For now it is equivalent to the filelog case, but introducing this early helps
make the comings changesets clearer.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
For now it is equivalent to the filelog case, but introducing this early helps
make the comings changesets clearer.
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | tests/test-copies-in-changeset.t (127 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
90e1f5e0e7da | 5de940825704 | Pierre-Yves David | Oct 6 2019, 11:36 PM |
#testcases extra sidedata | |||||
#if extra | |||||
$ cat >> $HGRCPATH << EOF | $ cat >> $HGRCPATH << EOF | ||||
> [experimental] | > [experimental] | ||||
> copies.write-to=changeset-only | > copies.write-to=changeset-only | ||||
> copies.read-from=changeset-only | > copies.read-from=changeset-only | ||||
> [alias] | > [alias] | ||||
> changesetcopies = log -r . -T 'files: {files} | > changesetcopies = log -r . -T 'files: {files} | ||||
> {extras % "{ifcontains("files", key, "{key}: {value}\n")}"} | > {extras % "{ifcontains("files", key, "{key}: {value}\n")}"} | ||||
> {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}' | > {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}' | ||||
> EOF | |||||
#endif | |||||
#if sidedata | |||||
$ cat >> $HGRCPATH << EOF | |||||
> [format] | |||||
> exp-use-copies-side-data-changeset = yes | |||||
> EOF | |||||
#endif | |||||
$ cat >> $HGRCPATH << EOF | |||||
> [alias] | |||||
> showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}' | > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}' | ||||
> [extensions] | > [extensions] | ||||
> rebase = | > rebase = | ||||
> split = | > split = | ||||
> EOF | > EOF | ||||
Check that copies are recorded correctly | Check that copies are recorded correctly | ||||
$ hg init repo | $ hg init repo | ||||
$ cd repo | $ cd repo | ||||
#if sidedata | |||||
$ hg debugformat -v | |||||
format-variant repo config default | |||||
fncache: yes yes yes | |||||
dotencode: yes yes yes | |||||
generaldelta: yes yes yes | |||||
sparserevlog: yes yes yes | |||||
sidedata: yes yes no | |||||
copies-sdc: yes yes no | |||||
plain-cl-delta: yes yes yes | |||||
compression: zlib zlib zlib | |||||
compression-level: default default default | |||||
#else | |||||
$ hg debugformat -v | |||||
format-variant repo config default | |||||
fncache: yes yes yes | |||||
dotencode: yes yes yes | |||||
generaldelta: yes yes yes | |||||
sparserevlog: yes yes yes | |||||
sidedata: no no no | |||||
copies-sdc: no no no | |||||
plain-cl-delta: yes yes yes | |||||
compression: zlib zlib zlib | |||||
compression-level: default default default | |||||
#endif | |||||
$ echo a > a | $ echo a > a | ||||
$ hg add a | $ hg add a | ||||
$ hg ci -m initial | $ hg ci -m initial | ||||
$ hg cp a b | $ hg cp a b | ||||
$ hg cp a c | $ hg cp a c | ||||
$ hg cp a d | $ hg cp a d | ||||
$ hg ci -m 'copy a to b, c, and d' | $ hg ci -m 'copy a to b, c, and d' | ||||
#if extra | |||||
$ hg changesetcopies | $ hg changesetcopies | ||||
files: b c d | files: b c d | ||||
filesadded: 0 | filesadded: 0 | ||||
1 | 1 | ||||
2 | 2 | ||||
p1copies: 0\x00a (esc) | p1copies: 0\x00a (esc) | ||||
1\x00a (esc) | 1\x00a (esc) | ||||
2\x00a (esc) | 2\x00a (esc) | ||||
#endif | |||||
$ hg showcopies | $ hg showcopies | ||||
a -> b | a -> b | ||||
a -> c | a -> c | ||||
a -> d | a -> d | ||||
#if extra | |||||
$ hg showcopies --config experimental.copies.read-from=compatibility | $ hg showcopies --config experimental.copies.read-from=compatibility | ||||
a -> b | a -> b | ||||
a -> c | a -> c | ||||
a -> d | a -> d | ||||
$ hg showcopies --config experimental.copies.read-from=filelog-only | $ hg showcopies --config experimental.copies.read-from=filelog-only | ||||
#endif | |||||
Check that renames are recorded correctly | Check that renames are recorded correctly | ||||
$ hg mv b b2 | $ hg mv b b2 | ||||
$ hg ci -m 'rename b to b2' | $ hg ci -m 'rename b to b2' | ||||
#if extra | |||||
$ hg changesetcopies | $ hg changesetcopies | ||||
files: b b2 | files: b b2 | ||||
filesadded: 1 | filesadded: 1 | ||||
filesremoved: 0 | filesremoved: 0 | ||||
p1copies: 1\x00b (esc) | p1copies: 1\x00b (esc) | ||||
#endif | |||||
$ hg showcopies | $ hg showcopies | ||||
b -> b2 | b -> b2 | ||||
Rename onto existing file. This should get recorded in the changeset files list and in the extras, | Rename onto existing file. This should get recorded in the changeset files list and in the extras, | ||||
even though there is no filelog entry. | even though there is no filelog entry. | ||||
$ hg cp b2 c --force | $ hg cp b2 c --force | ||||
$ hg st --copies | $ hg st --copies | ||||
M c | M c | ||||
b2 | b2 | ||||
#if extra | |||||
$ hg debugindex c | $ hg debugindex c | ||||
rev linkrev nodeid p1 p2 | rev linkrev nodeid p1 p2 | ||||
0 1 b789fdd96dc2 000000000000 000000000000 | 0 1 b789fdd96dc2 000000000000 000000000000 | ||||
#else | |||||
$ hg debugindex c | |||||
rev linkrev nodeid p1 p2 | |||||
0 1 37d9b5d994ea 000000000000 000000000000 | |||||
#endif | |||||
$ hg ci -m 'move b onto d' | $ hg ci -m 'move b onto d' | ||||
#if extra | |||||
$ hg changesetcopies | $ hg changesetcopies | ||||
files: c | files: c | ||||
p1copies: 0\x00b2 (esc) | p1copies: 0\x00b2 (esc) | ||||
#endif | |||||
$ hg showcopies | $ hg showcopies | ||||
b2 -> c | b2 -> c | ||||
#if extra | |||||
$ hg debugindex c | $ hg debugindex c | ||||
rev linkrev nodeid p1 p2 | rev linkrev nodeid p1 p2 | ||||
0 1 b789fdd96dc2 000000000000 000000000000 | 0 1 b789fdd96dc2 000000000000 000000000000 | ||||
#else | |||||
$ hg debugindex c | |||||
rev linkrev nodeid p1 p2 | |||||
0 1 37d9b5d994ea 000000000000 000000000000 | |||||
1 3 029625640347 000000000000 000000000000 | |||||
#endif | |||||
Create a merge commit with copying done during merge. | Create a merge commit with copying done during merge. | ||||
$ hg co 0 | $ hg co 0 | ||||
0 files updated, 0 files merged, 3 files removed, 0 files unresolved | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved | ||||
$ hg cp a e | $ hg cp a e | ||||
$ hg cp a f | $ hg cp a f | ||||
$ hg ci -m 'copy a to e and f' | $ hg ci -m 'copy a to e and f' | ||||
created new head | created new head | ||||
$ hg merge 3 | $ hg merge 3 | ||||
3 files updated, 0 files merged, 0 files removed, 0 files unresolved | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
(branch merge, don't forget to commit) | (branch merge, don't forget to commit) | ||||
File 'a' exists on both sides, so 'g' could be recorded as being from p1 or p2, but we currently | File 'a' exists on both sides, so 'g' could be recorded as being from p1 or p2, but we currently | ||||
always record it as being from p1 | always record it as being from p1 | ||||
$ hg cp a g | $ hg cp a g | ||||
File 'd' exists only in p2, so 'h' should be from p2 | File 'd' exists only in p2, so 'h' should be from p2 | ||||
$ hg cp d h | $ hg cp d h | ||||
File 'f' exists only in p1, so 'i' should be from p1 | File 'f' exists only in p1, so 'i' should be from p1 | ||||
$ hg cp f i | $ hg cp f i | ||||
$ hg ci -m 'merge' | $ hg ci -m 'merge' | ||||
#if extra | |||||
$ hg changesetcopies | $ hg changesetcopies | ||||
files: g h i | files: g h i | ||||
filesadded: 0 | filesadded: 0 | ||||
1 | 1 | ||||
2 | 2 | ||||
p1copies: 0\x00a (esc) | p1copies: 0\x00a (esc) | ||||
2\x00f (esc) | 2\x00f (esc) | ||||
p2copies: 1\x00d (esc) | p2copies: 1\x00d (esc) | ||||
#endif | |||||
$ hg showcopies | $ hg showcopies | ||||
a -> g | a -> g | ||||
d -> h | d -> h | ||||
f -> i | f -> i | ||||
Test writing to both changeset and filelog | Test writing to both changeset and filelog | ||||
$ hg cp a j | $ hg cp a j | ||||
#if extra | |||||
$ hg ci -m 'copy a to j' --config experimental.copies.write-to=compatibility | $ hg ci -m 'copy a to j' --config experimental.copies.write-to=compatibility | ||||
$ hg changesetcopies | $ hg changesetcopies | ||||
files: j | files: j | ||||
filesadded: 0 | filesadded: 0 | ||||
filesremoved: | filesremoved: | ||||
p1copies: 0\x00a (esc) | p1copies: 0\x00a (esc) | ||||
p2copies: | p2copies: | ||||
#else | |||||
$ hg ci -m 'copy a to j' | |||||
#endif | |||||
$ hg debugdata j 0 | $ hg debugdata j 0 | ||||
\x01 (esc) | \x01 (esc) | ||||
copy: a | copy: a | ||||
copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 | copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 | ||||
\x01 (esc) | \x01 (esc) | ||||
a | a | ||||
$ hg showcopies | $ hg showcopies | ||||
a -> j | a -> j | ||||
$ hg showcopies --config experimental.copies.read-from=compatibility | $ hg showcopies --config experimental.copies.read-from=compatibility | ||||
a -> j | a -> j | ||||
$ hg showcopies --config experimental.copies.read-from=filelog-only | $ hg showcopies --config experimental.copies.read-from=filelog-only | ||||
a -> j | a -> j | ||||
Existing copy information in the changeset gets removed on amend and writing | Existing copy information in the changeset gets removed on amend and writing | ||||
copy information on to the filelog | copy information on to the filelog | ||||
#if extra | |||||
$ hg ci --amend -m 'copy a to j, v2' \ | $ hg ci --amend -m 'copy a to j, v2' \ | ||||
> --config experimental.copies.write-to=filelog-only | > --config experimental.copies.write-to=filelog-only | ||||
saved backup bundle to $TESTTMP/repo/.hg/strip-backup/dd7bb9581359-a6e6b6d2-amend.hg | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob) | ||||
$ hg changesetcopies | $ hg changesetcopies | ||||
files: j | files: j | ||||
#else | |||||
$ hg ci --amend -m 'copy a to j, v2' | |||||
saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob) | |||||
#endif | |||||
$ hg showcopies --config experimental.copies.read-from=filelog-only | $ hg showcopies --config experimental.copies.read-from=filelog-only | ||||
a -> j | a -> j | ||||
The entries should be written to extras even if they're empty (so the client | The entries should be written to extras even if they're empty (so the client | ||||
won't have to fall back to reading from filelogs) | won't have to fall back to reading from filelogs) | ||||
$ echo x >> j | $ echo x >> j | ||||
#if extra | |||||
$ hg ci -m 'modify j' --config experimental.copies.write-to=compatibility | $ hg ci -m 'modify j' --config experimental.copies.write-to=compatibility | ||||
$ hg changesetcopies | $ hg changesetcopies | ||||
files: j | files: j | ||||
filesadded: | filesadded: | ||||
filesremoved: | filesremoved: | ||||
p1copies: | p1copies: | ||||
p2copies: | p2copies: | ||||
#else | |||||
$ hg ci -m 'modify j' | |||||
#endif | |||||
Test writing only to filelog | Test writing only to filelog | ||||
$ hg cp a k | $ hg cp a k | ||||
#if extra | |||||
$ hg ci -m 'copy a to k' --config experimental.copies.write-to=filelog-only | $ hg ci -m 'copy a to k' --config experimental.copies.write-to=filelog-only | ||||
$ hg changesetcopies | $ hg changesetcopies | ||||
files: k | files: k | ||||
#else | |||||
$ hg ci -m 'copy a to k' | |||||
#endif | |||||
$ hg debugdata k 0 | $ hg debugdata k 0 | ||||
\x01 (esc) | \x01 (esc) | ||||
copy: a | copy: a | ||||
copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 | copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 | ||||
\x01 (esc) | \x01 (esc) | ||||
a | a | ||||
#if extra | |||||
$ hg showcopies | $ hg showcopies | ||||
$ hg showcopies --config experimental.copies.read-from=compatibility | $ hg showcopies --config experimental.copies.read-from=compatibility | ||||
a -> k | a -> k | ||||
$ hg showcopies --config experimental.copies.read-from=filelog-only | $ hg showcopies --config experimental.copies.read-from=filelog-only | ||||
a -> k | a -> k | ||||
#else | |||||
$ hg showcopies | |||||
a -> k | |||||
#endif | |||||
$ cd .. | $ cd .. | ||||
Test rebasing a commit with copy information | Test rebasing a commit with copy information | ||||
$ hg init rebase-rename | $ hg init rebase-rename | ||||
$ cd rebase-rename | $ cd rebase-rename | ||||
$ echo a > a | $ echo a > a | ||||
$ hg ci -Aqm 'add a' | $ hg ci -Aqm 'add a' | ||||
$ echo a2 > a | $ echo a2 > a | ||||
$ hg ci -m 'modify a' | $ hg ci -m 'modify a' | ||||
$ hg co -q 0 | $ hg co -q 0 | ||||
$ hg mv a b | $ hg mv a b | ||||
$ hg ci -qm 'rename a to b' | $ hg ci -qm 'rename a to b' | ||||
$ hg rebase -d 1 --config rebase.experimental.inmemory=yes | $ hg rebase -d 1 --config rebase.experimental.inmemory=yes | ||||
rebasing 2:fc7287ac5b9b "rename a to b" (tip) | rebasing 2:* "rename a to b" (tip) (glob) | ||||
merging a and b to b | merging a and b to b | ||||
saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/fc7287ac5b9b-8f2a95ec-rebase.hg | saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/*-*-rebase.hg (glob) | ||||
$ hg st --change . --copies | $ hg st --change . --copies | ||||
A b | A b | ||||
a | a | ||||
R a | R a | ||||
$ cd .. | $ cd .. | ||||
Test splitting a commit | Test splitting a commit | ||||
created new head | created new head | ||||
diff --git a/b b/c | diff --git a/b b/c | ||||
rename from b | rename from b | ||||
rename to c | rename to c | ||||
examine changes to 'b' and 'c'? | examine changes to 'b' and 'c'? | ||||
(enter ? for help) [Ynesfdaq?] y | (enter ? for help) [Ynesfdaq?] y | ||||
saved backup bundle to $TESTTMP/split/.hg/strip-backup/9a396d463e04-2d9e6864-split.hg | saved backup bundle to $TESTTMP/split/.hg/strip-backup/*-*-split.hg (glob) | ||||
$ cd .. | $ cd .. | ||||
Test committing half a rename | Test committing half a rename | ||||
$ hg init partial | $ hg init partial | ||||
$ cd partial | $ cd partial | ||||
$ echo a > a | $ echo a > a | ||||
$ hg ci -Aqm 'add a' | $ hg ci -Aqm 'add a' | ||||
$ hg mv a b | $ hg mv a b | ||||
$ hg ci -m 'remove a' a | $ hg ci -m 'remove a' a | ||||
$ cd .. | $ cd .. |