Show More
@@ -23,8 +23,8 b' from . import (' | |||||
23 | ) |
|
23 | ) | |
24 |
|
24 | |||
25 | calcsize = struct.calcsize |
|
25 | calcsize = struct.calcsize | |
26 | pack = struct.pack |
|
26 | pack_into = struct.pack_into | |
27 | unpack = struct.unpack |
|
27 | unpack_from = struct.unpack_from | |
28 |
|
28 | |||
29 | def _filename(repo): |
|
29 | def _filename(repo): | |
30 | """name of a branchcache file for a given repo or repoview""" |
|
30 | """name of a branchcache file for a given repo or repoview""" | |
@@ -406,8 +406,7 b' class revbranchcache(object):' | |||||
406 |
|
406 | |||
407 | # fast path: extract data from cache, use it if node is matching |
|
407 | # fast path: extract data from cache, use it if node is matching | |
408 | reponode = changelog.node(rev)[:_rbcnodelen] |
|
408 | reponode = changelog.node(rev)[:_rbcnodelen] | |
409 | cachenode, branchidx = unpack( |
|
409 | cachenode, branchidx = unpack_from(_rbcrecfmt, self._rbcrevs, rbcrevidx) | |
410 | _rbcrecfmt, util.buffer(self._rbcrevs, rbcrevidx, _rbcrecsize)) |
|
|||
411 | close = bool(branchidx & _rbccloseflag) |
|
410 | close = bool(branchidx & _rbccloseflag) | |
412 | if close: |
|
411 | if close: | |
413 | branchidx &= _rbcbranchidxmask |
|
412 | branchidx &= _rbcbranchidxmask | |
@@ -451,12 +450,11 b' class revbranchcache(object):' | |||||
451 | def _setcachedata(self, rev, node, branchidx): |
|
450 | def _setcachedata(self, rev, node, branchidx): | |
452 | """Writes the node's branch data to the in-memory cache data.""" |
|
451 | """Writes the node's branch data to the in-memory cache data.""" | |
453 | rbcrevidx = rev * _rbcrecsize |
|
452 | rbcrevidx = rev * _rbcrecsize | |
454 | rec = bytearray(pack(_rbcrecfmt, node, branchidx)) |
|
|||
455 | if len(self._rbcrevs) < rbcrevidx + _rbcrecsize: |
|
453 | if len(self._rbcrevs) < rbcrevidx + _rbcrecsize: | |
456 | self._rbcrevs.extend('\0' * |
|
454 | self._rbcrevs.extend('\0' * | |
457 | (len(self._repo.changelog) * _rbcrecsize - |
|
455 | (len(self._repo.changelog) * _rbcrecsize - | |
458 | len(self._rbcrevs))) |
|
456 | len(self._rbcrevs))) | |
459 | self._rbcrevs[rbcrevidx:rbcrevidx + _rbcrecsize] = rec |
|
457 | pack_into(_rbcrecfmt, self._rbcrevs, rbcrevidx, node, branchidx) | |
460 | self._rbcrevslen = min(self._rbcrevslen, rev) |
|
458 | self._rbcrevslen = min(self._rbcrevslen, rev) | |
461 |
|
459 | |||
462 | tr = self._repo.currenttransaction() |
|
460 | tr = self._repo.currenttransaction() |
General Comments 0
You need to be logged in to leave comments.
Login now