Show More
@@ -1,187 +1,218 b'' | |||||
1 |
|
1 | |||
2 | $ cat >> $HGRCPATH << EOF |
|
2 | $ cat >> $HGRCPATH << EOF | |
3 | > [experimental] |
|
3 | > [experimental] | |
4 | > copies.write-to=changeset-only |
|
4 | > copies.write-to=changeset-only | |
5 | > copies.read-from=changeset-only |
|
5 | > copies.read-from=changeset-only | |
6 | > [alias] |
|
6 | > [alias] | |
7 | > changesetcopies = log -r . -T 'files: {files} |
|
7 | > changesetcopies = log -r . -T 'files: {files} | |
8 | > {extras % "{ifcontains("files", key, "{key}: {value}\n")}"} |
|
8 | > {extras % "{ifcontains("files", key, "{key}: {value}\n")}"} | |
9 | > {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}' |
|
9 | > {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}' | |
10 | > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}' |
|
10 | > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}' | |
11 | > [extensions] |
|
11 | > [extensions] | |
12 | > rebase = |
|
12 | > rebase = | |
|
13 | > split = | |||
13 | > EOF |
|
14 | > EOF | |
14 |
|
15 | |||
15 | Check that copies are recorded correctly |
|
16 | Check that copies are recorded correctly | |
16 |
|
17 | |||
17 | $ hg init repo |
|
18 | $ hg init repo | |
18 | $ cd repo |
|
19 | $ cd repo | |
19 | $ echo a > a |
|
20 | $ echo a > a | |
20 | $ hg add a |
|
21 | $ hg add a | |
21 | $ hg ci -m initial |
|
22 | $ hg ci -m initial | |
22 | $ hg cp a b |
|
23 | $ hg cp a b | |
23 | $ hg cp a c |
|
24 | $ hg cp a c | |
24 | $ hg cp a d |
|
25 | $ hg cp a d | |
25 | $ hg ci -m 'copy a to b, c, and d' |
|
26 | $ hg ci -m 'copy a to b, c, and d' | |
26 | $ hg changesetcopies |
|
27 | $ hg changesetcopies | |
27 | files: b c d |
|
28 | files: b c d | |
28 | filesadded: 0 |
|
29 | filesadded: 0 | |
29 | 1 |
|
30 | 1 | |
30 | 2 |
|
31 | 2 | |
31 |
|
32 | |||
32 | p1copies: 0\x00a (esc) |
|
33 | p1copies: 0\x00a (esc) | |
33 | 1\x00a (esc) |
|
34 | 1\x00a (esc) | |
34 | 2\x00a (esc) |
|
35 | 2\x00a (esc) | |
35 | $ hg showcopies |
|
36 | $ hg showcopies | |
36 | a -> b |
|
37 | a -> b | |
37 | a -> c |
|
38 | a -> c | |
38 | a -> d |
|
39 | a -> d | |
39 | $ hg showcopies --config experimental.copies.read-from=compatibility |
|
40 | $ hg showcopies --config experimental.copies.read-from=compatibility | |
40 | a -> b |
|
41 | a -> b | |
41 | a -> c |
|
42 | a -> c | |
42 | a -> d |
|
43 | a -> d | |
43 | $ hg showcopies --config experimental.copies.read-from=filelog-only |
|
44 | $ hg showcopies --config experimental.copies.read-from=filelog-only | |
44 |
|
45 | |||
45 | Check that renames are recorded correctly |
|
46 | Check that renames are recorded correctly | |
46 |
|
47 | |||
47 | $ hg mv b b2 |
|
48 | $ hg mv b b2 | |
48 | $ hg ci -m 'rename b to b2' |
|
49 | $ hg ci -m 'rename b to b2' | |
49 | $ hg changesetcopies |
|
50 | $ hg changesetcopies | |
50 | files: b b2 |
|
51 | files: b b2 | |
51 | filesadded: 1 |
|
52 | filesadded: 1 | |
52 | filesremoved: 0 |
|
53 | filesremoved: 0 | |
53 |
|
54 | |||
54 | p1copies: 1\x00b (esc) |
|
55 | p1copies: 1\x00b (esc) | |
55 | $ hg showcopies |
|
56 | $ hg showcopies | |
56 | b -> b2 |
|
57 | b -> b2 | |
57 |
|
58 | |||
58 | Rename onto existing file. This should get recorded in the changeset files list and in the extras, |
|
59 | Rename onto existing file. This should get recorded in the changeset files list and in the extras, | |
59 | even though there is no filelog entry. |
|
60 | even though there is no filelog entry. | |
60 |
|
61 | |||
61 | $ hg cp b2 c --force |
|
62 | $ hg cp b2 c --force | |
62 | $ hg st --copies |
|
63 | $ hg st --copies | |
63 | M c |
|
64 | M c | |
64 | b2 |
|
65 | b2 | |
65 | $ hg debugindex c |
|
66 | $ hg debugindex c | |
66 | rev linkrev nodeid p1 p2 |
|
67 | rev linkrev nodeid p1 p2 | |
67 | 0 1 b789fdd96dc2 000000000000 000000000000 |
|
68 | 0 1 b789fdd96dc2 000000000000 000000000000 | |
68 | $ hg ci -m 'move b onto d' |
|
69 | $ hg ci -m 'move b onto d' | |
69 | $ hg changesetcopies |
|
70 | $ hg changesetcopies | |
70 | files: c |
|
71 | files: c | |
71 |
|
72 | |||
72 | p1copies: 0\x00b2 (esc) |
|
73 | p1copies: 0\x00b2 (esc) | |
73 | $ hg showcopies |
|
74 | $ hg showcopies | |
74 | b2 -> c |
|
75 | b2 -> c | |
75 | $ hg debugindex c |
|
76 | $ hg debugindex c | |
76 | rev linkrev nodeid p1 p2 |
|
77 | rev linkrev nodeid p1 p2 | |
77 | 0 1 b789fdd96dc2 000000000000 000000000000 |
|
78 | 0 1 b789fdd96dc2 000000000000 000000000000 | |
78 |
|
79 | |||
79 | Create a merge commit with copying done during merge. |
|
80 | Create a merge commit with copying done during merge. | |
80 |
|
81 | |||
81 | $ hg co 0 |
|
82 | $ hg co 0 | |
82 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
83 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
83 | $ hg cp a e |
|
84 | $ hg cp a e | |
84 | $ hg cp a f |
|
85 | $ hg cp a f | |
85 | $ hg ci -m 'copy a to e and f' |
|
86 | $ hg ci -m 'copy a to e and f' | |
86 | created new head |
|
87 | created new head | |
87 | $ hg merge 3 |
|
88 | $ hg merge 3 | |
88 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
89 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
89 | (branch merge, don't forget to commit) |
|
90 | (branch merge, don't forget to commit) | |
90 | File 'a' exists on both sides, so 'g' could be recorded as being from p1 or p2, but we currently |
|
91 | File 'a' exists on both sides, so 'g' could be recorded as being from p1 or p2, but we currently | |
91 | always record it as being from p1 |
|
92 | always record it as being from p1 | |
92 | $ hg cp a g |
|
93 | $ hg cp a g | |
93 | File 'd' exists only in p2, so 'h' should be from p2 |
|
94 | File 'd' exists only in p2, so 'h' should be from p2 | |
94 | $ hg cp d h |
|
95 | $ hg cp d h | |
95 | File 'f' exists only in p1, so 'i' should be from p1 |
|
96 | File 'f' exists only in p1, so 'i' should be from p1 | |
96 | $ hg cp f i |
|
97 | $ hg cp f i | |
97 | $ hg ci -m 'merge' |
|
98 | $ hg ci -m 'merge' | |
98 | $ hg changesetcopies |
|
99 | $ hg changesetcopies | |
99 | files: g h i |
|
100 | files: g h i | |
100 | filesadded: 0 |
|
101 | filesadded: 0 | |
101 | 1 |
|
102 | 1 | |
102 | 2 |
|
103 | 2 | |
103 |
|
104 | |||
104 | p1copies: 0\x00a (esc) |
|
105 | p1copies: 0\x00a (esc) | |
105 | 2\x00f (esc) |
|
106 | 2\x00f (esc) | |
106 | p2copies: 1\x00d (esc) |
|
107 | p2copies: 1\x00d (esc) | |
107 | $ hg showcopies |
|
108 | $ hg showcopies | |
108 | a -> g |
|
109 | a -> g | |
109 | d -> h |
|
110 | d -> h | |
110 | f -> i |
|
111 | f -> i | |
111 |
|
112 | |||
112 | Test writing to both changeset and filelog |
|
113 | Test writing to both changeset and filelog | |
113 |
|
114 | |||
114 | $ hg cp a j |
|
115 | $ hg cp a j | |
115 | $ hg ci -m 'copy a to j' --config experimental.copies.write-to=compatibility |
|
116 | $ hg ci -m 'copy a to j' --config experimental.copies.write-to=compatibility | |
116 | $ hg changesetcopies |
|
117 | $ hg changesetcopies | |
117 | files: j |
|
118 | files: j | |
118 | filesadded: 0 |
|
119 | filesadded: 0 | |
119 | filesremoved: |
|
120 | filesremoved: | |
120 |
|
121 | |||
121 | p1copies: 0\x00a (esc) |
|
122 | p1copies: 0\x00a (esc) | |
122 | p2copies: |
|
123 | p2copies: | |
123 | $ hg debugdata j 0 |
|
124 | $ hg debugdata j 0 | |
124 | \x01 (esc) |
|
125 | \x01 (esc) | |
125 | copy: a |
|
126 | copy: a | |
126 | copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 |
|
127 | copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 | |
127 | \x01 (esc) |
|
128 | \x01 (esc) | |
128 | a |
|
129 | a | |
129 | $ hg showcopies |
|
130 | $ hg showcopies | |
130 | a -> j |
|
131 | a -> j | |
131 | $ hg showcopies --config experimental.copies.read-from=compatibility |
|
132 | $ hg showcopies --config experimental.copies.read-from=compatibility | |
132 | a -> j |
|
133 | a -> j | |
133 | $ hg showcopies --config experimental.copies.read-from=filelog-only |
|
134 | $ hg showcopies --config experimental.copies.read-from=filelog-only | |
134 | a -> j |
|
135 | a -> j | |
135 | The entries should be written to extras even if they're empty (so the client |
|
136 | The entries should be written to extras even if they're empty (so the client | |
136 | won't have to fall back to reading from filelogs) |
|
137 | won't have to fall back to reading from filelogs) | |
137 | $ echo x >> j |
|
138 | $ echo x >> j | |
138 | $ hg ci -m 'modify j' --config experimental.copies.write-to=compatibility |
|
139 | $ hg ci -m 'modify j' --config experimental.copies.write-to=compatibility | |
139 | $ hg changesetcopies |
|
140 | $ hg changesetcopies | |
140 | files: j |
|
141 | files: j | |
141 | filesadded: |
|
142 | filesadded: | |
142 | filesremoved: |
|
143 | filesremoved: | |
143 |
|
144 | |||
144 | p1copies: |
|
145 | p1copies: | |
145 | p2copies: |
|
146 | p2copies: | |
146 |
|
147 | |||
147 | Test writing only to filelog |
|
148 | Test writing only to filelog | |
148 |
|
149 | |||
149 | $ hg cp a k |
|
150 | $ hg cp a k | |
150 | $ hg ci -m 'copy a to k' --config experimental.copies.write-to=filelog-only |
|
151 | $ hg ci -m 'copy a to k' --config experimental.copies.write-to=filelog-only | |
151 | $ hg changesetcopies |
|
152 | $ hg changesetcopies | |
152 | files: k |
|
153 | files: k | |
153 |
|
154 | |||
154 | $ hg debugdata k 0 |
|
155 | $ hg debugdata k 0 | |
155 | \x01 (esc) |
|
156 | \x01 (esc) | |
156 | copy: a |
|
157 | copy: a | |
157 | copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 |
|
158 | copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 | |
158 | \x01 (esc) |
|
159 | \x01 (esc) | |
159 | a |
|
160 | a | |
160 | $ hg showcopies |
|
161 | $ hg showcopies | |
161 | $ hg showcopies --config experimental.copies.read-from=compatibility |
|
162 | $ hg showcopies --config experimental.copies.read-from=compatibility | |
162 | a -> k |
|
163 | a -> k | |
163 | $ hg showcopies --config experimental.copies.read-from=filelog-only |
|
164 | $ hg showcopies --config experimental.copies.read-from=filelog-only | |
164 | a -> k |
|
165 | a -> k | |
165 |
|
166 | |||
166 | $ cd .. |
|
167 | $ cd .. | |
167 |
|
168 | |||
168 | Test rebasing a commit with copy information |
|
169 | Test rebasing a commit with copy information | |
169 |
|
170 | |||
170 | $ hg init rebase-rename |
|
171 | $ hg init rebase-rename | |
171 | $ cd rebase-rename |
|
172 | $ cd rebase-rename | |
172 | $ echo a > a |
|
173 | $ echo a > a | |
173 | $ hg ci -Aqm 'add a' |
|
174 | $ hg ci -Aqm 'add a' | |
174 | $ echo a2 > a |
|
175 | $ echo a2 > a | |
175 | $ hg ci -m 'modify a' |
|
176 | $ hg ci -m 'modify a' | |
176 | $ hg co -q 0 |
|
177 | $ hg co -q 0 | |
177 | $ hg mv a b |
|
178 | $ hg mv a b | |
178 | $ hg ci -qm 'rename a to b' |
|
179 | $ hg ci -qm 'rename a to b' | |
179 | $ hg rebase -d 1 --config rebase.experimental.inmemory=yes |
|
180 | $ hg rebase -d 1 --config rebase.experimental.inmemory=yes | |
180 | rebasing 2:fc7287ac5b9b "rename a to b" (tip) |
|
181 | rebasing 2:fc7287ac5b9b "rename a to b" (tip) | |
181 | merging a and b to b |
|
182 | merging a and b to b | |
182 | saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/fc7287ac5b9b-8f2a95ec-rebase.hg |
|
183 | saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/fc7287ac5b9b-8f2a95ec-rebase.hg | |
183 | $ hg st --change . --copies |
|
184 | $ hg st --change . --copies | |
184 | A b |
|
185 | A b | |
185 | a |
|
186 | a | |
186 | R a |
|
187 | R a | |
187 | $ cd .. |
|
188 | $ cd .. | |
|
189 | ||||
|
190 | Test splitting a commit | |||
|
191 | ||||
|
192 | $ hg init split | |||
|
193 | $ cd split | |||
|
194 | $ echo a > a | |||
|
195 | $ echo b > b | |||
|
196 | $ hg ci -Aqm 'add a and b' | |||
|
197 | $ echo a2 > a | |||
|
198 | $ hg mv b c | |||
|
199 | $ hg ci -m 'modify a, move b to c' | |||
|
200 | $ (hg --config ui.interactive=yes split 2>&1 | grep mercurial.error) <<EOF | |||
|
201 | > y | |||
|
202 | > y | |||
|
203 | > n | |||
|
204 | > y | |||
|
205 | > EOF | |||
|
206 | mercurial.error.ProgrammingError: some copy targets missing from file list | |||
|
207 | $ cd .. | |||
|
208 | ||||
|
209 | Test committing half a rename | |||
|
210 | ||||
|
211 | $ hg init partial | |||
|
212 | $ cd partial | |||
|
213 | $ echo a > a | |||
|
214 | $ hg ci -Aqm 'add a' | |||
|
215 | $ hg mv a b | |||
|
216 | $ hg ci -m 'remove a' a 2>&1 | grep mercurial.error | |||
|
217 | mercurial.error.ProgrammingError: some copy targets missing from file list | |||
|
218 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now