comparison tests/test-copies-in-changeset.t @ 42858:170b070ec6a5

tests: demonstrate crash when committing subset of copies to changeset When writing copy metadata to the changeset and not committing all copies in the dirstate, we get a ProgrammingError. This commit adds two tests showing how to trigger this bug. Differential Revision: https://phab.mercurial-scm.org/D6749
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 19 Aug 2019 12:30:02 -0700
parents 027f1567f97f
children 2b869a515ba6
comparison
equal deleted inserted replaced
42857:3316e59b0105 42858:170b070ec6a5
8 > {extras % "{ifcontains("files", key, "{key}: {value}\n")}"} 8 > {extras % "{ifcontains("files", key, "{key}: {value}\n")}"}
9 > {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}' 9 > {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}'
10 > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}' 10 > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}'
11 > [extensions] 11 > [extensions]
12 > rebase = 12 > rebase =
13 > split =
13 > EOF 14 > EOF
14 15
15 Check that copies are recorded correctly 16 Check that copies are recorded correctly
16 17
17 $ hg init repo 18 $ hg init repo
183 $ hg st --change . --copies 184 $ hg st --change . --copies
184 A b 185 A b
185 a 186 a
186 R a 187 R a
187 $ cd .. 188 $ cd ..
189
190 Test splitting a commit
191
192 $ hg init split
193 $ cd split
194 $ echo a > a
195 $ echo b > b
196 $ hg ci -Aqm 'add a and b'
197 $ echo a2 > a
198 $ hg mv b c
199 $ hg ci -m 'modify a, move b to c'
200 $ (hg --config ui.interactive=yes split 2>&1 | grep mercurial.error) <<EOF
201 > y
202 > y
203 > n
204 > y
205 > EOF
206 mercurial.error.ProgrammingError: some copy targets missing from file list
207 $ cd ..
208
209 Test committing half a rename
210
211 $ hg init partial
212 $ cd partial
213 $ echo a > a
214 $ hg ci -Aqm 'add a'
215 $ hg mv a b
216 $ hg ci -m 'remove a' a 2>&1 | grep mercurial.error
217 mercurial.error.ProgrammingError: some copy targets missing from file list
218 $ cd ..