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.
--- a/mercurial/tags.py Fri Apr 14 14:25:06 2017 +0200
+++ b/mercurial/tags.py Tue Mar 28 05:06:56 2017 +0200
@@ -78,6 +78,18 @@
# The most recent changeset (in terms of revlog ordering for the head
# setting it) for each tag is last.
+def fnoderevs(ui, repo, revs):
+ """return the list of '.hgtags' fnodes used in a set revisions
+
+ This is returned as list of unique fnodes. We use a list instead of a set
+ because order matters when it comes to tags."""
+ unfi = repo.unfiltered()
+ tonode = unfi.changelog.node
+ nodes = [tonode(r) for r in revs]
+ fnodes = _getfnodes(ui, repo, nodes[::-1]) # reversed help the cache
+ fnodes = _filterfnodes(fnodes, nodes)
+ return fnodes
+
def findglobaltags(ui, repo):
'''Find global tags in a repo: return a tagsmap