tests/test-hg-parseurl.py
author Sean Farley <sean@farley.io>
Tue, 01 Aug 2017 14:40:19 -0700
branchstable
changeset 33650 d7a1c4c1181d
parent 28806 d26c4af27978
child 37713 11d128a14ec0
permissions -rw-r--r--
sshpeer: check for safe ssh url (SEC) Checking in the sshpeer for a rogue ssh:// urls seems like the right place to do it (instead of whack-a-mole with pull, clone, push, etc).

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')