##// END OF EJS Templates
tests: show invalid copies when turning off copies-in-changeset...
Martin von Zweigbergk -
r43126:6f027355 default
parent child Browse files
Show More
@@ -1,241 +1,255 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 > split =
14 > EOF
14 > EOF
15
15
16 Check that copies are recorded correctly
16 Check that copies are recorded correctly
17
17
18 $ hg init repo
18 $ hg init repo
19 $ cd repo
19 $ cd repo
20 $ echo a > a
20 $ echo a > a
21 $ hg add a
21 $ hg add a
22 $ hg ci -m initial
22 $ hg ci -m initial
23 $ hg cp a b
23 $ hg cp a b
24 $ hg cp a c
24 $ hg cp a c
25 $ hg cp a d
25 $ hg cp a d
26 $ hg ci -m 'copy a to b, c, and d'
26 $ hg ci -m 'copy a to b, c, and d'
27 $ hg changesetcopies
27 $ hg changesetcopies
28 files: b c d
28 files: b c d
29 filesadded: 0
29 filesadded: 0
30 1
30 1
31 2
31 2
32
32
33 p1copies: 0\x00a (esc)
33 p1copies: 0\x00a (esc)
34 1\x00a (esc)
34 1\x00a (esc)
35 2\x00a (esc)
35 2\x00a (esc)
36 $ hg showcopies
36 $ hg showcopies
37 a -> b
37 a -> b
38 a -> c
38 a -> c
39 a -> d
39 a -> d
40 $ hg showcopies --config experimental.copies.read-from=compatibility
40 $ hg showcopies --config experimental.copies.read-from=compatibility
41 a -> b
41 a -> b
42 a -> c
42 a -> c
43 a -> d
43 a -> d
44 $ hg showcopies --config experimental.copies.read-from=filelog-only
44 $ hg showcopies --config experimental.copies.read-from=filelog-only
45
45
46 Check that renames are recorded correctly
46 Check that renames are recorded correctly
47
47
48 $ hg mv b b2
48 $ hg mv b b2
49 $ hg ci -m 'rename b to b2'
49 $ hg ci -m 'rename b to b2'
50 $ hg changesetcopies
50 $ hg changesetcopies
51 files: b b2
51 files: b b2
52 filesadded: 1
52 filesadded: 1
53 filesremoved: 0
53 filesremoved: 0
54
54
55 p1copies: 1\x00b (esc)
55 p1copies: 1\x00b (esc)
56 $ hg showcopies
56 $ hg showcopies
57 b -> b2
57 b -> b2
58
58
59 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,
60 even though there is no filelog entry.
60 even though there is no filelog entry.
61
61
62 $ hg cp b2 c --force
62 $ hg cp b2 c --force
63 $ hg st --copies
63 $ hg st --copies
64 M c
64 M c
65 b2
65 b2
66 $ hg debugindex c
66 $ hg debugindex c
67 rev linkrev nodeid p1 p2
67 rev linkrev nodeid p1 p2
68 0 1 b789fdd96dc2 000000000000 000000000000
68 0 1 b789fdd96dc2 000000000000 000000000000
69 $ hg ci -m 'move b onto d'
69 $ hg ci -m 'move b onto d'
70 $ hg changesetcopies
70 $ hg changesetcopies
71 files: c
71 files: c
72
72
73 p1copies: 0\x00b2 (esc)
73 p1copies: 0\x00b2 (esc)
74 $ hg showcopies
74 $ hg showcopies
75 b2 -> c
75 b2 -> c
76 $ hg debugindex c
76 $ hg debugindex c
77 rev linkrev nodeid p1 p2
77 rev linkrev nodeid p1 p2
78 0 1 b789fdd96dc2 000000000000 000000000000
78 0 1 b789fdd96dc2 000000000000 000000000000
79
79
80 Create a merge commit with copying done during merge.
80 Create a merge commit with copying done during merge.
81
81
82 $ hg co 0
82 $ hg co 0
83 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
84 $ hg cp a e
84 $ hg cp a e
85 $ hg cp a f
85 $ hg cp a f
86 $ hg ci -m 'copy a to e and f'
86 $ hg ci -m 'copy a to e and f'
87 created new head
87 created new head
88 $ hg merge 3
88 $ hg merge 3
89 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
90 (branch merge, don't forget to commit)
90 (branch merge, don't forget to commit)
91 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
92 always record it as being from p1
92 always record it as being from p1
93 $ hg cp a g
93 $ hg cp a g
94 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
95 $ hg cp d h
95 $ hg cp d h
96 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
97 $ hg cp f i
97 $ hg cp f i
98 $ hg ci -m 'merge'
98 $ hg ci -m 'merge'
99 $ hg changesetcopies
99 $ hg changesetcopies
100 files: g h i
100 files: g h i
101 filesadded: 0
101 filesadded: 0
102 1
102 1
103 2
103 2
104
104
105 p1copies: 0\x00a (esc)
105 p1copies: 0\x00a (esc)
106 2\x00f (esc)
106 2\x00f (esc)
107 p2copies: 1\x00d (esc)
107 p2copies: 1\x00d (esc)
108 $ hg showcopies
108 $ hg showcopies
109 a -> g
109 a -> g
110 d -> h
110 d -> h
111 f -> i
111 f -> i
112
112
113 Test writing to both changeset and filelog
113 Test writing to both changeset and filelog
114
114
115 $ hg cp a j
115 $ hg cp a j
116 $ 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
117 $ hg changesetcopies
117 $ hg changesetcopies
118 files: j
118 files: j
119 filesadded: 0
119 filesadded: 0
120 filesremoved:
120 filesremoved:
121
121
122 p1copies: 0\x00a (esc)
122 p1copies: 0\x00a (esc)
123 p2copies:
123 p2copies:
124 $ hg debugdata j 0
124 $ hg debugdata j 0
125 \x01 (esc)
125 \x01 (esc)
126 copy: a
126 copy: a
127 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
127 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
128 \x01 (esc)
128 \x01 (esc)
129 a
129 a
130 $ hg showcopies
130 $ hg showcopies
131 a -> j
131 a -> j
132 $ hg showcopies --config experimental.copies.read-from=compatibility
132 $ hg showcopies --config experimental.copies.read-from=compatibility
133 a -> j
133 a -> j
134 $ hg showcopies --config experimental.copies.read-from=filelog-only
134 $ hg showcopies --config experimental.copies.read-from=filelog-only
135 a -> j
135 a -> j
136 Existing copy information in the changeset gets removed on amend and writing
137 copy information on to the filelog
138 $ hg ci --amend -m 'copy a to j, v2' \
139 > --config experimental.copies.write-to=filelog-only
140 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/dd7bb9581359-a6e6b6d2-amend.hg
141 $ hg changesetcopies
142 files: j
143 filesadded: 0
144 filesremoved:
145
146 p1copies: 0\x00a (esc)
147 p2copies:
148 $ hg showcopies --config experimental.copies.read-from=filelog-only
149 a -> j
136 The entries should be written to extras even if they're empty (so the client
150 The entries should be written to extras even if they're empty (so the client
137 won't have to fall back to reading from filelogs)
151 won't have to fall back to reading from filelogs)
138 $ echo x >> j
152 $ echo x >> j
139 $ hg ci -m 'modify j' --config experimental.copies.write-to=compatibility
153 $ hg ci -m 'modify j' --config experimental.copies.write-to=compatibility
140 $ hg changesetcopies
154 $ hg changesetcopies
141 files: j
155 files: j
142 filesadded:
156 filesadded:
143 filesremoved:
157 filesremoved:
144
158
145 p1copies:
159 p1copies:
146 p2copies:
160 p2copies:
147
161
148 Test writing only to filelog
162 Test writing only to filelog
149
163
150 $ hg cp a k
164 $ hg cp a k
151 $ hg ci -m 'copy a to k' --config experimental.copies.write-to=filelog-only
165 $ hg ci -m 'copy a to k' --config experimental.copies.write-to=filelog-only
152 $ hg changesetcopies
166 $ hg changesetcopies
153 files: k
167 files: k
154
168
155 $ hg debugdata k 0
169 $ hg debugdata k 0
156 \x01 (esc)
170 \x01 (esc)
157 copy: a
171 copy: a
158 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
172 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
159 \x01 (esc)
173 \x01 (esc)
160 a
174 a
161 $ hg showcopies
175 $ hg showcopies
162 $ hg showcopies --config experimental.copies.read-from=compatibility
176 $ hg showcopies --config experimental.copies.read-from=compatibility
163 a -> k
177 a -> k
164 $ hg showcopies --config experimental.copies.read-from=filelog-only
178 $ hg showcopies --config experimental.copies.read-from=filelog-only
165 a -> k
179 a -> k
166
180
167 $ cd ..
181 $ cd ..
168
182
169 Test rebasing a commit with copy information
183 Test rebasing a commit with copy information
170
184
171 $ hg init rebase-rename
185 $ hg init rebase-rename
172 $ cd rebase-rename
186 $ cd rebase-rename
173 $ echo a > a
187 $ echo a > a
174 $ hg ci -Aqm 'add a'
188 $ hg ci -Aqm 'add a'
175 $ echo a2 > a
189 $ echo a2 > a
176 $ hg ci -m 'modify a'
190 $ hg ci -m 'modify a'
177 $ hg co -q 0
191 $ hg co -q 0
178 $ hg mv a b
192 $ hg mv a b
179 $ hg ci -qm 'rename a to b'
193 $ hg ci -qm 'rename a to b'
180 $ hg rebase -d 1 --config rebase.experimental.inmemory=yes
194 $ hg rebase -d 1 --config rebase.experimental.inmemory=yes
181 rebasing 2:fc7287ac5b9b "rename a to b" (tip)
195 rebasing 2:fc7287ac5b9b "rename a to b" (tip)
182 merging a and b to b
196 merging a and b to b
183 saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/fc7287ac5b9b-8f2a95ec-rebase.hg
197 saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/fc7287ac5b9b-8f2a95ec-rebase.hg
184 $ hg st --change . --copies
198 $ hg st --change . --copies
185 A b
199 A b
186 a
200 a
187 R a
201 R a
188 $ cd ..
202 $ cd ..
189
203
190 Test splitting a commit
204 Test splitting a commit
191
205
192 $ hg init split
206 $ hg init split
193 $ cd split
207 $ cd split
194 $ echo a > a
208 $ echo a > a
195 $ echo b > b
209 $ echo b > b
196 $ hg ci -Aqm 'add a and b'
210 $ hg ci -Aqm 'add a and b'
197 $ echo a2 > a
211 $ echo a2 > a
198 $ hg mv b c
212 $ hg mv b c
199 $ hg ci -m 'modify a, move b to c'
213 $ hg ci -m 'modify a, move b to c'
200 $ hg --config ui.interactive=yes split <<EOF
214 $ hg --config ui.interactive=yes split <<EOF
201 > y
215 > y
202 > y
216 > y
203 > n
217 > n
204 > y
218 > y
205 > EOF
219 > EOF
206 diff --git a/a b/a
220 diff --git a/a b/a
207 1 hunks, 1 lines changed
221 1 hunks, 1 lines changed
208 examine changes to 'a'?
222 examine changes to 'a'?
209 (enter ? for help) [Ynesfdaq?] y
223 (enter ? for help) [Ynesfdaq?] y
210
224
211 @@ -1,1 +1,1 @@
225 @@ -1,1 +1,1 @@
212 -a
226 -a
213 +a2
227 +a2
214 record this change to 'a'?
228 record this change to 'a'?
215 (enter ? for help) [Ynesfdaq?] y
229 (enter ? for help) [Ynesfdaq?] y
216
230
217 diff --git a/b b/c
231 diff --git a/b b/c
218 rename from b
232 rename from b
219 rename to c
233 rename to c
220 examine changes to 'b' and 'c'?
234 examine changes to 'b' and 'c'?
221 (enter ? for help) [Ynesfdaq?] n
235 (enter ? for help) [Ynesfdaq?] n
222
236
223 created new head
237 created new head
224 diff --git a/b b/c
238 diff --git a/b b/c
225 rename from b
239 rename from b
226 rename to c
240 rename to c
227 examine changes to 'b' and 'c'?
241 examine changes to 'b' and 'c'?
228 (enter ? for help) [Ynesfdaq?] y
242 (enter ? for help) [Ynesfdaq?] y
229
243
230 saved backup bundle to $TESTTMP/split/.hg/strip-backup/9a396d463e04-2d9e6864-split.hg
244 saved backup bundle to $TESTTMP/split/.hg/strip-backup/9a396d463e04-2d9e6864-split.hg
231 $ cd ..
245 $ cd ..
232
246
233 Test committing half a rename
247 Test committing half a rename
234
248
235 $ hg init partial
249 $ hg init partial
236 $ cd partial
250 $ cd partial
237 $ echo a > a
251 $ echo a > a
238 $ hg ci -Aqm 'add a'
252 $ hg ci -Aqm 'add a'
239 $ hg mv a b
253 $ hg mv a b
240 $ hg ci -m 'remove a' a
254 $ hg ci -m 'remove a' a
241 $ cd ..
255 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now