| 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)
|
|
|
|
|