Patchwork [1,of,2] tests: use cp -R instead of cp -r

login
register
mail settings
Submitter Jun Wu
Date Nov. 30, 2016, 5:34 p.m.
Message ID <a4f46a03e5f8e33f32c3.1480527240@x1c>
Download mbox | patch
Permalink /patch/17802/
State Superseded
Delegated to: Jun Wu
Headers show

Comments

Jun Wu - Nov. 30, 2016, 5:34 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1480526736 0
#      Wed Nov 30 17:25:36 2016 +0000
# Node ID a4f46a03e5f8e33f32c36326c6b14b84d9cb03b4
# Parent  9e29d4e4e08b5996adda49cdd0b497d89e2b16ee
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r a4f46a03e5f8
tests: use cp -R instead of cp -r

This makes OS X happy for some tests after 0d87b1caed92. The default
behavior of -R (-P, not follow symlinks) is what we want.

"cp -r" is not documented in the OSX cp man page, and is not defined by
POSIX. The next patch will add a check-code rule to forbid it.
Kostia Balytskyi - Nov. 30, 2016, 5:44 p.m.
Good catch!

On 11/30/16 5:34 PM, Jun Wu wrote:
> # HG changeset patch

> # User Jun Wu <quark@fb.com>

> # Date 1480526736 0

> #      Wed Nov 30 17:25:36 2016 +0000

> # Node ID a4f46a03e5f8e33f32c36326c6b14b84d9cb03b4

> # Parent  9e29d4e4e08b5996adda49cdd0b497d89e2b16ee

> # Available At https://bitbucket.org/quark-zju/hg-draft

> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r a4f46a03e5f8

> tests: use cp -R instead of cp -r

>

> This makes OS X happy for some tests after 0d87b1caed92. The default

> behavior of -R (-P, not follow symlinks) is what we want.

>

> "cp -r" is not documented in the OSX cp man page, and is not defined by

> POSIX. The next patch will add a check-code rule to forbid it.

>

> diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t

> --- a/tests/test-bookmarks.t

> +++ b/tests/test-bookmarks.t

> @@ -573,6 +573,6 @@ pull --update works the same as pull &&

>     $ 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)

> diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t

> --- a/tests/test-histedit-obsolete.t

> +++ b/tests/test-histedit-obsolete.t

> @@ -340,5 +340,5 @@ phases.new-commit option is.

>   New-commit as draft (default)

>   

> -  $ cp -r base simple-draft

> +  $ cp -R base simple-draft

>     $ cd simple-draft

>     $ hg histedit -r 'b449568bf7fc' --commands - << EOF

> @@ -379,5 +379,5 @@ New-commit as draft (default)

>   New-commit as secret (config)

>   

> -  $ cp -r base simple-secret

> +  $ cp -R base simple-secret

>     $ cd simple-secret

>     $ cat >> .hg/hgrc << EOF

> @@ -426,5 +426,5 @@ If a secret changeset is put before a dr

>   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

> @@ -463,5 +463,5 @@ better safe than sorry). Folding between

>   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

> diff --git a/tests/test-obsolete-checkheads.t b/tests/test-obsolete-checkheads.t

> --- a/tests/test-obsolete-checkheads.t

> +++ b/tests/test-obsolete-checkheads.t

> @@ -24,5 +24,5 @@ Check that obsolete properly strip heads

>     $ hg phase --public .

>     $ cd ..

> -  $ cp -r remote base

> +  $ cp -R remote base

>     $ hg clone remote local

>     updating to branch default

> @@ -55,5 +55,5 @@ setup

>     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.

> @@ -74,5 +74,5 @@ setup

>   

>     $ rm -fr ../remote

> -  $ cp -r ../backup1 ../remote

> +  $ cp -R ../backup1 ../remote

>     $ hg -R ../remote phase --public c70b08862e08

>     $ hg pull -v

> @@ -105,5 +105,5 @@ TODO: Not implemented yet.

>   #

>   #   $ rm -fr ../remote

> -#   $ cp -r ../backup1 ../remote

> +#   $ cp -R ../backup1 ../remote

>   #   $ hg -R ../remote phase --public c70b08862e08

>   #   $ hg phase --draft --force c70b08862e08

> @@ -132,5 +132,5 @@ setup

>   

>     $ rm -fr ../remote

> -  $ cp -r ../backup1 ../remote

> +  $ cp -R ../backup1 ../remote

>     $ hg phase --draft --force '(0::) - 0'

>     $ hg up -q '.^'

