Show More
@@ -1,554 +1,633 | |||||
1 | #testcases filelog compatibility |
|
1 | #testcases filelog compatibility | |
2 |
|
2 | |||
3 | $ cat >> $HGRCPATH << EOF |
|
3 | $ cat >> $HGRCPATH << EOF | |
|
4 | > [extensions] | |||
|
5 | > rebase= | |||
4 | > [alias] |
|
6 | > [alias] | |
5 | > l = log -G -T '{rev} {desc}\n{files}\n' |
|
7 | > l = log -G -T '{rev} {desc}\n{files}\n' | |
6 | > EOF |
|
8 | > EOF | |
7 |
|
9 | |||
8 | #if compatibility |
|
10 | #if compatibility | |
9 | $ cat >> $HGRCPATH << EOF |
|
11 | $ cat >> $HGRCPATH << EOF | |
10 | > [experimental] |
|
12 | > [experimental] | |
11 | > copies.read-from = compatibility |
|
13 | > copies.read-from = compatibility | |
12 | > EOF |
|
14 | > EOF | |
13 | #endif |
|
15 | #endif | |
14 |
|
16 | |||
15 | $ REPONUM=0 |
|
17 | $ REPONUM=0 | |
16 | $ newrepo() { |
|
18 | $ newrepo() { | |
17 | > cd $TESTTMP |
|
19 | > cd $TESTTMP | |
18 | > REPONUM=`expr $REPONUM + 1` |
|
20 | > REPONUM=`expr $REPONUM + 1` | |
19 | > hg init repo-$REPONUM |
|
21 | > hg init repo-$REPONUM | |
20 | > cd repo-$REPONUM |
|
22 | > cd repo-$REPONUM | |
21 | > } |
|
23 | > } | |
22 |
|
24 | |||
23 | Simple rename case |
|
25 | Simple rename case | |
24 | $ newrepo |
|
26 | $ newrepo | |
25 | $ echo x > x |
|
27 | $ echo x > x | |
26 | $ hg ci -Aqm 'add x' |
|
28 | $ hg ci -Aqm 'add x' | |
27 | $ hg mv x y |
|
29 | $ hg mv x y | |
28 | $ hg debugp1copies |
|
30 | $ hg debugp1copies | |
29 | x -> y |
|
31 | x -> y | |
30 | $ hg debugp2copies |
|
32 | $ hg debugp2copies | |
31 | $ hg ci -m 'rename x to y' |
|
33 | $ hg ci -m 'rename x to y' | |
32 | $ hg l |
|
34 | $ hg l | |
33 | @ 1 rename x to y |
|
35 | @ 1 rename x to y | |
34 | | x y |
|
36 | | x y | |
35 | o 0 add x |
|
37 | o 0 add x | |
36 | x |
|
38 | x | |
37 | $ hg debugp1copies -r 1 |
|
39 | $ hg debugp1copies -r 1 | |
38 | x -> y |
|
40 | x -> y | |
39 | $ hg debugpathcopies 0 1 |
|
41 | $ hg debugpathcopies 0 1 | |
40 | x -> y |
|
42 | x -> y | |
41 | $ hg debugpathcopies 1 0 |
|
43 | $ hg debugpathcopies 1 0 | |
42 | y -> x |
|
44 | y -> x | |
43 | Test filtering copies by path. We do filtering by destination. |
|
45 | Test filtering copies by path. We do filtering by destination. | |
44 | $ hg debugpathcopies 0 1 x |
|
46 | $ hg debugpathcopies 0 1 x | |
45 | $ hg debugpathcopies 1 0 x |
|
47 | $ hg debugpathcopies 1 0 x | |
46 | y -> x |
|
48 | y -> x | |
47 | $ hg debugpathcopies 0 1 y |
|
49 | $ hg debugpathcopies 0 1 y | |
48 | x -> y |
|
50 | x -> y | |
49 | $ hg debugpathcopies 1 0 y |
|
51 | $ hg debugpathcopies 1 0 y | |
50 |
|
52 | |||
51 | Copy a file onto another file |
|
53 | Copy a file onto another file | |
52 | $ newrepo |
|
54 | $ newrepo | |
53 | $ echo x > x |
|
55 | $ echo x > x | |
54 | $ echo y > y |
|
56 | $ echo y > y | |
55 | $ hg ci -Aqm 'add x and y' |
|
57 | $ hg ci -Aqm 'add x and y' | |
56 | $ hg cp -f x y |
|
58 | $ hg cp -f x y | |
57 | $ hg debugp1copies |
|
59 | $ hg debugp1copies | |
58 | x -> y |
|
60 | x -> y | |
59 | $ hg debugp2copies |
|
61 | $ hg debugp2copies | |
60 | $ hg ci -m 'copy x onto y' |
|
62 | $ hg ci -m 'copy x onto y' | |
61 | $ hg l |
|
63 | $ hg l | |
62 | @ 1 copy x onto y |
|
64 | @ 1 copy x onto y | |
63 | | y |
|
65 | | y | |
64 | o 0 add x and y |
|
66 | o 0 add x and y | |
65 | x y |
|
67 | x y | |
66 | $ hg debugp1copies -r 1 |
|
68 | $ hg debugp1copies -r 1 | |
67 | x -> y |
|
69 | x -> y | |
68 | Incorrectly doesn't show the rename |
|
70 | Incorrectly doesn't show the rename | |
69 | $ hg debugpathcopies 0 1 |
|
71 | $ hg debugpathcopies 0 1 | |
70 |
|
72 | |||
71 | Copy a file onto another file with same content. If metadata is stored in changeset, this does not |
|
73 | Copy a file onto another file with same content. If metadata is stored in changeset, this does not | |
72 | produce a new filelog entry. The changeset's "files" entry should still list the file. |
|
74 | produce a new filelog entry. The changeset's "files" entry should still list the file. | |
73 | $ newrepo |
|
75 | $ newrepo | |
74 | $ echo x > x |
|
76 | $ echo x > x | |
75 | $ echo x > x2 |
|
77 | $ echo x > x2 | |
76 | $ hg ci -Aqm 'add x and x2 with same content' |
|
78 | $ hg ci -Aqm 'add x and x2 with same content' | |
77 | $ hg cp -f x x2 |
|
79 | $ hg cp -f x x2 | |
78 | $ hg ci -m 'copy x onto x2' |
|
80 | $ hg ci -m 'copy x onto x2' | |
79 | $ hg l |
|
81 | $ hg l | |
80 | @ 1 copy x onto x2 |
|
82 | @ 1 copy x onto x2 | |
81 | | x2 |
|
83 | | x2 | |
82 | o 0 add x and x2 with same content |
|
84 | o 0 add x and x2 with same content | |
83 | x x2 |
|
85 | x x2 | |
84 | $ hg debugp1copies -r 1 |
|
86 | $ hg debugp1copies -r 1 | |
85 | x -> x2 |
|
87 | x -> x2 | |
86 | Incorrectly doesn't show the rename |
|
88 | Incorrectly doesn't show the rename | |
87 | $ hg debugpathcopies 0 1 |
|
89 | $ hg debugpathcopies 0 1 | |
88 |
|
90 | |||
89 | Copy a file, then delete destination, then copy again. This does not create a new filelog entry. |
|
91 | Copy a file, then delete destination, then copy again. This does not create a new filelog entry. | |
90 | $ newrepo |
|
92 | $ newrepo | |
91 | $ echo x > x |
|
93 | $ echo x > x | |
92 | $ hg ci -Aqm 'add x' |
|
94 | $ hg ci -Aqm 'add x' | |
93 | $ hg cp x y |
|
95 | $ hg cp x y | |
94 | $ hg ci -m 'copy x to y' |
|
96 | $ hg ci -m 'copy x to y' | |
95 | $ hg rm y |
|
97 | $ hg rm y | |
96 | $ hg ci -m 'remove y' |
|
98 | $ hg ci -m 'remove y' | |
97 | $ hg cp -f x y |
|
99 | $ hg cp -f x y | |
98 | $ hg ci -m 'copy x onto y (again)' |
|
100 | $ hg ci -m 'copy x onto y (again)' | |
99 | $ hg l |
|
101 | $ hg l | |
100 | @ 3 copy x onto y (again) |
|
102 | @ 3 copy x onto y (again) | |
101 | | y |
|
103 | | y | |
102 | o 2 remove y |
|
104 | o 2 remove y | |
103 | | y |
|
105 | | y | |
104 | o 1 copy x to y |
|
106 | o 1 copy x to y | |
105 | | y |
|
107 | | y | |
106 | o 0 add x |
|
108 | o 0 add x | |
107 | x |
|
109 | x | |
108 | $ hg debugp1copies -r 3 |
|
110 | $ hg debugp1copies -r 3 | |
109 | x -> y |
|
111 | x -> y | |
110 | $ hg debugpathcopies 0 3 |
|
112 | $ hg debugpathcopies 0 3 | |
111 | x -> y |
|
113 | x -> y | |
112 |
|
114 | |||
113 | Rename file in a loop: x->y->z->x |
|
115 | Rename file in a loop: x->y->z->x | |
114 | $ newrepo |
|
116 | $ newrepo | |
115 | $ echo x > x |
|
117 | $ echo x > x | |
116 | $ hg ci -Aqm 'add x' |
|
118 | $ hg ci -Aqm 'add x' | |
117 | $ hg mv x y |
|
119 | $ hg mv x y | |
118 | $ hg debugp1copies |
|
120 | $ hg debugp1copies | |
119 | x -> y |
|
121 | x -> y | |
120 | $ hg debugp2copies |
|
122 | $ hg debugp2copies | |
121 | $ hg ci -m 'rename x to y' |
|
123 | $ hg ci -m 'rename x to y' | |
122 | $ hg mv y z |
|
124 | $ hg mv y z | |
123 | $ hg ci -m 'rename y to z' |
|
125 | $ hg ci -m 'rename y to z' | |
124 | $ hg mv z x |
|
126 | $ hg mv z x | |
125 | $ hg ci -m 'rename z to x' |
|
127 | $ hg ci -m 'rename z to x' | |
126 | $ hg l |
|
128 | $ hg l | |
127 | @ 3 rename z to x |
|
129 | @ 3 rename z to x | |
128 | | x z |
|
130 | | x z | |
129 | o 2 rename y to z |
|
131 | o 2 rename y to z | |
130 | | y z |
|
132 | | y z | |
131 | o 1 rename x to y |
|
133 | o 1 rename x to y | |
132 | | x y |
|
134 | | x y | |
133 | o 0 add x |
|
135 | o 0 add x | |
134 | x |
|
136 | x | |
135 | $ hg debugpathcopies 0 3 |
|
137 | $ hg debugpathcopies 0 3 | |
136 |
|
138 | |||
137 | Copy x to y, then remove y, then add back y. With copy metadata in the changeset, this could easily |
|
139 | Copy x to y, then remove y, then add back y. With copy metadata in the changeset, this could easily | |
138 | end up reporting y as copied from x (if we don't unmark it as a copy when it's removed). |
|
140 | end up reporting y as copied from x (if we don't unmark it as a copy when it's removed). | |
139 | $ newrepo |
|
141 | $ newrepo | |
140 | $ echo x > x |
|
142 | $ echo x > x | |
141 | $ hg ci -Aqm 'add x' |
|
143 | $ hg ci -Aqm 'add x' | |
142 | $ hg mv x y |
|
144 | $ hg mv x y | |
143 | $ hg ci -m 'rename x to y' |
|
145 | $ hg ci -m 'rename x to y' | |
144 | $ hg rm y |
|
146 | $ hg rm y | |
145 | $ hg ci -qm 'remove y' |
|
147 | $ hg ci -qm 'remove y' | |
146 | $ echo x > y |
|
148 | $ echo x > y | |
147 | $ hg ci -Aqm 'add back y' |
|
149 | $ hg ci -Aqm 'add back y' | |
148 | $ hg l |
|
150 | $ hg l | |
149 | @ 3 add back y |
|
151 | @ 3 add back y | |
150 | | y |
|
152 | | y | |
151 | o 2 remove y |
|
153 | o 2 remove y | |
152 | | y |
|
154 | | y | |
153 | o 1 rename x to y |
|
155 | o 1 rename x to y | |
154 | | x y |
|
156 | | x y | |
155 | o 0 add x |
|
157 | o 0 add x | |
156 | x |
|
158 | x | |
157 | $ hg debugp1copies -r 3 |
|
159 | $ hg debugp1copies -r 3 | |
158 | $ hg debugpathcopies 0 3 |
|
160 | $ hg debugpathcopies 0 3 | |
159 |
|
161 | |||
160 | Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy metadata in the |
|
162 | Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy metadata in the | |
161 | changeset, the two copies here will have the same filelog entry, so ctx['z'].introrev() might point |
|
163 | changeset, the two copies here will have the same filelog entry, so ctx['z'].introrev() might point | |
162 | to the first commit that added the file. We should still report the copy as being from x2. |
|
164 | to the first commit that added the file. We should still report the copy as being from x2. | |
163 | $ newrepo |
|
165 | $ newrepo | |
164 | $ echo x > x |
|
166 | $ echo x > x | |
165 | $ echo x > x2 |
|
167 | $ echo x > x2 | |
166 | $ hg ci -Aqm 'add x and x2 with same content' |
|
168 | $ hg ci -Aqm 'add x and x2 with same content' | |
167 | $ hg cp x z |
|
169 | $ hg cp x z | |
168 | $ hg ci -qm 'copy x to z' |
|
170 | $ hg ci -qm 'copy x to z' | |
169 | $ hg rm z |
|
171 | $ hg rm z | |
170 | $ hg ci -m 'remove z' |
|
172 | $ hg ci -m 'remove z' | |
171 | $ hg cp x2 z |
|
173 | $ hg cp x2 z | |
172 | $ hg ci -m 'copy x2 to z' |
|
174 | $ hg ci -m 'copy x2 to z' | |
173 | $ hg l |
|
175 | $ hg l | |
174 | @ 3 copy x2 to z |
|
176 | @ 3 copy x2 to z | |
175 | | z |
|
177 | | z | |
176 | o 2 remove z |
|
178 | o 2 remove z | |
177 | | z |
|
179 | | z | |
178 | o 1 copy x to z |
|
180 | o 1 copy x to z | |
179 | | z |
|
181 | | z | |
180 | o 0 add x and x2 with same content |
|
182 | o 0 add x and x2 with same content | |
181 | x x2 |
|
183 | x x2 | |
182 | $ hg debugp1copies -r 3 |
|
184 | $ hg debugp1copies -r 3 | |
183 | x2 -> z |
|
185 | x2 -> z | |
184 | $ hg debugpathcopies 0 3 |
|
186 | $ hg debugpathcopies 0 3 | |
185 | x2 -> z |
|
187 | x2 -> z | |
186 |
|
188 | |||
187 | Create x and y, then rename them both to the same name, but on different sides of a fork |
|
189 | Create x and y, then rename them both to the same name, but on different sides of a fork | |
188 | $ newrepo |
|
190 | $ newrepo | |
189 | $ echo x > x |
|
191 | $ echo x > x | |
190 | $ echo y > y |
|
192 | $ echo y > y | |
191 | $ hg ci -Aqm 'add x and y' |
|
193 | $ hg ci -Aqm 'add x and y' | |
192 | $ hg mv x z |
|
194 | $ hg mv x z | |
193 | $ hg ci -qm 'rename x to z' |
|
195 | $ hg ci -qm 'rename x to z' | |
194 | $ hg co -q 0 |
|
196 | $ hg co -q 0 | |
195 | $ hg mv y z |
|
197 | $ hg mv y z | |
196 | $ hg ci -qm 'rename y to z' |
|
198 | $ hg ci -qm 'rename y to z' | |
197 | $ hg l |
|
199 | $ hg l | |
198 | @ 2 rename y to z |
|
200 | @ 2 rename y to z | |
199 | | y z |
|
201 | | y z | |
200 | | o 1 rename x to z |
|
202 | | o 1 rename x to z | |
201 | |/ x z |
|
203 | |/ x z | |
202 | o 0 add x and y |
|
204 | o 0 add x and y | |
203 | x y |
|
205 | x y | |
204 | $ hg debugpathcopies 1 2 |
|
206 | $ hg debugpathcopies 1 2 | |
205 | z -> x |
|
207 | z -> x | |
206 | y -> z |
|
208 | y -> z | |
207 |
|
209 | |||
208 | Fork renames x to y on one side and removes x on the other |
|
210 | Fork renames x to y on one side and removes x on the other | |
209 | $ newrepo |
|
211 | $ newrepo | |
210 | $ echo x > x |
|
212 | $ echo x > x | |
211 | $ hg ci -Aqm 'add x' |
|
213 | $ hg ci -Aqm 'add x' | |
212 | $ hg mv x y |
|
214 | $ hg mv x y | |
213 | $ hg ci -m 'rename x to y' |
|
215 | $ hg ci -m 'rename x to y' | |
214 | $ hg co -q 0 |
|
216 | $ hg co -q 0 | |
215 | $ hg rm x |
|
217 | $ hg rm x | |
216 | $ hg ci -m 'remove x' |
|
218 | $ hg ci -m 'remove x' | |
217 | created new head |
|
219 | created new head | |
218 | $ hg l |
|
220 | $ hg l | |
219 | @ 2 remove x |
|
221 | @ 2 remove x | |
220 | | x |
|
222 | | x | |
221 | | o 1 rename x to y |
|
223 | | o 1 rename x to y | |
222 | |/ x y |
|
224 | |/ x y | |
223 | o 0 add x |
|
225 | o 0 add x | |
224 | x |
|
226 | x | |
225 | $ hg debugpathcopies 1 2 |
|
227 | $ hg debugpathcopies 1 2 | |
226 |
|
228 | |||
227 | Copies via null revision (there shouldn't be any) |
|
229 | Copies via null revision (there shouldn't be any) | |
228 | $ newrepo |
|
230 | $ newrepo | |
229 | $ echo x > x |
|
231 | $ echo x > x | |
230 | $ hg ci -Aqm 'add x' |
|
232 | $ hg ci -Aqm 'add x' | |
231 | $ hg cp x y |
|
233 | $ hg cp x y | |
232 | $ hg ci -m 'copy x to y' |
|
234 | $ hg ci -m 'copy x to y' | |
233 | $ hg co -q null |
|
235 | $ hg co -q null | |
234 | $ echo x > x |
|
236 | $ echo x > x | |
235 | $ hg ci -Aqm 'add x (again)' |
|
237 | $ hg ci -Aqm 'add x (again)' | |
236 | $ hg l |
|
238 | $ hg l | |
237 | @ 2 add x (again) |
|
239 | @ 2 add x (again) | |
238 | x |
|
240 | x | |
239 | o 1 copy x to y |
|
241 | o 1 copy x to y | |
240 | | y |
|
242 | | y | |
241 | o 0 add x |
|
243 | o 0 add x | |
242 | x |
|
244 | x | |
243 | $ hg debugpathcopies 1 2 |
|
245 | $ hg debugpathcopies 1 2 | |
244 | $ hg debugpathcopies 2 1 |
|
246 | $ hg debugpathcopies 2 1 | |
245 |
|
247 | |||
246 | Merge rename from other branch |
|
248 | Merge rename from other branch | |
247 | $ newrepo |
|
249 | $ newrepo | |
248 | $ echo x > x |
|
250 | $ echo x > x | |
249 | $ hg ci -Aqm 'add x' |
|
251 | $ hg ci -Aqm 'add x' | |
250 | $ hg mv x y |
|
252 | $ hg mv x y | |
251 | $ hg ci -m 'rename x to y' |
|
253 | $ hg ci -m 'rename x to y' | |
252 | $ hg co -q 0 |
|
254 | $ hg co -q 0 | |
253 | $ echo z > z |
|
255 | $ echo z > z | |
254 | $ hg ci -Aqm 'add z' |
|
256 | $ hg ci -Aqm 'add z' | |
255 | $ hg merge -q 1 |
|
257 | $ hg merge -q 1 | |
256 | $ hg debugp1copies |
|
258 | $ hg debugp1copies | |
257 | $ hg debugp2copies |
|
259 | $ hg debugp2copies | |
258 | $ hg ci -m 'merge rename from p2' |
|
260 | $ hg ci -m 'merge rename from p2' | |
259 | $ hg l |
|
261 | $ hg l | |
260 | @ 3 merge rename from p2 |
|
262 | @ 3 merge rename from p2 | |
261 | |\ x |
|
263 | |\ x | |
262 | | o 2 add z |
|
264 | | o 2 add z | |
263 | | | z |
|
265 | | | z | |
264 | o | 1 rename x to y |
|
266 | o | 1 rename x to y | |
265 | |/ x y |
|
267 | |/ x y | |
266 | o 0 add x |
|
268 | o 0 add x | |
267 | x |
|
269 | x | |
268 | Perhaps we should indicate the rename here, but `hg status` is documented to be weird during |
|
270 | Perhaps we should indicate the rename here, but `hg status` is documented to be weird during | |
269 | merges, so... |
|
271 | merges, so... | |
270 | $ hg debugp1copies -r 3 |
|
272 | $ hg debugp1copies -r 3 | |
271 | $ hg debugp2copies -r 3 |
|
273 | $ hg debugp2copies -r 3 | |
272 | $ hg debugpathcopies 0 3 |
|
274 | $ hg debugpathcopies 0 3 | |
273 | x -> y |
|
275 | x -> y | |
274 | $ hg debugpathcopies 1 2 |
|
276 | $ hg debugpathcopies 1 2 | |
275 | y -> x |
|
277 | y -> x | |
276 | $ hg debugpathcopies 1 3 |
|
278 | $ hg debugpathcopies 1 3 | |
277 | $ hg debugpathcopies 2 3 |
|
279 | $ hg debugpathcopies 2 3 | |
278 | x -> y |
|
280 | x -> y | |
279 |
|
281 | |||
280 | Copy file from either side in a merge |
|
282 | Copy file from either side in a merge | |
281 | $ newrepo |
|
283 | $ newrepo | |
282 | $ echo x > x |
|
284 | $ echo x > x | |
283 | $ hg ci -Aqm 'add x' |
|
285 | $ hg ci -Aqm 'add x' | |
284 | $ hg co -q null |
|
286 | $ hg co -q null | |
285 | $ echo y > y |
|
287 | $ echo y > y | |
286 | $ hg ci -Aqm 'add y' |
|
288 | $ hg ci -Aqm 'add y' | |
287 | $ hg merge -q 0 |
|
289 | $ hg merge -q 0 | |
288 | $ hg cp y z |
|
290 | $ hg cp y z | |
289 | $ hg debugp1copies |
|
291 | $ hg debugp1copies | |
290 | y -> z |
|
292 | y -> z | |
291 | $ hg debugp2copies |
|
293 | $ hg debugp2copies | |
292 | $ hg ci -m 'copy file from p1 in merge' |
|
294 | $ hg ci -m 'copy file from p1 in merge' | |
293 | $ hg co -q 1 |
|
295 | $ hg co -q 1 | |
294 | $ hg merge -q 0 |
|
296 | $ hg merge -q 0 | |
295 | $ hg cp x z |
|
297 | $ hg cp x z | |
296 | $ hg debugp1copies |
|
298 | $ hg debugp1copies | |
297 | $ hg debugp2copies |
|
299 | $ hg debugp2copies | |
298 | x -> z |
|
300 | x -> z | |
299 | $ hg ci -qm 'copy file from p2 in merge' |
|
301 | $ hg ci -qm 'copy file from p2 in merge' | |
300 | $ hg l |
|
302 | $ hg l | |
301 | @ 3 copy file from p2 in merge |
|
303 | @ 3 copy file from p2 in merge | |
302 | |\ z |
|
304 | |\ z | |
303 | +---o 2 copy file from p1 in merge |
|
305 | +---o 2 copy file from p1 in merge | |
304 | | |/ z |
|
306 | | |/ z | |
305 | | o 1 add y |
|
307 | | o 1 add y | |
306 | | y |
|
308 | | y | |
307 | o 0 add x |
|
309 | o 0 add x | |
308 | x |
|
310 | x | |
309 | $ hg debugp1copies -r 2 |
|
311 | $ hg debugp1copies -r 2 | |
310 | y -> z |
|
312 | y -> z | |
311 | $ hg debugp2copies -r 2 |
|
313 | $ hg debugp2copies -r 2 | |
312 | $ hg debugpathcopies 1 2 |
|
314 | $ hg debugpathcopies 1 2 | |
313 | y -> z |
|
315 | y -> z | |
314 | $ hg debugpathcopies 0 2 |
|
316 | $ hg debugpathcopies 0 2 | |
315 | $ hg debugp1copies -r 3 |
|
317 | $ hg debugp1copies -r 3 | |
316 | $ hg debugp2copies -r 3 |
|
318 | $ hg debugp2copies -r 3 | |
317 | x -> z |
|
319 | x -> z | |
318 | $ hg debugpathcopies 1 3 |
|
320 | $ hg debugpathcopies 1 3 | |
319 | $ hg debugpathcopies 0 3 |
|
321 | $ hg debugpathcopies 0 3 | |
320 | x -> z |
|
322 | x -> z | |
321 |
|
323 | |||
322 | Copy file that exists on both sides of the merge, same content on both sides |
|
324 | Copy file that exists on both sides of the merge, same content on both sides | |
323 | $ newrepo |
|
325 | $ newrepo | |
324 | $ echo x > x |
|
326 | $ echo x > x | |
325 | $ hg ci -Aqm 'add x on branch 1' |
|
327 | $ hg ci -Aqm 'add x on branch 1' | |
326 | $ hg co -q null |
|
328 | $ hg co -q null | |
327 | $ echo x > x |
|
329 | $ echo x > x | |
328 | $ hg ci -Aqm 'add x on branch 2' |
|
330 | $ hg ci -Aqm 'add x on branch 2' | |
329 | $ hg merge -q 0 |
|
331 | $ hg merge -q 0 | |
330 | $ hg cp x z |
|
332 | $ hg cp x z | |
331 | $ hg debugp1copies |
|
333 | $ hg debugp1copies | |
332 | x -> z |
|
334 | x -> z | |
333 | $ hg debugp2copies |
|
335 | $ hg debugp2copies | |
334 | $ hg ci -qm 'merge' |
|
336 | $ hg ci -qm 'merge' | |
335 | $ hg l |
|
337 | $ hg l | |
336 | @ 2 merge |
|
338 | @ 2 merge | |
337 | |\ z |
|
339 | |\ z | |
338 | | o 1 add x on branch 2 |
|
340 | | o 1 add x on branch 2 | |
339 | | x |
|
341 | | x | |
340 | o 0 add x on branch 1 |
|
342 | o 0 add x on branch 1 | |
341 | x |
|
343 | x | |
342 | $ hg debugp1copies -r 2 |
|
344 | $ hg debugp1copies -r 2 | |
343 | x -> z |
|
345 | x -> z | |
344 | $ hg debugp2copies -r 2 |
|
346 | $ hg debugp2copies -r 2 | |
345 | It's a little weird that it shows up on both sides |
|
347 | It's a little weird that it shows up on both sides | |
346 | $ hg debugpathcopies 1 2 |
|
348 | $ hg debugpathcopies 1 2 | |
347 | x -> z |
|
349 | x -> z | |
348 | $ hg debugpathcopies 0 2 |
|
350 | $ hg debugpathcopies 0 2 | |
349 | x -> z (filelog !) |
|
351 | x -> z (filelog !) | |
350 |
|
352 | |||
351 | Copy file that exists on both sides of the merge, different content |
|
353 | Copy file that exists on both sides of the merge, different content | |
352 | $ newrepo |
|
354 | $ newrepo | |
353 | $ echo branch1 > x |
|
355 | $ echo branch1 > x | |
354 | $ hg ci -Aqm 'add x on branch 1' |
|
356 | $ hg ci -Aqm 'add x on branch 1' | |
355 | $ hg co -q null |
|
357 | $ hg co -q null | |
356 | $ echo branch2 > x |
|
358 | $ echo branch2 > x | |
357 | $ hg ci -Aqm 'add x on branch 2' |
|
359 | $ hg ci -Aqm 'add x on branch 2' | |
358 | $ hg merge -q 0 |
|
360 | $ hg merge -q 0 | |
359 | warning: conflicts while merging x! (edit, then use 'hg resolve --mark') |
|
361 | warning: conflicts while merging x! (edit, then use 'hg resolve --mark') | |
360 | [1] |
|
362 | [1] | |
361 | $ echo resolved > x |
|
363 | $ echo resolved > x | |
362 | $ hg resolve -m x |
|
364 | $ hg resolve -m x | |
363 | (no more unresolved files) |
|
365 | (no more unresolved files) | |
364 | $ hg cp x z |
|
366 | $ hg cp x z | |
365 | $ hg debugp1copies |
|
367 | $ hg debugp1copies | |
366 | x -> z |
|
368 | x -> z | |
367 | $ hg debugp2copies |
|
369 | $ hg debugp2copies | |
368 | $ hg ci -qm 'merge' |
|
370 | $ hg ci -qm 'merge' | |
369 | $ hg l |
|
371 | $ hg l | |
370 | @ 2 merge |
|
372 | @ 2 merge | |
371 | |\ x z |
|
373 | |\ x z | |
372 | | o 1 add x on branch 2 |
|
374 | | o 1 add x on branch 2 | |
373 | | x |
|
375 | | x | |
374 | o 0 add x on branch 1 |
|
376 | o 0 add x on branch 1 | |
375 | x |
|
377 | x | |
376 | $ hg debugp1copies -r 2 |
|
378 | $ hg debugp1copies -r 2 | |
377 | $ hg debugp2copies -r 2 |
|
379 | $ hg debugp2copies -r 2 | |
378 | x -> z |
|
380 | x -> z | |
379 | $ hg debugpathcopies 1 2 |
|
381 | $ hg debugpathcopies 1 2 | |
380 | $ hg debugpathcopies 0 2 |
|
382 | $ hg debugpathcopies 0 2 | |
381 | x -> z |
|
383 | x -> z | |
382 |
|
384 | |||
383 | Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent |
|
385 | Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent | |
384 | of the merge to the merge should include the copy from the other side. |
|
386 | of the merge to the merge should include the copy from the other side. | |
385 | $ newrepo |
|
387 | $ newrepo | |
386 | $ echo x > x |
|
388 | $ echo x > x | |
387 | $ hg ci -Aqm 'add x' |
|
389 | $ hg ci -Aqm 'add x' | |
388 | $ hg cp x y |
|
390 | $ hg cp x y | |
389 | $ hg ci -qm 'copy x to y' |
|
391 | $ hg ci -qm 'copy x to y' | |
390 | $ hg co -q 0 |
|
392 | $ hg co -q 0 | |
391 | $ hg cp x z |
|
393 | $ hg cp x z | |
392 | $ hg ci -qm 'copy x to z' |
|
394 | $ hg ci -qm 'copy x to z' | |
393 | $ hg merge -q 1 |
|
395 | $ hg merge -q 1 | |
394 | $ hg ci -m 'merge copy x->y and copy x->z' |
|
396 | $ hg ci -m 'merge copy x->y and copy x->z' | |
395 | $ hg l |
|
397 | $ hg l | |
396 | @ 3 merge copy x->y and copy x->z |
|
398 | @ 3 merge copy x->y and copy x->z | |
397 | |\ |
|
399 | |\ | |
398 | | o 2 copy x to z |
|
400 | | o 2 copy x to z | |
399 | | | z |
|
401 | | | z | |
400 | o | 1 copy x to y |
|
402 | o | 1 copy x to y | |
401 | |/ y |
|
403 | |/ y | |
402 | o 0 add x |
|
404 | o 0 add x | |
403 | x |
|
405 | x | |
404 | $ hg debugp1copies -r 3 |
|
406 | $ hg debugp1copies -r 3 | |
405 | $ hg debugp2copies -r 3 |
|
407 | $ hg debugp2copies -r 3 | |
406 | $ hg debugpathcopies 2 3 |
|
408 | $ hg debugpathcopies 2 3 | |
407 | x -> y |
|
409 | x -> y | |
408 | $ hg debugpathcopies 1 3 |
|
410 | $ hg debugpathcopies 1 3 | |
409 | x -> z |
|
411 | x -> z | |
410 |
|
412 | |||
411 | Copy x to y on one side of merge, create y and rename to z on the other side. Pathcopies from the |
|
413 | Copy x to y on one side of merge, create y and rename to z on the other side. Pathcopies from the | |
412 | first side should not include the y->z rename since y didn't exist in the merge base. |
|
414 | first side should not include the y->z rename since y didn't exist in the merge base. | |
413 | $ newrepo |
|
415 | $ newrepo | |
414 | $ echo x > x |
|
416 | $ echo x > x | |
415 | $ hg ci -Aqm 'add x' |
|
417 | $ hg ci -Aqm 'add x' | |
416 | $ hg cp x y |
|
418 | $ hg cp x y | |
417 | $ hg ci -qm 'copy x to y' |
|
419 | $ hg ci -qm 'copy x to y' | |
418 | $ hg co -q 0 |
|
420 | $ hg co -q 0 | |
419 | $ echo y > y |
|
421 | $ echo y > y | |
420 | $ hg ci -Aqm 'add y' |
|
422 | $ hg ci -Aqm 'add y' | |
421 | $ hg mv y z |
|
423 | $ hg mv y z | |
422 | $ hg ci -m 'rename y to z' |
|
424 | $ hg ci -m 'rename y to z' | |
423 | $ hg merge -q 1 |
|
425 | $ hg merge -q 1 | |
424 | $ hg ci -m 'merge' |
|
426 | $ hg ci -m 'merge' | |
425 | $ hg l |
|
427 | $ hg l | |
426 | @ 4 merge |
|
428 | @ 4 merge | |
427 | |\ |
|
429 | |\ | |
428 | | o 3 rename y to z |
|
430 | | o 3 rename y to z | |
429 | | | y z |
|
431 | | | y z | |
430 | | o 2 add y |
|
432 | | o 2 add y | |
431 | | | y |
|
433 | | | y | |
432 | o | 1 copy x to y |
|
434 | o | 1 copy x to y | |
433 | |/ y |
|
435 | |/ y | |
434 | o 0 add x |
|
436 | o 0 add x | |
435 | x |
|
437 | x | |
436 | $ hg debugp1copies -r 3 |
|
438 | $ hg debugp1copies -r 3 | |
437 | y -> z |
|
439 | y -> z | |
438 | $ hg debugp2copies -r 3 |
|
440 | $ hg debugp2copies -r 3 | |
439 | $ hg debugpathcopies 2 3 |
|
441 | $ hg debugpathcopies 2 3 | |
440 | y -> z |
|
442 | y -> z | |
441 | $ hg debugpathcopies 1 3 |
|
443 | $ hg debugpathcopies 1 3 | |
442 |
|
444 | |||
443 | Create x and y, then rename x to z on one side of merge, and rename y to z and modify z on the |
|
445 | Create x and y, then rename x to z on one side of merge, and rename y to z and modify z on the | |
444 | other side. |
|
446 | other side. | |
445 | $ newrepo |
|
447 | $ newrepo | |
446 | $ echo x > x |
|
448 | $ echo x > x | |
447 | $ echo y > y |
|
449 | $ echo y > y | |
448 | $ hg ci -Aqm 'add x and y' |
|
450 | $ hg ci -Aqm 'add x and y' | |
449 | $ hg mv x z |
|
451 | $ hg mv x z | |
450 | $ hg ci -qm 'rename x to z' |
|
452 | $ hg ci -qm 'rename x to z' | |
451 | $ hg co -q 0 |
|
453 | $ hg co -q 0 | |
452 | $ hg mv y z |
|
454 | $ hg mv y z | |
453 | $ hg ci -qm 'rename y to z' |
|
455 | $ hg ci -qm 'rename y to z' | |
454 | $ echo z >> z |
|
456 | $ echo z >> z | |
455 | $ hg ci -m 'modify z' |
|
457 | $ hg ci -m 'modify z' | |
456 | $ hg merge -q 1 |
|
458 | $ hg merge -q 1 | |
457 | warning: conflicts while merging z! (edit, then use 'hg resolve --mark') |
|
459 | warning: conflicts while merging z! (edit, then use 'hg resolve --mark') | |
458 | [1] |
|
460 | [1] | |
459 | $ echo z > z |
|
461 | $ echo z > z | |
460 | $ hg resolve -qm z |
|
462 | $ hg resolve -qm z | |
461 | $ hg ci -m 'merge 1 into 3' |
|
463 | $ hg ci -m 'merge 1 into 3' | |
462 | Try merging the other direction too |
|
464 | Try merging the other direction too | |
463 | $ hg co -q 1 |
|
465 | $ hg co -q 1 | |
464 | $ hg merge -q 3 |
|
466 | $ hg merge -q 3 | |
465 | warning: conflicts while merging z! (edit, then use 'hg resolve --mark') |
|
467 | warning: conflicts while merging z! (edit, then use 'hg resolve --mark') | |
466 | [1] |
|
468 | [1] | |
467 | $ echo z > z |
|
469 | $ echo z > z | |
468 | $ hg resolve -qm z |
|
470 | $ hg resolve -qm z | |
469 | $ hg ci -m 'merge 3 into 1' |
|
471 | $ hg ci -m 'merge 3 into 1' | |
470 | created new head |
|
472 | created new head | |
471 | $ hg l |
|
473 | $ hg l | |
472 | @ 5 merge 3 into 1 |
|
474 | @ 5 merge 3 into 1 | |
473 | |\ y z |
|
475 | |\ y z | |
474 | +---o 4 merge 1 into 3 |
|
476 | +---o 4 merge 1 into 3 | |
475 | | |/ x z |
|
477 | | |/ x z | |
476 | | o 3 modify z |
|
478 | | o 3 modify z | |
477 | | | z |
|
479 | | | z | |
478 | | o 2 rename y to z |
|
480 | | o 2 rename y to z | |
479 | | | y z |
|
481 | | | y z | |
480 | o | 1 rename x to z |
|
482 | o | 1 rename x to z | |
481 | |/ x z |
|
483 | |/ x z | |
482 | o 0 add x and y |
|
484 | o 0 add x and y | |
483 | x y |
|
485 | x y | |
484 | $ hg debugpathcopies 1 4 |
|
486 | $ hg debugpathcopies 1 4 | |
485 | $ hg debugpathcopies 2 4 |
|
487 | $ hg debugpathcopies 2 4 | |
486 | $ hg debugpathcopies 0 4 |
|
488 | $ hg debugpathcopies 0 4 | |
487 | x -> z (filelog !) |
|
489 | x -> z (filelog !) | |
488 | y -> z (compatibility !) |
|
490 | y -> z (compatibility !) | |
489 | $ hg debugpathcopies 1 5 |
|
491 | $ hg debugpathcopies 1 5 | |
490 | $ hg debugpathcopies 2 5 |
|
492 | $ hg debugpathcopies 2 5 | |
491 | $ hg debugpathcopies 0 5 |
|
493 | $ hg debugpathcopies 0 5 | |
492 | x -> z |
|
494 | x -> z | |
493 |
|
495 | |||
494 |
|
496 | |||
495 | Test for a case in fullcopytracing algorithm where both the merging csets are |
|
497 | Test for a case in fullcopytracing algorithm where both the merging csets are | |
496 | "dirty"; where a dirty cset means that cset is descendant of merge base. This |
|
498 | "dirty"; where a dirty cset means that cset is descendant of merge base. This | |
497 | test reflect that for this particular case this algorithm correctly find the copies: |
|
499 | test reflect that for this particular case this algorithm correctly find the copies: | |
498 |
|
500 | |||
499 | $ cat >> $HGRCPATH << EOF |
|
501 | $ cat >> $HGRCPATH << EOF | |
500 | > [experimental] |
|
502 | > [experimental] | |
501 | > evolution.createmarkers=True |
|
503 | > evolution.createmarkers=True | |
502 | > evolution.allowunstable=True |
|
504 | > evolution.allowunstable=True | |
503 | > EOF |
|
505 | > EOF | |
504 |
|
506 | |||
505 | $ newrepo |
|
507 | $ newrepo | |
506 | $ echo a > a |
|
508 | $ echo a > a | |
507 | $ hg add a |
|
509 | $ hg add a | |
508 | $ hg ci -m "added a" |
|
510 | $ hg ci -m "added a" | |
509 | $ echo b > b |
|
511 | $ echo b > b | |
510 | $ hg add b |
|
512 | $ hg add b | |
511 | $ hg ci -m "added b" |
|
513 | $ hg ci -m "added b" | |
512 |
|
514 | |||
513 | $ hg mv b b1 |
|
515 | $ hg mv b b1 | |
514 | $ hg ci -m "rename b to b1" |
|
516 | $ hg ci -m "rename b to b1" | |
515 |
|
517 | |||
516 | $ hg up ".^" |
|
518 | $ hg up ".^" | |
517 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
519 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
518 | $ echo d > d |
|
520 | $ echo d > d | |
519 | $ hg add d |
|
521 | $ hg add d | |
520 | $ hg ci -m "added d" |
|
522 | $ hg ci -m "added d" | |
521 | created new head |
|
523 | created new head | |
522 |
|
524 | |||
523 | $ echo baba >> b |
|
525 | $ echo baba >> b | |
524 | $ hg ci --amend -m "added d, modified b" |
|
526 | $ hg ci --amend -m "added d, modified b" | |
525 |
|
527 | |||
526 | $ hg l --hidden |
|
528 | $ hg l --hidden | |
527 | @ 4 added d, modified b |
|
529 | @ 4 added d, modified b | |
528 | | b d |
|
530 | | b d | |
529 | | x 3 added d |
|
531 | | x 3 added d | |
530 | |/ d |
|
532 | |/ d | |
531 | | o 2 rename b to b1 |
|
533 | | o 2 rename b to b1 | |
532 | |/ b b1 |
|
534 | |/ b b1 | |
533 | o 1 added b |
|
535 | o 1 added b | |
534 | | b |
|
536 | | b | |
535 | o 0 added a |
|
537 | o 0 added a | |
536 | a |
|
538 | a | |
537 |
|
539 | |||
538 | Grafting revision 4 on top of revision 2, showing that it respect the rename: |
|
540 | Grafting revision 4 on top of revision 2, showing that it respect the rename: | |
539 |
|
541 | |||
540 | $ hg up 2 -q |
|
542 | $ hg up 2 -q | |
541 | $ hg graft -r 4 --base 3 --hidden |
|
543 | $ hg graft -r 4 --base 3 --hidden | |
542 | grafting 4:af28412ec03c "added d, modified b" (tip) |
|
544 | grafting 4:af28412ec03c "added d, modified b" (tip) | |
543 | merging b1 and b to b1 |
|
545 | merging b1 and b to b1 | |
544 |
|
546 | |||
545 | $ hg l -l1 -p |
|
547 | $ hg l -l1 -p | |
546 | @ 5 added d, modified b |
|
548 | @ 5 added d, modified b | |
547 | | b1 |
|
549 | | b1 | |
548 | ~ diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1 |
|
550 | ~ diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1 | |
549 | --- a/b1 Thu Jan 01 00:00:00 1970 +0000 |
|
551 | --- a/b1 Thu Jan 01 00:00:00 1970 +0000 | |
550 | +++ b/b1 Thu Jan 01 00:00:00 1970 +0000 |
|
552 | +++ b/b1 Thu Jan 01 00:00:00 1970 +0000 | |
551 | @@ -1,1 +1,2 @@ |
|
553 | @@ -1,1 +1,2 @@ | |
552 | b |
|
554 | b | |
553 | +baba |
|
555 | +baba | |
554 |
|
556 | |||
|
557 | Test which demonstrate that fullcopytracing algorithm can fail to handle a case when both the csets are dirty | |||
|
558 | ---------------------------------------------------------------------------------------------------------- | |||
|
559 | ||||
|
560 | $ newrepo | |||
|
561 | $ echo a > a | |||
|
562 | $ hg add a | |||
|
563 | $ hg ci -m "added a" | |||
|
564 | $ echo b > b | |||
|
565 | $ hg add b | |||
|
566 | $ hg ci -m "added b" | |||
|
567 | ||||
|
568 | $ echo foobar > willconflict | |||
|
569 | $ hg add willconflict | |||
|
570 | $ hg ci -m "added willconflict" | |||
|
571 | $ echo c > c | |||
|
572 | $ hg add c | |||
|
573 | $ hg ci -m "added c" | |||
|
574 | ||||
|
575 | $ hg l | |||
|
576 | @ 3 added c | |||
|
577 | | c | |||
|
578 | o 2 added willconflict | |||
|
579 | | willconflict | |||
|
580 | o 1 added b | |||
|
581 | | b | |||
|
582 | o 0 added a | |||
|
583 | a | |||
|
584 | ||||
|
585 | $ hg up ".^^" | |||
|
586 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |||
|
587 | $ echo d > d | |||
|
588 | $ hg add d | |||
|
589 | $ hg ci -m "added d" | |||
|
590 | created new head | |||
|
591 | ||||
|
592 | $ echo barfoo > willconflict | |||
|
593 | $ hg add willconflict | |||
|
594 | $ hg ci --amend -m "added willconflict and d" | |||
|
595 | ||||
|
596 | $ hg l | |||
|
597 | @ 5 added willconflict and d | |||
|
598 | | d willconflict | |||
|
599 | | o 3 added c | |||
|
600 | | | c | |||
|
601 | | o 2 added willconflict | |||
|
602 | |/ willconflict | |||
|
603 | o 1 added b | |||
|
604 | | b | |||
|
605 | o 0 added a | |||
|
606 | a | |||
|
607 | ||||
|
608 | $ hg rebase -r . -d 2 -t :other | |||
|
609 | rebasing 5:5018b1509e94 "added willconflict and d" (tip) | |||
|
610 | ||||
|
611 | $ hg up 3 -q | |||
|
612 | $ hg l --hidden | |||
|
613 | o 6 added willconflict and d | |||
|
614 | | d willconflict | |||
|
615 | | x 5 added willconflict and d | |||
|
616 | | | d willconflict | |||
|
617 | | | x 4 added d | |||
|
618 | | |/ d | |||
|
619 | +---@ 3 added c | |||
|
620 | | | c | |||
|
621 | o | 2 added willconflict | |||
|
622 | |/ willconflict | |||
|
623 | o 1 added b | |||
|
624 | | b | |||
|
625 | o 0 added a | |||
|
626 | a | |||
|
627 | ||||
|
628 | Now if we trigger a merge between cset revision 3 and 6 using base revision 4, in this case | |||
|
629 | both the merging csets will be dirty as no one is descendent of base revision: | |||
|
630 | ||||
|
631 | $ hg graft -r 6 --base 4 --hidden 2>&1 | grep "AssertionError" | |||
|
632 | AssertionError | |||
|
633 |
General Comments 0
You need to be logged in to leave comments.
Login now