Show More
@@ -272,8 +272,6 b' def clone(ui, source, dest = None, **opt' | |||||
272 | """make a copy of an existing repository""" |
|
272 | """make a copy of an existing repository""" | |
273 | source = ui.expandpath(source) |
|
273 | source = ui.expandpath(source) | |
274 |
|
274 | |||
275 | success = False |
|
|||
276 |
|
||||
277 | if dest is None: |
|
275 | if dest is None: | |
278 | dest = os.path.basename(os.path.normpath(source)) |
|
276 | dest = os.path.basename(os.path.normpath(source)) | |
279 |
|
277 | |||
@@ -281,9 +279,19 b' def clone(ui, source, dest = None, **opt' | |||||
281 | ui.warn("abort: destination '%s' already exists\n" % dest) |
|
279 | ui.warn("abort: destination '%s' already exists\n" % dest) | |
282 | return 1 |
|
280 | return 1 | |
283 |
|
281 | |||
284 | os.mkdir(dest) |
|
282 | class dircleanup: | |
|
283 | def __init__(self, dir): | |||
|
284 | self.dir = dir | |||
|
285 | os.mkdir(dir) | |||
|
286 | def close(self): | |||
|
287 | self.dir = None | |||
|
288 | def __del__(self): | |||
|
289 | if self.dir: | |||
|
290 | import shutil | |||
|
291 | shutil.rmtree(self.dir, True) | |||
285 |
|
292 | |||
286 | try: |
|
293 | d = dircleanup(dest) | |
|
294 | ||||
287 |
|
|
295 | link = 0 | |
288 |
|
|
296 | if not source.startswith("http://"): | |
289 |
|
|
297 | d1 = os.stat(dest).st_dev | |
@@ -314,12 +322,7 b' def clone(ui, source, dest = None, **opt' | |||||
314 |
|
|
322 | if not opts['noupdate']: | |
315 |
|
|
323 | update(ui, repo) | |
316 |
|
324 | |||
317 | success = True |
|
325 | d.close() | |
318 |
|
||||
319 | finally: |
|
|||
320 | if not success: |
|
|||
321 | import shutil |
|
|||
322 | shutil.rmtree(dest, True) |
|
|||
323 |
|
326 | |||
324 | def commit(ui, repo, *files, **opts): |
|
327 | def commit(ui, repo, *files, **opts): | |
325 | """commit the specified files or all outstanding changes""" |
|
328 | """commit the specified files or all outstanding changes""" |
General Comments 0
You need to be logged in to leave comments.
Login now