# HG changeset patch # User Yuya Nishihara # Date 1648545349 -32400 # 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 -r 9bb700223f00 -r d4b66dc500c5 mercurial/tags.py --- a/mercurial/tags.py Mon Mar 28 17:24:41 2022 +0200 +++ b/mercurial/tags.py Tue Mar 29 18:15:49 2022 +0900 @@ -808,7 +808,7 @@ # 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 -r 9bb700223f00 -r d4b66dc500c5 tests/test-tags.t --- a/tests/test-tags.t Mon Mar 28 17:24:41 2022 +0200 +++ b/tests/test-tags.t Tue Mar 29 18:15:49 2022 +0900 @@ -933,3 +933,58 @@ 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 ..