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

Side by Side Diff: git_cl.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: Add a helpful note when presubmits were run on the commit 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 | « gcl.py ('k') | tests/gcl_unittest.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 # Copyright (C) 2008 Evan Martin <martine@danga.com> 6 # Copyright (C) 2008 Evan Martin <martine@danga.com>
7 7
8 """A git-command for integrating reviews on Rietveld.""" 8 """A git-command for integrating reviews on Rietveld."""
9 9
10 import json 10 import json
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 else: 605 else:
606 DieWithError( 606 DieWithError(
607 '\nFailed to fetch issue description. HTTP error ' + e.code) 607 '\nFailed to fetch issue description. HTTP error ' + e.code)
608 self.has_description = True 608 self.has_description = True
609 if pretty: 609 if pretty:
610 wrapper = textwrap.TextWrapper() 610 wrapper = textwrap.TextWrapper()
611 wrapper.initial_indent = wrapper.subsequent_indent = ' ' 611 wrapper.initial_indent = wrapper.subsequent_indent = ' '
612 return wrapper.fill(self.description) 612 return wrapper.fill(self.description)
613 return self.description 613 return self.description
614 614
615 def AddComment(self, comment):
M-A Ruel 2013/01/25 23:28:43 This method doesn't add much, you can as well just
iannucci 2013/01/25 23:33:00 Ok, sgtm. I wasn't sure about consistency/style. S
M-A Ruel 2013/01/25 23:47:10 gcl and git_cl.py are completely separate, no need
616 """Adds a comment for an issue on Rietveld.
617 As a side effect, this will email everyone associated with the issue."""
618 return self.RpcServer().add_comment(self.GetIssue(), comment)
619
615 def GetPatchset(self): 620 def GetPatchset(self):
616 """Returns the patchset number as a int or None if not set.""" 621 """Returns the patchset number as a int or None if not set."""
617 if not self.has_patchset: 622 if not self.has_patchset:
618 patchset = RunGit(['config', self._PatchsetSetting()], 623 patchset = RunGit(['config', self._PatchsetSetting()],
619 error_ok=True).strip() 624 error_ok=True).strip()
620 if patchset: 625 if patchset:
621 self.patchset = int(patchset) 626 self.patchset = int(patchset)
622 else: 627 else:
623 self.patchset = None 628 self.patchset = None
624 self.has_patchset = True 629 self.has_patchset = True
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 else: 1493 else:
1489 return 1 1494 return 1
1490 viewvc_url = settings.GetViewVCUrl() 1495 viewvc_url = settings.GetViewVCUrl()
1491 if viewvc_url and revision: 1496 if viewvc_url and revision:
1492 cl.description += ('\n\nCommitted: ' + viewvc_url + revision) 1497 cl.description += ('\n\nCommitted: ' + viewvc_url + revision)
1493 elif revision: 1498 elif revision:
1494 cl.description += ('\n\nCommitted: ' + revision) 1499 cl.description += ('\n\nCommitted: ' + revision)
1495 print ('Closing issue ' 1500 print ('Closing issue '
1496 '(you may be prompted for your codereview password)...') 1501 '(you may be prompted for your codereview password)...')
1497 cl.CloseIssue() 1502 cl.CloseIssue()
1503 comment = "Committed manually as r%s" % revision
1504 comment += ' (presubmit successful).' if not options.bypass_hooks else '.'
1505 cl.AddComment(comment)
1498 cl.SetIssue(0) 1506 cl.SetIssue(0)
1499 1507
1500 if retcode == 0: 1508 if retcode == 0:
1501 hook = POSTUPSTREAM_HOOK_PATTERN % cmd 1509 hook = POSTUPSTREAM_HOOK_PATTERN % cmd
1502 if os.path.isfile(hook): 1510 if os.path.isfile(hook):
1503 RunCommand([hook, base_branch], error_ok=True) 1511 RunCommand([hook, base_branch], error_ok=True)
1504 1512
1505 return 0 1513 return 0
1506 1514
1507 1515
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 1874 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
1867 1875
1868 # Not a known command. Default to help. 1876 # Not a known command. Default to help.
1869 GenUsage(parser, 'help') 1877 GenUsage(parser, 'help')
1870 return CMDhelp(parser, argv) 1878 return CMDhelp(parser, argv)
1871 1879
1872 1880
1873 if __name__ == '__main__': 1881 if __name__ == '__main__':
1874 fix_encoding.fix_encoding() 1882 fix_encoding.fix_encoding()
1875 sys.exit(main(sys.argv[1:])) 1883 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « gcl.py ('k') | tests/gcl_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698