changeset 13824:ec1695350361

hg: use url.url to parse branch names in parseurl()
author Brodie Rao <brodie@bitheap.org>
date Wed, 30 Mar 2011 20:02:09 -0700
parents ad179644750f
children cc383142e738
files mercurial/hg.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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,