Show More
@@ -27,37 +27,12 b' def _debugnever(ui, *msg):' | |||||
27 | _debug = _debugalways |
|
27 | _debug = _debugalways | |
28 | _debug = _debugnever |
|
28 | _debug = _debugnever | |
29 |
|
29 | |||
30 |
def findglobaltags |
|
30 | def findglobaltags(ui, repo, alltags, tagtypes): | |
31 | '''Find global tags in repo by reading .hgtags from every head that |
|
31 | '''Find global tags in repo by reading .hgtags from every head that | |
32 |
has a distinct version of it |
|
32 | has a distinct version of it, using a cache to avoid excess work. | |
33 | in place: alltags maps tag name to (node, hist) pair (see _readtags() |
|
33 | Updates the dicts alltags, tagtypes in place: alltags maps tag name | |
34 | below), and tagtypes maps tag name to tag type ('global' in this |
|
34 | to (node, hist) pair (see _readtags() below), and tagtypes maps tag | |
35 | case).''' |
|
35 | name to tag type ("global" in this case).''' | |
36 |
|
||||
37 | seen = set() |
|
|||
38 | fctx = None |
|
|||
39 | ctxs = [] # list of filectx |
|
|||
40 | for node in repo.heads(): |
|
|||
41 | try: |
|
|||
42 | fnode = repo[node].filenode('.hgtags') |
|
|||
43 | except error.LookupError: |
|
|||
44 | continue |
|
|||
45 | if fnode not in seen: |
|
|||
46 | seen.add(fnode) |
|
|||
47 | if not fctx: |
|
|||
48 | fctx = repo.filectx('.hgtags', fileid=fnode) |
|
|||
49 | else: |
|
|||
50 | fctx = fctx.filectx(fnode) |
|
|||
51 | ctxs.append(fctx) |
|
|||
52 |
|
||||
53 | # read the tags file from each head, ending with the tip |
|
|||
54 | for fctx in reversed(ctxs): |
|
|||
55 | filetags = _readtags( |
|
|||
56 | ui, repo, fctx.data().splitlines(), fctx) |
|
|||
57 | _updatetags(filetags, "global", alltags, tagtypes) |
|
|||
58 |
|
||||
59 | def findglobaltags2(ui, repo, alltags, tagtypes): |
|
|||
60 | '''Same as findglobaltags1(), but with caching.''' |
|
|||
61 | # This is so we can be lazy and assume alltags contains only global |
|
36 | # This is so we can be lazy and assume alltags contains only global | |
62 | # tags when we pass it to _writetagcache(). |
|
37 | # tags when we pass it to _writetagcache(). | |
63 | assert len(alltags) == len(tagtypes) == 0, \ |
|
38 | assert len(alltags) == len(tagtypes) == 0, \ | |
@@ -95,9 +70,6 b' def findglobaltags2(ui, repo, alltags, t' | |||||
95 | if shouldwrite: |
|
70 | if shouldwrite: | |
96 | _writetagcache(ui, repo, heads, tagfnode, alltags) |
|
71 | _writetagcache(ui, repo, heads, tagfnode, alltags) | |
97 |
|
72 | |||
98 | # Set this to findglobaltags1 to disable tag caching. |
|
|||
99 | findglobaltags = findglobaltags2 |
|
|||
100 |
|
||||
101 | def readlocaltags(ui, repo, alltags, tagtypes): |
|
73 | def readlocaltags(ui, repo, alltags, tagtypes): | |
102 | '''Read local tags in repo. Update alltags and tagtypes.''' |
|
74 | '''Read local tags in repo. Update alltags and tagtypes.''' | |
103 | try: |
|
75 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now