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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 # 1) current branch based on a hash (could be git-svn) | 230 # 1) current branch based on a hash (could be git-svn) |
231 # - try to rebase onto the new upstream (hash or branch) | 231 # - try to rebase onto the new upstream (hash or branch) |
232 # 2) current branch based on a remote branch with local committed changes, | 232 # 2) current branch based on a remote branch with local committed changes, |
233 # but the DEPS file switched to point to a hash | 233 # but the DEPS file switched to point to a hash |
234 # - rebase those changes on top of the hash | 234 # - rebase those changes on top of the hash |
235 # 3) current branch based on a remote with or without changes, no switch | 235 # 3) current branch based on a remote with or without changes, no switch |
236 # - see if we can FF, if not, prompt the user for rebase, merge, or stop | 236 # - see if we can FF, if not, prompt the user for rebase, merge, or stop |
237 # 4) current branch based on a remote, switches to a new remote | 237 # 4) current branch based on a remote, switches to a new remote |
238 # - exit | 238 # - exit |
239 | 239 |
240 # GetUpstream returns something like 'refs/remotes/origin/master' for a | 240 # GetUpstreamBranch returns something like 'refs/remotes/origin/master' for |
241 # tracking branch | 241 # a tracking branch |
242 # or 'master' if not a tracking branch (it's based on a specific rev/hash) | 242 # or 'master' if not a tracking branch (it's based on a specific rev/hash) |
243 # or it returns None if it couldn't find an upstream | 243 # or it returns None if it couldn't find an upstream |
244 upstream_branch = scm.GIT.GetUpstream(self.checkout_path) | 244 upstream_branch = scm.GIT.GetUpstreamBranch(self.checkout_path) |
245 if not upstream_branch or not upstream_branch.startswith('refs/remotes'): | 245 if not upstream_branch or not upstream_branch.startswith('refs/remotes'): |
246 current_type = "hash" | 246 current_type = "hash" |
247 logging.debug("Current branch is based off a specific rev and is not " | 247 logging.debug("Current branch is based off a specific rev and is not " |
248 "tracking an upstream.") | 248 "tracking an upstream.") |
249 elif upstream_branch.startswith('refs/remotes'): | 249 elif upstream_branch.startswith('refs/remotes'): |
250 current_type = "branch" | 250 current_type = "branch" |
251 else: | 251 else: |
252 raise gclient_utils.Error('Invalid Upstream') | 252 raise gclient_utils.Error('Invalid Upstream') |
253 | 253 |
254 # Update the remotes first so we have all the refs. | 254 # Update the remotes first so we have all the refs. |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " | 850 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " |
851 "does not exist." | 851 "does not exist." |
852 % (' '.join(command), path)) | 852 % (' '.join(command), path)) |
853 # There's no file list to retrieve. | 853 # There's no file list to retrieve. |
854 else: | 854 else: |
855 scm.SVN.RunAndGetFileList(options, command, path, file_list) | 855 scm.SVN.RunAndGetFileList(options, command, path, file_list) |
856 | 856 |
857 def FullUrlForRelativeUrl(self, url): | 857 def FullUrlForRelativeUrl(self, url): |
858 # Find the forth '/' and strip from there. A bit hackish. | 858 # Find the forth '/' and strip from there. A bit hackish. |
859 return '/'.join(self.url.split('/')[:4]) + url | 859 return '/'.join(self.url.split('/')[:4]) + url |
OLD | NEW |