comparison mercurial/hg.py @ 7935:39566bb99a9c

on clone failure, only remove directories we created If the user created the clone target directory before running the clone command, only cleanup the .hg/ repository when errors occur. Leave the empty target directory in place.
author Steve Borho <steve@borho.org>
date Tue, 31 Mar 2009 21:21:53 -0500
parents a218ba5f60df
children 496ae1ea4698
comparison
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")