Show More
@@ -244,13 +244,10 b' class localrepository(repo.repository):' | |||||
244 | # read the tags file from each head, ending with the tip, |
|
244 | # read the tags file from each head, ending with the tip, | |
245 | # and add each tag found to the map, with "newer" ones |
|
245 | # and add each tag found to the map, with "newer" ones | |
246 | # taking precedence |
|
246 | # taking precedence | |
247 |
|
|
247 | f = None | |
248 | heads.reverse() |
|
248 | for rev, node, fnode in self._hgtagsnodes(): | |
249 | seen = {} |
|
249 | f = (f and f.filectx(fnode) or | |
250 | for node in heads: |
|
250 | self.filectx('.hgtags', fileid=fnode)) | |
251 | f = self.filectx('.hgtags', node) |
|
|||
252 | if not f or f.filerev() in seen: continue |
|
|||
253 | seen[f.filerev()] = 1 |
|
|||
254 | count = 0 |
|
251 | count = 0 | |
255 | for l in f.data().splitlines(): |
|
252 | for l in f.data().splitlines(): | |
256 | count += 1 |
|
253 | count += 1 | |
@@ -269,6 +266,24 b' class localrepository(repo.repository):' | |||||
269 |
|
266 | |||
270 | return self.tagscache |
|
267 | return self.tagscache | |
271 |
|
268 | |||
|
269 | def _hgtagsnodes(self): | |||
|
270 | heads = self.heads() | |||
|
271 | heads.reverse() | |||
|
272 | last = {} | |||
|
273 | ret = [] | |||
|
274 | for node in heads: | |||
|
275 | c = self.changectx(node) | |||
|
276 | rev = c.rev() | |||
|
277 | try: | |||
|
278 | fnode = c.filenode('.hgtags') | |||
|
279 | except repo.LookupError: | |||
|
280 | continue | |||
|
281 | ret.append((rev, node, fnode)) | |||
|
282 | if fnode in last: | |||
|
283 | ret[last[fnode]] = None | |||
|
284 | last[fnode] = len(ret) - 1 | |||
|
285 | return [item for item in ret if item] | |||
|
286 | ||||
272 | def tagslist(self): |
|
287 | def tagslist(self): | |
273 | '''return a list of tags ordered by revision''' |
|
288 | '''return a list of tags ordered by revision''' | |
274 | l = [] |
|
289 | l = [] |
@@ -60,3 +60,19 b' hg commit -m "head" -d "1000000 0"' | |||||
60 | hg tags |
|
60 | hg tags | |
61 | hg tip |
|
61 | hg tip | |
62 |
|
62 | |||
|
63 | # tags from later heads override previous ones | |||
|
64 | cd .. | |||
|
65 | hg init t2 | |||
|
66 | cd t2 | |||
|
67 | echo foo > foo | |||
|
68 | hg add foo | |||
|
69 | hg ci -m 'add foo' -d '1000000 0' # rev 0 | |||
|
70 | hg tag -d '1000000 0' bar # rev 1 | |||
|
71 | echo >> foo | |||
|
72 | hg ci -m 'change foo 1' -d '1000000 0' # rev 2 | |||
|
73 | hg up -C 1 | |||
|
74 | hg tag -r 1 -d '1000000 0' bar # rev 3 | |||
|
75 | hg up -C 1 | |||
|
76 | echo >> foo | |||
|
77 | hg ci -m 'change foo 2' -d '1000000 0' # rev 4 | |||
|
78 | hg tags |
@@ -36,3 +36,7 b' user: test' | |||||
36 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
36 | date: Mon Jan 12 13:46:40 1970 +0000 | |
37 | summary: head |
|
37 | summary: head | |
38 |
|
38 | |||
|
39 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
40 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
41 | tip 4:36195b728445 | |||
|
42 | bar 0:b409d9da318e |
General Comments 0
You need to be logged in to leave comments.
Login now