view tests/test-hg-parseurl.py @ 36557:d60430dc7853

convert: add some utility code for working with shlex on Python 3 This could have gone in pycompat, but it's only needed in convert, so I figured it made more sense here. It's got py3 in the name and checks pycompat.ispy3, so we'll find it whenever we decide to drop Python 2 support in 20x6. # no-check-commit because of required foo_bar naming on the proxy class Differential Revision: https://phab.mercurial-scm.org/D2525
author Augie Fackler <augie@google.com>
date Thu, 01 Mar 2018 17:47:35 -0500
parents d26c4af27978
children 11d128a14ec0
line wrap: on
line source

from __future__ import absolute_import, print_function

from mercurial import (
    hg,
)

def testparse(url, branch=[]):
    print('%s, branches: %r' % hg.parseurl(url, branch))

testparse('http://example.com/no/anchor')
testparse('http://example.com/an/anchor#foo')
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')