Mercurial > hg
comparison tests/test-setdiscovery.t @ 42742:334c1ea57136
discovery: new devel.discovery.randomize option
By default, this is True, but setting it to False is a uniform
way to kill all randomness in integration tests such as test-setdiscovery.t
By "uniform" we mean that it can be passed to implementations in other
languages, for which the monkey-patching of random.sample would be
irrelevant.
In the above mentioned test file, we use it right away,
replacing the adhoc extension that had the same purpose, and to derandomize a
case with many round-trips, that we'll need to behave uniformly in the Rust
version.
Differential Revision: https://phab.mercurial-scm.org/D6427
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Tue, 21 May 2019 17:44:15 +0200 |
parents | 06ee841697a8 |
children | 775224e26d74 |
comparison
equal
deleted
inserted
replaced
42741:4e7bd6180b53 | 42742:334c1ea57136 |
---|---|
966 added 304 changesets with 0 changes to 0 files | 966 added 304 changesets with 0 changes to 0 files |
967 new changesets 1ea73414a91b:513314ca8b3a | 967 new changesets 1ea73414a91b:513314ca8b3a |
968 updating to branch b | 968 updating to branch b |
969 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | 969 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
970 | 970 |
971 $ hg -R a debugdiscovery b --debug --verbose --config progress.debug=true | 971 $ hg -R a debugdiscovery b --debug --verbose --config progress.debug=true --config devel.discovery.randomize=false |
972 comparing with b | 972 comparing with b |
973 query 1; heads | 973 query 1; heads |
974 searching for changes | 974 searching for changes |
975 taking quick initial sample | 975 taking quick initial sample |
976 searching: 2 queries | 976 searching: 2 queries |
978 sampling from both directions | 978 sampling from both directions |
979 searching: 3 queries | 979 searching: 3 queries |
980 query 3; still undecided: 980, sample size is: 200 | 980 query 3; still undecided: 980, sample size is: 200 |
981 sampling from both directions | 981 sampling from both directions |
982 searching: 4 queries | 982 searching: 4 queries |
983 query 4; still undecided: 435, sample size is: 210 (no-py3 !) | 983 query 4; still undecided: 497, sample size is: 210 |
984 query 4; still undecided: 430, sample size is: 210 (py3 !) | |
985 sampling from both directions | 984 sampling from both directions |
986 searching: 5 queries | 985 searching: 5 queries |
987 query 5; still undecided: 185, sample size is: 185 (no-py3 !) | 986 query 5; still undecided: 285, sample size is: 220 |
988 query 5; still undecided: 187, sample size is: 187 (py3 !) | 987 sampling from both directions |
989 5 total queries in *.????s (glob) | 988 searching: 6 queries |
989 query 6; still undecided: 63, sample size is: 63 | |
990 6 total queries in *.????s (glob) | |
990 elapsed time: * seconds (glob) | 991 elapsed time: * seconds (glob) |
991 heads summary: | 992 heads summary: |
992 total common heads: 1 | 993 total common heads: 1 |
993 also local heads: 0 | 994 also local heads: 0 |
994 also remote heads: 0 | 995 also remote heads: 0 |
1093 | 1094 |
1094 The case where all the 'initialsamplesize' samples already were common would | 1095 The case where all the 'initialsamplesize' samples already were common would |
1095 give 'all remote heads known locally' without checking the remaining heads - | 1096 give 'all remote heads known locally' without checking the remaining heads - |
1096 fixed in 86c35b7ae300: | 1097 fixed in 86c35b7ae300: |
1097 | 1098 |
1098 $ cat >> $TESTTMP/unrandomsample.py << EOF | |
1099 > import random | |
1100 > def sample(population, k): | |
1101 > return sorted(population)[:k] | |
1102 > random.sample = sample | |
1103 > EOF | |
1104 | |
1105 $ cat >> r1/.hg/hgrc << EOF | 1099 $ cat >> r1/.hg/hgrc << EOF |
1106 > [extensions] | 1100 > [devel] |
1107 > unrandomsample = $TESTTMP/unrandomsample.py | 1101 > discovery.randomize = False |
1108 > EOF | 1102 > EOF |
1109 | 1103 |
1110 $ hg -R r1 outgoing r2 -T'{rev} ' --config extensions.blackbox= \ | 1104 $ hg -R r1 outgoing r2 -T'{rev} ' --config extensions.blackbox= \ |
1111 > --config blackbox.track='command commandfinish discovery' | 1105 > --config blackbox.track='command commandfinish discovery' |
1112 comparing with r2 | 1106 comparing with r2 |