Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 50324:e6532a7336d0 stable
dirstate: try refreshing the changelog when parent are unknown
See inline comment for details.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 23 Mar 2023 21:18:54 +0000 |
parents | 6901916458bd |
children | 3a2df812e1c7 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Thu Mar 23 21:18:14 2023 +0000 +++ b/mercurial/localrepo.py Thu Mar 23 21:18:54 2023 +0000 @@ -1805,10 +1805,29 @@ ) def _dirstatevalidate(self, node): + okay = True try: self.changelog.rev(node) + except error.LookupError: + # If the parent are unknown it might just be because the changelog + # in memory is lagging behind the dirstate in memory. So try to + # refresh the changelog first. + # + # We only do so if we don't hold the lock, if we do hold the lock + # the invalidation at that time should have taken care of this and + # something is very fishy. + if self.currentlock() is None: + self.invalidate() + try: + self.changelog.rev(node) + except error.LookupError: + okay = False + else: + # XXX we should consider raising an error here. + okay = False + if okay: return node - except error.LookupError: + else: if not self._dirstatevalidatewarned: self._dirstatevalidatewarned = True self.ui.warn(