##// END OF EJS Templates
test: prepare tests for removing date aliases...
Boris Feld -
r32413:d6be5b5c default
parent child Browse files
Show More
@@ -1,982 +1,982 b''
1 1 ==========================
2 2 Test rebase with obsolete
3 3 ==========================
4 4
5 5 Enable obsolete
6 6
7 7 $ cat >> $HGRCPATH << EOF
8 8 > [ui]
9 9 > logtemplate= {rev}:{node|short} {desc|firstline}
10 10 > [experimental]
11 11 > evolution=createmarkers,allowunstable
12 12 > [phases]
13 13 > publish=False
14 14 > [extensions]
15 15 > rebase=
16 16 > EOF
17 17
18 18 Setup rebase canonical repo
19 19
20 20 $ hg init base
21 21 $ cd base
22 22 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
23 23 adding changesets
24 24 adding manifests
25 25 adding file changes
26 26 added 8 changesets with 7 changes to 7 files (+2 heads)
27 27 (run 'hg heads' to see heads, 'hg merge' to merge)
28 28 $ hg up tip
29 29 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 30 $ hg log -G
31 31 @ 7:02de42196ebe H
32 32 |
33 33 | o 6:eea13746799a G
34 34 |/|
35 35 o | 5:24b6387c8c8c F
36 36 | |
37 37 | o 4:9520eea781bc E
38 38 |/
39 39 | o 3:32af7686d403 D
40 40 | |
41 41 | o 2:5fddd98957c8 C
42 42 | |
43 43 | o 1:42ccdea3bb16 B
44 44 |/
45 45 o 0:cd010b8cd998 A
46 46
47 47 $ cd ..
48 48
49 49 simple rebase
50 50 ---------------------------------
51 51
52 52 $ hg clone base simple
53 53 updating to branch default
54 54 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 55 $ cd simple
56 56 $ hg up 32af7686d403
57 57 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
58 58 $ hg rebase -d eea13746799a
59 59 rebasing 1:42ccdea3bb16 "B"
60 60 rebasing 2:5fddd98957c8 "C"
61 61 rebasing 3:32af7686d403 "D"
62 62 $ hg log -G
63 63 @ 10:8eeb3c33ad33 D
64 64 |
65 65 o 9:2327fea05063 C
66 66 |
67 67 o 8:e4e5be0395b2 B
68 68 |
69 69 | o 7:02de42196ebe H
70 70 | |
71 71 o | 6:eea13746799a G
72 72 |\|
73 73 | o 5:24b6387c8c8c F
74 74 | |
75 75 o | 4:9520eea781bc E
76 76 |/
77 77 o 0:cd010b8cd998 A
78 78
79 79 $ hg log --hidden -G
80 80 @ 10:8eeb3c33ad33 D
81 81 |
82 82 o 9:2327fea05063 C
83 83 |
84 84 o 8:e4e5be0395b2 B
85 85 |
86 86 | o 7:02de42196ebe H
87 87 | |
88 88 o | 6:eea13746799a G
89 89 |\|
90 90 | o 5:24b6387c8c8c F
91 91 | |
92 92 o | 4:9520eea781bc E
93 93 |/
94 94 | x 3:32af7686d403 D
95 95 | |
96 96 | x 2:5fddd98957c8 C
97 97 | |
98 98 | x 1:42ccdea3bb16 B
99 99 |/
100 100 o 0:cd010b8cd998 A
101 101
102 102 $ hg debugobsolete
103 103 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (*) {'user': 'test'} (glob)
104 104 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (*) {'user': 'test'} (glob)
105 105 32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (*) {'user': 'test'} (glob)
106 106
107 107
108 108 $ cd ..
109 109
110 110 empty changeset
111 111 ---------------------------------
112 112
113 113 $ hg clone base empty
114 114 updating to branch default
115 115 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
116 116 $ cd empty
117 117 $ hg up eea13746799a
118 118 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
119 119
120 120 We make a copy of both the first changeset in the rebased and some other in the
121 121 set.
122 122
123 123 $ hg graft 42ccdea3bb16 32af7686d403
124 124 grafting 1:42ccdea3bb16 "B"
125 125 grafting 3:32af7686d403 "D"
126 126 $ hg rebase -s 42ccdea3bb16 -d .
127 127 rebasing 1:42ccdea3bb16 "B"
128 128 note: rebase of 1:42ccdea3bb16 created no changes to commit
129 129 rebasing 2:5fddd98957c8 "C"
130 130 rebasing 3:32af7686d403 "D"
131 131 note: rebase of 3:32af7686d403 created no changes to commit
132 132 $ hg log -G
133 133 o 10:5ae4c968c6ac C
134 134 |
135 135 @ 9:08483444fef9 D
136 136 |
137 137 o 8:8877864f1edb B
138 138 |
139 139 | o 7:02de42196ebe H
140 140 | |
141 141 o | 6:eea13746799a G
142 142 |\|
143 143 | o 5:24b6387c8c8c F
144 144 | |
145 145 o | 4:9520eea781bc E
146 146 |/
147 147 o 0:cd010b8cd998 A
148 148
149 149 $ hg log --hidden -G
150 150 o 10:5ae4c968c6ac C
151 151 |
152 152 @ 9:08483444fef9 D
153 153 |
154 154 o 8:8877864f1edb B
155 155 |
156 156 | o 7:02de42196ebe H
157 157 | |
158 158 o | 6:eea13746799a G
159 159 |\|
160 160 | o 5:24b6387c8c8c F
161 161 | |
162 162 o | 4:9520eea781bc E
163 163 |/
164 164 | x 3:32af7686d403 D
165 165 | |
166 166 | x 2:5fddd98957c8 C
167 167 | |
168 168 | x 1:42ccdea3bb16 B
169 169 |/
170 170 o 0:cd010b8cd998 A
171 171
172 172 $ hg debugobsolete
173 173 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
174 174 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
175 175 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
176 176
177 177
178 178 More complex case where part of the rebase set were already rebased
179 179
180 180 $ hg rebase --rev 'desc(D)' --dest 'desc(H)'
181 181 rebasing 9:08483444fef9 "D"
182 182 $ hg debugobsolete
183 183 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
184 184 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
185 185 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
186 186 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob)
187 187 $ hg log -G
188 188 @ 11:4596109a6a43 D
189 189 |
190 190 | o 10:5ae4c968c6ac C
191 191 | |
192 192 | x 9:08483444fef9 D
193 193 | |
194 194 | o 8:8877864f1edb B
195 195 | |
196 196 o | 7:02de42196ebe H
197 197 | |
198 198 | o 6:eea13746799a G
199 199 |/|
200 200 o | 5:24b6387c8c8c F
201 201 | |
202 202 | o 4:9520eea781bc E
203 203 |/
204 204 o 0:cd010b8cd998 A
205 205
206 206 $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True
207 207 rebasing 8:8877864f1edb "B"
208 208 note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D"
209 209 rebasing 10:5ae4c968c6ac "C"
210 210 $ hg debugobsolete
211 211 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
212 212 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
213 213 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
214 214 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob)
215 215 8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (*) {'user': 'test'} (glob)
216 216 5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (*) {'user': 'test'} (glob)
217 217 $ hg log --rev 'divergent()'
218 218 $ hg log -G
219 219 o 13:98f6af4ee953 C
220 220 |
221 221 o 12:462a34d07e59 B
222 222 |
223 223 @ 11:4596109a6a43 D
224 224 |
225 225 o 7:02de42196ebe H
226 226 |
227 227 | o 6:eea13746799a G
228 228 |/|
229 229 o | 5:24b6387c8c8c F
230 230 | |
231 231 | o 4:9520eea781bc E
232 232 |/
233 233 o 0:cd010b8cd998 A
234 234
235 235 $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003
236 236 changeset: 11:4596109a6a4328c398bde3a4a3b6737cfade3003
237 237 phase: draft
238 238 parent: 7:02de42196ebee42ef284b6780a87cdc96e8eaab6
239 239 parent: -1:0000000000000000000000000000000000000000
240 240 manifest: 11:a91006e3a02f1edf631f7018e6e5684cf27dd905
241 241 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
242 242 date: Sat Apr 30 15:24:48 2011 +0200
243 243 files+: D
244 244 extra: branch=default
245 245 extra: rebase_source=08483444fef91d6224f6655ee586a65d263ad34c
246 246 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
247 247 description:
248 248 D
249 249
250 250
251 251 $ hg up -qr 'desc(G)'
252 252 $ hg graft 4596109a6a4328c398bde3a4a3b6737cfade3003
253 253 grafting 11:4596109a6a43 "D"
254 254 $ hg up -qr 'desc(E)'
255 255 $ hg rebase -s tip -d .
256 256 rebasing 14:9e36056a46e3 "D" (tip)
257 257 $ hg log --style default --debug -r tip
258 258 changeset: 15:627d4614809036ba22b9e7cb31638ddc06ab99ab
259 259 tag: tip
260 260 phase: draft
261 261 parent: 4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba
262 262 parent: -1:0000000000000000000000000000000000000000
263 263 manifest: 15:648e8ede73ae3e497d093d3a4c8fcc2daa864f42
264 264 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
265 265 date: Sat Apr 30 15:24:48 2011 +0200
266 266 files+: D
267 267 extra: branch=default
268 268 extra: intermediate-source=4596109a6a4328c398bde3a4a3b6737cfade3003
269 269 extra: rebase_source=9e36056a46e37c9776168c7375734eebc70e294f
270 270 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
271 271 description:
272 272 D
273 273
274 274
275 275 Start rebase from a commit that is obsolete but not hidden only because it's
276 276 a working copy parent. We should be moved back to the starting commit as usual
277 277 even though it is hidden (until we're moved there).
278 278
279 279 $ hg --hidden up -qr 'first(hidden())'
280 280 $ hg rebase --rev 13 --dest 15
281 281 rebasing 13:98f6af4ee953 "C"
282 282 $ hg log -G
283 283 o 16:294a2b93eb4d C
284 284 |
285 285 o 15:627d46148090 D
286 286 |
287 287 | o 12:462a34d07e59 B
288 288 | |
289 289 | o 11:4596109a6a43 D
290 290 | |
291 291 | o 7:02de42196ebe H
292 292 | |
293 293 +---o 6:eea13746799a G
294 294 | |/
295 295 | o 5:24b6387c8c8c F
296 296 | |
297 297 o | 4:9520eea781bc E
298 298 |/
299 299 | @ 1:42ccdea3bb16 B
300 300 |/
301 301 o 0:cd010b8cd998 A
302 302
303 303
304 304 $ cd ..
305 305
306 306 collapse rebase
307 307 ---------------------------------
308 308
309 309 $ hg clone base collapse
310 310 updating to branch default
311 311 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
312 312 $ cd collapse
313 313 $ hg rebase -s 42ccdea3bb16 -d eea13746799a --collapse
314 314 rebasing 1:42ccdea3bb16 "B"
315 315 rebasing 2:5fddd98957c8 "C"
316 316 rebasing 3:32af7686d403 "D"
317 317 $ hg log -G
318 318 o 8:4dc2197e807b Collapsed revision
319 319 |
320 320 | @ 7:02de42196ebe H
321 321 | |
322 322 o | 6:eea13746799a G
323 323 |\|
324 324 | o 5:24b6387c8c8c F
325 325 | |
326 326 o | 4:9520eea781bc E
327 327 |/
328 328 o 0:cd010b8cd998 A
329 329
330 330 $ hg log --hidden -G
331 331 o 8:4dc2197e807b Collapsed revision
332 332 |
333 333 | @ 7:02de42196ebe H
334 334 | |
335 335 o | 6:eea13746799a G
336 336 |\|
337 337 | o 5:24b6387c8c8c F
338 338 | |
339 339 o | 4:9520eea781bc E
340 340 |/
341 341 | x 3:32af7686d403 D
342 342 | |
343 343 | x 2:5fddd98957c8 C
344 344 | |
345 345 | x 1:42ccdea3bb16 B
346 346 |/
347 347 o 0:cd010b8cd998 A
348 348
349 349 $ hg id --debug -r tip
350 350 4dc2197e807bae9817f09905b50ab288be2dbbcf tip
351 351 $ hg debugobsolete
352 352 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
353 353 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
354 354 32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
355 355
356 356 $ cd ..
357 357
358 358 Rebase set has hidden descendants
359 359 ---------------------------------
360 360
361 361 We rebase a changeset which has a hidden changeset. The hidden changeset must
362 362 not be rebased.
363 363
364 364 $ hg clone base hidden
365 365 updating to branch default
366 366 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
367 367 $ cd hidden
368 368 $ hg rebase -s 5fddd98957c8 -d eea13746799a
369 369 rebasing 2:5fddd98957c8 "C"
370 370 rebasing 3:32af7686d403 "D"
371 371 $ hg rebase -s 42ccdea3bb16 -d 02de42196ebe
372 372 rebasing 1:42ccdea3bb16 "B"
373 373 $ hg log -G
374 374 o 10:7c6027df6a99 B
375 375 |
376 376 | o 9:cf44d2f5a9f4 D
377 377 | |
378 378 | o 8:e273c5e7d2d2 C
379 379 | |
380 380 @ | 7:02de42196ebe H
381 381 | |
382 382 | o 6:eea13746799a G
383 383 |/|
384 384 o | 5:24b6387c8c8c F
385 385 | |
386 386 | o 4:9520eea781bc E
387 387 |/
388 388 o 0:cd010b8cd998 A
389 389
390 390 $ hg log --hidden -G
391 391 o 10:7c6027df6a99 B
392 392 |
393 393 | o 9:cf44d2f5a9f4 D
394 394 | |
395 395 | o 8:e273c5e7d2d2 C
396 396 | |
397 397 @ | 7:02de42196ebe H
398 398 | |
399 399 | o 6:eea13746799a G
400 400 |/|
401 401 o | 5:24b6387c8c8c F
402 402 | |
403 403 | o 4:9520eea781bc E
404 404 |/
405 405 | x 3:32af7686d403 D
406 406 | |
407 407 | x 2:5fddd98957c8 C
408 408 | |
409 409 | x 1:42ccdea3bb16 B
410 410 |/
411 411 o 0:cd010b8cd998 A
412 412
413 413 $ hg debugobsolete
414 414 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (*) {'user': 'test'} (glob)
415 415 32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (*) {'user': 'test'} (glob)
416 416 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (*) {'user': 'test'} (glob)
417 417
418 418 Test that rewriting leaving instability behind is allowed
419 419 ---------------------------------------------------------------------
420 420
421 421 $ hg log -r 'children(8)'
422 422 9:cf44d2f5a9f4 D (no-eol)
423 423 $ hg rebase -r 8
424 424 rebasing 8:e273c5e7d2d2 "C"
425 425 $ hg log -G
426 426 o 11:0d8f238b634c C
427 427 |
428 428 o 10:7c6027df6a99 B
429 429 |
430 430 | o 9:cf44d2f5a9f4 D
431 431 | |
432 432 | x 8:e273c5e7d2d2 C
433 433 | |
434 434 @ | 7:02de42196ebe H
435 435 | |
436 436 | o 6:eea13746799a G
437 437 |/|
438 438 o | 5:24b6387c8c8c F
439 439 | |
440 440 | o 4:9520eea781bc E
441 441 |/
442 442 o 0:cd010b8cd998 A
443 443
444 444
445 445
446 446 Test multiple root handling
447 447 ------------------------------------
448 448
449 449 $ hg rebase --dest 4 --rev '7+11+9'
450 450 rebasing 9:cf44d2f5a9f4 "D"
451 451 rebasing 7:02de42196ebe "H"
452 452 not rebasing ignored 10:7c6027df6a99 "B"
453 453 rebasing 11:0d8f238b634c "C" (tip)
454 454 $ hg log -G
455 455 o 14:1e8370e38cca C
456 456 |
457 457 @ 13:bfe264faf697 H
458 458 |
459 459 | o 12:102b4c1d889b D
460 460 |/
461 461 | o 10:7c6027df6a99 B
462 462 | |
463 463 | x 7:02de42196ebe H
464 464 | |
465 465 +---o 6:eea13746799a G
466 466 | |/
467 467 | o 5:24b6387c8c8c F
468 468 | |
469 469 o | 4:9520eea781bc E
470 470 |/
471 471 o 0:cd010b8cd998 A
472 472
473 473 $ cd ..
474 474
475 475 test on rebase dropping a merge
476 476
477 477 (setup)
478 478
479 479 $ hg init dropmerge
480 480 $ cd dropmerge
481 481 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
482 482 adding changesets
483 483 adding manifests
484 484 adding file changes
485 485 added 8 changesets with 7 changes to 7 files (+2 heads)
486 486 (run 'hg heads' to see heads, 'hg merge' to merge)
487 487 $ hg up 3
488 488 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
489 489 $ hg merge 7
490 490 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
491 491 (branch merge, don't forget to commit)
492 492 $ hg ci -m 'M'
493 493 $ echo I > I
494 494 $ hg add I
495 495 $ hg ci -m I
496 496 $ hg log -G
497 497 @ 9:4bde274eefcf I
498 498 |
499 499 o 8:53a6a128b2b7 M
500 500 |\
501 501 | o 7:02de42196ebe H
502 502 | |
503 503 | | o 6:eea13746799a G
504 504 | |/|
505 505 | o | 5:24b6387c8c8c F
506 506 | | |
507 507 | | o 4:9520eea781bc E
508 508 | |/
509 509 o | 3:32af7686d403 D
510 510 | |
511 511 o | 2:5fddd98957c8 C
512 512 | |
513 513 o | 1:42ccdea3bb16 B
514 514 |/
515 515 o 0:cd010b8cd998 A
516 516
517 517 (actual test)
518 518
519 519 $ hg rebase --dest 6 --rev '((desc(H) + desc(D))::) - desc(M)'
520 520 rebasing 3:32af7686d403 "D"
521 521 rebasing 7:02de42196ebe "H"
522 522 not rebasing ignored 8:53a6a128b2b7 "M"
523 523 rebasing 9:4bde274eefcf "I" (tip)
524 524 $ hg log -G
525 525 @ 12:acd174b7ab39 I
526 526 |
527 527 o 11:6c11a6218c97 H
528 528 |
529 529 | o 10:b5313c85b22e D
530 530 |/
531 531 | o 8:53a6a128b2b7 M
532 532 | |\
533 533 | | x 7:02de42196ebe H
534 534 | | |
535 535 o---+ 6:eea13746799a G
536 536 | | |
537 537 | | o 5:24b6387c8c8c F
538 538 | | |
539 539 o---+ 4:9520eea781bc E
540 540 / /
541 541 x | 3:32af7686d403 D
542 542 | |
543 543 o | 2:5fddd98957c8 C
544 544 | |
545 545 o | 1:42ccdea3bb16 B
546 546 |/
547 547 o 0:cd010b8cd998 A
548 548
549 549
550 550 Test hidden changesets in the rebase set (issue4504)
551 551
552 552 $ hg up --hidden 9
553 553 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
554 554 $ echo J > J
555 555 $ hg add J
556 556 $ hg commit -m J
557 557 $ hg debugobsolete `hg log --rev . -T '{node}'`
558 558
559 559 $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback --config experimental.rebaseskipobsolete=off
560 560 rebasing 9:4bde274eefcf "I"
561 561 rebasing 13:06edfc82198f "J" (tip)
562 562 $ hg log -G
563 563 @ 15:5ae8a643467b J
564 564 |
565 565 o 14:9ad579b4a5de I
566 566 |
567 567 | o 12:acd174b7ab39 I
568 568 | |
569 569 | o 11:6c11a6218c97 H
570 570 | |
571 571 o | 10:b5313c85b22e D
572 572 |/
573 573 | o 8:53a6a128b2b7 M
574 574 | |\
575 575 | | x 7:02de42196ebe H
576 576 | | |
577 577 o---+ 6:eea13746799a G
578 578 | | |
579 579 | | o 5:24b6387c8c8c F
580 580 | | |
581 581 o---+ 4:9520eea781bc E
582 582 / /
583 583 x | 3:32af7686d403 D
584 584 | |
585 585 o | 2:5fddd98957c8 C
586 586 | |
587 587 o | 1:42ccdea3bb16 B
588 588 |/
589 589 o 0:cd010b8cd998 A
590 590
591 591 $ hg up 14 -C
592 592 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
593 593 $ echo "K" > K
594 594 $ hg add K
595 595 $ hg commit --amend -m "K"
596 596 $ echo "L" > L
597 597 $ hg add L
598 598 $ hg commit -m "L"
599 599 $ hg up '.^'
600 600 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
601 601 $ echo "M" > M
602 602 $ hg add M
603 603 $ hg commit --amend -m "M"
604 604 $ hg log -G
605 605 @ 20:bfaedf8eb73b M
606 606 |
607 607 | o 18:97219452e4bd L
608 608 | |
609 609 | x 17:fc37a630c901 K
610 610 |/
611 611 | o 15:5ae8a643467b J
612 612 | |
613 613 | x 14:9ad579b4a5de I
614 614 |/
615 615 | o 12:acd174b7ab39 I
616 616 | |
617 617 | o 11:6c11a6218c97 H
618 618 | |
619 619 o | 10:b5313c85b22e D
620 620 |/
621 621 | o 8:53a6a128b2b7 M
622 622 | |\
623 623 | | x 7:02de42196ebe H
624 624 | | |
625 625 o---+ 6:eea13746799a G
626 626 | | |
627 627 | | o 5:24b6387c8c8c F
628 628 | | |
629 629 o---+ 4:9520eea781bc E
630 630 / /
631 631 x | 3:32af7686d403 D
632 632 | |
633 633 o | 2:5fddd98957c8 C
634 634 | |
635 635 o | 1:42ccdea3bb16 B
636 636 |/
637 637 o 0:cd010b8cd998 A
638 638
639 639 $ hg rebase -s 14 -d 18 --config experimental.rebaseskipobsolete=True
640 640 note: not rebasing 14:9ad579b4a5de "I", already in destination as 17:fc37a630c901 "K"
641 641 rebasing 15:5ae8a643467b "J"
642 642
643 643 $ cd ..
644 644
645 645 Skip obsolete changeset even with multiple hops
646 646 -----------------------------------------------
647 647
648 648 setup
649 649
650 650 $ hg init obsskip
651 651 $ cd obsskip
652 652 $ cat << EOF >> .hg/hgrc
653 653 > [experimental]
654 654 > rebaseskipobsolete = True
655 655 > [extensions]
656 656 > strip =
657 657 > EOF
658 658 $ echo A > A
659 659 $ hg add A
660 660 $ hg commit -m A
661 661 $ echo B > B
662 662 $ hg add B
663 663 $ hg commit -m B0
664 664 $ hg commit --amend -m B1
665 665 $ hg commit --amend -m B2
666 666 $ hg up --hidden 'desc(B0)'
667 667 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
668 668 $ echo C > C
669 669 $ hg add C
670 670 $ hg commit -m C
671 671
672 672 Rebase finds its way in a chain of marker
673 673
674 674 $ hg rebase -d 'desc(B2)'
675 675 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
676 676 rebasing 4:212cb178bcbb "C" (tip)
677 677
678 678 Even when the chain include missing node
679 679
680 680 $ hg up --hidden 'desc(B0)'
681 681 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
682 682 $ echo D > D
683 683 $ hg add D
684 684 $ hg commit -m D
685 685 $ hg --hidden strip -r 'desc(B1)'
686 686 saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg (glob)
687 687
688 688 $ hg rebase -d 'desc(B2)'
689 689 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
690 690 rebasing 5:1a79b7535141 "D" (tip)
691 691 $ hg up 4
692 692 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
693 693 $ echo "O" > O
694 694 $ hg add O
695 695 $ hg commit -m O
696 696 $ echo "P" > P
697 697 $ hg add P
698 698 $ hg commit -m P
699 699 $ hg log -G
700 700 @ 8:8d47583e023f P
701 701 |
702 702 o 7:360bbaa7d3ce O
703 703 |
704 704 | o 6:9c48361117de D
705 705 | |
706 706 o | 4:ff2c4d47b71d C
707 707 |/
708 708 o 2:261e70097290 B2
709 709 |
710 710 o 0:4a2df7238c3b A
711 711
712 712 $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=all
713 713 $ hg rebase -d 6 -r "4::"
714 714 rebasing 4:ff2c4d47b71d "C"
715 715 note: not rebasing 7:360bbaa7d3ce "O", it has no successor
716 716 rebasing 8:8d47583e023f "P" (tip)
717 717
718 718 If all the changeset to be rebased are obsolete and present in the destination, we
719 719 should display a friendly error message
720 720
721 721 $ hg log -G
722 722 @ 10:121d9e3bc4c6 P
723 723 |
724 724 o 9:4be60e099a77 C
725 725 |
726 726 o 6:9c48361117de D
727 727 |
728 728 o 2:261e70097290 B2
729 729 |
730 730 o 0:4a2df7238c3b A
731 731
732 732
733 733 $ hg up 9
734 734 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
735 735 $ echo "non-relevant change" > nonrelevant
736 736 $ hg add nonrelevant
737 737 $ hg commit -m nonrelevant
738 738 created new head
739 739 $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=all
740 740 $ hg rebase -r . -d 10
741 741 note: not rebasing 11:f44da1f4954c "nonrelevant" (tip), it has no successor
742 742
743 743 If a rebase is going to create divergence, it should abort
744 744
745 745 $ hg log -G
746 746 @ 11:f44da1f4954c nonrelevant
747 747 |
748 748 | o 10:121d9e3bc4c6 P
749 749 |/
750 750 o 9:4be60e099a77 C
751 751 |
752 752 o 6:9c48361117de D
753 753 |
754 754 o 2:261e70097290 B2
755 755 |
756 756 o 0:4a2df7238c3b A
757 757
758 758
759 759 $ hg up 9
760 760 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
761 761 $ echo "john" > doe
762 762 $ hg add doe
763 763 $ hg commit -m "john doe"
764 764 created new head
765 765 $ hg up 10
766 766 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
767 767 $ echo "foo" > bar
768 768 $ hg add bar
769 769 $ hg commit --amend -m "10'"
770 770 $ hg up 10 --hidden
771 771 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
772 772 $ echo "bar" > foo
773 773 $ hg add foo
774 774 $ hg commit -m "bar foo"
775 775 $ hg log -G
776 776 @ 15:73568ab6879d bar foo
777 777 |
778 778 | o 14:77d874d096a2 10'
779 779 | |
780 780 | | o 12:3eb461388009 john doe
781 781 | |/
782 782 x | 10:121d9e3bc4c6 P
783 783 |/
784 784 o 9:4be60e099a77 C
785 785 |
786 786 o 6:9c48361117de D
787 787 |
788 788 o 2:261e70097290 B2
789 789 |
790 790 o 0:4a2df7238c3b A
791 791
792 792 $ hg summary
793 793 parent: 15:73568ab6879d tip (unstable)
794 794 bar foo
795 795 branch: default
796 796 commit: (clean)
797 797 update: 2 new changesets, 3 branch heads (merge)
798 798 phases: 8 draft
799 799 unstable: 1 changesets
800 800 $ hg rebase -s 10 -d 12
801 801 abort: this rebase will cause divergences from: 121d9e3bc4c6
802 802 (to force the rebase please set experimental.allowdivergence=True)
803 803 [255]
804 804 $ hg log -G
805 805 @ 15:73568ab6879d bar foo
806 806 |
807 807 | o 14:77d874d096a2 10'
808 808 | |
809 809 | | o 12:3eb461388009 john doe
810 810 | |/
811 811 x | 10:121d9e3bc4c6 P
812 812 |/
813 813 o 9:4be60e099a77 C
814 814 |
815 815 o 6:9c48361117de D
816 816 |
817 817 o 2:261e70097290 B2
818 818 |
819 819 o 0:4a2df7238c3b A
820 820
821 821 With experimental.allowdivergence=True, rebase can create divergence
822 822
823 823 $ hg rebase -s 10 -d 12 --config experimental.allowdivergence=True
824 824 rebasing 10:121d9e3bc4c6 "P"
825 825 rebasing 15:73568ab6879d "bar foo" (tip)
826 826 $ hg summary
827 827 parent: 17:61bd55f69bc4 tip
828 828 bar foo
829 829 branch: default
830 830 commit: (clean)
831 831 update: 1 new changesets, 2 branch heads (merge)
832 832 phases: 8 draft
833 833 divergent: 2 changesets
834 834
835 835 rebase --continue + skipped rev because their successors are in destination
836 836 we make a change in trunk and work on conflicting changes to make rebase abort.
837 837
838 838 $ hg log -G -r 17::
839 839 @ 17:61bd55f69bc4 bar foo
840 840 |
841 841 ~
842 842
843 843 Create the two changes in trunk
844 844 $ printf "a" > willconflict
845 845 $ hg add willconflict
846 846 $ hg commit -m "willconflict first version"
847 847
848 848 $ printf "dummy" > C
849 849 $ hg commit -m "dummy change successor"
850 850
851 851 Create the changes that we will rebase
852 852 $ hg update -C 17 -q
853 853 $ printf "b" > willconflict
854 854 $ hg add willconflict
855 855 $ hg commit -m "willconflict second version"
856 856 created new head
857 857 $ printf "dummy" > K
858 858 $ hg add K
859 859 $ hg commit -m "dummy change"
860 860 $ printf "dummy" > L
861 861 $ hg add L
862 862 $ hg commit -m "dummy change"
863 863 $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 19 -T '{node}'` --config experimental.evolution=all
864 864
865 865 $ hg log -G -r 17::
866 866 @ 22:7bdc8a87673d dummy change
867 867 |
868 868 x 21:8b31da3c4919 dummy change
869 869 |
870 870 o 20:b82fb57ea638 willconflict second version
871 871 |
872 872 | o 19:601db7a18f51 dummy change successor
873 873 | |
874 874 | o 18:357ddf1602d5 willconflict first version
875 875 |/
876 876 o 17:61bd55f69bc4 bar foo
877 877 |
878 878 ~
879 879 $ hg rebase -r ".^^ + .^ + ." -d 19
880 880 rebasing 20:b82fb57ea638 "willconflict second version"
881 881 merging willconflict
882 882 warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark')
883 883 unresolved conflicts (see hg resolve, then hg rebase --continue)
884 884 [1]
885 885
886 886 $ hg resolve --mark willconflict
887 887 (no more unresolved files)
888 888 continue: hg rebase --continue
889 889 $ hg rebase --continue
890 890 rebasing 20:b82fb57ea638 "willconflict second version"
891 891 note: not rebasing 21:8b31da3c4919 "dummy change", already in destination as 19:601db7a18f51 "dummy change successor"
892 892 rebasing 22:7bdc8a87673d "dummy change" (tip)
893 893 $ cd ..
894 894
895 895 rebase source is obsoleted (issue5198)
896 896 ---------------------------------
897 897
898 898 $ hg clone base amended
899 899 updating to branch default
900 900 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
901 901 $ cd amended
902 902 $ hg up 9520eea781bc
903 903 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
904 904 $ echo 1 >> E
905 $ hg commit --amend -m "E'"
905 $ hg commit --amend -m "E'" -d "0 0"
906 906 $ hg log -G
907 907 @ 9:69abe8906104 E'
908 908 |
909 909 | o 7:02de42196ebe H
910 910 | |
911 911 | | o 6:eea13746799a G
912 912 | |/|
913 913 | o | 5:24b6387c8c8c F
914 914 |/ /
915 915 | x 4:9520eea781bc E
916 916 |/
917 917 | o 3:32af7686d403 D
918 918 | |
919 919 | o 2:5fddd98957c8 C
920 920 | |
921 921 | o 1:42ccdea3bb16 B
922 922 |/
923 923 o 0:cd010b8cd998 A
924 924
925 925 $ hg rebase -d . -s 9520eea781bc
926 926 note: not rebasing 4:9520eea781bc "E", already in destination as 9:69abe8906104 "E'"
927 927 rebasing 6:eea13746799a "G"
928 928 $ hg log -G
929 929 o 10:17be06e82e95 G
930 930 |\
931 931 | @ 9:69abe8906104 E'
932 932 | |
933 933 +---o 7:02de42196ebe H
934 934 | |
935 935 o | 5:24b6387c8c8c F
936 936 |/
937 937 | o 3:32af7686d403 D
938 938 | |
939 939 | o 2:5fddd98957c8 C
940 940 | |
941 941 | o 1:42ccdea3bb16 B
942 942 |/
943 943 o 0:cd010b8cd998 A
944 944
945 945 $ cd ..
946 946
947 947 Test that bookmark is moved and working dir is updated when all changesets have
948 948 equivalents in destination
949 949 $ hg init rbsrepo && cd rbsrepo
950 950 $ echo "[experimental]" > .hg/hgrc
951 951 $ echo "evolution=all" >> .hg/hgrc
952 952 $ echo "rebaseskipobsolete=on" >> .hg/hgrc
953 953 $ echo root > root && hg ci -Am root
954 954 adding root
955 955 $ echo a > a && hg ci -Am a
956 956 adding a
957 957 $ hg up 0
958 958 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
959 959 $ echo b > b && hg ci -Am b
960 960 adding b
961 961 created new head
962 962 $ hg rebase -r 2 -d 1
963 963 rebasing 2:1e9a3c00cbe9 "b" (tip)
964 964 $ hg log -r . # working dir is at rev 3 (successor of 2)
965 965 3:be1832deae9a b (no-eol)
966 966 $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now
967 967 $ hg up 2 && hg log -r . # working dir is at rev 2 again
968 968 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
969 969 2:1e9a3c00cbe9 b (no-eol)
970 970 $ hg rebase -r 2 -d 3 --config experimental.evolution.track-operation=1
971 971 note: not rebasing 2:1e9a3c00cbe9 "b" (mybook), already in destination as 3:be1832deae9a "b"
972 972 Check that working directory was updated to rev 3 although rev 2 was skipped
973 973 during the rebase operation
974 974 $ hg log -r .
975 975 3:be1832deae9a b (no-eol)
976 976
977 977 Check that bookmark was moved to rev 3 although rev 2 was skipped
978 978 during the rebase operation
979 979 $ hg bookmarks
980 980 mybook 3:be1832deae9a
981 981 $ hg debugobsolete --rev tip
982 982 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (*) {'user': 'test'} (glob)
@@ -1,1175 +1,1180 b''
1 1 #require git
2 2
3 3 make git commits repeatable
4 4
5 $ cat >> $HGRCPATH <<EOF
6 > [defaults]
7 > commit = -d "0 0"
8 > EOF
9
5 10 $ echo "[core]" >> $HOME/.gitconfig
6 11 $ echo "autocrlf = false" >> $HOME/.gitconfig
7 12 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
8 13 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
9 14 $ GIT_AUTHOR_DATE='1234567891 +0000'; export GIT_AUTHOR_DATE
10 15 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
11 16 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
12 17 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
13 18 $ GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM
14 19
15 20 root hg repo
16 21
17 22 $ hg init t
18 23 $ cd t
19 24 $ echo a > a
20 25 $ hg add a
21 26 $ hg commit -m a
22 27 $ cd ..
23 28
24 29 new external git repo
25 30
26 31 $ mkdir gitroot
27 32 $ cd gitroot
28 33 $ git init -q
29 34 $ echo g > g
30 35 $ git add g
31 36 $ git commit -q -m g
32 37
33 38 add subrepo clone
34 39
35 40 $ cd ../t
36 41 $ echo 's = [git]../gitroot' > .hgsub
37 42 $ git clone -q ../gitroot s
38 43 $ hg add .hgsub
39 44 $ hg commit -m 'new git subrepo'
40 45 $ hg debugsub
41 46 path s
42 47 source ../gitroot
43 48 revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
44 49
45 50 record a new commit from upstream from a different branch
46 51
47 52 $ cd ../gitroot
48 53 $ git checkout -q -b testing
49 54 $ echo gg >> g
50 55 $ git commit -q -a -m gg
51 56
52 57 $ cd ../t/s
53 58 $ git pull -q >/dev/null 2>/dev/null
54 59 $ git checkout -q -b testing origin/testing >/dev/null
55 60
56 61 $ cd ..
57 62 $ hg status --subrepos
58 63 M s/g
59 64 $ hg commit -m 'update git subrepo'
60 65 $ hg debugsub
61 66 path s
62 67 source ../gitroot
63 68 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a
64 69
65 70 make $GITROOT pushable, by replacing it with a clone with nothing checked out
66 71
67 72 $ cd ..
68 73 $ git clone gitroot gitrootbare --bare -q
69 74 $ rm -rf gitroot
70 75 $ mv gitrootbare gitroot
71 76
72 77 clone root
73 78
74 79 $ cd t
75 80 $ hg clone . ../tc 2> /dev/null
76 81 updating to branch default
77 82 cloning subrepo s from $TESTTMP/gitroot
78 83 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
79 84 $ cd ../tc
80 85 $ hg debugsub
81 86 path s
82 87 source ../gitroot
83 88 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a
84 89
85 90 update to previous substate
86 91
87 92 $ hg update 1 -q
88 93 $ cat s/g
89 94 g
90 95 $ hg debugsub
91 96 path s
92 97 source ../gitroot
93 98 revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
94 99
95 100 clone root, make local change
96 101
97 102 $ cd ../t
98 103 $ hg clone . ../ta 2> /dev/null
99 104 updating to branch default
100 105 cloning subrepo s from $TESTTMP/gitroot
101 106 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
102 107
103 108 $ cd ../ta
104 109 $ echo ggg >> s/g
105 110 $ hg status --subrepos
106 111 M s/g
107 112 $ hg diff --subrepos
108 113 diff --git a/s/g b/s/g
109 114 index 089258f..85341ee 100644
110 115 --- a/s/g
111 116 +++ b/s/g
112 117 @@ -1,2 +1,3 @@
113 118 g
114 119 gg
115 120 +ggg
116 121 $ hg commit --subrepos -m ggg
117 122 committing subrepository s
118 123 $ hg debugsub
119 124 path s
120 125 source ../gitroot
121 126 revision 79695940086840c99328513acbe35f90fcd55e57
122 127
123 128 clone root separately, make different local change
124 129
125 130 $ cd ../t
126 131 $ hg clone . ../tb 2> /dev/null
127 132 updating to branch default
128 133 cloning subrepo s from $TESTTMP/gitroot
129 134 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
130 135
131 136 $ cd ../tb/s
132 137 $ hg status --subrepos
133 138 $ echo f > f
134 139 $ hg status --subrepos
135 140 ? s/f
136 141 $ hg add .
137 142 adding f
138 143 $ git add f
139 144 $ cd ..
140 145
141 146 $ hg status --subrepos
142 147 A s/f
143 148 $ hg commit --subrepos -m f
144 149 committing subrepository s
145 150 $ hg debugsub
146 151 path s
147 152 source ../gitroot
148 153 revision aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
149 154
150 155 user b push changes
151 156
152 157 $ hg push 2>/dev/null
153 158 pushing to $TESTTMP/t (glob)
154 159 pushing branch testing of subrepo s
155 160 searching for changes
156 161 adding changesets
157 162 adding manifests
158 163 adding file changes
159 164 added 1 changesets with 1 changes to 1 files
160 165
161 166 user a pulls, merges, commits
162 167
163 168 $ cd ../ta
164 169 $ hg pull
165 170 pulling from $TESTTMP/t (glob)
166 171 searching for changes
167 172 adding changesets
168 173 adding manifests
169 174 adding file changes
170 175 added 1 changesets with 1 changes to 1 files (+1 heads)
171 176 (run 'hg heads' to see heads, 'hg merge' to merge)
172 177 $ hg merge 2>/dev/null
173 178 subrepository s diverged (local revision: 7969594, remote revision: aa84837)
174 179 (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
175 180 pulling subrepo s from $TESTTMP/gitroot
176 181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
177 182 (branch merge, don't forget to commit)
178 183 $ hg st --subrepos s
179 184 A s/f
180 185 $ cat s/f
181 186 f
182 187 $ cat s/g
183 188 g
184 189 gg
185 190 ggg
186 191 $ hg commit --subrepos -m 'merge'
187 192 committing subrepository s
188 193 $ hg status --subrepos --rev 1:5
189 194 M .hgsubstate
190 195 M s/g
191 196 A s/f
192 197 $ hg debugsub
193 198 path s
194 199 source ../gitroot
195 200 revision f47b465e1bce645dbf37232a00574aa1546ca8d3
196 201 $ hg push 2>/dev/null
197 202 pushing to $TESTTMP/t (glob)
198 203 pushing branch testing of subrepo s
199 204 searching for changes
200 205 adding changesets
201 206 adding manifests
202 207 adding file changes
203 208 added 2 changesets with 2 changes to 1 files
204 209
205 210 make upstream git changes
206 211
207 212 $ cd ..
208 213 $ git clone -q gitroot gitclone
209 214 $ cd gitclone
210 215 $ echo ff >> f
211 216 $ git commit -q -a -m ff
212 217 $ echo fff >> f
213 218 $ git commit -q -a -m fff
214 219 $ git push origin testing 2>/dev/null
215 220
216 221 make and push changes to hg without updating the subrepo
217 222
218 223 $ cd ../t
219 224 $ hg clone . ../td 2>&1 | egrep -v '^Cloning into|^done\.'
220 225 updating to branch default
221 226 cloning subrepo s from $TESTTMP/gitroot
222 227 checking out detached HEAD in subrepo s
223 228 check out a git branch if you intend to make changes
224 229 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
225 230 $ cd ../td
226 231 $ echo aa >> a
227 232 $ hg commit -m aa
228 233 $ hg push
229 234 pushing to $TESTTMP/t (glob)
230 235 searching for changes
231 236 adding changesets
232 237 adding manifests
233 238 adding file changes
234 239 added 1 changesets with 1 changes to 1 files
235 240
236 241 sync to upstream git, distribute changes
237 242
238 243 $ cd ../ta
239 244 $ hg pull -u -q
240 245 $ cd s
241 246 $ git pull -q >/dev/null 2>/dev/null
242 247 $ cd ..
243 248 $ hg commit -m 'git upstream sync'
244 249 $ hg debugsub
245 250 path s
246 251 source ../gitroot
247 252 revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc
248 253 $ hg push -q
249 254
250 255 $ cd ../tb
251 256 $ hg pull -q
252 257 $ hg update 2>/dev/null
253 258 pulling subrepo s from $TESTTMP/gitroot
254 259 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
255 260 $ hg debugsub
256 261 path s
257 262 source ../gitroot
258 263 revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc
259 264
260 265 create a new git branch
261 266
262 267 $ cd s
263 268 $ git checkout -b b2
264 269 Switched to a new branch 'b2'
265 270 $ echo a>a
266 271 $ git add a
267 272 $ git commit -qm 'add a'
268 273 $ cd ..
269 274 $ hg commit -m 'add branch in s'
270 275
271 276 pulling new git branch should not create tracking branch named 'origin/b2'
272 277 (issue3870)
273 278 $ cd ../td/s
274 279 $ git remote set-url origin $TESTTMP/tb/s
275 280 $ git branch --no-track oldtesting
276 281 $ cd ..
277 282 $ hg pull -q ../tb
278 283 $ hg up
279 284 From $TESTTMP/tb/s
280 285 * [new branch] b2 -> origin/b2
281 286 Previous HEAD position was f47b465... merge
282 287 Switched to a new branch 'b2'
283 288 pulling subrepo s from $TESTTMP/tb/s
284 289 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
285 290
286 291 update to a revision without the subrepo, keeping the local git repository
287 292
288 293 $ cd ../t
289 294 $ hg up 0
290 295 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
291 296 $ ls -a s
292 297 .
293 298 ..
294 299 .git
295 300
296 301 $ hg up 2
297 302 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
298 303 $ ls -a s
299 304 .
300 305 ..
301 306 .git
302 307 g
303 308
304 309 archive subrepos
305 310
306 311 $ cd ../tc
307 312 $ hg pull -q
308 313 $ hg archive --subrepos -r 5 ../archive 2>/dev/null
309 314 pulling subrepo s from $TESTTMP/gitroot
310 315 $ cd ../archive
311 316 $ cat s/f
312 317 f
313 318 $ cat s/g
314 319 g
315 320 gg
316 321 ggg
317 322
318 323 $ hg -R ../tc archive --subrepo -r 5 -X ../tc/**f ../archive_x 2>/dev/null
319 324 $ find ../archive_x | sort | grep -v pax_global_header
320 325 ../archive_x
321 326 ../archive_x/.hg_archival.txt
322 327 ../archive_x/.hgsub
323 328 ../archive_x/.hgsubstate
324 329 ../archive_x/a
325 330 ../archive_x/s
326 331 ../archive_x/s/g
327 332
328 333 $ hg -R ../tc archive -S ../archive.tgz --prefix '.' 2>/dev/null
329 334 $ tar -tzf ../archive.tgz | sort | grep -v pax_global_header
330 335 .hg_archival.txt
331 336 .hgsub
332 337 .hgsubstate
333 338 a
334 339 s/g
335 340
336 341 create nested repo
337 342
338 343 $ cd ..
339 344 $ hg init outer
340 345 $ cd outer
341 346 $ echo b>b
342 347 $ hg add b
343 348 $ hg commit -m b
344 349
345 350 $ hg clone ../t inner 2> /dev/null
346 351 updating to branch default
347 352 cloning subrepo s from $TESTTMP/gitroot
348 353 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
349 354 $ echo inner = inner > .hgsub
350 355 $ hg add .hgsub
351 356 $ hg commit -m 'nested sub'
352 357
353 358 nested commit
354 359
355 360 $ echo ffff >> inner/s/f
356 361 $ hg status --subrepos
357 362 M inner/s/f
358 363 $ hg commit --subrepos -m nested
359 364 committing subrepository inner
360 365 committing subrepository inner/s (glob)
361 366
362 367 nested archive
363 368
364 369 $ hg archive --subrepos ../narchive
365 370 $ ls ../narchive/inner/s | grep -v pax_global_header
366 371 f
367 372 g
368 373
369 374 relative source expansion
370 375
371 376 $ cd ..
372 377 $ mkdir d
373 378 $ hg clone t d/t 2> /dev/null
374 379 updating to branch default
375 380 cloning subrepo s from $TESTTMP/gitroot
376 381 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
377 382
378 383 Don't crash if the subrepo is missing
379 384
380 385 $ hg clone t missing -q
381 386 $ cd missing
382 387 $ rm -rf s
383 388 $ hg status -S
384 389 $ hg sum | grep commit
385 390 commit: 1 subrepos
386 391 $ hg push -q
387 392 abort: subrepo s is missing (in subrepo s)
388 393 [255]
389 394 $ hg commit --subrepos -qm missing
390 395 abort: subrepo s is missing (in subrepo s)
391 396 [255]
392 397
393 398 #if symlink
394 399 Don't crash if subrepo is a broken symlink
395 400 $ ln -s broken s
396 401 $ hg status -S
397 402 $ hg push -q
398 403 abort: subrepo s is missing (in subrepo s)
399 404 [255]
400 405 $ hg commit --subrepos -qm missing
401 406 abort: subrepo s is missing (in subrepo s)
402 407 [255]
403 408 $ rm s
404 409 #endif
405 410
406 411 $ hg update -C 2> /dev/null
407 412 cloning subrepo s from $TESTTMP/gitroot
408 413 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
409 414 $ hg sum | grep commit
410 415 commit: (clean)
411 416
412 417 Don't crash if the .hgsubstate entry is missing
413 418
414 419 $ hg update 1 -q
415 420 $ hg rm .hgsubstate
416 421 $ hg commit .hgsubstate -m 'no substate'
417 422 nothing changed
418 423 [1]
419 424 $ hg tag -l nosubstate
420 425 $ hg manifest
421 426 .hgsub
422 427 .hgsubstate
423 428 a
424 429
425 430 $ hg status -S
426 431 R .hgsubstate
427 432 $ hg sum | grep commit
428 433 commit: 1 removed, 1 subrepos (new branch head)
429 434
430 435 $ hg commit -m 'restore substate'
431 436 nothing changed
432 437 [1]
433 438 $ hg manifest
434 439 .hgsub
435 440 .hgsubstate
436 441 a
437 442 $ hg sum | grep commit
438 443 commit: 1 removed, 1 subrepos (new branch head)
439 444
440 445 $ hg update -qC nosubstate
441 446 $ ls s
442 447 g
443 448
444 449 issue3109: false positives in git diff-index
445 450
446 451 $ hg update -q
447 452 $ touch -t 200001010000 s/g
448 453 $ hg status --subrepos
449 454 $ touch -t 200001010000 s/g
450 455 $ hg sum | grep commit
451 456 commit: (clean)
452 457
453 458 Check hg update --clean
454 459 $ cd $TESTTMP/ta
455 460 $ echo > s/g
456 461 $ cd s
457 462 $ echo c1 > f1
458 463 $ echo c1 > f2
459 464 $ git add f1
460 465 $ cd ..
461 466 $ hg status -S
462 467 M s/g
463 468 A s/f1
464 469 ? s/f2
465 470 $ ls s
466 471 f
467 472 f1
468 473 f2
469 474 g
470 475 $ hg update --clean
471 476 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
472 477 $ hg status -S
473 478 ? s/f1
474 479 ? s/f2
475 480 $ ls s
476 481 f
477 482 f1
478 483 f2
479 484 g
480 485
481 486 Sticky subrepositories, no changes
482 487 $ cd $TESTTMP/ta
483 488 $ hg id -n
484 489 7
485 490 $ cd s
486 491 $ git rev-parse HEAD
487 492 32a343883b74769118bb1d3b4b1fbf9156f4dddc
488 493 $ cd ..
489 494 $ hg update 1 > /dev/null 2>&1
490 495 $ hg id -n
491 496 1
492 497 $ cd s
493 498 $ git rev-parse HEAD
494 499 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
495 500 $ cd ..
496 501
497 502 Sticky subrepositories, file changes
498 503 $ touch s/f1
499 504 $ cd s
500 505 $ git add f1
501 506 $ cd ..
502 507 $ hg id -n
503 508 1+
504 509 $ cd s
505 510 $ git rev-parse HEAD
506 511 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
507 512 $ cd ..
508 513 $ hg update 4
509 514 subrepository s diverged (local revision: da5f5b1, remote revision: aa84837)
510 515 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
511 516 subrepository sources for s differ
512 517 use (l)ocal source (da5f5b1) or (r)emote source (aa84837)? l
513 518 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
514 519 $ hg id -n
515 520 4+
516 521 $ cd s
517 522 $ git rev-parse HEAD
518 523 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
519 524 $ cd ..
520 525 $ hg update --clean tip > /dev/null 2>&1
521 526
522 527 Sticky subrepository, revision updates
523 528 $ hg id -n
524 529 7
525 530 $ cd s
526 531 $ git rev-parse HEAD
527 532 32a343883b74769118bb1d3b4b1fbf9156f4dddc
528 533 $ cd ..
529 534 $ cd s
530 535 $ git checkout aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
531 536 Previous HEAD position was 32a3438... fff
532 537 HEAD is now at aa84837... f
533 538 $ cd ..
534 539 $ hg update 1
535 540 subrepository s diverged (local revision: 32a3438, remote revision: da5f5b1)
536 541 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
537 542 subrepository sources for s differ (in checked out version)
538 543 use (l)ocal source (32a3438) or (r)emote source (da5f5b1)? l
539 544 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
540 545 $ hg id -n
541 546 1+
542 547 $ cd s
543 548 $ git rev-parse HEAD
544 549 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
545 550 $ cd ..
546 551
547 552 Sticky subrepository, file changes and revision updates
548 553 $ touch s/f1
549 554 $ cd s
550 555 $ git add f1
551 556 $ git rev-parse HEAD
552 557 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
553 558 $ cd ..
554 559 $ hg id -n
555 560 1+
556 561 $ hg update 7
557 562 subrepository s diverged (local revision: 32a3438, remote revision: 32a3438)
558 563 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
559 564 subrepository sources for s differ
560 565 use (l)ocal source (32a3438) or (r)emote source (32a3438)? l
561 566 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
562 567 $ hg id -n
563 568 7+
564 569 $ cd s
565 570 $ git rev-parse HEAD
566 571 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
567 572 $ cd ..
568 573
569 574 Sticky repository, update --clean
570 575 $ hg update --clean tip 2>/dev/null
571 576 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
572 577 $ hg id -n
573 578 7
574 579 $ cd s
575 580 $ git rev-parse HEAD
576 581 32a343883b74769118bb1d3b4b1fbf9156f4dddc
577 582 $ cd ..
578 583
579 584 Test subrepo already at intended revision:
580 585 $ cd s
581 586 $ git checkout 32a343883b74769118bb1d3b4b1fbf9156f4dddc
582 587 HEAD is now at 32a3438... fff
583 588 $ cd ..
584 589 $ hg update 1
585 590 Previous HEAD position was 32a3438... fff
586 591 HEAD is now at da5f5b1... g
587 592 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
588 593 $ hg id -n
589 594 1
590 595 $ cd s
591 596 $ git rev-parse HEAD
592 597 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
593 598 $ cd ..
594 599
595 600 Test forgetting files, not implemented in git subrepo, used to
596 601 traceback
597 602 #if no-windows
598 603 $ hg forget 'notafile*'
599 604 notafile*: No such file or directory
600 605 [1]
601 606 #else
602 607 $ hg forget 'notafile'
603 608 notafile: * (glob)
604 609 [1]
605 610 #endif
606 611
607 612 $ cd ..
608 613
609 614 Test sanitizing ".hg/hgrc" in subrepo
610 615
611 616 $ cd t
612 617 $ hg tip -q
613 618 7:af6d2edbb0d3
614 619 $ hg update -q -C af6d2edbb0d3
615 620 $ cd s
616 621 $ git checkout -q -b sanitize-test
617 622 $ mkdir .hg
618 623 $ echo '.hg/hgrc in git repo' > .hg/hgrc
619 624 $ mkdir -p sub/.hg
620 625 $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc
621 626 $ git add .hg sub
622 627 $ git commit -qm 'add .hg/hgrc to be sanitized at hg update'
623 628 $ git push -q origin sanitize-test
624 629 $ cd ..
625 630 $ grep ' s$' .hgsubstate
626 631 32a343883b74769118bb1d3b4b1fbf9156f4dddc s
627 632 $ hg commit -qm 'commit with git revision including .hg/hgrc'
628 633 $ hg parents -q
629 634 8:3473d20bddcf
630 635 $ grep ' s$' .hgsubstate
631 636 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
632 637 $ cd ..
633 638
634 639 $ hg -R tc pull -q
635 640 $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort
636 641 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
637 642 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
638 643 $ cd tc
639 644 $ hg parents -q
640 645 8:3473d20bddcf
641 646 $ grep ' s$' .hgsubstate
642 647 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
643 648 $ test -f s/.hg/hgrc
644 649 [1]
645 650 $ test -f s/sub/.hg/hgrc
646 651 [1]
647 652 $ cd ..
648 653
649 654 additional test for "git merge --ff" route:
650 655
651 656 $ cd t
652 657 $ hg tip -q
653 658 8:3473d20bddcf
654 659 $ hg update -q -C af6d2edbb0d3
655 660 $ cd s
656 661 $ git checkout -q testing
657 662 $ mkdir .hg
658 663 $ echo '.hg/hgrc in git repo' > .hg/hgrc
659 664 $ mkdir -p sub/.hg
660 665 $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc
661 666 $ git add .hg sub
662 667 $ git commit -qm 'add .hg/hgrc to be sanitized at hg update (git merge --ff)'
663 668 $ git push -q origin testing
664 669 $ cd ..
665 670 $ grep ' s$' .hgsubstate
666 671 32a343883b74769118bb1d3b4b1fbf9156f4dddc s
667 672 $ hg commit -qm 'commit with git revision including .hg/hgrc'
668 673 $ hg parents -q
669 674 9:ed23f7fe024e
670 675 $ grep ' s$' .hgsubstate
671 676 f262643c1077219fbd3858d54e78ef050ef84fbf s
672 677 $ cd ..
673 678
674 679 $ cd tc
675 680 $ hg update -q -C af6d2edbb0d3
676 681 $ test -f s/.hg/hgrc
677 682 [1]
678 683 $ test -f s/sub/.hg/hgrc
679 684 [1]
680 685 $ cd ..
681 686 $ hg -R tc pull -q
682 687 $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort
683 688 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
684 689 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
685 690 $ cd tc
686 691 $ hg parents -q
687 692 9:ed23f7fe024e
688 693 $ grep ' s$' .hgsubstate
689 694 f262643c1077219fbd3858d54e78ef050ef84fbf s
690 695 $ test -f s/.hg/hgrc
691 696 [1]
692 697 $ test -f s/sub/.hg/hgrc
693 698 [1]
694 699
695 700 Test that sanitizing is omitted in meta data area:
696 701
697 702 $ mkdir s/.git/.hg
698 703 $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc
699 704 $ hg update -q -C af6d2edbb0d3
700 705 checking out detached HEAD in subrepo s
701 706 check out a git branch if you intend to make changes
702 707
703 708 check differences made by most recent change
704 709 $ cd s
705 710 $ cat > foobar << EOF
706 711 > woopwoop
707 712 >
708 713 > foo
709 714 > bar
710 715 > EOF
711 716 $ git add foobar
712 717 $ cd ..
713 718
714 719 $ hg diff --subrepos
715 720 diff --git a/s/foobar b/s/foobar
716 721 new file mode 100644
717 722 index 0000000..8a5a5e2
718 723 --- /dev/null
719 724 +++ b/s/foobar
720 725 @@ -0,0 +1,4 @@
721 726 +woopwoop
722 727 +
723 728 +foo
724 729 +bar
725 730
726 731 $ hg commit --subrepos -m "Added foobar"
727 732 committing subrepository s
728 733 created new head
729 734
730 735 $ hg diff -c . --subrepos --nodates
731 736 diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate
732 737 --- a/.hgsubstate
733 738 +++ b/.hgsubstate
734 739 @@ -1,1 +1,1 @@
735 740 -32a343883b74769118bb1d3b4b1fbf9156f4dddc s
736 741 +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s
737 742 diff --git a/s/foobar b/s/foobar
738 743 new file mode 100644
739 744 index 0000000..8a5a5e2
740 745 --- /dev/null
741 746 +++ b/s/foobar
742 747 @@ -0,0 +1,4 @@
743 748 +woopwoop
744 749 +
745 750 +foo
746 751 +bar
747 752
748 753 check output when only diffing the subrepository
749 754 $ hg diff -c . --subrepos s
750 755 diff --git a/s/foobar b/s/foobar
751 756 new file mode 100644
752 757 index 0000000..8a5a5e2
753 758 --- /dev/null
754 759 +++ b/s/foobar
755 760 @@ -0,0 +1,4 @@
756 761 +woopwoop
757 762 +
758 763 +foo
759 764 +bar
760 765
761 766 check output when diffing something else
762 767 $ hg diff -c . --subrepos .hgsubstate --nodates
763 768 diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate
764 769 --- a/.hgsubstate
765 770 +++ b/.hgsubstate
766 771 @@ -1,1 +1,1 @@
767 772 -32a343883b74769118bb1d3b4b1fbf9156f4dddc s
768 773 +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s
769 774
770 775 add new changes, including whitespace
771 776 $ cd s
772 777 $ cat > foobar << EOF
773 778 > woop woop
774 779 >
775 780 > foo
776 781 > bar
777 782 > EOF
778 783 $ echo foo > barfoo
779 784 $ git add barfoo
780 785 $ cd ..
781 786
782 787 $ hg diff --subrepos --ignore-all-space
783 788 diff --git a/s/barfoo b/s/barfoo
784 789 new file mode 100644
785 790 index 0000000..257cc56
786 791 --- /dev/null
787 792 +++ b/s/barfoo
788 793 @@ -0,0 +1* @@ (glob)
789 794 +foo
790 795 $ hg diff --subrepos s/foobar
791 796 diff --git a/s/foobar b/s/foobar
792 797 index 8a5a5e2..bd5812a 100644
793 798 --- a/s/foobar
794 799 +++ b/s/foobar
795 800 @@ -1,4 +1,4 @@
796 801 -woopwoop
797 802 +woop woop
798 803
799 804 foo
800 805 bar
801 806
802 807 execute a diffstat
803 808 the output contains a regex, because git 1.7.10 and 1.7.11
804 809 change the amount of whitespace
805 810 $ hg diff --subrepos --stat
806 811 \s*barfoo |\s*1 + (re)
807 812 \s*foobar |\s*2 +- (re)
808 813 2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) (re)
809 814
810 815 adding an include should ignore the other elements
811 816 $ hg diff --subrepos -I s/foobar
812 817 diff --git a/s/foobar b/s/foobar
813 818 index 8a5a5e2..bd5812a 100644
814 819 --- a/s/foobar
815 820 +++ b/s/foobar
816 821 @@ -1,4 +1,4 @@
817 822 -woopwoop
818 823 +woop woop
819 824
820 825 foo
821 826 bar
822 827
823 828 adding an exclude should ignore this element
824 829 $ hg diff --subrepos -X s/foobar
825 830 diff --git a/s/barfoo b/s/barfoo
826 831 new file mode 100644
827 832 index 0000000..257cc56
828 833 --- /dev/null
829 834 +++ b/s/barfoo
830 835 @@ -0,0 +1* @@ (glob)
831 836 +foo
832 837
833 838 moving a file should show a removal and an add
834 839 $ hg revert --all
835 840 reverting subrepo ../gitroot
836 841 $ cd s
837 842 $ git mv foobar woop
838 843 $ cd ..
839 844 $ hg diff --subrepos
840 845 diff --git a/s/foobar b/s/foobar
841 846 deleted file mode 100644
842 847 index 8a5a5e2..0000000
843 848 --- a/s/foobar
844 849 +++ /dev/null
845 850 @@ -1,4 +0,0 @@
846 851 -woopwoop
847 852 -
848 853 -foo
849 854 -bar
850 855 diff --git a/s/woop b/s/woop
851 856 new file mode 100644
852 857 index 0000000..8a5a5e2
853 858 --- /dev/null
854 859 +++ b/s/woop
855 860 @@ -0,0 +1,4 @@
856 861 +woopwoop
857 862 +
858 863 +foo
859 864 +bar
860 865 $ rm s/woop
861 866
862 867 revert the subrepository
863 868 $ hg revert --all
864 869 reverting subrepo ../gitroot
865 870
866 871 $ hg status --subrepos
867 872 ? s/barfoo
868 873 ? s/foobar.orig
869 874
870 875 $ mv s/foobar.orig s/foobar
871 876
872 877 $ hg revert --no-backup s
873 878 reverting subrepo ../gitroot
874 879
875 880 $ hg status --subrepos
876 881 ? s/barfoo
877 882
878 883 revert moves orig files to the right place
879 884 $ echo 'bloop' > s/foobar
880 885 $ hg revert --all --verbose --config 'ui.origbackuppath=.hg/origbackups'
881 886 reverting subrepo ../gitroot
882 887 creating directory: $TESTTMP/tc/.hg/origbackups (glob)
883 888 saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar.orig (glob)
884 889 $ ls .hg/origbackups
885 890 foobar.orig
886 891 $ rm -rf .hg/origbackups
887 892
888 893 show file at specific revision
889 894 $ cat > s/foobar << EOF
890 895 > woop woop
891 896 > fooo bar
892 897 > EOF
893 898 $ hg commit --subrepos -m "updated foobar"
894 899 committing subrepository s
895 900 $ cat > s/foobar << EOF
896 901 > current foobar
897 902 > (should not be visible using hg cat)
898 903 > EOF
899 904
900 905 $ hg cat -r . s/foobar
901 906 woop woop
902 907 fooo bar (no-eol)
903 908 $ hg cat -r "parents(.)" s/foobar > catparents
904 909
905 910 $ mkdir -p tmp/s
906 911
907 912 $ hg cat -r "parents(.)" --output tmp/%% s/foobar
908 913 $ diff tmp/% catparents
909 914
910 915 $ hg cat -r "parents(.)" --output tmp/%s s/foobar
911 916 $ diff tmp/foobar catparents
912 917
913 918 $ hg cat -r "parents(.)" --output tmp/%d/otherfoobar s/foobar
914 919 $ diff tmp/s/otherfoobar catparents
915 920
916 921 $ hg cat -r "parents(.)" --output tmp/%p s/foobar
917 922 $ diff tmp/s/foobar catparents
918 923
919 924 $ hg cat -r "parents(.)" --output tmp/%H s/foobar
920 925 $ diff tmp/255ee8cf690ec86e99b1e80147ea93ece117cd9d catparents
921 926
922 927 $ hg cat -r "parents(.)" --output tmp/%R s/foobar
923 928 $ diff tmp/10 catparents
924 929
925 930 $ hg cat -r "parents(.)" --output tmp/%h s/foobar
926 931 $ diff tmp/255ee8cf690e catparents
927 932
928 933 $ rm tmp/10
929 934 $ hg cat -r "parents(.)" --output tmp/%r s/foobar
930 935 $ diff tmp/10 catparents
931 936
932 937 $ mkdir tmp/tc
933 938 $ hg cat -r "parents(.)" --output tmp/%b/foobar s/foobar
934 939 $ diff tmp/tc/foobar catparents
935 940
936 941 cleanup
937 942 $ rm -r tmp
938 943 $ rm catparents
939 944
940 945 add git files, using either files or patterns
941 946 $ echo "hsss! hsssssssh!" > s/snake.python
942 947 $ echo "ccc" > s/c.c
943 948 $ echo "cpp" > s/cpp.cpp
944 949
945 950 $ hg add s/snake.python s/c.c s/cpp.cpp
946 951 $ hg st --subrepos s
947 952 M s/foobar
948 953 A s/c.c
949 954 A s/cpp.cpp
950 955 A s/snake.python
951 956 ? s/barfoo
952 957 $ hg revert s
953 958 reverting subrepo ../gitroot
954 959
955 960 $ hg add --subrepos "glob:**.python"
956 961 adding s/snake.python (glob)
957 962 $ hg st --subrepos s
958 963 A s/snake.python
959 964 ? s/barfoo
960 965 ? s/c.c
961 966 ? s/cpp.cpp
962 967 ? s/foobar.orig
963 968 $ hg revert s
964 969 reverting subrepo ../gitroot
965 970
966 971 $ hg add --subrepos s
967 972 adding s/barfoo (glob)
968 973 adding s/c.c (glob)
969 974 adding s/cpp.cpp (glob)
970 975 adding s/foobar.orig (glob)
971 976 adding s/snake.python (glob)
972 977 $ hg st --subrepos s
973 978 A s/barfoo
974 979 A s/c.c
975 980 A s/cpp.cpp
976 981 A s/foobar.orig
977 982 A s/snake.python
978 983 $ hg revert s
979 984 reverting subrepo ../gitroot
980 985 make sure everything is reverted correctly
981 986 $ hg st --subrepos s
982 987 ? s/barfoo
983 988 ? s/c.c
984 989 ? s/cpp.cpp
985 990 ? s/foobar.orig
986 991 ? s/snake.python
987 992
988 993 $ hg add --subrepos --exclude "path:s/c.c"
989 994 adding s/barfoo (glob)
990 995 adding s/cpp.cpp (glob)
991 996 adding s/foobar.orig (glob)
992 997 adding s/snake.python (glob)
993 998 $ hg st --subrepos s
994 999 A s/barfoo
995 1000 A s/cpp.cpp
996 1001 A s/foobar.orig
997 1002 A s/snake.python
998 1003 ? s/c.c
999 1004 $ hg revert --all -q
1000 1005
1001 1006 .hgignore should not have influence in subrepos
1002 1007 $ cat > .hgignore << EOF
1003 1008 > syntax: glob
1004 1009 > *.python
1005 1010 > EOF
1006 1011 $ hg add .hgignore
1007 1012 $ hg add --subrepos "glob:**.python" s/barfoo
1008 1013 adding s/snake.python (glob)
1009 1014 $ hg st --subrepos s
1010 1015 A s/barfoo
1011 1016 A s/snake.python
1012 1017 ? s/c.c
1013 1018 ? s/cpp.cpp
1014 1019 ? s/foobar.orig
1015 1020 $ hg revert --all -q
1016 1021
1017 1022 .gitignore should have influence,
1018 1023 except for explicitly added files (no patterns)
1019 1024 $ cat > s/.gitignore << EOF
1020 1025 > *.python
1021 1026 > EOF
1022 1027 $ hg add s/.gitignore
1023 1028 $ hg st --subrepos s
1024 1029 A s/.gitignore
1025 1030 ? s/barfoo
1026 1031 ? s/c.c
1027 1032 ? s/cpp.cpp
1028 1033 ? s/foobar.orig
1029 1034 $ hg st --subrepos s --all
1030 1035 A s/.gitignore
1031 1036 ? s/barfoo
1032 1037 ? s/c.c
1033 1038 ? s/cpp.cpp
1034 1039 ? s/foobar.orig
1035 1040 I s/snake.python
1036 1041 C s/f
1037 1042 C s/foobar
1038 1043 C s/g
1039 1044 $ hg add --subrepos "glob:**.python"
1040 1045 $ hg st --subrepos s
1041 1046 A s/.gitignore
1042 1047 ? s/barfoo
1043 1048 ? s/c.c
1044 1049 ? s/cpp.cpp
1045 1050 ? s/foobar.orig
1046 1051 $ hg add --subrepos s/snake.python
1047 1052 $ hg st --subrepos s
1048 1053 A s/.gitignore
1049 1054 A s/snake.python
1050 1055 ? s/barfoo
1051 1056 ? s/c.c
1052 1057 ? s/cpp.cpp
1053 1058 ? s/foobar.orig
1054 1059
1055 1060 correctly do a dry run
1056 1061 $ hg add --subrepos s --dry-run
1057 1062 adding s/barfoo (glob)
1058 1063 adding s/c.c (glob)
1059 1064 adding s/cpp.cpp (glob)
1060 1065 adding s/foobar.orig (glob)
1061 1066 $ hg st --subrepos s
1062 1067 A s/.gitignore
1063 1068 A s/snake.python
1064 1069 ? s/barfoo
1065 1070 ? s/c.c
1066 1071 ? s/cpp.cpp
1067 1072 ? s/foobar.orig
1068 1073
1069 1074 error given when adding an already tracked file
1070 1075 $ hg add s/.gitignore
1071 1076 s/.gitignore already tracked!
1072 1077 [1]
1073 1078 $ hg add s/g
1074 1079 s/g already tracked!
1075 1080 [1]
1076 1081
1077 1082 removed files can be re-added
1078 1083 removing files using 'rm' or 'git rm' has the same effect,
1079 1084 since we ignore the staging area
1080 1085 $ hg ci --subrepos -m 'snake'
1081 1086 committing subrepository s
1082 1087 $ cd s
1083 1088 $ rm snake.python
1084 1089 (remove leftover .hg so Mercurial doesn't look for a root here)
1085 1090 $ rm -rf .hg
1086 1091 $ hg status --subrepos --all .
1087 1092 R snake.python
1088 1093 ? barfoo
1089 1094 ? c.c
1090 1095 ? cpp.cpp
1091 1096 ? foobar.orig
1092 1097 C .gitignore
1093 1098 C f
1094 1099 C foobar
1095 1100 C g
1096 1101 $ git rm snake.python
1097 1102 rm 'snake.python'
1098 1103 $ hg status --subrepos --all .
1099 1104 R snake.python
1100 1105 ? barfoo
1101 1106 ? c.c
1102 1107 ? cpp.cpp
1103 1108 ? foobar.orig
1104 1109 C .gitignore
1105 1110 C f
1106 1111 C foobar
1107 1112 C g
1108 1113 $ touch snake.python
1109 1114 $ cd ..
1110 1115 $ hg add s/snake.python
1111 1116 $ hg status -S
1112 1117 M s/snake.python
1113 1118 ? .hgignore
1114 1119 ? s/barfoo
1115 1120 ? s/c.c
1116 1121 ? s/cpp.cpp
1117 1122 ? s/foobar.orig
1118 1123 $ hg revert --all -q
1119 1124
1120 1125 make sure we show changed files, rather than changed subtrees
1121 1126 $ mkdir s/foo
1122 1127 $ touch s/foo/bwuh
1123 1128 $ hg add s/foo/bwuh
1124 1129 $ hg commit -S -m "add bwuh"
1125 1130 committing subrepository s
1126 1131 $ hg status -S --change .
1127 1132 M .hgsubstate
1128 1133 A s/foo/bwuh
1129 1134 ? s/barfoo
1130 1135 ? s/c.c
1131 1136 ? s/cpp.cpp
1132 1137 ? s/foobar.orig
1133 1138 ? s/snake.python.orig
1134 1139
1135 1140 test for Git CVE-2016-3068
1136 1141 $ hg init malicious-subrepository
1137 1142 $ cd malicious-subrepository
1138 1143 $ echo "s = [git]ext::sh -c echo% pwned:% \$PWNED_MSG% >pwned.txt" > .hgsub
1139 1144 $ git init s
1140 1145 Initialized empty Git repository in $TESTTMP/tc/malicious-subrepository/s/.git/
1141 1146 $ cd s
1142 1147 $ git commit --allow-empty -m 'empty'
1143 1148 [master (root-commit) 153f934] empty
1144 1149 $ cd ..
1145 1150 $ hg add .hgsub
1146 1151 $ hg commit -m "add subrepo"
1147 1152 $ cd ..
1148 1153 $ rm -f pwned.txt
1149 1154 $ unset GIT_ALLOW_PROTOCOL
1150 1155 $ PWNED_MSG="your git is too old or mercurial has regressed" hg clone \
1151 1156 > malicious-subrepository malicious-subrepository-protected
1152 1157 Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'... (glob)
1153 1158 fatal: transport 'ext' not allowed
1154 1159 updating to branch default
1155 1160 cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt
1156 1161 abort: git clone error 128 in s (in subrepo s)
1157 1162 [255]
1158 1163 $ f -Dq pwned.txt
1159 1164 pwned.txt: file not found
1160 1165
1161 1166 whitelisting of ext should be respected (that's the git submodule behaviour)
1162 1167 $ rm -f pwned.txt
1163 1168 $ env GIT_ALLOW_PROTOCOL=ext PWNED_MSG="you asked for it" hg clone \
1164 1169 > malicious-subrepository malicious-subrepository-clone-allowed
1165 1170 Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'... (glob)
1166 1171 fatal: Could not read from remote repository.
1167 1172
1168 1173 Please make sure you have the correct access rights
1169 1174 and the repository exists.
1170 1175 updating to branch default
1171 1176 cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt
1172 1177 abort: git clone error 128 in s (in subrepo s)
1173 1178 [255]
1174 1179 $ f -Dq pwned.txt
1175 1180 pwned: you asked for it
General Comments 0
You need to be logged in to leave comments. Login now