| Index: git_cl.py
|
| diff --git a/git_cl.py b/git_cl.py
|
| index e4d21453fc67acfffc4fb497c238dcd5a4ca90bb..84edfdc63c605b0c0c683a4bc07fbf3bc6efa3e7 100755
|
| --- a/git_cl.py
|
| +++ b/git_cl.py
|
| @@ -42,6 +42,7 @@ DEFAULT_SERVER = 'http://codereview.appspot.com'
|
| POSTUPSTREAM_HOOK_PATTERN = '.git/hooks/post-cl-%s'
|
| DESCRIPTION_BACKUP_FILE = '~/.git_cl_description_backup'
|
|
|
| +
|
| def DieWithError(message):
|
| print >> sys.stderr, message
|
| sys.exit(1)
|
| @@ -97,6 +98,14 @@ def usage(more):
|
| return hook
|
|
|
|
|
| +def ask_for_data(prompt):
|
| + try:
|
| + return raw_input(prompt)
|
| + except KeyboardInterrupt:
|
| + # Hide the exception.
|
| + sys.exit(1)
|
| +
|
| +
|
| def FixUrl(server):
|
| """Fix a server url to defaults protocol to http:// if none is specified."""
|
| if not server:
|
| @@ -525,7 +534,7 @@ def GetCodereviewSettingsInteractively():
|
| server = settings.GetDefaultServerUrl(error_ok=True)
|
| prompt = 'Rietveld server (host[:port])'
|
| prompt += ' [%s]' % (server or DEFAULT_SERVER)
|
| - newserver = raw_input(prompt + ': ')
|
| + newserver = ask_for_data(prompt + ':')
|
| if not server and not newserver:
|
| newserver = DEFAULT_SERVER
|
| if newserver and newserver != server:
|
| @@ -535,7 +544,7 @@ def GetCodereviewSettingsInteractively():
|
| prompt = caption
|
| if initial:
|
| prompt += ' ("x" to clear) [%s]' % initial
|
| - new_val = raw_input(prompt + ': ')
|
| + new_val = ask_for_data(prompt + ':')
|
| if new_val == 'x':
|
| RunGit(['config', '--unset-all', 'rietveld.' + name], error_ok=True)
|
| elif new_val and new_val != initial:
|
| @@ -1112,7 +1121,7 @@ def SendUpstream(parser, args, cmd):
|
| branches = [base_branch, cl.GetBranchRef()]
|
| if not options.force:
|
| subprocess.call(['git', 'diff', '--stat'] + branches)
|
| - raw_input("About to commit; enter to confirm.")
|
| + ask_for_data('About to commit; enter to confirm.')
|
|
|
| # We want to squash all this branch's commits into one commit with the
|
| # proper description.
|
| @@ -1197,7 +1206,7 @@ to run 'git cl push' instead.
|
| Choose wisely, if you get this wrong, your commit might appear to succeed but
|
| will instead be silently ignored."""
|
| print(message)
|
| - raw_input('[Press enter to dcommit or ctrl-C to quit]')
|
| + ask_for_data('[Press enter to dcommit or ctrl-C to quit]')
|
| return SendUpstream(parser, args, 'dcommit')
|
|
|
|
|
| @@ -1207,7 +1216,7 @@ def CMDpush(parser, args):
|
| if settings.GetIsGitSvn():
|
| print('This appears to be an SVN repository.')
|
| print('Are you sure you didn\'t mean \'git cl dcommit\'?')
|
| - raw_input('[Press enter to push or ctrl-C to quit]')
|
| + ask_for_data('[Press enter to push or ctrl-C to quit]')
|
| return SendUpstream(parser, args, 'push')
|
|
|
|
|
|
|