# HG changeset patch # User Matt Mackall # Date 2011-09-10 22:49:19 # Node ID 64fbd0de97730ab2ccd288c150d6ca03de3a9cec # Parent 19071b04c9c12b09f922b3fed10c4c3c7dddb962 url: parse fragments first (issue2997) diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1434,6 +1434,8 @@ class url(object): >>> url(r'\\blah\blah\blah') + >>> url(r'\\blah\blah\blah#baz') + Authentication credentials: @@ -1462,6 +1464,11 @@ class url(object): self._hostport = '' self._origpath = path + if parsefragment and '#' in path: + path, self.fragment = path.split('#', 1) + if not path: + path = None + # special case for Windows drive letters and UNC paths if hasdriveletter(path) or path.startswith(r'\\'): self.path = path @@ -1489,10 +1496,6 @@ class url(object): self.path = '' return else: - if parsefragment and '#' in path: - path, self.fragment = path.split('#', 1) - if not path: - path = None if self._localpath: self.path = path return