gclient: fix bug where ssh urls with a username weren't parse correctly

ssh://test@example.org/test.git was not parsed correctly because we
would split at the '@' assuming what followed was a revision.

Review URL: http://codereview.chromium.org/372045

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@31444 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_scm.py b/gclient_scm.py
index ab381bf..ea8e36b 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -125,7 +125,12 @@
     if args:
       raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args))
 
-    components = self.url.split("@")
+    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
     if options.revision: