##// END OF EJS Templates
tests: fix another multi-statement hook for Windows...
Matt Harbison -
r23389:ce209c9d default
parent child Browse files
Show More
@@ -1,519 +1,519
1 1 Test exchange of common information using bundle2
2 2
3 3
4 4 $ getmainid() {
5 5 > hg -R main log --template '{node}\n' --rev "$1"
6 6 > }
7 7
8 8 enable obsolescence
9 9
10 10 $ cat >> $HGRCPATH << EOF
11 11 > [experimental]
12 12 > evolution=createmarkers,exchange
13 13 > bundle2-exp=True
14 14 > [ui]
15 15 > ssh=python "$TESTDIR/dummyssh"
16 16 > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
17 17 > [web]
18 18 > push_ssl = false
19 19 > allow_push = *
20 20 > [phases]
21 21 > publish=False
22 22 > [hooks]
23 23 > changegroup = sh -c "HG_LOCAL= python \"$TESTDIR/printenv.py\" changegroup"
24 > b2x-pretransactionclose.tip = printf 'pre-close-tip:'; hg log -r tip -T '{node|short} {phase} {bookmarks}\n'
25 > b2x-transactionclose.tip = printf 'postclose-tip:'; hg log -r tip -T '{node|short} {phase} {bookmarks}\n'
24 > b2x-pretransactionclose.tip = hg log -r tip -T "pre-close-tip:{node|short} {phase} {bookmarks}\n"
25 > b2x-transactionclose.tip = hg log -r tip -T "postclose-tip:{node|short} {phase} {bookmarks}\n"
26 26 > b2x-transactionclose.env = sh -c "HG_LOCAL= python \"$TESTDIR/printenv.py\" b2x-transactionclose"
27 27 > EOF
28 28
29 29 The extension requires a repo (currently unused)
30 30
31 31 $ hg init main
32 32 $ cd main
33 33 $ touch a
34 34 $ hg add a
35 35 $ hg commit -m 'a'
36 36
37 37 $ hg unbundle $TESTDIR/bundles/rebase.hg
38 38 adding changesets
39 39 adding manifests
40 40 adding file changes
41 41 added 8 changesets with 7 changes to 7 files (+3 heads)
42 42 changegroup hook: HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_SOURCE=unbundle HG_URL=bundle:*/rebase.hg (glob)
43 43 (run 'hg heads' to see heads, 'hg merge' to merge)
44 44
45 45 $ cd ..
46 46
47 47 Real world exchange
48 48 =====================
49 49
50 50 Add more obsolescence information
51 51
52 52 $ hg -R main debugobsolete -d '0 0' 1111111111111111111111111111111111111111 `getmainid 9520eea781bc`
53 53 $ hg -R main debugobsolete -d '0 0' 2222222222222222222222222222222222222222 `getmainid 24b6387c8c8c`
54 54
55 55 clone --pull
56 56
57 57 $ hg -R main phase --public cd010b8cd998
58 58 $ hg clone main other --pull --rev 9520eea781bc
59 59 adding changesets
60 60 adding manifests
61 61 adding file changes
62 62 added 2 changesets with 2 changes to 2 files
63 63 1 new obsolescence markers
64 64 pre-close-tip:9520eea781bc draft
65 65 postclose-tip:9520eea781bc draft
66 66 b2x-transactionclose hook: HG_NEW_OBSMARKERS=1 HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=file:$TESTTMP/main
67 67 changegroup hook: HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_SOURCE=pull HG_URL=file:$TESTTMP/main
68 68 updating to branch default
69 69 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 70 $ hg -R other log -G
71 71 @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
72 72 |
73 73 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
74 74
75 75 $ hg -R other debugobsolete
76 76 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
77 77
78 78 pull
79 79
80 80 $ hg -R main phase --public 9520eea781bc
81 81 $ hg -R other pull -r 24b6387c8c8c
82 82 pulling from $TESTTMP/main (glob)
83 83 searching for changes
84 84 adding changesets
85 85 adding manifests
86 86 adding file changes
87 87 added 1 changesets with 1 changes to 1 files (+1 heads)
88 88 1 new obsolescence markers
89 89 pre-close-tip:24b6387c8c8c draft
90 90 postclose-tip:24b6387c8c8c draft
91 91 b2x-transactionclose hook: HG_NEW_OBSMARKERS=1 HG_NODE=24b6387c8c8cae37178880f3fa95ded3cb1cf785 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=file:$TESTTMP/main
92 92 changegroup hook: HG_NODE=24b6387c8c8cae37178880f3fa95ded3cb1cf785 HG_SOURCE=pull HG_URL=file:$TESTTMP/main
93 93 (run 'hg heads' to see heads, 'hg merge' to merge)
94 94 $ hg -R other log -G
95 95 o 2:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F
96 96 |
97 97 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
98 98 |/
99 99 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
100 100
101 101 $ hg -R other debugobsolete
102 102 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
103 103 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
104 104
105 105 pull empty (with phase movement)
106 106
107 107 $ hg -R main phase --public 24b6387c8c8c
108 108 $ hg -R other pull -r 24b6387c8c8c
109 109 pulling from $TESTTMP/main (glob)
110 110 no changes found
111 111 pre-close-tip:000000000000 public
112 112 postclose-tip:24b6387c8c8c public
113 113 b2x-transactionclose hook: HG_NEW_OBSMARKERS=0 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=file:$TESTTMP/main
114 114 $ hg -R other log -G
115 115 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
116 116 |
117 117 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
118 118 |/
119 119 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
120 120
121 121 $ hg -R other debugobsolete
122 122 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
123 123 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
124 124
125 125 pull empty
126 126
127 127 $ hg -R other pull -r 24b6387c8c8c
128 128 pulling from $TESTTMP/main (glob)
129 129 no changes found
130 130 pre-close-tip:24b6387c8c8c public
131 131 postclose-tip:24b6387c8c8c public
132 132 b2x-transactionclose hook: HG_NEW_OBSMARKERS=0 HG_SOURCE=pull HG_URL=file:$TESTTMP/main
133 133 $ hg -R other log -G
134 134 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
135 135 |
136 136 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
137 137 |/
138 138 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
139 139
140 140 $ hg -R other debugobsolete
141 141 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
142 142 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
143 143
144 144 add extra data to test their exchange during push
145 145
146 146 $ hg -R main bookmark --rev eea13746799a book_eea1
147 147 $ hg -R main debugobsolete -d '0 0' 3333333333333333333333333333333333333333 `getmainid eea13746799a`
148 148 $ hg -R main bookmark --rev 02de42196ebe book_02de
149 149 $ hg -R main debugobsolete -d '0 0' 4444444444444444444444444444444444444444 `getmainid 02de42196ebe`
150 150 $ hg -R main bookmark --rev 42ccdea3bb16 book_42cc
151 151 $ hg -R main debugobsolete -d '0 0' 5555555555555555555555555555555555555555 `getmainid 42ccdea3bb16`
152 152 $ hg -R main bookmark --rev 5fddd98957c8 book_5fdd
153 153 $ hg -R main debugobsolete -d '0 0' 6666666666666666666666666666666666666666 `getmainid 5fddd98957c8`
154 154 $ hg -R main bookmark --rev 32af7686d403 book_32af
155 155 $ hg -R main debugobsolete -d '0 0' 7777777777777777777777777777777777777777 `getmainid 32af7686d403`
156 156
157 157 $ hg -R other bookmark --rev cd010b8cd998 book_eea1
158 158 $ hg -R other bookmark --rev cd010b8cd998 book_02de
159 159 $ hg -R other bookmark --rev cd010b8cd998 book_42cc
160 160 $ hg -R other bookmark --rev cd010b8cd998 book_5fdd
161 161 $ hg -R other bookmark --rev cd010b8cd998 book_32af
162 162
163 163 $ hg -R main phase --public eea13746799a
164 164
165 165 push
166 166 $ hg -R main push other --rev eea13746799a --bookmark book_eea1
167 167 pushing to other
168 168 searching for changes
169 169 pre-close-tip:eea13746799a public book_eea1
170 170 postclose-tip:eea13746799a public book_eea1
171 171 b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_URL=push
172 172 changegroup hook: HG_BUNDLE2-EXP=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_SOURCE=push HG_URL=push
173 173 remote: adding changesets
174 174 remote: adding manifests
175 175 remote: adding file changes
176 176 remote: added 1 changesets with 0 changes to 0 files (-1 heads)
177 177 remote: 1 new obsolescence markers
178 178 updating bookmark book_eea1
179 179 $ hg -R other log -G
180 180 o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
181 181 |\
182 182 | o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
183 183 | |
184 184 @ | 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
185 185 |/
186 186 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de book_32af book_42cc book_5fdd A
187 187
188 188 $ hg -R other debugobsolete
189 189 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
190 190 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
191 191 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
192 192
193 193 pull over ssh
194 194
195 195 $ hg -R other pull ssh://user@dummy/main -r 02de42196ebe --bookmark book_02de
196 196 pulling from ssh://user@dummy/main
197 197 searching for changes
198 198 adding changesets
199 199 adding manifests
200 200 adding file changes
201 201 added 1 changesets with 1 changes to 1 files (+1 heads)
202 202 1 new obsolescence markers
203 203 updating bookmark book_02de
204 204 pre-close-tip:02de42196ebe draft book_02de
205 205 postclose-tip:02de42196ebe draft book_02de
206 206 b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_NEW_OBSMARKERS=1 HG_NODE=02de42196ebee42ef284b6780a87cdc96e8eaab6 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=ssh://user@dummy/main
207 207 changegroup hook: HG_NODE=02de42196ebee42ef284b6780a87cdc96e8eaab6 HG_SOURCE=pull HG_URL=ssh://user@dummy/main
208 208 (run 'hg heads' to see heads, 'hg merge' to merge)
209 209 $ hg -R other debugobsolete
210 210 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
211 211 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
212 212 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
213 213 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
214 214
215 215 pull over http
216 216
217 217 $ hg -R main serve -p $HGPORT -d --pid-file=main.pid -E main-error.log
218 218 $ cat main.pid >> $DAEMON_PIDS
219 219
220 220 $ hg -R other pull http://localhost:$HGPORT/ -r 42ccdea3bb16 --bookmark book_42cc
221 221 pulling from http://localhost:$HGPORT/
222 222 searching for changes
223 223 adding changesets
224 224 adding manifests
225 225 adding file changes
226 226 added 1 changesets with 1 changes to 1 files (+1 heads)
227 227 1 new obsolescence markers
228 228 updating bookmark book_42cc
229 229 pre-close-tip:42ccdea3bb16 draft book_42cc
230 230 postclose-tip:42ccdea3bb16 draft book_42cc
231 231 b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_NEW_OBSMARKERS=1 HG_NODE=42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/
232 232 changegroup hook: HG_NODE=42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/
233 233 (run 'hg heads .' to see heads, 'hg merge' to merge)
234 234 $ cat main-error.log
235 235 $ hg -R other debugobsolete
236 236 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
237 237 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
238 238 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
239 239 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
240 240 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
241 241
242 242 push over ssh
243 243
244 244 $ hg -R main push ssh://user@dummy/other -r 5fddd98957c8 --bookmark book_5fdd
245 245 pushing to ssh://user@dummy/other
246 246 searching for changes
247 247 remote: adding changesets
248 248 remote: adding manifests
249 249 remote: adding file changes
250 250 remote: added 1 changesets with 1 changes to 1 files
251 251 remote: 1 new obsolescence markers
252 252 updating bookmark book_5fdd
253 253 remote: pre-close-tip:5fddd98957c8 draft book_5fdd
254 254 remote: postclose-tip:5fddd98957c8 draft book_5fdd
255 255 remote: b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
256 256 remote: changegroup hook: HG_BUNDLE2-EXP=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
257 257 $ hg -R other log -G
258 258 o 6:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C
259 259 |
260 260 o 5:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B
261 261 |
262 262 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H
263 263 | |
264 264 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
265 265 | |/|
266 266 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
267 267 |/ /
268 268 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
269 269 |/
270 270 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af A
271 271
272 272 $ hg -R other debugobsolete
273 273 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
274 274 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
275 275 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
276 276 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
277 277 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
278 278 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
279 279
280 280 push over http
281 281
282 282 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
283 283 $ cat other.pid >> $DAEMON_PIDS
284 284
285 285 $ hg -R main phase --public 32af7686d403
286 286 $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403 --bookmark book_32af
287 287 pushing to http://localhost:$HGPORT2/
288 288 searching for changes
289 289 remote: adding changesets
290 290 remote: adding manifests
291 291 remote: adding file changes
292 292 remote: added 1 changesets with 1 changes to 1 files
293 293 remote: 1 new obsolescence markers
294 294 updating bookmark book_32af
295 295 $ cat other-error.log
296 296
297 297 Check final content.
298 298
299 299 $ hg -R other log -G
300 300 o 7:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af D
301 301 |
302 302 o 6:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C
303 303 |
304 304 o 5:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B
305 305 |
306 306 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H
307 307 | |
308 308 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
309 309 | |/|
310 310 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
311 311 |/ /
312 312 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
313 313 |/
314 314 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
315 315
316 316 $ hg -R other debugobsolete
317 317 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
318 318 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
319 319 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
320 320 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
321 321 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
322 322 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
323 323 7777777777777777777777777777777777777777 32af7686d403cf45b5d95f2d70cebea587ac806a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
324 324
325 325 (check that no 'pending' files remain)
326 326
327 327 $ ls -1 other/.hg/bookmarks*
328 328 other/.hg/bookmarks
329 329 $ ls -1 other/.hg/store/phaseroots*
330 330 other/.hg/store/phaseroots
331 331 $ ls -1 other/.hg/store/00changelog.i*
332 332 other/.hg/store/00changelog.i
333 333
334 334 Error Handling
335 335 ==============
336 336
337 337 Check that errors are properly returned to the client during push.
338 338
339 339 Setting up
340 340
341 341 $ cat > failpush.py << EOF
342 342 > """A small extension that makes push fails when using bundle2
343 343 >
344 344 > used to test error handling in bundle2
345 345 > """
346 346 >
347 347 > from mercurial import util
348 348 > from mercurial import bundle2
349 349 > from mercurial import exchange
350 350 > from mercurial import extensions
351 351 >
352 352 > def _pushbundle2failpart(pushop, bundler):
353 353 > reason = pushop.ui.config('failpush', 'reason', None)
354 354 > part = None
355 355 > if reason == 'abort':
356 356 > bundler.newpart('test:abort')
357 357 > if reason == 'unknown':
358 358 > bundler.newpart('TEST:UNKNOWN')
359 359 > if reason == 'race':
360 360 > # 20 Bytes of crap
361 361 > bundler.newpart('b2x:check:heads', data='01234567890123456789')
362 362 >
363 363 > @bundle2.parthandler("test:abort")
364 364 > def handleabort(op, part):
365 365 > raise util.Abort('Abandon ship!', hint="don't panic")
366 366 >
367 367 > def uisetup(ui):
368 368 > exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart
369 369 > exchange.b2partsgenorder.insert(0, 'failpart')
370 370 >
371 371 > EOF
372 372
373 373 $ cd main
374 374 $ hg up tip
375 375 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
376 376 $ echo 'I' > I
377 377 $ hg add I
378 378 $ hg ci -m 'I'
379 379 $ hg id
380 380 e7ec4e813ba6 tip
381 381 $ cd ..
382 382
383 383 $ cat << EOF >> $HGRCPATH
384 384 > [extensions]
385 385 > failpush=$TESTTMP/failpush.py
386 386 > EOF
387 387
388 388 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
389 389 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
390 390 $ cat other.pid >> $DAEMON_PIDS
391 391
392 392 Doing the actual push: Abort error
393 393
394 394 $ cat << EOF >> $HGRCPATH
395 395 > [failpush]
396 396 > reason = abort
397 397 > EOF
398 398
399 399 $ hg -R main push other -r e7ec4e813ba6
400 400 pushing to other
401 401 searching for changes
402 402 abort: Abandon ship!
403 403 (don't panic)
404 404 [255]
405 405
406 406 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
407 407 pushing to ssh://user@dummy/other
408 408 searching for changes
409 409 abort: Abandon ship!
410 410 (don't panic)
411 411 [255]
412 412
413 413 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
414 414 pushing to http://localhost:$HGPORT2/
415 415 searching for changes
416 416 abort: Abandon ship!
417 417 (don't panic)
418 418 [255]
419 419
420 420
421 421 Doing the actual push: unknown mandatory parts
422 422
423 423 $ cat << EOF >> $HGRCPATH
424 424 > [failpush]
425 425 > reason = unknown
426 426 > EOF
427 427
428 428 $ hg -R main push other -r e7ec4e813ba6
429 429 pushing to other
430 430 searching for changes
431 431 abort: missing support for test:unknown
432 432 [255]
433 433
434 434 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
435 435 pushing to ssh://user@dummy/other
436 436 searching for changes
437 437 abort: missing support for test:unknown
438 438 [255]
439 439
440 440 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
441 441 pushing to http://localhost:$HGPORT2/
442 442 searching for changes
443 443 abort: missing support for test:unknown
444 444 [255]
445 445
446 446 Doing the actual push: race
447 447
448 448 $ cat << EOF >> $HGRCPATH
449 449 > [failpush]
450 450 > reason = race
451 451 > EOF
452 452
453 453 $ hg -R main push other -r e7ec4e813ba6
454 454 pushing to other
455 455 searching for changes
456 456 abort: push failed:
457 457 'repository changed while pushing - please try again'
458 458 [255]
459 459
460 460 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
461 461 pushing to ssh://user@dummy/other
462 462 searching for changes
463 463 abort: push failed:
464 464 'repository changed while pushing - please try again'
465 465 [255]
466 466
467 467 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
468 468 pushing to http://localhost:$HGPORT2/
469 469 searching for changes
470 470 abort: push failed:
471 471 'repository changed while pushing - please try again'
472 472 [255]
473 473
474 474 Doing the actual push: hook abort
475 475
476 476 $ cat << EOF >> $HGRCPATH
477 477 > [failpush]
478 478 > reason =
479 479 > [hooks]
480 480 > b2x-pretransactionclose.failpush = false
481 481 > EOF
482 482
483 483 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
484 484 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
485 485 $ cat other.pid >> $DAEMON_PIDS
486 486
487 487 $ hg -R main push other -r e7ec4e813ba6
488 488 pushing to other
489 489 searching for changes
490 490 pre-close-tip:e7ec4e813ba6 draft
491 491 transaction abort!
492 492 rollback completed
493 493 abort: b2x-pretransactionclose.failpush hook exited with status 1
494 494 [255]
495 495
496 496 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
497 497 pushing to ssh://user@dummy/other
498 498 searching for changes
499 499 abort: b2x-pretransactionclose.failpush hook exited with status 1
500 500 remote: pre-close-tip:e7ec4e813ba6 draft
501 501 remote: transaction abort!
502 502 remote: rollback completed
503 503 [255]
504 504
505 505 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
506 506 pushing to http://localhost:$HGPORT2/
507 507 searching for changes
508 508 abort: b2x-pretransactionclose.failpush hook exited with status 1
509 509 [255]
510 510
511 511 (check that no 'pending' files remain)
512 512
513 513 $ ls -1 other/.hg/bookmarks*
514 514 other/.hg/bookmarks
515 515 $ ls -1 other/.hg/store/phaseroots*
516 516 other/.hg/store/phaseroots
517 517 $ ls -1 other/.hg/store/00changelog.i*
518 518 other/.hg/store/00changelog.i
519 519
General Comments 0
You need to be logged in to leave comments. Login now