tests/test-rename
author Nicolas Dumazet <nicdumz.commits@gmail.com>
Thu, 12 Aug 2010 19:40:22 +0900
changeset 11794 80c63b2a29a8
parent 11551 4484a7b661f2
permissions -rwxr-xr-x
tests: remove useless sed in test-hook
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
     1
#!/bin/sh
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
     2
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
     3
hg init
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
     4
mkdir d1 d1/d11 d2
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
     5
echo d1/a > d1/a
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
     6
echo d1/ba > d1/ba
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
     7
echo d1/a1 > d1/d11/a1
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
     8
echo d1/b > d1/b
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
     9
echo d2/b > d2/b
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    10
hg add d1/a d1/b d1/ba d1/d11/a1 d2/b
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1822
diff changeset
    11
hg commit -m "1" -d "1000000 0"
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    12
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    13
echo "# rename a single file"
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    14
hg rename d1/d11/a1 d2/c
11331
997ab9af81df summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents: 11223
diff changeset
    15
hg sum
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
    16
hg status -C
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    17
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
    18
rm d2/c
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    19
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    20
echo "# rename --after a single file"
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    21
mv d1/d11/a1 d2/c
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    22
hg rename --after d1/d11/a1 d2/c
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
    23
hg status -C
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    24
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
    25
rm d2/c
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    26
11223
0d09f2244805 rename: make --after work if source is already in R state
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 11152
diff changeset
    27
echo '# rename --after a single file when src and tgt already tracked'
0d09f2244805 rename: make --after work if source is already in R state
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 11152
diff changeset
    28
mv d1/d11/a1 d2/c
11551
4484a7b661f2 commands: addremove does similarity 100 by default
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 11331
diff changeset
    29
hg addrem -s 0
11223
0d09f2244805 rename: make --after work if source is already in R state
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 11152
diff changeset
    30
hg rename --after d1/d11/a1 d2/c
0d09f2244805 rename: make --after work if source is already in R state
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 11152
diff changeset
    31
hg status -C
0d09f2244805 rename: make --after work if source is already in R state
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 11152
diff changeset
    32
hg update -C
0d09f2244805 rename: make --after work if source is already in R state
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 11152
diff changeset
    33
rm d2/c
0d09f2244805 rename: make --after work if source is already in R state
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 11152
diff changeset
    34
11152
e8d10d085f47 cmdutil: Warn when trying to copy/rename --after to a nonexistant file.
Steve Losh <steve@stevelosh.com>
parents: 10466
diff changeset
    35
echo "# rename --after a single file to a nonexistant target filename"
e8d10d085f47 cmdutil: Warn when trying to copy/rename --after to a nonexistant file.
Steve Losh <steve@stevelosh.com>
parents: 10466
diff changeset
    36
hg rename --after d1/a dummy
e8d10d085f47 cmdutil: Warn when trying to copy/rename --after to a nonexistant file.
Steve Losh <steve@stevelosh.com>
parents: 10466
diff changeset
    37
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    38
echo "# move a single file to an existing directory"
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    39
hg rename d1/d11/a1 d2
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
    40
hg status -C
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    41
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
    42
rm d2/a1
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    43
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    44
echo "# move --after a single file to an existing directory"
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    45
mv d1/d11/a1 d2
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    46
hg rename --after d1/d11/a1 d2
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
    47
hg status -C
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    48
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
    49
rm d2/a1
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    50
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    51
echo "# rename a file using a relative path"
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    52
(cd d1/d11; hg rename ../../d2/b e)
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
    53
hg status -C
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    54
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
    55
rm d1/d11/e
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    56
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    57
echo "# rename --after a file using a relative path"
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    58
(cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e)
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
    59
hg status -C
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    60
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
    61
rm d1/d11/e
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    62
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    63
echo "# rename directory d1 as d3"
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    64
hg rename d1/ d3
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
    65
hg status -C
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    66
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
    67
rm -rf d3
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    68
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    69
echo "# rename --after directory d1 as d3"
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    70
mv d1 d3
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    71
hg rename --after d1 d3
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
    72
hg status -C
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    73
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
    74
rm -rf d3
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    75
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    76
echo "# move a directory using a relative path"
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    77
(cd d2; mkdir d3; hg rename ../d1/d11 d3)
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
    78
hg status -C
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    79
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
    80
