# HG changeset patch # User Pierre-Yves David # Date 1413619781 25200 # Node ID 2d54aa5397cdb1c697673ba10b7618d5ac25c69e # Parent 10beda5bd2b725e2ad03431b24bc88f60050e9f4 changelog: rely on transaction for finalization Instead of calling 'cl.finalize()' by hand (possibly at a bogus time) we register it in the transaction during 'delayupdate' and rely on 'tr.close()' to call it at the right time. diff -r 10beda5bd2b7 -r 2d54aa5397cd mercurial/changegroup.py --- a/mercurial/changegroup.py Fri Oct 17 22:28:09 2014 -0700 +++ b/mercurial/changegroup.py Sat Oct 18 01:09:41 2014 -0700 @@ -788,8 +788,6 @@ # 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 -r 10beda5bd2b7 -r 2d54aa5397cd mercurial/changelog.py --- a/mercurial/changelog.py Fri Oct 17 22:28:09 2014 -0700 +++ b/mercurial/changelog.py Sat Oct 18 01:09:41 2014 -0700 @@ -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 @@ 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 -r 10beda5bd2b7 -r 2d54aa5397cd mercurial/localrepo.py --- a/mercurial/localrepo.py Fri Oct 17 22:28:09 2014 -0700 +++ b/mercurial/localrepo.py Sat Oct 18 01:09:41 2014 -0700 @@ -1445,7 +1445,6 @@ 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: