Re: [PATCH 1 of 7 V4] revbranchcache: add a public function to update the data
On Fri, Mar 16, 2018 at 8:20 AM, Yuya Nishihara wrote: > On Fri, 16 Mar 2018 12:29:33 +0100, Boris Feld wrote: > > # HG changeset patch > > # User Boris Feld > > # Date 1516281665 -3600 > > # Thu Jan 18 14:21:05 2018 +0100 > > # Node ID 695dfd0f5d9849a7f0b81e623dbdb1befdca63c9 > > # Parent c978ffef167e8c5d343c3cca1ebf23f1082c3c09 > > # EXP-Topic wire-rbc > > # Available At https://bitbucket.org/octobus/mercurial-devel/ > > # hg pull https://bitbucket.org/octobus/mercurial-devel/ > -r 695dfd0f5d98 > > revbranchcache: add a public function to update the data > > Queued per the last review of V2, thanks. > Boris: please follow up on this series with additions to mercurial/help/internals/bundle2.txt that document the new bundle2 part and capability string. > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 7 V4] revbranchcache: add a public function to update the data
On Fri, 16 Mar 2018 12:29:33 +0100, Boris Feld wrote: > # HG changeset patch > # User Boris Feld > # Date 1516281665 -3600 > # Thu Jan 18 14:21:05 2018 +0100 > # Node ID 695dfd0f5d9849a7f0b81e623dbdb1befdca63c9 > # Parent c978ffef167e8c5d343c3cca1ebf23f1082c3c09 > # EXP-Topic wire-rbc > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 695dfd0f5d98 > revbranchcache: add a public function to update the data Queued per the last review of V2, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 7 V4] revbranchcache: add a public function to update the data
# HG changeset patch # User Boris Feld # Date 1516281665 -3600 # Thu Jan 18 14:21:05 2018 +0100 # Node ID 695dfd0f5d9849a7f0b81e623dbdb1befdca63c9 # Parent c978ffef167e8c5d343c3cca1ebf23f1082c3c09 # EXP-Topic wire-rbc # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 695dfd0f5d98 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. diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -454,6 +454,26 @@ class revbranchcache(object): 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: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel