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

Unified Diff: depot_tools/git_cl_hooks.py

Issue 1993008: Enable CheckRietveldTryJobExecution for git-cl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/
Patch Set: '' Created 10 years, 7 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 side-by-side diff with in-line comments
Download patch
« 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: depot_tools/git_cl_hooks.py
===================================================================
--- depot_tools/git_cl_hooks.py (revision 46814)
+++ depot_tools/git_cl_hooks.py (working copy)
@@ -20,7 +20,14 @@
cwd=cwd,
stdout=subprocess.PIPE).communicate()[0].strip()
+def BackquoteAsInteger(cmd, cwd=None):
+ """Like Backquote, but returns either an int or None."""
+ try:
+ return int(Backquote(cmd, cwd))
+ except ValueError:
+ return None
+
class ChangeOptions:
def __init__(self, commit=None, upstream_branch=None):
self.commit = commit
@@ -41,12 +48,12 @@
raise Exception("Could not parse log message: %s" % log)
name = m.group(1)
files = scm.GIT.CaptureStatus([root], upstream_branch)
- issue = Backquote(['git', 'cl', 'status', '--field=id'])
- try:
- description = gcl.GetIssueDescription(int(issue))
- except ValueError:
+ issue = BackquoteAsInteger(['git', 'cl', 'status', '--field=id'])
+ patchset = BackquoteAsInteger(['git', 'cl', 'status', '--field=patch'])
+ if issue:
+ description = gcl.GetIssueDescription(issue)
+ else:
description = m.group(2)
- patchset = None
self.change = presubmit_support.GitChange(name, description, absroot, files,
issue, patchset)
« 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