From 5a2fefb9ebf89806b6b6a5aeead5dad5855fc476 Mon Sep 17 00:00:00 2001 From: "dpranke@chromium.org" Date: Sun, 13 Mar 2011 23:54:56 +0000 Subject: [PATCH] Fix prompting - had the logic backwards. The git-cl unit tests actually test the prompting correctly (once they are modified to pass otherwise). Review URL: http://codereview.chromium.org/6679032 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@77985 0039d316-1c4b-4281-b951-d872f2087c98 --- git_cl/git_cl.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/git_cl/git_cl.py b/git_cl/git_cl.py index c3631e6788..1d12d2fb6d 100644 --- a/git_cl/git_cl.py +++ b/git_cl/git_cl.py @@ -778,7 +778,7 @@ def RunHook(committing, upstream_branch, rietveld_server, tbr, may_prompt): 'rietveld.extracc', ','.join(watchers)]) output = StringIO.StringIO() - res = presubmit_support.DoPresubmitChecks(change, committing, + should_continue = presubmit_support.DoPresubmitChecks(change, committing, verbose=None, output_stream=output, input_stream=sys.stdin, default_presubmit=None, may_prompt=False, tbr=tbr, host_url=cl.GetRietveldServer()) @@ -787,11 +787,12 @@ def RunHook(committing, upstream_branch, rietveld_server, tbr, may_prompt): print hook_results.output # TODO(dpranke): We should propagate the error out instead of calling exit(). - if not res and ('** Presubmit ERRORS **' in hook_results.output or - '** Presubmit WARNINGS **' in hook_results.output): - res = True + 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 res: + 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'):