annotate tests/testlib/push-checkheads-util.sh @ 5272:1227553f82c6

tests: don't assume that echo will unescape \\
author Joerg Sonnenberger <joerg@bec.de>
date Thu, 09 Apr 2020 20:02:32 +0200
parents fa1324e58fcf
children fc60328270ac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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
5224
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
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5224
diff changeset
29
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5224
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: 5224
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: 5224
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: 5224
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: 5224
diff changeset
34
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5224
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: 5224
diff changeset
36 echo >> "client/.hg/hgrc" "# simpler log output"
5272
1227553f82c6 tests: don't assume that echo will unescape \\
Joerg Sonnenberger <joerg@bec.de>
parents: 5229
diff changeset
37 printf >> "client/.hg/hgrc" "%s" 'logtemplate = "{node|short} [{branch}{if(topic, ":{topic}")}] ({phase}): {desc}\n"'
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5224
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 }