Show More
@@ -272,8 +272,6 b' def clone(ui, source, dest = None, **opt' | |||
|
272 | 272 | """make a copy of an existing repository""" |
|
273 | 273 | source = ui.expandpath(source) |
|
274 | 274 | |
|
275 | success = False | |
|
276 | ||
|
277 | 275 | if dest is None: |
|
278 | 276 | dest = os.path.basename(os.path.normpath(source)) |
|
279 | 277 | |
@@ -281,9 +279,19 b' def clone(ui, source, dest = None, **opt' | |||
|
281 | 279 | ui.warn("abort: destination '%s' already exists\n" % dest) |
|
282 | 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 |
|
|
288 | 296 |
|
|
289 | 297 |
|
@@ -314,12 +322,7 b' def clone(ui, source, dest = None, **opt' | |||
|
314 | 322 |
|
|
315 | 323 |
|
|
316 | 324 | |
|
317 | success = True | |
|
318 | ||
|
319 | finally: | |
|
320 | if not success: | |
|
321 | import shutil | |
|
322 | shutil.rmtree(dest, True) | |
|
325 | d.close() | |
|
323 | 326 | |
|
324 | 327 | def commit(ui, repo, *files, **opts): |
|
325 | 328 | """commit the specified files or all outstanding changes""" |
General Comments 0
You need to be logged in to leave comments.
Login now