Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(810)

Unified Diff: gclient_scm.py

Issue 391048: gclient: fix another bug where ssh urls weren't parsed correctly (Closed)
Patch Set: fix per code review Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient.py ('k') | gclient_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index 5013759672011bdc009534d0c769563c9591b575..a9c537b9c2baf0b283f230815cfdeb1d5282cb54 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -129,23 +129,16 @@ class GitWrapper(SCMWrapper):
if args:
raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args))
- if self.url.startswith('ssh:'):
- # Make sure ssh://test@example.com/test.git@stable works
- regex = r"(ssh://(?:[\w]+@)?[-\w:\.]+/[-\w\.]+)(?:@([\w/]+))?"
- components = re.search(regex, self.url).groups()
- else:
- components = self.url.split("@")
- url = components[0]
- revision = None
+ url, revision = gclient_utils.SplitUrlRevision(self.url)
+ rev_str = ""
if options.revision:
- revision = options.revision
- elif len(components) == 2:
- revision = components[1]
+ # Override the revision number.
+ revision = str(options.revision)
+ if revision:
+ url = '%s@%s' % (url, revision)
+ rev_str = ' at %s' % revision
if options.verbose:
- rev_str = ""
- if revision:
- rev_str = ' at %s' % revision
print("\n_____ %s%s" % (self.relpath, rev_str))
if not os.path.exists(self.checkout_path):
@@ -269,21 +262,16 @@ class SVNWrapper(SCMWrapper):
if args:
raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args))
- url = self.url
- components = url.split("@")
- revision = None
+ url, revision = gclient_utils.SplitUrlRevision(self.url)
+ base_url = url
forced_revision = False
+ rev_str = ""
if options.revision:
# Override the revision number.
- url = '%s@%s' % (components[0], str(options.revision))
- revision = options.revision
- forced_revision = True
- elif len(components) == 2:
- revision = components[1]
- forced_revision = True
-
- rev_str = ""
+ revision = str(options.revision)
if revision:
+ forced_revision = True
+ url = '%s@%s' % (url, revision)
rev_str = ' at %s' % revision
if not os.path.exists(checkout_path):
@@ -309,7 +297,7 @@ class SVNWrapper(SCMWrapper):
revision = str(from_info_live['Revision'])
rev_str = ' at %s' % revision
- if from_info['URL'] != components[0]:
+ if from_info['URL'] != base_url:
to_info = CaptureSVNInfo(url, '.')
if not to_info.get('Repository Root') or not to_info.get('UUID'):
# The url is invalid or the server is not accessible, it's safer to bail
« no previous file with comments | « gclient.py ('k') | gclient_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698