Show More
@@ -494,11 +494,25 b' def _getfnodes(ui, repo, nodes):' | |||
|
494 | 494 | starttime = util.timer() |
|
495 | 495 | fnodescache = hgtagsfnodescache(repo.unfiltered()) |
|
496 | 496 | cachefnode = {} |
|
497 | validated_fnodes = set() | |
|
498 | unknown_entries = set() | |
|
497 | 499 | for node in nodes: |
|
498 | 500 | fnode = fnodescache.getfnode(node) |
|
501 | flog = repo.file(b'.hgtags') | |
|
499 | 502 | if fnode != nullid: |
|
503 | if fnode not in validated_fnodes: | |
|
504 | if flog.hasnode(fnode): | |
|
505 | validated_fnodes.add(fnode) | |
|
506 | else: | |
|
507 | unknown_entries.add(node) | |
|
500 | 508 | cachefnode[node] = fnode |
|
501 | 509 | |
|
510 | if unknown_entries: | |
|
511 | fixed_nodemap = fnodescache.refresh_invalid_nodes(unknown_entries) | |
|
512 | for node, fnode in pycompat.iteritems(fixed_nodemap): | |
|
513 | if fnode != nullid: | |
|
514 | cachefnode[node] = fnode | |
|
515 | ||
|
502 | 516 | fnodescache.write() |
|
503 | 517 | |
|
504 | 518 | duration = util.timer() - starttime |
@@ -826,6 +840,21 b' class hgtagsfnodescache(object):' | |||
|
826 | 840 | |
|
827 | 841 | self._writeentry(ctx.rev() * _fnodesrecsize, node[0:4], fnode) |
|
828 | 842 | |
|
843 | def refresh_invalid_nodes(self, nodes): | |
|
844 | """recomputes file nodes for a given set of nodes which has unknown | |
|
845 | filenodes for them in the cache | |
|
846 | Also updates the in-memory cache with the correct filenode. | |
|
847 | Caller needs to take care about calling `.write()` so that updates are | |
|
848 | persisted. | |
|
849 | Returns a map {node: recomputed fnode} | |
|
850 | """ | |
|
851 | fixed_nodemap = {} | |
|
852 | for node in nodes: | |
|
853 | fnode = self._computefnode(node) | |
|
854 | fixed_nodemap[node] = fnode | |
|
855 | self.setfnode(node, fnode) | |
|
856 | return fixed_nodemap | |
|
857 | ||
|
829 | 858 | def _writeentry(self, offset, prefix, fnode): |
|
830 | 859 | # Slices on array instances only accept other array. |
|
831 | 860 | entry = bytearray(prefix + fnode) |
@@ -452,8 +452,8 b' debug command hides the corruption, both' | |||
|
452 | 452 | 5 8dbfe60eff306a54259cfe007db9e330e7ecf866 0c04f2a8deadde17fab7422878ee5a2dadbc943d (unknown node) |
|
453 | 453 | |
|
454 | 454 | $ hg tags |
|
455 | abort: data/.hgtags.i@0c04f2a8deadde17fab7422878ee5a2dadbc943d: no match found | |
|
456 | [50] | |
|
455 | tip 5:8dbfe60eff30 | |
|
456 | bar 1:78391a272241 | |
|
457 | 457 | |
|
458 | 458 | BUG: Unless this file is restored, the `hg tags` in the next unix-permissions |
|
459 | 459 | conditional will fail: "abort: data/.hgtags.i@0c04f2a8dead: no match found" |
General Comments 0
You need to be logged in to leave comments.
Login now