From f6f5840276aca5a5bcc50a11022ffdc5eef2838c Mon Sep 17 00:00:00 2001 From: "ilevy@chromium.org" Date: Wed, 22 May 2013 00:14:32 +0000 Subject: [PATCH] Fix gclient sync 'dontswitchurl' url stickiness ._Capture throws exception on non-zero status, switch to subprocess2 capture method. Switch magic value to dontswitchurl. BUG=241907 R=dpranke@chromium.org, maruel@chromium.org Review URL: https://chromiumcodereview.appspot.com/15325003 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@201397 0039d316-1c4b-4281-b951-d872f2087c98 --- gclient_scm.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gclient_scm.py b/gclient_scm.py index 1c3eb7949..85d0d5032 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -322,8 +322,14 @@ class GitWrapper(SCMWrapper): current_url = self._Capture(['config', 'remote.origin.url']) # TODO(maruel): Delete url != 'git://foo' since it's just to make the # unit test pass. (and update the comment above) - if (current_url != url and url != 'git://foo' and - self._Capture(['config', 'remote.origin.gclient']) != 'getoffmylawn'): + # Skip url auto-correction if remote.origin.gclient-auto-fix-url is set. + # This allows devs to use experimental repos which have a different url + # but whose branch(s) are the same as official repos. + if (current_url != url and + url != 'git://foo' and + subprocess2.capture( + ['git', 'config', 'remote.origin.gclient-auto-fix-url'], + cwd=self.checkout_path).strip() != 'False'): print('_____ switching %s to a new upstream' % self.relpath) # Make sure it's clean self._CheckClean(rev_str) @@ -862,7 +868,7 @@ class GitWrapper(SCMWrapper): def _Capture(self, args): return subprocess2.check_output( ['git'] + args, - stderr=subprocess2.PIPE, + stderr=subprocess2.VOID, nag_timer=self.nag_timer, nag_max=self.nag_max, cwd=self.checkout_path).strip()