Mercurial > hg > mercurial-crew-with-dirclash
comparison tests/test-rename @ 4779:37e11c768db9
merge with crew-stable
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Tue, 03 Jul 2007 03:14:18 -0300 |
parents | 438603c1eb6f |
children | 7e6138cb8d38 |
comparison
equal
deleted
inserted
replaced
4774:38bf55d2e41f | 4779:37e11c768db9 |
---|---|
10 hg add d1/a d1/b d1/ba d1/d11/a1 d2/b | 10 hg add d1/a d1/b d1/ba d1/d11/a1 d2/b |
11 hg commit -m "1" -d "1000000 0" | 11 hg commit -m "1" -d "1000000 0" |
12 | 12 |
13 echo "# rename a single file" | 13 echo "# rename a single file" |
14 hg rename d1/d11/a1 d2/c | 14 hg rename d1/d11/a1 d2/c |
15 hg status | 15 hg status -C |
16 hg update -C | 16 hg update -C |
17 | 17 |
18 echo "# rename --after a single file" | 18 echo "# rename --after a single file" |
19 mv d1/d11/a1 d2/c | 19 mv d1/d11/a1 d2/c |
20 hg rename --after d1/d11/a1 d2/c | 20 hg rename --after d1/d11/a1 d2/c |
21 hg status | 21 hg status -C |
22 hg update -C | 22 hg update -C |
23 | 23 |
24 echo "# move a single file to an existing directory" | 24 echo "# move a single file to an existing directory" |
25 hg rename d1/d11/a1 d2 | 25 hg rename d1/d11/a1 d2 |
26 hg status | 26 hg status -C |
27 hg update -C | 27 hg update -C |
28 | 28 |
29 echo "# move --after a single file to an existing directory" | 29 echo "# move --after a single file to an existing directory" |
30 mv d1/d11/a1 d2 | 30 mv d1/d11/a1 d2 |
31 hg rename --after d1/d11/a1 d2 | 31 hg rename --after d1/d11/a1 d2 |
32 hg status | 32 hg status -C |
33 hg update -C | 33 hg update -C |
34 | 34 |
35 echo "# rename a file using a relative path" | 35 echo "# rename a file using a relative path" |
36 (cd d1/d11; hg rename ../../d2/b e) | 36 (cd d1/d11; hg rename ../../d2/b e) |
37 hg status | 37 hg status -C |
38 hg update -C | 38 hg update -C |
39 | 39 |
40 echo "# rename --after a file using a relative path" | 40 echo "# rename --after a file using a relative path" |
41 (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e) | 41 (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e) |
42 hg status | 42 hg status -C |
43 hg update -C | 43 hg update -C |
44 | 44 |
45 echo "# rename directory d1 as d3" | 45 echo "# rename directory d1 as d3" |
46 hg rename d1/ d3 | 46 hg rename d1/ d3 |
47 hg status | 47 hg status -C |
48 hg update -C | 48 hg update -C |
49 | 49 |
50 echo "# rename --after directory d1 as d3" | 50 echo "# rename --after directory d1 as d3" |
51 mv d1 d3 | 51 mv d1 d3 |
52 hg rename --after d1 d3 | 52 hg rename --after d1 d3 |
53 hg status | 53 hg status -C |
54 hg update -C | 54 hg update -C |
55 | 55 |
56 echo "# move a directory using a relative path" | 56 echo "# move a directory using a relative path" |
57 (cd d2; mkdir d3; hg rename ../d1/d11 d3) | 57 (cd d2; mkdir d3; hg rename ../d1/d11 d3) |
58 hg status | 58 hg status -C |
59 hg update -C | 59 hg update -C |
60 | 60 |
61 echo "# move --after a directory using a relative path" | 61 echo "# move --after a directory using a relative path" |
62 (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3) | 62 (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3) |
63 hg status | 63 hg status -C |
64 hg update -C | 64 hg update -C |
65 | 65 |
66 echo "# move directory d1/d11 to an existing directory d2 (removes empty d1)" | 66 echo "# move directory d1/d11 to an existing directory d2 (removes empty d1)" |
67 hg rename d1/d11/ d2 | 67 hg rename d1/d11/ d2 |
68 hg status | 68 hg status -C |
69 hg update -C | 69 hg update -C |
70 | 70 |
71 echo "# move directories d1 and d2 to a new directory d3" | 71 echo "# move directories d1 and d2 to a new directory d3" |
72 mkdir d3 | 72 mkdir d3 |
73 hg rename d1 d2 d3 | 73 hg rename d1 d2 d3 |
74 hg status | 74 hg status -C |
75 hg update -C | 75 hg update -C |
76 | 76 |
77 echo "# move --after directories d1 and d2 to a new directory d3" | 77 echo "# move --after directories d1 and d2 to a new directory d3" |
78 mkdir d3 | 78 mkdir d3 |
79 mv d1 d2 d3 | 79 mv d1 d2 d3 |
80 hg rename --after d1 d2 d3 | 80 hg rename --after d1 d2 d3 |
81 hg status | 81 hg status -C |
82 hg update -C | 82 hg update -C |
83 | 83 |
84 echo "# move everything under directory d1 to existing directory d2, do not" | 84 echo "# move everything under directory d1 to existing directory d2, do not" |
85 echo "# overwrite existing files (d2/b)" | 85 echo "# overwrite existing files (d2/b)" |
86 hg rename d1/* d2 | 86 hg rename d1/* d2 |
87 hg status | 87 hg status -C |
88 diff d1/b d2/b | 88 diff d1/b d2/b |
89 hg update -C | 89 hg update -C |
90 | 90 |
91 echo "# attempt to move potentially more than one file into a non-existent" | 91 echo "# attempt to move potentially more than one file into a non-existent" |
92 echo "# directory" | 92 echo "# directory" |
93 hg rename 'glob:d1/**' dx | 93 hg rename 'glob:d1/**' dx |
94 | 94 |
95 echo "# move every file under d1 to d2/d21 (glob)" | 95 echo "# move every file under d1 to d2/d21 (glob)" |
96 mkdir d2/d21 | 96 mkdir d2/d21 |
97 hg rename 'glob:d1/**' d2/d21 | 97 hg rename 'glob:d1/**' d2/d21 |
98 hg status | 98 hg status -C |
99 hg update -C | 99 hg update -C |
100 | 100 |
101 echo "# move --after some files under d1 to d2/d21 (glob)" | 101 echo "# move --after some files under d1 to d2/d21 (glob)" |
102 mkdir d2/d21 | 102 mkdir d2/d21 |
103 mv d1/a d1/d11/a1 d2/d21 | 103 mv d1/a d1/d11/a1 d2/d21 |
104 hg rename --after 'glob:d1/**' d2/d21 | 104 hg rename --after 'glob:d1/**' d2/d21 |
105 hg status | 105 hg status -C |
106 hg update -C | 106 hg update -C |
107 | 107 |
108 echo "# move every file under d1 starting with an 'a' to d2/d21 (regexp)" | 108 echo "# move every file under d1 starting with an 'a' to d2/d21 (regexp)" |
109 mkdir d2/d21 | 109 mkdir d2/d21 |
110 hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21 | 110 hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21 |
111 hg status | 111 hg status -C |
112 hg update -C | 112 hg update -C |
113 | 113 |
114 echo "# attempt to overwrite an existing file" | 114 echo "# attempt to overwrite an existing file" |
115 echo "ca" > d1/ca | 115 echo "ca" > d1/ca |
116 hg rename d1/ba d1/ca | 116 hg rename d1/ba d1/ca |
117 hg status | 117 hg status -C |
118 hg update -C | 118 hg update -C |
119 | 119 |
120 echo "# forced overwrite of an existing file" | 120 echo "# forced overwrite of an existing file" |
121 echo "ca" > d1/ca | 121 echo "ca" > d1/ca |
122 hg rename --force d1/ba d1/ca | 122 hg rename --force d1/ba d1/ca |
123 hg status | 123 hg status -C |
124 hg update -C | 124 hg update -C |
125 | 125 |
126 echo "# replace a symlink with a file" | 126 echo "# replace a symlink with a file" |
127 ln -s ba d1/ca | 127 ln -s ba d1/ca |
128 hg rename --force d1/ba d1/ca | 128 hg rename --force d1/ba d1/ca |
129 hg status | 129 hg status -C |
130 hg update -C | 130 hg update -C |
131 | 131 |
132 echo "# do not copy more than one source file to the same destination file" | 132 echo "# do not copy more than one source file to the same destination file" |
133 mkdir d3 | 133 mkdir d3 |
134 hg rename d1/* d2/* d3 | 134 hg rename d1/* d2/* d3 |
135 hg status | 135 hg status -C |
136 hg update -C | 136 hg update -C |
137 | 137 |
138 echo "# move a whole subtree with \"hg rename .\"" | 138 echo "# move a whole subtree with \"hg rename .\"" |
139 mkdir d3 | 139 mkdir d3 |
140 (cd d1; hg rename . ../d3) | 140 (cd d1; hg rename . ../d3) |
141 hg status | 141 hg status -C |
142 hg update -C | 142 hg update -C |
143 | 143 |
144 echo "# move a whole subtree with \"hg rename --after .\"" | 144 echo "# move a whole subtree with \"hg rename --after .\"" |
145 mkdir d3 | 145 mkdir d3 |
146 mv d1/* d3 | 146 mv d1/* d3 |
147 (cd d1; hg rename --after . ../d3) | 147 (cd d1; hg rename --after . ../d3) |
148 hg status | 148 hg status -C |
149 hg update -C | 149 hg update -C |
150 | 150 |
151 echo "# move the parent tree with \"hg rename ..\"" | 151 echo "# move the parent tree with \"hg rename ..\"" |
152 (cd d1/d11; hg rename .. ../../d3) | 152 (cd d1/d11; hg rename .. ../../d3) |
153 hg status | 153 hg status -C |
154 hg update -C | 154 hg update -C |
155 | 155 |
156 echo "# skip removed files" | 156 echo "# skip removed files" |
157 hg remove d1/b | 157 hg remove d1/b |
158 hg rename d1 d3 | 158 hg rename d1 d3 |
159 hg status | 159 hg status -C |
160 hg update -C | 160 hg update -C |
161 | 161 |
162 echo "# transitive rename" | 162 echo "# transitive rename" |
163 hg rename d1/b d1/bb | 163 hg rename d1/b d1/bb |
164 hg rename d1/bb d1/bc | 164 hg rename d1/bb d1/bc |
165 hg status | 165 hg status -C |
166 hg update -C | 166 hg update -C |
167 | 167 |
168 echo "# transitive rename --after" | 168 echo "# transitive rename --after" |
169 hg rename d1/b d1/bb | 169 hg rename d1/b d1/bb |
170 mv d1/bb d1/bc | 170 mv d1/bb d1/bc |
171 hg rename --after d1/bb d1/bc | 171 hg rename --after d1/bb d1/bc |
172 hg status | 172 hg status -C |
173 hg update -C | 173 hg update -C |
174 | 174 |
175 echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)" | 175 echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)" |
176 hg rename d1/b d1/bb | 176 hg rename d1/b d1/bb |
177 echo "some stuff added to d1/bb" >> d1/bb | 177 echo "some stuff added to d1/bb" >> d1/bb |
178 hg rename d1/bb d1/b | 178 hg rename d1/bb d1/b |
179 hg status | 179 hg status -C |
180 hg debugstate | grep copy | |
181 hg update -C | 180 hg update -C |
182 | 181 |
183 echo "# check illegal path components" | 182 echo "# check illegal path components" |
184 | 183 |
185 hg rename d1/d11/a1 .hg/foo | 184 hg rename d1/d11/a1 .hg/foo |
186 hg status | 185 hg status -C |
187 hg rename d1/d11/a1 ../foo | 186 hg rename d1/d11/a1 ../foo |
188 hg status | 187 hg status -C |
189 | 188 |
190 mv d1/d11/a1 .hg/foo | 189 mv d1/d11/a1 .hg/foo |
191 hg rename --after d1/d11/a1 .hg/foo | 190 hg rename --after d1/d11/a1 .hg/foo |
192 hg status | 191 hg status -C |
193 hg update -C | 192 hg update -C |
194 rm .hg/foo | 193 rm .hg/foo |
195 | 194 |
196 hg rename d1/d11/a1 .hg | 195 hg rename d1/d11/a1 .hg |
197 hg status | 196 hg status -C |
198 hg rename d1/d11/a1 .. | 197 hg rename d1/d11/a1 .. |
199 hg status | 198 hg status -C |
200 | 199 |
201 mv d1/d11/a1 .hg | 200 mv d1/d11/a1 .hg |
202 hg rename --after d1/d11/a1 .hg | 201 hg rename --after d1/d11/a1 .hg |
203 hg status | 202 hg status -C |
204 hg update -C | 203 hg update -C |
205 rm .hg/a1 | 204 rm .hg/a1 |
206 | 205 |
207 (cd d1/d11; hg rename ../../d2/b ../../.hg/foo) | 206 (cd d1/d11; hg rename ../../d2/b ../../.hg/foo) |
208 hg status | 207 hg status -C |
209 (cd d1/d11; hg rename ../../d2/b ../../../foo) | 208 (cd d1/d11; hg rename ../../d2/b ../../../foo) |
210 hg status | 209 hg status -C |
211 | 210 |