Mercurial > hg
comparison tests/test-rename @ 1512:53ad6ee6ede4
generalize copy/rename to handle more than one source directory
author | Robin Farine <robin.farine@terminus.org> |
---|---|
date | Tue, 08 Nov 2005 10:35:05 -0800 |
parents | |
children | 5c3b93b244aa |
comparison
equal
deleted
inserted
replaced
1511:a91bfbbe88d3 | 1512:53ad6ee6ede4 |
---|---|
1 #!/bin/sh | |
2 | |
3 hg init | |
4 mkdir d1 d1/d11 d2 | |
5 echo d1/a > d1/a | |
6 echo d1/ba > d1/ba | |
7 echo d1/a1 > d1/d11/a1 | |
8 echo d1/b > d1/b | |
9 echo d2/b > d2/b | |
10 hg add d1/a d1/b d1/ba d1/d11/a1 d2/b | |
11 hg commit -m "1" -d "0 0" | |
12 | |
13 echo "# rename a single file" | |
14 hg rename d1/d11/a1 d2/c | |
15 hg status | |
16 hg update -C | |
17 | |
18 echo "# move a single file to an existing directory" | |
19 hg rename d1/d11/a1 d2 | |
20 hg status | |
21 hg update -C | |
22 | |
23 echo "# rename directory d1 as d3" | |
24 hg rename d1 d3 | |
25 hg status | |
26 hg update -C | |
27 | |
28 echo "# move directory d1/d11 to an existing directory d2 (removes empty d1)" | |
29 hg rename d1/d11 d2 | |
30 hg status | |
31 hg update -C | |
32 | |
33 echo "# move directories d1 and d2 to a new directory d3" | |
34 mkdir d3 | |
35 hg rename d1 d2 d3 | |
36 hg status | |
37 hg update -C | |
38 | |
39 echo "# move everything under directory d1 to existing directory d2, do not" | |
40 echo "# overwrite existing files (d2/b)" | |
41 hg rename d1/* d2 | |
42 hg status | |
43 diff d1/b d2/b | |
44 hg update -C | |
45 | |
46 echo "# attempt to move potentially more than one file into a non-existent" | |
47 echo "# directory" | |
48 hg rename 'glob:d1/**' dx | |
49 | |
50 echo "# move every file under d1 to d2/d21 (glob)" | |
51 mkdir d2/d21 | |
52 hg rename 'glob:d1/**' d2/d21 | |
53 hg status | |
54 hg update -C | |
55 | |
56 echo "# move every file under d1 starting with an 'a' to d2/d21 (regexp)" | |
57 mkdir d2/d21 | |
58 hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21 | |
59 hg status | |
60 hg update -C |