# HG changeset patch # User Yuya Nishihara # Date 2022-03-29 09:15:49 # Node ID d4b66dc500c5bceaf49439feb7d5d34cd975d7d4 # Parent 9bb700223f000be88912382adee80b8a7afe5fcb tags: fix typo in fast path detection of fnode resolution (issue6673) If I understand it, mctx.readfast() is unreliable here if p1/p2 .hgtags nodes differ, and tags on that branch would be randomly discarded depending on which parent were picked. The test case added by this patch would fail only on zstd-compressed repository. I didn't try hard to stabilize the failure case. diff --git a/mercurial/tags.py b/mercurial/tags.py --- a/mercurial/tags.py +++ b/mercurial/tags.py @@ -808,7 +808,7 @@ class hgtagsfnodescache(object): # There is some no-merge changeset where p1 is null and p2 is set # Processing them as merge is just slower, but still gives a good # result. - p2node = cl.node(p1rev) + p2node = cl.node(p2rev) p2fnode = self.getfnode(p2node, computemissing=False) if p1fnode != p2fnode: # we cannot rely on readfast because we don't know against what diff --git a/tests/test-tags.t b/tests/test-tags.t --- a/tests/test-tags.t +++ b/tests/test-tags.t @@ -933,3 +933,58 @@ Avoid writing logs on trying to delete a a8a82d372bb35b42ff736e74f07c23bcd99c371f a a8a82d372bb35b42ff736e74f07c23bcd99c371f a 0000000000000000000000000000000000000000 a + + $ cd .. + +.hgtags fnode should be properly resolved at merge revision (issue6673) + + $ hg init issue6673 + $ cd issue6673 + + $ touch a + $ hg ci -qAm a + $ hg branch -q stable + $ hg ci -m branch + + $ hg up -q default + $ hg merge -q stable + $ hg ci -m merge + + add tag to stable branch: + + $ hg up -q stable + $ echo a >> a + $ hg ci -m a + $ hg tag whatever + $ hg log -GT'{rev} {tags}\n' + @ 4 tip + | + o 3 whatever + | + | o 2 + |/| + o | 1 + |/ + o 0 + + + merge tagged stable into default: + + $ hg up -q default + $ hg merge -q stable + $ hg ci -m merge + $ hg log -GT'{rev} {tags}\n' + @ 5 tip + |\ + | o 4 + | | + | o 3 whatever + | | + o | 2 + |\| + | o 1 + |/ + o 0 + + + $ cd ..