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

Unified Diff: gclient_scm.py

Issue 15421005: Don't "hang" gclient if fast-forward is not possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Generalizing. Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index 18bc0e389653cfab2ec2fc1443a963c1887c5cb0..1c3eb79492e42d1457385915ba5b6eba9f3306db 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -69,7 +69,11 @@ class GitDiffFilterer(DiffFiltererWrapper):
return re.sub("[a|b]/" + self._current_file, self._replacement_file, line)
-def ask_for_data(prompt):
+def ask_for_data(prompt, options):
+ if options.jobs > 1:
+ raise gclient_utils.Error("Background task requires input. Rerun "
+ "gclient with --jobs=1 so that\n"
+ "interaction is possible.")
try:
return raw_input(prompt)
except KeyboardInterrupt:
@@ -454,17 +458,16 @@ class GitWrapper(SCMWrapper):
merge_args.append('--ff-only')
merge_args.append(upstream_branch)
merge_output = scm.GIT.Capture(merge_args, cwd=self.checkout_path)
- except subprocess2.CalledProcessError, e:
+ except subprocess2.CalledProcessError as e:
if re.match('fatal: Not possible to fast-forward, aborting.', e.stderr):
if not printed_path:
print('\n_____ %s%s' % (self.relpath, rev_str))
printed_path = True
while True:
try:
- # TODO(maruel): That can't work with --jobs.
action = ask_for_data(
'Cannot fast-forward merge, attempt to rebase? '
- '(y)es / (q)uit / (s)kip : ')
+ '(y)es / (q)uit / (s)kip : ', options)
except ValueError:
raise gclient_utils.Error('Invalid Character')
if re.match(r'yes|y', action, re.I):
@@ -755,7 +758,7 @@ class GitWrapper(SCMWrapper):
'Cannot rebase because of unstaged changes.\n'
'\'git reset --hard HEAD\' ?\n'
'WARNING: destroys any uncommitted work in your current branch!'
- ' (y)es / (q)uit / (s)how : ')
+ ' (y)es / (q)uit / (s)how : ', options)
if re.match(r'yes|y', rebase_action, re.I):
self._Run(['reset', '--hard', 'HEAD'], options)
# Should this be recursive?
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698