clone: add doctest for default destination

This commit is contained in:
Yuya Nishihara 2014-03-22 00:46:08 +09:00
parent c173245d83
commit b9bc586fe9
2 changed files with 16 additions and 1 deletions

View File

@ -123,7 +123,21 @@ def peer(uiorrepo, opts, path, create=False):
return _peerorrepo(rui, path, create).peer()
def defaultdest(source):
'''return default destination of clone if none is given'''
'''return default destination of clone if none is given
>>> defaultdest('foo')
'foo'
>>> defaultdest('/foo/bar')
'bar'
>>> defaultdest('/')
''
>>> defaultdest('')
'.'
>>> defaultdest('http://example.org/')
'.'
>>> defaultdest('http://example.org/foo/')
'foo'
'''
return os.path.basename(os.path.normpath(util.url(source).path or ''))
def share(ui, source, dest=None, update=True):

View File

@ -15,6 +15,7 @@ testmod('mercurial.changelog')
testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE)
testmod('mercurial.dispatch')
testmod('mercurial.encoding')
testmod('mercurial.hg')
testmod('mercurial.hgweb.hgwebdir_mod')
testmod('mercurial.match')
testmod('mercurial.minirst')