comparison mercurial/hg.py @ 47447:377d8fc20e34

clone: reuse the stream clone logic for local clone Streaming clone and local (non `--pull`) clone do mostly the same thing, however they were using different logic to do so. This means the logic frequently went out of sync and that new case had to be dealt with twice. This is fragile and anoying. So we replace this with a re-use of the logic we use for streaming clone. I can see various test changes: - a more precise progress output, - armless fncache loading during clone, - fncache is no longer hardlinked (since we write it by hand). I am not reinstalling the `reposimplestore` specific output, as far as I understand this variant have been broken for years. Differential Revision: https://phab.mercurial-scm.org/D10855
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 08 Jun 2021 02:06:45 +0200
parents d1c1fd7ac46d
children 1fdf315eff66
comparison
equal deleted inserted replaced
47446:09ff5d532a25 47447:377d8fc20e34
22 from .pycompat import getattr 22 from .pycompat import getattr
23 23
24 from . import ( 24 from . import (
25 bookmarks, 25 bookmarks,
26 bundlerepo, 26 bundlerepo,
27 cacheutil,
28 cmdutil, 27 cmdutil,
29 destutil, 28 destutil,
30 discovery, 29 discovery,
31 error, 30 error,
32 exchange, 31 exchange,
864 ui, 863 ui,
865 destrootpath, 864 destrootpath,
866 requirements=dest_reqs, 865 requirements=dest_reqs,
867 ) 866 )
868 destrepo = localrepo.makelocalrepository(ui, destrootpath) 867 destrepo = localrepo.makelocalrepository(ui, destrootpath)
869 868 destlock = destrepo.lock()
870 destpath = destrepo.vfs.base 869 from . import streamclone # avoid cycle
871 destlock = copystore(ui, srcrepo, destpath) 870
872 # copy bookmarks over 871 streamclone.local_copy(srcrepo, destrepo)
873 srcbookmarks = srcrepo.vfs.join(b'bookmarks')
874 dstbookmarks = os.path.join(destpath, b'bookmarks')
875 if os.path.exists(srcbookmarks):
876 util.copyfile(srcbookmarks, dstbookmarks)
877
878 dstcachedir = os.path.join(destpath, b'cache')
879 for cache in cacheutil.cachetocopy(srcrepo):
880 _copycache(srcrepo, dstcachedir, cache)
881 872
882 # we need to re-init the repo after manually copying the data 873 # we need to re-init the repo after manually copying the data
883 # into it 874 # into it
884 destpeer = peer(srcrepo, peeropts, dest) 875 destpeer = peer(srcrepo, peeropts, dest)
885 srcrepo.hook( 876 srcrepo.hook(