Commit 85616e0e authored by maruel@chromium.org's avatar maruel@chromium.org

Do not fetch the CL description when using git cl status --fast.

This causes a network I/O, which is not fast. Also this is a non-starter in the
case of no network connectivity, causing a crash instead of completing
successfully. Until Air Canada provides on-flight internet, this is a
non-starter. #firstworldproblem.

Also fix git cl presubmit in case of lack of network connectivity.

R=stip@chromium.org
BUG=

Review URL: https://codereview.chromium.org/418293004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@285911 0039d316-1c4b-4281-b951-d872f2087c98
parent de3ee901
...@@ -696,7 +696,7 @@ or verify this branch is set up to track another (via the --track argument to ...@@ -696,7 +696,7 @@ or verify this branch is set up to track another (via the --track argument to
issue = self.GetIssue() issue = self.GetIssue()
try: try:
self.description = self.RpcServer().get_description(issue).strip() self.description = self.RpcServer().get_description(issue).strip()
except urllib2.HTTPError, e: except urllib2.HTTPError as e:
if e.code == 404: if e.code == 404:
DieWithError( DieWithError(
('\nWhile fetching the description for issue %d, received a ' ('\nWhile fetching the description for issue %d, received a '
...@@ -710,6 +710,12 @@ or verify this branch is set up to track another (via the --track argument to ...@@ -710,6 +710,12 @@ or verify this branch is set up to track another (via the --track argument to
else: else:
DieWithError( DieWithError(
'\nFailed to fetch issue description. HTTP error %d' % e.code) '\nFailed to fetch issue description. HTTP error %d' % e.code)
except urllib2.URLError as e:
print >> sys.stderr, (
'Warning: Failed to retrieve CL description due to network '
'failure.')
self.description = ''
self.has_description = True self.has_description = True
if pretty: if pretty:
wrapper = textwrap.TextWrapper() wrapper = textwrap.TextWrapper()
...@@ -1314,8 +1320,9 @@ def CMDstatus(parser, args): ...@@ -1314,8 +1320,9 @@ def CMDstatus(parser, args):
return 0 return 0
print cl.GetBranch() print cl.GetBranch()
print 'Issue number: %s (%s)' % (cl.GetIssue(), cl.GetIssueURL()) print 'Issue number: %s (%s)' % (cl.GetIssue(), cl.GetIssueURL())
print 'Issue description:' if not options.fast:
print cl.GetDescription(pretty=True) print 'Issue description:'
print cl.GetDescription(pretty=True)
return 0 return 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment