| Index: gclient_scm.py
|
| diff --git a/gclient_scm.py b/gclient_scm.py
|
| index f5a434b1edaada44cfcc93e64cf897f2d3ca5ae7..6bc9081f0f06153258a64159412582a179efd760 100644
|
| --- a/gclient_scm.py
|
| +++ b/gclient_scm.py
|
| @@ -215,6 +215,13 @@ class GitWrapper(SCMWrapper):
|
| def GetCheckoutRoot(self):
|
| return scm.GIT.GetCheckoutRoot(self.checkout_path)
|
|
|
| + def GetRemoteURL(self, options, cwd=None):
|
| + try:
|
| + return self._Capture(['config', 'remote.origin.url'],
|
| + cwd=cwd or self.checkout_path).rstrip()
|
| + except (OSError, subprocess2.CalledProcessError):
|
| + return None
|
| +
|
| def GetRevisionDate(self, _revision):
|
| """Returns the given revision's date in ISO-8601 format (which contains the
|
| time zone)."""
|
| @@ -375,7 +382,7 @@ class GitWrapper(SCMWrapper):
|
|
|
| # See if the url has changed (the unittests use git://foo for the url, let
|
| # that through).
|
| - current_url = self._Capture(['config', 'remote.origin.url'])
|
| + current_url = self.GetRemoteURL(options)
|
| return_early = False
|
| # TODO(maruel): Delete url != 'git://foo' since it's just to make the
|
| # unit test pass. (and update the comment above)
|
| @@ -807,8 +814,7 @@ class GitWrapper(SCMWrapper):
|
| # to relax this restriction in the future to allow for smarter cache
|
| # repo update schemes (such as pulling the same repo, but from a
|
| # different host).
|
| - existing_url = self._Capture(['config', 'remote.origin.url'],
|
| - cwd=folder)
|
| + existing_url = self.GetRemoteURL(options, cwd=folder)
|
| assert self._NormalizeGitURL(existing_url) == self._NormalizeGitURL(url)
|
|
|
| if use_reference:
|
| @@ -1077,6 +1083,13 @@ class SVNWrapper(SCMWrapper):
|
| def GetCheckoutRoot(self):
|
| return scm.SVN.GetCheckoutRoot(self.checkout_path)
|
|
|
| + def GetRemoteURL(self, options):
|
| + try:
|
| + local_info = scm.SVN.CaptureLocalInfo([os.curdir], self.checkout_path)
|
| + except (OSError, subprocess2.CalledProcessError):
|
| + return None
|
| + return local_info.get('URL')
|
| +
|
| def GetRevisionDate(self, revision):
|
| """Returns the given revision's date in ISO-8601 format (which contains the
|
| time zone)."""
|
|
|