mercurial/hg.py
changeset 20799 069bf1b821c8
parent 20790 49f2d5644f04
child 20800 8253e55930a3
equal deleted inserted replaced
20798:170d6d591a7d 20799:069bf1b821c8
   121     '''return a repository peer for the specified path'''
   121     '''return a repository peer for the specified path'''
   122     rui = remoteui(uiorrepo, opts)
   122     rui = remoteui(uiorrepo, opts)
   123     return _peerorrepo(rui, path, create).peer()
   123     return _peerorrepo(rui, path, create).peer()
   124 
   124 
   125 def defaultdest(source):
   125 def defaultdest(source):
   126     '''return default destination of clone if none is given'''
   126     '''return default destination of clone if none is given
       
   127 
       
   128     >>> defaultdest('foo')
       
   129     'foo'
       
   130     >>> defaultdest('/foo/bar')
       
   131     'bar'
       
   132     >>> defaultdest('/')
       
   133     ''
       
   134     >>> defaultdest('')
       
   135     '.'
       
   136     >>> defaultdest('http://example.org/')
       
   137     '.'
       
   138     >>> defaultdest('http://example.org/foo/')
       
   139     'foo'
       
   140     '''
   127     return os.path.basename(os.path.normpath(util.url(source).path or ''))
   141     return os.path.basename(os.path.normpath(util.url(source).path or ''))
   128 
   142 
   129 def share(ui, source, dest=None, update=True):
   143 def share(ui, source, dest=None, update=True):
   130     '''create a shared repository'''
   144     '''create a shared repository'''
   131 
   145