Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hg.py @ 46314:95a615dd77bf
clone: make sure we warm the cache after a clone
This work around any deviciency/limitation of the clone process. In our case
this ensure the persistent nodemap exist with valid content.
Ideally, the cloning process would also do "the right thing". However since
older server will never be able to do "the right thing". The local workaround
will be necessary anyway.
I am not worried by the performance impact of this as `hg clone` is non-instant
on large repositories where is could matters. Warming the cache if they are
already correct is very fast. And if they are not already warm, this seems like
a good time to do so.
This impact various test as more cache are now warmed sooner, all the change
should be harmless.
Differential Revision: https://phab.mercurial-scm.org/D9789
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 15 Jan 2021 12:41:38 +0100 |
parents | 72007a9ac064 |
children | 1099541b6462 a4c19a162615 |
line wrap: on
line diff
--- a/mercurial/hg.py Thu Jan 14 04:56:29 2021 +0100 +++ b/mercurial/hg.py Fri Jan 15 12:41:38 2021 +0100 @@ -1038,6 +1038,14 @@ _update(destrepo, uprev) if update in destrepo._bookmarks: bookmarks.activate(destrepo, update) + if destlock is not None: + release(destlock) + # here is a tiny windows were someone could end up writing the + # repository before the cache are sure to be warm. This is "fine" + # as the only "bad" outcome would be some slowness. That potential + # slowness already affect reader. + with destrepo.lock(): + destrepo.updatecaches(full=True) finally: release(srclock, destlock) if cleandir is not None: