@ -69,7 +69,11 @@ class GitDiffFilterer(DiffFiltererWrapper):
return re . sub ( " [a|b]/ " + self . _current_file , self . _replacement_file , line )
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 :
try :
return raw_input ( prompt )
return raw_input ( prompt )
except KeyboardInterrupt :
except KeyboardInterrupt :
@ -454,17 +458,16 @@ class GitWrapper(SCMWrapper):
merge_args . append ( ' --ff-only ' )
merge_args . append ( ' --ff-only ' )
merge_args . append ( upstream_branch )
merge_args . append ( upstream_branch )
merge_output = scm . GIT . Capture ( merge_args , cwd = self . checkout_path )
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 re . match ( ' fatal: Not possible to fast-forward, aborting. ' , e . stderr ) :
if not printed_path :
if not printed_path :
print ( ' \n _____ %s %s ' % ( self . relpath , rev_str ) )
print ( ' \n _____ %s %s ' % ( self . relpath , rev_str ) )
printed_path = True
printed_path = True
while True :
while True :
try :
try :
# TODO(maruel): That can't work with --jobs.
action = ask_for_data (
action = ask_for_data (
' Cannot fast-forward merge, attempt to rebase? '
' Cannot fast-forward merge, attempt to rebase? '
' (y)es / (q)uit / (s)kip : ' )
' (y)es / (q)uit / (s)kip : ' , options )
except ValueError :
except ValueError :
raise gclient_utils . Error ( ' Invalid Character ' )
raise gclient_utils . Error ( ' Invalid Character ' )
if re . match ( r ' yes|y ' , action , re . I ) :
if re . match ( r ' yes|y ' , action , re . I ) :
@ -755,7 +758,7 @@ class GitWrapper(SCMWrapper):
' Cannot rebase because of unstaged changes. \n '
' Cannot rebase because of unstaged changes. \n '
' \' git reset --hard HEAD \' ? \n '
' \' git reset --hard HEAD \' ? \n '
' WARNING: destroys any uncommitted work in your current branch! '
' 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 ) :
if re . match ( r ' yes|y ' , rebase_action , re . I ) :
self . _Run ( [ ' reset ' , ' --hard ' , ' HEAD ' ] , options )
self . _Run ( [ ' reset ' , ' --hard ' , ' HEAD ' ] , options )
# Should this be recursive?
# Should this be recursive?