Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: git_cl/git_cl.py

Issue 6679032: Fix prompting - had the logic backwards (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # git-cl -- a git-command for integrating reviews on Rietveld 2 # git-cl -- a git-command for integrating reviews on Rietveld
3 # Copyright (C) 2008 Evan Martin <martine@danga.com> 3 # Copyright (C) 2008 Evan Martin <martine@danga.com>
4 4
5 import errno 5 import errno
6 import logging 6 import logging
7 import optparse 7 import optparse
8 import os 8 import os
9 import re 9 import re
10 import StringIO 10 import StringIO
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 771
772 # Apply watchlists on upload. 772 # Apply watchlists on upload.
773 if not committing: 773 if not committing:
774 watchlist = watchlists.Watchlists(change.RepositoryRoot()) 774 watchlist = watchlists.Watchlists(change.RepositoryRoot())
775 files = [f.LocalPath() for f in change.AffectedFiles()] 775 files = [f.LocalPath() for f in change.AffectedFiles()]
776 watchers = watchlist.GetWatchersForPaths(files) 776 watchers = watchlist.GetWatchersForPaths(files)
777 RunCommand(['git', 'config', '--replace-all', 777 RunCommand(['git', 'config', '--replace-all',
778 'rietveld.extracc', ','.join(watchers)]) 778 'rietveld.extracc', ','.join(watchers)])
779 779
780 output = StringIO.StringIO() 780 output = StringIO.StringIO()
781 res = presubmit_support.DoPresubmitChecks(change, committing, 781 should_continue = presubmit_support.DoPresubmitChecks(change, committing,
782 verbose=None, output_stream=output, input_stream=sys.stdin, 782 verbose=None, output_stream=output, input_stream=sys.stdin,
783 default_presubmit=None, may_prompt=False, tbr=tbr, 783 default_presubmit=None, may_prompt=False, tbr=tbr,
784 host_url=cl.GetRietveldServer()) 784 host_url=cl.GetRietveldServer())
785 hook_results = HookResults(output.getvalue()) 785 hook_results = HookResults(output.getvalue())
786 if hook_results.output: 786 if hook_results.output:
787 print hook_results.output 787 print hook_results.output
788 788
789 # TODO(dpranke): We should propagate the error out instead of calling exit(). 789 # TODO(dpranke): We should propagate the error out instead of calling exit().
790 if not res and ('** Presubmit ERRORS **' in hook_results.output or 790 if should_continue and hook_results.output and (
791 '** Presubmit WARNINGS **' in hook_results.output): 791 '** Presubmit ERRORS **\n' in hook_results.output or
792 res = True 792 '** Presubmit WARNINGS **\n' in hook_results.output):
793 should_continue = False
793 794
794 if res: 795 if not should_continue:
795 if may_prompt: 796 if may_prompt:
796 response = raw_input('Are you sure you want to continue? (y/N): ') 797 response = raw_input('Are you sure you want to continue? (y/N): ')
797 if not response.lower().startswith('y'): 798 if not response.lower().startswith('y'):
798 sys.exit(1) 799 sys.exit(1)
799 else: 800 else:
800 sys.exit(1) 801 sys.exit(1)
801 802
802 803
803 return hook_results 804 return hook_results
804 805
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 1413 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
1413 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 1414 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
1414 1415
1415 # Not a known command. Default to help. 1416 # Not a known command. Default to help.
1416 GenUsage(parser, 'help') 1417 GenUsage(parser, 'help')
1417 return CMDhelp(parser, argv) 1418 return CMDhelp(parser, argv)
1418 1419
1419 1420
1420 if __name__ == '__main__': 1421 if __name__ == '__main__':
1421 sys.exit(main(sys.argv[1:])) 1422 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698