OLD | NEW |
1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Gclient-specific SCM-specific operations.""" | 5 """Gclient-specific SCM-specific operations.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import posixpath | 9 import posixpath |
10 import re | 10 import re |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 # case 1 | 268 # case 1 |
269 if self.IsGitSvn(self.checkout_path) and upstream_branch is not None: | 269 if self.IsGitSvn(self.checkout_path) and upstream_branch is not None: |
270 # Our git-svn branch (upstream_branch) is our upstream | 270 # Our git-svn branch (upstream_branch) is our upstream |
271 self._AttemptRebase(upstream_branch, files, verbose=options.verbose, | 271 self._AttemptRebase(upstream_branch, files, verbose=options.verbose, |
272 newbase=revision, printed_path=printed_path) | 272 newbase=revision, printed_path=printed_path) |
273 printed_path = True | 273 printed_path = True |
274 else: | 274 else: |
275 # Can't find a merge-base since we don't know our upstream. That makes | 275 # Can't find a merge-base since we don't know our upstream. That makes |
276 # this command VERY likely to produce a rebase failure. For now we | 276 # this command VERY likely to produce a rebase failure. For now we |
277 # assume origin is our upstream since that's what the old behavior was. | 277 # assume origin is our upstream since that's what the old behavior was. |
278 self._AttemptRebase('origin', files=files, verbose=options.verbose, | 278 upstream_branch = 'origin' |
279 printed_path=printed_path) | 279 if options.revision: |
| 280 upstream_branch = revision |
| 281 self._AttemptRebase(upstream_branch, files=files, |
| 282 verbose=options.verbose, printed_path=printed_path) |
280 printed_path = True | 283 printed_path = True |
281 elif rev_type is 'hash': | 284 elif rev_type is 'hash': |
282 # case 2 | 285 # case 2 |
283 self._AttemptRebase(upstream_branch, files, verbose=options.verbose, | 286 self._AttemptRebase(upstream_branch, files, verbose=options.verbose, |
284 newbase=revision, printed_path=printed_path) | 287 newbase=revision, printed_path=printed_path) |
285 printed_path = True | 288 printed_path = True |
286 elif revision.replace('heads', 'remotes/origin') != upstream_branch: | 289 elif revision.replace('heads', 'remotes/origin') != upstream_branch: |
287 # case 4 | 290 # case 4 |
288 new_base = revision.replace('heads', 'remotes/origin') | 291 new_base = revision.replace('heads', 'remotes/origin') |
289 if not printed_path: | 292 if not printed_path: |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " | 818 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " |
816 "does not exist." | 819 "does not exist." |
817 % (' '.join(command), path)) | 820 % (' '.join(command), path)) |
818 # There's no file list to retrieve. | 821 # There's no file list to retrieve. |
819 else: | 822 else: |
820 self.RunAndGetFileList(options, command, path, file_list) | 823 self.RunAndGetFileList(options, command, path, file_list) |
821 | 824 |
822 def FullUrlForRelativeUrl(self, url): | 825 def FullUrlForRelativeUrl(self, url): |
823 # Find the forth '/' and strip from there. A bit hackish. | 826 # Find the forth '/' and strip from there. A bit hackish. |
824 return '/'.join(self.url.split('/')[:4]) + url | 827 return '/'.join(self.url.split('/')[:4]) + url |
OLD | NEW |