# HG changeset patch # User Brodie Rao # Date 2011-03-31 03:02:09 # Node ID ec16953503610b95bb0c49739f3b41c76bfd9352 # Parent ad179644750fb254517d822541f4e4a3bd2005e2 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,