Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 return | 207 return |
| 208 | 208 |
| 209 if not os.path.exists(os.path.join(self.checkout_path, '.git')): | 209 if not os.path.exists(os.path.join(self.checkout_path, '.git')): |
| 210 raise gclient_utils.Error('\n____ %s%s\n' | 210 raise gclient_utils.Error('\n____ %s%s\n' |
| 211 '\tPath is not a git repo. No .git dir.\n' | 211 '\tPath is not a git repo. No .git dir.\n' |
| 212 '\tTo resolve:\n' | 212 '\tTo resolve:\n' |
| 213 '\t\trm -rf %s\n' | 213 '\t\trm -rf %s\n' |
| 214 '\tAnd run gclient sync again\n' | 214 '\tAnd run gclient sync again\n' |
| 215 % (self.relpath, rev_str, self.relpath)) | 215 % (self.relpath, rev_str, self.relpath)) |
| 216 | 216 |
| 217 # See if the url has changed | 217 # See if the url has changed (the unittests use git://foo for the url, let |
| 218 # that through) | |
| 218 current_url = self._Capture(['config', 'remote.origin.url']) | 219 current_url = self._Capture(['config', 'remote.origin.url']) |
| 219 if current_url != url: | 220 if current_url != url and url != 'git://foo': |
|
M-A Ruel
2011/03/25 20:38:53
Just add a
# TODO(maruel): Delete url != 'git://fo
| |
| 220 print('_____ switching %s to a new upstream' % self.relpath) | 221 print('_____ switching %s to a new upstream' % self.relpath) |
| 221 # Make sure it's clean | 222 # Make sure it's clean |
| 222 self._CheckClean(rev_str) | 223 self._CheckClean(rev_str) |
| 223 # Switch over to the new upstream | 224 # Switch over to the new upstream |
| 224 self._Run(['remote', 'set-url', 'origin', url], options) | 225 self._Run(['remote', 'set-url', 'origin', url], options) |
| 225 quiet = [] | 226 quiet = [] |
| 226 if not options.verbose: | 227 if not options.verbose: |
| 227 quiet = ['--quiet'] | 228 quiet = ['--quiet'] |
| 228 self._Run(['fetch', 'origin', '--prune'] + quiet, options) | 229 self._Run(['fetch', 'origin', '--prune'] + quiet, options) |
| 229 self._Run(['reset', '--hard', 'origin/master'] + quiet, options) | 230 self._Run(['reset', '--hard', 'origin/master'] + quiet, options) |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 921 | 922 |
| 922 This method returns a new list to be used as a command.""" | 923 This method returns a new list to be used as a command.""" |
| 923 new_command = command[:] | 924 new_command = command[:] |
| 924 if revision: | 925 if revision: |
| 925 new_command.extend(['--revision', str(revision).strip()]) | 926 new_command.extend(['--revision', str(revision).strip()]) |
| 926 # --force was added to 'svn update' in svn 1.5. | 927 # --force was added to 'svn update' in svn 1.5. |
| 927 if ((options.force or options.manually_grab_svn_rev) and | 928 if ((options.force or options.manually_grab_svn_rev) and |
| 928 scm.SVN.AssertVersion("1.5")[0]): | 929 scm.SVN.AssertVersion("1.5")[0]): |
| 929 new_command.append('--force') | 930 new_command.append('--force') |
| 930 return new_command | 931 return new_command |
| OLD | NEW |