[PATCH 09 of 11 RFC] hg: use url.url to parse branch names in parseurl()
Brodie Rao
brodie at bitheap.org
Sat Mar 26 01:29:44 CDT 2011
# HG changeset patch
# User Brodie Rao <brodie at bitheap.org>
# Date 1301119183 25200
# Node ID c74e95416d7744994cf3174155717516040d7f1e
# Parent 0655facb4d07f6f1d7eb162e764667f6f0cb145c
hg: use url.url to parse branch names in parseurl()
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -51,13 +51,15 @@ def addbranchrevs(lrepo, repo, branches,
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,
More information about the Mercurial-devel
mailing list