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

Side by Side Diff: gcl.py

Issue 12047089: Make gcl commit/git cl dcommit append a commit notification to rietveld. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Pull AddComment from git_cl.py 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') | no next file with comments »
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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 """Sets the description for an issue on Rietveld.""" 386 """Sets the description for an issue on Rietveld."""
387 data = [("description", self.description),] 387 data = [("description", self.description),]
388 ctype, body = upload.EncodeMultipartFormData(data, []) 388 ctype, body = upload.EncodeMultipartFormData(data, [])
389 self.SendToRietveld('/%d/description' % self.issue, payload=body, 389 self.SendToRietveld('/%d/description' % self.issue, payload=body,
390 content_type=ctype) 390 content_type=ctype)
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):
397 """Adds a comment for an issue on Rietveld.
398 As a side effect, this will email everyone associated with the issue."""
399 return self.RpcServer().add_comment(self.issue, comment)
400
396 def PrimeLint(self): 401 def PrimeLint(self):
397 """Do background work on Rietveld to lint the file so that the results are 402 """Do background work on Rietveld to lint the file so that the results are
398 ready when the issue is viewed.""" 403 ready when the issue is viewed."""
399 if self.issue and self.patchset: 404 if self.issue and self.patchset:
400 self.SendToRietveld('/lint/issue%s_%s' % (self.issue, self.patchset), 405 self.SendToRietveld('/lint/issue%s_%s' % (self.issue, self.patchset),
401 timeout=10) 406 timeout=10)
402 407
403 def SendToRietveld(self, request_path, timeout=None, **kwargs): 408 def SendToRietveld(self, request_path, timeout=None, **kwargs):
404 """Send a POST/GET to Rietveld. Returns the response body.""" 409 """Send a POST/GET to Rietveld. Returns the response body."""
405 try: 410 try:
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 980
976 981
977 @need_change_and_args 982 @need_change_and_args
978 @attrs(usage='[--no_presubmit]') 983 @attrs(usage='[--no_presubmit]')
979 def CMDcommit(change_info, args): 984 def CMDcommit(change_info, args):
980 """Commits the changelist to the repository.""" 985 """Commits the changelist to the repository."""
981 if not change_info.GetFiles(): 986 if not change_info.GetFiles():
982 print "Nothing to commit, changelist is empty." 987 print "Nothing to commit, changelist is empty."
983 return 1 988 return 1
984 989
990 # OptionallyDoPresubmitChecks has a side-effect which eats these flags.
991 bypassed = '--no_presubmit' in args or '--force' in args
985 output = OptionallyDoPresubmitChecks(change_info, True, args) 992 output = OptionallyDoPresubmitChecks(change_info, True, args)
986 if not output.should_continue(): 993 if not output.should_continue():
987 return 1 994 return 1
988 995
989 # We face a problem with svn here: Let's say change 'bleh' modifies 996 # We face a problem with svn here: Let's say change 'bleh' modifies
990 # svn:ignore on dir1\. but another unrelated change 'pouet' modifies 997 # svn:ignore on dir1\. but another unrelated change 'pouet' modifies
991 # dir1\foo.cc. When the user `gcl commit bleh`, foo.cc is *also committed*. 998 # dir1\foo.cc. When the user `gcl commit bleh`, foo.cc is *also committed*.
992 # The only fix is to use --non-recursive but that has its issues too: 999 # The only fix is to use --non-recursive but that has its issues too:
993 # Let's say if dir1 is deleted, --non-recursive must *not* be used otherwise 1000 # Let's say if dir1 is deleted, --non-recursive must *not* be used otherwise
994 # you'll get "svn: Cannot non-recursively commit a directory deletion of a 1001 # you'll get "svn: Cannot non-recursively commit a directory deletion of a
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 if change_info.issue: 1038 if change_info.issue:
1032 revision = re.compile(".*?\nCommitted revision (\d+)", 1039 revision = re.compile(".*?\nCommitted revision (\d+)",
1033 re.DOTALL).match(output).group(1) 1040 re.DOTALL).match(output).group(1)
1034 viewvc_url = GetCodeReviewSetting('VIEW_VC') 1041 viewvc_url = GetCodeReviewSetting('VIEW_VC')
1035 change_info.description += '\n' 1042 change_info.description += '\n'
1036 if viewvc_url and revision: 1043 if viewvc_url and revision:
1037 change_info.description += "\nCommitted: " + viewvc_url + revision 1044 change_info.description += "\nCommitted: " + viewvc_url + revision
1038 elif revision: 1045 elif revision:
1039 change_info.description += "\nCommitted: " + revision 1046 change_info.description += "\nCommitted: " + revision
1040 change_info.CloseIssue() 1047 change_info.CloseIssue()
1048 comment = "Committed manually as r%s" % revision
1049 comment += ' (presubmit successful).' if not bypassed else '.'
1050 change_info.AddComment(comment)
1041 return 0 1051 return 0
1042 1052
1043 1053
1044 def CMDchange(args): 1054 def CMDchange(args):
1045 """Creates or edits a changelist. 1055 """Creates or edits a changelist.
1046 1056
1047 Only scans the current directory and subdirectories. 1057 Only scans the current directory and subdirectories.
1048 """ 1058 """
1049 # Verify the user is running the change command from a read-write checkout. 1059 # Verify the user is running the change command from a read-write checkout.
1050 svn_info = SVN.CaptureLocalInfo([], '.') 1060 svn_info = SVN.CaptureLocalInfo([], '.')
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 raise 1467 raise
1458 print >> sys.stderr, ( 1468 print >> sys.stderr, (
1459 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 1469 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
1460 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) 1470 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))
1461 return 1 1471 return 1
1462 1472
1463 1473
1464 if __name__ == "__main__": 1474 if __name__ == "__main__":
1465 fix_encoding.fix_encoding() 1475 fix_encoding.fix_encoding()
1466 sys.exit(main(sys.argv[1:])) 1476 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | git_cl.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698