| Index: git_cl_hooks.py
|
| ===================================================================
|
| --- git_cl_hooks.py (revision 61882)
|
| +++ git_cl_hooks.py (working copy)
|
| @@ -1,4 +1,4 @@
|
| -# Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
| +# Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| @@ -25,11 +25,11 @@
|
| cwd=cwd,
|
| stdout=subprocess.PIPE).communicate()[0].strip()
|
|
|
| -def BackquoteAsInteger(cmd, cwd=None):
|
| - """Like Backquote, but returns either an int or None."""
|
| +def ConvertToInteger(input):
|
| + """Convert a string to integer, but returns either an int or None."""
|
| try:
|
| - return int(Backquote(cmd, cwd))
|
| - except ValueError:
|
| + return int(input)
|
| + except TypeError, ValueError:
|
| return None
|
|
|
|
|
| @@ -50,8 +50,8 @@
|
| name = Backquote(['git', 'rev-parse', 'HEAD'])
|
| files = scm.GIT.CaptureStatus([root], upstream_branch)
|
| cl = git_cl.Changelist()
|
| - issue = cl.GetIssue()
|
| - patchset = cl.GetPatchset()
|
| + issue = ConvertToInteger(cl.GetIssue())
|
| + patchset = ConvertToInteger(cl.GetPatchset())
|
| if issue:
|
| description = cl.GetDescription()
|
| else:
|
|
|