Mercurial > hg
diff mercurial/localrepo.py @ 44826:35b255e474d9 stable
dirstate: make sure the dirstate is loaded before the changelog (issue6303)
Before this change, it was possible for the changelog to be loaded before the
dirstate. If a transaction happens betwen the changelog and dirstate reading,
the dirstate can up end poitning toward a revision not existing in the (olded)
changelog. This lead to a warning.
With this revision, we preload the dirstate parent before reading the changelog.
This has a negligible performance impact on performance for all case we are
tracking.
Differential Revision: https://phab.mercurial-scm.org/D8528
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 11 May 2020 13:08:02 +0200 |
parents | 1b8fd4af3318 |
children | fd3b94f1712d |
line wrap: on
line diff
--- a/mercurial/localrepo.py Mon May 11 16:44:11 2020 +0200 +++ b/mercurial/localrepo.py Mon May 11 13:08:02 2020 +0200 @@ -1450,6 +1450,8 @@ @storecache(b'00changelog.i') def changelog(self): + # load dirstate before changelog to avoid race see issue6303 + self.dirstate.prefetch_parents() return self.store.changelog(txnutil.mayhavepending(self.root)) @storecache(b'00manifest.i')