mercurial/hg.py
changeset 7935 39566bb99a9c
parent 7927 a218ba5f60df
child 8109 496ae1ea4698
equal deleted inserted replaced
7934:ec4784bb7d75 7935:39566bb99a9c
   166                 src_lock = src_repo.lock()
   166                 src_lock = src_repo.lock()
   167             except error.LockError:
   167             except error.LockError:
   168                 copy = False
   168                 copy = False
   169 
   169 
   170         if copy:
   170         if copy:
       
   171             hgdir = os.path.realpath(os.path.join(dest, ".hg"))
   171             if not os.path.exists(dest):
   172             if not os.path.exists(dest):
   172                 os.mkdir(dest)
   173                 os.mkdir(dest)
       
   174             else:
       
   175                 # only clean up directories we create ourselves
       
   176                 dir_cleanup.dir_ = hgdir
   173             try:
   177             try:
   174                 dest_path = os.path.realpath(os.path.join(dest, ".hg"))
   178                 dest_path = hgdir
   175                 os.mkdir(dest_path)
   179                 os.mkdir(dest_path)
   176             except OSError, inst:
   180             except OSError, inst:
   177                 if inst.errno == errno.EEXIST:
   181                 if inst.errno == errno.EEXIST:
   178                     dir_cleanup.close()
   182                     dir_cleanup.close()
   179                     raise util.Abort(_("destination '%s' already exists")
   183                     raise util.Abort(_("destination '%s' already exists")