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) |