gclient: Add '--auto_rebase' sync option.

This adds the '--auto_rebase' sync option, enabling parallel updates to
automatically rebase local Git branches during sync.

BUG=None
TEST=local

Review URL: https://codereview.chromium.org/930693002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294151 0039d316-1c4b-4281-b951-d872f2087c98
changes/01/332501/1
dnj@chromium.org 10 years ago
parent c3617f3fdd
commit 5b23e871ba

@ -2003,6 +2003,9 @@ def CMDsync(parser, args):
parser.add_option('-M', '--merge', action='store_true', parser.add_option('-M', '--merge', action='store_true',
help='merge upstream changes instead of trying to ' help='merge upstream changes instead of trying to '
'fast-forward or rebase') 'fast-forward or rebase')
parser.add_option('-A', '--auto_rebase', action='store_true',
help='Automatically rebase repositories against local '
'checkout during update (git only).')
parser.add_option('--deps', dest='deps_os', metavar='OS_LIST', parser.add_option('--deps', dest='deps_os', metavar='OS_LIST',
help='override deps for the specified (comma-separated) ' help='override deps for the specified (comma-separated) '
'platform(s); \'all\' will process all deps_os ' 'platform(s); \'all\' will process all deps_os '

@ -606,15 +606,16 @@ class GitWrapper(SCMWrapper):
self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False)
printed_path = True printed_path = True
while True: while True:
try: if not options.auto_rebase:
action = self._AskForData( try:
'Cannot %s, attempt to rebase? ' action = self._AskForData(
'(y)es / (q)uit / (s)kip : ' % 'Cannot %s, attempt to rebase? '
('merge' if options.merge else 'fast-forward merge'), '(y)es / (q)uit / (s)kip : ' %
options) ('merge' if options.merge else 'fast-forward merge'),
except ValueError: options)
raise gclient_utils.Error('Invalid Character') except ValueError:
if re.match(r'yes|y', action, re.I): raise gclient_utils.Error('Invalid Character')
if options.auto_rebase or re.match(r'yes|y', action, re.I):
self._AttemptRebase(upstream_branch, files, options, self._AttemptRebase(upstream_branch, files, options,
printed_path=printed_path, merge=False) printed_path=printed_path, merge=False)
printed_path = True printed_path = True

@ -804,6 +804,7 @@ class BaseGitWrapperTestCase(GCBaseTestCase, StdoutCheck, TestCaseUtils,
"""This class doesn't use pymox.""" """This class doesn't use pymox."""
class OptionsObject(object): class OptionsObject(object):
def __init__(self, verbose=False, revision=None): def __init__(self, verbose=False, revision=None):
self.auto_rebase = False
self.verbose = verbose self.verbose = verbose
self.revision = revision self.revision = revision
self.manually_grab_svn_rev = True self.manually_grab_svn_rev = True

Loading…
Cancel
Save