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