Mercurial > hg-stable
changeset 36968:95f4f1bfb650
revbranchcache: add a public function to update the data
We want to exchange more cached data over the wire. To do so, we need a clean
way to update the cache on the receiving ends.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 18 Jan 2018 14:21:05 +0100 |
parents | 586891c561dc |
children | 9988fc10f49e |
files | mercurial/branchmap.py |
diffstat | 1 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/branchmap.py Thu Mar 15 11:19:16 2018 -0700 +++ b/mercurial/branchmap.py Thu Jan 18 14:21:05 2018 +0100 @@ -454,6 +454,26 @@ self._setcachedata(rev, reponode, branchidx) return b, close + def setdata(self, branch, rev, node, close): + """add new data information to the cache""" + if branch in self._namesreverse: + branchidx = self._namesreverse[branch] + else: + branchidx = len(self._names) + self._names.append(branch) + self._namesreverse[branch] = branchidx + if close: + branchidx |= _rbccloseflag + self._setcachedata(rev, node, branchidx) + # If no cache data were readable (non exists, bad permission, etc) + # the cache was bypassing itself by setting: + # + # self.branchinfo = self._branchinfo + # + # Since we now have data in the cache, we need to drop this bypassing. + if 'branchinfo' in vars(self): + del self.branchinfo + def _setcachedata(self, rev, node, branchidx): """Writes the node's branch data to the in-memory cache data.""" if rev == nullrev: