annotate tests/test-copies-in-changeset.t @ 42861:57ea0a81a65c

copies: remove existing copy info from the changeset on amend (BC) When amending a changeset with copy information in the changeset and the new changeset doesn't have any copy information (or similar for "filesadded" and "filesremoved"), we shouldn't keep it. A drawback of this is that we now unconditionally remove these four entries from the extras, breaking any extensions that happened to write entries with the same names (which seems very unlikely). I think I'd heard that there was list of blacklisted keys that would be removed from the extras when a commit is rewritten, but I couldn't find that. It would make sense to add the keys mentioned above there instead of the custom filtering I've added in this patch. Differential Revision: https://phab.mercurial-scm.org/D6752
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 16 Jul 2019 21:15:39 -0700
parents 6f0273558c4b
children 52781d57313d
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
6f0273558c4b tests: show invalid copies when turning off copies-in-changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42859
diff changeset
144 $ 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
145 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
146 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
147 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
148 $ 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
149 $ 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
150 $ hg changesetcopies
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
151 files: j
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
152 filesadded:
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
153 filesremoved:
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
154
42300
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
155 p1copies:
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
156 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
157
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
158 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
159
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
160 $ 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
161 $ 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
162 $ 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
163 files: k
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
164
42141
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 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
166 \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
167 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
168 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
169 \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
170 a
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
171 $ hg showcopies
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
172 $ 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
173 a -> k
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
174 $ 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
175 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
176
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
177 $ cd ..
42289
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
178
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
179 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
180
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
181 $ hg init rebase-rename
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
182 $ cd rebase-rename
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
183 $ echo a > a
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
184 $ 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
185 $ echo a2 > a
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
186 $ 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
187 $ hg co -q 0
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
188 $ hg mv a b
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
189 $ 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
190 $ 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
191 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
192 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
193 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
194 $ hg st --change . --copies
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
195 A b
42291
a13b30555ffb context: reuse changectx._copies() in all but workingctx
Martin von Zweigbergk <martinvonz@google.com>
parents: 42289
diff changeset
196 a
42289
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
197 R a
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
198 $ cd ..
42858
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
199
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
200 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
201
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
202 $ hg init split
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
203 $ cd split
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
204 $ echo a > a
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
205 $ echo b > b
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
206 $ 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
207 $ echo a2 > a
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
208 $ 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
209 $ 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
210 $ 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
211 > y
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
212 > y
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
213 > n
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
214 > y
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
215 > EOF
42859
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
216 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
217 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
218 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
219 (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
220
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
221 @@ -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
222 -a
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
223 +a2
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
224 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
225 (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
226
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
227 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
228 rename from b
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
229 rename to c
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
230 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
231 (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
232
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
233 created new head
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
234 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
235 rename from b
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
236 rename to c
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
237 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
238 (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
239
2b869a515ba6 context: filter out invalid copies from workingctx.p[12]copies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 42858
diff changeset
240 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
241 $ cd ..
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
242
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
243 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
244
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
245 $ hg init partial
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
246 $ cd partial
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
247 $ echo a > a
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
248 $ 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
249 $ 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
250 $ 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
251 $ cd ..