[PATCH STABLE] tags: fix typo in fast path detection of fnode resolution (issue6673)
Raphaël Gomès
raphael.gomes at octobus.net
Tue Mar 29 12:28:48 UTC 2022
Queued, that was fast, thanks a lot!
On 3/29/22 12:10, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1648545349 -32400
> # Tue Mar 29 18:15:49 2022 +0900
> # Branch stable
> # Node ID 1da3259a1a38ed0ba6607c0830bb1aec461ec784
> # 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 ..
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list