Mercurial > hg
diff tests/test-revset.t @ 49447:6dbe74669eba
sort-revset: introduce a `random` variant
This new `sort` variant allows to shuffle any revset. It also allow for
randomly picking element using `first`.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 25 Jul 2022 05:30:06 +0200 |
parents | 42d2b31cee0b |
children | 76c128d4de4e |
line wrap: on
line diff
--- a/tests/test-revset.t Thu Aug 25 05:12:25 2022 +0200 +++ b/tests/test-revset.t Mon Jul 25 05:30:06 2022 +0200 @@ -2974,6 +2974,25 @@ 1 b11 m12 u111 112 7200 0 b12 m111 u112 111 10800 +random sort + + $ hg log --rev 'sort(all(), "random")' | wc -l + \s*8 (re) + $ hg log --rev 'sort(all(), "-random")' | wc -l + \s*8 (re) + $ hg log --rev 'sort(all(), "random", random.seed=celeste)' + 6 b111 t2 tu 130 0 + 7 b111 t3 tu 130 0 + 4 b111 m112 u111 110 14400 + 3 b112 m111 u11 120 0 + 5 b111 t1 tu 130 0 + 0 b12 m111 u112 111 10800 + 1 b11 m12 u111 112 7200 + 2 b111 m11 u12 111 3600 + $ hg log --rev 'first(sort(all(), "random", random.seed=celeste))' + 6 b111 t2 tu 130 0 + + topographical sorting can't be combined with other sort keys, and you can't use the topo.firstbranch option when topo sort is not active: