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