diff -r 5b08e8b7ab00 -r e6067bec18da mercurial/hg.py --- a/mercurial/hg.py Wed Oct 10 01:30:45 2012 +0200 +++ b/mercurial/hg.py Wed Oct 03 13:19:53 2012 -0700 @@ -336,6 +336,16 @@ destlock = copystore(ui, srcrepo, destpath) + # Recomputing branch cache might be slow on big repos, + # so just copy it + dstcachedir = os.path.join(destpath, 'cache') + srcbranchcache = srcrepo.sjoin('cache/branchheads') + dstbranchcache = os.path.join(dstcachedir, 'branchheads') + if os.path.exists(srcbranchcache): + if not os.path.exists(dstcachedir): + os.mkdir(dstcachedir) + util.copyfile(srcbranchcache, dstbranchcache) + # we need to re-init the repo after manually copying the data # into it destpeer = peer(ui, peeropts, dest)