Mercurial > hg
comparison tests/test-histedit-obsolete.t @ 30556:c059286a0f9c
tests: replace "cp -r" with "cp -R"
The POSIX documentation about "cp" [1] says:
....
RATIONALE
....
Earlier versions of this standard included support for the -r option to
copy file hierarchies. The -r option is historical practice on BSD and
BSD-derived systems. This option is no longer specified by POSIX.1-2008
but may be present in some implementations. The -R option was added as a
close synonym to the -r option, selected for consistency with all other
options in this volume of POSIX.1-2008 that do recursive directory
descent.
The difference between -R and the removed -r option is in the treatment
by cp of file types other than regular and directory. It was
implementation-defined how the - option treated special files to allow
both historical implementations and those that chose to support -r with
the same abilities as -R defined by this volume of POSIX.1-2008. The
original -r flag, for historic reasons, did not handle special files any
differently from regular files, but always read the file and copied its
contents. This had obvious problems in the presence of special file
types; for example, character devices, FIFOs, and sockets.
....
....
Issue 6
The -r option is marked obsolescent.
....
Issue 7
....
The obsolescent -r option is removed.
....
(No "Issue 8" yet)
Therefore it's clear that "cp -R" is strictly better than "cp -r".
The issue was discovered when running tests on OS X after 0d87b1caed92.
[1]: pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 30 Nov 2016 19:25:18 +0000 |
parents | 5ad164698626 |
children | 37ab9e20991c |
comparison
equal
deleted
inserted
replaced
30555:6a672c3b7860 | 30556:c059286a0f9c |
---|---|
337 Resulting changeset should conserve the phase of the original one whatever the | 337 Resulting changeset should conserve the phase of the original one whatever the |
338 phases.new-commit option is. | 338 phases.new-commit option is. |
339 | 339 |
340 New-commit as draft (default) | 340 New-commit as draft (default) |
341 | 341 |
342 $ cp -r base simple-draft | 342 $ cp -R base simple-draft |
343 $ cd simple-draft | 343 $ cd simple-draft |
344 $ hg histedit -r 'b449568bf7fc' --commands - << EOF | 344 $ hg histedit -r 'b449568bf7fc' --commands - << EOF |
345 > edit b449568bf7fc 11 f | 345 > edit b449568bf7fc 11 f |
346 > pick 6b70183d2492 12 g | 346 > pick 6b70183d2492 12 g |
347 > pick 7395e1ff83bd 13 h | 347 > pick 7395e1ff83bd 13 h |
376 $ cd .. | 376 $ cd .. |
377 | 377 |
378 | 378 |
379 New-commit as secret (config) | 379 New-commit as secret (config) |
380 | 380 |
381 $ cp -r base simple-secret | 381 $ cp -R base simple-secret |
382 $ cd simple-secret | 382 $ cd simple-secret |
383 $ cat >> .hg/hgrc << EOF | 383 $ cat >> .hg/hgrc << EOF |
384 > [phases] | 384 > [phases] |
385 > new-commit=secret | 385 > new-commit=secret |
386 > EOF | 386 > EOF |
423 ------------------------------------------- | 423 ------------------------------------------- |
424 | 424 |
425 If a secret changeset is put before a draft one, all descendant should be secret. | 425 If a secret changeset is put before a draft one, all descendant should be secret. |
426 It seems more important to present the secret phase. | 426 It seems more important to present the secret phase. |
427 | 427 |
428 $ cp -r base reorder | 428 $ cp -R base reorder |
429 $ cd reorder | 429 $ cd reorder |
430 $ hg histedit -r 'b449568bf7fc' --commands - << EOF | 430 $ hg histedit -r 'b449568bf7fc' --commands - << EOF |
431 > pick b449568bf7fc 11 f | 431 > pick b449568bf7fc 11 f |
432 > pick 3a6c53ee7f3d 15 j | 432 > pick 3a6c53ee7f3d 15 j |
433 > pick 6b70183d2492 12 g | 433 > pick 6b70183d2492 12 g |
460 Folding a secret changeset with a draft one turn the result secret (again, | 460 Folding a secret changeset with a draft one turn the result secret (again, |
461 better safe than sorry). Folding between same phase changeset still works | 461 better safe than sorry). Folding between same phase changeset still works |
462 | 462 |
463 Note that there is a few reordering in this series for more extensive test | 463 Note that there is a few reordering in this series for more extensive test |
464 | 464 |
465 $ cp -r base folding | 465 $ cp -R base folding |
466 $ cd folding | 466 $ cd folding |
467 $ cat >> .hg/hgrc << EOF | 467 $ cat >> .hg/hgrc << EOF |
468 > [phases] | 468 > [phases] |
469 > new-commit=secret | 469 > new-commit=secret |
470 > EOF | 470 > EOF |