diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -788,8 +788,6 @@ def addchangegroup(repo, source, srctype # strip should not touch boundary at all phases.retractboundary(repo, tr, targetphase, added) - # make changelog see real files again - cl.finalize(trp) tr.close() diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -5,6 +5,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. +import weakref from node import bin, hex, nullid from i18n import _ import util, error, revlog, encoding @@ -239,8 +240,10 @@ class changelog(revlog.revlog): self._delaybuf) self._delayed = True tr.addpending('cl-%i' % id(self), self._writepending) + trp = weakref.proxy(tr) + tr.addfinalize('cl-%i' % id(self), lambda: self._finalize(trp)) - def finalize(self, tr): + def _finalize(self, tr): "finalize index updates" self._delayed = False self.opener = self._realopener diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1445,7 +1445,6 @@ class localrepository(object): xp1, xp2 = p1.hex(), p2 and p2.hex() or '' self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, parent2=xp2, pending=p) - self.changelog.finalize(trp) # set the new commit is proper phase targetphase = subrepo.newcommitphase(self.ui, ctx) if targetphase: