# HG changeset patch # User Thomas Arendsen Hein # Date 1302086939 -7200 # Node ID 375872fdadba7266eced67c85e57ffda26fa7500 # Parent 3b4025dcb223e8ec513b3c85e8425493bb7e2b4f hg: make parseurl() consistently return normalised path Before this the path was only normalised when a fragment was used. diff -r 3b4025dcb223 -r 375872fdadba mercurial/hg.py --- a/mercurial/hg.py Wed Apr 06 11:30:08 2011 +0100 +++ b/mercurial/hg.py Wed Apr 06 12:48:59 2011 +0200 @@ -55,10 +55,10 @@ '''parse url#branch, returning (url, (branch, branches))''' u = url.url(path) - if not u.fragment: - return path, (None, branches or []) - branch = u.fragment - u.fragment = None + branch = None + if u.fragment: + branch = u.fragment + u.fragment = None return str(u), (branch, branches or []) schemes = { diff -r 3b4025dcb223 -r 375872fdadba tests/test-hg-parseurl.py --- a/tests/test-hg-parseurl.py Wed Apr 06 11:30:08 2011 +0100 +++ b/tests/test-hg-parseurl.py Wed Apr 06 12:48:59 2011 +0200 @@ -8,3 +8,6 @@ testparse('http://example.com/no/anchor/branches', branch=['foo']) testparse('http://example.com/an/anchor/branches#bar', branch=['foo']) testparse('http://example.com/an/anchor/branches-None#foo', branch=None) +testparse('http://example.com/') +testparse('http://example.com') +testparse('http://example.com#foo') diff -r 3b4025dcb223 -r 375872fdadba tests/test-hg-parseurl.py.out --- a/tests/test-hg-parseurl.py.out Wed Apr 06 11:30:08 2011 +0100 +++ b/tests/test-hg-parseurl.py.out Wed Apr 06 12:48:59 2011 +0200 @@ -3,3 +3,6 @@ http://example.com/no/anchor/branches, branches: (None, ['foo']) http://example.com/an/anchor/branches, branches: ('bar', ['foo']) http://example.com/an/anchor/branches-None, branches: ('foo', []) +http://example.com/, branches: (None, []) +http://example.com/, branches: (None, []) +http://example.com/, branches: ('foo', [])