Mercurial > public > mercurial-scm > hg
comparison mercurial/branchmap.py @ 36962: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 | d139eb308358 |
children | f0b6fbea00cf |
comparison
equal
deleted
inserted
replaced
36961:586891c561dc | 36962:95f4f1bfb650 |
---|---|
452 if close: | 452 if close: |
453 branchidx |= _rbccloseflag | 453 branchidx |= _rbccloseflag |
454 self._setcachedata(rev, reponode, branchidx) | 454 self._setcachedata(rev, reponode, branchidx) |
455 return b, close | 455 return b, close |
456 | 456 |
457 def setdata(self, branch, rev, node, close): | |
458 """add new data information to the cache""" | |
459 if branch in self._namesreverse: | |
460 branchidx = self._namesreverse[branch] | |
461 else: | |
462 branchidx = len(self._names) | |
463 self._names.append(branch) | |
464 self._namesreverse[branch] = branchidx | |
465 if close: | |
466 branchidx |= _rbccloseflag | |
467 self._setcachedata(rev, node, branchidx) | |
468 # If no cache data were readable (non exists, bad permission, etc) | |
469 # the cache was bypassing itself by setting: | |
470 # | |
471 # self.branchinfo = self._branchinfo | |
472 # | |
473 # Since we now have data in the cache, we need to drop this bypassing. | |
474 if 'branchinfo' in vars(self): | |
475 del self.branchinfo | |
476 | |
457 def _setcachedata(self, rev, node, branchidx): | 477 def _setcachedata(self, rev, node, branchidx): |
458 """Writes the node's branch data to the in-memory cache data.""" | 478 """Writes the node's branch data to the in-memory cache data.""" |
459 if rev == nullrev: | 479 if rev == nullrev: |
460 return | 480 return |
461 rbcrevidx = rev * _rbcrecsize | 481 rbcrevidx = rev * _rbcrecsize |