Mercurial > hg
diff tests/test-treemanifest.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 | 55d341877316 |
children | 1871a1ee64ed |
line wrap: on
line diff
--- a/tests/test-treemanifest.t Wed Nov 30 16:39:36 2016 +0000 +++ b/tests/test-treemanifest.t Wed Nov 30 19:25:18 2016 +0000 @@ -458,7 +458,7 @@ b/bar/fruits.txt (glob) b/bar/orange/fly/gnat.py (glob) b/bar/orange/fly/housefly.txt (glob) - $ cp -r .hg/store .hg/store-copy + $ cp -R .hg/store .hg/store-copy Test files for a subdirectory. @@ -468,7 +468,7 @@ b/bar/orange/fly/gnat.py (glob) b/bar/orange/fly/housefly.txt (glob) b/foo/apple/bees/flower.py (glob) - $ cp -r .hg/store-copy/. .hg/store + $ cp -R .hg/store-copy/. .hg/store Test files with just includes and excludes. @@ -477,7 +477,7 @@ $ rm -r .hg/store/meta/b/foo/apple/bees $ hg files -r . -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees b/bar/fruits.txt (glob) - $ cp -r .hg/store-copy/. .hg/store + $ cp -R .hg/store-copy/. .hg/store Test files for a subdirectory, excluding a directory within it. @@ -487,7 +487,7 @@ b/bar/fruits.txt (glob) b/bar/orange/fly/gnat.py (glob) b/bar/orange/fly/housefly.txt (glob) - $ cp -r .hg/store-copy/. .hg/store + $ cp -R .hg/store-copy/. .hg/store Test files for a sub directory, including only a directory within it, and including an unrelated directory. @@ -497,7 +497,7 @@ $ hg files -r . -I path:b/bar/orange -I path:a b b/bar/orange/fly/gnat.py (glob) b/bar/orange/fly/housefly.txt (glob) - $ cp -r .hg/store-copy/. .hg/store + $ cp -R .hg/store-copy/. .hg/store Test files for a pattern, including a directory, and excluding a directory within that. @@ -507,7 +507,7 @@ $ rm -r .hg/store/meta/b/bar/orange $ hg files -r . glob:**.txt -I path:b/bar -X path:b/bar/orange b/bar/fruits.txt (glob) - $ cp -r .hg/store-copy/. .hg/store + $ cp -R .hg/store-copy/. .hg/store Add some more changes to the deep repo $ echo narf >> b/bar/fruits.txt @@ -553,7 +553,7 @@ $ killdaemons.py Back up the recently added revlogs - $ cp -r .hg/store .hg/store-newcopy + $ cp -R .hg/store .hg/store-newcopy Verify reports missing dirlog $ rm .hg/store/meta/b/00manifest.* @@ -582,7 +582,7 @@ 8 integrity errors encountered! (first damaged changeset appears to be 0) [1] - $ cp -r .hg/store-newcopy/. .hg/store + $ cp -R .hg/store-newcopy/. .hg/store Verify reports missing dirlog entry $ mv -f .hg/store-copy/meta/b/00manifest.* .hg/store/meta/b/ @@ -607,7 +607,7 @@ 8 integrity errors encountered! (first damaged changeset appears to be 1) [1] - $ cp -r .hg/store-newcopy/. .hg/store + $ cp -R .hg/store-newcopy/. .hg/store Test cloning a treemanifest repo over http. $ hg serve -p $HGPORT -d --pid-file=hg.pid --errorlog=errors.log