equal
deleted
inserted
replaced
95 if cachetags is not None: |
95 if cachetags is not None: |
96 assert not shouldwrite |
96 assert not shouldwrite |
97 # XXX is this really 100% correct? are there oddball special |
97 # XXX is this really 100% correct? are there oddball special |
98 # cases where a global tag should outrank a local tag but won't, |
98 # cases where a global tag should outrank a local tag but won't, |
99 # because cachetags does not contain rank info? |
99 # because cachetags does not contain rank info? |
100 _updatetags(cachetags, 'global', alltags, tagtypes) |
100 _updatetags(cachetags, alltags, 'global', tagtypes) |
101 return alltags, tagtypes |
101 return alltags, tagtypes |
102 |
102 |
103 seen = set() # set of fnode |
103 seen = set() # set of fnode |
104 fctx = None |
104 fctx = None |
105 for head in reversed(heads): # oldest to newest |
105 for head in reversed(heads): # oldest to newest |
113 fctx = repo.filectx('.hgtags', fileid=fnode) |
113 fctx = repo.filectx('.hgtags', fileid=fnode) |
114 else: |
114 else: |
115 fctx = fctx.filectx(fnode) |
115 fctx = fctx.filectx(fnode) |
116 |
116 |
117 filetags = _readtags(ui, repo, fctx.data().splitlines(), fctx) |
117 filetags = _readtags(ui, repo, fctx.data().splitlines(), fctx) |
118 _updatetags(filetags, 'global', alltags, tagtypes) |
118 _updatetags(filetags, alltags, 'global', tagtypes) |
119 |
119 |
120 # and update the cache (if necessary) |
120 # and update the cache (if necessary) |
121 if shouldwrite: |
121 if shouldwrite: |
122 _writetagcache(ui, repo, valid, alltags) |
122 _writetagcache(ui, repo, valid, alltags) |
123 return alltags, tagtypes |
123 return alltags, tagtypes |
143 try: |
143 try: |
144 cl.rev(filetags[t][0]) |
144 cl.rev(filetags[t][0]) |
145 except (LookupError, ValueError): |
145 except (LookupError, ValueError): |
146 del filetags[t] |
146 del filetags[t] |
147 |
147 |
148 _updatetags(filetags, "local", alltags, tagtypes) |
148 _updatetags(filetags, alltags, 'local', tagtypes) |
149 |
149 |
150 def _readtaghist(ui, repo, lines, fn, recode=None, calcnodelines=False): |
150 def _readtaghist(ui, repo, lines, fn, recode=None, calcnodelines=False): |
151 '''Read tag definitions from a file (or any source of lines). |
151 '''Read tag definitions from a file (or any source of lines). |
152 |
152 |
153 This function returns two sortdicts with similar information: |
153 This function returns two sortdicts with similar information: |
221 newtags = util.sortdict() |
221 newtags = util.sortdict() |
222 for tag, taghist in filetags.items(): |
222 for tag, taghist in filetags.items(): |
223 newtags[tag] = (taghist[-1], taghist[:-1]) |
223 newtags[tag] = (taghist[-1], taghist[:-1]) |
224 return newtags |
224 return newtags |
225 |
225 |
226 def _updatetags(filetags, tagtype, alltags, tagtypes): |
226 def _updatetags(filetags, alltags, tagtype, tagtypes): |
227 '''Incorporate the tag info read from one file into the two |
227 '''Incorporate the tag info read from one file into the two |
228 dictionaries, alltags and tagtypes, that contain all tag |
228 dictionaries, alltags and tagtypes, that contain all tag |
229 info (global across all heads plus local).''' |
229 info (global across all heads plus local).''' |
230 |
230 |
231 for name, nodehist in filetags.iteritems(): |
231 for name, nodehist in filetags.iteritems(): |