OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 from __future__ import print_function | 7 from __future__ import print_function |
8 | 8 |
9 import errno | 9 import errno |
10 import logging | 10 import logging |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 # unit test pass. (and update the comment above) | 419 # unit test pass. (and update the comment above) |
420 # Skip url auto-correction if remote.origin.gclient-auto-fix-url is set. | 420 # Skip url auto-correction if remote.origin.gclient-auto-fix-url is set. |
421 # This allows devs to use experimental repos which have a different url | 421 # This allows devs to use experimental repos which have a different url |
422 # but whose branch(s) are the same as official repos. | 422 # but whose branch(s) are the same as official repos. |
423 if (current_url.rstrip('/') != url.rstrip('/') and | 423 if (current_url.rstrip('/') != url.rstrip('/') and |
424 url != 'git://foo' and | 424 url != 'git://foo' and |
425 subprocess2.capture( | 425 subprocess2.capture( |
426 ['git', 'config', 'remote.%s.gclient-auto-fix-url' % self.remote], | 426 ['git', 'config', 'remote.%s.gclient-auto-fix-url' % self.remote], |
427 cwd=self.checkout_path).strip() != 'False'): | 427 cwd=self.checkout_path).strip() != 'False'): |
428 self.Print('_____ switching %s to a new upstream' % self.relpath) | 428 self.Print('_____ switching %s to a new upstream' % self.relpath) |
429 # Make sure it's clean | 429 if not (options.force or options.reset): |
430 self._CheckClean(rev_str) | 430 # Make sure it's clean |
| 431 self._CheckClean(rev_str) |
431 # Switch over to the new upstream | 432 # Switch over to the new upstream |
432 self._Run(['remote', 'set-url', self.remote, url], options) | 433 self._Run(['remote', 'set-url', self.remote, url], options) |
433 self._FetchAndReset(revision, file_list, options) | 434 self._FetchAndReset(revision, file_list, options) |
434 return_early = True | 435 return_early = True |
435 | 436 |
436 if return_early: | 437 if return_early: |
437 return self._Capture(['rev-parse', '--verify', 'HEAD']) | 438 return self._Capture(['rev-parse', '--verify', 'HEAD']) |
438 | 439 |
439 cur_branch = self._GetCurrentBranch() | 440 cur_branch = self._GetCurrentBranch() |
440 | 441 |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 new_command.append('--force') | 1572 new_command.append('--force') |
1572 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1573 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1573 new_command.extend(('--accept', 'theirs-conflict')) | 1574 new_command.extend(('--accept', 'theirs-conflict')) |
1574 elif options.manually_grab_svn_rev: | 1575 elif options.manually_grab_svn_rev: |
1575 new_command.append('--force') | 1576 new_command.append('--force') |
1576 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1577 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1577 new_command.extend(('--accept', 'postpone')) | 1578 new_command.extend(('--accept', 'postpone')) |
1578 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1579 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1579 new_command.extend(('--accept', 'postpone')) | 1580 new_command.extend(('--accept', 'postpone')) |
1580 return new_command | 1581 return new_command |
OLD | NEW |