tests/testlib/push-checkheads-util.sh
author Anton Shestakov <av6@dwimlabs.net>
Wed, 11 Mar 2020 18:03:52 +0700
changeset 5300 372dc6c5692a
parent 5274 fa1324e58fcf
child 5320 1227553f82c6
permissions -rw-r--r--
obshistory: rename node/ctx-displaying functions Not just for debug, and yes we know it's obshistory-related.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2119
diff changeset
     1
# setup config and various utility to test new heads checks on push
2119
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     2
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     3
. $TESTDIR/testlib/common.sh
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     4
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     5
cat >> $HGRCPATH <<EOF
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     6
[ui]
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2119
diff changeset
     7
# simpler log output
5269
5a46f156c9b7 head-checking: add test variants with topics
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2277
diff changeset
     8
logtemplate ="{node|short} ({phase}){if(topic, "[{topic}]")}: {desc}\n"
2119
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     9
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    10
[phases]
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2119
diff changeset
    11
# non publishing server
2119
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    12
publish=False
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    13
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    14
[extensions]
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2119
diff changeset
    15
# we need to strip some changeset for some test cases
2119
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    16
strip=
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    17
evolve=
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    18
EOF
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    19
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    20
setuprepos() {
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    21
    echo creating basic server and client repo
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    22
    hg init server
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    23
    cd server
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    24
    mkcommit root
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    25
    hg phase --public .
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    26
    mkcommit A0
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2119
diff changeset
    27
    cd ..
2119
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    28
    hg clone server client
5272
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5269
diff changeset
    29
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5269
diff changeset
    30
    if [ "$1" = "single-head" ]; then
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5269
diff changeset
    31
        echo >> "server/.hg/hgrc" "[experimental]"
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5269
diff changeset
    32
        echo >> "server/.hg/hgrc" "# enforce a single name per branch"
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5269
diff changeset
    33
        echo >> "server/.hg/hgrc" "single-head-per-branch = yes"
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5269
diff changeset
    34
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5269
diff changeset
    35
        echo >> "client/.hg/hgrc" "[ui]"
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5269
diff changeset
    36
        echo >> "client/.hg/hgrc" "# simpler log output"
5274
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5272
diff changeset
    37
        echo >> "client/.hg/hgrc" 'logtemplate = "{node|short} [{branch}{if(topic, ":{topic}")}] ({phase}): {desc}\\n"'
5272
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5269
diff changeset
    38
    fi
2119
e1c26c632b6d tests: adds simple test case for heads checking
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    39
}