Display line comments from all patchsets in change view
The change view did not display comments from previous patchsets, only comments associated with the patchset of the current message. This displays them from all patchsets, annotating them with the patchset number when it is different. Note, the line comments were correctly displayed in the diff view. Change-Id: Ieda0de0bb24800b9c3f577f339ca1338f2f1cc38
This commit is contained in:
parent
2df6a24693
commit
b6ba991215
@ -387,11 +387,11 @@ class ChangeButton(urwid.Button):
|
|||||||
self.change_view.app.error(e.message)
|
self.change_view.app.error(e.message)
|
||||||
|
|
||||||
class ChangeMessageBox(mywid.HyperText):
|
class ChangeMessageBox(mywid.HyperText):
|
||||||
def __init__(self, change_view, message):
|
def __init__(self, change_view, change, message):
|
||||||
super(ChangeMessageBox, self).__init__(u'')
|
super(ChangeMessageBox, self).__init__(u'')
|
||||||
self.change_view = change_view
|
self.change_view = change_view
|
||||||
self.app = change_view.app
|
self.app = change_view.app
|
||||||
self.refresh(message)
|
self.refresh(change, message)
|
||||||
|
|
||||||
def formatReply(self):
|
def formatReply(self):
|
||||||
text = self.message_text
|
text = self.message_text
|
||||||
@ -430,7 +430,7 @@ class ChangeMessageBox(mywid.HyperText):
|
|||||||
row = self.change_view.revision_rows[self.revision_key]
|
row = self.change_view.revision_rows[self.revision_key]
|
||||||
row.review_button.openReview(reply_text)
|
row.review_button.openReview(reply_text)
|
||||||
|
|
||||||
def refresh(self, message):
|
def refresh(self, change, message):
|
||||||
self.revision_key = message.revision.key
|
self.revision_key = message.revision.key
|
||||||
self.message_created = message.created
|
self.message_created = message.created
|
||||||
self.message_author = message.author_name
|
self.message_author = message.author_name
|
||||||
@ -476,14 +476,18 @@ class ChangeMessageBox(mywid.HyperText):
|
|||||||
comment_text = commentlink.run(self.app, comment_text)
|
comment_text = commentlink.run(self.app, comment_text)
|
||||||
|
|
||||||
inline_comments = {}
|
inline_comments = {}
|
||||||
for file in message.revision.files:
|
for revno, revision in enumerate(change.revisions):
|
||||||
|
for file in revision.files:
|
||||||
comments = [c for c in file.comments
|
comments = [c for c in file.comments
|
||||||
if c.author.id == message.author.id
|
if c.author.id == message.author.id
|
||||||
and c.created == message.created]
|
and c.created == message.created]
|
||||||
for comment in comments:
|
for comment in comments:
|
||||||
path = comment.file.path
|
path = comment.file.path
|
||||||
inline_comments.setdefault(path, [])
|
inline_comments.setdefault(path, [])
|
||||||
inline_comments[path].append((comment.line or 0, comment.message))
|
comment_ps = revno + 1
|
||||||
|
if comment_ps == message.revision.number:
|
||||||
|
comment_ps = None
|
||||||
|
inline_comments[path].append((comment_ps or 0, comment.line or 0, comment.message))
|
||||||
for v in inline_comments.values():
|
for v in inline_comments.values():
|
||||||
v.sort()
|
v.sort()
|
||||||
|
|
||||||
@ -491,11 +495,16 @@ class ChangeMessageBox(mywid.HyperText):
|
|||||||
comment_text.append(u'\n')
|
comment_text.append(u'\n')
|
||||||
for key, value in inline_comments.items():
|
for key, value in inline_comments.items():
|
||||||
comment_text.append(('filename-inline-comment', u'%s' % key))
|
comment_text.append(('filename-inline-comment', u'%s' % key))
|
||||||
for line, comment in value:
|
for patchset, line, comment in value:
|
||||||
if not line:
|
location_str = ''
|
||||||
comment_text.append(u'\n %s\n' % comment)
|
if patchset:
|
||||||
else:
|
location_str += "PS%i" % patchset
|
||||||
comment_text.append(u'\n %s: %s\n' % (line, comment))
|
if line: location_str += ", "
|
||||||
|
if line:
|
||||||
|
location_str += str(line)
|
||||||
|
if location_str:
|
||||||
|
location_str += ": "
|
||||||
|
comment_text.append(u'\n %s%s\n' % (location_str, comment))
|
||||||
|
|
||||||
self.set_text(text+comment_text)
|
self.set_text(text+comment_text)
|
||||||
|
|
||||||
@ -830,7 +839,7 @@ class ChangeView(urwid.WidgetWrap):
|
|||||||
for message in display_messages:
|
for message in display_messages:
|
||||||
row = self.message_rows.get(message.key)
|
row = self.message_rows.get(message.key)
|
||||||
if not row:
|
if not row:
|
||||||
box = ChangeMessageBox(self, message)
|
box = ChangeMessageBox(self, change, message)
|
||||||
row = urwid.Padding(box, width=80)
|
row = urwid.Padding(box, width=80)
|
||||||
self.listbox.body.insert(listbox_index, row)
|
self.listbox.body.insert(listbox_index, row)
|
||||||
self.message_rows[message.key] = row
|
self.message_rows[message.key] = row
|
||||||
|
Loading…
Reference in New Issue
Block a user