tests/test-remote-hidden.t
author Manuel Jacob <me@manueljacob.de>
Fri, 10 Jul 2020 09:59:36 +0200
changeset 45080 00cdac669614
parent 42893 34a46d48d24e
child 50439 4077d6222cf1
permissions -rw-r--r--
procutil: split if condition This prepares the code for subsequent changes where we need to differentiate between the two cases.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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'
42893
34a46d48d24e debugobsolete: also issue the "new obsmarkers" messsage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42127
diff changeset
    39
  1 new obsolescence markers
42126
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    40
  obsoleted 1 changesets
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    41
  $ hg up ".^"
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    42
  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
    43
  $ echo 4 > a
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    44
  $ 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
    45
  created new head
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    46
  $ echo 5 > a
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    47
  $ 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
    48
  $ hg debugobsolete --record-parents `getid 'desc("c_Secret_Pruned")'` -d '0 0'
42893
34a46d48d24e debugobsolete: also issue the "new obsmarkers" messsage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42127
diff changeset
    49
  1 new obsolescence markers
42126
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    50
  obsoleted 1 changesets
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    51
  $ hg up null
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    52
  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
    53
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    54
  $ 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
    55
  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
    56
  |
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    57
  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
    58
  |
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    59
  | 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
    60
  |/
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    61
  | 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
    62
  |/
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    63
  | 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
    64
  |/
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    65
  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
    66
  
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    67
  $ hg debugobsolete
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    68
  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
    69
  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
    70
  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
    71
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    72
  $ cd ..
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
Test the feature
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    75
================
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    76
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
    77
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
    78
--------------------
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
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
  $ 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
    81
  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
    82
  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
    83
  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
    84
  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
    85
  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
    86
  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
    87
  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
    88
  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
    89
  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
    90
42126
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    91
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
    92
---------------------------------------
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    93
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    94
  $ 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
    95
  $ 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
    96
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    97
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
    98
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    99
  $ 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
   100
  revision:    2
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   101
  revision:    0
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   102
  $ 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
   103
  revision:    3
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   104
  revision:    2
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   105
  revision:    1
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   106
  revision:    0
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   107
  $ 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
   108
  revision:    3
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   109
  revision:    2
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   110
  revision:    1
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   111
  revision:    0
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   112
ef0e3cc684b3 repoview: introduce a filter for serving hidden changesets
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   113
  $ killdaemons.py