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

Unified Diff: gclient_utils.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_scm.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_utils.py
diff --git a/gclient_utils.py b/gclient_utils.py
index d21467fd7b3b4dc1639341b836abd13c72853cc0..9016270d4d917c70202400f68b8c0299b090352d 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -14,6 +14,7 @@
import errno
import os
+import re
import stat
import subprocess
import sys
@@ -24,6 +25,19 @@ import xml.parsers.expat
## Generic utils
+def SplitUrlRevision(url):
+ """Splits url and returns a two-tuple: url, rev"""
+ if url.startswith('ssh:'):
+ # Make sure ssh://test@example.com/test.git@stable works
+ regex = r"(ssh://(?:[\w]+@)?[-\w:\.]+/[-\w\.]+)(?:@([\w/]+))?"
+ components = re.search(regex, url).groups()
+ else:
+ components = url.split("@")
+ if len(components) == 1:
+ components += [None]
+ return tuple(components)
+
+
def ParseXML(output):
try:
return xml.dom.minidom.parseString(output)
« no previous file with comments | « gclient_scm.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698