##// END OF EJS Templates
Deal with failed clone/transaction interaction...
mpm@selenic.com -
r535:fba26990 default
parent child Browse files
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 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
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