tests/test-diff-copy-depth.t
author Jun Wu <quark@fb.com>
Wed, 30 Nov 2016 19:25:18 +0000
changeset 30556 c059286a0f9c
parent 12150 bca69641de61
permissions -rw-r--r--
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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12150
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
     1
  $ for i in aaa zzz; do
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
     2
  >     hg init t
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
     3
  >     cd t
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
     4
  > 
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
     5
  >     echo
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
     6
  >     echo "-- With $i"
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
     7
  > 
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
     8
  >     touch file
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
     9
  >     hg add file
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    10
  >     hg ci -m "Add"
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    11
  > 
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    12
  >     hg cp file $i
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    13
  >     hg ci -m "a -> $i"
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    14
  > 
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    15
  >     hg cp $i other-file
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    16
  >     echo "different" >> $i
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    17
  >     hg ci -m "$i -> other-file"
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    18
  > 
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    19
  >     hg cp other-file somename
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    20
  > 
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    21
  >     echo "Status":
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    22
  >     hg st -C
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    23
  >     echo
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    24
  >     echo "Diff:"
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    25
  >     hg diff -g
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    26
  > 
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    27
  >     cd ..
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    28
  >     rm -rf t
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    29
  > done
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    30
  
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    31
  -- With aaa
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    32
  Status:
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    33
  A somename
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    34
    other-file
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    35
  
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    36
  Diff:
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    37
  diff --git a/other-file b/somename
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    38
  copy from other-file
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    39
  copy to somename
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    40
  
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    41
  -- With zzz
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    42
  Status:
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    43
  A somename
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    44
    other-file
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    45
  
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    46
  Diff:
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    47
  diff --git a/other-file b/somename
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    48
  copy from other-file
bca69641de61 tests: unify test-diff-copy-depth
Adrian Buehlmann <adrian@cadifra.com>
parents: 6489
diff changeset
    49
  copy to somename
6424
d8f44384c3ee copies: sort old names by depth
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    50
d8f44384c3ee copies: sort old names by depth
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    51