Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: gcl.py

Issue 12276007: Add patchset number on manual commit comment. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | git_cl.py » ('j') | git_cl.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """\ 6 """\
7 Wrapper script around Rietveld's upload.py that simplifies working with groups 7 Wrapper script around Rietveld's upload.py that simplifies working with groups
8 of files. 8 of files.
9 """ 9 """
10 10
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 391
392 def GetIssueDescription(self): 392 def GetIssueDescription(self):
393 """Returns the issue description from Rietveld.""" 393 """Returns the issue description from Rietveld."""
394 return self.SendToRietveld('/%d/description' % self.issue) 394 return self.SendToRietveld('/%d/description' % self.issue)
395 395
396 def AddComment(self, comment): 396 def AddComment(self, comment):
397 """Adds a comment for an issue on Rietveld. 397 """Adds a comment for an issue on Rietveld.
398 As a side effect, this will email everyone associated with the issue.""" 398 As a side effect, this will email everyone associated with the issue."""
399 return self.RpcServer().add_comment(self.issue, comment) 399 return self.RpcServer().add_comment(self.issue, comment)
400 400
401 def GetIssueProperties(self, messages=False):
402 """Returns the issue properties as a JSON-style object.
403 Can optionally retrieve the messages as well."""
404 return self.RpcServer().get_issue_properties(self.issue, messages)
405
401 def PrimeLint(self): 406 def PrimeLint(self):
402 """Do background work on Rietveld to lint the file so that the results are 407 """Do background work on Rietveld to lint the file so that the results are
403 ready when the issue is viewed.""" 408 ready when the issue is viewed."""
404 if self.issue and self.patchset: 409 if self.issue and self.patchset:
405 self.SendToRietveld('/lint/issue%s_%s' % (self.issue, self.patchset), 410 self.SendToRietveld('/lint/issue%s_%s' % (self.issue, self.patchset),
406 timeout=10) 411 timeout=10)
407 412
408 def SendToRietveld(self, request_path, timeout=None, **kwargs): 413 def SendToRietveld(self, request_path, timeout=None, **kwargs):
409 """Send a POST/GET to Rietveld. Returns the response body.""" 414 """Send a POST/GET to Rietveld. Returns the response body."""
410 try: 415 try:
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 if change_info.issue: 1043 if change_info.issue:
1039 revision = re.compile(".*?\nCommitted revision (\d+)", 1044 revision = re.compile(".*?\nCommitted revision (\d+)",
1040 re.DOTALL).match(output).group(1) 1045 re.DOTALL).match(output).group(1)
1041 viewvc_url = GetCodeReviewSetting('VIEW_VC') 1046 viewvc_url = GetCodeReviewSetting('VIEW_VC')
1042 change_info.description += '\n' 1047 change_info.description += '\n'
1043 if viewvc_url and revision: 1048 if viewvc_url and revision:
1044 change_info.description += "\nCommitted: " + viewvc_url + revision 1049 change_info.description += "\nCommitted: " + viewvc_url + revision
1045 elif revision: 1050 elif revision:
1046 change_info.description += "\nCommitted: " + revision 1051 change_info.description += "\nCommitted: " + revision
1047 change_info.CloseIssue() 1052 change_info.CloseIssue()
1048 comment = "Committed manually as r%s" % revision 1053 patch_num = len(change_info.GetIssueProperties()['patchsets'])
M-A Ruel 2013/02/15 22:43:34 I'd be fine with: change_info.RpcServer().get_issu
iannucci 2013/02/15 23:09:00 Done. (Though it made the test a little (more) awk
M-A Ruel 2013/02/15 23:12:08 As you prefer
1054 comment = "Committed patch #%d manually as r%s" % (patch_num, revision)
M-A Ruel 2013/02/15 22:43:34 s/patch/patchset/
iannucci 2013/02/15 23:09:00 Done.
1049 comment += ' (presubmit successful).' if not bypassed else '.' 1055 comment += ' (presubmit successful).' if not bypassed else '.'
1050 change_info.AddComment(comment) 1056 change_info.AddComment(comment)
1051 return 0 1057 return 0
1052 1058
1053 1059
1054 def CMDchange(args): 1060 def CMDchange(args):
1055 """Creates or edits a changelist. 1061 """Creates or edits a changelist.
1056 1062
1057 Only scans the current directory and subdirectories. 1063 Only scans the current directory and subdirectories.
1058 """ 1064 """
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 file_re = re.compile(r"^[a-z].+\Z", re.IGNORECASE) 1110 file_re = re.compile(r"^[a-z].+\Z", re.IGNORECASE)
1105 affected_files = [x for x in other_files if file_re.match(x[0])] 1111 affected_files = [x for x in other_files if file_re.match(x[0])]
1106 unaffected_files = [x for x in other_files if not file_re.match(x[0])] 1112 unaffected_files = [x for x in other_files if not file_re.match(x[0])]
1107 1113
1108 description = description.rstrip() + '\n' 1114 description = description.rstrip() + '\n'
1109 1115
1110 separator1 = ("\n---All lines above this line become the description.\n" 1116 separator1 = ("\n---All lines above this line become the description.\n"
1111 "---Repository Root: " + change_info.GetLocalRoot() + "\n" 1117 "---Repository Root: " + change_info.GetLocalRoot() + "\n"
1112 "---Paths in this changelist (" + change_info.name + "):\n") 1118 "---Paths in this changelist (" + change_info.name + "):\n")
1113 separator2 = "\n\n---Paths modified but not in any changelist:\n\n" 1119 separator2 = "\n\n---Paths modified but not in any changelist:\n\n"
1114 1120
1115 text = (description + separator1 + '\n' + 1121 text = (description + separator1 + '\n' +
1116 '\n'.join([f[0] + f[1] for f in change_info.GetFiles()])) 1122 '\n'.join([f[0] + f[1] for f in change_info.GetFiles()]))
1117 1123
1118 if change_info.Exists(): 1124 if change_info.Exists():
1119 text += (separator2 + 1125 text += (separator2 +
1120 '\n'.join([f[0] + f[1] for f in affected_files]) + '\n') 1126 '\n'.join([f[0] + f[1] for f in affected_files]) + '\n')
1121 else: 1127 else:
1122 text += ('\n'.join([f[0] + f[1] for f in affected_files]) + '\n' + 1128 text += ('\n'.join([f[0] + f[1] for f in affected_files]) + '\n' +
1123 separator2) 1129 separator2)
1124 text += '\n'.join([f[0] + f[1] for f in unaffected_files]) + '\n' 1130 text += '\n'.join([f[0] + f[1] for f in unaffected_files]) + '\n'
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 raise 1473 raise
1468 print >> sys.stderr, ( 1474 print >> sys.stderr, (
1469 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 1475 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
1470 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) 1476 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))
1471 return 1 1477 return 1
1472 1478
1473 1479
1474 if __name__ == "__main__": 1480 if __name__ == "__main__":
1475 fix_encoding.fix_encoding() 1481 fix_encoding.fix_encoding()
1476 sys.exit(main(sys.argv[1:])) 1482 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | git_cl.py » ('j') | git_cl.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698