OLD | NEW |
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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 try: | 706 try: |
707 return presubmit_support.DoPresubmitChecks(change, committing, | 707 return presubmit_support.DoPresubmitChecks(change, committing, |
708 verbose=verbose, output_stream=sys.stdout, input_stream=sys.stdin, | 708 verbose=verbose, output_stream=sys.stdout, input_stream=sys.stdin, |
709 default_presubmit=None, may_prompt=may_prompt, | 709 default_presubmit=None, may_prompt=may_prompt, |
710 rietveld_obj=self.RpcServer()) | 710 rietveld_obj=self.RpcServer()) |
711 except presubmit_support.PresubmitFailure, e: | 711 except presubmit_support.PresubmitFailure, e: |
712 DieWithError( | 712 DieWithError( |
713 ('%s\nMaybe your depot_tools is out of date?\n' | 713 ('%s\nMaybe your depot_tools is out of date?\n' |
714 'If all fails, contact maruel@') % e) | 714 'If all fails, contact maruel@') % e) |
715 | 715 |
| 716 def UpdateDescription(self, description): |
| 717 self.description = description |
| 718 return self.RpcServer().update_description( |
| 719 self.GetIssue(), self.description) |
| 720 |
716 def CloseIssue(self): | 721 def CloseIssue(self): |
717 """Updates the description and closes the issue.""" | 722 """Updates the description and closes the issue.""" |
718 issue = self.GetIssue() | 723 return self.RpcServer().close_issue(self.GetIssue()) |
719 self.RpcServer().update_description(issue, self.description) | |
720 return self.RpcServer().close_issue(issue) | |
721 | 724 |
722 def SetFlag(self, flag, value): | 725 def SetFlag(self, flag, value): |
723 """Patchset must match.""" | 726 """Patchset must match.""" |
724 if not self.GetPatchset(): | 727 if not self.GetPatchset(): |
725 DieWithError('The patchset needs to match. Send another patchset.') | 728 DieWithError('The patchset needs to match. Send another patchset.') |
726 try: | 729 try: |
727 return self.RpcServer().set_flag( | 730 return self.RpcServer().set_flag( |
728 self.GetIssue(), self.GetPatchset(), flag, value) | 731 self.GetIssue(), self.GetPatchset(), flag, value) |
729 except urllib2.HTTPError, e: | 732 except urllib2.HTTPError, e: |
730 if e.code == 404: | 733 if e.code == 404: |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 revision = match[0].group(2) | 1508 revision = match[0].group(2) |
1506 else: | 1509 else: |
1507 return 1 | 1510 return 1 |
1508 viewvc_url = settings.GetViewVCUrl() | 1511 viewvc_url = settings.GetViewVCUrl() |
1509 if viewvc_url and revision: | 1512 if viewvc_url and revision: |
1510 cl.description += ('\n\nCommitted: ' + viewvc_url + revision) | 1513 cl.description += ('\n\nCommitted: ' + viewvc_url + revision) |
1511 elif revision: | 1514 elif revision: |
1512 cl.description += ('\n\nCommitted: ' + revision) | 1515 cl.description += ('\n\nCommitted: ' + revision) |
1513 print ('Closing issue ' | 1516 print ('Closing issue ' |
1514 '(you may be prompted for your codereview password)...') | 1517 '(you may be prompted for your codereview password)...') |
| 1518 cl.UpdateDescription(cl.description) |
1515 cl.CloseIssue() | 1519 cl.CloseIssue() |
1516 props = cl.RpcServer().get_issue_properties(cl.GetIssue(), False) | 1520 props = cl.RpcServer().get_issue_properties(cl.GetIssue(), False) |
1517 patch_num = len(props['patchsets']) | 1521 patch_num = len(props['patchsets']) |
1518 comment = "Committed patchset #%d manually as r%s" % (patch_num, revision) | 1522 comment = "Committed patchset #%d manually as r%s" % (patch_num, revision) |
1519 comment += ' (presubmit successful).' if not options.bypass_hooks else '.' | 1523 comment += ' (presubmit successful).' if not options.bypass_hooks else '.' |
1520 cl.RpcServer().add_comment(cl.GetIssue(), comment) | 1524 cl.RpcServer().add_comment(cl.GetIssue(), comment) |
1521 cl.SetIssue(0) | 1525 cl.SetIssue(0) |
1522 | 1526 |
1523 if retcode == 0: | 1527 if retcode == 0: |
1524 hook = POSTUPSTREAM_HOOK_PATTERN % cmd | 1528 hook = POSTUPSTREAM_HOOK_PATTERN % cmd |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 1905 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
1902 | 1906 |
1903 # Not a known command. Default to help. | 1907 # Not a known command. Default to help. |
1904 GenUsage(parser, 'help') | 1908 GenUsage(parser, 'help') |
1905 return CMDhelp(parser, argv) | 1909 return CMDhelp(parser, argv) |
1906 | 1910 |
1907 | 1911 |
1908 if __name__ == '__main__': | 1912 if __name__ == '__main__': |
1909 fix_encoding.fix_encoding() | 1913 fix_encoding.fix_encoding() |
1910 sys.exit(main(sys.argv[1:])) | 1914 sys.exit(main(sys.argv[1:])) |
OLD | NEW |