Chromium Code Reviews| Index: gclient_scm.py |
| diff --git a/gclient_scm.py b/gclient_scm.py |
| index af48b5f7f33b5984667abe2e4887f9f224e59737..0ea906fbb3afd687b436616337e72202aa0e7d74 100644 |
| --- a/gclient_scm.py |
| +++ b/gclient_scm.py |
| @@ -8,6 +8,7 @@ import logging |
| import os |
| import posixpath |
| import re |
| +import shlex |
| import sys |
| import tempfile |
| import traceback |
| @@ -139,6 +140,24 @@ class SCMWrapper(object): |
| return getattr(self, command)(options, args, file_list) |
| + def GetActualRemoteURL(self): |
| + """Attempt to determine the remote URL for this SCMWrapper.""" |
|
borenet
2014/03/13 13:53:35
I just copied the new code here, because GitWrappe
iannucci
2014/03/13 18:27:27
yeah, that seems reasonable to me.
|
| + try: |
| + return shlex.split(scm.GIT.Capture( |
| + ['config', '--local', '--get-regexp', r'remote.*.url'], |
| + self.checkout_path))[1] |
| + except Exception: |
| + pass |
| + try: |
| + return scm.SVN.CaptureLocalInfo([], self.checkout_path)['URL'] |
| + except Exception: |
| + pass |
| + return None |
| + |
| + def DoesRemoteURLMatch(self): |
| + """Determine whether the remote URL of this checkout is the expected URL.""" |
| + return self.GetActualRemoteURL().rstrip('/') == self.url.rstrip('/') |
| + |
| class GitWrapper(SCMWrapper): |
| """Wrapper for Git""" |