Mercurial > public > mercurial-scm > hg-stable
diff mercurial/changelog.py @ 23203:3872d563e01a
changelog: handle writepending in the transaction
The 'delayupdate' method now takes a transaction object and registers its
'_writepending' method for execution in 'transaction.writepending()'. The hook can then
use 'transaction.writepending()' directly.
At some point this will allow the addition of other file creation
during writepending.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 17 Oct 2014 21:55:31 -0700 |
parents | 7e97bf6ee2d6 |
children | 2d54aa5397cd |
line wrap: on
line diff
--- a/mercurial/changelog.py Fri Oct 17 21:19:54 2014 -0700 +++ b/mercurial/changelog.py Fri Oct 17 21:55:31 2014 -0700 @@ -224,7 +224,7 @@ raise error.FilteredIndexError(rev) return super(changelog, self).flags(rev) - def delayupdate(self): + def delayupdate(self, tr): "delay visibility of index updates to other readers" if not self._delayed: @@ -238,6 +238,7 @@ self.opener = _delayopener(self._realopener, self.indexfile, self._delaybuf) self._delayed = True + tr.addpending('cl-%i' % id(self), self._writepending) def finalize(self, tr): "finalize index updates" @@ -266,7 +267,7 @@ self._nodecache = r._nodecache self._chunkcache = r._chunkcache - def writepending(self): + def _writepending(self): "create a file containing the unfinalized state for pretxnchangegroup" if self._delaybuf: # make a temporary copy of the index