##// END OF EJS Templates
tests: replace uses of 'seq' with portable 'seq.py'
Matt Harbison -
r24361:8de8cd34 default
parent child Browse files
Show More
@@ -1,601 +1,596 b''
1 1 #require serve
2 2
3 3 $ cat << EOF >> $HGRCPATH
4 4 > [ui]
5 5 > logtemplate={rev}:{node|short} {desc|firstline}
6 6 > [phases]
7 7 > publish=False
8 8 > [experimental]
9 9 > evolution=createmarkers,exchange
10 10 > EOF
11 11
12 12 initialize
13 13
14 14 $ hg init a
15 15 $ cd a
16 16 $ echo 'test' > test
17 17 $ hg commit -Am'test'
18 18 adding test
19 19
20 20 set bookmarks
21 21
22 22 $ hg bookmark X
23 23 $ hg bookmark Y
24 24 $ hg bookmark Z
25 25
26 26 import bookmark by name
27 27
28 28 $ hg init ../b
29 29 $ cd ../b
30 30 $ hg book Y
31 31 $ hg book
32 32 * Y -1:000000000000
33 33 $ hg pull ../a
34 34 pulling from ../a
35 35 requesting all changes
36 36 adding changesets
37 37 adding manifests
38 38 adding file changes
39 39 added 1 changesets with 1 changes to 1 files
40 40 adding remote bookmark X
41 41 updating bookmark Y
42 42 adding remote bookmark Z
43 43 (run 'hg update' to get a working copy)
44 44 $ hg bookmarks
45 45 X 0:4e3505fd9583
46 46 * Y 0:4e3505fd9583
47 47 Z 0:4e3505fd9583
48 48 $ hg debugpushkey ../a namespaces
49 49 bookmarks
50 50 namespaces
51 51 obsolete
52 52 phases
53 53 $ hg debugpushkey ../a bookmarks
54 54 X 4e3505fd95835d721066b76e75dbb8cc554d7f77
55 55 Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
56 56 Z 4e3505fd95835d721066b76e75dbb8cc554d7f77
57 57
58 58 delete the bookmark to re-pull it
59 59
60 60 $ hg book -d X
61 61 $ hg pull -B X ../a
62 62 pulling from ../a
63 63 no changes found
64 64 adding remote bookmark X
65 65
66 66 finally no-op pull
67 67
68 68 $ hg pull -B X ../a
69 69 pulling from ../a
70 70 no changes found
71 71 $ hg bookmark
72 72 X 0:4e3505fd9583
73 73 * Y 0:4e3505fd9583
74 74 Z 0:4e3505fd9583
75 75
76 76 export bookmark by name
77 77
78 78 $ hg bookmark W
79 79 $ hg bookmark foo
80 80 $ hg bookmark foobar
81 81 $ hg push -B W ../a
82 82 pushing to ../a
83 83 searching for changes
84 84 no changes found
85 85 exporting bookmark W
86 86 [1]
87 87 $ hg -R ../a bookmarks
88 88 W -1:000000000000
89 89 X 0:4e3505fd9583
90 90 Y 0:4e3505fd9583
91 91 * Z 0:4e3505fd9583
92 92
93 93 delete a remote bookmark
94 94
95 95 $ hg book -d W
96 96 $ hg push -B W ../a
97 97 pushing to ../a
98 98 searching for changes
99 99 no changes found
100 100 deleting remote bookmark W
101 101 [1]
102 102
103 103 push/pull name that doesn't exist
104 104
105 105 $ hg push -B badname ../a
106 106 pushing to ../a
107 107 searching for changes
108 108 bookmark badname does not exist on the local or remote repository!
109 109 no changes found
110 110 [2]
111 111 $ hg pull -B anotherbadname ../a
112 112 pulling from ../a
113 113 abort: remote bookmark anotherbadname not found!
114 114 [255]
115 115
116 116 divergent bookmarks
117 117
118 118 $ cd ../a
119 119 $ echo c1 > f1
120 120 $ hg ci -Am1
121 121 adding f1
122 122 $ hg book -f @
123 123 $ hg book -f X
124 124 $ hg book
125 125 @ 1:0d2164f0ce0d
126 126 * X 1:0d2164f0ce0d
127 127 Y 0:4e3505fd9583
128 128 Z 1:0d2164f0ce0d
129 129
130 130 $ cd ../b
131 131 $ hg up
132 132 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
133 133 updating bookmark foobar
134 134 $ echo c2 > f2
135 135 $ hg ci -Am2
136 136 adding f2
137 137 $ hg book -if @
138 138 $ hg book -if X
139 139 $ hg book
140 140 @ 1:9b140be10808
141 141 X 1:9b140be10808
142 142 Y 0:4e3505fd9583
143 143 Z 0:4e3505fd9583
144 144 foo -1:000000000000
145 145 * foobar 1:9b140be10808
146 146
147 147 $ hg pull --config paths.foo=../a foo
148 148 pulling from $TESTTMP/a (glob)
149 149 searching for changes
150 150 adding changesets
151 151 adding manifests
152 152 adding file changes
153 153 added 1 changesets with 1 changes to 1 files (+1 heads)
154 154 divergent bookmark @ stored as @foo
155 155 divergent bookmark X stored as X@foo
156 156 updating bookmark Z
157 157 (run 'hg heads' to see heads, 'hg merge' to merge)
158 158 $ hg book
159 159 @ 1:9b140be10808
160 160 @foo 2:0d2164f0ce0d
161 161 X 1:9b140be10808
162 162 X@foo 2:0d2164f0ce0d
163 163 Y 0:4e3505fd9583
164 164 Z 2:0d2164f0ce0d
165 165 foo -1:000000000000
166 166 * foobar 1:9b140be10808
167 167
168 168 (test that too many divergence of bookmark)
169 169
170 $ cat > $TESTTMP/seq.py <<EOF
171 > import sys
172 > for i in xrange(*[int(a) for a in sys.argv[1:]]):
173 > print i
174 > EOF
175 $ python $TESTTMP/seq.py 1 100 | while read i; do hg bookmarks -r 000000000000 "X@${i}"; done
170 $ python $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -r 000000000000 "X@${i}"; done
176 171 $ hg pull ../a
177 172 pulling from ../a
178 173 searching for changes
179 174 no changes found
180 175 warning: failed to assign numbered name to divergent bookmark X
181 176 divergent bookmark @ stored as @1
182 177 $ hg bookmarks | grep '^ X' | grep -v ':000000000000'
183 178 X 1:9b140be10808
184 179 X@foo 2:0d2164f0ce0d
185 180
186 181 (test that remotely diverged bookmarks are reused if they aren't changed)
187 182
188 183 $ hg bookmarks | grep '^ @'
189 184 @ 1:9b140be10808
190 185 @1 2:0d2164f0ce0d
191 186 @foo 2:0d2164f0ce0d
192 187 $ hg pull ../a
193 188 pulling from ../a
194 189 searching for changes
195 190 no changes found
196 191 warning: failed to assign numbered name to divergent bookmark X
197 192 divergent bookmark @ stored as @1
198 193 $ hg bookmarks | grep '^ @'
199 194 @ 1:9b140be10808
200 195 @1 2:0d2164f0ce0d
201 196 @foo 2:0d2164f0ce0d
202 197
203 $ python $TESTTMP/seq.py 1 100 | while read i; do hg bookmarks -d "X@${i}"; done
198 $ python $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -d "X@${i}"; done
204 199 $ hg bookmarks -d "@1"
205 200
206 201 $ hg push -f ../a
207 202 pushing to ../a
208 203 searching for changes
209 204 adding changesets
210 205 adding manifests
211 206 adding file changes
212 207 added 1 changesets with 1 changes to 1 files (+1 heads)
213 208 $ hg -R ../a book
214 209 @ 1:0d2164f0ce0d
215 210 * X 1:0d2164f0ce0d
216 211 Y 0:4e3505fd9583
217 212 Z 1:0d2164f0ce0d
218 213
219 214 explicit pull should overwrite the local version (issue4439)
220 215
221 216 $ hg pull --config paths.foo=../a foo -B X
222 217 pulling from $TESTTMP/a (glob)
223 218 no changes found
224 219 divergent bookmark @ stored as @foo
225 220 importing bookmark X
226 221
227 222 reinstall state for further testing:
228 223
229 224 $ hg book -fr 9b140be10808 X
230 225
231 226 revsets should not ignore divergent bookmarks
232 227
233 228 $ hg bookmark -fr 1 Z
234 229 $ hg log -r 'bookmark()' --template '{rev}:{node|short} {bookmarks}\n'
235 230 0:4e3505fd9583 Y
236 231 1:9b140be10808 @ X Z foobar
237 232 2:0d2164f0ce0d @foo X@foo
238 233 $ hg log -r 'bookmark("X@foo")' --template '{rev}:{node|short} {bookmarks}\n'
239 234 2:0d2164f0ce0d @foo X@foo
240 235 $ hg log -r 'bookmark("re:X@foo")' --template '{rev}:{node|short} {bookmarks}\n'
241 236 2:0d2164f0ce0d @foo X@foo
242 237
243 238 update a remote bookmark from a non-head to a head
244 239
245 240 $ hg up -q Y
246 241 $ echo c3 > f2
247 242 $ hg ci -Am3
248 243 adding f2
249 244 created new head
250 245 $ hg push ../a
251 246 pushing to ../a
252 247 searching for changes
253 248 adding changesets
254 249 adding manifests
255 250 adding file changes
256 251 added 1 changesets with 1 changes to 1 files (+1 heads)
257 252 updating bookmark Y
258 253 $ hg -R ../a book
259 254 @ 1:0d2164f0ce0d
260 255 * X 1:0d2164f0ce0d
261 256 Y 3:f6fc62dde3c0
262 257 Z 1:0d2164f0ce0d
263 258
264 259 update a bookmark in the middle of a client pulling changes
265 260
266 261 $ cd ..
267 262 $ hg clone -q a pull-race
268 263 $ hg clone -q pull-race pull-race2
269 264 $ cd pull-race
270 265 $ hg up -q Y
271 266 $ echo c4 > f2
272 267 $ hg ci -Am4
273 268 $ echo c5 > f3
274 269 $ cat <<EOF > .hg/hgrc
275 270 > [hooks]
276 271 > outgoing.makecommit = hg ci -Am5; echo committed in pull-race
277 272 > EOF
278 273 $ cd ../pull-race2
279 274 $ hg pull
280 275 pulling from $TESTTMP/pull-race (glob)
281 276 searching for changes
282 277 adding changesets
283 278 adding f3
284 279 committed in pull-race
285 280 adding manifests
286 281 adding file changes
287 282 added 1 changesets with 1 changes to 1 files
288 283 updating bookmark Y
289 284 (run 'hg update' to get a working copy)
290 285 $ hg book
291 286 * @ 1:0d2164f0ce0d
292 287 X 1:0d2164f0ce0d
293 288 Y 4:b0a5eff05604
294 289 Z 1:0d2164f0ce0d
295 290 $ cd ../b
296 291
297 292 diverging a remote bookmark fails
298 293
299 294 $ hg up -q 4e3505fd9583
300 295 $ echo c4 > f2
301 296 $ hg ci -Am4
302 297 adding f2
303 298 created new head
304 299 $ echo c5 > f2
305 300 $ hg ci -Am5
306 301 $ hg log -G
307 302 @ 5:c922c0139ca0 5
308 303 |
309 304 o 4:4efff6d98829 4
310 305 |
311 306 | o 3:f6fc62dde3c0 3
312 307 |/
313 308 | o 2:0d2164f0ce0d 1
314 309 |/
315 310 | o 1:9b140be10808 2
316 311 |/
317 312 o 0:4e3505fd9583 test
318 313
319 314
320 315 $ hg book -f Y
321 316
322 317 $ cat <<EOF > ../a/.hg/hgrc
323 318 > [web]
324 319 > push_ssl = false
325 320 > allow_push = *
326 321 > EOF
327 322
328 323 $ hg -R ../a serve -p $HGPORT2 -d --pid-file=../hg2.pid
329 324 $ cat ../hg2.pid >> $DAEMON_PIDS
330 325
331 326 $ hg push http://localhost:$HGPORT2/
332 327 pushing to http://localhost:$HGPORT2/
333 328 searching for changes
334 329 abort: push creates new remote head c922c0139ca0 with bookmark 'Y'!
335 330 (merge or see "hg help push" for details about pushing new heads)
336 331 [255]
337 332 $ hg -R ../a book
338 333 @ 1:0d2164f0ce0d
339 334 * X 1:0d2164f0ce0d
340 335 Y 3:f6fc62dde3c0
341 336 Z 1:0d2164f0ce0d
342 337
343 338
344 339 Unrelated marker does not alter the decision
345 340
346 341 $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
347 342 $ hg push http://localhost:$HGPORT2/
348 343 pushing to http://localhost:$HGPORT2/
349 344 searching for changes
350 345 abort: push creates new remote head c922c0139ca0 with bookmark 'Y'!
351 346 (merge or see "hg help push" for details about pushing new heads)
352 347 [255]
353 348 $ hg -R ../a book
354 349 @ 1:0d2164f0ce0d
355 350 * X 1:0d2164f0ce0d
356 351 Y 3:f6fc62dde3c0
357 352 Z 1:0d2164f0ce0d
358 353
359 354 Update to a successor works
360 355
361 356 $ hg id --debug -r 3
362 357 f6fc62dde3c0771e29704af56ba4d8af77abcc2f
363 358 $ hg id --debug -r 4
364 359 4efff6d98829d9c824c621afd6e3f01865f5439f
365 360 $ hg id --debug -r 5
366 361 c922c0139ca03858f655e4a2af4dd02796a63969 tip Y
367 362 $ hg debugobsolete f6fc62dde3c0771e29704af56ba4d8af77abcc2f cccccccccccccccccccccccccccccccccccccccc
368 363 $ hg debugobsolete cccccccccccccccccccccccccccccccccccccccc 4efff6d98829d9c824c621afd6e3f01865f5439f
369 364 $ hg push http://localhost:$HGPORT2/
370 365 pushing to http://localhost:$HGPORT2/
371 366 searching for changes
372 367 remote: adding changesets
373 368 remote: adding manifests
374 369 remote: adding file changes
375 370 remote: added 2 changesets with 2 changes to 1 files (+1 heads)
376 371 updating bookmark Y
377 372 $ hg -R ../a book
378 373 @ 1:0d2164f0ce0d
379 374 * X 1:0d2164f0ce0d
380 375 Y 5:c922c0139ca0
381 376 Z 1:0d2164f0ce0d
382 377
383 378 hgweb
384 379
385 380 $ cat <<EOF > .hg/hgrc
386 381 > [web]
387 382 > push_ssl = false
388 383 > allow_push = *
389 384 > EOF
390 385
391 386 $ hg serve -p $HGPORT -d --pid-file=../hg.pid -E errors.log
392 387 $ cat ../hg.pid >> $DAEMON_PIDS
393 388 $ cd ../a
394 389
395 390 $ hg debugpushkey http://localhost:$HGPORT/ namespaces
396 391 bookmarks
397 392 namespaces
398 393 obsolete
399 394 phases
400 395 $ hg debugpushkey http://localhost:$HGPORT/ bookmarks
401 396 @ 9b140be1080824d768c5a4691a564088eede71f9
402 397 X 9b140be1080824d768c5a4691a564088eede71f9
403 398 Y c922c0139ca03858f655e4a2af4dd02796a63969
404 399 Z 9b140be1080824d768c5a4691a564088eede71f9
405 400 foo 0000000000000000000000000000000000000000
406 401 foobar 9b140be1080824d768c5a4691a564088eede71f9
407 402 $ hg out -B http://localhost:$HGPORT/
408 403 comparing with http://localhost:$HGPORT/
409 404 searching for changed bookmarks
410 405 no changed bookmarks found
411 406 [1]
412 407 $ hg push -B Z http://localhost:$HGPORT/
413 408 pushing to http://localhost:$HGPORT/
414 409 searching for changes
415 410 no changes found
416 411 updating bookmark Z
417 412 [1]
418 413 $ hg book -d Z
419 414 $ hg in -B http://localhost:$HGPORT/
420 415 comparing with http://localhost:$HGPORT/
421 416 searching for changed bookmarks
422 417 Z 0d2164f0ce0d
423 418 foo 000000000000
424 419 foobar 9b140be10808
425 420 $ hg pull -B Z http://localhost:$HGPORT/
426 421 pulling from http://localhost:$HGPORT/
427 422 no changes found
428 423 divergent bookmark @ stored as @1
429 424 divergent bookmark X stored as X@1
430 425 adding remote bookmark Z
431 426 adding remote bookmark foo
432 427 adding remote bookmark foobar
433 428 $ hg clone http://localhost:$HGPORT/ cloned-bookmarks
434 429 requesting all changes
435 430 adding changesets
436 431 adding manifests
437 432 adding file changes
438 433 added 5 changesets with 5 changes to 3 files (+2 heads)
439 434 updating to bookmark @
440 435 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
441 436 $ hg -R cloned-bookmarks bookmarks
442 437 * @ 1:9b140be10808
443 438 X 1:9b140be10808
444 439 Y 4:c922c0139ca0
445 440 Z 2:0d2164f0ce0d
446 441 foo -1:000000000000
447 442 foobar 1:9b140be10808
448 443
449 444 $ cd ..
450 445
451 446 Pushing a bookmark should only push the changes required by that
452 447 bookmark, not all outgoing changes:
453 448 $ hg clone http://localhost:$HGPORT/ addmarks
454 449 requesting all changes
455 450 adding changesets
456 451 adding manifests
457 452 adding file changes
458 453 added 5 changesets with 5 changes to 3 files (+2 heads)
459 454 updating to bookmark @
460 455 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
461 456 $ cd addmarks
462 457 $ echo foo > foo
463 458 $ hg add foo
464 459 $ hg commit -m 'add foo'
465 460 $ echo bar > bar
466 461 $ hg add bar
467 462 $ hg commit -m 'add bar'
468 463 $ hg co "tip^"
469 464 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
470 465 (leaving bookmark @)
471 466 $ hg book add-foo
472 467 $ hg book -r tip add-bar
473 468 Note: this push *must* push only a single changeset, as that's the point
474 469 of this test.
475 470 $ hg push -B add-foo --traceback
476 471 pushing to http://localhost:$HGPORT/
477 472 searching for changes
478 473 remote: adding changesets
479 474 remote: adding manifests
480 475 remote: adding file changes
481 476 remote: added 1 changesets with 1 changes to 1 files
482 477 exporting bookmark add-foo
483 478
484 479 pushing a new bookmark on a new head does not require -f if -B is specified
485 480
486 481 $ hg up -q X
487 482 $ hg book W
488 483 $ echo c5 > f2
489 484 $ hg ci -Am5
490 485 created new head
491 486 $ hg push -B W
492 487 pushing to http://localhost:$HGPORT/
493 488 searching for changes
494 489 remote: adding changesets
495 490 remote: adding manifests
496 491 remote: adding file changes
497 492 remote: added 1 changesets with 1 changes to 1 files (+1 heads)
498 493 exporting bookmark W
499 494 $ hg -R ../b id -r W
500 495 cc978a373a53 tip W
501 496
502 497 $ cd ..
503 498
504 499 pushing an unchanged bookmark should result in no changes
505 500
506 501 $ hg init unchanged-a
507 502 $ hg init unchanged-b
508 503 $ cd unchanged-a
509 504 $ echo initial > foo
510 505 $ hg commit -A -m initial
511 506 adding foo
512 507 $ hg bookmark @
513 508 $ hg push -B @ ../unchanged-b
514 509 pushing to ../unchanged-b
515 510 searching for changes
516 511 adding changesets
517 512 adding manifests
518 513 adding file changes
519 514 added 1 changesets with 1 changes to 1 files
520 515 exporting bookmark @
521 516
522 517 $ hg push -B @ ../unchanged-b
523 518 pushing to ../unchanged-b
524 519 searching for changes
525 520 no changes found
526 521 [1]
527 522
528 523
529 524 Check hook preventing push (issue4455)
530 525 ======================================
531 526
532 527 $ hg bookmarks
533 528 * @ 0:55482a6fb4b1
534 529 $ hg log -G
535 530 @ 0:55482a6fb4b1 initial
536 531
537 532 $ hg init ../issue4455-dest
538 533 $ hg push ../issue4455-dest # changesets only
539 534 pushing to ../issue4455-dest
540 535 searching for changes
541 536 adding changesets
542 537 adding manifests
543 538 adding file changes
544 539 added 1 changesets with 1 changes to 1 files
545 540 $ cat >> .hg/hgrc << EOF
546 541 > [paths]
547 542 > local=../issue4455-dest/
548 543 > ssh=ssh://user@dummy/issue4455-dest
549 544 > http=http://localhost:$HGPORT/
550 545 > [ui]
551 546 > ssh=python "$TESTDIR/dummyssh"
552 547 > EOF
553 548 $ cat >> ../issue4455-dest/.hg/hgrc << EOF
554 549 > [hooks]
555 550 > prepushkey=false
556 551 > [web]
557 552 > push_ssl = false
558 553 > allow_push = *
559 554 > EOF
560 555 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
561 556 $ hg -R ../issue4455-dest serve -p $HGPORT -d --pid-file=../issue4455.pid -E ../issue4455-error.log
562 557 $ cat ../issue4455.pid >> $DAEMON_PIDS
563 558
564 559 Local push
565 560 ----------
566 561
567 562 $ hg push -B @ local
568 563 pushing to $TESTTMP/issue4455-dest (glob)
569 564 searching for changes
570 565 no changes found
571 566 pushkey-abort: prepushkey hook exited with status 1
572 567 exporting bookmark @ failed!
573 568 [1]
574 569 $ hg -R ../issue4455-dest/ bookmarks
575 570 no bookmarks set
576 571
577 572 Using ssh
578 573 ---------
579 574
580 575 $ hg push -B @ ssh
581 576 pushing to ssh://user@dummy/issue4455-dest
582 577 searching for changes
583 578 no changes found
584 579 remote: pushkey-abort: prepushkey hook exited with status 1
585 580 exporting bookmark @ failed!
586 581 [1]
587 582 $ hg -R ../issue4455-dest/ bookmarks
588 583 no bookmarks set
589 584
590 585 Using http
591 586 ----------
592 587
593 588 $ hg push -B @ http
594 589 pushing to http://localhost:$HGPORT/
595 590 searching for changes
596 591 no changes found
597 592 remote: pushkey-abort: prepushkey hook exited with status 1
598 593 exporting bookmark @ failed!
599 594 [1]
600 595 $ hg -R ../issue4455-dest/ bookmarks
601 596 no bookmarks set
@@ -1,480 +1,480 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > censor=
4 4 > EOF
5 5 $ cp $HGRCPATH $HGRCPATH.orig
6 6
7 7 Create repo with unimpeachable content
8 8
9 9 $ hg init r
10 10 $ cd r
11 11 $ echo 'Initially untainted file' > target
12 12 $ echo 'Normal file here' > bystander
13 13 $ hg add target bystander
14 14 $ hg ci -m init
15 15
16 16 Clone repo so we can test pull later
17 17
18 18 $ cd ..
19 19 $ hg clone r rpull
20 20 updating to branch default
21 21 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 22 $ cd r
23 23
24 24 Introduce content which will ultimately require censorship. Name the first
25 25 censored node C1, second C2, and so on
26 26
27 27 $ echo 'Tainted file' > target
28 28 $ echo 'Passwords: hunter2' >> target
29 29 $ hg ci -m taint target
30 30 $ C1=`hg id --debug -i`
31 31
32 32 $ echo 'hunter3' >> target
33 33 $ echo 'Normal file v2' > bystander
34 34 $ hg ci -m moretaint target bystander
35 35 $ C2=`hg id --debug -i`
36 36
37 37 Add a new sanitized versions to correct our mistake. Name the first head H1,
38 38 the second head H2, and so on
39 39
40 40 $ echo 'Tainted file is now sanitized' > target
41 41 $ hg ci -m sanitized target
42 42 $ H1=`hg id --debug -i`
43 43
44 44 $ hg update -r $C2
45 45 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 46 $ echo 'Tainted file now super sanitized' > target
47 47 $ hg ci -m 'super sanitized' target
48 48 created new head
49 49 $ H2=`hg id --debug -i`
50 50
51 51 Verify target contents before censorship at each revision
52 52
53 53 $ hg cat -r $H1 target
54 54 Tainted file is now sanitized
55 55 $ hg cat -r $H2 target
56 56 Tainted file now super sanitized
57 57 $ hg cat -r $C2 target
58 58 Tainted file
59 59 Passwords: hunter2
60 60 hunter3
61 61 $ hg cat -r $C1 target
62 62 Tainted file
63 63 Passwords: hunter2
64 64 $ hg cat -r 0 target
65 65 Initially untainted file
66 66
67 67 Try to censor revision with too large of a tombstone message
68 68
69 69 $ hg censor -r $C1 -t 'blah blah blah blah blah blah blah blah bla' target
70 70 abort: censor tombstone must be no longer than censored data
71 71 [255]
72 72
73 73 Censor revision with 2 offenses
74 74
75 75 $ hg censor -r $C2 -t "remove password" target
76 76 $ hg cat -r $H1 target
77 77 Tainted file is now sanitized
78 78 $ hg cat -r $H2 target
79 79 Tainted file now super sanitized
80 80 $ hg cat -r $C2 target
81 81 abort: censored node: 1e0247a9a4b7
82 82 (set censor.policy to ignore errors)
83 83 [255]
84 84 $ hg cat -r $C1 target
85 85 Tainted file
86 86 Passwords: hunter2
87 87 $ hg cat -r 0 target
88 88 Initially untainted file
89 89
90 90 Censor revision with 1 offense
91 91
92 92 $ hg censor -r $C1 target
93 93 $ hg cat -r $H1 target
94 94 Tainted file is now sanitized
95 95 $ hg cat -r $H2 target
96 96 Tainted file now super sanitized
97 97 $ hg cat -r $C2 target
98 98 abort: censored node: 1e0247a9a4b7
99 99 (set censor.policy to ignore errors)
100 100 [255]
101 101 $ hg cat -r $C1 target
102 102 abort: censored node: 613bc869fceb
103 103 (set censor.policy to ignore errors)
104 104 [255]
105 105 $ hg cat -r 0 target
106 106 Initially untainted file
107 107
108 108 Can only checkout target at uncensored revisions, -X is workaround for --all
109 109
110 110 $ hg revert -r $C2 target
111 111 abort: censored node: 1e0247a9a4b7
112 112 (set censor.policy to ignore errors)
113 113 [255]
114 114 $ hg revert -r $C1 target
115 115 abort: censored node: 613bc869fceb
116 116 (set censor.policy to ignore errors)
117 117 [255]
118 118 $ hg revert -r $C1 --all
119 119 reverting bystander
120 120 reverting target
121 121 abort: censored node: 613bc869fceb
122 122 (set censor.policy to ignore errors)
123 123 [255]
124 124 $ hg revert -r $C1 --all -X target
125 125 $ cat target
126 126 Tainted file now super sanitized
127 127 $ hg revert -r 0 --all
128 128 reverting target
129 129 $ cat target
130 130 Initially untainted file
131 131 $ hg revert -r $H2 --all
132 132 reverting bystander
133 133 reverting target
134 134 $ cat target
135 135 Tainted file now super sanitized
136 136
137 137 Uncensored file can be viewed at any revision
138 138
139 139 $ hg cat -r $H1 bystander
140 140 Normal file v2
141 141 $ hg cat -r $C2 bystander
142 142 Normal file v2
143 143 $ hg cat -r $C1 bystander
144 144 Normal file here
145 145 $ hg cat -r 0 bystander
146 146 Normal file here
147 147
148 148 Can update to children of censored revision
149 149
150 150 $ hg update -r $H1
151 151 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
152 152 $ cat target
153 153 Tainted file is now sanitized
154 154 $ hg update -r $H2
155 155 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
156 156 $ cat target
157 157 Tainted file now super sanitized
158 158
159 159 Set censor policy to abort in trusted $HGRC so hg verify fails
160 160
161 161 $ cp $HGRCPATH.orig $HGRCPATH
162 162 $ cat >> $HGRCPATH <<EOF
163 163 > [censor]
164 164 > policy = abort
165 165 > EOF
166 166
167 167 Repo fails verification due to censorship
168 168
169 169 $ hg verify
170 170 checking changesets
171 171 checking manifests
172 172 crosschecking files in changesets and manifests
173 173 checking files
174 174 target@1: censored file data
175 175 target@2: censored file data
176 176 2 files, 5 changesets, 7 total revisions
177 177 2 integrity errors encountered!
178 178 (first damaged changeset appears to be 1)
179 179 [1]
180 180
181 181 Cannot update to revision with censored data
182 182
183 183 $ hg update -r $C2
184 184 abort: censored node: 1e0247a9a4b7
185 185 (set censor.policy to ignore errors)
186 186 [255]
187 187 $ hg update -r $C1
188 188 abort: censored node: 613bc869fceb
189 189 (set censor.policy to ignore errors)
190 190 [255]
191 191 $ hg update -r 0
192 192 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
193 193 $ hg update -r $H2
194 194 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
195 195
196 196 Set censor policy to ignore in trusted $HGRC so hg verify passes
197 197
198 198 $ cp $HGRCPATH.orig $HGRCPATH
199 199 $ cat >> $HGRCPATH <<EOF
200 200 > [censor]
201 201 > policy = ignore
202 202 > EOF
203 203
204 204 Repo passes verification with warnings with explicit config
205 205
206 206 $ hg verify
207 207 checking changesets
208 208 checking manifests
209 209 crosschecking files in changesets and manifests
210 210 checking files
211 211 2 files, 5 changesets, 7 total revisions
212 212
213 213 May update to revision with censored data with explicit config
214 214
215 215 $ hg update -r $C2
216 216 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
217 217 $ cat target
218 218 $ hg update -r $C1
219 219 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
220 220 $ cat target
221 221 $ hg update -r 0
222 222 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 223 $ cat target
224 224 Initially untainted file
225 225 $ hg update -r $H2
226 226 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
227 227 $ cat target
228 228 Tainted file now super sanitized
229 229
230 230 Can merge in revision with censored data. Test requires one branch of history
231 231 with the file censored, but we can't censor at a head, so advance H1.
232 232
233 233 $ hg update -r $H1
234 234 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
235 235 $ C3=$H1
236 236 $ echo 'advanced head H1' > target
237 237 $ hg ci -m 'advance head H1' target
238 238 $ H1=`hg id --debug -i`
239 239 $ hg censor -r $C3 target
240 240 $ hg update -r $H2
241 241 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
242 242 $ hg merge -r $C3
243 243 merging target
244 244 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
245 245 (branch merge, don't forget to commit)
246 246
247 247 Revisions present in repository heads may not be censored
248 248
249 249 $ hg update -C -r $H2
250 250 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
251 251 $ hg censor -r $H2 target
252 252 abort: cannot censor file in heads (78a8fc215e79)
253 253 (clean/delete and commit first)
254 254 [255]
255 255 $ echo 'twiddling thumbs' > bystander
256 256 $ hg ci -m 'bystander commit'
257 257 $ H2=`hg id --debug -i`
258 258 $ hg censor -r "$H2^" target
259 259 abort: cannot censor file in heads (efbe78065929)
260 260 (clean/delete and commit first)
261 261 [255]
262 262
263 263 Cannot censor working directory
264 264
265 265 $ echo 'seriously no passwords' > target
266 266 $ hg ci -m 'extend second head arbitrarily' target
267 267 $ H2=`hg id --debug -i`
268 268 $ hg update -r "$H2^"
269 269 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
270 270 $ hg censor -r . target
271 271 abort: cannot censor working directory
272 272 (clean/delete/update first)
273 273 [255]
274 274 $ hg update -r $H2
275 275 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
276 276
277 277 Can re-add file after being deleted + censored
278 278
279 279 $ C4=$H2
280 280 $ hg rm target
281 281 $ hg ci -m 'delete target so it may be censored'
282 282 $ H2=`hg id --debug -i`
283 283 $ hg censor -r $C4 target
284 284 $ hg cat -r $C4 target
285 285 $ hg cat -r "$H2^^" target
286 286 Tainted file now super sanitized
287 287 $ echo 'fresh start' > target
288 288 $ hg add target
289 289 $ hg ci -m reincarnated target
290 290 $ H2=`hg id --debug -i`
291 291 $ hg cat -r $H2 target
292 292 fresh start
293 293 $ hg cat -r "$H2^" target
294 294 target: no such file in rev 452ec1762369
295 295 [1]
296 296 $ hg cat -r $C4 target
297 297 $ hg cat -r "$H2^^^" target
298 298 Tainted file now super sanitized
299 299
300 300 Can censor after revlog has expanded to no longer permit inline storage
301 301
302 $ for x in `seq 0 50000`
302 $ for x in `python $TESTDIR/seq.py 0 50000`
303 303 > do
304 304 > echo "Password: hunter$x" >> target
305 305 > done
306 306 $ hg ci -m 'add 100k passwords'
307 307 $ H2=`hg id --debug -i`
308 308 $ C5=$H2
309 309 $ hg revert -r "$H2^" target
310 310 $ hg ci -m 'cleaned 100k passwords'
311 311 $ H2=`hg id --debug -i`
312 312 $ hg censor -r $C5 target
313 313 $ hg cat -r $C5 target
314 314 $ hg cat -r $H2 target
315 315 fresh start
316 316
317 317 Repo with censored nodes can be cloned and cloned nodes are censored
318 318
319 319 $ cd ..
320 320 $ hg clone r rclone
321 321 updating to branch default
322 322 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
323 323 $ cd rclone
324 324 $ hg cat -r $H1 target
325 325 advanced head H1
326 326 $ hg cat -r $H2~5 target
327 327 Tainted file now super sanitized
328 328 $ hg cat -r $C2 target
329 329 $ hg cat -r $C1 target
330 330 $ hg cat -r 0 target
331 331 Initially untainted file
332 332 $ hg verify
333 333 checking changesets
334 334 checking manifests
335 335 crosschecking files in changesets and manifests
336 336 checking files
337 337 2 files, 12 changesets, 13 total revisions
338 338
339 339 Repo cloned before tainted content introduced can pull censored nodes
340 340
341 341 $ cd ../rpull
342 342 $ hg cat -r tip target
343 343 Initially untainted file
344 344 $ hg verify
345 345 checking changesets
346 346 checking manifests
347 347 crosschecking files in changesets and manifests
348 348 checking files
349 349 2 files, 1 changesets, 2 total revisions
350 350 $ hg pull -r $H1 -r $H2
351 351 pulling from $TESTTMP/r (glob)
352 352 searching for changes
353 353 adding changesets
354 354 adding manifests
355 355 adding file changes
356 356 added 11 changesets with 11 changes to 2 files (+1 heads)
357 357 (run 'hg heads' to see heads, 'hg merge' to merge)
358 358 $ hg update 4
359 359 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
360 360 $ cat target
361 361 Tainted file now super sanitized
362 362 $ hg cat -r $H1 target
363 363 advanced head H1
364 364 $ hg cat -r $H2~5 target
365 365 Tainted file now super sanitized
366 366 $ hg cat -r $C2 target
367 367 $ hg cat -r $C1 target
368 368 $ hg cat -r 0 target
369 369 Initially untainted file
370 370 $ hg verify
371 371 checking changesets
372 372 checking manifests
373 373 crosschecking files in changesets and manifests
374 374 checking files
375 375 2 files, 12 changesets, 13 total revisions
376 376
377 377 Censored nodes can be pushed if they censor previously unexchanged nodes
378 378
379 379 $ echo 'Passwords: hunter2hunter2' > target
380 380 $ hg ci -m 're-add password from clone' target
381 381 created new head
382 382 $ H3=`hg id --debug -i`
383 383 $ REV=$H3
384 384 $ echo 'Re-sanitized; nothing to see here' > target
385 385 $ hg ci -m 're-sanitized' target
386 386 $ H2=`hg id --debug -i`
387 387 $ CLEANREV=$H2
388 388 $ hg cat -r $REV target
389 389 Passwords: hunter2hunter2
390 390 $ hg censor -r $REV target
391 391 $ hg cat -r $REV target
392 392 $ hg cat -r $CLEANREV target
393 393 Re-sanitized; nothing to see here
394 394 $ hg push -f -r $H2
395 395 pushing to $TESTTMP/r (glob)
396 396 searching for changes
397 397 adding changesets
398 398 adding manifests
399 399 adding file changes
400 400 added 2 changesets with 2 changes to 1 files (+1 heads)
401 401
402 402 $ cd ../r
403 403 $ hg cat -r $REV target
404 404 $ hg cat -r $CLEANREV target
405 405 Re-sanitized; nothing to see here
406 406 $ hg update $CLEANREV
407 407 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
408 408 $ cat target
409 409 Re-sanitized; nothing to see here
410 410
411 411 Censored nodes can be bundled up and unbundled in another repo
412 412
413 413 $ hg bundle --base 0 ../pwbundle
414 414 13 changesets found
415 415 $ cd ../rclone
416 416 $ hg unbundle ../pwbundle
417 417 adding changesets
418 418 adding manifests
419 419 adding file changes
420 420 added 2 changesets with 2 changes to 2 files (+1 heads)
421 421 (run 'hg heads .' to see heads, 'hg merge' to merge)
422 422 $ hg cat -r $REV target
423 423 $ hg cat -r $CLEANREV target
424 424 Re-sanitized; nothing to see here
425 425 $ hg update $CLEANREV
426 426 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
427 427 $ cat target
428 428 Re-sanitized; nothing to see here
429 429 $ hg verify
430 430 checking changesets
431 431 checking manifests
432 432 crosschecking files in changesets and manifests
433 433 checking files
434 434 2 files, 14 changesets, 15 total revisions
435 435
436 436 Censored nodes can be imported on top of censored nodes, consecutively
437 437
438 438 $ hg init ../rimport
439 439 $ hg bundle --base 1 ../rimport/splitbundle
440 440 12 changesets found
441 441 $ cd ../rimport
442 442 $ hg pull -r $H1 -r $H2 ../r
443 443 pulling from ../r
444 444 adding changesets
445 445 adding manifests
446 446 adding file changes
447 447 added 8 changesets with 10 changes to 2 files (+1 heads)
448 448 (run 'hg heads' to see heads, 'hg merge' to merge)
449 449 $ hg unbundle splitbundle
450 450 adding changesets
451 451 adding manifests
452 452 adding file changes
453 453 added 6 changesets with 5 changes to 2 files (+1 heads)
454 454 (run 'hg heads .' to see heads, 'hg merge' to merge)
455 455 $ hg update $H2
456 456 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
457 457 $ cat target
458 458 Re-sanitized; nothing to see here
459 459 $ hg verify
460 460 checking changesets
461 461 checking manifests
462 462 crosschecking files in changesets and manifests
463 463 checking files
464 464 2 files, 14 changesets, 15 total revisions
465 465 $ cd ../r
466 466
467 467 Can import bundle where first revision of a file is censored
468 468
469 469 $ hg init ../rinit
470 470 $ hg censor -r 0 target
471 471 $ hg bundle -r 0 --base null ../rinit/initbundle
472 472 1 changesets found
473 473 $ cd ../rinit
474 474 $ hg unbundle initbundle
475 475 adding changesets
476 476 adding manifests
477 477 adding file changes
478 478 added 1 changesets with 2 changes to 2 files
479 479 (run 'hg update' to get a working copy)
480 480 $ hg cat -r 0 target
@@ -1,184 +1,184 b''
1 1 Set up a repo
2 2
3 3 $ cat <<EOF >> $HGRCPATH
4 4 > [ui]
5 5 > interactive = true
6 6 > [experimental]
7 7 > crecord = true
8 8 > crecordtest = testModeCommands
9 9 > EOF
10 10
11 11 $ hg init a
12 12 $ cd a
13 13
14 14 Committing some changes but stopping on the way
15 15
16 16 $ echo "a" > a
17 17 $ hg add a
18 18 $ cat <<EOF >testModeCommands
19 19 > TOGGLE
20 20 > X
21 21 > EOF
22 22 $ hg commit -i -m "a" -d "0 0"
23 23 no changes to record
24 24 $ hg tip
25 25 changeset: -1:000000000000
26 26 tag: tip
27 27 user:
28 28 date: Thu Jan 01 00:00:00 1970 +0000
29 29
30 30
31 31 Committing some changes
32 32
33 33 $ cat <<EOF >testModeCommands
34 34 > X
35 35 > EOF
36 36 $ hg commit -i -m "a" -d "0 0"
37 37 $ hg tip
38 38 changeset: 0:cb9a9f314b8b
39 39 tag: tip
40 40 user: test
41 41 date: Thu Jan 01 00:00:00 1970 +0000
42 42 summary: a
43 43
44 44 Committing only one file
45 45
46 46 $ echo "a" >> a
47 $ seq 1 10 > b
47 $ python $TESTDIR/seq.py 1 10 > b
48 48 $ hg add b
49 49 $ cat <<EOF >testModeCommands
50 50 > TOGGLE
51 51 > KEY_DOWN
52 52 > X
53 53 > EOF
54 54 $ hg commit -i -m "one file" -d "0 0"
55 55 $ hg tip
56 56 changeset: 1:fb2705a663ea
57 57 tag: tip
58 58 user: test
59 59 date: Thu Jan 01 00:00:00 1970 +0000
60 60 summary: one file
61 61
62 62 $ hg cat -r tip a
63 63 a
64 64 $ cat a
65 65 a
66 66 a
67 67
68 68 Committing only one hunk
69 69
70 70 - Untoggle all the hunks, go down to the second file
71 71 - unfold it
72 72 - go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike)
73 73 - toggle the second hunk
74 74 - commit
75 75
76 76 $ echo "x" > c
77 77 $ cat b >> c
78 78 $ echo "y" >> c
79 79 $ mv c b
80 80 $ cat <<EOF >testModeCommands
81 81 > A
82 82 > KEY_DOWN
83 83 > f
84 84 > KEY_DOWN
85 85 > KEY_DOWN
86 86 > KEY_DOWN
87 87 > KEY_DOWN
88 88 > TOGGLE
89 89 > X
90 90 > EOF
91 91 $ hg commit -i -m "one hunk" -d "0 0"
92 92 $ hg tip
93 93 changeset: 2:7d10dfe755a8
94 94 tag: tip
95 95 user: test
96 96 date: Thu Jan 01 00:00:00 1970 +0000
97 97 summary: one hunk
98 98
99 99 $ hg cat -r tip b
100 100 1
101 101 2
102 102 3
103 103 4
104 104 5
105 105 6
106 106 7
107 107 8
108 108 9
109 109 10
110 110 y
111 111 $ cat b
112 112 x
113 113 1
114 114 2
115 115 3
116 116 4
117 117 5
118 118 6
119 119 7
120 120 8
121 121 9
122 122 10
123 123 y
124 124 $ hg commit -m "other hunks"
125 125 $ hg tip
126 126 changeset: 3:a6735021574d
127 127 tag: tip
128 128 user: test
129 129 date: Thu Jan 01 00:00:00 1970 +0000
130 130 summary: other hunks
131 131
132 132 $ hg cat -r tip b
133 133 x
134 134 1
135 135 2
136 136 3
137 137 4
138 138 5
139 139 6
140 140 7
141 141 8
142 142 9
143 143 10
144 144 y
145 145
146 146 Editing patch of newly added file
147 147
148 148 $ cat > editor.sh << '__EOF__'
149 149 > cat "$1" | sed "s/first/very/g" > tt
150 150 > mv tt "$1"
151 151 > __EOF__
152 152 $ cat > newfile << '__EOF__'
153 153 > This is the first line
154 154 > This is the second line
155 155 > This is the third line
156 156 > __EOF__
157 157 $ hg add newfile
158 158 $ cat <<EOF >testModeCommands
159 159 > f
160 160 > KEY_DOWN
161 161 > KEY_DOWN
162 162 > KEY_DOWN
163 163 > e
164 164 > X
165 165 > EOF
166 166 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -d '23 0' -medit-patch-new
167 167 $ hg tip
168 168 changeset: 4:6a0a43e9eff5
169 169 tag: tip
170 170 user: test
171 171 date: Thu Jan 01 00:00:23 1970 +0000
172 172 summary: edit-patch-new
173 173
174 174 $ hg cat -r tip newfile
175 175 This is the very line
176 176 This is the second line
177 177 This is the third line
178 178
179 179 $ cat newfile
180 180 This is the first line
181 181 This is the second line
182 182 This is the third line
183 183
184 184
@@ -1,781 +1,781 b''
1 1 $ hg init a
2 2 $ cd a
3 3 $ echo foo > t1
4 4 $ hg add t1
5 5 $ hg commit -m "1"
6 6
7 7 $ cd ..
8 8 $ hg clone a b
9 9 updating to branch default
10 10 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
11 11
12 12 $ cd a
13 13 $ echo foo > t2
14 14 $ hg add t2
15 15 $ hg commit -m "2"
16 16
17 17 $ cd ../b
18 18 $ echo foo > t3
19 19 $ hg add t3
20 20 $ hg commit -m "3"
21 21
22 22 $ hg push ../a
23 23 pushing to ../a
24 24 searching for changes
25 25 remote has heads on branch 'default' that are not known locally: 1c9246a22a0a
26 26 abort: push creates new remote head 1e108cc5548c!
27 27 (pull and merge or see "hg help push" for details about pushing new heads)
28 28 [255]
29 29
30 30 $ hg push --debug ../a
31 31 pushing to ../a
32 32 query 1; heads
33 33 searching for changes
34 34 taking quick initial sample
35 35 searching: 2 queries
36 36 query 2; still undecided: 1, sample size is: 1
37 37 2 total queries
38 38 listing keys for "phases"
39 39 checking for updated bookmarks
40 40 listing keys for "bookmarks"
41 41 listing keys for "bookmarks"
42 42 remote has heads on branch 'default' that are not known locally: 1c9246a22a0a
43 43 new remote heads on branch 'default':
44 44 1e108cc5548c
45 45 abort: push creates new remote head 1e108cc5548c!
46 46 (pull and merge or see "hg help push" for details about pushing new heads)
47 47 [255]
48 48
49 49 $ hg pull ../a
50 50 pulling from ../a
51 51 searching for changes
52 52 adding changesets
53 53 adding manifests
54 54 adding file changes
55 55 added 1 changesets with 1 changes to 1 files (+1 heads)
56 56 (run 'hg heads' to see heads, 'hg merge' to merge)
57 57
58 58 $ hg push ../a
59 59 pushing to ../a
60 60 searching for changes
61 61 abort: push creates new remote head 1e108cc5548c!
62 62 (merge or see "hg help push" for details about pushing new heads)
63 63 [255]
64 64
65 65 $ hg merge
66 66 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 67 (branch merge, don't forget to commit)
68 68
69 69 $ hg commit -m "4"
70 70 $ hg push ../a
71 71 pushing to ../a
72 72 searching for changes
73 73 adding changesets
74 74 adding manifests
75 75 adding file changes
76 76 added 2 changesets with 1 changes to 1 files
77 77
78 78 $ cd ..
79 79
80 80 $ hg init c
81 81 $ cd c
82 82 $ for i in 0 1 2; do
83 83 > echo $i >> foo
84 84 > hg ci -Am $i
85 85 > done
86 86 adding foo
87 87 $ cd ..
88 88
89 89 $ hg clone c d
90 90 updating to branch default
91 91 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 92
93 93 $ cd d
94 94 $ for i in 0 1; do
95 95 > hg co -C $i
96 96 > echo d-$i >> foo
97 97 > hg ci -m d-$i
98 98 > done
99 99 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 100 created new head
101 101 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
102 102 created new head
103 103
104 104 $ HGMERGE=true hg merge 3
105 105 merging foo
106 106 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
107 107 (branch merge, don't forget to commit)
108 108
109 109 $ hg ci -m c-d
110 110
111 111 $ hg push ../c
112 112 pushing to ../c
113 113 searching for changes
114 114 abort: push creates new remote head 6346d66eb9f5!
115 115 (merge or see "hg help push" for details about pushing new heads)
116 116 [255]
117 117
118 118 $ hg push -r 2 ../c
119 119 pushing to ../c
120 120 searching for changes
121 121 no changes found
122 122 [1]
123 123
124 124 $ hg push -r 3 ../c
125 125 pushing to ../c
126 126 searching for changes
127 127 abort: push creates new remote head a5dda829a167!
128 128 (merge or see "hg help push" for details about pushing new heads)
129 129 [255]
130 130
131 131 $ hg push -v -r 3 -r 4 ../c
132 132 pushing to ../c
133 133 searching for changes
134 134 new remote heads on branch 'default':
135 135 a5dda829a167
136 136 ee8fbc7a0295
137 137 abort: push creates new remote head a5dda829a167!
138 138 (merge or see "hg help push" for details about pushing new heads)
139 139 [255]
140 140
141 141 $ hg push -v -f -r 3 -r 4 ../c
142 142 pushing to ../c
143 143 searching for changes
144 144 2 changesets found
145 145 uncompressed size of bundle content:
146 146 308 (changelog)
147 147 286 (manifests)
148 148 213 foo
149 149 adding changesets
150 150 adding manifests
151 151 adding file changes
152 152 added 2 changesets with 2 changes to 1 files (+2 heads)
153 153
154 154 $ hg push -r 5 ../c
155 155 pushing to ../c
156 156 searching for changes
157 157 adding changesets
158 158 adding manifests
159 159 adding file changes
160 160 added 1 changesets with 1 changes to 1 files (-1 heads)
161 161
162 162 $ hg in ../c
163 163 comparing with ../c
164 164 searching for changes
165 165 no changes found
166 166 [1]
167 167
168 168
169 169 Issue450: push -r warns about remote head creation even if no heads
170 170 will be created
171 171
172 172 $ hg init ../e
173 173 $ hg push -r 0 ../e
174 174 pushing to ../e
175 175 searching for changes
176 176 adding changesets
177 177 adding manifests
178 178 adding file changes
179 179 added 1 changesets with 1 changes to 1 files
180 180
181 181 $ hg push -r 1 ../e
182 182 pushing to ../e
183 183 searching for changes
184 184 adding changesets
185 185 adding manifests
186 186 adding file changes
187 187 added 1 changesets with 1 changes to 1 files
188 188
189 189 $ cd ..
190 190
191 191
192 192 Issue736: named branches are not considered for detection of
193 193 unmerged heads in "hg push"
194 194
195 195 $ hg init f
196 196 $ cd f
197 197 $ hg -q branch a
198 198 $ echo 0 > foo
199 199 $ hg -q ci -Am 0
200 200 $ echo 1 > foo
201 201 $ hg -q ci -m 1
202 202 $ hg -q up 0
203 203 $ echo 2 > foo
204 204 $ hg -q ci -m 2
205 205 $ hg -q up 0
206 206 $ hg -q branch b
207 207 $ echo 3 > foo
208 208 $ hg -q ci -m 3
209 209 $ cd ..
210 210
211 211 $ hg -q clone f g
212 212 $ cd g
213 213
214 214 Push on existing branch and new branch:
215 215
216 216 $ hg -q up 1
217 217 $ echo 4 > foo
218 218 $ hg -q ci -m 4
219 219 $ hg -q up 0
220 220 $ echo 5 > foo
221 221 $ hg -q branch c
222 222 $ hg -q ci -m 5
223 223
224 224 $ hg push ../f
225 225 pushing to ../f
226 226 searching for changes
227 227 abort: push creates new remote branches: c!
228 228 (use 'hg push --new-branch' to create new remote branches)
229 229 [255]
230 230
231 231 $ hg push -r 4 -r 5 ../f
232 232 pushing to ../f
233 233 searching for changes
234 234 abort: push creates new remote branches: c!
235 235 (use 'hg push --new-branch' to create new remote branches)
236 236 [255]
237 237
238 238
239 239 Multiple new branches:
240 240
241 241 $ hg -q branch d
242 242 $ echo 6 > foo
243 243 $ hg -q ci -m 6
244 244
245 245 $ hg push ../f
246 246 pushing to ../f
247 247 searching for changes
248 248 abort: push creates new remote branches: c, d!
249 249 (use 'hg push --new-branch' to create new remote branches)
250 250 [255]
251 251
252 252 $ hg push -r 4 -r 6 ../f
253 253 pushing to ../f
254 254 searching for changes
255 255 abort: push creates new remote branches: c, d!
256 256 (use 'hg push --new-branch' to create new remote branches)
257 257 [255]
258 258
259 259 $ cd ../g
260 260
261 261
262 262 Fail on multiple head push:
263 263
264 264 $ hg -q up 1
265 265 $ echo 7 > foo
266 266 $ hg -q ci -m 7
267 267
268 268 $ hg push -r 4 -r 7 ../f
269 269 pushing to ../f
270 270 searching for changes
271 271 abort: push creates new remote head 0b715ef6ff8f on branch 'a'!
272 272 (merge or see "hg help push" for details about pushing new heads)
273 273 [255]
274 274
275 275 Push replacement head on existing branches:
276 276
277 277 $ hg -q up 3
278 278 $ echo 8 > foo
279 279 $ hg -q ci -m 8
280 280
281 281 $ hg push -r 7 -r 8 ../f
282 282 pushing to ../f
283 283 searching for changes
284 284 adding changesets
285 285 adding manifests
286 286 adding file changes
287 287 added 2 changesets with 2 changes to 1 files
288 288
289 289
290 290 Merge of branch a to other branch b followed by unrelated push
291 291 on branch a:
292 292
293 293 $ hg -q up 7
294 294 $ HGMERGE=true hg -q merge 8
295 295 $ hg -q ci -m 9
296 296 $ hg -q up 8
297 297 $ echo 10 > foo
298 298 $ hg -q ci -m 10
299 299
300 300 $ hg push -r 9 ../f
301 301 pushing to ../f
302 302 searching for changes
303 303 adding changesets
304 304 adding manifests
305 305 adding file changes
306 306 added 1 changesets with 1 changes to 1 files (-1 heads)
307 307
308 308 $ hg push -r 10 ../f
309 309 pushing to ../f
310 310 searching for changes
311 311 adding changesets
312 312 adding manifests
313 313 adding file changes
314 314 added 1 changesets with 1 changes to 1 files (+1 heads)
315 315
316 316
317 317 Cheating the counting algorithm:
318 318
319 319 $ hg -q up 9
320 320 $ HGMERGE=true hg -q merge 2
321 321 $ hg -q ci -m 11
322 322 $ hg -q up 1
323 323 $ echo 12 > foo
324 324 $ hg -q ci -m 12
325 325
326 326 $ hg push -r 11 -r 12 ../f
327 327 pushing to ../f
328 328 searching for changes
329 329 adding changesets
330 330 adding manifests
331 331 adding file changes
332 332 added 2 changesets with 2 changes to 1 files
333 333
334 334
335 335 Failed push of new named branch:
336 336
337 337 $ echo 12 > foo
338 338 $ hg -q ci -m 12a
339 339 [1]
340 340 $ hg -q up 11
341 341 $ echo 13 > foo
342 342 $ hg -q branch e
343 343 $ hg -q ci -m 13d
344 344
345 345 $ hg push -r 12 -r 13 ../f
346 346 pushing to ../f
347 347 searching for changes
348 348 abort: push creates new remote branches: e!
349 349 (use 'hg push --new-branch' to create new remote branches)
350 350 [255]
351 351
352 352
353 353 Using --new-branch to push new named branch:
354 354
355 355 $ hg push --new-branch -r 12 -r 13 ../f
356 356 pushing to ../f
357 357 searching for changes
358 358 adding changesets
359 359 adding manifests
360 360 adding file changes
361 361 added 1 changesets with 1 changes to 1 files
362 362
363 363 Pushing multi headed new branch:
364 364
365 365 $ echo 14 > foo
366 366 $ hg -q branch f
367 367 $ hg -q ci -m 14
368 368 $ echo 15 > foo
369 369 $ hg -q ci -m 15
370 370 $ hg -q up 14
371 371 $ echo 16 > foo
372 372 $ hg -q ci -m 16
373 373 $ hg push --branch f --new-branch ../f
374 374 pushing to ../f
375 375 searching for changes
376 376 abort: push creates new branch 'f' with multiple heads
377 377 (merge or see "hg help push" for details about pushing new heads)
378 378 [255]
379 379 $ hg push --branch f --new-branch --force ../f
380 380 pushing to ../f
381 381 searching for changes
382 382 adding changesets
383 383 adding manifests
384 384 adding file changes
385 385 added 3 changesets with 3 changes to 1 files (+1 heads)
386 386
387 387 Checking prepush logic does not allow silently pushing
388 388 multiple new heads but also doesn't report too many heads:
389 389
390 390 $ cd ..
391 391 $ hg init h
392 392 $ echo init > h/init
393 393 $ hg -R h ci -Am init
394 394 adding init
395 395 $ echo a > h/a
396 396 $ hg -R h ci -Am a
397 397 adding a
398 398 $ hg clone h i
399 399 updating to branch default
400 400 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
401 401 $ hg -R h up 0
402 402 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
403 403 $ echo b > h/b
404 404 $ hg -R h ci -Am b
405 405 adding b
406 406 created new head
407 407 $ hg -R i up 0
408 408 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
409 409 $ echo c > i/c
410 410 $ hg -R i ci -Am c
411 411 adding c
412 412 created new head
413 413
414 $ for i in `seq 3`; do hg -R h up -q 0; echo $i > h/b; hg -R h ci -qAm$i; done
414 $ for i in `python $TESTDIR/seq.py 3`; do hg -R h up -q 0; echo $i > h/b; hg -R h ci -qAm$i; done
415 415
416 416 $ hg -R i push h
417 417 pushing to h
418 418 searching for changes
419 419 remote has heads on branch 'default' that are not known locally: 534543e22c29 764f8ec07b96 afe7cc7679f5 ce4212fc8847
420 420 abort: push creates new remote head 97bd0c84d346!
421 421 (pull and merge or see "hg help push" for details about pushing new heads)
422 422 [255]
423 423 $ hg -R h up -q 0; echo x > h/b; hg -R h ci -qAmx
424 424 $ hg -R i push h
425 425 pushing to h
426 426 searching for changes
427 427 remote has heads on branch 'default' that are not known locally: 18ddb72c4590 534543e22c29 764f8ec07b96 afe7cc7679f5 and 1 others
428 428 abort: push creates new remote head 97bd0c84d346!
429 429 (pull and merge or see "hg help push" for details about pushing new heads)
430 430 [255]
431 431 $ hg -R i push h -v
432 432 pushing to h
433 433 searching for changes
434 434 remote has heads on branch 'default' that are not known locally: 18ddb72c4590 534543e22c29 764f8ec07b96 afe7cc7679f5 ce4212fc8847
435 435 new remote heads on branch 'default':
436 436 97bd0c84d346
437 437 abort: push creates new remote head 97bd0c84d346!
438 438 (pull and merge or see "hg help push" for details about pushing new heads)
439 439 [255]
440 440
441 441
442 442 Check prepush logic with merged branches:
443 443
444 444 $ hg init j
445 445 $ hg -R j branch a
446 446 marked working directory as branch a
447 447 (branches are permanent and global, did you want a bookmark?)
448 448 $ echo init > j/foo
449 449 $ hg -R j ci -Am init
450 450 adding foo
451 451 $ hg clone j k
452 452 updating to branch a
453 453 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
454 454 $ echo a1 > j/foo
455 455 $ hg -R j ci -m a1
456 456 $ hg -R k branch b
457 457 marked working directory as branch b
458 458 (branches are permanent and global, did you want a bookmark?)
459 459 $ echo b > k/foo
460 460 $ hg -R k ci -m b
461 461 $ hg -R k up 0
462 462 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
463 463
464 464 $ hg -R k merge b
465 465 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
466 466 (branch merge, don't forget to commit)
467 467
468 468 $ hg -R k ci -m merge
469 469
470 470 $ hg -R k push -r a j
471 471 pushing to j
472 472 searching for changes
473 473 abort: push creates new remote branches: b!
474 474 (use 'hg push --new-branch' to create new remote branches)
475 475 [255]
476 476
477 477
478 478 Prepush -r should not allow you to sneak in new heads:
479 479
480 480 $ hg init l
481 481 $ cd l
482 482 $ echo a >> foo
483 483 $ hg -q add foo
484 484 $ hg -q branch a
485 485 $ hg -q ci -ma
486 486 $ hg -q up null
487 487 $ echo a >> foo
488 488 $ hg -q add foo
489 489 $ hg -q branch b
490 490 $ hg -q ci -mb
491 491 $ cd ..
492 492 $ hg -q clone l m -u a
493 493 $ cd m
494 494 $ hg -q merge b
495 495 $ hg -q ci -mmb
496 496 $ hg -q up 0
497 497 $ echo a >> foo
498 498 $ hg -q ci -ma2
499 499 $ hg -q up 2
500 500 $ echo a >> foo
501 501 $ hg -q branch -f b
502 502 $ hg -q ci -mb2
503 503 $ hg -q merge 3
504 504 $ hg -q ci -mma
505 505
506 506 $ hg push ../l -b b
507 507 pushing to ../l
508 508 searching for changes
509 509 abort: push creates new remote head 451211cc22b0 on branch 'a'!
510 510 (merge or see "hg help push" for details about pushing new heads)
511 511 [255]
512 512
513 513 $ cd ..
514 514
515 515
516 516 Check prepush with new branch head on former topo non-head:
517 517
518 518 $ hg init n
519 519 $ cd n
520 520 $ hg branch A
521 521 marked working directory as branch A
522 522 (branches are permanent and global, did you want a bookmark?)
523 523 $ echo a >a
524 524 $ hg ci -Ama
525 525 adding a
526 526 $ hg branch B
527 527 marked working directory as branch B
528 528 (branches are permanent and global, did you want a bookmark?)
529 529 $ echo b >b
530 530 $ hg ci -Amb
531 531 adding b
532 532
533 533 b is now branch head of B, and a topological head
534 534 a is now branch head of A, but not a topological head
535 535
536 536 $ hg clone . inner
537 537 updating to branch B
538 538 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
539 539 $ cd inner
540 540 $ hg up B
541 541 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
542 542 $ echo b1 >b1
543 543 $ hg ci -Amb1
544 544 adding b1
545 545
546 546 in the clone b1 is now the head of B
547 547
548 548 $ cd ..
549 549 $ hg up 0
550 550 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
551 551 $ echo a2 >a2
552 552 $ hg ci -Ama2
553 553 adding a2
554 554
555 555 a2 is now the new branch head of A, and a new topological head
556 556 it replaces a former inner branch head, so it should at most warn about
557 557 A, not B
558 558
559 559 glog of local:
560 560
561 561 $ hg log -G --template "{rev}: {branches} {desc}\n"
562 562 @ 2: A a2
563 563 |
564 564 | o 1: B b
565 565 |/
566 566 o 0: A a
567 567
568 568 glog of remote:
569 569
570 570 $ hg log -G -R inner --template "{rev}: {branches} {desc}\n"
571 571 @ 2: B b1
572 572 |
573 573 o 1: B b
574 574 |
575 575 o 0: A a
576 576
577 577 outgoing:
578 578
579 579 $ hg out inner --template "{rev}: {branches} {desc}\n"
580 580 comparing with inner
581 581 searching for changes
582 582 2: A a2
583 583
584 584 $ hg push inner
585 585 pushing to inner
586 586 searching for changes
587 587 adding changesets
588 588 adding manifests
589 589 adding file changes
590 590 added 1 changesets with 1 changes to 1 files (+1 heads)
591 591
592 592 $ cd ..
593 593
594 594
595 595 Check prepush with new branch head on former topo head:
596 596
597 597 $ hg init o
598 598 $ cd o
599 599 $ hg branch A
600 600 marked working directory as branch A
601 601 (branches are permanent and global, did you want a bookmark?)
602 602 $ echo a >a
603 603 $ hg ci -Ama
604 604 adding a
605 605 $ hg branch B
606 606 marked working directory as branch B
607 607 (branches are permanent and global, did you want a bookmark?)
608 608 $ echo b >b
609 609 $ hg ci -Amb
610 610 adding b
611 611
612 612 b is now branch head of B, and a topological head
613 613
614 614 $ hg up 0
615 615 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
616 616 $ echo a1 >a1
617 617 $ hg ci -Ama1
618 618 adding a1
619 619
620 620 a1 is now branch head of A, and a topological head
621 621
622 622 $ hg clone . inner
623 623 updating to branch A
624 624 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
625 625 $ cd inner
626 626 $ hg up B
627 627 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
628 628 $ echo b1 >b1
629 629 $ hg ci -Amb1
630 630 adding b1
631 631
632 632 in the clone b1 is now the head of B
633 633
634 634 $ cd ..
635 635 $ echo a2 >a2
636 636 $ hg ci -Ama2
637 637 adding a2
638 638
639 639 a2 is now the new branch head of A, and a topological head
640 640 it replaces a former topological and branch head, so this should not warn
641 641
642 642 glog of local:
643 643
644 644 $ hg log -G --template "{rev}: {branches} {desc}\n"
645 645 @ 3: A a2
646 646 |
647 647 o 2: A a1
648 648 |
649 649 | o 1: B b
650 650 |/
651 651 o 0: A a
652 652
653 653 glog of remote:
654 654
655 655 $ hg log -G -R inner --template "{rev}: {branches} {desc}\n"
656 656 @ 3: B b1
657 657 |
658 658 | o 2: A a1
659 659 | |
660 660 o | 1: B b
661 661 |/
662 662 o 0: A a
663 663
664 664 outgoing:
665 665
666 666 $ hg out inner --template "{rev}: {branches} {desc}\n"
667 667 comparing with inner
668 668 searching for changes
669 669 3: A a2
670 670
671 671 $ hg push inner
672 672 pushing to inner
673 673 searching for changes
674 674 adding changesets
675 675 adding manifests
676 676 adding file changes
677 677 added 1 changesets with 1 changes to 1 files
678 678
679 679 $ cd ..
680 680
681 681
682 682 Check prepush with new branch head and new child of former branch head
683 683 but child is on different branch:
684 684
685 685 $ hg init p
686 686 $ cd p
687 687 $ hg branch A
688 688 marked working directory as branch A
689 689 (branches are permanent and global, did you want a bookmark?)
690 690 $ echo a0 >a
691 691 $ hg ci -Ama0
692 692 adding a
693 693 $ echo a1 >a
694 694 $ hg ci -ma1
695 695 $ hg up null
696 696 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
697 697 $ hg branch B
698 698 marked working directory as branch B
699 699 (branches are permanent and global, did you want a bookmark?)
700 700 $ echo b0 >b
701 701 $ hg ci -Amb0
702 702 adding b
703 703 $ echo b1 >b
704 704 $ hg ci -mb1
705 705
706 706 $ hg clone . inner
707 707 updating to branch B
708 708 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
709 709
710 710 $ hg up A
711 711 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
712 712 $ hg branch -f B
713 713 marked working directory as branch B
714 714 (branches are permanent and global, did you want a bookmark?)
715 715 $ echo a3 >a
716 716 $ hg ci -ma3
717 717 created new head
718 718 $ hg up 3
719 719 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
720 720 $ hg branch -f A
721 721 marked working directory as branch A
722 722 (branches are permanent and global, did you want a bookmark?)
723 723 $ echo b3 >b
724 724 $ hg ci -mb3
725 725 created new head
726 726
727 727 glog of local:
728 728
729 729 $ hg log -G --template "{rev}: {branches} {desc}\n"
730 730 @ 5: A b3
731 731 |
732 732 | o 4: B a3
733 733 | |
734 734 o | 3: B b1
735 735 | |
736 736 o | 2: B b0
737 737 /
738 738 o 1: A a1
739 739 |
740 740 o 0: A a0
741 741
742 742 glog of remote:
743 743
744 744 $ hg log -G -R inner --template "{rev}: {branches} {desc}\n"
745 745 @ 3: B b1
746 746 |
747 747 o 2: B b0
748 748
749 749 o 1: A a1
750 750 |
751 751 o 0: A a0
752 752
753 753 outgoing:
754 754
755 755 $ hg out inner --template "{rev}: {branches} {desc}\n"
756 756 comparing with inner
757 757 searching for changes
758 758 4: B a3
759 759 5: A b3
760 760
761 761 $ hg push inner
762 762 pushing to inner
763 763 searching for changes
764 764 abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'!
765 765 (merge or see "hg help push" for details about pushing new heads)
766 766 [255]
767 767
768 768 $ hg push inner -r4 -r5
769 769 pushing to inner
770 770 searching for changes
771 771 abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'!
772 772 (merge or see "hg help push" for details about pushing new heads)
773 773 [255]
774 774
775 775 $ hg in inner
776 776 comparing with inner
777 777 searching for changes
778 778 no changes found
779 779 [1]
780 780
781 781 $ cd ..
@@ -1,203 +1,203 b''
1 1 Revert interactive tests
2 2 1 add and commit file f
3 3 2 add commit file folder1/g
4 4 3 add and commit file folder2/h
5 5 4 add and commit file folder1/i
6 6 5 commit change to file f
7 7 6 commit changes to files folder1/g folder2/h
8 8 7 commit changes to files folder1/g folder2/h
9 9 8 revert interactive to commit id 2 (line 3 above), check that folder1/i is removed and
10 10 9 make workdir match 7
11 11 10 run the same test than 8 from within folder1 and check same expectations
12 12
13 13 $ cat <<EOF >> $HGRCPATH
14 14 > [ui]
15 15 > interactive = true
16 16 > [extensions]
17 17 > record =
18 18 > EOF
19 19
20 20
21 21 $ mkdir -p a/{folder1,folder2}
22 22 $ cd a
23 23 $ hg init
24 $ seq 1 5 > f ; hg add f ; hg commit -m "adding f"
25 $ seq 1 5 > folder1/g ; hg add folder1/g ; hg commit -m "adding folder1/g"
26 $ seq 1 5 > folder2/h ; hg add folder2/h ; hg commit -m "adding folder2/h"
27 $ seq 1 5 > folder1/i ; hg add folder1/i ; hg commit -m "adding folder1/i"
28 $ echo "a" > f ; seq 1 5 >> f ; echo "b" >> f ; hg commit -m "modifying f"
29 $ echo "c" > folder1/g ; seq 1 5 >> folder1/g ; echo "d" >> folder1/g ; hg commit -m "modifying folder1/g"
30 $ echo "e" > folder2/h ; seq 1 5 >> folder2/h ; echo "f" >> folder2/h ; hg commit -m "modifying folder2/h"
24 $ python $TESTDIR/seq.py 1 5 > f ; hg add f ; hg commit -m "adding f"
25 $ cat f > folder1/g ; hg add folder1/g ; hg commit -m "adding folder1/g"
26 $ cat f > folder2/h ; hg add folder2/h ; hg commit -m "adding folder2/h"
27 $ cat f > folder1/i ; hg add folder1/i ; hg commit -m "adding folder1/i"
28 $ echo "a" > f ; python $TESTDIR/seq.py 1 5 >> f ; echo "b" >> f ; hg commit -m "modifying f"
29 $ echo "c" > folder1/g ; python $TESTDIR/seq.py 1 5 >> folder1/g ; echo "d" >> folder1/g ; hg commit -m "modifying folder1/g"
30 $ echo "e" > folder2/h ; python $TESTDIR/seq.py 1 5 >> folder2/h ; echo "f" >> folder2/h ; hg commit -m "modifying folder2/h"
31 31 $ hg tip
32 32 changeset: 6:59dd6e4ab63a
33 33 tag: tip
34 34 user: test
35 35 date: Thu Jan 01 00:00:00 1970 +0000
36 36 summary: modifying folder2/h
37 37
38 38 $ hg revert -i -r 2 --all -- << EOF
39 39 > y
40 40 > y
41 41 > y
42 42 > y
43 43 > y
44 44 > n
45 45 > n
46 46 > EOF
47 47 reverting f
48 48 reverting folder1/g (glob)
49 49 removing folder1/i (glob)
50 50 reverting folder2/h (glob)
51 51 diff -r 89ac3d72e4a4 f
52 52 2 hunks, 2 lines changed
53 53 examine changes to 'f'? [Ynesfdaq?] y
54 54
55 55 @@ -1,6 +1,5 @@
56 56 -a
57 57 1
58 58 2
59 59 3
60 60 4
61 61 5
62 62 record change 1/6 to 'f'? [Ynesfdaq?] y
63 63
64 64 @@ -2,6 +1,5 @@
65 65 1
66 66 2
67 67 3
68 68 4
69 69 5
70 70 -b
71 71 record change 2/6 to 'f'? [Ynesfdaq?] y
72 72
73 73 diff -r 89ac3d72e4a4 folder1/g
74 74 2 hunks, 2 lines changed
75 75 examine changes to 'folder1/g'? [Ynesfdaq?] y
76 76
77 77 @@ -1,6 +1,5 @@
78 78 -c
79 79 1
80 80 2
81 81 3
82 82 4
83 83 5
84 84 record change 3/6 to 'folder1/g'? [Ynesfdaq?] y
85 85
86 86 @@ -2,6 +1,5 @@
87 87 1
88 88 2
89 89 3
90 90 4
91 91 5
92 92 -d
93 93 record change 4/6 to 'folder1/g'? [Ynesfdaq?] n
94 94
95 95 diff -r 89ac3d72e4a4 folder2/h
96 96 2 hunks, 2 lines changed
97 97 examine changes to 'folder2/h'? [Ynesfdaq?] n
98 98
99 99 $ cat f
100 100 1
101 101 2
102 102 3
103 103 4
104 104 5
105 105 $ cat folder1/g
106 106 1
107 107 2
108 108 3
109 109 4
110 110 5
111 111 d
112 112 $ cat folder2/h
113 113 e
114 114 1
115 115 2
116 116 3
117 117 4
118 118 5
119 119 f
120 120 $ hg update -C 6
121 121 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
122 122 $ hg revert -i -r 2 --all -- << EOF
123 123 > y
124 124 > y
125 125 > y
126 126 > y
127 127 > y
128 128 > n
129 129 > n
130 130 > EOF
131 131 reverting f
132 132 reverting folder1/g (glob)
133 133 removing folder1/i (glob)
134 134 reverting folder2/h (glob)
135 135 diff -r 89ac3d72e4a4 f
136 136 2 hunks, 2 lines changed
137 137 examine changes to 'f'? [Ynesfdaq?] y
138 138
139 139 @@ -1,6 +1,5 @@
140 140 -a
141 141 1
142 142 2
143 143 3
144 144 4
145 145 5
146 146 record change 1/6 to 'f'? [Ynesfdaq?] y
147 147
148 148 @@ -2,6 +1,5 @@
149 149 1
150 150 2
151 151 3
152 152 4
153 153 5
154 154 -b
155 155 record change 2/6 to 'f'? [Ynesfdaq?] y
156 156
157 157 diff -r 89ac3d72e4a4 folder1/g
158 158 2 hunks, 2 lines changed
159 159 examine changes to 'folder1/g'? [Ynesfdaq?] y
160 160
161 161 @@ -1,6 +1,5 @@
162 162 -c
163 163 1
164 164 2
165 165 3
166 166 4
167 167 5
168 168 record change 3/6 to 'folder1/g'? [Ynesfdaq?] y
169 169
170 170 @@ -2,6 +1,5 @@
171 171 1
172 172 2
173 173 3
174 174 4
175 175 5
176 176 -d
177 177 record change 4/6 to 'folder1/g'? [Ynesfdaq?] n
178 178
179 179 diff -r 89ac3d72e4a4 folder2/h
180 180 2 hunks, 2 lines changed
181 181 examine changes to 'folder2/h'? [Ynesfdaq?] n
182 182
183 183 $ cat f
184 184 1
185 185 2
186 186 3
187 187 4
188 188 5
189 189 $ cat folder1/g
190 190 1
191 191 2
192 192 3
193 193 4
194 194 5
195 195 d
196 196 $ cat folder2/h
197 197 e
198 198 1
199 199 2
200 200 3
201 201 4
202 202 5
203 203 f
@@ -1,406 +1,406 b''
1 1
2 2 Function to test discovery between two repos in both directions, using both the local shortcut
3 3 (which is currently not activated by default) and the full remotable protocol:
4 4
5 5 $ testdesc() { # revs_a, revs_b, dagdesc
6 6 > if [ -d foo ]; then rm -rf foo; fi
7 7 > hg init foo
8 8 > cd foo
9 9 > hg debugbuilddag "$3"
10 10 > hg clone . a $1 --quiet
11 11 > hg clone . b $2 --quiet
12 12 > echo
13 13 > echo "% -- a -> b tree"
14 14 > hg -R a debugdiscovery b --verbose --old
15 15 > echo
16 16 > echo "% -- a -> b set"
17 17 > hg -R a debugdiscovery b --verbose --debug
18 18 > echo
19 19 > echo "% -- b -> a tree"
20 20 > hg -R b debugdiscovery a --verbose --old
21 21 > echo
22 22 > echo "% -- b -> a set"
23 23 > hg -R b debugdiscovery a --verbose --debug
24 24 > cd ..
25 25 > }
26 26
27 27
28 28 Small superset:
29 29
30 30 $ testdesc '-ra1 -ra2' '-rb1 -rb2 -rb3' '
31 31 > +2:f +1:a1:b1
32 32 > <f +4 :a2
33 33 > +5 :b2
34 34 > <f +3 :b3'
35 35
36 36 % -- a -> b tree
37 37 comparing with b
38 38 searching for changes
39 39 unpruned common: 01241442b3c2 66f7d451a68b b5714e113bc0
40 40 common heads: 01241442b3c2 b5714e113bc0
41 41 local is subset
42 42
43 43 % -- a -> b set
44 44 comparing with b
45 45 query 1; heads
46 46 searching for changes
47 47 all local heads known remotely
48 48 common heads: 01241442b3c2 b5714e113bc0
49 49 local is subset
50 50
51 51 % -- b -> a tree
52 52 comparing with a
53 53 searching for changes
54 54 unpruned common: 01241442b3c2 b5714e113bc0
55 55 common heads: 01241442b3c2 b5714e113bc0
56 56 remote is subset
57 57
58 58 % -- b -> a set
59 59 comparing with a
60 60 query 1; heads
61 61 searching for changes
62 62 all remote heads known locally
63 63 common heads: 01241442b3c2 b5714e113bc0
64 64 remote is subset
65 65
66 66
67 67 Many new:
68 68
69 69 $ testdesc '-ra1 -ra2' '-rb' '
70 70 > +2:f +3:a1 +3:b
71 71 > <f +30 :a2'
72 72
73 73 % -- a -> b tree
74 74 comparing with b
75 75 searching for changes
76 76 unpruned common: bebd167eb94d
77 77 common heads: bebd167eb94d
78 78
79 79 % -- a -> b set
80 80 comparing with b
81 81 query 1; heads
82 82 searching for changes
83 83 taking initial sample
84 84 searching: 2 queries
85 85 query 2; still undecided: 29, sample size is: 29
86 86 2 total queries
87 87 common heads: bebd167eb94d
88 88
89 89 % -- b -> a tree
90 90 comparing with a
91 91 searching for changes
92 92 unpruned common: 66f7d451a68b bebd167eb94d
93 93 common heads: bebd167eb94d
94 94
95 95 % -- b -> a set
96 96 comparing with a
97 97 query 1; heads
98 98 searching for changes
99 99 taking initial sample
100 100 searching: 2 queries
101 101 query 2; still undecided: 2, sample size is: 2
102 102 2 total queries
103 103 common heads: bebd167eb94d
104 104
105 105
106 106 Both sides many new with stub:
107 107
108 108 $ testdesc '-ra1 -ra2' '-rb' '
109 109 > +2:f +2:a1 +30 :b
110 110 > <f +30 :a2'
111 111
112 112 % -- a -> b tree
113 113 comparing with b
114 114 searching for changes
115 115 unpruned common: 2dc09a01254d
116 116 common heads: 2dc09a01254d
117 117
118 118 % -- a -> b set
119 119 comparing with b
120 120 query 1; heads
121 121 searching for changes
122 122 taking initial sample
123 123 searching: 2 queries
124 124 query 2; still undecided: 29, sample size is: 29
125 125 2 total queries
126 126 common heads: 2dc09a01254d
127 127
128 128 % -- b -> a tree
129 129 comparing with a
130 130 searching for changes
131 131 unpruned common: 2dc09a01254d 66f7d451a68b
132 132 common heads: 2dc09a01254d
133 133
134 134 % -- b -> a set
135 135 comparing with a
136 136 query 1; heads
137 137 searching for changes
138 138 taking initial sample
139 139 searching: 2 queries
140 140 query 2; still undecided: 29, sample size is: 29
141 141 2 total queries
142 142 common heads: 2dc09a01254d
143 143
144 144
145 145 Both many new:
146 146
147 147 $ testdesc '-ra' '-rb' '
148 148 > +2:f +30 :b
149 149 > <f +30 :a'
150 150
151 151 % -- a -> b tree
152 152 comparing with b
153 153 searching for changes
154 154 unpruned common: 66f7d451a68b
155 155 common heads: 66f7d451a68b
156 156
157 157 % -- a -> b set
158 158 comparing with b
159 159 query 1; heads
160 160 searching for changes
161 161 taking quick initial sample
162 162 searching: 2 queries
163 163 query 2; still undecided: 31, sample size is: 31
164 164 2 total queries
165 165 common heads: 66f7d451a68b
166 166
167 167 % -- b -> a tree
168 168 comparing with a
169 169 searching for changes
170 170 unpruned common: 66f7d451a68b
171 171 common heads: 66f7d451a68b
172 172
173 173 % -- b -> a set
174 174 comparing with a
175 175 query 1; heads
176 176 searching for changes
177 177 taking quick initial sample
178 178 searching: 2 queries
179 179 query 2; still undecided: 31, sample size is: 31
180 180 2 total queries
181 181 common heads: 66f7d451a68b
182 182
183 183
184 184 Both many new skewed:
185 185
186 186 $ testdesc '-ra' '-rb' '
187 187 > +2:f +30 :b
188 188 > <f +50 :a'
189 189
190 190 % -- a -> b tree
191 191 comparing with b
192 192 searching for changes
193 193 unpruned common: 66f7d451a68b
194 194 common heads: 66f7d451a68b
195 195
196 196 % -- a -> b set
197 197 comparing with b
198 198 query 1; heads
199 199 searching for changes
200 200 taking quick initial sample
201 201 searching: 2 queries
202 202 query 2; still undecided: 51, sample size is: 51
203 203 2 total queries
204 204 common heads: 66f7d451a68b
205 205
206 206 % -- b -> a tree
207 207 comparing with a
208 208 searching for changes
209 209 unpruned common: 66f7d451a68b
210 210 common heads: 66f7d451a68b
211 211
212 212 % -- b -> a set
213 213 comparing with a
214 214 query 1; heads
215 215 searching for changes
216 216 taking quick initial sample
217 217 searching: 2 queries
218 218 query 2; still undecided: 31, sample size is: 31
219 219 2 total queries
220 220 common heads: 66f7d451a68b
221 221
222 222
223 223 Both many new on top of long history:
224 224
225 225 $ testdesc '-ra' '-rb' '
226 226 > +1000:f +30 :b
227 227 > <f +50 :a'
228 228
229 229 % -- a -> b tree
230 230 comparing with b
231 231 searching for changes
232 232 unpruned common: 7ead0cba2838
233 233 common heads: 7ead0cba2838
234 234
235 235 % -- a -> b set
236 236 comparing with b
237 237 query 1; heads
238 238 searching for changes
239 239 taking quick initial sample
240 240 searching: 2 queries
241 241 query 2; still undecided: 1049, sample size is: 11
242 242 sampling from both directions
243 243 searching: 3 queries
244 244 query 3; still undecided: 31, sample size is: 31
245 245 3 total queries
246 246 common heads: 7ead0cba2838
247 247
248 248 % -- b -> a tree
249 249 comparing with a
250 250 searching for changes
251 251 unpruned common: 7ead0cba2838
252 252 common heads: 7ead0cba2838
253 253
254 254 % -- b -> a set
255 255 comparing with a
256 256 query 1; heads
257 257 searching for changes
258 258 taking quick initial sample
259 259 searching: 2 queries
260 260 query 2; still undecided: 1029, sample size is: 11
261 261 sampling from both directions
262 262 searching: 3 queries
263 263 query 3; still undecided: 15, sample size is: 15
264 264 3 total queries
265 265 common heads: 7ead0cba2838
266 266
267 267
268 268 One with >200 heads, which used to use up all of the sample:
269 269
270 270 $ hg init manyheads
271 271 $ cd manyheads
272 272 $ echo "+300:r @a" >dagdesc
273 273 $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads
274 274 $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads
275 275 $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads
276 276 $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads
277 277 $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads
278 278 $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads
279 279 $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads
280 280 $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads
281 281 $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads
282 282 $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads
283 283 $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads
284 284 $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads
285 285 $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads
286 286 $ echo "@b *r+3" >>dagdesc # one more head
287 287 $ hg debugbuilddag <dagdesc
288 288 reading DAG from stdin
289 289
290 290 $ hg heads -t --template . | wc -c
291 291 \s*261 (re)
292 292
293 293 $ hg clone -b a . a
294 294 adding changesets
295 295 adding manifests
296 296 adding file changes
297 297 added 1340 changesets with 0 changes to 0 files (+259 heads)
298 298 updating to branch a
299 299 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
300 300 $ hg clone -b b . b
301 301 adding changesets
302 302 adding manifests
303 303 adding file changes
304 304 added 304 changesets with 0 changes to 0 files
305 305 updating to branch b
306 306 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
307 307
308 308 $ hg -R a debugdiscovery b --debug --verbose
309 309 comparing with b
310 310 query 1; heads
311 311 searching for changes
312 312 taking quick initial sample
313 313 searching: 2 queries
314 314 query 2; still undecided: 1240, sample size is: 100
315 315 sampling from both directions
316 316 searching: 3 queries
317 317 query 3; still undecided: 1140, sample size is: 200
318 318 sampling from both directions
319 319 searching: 4 queries
320 320 query 4; still undecided: 592, sample size is: 200
321 321 sampling from both directions
322 322 searching: 5 queries
323 323 query 5; still undecided: 292, sample size is: 200
324 324 sampling from both directions
325 325 searching: 6 queries
326 326 query 6; still undecided: 51, sample size is: 51
327 327 6 total queries
328 328 common heads: 3ee37d65064a
329 329
330 330 Test actual protocol when pulling one new head in addition to common heads
331 331
332 332 $ hg clone -U b c
333 333 $ hg -R c id -ir tip
334 334 513314ca8b3a
335 335 $ hg -R c up -qr default
336 336 $ touch c/f
337 337 $ hg -R c ci -Aqm "extra head"
338 338 $ hg -R c id -i
339 339 e64a39e7da8b
340 340
341 341 $ hg serve -R c -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
342 342 $ cat hg.pid >> $DAEMON_PIDS
343 343
344 344 $ hg -R b incoming http://localhost:$HGPORT/ -T '{node|short}\n'
345 345 comparing with http://localhost:$HGPORT/
346 346 searching for changes
347 347 e64a39e7da8b
348 348
349 349 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
350 350 $ cut -d' ' -f6- access.log | grep -v cmd=known # cmd=known uses random sampling
351 351 "GET /?cmd=capabilities HTTP/1.1" 200 -
352 352 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D513314ca8b3ae4dac8eec56966265b00fcf866db
353 353 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=513314ca8b3ae4dac8eec56966265b00fcf866db&heads=e64a39e7da8b0d54bc63e81169aff001c13b3477
354 354 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
355 355 $ cat errors.log
356 356
357 357 $ cd ..
358 358
359 359
360 360 Issue 4438 - test coverage for 3ef893520a85 issues.
361 361
362 362 $ mkdir issue4438
363 363 $ cd issue4438
364 364 #if false
365 365 generate new bundles:
366 366 $ hg init r1
367 $ for i in `seq 101`; do hg -R r1 up -qr null && hg -R r1 branch -q b$i && hg -R r1 ci -qmb$i; done
367 $ for i in `python $TESTDIR/seq.py 101`; do hg -R r1 up -qr null && hg -R r1 branch -q b$i && hg -R r1 ci -qmb$i; done
368 368 $ hg clone -q r1 r2
369 $ for i in `seq 10`; do hg -R r1 up -qr null && hg -R r1 branch -q c$i && hg -R r1 ci -qmc$i; done
369 $ for i in `python $TESTDIR/seq.py 10`; do hg -R r1 up -qr null && hg -R r1 branch -q c$i && hg -R r1 ci -qmc$i; done
370 370 $ hg -R r2 branch -q r2change && hg -R r2 ci -qmr2change
371 371 $ hg -R r1 bundle -qa $TESTDIR/bundles/issue4438-r1.hg
372 372 $ hg -R r2 bundle -qa $TESTDIR/bundles/issue4438-r2.hg
373 373 #else
374 374 use existing bundles:
375 375 $ hg clone -q $TESTDIR/bundles/issue4438-r1.hg r1
376 376 $ hg clone -q $TESTDIR/bundles/issue4438-r2.hg r2
377 377 #endif
378 378
379 379 Set iteration order could cause wrong and unstable results - fixed in 73cfaa348650:
380 380
381 381 $ hg -R r1 outgoing r2 -T'{rev} '
382 382 comparing with r2
383 383 searching for changes
384 384 101 102 103 104 105 106 107 108 109 110 (no-eol)
385 385
386 386 The case where all the 'initialsamplesize' samples already were common would
387 387 give 'all remote heads known locally' without checking the remaining heads -
388 388 fixed in 86c35b7ae300:
389 389
390 390 $ cat >> $TESTTMP/unrandomsample.py << EOF
391 391 > import random
392 392 > def sample(population, k):
393 393 > return sorted(population)[:k]
394 394 > random.sample = sample
395 395 > EOF
396 396
397 397 $ cat >> r1/.hg/hgrc << EOF
398 398 > [extensions]
399 399 > unrandomsample = $TESTTMP/unrandomsample.py
400 400 > EOF
401 401
402 402 $ hg -R r1 outgoing r2 -T'{rev} '
403 403 comparing with r2
404 404 searching for changes
405 405 101 102 103 104 105 106 107 108 109 110 (no-eol)
406 406 $ cd ..
@@ -1,104 +1,104 b''
1 1 Tests of the file helper tool
2 2
3 3 $ f -h
4 4 ?sage: f [options] [filenames] (glob)
5 5
6 6 ?ptions: (glob)
7 7 -h, --help show this help message and exit
8 8 -t, --type show file type (file or directory)
9 9 -m, --mode show file mode
10 10 -l, --links show number of links
11 11 -s, --size show size of file
12 12 -n NEWER, --newer=NEWER
13 13 check if file is newer (or same)
14 14 -r, --recurse recurse into directories
15 15 -S, --sha1 show sha1 hash of the content
16 16 -M, --md5 show md5 hash of the content
17 17 -D, --dump dump file content
18 18 -H, --hexdump hexdump file content
19 19 -B BYTES, --bytes=BYTES
20 20 number of characters to dump
21 21 -L LINES, --lines=LINES
22 22 number of lines to dump
23 23 -q, --quiet no default output
24 24
25 25 $ mkdir dir
26 26 $ cd dir
27 27
28 28 $ f --size
29 29 size=0
30 30
31 31 $ echo hello | f --md5 --size
32 32 size=6, md5=b1946ac92492d2347c6235b4d2611184
33 33
34 34 $ f foo
35 35 foo: file not found
36 36
37 37 $ echo foo > foo
38 38 $ f foo
39 39 foo:
40 40
41 41 #if symlink
42 42 $ f foo --mode
43 43 foo: mode=644
44 44 #endif
45 45
46 $ seq 10 > bar
46 $ python $TESTDIR/seq.py 10 > bar
47 47 #if unix-permissions symlink
48 48 $ chmod +x bar
49 49 $ f bar --newer foo --mode --type --size --dump --links --bytes 7
50 50 bar: file, size=21, mode=755, links=1, newer than foo
51 51 >>>
52 52 1
53 53 2
54 54 3
55 55 4
56 56 <<< no trailing newline
57 57 #endif
58 58
59 59 #if unix-permissions
60 60 $ ln bar baz
61 61 $ f bar -n baz -l --hexdump -t --sha1 --lines=9 -B 20
62 62 bar: file, links=2, newer than baz, sha1=612ca68d0305c821750a
63 63 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
64 64 0010: 39 0a |9.|
65 65 $ rm baz
66 66 #endif
67 67
68 68 #if unix-permissions symlink
69 69 $ ln -s yadda l
70 70 $ f . --recurse -MStmsB4
71 71 .: directory with 3 files, mode=755
72 72 ./bar: file, size=21, mode=755, md5=3b03, sha1=612c
73 73 ./foo: file, size=4, mode=644, md5=d3b0, sha1=f1d2
74 74 ./l: link, size=5, md5=2faa, sha1=af93
75 75 #endif
76 76
77 77 $ f --quiet bar -DL 3
78 78 1
79 79 2
80 80 3
81 81
82 82 $ cd ..
83 83
84 84 Yadda is a symlink
85 85 #if symlink
86 86 $ f -qr dir -HB 17
87 87 dir: directory with 3 files
88 88 dir/bar:
89 89 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
90 90 0010: 39 |9|
91 91 dir/foo:
92 92 0000: 66 6f 6f 0a |foo.|
93 93 dir/l:
94 94 0000: 79 61 64 64 61 |yadda|
95 95 #else
96 96 $ f -qr dir -HB 17
97 97 dir: directory with 2 files (esc)
98 98 dir/bar: (glob)
99 99 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
100 100 0010: 39 |9|
101 101 dir/foo: (glob)
102 102 0000: 66 6f 6f 0a |foo.|
103 103 #endif
104 104
General Comments 0
You need to be logged in to leave comments. Login now