Mercurial > hg
diff tests/test-copies.t @ 41755:a4358f7345b4
context: introduce p[12]copies() methods and debugp[12]copies commands
As mentioned earlier, I'm working on support for storing copy metadata
in the changeset instead of in the filelog.
In order to transition a repo from storing metadata in filelogs to
storing it in the changeset, I'm going to provide a config option for
reading the metadata from the changeset, but falling back to getting
it from the filelog if it's not in the changeset. In this compatiblity
mode, the changeset-optmized algorithms will be used. We will then
need to convert the filelog copy metadata to look like that provided
by changeset copy metadata. This patch introduces methods that do just
that.
By having these methods here, we can start writing changeset-optimized
algorithms that should work already before we add any support for
storing the metadata in the changesets.
This commit also includes new debugp[12]copies commands and exercises
them in test-copies.t.
Differential Revision: https://phab.mercurial-scm.org/D5990
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 18 Jan 2019 13:13:30 -0800 |
parents | d5edb5d3a337 |
children | 49ad315b39ee |
line wrap: on
line diff
--- a/tests/test-copies.t Thu Feb 14 22:46:18 2019 -0800 +++ b/tests/test-copies.t Fri Jan 18 13:13:30 2019 -0800 @@ -17,12 +17,17 @@ $ echo x > x $ hg ci -Aqm 'add x' $ hg mv x y + $ hg debugp1copies + x -> y + $ hg debugp2copies $ hg ci -m 'rename x to y' $ hg l @ 1 rename x to y | x y o 0 add x x + $ hg debugp1copies -r 1 + x -> y $ hg debugpathcopies 0 1 x -> y $ hg debugpathcopies 1 0 @@ -41,12 +46,17 @@ $ echo y > y $ hg ci -Aqm 'add x and y' $ hg cp -f x y + $ hg debugp1copies + x -> y + $ hg debugp2copies $ hg ci -m 'copy x onto y' $ hg l @ 1 copy x onto y | y o 0 add x and y x y + $ hg debugp1copies -r 1 + x -> y Incorrectly doesn't show the rename $ hg debugpathcopies 0 1 @@ -63,6 +73,8 @@ | x2 o 0 add x and x2 with same content x x2 + $ hg debugp1copies -r 1 + x -> x2 Incorrectly doesn't show the rename $ hg debugpathcopies 0 1 @@ -85,6 +97,8 @@ | y o 0 add x x + $ hg debugp1copies -r 3 + x -> y $ hg debugpathcopies 0 3 x -> y @@ -93,6 +107,9 @@ $ echo x > x $ hg ci -Aqm 'add x' $ hg mv x y + $ hg debugp1copies + x -> y + $ hg debugp2copies $ hg ci -m 'rename x to y' $ hg mv y z $ hg ci -m 'rename y to z' @@ -129,6 +146,7 @@ | x y o 0 add x x + $ hg debugp1copies -r 3 $ hg debugpathcopies 0 3 Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy metadata in the @@ -153,6 +171,8 @@ | z o 0 add x and x2 with same content x x2 + $ hg debugp1copies -r 3 + x2 -> z $ hg debugpathcopies 0 3 x2 -> z @@ -225,6 +245,8 @@ $ echo z > z $ hg ci -Aqm 'add z' $ hg merge -q 1 + $ hg debugp1copies + $ hg debugp2copies $ hg ci -m 'merge rename from p2' $ hg l @ 3 merge rename from p2 @@ -237,6 +259,8 @@ x Perhaps we should indicate the rename here, but `hg status` is documented to be weird during merges, so... + $ hg debugp1copies -r 3 + $ hg debugp2copies -r 3 $ hg debugpathcopies 0 3 x -> y $ hg debugpathcopies 1 2 @@ -254,10 +278,16 @@ $ hg ci -Aqm 'add y' $ hg merge -q 0 $ hg cp y z + $ hg debugp1copies + y -> z + $ hg debugp2copies $ hg ci -m 'copy file from p1 in merge' $ hg co -q 1 $ hg merge -q 0 $ hg cp x z + $ hg debugp1copies + $ hg debugp2copies + x -> z $ hg ci -qm 'copy file from p2 in merge' $ hg l @ 3 copy file from p2 in merge @@ -268,9 +298,15 @@ | y o 0 add x x + $ hg debugp1copies -r 2 + y -> z + $ hg debugp2copies -r 2 $ hg debugpathcopies 1 2 y -> z $ hg debugpathcopies 0 2 + $ hg debugp1copies -r 3 + $ hg debugp2copies -r 3 + x -> z $ hg debugpathcopies 1 3 $ hg debugpathcopies 0 3 x -> z @@ -284,6 +320,9 @@ $ hg ci -Aqm 'add x on branch 2' $ hg merge -q 0 $ hg cp x z + $ hg debugp1copies + x -> z + $ hg debugp2copies $ hg ci -qm 'merge' $ hg l @ 2 merge @@ -292,6 +331,9 @@ | x o 0 add x on branch 1 x + $ hg debugp1copies -r 2 + x -> z + $ hg debugp2copies -r 2 It's a little weird that it shows up on both sides $ hg debugpathcopies 1 2 x -> z @@ -312,6 +354,9 @@ $ hg resolve -m x (no more unresolved files) $ hg cp x z + $ hg debugp1copies + x -> z + $ hg debugp2copies $ hg ci -qm 'merge' $ hg l @ 2 merge @@ -320,6 +365,9 @@ | x o 0 add x on branch 1 x + $ hg debugp1copies -r 2 + $ hg debugp2copies -r 2 + x -> z $ hg debugpathcopies 1 2 $ hg debugpathcopies 0 2 x -> z @@ -345,6 +393,8 @@ |/ y o 0 add x x + $ hg debugp1copies -r 3 + $ hg debugp2copies -r 3 $ hg debugpathcopies 2 3 x -> y $ hg debugpathcopies 1 3 @@ -375,6 +425,9 @@ |/ y o 0 add x x + $ hg debugp1copies -r 3 + y -> z + $ hg debugp2copies -r 3 $ hg debugpathcopies 2 3 y -> z $ hg debugpathcopies 1 3