Fix some diff comment display errors
Change-Id: I0106e302feb6d3c02faa3fa7b6faf7907e833d5f
This commit is contained in:
parent
5585ba6786
commit
d924789cf9
|
@ -43,15 +43,18 @@ palette=[('reversed', 'default,standout', ''),
|
||||||
('reversed-added-word', 'light green,standout', ''),
|
('reversed-added-word', 'light green,standout', ''),
|
||||||
('reversed-nonexistent', 'default,standout', ''),
|
('reversed-nonexistent', 'default,standout', ''),
|
||||||
('draft-comment', 'default', 'dark gray'),
|
('draft-comment', 'default', 'dark gray'),
|
||||||
('comment', 'white', 'dark gray'),
|
('comment', 'light gray', 'dark gray'),
|
||||||
|
('comment-name', 'white', 'dark gray'),
|
||||||
# Change view
|
# Change view
|
||||||
('change-data', 'light cyan', ''),
|
('change-data', 'light cyan', ''),
|
||||||
('change-header', 'light blue', ''),
|
('change-header', 'light blue', ''),
|
||||||
('revision-name', 'light blue', ''),
|
('revision-name', 'light blue', ''),
|
||||||
('revision-commit', 'dark blue', ''),
|
('revision-commit', 'dark blue', ''),
|
||||||
|
('revision-comments', 'default', ''),
|
||||||
('revision-drafts', 'dark red', ''),
|
('revision-drafts', 'dark red', ''),
|
||||||
('reversed-revision-name', 'light blue,standout', ''),
|
('reversed-revision-name', 'light blue,standout', ''),
|
||||||
('reversed-revision-commit', 'dark blue,standout', ''),
|
('reversed-revision-commit', 'dark blue,standout', ''),
|
||||||
|
('reversed-revision-comments', 'default,standout', ''),
|
||||||
('reversed-revision-drafts', 'dark red,standout', ''),
|
('reversed-revision-drafts', 'dark red,standout', ''),
|
||||||
('change-message-name', 'light blue', ''),
|
('change-message-name', 'light blue', ''),
|
||||||
('change-message-header', 'dark blue', ''),
|
('change-message-header', 'dark blue', ''),
|
||||||
|
|
|
@ -150,6 +150,7 @@ class RevisionRow(urwid.WidgetWrap):
|
||||||
revision_focus_map = {
|
revision_focus_map = {
|
||||||
'revision-name': 'reversed-revision-name',
|
'revision-name': 'reversed-revision-name',
|
||||||
'revision-commit': 'reversed-revision-commit',
|
'revision-commit': 'reversed-revision-commit',
|
||||||
|
'revision-comments': 'reversed-revision-comments',
|
||||||
'revision-drafts': 'reversed-revision-drafts',
|
'revision-drafts': 'reversed-revision-drafts',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,6 +165,8 @@ class RevisionRow(urwid.WidgetWrap):
|
||||||
('revision-commit', revision.commit)]
|
('revision-commit', revision.commit)]
|
||||||
if len(revision.pending_comments):
|
if len(revision.pending_comments):
|
||||||
line.append(('revision-drafts', ' (%s drafts)' % len(revision.pending_comments)))
|
line.append(('revision-drafts', ' (%s drafts)' % len(revision.pending_comments)))
|
||||||
|
if len(revision.comments):
|
||||||
|
line.append(('revision-comments', ' (%s inline comments)' % len(revision.comments)))
|
||||||
self.title = mywid.TextButton(line, on_press = self.expandContract)
|
self.title = mywid.TextButton(line, on_press = self.expandContract)
|
||||||
stats = repo.diffstat(revision.parent, revision.commit)
|
stats = repo.diffstat(revision.parent, revision.commit)
|
||||||
rows = []
|
rows = []
|
||||||
|
|
|
@ -59,12 +59,16 @@ class DiffComment(urwid.Columns):
|
||||||
def __init__(self, context, old, new):
|
def __init__(self, context, old, new):
|
||||||
super(DiffComment, self).__init__([])
|
super(DiffComment, self).__init__([])
|
||||||
self.context = context
|
self.context = context
|
||||||
self.old = urwid.AttrMap(urwid.Text(old), 'comment')
|
oldt = urwid.Text(old)
|
||||||
self.new = urwid.AttrMap(urwid.Text(new), 'comment')
|
newt = urwid.Text(new)
|
||||||
|
if old:
|
||||||
|
oldt = urwid.AttrMap(oldt, 'comment')
|
||||||
|
if new:
|
||||||
|
newt = urwid.AttrMap(newt, 'comment')
|
||||||
self.contents.append((urwid.Text(u''), ('given', 4, False)))
|
self.contents.append((urwid.Text(u''), ('given', 4, False)))
|
||||||
self.contents.append((self.old, ('weight', 1, False)))
|
self.contents.append((oldt, ('weight', 1, False)))
|
||||||
self.contents.append((urwid.Text(u''), ('given', 4, False)))
|
self.contents.append((urwid.Text(u''), ('given', 4, False)))
|
||||||
self.contents.append((self.new, ('weight', 1, False)))
|
self.contents.append((newt, ('weight', 1, False)))
|
||||||
|
|
||||||
class DiffLine(urwid.Button):
|
class DiffLine(urwid.Button):
|
||||||
def selectable(self):
|
def selectable(self):
|
||||||
|
@ -129,7 +133,9 @@ class DiffView(urwid.WidgetWrap):
|
||||||
key += '-' + str(comment.line)
|
key += '-' + str(comment.line)
|
||||||
key += '-' + str(comment.file)
|
key += '-' + str(comment.file)
|
||||||
comment_list = comment_lists.get(key, [])
|
comment_list = comment_lists.get(key, [])
|
||||||
comment_list.append((comment.key, comment.message))
|
message = [('comment-name', comment.name),
|
||||||
|
('comment', u': '+comment.message)]
|
||||||
|
comment_list.append((comment.key, message))
|
||||||
comment_lists[key] = comment_list
|
comment_lists[key] = comment_list
|
||||||
repo = self.app.getRepo(self.project_name)
|
repo = self.app.getRepo(self.project_name)
|
||||||
self._w.contents.append((app.header, ('pack', 1)))
|
self._w.contents.append((app.header, ('pack', 1)))
|
||||||
|
@ -154,7 +160,7 @@ class DiffView(urwid.WidgetWrap):
|
||||||
# see if there are any comments for this line
|
# see if there are any comments for this line
|
||||||
key = 'old-%s-%s' % (old[0], diff.oldname)
|
key = 'old-%s-%s' % (old[0], diff.oldname)
|
||||||
old_list = comment_lists.get(key, [])
|
old_list = comment_lists.get(key, [])
|
||||||
key = 'new-%s-%s' % (old[0], diff.oldname)
|
key = 'new-%s-%s' % (new[0], diff.newname)
|
||||||
new_list = comment_lists.get(key, [])
|
new_list = comment_lists.get(key, [])
|
||||||
while old_list or new_list:
|
while old_list or new_list:
|
||||||
old_comment_key = new_comment_key = None
|
old_comment_key = new_comment_key = None
|
||||||
|
|
Loading…
Reference in New Issue