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

Side by Side Diff: git_cl.py

Issue 9091009: Provide a friendlier error message after Rietveld issue deletion. (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: '' Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 self.GetIssue() 439 self.GetIssue()
440 return self.rietveld_server 440 return self.rietveld_server
441 441
442 def GetIssueURL(self): 442 def GetIssueURL(self):
443 """Get the URL for a particular issue.""" 443 """Get the URL for a particular issue."""
444 return '%s/%s' % (self.GetRietveldServer(), self.GetIssue()) 444 return '%s/%s' % (self.GetRietveldServer(), self.GetIssue())
445 445
446 def GetDescription(self, pretty=False): 446 def GetDescription(self, pretty=False):
447 if not self.has_description: 447 if not self.has_description:
448 if self.GetIssue(): 448 if self.GetIssue():
449 self.description = self.RpcServer().get_description( 449 issue = int(self.GetIssue())
450 int(self.GetIssue())).strip() 450 try:
451 self.description = self.RpcServer().get_description(issue).strip()
452 except urllib2.HTTPError, e:
453 if e.code == 404:
454 DieWithError(
455 ('\nWhile fetching the description for issue %d, received a '
456 '404 (not found)\n'
457 'error. It is likely that you deleted this '
458 'issue on the server. If this is the\n'
459 'case, please run\n\n'
460 ' git cl issue 0\n\n'
461 'to clear the association with the deleted issue. Then run '
462 'this command again.') % issue)
463 else:
464 DieWithError(
465 '\nFailed to fetch issue description. HTTP error ' + e.code)
451 self.has_description = True 466 self.has_description = True
452 if pretty: 467 if pretty:
453 wrapper = textwrap.TextWrapper() 468 wrapper = textwrap.TextWrapper()
454 wrapper.initial_indent = wrapper.subsequent_indent = ' ' 469 wrapper.initial_indent = wrapper.subsequent_indent = ' '
455 return wrapper.fill(self.description) 470 return wrapper.fill(self.description)
456 return self.description 471 return self.description
457 472
458 def GetPatchset(self): 473 def GetPatchset(self):
459 if not self.has_patchset: 474 if not self.has_patchset:
460 patchset = RunGit(['config', self._PatchsetSetting()], 475 patchset = RunGit(['config', self._PatchsetSetting()],
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 1431 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
1417 1432
1418 # Not a known command. Default to help. 1433 # Not a known command. Default to help.
1419 GenUsage(parser, 'help') 1434 GenUsage(parser, 'help')
1420 return CMDhelp(parser, argv) 1435 return CMDhelp(parser, argv)
1421 1436
1422 1437
1423 if __name__ == '__main__': 1438 if __name__ == '__main__':
1424 fix_encoding.fix_encoding() 1439 fix_encoding.fix_encoding()
1425 sys.exit(main(sys.argv[1:])) 1440 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698