Chromium Code Reviews| Index: gclient_scm.py |
| diff --git a/gclient_scm.py b/gclient_scm.py |
| index f5a434b1edaada44cfcc93e64cf897f2d3ca5ae7..ff889391055437b78c7220b74e4fdff556232605 100644 |
| --- a/gclient_scm.py |
| +++ b/gclient_scm.py |
| @@ -9,6 +9,7 @@ import logging |
| import os |
| import posixpath |
| import re |
| +import shlex |
| import sys |
| import tempfile |
| import threading |
| @@ -215,6 +216,16 @@ class GitWrapper(SCMWrapper): |
| def GetCheckoutRoot(self): |
| return scm.GIT.GetCheckoutRoot(self.checkout_path) |
| + def GetRemoteURL(self, options): |
| + try: |
| + remote_info = self._Capture(['remote', '-v']) |
| + except (OSError, subprocess2.CalledProcessError): |
| + return None |
| + for line in remote_info.splitlines(): |
| + if line.startswith('origin'): |
| + return shlex.split(line)[1] |
| + return None |
|
iannucci
2013/11/15 18:25:25
Maybe just `git config remote.origin.url` ? Also I
borenet
2013/11/25 13:55:42
I didn't see such a utility method, but I did see
|
| + |
| def GetRevisionDate(self, _revision): |
| """Returns the given revision's date in ISO-8601 format (which contains the |
| time zone).""" |
| @@ -1077,6 +1088,21 @@ class SVNWrapper(SCMWrapper): |
| def GetCheckoutRoot(self): |
| return scm.SVN.GetCheckoutRoot(self.checkout_path) |
| + def GetRemoteURL(self, options): |
| + try: |
| + if self.relpath: |
| + cwd = os.path.join(self._root_dir, self.relpath) |
| + else: |
| + cwd = self._root_dir |
| + svn_info = scm.SVN.Capture(['info', os.curdir], cwd) |
| + except (OSError, subprocess2.CalledProcessError): |
| + return None |
| + url_prefix = 'URL: ' |
| + for line in svn_info.splitlines(): |
| + if line.startswith(url_prefix): |
| + return line[len(url_prefix):].rstrip() |
| + return None |
|
iannucci
2013/11/15 18:25:25
I think we should probably rely on the XML version
borenet
2013/11/25 13:55:42
Done.
|
| + |
| def GetRevisionDate(self, revision): |
| """Returns the given revision's date in ISO-8601 format (which contains the |
| time zone).""" |