Browse Source

Merge "Fix some diff comment display errors"

changes/91/391991/1
Jenkins 8 years ago committed by Gerrit Code Review
parent
commit
c82f98cc03
  1. 5
      gertty/gertty.py
  2. 3
      gertty/view/change.py
  3. 18
      gertty/view/diff.py

5
gertty/gertty.py

@ -43,15 +43,18 @@ palette=[('reversed', 'default,standout', ''),
('reversed-added-word', 'light green,standout', ''),
('reversed-nonexistent', 'default,standout', ''),
('draft-comment', 'default', 'dark gray'),
('comment', 'white', 'dark gray'),
('comment', 'light gray', 'dark gray'),
('comment-name', 'white', 'dark gray'),
# Change view
('change-data', 'light cyan', ''),
('change-header', 'light blue', ''),
('revision-name', 'light blue', ''),
('revision-commit', 'dark blue', ''),
('revision-comments', 'default', ''),
('revision-drafts', 'dark red', ''),
('reversed-revision-name', 'light blue,standout', ''),
('reversed-revision-commit', 'dark blue,standout', ''),
('reversed-revision-comments', 'default,standout', ''),
('reversed-revision-drafts', 'dark red,standout', ''),
('change-message-name', 'light blue', ''),
('change-message-header', 'dark blue', ''),

3
gertty/view/change.py

@ -150,6 +150,7 @@ class RevisionRow(urwid.WidgetWrap):
revision_focus_map = {
'revision-name': 'reversed-revision-name',
'revision-commit': 'reversed-revision-commit',
'revision-comments': 'reversed-revision-comments',
'revision-drafts': 'reversed-revision-drafts',
}
@ -164,6 +165,8 @@ class RevisionRow(urwid.WidgetWrap):
('revision-commit', revision.commit)]
if 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)
stats = repo.diffstat(revision.parent, revision.commit)
rows = []

18
gertty/view/diff.py

@ -59,12 +59,16 @@ class DiffComment(urwid.Columns):
def __init__(self, context, old, new):
super(DiffComment, self).__init__([])
self.context = context
self.old = urwid.AttrMap(urwid.Text(old), 'comment')
self.new = urwid.AttrMap(urwid.Text(new), 'comment')
oldt = urwid.Text(old)
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((self.old, ('weight', 1, False)))
self.contents.append((oldt, ('weight', 1, 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):
def selectable(self):
@ -129,7 +133,9 @@ class DiffView(urwid.WidgetWrap):
key += '-' + str(comment.line)
key += '-' + str(comment.file)
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
repo = self.app.getRepo(self.project_name)
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
key = 'old-%s-%s' % (old[0], diff.oldname)
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, [])
while old_list or new_list:
old_comment_key = new_comment_key = None

Loading…
Cancel
Save