Index: gclient_scm.py |
diff --git a/gclient_scm.py b/gclient_scm.py |
index 0dabd265e4fbfb1b388156dff71cca2914444a3e..c686445a0d0080843a25c88fa80412e898b54653 100644 |
--- a/gclient_scm.py |
+++ b/gclient_scm.py |
@@ -11,7 +11,6 @@ import logging |
import os |
import posixpath |
import re |
-import shlex |
import sys |
import tempfile |
import traceback |
@@ -161,11 +160,15 @@ class SCMWrapper(object): |
def GetActualRemoteURL(self, options): |
"""Attempt to determine the remote URL for this SCMWrapper.""" |
+ def _get_first_remote_url(checkout_path): |
+ log = scm.GIT.Capture( |
+ ['config', '--local', '--get-regexp', r'remote.*.url'], |
+ cwd=checkout_path) |
+ return re.search(r'^remote\..*\.url (.*)$', log).group(1) |
iannucci
2014/08/22 16:59:00
I think this could just be
log.splitlines()[0].sp
|
+ |
# Git |
if os.path.exists(os.path.join(self.checkout_path, '.git')): |
- actual_remote_url = shlex.split(scm.GIT.Capture( |
- ['config', '--local', '--get-regexp', r'remote.*.url'], |
- cwd=self.checkout_path))[1] |
+ actual_remote_url = _get_first_remote_url(self.checkout_path) |
# If a cache_dir is used, obtain the actual remote URL from the cache. |
if getattr(self, 'cache_dir', None): |
@@ -173,9 +176,7 @@ class SCMWrapper(object): |
mirror = git_cache.Mirror(url) |
if (mirror.exists() and mirror.mirror_path.replace('\\', '/') == |
actual_remote_url.replace('\\', '/')): |
- actual_remote_url = shlex.split(scm.GIT.Capture( |
- ['config', '--local', '--get-regexp', r'remote.*.url'], |
- cwd=mirror.mirror_path))[1] |
+ actual_remote_url = _get_first_remote_url(mirror.mirror_path) |
return actual_remote_url |
# Svn |