##// END OF EJS Templates
tests: test using both versions of SSH protocol...
Gregory Szorc -
r36235:1ee1a42b default
parent child Browse files
Show More
@@ -1,1148 +1,1158 b''
1 #testcases sshv1 sshv2
2
3 #if sshv2
4 $ cat >> $HGRCPATH << EOF
5 > [experimental]
6 > sshpeer.advertise-v2 = true
7 > sshserver.support-v2 = true
8 > EOF
9 #endif
10
1 11 Test exchange of common information using bundle2
2 12
3 13
4 14 $ getmainid() {
5 15 > hg -R main log --template '{node}\n' --rev "$1"
6 16 > }
7 17
8 18 enable obsolescence
9 19
10 20 $ cp $HGRCPATH $TESTTMP/hgrc.orig
11 21 $ cat > $TESTTMP/bundle2-pushkey-hook.sh << EOF
12 22 > echo pushkey: lock state after \"\$HG_NAMESPACE\"
13 23 > hg debuglock
14 24 > EOF
15 25
16 26 $ cat >> $HGRCPATH << EOF
17 27 > [experimental]
18 28 > evolution.createmarkers=True
19 29 > evolution.exchange=True
20 30 > bundle2-output-capture=True
21 31 > [ui]
22 32 > ssh="$PYTHON" "$TESTDIR/dummyssh"
23 33 > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
24 34 > [web]
25 35 > push_ssl = false
26 36 > allow_push = *
27 37 > [phases]
28 38 > publish=False
29 39 > [hooks]
30 40 > pretxnclose.tip = hg log -r tip -T "pre-close-tip:{node|short} {phase} {bookmarks}\n"
31 41 > txnclose.tip = hg log -r tip -T "postclose-tip:{node|short} {phase} {bookmarks}\n"
32 42 > txnclose.env = sh -c "HG_LOCAL= printenv.py txnclose"
33 43 > pushkey= sh "$TESTTMP/bundle2-pushkey-hook.sh"
34 44 > EOF
35 45
36 46 The extension requires a repo (currently unused)
37 47
38 48 $ hg init main
39 49 $ cd main
40 50 $ touch a
41 51 $ hg add a
42 52 $ hg commit -m 'a'
43 53 pre-close-tip:3903775176ed draft
44 54 postclose-tip:3903775176ed draft
45 55 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
46 56
47 57 $ hg unbundle $TESTDIR/bundles/rebase.hg
48 58 adding changesets
49 59 adding manifests
50 60 adding file changes
51 61 added 8 changesets with 7 changes to 7 files (+3 heads)
52 62 pre-close-tip:02de42196ebe draft
53 63 new changesets cd010b8cd998:02de42196ebe
54 64 postclose-tip:02de42196ebe draft
55 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
56 66 bundle:*/tests/bundles/rebase.hg HG_URL=bundle:*/tests/bundles/rebase.hg (glob)
57 67 (run 'hg heads' to see heads, 'hg merge' to merge)
58 68
59 69 $ cd ..
60 70
61 71 Real world exchange
62 72 =====================
63 73
64 74 Add more obsolescence information
65 75
66 76 $ hg -R main debugobsolete -d '0 0' 1111111111111111111111111111111111111111 `getmainid 9520eea781bc`
67 77 pre-close-tip:02de42196ebe draft
68 78 postclose-tip:02de42196ebe draft
69 79 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
70 80 $ hg -R main debugobsolete -d '0 0' 2222222222222222222222222222222222222222 `getmainid 24b6387c8c8c`
71 81 pre-close-tip:02de42196ebe draft
72 82 postclose-tip:02de42196ebe draft
73 83 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
74 84
75 85 clone --pull
76 86
77 87 $ hg -R main phase --public cd010b8cd998
78 88 pre-close-tip:02de42196ebe draft
79 89 postclose-tip:02de42196ebe draft
80 90 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=phase
81 91 $ hg clone main other --pull --rev 9520eea781bc
82 92 adding changesets
83 93 adding manifests
84 94 adding file changes
85 95 added 2 changesets with 2 changes to 2 files
86 96 1 new obsolescence markers
87 97 pre-close-tip:9520eea781bc draft
88 98 new changesets cd010b8cd998:9520eea781bc
89 99 postclose-tip:9520eea781bc draft
90 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
91 101 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
92 102 updating to branch default
93 103 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 104 $ hg -R other log -G
95 105 @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
96 106 |
97 107 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
98 108
99 109 $ hg -R other debugobsolete
100 110 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
101 111
102 112 pull
103 113
104 114 $ hg -R main phase --public 9520eea781bc
105 115 pre-close-tip:02de42196ebe draft
106 116 postclose-tip:02de42196ebe draft
107 117 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=phase
108 118 $ hg -R other pull -r 24b6387c8c8c
109 119 pulling from $TESTTMP/main
110 120 searching for changes
111 121 adding changesets
112 122 adding manifests
113 123 adding file changes
114 124 added 1 changesets with 1 changes to 1 files (+1 heads)
115 125 1 new obsolescence markers
116 126 pre-close-tip:24b6387c8c8c draft
117 127 new changesets 24b6387c8c8c
118 128 postclose-tip:24b6387c8c8c draft
119 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
120 130 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
121 131 (run 'hg heads' to see heads, 'hg merge' to merge)
122 132 $ hg -R other log -G
123 133 o 2:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F
124 134 |
125 135 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
126 136 |/
127 137 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
128 138
129 139 $ hg -R other debugobsolete
130 140 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
131 141 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
132 142
133 143 pull empty (with phase movement)
134 144
135 145 $ hg -R main phase --public 24b6387c8c8c
136 146 pre-close-tip:02de42196ebe draft
137 147 postclose-tip:02de42196ebe draft
138 148 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=phase
139 149 $ hg -R other pull -r 24b6387c8c8c
140 150 pulling from $TESTTMP/main
141 151 no changes found
142 152 pre-close-tip:24b6387c8c8c public
143 153 postclose-tip:24b6387c8c8c public
144 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
145 155 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
146 156 $ hg -R other log -G
147 157 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
148 158 |
149 159 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
150 160 |/
151 161 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
152 162
153 163 $ hg -R other debugobsolete
154 164 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
155 165 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
156 166
157 167 pull empty
158 168
159 169 $ hg -R other pull -r 24b6387c8c8c
160 170 pulling from $TESTTMP/main
161 171 no changes found
162 172 pre-close-tip:24b6387c8c8c public
163 173 postclose-tip:24b6387c8c8c public
164 174 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=0 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_TXNNAME=pull
165 175 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
166 176 $ hg -R other log -G
167 177 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
168 178 |
169 179 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
170 180 |/
171 181 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
172 182
173 183 $ hg -R other debugobsolete
174 184 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
175 185 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
176 186
177 187 add extra data to test their exchange during push
178 188
179 189 $ hg -R main bookmark --rev eea13746799a book_eea1
180 190 pre-close-tip:02de42196ebe draft
181 191 postclose-tip:02de42196ebe draft
182 192 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
183 193 $ hg -R main debugobsolete -d '0 0' 3333333333333333333333333333333333333333 `getmainid eea13746799a`
184 194 pre-close-tip:02de42196ebe draft
185 195 postclose-tip:02de42196ebe draft
186 196 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
187 197 $ hg -R main bookmark --rev 02de42196ebe book_02de
188 198 pre-close-tip:02de42196ebe draft book_02de
189 199 postclose-tip:02de42196ebe draft book_02de
190 200 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
191 201 $ hg -R main debugobsolete -d '0 0' 4444444444444444444444444444444444444444 `getmainid 02de42196ebe`
192 202 pre-close-tip:02de42196ebe draft book_02de
193 203 postclose-tip:02de42196ebe draft book_02de
194 204 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
195 205 $ hg -R main bookmark --rev 42ccdea3bb16 book_42cc
196 206 pre-close-tip:02de42196ebe draft book_02de
197 207 postclose-tip:02de42196ebe draft book_02de
198 208 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
199 209 $ hg -R main debugobsolete -d '0 0' 5555555555555555555555555555555555555555 `getmainid 42ccdea3bb16`
200 210 pre-close-tip:02de42196ebe draft book_02de
201 211 postclose-tip:02de42196ebe draft book_02de
202 212 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
203 213 $ hg -R main bookmark --rev 5fddd98957c8 book_5fdd
204 214 pre-close-tip:02de42196ebe draft book_02de
205 215 postclose-tip:02de42196ebe draft book_02de
206 216 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
207 217 $ hg -R main debugobsolete -d '0 0' 6666666666666666666666666666666666666666 `getmainid 5fddd98957c8`
208 218 pre-close-tip:02de42196ebe draft book_02de
209 219 postclose-tip:02de42196ebe draft book_02de
210 220 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
211 221 $ hg -R main bookmark --rev 32af7686d403 book_32af
212 222 pre-close-tip:02de42196ebe draft book_02de
213 223 postclose-tip:02de42196ebe draft book_02de
214 224 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
215 225 $ hg -R main debugobsolete -d '0 0' 7777777777777777777777777777777777777777 `getmainid 32af7686d403`
216 226 pre-close-tip:02de42196ebe draft book_02de
217 227 postclose-tip:02de42196ebe draft book_02de
218 228 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=debugobsolete
219 229
220 230 $ hg -R other bookmark --rev cd010b8cd998 book_eea1
221 231 pre-close-tip:24b6387c8c8c public
222 232 postclose-tip:24b6387c8c8c public
223 233 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
224 234 $ hg -R other bookmark --rev cd010b8cd998 book_02de
225 235 pre-close-tip:24b6387c8c8c public
226 236 postclose-tip:24b6387c8c8c public
227 237 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
228 238 $ hg -R other bookmark --rev cd010b8cd998 book_42cc
229 239 pre-close-tip:24b6387c8c8c public
230 240 postclose-tip:24b6387c8c8c public
231 241 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
232 242 $ hg -R other bookmark --rev cd010b8cd998 book_5fdd
233 243 pre-close-tip:24b6387c8c8c public
234 244 postclose-tip:24b6387c8c8c public
235 245 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
236 246 $ hg -R other bookmark --rev cd010b8cd998 book_32af
237 247 pre-close-tip:24b6387c8c8c public
238 248 postclose-tip:24b6387c8c8c public
239 249 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
240 250
241 251 $ hg -R main phase --public eea13746799a
242 252 pre-close-tip:02de42196ebe draft book_02de
243 253 postclose-tip:02de42196ebe draft book_02de
244 254 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=phase
245 255
246 256 push
247 257 $ hg -R main push other --rev eea13746799a --bookmark book_eea1
248 258 pushing to other
249 259 searching for changes
250 260 remote: adding changesets
251 261 remote: adding manifests
252 262 remote: adding file changes
253 263 remote: added 1 changesets with 0 changes to 0 files (-1 heads)
254 264 remote: 1 new obsolescence markers
255 265 remote: pre-close-tip:eea13746799a public book_eea1
256 266 remote: pushkey: lock state after "bookmarks"
257 267 remote: lock: free
258 268 remote: wlock: free
259 269 remote: postclose-tip:eea13746799a public book_eea1
260 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
261 271 updating bookmark book_eea1
262 272 pre-close-tip:02de42196ebe draft book_02de
263 273 postclose-tip:02de42196ebe draft book_02de
264 274 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_SOURCE=push-response HG_TXNID=TXN:$ID$ HG_TXNNAME=push-response
265 275 file:/*/$TESTTMP/other HG_URL=file:$TESTTMP/other (glob)
266 276 $ hg -R other log -G
267 277 o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
268 278 |\
269 279 | o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
270 280 | |
271 281 @ | 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
272 282 |/
273 283 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de book_32af book_42cc book_5fdd A
274 284
275 285 $ hg -R other debugobsolete
276 286 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
277 287 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
278 288 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
279 289
280 290 pull over ssh
281 291
282 292 $ hg -R other pull ssh://user@dummy/main -r 02de42196ebe --bookmark book_02de
283 293 pulling from ssh://user@dummy/main
284 294 searching for changes
285 295 adding changesets
286 296 adding manifests
287 297 adding file changes
288 298 added 1 changesets with 1 changes to 1 files (+1 heads)
289 299 1 new obsolescence markers
290 300 updating bookmark book_02de
291 301 pre-close-tip:02de42196ebe draft book_02de
292 302 new changesets 02de42196ebe
293 303 postclose-tip:02de42196ebe draft book_02de
294 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
295 305 ssh://user@dummy/main HG_URL=ssh://user@dummy/main
296 306 (run 'hg heads' to see heads, 'hg merge' to merge)
297 307 $ hg -R other debugobsolete
298 308 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
299 309 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
300 310 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
301 311 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
302 312
303 313 pull over http
304 314
305 315 $ hg serve -R main -p $HGPORT -d --pid-file=main.pid -E main-error.log
306 316 $ cat main.pid >> $DAEMON_PIDS
307 317
308 318 $ hg -R other pull http://localhost:$HGPORT/ -r 42ccdea3bb16 --bookmark book_42cc
309 319 pulling from http://localhost:$HGPORT/
310 320 searching for changes
311 321 adding changesets
312 322 adding manifests
313 323 adding file changes
314 324 added 1 changesets with 1 changes to 1 files (+1 heads)
315 325 1 new obsolescence markers
316 326 updating bookmark book_42cc
317 327 pre-close-tip:42ccdea3bb16 draft book_42cc
318 328 new changesets 42ccdea3bb16
319 329 postclose-tip:42ccdea3bb16 draft book_42cc
320 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
321 331 http://localhost:$HGPORT/ HG_URL=http://localhost:$HGPORT/
322 332 (run 'hg heads .' to see heads, 'hg merge' to merge)
323 333 $ cat main-error.log
324 334 $ hg -R other debugobsolete
325 335 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
326 336 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
327 337 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
328 338 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
329 339 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
330 340
331 341 push over ssh
332 342
333 343 $ hg -R main push ssh://user@dummy/other -r 5fddd98957c8 --bookmark book_5fdd
334 344 pushing to ssh://user@dummy/other
335 345 searching for changes
336 346 remote: adding changesets
337 347 remote: adding manifests
338 348 remote: adding file changes
339 349 remote: added 1 changesets with 1 changes to 1 files
340 350 remote: 1 new obsolescence markers
341 351 remote: pre-close-tip:5fddd98957c8 draft book_5fdd
342 352 remote: pushkey: lock state after "bookmarks"
343 353 remote: lock: free
344 354 remote: wlock: free
345 355 remote: postclose-tip:5fddd98957c8 draft book_5fdd
346 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
347 357 updating bookmark book_5fdd
348 358 pre-close-tip:02de42196ebe draft book_02de
349 359 postclose-tip:02de42196ebe draft book_02de
350 360 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_SOURCE=push-response HG_TXNID=TXN:$ID$ HG_TXNNAME=push-response
351 361 ssh://user@dummy/other HG_URL=ssh://user@dummy/other
352 362 $ hg -R other log -G
353 363 o 6:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C
354 364 |
355 365 o 5:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B
356 366 |
357 367 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H
358 368 | |
359 369 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
360 370 | |/|
361 371 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
362 372 |/ /
363 373 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
364 374 |/
365 375 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af A
366 376
367 377 $ hg -R other debugobsolete
368 378 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
369 379 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
370 380 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
371 381 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
372 382 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
373 383 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
374 384
375 385 push over http
376 386
377 387 $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
378 388 $ cat other.pid >> $DAEMON_PIDS
379 389
380 390 $ hg -R main phase --public 32af7686d403
381 391 pre-close-tip:02de42196ebe draft book_02de
382 392 postclose-tip:02de42196ebe draft book_02de
383 393 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=phase
384 394 $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403 --bookmark book_32af
385 395 pushing to http://localhost:$HGPORT2/
386 396 searching for changes
387 397 remote: adding changesets
388 398 remote: adding manifests
389 399 remote: adding file changes
390 400 remote: added 1 changesets with 1 changes to 1 files
391 401 remote: 1 new obsolescence markers
392 402 remote: pre-close-tip:32af7686d403 public book_32af
393 403 remote: pushkey: lock state after "bookmarks"
394 404 remote: lock: free
395 405 remote: wlock: free
396 406 remote: postclose-tip:32af7686d403 public book_32af
397 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)
398 408 updating bookmark book_32af
399 409 pre-close-tip:02de42196ebe draft book_02de
400 410 postclose-tip:02de42196ebe draft book_02de
401 411 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_SOURCE=push-response HG_TXNID=TXN:$ID$ HG_TXNNAME=push-response
402 412 http://localhost:$HGPORT2/ HG_URL=http://localhost:$HGPORT2/
403 413 $ cat other-error.log
404 414
405 415 Check final content.
406 416
407 417 $ hg -R other log -G
408 418 o 7:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af D
409 419 |
410 420 o 6:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C
411 421 |
412 422 o 5:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B
413 423 |
414 424 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H
415 425 | |
416 426 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
417 427 | |/|
418 428 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
419 429 |/ /
420 430 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
421 431 |/
422 432 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
423 433
424 434 $ hg -R other debugobsolete
425 435 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
426 436 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
427 437 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
428 438 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
429 439 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
430 440 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
431 441 7777777777777777777777777777777777777777 32af7686d403cf45b5d95f2d70cebea587ac806a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
432 442
433 443 (check that no 'pending' files remain)
434 444
435 445 $ ls -1 other/.hg/bookmarks*
436 446 other/.hg/bookmarks
437 447 $ ls -1 other/.hg/store/phaseroots*
438 448 other/.hg/store/phaseroots
439 449 $ ls -1 other/.hg/store/00changelog.i*
440 450 other/.hg/store/00changelog.i
441 451
442 452 Error Handling
443 453 ==============
444 454
445 455 Check that errors are properly returned to the client during push.
446 456
447 457 Setting up
448 458
449 459 $ cat > failpush.py << EOF
450 460 > """A small extension that makes push fails when using bundle2
451 461 >
452 462 > used to test error handling in bundle2
453 463 > """
454 464 >
455 465 > from mercurial import error
456 466 > from mercurial import bundle2
457 467 > from mercurial import exchange
458 468 > from mercurial import extensions
459 469 > from mercurial import registrar
460 470 > cmdtable = {}
461 471 > command = registrar.command(cmdtable)
462 472 >
463 473 > configtable = {}
464 474 > configitem = registrar.configitem(configtable)
465 475 > configitem('failpush', 'reason',
466 476 > default=None,
467 477 > )
468 478 >
469 479 > def _pushbundle2failpart(pushop, bundler):
470 480 > reason = pushop.ui.config('failpush', 'reason')
471 481 > part = None
472 482 > if reason == 'abort':
473 483 > bundler.newpart('test:abort')
474 484 > if reason == 'unknown':
475 485 > bundler.newpart('test:unknown')
476 486 > if reason == 'race':
477 487 > # 20 Bytes of crap
478 488 > bundler.newpart('check:heads', data='01234567890123456789')
479 489 >
480 490 > @bundle2.parthandler("test:abort")
481 491 > def handleabort(op, part):
482 492 > raise error.Abort('Abandon ship!', hint="don't panic")
483 493 >
484 494 > def uisetup(ui):
485 495 > exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart
486 496 > exchange.b2partsgenorder.insert(0, 'failpart')
487 497 >
488 498 > EOF
489 499
490 500 $ cd main
491 501 $ hg up tip
492 502 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
493 503 $ echo 'I' > I
494 504 $ hg add I
495 505 $ hg ci -m 'I'
496 506 pre-close-tip:e7ec4e813ba6 draft
497 507 postclose-tip:e7ec4e813ba6 draft
498 508 txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
499 509 $ hg id
500 510 e7ec4e813ba6 tip
501 511 $ cd ..
502 512
503 513 $ cat << EOF >> $HGRCPATH
504 514 > [extensions]
505 515 > failpush=$TESTTMP/failpush.py
506 516 > EOF
507 517
508 518 $ killdaemons.py
509 519 $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
510 520 $ cat other.pid >> $DAEMON_PIDS
511 521
512 522 Doing the actual push: Abort error
513 523
514 524 $ cat << EOF >> $HGRCPATH
515 525 > [failpush]
516 526 > reason = abort
517 527 > EOF
518 528
519 529 $ hg -R main push other -r e7ec4e813ba6
520 530 pushing to other
521 531 searching for changes
522 532 abort: Abandon ship!
523 533 (don't panic)
524 534 [255]
525 535
526 536 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
527 537 pushing to ssh://user@dummy/other
528 538 searching for changes
529 539 remote: Abandon ship!
530 540 remote: (don't panic)
531 541 abort: push failed on remote
532 542 [255]
533 543
534 544 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
535 545 pushing to http://localhost:$HGPORT2/
536 546 searching for changes
537 547 remote: Abandon ship!
538 548 remote: (don't panic)
539 549 abort: push failed on remote
540 550 [255]
541 551
542 552
543 553 Doing the actual push: unknown mandatory parts
544 554
545 555 $ cat << EOF >> $HGRCPATH
546 556 > [failpush]
547 557 > reason = unknown
548 558 > EOF
549 559
550 560 $ hg -R main push other -r e7ec4e813ba6
551 561 pushing to other
552 562 searching for changes
553 563 abort: missing support for test:unknown
554 564 [255]
555 565
556 566 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
557 567 pushing to ssh://user@dummy/other
558 568 searching for changes
559 569 abort: missing support for test:unknown
560 570 [255]
561 571
562 572 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
563 573 pushing to http://localhost:$HGPORT2/
564 574 searching for changes
565 575 abort: missing support for test:unknown
566 576 [255]
567 577
568 578 Doing the actual push: race
569 579
570 580 $ cat << EOF >> $HGRCPATH
571 581 > [failpush]
572 582 > reason = race
573 583 > EOF
574 584
575 585 $ hg -R main push other -r e7ec4e813ba6
576 586 pushing to other
577 587 searching for changes
578 588 abort: push failed:
579 589 'repository changed while pushing - please try again'
580 590 [255]
581 591
582 592 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
583 593 pushing to ssh://user@dummy/other
584 594 searching for changes
585 595 abort: push failed:
586 596 'repository changed while pushing - please try again'
587 597 [255]
588 598
589 599 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
590 600 pushing to http://localhost:$HGPORT2/
591 601 searching for changes
592 602 abort: push failed:
593 603 'repository changed while pushing - please try again'
594 604 [255]
595 605
596 606 Doing the actual push: hook abort
597 607
598 608 $ cat << EOF >> $HGRCPATH
599 609 > [failpush]
600 610 > reason =
601 611 > [hooks]
602 612 > pretxnclose.failpush = sh -c "echo 'You shall not pass!'; false"
603 613 > txnabort.failpush = sh -c "echo 'Cleaning up the mess...'"
604 614 > EOF
605 615
606 616 $ killdaemons.py
607 617 $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
608 618 $ cat other.pid >> $DAEMON_PIDS
609 619
610 620 $ hg -R main push other -r e7ec4e813ba6
611 621 pushing to other
612 622 searching for changes
613 623 remote: adding changesets
614 624 remote: adding manifests
615 625 remote: adding file changes
616 626 remote: added 1 changesets with 1 changes to 1 files
617 627 remote: pre-close-tip:e7ec4e813ba6 draft
618 628 remote: You shall not pass!
619 629 remote: transaction abort!
620 630 remote: Cleaning up the mess...
621 631 remote: rollback completed
622 632 abort: pretxnclose.failpush hook exited with status 1
623 633 [255]
624 634
625 635 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
626 636 pushing to ssh://user@dummy/other
627 637 searching for changes
628 638 remote: adding changesets
629 639 remote: adding manifests
630 640 remote: adding file changes
631 641 remote: added 1 changesets with 1 changes to 1 files
632 642 remote: pre-close-tip:e7ec4e813ba6 draft
633 643 remote: You shall not pass!
634 644 remote: transaction abort!
635 645 remote: Cleaning up the mess...
636 646 remote: rollback completed
637 647 remote: pretxnclose.failpush hook exited with status 1
638 648 abort: push failed on remote
639 649 [255]
640 650
641 651 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
642 652 pushing to http://localhost:$HGPORT2/
643 653 searching for changes
644 654 remote: adding changesets
645 655 remote: adding manifests
646 656 remote: adding file changes
647 657 remote: added 1 changesets with 1 changes to 1 files
648 658 remote: pre-close-tip:e7ec4e813ba6 draft
649 659 remote: You shall not pass!
650 660 remote: transaction abort!
651 661 remote: Cleaning up the mess...
652 662 remote: rollback completed
653 663 remote: pretxnclose.failpush hook exited with status 1
654 664 abort: push failed on remote
655 665 [255]
656 666
657 667 (check that no 'pending' files remain)
658 668
659 669 $ ls -1 other/.hg/bookmarks*
660 670 other/.hg/bookmarks
661 671 $ ls -1 other/.hg/store/phaseroots*
662 672 other/.hg/store/phaseroots
663 673 $ ls -1 other/.hg/store/00changelog.i*
664 674 other/.hg/store/00changelog.i
665 675
666 676 Check error from hook during the unbundling process itself
667 677
668 678 $ cat << EOF >> $HGRCPATH
669 679 > pretxnchangegroup = sh -c "echo 'Fail early!'; false"
670 680 > EOF
671 681 $ killdaemons.py # reload http config
672 682 $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
673 683 $ cat other.pid >> $DAEMON_PIDS
674 684
675 685 $ hg -R main push other -r e7ec4e813ba6
676 686 pushing to other
677 687 searching for changes
678 688 remote: adding changesets
679 689 remote: adding manifests
680 690 remote: adding file changes
681 691 remote: added 1 changesets with 1 changes to 1 files
682 692 remote: Fail early!
683 693 remote: transaction abort!
684 694 remote: Cleaning up the mess...
685 695 remote: rollback completed
686 696 abort: pretxnchangegroup hook exited with status 1
687 697 [255]
688 698 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
689 699 pushing to ssh://user@dummy/other
690 700 searching for changes
691 701 remote: adding changesets
692 702 remote: adding manifests
693 703 remote: adding file changes
694 704 remote: added 1 changesets with 1 changes to 1 files
695 705 remote: Fail early!
696 706 remote: transaction abort!
697 707 remote: Cleaning up the mess...
698 708 remote: rollback completed
699 709 remote: pretxnchangegroup hook exited with status 1
700 710 abort: push failed on remote
701 711 [255]
702 712 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
703 713 pushing to http://localhost:$HGPORT2/
704 714 searching for changes
705 715 remote: adding changesets
706 716 remote: adding manifests
707 717 remote: adding file changes
708 718 remote: added 1 changesets with 1 changes to 1 files
709 719 remote: Fail early!
710 720 remote: transaction abort!
711 721 remote: Cleaning up the mess...
712 722 remote: rollback completed
713 723 remote: pretxnchangegroup hook exited with status 1
714 724 abort: push failed on remote
715 725 [255]
716 726
717 727 Check output capture control.
718 728
719 729 (should be still forced for http, disabled for local and ssh)
720 730
721 731 $ cat >> $HGRCPATH << EOF
722 732 > [experimental]
723 733 > bundle2-output-capture=False
724 734 > EOF
725 735
726 736 $ hg -R main push other -r e7ec4e813ba6
727 737 pushing to other
728 738 searching for changes
729 739 adding changesets
730 740 adding manifests
731 741 adding file changes
732 742 added 1 changesets with 1 changes to 1 files
733 743 Fail early!
734 744 transaction abort!
735 745 Cleaning up the mess...
736 746 rollback completed
737 747 abort: pretxnchangegroup hook exited with status 1
738 748 [255]
739 749 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
740 750 pushing to ssh://user@dummy/other
741 751 searching for changes
742 752 remote: adding changesets
743 753 remote: adding manifests
744 754 remote: adding file changes
745 755 remote: added 1 changesets with 1 changes to 1 files
746 756 remote: Fail early!
747 757 remote: transaction abort!
748 758 remote: Cleaning up the mess...
749 759 remote: rollback completed
750 760 remote: pretxnchangegroup hook exited with status 1
751 761 abort: push failed on remote
752 762 [255]
753 763 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
754 764 pushing to http://localhost:$HGPORT2/
755 765 searching for changes
756 766 remote: adding changesets
757 767 remote: adding manifests
758 768 remote: adding file changes
759 769 remote: added 1 changesets with 1 changes to 1 files
760 770 remote: Fail early!
761 771 remote: transaction abort!
762 772 remote: Cleaning up the mess...
763 773 remote: rollback completed
764 774 remote: pretxnchangegroup hook exited with status 1
765 775 abort: push failed on remote
766 776 [255]
767 777
768 778 Check abort from mandatory pushkey
769 779
770 780 $ cat > mandatorypart.py << EOF
771 781 > from mercurial import exchange
772 782 > from mercurial import pushkey
773 783 > from mercurial import node
774 784 > from mercurial import error
775 785 > @exchange.b2partsgenerator('failingpuskey')
776 786 > def addfailingpushey(pushop, bundler):
777 787 > enc = pushkey.encode
778 788 > part = bundler.newpart('pushkey')
779 789 > part.addparam('namespace', enc('phases'))
780 790 > part.addparam('key', enc(pushop.repo['cd010b8cd998'].hex()))
781 791 > part.addparam('old', enc(str(0))) # successful update
782 792 > part.addparam('new', enc(str(0)))
783 793 > def fail(pushop, exc):
784 794 > raise error.Abort('Correct phase push failed (because hooks)')
785 795 > pushop.pkfailcb[part.id] = fail
786 796 > EOF
787 797 $ cat >> $HGRCPATH << EOF
788 798 > [hooks]
789 799 > pretxnchangegroup=
790 800 > pretxnclose.failpush=
791 801 > prepushkey.failpush = sh -c "echo 'do not push the key !'; false"
792 802 > [extensions]
793 803 > mandatorypart=$TESTTMP/mandatorypart.py
794 804 > EOF
795 805 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS # reload http config
796 806 $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
797 807 $ cat other.pid >> $DAEMON_PIDS
798 808
799 809 (Failure from a hook)
800 810
801 811 $ hg -R main push other -r e7ec4e813ba6
802 812 pushing to other
803 813 searching for changes
804 814 adding changesets
805 815 adding manifests
806 816 adding file changes
807 817 added 1 changesets with 1 changes to 1 files
808 818 do not push the key !
809 819 pushkey-abort: prepushkey.failpush hook exited with status 1
810 820 transaction abort!
811 821 Cleaning up the mess...
812 822 rollback completed
813 823 abort: Correct phase push failed (because hooks)
814 824 [255]
815 825 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
816 826 pushing to ssh://user@dummy/other
817 827 searching for changes
818 828 remote: adding changesets
819 829 remote: adding manifests
820 830 remote: adding file changes
821 831 remote: added 1 changesets with 1 changes to 1 files
822 832 remote: do not push the key !
823 833 remote: pushkey-abort: prepushkey.failpush hook exited with status 1
824 834 remote: transaction abort!
825 835 remote: Cleaning up the mess...
826 836 remote: rollback completed
827 837 abort: Correct phase push failed (because hooks)
828 838 [255]
829 839 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
830 840 pushing to http://localhost:$HGPORT2/
831 841 searching for changes
832 842 remote: adding changesets
833 843 remote: adding manifests
834 844 remote: adding file changes
835 845 remote: added 1 changesets with 1 changes to 1 files
836 846 remote: do not push the key !
837 847 remote: pushkey-abort: prepushkey.failpush hook exited with status 1
838 848 remote: transaction abort!
839 849 remote: Cleaning up the mess...
840 850 remote: rollback completed
841 851 abort: Correct phase push failed (because hooks)
842 852 [255]
843 853
844 854 (Failure from a the pushkey)
845 855
846 856 $ cat > mandatorypart.py << EOF
847 857 > from mercurial import exchange
848 858 > from mercurial import pushkey
849 859 > from mercurial import node
850 860 > from mercurial import error
851 861 > @exchange.b2partsgenerator('failingpuskey')
852 862 > def addfailingpushey(pushop, bundler):
853 863 > enc = pushkey.encode
854 864 > part = bundler.newpart('pushkey')
855 865 > part.addparam('namespace', enc('phases'))
856 866 > part.addparam('key', enc(pushop.repo['cd010b8cd998'].hex()))
857 867 > part.addparam('old', enc(str(4))) # will fail
858 868 > part.addparam('new', enc(str(3)))
859 869 > def fail(pushop, exc):
860 870 > raise error.Abort('Clown phase push failed')
861 871 > pushop.pkfailcb[part.id] = fail
862 872 > EOF
863 873 $ cat >> $HGRCPATH << EOF
864 874 > [hooks]
865 875 > prepushkey.failpush =
866 876 > EOF
867 877 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS # reload http config
868 878 $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
869 879 $ cat other.pid >> $DAEMON_PIDS
870 880
871 881 $ hg -R main push other -r e7ec4e813ba6
872 882 pushing to other
873 883 searching for changes
874 884 adding changesets
875 885 adding manifests
876 886 adding file changes
877 887 added 1 changesets with 1 changes to 1 files
878 888 transaction abort!
879 889 Cleaning up the mess...
880 890 rollback completed
881 891 pushkey: lock state after "phases"
882 892 lock: free
883 893 wlock: free
884 894 abort: Clown phase push failed
885 895 [255]
886 896 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
887 897 pushing to ssh://user@dummy/other
888 898 searching for changes
889 899 remote: adding changesets
890 900 remote: adding manifests
891 901 remote: adding file changes
892 902 remote: added 1 changesets with 1 changes to 1 files
893 903 remote: transaction abort!
894 904 remote: Cleaning up the mess...
895 905 remote: rollback completed
896 906 remote: pushkey: lock state after "phases"
897 907 remote: lock: free
898 908 remote: wlock: free
899 909 abort: Clown phase push failed
900 910 [255]
901 911 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
902 912 pushing to http://localhost:$HGPORT2/
903 913 searching for changes
904 914 remote: adding changesets
905 915 remote: adding manifests
906 916 remote: adding file changes
907 917 remote: added 1 changesets with 1 changes to 1 files
908 918 remote: transaction abort!
909 919 remote: Cleaning up the mess...
910 920 remote: rollback completed
911 921 remote: pushkey: lock state after "phases"
912 922 remote: lock: free
913 923 remote: wlock: free
914 924 abort: Clown phase push failed
915 925 [255]
916 926
917 927 Test lazily acquiring the lock during unbundle
918 928 $ cp $TESTTMP/hgrc.orig $HGRCPATH
919 929 $ cat >> $HGRCPATH <<EOF
920 930 > [ui]
921 931 > ssh="$PYTHON" "$TESTDIR/dummyssh"
922 932 > EOF
923 933
924 934 $ cat >> $TESTTMP/locktester.py <<EOF
925 935 > import os
926 936 > from mercurial import extensions, bundle2, util
927 937 > def checklock(orig, repo, *args, **kwargs):
928 938 > if repo.svfs.lexists("lock"):
929 939 > raise util.Abort("Lock should not be taken")
930 940 > return orig(repo, *args, **kwargs)
931 941 > def extsetup(ui):
932 942 > extensions.wrapfunction(bundle2, 'processbundle', checklock)
933 943 > EOF
934 944
935 945 $ hg init lazylock
936 946 $ cat >> lazylock/.hg/hgrc <<EOF
937 947 > [extensions]
938 948 > locktester=$TESTTMP/locktester.py
939 949 > EOF
940 950
941 951 $ hg clone -q ssh://user@dummy/lazylock lazylockclient
942 952 $ cd lazylockclient
943 953 $ touch a && hg ci -Aqm a
944 954 $ hg push
945 955 pushing to ssh://user@dummy/lazylock
946 956 searching for changes
947 957 remote: Lock should not be taken
948 958 abort: push failed on remote
949 959 [255]
950 960
951 961 $ cat >> ../lazylock/.hg/hgrc <<EOF
952 962 > [experimental]
953 963 > bundle2lazylocking=True
954 964 > EOF
955 965 $ hg push
956 966 pushing to ssh://user@dummy/lazylock
957 967 searching for changes
958 968 remote: adding changesets
959 969 remote: adding manifests
960 970 remote: adding file changes
961 971 remote: added 1 changesets with 1 changes to 1 files
962 972
963 973 $ cd ..
964 974
965 975 Servers can disable bundle1 for clone/pull operations
966 976
967 977 $ killdaemons.py
968 978 $ hg init bundle2onlyserver
969 979 $ cd bundle2onlyserver
970 980 $ cat > .hg/hgrc << EOF
971 981 > [server]
972 982 > bundle1.pull = false
973 983 > EOF
974 984
975 985 $ touch foo
976 986 $ hg -q commit -A -m initial
977 987
978 988 $ hg serve -p $HGPORT -d --pid-file=hg.pid
979 989 $ cat hg.pid >> $DAEMON_PIDS
980 990
981 991 $ hg --config devel.legacy.exchange=bundle1 clone http://localhost:$HGPORT/ not-bundle2
982 992 requesting all changes
983 993 abort: remote error:
984 994 incompatible Mercurial client; bundle2 required
985 995 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
986 996 [255]
987 997 $ killdaemons.py
988 998 $ cd ..
989 999
990 1000 bundle1 can still pull non-generaldelta repos when generaldelta bundle1 disabled
991 1001
992 1002 $ hg --config format.usegeneraldelta=false init notgdserver
993 1003 $ cd notgdserver
994 1004 $ cat > .hg/hgrc << EOF
995 1005 > [server]
996 1006 > bundle1gd.pull = false
997 1007 > EOF
998 1008
999 1009 $ touch foo
1000 1010 $ hg -q commit -A -m initial
1001 1011 $ hg serve -p $HGPORT -d --pid-file=hg.pid
1002 1012 $ cat hg.pid >> $DAEMON_PIDS
1003 1013
1004 1014 $ hg --config devel.legacy.exchange=bundle1 clone http://localhost:$HGPORT/ not-bundle2-1
1005 1015 requesting all changes
1006 1016 adding changesets
1007 1017 adding manifests
1008 1018 adding file changes
1009 1019 added 1 changesets with 1 changes to 1 files
1010 1020 new changesets 96ee1d7354c4
1011 1021 updating to branch default
1012 1022 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1013 1023
1014 1024 $ killdaemons.py
1015 1025 $ cd ../bundle2onlyserver
1016 1026
1017 1027 bundle1 pull can be disabled for generaldelta repos only
1018 1028
1019 1029 $ cat > .hg/hgrc << EOF
1020 1030 > [server]
1021 1031 > bundle1gd.pull = false
1022 1032 > EOF
1023 1033
1024 1034 $ hg serve -p $HGPORT -d --pid-file=hg.pid
1025 1035 $ cat hg.pid >> $DAEMON_PIDS
1026 1036 $ hg --config devel.legacy.exchange=bundle1 clone http://localhost:$HGPORT/ not-bundle2
1027 1037 requesting all changes
1028 1038 abort: remote error:
1029 1039 incompatible Mercurial client; bundle2 required
1030 1040 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1031 1041 [255]
1032 1042
1033 1043 $ killdaemons.py
1034 1044
1035 1045 Verify the global server.bundle1 option works
1036 1046
1037 1047 $ cd ..
1038 1048 $ cat > bundle2onlyserver/.hg/hgrc << EOF
1039 1049 > [server]
1040 1050 > bundle1 = false
1041 1051 > EOF
1042 1052 $ hg serve -R bundle2onlyserver -p $HGPORT -d --pid-file=hg.pid
1043 1053 $ cat hg.pid >> $DAEMON_PIDS
1044 1054 $ hg --config devel.legacy.exchange=bundle1 clone http://localhost:$HGPORT not-bundle2
1045 1055 requesting all changes
1046 1056 abort: remote error:
1047 1057 incompatible Mercurial client; bundle2 required
1048 1058 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1049 1059 [255]
1050 1060 $ killdaemons.py
1051 1061
1052 1062 $ hg --config devel.legacy.exchange=bundle1 clone ssh://user@dummy/bundle2onlyserver not-bundle2-ssh
1053 1063 requesting all changes
1054 1064 adding changesets
1055 1065 remote: abort: incompatible Mercurial client; bundle2 required
1056 1066 remote: (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1057 1067 transaction abort!
1058 1068 rollback completed
1059 1069 abort: stream ended unexpectedly (got 0 bytes, expected 4)
1060 1070 [255]
1061 1071
1062 1072 $ cat > bundle2onlyserver/.hg/hgrc << EOF
1063 1073 > [server]
1064 1074 > bundle1gd = false
1065 1075 > EOF
1066 1076 $ hg serve -R bundle2onlyserver -p $HGPORT -d --pid-file=hg.pid
1067 1077 $ cat hg.pid >> $DAEMON_PIDS
1068 1078
1069 1079 $ hg --config devel.legacy.exchange=bundle1 clone http://localhost:$HGPORT/ not-bundle2
1070 1080 requesting all changes
1071 1081 abort: remote error:
1072 1082 incompatible Mercurial client; bundle2 required
1073 1083 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1074 1084 [255]
1075 1085
1076 1086 $ killdaemons.py
1077 1087
1078 1088 $ cd notgdserver
1079 1089 $ cat > .hg/hgrc << EOF
1080 1090 > [server]
1081 1091 > bundle1gd = false
1082 1092 > EOF
1083 1093 $ hg serve -p $HGPORT -d --pid-file=hg.pid
1084 1094 $ cat hg.pid >> $DAEMON_PIDS
1085 1095
1086 1096 $ hg --config devel.legacy.exchange=bundle1 clone http://localhost:$HGPORT/ not-bundle2-2
1087 1097 requesting all changes
1088 1098 adding changesets
1089 1099 adding manifests
1090 1100 adding file changes
1091 1101 added 1 changesets with 1 changes to 1 files
1092 1102 new changesets 96ee1d7354c4
1093 1103 updating to branch default
1094 1104 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1095 1105
1096 1106 $ killdaemons.py
1097 1107 $ cd ../bundle2onlyserver
1098 1108
1099 1109 Verify bundle1 pushes can be disabled
1100 1110
1101 1111 $ cat > .hg/hgrc << EOF
1102 1112 > [server]
1103 1113 > bundle1.push = false
1104 1114 > [web]
1105 1115 > allow_push = *
1106 1116 > push_ssl = false
1107 1117 > EOF
1108 1118
1109 1119 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E error.log
1110 1120 $ cat hg.pid >> $DAEMON_PIDS
1111 1121 $ cd ..
1112 1122
1113 1123 $ hg clone http://localhost:$HGPORT bundle2-only
1114 1124 requesting all changes
1115 1125 adding changesets
1116 1126 adding manifests
1117 1127 adding file changes
1118 1128 added 1 changesets with 1 changes to 1 files
1119 1129 new changesets 96ee1d7354c4
1120 1130 updating to branch default
1121 1131 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1122 1132 $ cd bundle2-only
1123 1133 $ echo commit > foo
1124 1134 $ hg commit -m commit
1125 1135 $ hg --config devel.legacy.exchange=bundle1 push
1126 1136 pushing to http://localhost:$HGPORT/
1127 1137 searching for changes
1128 1138 abort: remote error:
1129 1139 incompatible Mercurial client; bundle2 required
1130 1140 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1131 1141 [255]
1132 1142
1133 1143 (also check with ssh)
1134 1144
1135 1145 $ hg --config devel.legacy.exchange=bundle1 push ssh://user@dummy/bundle2onlyserver
1136 1146 pushing to ssh://user@dummy/bundle2onlyserver
1137 1147 searching for changes
1138 1148 remote: abort: incompatible Mercurial client; bundle2 required
1139 1149 remote: (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1140 1150 [1]
1141 1151
1142 1152 $ hg push
1143 1153 pushing to http://localhost:$HGPORT/
1144 1154 searching for changes
1145 1155 remote: adding changesets
1146 1156 remote: adding manifests
1147 1157 remote: adding file changes
1148 1158 remote: added 1 changesets with 1 changes to 1 files
@@ -1,110 +1,120 b''
1 #testcases sshv1 sshv2
2
3 #if sshv2
4 $ cat >> $HGRCPATH << EOF
5 > [experimental]
6 > sshpeer.advertise-v2 = true
7 > sshserver.support-v2 = true
8 > EOF
9 #endif
10
1 11 $ cat > bundle2.py << EOF
2 12 > """A small extension to test bundle2 pushback parts.
3 13 > Current bundle2 implementation doesn't provide a way to generate those
4 14 > parts, so they must be created by extensions.
5 15 > """
6 16 > from __future__ import absolute_import
7 17 > from mercurial import bundle2, exchange, pushkey, util
8 18 > def _newhandlechangegroup(op, inpart):
9 19 > """This function wraps the changegroup part handler for getbundle.
10 20 > It issues an additional pushkey part to send a new
11 21 > bookmark back to the client"""
12 22 > result = bundle2.handlechangegroup(op, inpart)
13 23 > if 'pushback' in op.reply.capabilities:
14 24 > params = {'namespace': 'bookmarks',
15 25 > 'key': 'new-server-mark',
16 26 > 'old': '',
17 27 > 'new': 'tip'}
18 28 > encodedparams = [(k, pushkey.encode(v)) for (k,v) in params.items()]
19 29 > op.reply.newpart('pushkey', mandatoryparams=encodedparams)
20 30 > else:
21 31 > op.reply.newpart('output', data='pushback not enabled')
22 32 > return result
23 33 > _newhandlechangegroup.params = bundle2.handlechangegroup.params
24 34 > bundle2.parthandlermapping['changegroup'] = _newhandlechangegroup
25 35 > EOF
26 36
27 37 $ cat >> $HGRCPATH <<EOF
28 38 > [ui]
29 39 > ssh = $PYTHON "$TESTDIR/dummyssh"
30 40 > username = nobody <no.reply@example.com>
31 41 >
32 42 > [alias]
33 43 > tglog = log -G -T "{desc} [{phase}:{node|short}]"
34 44 > EOF
35 45
36 46 Set up server repository
37 47
38 48 $ hg init server
39 49 $ cd server
40 50 $ echo c0 > f0
41 51 $ hg commit -Am 0
42 52 adding f0
43 53
44 54 Set up client repository
45 55
46 56 $ cd ..
47 57 $ hg clone ssh://user@dummy/server client -q
48 58 $ cd client
49 59
50 60 Enable extension
51 61 $ cat >> $HGRCPATH <<EOF
52 62 > [extensions]
53 63 > bundle2=$TESTTMP/bundle2.py
54 64 > EOF
55 65
56 66 Without config
57 67
58 68 $ cd ../client
59 69 $ echo c1 > f1
60 70 $ hg commit -Am 1
61 71 adding f1
62 72 $ hg push
63 73 pushing to ssh://user@dummy/server
64 74 searching for changes
65 75 remote: adding changesets
66 76 remote: adding manifests
67 77 remote: adding file changes
68 78 remote: added 1 changesets with 1 changes to 1 files
69 79 remote: pushback not enabled
70 80 $ hg bookmark
71 81 no bookmarks set
72 82
73 83 $ cd ../server
74 84 $ hg tglog
75 85 o 1 [public:2b9c7234e035]
76 86 |
77 87 @ 0 [public:6cee5c8f3e5b]
78 88
79 89
80 90
81 91
82 92 With config
83 93
84 94 $ cd ../client
85 95 $ echo '[experimental]' >> .hg/hgrc
86 96 $ echo 'bundle2.pushback = True' >> .hg/hgrc
87 97 $ echo c2 > f2
88 98 $ hg commit -Am 2
89 99 adding f2
90 100 $ hg push
91 101 pushing to ssh://user@dummy/server
92 102 searching for changes
93 103 remote: adding changesets
94 104 remote: adding manifests
95 105 remote: adding file changes
96 106 remote: added 1 changesets with 1 changes to 1 files
97 107 $ hg bookmark
98 108 new-server-mark 2:0a76dfb2e179
99 109
100 110 $ cd ../server
101 111 $ hg tglog
102 112 o 2 [public:0a76dfb2e179]
103 113 |
104 114 o 1 [public:2b9c7234e035]
105 115 |
106 116 @ 0 [public:6cee5c8f3e5b]
107 117
108 118
109 119
110 120
@@ -1,604 +1,614 b''
1 1 #require killdaemons
2 2
3 #testcases sshv1 sshv2
4
5 #if sshv2
6 $ cat >> $HGRCPATH << EOF
7 > [experimental]
8 > sshpeer.advertise-v2 = true
9 > sshserver.support-v2 = true
10 > EOF
11 #endif
12
3 13 Create an extension to test bundle2 remote-changegroup parts
4 14
5 15 $ cat > bundle2.py << EOF
6 16 > """A small extension to test bundle2 remote-changegroup parts.
7 17 >
8 18 > Current bundle2 implementation doesn't provide a way to generate those
9 19 > parts, so they must be created by extensions.
10 20 > """
11 21 > from mercurial import bundle2, changegroup, discovery, exchange, util
12 22 >
13 23 > def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None,
14 24 > b2caps=None, heads=None, common=None,
15 25 > **kwargs):
16 26 > """this function replaces the changegroup part handler for getbundle.
17 27 > It allows to create a set of arbitrary parts containing changegroups
18 28 > and remote-changegroups, as described in a bundle2maker file in the
19 29 > repository .hg/ directory.
20 30 >
21 31 > Each line of that bundle2maker file contain a description of the
22 32 > part to add:
23 33 > - changegroup common_revset heads_revset
24 34 > Creates a changegroup part based, using common_revset and
25 35 > heads_revset for outgoing
26 36 > - remote-changegroup url file
27 37 > Creates a remote-changegroup part for a bundle at the given
28 38 > url. Size and digest, as required by the client, are computed
29 39 > from the given file.
30 40 > - raw-remote-changegroup <python expression>
31 41 > Creates a remote-changegroup part with the data given in the
32 42 > Python expression as parameters. The Python expression is
33 43 > evaluated with eval, and is expected to be a dict.
34 44 > """
35 45 > def newpart(name, data=''):
36 46 > """wrapper around bundler.newpart adding an extra part making the
37 47 > client output information about each processed part"""
38 48 > bundler.newpart('output', data=name)
39 49 > part = bundler.newpart(name, data=data)
40 50 > return part
41 51 >
42 52 > for line in open(repo.vfs.join('bundle2maker'), 'r'):
43 53 > line = line.strip()
44 54 > try:
45 55 > verb, args = line.split(None, 1)
46 56 > except ValueError:
47 57 > verb, args = line, ''
48 58 > if verb == 'remote-changegroup':
49 59 > url, file = args.split()
50 60 > bundledata = open(file, 'rb').read()
51 61 > digest = util.digester.preferred(b2caps['digests'])
52 62 > d = util.digester([digest], bundledata)
53 63 > part = newpart('remote-changegroup')
54 64 > part.addparam('url', url)
55 65 > part.addparam('size', str(len(bundledata)))
56 66 > part.addparam('digests', digest)
57 67 > part.addparam('digest:%s' % digest, d[digest])
58 68 > elif verb == 'raw-remote-changegroup':
59 69 > part = newpart('remote-changegroup')
60 70 > for k, v in eval(args).items():
61 71 > part.addparam(k, str(v))
62 72 > elif verb == 'changegroup':
63 73 > _common, heads = args.split()
64 74 > common.extend(repo.lookup(r) for r in repo.revs(_common))
65 75 > heads = [repo.lookup(r) for r in repo.revs(heads)]
66 76 > outgoing = discovery.outgoing(repo, common, heads)
67 77 > cg = changegroup.makechangegroup(repo, outgoing, '01',
68 78 > 'changegroup')
69 79 > newpart('changegroup', cg.getchunks())
70 80 > else:
71 81 > raise Exception('unknown verb')
72 82 >
73 83 > exchange.getbundle2partsmapping['changegroup'] = _getbundlechangegrouppart
74 84 > EOF
75 85
76 86 Start a simple HTTP server to serve bundles
77 87
78 88 $ $PYTHON "$TESTDIR/dumbhttp.py" -p $HGPORT --pid dumb.pid
79 89 $ cat dumb.pid >> $DAEMON_PIDS
80 90
81 91 $ cat >> $HGRCPATH << EOF
82 92 > [ui]
83 93 > ssh=$PYTHON "$TESTDIR/dummyssh"
84 94 > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
85 95 > EOF
86 96
87 97 $ hg init repo
88 98
89 99 $ hg -R repo unbundle $TESTDIR/bundles/rebase.hg
90 100 adding changesets
91 101 adding manifests
92 102 adding file changes
93 103 added 8 changesets with 7 changes to 7 files (+2 heads)
94 104 new changesets cd010b8cd998:02de42196ebe
95 105 (run 'hg heads' to see heads, 'hg merge' to merge)
96 106
97 107 $ hg -R repo log -G
98 108 o 7:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> H
99 109 |
100 110 | o 6:eea13746799a draft Nicolas Dumazet <nicdumz.commits@gmail.com> G
101 111 |/|
102 112 o | 5:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F
103 113 | |
104 114 | o 4:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
105 115 |/
106 116 | o 3:32af7686d403 draft Nicolas Dumazet <nicdumz.commits@gmail.com> D
107 117 | |
108 118 | o 2:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> C
109 119 | |
110 120 | o 1:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> B
111 121 |/
112 122 o 0:cd010b8cd998 draft Nicolas Dumazet <nicdumz.commits@gmail.com> A
113 123
114 124 $ hg clone repo orig
115 125 updating to branch default
116 126 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 127
118 128 $ cat > repo/.hg/hgrc << EOF
119 129 > [extensions]
120 130 > bundle2=$TESTTMP/bundle2.py
121 131 > EOF
122 132
123 133 Test a pull with an remote-changegroup
124 134
125 135 $ hg bundle -R repo --type v1 --base '0:4' -r '5:7' bundle.hg
126 136 3 changesets found
127 137 $ cat > repo/.hg/bundle2maker << EOF
128 138 > remote-changegroup http://localhost:$HGPORT/bundle.hg bundle.hg
129 139 > EOF
130 140 $ hg clone orig clone -r 3 -r 4
131 141 adding changesets
132 142 adding manifests
133 143 adding file changes
134 144 added 5 changesets with 5 changes to 5 files (+1 heads)
135 145 new changesets cd010b8cd998:9520eea781bc
136 146 updating to branch default
137 147 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
138 148 $ hg pull -R clone ssh://user@dummy/repo
139 149 pulling from ssh://user@dummy/repo
140 150 searching for changes
141 151 remote: remote-changegroup
142 152 adding changesets
143 153 adding manifests
144 154 adding file changes
145 155 added 3 changesets with 2 changes to 2 files (+1 heads)
146 156 new changesets 24b6387c8c8c:02de42196ebe
147 157 (run 'hg heads .' to see heads, 'hg merge' to merge)
148 158 $ hg -R clone log -G
149 159 o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H
150 160 |
151 161 | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G
152 162 |/|
153 163 o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
154 164 | |
155 165 | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
156 166 |/
157 167 | @ 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D
158 168 | |
159 169 | o 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C
160 170 | |
161 171 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B
162 172 |/
163 173 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
164 174
165 175 $ rm -rf clone
166 176
167 177 Test a pull with an remote-changegroup and a following changegroup
168 178
169 179 $ hg bundle -R repo --type v1 --base 2 -r '3:4' bundle2.hg
170 180 2 changesets found
171 181 $ cat > repo/.hg/bundle2maker << EOF
172 182 > remote-changegroup http://localhost:$HGPORT/bundle2.hg bundle2.hg
173 183 > changegroup 0:4 5:7
174 184 > EOF
175 185 $ hg clone orig clone -r 2
176 186 adding changesets
177 187 adding manifests
178 188 adding file changes
179 189 added 3 changesets with 3 changes to 3 files
180 190 new changesets cd010b8cd998:5fddd98957c8
181 191 updating to branch default
182 192 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
183 193 $ hg pull -R clone ssh://user@dummy/repo
184 194 pulling from ssh://user@dummy/repo
185 195 searching for changes
186 196 remote: remote-changegroup
187 197 adding changesets
188 198 adding manifests
189 199 adding file changes
190 200 added 2 changesets with 2 changes to 2 files (+1 heads)
191 201 remote: changegroup
192 202 adding changesets
193 203 adding manifests
194 204 adding file changes
195 205 added 3 changesets with 2 changes to 2 files (+1 heads)
196 206 new changesets 32af7686d403:02de42196ebe
197 207 (run 'hg heads' to see heads, 'hg merge' to merge)
198 208 $ hg -R clone log -G
199 209 o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H
200 210 |
201 211 | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G
202 212 |/|
203 213 o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
204 214 | |
205 215 | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
206 216 |/
207 217 | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D
208 218 | |
209 219 | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C
210 220 | |
211 221 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B
212 222 |/
213 223 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
214 224
215 225 $ rm -rf clone
216 226
217 227 Test a pull with a changegroup followed by an remote-changegroup
218 228
219 229 $ hg bundle -R repo --type v1 --base '0:4' -r '5:7' bundle3.hg
220 230 3 changesets found
221 231 $ cat > repo/.hg/bundle2maker << EOF
222 232 > changegroup 000000000000 :4
223 233 > remote-changegroup http://localhost:$HGPORT/bundle3.hg bundle3.hg
224 234 > EOF
225 235 $ hg clone orig clone -r 2
226 236 adding changesets
227 237 adding manifests
228 238 adding file changes
229 239 added 3 changesets with 3 changes to 3 files
230 240 new changesets cd010b8cd998:5fddd98957c8
231 241 updating to branch default
232 242 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
233 243 $ hg pull -R clone ssh://user@dummy/repo
234 244 pulling from ssh://user@dummy/repo
235 245 searching for changes
236 246 remote: changegroup
237 247 adding changesets
238 248 adding manifests
239 249 adding file changes
240 250 added 2 changesets with 2 changes to 2 files (+1 heads)
241 251 remote: remote-changegroup
242 252 adding changesets
243 253 adding manifests
244 254 adding file changes
245 255 added 3 changesets with 2 changes to 2 files (+1 heads)
246 256 new changesets 32af7686d403:02de42196ebe
247 257 (run 'hg heads' to see heads, 'hg merge' to merge)
248 258 $ hg -R clone log -G
249 259 o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H
250 260 |
251 261 | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G
252 262 |/|
253 263 o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
254 264 | |
255 265 | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
256 266 |/
257 267 | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D
258 268 | |
259 269 | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C
260 270 | |
261 271 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B
262 272 |/
263 273 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
264 274
265 275 $ rm -rf clone
266 276
267 277 Test a pull with two remote-changegroups and a changegroup
268 278
269 279 $ hg bundle -R repo --type v1 --base 2 -r '3:4' bundle4.hg
270 280 2 changesets found
271 281 $ hg bundle -R repo --type v1 --base '3:4' -r '5:6' bundle5.hg
272 282 2 changesets found
273 283 $ cat > repo/.hg/bundle2maker << EOF
274 284 > remote-changegroup http://localhost:$HGPORT/bundle4.hg bundle4.hg
275 285 > remote-changegroup http://localhost:$HGPORT/bundle5.hg bundle5.hg
276 286 > changegroup 0:6 7
277 287 > EOF
278 288 $ hg clone orig clone -r 2
279 289 adding changesets
280 290 adding manifests
281 291 adding file changes
282 292 added 3 changesets with 3 changes to 3 files
283 293 new changesets cd010b8cd998:5fddd98957c8
284 294 updating to branch default
285 295 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
286 296 $ hg pull -R clone ssh://user@dummy/repo
287 297 pulling from ssh://user@dummy/repo
288 298 searching for changes
289 299 remote: remote-changegroup
290 300 adding changesets
291 301 adding manifests
292 302 adding file changes
293 303 added 2 changesets with 2 changes to 2 files (+1 heads)
294 304 remote: remote-changegroup
295 305 adding changesets
296 306 adding manifests
297 307 adding file changes
298 308 added 2 changesets with 1 changes to 1 files
299 309 remote: changegroup
300 310 adding changesets
301 311 adding manifests
302 312 adding file changes
303 313 added 1 changesets with 1 changes to 1 files (+1 heads)
304 314 new changesets 32af7686d403:02de42196ebe
305 315 (run 'hg heads' to see heads, 'hg merge' to merge)
306 316 $ hg -R clone log -G
307 317 o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H
308 318 |
309 319 | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G
310 320 |/|
311 321 o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
312 322 | |
313 323 | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
314 324 |/
315 325 | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D
316 326 | |
317 327 | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C
318 328 | |
319 329 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B
320 330 |/
321 331 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
322 332
323 333 $ rm -rf clone
324 334
325 335 Hash digest tests
326 336
327 337 $ hg bundle -R repo --type v1 -a bundle6.hg
328 338 8 changesets found
329 339
330 340 $ cat > repo/.hg/bundle2maker << EOF
331 341 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'sha1', 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'}
332 342 > EOF
333 343 $ hg clone ssh://user@dummy/repo clone
334 344 requesting all changes
335 345 remote: remote-changegroup
336 346 adding changesets
337 347 adding manifests
338 348 adding file changes
339 349 added 8 changesets with 7 changes to 7 files (+2 heads)
340 350 new changesets cd010b8cd998:02de42196ebe
341 351 updating to branch default
342 352 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
343 353 $ rm -rf clone
344 354
345 355 $ cat > repo/.hg/bundle2maker << EOF
346 356 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394'}
347 357 > EOF
348 358 $ hg clone ssh://user@dummy/repo clone
349 359 requesting all changes
350 360 remote: remote-changegroup
351 361 adding changesets
352 362 adding manifests
353 363 adding file changes
354 364 added 8 changesets with 7 changes to 7 files (+2 heads)
355 365 new changesets cd010b8cd998:02de42196ebe
356 366 updating to branch default
357 367 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
358 368 $ rm -rf clone
359 369
360 370 Hash digest mismatch throws an error
361 371
362 372 $ cat > repo/.hg/bundle2maker << EOF
363 373 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'sha1', 'digest:sha1': '0' * 40}
364 374 > EOF
365 375 $ hg clone ssh://user@dummy/repo clone
366 376 requesting all changes
367 377 remote: remote-changegroup
368 378 adding changesets
369 379 adding manifests
370 380 adding file changes
371 381 added 8 changesets with 7 changes to 7 files (+2 heads)
372 382 transaction abort!
373 383 rollback completed
374 384 abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted:
375 385 sha1 mismatch: expected 0000000000000000000000000000000000000000, got 2c880cfec23cff7d8f80c2f12958d1563cbdaba6
376 386 [255]
377 387
378 388 Multiple hash digests can be given
379 389
380 390 $ cat > repo/.hg/bundle2maker << EOF
381 391 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394', 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'}
382 392 > EOF
383 393 $ hg clone ssh://user@dummy/repo clone
384 394 requesting all changes
385 395 remote: remote-changegroup
386 396 adding changesets
387 397 adding manifests
388 398 adding file changes
389 399 added 8 changesets with 7 changes to 7 files (+2 heads)
390 400 new changesets cd010b8cd998:02de42196ebe
391 401 updating to branch default
392 402 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
393 403 $ rm -rf clone
394 404
395 405 If either of the multiple hash digests mismatches, an error is thrown
396 406
397 407 $ cat > repo/.hg/bundle2maker << EOF
398 408 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': '0' * 32, 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'}
399 409 > EOF
400 410 $ hg clone ssh://user@dummy/repo clone
401 411 requesting all changes
402 412 remote: remote-changegroup
403 413 adding changesets
404 414 adding manifests
405 415 adding file changes
406 416 added 8 changesets with 7 changes to 7 files (+2 heads)
407 417 transaction abort!
408 418 rollback completed
409 419 abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted:
410 420 md5 mismatch: expected 00000000000000000000000000000000, got e22172c2907ef88794b7bea6642c2394
411 421 [255]
412 422
413 423 $ cat > repo/.hg/bundle2maker << EOF
414 424 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394', 'digest:sha1': '0' * 40}
415 425 > EOF
416 426 $ hg clone ssh://user@dummy/repo clone
417 427 requesting all changes
418 428 remote: remote-changegroup
419 429 adding changesets
420 430 adding manifests
421 431 adding file changes
422 432 added 8 changesets with 7 changes to 7 files (+2 heads)
423 433 transaction abort!
424 434 rollback completed
425 435 abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted:
426 436 sha1 mismatch: expected 0000000000000000000000000000000000000000, got 2c880cfec23cff7d8f80c2f12958d1563cbdaba6
427 437 [255]
428 438
429 439 Corruption tests
430 440
431 441 $ hg clone orig clone -r 2
432 442 adding changesets
433 443 adding manifests
434 444 adding file changes
435 445 added 3 changesets with 3 changes to 3 files
436 446 new changesets cd010b8cd998:5fddd98957c8
437 447 updating to branch default
438 448 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
439 449
440 450 $ cat > repo/.hg/bundle2maker << EOF
441 451 > remote-changegroup http://localhost:$HGPORT/bundle4.hg bundle4.hg
442 452 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle5.hg', 'size': 578, 'digests': 'sha1', 'digest:sha1': '0' * 40}
443 453 > changegroup 0:6 7
444 454 > EOF
445 455 $ hg pull -R clone ssh://user@dummy/repo
446 456 pulling from ssh://user@dummy/repo
447 457 searching for changes
448 458 remote: remote-changegroup
449 459 adding changesets
450 460 adding manifests
451 461 adding file changes
452 462 added 2 changesets with 2 changes to 2 files (+1 heads)
453 463 remote: remote-changegroup
454 464 adding changesets
455 465 adding manifests
456 466 adding file changes
457 467 added 2 changesets with 1 changes to 1 files
458 468 transaction abort!
459 469 rollback completed
460 470 abort: bundle at http://localhost:$HGPORT/bundle5.hg is corrupted:
461 471 sha1 mismatch: expected 0000000000000000000000000000000000000000, got f29485d6bfd37db99983cfc95ecb52f8ca396106
462 472 [255]
463 473
464 474 The entire transaction has been rolled back in the pull above
465 475
466 476 $ hg -R clone log -G
467 477 @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C
468 478 |
469 479 o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B
470 480 |
471 481 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
472 482
473 483
474 484 No params
475 485
476 486 $ cat > repo/.hg/bundle2maker << EOF
477 487 > raw-remote-changegroup {}
478 488 > EOF
479 489 $ hg pull -R clone ssh://user@dummy/repo
480 490 pulling from ssh://user@dummy/repo
481 491 searching for changes
482 492 remote: remote-changegroup
483 493 abort: remote-changegroup: missing "url" param
484 494 [255]
485 495
486 496 Missing size
487 497
488 498 $ cat > repo/.hg/bundle2maker << EOF
489 499 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg'}
490 500 > EOF
491 501 $ hg pull -R clone ssh://user@dummy/repo
492 502 pulling from ssh://user@dummy/repo
493 503 searching for changes
494 504 remote: remote-changegroup
495 505 abort: remote-changegroup: missing "size" param
496 506 [255]
497 507
498 508 Invalid size
499 509
500 510 $ cat > repo/.hg/bundle2maker << EOF
501 511 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 'foo'}
502 512 > EOF
503 513 $ hg pull -R clone ssh://user@dummy/repo
504 514 pulling from ssh://user@dummy/repo
505 515 searching for changes
506 516 remote: remote-changegroup
507 517 abort: remote-changegroup: invalid value for param "size"
508 518 [255]
509 519
510 520 Size mismatch
511 521
512 522 $ cat > repo/.hg/bundle2maker << EOF
513 523 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 42}
514 524 > EOF
515 525 $ hg pull -R clone ssh://user@dummy/repo
516 526 pulling from ssh://user@dummy/repo
517 527 searching for changes
518 528 remote: remote-changegroup
519 529 adding changesets
520 530 adding manifests
521 531 adding file changes
522 532 added 2 changesets with 2 changes to 2 files (+1 heads)
523 533 transaction abort!
524 534 rollback completed
525 535 abort: bundle at http://localhost:$HGPORT/bundle4.hg is corrupted:
526 536 size mismatch: expected 42, got 581
527 537 [255]
528 538
529 539 Unknown digest
530 540
531 541 $ cat > repo/.hg/bundle2maker << EOF
532 542 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 581, 'digests': 'foo', 'digest:foo': 'bar'}
533 543 > EOF
534 544 $ hg pull -R clone ssh://user@dummy/repo
535 545 pulling from ssh://user@dummy/repo
536 546 searching for changes
537 547 remote: remote-changegroup
538 548 abort: missing support for remote-changegroup - digest:foo
539 549 [255]
540 550
541 551 Missing digest
542 552
543 553 $ cat > repo/.hg/bundle2maker << EOF
544 554 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 581, 'digests': 'sha1'}
545 555 > EOF
546 556 $ hg pull -R clone ssh://user@dummy/repo
547 557 pulling from ssh://user@dummy/repo
548 558 searching for changes
549 559 remote: remote-changegroup
550 560 abort: remote-changegroup: missing "digest:sha1" param
551 561 [255]
552 562
553 563 Not an HTTP url
554 564
555 565 $ cat > repo/.hg/bundle2maker << EOF
556 566 > raw-remote-changegroup {'url': 'ssh://localhost:$HGPORT/bundle4.hg', 'size': 581}
557 567 > EOF
558 568 $ hg pull -R clone ssh://user@dummy/repo
559 569 pulling from ssh://user@dummy/repo
560 570 searching for changes
561 571 remote: remote-changegroup
562 572 abort: remote-changegroup does not support ssh urls
563 573 [255]
564 574
565 575 Not a bundle
566 576
567 577 $ cat > notbundle.hg << EOF
568 578 > foo
569 579 > EOF
570 580 $ cat > repo/.hg/bundle2maker << EOF
571 581 > remote-changegroup http://localhost:$HGPORT/notbundle.hg notbundle.hg
572 582 > EOF
573 583 $ hg pull -R clone ssh://user@dummy/repo
574 584 pulling from ssh://user@dummy/repo
575 585 searching for changes
576 586 remote: remote-changegroup
577 587 abort: http://localhost:$HGPORT/notbundle.hg: not a Mercurial bundle
578 588 [255]
579 589
580 590 Not a bundle 1.0
581 591
582 592 $ cat > notbundle10.hg << EOF
583 593 > HG20
584 594 > EOF
585 595 $ cat > repo/.hg/bundle2maker << EOF
586 596 > remote-changegroup http://localhost:$HGPORT/notbundle10.hg notbundle10.hg
587 597 > EOF
588 598 $ hg pull -R clone ssh://user@dummy/repo
589 599 pulling from ssh://user@dummy/repo
590 600 searching for changes
591 601 remote: remote-changegroup
592 602 abort: http://localhost:$HGPORT/notbundle10.hg: not a bundle version 1.0
593 603 [255]
594 604
595 605 $ hg -R clone log -G
596 606 @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C
597 607 |
598 608 o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B
599 609 |
600 610 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
601 611
602 612 $ rm -rf clone
603 613
604 614 $ killdaemons.py
@@ -1,1256 +1,1271 b''
1 #testcases sshv1 sshv2
2
3 #if sshv2
4 $ cat >> $HGRCPATH << EOF
5 > [experimental]
6 > sshpeer.advertise-v2 = true
7 > sshserver.support-v2 = true
8 > EOF
9 #endif
10
1 11 Prepare repo a:
2 12
3 13 $ hg init a
4 14 $ cd a
5 15 $ echo a > a
6 16 $ hg add a
7 17 $ hg commit -m test
8 18 $ echo first line > b
9 19 $ hg add b
10 20
11 21 Create a non-inlined filelog:
12 22
13 23 $ $PYTHON -c 'open("data1", "wb").write(b"".join(b"%d\n" % x for x in range(10000)))'
14 24 $ for j in 0 1 2 3 4 5 6 7 8 9; do
15 25 > cat data1 >> b
16 26 > hg commit -m test
17 27 > done
18 28
19 29 List files in store/data (should show a 'b.d'):
20 30
21 31 $ for i in .hg/store/data/*; do
22 32 > echo $i
23 33 > done
24 34 .hg/store/data/a.i
25 35 .hg/store/data/b.d
26 36 .hg/store/data/b.i
27 37
28 38 Trigger branchcache creation:
29 39
30 40 $ hg branches
31 41 default 10:a7949464abda
32 42 $ ls .hg/cache
33 43 branch2-served
34 44 checkisexec (execbit !)
35 45 checklink (symlink !)
36 46 checklink-target (symlink !)
37 47 checknoexec (execbit !)
38 48 rbc-names-v1
39 49 rbc-revs-v1
40 50
41 51 Default operation:
42 52
43 53 $ hg clone . ../b
44 54 updating to branch default
45 55 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 56 $ cd ../b
47 57
48 58 Ensure branchcache got copied over:
49 59
50 60 $ ls .hg/cache
51 61 branch2-served
52 62 checkisexec (execbit !)
53 63 checklink (symlink !)
54 64 checklink-target (symlink !)
55 65 rbc-names-v1
56 66 rbc-revs-v1
57 67
58 68 $ cat a
59 69 a
60 70 $ hg verify
61 71 checking changesets
62 72 checking manifests
63 73 crosschecking files in changesets and manifests
64 74 checking files
65 75 2 files, 11 changesets, 11 total revisions
66 76
67 77 Invalid dest '' must abort:
68 78
69 79 $ hg clone . ''
70 80 abort: empty destination path is not valid
71 81 [255]
72 82
73 83 No update, with debug option:
74 84
75 85 #if hardlink
76 86 $ hg --debug clone -U . ../c --config progress.debug=true
77 87 linking: 1
78 88 linking: 2
79 89 linking: 3
80 90 linking: 4
81 91 linking: 5
82 92 linking: 6
83 93 linking: 7
84 94 linking: 8
85 95 linked 8 files
86 96 #else
87 97 $ hg --debug clone -U . ../c --config progress.debug=true
88 98 linking: 1
89 99 copying: 2
90 100 copying: 3
91 101 copying: 4
92 102 copying: 5
93 103 copying: 6
94 104 copying: 7
95 105 copying: 8
96 106 copied 8 files
97 107 #endif
98 108 $ cd ../c
99 109
100 110 Ensure branchcache got copied over:
101 111
102 112 $ ls .hg/cache
103 113 branch2-served
104 114 rbc-names-v1
105 115 rbc-revs-v1
106 116
107 117 $ cat a 2>/dev/null || echo "a not present"
108 118 a not present
109 119 $ hg verify
110 120 checking changesets
111 121 checking manifests
112 122 crosschecking files in changesets and manifests
113 123 checking files
114 124 2 files, 11 changesets, 11 total revisions
115 125
116 126 Default destination:
117 127
118 128 $ mkdir ../d
119 129 $ cd ../d
120 130 $ hg clone ../a
121 131 destination directory: a
122 132 updating to branch default
123 133 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
124 134 $ cd a
125 135 $ hg cat a
126 136 a
127 137 $ cd ../..
128 138
129 139 Check that we drop the 'file:' from the path before writing the .hgrc:
130 140
131 141 $ hg clone file:a e
132 142 updating to branch default
133 143 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
134 144 $ grep 'file:' e/.hg/hgrc
135 145 [1]
136 146
137 147 Check that path aliases are expanded:
138 148
139 149 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
140 150 $ hg -R f showconfig paths.default
141 151 $TESTTMP/a#0
142 152
143 153 Use --pull:
144 154
145 155 $ hg clone --pull a g
146 156 requesting all changes
147 157 adding changesets
148 158 adding manifests
149 159 adding file changes
150 160 added 11 changesets with 11 changes to 2 files
151 161 new changesets acb14030fe0a:a7949464abda
152 162 updating to branch default
153 163 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
154 164 $ hg -R g verify
155 165 checking changesets
156 166 checking manifests
157 167 crosschecking files in changesets and manifests
158 168 checking files
159 169 2 files, 11 changesets, 11 total revisions
160 170
161 171 Invalid dest '' with --pull must abort (issue2528):
162 172
163 173 $ hg clone --pull a ''
164 174 abort: empty destination path is not valid
165 175 [255]
166 176
167 177 Clone to '.':
168 178
169 179 $ mkdir h
170 180 $ cd h
171 181 $ hg clone ../a .
172 182 updating to branch default
173 183 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
174 184 $ cd ..
175 185
176 186
177 187 *** Tests for option -u ***
178 188
179 189 Adding some more history to repo a:
180 190
181 191 $ cd a
182 192 $ hg tag ref1
183 193 $ echo the quick brown fox >a
184 194 $ hg ci -m "hacked default"
185 195 $ hg up ref1
186 196 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
187 197 $ hg branch stable
188 198 marked working directory as branch stable
189 199 (branches are permanent and global, did you want a bookmark?)
190 200 $ echo some text >a
191 201 $ hg ci -m "starting branch stable"
192 202 $ hg tag ref2
193 203 $ echo some more text >a
194 204 $ hg ci -m "another change for branch stable"
195 205 $ hg up ref2
196 206 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
197 207 $ hg parents
198 208 changeset: 13:e8ece76546a6
199 209 branch: stable
200 210 tag: ref2
201 211 parent: 10:a7949464abda
202 212 user: test
203 213 date: Thu Jan 01 00:00:00 1970 +0000
204 214 summary: starting branch stable
205 215
206 216
207 217 Repo a has two heads:
208 218
209 219 $ hg heads
210 220 changeset: 15:0aae7cf88f0d
211 221 branch: stable
212 222 tag: tip
213 223 user: test
214 224 date: Thu Jan 01 00:00:00 1970 +0000
215 225 summary: another change for branch stable
216 226
217 227 changeset: 12:f21241060d6a
218 228 user: test
219 229 date: Thu Jan 01 00:00:00 1970 +0000
220 230 summary: hacked default
221 231
222 232
223 233 $ cd ..
224 234
225 235
226 236 Testing --noupdate with --updaterev (must abort):
227 237
228 238 $ hg clone --noupdate --updaterev 1 a ua
229 239 abort: cannot specify both --noupdate and --updaterev
230 240 [255]
231 241
232 242
233 243 Testing clone -u:
234 244
235 245 $ hg clone -u . a ua
236 246 updating to branch stable
237 247 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
238 248
239 249 Repo ua has both heads:
240 250
241 251 $ hg -R ua heads
242 252 changeset: 15:0aae7cf88f0d
243 253 branch: stable
244 254 tag: tip
245 255 user: test
246 256 date: Thu Jan 01 00:00:00 1970 +0000
247 257 summary: another change for branch stable
248 258
249 259 changeset: 12:f21241060d6a
250 260 user: test
251 261 date: Thu Jan 01 00:00:00 1970 +0000
252 262 summary: hacked default
253 263
254 264
255 265 Same revision checked out in repo a and ua:
256 266
257 267 $ hg -R a parents --template "{node|short}\n"
258 268 e8ece76546a6
259 269 $ hg -R ua parents --template "{node|short}\n"
260 270 e8ece76546a6
261 271
262 272 $ rm -r ua
263 273
264 274
265 275 Testing clone --pull -u:
266 276
267 277 $ hg clone --pull -u . a ua
268 278 requesting all changes
269 279 adding changesets
270 280 adding manifests
271 281 adding file changes
272 282 added 16 changesets with 16 changes to 3 files (+1 heads)
273 283 new changesets acb14030fe0a:0aae7cf88f0d
274 284 updating to branch stable
275 285 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
276 286
277 287 Repo ua has both heads:
278 288
279 289 $ hg -R ua heads
280 290 changeset: 15:0aae7cf88f0d
281 291 branch: stable
282 292 tag: tip
283 293 user: test
284 294 date: Thu Jan 01 00:00:00 1970 +0000
285 295 summary: another change for branch stable
286 296
287 297 changeset: 12:f21241060d6a
288 298 user: test
289 299 date: Thu Jan 01 00:00:00 1970 +0000
290 300 summary: hacked default
291 301
292 302
293 303 Same revision checked out in repo a and ua:
294 304
295 305 $ hg -R a parents --template "{node|short}\n"
296 306 e8ece76546a6
297 307 $ hg -R ua parents --template "{node|short}\n"
298 308 e8ece76546a6
299 309
300 310 $ rm -r ua
301 311
302 312
303 313 Testing clone -u <branch>:
304 314
305 315 $ hg clone -u stable a ua
306 316 updating to branch stable
307 317 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
308 318
309 319 Repo ua has both heads:
310 320
311 321 $ hg -R ua heads
312 322 changeset: 15:0aae7cf88f0d
313 323 branch: stable
314 324 tag: tip
315 325 user: test
316 326 date: Thu Jan 01 00:00:00 1970 +0000
317 327 summary: another change for branch stable
318 328
319 329 changeset: 12:f21241060d6a
320 330 user: test
321 331 date: Thu Jan 01 00:00:00 1970 +0000
322 332 summary: hacked default
323 333
324 334
325 335 Branch 'stable' is checked out:
326 336
327 337 $ hg -R ua parents
328 338 changeset: 15:0aae7cf88f0d
329 339 branch: stable
330 340 tag: tip
331 341 user: test
332 342 date: Thu Jan 01 00:00:00 1970 +0000
333 343 summary: another change for branch stable
334 344
335 345
336 346 $ rm -r ua
337 347
338 348
339 349 Testing default checkout:
340 350
341 351 $ hg clone a ua
342 352 updating to branch default
343 353 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
344 354
345 355 Repo ua has both heads:
346 356
347 357 $ hg -R ua heads
348 358 changeset: 15:0aae7cf88f0d
349 359 branch: stable
350 360 tag: tip
351 361 user: test
352 362 date: Thu Jan 01 00:00:00 1970 +0000
353 363 summary: another change for branch stable
354 364
355 365 changeset: 12:f21241060d6a
356 366 user: test
357 367 date: Thu Jan 01 00:00:00 1970 +0000
358 368 summary: hacked default
359 369
360 370
361 371 Branch 'default' is checked out:
362 372
363 373 $ hg -R ua parents
364 374 changeset: 12:f21241060d6a
365 375 user: test
366 376 date: Thu Jan 01 00:00:00 1970 +0000
367 377 summary: hacked default
368 378
369 379 Test clone with a branch named "@" (issue3677)
370 380
371 381 $ hg -R ua branch @
372 382 marked working directory as branch @
373 383 $ hg -R ua commit -m 'created branch @'
374 384 $ hg clone ua atbranch
375 385 updating to branch default
376 386 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
377 387 $ hg -R atbranch heads
378 388 changeset: 16:798b6d97153e
379 389 branch: @
380 390 tag: tip
381 391 parent: 12:f21241060d6a
382 392 user: test
383 393 date: Thu Jan 01 00:00:00 1970 +0000
384 394 summary: created branch @
385 395
386 396 changeset: 15:0aae7cf88f0d
387 397 branch: stable
388 398 user: test
389 399 date: Thu Jan 01 00:00:00 1970 +0000
390 400 summary: another change for branch stable
391 401
392 402 changeset: 12:f21241060d6a
393 403 user: test
394 404 date: Thu Jan 01 00:00:00 1970 +0000
395 405 summary: hacked default
396 406
397 407 $ hg -R atbranch parents
398 408 changeset: 12:f21241060d6a
399 409 user: test
400 410 date: Thu Jan 01 00:00:00 1970 +0000
401 411 summary: hacked default
402 412
403 413
404 414 $ rm -r ua atbranch
405 415
406 416
407 417 Testing #<branch>:
408 418
409 419 $ hg clone -u . a#stable ua
410 420 adding changesets
411 421 adding manifests
412 422 adding file changes
413 423 added 14 changesets with 14 changes to 3 files
414 424 new changesets acb14030fe0a:0aae7cf88f0d
415 425 updating to branch stable
416 426 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
417 427
418 428 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
419 429
420 430 $ hg -R ua heads
421 431 changeset: 13:0aae7cf88f0d
422 432 branch: stable
423 433 tag: tip
424 434 user: test
425 435 date: Thu Jan 01 00:00:00 1970 +0000
426 436 summary: another change for branch stable
427 437
428 438 changeset: 10:a7949464abda
429 439 user: test
430 440 date: Thu Jan 01 00:00:00 1970 +0000
431 441 summary: test
432 442
433 443
434 444 Same revision checked out in repo a and ua:
435 445
436 446 $ hg -R a parents --template "{node|short}\n"
437 447 e8ece76546a6
438 448 $ hg -R ua parents --template "{node|short}\n"
439 449 e8ece76546a6
440 450
441 451 $ rm -r ua
442 452
443 453
444 454 Testing -u -r <branch>:
445 455
446 456 $ hg clone -u . -r stable a ua
447 457 adding changesets
448 458 adding manifests
449 459 adding file changes
450 460 added 14 changesets with 14 changes to 3 files
451 461 new changesets acb14030fe0a:0aae7cf88f0d
452 462 updating to branch stable
453 463 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
454 464
455 465 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
456 466
457 467 $ hg -R ua heads
458 468 changeset: 13:0aae7cf88f0d
459 469 branch: stable
460 470 tag: tip
461 471 user: test
462 472 date: Thu Jan 01 00:00:00 1970 +0000
463 473 summary: another change for branch stable
464 474
465 475 changeset: 10:a7949464abda
466 476 user: test
467 477 date: Thu Jan 01 00:00:00 1970 +0000
468 478 summary: test
469 479
470 480
471 481 Same revision checked out in repo a and ua:
472 482
473 483 $ hg -R a parents --template "{node|short}\n"
474 484 e8ece76546a6
475 485 $ hg -R ua parents --template "{node|short}\n"
476 486 e8ece76546a6
477 487
478 488 $ rm -r ua
479 489
480 490
481 491 Testing -r <branch>:
482 492
483 493 $ hg clone -r stable a ua
484 494 adding changesets
485 495 adding manifests
486 496 adding file changes
487 497 added 14 changesets with 14 changes to 3 files
488 498 new changesets acb14030fe0a:0aae7cf88f0d
489 499 updating to branch stable
490 500 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
491 501
492 502 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
493 503
494 504 $ hg -R ua heads
495 505 changeset: 13:0aae7cf88f0d
496 506 branch: stable
497 507 tag: tip
498 508 user: test
499 509 date: Thu Jan 01 00:00:00 1970 +0000
500 510 summary: another change for branch stable
501 511
502 512 changeset: 10:a7949464abda
503 513 user: test
504 514 date: Thu Jan 01 00:00:00 1970 +0000
505 515 summary: test
506 516
507 517
508 518 Branch 'stable' is checked out:
509 519
510 520 $ hg -R ua parents
511 521 changeset: 13:0aae7cf88f0d
512 522 branch: stable
513 523 tag: tip
514 524 user: test
515 525 date: Thu Jan 01 00:00:00 1970 +0000
516 526 summary: another change for branch stable
517 527
518 528
519 529 $ rm -r ua
520 530
521 531
522 532 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
523 533 iterable in addbranchrevs()
524 534
525 535 $ cat <<EOF > simpleclone.py
526 536 > from mercurial import ui, hg
527 537 > myui = ui.ui.load()
528 538 > repo = hg.repository(myui, 'a')
529 539 > hg.clone(myui, {}, repo, dest="ua")
530 540 > EOF
531 541
532 542 $ $PYTHON simpleclone.py
533 543 updating to branch default
534 544 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
535 545
536 546 $ rm -r ua
537 547
538 548 $ cat <<EOF > branchclone.py
539 549 > from mercurial import ui, hg, extensions
540 550 > myui = ui.ui.load()
541 551 > extensions.loadall(myui)
542 552 > repo = hg.repository(myui, 'a')
543 553 > hg.clone(myui, {}, repo, dest="ua", branch=["stable",])
544 554 > EOF
545 555
546 556 $ $PYTHON branchclone.py
547 557 adding changesets
548 558 adding manifests
549 559 adding file changes
550 560 added 14 changesets with 14 changes to 3 files
551 561 new changesets acb14030fe0a:0aae7cf88f0d
552 562 updating to branch stable
553 563 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
554 564 $ rm -r ua
555 565
556 566
557 567 Test clone with special '@' bookmark:
558 568 $ cd a
559 569 $ hg bookmark -r a7949464abda @ # branch point of stable from default
560 570 $ hg clone . ../i
561 571 updating to bookmark @
562 572 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
563 573 $ hg id -i ../i
564 574 a7949464abda
565 575 $ rm -r ../i
566 576
567 577 $ hg bookmark -f -r stable @
568 578 $ hg bookmarks
569 579 @ 15:0aae7cf88f0d
570 580 $ hg clone . ../i
571 581 updating to bookmark @ on branch stable
572 582 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
573 583 $ hg id -i ../i
574 584 0aae7cf88f0d
575 585 $ cd "$TESTTMP"
576 586
577 587
578 588 Testing failures:
579 589
580 590 $ mkdir fail
581 591 $ cd fail
582 592
583 593 No local source
584 594
585 595 $ hg clone a b
586 596 abort: repository a not found!
587 597 [255]
588 598
589 599 No remote source
590 600
591 601 #if windows
592 602 $ hg clone http://$LOCALIP:3121/a b
593 603 abort: error: * (glob)
594 604 [255]
595 605 #else
596 606 $ hg clone http://$LOCALIP:3121/a b
597 607 abort: error: *refused* (glob)
598 608 [255]
599 609 #endif
600 610 $ rm -rf b # work around bug with http clone
601 611
602 612
603 613 #if unix-permissions no-root
604 614
605 615 Inaccessible source
606 616
607 617 $ mkdir a
608 618 $ chmod 000 a
609 619 $ hg clone a b
610 620 abort: repository a not found!
611 621 [255]
612 622
613 623 Inaccessible destination
614 624
615 625 $ hg init b
616 626 $ cd b
617 627 $ hg clone . ../a
618 628 abort: Permission denied: '../a'
619 629 [255]
620 630 $ cd ..
621 631 $ chmod 700 a
622 632 $ rm -r a b
623 633
624 634 #endif
625 635
626 636
627 637 #if fifo
628 638
629 639 Source of wrong type
630 640
631 641 $ mkfifo a
632 642 $ hg clone a b
633 643 abort: repository a not found!
634 644 [255]
635 645 $ rm a
636 646
637 647 #endif
638 648
639 649 Default destination, same directory
640 650
641 651 $ hg init q
642 652 $ hg clone q
643 653 destination directory: q
644 654 abort: destination 'q' is not empty
645 655 [255]
646 656
647 657 destination directory not empty
648 658
649 659 $ mkdir a
650 660 $ echo stuff > a/a
651 661 $ hg clone q a
652 662 abort: destination 'a' is not empty
653 663 [255]
654 664
655 665
656 666 #if unix-permissions no-root
657 667
658 668 leave existing directory in place after clone failure
659 669
660 670 $ hg init c
661 671 $ cd c
662 672 $ echo c > c
663 673 $ hg commit -A -m test
664 674 adding c
665 675 $ chmod -rx .hg/store/data
666 676 $ cd ..
667 677 $ mkdir d
668 678 $ hg clone c d 2> err
669 679 [255]
670 680 $ test -d d
671 681 $ test -d d/.hg
672 682 [1]
673 683
674 684 re-enable perm to allow deletion
675 685
676 686 $ chmod +rx c/.hg/store/data
677 687
678 688 #endif
679 689
680 690 $ cd ..
681 691
682 692 Test clone from the repository in (emulated) revlog format 0 (issue4203):
683 693
684 694 $ mkdir issue4203
685 695 $ mkdir -p src/.hg
686 696 $ echo foo > src/foo
687 697 $ hg -R src add src/foo
688 698 $ hg -R src commit -m '#0'
689 699 $ hg -R src log -q
690 700 0:e1bab28bca43
691 701 $ hg clone -U -q src dst
692 702 $ hg -R dst log -q
693 703 0:e1bab28bca43
694 704
695 705 Create repositories to test auto sharing functionality
696 706
697 707 $ cat >> $HGRCPATH << EOF
698 708 > [extensions]
699 709 > share=
700 710 > EOF
701 711
702 712 $ hg init empty
703 713 $ hg init source1a
704 714 $ cd source1a
705 715 $ echo initial1 > foo
706 716 $ hg -q commit -A -m initial
707 717 $ echo second > foo
708 718 $ hg commit -m second
709 719 $ cd ..
710 720
711 721 $ hg init filteredrev0
712 722 $ cd filteredrev0
713 723 $ cat >> .hg/hgrc << EOF
714 724 > [experimental]
715 725 > evolution.createmarkers=True
716 726 > EOF
717 727 $ echo initial1 > foo
718 728 $ hg -q commit -A -m initial0
719 729 $ hg -q up -r null
720 730 $ echo initial2 > foo
721 731 $ hg -q commit -A -m initial1
722 732 $ hg debugobsolete c05d5c47a5cf81401869999f3d05f7d699d2b29a e082c1832e09a7d1e78b7fd49a592d372de854c8
723 733 obsoleted 1 changesets
724 734 $ cd ..
725 735
726 736 $ hg -q clone --pull source1a source1b
727 737 $ cd source1a
728 738 $ hg bookmark bookA
729 739 $ echo 1a > foo
730 740 $ hg commit -m 1a
731 741 $ cd ../source1b
732 742 $ hg -q up -r 0
733 743 $ echo head1 > foo
734 744 $ hg commit -m head1
735 745 created new head
736 746 $ hg bookmark head1
737 747 $ hg -q up -r 0
738 748 $ echo head2 > foo
739 749 $ hg commit -m head2
740 750 created new head
741 751 $ hg bookmark head2
742 752 $ hg -q up -r 0
743 753 $ hg branch branch1
744 754 marked working directory as branch branch1
745 755 (branches are permanent and global, did you want a bookmark?)
746 756 $ echo branch1 > foo
747 757 $ hg commit -m branch1
748 758 $ hg -q up -r 0
749 759 $ hg branch branch2
750 760 marked working directory as branch branch2
751 761 $ echo branch2 > foo
752 762 $ hg commit -m branch2
753 763 $ cd ..
754 764 $ hg init source2
755 765 $ cd source2
756 766 $ echo initial2 > foo
757 767 $ hg -q commit -A -m initial2
758 768 $ echo second > foo
759 769 $ hg commit -m second
760 770 $ cd ..
761 771
762 772 Clone with auto share from an empty repo should not result in share
763 773
764 774 $ mkdir share
765 775 $ hg --config share.pool=share clone empty share-empty
766 776 (not using pooled storage: remote appears to be empty)
767 777 updating to branch default
768 778 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
769 779 $ ls share
770 780 $ test -d share-empty/.hg/store
771 781 $ test -f share-empty/.hg/sharedpath
772 782 [1]
773 783
774 784 Clone with auto share from a repo with filtered revision 0 should not result in share
775 785
776 786 $ hg --config share.pool=share clone filteredrev0 share-filtered
777 787 (not using pooled storage: unable to resolve identity of remote)
778 788 requesting all changes
779 789 adding changesets
780 790 adding manifests
781 791 adding file changes
782 792 added 1 changesets with 1 changes to 1 files
783 793 new changesets e082c1832e09
784 794 updating to branch default
785 795 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
786 796
787 797 Clone from repo with content should result in shared store being created
788 798
789 799 $ hg --config share.pool=share clone source1a share-dest1a
790 800 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
791 801 requesting all changes
792 802 adding changesets
793 803 adding manifests
794 804 adding file changes
795 805 added 3 changesets with 3 changes to 1 files
796 806 new changesets b5f04eac9d8f:e5bfe23c0b47
797 807 searching for changes
798 808 no changes found
799 809 adding remote bookmark bookA
800 810 updating working directory
801 811 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
802 812
803 813 The shared repo should have been created
804 814
805 815 $ ls share
806 816 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
807 817
808 818 The destination should point to it
809 819
810 820 $ cat share-dest1a/.hg/sharedpath; echo
811 821 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
812 822
813 823 The destination should have bookmarks
814 824
815 825 $ hg -R share-dest1a bookmarks
816 826 bookA 2:e5bfe23c0b47
817 827
818 828 The default path should be the remote, not the share
819 829
820 830 $ hg -R share-dest1a config paths.default
821 831 $TESTTMP/source1a
822 832
823 833 Clone with existing share dir should result in pull + share
824 834
825 835 $ hg --config share.pool=share clone source1b share-dest1b
826 836 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
827 837 searching for changes
828 838 adding changesets
829 839 adding manifests
830 840 adding file changes
831 841 added 4 changesets with 4 changes to 1 files (+4 heads)
832 842 adding remote bookmark head1
833 843 adding remote bookmark head2
834 844 new changesets 4a8dc1ab4c13:6bacf4683960
835 845 updating working directory
836 846 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
837 847
838 848 $ ls share
839 849 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
840 850
841 851 $ cat share-dest1b/.hg/sharedpath; echo
842 852 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
843 853
844 854 We only get bookmarks from the remote, not everything in the share
845 855
846 856 $ hg -R share-dest1b bookmarks
847 857 head1 3:4a8dc1ab4c13
848 858 head2 4:99f71071f117
849 859
850 860 Default path should be source, not share.
851 861
852 862 $ hg -R share-dest1b config paths.default
853 863 $TESTTMP/source1b
854 864
855 865 Checked out revision should be head of default branch
856 866
857 867 $ hg -R share-dest1b log -r .
858 868 changeset: 4:99f71071f117
859 869 bookmark: head2
860 870 parent: 0:b5f04eac9d8f
861 871 user: test
862 872 date: Thu Jan 01 00:00:00 1970 +0000
863 873 summary: head2
864 874
865 875
866 876 Clone from unrelated repo should result in new share
867 877
868 878 $ hg --config share.pool=share clone source2 share-dest2
869 879 (sharing from new pooled repository 22aeff664783fd44c6d9b435618173c118c3448e)
870 880 requesting all changes
871 881 adding changesets
872 882 adding manifests
873 883 adding file changes
874 884 added 2 changesets with 2 changes to 1 files
875 885 new changesets 22aeff664783:63cf6c3dba4a
876 886 searching for changes
877 887 no changes found
878 888 updating working directory
879 889 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
880 890
881 891 $ ls share
882 892 22aeff664783fd44c6d9b435618173c118c3448e
883 893 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
884 894
885 895 remote naming mode works as advertised
886 896
887 897 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1a share-remote1a
888 898 (sharing from new pooled repository 195bb1fcdb595c14a6c13e0269129ed78f6debde)
889 899 requesting all changes
890 900 adding changesets
891 901 adding manifests
892 902 adding file changes
893 903 added 3 changesets with 3 changes to 1 files
894 904 new changesets b5f04eac9d8f:e5bfe23c0b47
895 905 searching for changes
896 906 no changes found
897 907 adding remote bookmark bookA
898 908 updating working directory
899 909 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
900 910
901 911 $ ls shareremote
902 912 195bb1fcdb595c14a6c13e0269129ed78f6debde
903 913
904 914 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1b share-remote1b
905 915 (sharing from new pooled repository c0d4f83847ca2a873741feb7048a45085fd47c46)
906 916 requesting all changes
907 917 adding changesets
908 918 adding manifests
909 919 adding file changes
910 920 added 6 changesets with 6 changes to 1 files (+4 heads)
911 921 new changesets b5f04eac9d8f:6bacf4683960
912 922 searching for changes
913 923 no changes found
914 924 adding remote bookmark head1
915 925 adding remote bookmark head2
916 926 updating working directory
917 927 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
918 928
919 929 $ ls shareremote
920 930 195bb1fcdb595c14a6c13e0269129ed78f6debde
921 931 c0d4f83847ca2a873741feb7048a45085fd47c46
922 932
923 933 request to clone a single revision is respected in sharing mode
924 934
925 935 $ hg --config share.pool=sharerevs clone -r 4a8dc1ab4c13 source1b share-1arev
926 936 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
927 937 adding changesets
928 938 adding manifests
929 939 adding file changes
930 940 added 2 changesets with 2 changes to 1 files
931 941 new changesets b5f04eac9d8f:4a8dc1ab4c13
932 942 no changes found
933 943 adding remote bookmark head1
934 944 updating working directory
935 945 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
936 946
937 947 $ hg -R share-1arev log -G
938 948 @ changeset: 1:4a8dc1ab4c13
939 949 | bookmark: head1
940 950 | tag: tip
941 951 | user: test
942 952 | date: Thu Jan 01 00:00:00 1970 +0000
943 953 | summary: head1
944 954 |
945 955 o changeset: 0:b5f04eac9d8f
946 956 user: test
947 957 date: Thu Jan 01 00:00:00 1970 +0000
948 958 summary: initial
949 959
950 960
951 961 making another clone should only pull down requested rev
952 962
953 963 $ hg --config share.pool=sharerevs clone -r 99f71071f117 source1b share-1brev
954 964 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
955 965 searching for changes
956 966 adding changesets
957 967 adding manifests
958 968 adding file changes
959 969 added 1 changesets with 1 changes to 1 files (+1 heads)
960 970 adding remote bookmark head1
961 971 adding remote bookmark head2
962 972 new changesets 99f71071f117
963 973 updating working directory
964 974 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
965 975
966 976 $ hg -R share-1brev log -G
967 977 @ changeset: 2:99f71071f117
968 978 | bookmark: head2
969 979 | tag: tip
970 980 | parent: 0:b5f04eac9d8f
971 981 | user: test
972 982 | date: Thu Jan 01 00:00:00 1970 +0000
973 983 | summary: head2
974 984 |
975 985 | o changeset: 1:4a8dc1ab4c13
976 986 |/ bookmark: head1
977 987 | user: test
978 988 | date: Thu Jan 01 00:00:00 1970 +0000
979 989 | summary: head1
980 990 |
981 991 o changeset: 0:b5f04eac9d8f
982 992 user: test
983 993 date: Thu Jan 01 00:00:00 1970 +0000
984 994 summary: initial
985 995
986 996
987 997 Request to clone a single branch is respected in sharing mode
988 998
989 999 $ hg --config share.pool=sharebranch clone -b branch1 source1b share-1bbranch1
990 1000 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
991 1001 adding changesets
992 1002 adding manifests
993 1003 adding file changes
994 1004 added 2 changesets with 2 changes to 1 files
995 1005 new changesets b5f04eac9d8f:5f92a6c1a1b1
996 1006 no changes found
997 1007 updating working directory
998 1008 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
999 1009
1000 1010 $ hg -R share-1bbranch1 log -G
1001 1011 o changeset: 1:5f92a6c1a1b1
1002 1012 | branch: branch1
1003 1013 | tag: tip
1004 1014 | user: test
1005 1015 | date: Thu Jan 01 00:00:00 1970 +0000
1006 1016 | summary: branch1
1007 1017 |
1008 1018 @ changeset: 0:b5f04eac9d8f
1009 1019 user: test
1010 1020 date: Thu Jan 01 00:00:00 1970 +0000
1011 1021 summary: initial
1012 1022
1013 1023
1014 1024 $ hg --config share.pool=sharebranch clone -b branch2 source1b share-1bbranch2
1015 1025 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1016 1026 searching for changes
1017 1027 adding changesets
1018 1028 adding manifests
1019 1029 adding file changes
1020 1030 added 1 changesets with 1 changes to 1 files (+1 heads)
1021 1031 new changesets 6bacf4683960
1022 1032 updating working directory
1023 1033 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1024 1034
1025 1035 $ hg -R share-1bbranch2 log -G
1026 1036 o changeset: 2:6bacf4683960
1027 1037 | branch: branch2
1028 1038 | tag: tip
1029 1039 | parent: 0:b5f04eac9d8f
1030 1040 | user: test
1031 1041 | date: Thu Jan 01 00:00:00 1970 +0000
1032 1042 | summary: branch2
1033 1043 |
1034 1044 | o changeset: 1:5f92a6c1a1b1
1035 1045 |/ branch: branch1
1036 1046 | user: test
1037 1047 | date: Thu Jan 01 00:00:00 1970 +0000
1038 1048 | summary: branch1
1039 1049 |
1040 1050 @ changeset: 0:b5f04eac9d8f
1041 1051 user: test
1042 1052 date: Thu Jan 01 00:00:00 1970 +0000
1043 1053 summary: initial
1044 1054
1045 1055
1046 1056 -U is respected in share clone mode
1047 1057
1048 1058 $ hg --config share.pool=share clone -U source1a share-1anowc
1049 1059 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1050 1060 searching for changes
1051 1061 no changes found
1052 1062 adding remote bookmark bookA
1053 1063
1054 1064 $ ls share-1anowc
1055 1065
1056 1066 Test that auto sharing doesn't cause failure of "hg clone local remote"
1057 1067
1058 1068 $ cd $TESTTMP
1059 1069 $ hg -R a id -r 0
1060 1070 acb14030fe0a
1061 1071 $ hg id -R remote -r 0
1062 1072 abort: repository remote not found!
1063 1073 [255]
1064 1074 $ hg --config share.pool=share -q clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" a ssh://user@dummy/remote
1065 1075 $ hg -R remote id -r 0
1066 1076 acb14030fe0a
1067 1077
1068 1078 Cloning into pooled storage doesn't race (issue5104)
1069 1079
1070 1080 $ HGPOSTLOCKDELAY=2.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace1 > race1.log 2>&1 &
1071 1081 $ HGPRELOCKDELAY=1.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace2 > race2.log 2>&1
1072 1082 $ wait
1073 1083
1074 1084 $ hg -R share-destrace1 log -r tip
1075 1085 changeset: 2:e5bfe23c0b47
1076 1086 bookmark: bookA
1077 1087 tag: tip
1078 1088 user: test
1079 1089 date: Thu Jan 01 00:00:00 1970 +0000
1080 1090 summary: 1a
1081 1091
1082 1092
1083 1093 $ hg -R share-destrace2 log -r tip
1084 1094 changeset: 2:e5bfe23c0b47
1085 1095 bookmark: bookA
1086 1096 tag: tip
1087 1097 user: test
1088 1098 date: Thu Jan 01 00:00:00 1970 +0000
1089 1099 summary: 1a
1090 1100
1091 1101 One repo should be new, the other should be shared from the pool. We
1092 1102 don't care which is which, so we just make sure we always print the
1093 1103 one containing "new pooled" first, then one one containing "existing
1094 1104 pooled".
1095 1105
1096 1106 $ (grep 'new pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1097 1107 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1098 1108 requesting all changes
1099 1109 adding changesets
1100 1110 adding manifests
1101 1111 adding file changes
1102 1112 added 3 changesets with 3 changes to 1 files
1103 1113 new changesets b5f04eac9d8f:e5bfe23c0b47
1104 1114 searching for changes
1105 1115 no changes found
1106 1116 adding remote bookmark bookA
1107 1117 updating working directory
1108 1118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1109 1119
1110 1120 $ (grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1111 1121 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1112 1122 searching for changes
1113 1123 no changes found
1114 1124 adding remote bookmark bookA
1115 1125 updating working directory
1116 1126 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1117 1127
1118 1128 SEC: check for unsafe ssh url
1119 1129
1120 1130 $ cat >> $HGRCPATH << EOF
1121 1131 > [ui]
1122 1132 > ssh = sh -c "read l; read l; read l"
1123 1133 > EOF
1124 1134
1125 1135 $ hg clone 'ssh://-oProxyCommand=touch${IFS}owned/path'
1126 1136 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1127 1137 [255]
1128 1138 $ hg clone 'ssh://%2DoProxyCommand=touch${IFS}owned/path'
1129 1139 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1130 1140 [255]
1131 1141 $ hg clone 'ssh://fakehost|touch%20owned/path'
1132 1142 abort: no suitable response from remote hg!
1133 1143 [255]
1134 1144 $ hg clone 'ssh://fakehost%7Ctouch%20owned/path'
1135 1145 abort: no suitable response from remote hg!
1136 1146 [255]
1137 1147
1138 1148 $ hg clone 'ssh://-oProxyCommand=touch owned%20foo@example.com/nonexistent/path'
1139 1149 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned foo@example.com/nonexistent/path'
1140 1150 [255]
1141 1151
1142 1152 #if windows
1143 1153 $ hg clone "ssh://%26touch%20owned%20/" --debug
1144 1154 running sh -c "read l; read l; read l" "&touch owned " "hg -R . serve --stdio"
1155 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1145 1156 sending hello command
1146 1157 sending between command
1147 1158 abort: no suitable response from remote hg!
1148 1159 [255]
1149 1160 $ hg clone "ssh://example.com:%26touch%20owned%20/" --debug
1150 1161 running sh -c "read l; read l; read l" -p "&touch owned " example.com "hg -R . serve --stdio"
1162 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1151 1163 sending hello command
1152 1164 sending between command
1153 1165 abort: no suitable response from remote hg!
1154 1166 [255]
1155 1167 #else
1156 1168 $ hg clone "ssh://%3btouch%20owned%20/" --debug
1157 1169 running sh -c "read l; read l; read l" ';touch owned ' 'hg -R . serve --stdio'
1170 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1158 1171 sending hello command
1159 1172 sending between command
1160 1173 abort: no suitable response from remote hg!
1161 1174 [255]
1162 1175 $ hg clone "ssh://example.com:%3btouch%20owned%20/" --debug
1163 1176 running sh -c "read l; read l; read l" -p ';touch owned ' example.com 'hg -R . serve --stdio'
1177 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1164 1178 sending hello command
1165 1179 sending between command
1166 1180 abort: no suitable response from remote hg!
1167 1181 [255]
1168 1182 #endif
1169 1183
1170 1184 $ hg clone "ssh://v-alid.example.com/" --debug
1171 1185 running sh -c "read l; read l; read l" v-alid\.example\.com ['"]hg -R \. serve --stdio['"] (re)
1186 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1172 1187 sending hello command
1173 1188 sending between command
1174 1189 abort: no suitable response from remote hg!
1175 1190 [255]
1176 1191
1177 1192 We should not have created a file named owned - if it exists, the
1178 1193 attack succeeded.
1179 1194 $ if test -f owned; then echo 'you got owned'; fi
1180 1195
1181 1196 Cloning without fsmonitor enabled does not print a warning for small repos
1182 1197
1183 1198 $ hg clone a fsmonitor-default
1184 1199 updating to bookmark @ on branch stable
1185 1200 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1186 1201
1187 1202 Lower the warning threshold to simulate a large repo
1188 1203
1189 1204 $ cat >> $HGRCPATH << EOF
1190 1205 > [fsmonitor]
1191 1206 > warn_update_file_count = 2
1192 1207 > EOF
1193 1208
1194 1209 We should see a warning about no fsmonitor on supported platforms
1195 1210
1196 1211 #if linuxormacos no-fsmonitor
1197 1212 $ hg clone a nofsmonitor
1198 1213 updating to bookmark @ on branch stable
1199 1214 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor")
1200 1215 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1201 1216 #else
1202 1217 $ hg clone a nofsmonitor
1203 1218 updating to bookmark @ on branch stable
1204 1219 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1205 1220 #endif
1206 1221
1207 1222 We should not see warning about fsmonitor when it is enabled
1208 1223
1209 1224 #if fsmonitor
1210 1225 $ hg clone a fsmonitor-enabled
1211 1226 updating to bookmark @ on branch stable
1212 1227 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1213 1228 #endif
1214 1229
1215 1230 We can disable the fsmonitor warning
1216 1231
1217 1232 $ hg --config fsmonitor.warn_when_unused=false clone a fsmonitor-disable-warning
1218 1233 updating to bookmark @ on branch stable
1219 1234 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1220 1235
1221 1236 Loaded fsmonitor but disabled in config should still print warning
1222 1237
1223 1238 #if linuxormacos fsmonitor
1224 1239 $ hg --config fsmonitor.mode=off clone a fsmonitor-mode-off
1225 1240 updating to bookmark @ on branch stable
1226 1241 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (fsmonitor !)
1227 1242 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1228 1243 #endif
1229 1244
1230 1245 Warning not printed if working directory isn't empty
1231 1246
1232 1247 $ hg -q clone a fsmonitor-update
1233 1248 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (?)
1234 1249 $ cd fsmonitor-update
1235 1250 $ hg up acb14030fe0a
1236 1251 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1237 1252 (leaving bookmark @)
1238 1253 $ hg up cf0fe1914066
1239 1254 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1240 1255
1241 1256 `hg update` from null revision also prints
1242 1257
1243 1258 $ hg up null
1244 1259 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1245 1260
1246 1261 #if linuxormacos no-fsmonitor
1247 1262 $ hg up cf0fe1914066
1248 1263 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor")
1249 1264 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1250 1265 #else
1251 1266 $ hg up cf0fe1914066
1252 1267 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1253 1268 #endif
1254 1269
1255 1270 $ cd ..
1256 1271
@@ -1,454 +1,464 b''
1 #testcases sshv1 sshv2
2
3 #if sshv2
4 $ cat >> $HGRCPATH << EOF
5 > [experimental]
6 > sshpeer.advertise-v2 = true
7 > sshserver.support-v2 = true
8 > EOF
9 #endif
10
1 11 This file contains testcases that tend to be related to the wire protocol part
2 12 of largefiles.
3 13
4 14 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
5 15 $ mkdir "${USERCACHE}"
6 16 $ cat >> $HGRCPATH <<EOF
7 17 > [extensions]
8 18 > largefiles=
9 19 > purge=
10 20 > rebase=
11 21 > transplant=
12 22 > [phases]
13 23 > publish=False
14 24 > [largefiles]
15 25 > minsize=2
16 26 > patterns=glob:**.dat
17 27 > usercache=${USERCACHE}
18 28 > [web]
19 29 > allow_archive = zip
20 30 > [hooks]
21 31 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
22 32 > EOF
23 33
24 34
25 35 #if serve
26 36 vanilla clients not locked out from largefiles servers on vanilla repos
27 37 $ mkdir r1
28 38 $ cd r1
29 39 $ hg init
30 40 $ echo c1 > f1
31 41 $ hg add f1
32 42 $ hg commit -m "m1"
33 43 Invoking status precommit hook
34 44 A f1
35 45 $ cd ..
36 46 $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid
37 47 $ cat hg.pid >> $DAEMON_PIDS
38 48 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2
39 49 requesting all changes
40 50 adding changesets
41 51 adding manifests
42 52 adding file changes
43 53 added 1 changesets with 1 changes to 1 files
44 54 new changesets b6eb3a2e2efe
45 55 updating to branch default
46 56 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 57
48 58 largefiles clients still work with vanilla servers
49 59 $ hg serve --config extensions.largefiles=! -R r1 -d -p $HGPORT1 --pid-file hg.pid
50 60 $ cat hg.pid >> $DAEMON_PIDS
51 61 $ hg clone http://localhost:$HGPORT1 r3
52 62 requesting all changes
53 63 adding changesets
54 64 adding manifests
55 65 adding file changes
56 66 added 1 changesets with 1 changes to 1 files
57 67 new changesets b6eb3a2e2efe
58 68 updating to branch default
59 69 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
60 70 #endif
61 71
62 72 vanilla clients locked out from largefiles http repos
63 73 $ mkdir r4
64 74 $ cd r4
65 75 $ hg init
66 76 $ echo c1 > f1
67 77 $ hg add --large f1
68 78 $ hg commit -m "m1"
69 79 Invoking status precommit hook
70 80 A f1
71 81 $ cd ..
72 82
73 83 largefiles can be pushed locally (issue3583)
74 84 $ hg init dest
75 85 $ cd r4
76 86 $ hg outgoing ../dest
77 87 comparing with ../dest
78 88 searching for changes
79 89 changeset: 0:639881c12b4c
80 90 tag: tip
81 91 user: test
82 92 date: Thu Jan 01 00:00:00 1970 +0000
83 93 summary: m1
84 94
85 95 $ hg push ../dest
86 96 pushing to ../dest
87 97 searching for changes
88 98 adding changesets
89 99 adding manifests
90 100 adding file changes
91 101 added 1 changesets with 1 changes to 1 files
92 102
93 103 exit code with nothing outgoing (issue3611)
94 104 $ hg outgoing ../dest
95 105 comparing with ../dest
96 106 searching for changes
97 107 no changes found
98 108 [1]
99 109 $ cd ..
100 110
101 111 #if serve
102 112 $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
103 113 $ cat hg.pid >> $DAEMON_PIDS
104 114 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
105 115 abort: remote error:
106 116
107 117 This repository uses the largefiles extension.
108 118
109 119 Please enable it in your Mercurial config file.
110 120 [255]
111 121
112 122 used all HGPORTs, kill all daemons
113 123 $ killdaemons.py
114 124 #endif
115 125
116 126 vanilla clients locked out from largefiles ssh repos
117 127 $ hg --config extensions.largefiles=! clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5
118 128 remote:
119 129 remote: This repository uses the largefiles extension.
120 130 remote:
121 131 remote: Please enable it in your Mercurial config file.
122 132 remote:
123 133 remote: -
124 134 abort: remote error
125 135 (check previous remote output)
126 136 [255]
127 137
128 138 #if serve
129 139
130 140 largefiles clients refuse to push largefiles repos to vanilla servers
131 141 $ mkdir r6
132 142 $ cd r6
133 143 $ hg init
134 144 $ echo c1 > f1
135 145 $ hg add f1
136 146 $ hg commit -m "m1"
137 147 Invoking status precommit hook
138 148 A f1
139 149 $ cat >> .hg/hgrc <<!
140 150 > [web]
141 151 > push_ssl = false
142 152 > allow_push = *
143 153 > !
144 154 $ cd ..
145 155 $ hg clone r6 r7
146 156 updating to branch default
147 157 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
148 158 $ cd r7
149 159 $ echo c2 > f2
150 160 $ hg add --large f2
151 161 $ hg commit -m "m2"
152 162 Invoking status precommit hook
153 163 A f2
154 164 $ hg verify --large
155 165 checking changesets
156 166 checking manifests
157 167 crosschecking files in changesets and manifests
158 168 checking files
159 169 2 files, 2 changesets, 2 total revisions
160 170 searching 1 changesets for largefiles
161 171 verified existence of 1 revisions of 1 largefiles
162 172 $ hg serve --config extensions.largefiles=! -R ../r6 -d -p $HGPORT --pid-file ../hg.pid
163 173 $ cat ../hg.pid >> $DAEMON_PIDS
164 174 $ hg push http://localhost:$HGPORT
165 175 pushing to http://localhost:$HGPORT/
166 176 searching for changes
167 177 abort: http://localhost:$HGPORT/ does not appear to be a largefile store
168 178 [255]
169 179 $ cd ..
170 180
171 181 putlfile errors are shown (issue3123)
172 182 Corrupt the cached largefile in r7 and move it out of the servers usercache
173 183 $ mv r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 .
174 184 $ echo 'client side corruption' > r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
175 185 $ rm "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8"
176 186 $ hg init empty
177 187 $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \
178 188 > --config 'web.allow_push=*' --config web.push_ssl=False
179 189 $ cat hg.pid >> $DAEMON_PIDS
180 190 $ hg push -R r7 http://localhost:$HGPORT1
181 191 pushing to http://localhost:$HGPORT1/
182 192 searching for changes
183 193 remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
184 194 abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/
185 195 [255]
186 196 $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
187 197 Push of file that exists on server but is corrupted - magic healing would be nice ... but too magic
188 198 $ echo "server side corruption" > empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
189 199 $ hg push -R r7 http://localhost:$HGPORT1
190 200 pushing to http://localhost:$HGPORT1/
191 201 searching for changes
192 202 remote: adding changesets
193 203 remote: adding manifests
194 204 remote: adding file changes
195 205 remote: added 2 changesets with 2 changes to 2 files
196 206 $ cat empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
197 207 server side corruption
198 208 $ rm -rf empty
199 209
200 210 Push a largefiles repository to a served empty repository
201 211 $ hg init r8
202 212 $ echo c3 > r8/f1
203 213 $ hg add --large r8/f1 -R r8
204 214 $ hg commit -m "m1" -R r8
205 215 Invoking status precommit hook
206 216 A f1
207 217 $ hg init empty
208 218 $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \
209 219 > --config 'web.allow_push=*' --config web.push_ssl=False
210 220 $ cat hg.pid >> $DAEMON_PIDS
211 221 $ rm "${USERCACHE}"/*
212 222 $ hg push -R r8 http://localhost:$HGPORT2/#default
213 223 pushing to http://localhost:$HGPORT2/
214 224 searching for changes
215 225 remote: adding changesets
216 226 remote: adding manifests
217 227 remote: adding file changes
218 228 remote: added 1 changesets with 1 changes to 1 files
219 229 $ [ -f "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
220 230 $ [ -f empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
221 231
222 232 Clone over http, no largefiles pulled on clone.
223 233
224 234 $ hg clone http://localhost:$HGPORT2/#default http-clone -U
225 235 adding changesets
226 236 adding manifests
227 237 adding file changes
228 238 added 1 changesets with 1 changes to 1 files
229 239 new changesets cf03e5bb9936
230 240
231 241 Archive contains largefiles
232 242 >>> import os
233 243 >>> import urllib2
234 244 >>> u = 'http://localhost:%s/archive/default.zip' % os.environ['HGPORT2']
235 245 >>> with open('archive.zip', 'w') as f:
236 246 ... f.write(urllib2.urlopen(u).read())
237 247 $ unzip -t archive.zip
238 248 Archive: archive.zip
239 249 testing: empty-default/.hg_archival.txt*OK (glob)
240 250 testing: empty-default/f1*OK (glob)
241 251 No errors detected in compressed data of archive.zip.
242 252
243 253 test 'verify' with remotestore:
244 254
245 255 $ rm "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90
246 256 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
247 257 $ hg -R http-clone verify --large --lfa
248 258 checking changesets
249 259 checking manifests
250 260 crosschecking files in changesets and manifests
251 261 checking files
252 262 1 files, 1 changesets, 1 total revisions
253 263 searching 1 changesets for largefiles
254 264 changeset 0:cf03e5bb9936: f1 missing
255 265 verified existence of 1 revisions of 1 largefiles
256 266 [1]
257 267 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
258 268 $ hg -R http-clone -q verify --large --lfa
259 269
260 270 largefiles pulled on update - a largefile missing on the server:
261 271 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
262 272 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
263 273 getting changed largefiles
264 274 f1: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 not available from http://localhost:$HGPORT2/
265 275 0 largefiles updated, 0 removed
266 276 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
267 277 $ hg -R http-clone st
268 278 ! f1
269 279 $ hg -R http-clone up -Cqr null
270 280
271 281 largefiles pulled on update - a largefile corrupted on the server:
272 282 $ echo corruption > empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
273 283 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
274 284 getting changed largefiles
275 285 f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27)
276 286 0 largefiles updated, 0 removed
277 287 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
278 288 $ hg -R http-clone st
279 289 ! f1
280 290 $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
281 291 $ [ ! -f http-clone/f1 ]
282 292 $ [ ! -f http-clone-usercache ]
283 293 $ hg -R http-clone verify --large --lfc
284 294 checking changesets
285 295 checking manifests
286 296 crosschecking files in changesets and manifests
287 297 checking files
288 298 1 files, 1 changesets, 1 total revisions
289 299 searching 1 changesets for largefiles
290 300 verified contents of 1 revisions of 1 largefiles
291 301 $ hg -R http-clone up -Cqr null
292 302
293 303 largefiles pulled on update - no server side problems:
294 304 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
295 305 $ hg -R http-clone --debug up --config largefiles.usercache=http-clone-usercache --config progress.debug=true
296 306 resolving manifests
297 307 branchmerge: False, force: False, partial: False
298 308 ancestor: 000000000000, local: 000000000000+, remote: cf03e5bb9936
299 309 .hglf/f1: remote created -> g
300 310 getting .hglf/f1
301 311 updating: .hglf/f1 1/1 files (100.00%)
302 312 getting changed largefiles
303 313 using http://localhost:$HGPORT2/
304 314 sending capabilities command
305 315 sending batch command
306 316 getting largefiles: 0/1 files (0.00%)
307 317 getting f1:02a439e5c31c526465ab1a0ca1f431f76b827b90
308 318 sending getlfile command
309 319 found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store
310 320 1 largefiles updated, 0 removed
311 321 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
312 322
313 323 $ ls http-clone-usercache/*
314 324 http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90
315 325
316 326 $ rm -rf empty http-clone*
317 327
318 328 used all HGPORTs, kill all daemons
319 329 $ killdaemons.py
320 330
321 331 largefiles should batch verify remote calls
322 332
323 333 $ hg init batchverifymain
324 334 $ cd batchverifymain
325 335 $ echo "aaa" >> a
326 336 $ hg add --large a
327 337 $ hg commit -m "a"
328 338 Invoking status precommit hook
329 339 A a
330 340 $ echo "bbb" >> b
331 341 $ hg add --large b
332 342 $ hg commit -m "b"
333 343 Invoking status precommit hook
334 344 A b
335 345 $ cd ..
336 346 $ hg serve -R batchverifymain -d -p $HGPORT --pid-file hg.pid \
337 347 > -A access.log
338 348 $ cat hg.pid >> $DAEMON_PIDS
339 349 $ hg clone --noupdate http://localhost:$HGPORT batchverifyclone
340 350 requesting all changes
341 351 adding changesets
342 352 adding manifests
343 353 adding file changes
344 354 added 2 changesets with 2 changes to 2 files
345 355 new changesets 567253b0f523:04d19c27a332
346 356 $ hg -R batchverifyclone verify --large --lfa
347 357 checking changesets
348 358 checking manifests
349 359 crosschecking files in changesets and manifests
350 360 checking files
351 361 2 files, 2 changesets, 2 total revisions
352 362 searching 2 changesets for largefiles
353 363 verified existence of 2 revisions of 2 largefiles
354 364 $ tail -1 access.log
355 365 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=statlfile+sha%3D972a1a11f19934401291cc99117ec614933374ce%3Bstatlfile+sha%3Dc801c9cfe94400963fcb683246217d5db77f9a9a x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
356 366 $ hg -R batchverifyclone update
357 367 getting changed largefiles
358 368 2 largefiles updated, 0 removed
359 369 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
360 370
361 371 Clear log file before next test
362 372
363 373 $ printf "" > access.log
364 374
365 375 Verify should check file on remote server only when file is not
366 376 available locally.
367 377
368 378 $ echo "ccc" >> batchverifymain/c
369 379 $ hg -R batchverifymain status
370 380 ? c
371 381 $ hg -R batchverifymain add --large batchverifymain/c
372 382 $ hg -R batchverifymain commit -m "c"
373 383 Invoking status precommit hook
374 384 A c
375 385 $ hg -R batchverifyclone pull
376 386 pulling from http://localhost:$HGPORT/
377 387 searching for changes
378 388 adding changesets
379 389 adding manifests
380 390 adding file changes
381 391 added 1 changesets with 1 changes to 1 files
382 392 new changesets 6bba8cb6935d
383 393 (run 'hg update' to get a working copy)
384 394 $ hg -R batchverifyclone verify --lfa
385 395 checking changesets
386 396 checking manifests
387 397 crosschecking files in changesets and manifests
388 398 checking files
389 399 3 files, 3 changesets, 3 total revisions
390 400 searching 3 changesets for largefiles
391 401 verified existence of 3 revisions of 3 largefiles
392 402 $ tail -1 access.log
393 403 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=statlfile+sha%3Dc8559c3c9cfb42131794b7d8009230403b9b454c x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
394 404
395 405 $ killdaemons.py
396 406
397 407 largefiles should not ask for password again after successful authorization
398 408
399 409 $ hg init credentialmain
400 410 $ cd credentialmain
401 411 $ echo "aaa" >> a
402 412 $ hg add --large a
403 413 $ hg commit -m "a"
404 414 Invoking status precommit hook
405 415 A a
406 416
407 417 Before running server clear the user cache to force clone to download
408 418 a large file from the server rather than to get it from the cache
409 419
410 420 $ rm "${USERCACHE}"/*
411 421
412 422 $ cd ..
413 423 $ cat << EOT > userpass.py
414 424 > import base64
415 425 > from mercurial.hgweb import common
416 426 > def perform_authentication(hgweb, req, op):
417 427 > auth = req.env.get('HTTP_AUTHORIZATION')
418 428 > if not auth:
419 429 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who',
420 430 > [('WWW-Authenticate', 'Basic Realm="mercurial"')])
421 431 > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
422 432 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')
423 433 > def extsetup():
424 434 > common.permhooks.insert(0, perform_authentication)
425 435 > EOT
426 436 $ hg serve --config extensions.x=userpass.py -R credentialmain \
427 437 > -d -p $HGPORT --pid-file hg.pid -A access.log
428 438 $ cat hg.pid >> $DAEMON_PIDS
429 439 $ cat << EOF > get_pass.py
430 440 > import getpass
431 441 > def newgetpass(arg):
432 442 > return "pass"
433 443 > getpass.getpass = newgetpass
434 444 > EOF
435 445 $ hg clone --config ui.interactive=true --config extensions.getpass=get_pass.py \
436 446 > http://user@localhost:$HGPORT credentialclone
437 447 requesting all changes
438 448 http authorization required for http://localhost:$HGPORT/
439 449 realm: mercurial
440 450 user: user
441 451 password: adding changesets
442 452 adding manifests
443 453 adding file changes
444 454 added 1 changesets with 1 changes to 1 files
445 455 new changesets 567253b0f523
446 456 updating to branch default
447 457 getting changed largefiles
448 458 1 largefiles updated, 0 removed
449 459 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
450 460
451 461 $ killdaemons.py
452 462 $ rm hg.pid access.log
453 463
454 464 #endif
@@ -1,136 +1,146 b''
1 1 #require serve
2 2
3 #testcases sshv1 sshv2
4
5 #if sshv2
6 $ cat >> $HGRCPATH << EOF
7 > [experimental]
8 > sshpeer.advertise-v2 = true
9 > sshserver.support-v2 = true
10 > EOF
11 #endif
12
3 13 $ hg init test
4 14 $ cd test
5 15
6 16 $ echo foo>foo
7 17 $ hg addremove
8 18 adding foo
9 19 $ hg commit -m 1
10 20
11 21 $ hg verify
12 22 checking changesets
13 23 checking manifests
14 24 crosschecking files in changesets and manifests
15 25 checking files
16 26 1 files, 1 changesets, 1 total revisions
17 27
18 28 $ hg serve -p $HGPORT -d --pid-file=hg.pid
19 29 $ cat hg.pid >> $DAEMON_PIDS
20 30 $ cd ..
21 31
22 32 $ hg clone --pull http://foo:bar@localhost:$HGPORT/ copy
23 33 requesting all changes
24 34 adding changesets
25 35 adding manifests
26 36 adding file changes
27 37 added 1 changesets with 1 changes to 1 files
28 38 new changesets 340e38bdcde4
29 39 updating to branch default
30 40 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
31 41
32 42 $ cd copy
33 43 $ hg verify
34 44 checking changesets
35 45 checking manifests
36 46 crosschecking files in changesets and manifests
37 47 checking files
38 48 1 files, 1 changesets, 1 total revisions
39 49
40 50 $ hg co
41 51 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 52 $ cat foo
43 53 foo
44 54
45 55 $ hg manifest --debug
46 56 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo
47 57
48 58 $ hg pull
49 59 pulling from http://foo@localhost:$HGPORT/
50 60 searching for changes
51 61 no changes found
52 62
53 63 $ hg rollback --dry-run --verbose
54 64 repository tip rolled back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
55 65
56 66 Test pull of non-existing 20 character revision specification, making sure plain ascii identifiers
57 67 not are encoded like a node:
58 68
59 69 $ hg pull -r 'xxxxxxxxxxxxxxxxxxxy'
60 70 pulling from http://foo@localhost:$HGPORT/
61 71 abort: unknown revision 'xxxxxxxxxxxxxxxxxxxy'!
62 72 [255]
63 73 $ hg pull -r 'xxxxxxxxxxxxxxxxxx y'
64 74 pulling from http://foo@localhost:$HGPORT/
65 75 abort: unknown revision '7878787878787878787878787878787878782079'!
66 76 [255]
67 77
68 78 Issue622: hg init && hg pull -u URL doesn't checkout default branch
69 79
70 80 $ cd ..
71 81 $ hg init empty
72 82 $ cd empty
73 83 $ hg pull -u ../test
74 84 pulling from ../test
75 85 requesting all changes
76 86 adding changesets
77 87 adding manifests
78 88 adding file changes
79 89 added 1 changesets with 1 changes to 1 files
80 90 new changesets 340e38bdcde4
81 91 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
82 92
83 93 Test 'file:' uri handling:
84 94
85 95 $ hg pull -q file://../test-does-not-exist
86 96 abort: file:// URLs can only refer to localhost
87 97 [255]
88 98
89 99 $ hg pull -q file://../test
90 100 abort: file:// URLs can only refer to localhost
91 101 [255]
92 102
93 103 MSYS changes 'file:' into 'file;'
94 104
95 105 #if no-msys
96 106 $ hg pull -q file:../test # no-msys
97 107 #endif
98 108
99 109 It's tricky to make file:// URLs working on every platform with
100 110 regular shell commands.
101 111
102 112 $ URL=`$PYTHON -c "import os; print 'file://foobar' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test'"`
103 113 $ hg pull -q "$URL"
104 114 abort: file:// URLs can only refer to localhost
105 115 [255]
106 116
107 117 $ URL=`$PYTHON -c "import os; print 'file://localhost' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test'"`
108 118 $ hg pull -q "$URL"
109 119
110 120 SEC: check for unsafe ssh url
111 121
112 122 $ cat >> $HGRCPATH << EOF
113 123 > [ui]
114 124 > ssh = sh -c "read l; read l; read l"
115 125 > EOF
116 126
117 127 $ hg pull 'ssh://-oProxyCommand=touch${IFS}owned/path'
118 128 pulling from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path
119 129 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
120 130 [255]
121 131 $ hg pull 'ssh://%2DoProxyCommand=touch${IFS}owned/path'
122 132 pulling from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path
123 133 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
124 134 [255]
125 135 $ hg pull 'ssh://fakehost|touch${IFS}owned/path'
126 136 pulling from ssh://fakehost%7Ctouch%24%7BIFS%7Downed/path
127 137 abort: no suitable response from remote hg!
128 138 [255]
129 139 $ hg pull 'ssh://fakehost%7Ctouch%20owned/path'
130 140 pulling from ssh://fakehost%7Ctouch%20owned/path
131 141 abort: no suitable response from remote hg!
132 142 [255]
133 143
134 144 $ [ ! -f owned ] || echo 'you got owned'
135 145
136 146 $ cd ..
@@ -1,565 +1,577 b''
1 1 This test is a duplicate of 'test-http.t' feel free to factor out
2 2 parts that are not bundle1/bundle2 specific.
3 3
4 #testcases sshv1 sshv2
5
6 #if sshv2
7 $ cat >> $HGRCPATH << EOF
8 > [experimental]
9 > sshpeer.advertise-v2 = true
10 > sshserver.support-v2 = true
11 > EOF
12 #endif
13
4 14 $ cat << EOF >> $HGRCPATH
5 15 > [devel]
6 16 > # This test is dedicated to interaction through old bundle
7 17 > legacy.exchange = bundle1
8 18 > [format] # temporary settings
9 19 > usegeneraldelta=yes
10 20 > EOF
11 21
12 22
13 23 This test tries to exercise the ssh functionality with a dummy script
14 24
15 25 creating 'remote' repo
16 26
17 27 $ hg init remote
18 28 $ cd remote
19 29 $ echo this > foo
20 30 $ echo this > fooO
21 31 $ hg ci -A -m "init" foo fooO
22 32
23 33 insert a closed branch (issue4428)
24 34
25 35 $ hg up null
26 36 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
27 37 $ hg branch closed
28 38 marked working directory as branch closed
29 39 (branches are permanent and global, did you want a bookmark?)
30 40 $ hg ci -mc0
31 41 $ hg ci --close-branch -mc1
32 42 $ hg up -q default
33 43
34 44 configure for serving
35 45
36 46 $ cat <<EOF > .hg/hgrc
37 47 > [server]
38 48 > uncompressed = True
39 49 >
40 50 > [hooks]
41 51 > changegroup = sh -c "printenv.py changegroup-in-remote 0 ../dummylog"
42 52 > EOF
43 53 $ cd ..
44 54
45 55 repo not found error
46 56
47 57 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
48 58 remote: abort: repository nonexistent not found!
49 59 abort: no suitable response from remote hg!
50 60 [255]
51 61
52 62 non-existent absolute path
53 63
54 64 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy//`pwd`/nonexistent local
55 65 remote: abort: repository /$TESTTMP/nonexistent not found!
56 66 abort: no suitable response from remote hg!
57 67 [255]
58 68
59 69 clone remote via stream
60 70
61 71 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/remote local-stream
62 72 streaming all changes
63 73 4 files to transfer, 602 bytes of data
64 74 transferred 602 bytes in * seconds (*) (glob)
65 75 searching for changes
66 76 no changes found
67 77 updating to branch default
68 78 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 79 $ cd local-stream
70 80 $ hg verify
71 81 checking changesets
72 82 checking manifests
73 83 crosschecking files in changesets and manifests
74 84 checking files
75 85 2 files, 3 changesets, 2 total revisions
76 86 $ hg branches
77 87 default 0:1160648e36ce
78 88 $ cd ..
79 89
80 90 clone bookmarks via stream
81 91
82 92 $ hg -R local-stream book mybook
83 93 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
84 94 streaming all changes
85 95 4 files to transfer, 602 bytes of data
86 96 transferred 602 bytes in * seconds (*) (glob)
87 97 searching for changes
88 98 no changes found
89 99 updating to branch default
90 100 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 101 $ cd stream2
92 102 $ hg book
93 103 mybook 0:1160648e36ce
94 104 $ cd ..
95 105 $ rm -rf local-stream stream2
96 106
97 107 clone remote via pull
98 108
99 109 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
100 110 requesting all changes
101 111 adding changesets
102 112 adding manifests
103 113 adding file changes
104 114 added 3 changesets with 2 changes to 2 files
105 115 new changesets 1160648e36ce:ad076bfb429d
106 116 updating to branch default
107 117 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 118
109 119 verify
110 120
111 121 $ cd local
112 122 $ hg verify
113 123 checking changesets
114 124 checking manifests
115 125 crosschecking files in changesets and manifests
116 126 checking files
117 127 2 files, 3 changesets, 2 total revisions
118 128 $ cat >> .hg/hgrc <<EOF
119 129 > [hooks]
120 130 > changegroup = sh -c "printenv.py changegroup-in-local 0 ../dummylog"
121 131 > EOF
122 132
123 133 empty default pull
124 134
125 135 $ hg paths
126 136 default = ssh://user@dummy/remote
127 137 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
128 138 pulling from ssh://user@dummy/remote
129 139 searching for changes
130 140 no changes found
131 141
132 142 pull from wrong ssh URL
133 143
134 144 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist
135 145 pulling from ssh://user@dummy/doesnotexist
136 146 remote: abort: repository doesnotexist not found!
137 147 abort: no suitable response from remote hg!
138 148 [255]
139 149
140 150 local change
141 151
142 152 $ echo bleah > foo
143 153 $ hg ci -m "add"
144 154
145 155 updating rc
146 156
147 157 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
148 158 $ echo "[ui]" >> .hg/hgrc
149 159 $ echo "ssh = \"$PYTHON\" \"$TESTDIR/dummyssh\"" >> .hg/hgrc
150 160
151 161 find outgoing
152 162
153 163 $ hg out ssh://user@dummy/remote
154 164 comparing with ssh://user@dummy/remote
155 165 searching for changes
156 166 changeset: 3:a28a9d1a809c
157 167 tag: tip
158 168 parent: 0:1160648e36ce
159 169 user: test
160 170 date: Thu Jan 01 00:00:00 1970 +0000
161 171 summary: add
162 172
163 173
164 174 find incoming on the remote side
165 175
166 176 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/local
167 177 comparing with ssh://user@dummy/local
168 178 searching for changes
169 179 changeset: 3:a28a9d1a809c
170 180 tag: tip
171 181 parent: 0:1160648e36ce
172 182 user: test
173 183 date: Thu Jan 01 00:00:00 1970 +0000
174 184 summary: add
175 185
176 186
177 187 find incoming on the remote side (using absolute path)
178 188
179 189 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/`pwd`"
180 190 comparing with ssh://user@dummy/$TESTTMP/local
181 191 searching for changes
182 192 changeset: 3:a28a9d1a809c
183 193 tag: tip
184 194 parent: 0:1160648e36ce
185 195 user: test
186 196 date: Thu Jan 01 00:00:00 1970 +0000
187 197 summary: add
188 198
189 199
190 200 push
191 201
192 202 $ hg push
193 203 pushing to ssh://user@dummy/remote
194 204 searching for changes
195 205 remote: adding changesets
196 206 remote: adding manifests
197 207 remote: adding file changes
198 208 remote: added 1 changesets with 1 changes to 1 files
199 209 $ cd ../remote
200 210
201 211 check remote tip
202 212
203 213 $ hg tip
204 214 changeset: 3:a28a9d1a809c
205 215 tag: tip
206 216 parent: 0:1160648e36ce
207 217 user: test
208 218 date: Thu Jan 01 00:00:00 1970 +0000
209 219 summary: add
210 220
211 221 $ hg verify
212 222 checking changesets
213 223 checking manifests
214 224 crosschecking files in changesets and manifests
215 225 checking files
216 226 2 files, 4 changesets, 3 total revisions
217 227 $ hg cat -r tip foo
218 228 bleah
219 229 $ echo z > z
220 230 $ hg ci -A -m z z
221 231 created new head
222 232
223 233 test pushkeys and bookmarks
224 234
225 235 $ cd ../local
226 236 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
227 237 bookmarks
228 238 namespaces
229 239 phases
230 240 $ hg book foo -r 0
231 241 $ hg out -B
232 242 comparing with ssh://user@dummy/remote
233 243 searching for changed bookmarks
234 244 foo 1160648e36ce
235 245 $ hg push -B foo
236 246 pushing to ssh://user@dummy/remote
237 247 searching for changes
238 248 no changes found
239 249 exporting bookmark foo
240 250 [1]
241 251 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote bookmarks
242 252 foo 1160648e36cec0054048a7edc4110c6f84fde594
243 253 $ hg book -f foo
244 254 $ hg push --traceback
245 255 pushing to ssh://user@dummy/remote
246 256 searching for changes
247 257 no changes found
248 258 updating bookmark foo
249 259 [1]
250 260 $ hg book -d foo
251 261 $ hg in -B
252 262 comparing with ssh://user@dummy/remote
253 263 searching for changed bookmarks
254 264 foo a28a9d1a809c
255 265 $ hg book -f -r 0 foo
256 266 $ hg pull -B foo
257 267 pulling from ssh://user@dummy/remote
258 268 no changes found
259 269 updating bookmark foo
260 270 $ hg book -d foo
261 271 $ hg push -B foo
262 272 pushing to ssh://user@dummy/remote
263 273 searching for changes
264 274 no changes found
265 275 deleting remote bookmark foo
266 276 [1]
267 277
268 278 a bad, evil hook that prints to stdout
269 279
270 280 $ cat <<EOF > $TESTTMP/badhook
271 281 > import sys
272 282 > sys.stdout.write("KABOOM\n")
273 283 > EOF
274 284
275 285 $ echo '[hooks]' >> ../remote/.hg/hgrc
276 286 $ echo "changegroup.stdout = \"$PYTHON\" $TESTTMP/badhook" >> ../remote/.hg/hgrc
277 287 $ echo r > r
278 288 $ hg ci -A -m z r
279 289
280 290 push should succeed even though it has an unexpected response
281 291
282 292 $ hg push
283 293 pushing to ssh://user@dummy/remote
284 294 searching for changes
285 295 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
286 296 remote: adding changesets
287 297 remote: adding manifests
288 298 remote: adding file changes
289 299 remote: added 1 changesets with 1 changes to 1 files
290 300 remote: KABOOM
291 301 $ hg -R ../remote heads
292 302 changeset: 5:1383141674ec
293 303 tag: tip
294 304 parent: 3:a28a9d1a809c
295 305 user: test
296 306 date: Thu Jan 01 00:00:00 1970 +0000
297 307 summary: z
298 308
299 309 changeset: 4:6c0482d977a3
300 310 parent: 0:1160648e36ce
301 311 user: test
302 312 date: Thu Jan 01 00:00:00 1970 +0000
303 313 summary: z
304 314
305 315
306 316 clone bookmarks
307 317
308 318 $ hg -R ../remote bookmark test
309 319 $ hg -R ../remote bookmarks
310 320 * test 4:6c0482d977a3
311 321 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local-bookmarks
312 322 requesting all changes
313 323 adding changesets
314 324 adding manifests
315 325 adding file changes
316 326 added 6 changesets with 5 changes to 4 files (+1 heads)
317 327 new changesets 1160648e36ce:1383141674ec
318 328 updating to branch default
319 329 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
320 330 $ hg -R local-bookmarks bookmarks
321 331 test 4:6c0482d977a3
322 332
323 333 passwords in ssh urls are not supported
324 334 (we use a glob here because different Python versions give different
325 335 results here)
326 336
327 337 $ hg push ssh://user:erroneouspwd@dummy/remote
328 338 pushing to ssh://user:*@dummy/remote (glob)
329 339 abort: password in URL not supported!
330 340 [255]
331 341
332 342 $ cd ..
333 343
334 344 hide outer repo
335 345 $ hg init
336 346
337 347 Test remote paths with spaces (issue2983):
338 348
339 349 $ hg init --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
340 350 $ touch "$TESTTMP/a repo/test"
341 351 $ hg -R 'a repo' commit -A -m "test"
342 352 adding test
343 353 $ hg -R 'a repo' tag tag
344 354 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
345 355 73649e48688a
346 356
347 357 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo#noNoNO"
348 358 abort: unknown revision 'noNoNO'!
349 359 [255]
350 360
351 361 Test (non-)escaping of remote paths with spaces when cloning (issue3145):
352 362
353 363 $ hg clone --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
354 364 destination directory: a repo
355 365 abort: destination 'a repo' is not empty
356 366 [255]
357 367
358 368 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
359 369 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
360 370 parameters:
361 371
362 372 $ cat > ssh.sh << EOF
363 373 > userhost="\$1"
364 374 > SSH_ORIGINAL_COMMAND="\$2"
365 375 > export SSH_ORIGINAL_COMMAND
366 376 > PYTHONPATH="$PYTHONPATH"
367 377 > export PYTHONPATH
368 378 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
369 379 > EOF
370 380
371 381 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
372 382 73649e48688a
373 383
374 384 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
375 385 remote: Illegal repository "$TESTTMP/a'repo"
376 386 abort: no suitable response from remote hg!
377 387 [255]
378 388
379 389 $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
380 390 remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
381 391 abort: no suitable response from remote hg!
382 392 [255]
383 393
384 394 $ SSH_ORIGINAL_COMMAND="'hg' serve -R 'a'repo' --stdio" $PYTHON "$TESTDIR/../contrib/hg-ssh"
385 395 Illegal command "'hg' serve -R 'a'repo' --stdio": No closing quotation
386 396 [255]
387 397
388 398 Test hg-ssh in read-only mode:
389 399
390 400 $ cat > ssh.sh << EOF
391 401 > userhost="\$1"
392 402 > SSH_ORIGINAL_COMMAND="\$2"
393 403 > export SSH_ORIGINAL_COMMAND
394 404 > PYTHONPATH="$PYTHONPATH"
395 405 > export PYTHONPATH
396 406 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
397 407 > EOF
398 408
399 409 $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
400 410 requesting all changes
401 411 adding changesets
402 412 adding manifests
403 413 adding file changes
404 414 added 6 changesets with 5 changes to 4 files (+1 heads)
405 415 new changesets 1160648e36ce:1383141674ec
406 416 updating to branch default
407 417 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
408 418
409 419 $ cd read-only-local
410 420 $ echo "baz" > bar
411 421 $ hg ci -A -m "unpushable commit" bar
412 422 $ hg push --ssh "sh ../ssh.sh"
413 423 pushing to ssh://user@dummy/*/remote (glob)
414 424 searching for changes
415 425 remote: Permission denied
416 426 remote: abort: pretxnopen.hg-ssh hook failed
417 427 remote: Permission denied
418 428 remote: pushkey-abort: prepushkey.hg-ssh hook failed
419 429 updating 6c0482d977a3 to public failed!
420 430 [1]
421 431
422 432 $ cd ..
423 433
424 434 stderr from remote commands should be printed before stdout from local code (issue4336)
425 435
426 436 $ hg clone remote stderr-ordering
427 437 updating to branch default
428 438 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
429 439 $ cd stderr-ordering
430 440 $ cat >> localwrite.py << EOF
431 441 > from mercurial import exchange, extensions
432 442 >
433 443 > def wrappedpush(orig, repo, *args, **kwargs):
434 444 > res = orig(repo, *args, **kwargs)
435 445 > repo.ui.write('local stdout\n')
436 446 > return res
437 447 >
438 448 > def extsetup(ui):
439 449 > extensions.wrapfunction(exchange, 'push', wrappedpush)
440 450 > EOF
441 451
442 452 $ cat >> .hg/hgrc << EOF
443 453 > [paths]
444 454 > default-push = ssh://user@dummy/remote
445 455 > [ui]
446 456 > ssh = "$PYTHON" "$TESTDIR/dummyssh"
447 457 > [extensions]
448 458 > localwrite = localwrite.py
449 459 > EOF
450 460
451 461 $ echo localwrite > foo
452 462 $ hg commit -m 'testing localwrite'
453 463 $ hg push
454 464 pushing to ssh://user@dummy/remote
455 465 searching for changes
456 466 remote: adding changesets
457 467 remote: adding manifests
458 468 remote: adding file changes
459 469 remote: added 1 changesets with 1 changes to 1 files
460 470 remote: KABOOM
461 471 local stdout
462 472
463 473 debug output
464 474
465 475 $ hg pull --debug ssh://user@dummy/remote
466 476 pulling from ssh://user@dummy/remote
467 477 running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re)
478 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
468 479 sending hello command
469 480 sending between command
470 remote: 384
481 protocol upgraded to exp-ssh-v2-0001 (sshv2 !)
482 remote: 384 (sshv1 !)
471 483 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
472 remote: 1
484 remote: 1 (sshv1 !)
473 485 preparing listkeys for "bookmarks"
474 486 sending listkeys command
475 487 received listkey for "bookmarks": 45 bytes
476 488 query 1; heads
477 489 sending batch command
478 490 searching for changes
479 491 all remote heads known locally
480 492 no changes found
481 493 preparing listkeys for "phases"
482 494 sending listkeys command
483 495 received listkey for "phases": 15 bytes
484 496 checking for updated bookmarks
485 497
486 498 $ cd ..
487 499
488 500 $ cat dummylog
489 501 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
490 502 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
491 503 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
492 504 Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio
493 505 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
494 506 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
495 507 Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio
496 508 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
497 509 Got arguments 1:user@dummy 2:hg -R local serve --stdio
498 510 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
499 511 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
500 512 changegroup-in-remote hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
501 513 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
502 514 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
503 515 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
504 516 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
505 517 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
506 518 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
507 519 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
508 520 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
509 521 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
510 522 changegroup-in-remote hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
511 523 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
512 524 Got arguments 1:user@dummy 2:hg init 'a repo'
513 525 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
514 526 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
515 527 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
516 528 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
517 529 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
518 530 changegroup-in-remote hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
519 531 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
520 532
521 533 remote hook failure is attributed to remote
522 534
523 535 $ cat > $TESTTMP/failhook << EOF
524 536 > def hook(ui, repo, **kwargs):
525 537 > ui.write('hook failure!\n')
526 538 > ui.flush()
527 539 > return 1
528 540 > EOF
529 541
530 542 $ echo "pretxnchangegroup.fail = python:$TESTTMP/failhook:hook" >> remote/.hg/hgrc
531 543
532 544 $ hg -q --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" clone ssh://user@dummy/remote hookout
533 545 $ cd hookout
534 546 $ touch hookfailure
535 547 $ hg -q commit -A -m 'remote hook failure'
536 548 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" push
537 549 pushing to ssh://user@dummy/remote
538 550 searching for changes
539 551 remote: adding changesets
540 552 remote: adding manifests
541 553 remote: adding file changes
542 554 remote: added 1 changesets with 1 changes to 1 files
543 555 remote: hook failure!
544 556 remote: transaction abort!
545 557 remote: rollback completed
546 558 remote: abort: pretxnchangegroup.fail hook failed
547 559 [1]
548 560
549 561 abort during pull is properly reported as such
550 562
551 563 $ echo morefoo >> ../remote/foo
552 564 $ hg -R ../remote commit --message "more foo to be pulled"
553 565 $ cat >> ../remote/.hg/hgrc << EOF
554 566 > [extensions]
555 567 > crash = ${TESTDIR}/crashgetbundler.py
556 568 > EOF
557 569 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" pull
558 570 pulling from ssh://user@dummy/remote
559 571 searching for changes
560 572 adding changesets
561 573 remote: abort: this is an exercise
562 574 transaction abort!
563 575 rollback completed
564 576 abort: stream ended unexpectedly (got 0 bytes, expected 4)
565 577 [255]
@@ -1,210 +1,220 b''
1 1 This test tries to exercise the ssh functionality with a dummy script
2 2
3 #testcases sshv1 sshv2
4
5 #if sshv2
6 $ cat >> $HGRCPATH << EOF
7 > [experimental]
8 > sshpeer.advertise-v2 = true
9 > sshserver.support-v2 = true
10 > EOF
11 #endif
12
3 13 creating 'remote' repo
4 14
5 15 $ hg init remote
6 16 $ cd remote
7 17 $ hg unbundle "$TESTDIR/bundles/remote.hg"
8 18 adding changesets
9 19 adding manifests
10 20 adding file changes
11 21 added 9 changesets with 7 changes to 4 files (+1 heads)
12 22 new changesets bfaf4b5cbf01:916f1afdef90
13 23 (run 'hg heads' to see heads, 'hg merge' to merge)
14 24 $ hg up tip
15 25 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 26 $ cd ..
17 27
18 28 clone remote via stream
19 29
20 30 $ for i in 0 1 2 3 4 5 6 7 8; do
21 31 > hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream -r "$i" ssh://user@dummy/remote test-"$i"
22 32 > if cd test-"$i"; then
23 33 > hg verify
24 34 > cd ..
25 35 > fi
26 36 > done
27 37 adding changesets
28 38 adding manifests
29 39 adding file changes
30 40 added 1 changesets with 1 changes to 1 files
31 41 new changesets bfaf4b5cbf01
32 42 updating to branch default
33 43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 44 checking changesets
35 45 checking manifests
36 46 crosschecking files in changesets and manifests
37 47 checking files
38 48 1 files, 1 changesets, 1 total revisions
39 49 adding changesets
40 50 adding manifests
41 51 adding file changes
42 52 added 2 changesets with 2 changes to 1 files
43 53 new changesets bfaf4b5cbf01:21f32785131f
44 54 updating to branch default
45 55 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 56 checking changesets
47 57 checking manifests
48 58 crosschecking files in changesets and manifests
49 59 checking files
50 60 1 files, 2 changesets, 2 total revisions
51 61 adding changesets
52 62 adding manifests
53 63 adding file changes
54 64 added 3 changesets with 3 changes to 1 files
55 65 new changesets bfaf4b5cbf01:4ce51a113780
56 66 updating to branch default
57 67 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 68 checking changesets
59 69 checking manifests
60 70 crosschecking files in changesets and manifests
61 71 checking files
62 72 1 files, 3 changesets, 3 total revisions
63 73 adding changesets
64 74 adding manifests
65 75 adding file changes
66 76 added 4 changesets with 4 changes to 1 files
67 77 new changesets bfaf4b5cbf01:93ee6ab32777
68 78 updating to branch default
69 79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 80 checking changesets
71 81 checking manifests
72 82 crosschecking files in changesets and manifests
73 83 checking files
74 84 1 files, 4 changesets, 4 total revisions
75 85 adding changesets
76 86 adding manifests
77 87 adding file changes
78 88 added 2 changesets with 2 changes to 1 files
79 89 new changesets bfaf4b5cbf01:c70afb1ee985
80 90 updating to branch default
81 91 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
82 92 checking changesets
83 93 checking manifests
84 94 crosschecking files in changesets and manifests
85 95 checking files
86 96 1 files, 2 changesets, 2 total revisions
87 97 adding changesets
88 98 adding manifests
89 99 adding file changes
90 100 added 3 changesets with 3 changes to 1 files
91 101 new changesets bfaf4b5cbf01:f03ae5a9b979
92 102 updating to branch default
93 103 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 104 checking changesets
95 105 checking manifests
96 106 crosschecking files in changesets and manifests
97 107 checking files
98 108 1 files, 3 changesets, 3 total revisions
99 109 adding changesets
100 110 adding manifests
101 111 adding file changes
102 112 added 4 changesets with 5 changes to 2 files
103 113 new changesets bfaf4b5cbf01:095cb14b1b4d
104 114 updating to branch default
105 115 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 116 checking changesets
107 117 checking manifests
108 118 crosschecking files in changesets and manifests
109 119 checking files
110 120 2 files, 4 changesets, 5 total revisions
111 121 adding changesets
112 122 adding manifests
113 123 adding file changes
114 124 added 5 changesets with 6 changes to 3 files
115 125 new changesets bfaf4b5cbf01:faa2e4234c7a
116 126 updating to branch default
117 127 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
118 128 checking changesets
119 129 checking manifests
120 130 crosschecking files in changesets and manifests
121 131 checking files
122 132 3 files, 5 changesets, 6 total revisions
123 133 adding changesets
124 134 adding manifests
125 135 adding file changes
126 136 added 5 changesets with 5 changes to 2 files
127 137 new changesets bfaf4b5cbf01:916f1afdef90
128 138 updating to branch default
129 139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
130 140 checking changesets
131 141 checking manifests
132 142 crosschecking files in changesets and manifests
133 143 checking files
134 144 2 files, 5 changesets, 5 total revisions
135 145 $ cd test-8
136 146 $ hg pull ../test-7
137 147 pulling from ../test-7
138 148 searching for changes
139 149 adding changesets
140 150 adding manifests
141 151 adding file changes
142 152 added 4 changesets with 2 changes to 3 files (+1 heads)
143 153 new changesets c70afb1ee985:faa2e4234c7a
144 154 (run 'hg heads' to see heads, 'hg merge' to merge)
145 155 $ hg verify
146 156 checking changesets
147 157 checking manifests
148 158 crosschecking files in changesets and manifests
149 159 checking files
150 160 4 files, 9 changesets, 7 total revisions
151 161 $ cd ..
152 162 $ cd test-1
153 163 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" -r 4 ssh://user@dummy/remote
154 164 pulling from ssh://user@dummy/remote
155 165 searching for changes
156 166 adding changesets
157 167 adding manifests
158 168 adding file changes
159 169 added 1 changesets with 0 changes to 0 files (+1 heads)
160 170 new changesets c70afb1ee985
161 171 (run 'hg heads' to see heads, 'hg merge' to merge)
162 172 $ hg verify
163 173 checking changesets
164 174 checking manifests
165 175 crosschecking files in changesets and manifests
166 176 checking files
167 177 1 files, 3 changesets, 2 total revisions
168 178 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote
169 179 pulling from ssh://user@dummy/remote
170 180 searching for changes
171 181 adding changesets
172 182 adding manifests
173 183 adding file changes
174 184 added 6 changesets with 5 changes to 4 files
175 185 new changesets 4ce51a113780:916f1afdef90
176 186 (run 'hg update' to get a working copy)
177 187 $ cd ..
178 188 $ cd test-2
179 189 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" -r 5 ssh://user@dummy/remote
180 190 pulling from ssh://user@dummy/remote
181 191 searching for changes
182 192 adding changesets
183 193 adding manifests
184 194 adding file changes
185 195 added 2 changesets with 0 changes to 0 files (+1 heads)
186 196 new changesets c70afb1ee985:f03ae5a9b979
187 197 (run 'hg heads' to see heads, 'hg merge' to merge)
188 198 $ hg verify
189 199 checking changesets
190 200 checking manifests
191 201 crosschecking files in changesets and manifests
192 202 checking files
193 203 1 files, 5 changesets, 3 total revisions
194 204 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote
195 205 pulling from ssh://user@dummy/remote
196 206 searching for changes
197 207 adding changesets
198 208 adding manifests
199 209 adding file changes
200 210 added 4 changesets with 4 changes to 4 files
201 211 new changesets 93ee6ab32777:916f1afdef90
202 212 (run 'hg update' to get a working copy)
203 213 $ hg verify
204 214 checking changesets
205 215 checking manifests
206 216 crosschecking files in changesets and manifests
207 217 checking files
208 218 4 files, 9 changesets, 7 total revisions
209 219
210 220 $ cd ..
@@ -1,629 +1,640 b''
1 #testcases sshv1 sshv2
2
3 #if sshv2
4 $ cat >> $HGRCPATH << EOF
5 > [experimental]
6 > sshpeer.advertise-v2 = true
7 > sshserver.support-v2 = true
8 > EOF
9 #endif
1 10
2 11 This test tries to exercise the ssh functionality with a dummy script
3 12
4 13 $ cat <<EOF >> $HGRCPATH
5 14 > [format]
6 15 > usegeneraldelta=yes
7 16 > EOF
8 17
9 18 creating 'remote' repo
10 19
11 20 $ hg init remote
12 21 $ cd remote
13 22 $ echo this > foo
14 23 $ echo this > fooO
15 24 $ hg ci -A -m "init" foo fooO
16 25
17 26 insert a closed branch (issue4428)
18 27
19 28 $ hg up null
20 29 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
21 30 $ hg branch closed
22 31 marked working directory as branch closed
23 32 (branches are permanent and global, did you want a bookmark?)
24 33 $ hg ci -mc0
25 34 $ hg ci --close-branch -mc1
26 35 $ hg up -q default
27 36
28 37 configure for serving
29 38
30 39 $ cat <<EOF > .hg/hgrc
31 40 > [server]
32 41 > uncompressed = True
33 42 >
34 43 > [hooks]
35 44 > changegroup = sh -c "printenv.py changegroup-in-remote 0 ../dummylog"
36 45 > EOF
37 46 $ cd ..
38 47
39 48 repo not found error
40 49
41 50 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
42 51 remote: abort: repository nonexistent not found!
43 52 abort: no suitable response from remote hg!
44 53 [255]
45 54
46 55 non-existent absolute path
47 56
48 57 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/`pwd`/nonexistent local
49 58 remote: abort: repository $TESTTMP/nonexistent not found!
50 59 abort: no suitable response from remote hg!
51 60 [255]
52 61
53 62 clone remote via stream
54 63
55 64 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/remote local-stream
56 65 streaming all changes
57 66 4 files to transfer, 602 bytes of data
58 67 transferred 602 bytes in * seconds (*) (glob)
59 68 searching for changes
60 69 no changes found
61 70 updating to branch default
62 71 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 72 $ cd local-stream
64 73 $ hg verify
65 74 checking changesets
66 75 checking manifests
67 76 crosschecking files in changesets and manifests
68 77 checking files
69 78 2 files, 3 changesets, 2 total revisions
70 79 $ hg branches
71 80 default 0:1160648e36ce
72 81 $ cd ..
73 82
74 83 clone bookmarks via stream
75 84
76 85 $ hg -R local-stream book mybook
77 86 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
78 87 streaming all changes
79 88 4 files to transfer, 602 bytes of data
80 89 transferred 602 bytes in * seconds (*) (glob)
81 90 searching for changes
82 91 no changes found
83 92 updating to branch default
84 93 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 94 $ cd stream2
86 95 $ hg book
87 96 mybook 0:1160648e36ce
88 97 $ cd ..
89 98 $ rm -rf local-stream stream2
90 99
91 100 clone remote via pull
92 101
93 102 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
94 103 requesting all changes
95 104 adding changesets
96 105 adding manifests
97 106 adding file changes
98 107 added 3 changesets with 2 changes to 2 files
99 108 new changesets 1160648e36ce:ad076bfb429d
100 109 updating to branch default
101 110 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
102 111
103 112 verify
104 113
105 114 $ cd local
106 115 $ hg verify
107 116 checking changesets
108 117 checking manifests
109 118 crosschecking files in changesets and manifests
110 119 checking files
111 120 2 files, 3 changesets, 2 total revisions
112 121 $ cat >> .hg/hgrc <<EOF
113 122 > [hooks]
114 123 > changegroup = sh -c "printenv.py changegroup-in-local 0 ../dummylog"
115 124 > EOF
116 125
117 126 empty default pull
118 127
119 128 $ hg paths
120 129 default = ssh://user@dummy/remote
121 130 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
122 131 pulling from ssh://user@dummy/remote
123 132 searching for changes
124 133 no changes found
125 134
126 135 pull from wrong ssh URL
127 136
128 137 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist
129 138 pulling from ssh://user@dummy/doesnotexist
130 139 remote: abort: repository doesnotexist not found!
131 140 abort: no suitable response from remote hg!
132 141 [255]
133 142
134 143 local change
135 144
136 145 $ echo bleah > foo
137 146 $ hg ci -m "add"
138 147
139 148 updating rc
140 149
141 150 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
142 151 $ echo "[ui]" >> .hg/hgrc
143 152 $ echo "ssh = \"$PYTHON\" \"$TESTDIR/dummyssh\"" >> .hg/hgrc
144 153
145 154 find outgoing
146 155
147 156 $ hg out ssh://user@dummy/remote
148 157 comparing with ssh://user@dummy/remote
149 158 searching for changes
150 159 changeset: 3:a28a9d1a809c
151 160 tag: tip
152 161 parent: 0:1160648e36ce
153 162 user: test
154 163 date: Thu Jan 01 00:00:00 1970 +0000
155 164 summary: add
156 165
157 166
158 167 find incoming on the remote side
159 168
160 169 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/local
161 170 comparing with ssh://user@dummy/local
162 171 searching for changes
163 172 changeset: 3:a28a9d1a809c
164 173 tag: tip
165 174 parent: 0:1160648e36ce
166 175 user: test
167 176 date: Thu Jan 01 00:00:00 1970 +0000
168 177 summary: add
169 178
170 179
171 180 find incoming on the remote side (using absolute path)
172 181
173 182 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/`pwd`"
174 183 comparing with ssh://user@dummy/$TESTTMP/local
175 184 searching for changes
176 185 changeset: 3:a28a9d1a809c
177 186 tag: tip
178 187 parent: 0:1160648e36ce
179 188 user: test
180 189 date: Thu Jan 01 00:00:00 1970 +0000
181 190 summary: add
182 191
183 192
184 193 push
185 194
186 195 $ hg push
187 196 pushing to ssh://user@dummy/remote
188 197 searching for changes
189 198 remote: adding changesets
190 199 remote: adding manifests
191 200 remote: adding file changes
192 201 remote: added 1 changesets with 1 changes to 1 files
193 202 $ cd ../remote
194 203
195 204 check remote tip
196 205
197 206 $ hg tip
198 207 changeset: 3:a28a9d1a809c
199 208 tag: tip
200 209 parent: 0:1160648e36ce
201 210 user: test
202 211 date: Thu Jan 01 00:00:00 1970 +0000
203 212 summary: add
204 213
205 214 $ hg verify
206 215 checking changesets
207 216 checking manifests
208 217 crosschecking files in changesets and manifests
209 218 checking files
210 219 2 files, 4 changesets, 3 total revisions
211 220 $ hg cat -r tip foo
212 221 bleah
213 222 $ echo z > z
214 223 $ hg ci -A -m z z
215 224 created new head
216 225
217 226 test pushkeys and bookmarks
218 227
219 228 $ cd ../local
220 229 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
221 230 bookmarks
222 231 namespaces
223 232 phases
224 233 $ hg book foo -r 0
225 234 $ hg out -B
226 235 comparing with ssh://user@dummy/remote
227 236 searching for changed bookmarks
228 237 foo 1160648e36ce
229 238 $ hg push -B foo
230 239 pushing to ssh://user@dummy/remote
231 240 searching for changes
232 241 no changes found
233 242 exporting bookmark foo
234 243 [1]
235 244 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote bookmarks
236 245 foo 1160648e36cec0054048a7edc4110c6f84fde594
237 246 $ hg book -f foo
238 247 $ hg push --traceback
239 248 pushing to ssh://user@dummy/remote
240 249 searching for changes
241 250 no changes found
242 251 updating bookmark foo
243 252 [1]
244 253 $ hg book -d foo
245 254 $ hg in -B
246 255 comparing with ssh://user@dummy/remote
247 256 searching for changed bookmarks
248 257 foo a28a9d1a809c
249 258 $ hg book -f -r 0 foo
250 259 $ hg pull -B foo
251 260 pulling from ssh://user@dummy/remote
252 261 no changes found
253 262 updating bookmark foo
254 263 $ hg book -d foo
255 264 $ hg push -B foo
256 265 pushing to ssh://user@dummy/remote
257 266 searching for changes
258 267 no changes found
259 268 deleting remote bookmark foo
260 269 [1]
261 270
262 271 a bad, evil hook that prints to stdout
263 272
264 273 $ cat <<EOF > $TESTTMP/badhook
265 274 > import sys
266 275 > sys.stdout.write("KABOOM\n")
267 276 > EOF
268 277
269 278 $ cat <<EOF > $TESTTMP/badpyhook.py
270 279 > import sys
271 280 > def hook(ui, repo, hooktype, **kwargs):
272 281 > sys.stdout.write("KABOOM IN PROCESS\n")
273 282 > EOF
274 283
275 284 $ cat <<EOF >> ../remote/.hg/hgrc
276 285 > [hooks]
277 286 > changegroup.stdout = $PYTHON $TESTTMP/badhook
278 287 > changegroup.pystdout = python:$TESTTMP/badpyhook.py:hook
279 288 > EOF
280 289 $ echo r > r
281 290 $ hg ci -A -m z r
282 291
283 292 push should succeed even though it has an unexpected response
284 293
285 294 $ hg push
286 295 pushing to ssh://user@dummy/remote
287 296 searching for changes
288 297 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
289 298 remote: adding changesets
290 299 remote: adding manifests
291 300 remote: adding file changes
292 301 remote: added 1 changesets with 1 changes to 1 files
293 302 remote: KABOOM
294 303 remote: KABOOM IN PROCESS
295 304 $ hg -R ../remote heads
296 305 changeset: 5:1383141674ec
297 306 tag: tip
298 307 parent: 3:a28a9d1a809c
299 308 user: test
300 309 date: Thu Jan 01 00:00:00 1970 +0000
301 310 summary: z
302 311
303 312 changeset: 4:6c0482d977a3
304 313 parent: 0:1160648e36ce
305 314 user: test
306 315 date: Thu Jan 01 00:00:00 1970 +0000
307 316 summary: z
308 317
309 318
310 319 clone bookmarks
311 320
312 321 $ hg -R ../remote bookmark test
313 322 $ hg -R ../remote bookmarks
314 323 * test 4:6c0482d977a3
315 324 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local-bookmarks
316 325 requesting all changes
317 326 adding changesets
318 327 adding manifests
319 328 adding file changes
320 329 added 6 changesets with 5 changes to 4 files (+1 heads)
321 330 new changesets 1160648e36ce:1383141674ec
322 331 updating to branch default
323 332 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
324 333 $ hg -R local-bookmarks bookmarks
325 334 test 4:6c0482d977a3
326 335
327 336 passwords in ssh urls are not supported
328 337 (we use a glob here because different Python versions give different
329 338 results here)
330 339
331 340 $ hg push ssh://user:erroneouspwd@dummy/remote
332 341 pushing to ssh://user:*@dummy/remote (glob)
333 342 abort: password in URL not supported!
334 343 [255]
335 344
336 345 $ cd ..
337 346
338 347 hide outer repo
339 348 $ hg init
340 349
341 350 Test remote paths with spaces (issue2983):
342 351
343 352 $ hg init --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
344 353 $ touch "$TESTTMP/a repo/test"
345 354 $ hg -R 'a repo' commit -A -m "test"
346 355 adding test
347 356 $ hg -R 'a repo' tag tag
348 357 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
349 358 73649e48688a
350 359
351 360 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo#noNoNO"
352 361 abort: unknown revision 'noNoNO'!
353 362 [255]
354 363
355 364 Test (non-)escaping of remote paths with spaces when cloning (issue3145):
356 365
357 366 $ hg clone --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
358 367 destination directory: a repo
359 368 abort: destination 'a repo' is not empty
360 369 [255]
361 370
362 371 Make sure hg is really paranoid in serve --stdio mode. It used to be
363 372 possible to get a debugger REPL by specifying a repo named --debugger.
364 373 $ hg -R --debugger serve --stdio
365 374 abort: potentially unsafe serve --stdio invocation: ['-R', '--debugger', 'serve', '--stdio']
366 375 [255]
367 376 $ hg -R --config=ui.debugger=yes serve --stdio
368 377 abort: potentially unsafe serve --stdio invocation: ['-R', '--config=ui.debugger=yes', 'serve', '--stdio']
369 378 [255]
370 379 Abbreviations of 'serve' also don't work, to avoid shenanigans.
371 380 $ hg -R narf serv --stdio
372 381 abort: potentially unsafe serve --stdio invocation: ['-R', 'narf', 'serv', '--stdio']
373 382 [255]
374 383
375 384 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
376 385 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
377 386 parameters:
378 387
379 388 $ cat > ssh.sh << EOF
380 389 > userhost="\$1"
381 390 > SSH_ORIGINAL_COMMAND="\$2"
382 391 > export SSH_ORIGINAL_COMMAND
383 392 > PYTHONPATH="$PYTHONPATH"
384 393 > export PYTHONPATH
385 394 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
386 395 > EOF
387 396
388 397 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
389 398 73649e48688a
390 399
391 400 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
392 401 remote: Illegal repository "$TESTTMP/a'repo"
393 402 abort: no suitable response from remote hg!
394 403 [255]
395 404
396 405 $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
397 406 remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
398 407 abort: no suitable response from remote hg!
399 408 [255]
400 409
401 410 $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" $PYTHON "$TESTDIR/../contrib/hg-ssh"
402 411 Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
403 412 [255]
404 413
405 414 Test hg-ssh in read-only mode:
406 415
407 416 $ cat > ssh.sh << EOF
408 417 > userhost="\$1"
409 418 > SSH_ORIGINAL_COMMAND="\$2"
410 419 > export SSH_ORIGINAL_COMMAND
411 420 > PYTHONPATH="$PYTHONPATH"
412 421 > export PYTHONPATH
413 422 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
414 423 > EOF
415 424
416 425 $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
417 426 requesting all changes
418 427 adding changesets
419 428 adding manifests
420 429 adding file changes
421 430 added 6 changesets with 5 changes to 4 files (+1 heads)
422 431 new changesets 1160648e36ce:1383141674ec
423 432 updating to branch default
424 433 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
425 434
426 435 $ cd read-only-local
427 436 $ echo "baz" > bar
428 437 $ hg ci -A -m "unpushable commit" bar
429 438 $ hg push --ssh "sh ../ssh.sh"
430 439 pushing to ssh://user@dummy/*/remote (glob)
431 440 searching for changes
432 441 remote: Permission denied
433 442 remote: pretxnopen.hg-ssh hook failed
434 443 abort: push failed on remote
435 444 [255]
436 445
437 446 $ cd ..
438 447
439 448 stderr from remote commands should be printed before stdout from local code (issue4336)
440 449
441 450 $ hg clone remote stderr-ordering
442 451 updating to branch default
443 452 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
444 453 $ cd stderr-ordering
445 454 $ cat >> localwrite.py << EOF
446 455 > from mercurial import exchange, extensions
447 456 >
448 457 > def wrappedpush(orig, repo, *args, **kwargs):
449 458 > res = orig(repo, *args, **kwargs)
450 459 > repo.ui.write('local stdout\n')
451 460 > return res
452 461 >
453 462 > def extsetup(ui):
454 463 > extensions.wrapfunction(exchange, 'push', wrappedpush)
455 464 > EOF
456 465
457 466 $ cat >> .hg/hgrc << EOF
458 467 > [paths]
459 468 > default-push = ssh://user@dummy/remote
460 469 > [ui]
461 470 > ssh = "$PYTHON" "$TESTDIR/dummyssh"
462 471 > [extensions]
463 472 > localwrite = localwrite.py
464 473 > EOF
465 474
466 475 $ echo localwrite > foo
467 476 $ hg commit -m 'testing localwrite'
468 477 $ hg push
469 478 pushing to ssh://user@dummy/remote
470 479 searching for changes
471 480 remote: adding changesets
472 481 remote: adding manifests
473 482 remote: adding file changes
474 483 remote: added 1 changesets with 1 changes to 1 files
475 484 remote: KABOOM
476 485 remote: KABOOM IN PROCESS
477 486 local stdout
478 487
479 488 debug output
480 489
481 490 $ hg pull --debug ssh://user@dummy/remote --config devel.debug.peer-request=yes
482 491 pulling from ssh://user@dummy/remote
483 492 running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re)
493 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
484 494 devel-peer-request: hello
485 495 sending hello command
486 496 devel-peer-request: between
487 497 devel-peer-request: pairs: 81 bytes
488 498 sending between command
489 remote: 384
499 remote: 384 (sshv1 !)
500 protocol upgraded to exp-ssh-v2-0001 (sshv2 !)
490 501 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN
491 remote: 1
502 remote: 1 (sshv1 !)
492 503 query 1; heads
493 504 devel-peer-request: batch
494 505 devel-peer-request: cmds: 141 bytes
495 506 sending batch command
496 507 searching for changes
497 508 all remote heads known locally
498 509 no changes found
499 510 devel-peer-request: getbundle
500 511 devel-peer-request: bookmarks: 1 bytes
501 512 devel-peer-request: bundlecaps: 247 bytes
502 513 devel-peer-request: cg: 1 bytes
503 514 devel-peer-request: common: 122 bytes
504 515 devel-peer-request: heads: 122 bytes
505 516 devel-peer-request: listkeys: 9 bytes
506 517 devel-peer-request: phases: 1 bytes
507 518 sending getbundle command
508 519 bundle2-input-bundle: with-transaction
509 520 bundle2-input-part: "bookmarks" supported
510 521 bundle2-input-part: total payload size 26
511 522 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
512 523 bundle2-input-part: total payload size 45
513 524 bundle2-input-part: "phase-heads" supported
514 525 bundle2-input-part: total payload size 72
515 526 bundle2-input-bundle: 2 parts total
516 527 checking for updated bookmarks
517 528
518 529 $ cd ..
519 530
520 531 $ cat dummylog
521 532 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
522 533 Got arguments 1:user@dummy 2:hg -R $TESTTMP/nonexistent serve --stdio
523 534 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
524 535 Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio
525 536 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
526 537 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
527 538 Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio
528 539 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
529 540 Got arguments 1:user@dummy 2:hg -R local serve --stdio
530 541 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
531 542 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
532 543 changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
533 544 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
534 545 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
535 546 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
536 547 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
537 548 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
538 549 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
539 550 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
540 551 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
541 552 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
542 553 changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
543 554 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
544 555 Got arguments 1:user@dummy 2:hg init 'a repo'
545 556 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
546 557 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
547 558 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
548 559 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
549 560 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
550 561 changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
551 562 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
552 563
553 564 remote hook failure is attributed to remote
554 565
555 566 $ cat > $TESTTMP/failhook << EOF
556 567 > def hook(ui, repo, **kwargs):
557 568 > ui.write('hook failure!\n')
558 569 > ui.flush()
559 570 > return 1
560 571 > EOF
561 572
562 573 $ echo "pretxnchangegroup.fail = python:$TESTTMP/failhook:hook" >> remote/.hg/hgrc
563 574
564 575 $ hg -q --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" clone ssh://user@dummy/remote hookout
565 576 $ cd hookout
566 577 $ touch hookfailure
567 578 $ hg -q commit -A -m 'remote hook failure'
568 579 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" push
569 580 pushing to ssh://user@dummy/remote
570 581 searching for changes
571 582 remote: adding changesets
572 583 remote: adding manifests
573 584 remote: adding file changes
574 585 remote: added 1 changesets with 1 changes to 1 files
575 586 remote: hook failure!
576 587 remote: transaction abort!
577 588 remote: rollback completed
578 589 remote: pretxnchangegroup.fail hook failed
579 590 abort: push failed on remote
580 591 [255]
581 592
582 593 abort during pull is properly reported as such
583 594
584 595 $ echo morefoo >> ../remote/foo
585 596 $ hg -R ../remote commit --message "more foo to be pulled"
586 597 $ cat >> ../remote/.hg/hgrc << EOF
587 598 > [extensions]
588 599 > crash = ${TESTDIR}/crashgetbundler.py
589 600 > EOF
590 601 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" pull
591 602 pulling from ssh://user@dummy/remote
592 603 searching for changes
593 604 remote: abort: this is an exercise
594 605 abort: pull failed on remote
595 606 [255]
596 607
597 608 abort with no error hint when there is a ssh problem when pulling
598 609
599 610 $ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
600 611 pulling from ssh://brokenrepository/
601 612 abort: no suitable response from remote hg!
602 613 [255]
603 614
604 615 abort with configured error hint when there is a ssh problem when pulling
605 616
606 617 $ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" \
607 618 > --config ui.ssherrorhint="Please see http://company/internalwiki/ssh.html"
608 619 pulling from ssh://brokenrepository/
609 620 abort: no suitable response from remote hg!
610 621 (Please see http://company/internalwiki/ssh.html)
611 622 [255]
612 623
613 624 test that custom environment is passed down to ssh executable
614 625 $ cat >>dumpenv <<EOF
615 626 > #! /bin/sh
616 627 > echo \$VAR >&2
617 628 > EOF
618 629 $ chmod +x dumpenv
619 630 $ hg pull ssh://something --config ui.ssh="sh dumpenv"
620 631 pulling from ssh://something/
621 632 remote:
622 633 abort: no suitable response from remote hg!
623 634 [255]
624 635 $ hg pull ssh://something --config ui.ssh="sh dumpenv" --config sshenv.VAR=17
625 636 pulling from ssh://something/
626 637 remote: 17
627 638 abort: no suitable response from remote hg!
628 639 [255]
629 640
General Comments 0
You need to be logged in to leave comments. Login now