| Index: git_cl/git_cl.py
|
| diff --git a/git_cl/git_cl.py b/git_cl/git_cl.py
|
| index aaa2670e43517c1603cd2431dd10b1999e809f19..c6df47b95a6f46e8bfd4d13b4007ae2c81cdccfd 100644
|
| --- a/git_cl/git_cl.py
|
| +++ b/git_cl/git_cl.py
|
| @@ -482,29 +482,6 @@ def GetCodereviewSettingsInteractively():
|
| # svn-based hackery.
|
|
|
|
|
| -class HookResults(object):
|
| - """Contains the parsed output of the presubmit hooks."""
|
| - def __init__(self, output_from_hooks=None):
|
| - self.reviewers = []
|
| - self.output = None
|
| - self._ParseOutputFromHooks(output_from_hooks)
|
| -
|
| - def _ParseOutputFromHooks(self, output_from_hooks):
|
| - if not output_from_hooks:
|
| - return
|
| - lines = []
|
| - reviewers = []
|
| - reviewer_regexp = re.compile('ADD: R=(.+)')
|
| - for l in output_from_hooks.splitlines():
|
| - m = reviewer_regexp.match(l)
|
| - if m:
|
| - reviewers.extend(m.group(1).split(','))
|
| - else:
|
| - lines.append(l)
|
| - self.output = '\n'.join(lines)
|
| - self.reviewers = ','.join(reviewers)
|
| -
|
| -
|
| class ChangeDescription(object):
|
| """Contains a parsed form of the change description."""
|
| def __init__(self, subject, log_desc, reviewers):
|
| @@ -772,31 +749,14 @@ def RunHook(committing, upstream_branch, rietveld_server, tbr, may_prompt):
|
| RunCommand(['git', 'config', '--replace-all',
|
| 'rietveld.extracc', ','.join(watchers)])
|
|
|
| - output = StringIO.StringIO()
|
| - should_continue = presubmit_support.DoPresubmitChecks(change, committing,
|
| - verbose=None, output_stream=output, input_stream=sys.stdin,
|
| - default_presubmit=None, may_prompt=False, tbr=tbr,
|
| + output = presubmit_support.DoPresubmitChecks(change, committing,
|
| + verbose=False, output_stream=sys.stdout, input_stream=sys.stdin,
|
| + default_presubmit=None, may_prompt=may_prompt, tbr=tbr,
|
| host_url=cl.GetRietveldServer())
|
| - hook_results = HookResults(output.getvalue())
|
| - if hook_results.output:
|
| - print hook_results.output
|
|
|
| # TODO(dpranke): We should propagate the error out instead of calling exit().
|
| - if should_continue and hook_results.output and (
|
| - '** Presubmit ERRORS **\n' in hook_results.output or
|
| - '** Presubmit WARNINGS **\n' in hook_results.output):
|
| - should_continue = False
|
| -
|
| - if not should_continue:
|
| - if may_prompt:
|
| - response = raw_input('Are you sure you want to continue? (y/N): ')
|
| - if not response.lower().startswith('y'):
|
| - sys.exit(1)
|
| - else:
|
| - sys.exit(1)
|
| -
|
| -
|
| - return hook_results
|
| + if not output.should_continue():
|
| + sys.exit(1)
|
|
|
|
|
| def CMDpresubmit(parser, args):
|
| @@ -874,11 +834,9 @@ def CMDupload(parser, args):
|
| hook_results = RunHook(committing=False, upstream_branch=base_branch,
|
| rietveld_server=cl.GetRietveldServer(), tbr=False,
|
| may_prompt=(not options.force))
|
| - else:
|
| - hook_results = HookResults()
|
| + if not options.reviewers and hook_results.reviewers:
|
| + options.reviewers = hook_results.reviewers
|
|
|
| - if not options.reviewers and hook_results.reviewers:
|
| - options.reviewers = hook_results.reviewers
|
|
|
| # --no-ext-diff is broken in some versions of Git, so try to work around
|
| # this by overriding the environment (but there is still a problem if the
|
|
|