> @@ -207,5 +207,5 @@ setup. (The obsolete marker is known loc

>     @  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

> @@ -227,5 +227,5 @@ setup

>   

>     $ rm -fr ../remote

> -  $ cp -r ../backup1 ../remote

> +  $ cp -R ../backup1 ../remote

>     $ cd ..

>     $ rm -rf local

> diff --git a/tests/test-revert.t b/tests/test-revert.t

> --- a/tests/test-revert.t

> +++ b/tests/test-revert.t

> @@ -785,5 +785,5 @@ Test revert --all to parent content

>   (setup from reference repo)

>   

> -  $ cp -r revert-ref revert-parent-all

> +  $ cp -R revert-ref revert-parent-all

>     $ cd revert-parent-all

>   

> @@ -842,5 +842,5 @@ Test revert --all to "base" content

>   (setup from reference repo)

>   

> -  $ cp -r revert-ref revert-base-all

> +  $ cp -R revert-ref revert-base-all

>     $ cd revert-base-all

>   

> @@ -897,5 +897,5 @@ Test revert to parent content with expli

>   (setup from reference repo)

>   

> -  $ cp -r revert-ref revert-parent-explicit

> +  $ cp -R revert-ref revert-parent-explicit

>     $ cd revert-parent-explicit

>   

> @@ -990,5 +990,5 @@ Test revert to "base" content with expli

>   (setup from reference repo)

>   

> -  $ cp -r revert-ref revert-base-explicit

> +  $ cp -R revert-ref revert-base-explicit

>     $ cd revert-base-explicit

>   

> diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t

> --- a/tests/test-subrepo.t

> +++ b/tests/test-subrepo.t

> @@ -1519,6 +1519,6 @@ Courtesy phases synchronisation to publi

>   (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

> diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t

> --- a/tests/test-treemanifest.t

> +++ b/tests/test-treemanifest.t

> @@ -459,5 +459,5 @@ Excludes with a glob should not exclude

>     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.

> @@ -469,5 +469,5 @@ Test files for a subdirectory.

>     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.

> @@ -478,5 +478,5 @@ Test files with just includes and exclud

>     $ 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.

> @@ -488,5 +488,5 @@ Test files for a subdirectory, excluding

>     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

> @@ -498,5 +498,5 @@ including an unrelated directory.

>     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

> @@ -508,5 +508,5 @@ within that.

>     $ 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

> @@ -554,5 +554,5 @@ Finish first server

>   

>   Back up the recently added revlogs

> -  $ cp -r .hg/store .hg/store-newcopy

> +  $ cp -R .hg/store .hg/store-newcopy

>   

>   Verify reports missing dirlog

> @@ -583,5 +583,5 @@ Verify reports missing dirlog

>     (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

> @@ -608,5 +608,5 @@ Verify reports missing dirlog entry

>     (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.

> diff --git a/tests/test-verify.t b/tests/test-verify.t

> --- a/tests/test-verify.t

> +++ b/tests/test-verify.t

> @@ -70,8 +70,8 @@ Set up a repo for testing missing revlog

>     $ 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

> @@ -85,5 +85,5 @@ Entire changelog missing

>     (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

> @@ -95,5 +95,5 @@ Entire manifest log missing

>     (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

> @@ -110,5 +110,5 @@ Entire filelog missing

>     (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

> @@ -119,5 +119,5 @@ Entire changelog and manifest log missin

>     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

> @@ -138,5 +138,5 @@ Entire changelog and filelog missing

>     (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

> @@ -153,5 +153,5 @@ Entire manifest log and filelog missing

>     (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

> @@ -166,5 +166,5 @@ Changelog missing entry

>     3 integrity errors encountered!

>     [1]

> -  $ cp -r .hg/store-full/. .hg/store

> +  $ cp -R .hg/store-full/. .hg/store

>   

>   Manifest log missing entry

> @@ -177,5 +177,5 @@ Manifest log missing entry

>     (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

> @@ -187,5 +187,5 @@ Filelog missing entry

>     (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

> @@ -200,5 +200,5 @@ Changelog and manifest log missing entry

>     2 integrity errors encountered!

>     [1]

> -  $ cp -r .hg/store-full/. .hg/store

> +  $ cp -R .hg/store-full/. .hg/store

>   

>   Changelog and filelog missing entry

> @@ -212,5 +212,5 @@ Changelog and filelog missing entry

>     3 integrity errors encountered!

>     [1]

> -  $ cp -r .hg/store-full/. .hg/store

> +  $ cp -R .hg/store-full/. .hg/store

>   

>   Manifest and filelog missing entry

> @@ -223,5 +223,5 @@ Manifest and filelog missing entry

>     (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

> @@ -239,5 +239,5 @@ Corrupt changelog base node to cause fai

>     (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

> @@ -251,5 +251,5 @@ Corrupt manifest log base node to cause

>     (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

> @@ -262,5 +262,5 @@ Corrupt filelog base node to cause failu

>     (first damaged changeset appears to be 0)

>     [1]

> -  $ cp -r .hg/store-full/. .hg/store

> +  $ cp -R .hg/store-full/. .hg/store

>   

>     $ cd ..

> _______________________________________________

> Mercurial-devel mailing list

> Mercurial-devel@mercurial-scm.org

> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Danek Duvall - Nov. 30, 2016, 5:51 p.m.
Jun Wu wrote:

> # HG changeset patch
> # User Jun Wu <quark@fb.com>
> # Date 1480526736 0
> #      Wed Nov 30 17:25:36 2016 +0000
> # Node ID a4f46a03e5f8e33f32c36326c6b14b84d9cb03b4
> # Parent  9e29d4e4e08b5996adda49cdd0b497d89e2b16ee
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r a4f46a03e5f8
> tests: use cp -R instead of cp -r
> 
> This makes OS X happy for some tests after 0d87b1caed92. The default
> behavior of -R (-P, not follow symlinks) is what we want.

Where is that documented?  The GNU cp manpage considers -r and -R to be the
same, and the Solaris manpage says that -R is the same as -r, except pipes
are replicated instead of read from.

Danek
Jun Wu - Nov. 30, 2016, 6:04 p.m.
Excerpts from Danek Duvall's message of 2016-11-30 09:51:11 -0800:
> Jun Wu wrote:
> 
> > # HG changeset patch
> > # User Jun Wu <quark@fb.com>
> > # Date 1480526736 0
> > #      Wed Nov 30 17:25:36 2016 +0000
> > # Node ID a4f46a03e5f8e33f32c36326c6b14b84d9cb03b4
> > # Parent  9e29d4e4e08b5996adda49cdd0b497d89e2b16ee
> > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > #              hg pull https://bitbucket.org/quark-zju/hg-draft  -r a4f46a03e5f8
> > tests: use cp -R instead of cp -r
> > 
> > This makes OS X happy for some tests after 0d87b1caed92. The default
> > behavior of -R (-P, not follow symlinks) is what we want.
> 
> Where is that documented?  The GNU cp manpage considers -r and -R to be the
> same, and the Solaris manpage says that -R is the same as -r, except pipes
> are replicated instead of read from.
See:

- http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html
- https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/cp.1.html

> 
> Danek
Danek Duvall - Nov. 30, 2016, 6:35 p.m.
Jun Wu wrote:

> Excerpts from Danek Duvall's message of 2016-11-30 09:51:11 -0800:
> > Jun Wu wrote:
> > 
> > > # HG changeset patch
> > > # User Jun Wu <quark@fb.com>
> > > # Date 1480526736 0
> > > #      Wed Nov 30 17:25:36 2016 +0000
> > > # Node ID a4f46a03e5f8e33f32c36326c6b14b84d9cb03b4
> > > # Parent  9e29d4e4e08b5996adda49cdd0b497d89e2b16ee
> > > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > > #              hg pull https://bitbucket.org/quark-zju/hg-draft  -r a4f46a03e5f8
> > > tests: use cp -R instead of cp -r
> > > 
> > > This makes OS X happy for some tests after 0d87b1caed92. The default
> > > behavior of -R (-P, not follow symlinks) is what we want.
> > 
> > Where is that documented?  The GNU cp manpage considers -r and -R to be the
> > same, and the Solaris manpage says that -R is the same as -r, except pipes
> > are replicated instead of read from.
> See:
> 
> - http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html

I'm not sure how you get that.

   If source_file is a file of type symbolic link:

   - If the -R option was specified:

     - If none of the options -H, -L, nor -P were specified, it is
       unspecified which of -H, -L, or -P will be used as a default.

> - https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/cp.1.html

I guess MacOS chose -P; Solaris didn't.

Seems reasonable to use -R instead of -r, but I think -P will be required,
too.

Danek
Jun Wu - Nov. 30, 2016, 7:08 p.m.
Excerpts from Danek Duvall's message of 2016-11-30 10:35:47 -0800:
> Jun Wu wrote:
> 
> > Excerpts from Danek Duvall's message of 2016-11-30 09:51:11 -0800:
> > > Jun Wu wrote:
> > > 
> > > > # HG changeset patch
> > > > # User Jun Wu <quark@fb.com>
> > > > # Date 1480526736 0
> > > > #      Wed Nov 30 17:25:36 2016 +0000
> > > > # Node ID a4f46a03e5f8e33f32c36326c6b14b84d9cb03b4
> > > > # Parent  9e29d4e4e08b5996adda49cdd0b497d89e2b16ee
> > > > # Available At https://bitbucket.org/quark-zju/hg-draft  
> > > > #              hg pull https://bitbucket.org/quark-zju/hg-draft   -r a4f46a03e5f8
> > > > tests: use cp -R instead of cp -r
> > > > 
> > > > This makes OS X happy for some tests after 0d87b1caed92. The default
> > > > behavior of -R (-P, not follow symlinks) is what we want.
> > > 
> > > Where is that documented?  The GNU cp manpage considers -r and -R to be the
> > > same, and the Solaris manpage says that -R is the same as -r, except pipes
> > > are replicated instead of read from.
> > See:
> > 
> > - http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html 
> 
> I'm not sure how you get that.
> 
>    If source_file is a file of type symbolic link:
> 
>    - If the -R option was specified:
> 
>      - If none of the options -H, -L, nor -P were specified, it is
>        unspecified which of -H, -L, or -P will be used as a default.

So it's all about OSX. I'll send a V2 to correct the commit message.
 
> > - https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/cp.1.html 
> 
> I guess MacOS chose -P; Solaris didn't.

I did change them to use -P then I noticed Martijn's patch [1]. With that
applied, -P becomes unnecessary and I reverted them.

Note: even with this patch applied, OS X will still fail on test-hardlinks.t
so Martijn's patch is a better way to fix the OS X tests. And this "cp -R"
thing seems to be nice to have in all cases.

[1]: www.mercurial-scm.org/pipermail/mercurial-devel/2016-November/091170.html
> 
> Seems reasonable to use -R instead of -r, but I think -P will be required,
> too.
> 
> Danek

Patch

diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -573,6 +573,6 @@  pull --update works the same as pull && 
   $ 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)
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -340,5 +340,5 @@  phases.new-commit option is.
 New-commit as draft (default)
 
-  $ cp -r base simple-draft
+  $ cp -R base simple-draft
   $ cd simple-draft
   $ hg histedit -r 'b449568bf7fc' --commands - << EOF
@@ -379,5 +379,5 @@  New-commit as draft (default)
 New-commit as secret (config)
 
-  $ cp -r base simple-secret
+  $ cp -R base simple-secret
   $ cd simple-secret
   $ cat >> .hg/hgrc << EOF
@@ -426,5 +426,5 @@  If a secret changeset is put before a dr
 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
@@ -463,5 +463,5 @@  better safe than sorry). Folding between
 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
diff --git a/tests/test-obsolete-checkheads.t b/tests/test-obsolete-checkheads.t
--- a/tests/test-obsolete-checkheads.t
+++ b/tests/test-obsolete-checkheads.t
@@ -24,5 +24,5 @@  Check that obsolete properly strip heads
   $ hg phase --public .
   $ cd ..
-  $ cp -r remote base
+  $ cp -R remote base
   $ hg clone remote local
   updating to branch default
@@ -55,5 +55,5 @@  setup
   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.
@@ -74,5 +74,5 @@  setup
 
   $ rm -fr ../remote
-  $ cp -r ../backup1 ../remote
+  $ cp -R ../backup1 ../remote
   $ hg -R ../remote phase --public c70b08862e08
   $ hg pull -v
@@ -105,5 +105,5 @@  TODO: Not implemented yet.
 #
 #   $ rm -fr ../remote
-#   $ cp -r ../backup1 ../remote
+#   $ cp -R ../backup1 ../remote
 #   $ hg -R ../remote phase --public c70b08862e08
 #   $ hg phase --draft --force c70b08862e08
@@ -132,5 +132,5 @@  setup
 
   $ rm -fr ../remote
-  $ cp -r ../backup1 ../remote
+  $ cp -R ../backup1 ../remote
   $ hg phase --draft --force '(0::) - 0'
   $ hg up -q '.^'
@@ -207,5 +207,5 @@  setup. (The obsolete marker is known loc
   @  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
@@ -227,5 +227,5 @@  setup
 
   $ rm -fr ../remote
-  $ cp -r ../backup1 ../remote
+  $ cp -R ../backup1 ../remote
   $ cd ..
   $ rm -rf local
diff --git a/tests/test-revert.t b/tests/test-revert.t
--- a/tests/test-revert.t
+++ b/tests/test-revert.t
@@ -785,5 +785,5 @@  Test revert --all to parent content
 (setup from reference repo)
 
-  $ cp -r revert-ref revert-parent-all
+  $ cp -R revert-ref revert-parent-all
   $ cd revert-parent-all
 
@@ -842,5 +842,5 @@  Test revert --all to "base" content
 (setup from reference repo)
 
-  $ cp -r revert-ref revert-base-all
+  $ cp -R revert-ref revert-base-all
   $ cd revert-base-all
 
@@ -897,5 +897,5 @@  Test revert to parent content with expli
 (setup from reference repo)
 
-  $ cp -r revert-ref revert-parent-explicit
+  $ cp -R revert-ref revert-parent-explicit
   $ cd revert-parent-explicit
 
@@ -990,5 +990,5 @@  Test revert to "base" content with expli
 (setup from reference repo)
 
-  $ cp -r revert-ref revert-base-explicit
+  $ cp -R revert-ref revert-base-explicit
   $ cd revert-base-explicit
 
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -1519,6 +1519,6 @@  Courtesy phases synchronisation to publi
 (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
diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t
--- a/tests/test-treemanifest.t
+++ b/tests/test-treemanifest.t
@@ -459,5 +459,5 @@  Excludes with a glob should not exclude 
   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.
@@ -469,5 +469,5 @@  Test files for a subdirectory.
   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.
@@ -478,5 +478,5 @@  Test files with just includes and exclud
   $ 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.
@@ -488,5 +488,5 @@  Test files for a subdirectory, excluding
   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
@@ -498,5 +498,5 @@  including an unrelated directory.
   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
@@ -508,5 +508,5 @@  within that.
   $ 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
@@ -554,5 +554,5 @@  Finish first server
 
 Back up the recently added revlogs
-  $ cp -r .hg/store .hg/store-newcopy
+  $ cp -R .hg/store .hg/store-newcopy
 
 Verify reports missing dirlog
@@ -583,5 +583,5 @@  Verify reports missing dirlog
   (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
@@ -608,5 +608,5 @@  Verify reports missing dirlog entry
   (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.
diff --git a/tests/test-verify.t b/tests/test-verify.t
--- a/tests/test-verify.t
+++ b/tests/test-verify.t
@@ -70,8 +70,8 @@  Set up a repo for testing missing revlog
   $ 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
@@ -85,5 +85,5 @@  Entire changelog missing
   (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
@@ -95,5 +95,5 @@  Entire manifest log missing
   (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
@@ -110,5 +110,5 @@  Entire filelog missing
   (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
@@ -119,5 +119,5 @@  Entire changelog and manifest log missin
   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
@@ -138,5 +138,5 @@  Entire changelog and filelog missing
   (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
@@ -153,5 +153,5 @@  Entire manifest log and filelog missing
   (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
@@ -166,5 +166,5 @@  Changelog missing entry
   3 integrity errors encountered!
   [1]
-  $ cp -r .hg/store-full/. .hg/store
+  $ cp -R .hg/store-full/. .hg/store
 
 Manifest log missing entry
@@ -177,5 +177,5 @@  Manifest log missing entry
   (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
@@ -187,5 +187,5 @@  Filelog missing entry
   (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
@@ -200,5 +200,5 @@  Changelog and manifest log missing entry
   2 integrity errors encountered!
   [1]
-  $ cp -r .hg/store-full/. .hg/store
+  $ cp -R .hg/store-full/. .hg/store
 
 Changelog and filelog missing entry
@@ -212,5 +212,5 @@  Changelog and filelog missing entry
   3 integrity errors encountered!
   [1]
-  $ cp -r .hg/store-full/. .hg/store
+  $ cp -R .hg/store-full/. .hg/store
 
 Manifest and filelog missing entry
@@ -223,5 +223,5 @@  Manifest and filelog missing entry
   (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
@@ -239,5 +239,5 @@  Corrupt changelog base node to cause fai
   (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
@@ -251,5 +251,5 @@  Corrupt manifest log base node to cause 
   (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
@@ -262,5 +262,5 @@  Corrupt filelog base node to cause failu
   (first damaged changeset appears to be 0)
   [1]
-  $ cp -r .hg/store-full/. .hg/store
+  $ cp -R .hg/store-full/. .hg/store
 
   $ cd ..