mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
git cl comments: Add --unresolved & improve --json-file
* Don't output to non-json format when --json-file is passed * Format individual comments as JSON when --json-file is used * Add "unresolved" field to comments * --unresolved flag will show only unresolved comments * Better error message when no issue is associated with the branch I intend to use this to have gemini-cli fix comments: https://chromium-review.googlesource.com/c/chromium/src/+/6944524 Change-Id: I3b4d594b065751a600661a89925c69ffbf22aed5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6944465 Reviewed-by: Scott Lee <ddoman@chromium.org> Commit-Queue: Andrew Grieve <agrieve@chromium.org>
This commit is contained in:
@@ -3305,57 +3305,84 @@ class TestGitCl(unittest.TestCase):
|
||||
]
|
||||
}),
|
||||
] * 2 + [(('write_json', 'output.json', [{
|
||||
u'date':
|
||||
u'2017-03-16 20:00:41.000000',
|
||||
u'message': (u'PTAL\n' + u'\n' + u'codereview.settings\n' +
|
||||
u' Base, Line 42: https://crrev.com/c/1/2/'
|
||||
u'codereview.settings#b42\n' +
|
||||
u' I removed this because it is bad\n'),
|
||||
u'autogenerated':
|
||||
False,
|
||||
u'approval':
|
||||
False,
|
||||
u'disapproval':
|
||||
False,
|
||||
u'sender':
|
||||
u'owner@example.com'
|
||||
'date': '2017-03-16 20:00:41.000000',
|
||||
'message': {
|
||||
'message':
|
||||
'PTAL',
|
||||
'comments': [{
|
||||
'path': 'codereview.settings',
|
||||
'line': 42,
|
||||
'patchset': 'Base',
|
||||
'unresolved': False,
|
||||
'content': 'I removed this because it is bad'
|
||||
}]
|
||||
},
|
||||
'sender': 'owner@example.com',
|
||||
'autogenerated': False,
|
||||
'approval': False,
|
||||
'disapproval': False
|
||||
}, {
|
||||
u'date':
|
||||
u'2017-03-17 05:19:37.500000',
|
||||
u'message':
|
||||
(u'Patch Set 2: Code-Review+1\n' + u'\n' + u'/COMMIT_MSG\n' +
|
||||
u' PS2, File comment: https://crrev.com/c/1/2//COMMIT_MSG#\n' +
|
||||
u' Please include a bug link\n'),
|
||||
u'autogenerated':
|
||||
False,
|
||||
u'approval':
|
||||
False,
|
||||
u'disapproval':
|
||||
False,
|
||||
u'sender':
|
||||
u'reviewer@example.com'
|
||||
'date': '2017-03-17 05:19:37.500000',
|
||||
'message': {
|
||||
'message':
|
||||
'Patch Set 2: Code-Review+1',
|
||||
'comments': [{
|
||||
'path': '/COMMIT_MSG',
|
||||
'line': 0,
|
||||
'patchset': 'PS2',
|
||||
'unresolved': False,
|
||||
'content': 'Please include a bug link'
|
||||
}]
|
||||
},
|
||||
'sender': 'reviewer@example.com',
|
||||
'autogenerated': False,
|
||||
'approval': False,
|
||||
'disapproval': False
|
||||
}]), '')]
|
||||
expected_comments_summary = [
|
||||
git_cl._CommentSummary(
|
||||
message=(u'PTAL\n' + u'\n' + u'codereview.settings\n' +
|
||||
u' Base, Line 42: https://crrev.com/c/1/2/' +
|
||||
u'codereview.settings#b42\n' +
|
||||
u'codereview.settings#b42 (resolved)\n' +
|
||||
u' I removed this because it is bad\n'),
|
||||
message_json={
|
||||
'message':
|
||||
'PTAL',
|
||||
'comments': [{
|
||||
'path': 'codereview.settings',
|
||||
'line': 42,
|
||||
'patchset': 'Base',
|
||||
'unresolved': False,
|
||||
'content': 'I removed this because it is bad'
|
||||
}]
|
||||
},
|
||||
date=datetime.datetime(2017, 3, 16, 20, 0, 41, 0),
|
||||
autogenerated=False,
|
||||
disapproval=False,
|
||||
approval=False,
|
||||
sender=u'owner@example.com'),
|
||||
git_cl._CommentSummary(message=(
|
||||
u'Patch Set 2: Code-Review+1\n' + u'\n' + u'/COMMIT_MSG\n' +
|
||||
u' PS2, File comment: https://crrev.com/c/1/2//COMMIT_MSG#\n' +
|
||||
u' Please include a bug link\n'),
|
||||
date=datetime.datetime(
|
||||
2017, 3, 17, 5, 19, 37, 500000),
|
||||
autogenerated=False,
|
||||
disapproval=False,
|
||||
approval=False,
|
||||
sender=u'reviewer@example.com'),
|
||||
git_cl._CommentSummary(
|
||||
message=(u'Patch Set 2: Code-Review+1\n' + u'\n' +
|
||||
u'/COMMIT_MSG\n' +
|
||||
u' PS2, File comment: https://crrev.com/c/1/2/'
|
||||
u'/COMMIT_MSG# (resolved)\n' +
|
||||
u' Please include a bug link\n'),
|
||||
message_json={
|
||||
'message':
|
||||
'Patch Set 2: Code-Review+1',
|
||||
'comments': [{
|
||||
'path': '/COMMIT_MSG',
|
||||
'line': 0,
|
||||
'patchset': 'PS2',
|
||||
'unresolved': False,
|
||||
'content': 'Please include a bug link'
|
||||
}]
|
||||
},
|
||||
date=datetime.datetime(2017, 3, 17, 5, 19, 37, 500000),
|
||||
autogenerated=False,
|
||||
disapproval=False,
|
||||
approval=False,
|
||||
sender=u'reviewer@example.com'),
|
||||
]
|
||||
cl = git_cl.Changelist(issue=1, branchref='refs/heads/foo')
|
||||
self.assertEqual(cl.GetCommentsSummary(), expected_comments_summary)
|
||||
|
||||
Reference in New Issue
Block a user