rm -rf d2/d3
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    81
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    82
echo "# move --after a directory using a relative path"
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    83
(cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
    84
hg status -C
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    85
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
    86
rm -rf d2/d3
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    87
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    88
echo "# move directory d1/d11 to an existing directory d2 (removes empty d1)"
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    89
hg rename d1/d11/ d2
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
    90
hg status -C
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    91
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
    92
rm -rf d2/d11
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    93
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    94
echo "# move directories d1 and d2 to a new directory d3"
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    95
mkdir d3
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    96
hg rename d1 d2 d3
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
    97
hg status -C
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    98
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
    99
rm -rf d3
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   100
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   101
echo "# move --after directories d1 and d2 to a new directory d3"
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   102
mkdir d3
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   103
mv d1 d2 d3
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   104
hg rename --after d1 d2 d3
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   105
hg status -C
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   106
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   107
rm -rf d3
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   108
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   109
echo "# move everything under directory d1 to existing directory d2, do not"
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   110
echo "# overwrite existing files (d2/b)"
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   111
hg rename d1/* d2
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   112
hg status -C
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   113
diff d1/b d2/b
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   114
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   115
rm d2/a d2/ba d2/d11/a1
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   116
5329
7e6138cb8d38 copy: if destination ends with "/", make sure it's a directory
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4742
diff changeset
   117
echo "# attempt to move one file into a non-existent directory"
7e6138cb8d38 copy: if destination ends with "/", make sure it's a directory
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4742
diff changeset
   118
hg rename d1/a dx/
7e6138cb8d38 copy: if destination ends with "/", make sure it's a directory
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4742
diff changeset
   119
hg status -C
7e6138cb8d38 copy: if destination ends with "/", make sure it's a directory
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4742
diff changeset
   120
hg update -C
7e6138cb8d38 copy: if destination ends with "/", make sure it's a directory
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4742
diff changeset
   121
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   122
echo "# attempt to move potentially more than one file into a non-existent"
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   123
echo "# directory"
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   124
hg rename 'glob:d1/**' dx
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   125
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   126
echo "# move every file under d1 to d2/d21 (glob)"
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   127
mkdir d2/d21
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   128
hg rename 'glob:d1/**' d2/d21
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   129
hg status -C
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   130
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   131
rm -rf d2/d21
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   132
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   133
echo "# move --after some files under d1 to d2/d21 (glob)"
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   134
mkdir d2/d21
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   135
mv d1/a d1/d11/a1 d2/d21
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   136
hg rename --after 'glob:d1/**' d2/d21
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   137
hg status -C
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   138
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   139
rm -rf d2/d21
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   140
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   141
echo "# move every file under d1 starting with an 'a' to d2/d21 (regexp)"
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   142
mkdir d2/d21
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   143
hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   144
hg status -C
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   145
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   146
rm -rf d2/d21
1513
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   147
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   148
echo "# attempt to overwrite an existing file"
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   149
echo "ca" > d1/ca
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   150
hg rename d1/ba d1/ca
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   151
hg status -C
1513
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   152
hg update -C
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   153
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   154
echo "# forced overwrite of an existing file"
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   155
echo "ca" > d1/ca
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   156
hg rename --force d1/ba d1/ca
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   157
hg status -C
1513
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   158
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   159
rm d1/ca
1513
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   160
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   161
echo "# replace a symlink with a file"
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   162
ln -s ba d1/ca
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   163
hg rename --force d1/ba d1/ca
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   164
hg status -C
1513
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   165
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   166
rm d1/ca
1514
faf46d810a85 avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents: 1513
diff changeset
   167
faf46d810a85 avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents: 1513
diff changeset
   168
echo "# do not copy more than one source file to the same destination file"
faf46d810a85 avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents: 1513
diff changeset
   169
mkdir d3
faf46d810a85 avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents: 1513
diff changeset
   170
hg rename d1/* d2/* d3
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   171
hg status -C
1514
faf46d810a85 avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents: 1513
diff changeset
   172
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   173
rm -rf d3
1633
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   174
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   175
echo "# move a whole subtree with \"hg rename .\""
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   176
mkdir d3
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   177
(cd d1; hg rename . ../d3)
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   178
hg status -C
1633
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   179
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   180
rm -rf d3
1633
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   181
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   182
echo "# move a whole subtree with \"hg rename --after .\""
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   183
mkdir d3
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   184
mv d1/* d3
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   185
(cd d1; hg rename --after . ../d3)
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   186
hg status -C
1633
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   187
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   188
rm -rf d3
1633
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   189
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   190
echo "# move the parent tree with \"hg rename ..\""
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   191
(cd d1/d11; hg rename .. ../../d3)
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   192
hg status -C
1633
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   193
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   194
rm -rf d3
1634
f49f602fae92 copy & rename can ignore removed source files
Robin Farine <robin.farine@terminus.org>
parents: 1633
diff changeset
   195
f49f602fae92 copy & rename can ignore removed source files
Robin Farine <robin.farine@terminus.org>
parents: 1633
diff changeset
   196
echo "# skip removed files"
f49f602fae92 copy & rename can ignore removed source files
Robin Farine <robin.farine@terminus.org>
parents: 1633
diff changeset
   197
hg remove d1/b
f49f602fae92 copy & rename can ignore removed source files
Robin Farine <robin.farine@terminus.org>
parents: 1633
diff changeset
   198
hg rename d1 d3
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   199
hg status -C
1634
f49f602fae92 copy & rename can ignore removed source files
Robin Farine <robin.farine@terminus.org>
parents: 1633
diff changeset
   200
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   201
rm -rf d3
1747
91c56c427171 transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents: 1634
diff changeset
   202
91c56c427171 transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents: 1634
diff changeset
   203
echo "# transitive rename"
91c56c427171 transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents: 1634
diff changeset
   204
hg rename d1/b d1/bb
91c56c427171 transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents: 1634
diff changeset
   205
hg rename d1/bb d1/bc
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   206
hg status -C
1747
91c56c427171 transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents: 1634
diff changeset
   207
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   208
rm d1/bc
1747
91c56c427171 transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents: 1634
diff changeset
   209
91c56c427171 transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents: 1634
diff changeset
   210
echo "# transitive rename --after"
91c56c427171 transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents: 1634
diff changeset
   211
hg rename d1/b d1/bb
91c56c427171 transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents: 1634
diff changeset
   212
mv d1/bb d1/bc
91c56c427171 transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents: 1634
diff changeset
   213
hg rename --after d1/bb d1/bc
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   214
hg status -C
1747
91c56c427171 transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents: 1634
diff changeset
   215
hg update -C
8518
3f4f14eab085 update --clean: do not unlink added files (issue575)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5329
diff changeset
   216
rm d1/bc
1822
64df4220b349 copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents: 1747
diff changeset
   217
64df4220b349 copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents: 1747
diff changeset
   218
echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)"
64df4220b349 copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents: 1747
diff changeset
   219
hg rename d1/b d1/bb
64df4220b349 copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents: 1747
diff changeset
   220
echo "some stuff added to d1/bb" >> d1/bb
64df4220b349 copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents: 1747
diff changeset
   221
hg rename d1/bb d1/b
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   222
hg status -C
1822
64df4220b349 copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents: 1747
diff changeset
   223
hg update -C
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   224
10466
d1f209bb9564 patch: separate reverse copy data (issue1959)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 8518
diff changeset
   225
echo '# overwriting with renames (issue1959)'
d1f209bb9564 patch: separate reverse copy data (issue1959)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 8518
diff changeset
   226
hg rename d1/a d1/c
d1f209bb9564 patch: separate reverse copy data (issue1959)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 8518
diff changeset
   227
hg rename d1/b d1/a
d1f209bb9564 patch: separate reverse copy data (issue1959)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 8518
diff changeset
   228
hg status -C
d1f209bb9564 patch: separate reverse copy data (issue1959)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 8518
diff changeset
   229
hg diff --git
d1f209bb9564 patch: separate reverse copy data (issue1959)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 8518
diff changeset
   230
hg update -C
d1f209bb9564 patch: separate reverse copy data (issue1959)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 8518
diff changeset
   231
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   232
echo "# check illegal path components"
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   233
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   234
hg rename d1/d11/a1 .hg/foo
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   235
hg status -C
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   236
hg rename d1/d11/a1 ../foo
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   237
hg status -C
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   238
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   239
mv d1/d11/a1 .hg/foo
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   240
hg rename --after d1/d11/a1 .hg/foo
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   241
hg status -C
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   242
hg update -C
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   243
rm .hg/foo
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   244
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   245
hg rename d1/d11/a1 .hg
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   246
hg status -C
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   247
hg rename d1/d11/a1 ..
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   248
hg status -C
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   249
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   250
mv d1/d11/a1 .hg
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   251
hg rename --after d1/d11/a1 .hg
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   252
hg status -C
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   253
hg update -C
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   254
rm .hg/a1
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   255
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   256
(cd d1/d11; hg rename ../../d2/b ../../.hg/foo)
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   257
hg status -C
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   258
(cd d1/d11; hg rename ../../d2/b ../../../foo)
4742
438603c1eb6f test-rename: use hg status -C; don't use hg debugstate | grep copy
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 1976
diff changeset
   259
hg status -C
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   260