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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 Raises: | 161 Raises: |
162 Error: if can't get URL for relative path. | 162 Error: if can't get URL for relative path. |
163 """ | 163 """ |
164 | 164 |
165 if args: | 165 if args: |
166 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) | 166 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) |
167 | 167 |
168 self._CheckMinVersion("1.6.6") | 168 self._CheckMinVersion("1.6.6") |
169 | 169 |
170 default_rev = "refs/heads/master" | 170 default_rev = "refs/heads/master" |
171 url, revision = gclient_utils.SplitUrlRevision(self.url) | 171 url, deps_revision = gclient_utils.SplitUrlRevision(self.url) |
172 rev_str = "" | 172 rev_str = "" |
| 173 revision = deps_revision |
173 if options.revision: | 174 if options.revision: |
174 # Override the revision number. | 175 # Override the revision number. |
175 revision = str(options.revision) | 176 revision = str(options.revision) |
176 if not revision: | 177 if not revision: |
177 revision = default_rev | 178 revision = default_rev |
178 | 179 |
179 rev_str = ' at %s' % revision | 180 rev_str = ' at %s' % revision |
180 files = [] | 181 files = [] |
181 | 182 |
182 printed_path = False | 183 printed_path = False |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 if scm.GIT.IsGitSvn(self.checkout_path) and upstream_branch is not None: | 282 if scm.GIT.IsGitSvn(self.checkout_path) and upstream_branch is not None: |
282 # Our git-svn branch (upstream_branch) is our upstream | 283 # Our git-svn branch (upstream_branch) is our upstream |
283 self._AttemptRebase(upstream_branch, files, verbose=options.verbose, | 284 self._AttemptRebase(upstream_branch, files, verbose=options.verbose, |
284 newbase=revision, printed_path=printed_path) | 285 newbase=revision, printed_path=printed_path) |
285 printed_path = True | 286 printed_path = True |
286 else: | 287 else: |
287 # Can't find a merge-base since we don't know our upstream. That makes | 288 # Can't find a merge-base since we don't know our upstream. That makes |
288 # this command VERY likely to produce a rebase failure. For now we | 289 # this command VERY likely to produce a rebase failure. For now we |
289 # assume origin is our upstream since that's what the old behavior was. | 290 # assume origin is our upstream since that's what the old behavior was. |
290 upstream_branch = 'origin' | 291 upstream_branch = 'origin' |
291 if options.revision: | 292 if options.revision or deps_revision: |
292 upstream_branch = revision | 293 upstream_branch = revision |
293 self._AttemptRebase(upstream_branch, files=files, | 294 self._AttemptRebase(upstream_branch, files=files, |
294 verbose=options.verbose, printed_path=printed_path) | 295 verbose=options.verbose, printed_path=printed_path) |
295 printed_path = True | 296 printed_path = True |
296 elif rev_type == 'hash': | 297 elif rev_type == 'hash': |
297 # case 2 | 298 # case 2 |
298 self._AttemptRebase(upstream_branch, files, verbose=options.verbose, | 299 self._AttemptRebase(upstream_branch, files, verbose=options.verbose, |
299 newbase=revision, printed_path=printed_path) | 300 newbase=revision, printed_path=printed_path) |
300 printed_path = True | 301 printed_path = True |
301 elif revision.replace('heads', 'remotes/origin') != upstream_branch: | 302 elif revision.replace('heads', 'remotes/origin') != upstream_branch: |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " | 821 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " |
821 "does not exist." | 822 "does not exist." |
822 % (' '.join(command), path)) | 823 % (' '.join(command), path)) |
823 # There's no file list to retrieve. | 824 # There's no file list to retrieve. |
824 else: | 825 else: |
825 scm.SVN.RunAndGetFileList(options, command, path, file_list) | 826 scm.SVN.RunAndGetFileList(options, command, path, file_list) |
826 | 827 |
827 def FullUrlForRelativeUrl(self, url): | 828 def FullUrlForRelativeUrl(self, url): |
828 # Find the forth '/' and strip from there. A bit hackish. | 829 # Find the forth '/' and strip from there. A bit hackish. |
829 return '/'.join(self.url.split('/')[:4]) + url | 830 return '/'.join(self.url.split('/')[:4]) + url |
OLD | NEW |