##// END OF EJS Templates
clone: abort if default destination has no meaningful name (BC)...
Yuya Nishihara -
r20800:8253e559 default
parent child Browse files
Show More
@@ -132,13 +132,16 b' def defaultdest(source):'
132 >>> defaultdest('/')
132 >>> defaultdest('/')
133 ''
133 ''
134 >>> defaultdest('')
134 >>> defaultdest('')
135 '.'
135 ''
136 >>> defaultdest('http://example.org/')
136 >>> defaultdest('http://example.org/')
137 '.'
137 ''
138 >>> defaultdest('http://example.org/foo/')
138 >>> defaultdest('http://example.org/foo/')
139 'foo'
139 'foo'
140 '''
140 '''
141 return os.path.basename(os.path.normpath(util.url(source).path or ''))
141 path = util.url(source).path
142 if not path:
143 return ''
144 return os.path.basename(os.path.normpath(path))
142
145
143 def share(ui, source, dest=None, update=True):
146 def share(ui, source, dest=None, update=True):
144 '''create a shared repository'''
147 '''create a shared repository'''
@@ -290,7 +293,8 b' def clone(ui, peeropts, source, dest=Non'
290
293
291 if dest is None:
294 if dest is None:
292 dest = defaultdest(source)
295 dest = defaultdest(source)
293 ui.status(_("destination directory: %s\n") % dest)
296 if dest:
297 ui.status(_("destination directory: %s\n") % dest)
294 else:
298 else:
295 dest = ui.expandpath(dest)
299 dest = ui.expandpath(dest)
296
300
@@ -197,4 +197,11 b' clone remote via stream'
197 checking files
197 checking files
198 4 files, 9 changesets, 7 total revisions
198 4 files, 9 changesets, 7 total revisions
199 $ cd ..
199 $ cd ..
200
201 no default destination if url has no path:
202
203 $ hg clone http://localhost:$HGPORT/
204 abort: empty destination path is not valid
205 [255]
206
200 $ cat error.log
207 $ cat error.log
General Comments 0
You need to be logged in to leave comments. Login now