| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 import re | |
| 7 import subprocess | 6 import subprocess |
| 8 import sys | 7 import sys |
| 9 | 8 |
| 10 import breakpad | 9 import breakpad # pylint: disable=W0611 |
| 11 | 10 |
| 12 from git_cl_repo import git_cl | 11 from git_cl_repo import git_cl |
| 13 from git_cl_repo import upload | 12 from git_cl_repo import upload |
| 14 | 13 |
| 15 import presubmit_support | 14 import presubmit_support |
| 16 import scm | 15 import scm |
| 17 import watchlists | 16 import watchlists |
| 18 | 17 |
| 19 # Really ugly hack to quiet upload.py | 18 # Really ugly hack to quiet upload.py |
| 20 upload.verbosity = 0 | 19 upload.verbosity = 0 |
| 21 | 20 |
| 22 def Backquote(cmd, cwd=None): | 21 def Backquote(cmd, cwd=None): |
| 23 """Like running `cmd` in a shell script.""" | 22 """Like running `cmd` in a shell script.""" |
| 24 return subprocess.Popen(cmd, | 23 return subprocess.Popen(cmd, |
| 25 cwd=cwd, | 24 cwd=cwd, |
| 26 stdout=subprocess.PIPE).communicate()[0].strip() | 25 stdout=subprocess.PIPE).communicate()[0].strip() |
| 27 | 26 |
| 28 def ConvertToInteger(input): | 27 def ConvertToInteger(inputval): |
| 29 """Convert a string to integer, but returns either an int or None.""" | 28 """Convert a string to integer, but returns either an int or None.""" |
| 30 try: | 29 try: |
| 31 return int(input) | 30 return int(inputval) |
| 32 except TypeError, ValueError: | 31 except (TypeError, ValueError): |
| 33 return None | 32 return None |
| 34 | 33 |
| 35 | 34 |
| 36 class ChangeOptions: | 35 class ChangeOptions: |
| 37 def __init__(self, commit=None, upstream_branch=None): | 36 def __init__(self, commit=None, upstream_branch=None): |
| 38 self.commit = commit | 37 self.commit = commit |
| 39 self.verbose = None | 38 self.verbose = None |
| 40 self.default_presubmit = None | 39 self.default_presubmit = None |
| 41 self.may_prompt = None | 40 self.may_prompt = None |
| 42 | 41 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 if presubmit_support.DoPresubmitChecks(options.change, | 81 if presubmit_support.DoPresubmitChecks(options.change, |
| 83 options.commit, | 82 options.commit, |
| 84 options.verbose, | 83 options.verbose, |
| 85 sys.stdout, | 84 sys.stdout, |
| 86 sys.stdin, | 85 sys.stdin, |
| 87 options.default_presubmit, | 86 options.default_presubmit, |
| 88 options.may_prompt): | 87 options.may_prompt): |
| 89 sys.exit(0) | 88 sys.exit(0) |
| 90 else: | 89 else: |
| 91 sys.exit(1) | 90 sys.exit(1) |
| OLD | NEW |