[PATCH 3 of 5] rank: add minimal test

Pierre-Yves David pierre-yves.david at octobus.net
Mon Jan 31 15:53:17 UTC 2022


On 1/31/22 15:03, pacien wrote:
> # HG changeset patch
> # User pacien <pacien.trangirard at pacien.net>
> # Date 1643366718 -3600
> #      Fri Jan 28 11:45:18 2022 +0100
> # Node ID 2bf3d6c5b1fa4e0c2882752031e7ca934f7330c3
> # Parent  a5e1331be0ffa00772e4de07c982dfd36cd4f8c7
> # EXP-Topic cl2-rank
> rank: add minimal test
>
> This adds a small test checking the rank computation in the case of a merge.
>
> diff --git a/tests/test-rank.t b/tests/test-rank.t
> new file mode 100644
> --- /dev/null
> +++ b/tests/test-rank.t
> @@ -0,0 +1,37 @@
> +=============================================================
> +Check that we can compute and exchange revision rank properly
> +=============================================================
> +
> +  $ cat << EOF >> $HGRCPATH
> +  > [format]
> +  > exp-use-changelog-v2=enable-unstable-format-and-corrupt-my-data
> +  > EOF
> +
> +
> +Test minimal rank computation with merge
> +
> +  $ hg init rank-repo-minimal
> +  $ cd rank-repo-minimal
> +  $ touch 0
> +  $ hg add 0
> +  $ hg commit -m 0
> +  $ touch 1
> +  $ hg add 1
> +  $ hg commit -m 1
> +  $ hg update -r 0 >> /dev/null
> +  $ touch 2
> +  $ hg add 2
> +  $ hg commit -m 2 >> /dev/null
> +  $ hg merge -r 1 >> /dev/null
> +  $ hg commit -m 3
> +  $ touch 4
> +  $ hg add 4
> +  $ hg commit -m 4
> +  $ hg log --template '{rev} {_fast_rank}\n'
> +  4 5
> +  3 4
> +  2 2
> +  1 2
> +  0 1
> +  $ cd ..


You should throw a `--graph` flag on this log call to make it easier to 
understand.

-- 
Pierre-Yves David




More information about the Mercurial-devel mailing list