Debian Codegraph @

tests/test-bundle2-exchange.t

raw
1 Test exchange of common information using bundle2
2
3
4 $ getmainid() {
5 > hg -R main log --template '{node}\n' --rev "$1"
6 > }
7
8 enable obsolescence
9
10 $ cp $HGRCPATH $TESTTMP/hgrc.orig
11 $ cat > $TESTTMP/bundle2-pushkey-hook.sh << EOF
12 > echo pushkey: lock state after \"\$HG_NAMESPACE\"
13 > hg debuglock
14 > EOF
15
16 $ cat >> $HGRCPATH << EOF
17 > [experimental]
18 > evolution.createmarkers=True
19 > evolution.exchange=True
20 > bundle2-output-capture=True
21 > [command-templates]
22 > log={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
23 > [web]
24 > push_ssl = false
25 > allow_push = *
26 > [phases]
27 > publish=False
28 > [hooks]
29 > pretxnclose.tip = hg log -r tip -T "pre-close-tip:{node|short} {phase} {bookmarks}\n"
30 > txnclose.tip = hg log -r tip -T "postclose-tip:{node|short} {phase} {bookmarks}\n"
31 > txnclose.env = sh -c "HG_LOCAL= printenv.py txnclose"
32 > pushkey= sh "$TESTTMP/bundle2-pushkey-hook.sh"
33 > EOF
34
35 The extension requires a repo (currently unused)
36
37 $ hg init main
38 $ cd main
39 $ touch a
40 $ hg add a
41 $ hg commit -m 'a'
42 pre-close-tip:3903775176ed draft
43 postclose-tip:3903775176ed draft
44 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
45
46 $ hg unbundle $TESTDIR/bundles/rebase.hg
47 adding changesets
48 adding manifests
49 adding file changes
50 pre-close-tip:02de42196ebe draft
51 added 8 changesets with 7 changes to 7 files (+3 heads)
52 new changesets cd010b8cd998:02de42196ebe (8 drafts)
53 postclose-tip:02de42196ebe draft
54 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_NODE_LAST=02de42196ebee42ef284b6780a87cdc96e8eaab6 HG_PHASES_MOVED=1 HG_SOURCE=unbundle HG_TXNID=TXN:$ID$ HG_TXNNAME=unbundle
55 bundle:$TESTDIR/bundles/rebase.hg HG_URL=bundle:$TESTDIR/bundles/rebase.hg
56 (run 'hg heads' to see heads, 'hg merge' to merge)
57
58 $ cd ..
59
60 Real world exchange
61 =====================
62
63 Add more obsolescence information
64
65 $ hg -R main debugobsolete -d '0 0' 1111111111111111111111111111111111111111 `getmainid 9520eea781bc`
66 pre-close-tip:02de42196ebe draft
67 1 new obsolescence markers
68 postclose-tip:02de42196ebe draft
69 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
70 $ hg -R main debugobsolete -d '0 0' 2222222222222222222222222222222222222222 `getmainid 24b6387c8c8c`
71 pre-close-tip:02de42196ebe draft
72 1 new obsolescence markers
73 postclose-tip:02de42196ebe draft
74 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
75
76 clone --pull
77
78 $ hg -R main phase --public cd010b8cd998
79 pre-close-tip:02de42196ebe draft
80 postclose-tip:02de42196ebe draft
81 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=phase
82 $ hg clone main other --pull --rev 9520eea781bc
83 adding changesets
84 adding manifests
85 adding file changes
86 pre-close-tip:9520eea781bc draft
87 added 2 changesets with 2 changes to 2 files
88 1 new obsolescence markers
89 new changesets cd010b8cd998:9520eea781bc (1 drafts)
90 postclose-tip:9520eea781bc draft
91 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_NODE_LAST=9520eea781bcca16c1e15acc0ba14335a0e8e5ba HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_TXNNAME=pull
92 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
93 updating to branch default
94 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 $ hg -R other log -G
96 @ 1:9520eea781bc draft Nicolas Dumazet <[email protected]> E
97 |
98 o 0:cd010b8cd998 public Nicolas Dumazet <[email protected]> A
99
100 $ hg -R other debugobsolete
101 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
102
103 pull
104
105 $ hg -R main phase --public 9520eea781bc
106 pre-close-tip:02de42196ebe draft
107 postclose-tip:02de42196ebe draft
108 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=phase
109 $ hg -R other pull -r 24b6387c8c8c
110 pulling from $TESTTMP/main
111 searching for changes
112 adding changesets
113 adding manifests
114 adding file changes
115 pre-close-tip:24b6387c8c8c draft
116 added 1 changesets with 1 changes to 1 files (+1 heads)
117 1 new obsolescence markers
118 new changesets 24b6387c8c8c (1 drafts)
119 postclose-tip:24b6387c8c8c draft
120 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_NODE=24b6387c8c8cae37178880f3fa95ded3cb1cf785 HG_NODE_LAST=24b6387c8c8cae37178880f3fa95ded3cb1cf785 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_TXNNAME=pull
121 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
122 (run 'hg heads' to see heads, 'hg merge' to merge)
123 $ hg -R other log -G
124 o 2:24b6387c8c8c draft Nicolas Dumazet <[email protected]> F
125 |
126 | @ 1:9520eea781bc draft Nicolas Dumazet <[email protected]> E
127 |/
128 o 0:cd010b8cd998 public Nicolas Dumazet <[email protected]> A
129
130 $ hg -R other debugobsolete
131 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
132 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
133
134 pull empty (with phase movement)
135
136 $ hg -R main phase --public 24b6387c8c8c
137 pre-close-tip:02de42196ebe draft
138 postclose-tip:02de42196ebe draft
139 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=phase
140 $ hg -R other pull -r 24b6387c8c8c
141 pulling from $TESTTMP/main
142 no changes found
143 pre-close-tip:24b6387c8c8c public
144 1 local changesets published
145 postclose-tip:24b6387c8c8c public
146 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=0 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_TXNNAME=pull
147 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
148 $ hg -R other log -G
149 o 2:24b6387c8c8c public Nicolas Dumazet <[email protected]> F
150 |
151 | @ 1:9520eea781bc draft Nicolas Dumazet <[email protected]> E
152 |/
153 o 0:cd010b8cd998 public Nicolas Dumazet <[email protected]> A
154
155 $ hg -R other debugobsolete
156 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
157 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
158
159 pull empty
160
161 $ hg -R other pull -r 24b6387c8c8c
162 pulling from $TESTTMP/main
163 no changes found
164 pre-close-tip:24b6387c8c8c public
165 postclose-tip:24b6387c8c8c public
166 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=0 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_TXNNAME=pull
167 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
168 $ hg -R other log -G
169 o 2:24b6387c8c8c public Nicolas Dumazet <[email protected]> F
170 |
171 | @ 1:9520eea781bc draft Nicolas Dumazet <[email protected]> E
172 |/
173 o 0:cd010b8cd998 public Nicolas Dumazet <[email protected]> A
174
175 $ hg -R other debugobsolete
176 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
177 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
178
179 add extra data to test their exchange during push
180
181 $ hg -R main bookmark --rev eea13746799a book_eea1
182 pre-close-tip:02de42196ebe draft
183 postclose-tip:02de42196ebe draft
184 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
185 $ hg -R main debugobsolete -d '0 0' 3333333333333333333333333333333333333333 `getmainid eea13746799a`
186 pre-close-tip:02de42196ebe draft
187 1 new obsolescence markers
188 postclose-tip:02de42196ebe draft
189 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
190 $ hg -R main bookmark --rev 02de42196ebe book_02de
191 pre-close-tip:02de42196ebe draft book_02de
192 postclose-tip:02de42196ebe draft book_02de
193 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
194 $ hg -R main debugobsolete -d '0 0' 4444444444444444444444444444444444444444 `getmainid 02de42196ebe`
195 pre-close-tip:02de42196ebe draft book_02de
196 1 new obsolescence markers
197 postclose-tip:02de42196ebe draft book_02de
198 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
199 $ hg -R main bookmark --rev 42ccdea3bb16 book_42cc
200 pre-close-tip:02de42196ebe draft book_02de
201 postclose-tip:02de42196ebe draft book_02de
202 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
203 $ hg -R main debugobsolete -d '0 0' 5555555555555555555555555555555555555555 `getmainid 42ccdea3bb16`
204 pre-close-tip:02de42196ebe draft book_02de
205 1 new obsolescence markers
206 postclose-tip:02de42196ebe draft book_02de
207 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
208 $ hg -R main bookmark --rev 5fddd98957c8 book_5fdd
209 pre-close-tip:02de42196ebe draft book_02de
210 postclose-tip:02de42196ebe draft book_02de
211 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
212 $ hg -R main debugobsolete -d '0 0' 6666666666666666666666666666666666666666 `getmainid 5fddd98957c8`
213 pre-close-tip:02de42196ebe draft book_02de
214 1 new obsolescence markers
215 postclose-tip:02de42196ebe draft book_02de
216 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
217 $ hg -R main bookmark --rev 32af7686d403 book_32af
218 pre-close-tip:02de42196ebe draft book_02de
219 postclose-tip:02de42196ebe draft book_02de
220 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
221 $ hg -R main debugobsolete -d '0 0' 7777777777777777777777777777777777777777 `getmainid 32af7686d403`
222 pre-close-tip:02de42196ebe draft book_02de
223 1 new obsolescence markers
224 postclose-tip:02de42196ebe draft book_02de
225 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
226
227 $ hg -R other bookmark --rev cd010b8cd998 book_eea1
228 pre-close-tip:24b6387c8c8c public
229 postclose-tip:24b6387c8c8c public
230 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
231 $ hg -R other bookmark --rev cd010b8cd998 book_02de
232 pre-close-tip:24b6387c8c8c public
233 postclose-tip:24b6387c8c8c public
234 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
235 $ hg -R other bookmark --rev cd010b8cd998 book_42cc
236 pre-close-tip:24b6387c8c8c public
237 postclose-tip:24b6387c8c8c public
238 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
239 $ hg -R other bookmark --rev cd010b8cd998 book_5fdd
240 pre-close-tip:24b6387c8c8c public
241 postclose-tip:24b6387c8c8c public
242 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
243 $ hg -R other bookmark --rev cd010b8cd998 book_32af
244 pre-close-tip:24b6387c8c8c public
245 postclose-tip:24b6387c8c8c public
246 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
247
248 $ hg -R main phase --public eea13746799a
249 pre-close-tip:02de42196ebe draft book_02de
250 postclose-tip:02de42196ebe draft book_02de
251 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=phase
252
253 push
254 $ hg -R main push other --rev eea13746799a --bookmark book_eea1
255 pushing to other
256 searching for changes
257 remote: adding changesets
258 remote: adding manifests
259 remote: adding file changes
260 remote: pre-close-tip:eea13746799a public book_eea1
261 remote: added 1 changesets with 0 changes to 0 files (-1 heads)
262 remote: 1 new obsolescence markers
263 remote: pushkey: lock state after "bookmarks"
264 remote: lock: free
265 remote: wlock: free
266 remote: postclose-tip:eea13746799a public book_eea1
267 remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_NODE_LAST=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/other
268 updating bookmark book_eea1
269 pre-close-tip:02de42196ebe draft book_02de
270 postclose-tip:02de42196ebe draft book_02de
271 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_SOURCE=push-response HG_TXNID=TXN:$ID$ HG_TXNNAME=push-response
272 file:/*/$TESTTMP/other HG_URL=file:$TESTTMP/other (glob)
273 $ hg -R other log -G
274 o 3:eea13746799a public Nicolas Dumazet <[email protected]> book_eea1 G
275 |\
276 | o 2:24b6387c8c8c public Nicolas Dumazet <[email protected]> F
277 | |
278 @ | 1:9520eea781bc public Nicolas Dumazet <[email protected]> E
279 |/
280 o 0:cd010b8cd998 public Nicolas Dumazet <[email protected]> book_02de book_32af book_42cc book_5fdd A
281
282 $ hg -R other debugobsolete
283 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
284 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
285 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
286
287 pull over ssh
288
289 $ hg -R other pull ssh://user@dummy/main -r 02de42196ebe --bookmark book_02de
290 pulling from ssh://user@dummy/main
291 searching for changes
292 adding changesets
293 adding manifests
294 adding file changes
295 updating bookmark book_02de
296 pre-close-tip:02de42196ebe draft book_02de
297 added 1 changesets with 1 changes to 1 files (+1 heads)
298 1 new obsolescence markers
299 new changesets 02de42196ebe (1 drafts)
300 postclose-tip:02de42196ebe draft book_02de
301 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_NODE=02de42196ebee42ef284b6780a87cdc96e8eaab6 HG_NODE_LAST=02de42196ebee42ef284b6780a87cdc96e8eaab6 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_TXNNAME=pull
302 ssh://user@dummy/main HG_URL=ssh://user@dummy/main
303 (run 'hg heads' to see heads, 'hg merge' to merge)
304 $ hg -R other debugobsolete
305 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
306 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
307 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
308 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
309
310 pull over http
311
312 $ hg serve -R main -p $HGPORT -d --pid-file=main.pid -E main-error.log
313 $ cat main.pid >> $DAEMON_PIDS
314
315 $ hg -R other pull http://localhost:$HGPORT/ -r 42ccdea3bb16 --bookmark book_42cc
316 pulling from http://localhost:$HGPORT/
317 searching for changes
318 adding changesets
319 adding manifests
320 adding file changes
321 updating bookmark book_42cc
322 pre-close-tip:42ccdea3bb16 draft book_42cc
323 added 1 changesets with 1 changes to 1 files (+1 heads)
324 1 new obsolescence markers
325 new changesets 42ccdea3bb16 (1 drafts)
326 postclose-tip:42ccdea3bb16 draft book_42cc
327 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_NODE=42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 HG_NODE_LAST=42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_TXNNAME=pull
328 http://localhost:$HGPORT/ HG_URL=http://localhost:$HGPORT/
329 (run 'hg heads .' to see heads, 'hg merge' to merge)
330 $ cat main-error.log
331 $ hg -R other debugobsolete
332 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
333 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
334 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
335 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
336 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
337
338 push over ssh
339
340 $ hg -R main push ssh://user@dummy/other -r 5fddd98957c8 --bookmark book_5fdd
341 pushing to ssh://user@dummy/other
342 searching for changes
343 remote: adding changesets
344 remote: adding manifests
345 remote: adding file changes
346 remote: pre-close-tip:5fddd98957c8 draft book_5fdd
347 remote: added 1 changesets with 1 changes to 1 files
348 remote: 1 new obsolescence markers
349 remote: pushkey: lock state after "bookmarks"
350 remote: lock: free
351 remote: wlock: free
352 remote: postclose-tip:5fddd98957c8 draft book_5fdd
353 remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_NODE_LAST=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_TXNNAME=serve HG_URL=remote:ssh:$LOCALIP
354 updating bookmark book_5fdd
355 pre-close-tip:02de42196ebe draft book_02de
356 postclose-tip:02de42196ebe draft book_02de
357 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_SOURCE=push-response HG_TXNID=TXN:$ID$ HG_TXNNAME=push-response
358 ssh://user@dummy/other HG_URL=ssh://user@dummy/other
359 $ hg -R other log -G
360 o 6:5fddd98957c8 draft Nicolas Dumazet <[email protected]> book_5fdd C
361 |
362 o 5:42ccdea3bb16 draft Nicolas Dumazet <[email protected]> book_42cc B
363 |
364 | o 4:02de42196ebe draft Nicolas Dumazet <[email protected]> book_02de H
365 | |
366 | | o 3:eea13746799a public Nicolas Dumazet <[email protected]> book_eea1 G
367 | |/|
368 | o | 2:24b6387c8c8c public Nicolas Dumazet <[email protected]> F
369 |/ /
370 | @ 1:9520eea781bc public Nicolas Dumazet <[email protected]> E
371 |/
372 o 0:cd010b8cd998 public Nicolas Dumazet <[email protected]> book_32af A
373
374 $ hg -R other debugobsolete
375 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
376 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
377 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
378 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
379 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
380 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
381
382 push over http
383
384 $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
385 $ cat other.pid >> $DAEMON_PIDS
386
387 $ hg -R main phase --public 32af7686d403
388 pre-close-tip:02de42196ebe draft book_02de
389 postclose-tip:02de42196ebe draft book_02de
390 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=phase
391 $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403 --bookmark book_32af
392 pushing to http://localhost:$HGPORT2/
393 searching for changes
394 remote: adding changesets
395 remote: adding manifests
396 remote: adding file changes
397 remote: pre-close-tip:32af7686d403 public book_32af
398 remote: added 1 changesets with 1 changes to 1 files
399 remote: 1 new obsolescence markers
400 remote: pushkey: lock state after "bookmarks"
401 remote: lock: free
402 remote: wlock: free
403 remote: postclose-tip:32af7686d403 public book_32af
404 remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_NODE=32af7686d403cf45b5d95f2d70cebea587ac806a HG_NODE_LAST=32af7686d403cf45b5d95f2d70cebea587ac806a HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_TXNNAME=serve HG_URL=remote:http:$LOCALIP: (glob)
405 updating bookmark book_32af
406 pre-close-tip:02de42196ebe draft book_02de
407 postclose-tip:02de42196ebe draft book_02de
408 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_SOURCE=push-response HG_TXNID=TXN:$ID$ HG_TXNNAME=push-response
409 http://localhost:$HGPORT2/ HG_URL=http://localhost:$HGPORT2/
410 $ cat other-error.log
411
412 Check final content.
413
414 $ hg -R other log -G
415 o 7:32af7686d403 public Nicolas Dumazet <[email protected]> book_32af D
416 |
417 o 6:5fddd98957c8 public Nicolas Dumazet <[email protected]> book_5fdd C
418 |
419 o 5:42ccdea3bb16 public Nicolas Dumazet <[email protected]> book_42cc B
420 |
421 | o 4:02de42196ebe draft Nicolas Dumazet <[email protected]> book_02de H
422 | |
423 | | o 3:eea13746799a public Nicolas Dumazet <[email protected]> book_eea1 G
424 | |/|
425 | o | 2:24b6387c8c8c public Nicolas Dumazet <[email protected]> F
426 |/ /
427 | @ 1:9520eea781bc public Nicolas Dumazet <[email protected]> E
428 |/
429 o 0:cd010b8cd998 public Nicolas Dumazet <[email protected]> A
430
431 $ hg -R other debugobsolete
432 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
433 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
434 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
435 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
436 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
437 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
438 7777777777777777777777777777777777777777 32af7686d403cf45b5d95f2d70cebea587ac806a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
439
440 (check that no 'pending' files remain)
441
442 $ ls -1 other/.hg/bookmarks*
443 other/.hg/bookmarks
444 $ ls -1 other/.hg/store/phaseroots*
445 other/.hg/store/phaseroots
446 $ ls -1 other/.hg/store/00changelog.i*
447 other/.hg/store/00changelog.i
448
449 Error Handling
450 ==============
451
452 Check that errors are properly returned to the client during push.
453
454 Setting up
455
456 $ cat > failpush.py << EOF
457 > """A small extension that makes push fails when using bundle2
458 >
459 > used to test error handling in bundle2
460 > """
461 >
462 > from mercurial import error
463 > from mercurial import bundle2_part_handlers
464 > from mercurial import exchange
465 > from mercurial import extensions
466 > from mercurial import registrar
467 > cmdtable = {}
468 > command = registrar.command(cmdtable)
469 >
470 > configtable = {}
471 > configitem = registrar.configitem(configtable)
472 > configitem(b'failpush', b'reason',
473 > default=None,
474 > )
475 >
476 > def _pushbundle2failpart(pushop, bundler):
477 > reason = pushop.ui.config(b'failpush', b'reason')
478 > part = None
479 > if reason == b'abort':
480 > bundler.newpart(b'test:abort')
481 > if reason == b'unknown':
482 > bundler.newpart(b'test:unknown')
483 > if reason == b'race':
484 > # 20 Bytes of crap
485 > bundler.newpart(b'check:heads', data=b'01234567890123456789')
486 >
487 > @bundle2_part_handlers.parthandler(b"test:abort")
488 > def handleabort(op, part):
489 > raise error.Abort(b'Abandon ship!', hint=b"don't panic")
490 >
491 > def uisetup(ui):
492 > exchange.b2partsgenmapping[b'failpart'] = _pushbundle2failpart
493 > exchange.b2partsgenorder.insert(0, b'failpart')
494 >
495 > EOF
496
497 $ cd main
498 $ hg up tip
499 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
500 $ echo 'I' > I
501 $ hg add I
502 $ hg ci -m 'I'
503 pre-close-tip:e7ec4e813ba6 draft
504 postclose-tip:e7ec4e813ba6 draft
505 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
506 $ hg id
507 e7ec4e813ba6 tip
508 $ cd ..
509
510 $ cat << EOF >> $HGRCPATH
511 > [extensions]
512 > failpush=$TESTTMP/failpush.py
513 > EOF
514
515 $ killdaemons.py
516 $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
517 $ cat other.pid >> $DAEMON_PIDS
518
519 Doing the actual push: Abort error
520
521 $ cat << EOF >> $HGRCPATH
522 > [failpush]
523 > reason = abort
524 > EOF
525
526 $ hg -R main push other -r e7ec4e813ba6
527 pushing to other
528 searching for changes
529 abort: Abandon ship!
530 (don't panic)
531 [255]
532
533 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
534 pushing to ssh://user@dummy/other
535 searching for changes
536 remote: Abandon ship!
537 remote: (don't panic)
538 abort: push failed on remote
539 [100]
540
541 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
542 pushing to http://localhost:$HGPORT2/
543 searching for changes
544 remote: Abandon ship!
545 remote: (don't panic)
546 abort: push failed on remote
547 [100]
548
549
550 Doing the actual push: unknown mandatory parts
551
552 $ cat << EOF >> $HGRCPATH
553 > [failpush]
554 > reason = unknown
555 > EOF
556
557 $ hg -R main push other -r e7ec4e813ba6
558 pushing to other
559 searching for changes
560 abort: missing support for test:unknown
561 [100]
562
563 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
564 pushing to ssh://user@dummy/other
565 searching for changes
566 abort: missing support for test:unknown
567 [100]
568
569 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
570 pushing to http://localhost:$HGPORT2/
571 searching for changes
572 abort: missing support for test:unknown
573 [100]
574
575 Doing the actual push: race
576
577 $ cat << EOF >> $HGRCPATH
578 > [failpush]
579 > reason = race
580 > EOF
581
582 $ hg -R main push other -r e7ec4e813ba6
583 pushing to other
584 searching for changes
585 abort: push failed:
586 'remote repository changed while pushing - please try again'
587 [255]
588
589 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
590 pushing to ssh://user@dummy/other
591 searching for changes
592 abort: push failed:
593 'remote repository changed while pushing - please try again'
594 [255]
595
596 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
597 pushing to http://localhost:$HGPORT2/
598 searching for changes
599 abort: push failed:
600 'remote repository changed while pushing - please try again'
601 [255]
602
603 Doing the actual push: hook abort
604
605 $ cat << EOF >> $HGRCPATH
606 > [failpush]
607 > reason =
608 > [hooks]
609 > pretxnclose.failpush = sh -c "echo 'You shall not pass!'; false"
610 > txnabort.failpush = sh -c "echo 'Cleaning up the mess...'"
611 > EOF
612
613 $ killdaemons.py
614 $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
615 $ cat other.pid >> $DAEMON_PIDS
616
617 $ hg -R main push other -r e7ec4e813ba6
618 pushing to other
619 searching for changes
620 remote: adding changesets
621 remote: adding manifests
622 remote: adding file changes
623 remote: pre-close-tip:e7ec4e813ba6 draft
624 remote: You shall not pass!
625 remote: transaction abort!
626 remote: Cleaning up the mess...
627 remote: rollback completed
628 abort: pretxnclose.failpush hook exited with status 1
629 [40]
630
631 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
632 pushing to ssh://user@dummy/other
633 searching for changes
634 remote: adding changesets
635 remote: adding manifests
636 remote: adding file changes
637 remote: pre-close-tip:e7ec4e813ba6 draft
638 remote: You shall not pass!
639 remote: transaction abort!
640 remote: Cleaning up the mess...
641 remote: rollback completed
642 remote: pretxnclose.failpush hook exited with status 1
643 abort: push failed on remote
644 [100]
645
646 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
647 pushing to http://localhost:$HGPORT2/
648 searching for changes
649 remote: adding changesets
650 remote: adding manifests
651 remote: adding file changes
652 remote: pre-close-tip:e7ec4e813ba6 draft
653 remote: You shall not pass!
654 remote: transaction abort!
655 remote: Cleaning up the mess...
656 remote: rollback completed
657 remote: pretxnclose.failpush hook exited with status 1
658 abort: push failed on remote
659 [100]
660
661 (check that no 'pending' files remain)
662
663 $ ls -1 other/.hg/bookmarks*
664 other/.hg/bookmarks
665 $ ls -1 other/.hg/store/phaseroots*
666 other/.hg/store/phaseroots
667 $ ls -1 other/.hg/store/00changelog.i*
668 other/.hg/store/00changelog.i
669
670 Check error from hook during the unbundling process itself
671
672 $ cat << EOF >> $HGRCPATH
673 > pretxnchangegroup = sh -c "echo 'Fail early!'; false"
674 > EOF
675 $ killdaemons.py # reload http config
676 $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
677 $ cat other.pid >> $DAEMON_PIDS
678
679 $ hg -R main push other -r e7ec4e813ba6
680 pushing to other
681 searching for changes
682 remote: adding changesets
683 remote: adding manifests
684 remote: adding file changes
685 remote: Fail early!
686 remote: transaction abort!
687 remote: Cleaning up the mess...
688 remote: rollback completed
689 abort: pretxnchangegroup hook exited with status 1
690 [40]
691 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
692 pushing to ssh://user@dummy/other
693 searching for changes
694 remote: adding changesets
695 remote: adding manifests
696 remote: adding file changes
697 remote: Fail early!
698 remote: transaction abort!
699 remote: Cleaning up the mess...
700 remote: rollback completed
701 remote: pretxnchangegroup hook exited with status 1
702 abort: push failed on remote
703 [100]
704 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
705 pushing to http://localhost:$HGPORT2/
706 searching for changes
707 remote: adding changesets
708 remote: adding manifests
709 remote: adding file changes
710 remote: Fail early!
711 remote: transaction abort!
712 remote: Cleaning up the mess...
713 remote: rollback completed
714 remote: pretxnchangegroup hook exited with status 1
715 abort: push failed on remote
716 [100]
717
718 Check output capture control.
719
720 (should be still forced for http, disabled for local and ssh)
721
722 $ cat >> $HGRCPATH << EOF
723 > [experimental]
724 > bundle2-output-capture=False
725 > EOF
726
727 $ hg -R main push other -r e7ec4e813ba6
728 pushing to other
729 searching for changes
730 adding changesets
731 adding manifests
732 adding file changes
733 Fail early!
734 transaction abort!
735 Cleaning up the mess...
736 rollback completed
737 abort: pretxnchangegroup hook exited with status 1
738 [40]
739 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
740 pushing to ssh://user@dummy/other
741 searching for changes
742 remote: adding changesets
743 remote: adding manifests
744 remote: adding file changes
745 remote: Fail early!
746 remote: transaction abort!
747 remote: Cleaning up the mess...
748 remote: rollback completed
749 remote: pretxnchangegroup hook exited with status 1
750 abort: push failed on remote
751 [100]
752 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
753 pushing to http://localhost:$HGPORT2/
754 searching for changes
755 remote: adding changesets
756 remote: adding manifests
757 remote: adding file changes
758 remote: Fail early!
759 remote: transaction abort!
760 remote: Cleaning up the mess...
761 remote: rollback completed
762 remote: pretxnchangegroup hook exited with status 1
763 abort: push failed on remote
764 [100]
765
766 Check abort from mandatory pushkey
767
768 $ cat > mandatorypart.py << EOF
769 > from mercurial import exchange
770 > from mercurial import pushkey
771 > from mercurial import node
772 > from mercurial import error
773 > @exchange.b2partsgenerator(b'failingpuskey')
774 > def addfailingpushey(pushop, bundler):
775 > enc = pushkey.encode
776 > part = bundler.newpart(b'pushkey')
777 > part.addparam(b'namespace', enc(b'phases'))
778 > part.addparam(b'key', enc(b'cd010b8cd998f3981a5a8115f94f8da4ab506089'))
779 > part.addparam(b'old', enc(b'0')) # successful update
780 > part.addparam(b'new', enc(b'0'))
781 > def fail(pushop, exc):
782 > raise error.Abort(b'Correct phase push failed (because hooks)')
783 > pushop.pkfailcb[part.id] = fail
784 > EOF
785 $ cat >> $HGRCPATH << EOF
786 > [hooks]
787 > pretxnchangegroup=
788 > pretxnclose.failpush=
789 > prepushkey.failpush = sh -c "echo 'do not push the key !'; false"
790 > [extensions]
791 > mandatorypart=$TESTTMP/mandatorypart.py
792 > EOF
793 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS # reload http config
794 $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
795 $ cat other.pid >> $DAEMON_PIDS
796
797 (Failure from a hook)
798
799 $ hg -R main push other -r e7ec4e813ba6
800 pushing to other
801 searching for changes
802 adding changesets
803 adding manifests
804 adding file changes
805 do not push the key !
806 pushkey-abort: prepushkey.failpush hook exited with status 1
807 transaction abort!
808 Cleaning up the mess...
809 rollback completed
810 abort: Correct phase push failed (because hooks)
811 [255]
812 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
813 pushing to ssh://user@dummy/other
814 searching for changes
815 remote: adding changesets
816 remote: adding manifests
817 remote: adding file changes
818 remote: do not push the key !
819 remote: pushkey-abort: prepushkey.failpush hook exited with status 1
820 remote: transaction abort!
821 remote: Cleaning up the mess...
822 remote: rollback completed
823 abort: Correct phase push failed (because hooks)
824 [255]
825 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
826 pushing to http://localhost:$HGPORT2/
827 searching for changes
828 remote: adding changesets
829 remote: adding manifests
830 remote: adding file changes
831 remote: do not push the key !
832 remote: pushkey-abort: prepushkey.failpush hook exited with status 1
833 remote: transaction abort!
834 remote: Cleaning up the mess...
835 remote: rollback completed
836 abort: Correct phase push failed (because hooks)
837 [255]
838
839 (Failure from a the pushkey)
840
841 $ cat > mandatorypart.py << EOF
842 > from mercurial import exchange
843 > from mercurial import pushkey
844 > from mercurial import node
845 > from mercurial import error
846 > @exchange.b2partsgenerator(b'failingpuskey')
847 > def addfailingpushey(pushop, bundler):
848 > enc = pushkey.encode
849 > part = bundler.newpart(b'pushkey')
850 > part.addparam(b'namespace', enc(b'phases'))
851 > part.addparam(b'key', enc(b'cd010b8cd998f3981a5a8115f94f8da4ab506089'))
852 > part.addparam(b'old', enc(b'4')) # will fail
853 > part.addparam(b'new', enc(b'3'))
854 > def fail(pushop, exc):
855 > raise error.Abort(b'Clown phase push failed')
856 > pushop.pkfailcb[part.id] = fail
857 > EOF
858 $ cat >> $HGRCPATH << EOF
859 > [hooks]
860 > prepushkey.failpush =
861 > EOF
862 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS # reload http config
863 $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
864 $ cat other.pid >> $DAEMON_PIDS
865
866 $ hg -R main push other -r e7ec4e813ba6
867 pushing to other
868 searching for changes
869 adding changesets
870 adding manifests
871 adding file changes
872 transaction abort!
873 Cleaning up the mess...
874 rollback completed
875 pushkey: lock state after "phases"
876 lock: free
877 wlock: free
878 abort: Clown phase push failed
879 [255]
880 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
881 pushing to ssh://user@dummy/other
882 searching for changes
883 remote: adding changesets
884 remote: adding manifests
885 remote: adding file changes
886 remote: transaction abort!
887 remote: Cleaning up the mess...
888 remote: rollback completed
889 remote: pushkey: lock state after "phases"
890 remote: lock: free
891 remote: wlock: free
892 abort: Clown phase push failed
893 [255]
894 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
895 pushing to http://localhost:$HGPORT2/
896 searching for changes
897 remote: adding changesets
898 remote: adding manifests
899 remote: adding file changes
900 remote: transaction abort!
901 remote: Cleaning up the mess...
902 remote: rollback completed
903 remote: pushkey: lock state after "phases"
904 remote: lock: free
905 remote: wlock: free
906 abort: Clown phase push failed
907 [255]
908
909 Test lazily acquiring the lock during unbundle
910 $ cp $TESTTMP/hgrc.orig $HGRCPATH
911
912 $ cat >> $TESTTMP/locktester.py <<EOF
913 > import os
914 > from mercurial import bundle2, error, extensions
915 > def checklock(orig, repo, *args, **kwargs):
916 > if repo.svfs.lexists(b"lock"):
917 > raise error.Abort(b"Lock should not be taken")
918 > return orig(repo, *args, **kwargs)
919 > def extsetup(ui):
920 > extensions.wrapfunction(bundle2, 'processbundle', checklock)
921 > EOF
922
923 $ hg init lazylock
924 $ cat >> lazylock/.hg/hgrc <<EOF
925 > [extensions]
926 > locktester=$TESTTMP/locktester.py
927 > EOF
928
929 $ hg clone -q ssh://user@dummy/lazylock lazylockclient
930 $ cd lazylockclient
931 $ touch a && hg ci -Aqm a
932 $ hg push
933 pushing to ssh://user@dummy/lazylock
934 searching for changes
935 remote: Lock should not be taken
936 abort: push failed on remote
937 [100]
938
939 $ cat >> ../lazylock/.hg/hgrc <<EOF
940 > [experimental]
941 > bundle2lazylocking=True
942 > EOF
943 $ hg push
944 pushing to ssh://user@dummy/lazylock
945 searching for changes
946 remote: adding changesets
947 remote: adding manifests
948 remote: adding file changes
949 remote: added 1 changesets with 1 changes to 1 files
950
951 $ cd ..
952
953 Servers can disable bundle1 for clone/pull operations
954
955 $ killdaemons.py
956 $ hg init bundle2onlyserver
957 $ cd bundle2onlyserver
958 $ cat > .hg/hgrc << EOF
959 > [server]
960 > bundle1.pull = false
961 > EOF
962
963 $ touch foo
964 $ hg -q commit -A -m initial
965
966 $ hg serve -p $HGPORT -d --pid-file=hg.pid
967 $ cat hg.pid >> $DAEMON_PIDS
968
969 $ hg --config devel.legacy.exchange=bundle1 clone http://localhost:$HGPORT/ not-bundle2
970 requesting all changes
971 abort: remote error:
972 incompatible Mercurial client; bundle2 required
973 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
974 [100]
975 $ killdaemons.py
976 $ cd ..
977
978 bundle1 can still pull non-generaldelta repos when generaldelta bundle1 disabled
979
980 $ hg --config format.usegeneraldelta=false init notgdserver
981 $ cd notgdserver
982 $ cat > .hg/hgrc << EOF
983 > [server]
984 > bundle1gd.pull = false
985 > EOF
986
987 $ touch foo
988 $ hg -q commit -A -m initial
989 $ hg serve -p $HGPORT -d --pid-file=hg.pid
990 $ cat hg.pid >> $DAEMON_PIDS
991
992 $ hg --config devel.legacy.exchange=bundle1 clone http://localhost:$HGPORT/ not-bundle2-1
993 requesting all changes
994 adding changesets
995 adding manifests
996 adding file changes
997 added 1 changesets with 1 changes to 1 files
998 new changesets 96ee1d7354c4
999 updating to branch default
1000 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1001
1002 $ killdaemons.py
1003 $ cd ../bundle2onlyserver
1004
1005 bundle1 pull can be disabled for generaldelta repos only
1006
1007 $ cat > .hg/hgrc << EOF
1008 > [server]
1009 > bundle1gd.pull = false
1010 > EOF
1011
1012 $ hg serve -p $HGPORT -d --pid-file=hg.pid
1013 $ cat hg.pid >> $DAEMON_PIDS
1014 $ hg --config devel.legacy.exchange=bundle1 clone http://localhost:$HGPORT/ not-bundle2
1015 requesting all changes
1016 abort: remote error:
1017 incompatible Mercurial client; bundle2 required
1018 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1019 [100]
1020
1021 $ killdaemons.py
1022
1023 Verify the global server.bundle1 option works
1024
1025 $ cd ..
1026 $ cat > bundle2onlyserver/.hg/hgrc << EOF
1027 > [server]
1028 > bundle1 = false
1029 > EOF
1030 $ hg serve -R bundle2onlyserver -p $HGPORT -d --pid-file=hg.pid
1031 $ cat hg.pid >> $DAEMON_PIDS
1032 $ hg --config devel.legacy.exchange=bundle1 clone http://localhost:$HGPORT not-bundle2
1033 requesting all changes
1034 abort: remote error:
1035 incompatible Mercurial client; bundle2 required
1036 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1037 [100]
1038 $ killdaemons.py
1039
1040 $ hg --config devel.legacy.exchange=bundle1 clone ssh://user@dummy/bundle2onlyserver not-bundle2-ssh
1041 requesting all changes
1042 adding changesets
1043 remote: abort: incompatible Mercurial client; bundle2 required
1044 remote: (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1045 transaction abort!
1046 rollback completed
1047 abort: stream ended unexpectedly (got 0 bytes, expected 4)
1048 [255]
1049
1050 $ cat > bundle2onlyserver/.hg/hgrc << EOF
1051 > [server]
1052 > bundle1gd = false
1053 > EOF
1054 $ hg serve -R bundle2onlyserver -p $HGPORT -d --pid-file=hg.pid
1055 $ cat hg.pid >> $DAEMON_PIDS
1056
1057 $ hg --config devel.legacy.exchange=bundle1 clone http://localhost:$HGPORT/ not-bundle2
1058 requesting all changes
1059 abort: remote error:
1060 incompatible Mercurial client; bundle2 required
1061 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1062 [100]
1063
1064 $ killdaemons.py
1065
1066 $ cd notgdserver
1067 $ cat > .hg/hgrc << EOF
1068 > [server]
1069 > bundle1gd = false
1070 > EOF
1071 $ hg serve -p $HGPORT -d --pid-file=hg.pid
1072 $ cat hg.pid >> $DAEMON_PIDS
1073
1074 $ hg --config devel.legacy.exchange=bundle1 clone http://localhost:$HGPORT/ not-bundle2-2
1075 requesting all changes
1076 adding changesets
1077 adding manifests
1078 adding file changes
1079 added 1 changesets with 1 changes to 1 files
1080 new changesets 96ee1d7354c4
1081 updating to branch default
1082 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1083
1084 $ killdaemons.py
1085 $ cd ../bundle2onlyserver
1086
1087 Verify bundle1 pushes can be disabled
1088
1089 $ cat > .hg/hgrc << EOF
1090 > [server]
1091 > bundle1.push = false
1092 > [web]
1093 > allow_push = *
1094 > push_ssl = false
1095 > EOF
1096
1097 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E error.log
1098 $ cat hg.pid >> $DAEMON_PIDS
1099 $ cd ..
1100
1101 $ hg clone http://localhost:$HGPORT bundle2-only
1102 requesting all changes
1103 adding changesets
1104 adding manifests
1105 adding file changes
1106 added 1 changesets with 1 changes to 1 files
1107 new changesets 96ee1d7354c4
1108 updating to branch default
1109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1110 $ cd bundle2-only
1111 $ echo commit > foo
1112 $ hg commit -m commit
1113 $ hg --config devel.legacy.exchange=bundle1 push
1114 pushing to http://localhost:$HGPORT/
1115 searching for changes
1116 abort: remote error:
1117 incompatible Mercurial client; bundle2 required
1118 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1119 [100]
1120
1121 (also check with ssh)
1122
1123 $ hg --config devel.legacy.exchange=bundle1 push ssh://user@dummy/bundle2onlyserver
1124 pushing to ssh://user@dummy/bundle2onlyserver
1125 searching for changes
1126 remote: abort: incompatible Mercurial client; bundle2 required
1127 remote: (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1128 [1]
1129
1130 $ hg push
1131 pushing to http://localhost:$HGPORT/
1132 searching for changes
1133 remote: adding changesets
1134 remote: adding manifests
1135 remote: adding file changes
1136 remote: added 1 changesets with 1 changes to 1 files