comparison mercurial/commands.py @ 503:c6a2e41c8c60

Fix troubles with clone and exception handling -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Fix troubles with clone and exception handling Clone deletes its directory on failure This was deleting the lockfile out from under the lock object before it got destroyed This patch shuts lock up and makes the cleanup code for clone a little cleaner. manifest hash: f666fddcf6f3a905020a091f5e9fd2cb5d806cdd -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCwSGOywK+sNU5EO8RAkx2AKCIxPczl9YWnuUM+bMQnpVr8kv6uQCeNWld SUxSB99PGJHhq1LWFaSJJNw= =Frk/ -----END PGP SIGNATURE-----
author mpm@selenic.com
date Tue, 28 Jun 2005 02:08:14 -0800
parents ebc4714a7632
children dc1f735dfaac
comparison
equal deleted inserted replaced
502:509e62469cb1 503:c6a2e41c8c60
271 for name, path in ui.configitems("paths"): 271 for name, path in ui.configitems("paths"):
272 paths[name] = path 272 paths[name] = path
273 273
274 if source in paths: source = paths[source] 274 if source in paths: source = paths[source]
275 275
276 created = False 276 created = success = False
277 277
278 if dest is None: 278 if dest is None:
279 dest = os.getcwd() 279 dest = os.getcwd()
280 elif not os.path.exists(dest): 280 elif not os.path.exists(dest):
281 os.mkdir(dest) 281 os.mkdir(dest)
312 f.write("[paths]\n") 312 f.write("[paths]\n")
313 f.write("default = %s\n" % source) 313 f.write("default = %s\n" % source)
314 314
315 if not opts['no-update']: 315 if not opts['no-update']:
316 update(ui, repo) 316 update(ui, repo)
317 except: 317
318 if created: 318 success = True
319
320 finally:
321 if not success:
322 del repo
319 import shutil 323 import shutil
320 shutil.rmtree(dest, True) 324 shutil.rmtree(dest, True)
321 raise 325
322
323 def commit(ui, repo, *files, **opts): 326 def commit(ui, repo, *files, **opts):
324 """commit the specified files or all outstanding changes""" 327 """commit the specified files or all outstanding changes"""
325 text = opts['text'] 328 text = opts['text']
326 if not text and opts['logfile']: 329 if not text and opts['logfile']:
327 try: text = open(opts['logfile']).read() 330 try: text = open(opts['logfile']).read()
902 if len(tb) > 2: # no 905 if len(tb) > 2: # no
903 raise 906 raise
904 u.debug(inst, "\n") 907 u.debug(inst, "\n")
905 u.warn("%s: invalid arguments\n" % i[0].__name__) 908 u.warn("%s: invalid arguments\n" % i[0].__name__)
906 help(u, cmd) 909 help(u, cmd)
907 sys.exit(-1) 910
908 911 sys.exit(-1)
912