comparison mercurial/tags.py @ 31993:bfb826c350d4

tags: introduce a function to return a valid fnodes list from revs This will get used to compare tags between two set of revisions during a transaction (pre and post heads). The end goal is to be able to track tags movement in transaction hooks.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 28 Mar 2017 05:06:56 +0200
parents 417363736c11
children fe9c4d614600
comparison
equal deleted inserted replaced
31992:3e47a40d7a7a 31993:bfb826c350d4
75 # Tags are written sorted by tag name. 75 # Tags are written sorted by tag name.
76 # 76 #
77 # Tags associated with multiple changesets have an entry for each changeset. 77 # Tags associated with multiple changesets have an entry for each changeset.
78 # The most recent changeset (in terms of revlog ordering for the head 78 # The most recent changeset (in terms of revlog ordering for the head
79 # setting it) for each tag is last. 79 # setting it) for each tag is last.
80
81 def fnoderevs(ui, repo, revs):
82 """return the list of '.hgtags' fnodes used in a set revisions
83
84 This is returned as list of unique fnodes. We use a list instead of a set
85 because order matters when it comes to tags."""
86 unfi = repo.unfiltered()
87 tonode = unfi.changelog.node
88 nodes = [tonode(r) for r in revs]
89 fnodes = _getfnodes(ui, repo, nodes[::-1]) # reversed help the cache
90 fnodes = _filterfnodes(fnodes, nodes)
91 return fnodes
80 92
81 def findglobaltags(ui, repo): 93 def findglobaltags(ui, repo):
82 '''Find global tags in a repo: return a tagsmap 94 '''Find global tags in a repo: return a tagsmap
83 95
84 tagsmap: tag name to (node, hist) 2-tuples. 96 tagsmap: tag name to (node, hist) 2-tuples.