mercurial/commands.py
changeset 513 2ab152e45de4
parent 512 78896f572a22
child 515 03f27b1381f9
equal deleted inserted replaced
512:78896f572a22 513:2ab152e45de4
   267 
   267 
   268 def clone(ui, source, dest = None, **opts):
   268 def clone(ui, source, dest = None, **opts):
   269     """make a copy of an existing repository"""
   269     """make a copy of an existing repository"""
   270     source = ui.expandpath(source)
   270     source = ui.expandpath(source)
   271 
   271 
   272     created = success = False
   272     success = False
   273 
   273 
   274     if dest is None:
   274     if dest is None:
   275         dest = os.getcwd()
   275         dest = os.getcwd()
   276     elif not os.path.exists(dest):
   276     elif not os.path.exists(dest):
   277         os.mkdir(dest)
   277         os.mkdir(dest)
   312             update(ui, repo)
   312             update(ui, repo)
   313 
   313 
   314         success = True
   314         success = True
   315         
   315         
   316     finally:
   316     finally:
   317         if not success:
   317         if created and not success:
   318             import shutil
   318             import shutil
   319             shutil.rmtree(dest, True)
   319             shutil.rmtree(dest, True)
   320     
   320     
   321 def commit(ui, repo, *files, **opts):
   321 def commit(ui, repo, *files, **opts):
   322     """commit the specified files or all outstanding changes"""
   322     """commit the specified files or all outstanding changes"""