Index: gclient_scm.py |
=================================================================== |
--- gclient_scm.py (revision 79277) |
+++ gclient_scm.py (working copy) |
@@ -186,6 +186,27 @@ |
verbose = ['--verbose'] |
printed_path = True |
+ # See if the url has changed |
+ current_url = self._Capture(['config', 'remote.origin.url']) |
+ if current_url != url: |
+ print('_____ switching %s to a new upstream' % self.relpath) |
+ # Make sure it's clean |
+ self._CheckClean(rev_str) |
+ # Switch over to the new upstream |
+ commands = [ |
+ (['remote', 'set-url', 'origin', url], None), |
+ (['fetch', 'origin', '--prune'], '--quiet'), |
+ (['reset', '--hard', 'origin/master'], '-q'), |
+ ] |
+ for cmd, quiet_arg in commands: |
M-A Ruel
2011/03/24 17:17:02
It's funny but the following is still less lines (
TVL
2011/03/24 17:43:11
Done. (help didn't list --quiet as valid for rese
|
+ if not options.verbose and quiet_arg: |
+ cmd.append(quiet_arg) |
+ self._Run(cmd, options, cwd=self.checkout_path) |
+ # List the tree in the file list |
+ files = self._Capture(['ls-files']).split() |
M-A Ruel
2011/03/24 17:17:02
splitlines() ?
TVL
2011/03/24 17:43:11
I just copied what 222-223 do for a fresh clone, s
|
+ file_list.extend([os.path.join(self.checkout_path, f) for f in files]) |
+ return |
+ |
if revision.startswith('refs/heads/'): |
rev_type = "branch" |
elif revision.startswith('origin/'): |