annotate tests/test-remote-hidden.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 70b71421fd33
children 34a46d48d24e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
42126
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
1 ========================================================
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
2 Test the ability to access a hidden revision on a server
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
3 ========================================================
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
4
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
5 #require serve
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
6
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
7 $ . $TESTDIR/testlib/obsmarker-common.sh
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
8 $ cat >> $HGRCPATH << EOF
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
9 > [phases]
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
10 > # public changeset are not obsolete
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
11 > publish=false
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
12 > [experimental]
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
13 > evolution=all
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
14 > [ui]
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
15 > logtemplate='{rev}:{node|short} {desc} [{phase}]\n'
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
16 > EOF
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
17
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
18 Setup a simple repository with some hidden revisions
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
19 ----------------------------------------------------
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
20
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
21 Testing the `served.hidden` view
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
22
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
23 $ hg init repo-with-hidden
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
24 $ cd repo-with-hidden
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
25
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
26 $ echo 0 > a
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
27 $ hg ci -qAm "c_Public"
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
28 $ hg phase --public
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
29 $ echo 1 > a
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
30 $ hg ci -m "c_Amend_Old"
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
31 $ echo 2 > a
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
32 $ hg ci -m "c_Amend_New" --amend
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
33 $ hg up ".^"
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
35 $ echo 3 > a
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
36 $ hg ci -m "c_Pruned"
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
37 created new head
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
38 $ hg debugobsolete --record-parents `getid 'desc("c_Pruned")'` -d '0 0'
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
39 obsoleted 1 changesets
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
40 $ hg up ".^"
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
42 $ echo 4 > a
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
43 $ hg ci -m "c_Secret" --secret
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
44 created new head
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
45 $ echo 5 > a
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
46 $ hg ci -m "c_Secret_Pruned" --secret
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
47 $ hg debugobsolete --record-parents `getid 'desc("c_Secret_Pruned")'` -d '0 0'
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
48 obsoleted 1 changesets
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
49 $ hg up null
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
50 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
51
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
52 $ hg log -G -T '{rev}:{node|short} {desc} [{phase}]\n' --hidden
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
53 x 5:8d28cbe335f3 c_Secret_Pruned [secret]
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
54 |
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
55 o 4:1c6afd79eb66 c_Secret [secret]
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
56 |
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
57 | x 3:5d1575e42c25 c_Pruned [draft]
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
58 |/
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
59 | o 2:c33affeb3f6b c_Amend_New [draft]
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
60 |/
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
61 | x 1:be215fbb8c50 c_Amend_Old [draft]
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
62 |/
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
63 o 0:5f354f46e585 c_Public [public]
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
64
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
65 $ hg debugobsolete
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
66 be215fbb8c5090028b00154c1fe877ad1b376c61 c33affeb3f6b4e9621d1839d6175ddc07708807c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
67 5d1575e42c25b7f2db75cd4e0b881b1c35158fae 0 {5f354f46e5853535841ec7a128423e991ca4d59b} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
68 8d28cbe335f311bc89332d7bbe8a07889b6914a0 0 {1c6afd79eb6663275bbe30097e162b1c24ced0f0} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
69
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
70 $ cd ..
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
71
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
72 Test the feature
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
73 ================
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
74
42127
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
75 Check cache pre-warm
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
76 --------------------
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
77
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
78 $ ls -1 repo-with-hidden/.hg/cache
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
79 branch2
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
80 branch2-base
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
81 branch2-served
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
82 branch2-served.hidden
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
83 branch2-visible
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
84 rbc-names-v1
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
85 rbc-revs-v1
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
86 tags2
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
87 tags2-visible
70b71421fd33 repoview: keep the branchmap cache for the `served.hidden` view warm
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42126
diff changeset
88
42126
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
89 Check that the `served.hidden` repoview
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
90 ---------------------------------------
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
91
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
92 $ hg -R repo-with-hidden serve -p $HGPORT -d --pid-file hg.pid --config web.view=served.hidden
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
93 $ cat hg.pid >> $DAEMON_PIDS
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
94
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
95 changesets in secret and higher phases are not visible through hgweb
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
96
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
97 $ hg -R repo-with-hidden log --template "revision: {rev}\\n" --rev "reverse(not secret())"
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
98 revision: 2
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
99 revision: 0
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
100 $ hg -R repo-with-hidden log --template "revision: {rev}\\n" --rev "reverse(not secret())" --hidden
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
101 revision: 3
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
102 revision: 2
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
103 revision: 1
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
104 revision: 0
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
105 $ get-with-headers.py localhost:$HGPORT 'log?style=raw' | grep revision:
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
106 revision: 3
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
107 revision: 2
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
108 revision: 1
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
109 revision: 0
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
110
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
111 $ killdaemons.py