Mercurial > hg
comparison tests/test-remote-hidden.t @ 42126:ef0e3cc684b3
repoview: introduce a filter for serving hidden changesets
There are multiple usecase for being able to explicitly view or pull obsolete
from a server. We need to be able to do so without exposing the secret
changesets. We introduces a dedicated repository "view" to do so. Way to expose
this "view" to the user will come later.
To keep a behavior consistent with expected client/server behavior, the general
idea is for the obsolete access to be explicitly requested by the code
generating the request. In addition, the will be server side configuration to
restrict the access to this feature.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 21 May 2018 17:28:35 +0200 |
parents | |
children | 70b71421fd33 |
comparison
equal
deleted
inserted
replaced
42125:bc15e37ecc16 | 42126:ef0e3cc684b3 |
---|---|
1 ======================================================== | |
2 Test the ability to access a hidden revision on a server | |
3 ======================================================== | |
4 | |
5 #require serve | |
6 | |
7 $ . $TESTDIR/testlib/obsmarker-common.sh | |
8 $ cat >> $HGRCPATH << EOF | |
9 > [phases] | |
10 > # public changeset are not obsolete | |
11 > publish=false | |
12 > [experimental] | |
13 > evolution=all | |
14 > [ui] | |
15 > logtemplate='{rev}:{node|short} {desc} [{phase}]\n' | |
16 > EOF | |
17 | |
18 Setup a simple repository with some hidden revisions | |
19 ---------------------------------------------------- | |
20 | |
21 Testing the `served.hidden` view | |
22 | |
23 $ hg init repo-with-hidden | |
24 $ cd repo-with-hidden | |
25 | |
26 $ echo 0 > a | |
27 $ hg ci -qAm "c_Public" | |
28 $ hg phase --public | |
29 $ echo 1 > a | |
30 $ hg ci -m "c_Amend_Old" | |
31 $ echo 2 > a | |
32 $ hg ci -m "c_Amend_New" --amend | |
33 $ hg up ".^" | |
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
35 $ echo 3 > a | |
36 $ hg ci -m "c_Pruned" | |
37 created new head | |
38 $ hg debugobsolete --record-parents `getid 'desc("c_Pruned")'` -d '0 0' | |
39 obsoleted 1 changesets | |
40 $ hg up ".^" | |
41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
42 $ echo 4 > a | |
43 $ hg ci -m "c_Secret" --secret | |
44 created new head | |
45 $ echo 5 > a | |
46 $ hg ci -m "c_Secret_Pruned" --secret | |
47 $ hg debugobsolete --record-parents `getid 'desc("c_Secret_Pruned")'` -d '0 0' | |
48 obsoleted 1 changesets | |
49 $ hg up null | |
50 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
51 | |
52 $ hg log -G -T '{rev}:{node|short} {desc} [{phase}]\n' --hidden | |
53 x 5:8d28cbe335f3 c_Secret_Pruned [secret] | |
54 | | |
55 o 4:1c6afd79eb66 c_Secret [secret] | |
56 | | |
57 | x 3:5d1575e42c25 c_Pruned [draft] | |
58 |/ | |
59 | o 2:c33affeb3f6b c_Amend_New [draft] | |
60 |/ | |
61 | x 1:be215fbb8c50 c_Amend_Old [draft] | |
62 |/ | |
63 o 0:5f354f46e585 c_Public [public] | |
64 | |
65 $ hg debugobsolete | |
66 be215fbb8c5090028b00154c1fe877ad1b376c61 c33affeb3f6b4e9621d1839d6175ddc07708807c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'} | |
67 5d1575e42c25b7f2db75cd4e0b881b1c35158fae 0 {5f354f46e5853535841ec7a128423e991ca4d59b} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} | |
68 8d28cbe335f311bc89332d7bbe8a07889b6914a0 0 {1c6afd79eb6663275bbe30097e162b1c24ced0f0} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} | |
69 | |
70 $ cd .. | |
71 | |
72 Test the feature | |
73 ================ | |
74 | |
75 Check that the `served.hidden` repoview | |
76 --------------------------------------- | |
77 | |
78 $ hg -R repo-with-hidden serve -p $HGPORT -d --pid-file hg.pid --config web.view=served.hidden | |
79 $ cat hg.pid >> $DAEMON_PIDS | |
80 | |
81 changesets in secret and higher phases are not visible through hgweb | |
82 | |
83 $ hg -R repo-with-hidden log --template "revision: {rev}\\n" --rev "reverse(not secret())" | |
84 revision: 2 | |
85 revision: 0 | |
86 $ hg -R repo-with-hidden log --template "revision: {rev}\\n" --rev "reverse(not secret())" --hidden | |
87 revision: 3 | |
88 revision: 2 | |
89 revision: 1 | |
90 revision: 0 | |
91 $ get-with-headers.py localhost:$HGPORT 'log?style=raw' | grep revision: | |
92 revision: 3 | |
93 revision: 2 | |
94 revision: 1 | |
95 revision: 0 | |
96 | |
97 $ killdaemons.py |