hg: use url.url to parse branch names in parseurl()
authorBrodie Rao <brodie@bitheap.org>
Wed, 30 Mar 2011 20:02:09 -0700
changeset 13824 ec1695350361
parent 13823 ad179644750f
child 13825 cc383142e738
hg: use url.url to parse branch names in parseurl()
mercurial/hg.py
--- a/mercurial/hg.py	Wed Mar 30 20:02:07 2011 -0700
+++ b/mercurial/hg.py	Wed Mar 30 20:02:09 2011 -0700
@@ -51,13 +51,15 @@
             revs.append(hashbranch)
     return revs, revs[0]
 
-def parseurl(url, branches=None):
+def parseurl(path, branches=None):
     '''parse url#branch, returning (url, (branch, branches))'''
 
-    if '#' not in url:
-        return url, (None, branches or [])
-    url, branch = url.split('#', 1)
-    return url, (branch, branches or [])
+    u = url.url(path)
+    if not u.fragment:
+        return path, (None, branches or [])
+    branch = u.fragment
+    u.fragment = None
+    return str(u), (branch, branches or [])
 
 schemes = {
     'bundle': bundlerepo,