Commit 25a4ab43 authored by iannucci@chromium.org's avatar iannucci@chromium.org

Add patchset number on manual commit comment.

R=cmp@chromium.org, maruel@chromium.org


Review URL: https://chromiumcodereview.appspot.com/12276007

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@182861 0039d316-1c4b-4281-b951-d872f2087c98
parent 69aea165
......@@ -1045,7 +1045,9 @@ def CMDcommit(change_info, args):
elif revision:
change_info.description += "\nCommitted: " + revision
change_info.CloseIssue()
comment = "Committed manually as r%s" % revision
props = change_info.RpcServer().get_issue_properties(change_info.issue)
patch_num = len(props['patchsets'])
comment = "Committed patchset #%d manually as r%s" % (patch_num, revision)
comment += ' (presubmit successful).' if not bypassed else '.'
change_info.AddComment(comment)
return 0
......@@ -1111,7 +1113,7 @@ def CMDchange(args):
"---Repository Root: " + change_info.GetLocalRoot() + "\n"
"---Paths in this changelist (" + change_info.name + "):\n")
separator2 = "\n\n---Paths modified but not in any changelist:\n\n"
text = (description + separator1 + '\n' +
'\n'.join([f[0] + f[1] for f in change_info.GetFiles()]))
......
......@@ -1495,7 +1495,9 @@ def SendUpstream(parser, args, cmd):
print ('Closing issue '
'(you may be prompted for your codereview password)...')
cl.CloseIssue()
comment = "Committed manually as r%s" % revision
props = cl.RpcServer().get_issue_properties(cl.GetIssue())
patch_num = len(props['patchset'])
comment = "Committed patchset #%d manually as r%s" % (patch_num, revision)
comment += ' (presubmit successful).' if not options.bypass_hooks else '.'
cl.RpcServer().add_comment(cl.GetIssue(), comment)
cl.SetIssue(0)
......
......@@ -37,7 +37,7 @@ class GclTestsBase(SuperMoxTestBase):
def tearDown(self):
gcl.CODEREVIEW_SETTINGS = self.old_review_settings
def fakeChange(self, files=None):
def fakeChange(self, files=None): # pylint: disable=R0201
if files == None:
files = [('A', 'aa'), ('M', 'bb')]
......@@ -58,6 +58,11 @@ class GclTestsBase(SuperMoxTestBase):
change_info._deleted = False
change_info._comments_added = []
class RpcServer(object):
def get_issue_properties(self, *_): # pylint: disable=R0201
return { 'patchsets': [1337] }
change_info.RpcServer = RpcServer
def AddComment(comment):
# pylint: disable=W0212
change_info._comments_added.append(comment)
......@@ -595,7 +600,7 @@ class CMDCommitUnittest(GclTestsBase):
self.assertTrue(change_info._closed)
self.assertEqual(
change_info._comments_added,
["Committed manually as r12345 (presubmit successful)."])
["Committed patchset #1 manually as r12345 (presubmit successful)."])
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment