##// END OF EJS Templates
tags-cache: directly perform a monimal walk for hgtagsfnodescache warming...
marmoute -
r52492:b0aaffcb default
parent child Browse files
Show More
@@ -21,6 +21,7 b' from .node import ('
21 short,
21 short,
22 )
22 )
23 from .i18n import _
23 from .i18n import _
24 from .revlogutils.constants import ENTRY_NODE_ID
24 from . import (
25 from . import (
25 encoding,
26 encoding,
26 error,
27 error,
@@ -30,6 +31,7 b' from . import ('
30 )
31 )
31 from .utils import stringutil
32 from .utils import stringutil
32
33
34
33 # Tags computation can be expensive and caches exist to make it fast in
35 # Tags computation can be expensive and caches exist to make it fast in
34 # the common case.
36 # the common case.
35 #
37 #
@@ -83,7 +85,29 b' from .utils import stringutil'
83 def warm_cache(repo):
85 def warm_cache(repo):
84 """ensure the cache is properly filled"""
86 """ensure the cache is properly filled"""
85 unfi = repo.unfiltered()
87 unfi = repo.unfiltered()
86 _getfnodes(repo.ui, repo, revs=unfi.changelog.revs())
88 fnodescache = hgtagsfnodescache(unfi)
89 validated_fnodes = set()
90 unknown_entries = set()
91 flog = None
92
93 entries = enumerate(repo.changelog.index)
94 node_revs = ((e[ENTRY_NODE_ID], rev) for (rev, e) in entries)
95
96 for node, rev in node_revs:
97 fnode = fnodescache.getfnode(node=node, rev=rev)
98 if fnode != repo.nullid:
99 if fnode not in validated_fnodes:
100 if flog is None:
101 flog = repo.file(b'.hgtags')
102 if flog.hasnode(fnode):
103 validated_fnodes.add(fnode)
104 else:
105 unknown_entries.add(node)
106
107 if unknown_entries:
108 fnodescache.refresh_invalid_nodes(unknown_entries)
109
110 fnodescache.write()
87
111
88
112
89 def fnoderevs(ui, repo, revs):
113 def fnoderevs(ui, repo, revs):
General Comments 0
You need to be logged in to leave comments. Login now