Commit df947ea8 authored by maruel@chromium.org's avatar maruel@chromium.org

Improve parsing of committed hash to be more resilient.

TEST=Verified that if this code breaks, the presubmit checks fail.
BUG=none

Review URL: http://codereview.chromium.org/6079003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@71229 0039d316-1c4b-4281-b951-d872f2087c98
parent 2c64b712
......@@ -1000,7 +1000,13 @@ def SendUpstream(parser, args, cmd):
if cmd == 'dcommit' and 'Committed r' in output:
revision = re.match('.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1)
elif cmd == 'push' and retcode == 0:
revision = output.splitlines()[1].split('\t')[2].split('..')[1]
match = (re.match(r'.*?([a-f0-9]{7})\.\.([a-f0-9]{7})$', l)
for l in output.splitlines(False))
match = filter(None, match)
if len(match) != 1:
DieWithError("Couldn't parse ouput to extract the committed hash:\n%s" %
output)
revision = match[0].group(2)
else:
return 1
viewvc_url = settings.GetViewVCUrl()
......
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