annotate tests/test-copies-in-changeset.t @ 42860:6f0273558c4b

tests: show invalid copies when turning off copies-in-changeset If you turn on copies in changesets and write a commit with a copy, then turn it off and amend the commit while undoing the copy, the invalid copy information will remain. The read path doesn't crash in invalid copy data, but it seems better to not produce the invalid data. Differential Revision: https://phab.mercurial-scm.org/D6751
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 16 Jul 2019 21:15:35 -0700
parents 2b869a515ba6
children 57ea0a81a65c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
1
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
2 $ cat >> $HGRCPATH << EOF
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
3 > [experimental]
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
4 > copies.write-to=changeset-only
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
5 > copies.read-from=changeset-only
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
6 > [alias]
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
7 > changesetcopies = log -r . -T 'files: {files}
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
8 > {extras % "{ifcontains("files", key, "{key}: {value}\n")}"}
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
9 > {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}'
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
10 > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}'
42289
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
11 > [extensions]
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
12 > rebase =
42858
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
13 > split =
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
14 > EOF
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
15
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
16 Check that copies are recorded correctly
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
17
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
18 $ hg init repo
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
19 $ cd repo
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
20 $ echo a > a
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
21 $ hg add a
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
22 $ hg ci -m initial
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
23 $ hg cp a b
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
24 $ hg cp a c
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
25 $ hg cp a d
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
26 $ hg ci -m 'copy a to b, c, and d'
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
27 $ hg changesetcopies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
28 files: b c d
42427
027f1567f97f copies: separate added/removed files by newline instead of null
Martin von Zweigbergk <martinvonz@google.com>
parents: 42426
diff changeset
29 filesadded: 0
027f1567f97f copies: separate added/removed files by newline instead of null
Martin von Zweigbergk <martinvonz@google.com>
parents: 42426
diff changeset
30 1
027f1567f97f copies: separate added/removed files by newline instead of null
Martin von Zweigbergk <martinvonz@google.com>
parents: 42426
diff changeset
31 2
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
32
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
33 p1copies: 0\x00a (esc)
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
34 1\x00a (esc)
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
35 2\x00a (esc)
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
36 $ hg showcopies
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
37 a -> b
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
38 a -> c
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
39 a -> d
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
40 $ hg showcopies --config experimental.copies.read-from=compatibility
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
41 a -> b
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
42 a -> c
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
43 a -> d
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
44 $ hg showcopies --config experimental.copies.read-from=filelog-only
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
45
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
46 Check that renames are recorded correctly
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
47
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
48 $ hg mv b b2
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
49 $ hg ci -m 'rename b to b2'
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
50 $ hg changesetcopies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
51 files: b b2
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
52 filesadded: 1
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
53 filesremoved: 0
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
54
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
55 p1copies: 1\x00b (esc)
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
56 $ hg showcopies
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
57 b -> b2
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
58
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
59 Rename onto existing file. This should get recorded in the changeset files list and in the extras,
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
60 even though there is no filelog entry.
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
61
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
62 $ hg cp b2 c --force
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
63 $ hg st --copies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
64 M c
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
65 b2
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
66 $ hg debugindex c
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
67 rev linkrev nodeid p1 p2
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
68 0 1 b789fdd96dc2 000000000000 000000000000
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
69 $ hg ci -m 'move b onto d'
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
70 $ hg changesetcopies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
71 files: c
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
72
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
73 p1copies: 0\x00b2 (esc)
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
74 $ hg showcopies
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
75 b2 -> c
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
76 $ hg debugindex c
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
77 rev linkrev nodeid p1 p2
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
78 0 1 b789fdd96dc2 000000000000 000000000000
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
79
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
80 Create a merge commit with copying done during merge.
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
81
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
82 $ hg co 0
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
83 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
84 $ hg cp a e
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
85 $ hg cp a f
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
86 $ hg ci -m 'copy a to e and f'
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
87 created new head
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
88 $ hg merge 3
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
89 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
90 (branch merge, don't forget to commit)
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
91 File 'a' exists on both sides, so 'g' could be recorded as being from p1 or p2, but we currently
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
92 always record it as being from p1
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
93 $ hg cp a g
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
94 File 'd' exists only in p2, so 'h' should be from p2
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
95 $ hg cp d h
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
96 File 'f' exists only in p1, so 'i' should be from p1
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
97 $ hg cp f i
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
98 $ hg ci -m 'merge'
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
99 $ hg changesetcopies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
100 files: g h i
42427
027f1567f97f copies: separate added/removed files by newline instead of null
Martin von Zweigbergk <martinvonz@google.com>
parents: 42426
diff changeset
101 filesadded: 0
027f1567f97f copies: separate added/removed files by newline instead of null
Martin von Zweigbergk <martinvonz@google.com>
parents: 42426
diff changeset
102 1
027f1567f97f copies: separate added/removed files by newline instead of null
Martin von Zweigbergk <martinvonz@google.com>
parents: 42426
diff changeset
103 2
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
104
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
105 p1copies: 0\x00a (esc)
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
106 2\x00f (esc)
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
107 p2copies: 1\x00d (esc)
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
108 $ hg showcopies
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
109 a -> g
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
110 d -> h
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
111 f -> i
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
112
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
113 Test writing to both changeset and filelog
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
114
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
115 $ hg cp a j
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
116 $ hg ci -m 'copy a to j' --config experimental.copies.write-to=compatibility
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
117 $ hg changesetcopies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
118 files: j
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
119 filesadded: 0
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
120 filesremoved:
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
121
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
122 p1copies: 0\x00a (esc)
42300
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
123 p2copies:
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
124 $ hg debugdata j 0
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
125 \x01 (esc)
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
126 copy: a
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
127 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
128 \x01 (esc)
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
129 a
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
130 $ hg showcopies
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
131 a -> j
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
132 $ hg showcopies --config experimental.copies.read-from=compatibility
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
133 a -> j
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
134 $ hg showcopies --config experimental.copies.read-from=filelog-only
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
135 a -> j
42860
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
136 Existing copy information in the changeset gets removed on amend and writing
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
137 copy information on to the filelog
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
138 $ hg ci --amend -m 'copy a to j, v2' \
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
139 > --config experimental.copies.write-to=filelog-only
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
140 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/dd7bb9581359-a6e6b6d2-amend.hg
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
141 $ hg changesetcopies
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
142 files: j
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
143 filesadded: 0
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
144 filesremoved:
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
145
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
146 p1copies: 0\x00a (esc)
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
147 p2copies:
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
148 $ hg showcopies --config experimental.copies.read-from=filelog-only
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
149 a -> j
42300
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
150 The entries should be written to extras even if they're empty (so the client
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
151 won't have to fall back to reading from filelogs)
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
152 $ echo x >> j
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
153 $ hg ci -m 'modify j' --config experimental.copies.write-to=compatibility
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
154 $ hg changesetcopies
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
155 files: j
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
156 filesadded:
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
157 filesremoved:
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
158
42300
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
159 p1copies:
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
160 p2copies:
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
161
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
162 Test writing only to filelog
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
163
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
164 $ hg cp a k
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
165 $ hg ci -m 'copy a to k' --config experimental.copies.write-to=filelog-only
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
166 $ hg changesetcopies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
167 files: k
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
168
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
169 $ hg debugdata k 0
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
170 \x01 (esc)
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
171 copy: a
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
172 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
173 \x01 (esc)
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
174 a
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
175 $ hg showcopies
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
176 $ hg showcopies --config experimental.copies.read-from=compatibility
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
177 a -> k
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
178 $ hg showcopies --config experimental.copies.read-from=filelog-only
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
179 a -> k
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
180
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
181 $ cd ..
42289
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
182
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
183 Test rebasing a commit with copy information
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
184
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
185 $ hg init rebase-rename
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
186 $ cd rebase-rename
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
187 $ echo a > a
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
188 $ hg ci -Aqm 'add a'
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
189 $ echo a2 > a
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
190 $ hg ci -m 'modify a'
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
191 $ hg co -q 0
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
192 $ hg mv a b
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
193 $ hg ci -qm 'rename a to b'
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
194 $ hg rebase -d 1 --config rebase.experimental.inmemory=yes
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
195 rebasing 2:fc7287ac5b9b "rename a to b" (tip)
42289
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
196 merging a and b to b
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
197 saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/fc7287ac5b9b-8f2a95ec-rebase.hg
42289
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
198 $ hg st --change . --copies
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
199 A b
42291
a13b30555ffb context: reuse changectx._copies() in all but workingctx
Martin von Zweigbergk <martinvonz@google.com>
parents: 42289
diff changeset
200 a
42289
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
201 R a
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
202 $ cd ..
42858
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
203
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
204 Test splitting a commit
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
205
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
206 $ hg init split
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
207 $ cd split
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
208 $ echo a > a
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
209 $ echo b > b
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
210 $ hg ci -Aqm 'add a and b'
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
211 $ echo a2 > a
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
212 $ hg mv b c
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
213 $ hg ci -m 'modify a, move b to c'
42859
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
214 $ hg --config ui.interactive=yes split <<EOF
42858
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
215 > y
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
216 > y
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
217 > n
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
218 > y
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
219 > EOF
42859
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
220 diff --git a/a b/a
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
221 1 hunks, 1 lines changed
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
222 examine changes to 'a'?
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
223 (enter ? for help) [Ynesfdaq?] y
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
224
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
225 @@ -1,1 +1,1 @@
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
226 -a
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
227 +a2
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
228 record this change to 'a'?
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
229 (enter ? for help) [Ynesfdaq?] y
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
230
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
231 diff --git a/b b/c
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
232 rename from b
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
233 rename to c
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
234 examine changes to 'b' and 'c'?
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
235 (enter ? for help) [Ynesfdaq?] n
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
236
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
237 created new head
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
238 diff --git a/b b/c
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
239 rename from b
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
240 rename to c
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
241 examine changes to 'b' and 'c'?
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
242 (enter ? for help) [Ynesfdaq?] y
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
243
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
244 saved backup bundle to $TESTTMP/split/.hg/strip-backup/9a396d463e04-2d9e6864-split.hg
42858
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
245 $ cd ..
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
246
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
247 Test committing half a rename
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
248
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
249 $ hg init partial
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
250 $ cd partial
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
251 $ echo a > a
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
252 $ hg ci -Aqm 'add a'
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
253 $ hg mv a b
42859
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
254 $ hg ci -m 'remove a' a
42858
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
255 $ cd ..