Commit 2aad1b26 authored by bauerb@chromium.org's avatar bauerb@chromium.org

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
parent 891f6454
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment