Add --merge option to gclient sync.

BUG=none
TEST=

Review URL: http://codereview.chromium.org/7277035

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@93611 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
bauerb@chromium.org 14 years ago
parent 891f6454c9
commit 2aad1b262d

@ -1090,6 +1090,9 @@ def CMDsync(parser, args):
'local modifications')
parser.add_option('-R', '--reset', action='store_true',
help='resets any local changes before updating (git only)')
parser.add_option('-M', '--merge', action='store_true',
help='merge upstream changes instead of trying to '
'fast-forward or rebase')
parser.add_option('--deps', dest='deps_os', metavar='OS_LIST',
help='override deps for the specified (comma-separated) '
'platform(s); \'all\' will process all deps_os '

@ -355,8 +355,11 @@ class GitWrapper(SCMWrapper):
if verbose:
print('Trying fast-forward merge to branch : %s' % upstream_branch)
try:
merge_output = scm.GIT.Capture(['merge', '--ff-only', upstream_branch],
cwd=self.checkout_path)
merge_args = ['merge']
if not options.merge:
merge_args.append('--ff-only')
merge_args.append(upstream_branch)
merge_output = scm.GIT.Capture(merge_args, cwd=self.checkout_path)
except gclient_utils.CheckCallError, e:
if re.match('fatal: Not possible to fast-forward, aborting.', e.stderr):
if not printed_path:

Loading…
Cancel
Save