Chromium Code Reviews| Index: gclient_scm.py |
| diff --git a/gclient_scm.py b/gclient_scm.py |
| index 7dc0bd8018693859b15529b74ba0fb747973c5fe..5d9dea95d0c01872150daeb7e35563ea371e4369 100644 |
| --- a/gclient_scm.py |
| +++ b/gclient_scm.py |
| @@ -469,7 +469,8 @@ class GitWrapper(SCMWrapper): |
| if scm.GIT.IsGitSvn(self.checkout_path) and upstream_branch is not None: |
| # Our git-svn branch (upstream_branch) is our upstream |
| self._AttemptRebase(upstream_branch, files, options, |
| - newbase=revision, printed_path=printed_path) |
| + newbase=revision, printed_path=printed_path, |
| + merge=options.merge) |
| printed_path = True |
| else: |
| # Can't find a merge-base since we don't know our upstream. That makes |
| @@ -479,12 +480,13 @@ class GitWrapper(SCMWrapper): |
| if options.revision or deps_revision: |
| upstream_branch = revision |
| self._AttemptRebase(upstream_branch, files, options, |
| - printed_path=printed_path) |
| + printed_path=printed_path, merge=options.merge) |
| printed_path = True |
| elif rev_type == 'hash': |
| # case 2 |
| self._AttemptRebase(upstream_branch, files, options, |
| - newbase=revision, printed_path=printed_path) |
| + newbase=revision, printed_path=printed_path, |
| + merge=options.merge) |
| printed_path = True |
| elif revision.replace('heads', 'remotes/' + self.remote) != upstream_branch: |
| # case 4 |
| @@ -517,13 +519,15 @@ class GitWrapper(SCMWrapper): |
| while True: |
| try: |
| action = ask_for_data( |
| - 'Cannot fast-forward merge, attempt to rebase? ' |
| - '(y)es / (q)uit / (s)kip : ', options) |
| + 'Cannot %s, attempt to rebase? ' |
| + '(y)es / (q)uit / (s)kip : ' % |
| + 'merge' if options.merge else 'fast-forward merge', |
|
iannucci
2013/12/16 21:01:15
Wouldn't we want to still fast-forward, even if me
Bernhard Bauer
2013/12/16 21:39:03
With this version (and --merge), we will still try
|
| + options) |
| except ValueError: |
| raise gclient_utils.Error('Invalid Character') |
| if re.match(r'yes|y', action, re.I): |
| self._AttemptRebase(upstream_branch, files, options, |
| - printed_path=printed_path) |
| + printed_path=printed_path, merge=False) |
| printed_path = True |
| break |
| elif re.match(r'quit|q', action, re.I): |
| @@ -880,19 +884,26 @@ class GitWrapper(SCMWrapper): |
| 'create a new branch for your work.') % (revision, self.remote)) |
| def _AttemptRebase(self, upstream, files, options, newbase=None, |
| - branch=None, printed_path=False): |
| + branch=None, printed_path=False, merge=False): |
| """Attempt to rebase onto either upstream or, if specified, newbase.""" |
| if files is not None: |
| files.extend(self._Capture(['diff', upstream, '--name-only']).split()) |
| revision = upstream |
| if newbase: |
| revision = newbase |
| + action = 'merge' if merge else 'rebase' |
| if not printed_path: |
| - print('\n_____ %s : Attempting rebase onto %s...' % ( |
| - self.relpath, revision)) |
| + print('\n_____ %s : Attempting %s onto %s...' % ( |
| + action, self.relpath, revision)) |
| printed_path = True |
| else: |
| - print('Attempting rebase onto %s...' % revision) |
| + print('Attempting %s onto %s...' % (action, revision)) |
| + |
| + if merge: |
| + merge_output = self._Capture(['merge', revision]) |
| + if options.verbose: |
| + print(merge_output) |
| + return |
| # Build the rebase command here using the args |
| # git rebase [options] [--onto <newbase>] <upstream> [<branch>] |