Show More
@@ -484,14 +484,27 b' class hgtagsfnodescache(object):' | |||
|
484 | 484 | # No .hgtags file on this revision. |
|
485 | 485 | fnode = nullid |
|
486 | 486 | |
|
487 | self._writeentry(offset, properprefix, fnode) | |
|
488 | return fnode | |
|
489 | ||
|
490 | def setfnode(self, node, fnode): | |
|
491 | """Set the .hgtags filenode for a given changeset.""" | |
|
492 | assert len(fnode) == 20 | |
|
493 | ctx = self._repo[node] | |
|
494 | ||
|
495 | # Do a lookup first to avoid writing if nothing has changed. | |
|
496 | if self.getfnode(ctx.node(), computemissing=False) == fnode: | |
|
497 | return | |
|
498 | ||
|
499 | self._writeentry(ctx.rev() * _fnodesrecsize, node[0:4], fnode) | |
|
500 | ||
|
501 | def _writeentry(self, offset, prefix, fnode): | |
|
487 | 502 | # Slices on array instances only accept other array. |
|
488 |
entry = array('c', |
|
|
503 | entry = array('c', prefix + fnode) | |
|
489 | 504 | self._raw[offset:offset + _fnodesrecsize] = entry |
|
490 | 505 | # self._dirtyoffset could be None. |
|
491 | 506 | self._dirtyoffset = min(self._dirtyoffset, offset) or 0 |
|
492 | 507 | |
|
493 | return fnode | |
|
494 | ||
|
495 | 508 | def write(self): |
|
496 | 509 | """Perform all necessary writes to cache file. |
|
497 | 510 |
General Comments 0
You need to be logged in to leave comments.
Login now