Chromium Code Reviews

Unified Diff: git_cl/git_cl.py

Issue 6079003: Improve parsing of committed hash to be more resilient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/git_cl
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl/git_cl.py
diff --git a/git_cl/git_cl.py b/git_cl/git_cl.py
index ea1238261dc8c1aa2fe6d30485a13264bd1de242..6d153f8d7a318f9f906d7d82117d87799eaa3a18 100644
--- a/git_cl/git_cl.py
+++ b/git_cl/git_cl.py
@@ -996,7 +996,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]
+ m = (re.match(r'.*?([a-f0-9]{7})\.\.([a-f0-9]{7})$', l)
evanm 2011/01/12 00:21:06 Can you use longer variable names? ("match" inste
+ for l in output.splitlines(False))
+ m = filter(None, m)
+ if not len(m) == 1:
evanm 2011/01/12 00:21:06 Didn't realize this was valid Python (rather than
+ DieWithError("Couldn't parse ouput to extract the committed hash:\n%s" %
+ output)
+ revision = m[0].group(2)
else:
return 1
viewvc_url = settings.GetViewVCUrl()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine