Show More
@@ -1,271 +1,269 b'' | |||
|
1 | 1 | Test transaction safety |
|
2 | 2 | ======================= |
|
3 | 3 | |
|
4 | 4 | #testcases revlogv1 revlogv2 changelogv2 |
|
5 | 5 | |
|
6 | 6 | #if revlogv1 |
|
7 | 7 | |
|
8 | 8 | $ cat << EOF >> $HGRCPATH |
|
9 | 9 | > [experimental] |
|
10 | 10 | > revlogv2=no |
|
11 | 11 | > EOF |
|
12 | 12 | |
|
13 | 13 | #endif |
|
14 | 14 | |
|
15 | 15 | #if revlogv2 |
|
16 | 16 | |
|
17 | 17 | $ cat << EOF >> $HGRCPATH |
|
18 | 18 | > [experimental] |
|
19 | 19 | > revlogv2=enable-unstable-format-and-corrupt-my-data |
|
20 | 20 | > EOF |
|
21 | 21 | |
|
22 | 22 | #endif |
|
23 | 23 | |
|
24 | 24 | #if changelogv2 |
|
25 | 25 | |
|
26 | 26 | $ cat << EOF >> $HGRCPATH |
|
27 | 27 | > [format] |
|
28 | 28 | > exp-use-changelog-v2=enable-unstable-format-and-corrupt-my-data |
|
29 | 29 | > EOF |
|
30 | 30 | |
|
31 | 31 | #endif |
|
32 | 32 | |
|
33 | 33 | This test basic case to make sure external process do not see transaction |
|
34 | 34 | content until it is committed. |
|
35 | 35 | |
|
36 | 36 | # TODO: also add an external reader accessing revlog files while they are written |
|
37 | 37 | # (instead of during transaction finalisation) |
|
38 | 38 | |
|
39 | 39 | # TODO: also add stream clone and hardlink clone happening during these transaction. |
|
40 | 40 | |
|
41 | 41 | setup |
|
42 | 42 | ----- |
|
43 | 43 | |
|
44 | 44 | synchronisation+output script: |
|
45 | 45 | |
|
46 | 46 | $ mkdir sync |
|
47 | 47 | $ mkdir output |
|
48 | 48 | $ mkdir script |
|
49 | 49 | $ HG_TEST_FILE_EXT_WAITING=$TESTTMP/sync/ext_waiting |
|
50 | 50 | $ export HG_TEST_FILE_EXT_WAITING |
|
51 | 51 | $ HG_TEST_FILE_EXT_UNLOCK=$TESTTMP/sync/ext_unlock |
|
52 | 52 | $ export HG_TEST_FILE_EXT_UNLOCK |
|
53 | 53 | $ HG_TEST_FILE_EXT_DONE=$TESTTMP/sync/ext_done |
|
54 | 54 | $ export HG_TEST_FILE_EXT_DONE |
|
55 | 55 | $ cat << EOF > script/external.sh |
|
56 | 56 | > #!/bin/sh |
|
57 |
> $RUNTESTDIR/testlib/wait-on-file 5 $ |
|
|
58 |
> hg log --rev 'tip' -T 'external: {rev} {desc}\n' > $ |
|
|
59 |
> touch $ |
|
|
57 | > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_UNLOCK" "$HG_TEST_FILE_EXT_WAITING" | |
|
58 | > hg log --rev 'tip' -T 'external: {rev} {desc}\n' > "$TESTTMP/output/external.out" | |
|
59 | > touch "$HG_TEST_FILE_EXT_DONE" | |
|
60 | 60 | > EOF |
|
61 | $ chmod +x script/external.sh | |
|
62 | 61 | $ cat << EOF > script/internal.sh |
|
63 | 62 | > #!/bin/sh |
|
64 |
> hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > $ |
|
|
65 |
> $RUNTESTDIR/testlib/wait-on-file 5 $ |
|
|
63 | > hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > "$TESTTMP/output/internal.out" | |
|
64 | > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_DONE" "$HG_TEST_FILE_EXT_UNLOCK" | |
|
66 | 65 | > EOF |
|
67 | $ chmod +x script/internal.sh | |
|
68 | 66 | |
|
69 | 67 | |
|
70 | 68 | Automated commands: |
|
71 | 69 | |
|
72 | 70 | $ make_one_commit() { |
|
73 | 71 | > rm -f $TESTTMP/sync/* |
|
74 | 72 | > rm -f $TESTTMP/output/* |
|
75 | 73 | > hg log --rev 'tip' -T 'pre-commit: {rev} {desc}\n' |
|
76 | 74 | > echo x >> a |
|
77 | > $TESTTMP/script/external.sh & hg commit -m "$1" | |
|
75 | > sh $TESTTMP/script/external.sh & hg commit -m "$1" | |
|
78 | 76 | > cat $TESTTMP/output/external.out |
|
79 | 77 | > cat $TESTTMP/output/internal.out |
|
80 | 78 | > hg log --rev 'tip' -T 'post-tr: {rev} {desc}\n' |
|
81 | 79 | > } |
|
82 | 80 | |
|
83 | 81 | |
|
84 | 82 | $ make_one_pull() { |
|
85 | 83 | > rm -f $TESTTMP/sync/* |
|
86 | 84 | > rm -f $TESTTMP/output/* |
|
87 | 85 | > hg log --rev 'tip' -T 'pre-commit: {rev} {desc}\n' |
|
88 | 86 | > echo x >> a |
|
89 | > $TESTTMP/script/external.sh & hg pull ../other-repo/ --rev "$1" --force --quiet | |
|
87 | > sh $TESTTMP/script/external.sh & hg pull ../other-repo/ --rev "$1" --force --quiet | |
|
90 | 88 | > cat $TESTTMP/output/external.out |
|
91 | 89 | > cat $TESTTMP/output/internal.out |
|
92 | 90 | > hg log --rev 'tip' -T 'post-tr: {rev} {desc}\n' |
|
93 | 91 | > } |
|
94 | 92 | |
|
95 | 93 | prepare a large source to which to pull from: |
|
96 | 94 | |
|
97 | 95 | The source is large to unsure we don't use inline more after the pull |
|
98 | 96 | |
|
99 | 97 | $ hg init other-repo |
|
100 | 98 | $ hg -R other-repo debugbuilddag .+500 |
|
101 | 99 | |
|
102 | 100 | |
|
103 | 101 | prepare an empty repository where to make test: |
|
104 | 102 | |
|
105 | 103 | $ hg init repo |
|
106 | 104 | $ cd repo |
|
107 | 105 | $ touch a |
|
108 | 106 | $ hg add a |
|
109 | 107 | |
|
110 | 108 | prepare a small extension to controll inline size |
|
111 | 109 | |
|
112 | 110 | $ mkdir $TESTTMP/ext |
|
113 | 111 | $ cat << EOF > $TESTTMP/ext/small_inline.py |
|
114 | 112 | > from mercurial import revlog |
|
115 | 113 | > revlog._maxinline = 64 * 100 |
|
116 | 114 | > EOF |
|
117 | 115 | |
|
118 | 116 | |
|
119 | 117 | |
|
120 | 118 | |
|
121 | 119 | $ cat << EOF >> $HGRCPATH |
|
122 | 120 | > [extensions] |
|
123 | 121 | > small_inline=$TESTTMP/ext/small_inline.py |
|
124 | 122 | > [hooks] |
|
125 | > pretxnclose = $TESTTMP/script/internal.sh | |
|
123 | > pretxnclose = sh $TESTTMP/script/internal.sh | |
|
126 | 124 | > EOF |
|
127 | 125 | |
|
128 | 126 | check this is true for the initial commit (inline → inline) |
|
129 | 127 | ----------------------------------------------------------- |
|
130 | 128 | |
|
131 | 129 | the repository should still be inline (for relevant format) |
|
132 | 130 | |
|
133 | 131 | $ make_one_commit first |
|
134 | 132 | pre-commit: -1 |
|
135 | 133 | external: -1 |
|
136 | 134 | internal: 0 first |
|
137 | 135 | post-tr: 0 first |
|
138 | 136 | |
|
139 | 137 | #if revlogv1 |
|
140 | 138 | |
|
141 | 139 | $ hg debugrevlog -c | grep inline |
|
142 | 140 | flags : inline |
|
143 | 141 | |
|
144 | 142 | #endif |
|
145 | 143 | |
|
146 | 144 | check this is true for extra commit (inline → inline) |
|
147 | 145 | ----------------------------------------------------- |
|
148 | 146 | |
|
149 | 147 | the repository should still be inline (for relevant format) |
|
150 | 148 | |
|
151 | 149 | #if revlogv1 |
|
152 | 150 | |
|
153 | 151 | $ hg debugrevlog -c | grep inline |
|
154 | 152 | flags : inline |
|
155 | 153 | |
|
156 | 154 | #endif |
|
157 | 155 | |
|
158 | 156 | $ make_one_commit second |
|
159 | 157 | pre-commit: 0 first |
|
160 | 158 | external: 0 first |
|
161 | 159 | internal: 1 second |
|
162 | 160 | post-tr: 1 second |
|
163 | 161 | |
|
164 | 162 | #if revlogv1 |
|
165 | 163 | |
|
166 | 164 | $ hg debugrevlog -c | grep inline |
|
167 | 165 | flags : inline |
|
168 | 166 | |
|
169 | 167 | #endif |
|
170 | 168 | |
|
171 | 169 | check this is true for a small pull (inline → inline) |
|
172 | 170 | ----------------------------------------------------- |
|
173 | 171 | |
|
174 | 172 | the repository should still be inline (for relevant format) |
|
175 | 173 | |
|
176 | 174 | #if revlogv1 |
|
177 | 175 | |
|
178 | 176 | $ hg debugrevlog -c | grep inline |
|
179 | 177 | flags : inline |
|
180 | 178 | |
|
181 | 179 | #endif |
|
182 | 180 | |
|
183 | 181 | $ make_one_pull 3 |
|
184 | 182 | pre-commit: 1 second |
|
185 | 183 | warning: repository is unrelated |
|
186 | 184 | external: 1 second |
|
187 | 185 | internal: 5 r3 |
|
188 | 186 | post-tr: 5 r3 |
|
189 | 187 | |
|
190 | 188 | #if revlogv1 |
|
191 | 189 | |
|
192 | 190 | $ hg debugrevlog -c | grep inline |
|
193 | 191 | flags : inline |
|
194 | 192 | |
|
195 | 193 | #endif |
|
196 | 194 | |
|
197 | 195 | Make a large pull (inline → no-inline) |
|
198 | 196 | --------------------------------------- |
|
199 | 197 | |
|
200 | 198 | the repository should no longer be inline (for relevant format) |
|
201 | 199 | |
|
202 | 200 | #if revlogv1 |
|
203 | 201 | |
|
204 | 202 | $ hg debugrevlog -c | grep inline |
|
205 | 203 | flags : inline |
|
206 | 204 | |
|
207 | 205 | #endif |
|
208 | 206 | |
|
209 | 207 | $ make_one_pull 400 |
|
210 | 208 | pre-commit: 5 r3 |
|
211 | 209 | external: 5 r3 |
|
212 | 210 | internal: 402 r400 |
|
213 | 211 | post-tr: 402 r400 |
|
214 | 212 | |
|
215 | 213 | #if revlogv1 |
|
216 | 214 | |
|
217 | 215 | $ hg debugrevlog -c | grep inline |
|
218 | 216 | [1] |
|
219 | 217 | |
|
220 | 218 | #endif |
|
221 | 219 | |
|
222 | 220 | check this is true for extra commit (no-inline → no-inline) |
|
223 | 221 | ----------------------------------------------------------- |
|
224 | 222 | |
|
225 | 223 | the repository should no longer be inline (for relevant format) |
|
226 | 224 | |
|
227 | 225 | #if revlogv1 |
|
228 | 226 | |
|
229 | 227 | $ hg debugrevlog -c | grep inline |
|
230 | 228 | [1] |
|
231 | 229 | |
|
232 | 230 | #endif |
|
233 | 231 | |
|
234 | 232 | $ make_one_commit third |
|
235 | 233 | pre-commit: 402 r400 |
|
236 | 234 | external: 402 r400 |
|
237 | 235 | internal: 403 third |
|
238 | 236 | post-tr: 403 third |
|
239 | 237 | |
|
240 | 238 | #if revlogv1 |
|
241 | 239 | |
|
242 | 240 | $ hg debugrevlog -c | grep inline |
|
243 | 241 | [1] |
|
244 | 242 | |
|
245 | 243 | #endif |
|
246 | 244 | |
|
247 | 245 | |
|
248 | 246 | Make a pull (not-inline → no-inline) |
|
249 | 247 | ------------------------------------- |
|
250 | 248 | |
|
251 | 249 | the repository should no longer be inline (for relevant format) |
|
252 | 250 | |
|
253 | 251 | #if revlogv1 |
|
254 | 252 | |
|
255 | 253 | $ hg debugrevlog -c | grep inline |
|
256 | 254 | [1] |
|
257 | 255 | |
|
258 | 256 | #endif |
|
259 | 257 | |
|
260 | 258 | $ make_one_pull tip |
|
261 | 259 | pre-commit: 403 third |
|
262 | 260 | external: 403 third |
|
263 | 261 | internal: 503 r500 |
|
264 | 262 | post-tr: 503 r500 |
|
265 | 263 | |
|
266 | 264 | #if revlogv1 |
|
267 | 265 | |
|
268 | 266 | $ hg debugrevlog -c | grep inline |
|
269 | 267 | [1] |
|
270 | 268 | |
|
271 | 269 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now