Show More
@@ -484,14 +484,27 b' class hgtagsfnodescache(object):' | |||||
484 | # No .hgtags file on this revision. |
|
484 | # No .hgtags file on this revision. | |
485 | fnode = nullid |
|
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 | # Slices on array instances only accept other array. |
|
502 | # Slices on array instances only accept other array. | |
488 |
entry = array('c', |
|
503 | entry = array('c', prefix + fnode) | |
489 | self._raw[offset:offset + _fnodesrecsize] = entry |
|
504 | self._raw[offset:offset + _fnodesrecsize] = entry | |
490 | # self._dirtyoffset could be None. |
|
505 | # self._dirtyoffset could be None. | |
491 | self._dirtyoffset = min(self._dirtyoffset, offset) or 0 |
|
506 | self._dirtyoffset = min(self._dirtyoffset, offset) or 0 | |
492 |
|
507 | |||
493 | return fnode |
|
|||
494 |
|
||||
495 | def write(self): |
|
508 | def write(self): | |
496 | """Perform all necessary writes to cache file. |
|
509 | """Perform all necessary writes to cache file. | |
497 |
|
510 |
General Comments 0
You need to be logged in to leave comments.
Login now