275 dir_cleanup.close() |
275 dir_cleanup.close() |
276 raise util.Abort(_("destination '%s' already exists") |
276 raise util.Abort(_("destination '%s' already exists") |
277 % dest) |
277 % dest) |
278 raise |
278 raise |
279 |
279 |
|
280 hardlink = None |
280 for f in src_repo.store.copylist(): |
281 for f in src_repo.store.copylist(): |
281 src = os.path.join(src_repo.sharedpath, f) |
282 src = os.path.join(src_repo.sharedpath, f) |
282 dst = os.path.join(dest_path, f) |
283 dst = os.path.join(dest_path, f) |
283 dstbase = os.path.dirname(dst) |
284 dstbase = os.path.dirname(dst) |
284 if dstbase and not os.path.exists(dstbase): |
285 if dstbase and not os.path.exists(dstbase): |
285 os.mkdir(dstbase) |
286 os.mkdir(dstbase) |
286 if os.path.exists(src): |
287 if os.path.exists(src): |
287 if dst.endswith('data'): |
288 if dst.endswith('data'): |
288 # lock to avoid premature writing to the target |
289 # lock to avoid premature writing to the target |
289 dest_lock = lock.lock(os.path.join(dstbase, "lock")) |
290 dest_lock = lock.lock(os.path.join(dstbase, "lock")) |
290 util.copyfiles(src, dst) |
291 hardlink = util.copyfiles(src, dst, hardlink) |
291 |
292 |
292 # we need to re-init the repo after manually copying the data |
293 # we need to re-init the repo after manually copying the data |
293 # into it |
294 # into it |
294 dest_repo = repository(ui, dest) |
295 dest_repo = repository(ui, dest) |
295 src_repo.hook('outgoing', source='clone', node='0'*40) |
296 src_repo.hook('outgoing', source='clone', node='0'*40) |