Show More
@@ -0,0 +1,133 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | # setup config and various utility to test obsolescence marker exchanges tests | |||
|
3 | ||||
|
4 | cat >> $HGRCPATH <<EOF | |||
|
5 | [web] | |||
|
6 | # We test http pull and push, drop authentication requirement | |||
|
7 | push_ssl = false | |||
|
8 | allow_push = * | |||
|
9 | ||||
|
10 | [ui] | |||
|
11 | # simpler log output | |||
|
12 | logtemplate ="{node|short} ({phase}): {desc}\n" | |||
|
13 | ||||
|
14 | [phases] | |||
|
15 | # non publishing server | |||
|
16 | publish=False | |||
|
17 | ||||
|
18 | [experimental] | |||
|
19 | # reduce output changes | |||
|
20 | bundle2-output-capture=True | |||
|
21 | # enable evolution | |||
|
22 | evolution=all | |||
|
23 | ||||
|
24 | [extensions] | |||
|
25 | # we need to strip some changeset for some test cases | |||
|
26 | hgext.strip= | |||
|
27 | ||||
|
28 | [alias] | |||
|
29 | # fix date used to create obsolete markers. | |||
|
30 | debugobsolete=debugobsolete -d '0 0' | |||
|
31 | # poor man substiture to the evolve 'hg prune'. using prune makes the test clearer and | |||
|
32 | prune =!hg debugobsolete --record-parents \$1 "\$2" \`hg log --hidden --template '{node}\n' --rev "\$3"\`;\ | |||
|
33 | hg up --quiet 'max((::.) - obsolete())' | |||
|
34 | EOF | |||
|
35 | ||||
|
36 | mkcommit() { | |||
|
37 | echo "$1" > "$1" | |||
|
38 | hg add "$1" | |||
|
39 | hg ci -m "$1" | |||
|
40 | } | |||
|
41 | getid() { | |||
|
42 | hg log --hidden --template '{node}\n' --rev "$1" | |||
|
43 | } | |||
|
44 | ||||
|
45 | setuprepos() { | |||
|
46 | echo creating test repo for test case $1 | |||
|
47 | mkdir $1 | |||
|
48 | cd $1 | |||
|
49 | echo - pulldest | |||
|
50 | hg init pushdest | |||
|
51 | cd pushdest | |||
|
52 | mkcommit O | |||
|
53 | hg phase --public . | |||
|
54 | cd .. | |||
|
55 | echo - main | |||
|
56 | hg clone -q pushdest main | |||
|
57 | echo - pushdest | |||
|
58 | hg clone -q main pulldest | |||
|
59 | echo 'cd into `main` and proceed with env setup' | |||
|
60 | } | |||
|
61 | ||||
|
62 | inspect_obsmarkers (){ | |||
|
63 | # This exist as its own function to help the evolve extension reuse the tests as is. | |||
|
64 | # The evolve extensions version will includes more advances query (eg: | |||
|
65 | # related to obsmarkers discovery) to this. | |||
|
66 | echo 'obsstore content' | |||
|
67 | echo '================' | |||
|
68 | hg debugobsolete | |||
|
69 | } | |||
|
70 | ||||
|
71 | dotest() { | |||
|
72 | # dotest TESTNAME [TARGETNODE] [PUSHFLAGS+] | |||
|
73 | # | |||
|
74 | # test exchange for the given test case. | |||
|
75 | # | |||
|
76 | # This function performs push and pull in all directions through all | |||
|
77 | # protocols and display the resulting obsolescence markers on all sides. | |||
|
78 | ||||
|
79 | testcase=$1 | |||
|
80 | shift | |||
|
81 | target="$1" | |||
|
82 | if [ $# -gt 0 ]; then | |||
|
83 | shift | |||
|
84 | fi | |||
|
85 | targetnode="" | |||
|
86 | desccall="" | |||
|
87 | cd $testcase | |||
|
88 | echo "## Running testcase $testcase" | |||
|
89 | if [ -n "$target" ]; then | |||
|
90 | desccall="desc("\'"$target"\'")" | |||
|
91 | targetnode="`hg -R main id -qr \"$desccall\"`" | |||
|
92 | echo "# testing echange of \"$target\" ($targetnode)" | |||
|
93 | fi | |||
|
94 | echo "## initial state" | |||
|
95 | echo "# obstore: main" | |||
|
96 | hg -R main debugobsolete | sort | |||
|
97 | echo "# obstore: pushdest" | |||
|
98 | hg -R pushdest debugobsolete | sort | |||
|
99 | echo "# obstore: pulldest" | |||
|
100 | hg -R pulldest debugobsolete | sort | |||
|
101 | ||||
|
102 | if [ -n "$target" ]; then | |||
|
103 | echo "## pushing \"$target\"" from main to pushdest | |||
|
104 | hg -R main push -r "$desccall" $@ pushdest | |||
|
105 | else | |||
|
106 | echo "## pushing from main to pushdest" | |||
|
107 | hg -R main push pushdest $@ | |||
|
108 | fi | |||
|
109 | echo "## post push state" | |||
|
110 | echo "# obstore: main" | |||
|
111 | hg -R main debugobsolete | sort | |||
|
112 | echo "# obstore: pushdest" | |||
|
113 | hg -R pushdest debugobsolete | sort | |||
|
114 | echo "# obstore: pulldest" | |||
|
115 | hg -R pulldest debugobsolete | sort | |||
|
116 | if [ -n "$target" ]; then | |||
|
117 | echo "## pulling \"$targetnode\"" from main into pulldest | |||
|
118 | hg -R pulldest pull -r $targetnode $@ main | |||
|
119 | else | |||
|
120 | echo "## pulling from main into pulldest" | |||
|
121 | hg -R pulldest pull main $@ | |||
|
122 | fi | |||
|
123 | echo "## post pull state" | |||
|
124 | echo "# obstore: main" | |||
|
125 | hg -R main debugobsolete | sort | |||
|
126 | echo "# obstore: pushdest" | |||
|
127 | hg -R pushdest debugobsolete | sort | |||
|
128 | echo "# obstore: pulldest" | |||
|
129 | hg -R pulldest debugobsolete | sort | |||
|
130 | ||||
|
131 | cd .. | |||
|
132 | ||||
|
133 | } |
General Comments 0
You need to be logged in to leave comments.
Login now