Add inline comments to change overview
The gerrit ui shows the inline comments on the change overview without having to open the diff screen. This is useful for following discussions on changes so add this to gertty as well. Change-Id: I976ec5584e978ce4aee7075bc45394193c104889
This commit is contained in:
parent
c20fef1dec
commit
56d63841f5
|
@ -18,6 +18,7 @@ DEFAULT_PALETTE={
|
|||
'error': ['light red', 'dark blue'],
|
||||
'table-header': ['white,bold', ''],
|
||||
'filename': ['light cyan', ''],
|
||||
'filename-inline-comment': ['dark cyan', ''],
|
||||
'focused-filename': ['light cyan,standout', ''],
|
||||
'positive-label': ['dark green', ''],
|
||||
'negative-label': ['dark red', ''],
|
||||
|
|
|
@ -446,6 +446,29 @@ class ChangeMessageBox(mywid.HyperText):
|
|||
comment_text = ['\n'.join(lines)]
|
||||
for commentlink in self.app.config.commentlinks:
|
||||
comment_text = commentlink.run(self.app, comment_text)
|
||||
|
||||
inline_comments = {}
|
||||
for file in message.revision.files:
|
||||
comments = [c for c in file.comments
|
||||
if c.author.id == message.author.id
|
||||
and c.created == message.created]
|
||||
for comment in comments:
|
||||
path = comment.file.path
|
||||
inline_comments.setdefault(path, [])
|
||||
inline_comments[path].append((comment.line, comment.message))
|
||||
for v in inline_comments.values():
|
||||
v.sort()
|
||||
|
||||
if inline_comments:
|
||||
comment_text.append(u'\n')
|
||||
for key, value in inline_comments.items():
|
||||
comment_text.append(('filename-inline-comment', u'%s' % key))
|
||||
for line, comment in value:
|
||||
if line is None:
|
||||
comment_text.append(u'\n %s' % comment)
|
||||
else:
|
||||
comment_text.append(u'\n %s: %s\n' % (line, comment))
|
||||
|
||||
self.set_text(text+comment_text)
|
||||
|
||||
class CommitMessageBox(mywid.HyperText):
|
||||
|
|
Loading…
Reference in New Issue