Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 logging | 10 import logging |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 ('\nFailed to diff against upstream branch %s!\n\n' | 506 ('\nFailed to diff against upstream branch %s!\n\n' |
| 507 'This branch probably doesn\'t exist anymore. To reset the\n' | 507 'This branch probably doesn\'t exist anymore. To reset the\n' |
| 508 'tracking branch, please run\n' | 508 'tracking branch, please run\n' |
| 509 ' git branch --set-upstream %s trunk\n' | 509 ' git branch --set-upstream %s trunk\n' |
| 510 'replacing trunk with origin/master or the relevant branch') % | 510 'replacing trunk with origin/master or the relevant branch') % |
| 511 (upstream_branch, self.GetBranch())) | 511 (upstream_branch, self.GetBranch())) |
| 512 | 512 |
| 513 issue = ConvertToInteger(self.GetIssue()) | 513 issue = ConvertToInteger(self.GetIssue()) |
| 514 patchset = ConvertToInteger(self.GetPatchset()) | 514 patchset = ConvertToInteger(self.GetPatchset()) |
| 515 if issue: | 515 if issue: |
| 516 description = self.GetDescription() | 516 try: |
| 517 description = self.GetDescription() | |
| 518 except urllib2.HTTPError, e: | |
|
M-A Ruel
2012/01/04 17:56:51
I'd prefer to have this at line 448 so all calls w
| |
| 519 if e.code == 404: | |
| 520 DieWithError( | |
| 521 ('\nWhile fetching the description for issue %d, received a 404\n' | |
| 522 '(not found) error. It is likely that you deleted this issue\n' | |
| 523 'on the server. If this is the case, please run\n' | |
| 524 ' git cl issue 0\n' | |
| 525 'to clear the association with the deleted issue, and then run\n' | |
| 526 'this command again.') % issue) | |
| 527 else: | |
| 528 DieWithError('\nFailed to fetch description. HTTP error ' + e.code) | |
| 517 else: | 529 else: |
| 518 # If the change was never uploaded, use the log messages of all commits | 530 # If the change was never uploaded, use the log messages of all commits |
| 519 # up to the branch point, as git cl upload will prefill the description | 531 # up to the branch point, as git cl upload will prefill the description |
| 520 # with these log messages. | 532 # with these log messages. |
| 521 description = RunCommand(['git', 'log', '--pretty=format:%s%n%n%b', | 533 description = RunCommand(['git', 'log', '--pretty=format:%s%n%n%b', |
| 522 '%s...' % (upstream_branch)]).strip() | 534 '%s...' % (upstream_branch)]).strip() |
| 523 | 535 |
| 524 if not author: | 536 if not author: |
| 525 author = RunGit(['config', 'user.email']).strip() or None | 537 author = RunGit(['config', 'user.email']).strip() or None |
| 526 return presubmit_support.GitChange( | 538 return presubmit_support.GitChange( |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1416 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 1428 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
| 1417 | 1429 |
| 1418 # Not a known command. Default to help. | 1430 # Not a known command. Default to help. |
| 1419 GenUsage(parser, 'help') | 1431 GenUsage(parser, 'help') |
| 1420 return CMDhelp(parser, argv) | 1432 return CMDhelp(parser, argv) |
| 1421 | 1433 |
| 1422 | 1434 |
| 1423 if __name__ == '__main__': | 1435 if __name__ == '__main__': |
| 1424 fix_encoding.fix_encoding() | 1436 fix_encoding.fix_encoding() |
| 1425 sys.exit(main(sys.argv[1:])) | 1437 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |