mercurial/commands.py
changeset 503 c6a2e41c8c60
parent 500 ebc4714a7632
child 505 dc1f735dfaac
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