comparison tests/test-copies.t @ 46689:2803f94b7431

copies: filter out copies grafted from another branch Consider this simple history: ``` @ 3 modify y | o 2 copy x to y, modify x | | o 1 copy x to y, modify x |/ o 0 add x ``` If we now rebase commit 3 onto 1, Mercurial will look for copies between commit 2 and commit 1. It does that by going backwards from 2 to 0 and then forwards from 0 to 1. It will find that x was copied to y, since that was what happened on the path between them (namely in commit 1). That leads Mercurial to do a 3-way merge between y@3 and y@1 with x@2 as base. We want to use y@2 as base instead. That's also what happened until commit 1d6d1a15. This patch fixes the regression by adding another filtering step when chaining copies via a diffbase. The new filtering step removes copies that were the same between the two branches (same source and destination, but not necessarily the same contents). Differential Revision: https://phab.mercurial-scm.org/D10120
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 04 Mar 2021 08:20:19 -0800
parents 86ee73018e62
children
comparison
equal deleted inserted replaced
46688:324ded1aa2ab 46689:2803f94b7431
396 x 396 x
397 $ hg debugp1copies -r 1 397 $ hg debugp1copies -r 1
398 x -> y 398 x -> y
399 $ hg debugp1copies -r 2 399 $ hg debugp1copies -r 2
400 x -> y 400 x -> y
401 BROKEN: These two should not report any copies
402 $ hg debugpathcopies 1 2 401 $ hg debugpathcopies 1 2
403 x -> y
404 $ hg debugpathcopies 2 1 402 $ hg debugpathcopies 2 1
405 x -> y
406 403
407 Copy x to y on one side of merge, create y and rename to z on the other side. 404 Copy x to y on one side of merge, create y and rename to z on the other side.
408 $ newrepo 405 $ newrepo
409 $ echo x > x 406 $ echo x > x
410 $ hg ci -Aqm 'add x' 407 $ hg ci -Aqm 'add x'