Mercurial > evolve
comparison tests/testlib/exchange-obsmarker-util.sh @ 2268:f2ebe960998b stable
tests: update test to match upstreamable version
Name have been clarified, documentation has been updated and some test-case have
been updated to match the intended test.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Sat, 08 Apr 2017 12:48:20 +0200 |
parents | tests/testlib/exchange-util.sh@d0bc98161794 |
children | 51a1dd295fe0 |
comparison
equal
deleted
inserted
replaced
2267:150fee60887a | 2268:f2ebe960998b |
---|---|
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 | |
32 [extensions] | |
33 hgext.strip= | |
34 EOF | |
35 echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH | |
36 | |
37 mkcommit() { | |
38 echo "$1" > "$1" | |
39 hg add "$1" | |
40 hg ci -m "$1" | |
41 } | |
42 getid() { | |
43 hg log --hidden --template '{node}\n' --rev "$1" | |
44 } | |
45 | |
46 setuprepos() { | |
47 echo creating test repo for test case $1 | |
48 mkdir $1 | |
49 cd $1 | |
50 echo - pulldest | |
51 hg init pushdest | |
52 cd pushdest | |
53 mkcommit O | |
54 hg phase --public . | |
55 cd .. | |
56 echo - main | |
57 hg clone -q pushdest main | |
58 echo - pushdest | |
59 hg clone -q main pulldest | |
60 echo 'cd into `main` and proceed with env setup' | |
61 } | |
62 | |
63 inspect_obsmarkers (){ | |
64 # This exist as its own function to help the evolve extension reuse the tests as is. | |
65 # The evolve extensions version will includes more advances query (eg: | |
66 # related to obsmarkers discovery) to this. | |
67 echo 'obsstore content' | |
68 echo '================' | |
69 hg debugobsolete | |
70 echo 'obshashtree' | |
71 echo '===========' | |
72 hg debugobsrelsethashtree | |
73 echo 'obshashrange' | |
74 echo '============' | |
75 hg debugobshashrange --subranges --rev 'head()' | |
76 } | |
77 | |
78 dotest() { | |
79 # dotest TESTNAME [TARGETNODE] [PUSHFLAGS+] | |
80 # | |
81 # test exchange for the given test case. | |
82 # | |
83 # This function performs push and pull in all directions through all | |
84 # protocols and display the resulting obsolescence markers on all sides. | |
85 | |
86 testcase=$1 | |
87 shift | |
88 target="$1" | |
89 if [ $# -gt 0 ]; then | |
90 shift | |
91 fi | |
92 targetnode="" | |
93 desccall="" | |
94 cd $testcase | |
95 echo "## Running testcase $testcase" | |
96 if [ -n "$target" ]; then | |
97 desccall="desc("\'"$target"\'")" | |
98 targetnode="`hg -R main id -qr \"$desccall\"`" | |
99 echo "# testing echange of \"$target\" ($targetnode)" | |
100 fi | |
101 echo "## initial state" | |
102 echo "# obstore: main" | |
103 hg -R main debugobsolete | sort | |
104 echo "# obstore: pushdest" | |
105 hg -R pushdest debugobsolete | sort | |
106 echo "# obstore: pulldest" | |
107 hg -R pulldest debugobsolete | sort | |
108 | |
109 if [ -n "$target" ]; then | |
110 echo "## pushing \"$target\"" from main to pushdest | |
111 hg -R main push -r "$desccall" $@ pushdest | |
112 else | |
113 echo "## pushing from main to pushdest" | |
114 hg -R main push pushdest $@ | |
115 fi | |
116 echo "## post push state" | |
117 echo "# obstore: main" | |
118 hg -R main debugobsolete | sort | |
119 echo "# obstore: pushdest" | |
120 hg -R pushdest debugobsolete | sort | |
121 echo "# obstore: pulldest" | |
122 hg -R pulldest debugobsolete | sort | |
123 if [ -n "$target" ]; then | |
124 echo "## pulling \"$targetnode\"" from main into pulldest | |
125 hg -R pulldest pull -r $targetnode $@ main | |
126 else | |
127 echo "## pulling from main into pulldest" | |
128 hg -R pulldest pull main $@ | |
129 fi | |
130 echo "## post pull state" | |
131 echo "# obstore: main" | |
132 hg -R main debugobsolete | sort | |
133 echo "# obstore: pushdest" | |
134 hg -R pushdest debugobsolete | sort | |
135 echo "# obstore: pulldest" | |
136 hg -R pulldest debugobsolete | sort | |
137 | |
138 cd .. | |
139 | |
140 } |