From df947ea84697a2c3c5f1ccc382160e428dab8d48 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Wed, 12 Jan 2011 20:44:54 +0000 Subject: [PATCH] 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 --- git_cl/git_cl.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/git_cl/git_cl.py b/git_cl/git_cl.py index 46d178a3d..ac51470d0 100644 --- a/git_cl/git_cl.py +++ b/git_cl/git_cl.py @@ -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()