comparison mercurial/hg.py @ 11251:c61442f6d106

clone: print number of linked/copied files on --debug
author Adrian Buehlmann <adrian@cadifra.com>
date Mon, 31 May 2010 13:47:51 +0200
parents 5593ff6d1e5a
children 94b7b3a1ae1b
comparison
equal deleted inserted replaced
11250:ac6fec2af8c8 11251:c61442f6d106
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 hardlink = None
281 num = 0
281 for f in src_repo.store.copylist(): 282 for f in src_repo.store.copylist():
282 src = os.path.join(src_repo.sharedpath, f) 283 src = os.path.join(src_repo.sharedpath, f)
283 dst = os.path.join(dest_path, f) 284 dst = os.path.join(dest_path, f)
284 dstbase = os.path.dirname(dst) 285 dstbase = os.path.dirname(dst)
285 if dstbase and not os.path.exists(dstbase): 286 if dstbase and not os.path.exists(dstbase):
286 os.mkdir(dstbase) 287 os.mkdir(dstbase)
287 if os.path.exists(src): 288 if os.path.exists(src):
288 if dst.endswith('data'): 289 if dst.endswith('data'):
289 # lock to avoid premature writing to the target 290 # lock to avoid premature writing to the target
290 dest_lock = lock.lock(os.path.join(dstbase, "lock")) 291 dest_lock = lock.lock(os.path.join(dstbase, "lock"))
291 hardlink = util.copyfiles(src, dst, hardlink) 292 hardlink, n = util.copyfiles(src, dst, hardlink)
293 num += n
294 if hardlink:
295 ui.debug("linked %d files\n" % num)
296 else:
297 ui.debug("copied %d files\n" % num)
292 298
293 # we need to re-init the repo after manually copying the data 299 # we need to re-init the repo after manually copying the data
294 # into it 300 # into it
295 dest_repo = repository(ui, dest) 301 dest_repo = repository(ui, dest)
296 src_repo.hook('outgoing', source='clone', node='0'*40) 302 src_repo.hook('outgoing', source='clone', node='0'*40)