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
--- a/tests/test-bookmarks.t Wed Nov 30 16:39:36 2016 +0000
+++ b/tests/test-bookmarks.t Wed Nov 30 19:25:18 2016 +0000
@@ -572,8 +572,8 @@
$ hg bookmark -r3 Y
moving bookmark 'Y' forward from db815d6d32e6
- $ cp -r ../cloned-bookmarks-update ../cloned-bookmarks-manual-update
- $ cp -r ../cloned-bookmarks-update ../cloned-bookmarks-manual-update-with-divergence
+ $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update
+ $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update-with-divergence
(manual version)
--- a/tests/test-histedit-obsolete.t Wed Nov 30 16:39:36 2016 +0000
+++ b/tests/test-histedit-obsolete.t Wed Nov 30 19:25:18 2016 +0000
@@ -339,7 +339,7 @@
New-commit as draft (default)
- $ cp -r base simple-draft
+ $ cp -R base simple-draft
$ cd simple-draft
$ hg histedit -r 'b449568bf7fc' --commands - << EOF
> edit b449568bf7fc 11 f
@@ -378,7 +378,7 @@
New-commit as secret (config)
- $ cp -r base simple-secret
+ $ cp -R base simple-secret
$ cd simple-secret
$ cat >> .hg/hgrc << EOF
> [phases]
@@ -425,7 +425,7 @@
If a secret changeset is put before a draft one, all descendant should be secret.
It seems more important to present the secret phase.
- $ cp -r base reorder
+ $ cp -R base reorder
$ cd reorder
$ hg histedit -r 'b449568bf7fc' --commands - << EOF
> pick b449568bf7fc 11 f
@@ -462,7 +462,7 @@
Note that there is a few reordering in this series for more extensive test
- $ cp -r base folding
+ $ cp -R base folding
$ cd folding
$ cat >> .hg/hgrc << EOF
> [phases]
--- a/tests/test-obsolete-checkheads.t Wed Nov 30 16:39:36 2016 +0000
+++ b/tests/test-obsolete-checkheads.t Wed Nov 30 19:25:18 2016 +0000
@@ -23,7 +23,7 @@
$ mkcommit base
$ hg phase --public .
$ cd ..
- $ cp -r remote base
+ $ cp -R remote base
$ hg clone remote local
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -54,7 +54,7 @@
|/
o b4952fcf48cf (public) add base
- $ cp -r ../remote ../backup1
+ $ cp -R ../remote ../backup1
old exists remotely as draft. It is obsoleted by new that we now push.
Push should not warn about creating new head
@@ -73,7 +73,7 @@
setup
$ rm -fr ../remote
- $ cp -r ../backup1 ../remote
+ $ cp -R ../backup1 ../remote
$ hg -R ../remote phase --public c70b08862e08
$ hg pull -v
pulling from $TESTTMP/remote (glob)
@@ -104,7 +104,7 @@
# setup
#
# $ rm -fr ../remote
-# $ cp -r ../backup1 ../remote
+# $ cp -R ../backup1 ../remote
# $ hg -R ../remote phase --public c70b08862e08
# $ hg phase --draft --force c70b08862e08
# $ hg log -G --hidden
@@ -131,7 +131,7 @@
setup
$ rm -fr ../remote
- $ cp -r ../backup1 ../remote
+ $ cp -R ../backup1 ../remote
$ hg phase --draft --force '(0::) - 0'
$ hg up -q '.^'
$ mkcommit other
@@ -206,7 +206,7 @@
|/
@ b4952fcf48cf (public) add base
- $ cp -r ../remote ../backup2
+ $ cp -R ../remote ../backup2
Push should not warn about adding new heads. We create one, but we'll delete
one anyway.
@@ -226,7 +226,7 @@
setup
$ rm -fr ../remote
- $ cp -r ../backup1 ../remote
+ $ cp -R ../backup1 ../remote
$ cd ..
$ rm -rf local
$ hg clone remote local -r 0
--- a/tests/test-revert.t Wed Nov 30 16:39:36 2016 +0000
+++ b/tests/test-revert.t Wed Nov 30 19:25:18 2016 +0000
@@ -784,7 +784,7 @@
(setup from reference repo)
- $ cp -r revert-ref revert-parent-all
+ $ cp -R revert-ref revert-parent-all
$ cd revert-parent-all
check revert output
@@ -841,7 +841,7 @@
(setup from reference repo)
- $ cp -r revert-ref revert-base-all
+ $ cp -R revert-ref revert-base-all
$ cd revert-base-all
check revert output
@@ -896,7 +896,7 @@
(setup from reference repo)
- $ cp -r revert-ref revert-parent-explicit
+ $ cp -R revert-ref revert-parent-explicit
$ cd revert-parent-explicit
revert all files individually and check the output
@@ -989,7 +989,7 @@
(setup from reference repo)
- $ cp -r revert-ref revert-base-explicit
+ $ cp -R revert-ref revert-base-explicit
$ cd revert-base-explicit
revert all files individually and check the output
--- a/tests/test-subrepo.t Wed Nov 30 16:39:36 2016 +0000
+++ b/tests/test-subrepo.t Wed Nov 30 19:25:18 2016 +0000
@@ -1518,8 +1518,8 @@
Courtesy phases synchronisation to publishing server does not block the push
(issue3781)
- $ cp -r main issue3781
- $ cp -r main issue3781-dest
+ $ cp -R main issue3781
+ $ cp -R main issue3781-dest
$ cd issue3781-dest/s
$ hg phase tip # show we have draft changeset
5: draft
--- 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
--- a/tests/test-verify.t Wed Nov 30 16:39:36 2016 +0000
+++ b/tests/test-verify.t Wed Nov 30 19:25:18 2016 +0000
@@ -69,10 +69,10 @@
$ cd missing-entries
$ echo 0 > file
$ hg ci -Aqm0
- $ cp -r .hg/store .hg/store-partial
+ $ cp -R .hg/store .hg/store-partial
$ echo 1 > file
$ hg ci -Aqm1
- $ cp -r .hg/store .hg/store-full
+ $ cp -R .hg/store .hg/store-full
Entire changelog missing
@@ -84,7 +84,7 @@
3 integrity errors encountered!
(first damaged changeset appears to be 0)
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Entire manifest log missing
@@ -94,7 +94,7 @@
1 integrity errors encountered!
(first damaged changeset appears to be 0)
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Entire filelog missing
@@ -109,7 +109,7 @@
3 integrity errors encountered!
(first damaged changeset appears to be 0)
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Entire changelog and manifest log missing
@@ -118,7 +118,7 @@
$ hg verify -q
warning: orphan revlog 'data/file.i'
1 warnings encountered!
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Entire changelog and filelog missing
@@ -137,7 +137,7 @@
6 integrity errors encountered!
(first damaged changeset appears to be 0)
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Entire manifest log and filelog missing
@@ -152,7 +152,7 @@
2 integrity errors encountered!
(first damaged changeset appears to be 0)
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Changelog missing entry
@@ -165,7 +165,7 @@
1 warnings encountered!
3 integrity errors encountered!
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Manifest log missing entry
@@ -176,7 +176,7 @@
2 integrity errors encountered!
(first damaged changeset appears to be 1)
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Filelog missing entry
@@ -186,7 +186,7 @@
1 integrity errors encountered!
(first damaged changeset appears to be 1)
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Changelog and manifest log missing entry
@@ -199,7 +199,7 @@
1 warnings encountered!
2 integrity errors encountered!
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Changelog and filelog missing entry
@@ -211,7 +211,7 @@
file@?: manifest refers to unknown revision c10f2164107d
3 integrity errors encountered!
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Manifest and filelog missing entry
@@ -222,7 +222,7 @@
1 integrity errors encountered!
(first damaged changeset appears to be 1)
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Corrupt changelog base node to cause failure to read revision
@@ -238,7 +238,7 @@
4 integrity errors encountered!
(first damaged changeset appears to be 0)
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Corrupt manifest log base node to cause failure to read revision
@@ -250,7 +250,7 @@
2 integrity errors encountered!
(first damaged changeset appears to be 0)
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
Corrupt filelog base node to cause failure to read revision
@@ -261,7 +261,7 @@
1 integrity errors encountered!
(first damaged changeset appears to be 0)
[1]
- $ cp -r .hg/store-full/. .hg/store
+ $ cp -R .hg/store-full/. .hg/store
$ cd ..