mutation: update amend tests to use mutation and visibility

Summary:
Update all amend tests to use mutation and visibility.  For these tests, `mutation.record`
is disabled so that hashes do not change.

Most tests pass as-is.  A few tests have changes which are the results of slight behavioural
changes or bug-fixes compared with obsmarkers.

Reviewed By: quark-zju

Differential Revision: D19413580

fbshipit-source-id: 18696a08db69130b08f829366659783df4c9bcc1
This commit is contained in:
Mark Thomas 2020-01-16 01:01:10 -08:00 committed by Facebook Github Bot
parent 05f1ef73b2
commit 2815d67f41
22 changed files with 97 additions and 366 deletions

View File

@ -1,13 +1,7 @@
#chg-compatible
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> amend=
> rebase=
> [experimental]
> evolution = createmarkers, allowunstable
> EOF
$ enable mutation-norecord amend rebase
$ reset() {
> cd ..
> rm -rf repo

View File

@ -1,217 +0,0 @@
#chg-compatible
$ cat >> $HGRCPATH << EOF
> [extensions]
> amend=
> [experimental]
> evolution = all
> EOF
$ hg init
$ drawdag <<'EOS'
> B C # amend: B -> C
> |/
> A
> EOS
$ hg log -G -T '{rev} {desc}\n'
o 2 C
|
o 0 A
$ hg log -G -T '{rev} {desc}\n' --hidden
o 2 C
|
| x 1 B
|/
o 0 A
Changing working copy parent pins a node
$ hg update 1 --hidden -q
$ hg update 0 -q
$ hg log -G -T '{rev} {desc}\n'
o 2 C
|
| x 1 B
|/
@ 0 A
Strip/prune unpins a node
$ hg prune 1 -q
hint[strip-hide]: 'hg strip' may be deprecated in the future - use 'hg hide' instead
hint[hint-ack]: use 'hg hint --ack strip-hide' to silence these hints
$ hg log -G -T '{rev} {desc}\n'
o 2 C
|
@ 0 A
Bookmark pins nodes even after removed
$ hg bookmark -ir 1 BOOK --hidden -q
$ hg bookmark -d BOOK -q
$ hg log -G -T '{rev} {desc}\n'
o 2 C
|
| x 1 B
|/
@ 0 A
Check blackbox logs
$ hg blackbox --no-timestamp --no-sid --pattern '{"legacy_log":{"service":["or","command","command_finish","pinnednodes"]}}'
[legacy][command] debugdrawdag
[legacy][pinnednodes] pinnednodes: ['debugdrawdag'] newpin=['112478962961'] newunpin=['112478962961'] before=[] after=[]
[legacy][command_finish] debugdrawdag exited 0 after 0.00 seconds
[legacy][command] bookmarks -T '{bookmark}={node}\n'
[legacy][command_finish] bookmarks -T '{bookmark}={node}\n' exited 0 after 0.00 seconds
[legacy][command] book -T '{bookmark} '
[legacy][command_finish] book -T '{bookmark} ' exited 0 after 0.00 seconds
[legacy][command] book -fd A B C
[legacy][command_finish] book -fd A B C exited 0 after 0.00 seconds
[legacy][command] log -G -T '{rev} {desc}\n'
[legacy][command_finish] log -G -T '{rev} {desc}\n' exited 0 after 0.00 seconds
[legacy][command] log -G -T '{rev} {desc}\n' --hidden
[legacy][command_finish] log -G -T '{rev} {desc}\n' --hidden exited 0 after 0.00 seconds
[legacy][command] update 1 --hidden -q
[legacy][pinnednodes] pinnednodes: ['update', '1', '--hidden', '-q'] newpin=['112478962961'] newunpin=[] before=[] after=['112478962961']
[legacy][command_finish] update 1 --hidden -q exited 0 after 0.00 seconds
[legacy][command] update 0 -q
[legacy][command_finish] update 0 -q exited 0 after 0.00 seconds
[legacy][command] log -G -T '{rev} {desc}\n'
[legacy][command_finish] log -G -T '{rev} {desc}\n' exited 0 after 0.00 seconds
[legacy][command] prune 1 -q
[legacy][pinnednodes] pinnednodes: ['prune', '1', '-q'] newpin=[] newunpin=['112478962961'] before=['112478962961'] after=[]
[legacy][command_finish] prune 1 -q exited 0 after 0.00 seconds
[legacy][command] log -G -T '{rev} {desc}\n'
[legacy][command_finish] log -G -T '{rev} {desc}\n' exited 0 after 0.00 seconds
[legacy][command] bookmark -ir 1 BOOK --hidden -q
[legacy][pinnednodes] pinnednodes: ['bookmark', '-ir', '1', 'BOOK', '--hidden', '-q'] newpin=['112478962961'] newunpin=[] before=[] after=['112478962961']
[legacy][command_finish] bookmark -ir 1 BOOK --hidden -q exited 0 after 0.00 seconds
[legacy][command] bookmark -d BOOK -q
[legacy][command_finish] bookmark -d BOOK -q exited 0 after 0.00 seconds
[legacy][command] log -G -T '{rev} {desc}\n'
[legacy][command_finish] log -G -T '{rev} {desc}\n' exited 0 after 0.00 seconds
[legacy][command] blackbox --no-timestamp --no-sid --pattern '{"legacy_log":{"service":["or","command","command_finish","pinnednodes"]}}'
The order matters - putting bookmarks or moving working copy on non-obsoleted
commits do not pin them. Test this using "debugobsolete" which will not call
"createmarkers".
Obsolete working copy, and move working copy away should make things disappear
$ rm -rf .hg && hg init && drawdag <<'EOS'
> C E
> | |
> B D
> |/
> A
> EOS
$ hg up -q $E
$ hg debugobsolete `HGPLAIN=1 hg log -r $E -T '{node}'`
obsoleted 1 changesets
$ hg log -G -T '{rev} {desc}\n'
@ 4 E
|
| o 3 C
| |
o | 2 D
| |
| o 1 B
|/
o 0 A
$ hg debugobsolete `HGPLAIN=1 hg log -r $D -T '{node}'`
obsoleted 1 changesets
$ hg log -G -T '{rev} {desc}\n'
@ 4 E
|
| o 3 C
| |
x | 2 D
| |
| o 1 B
|/
o 0 A
$ hg update -q $C
$ hg log -G -T '{rev} {desc}\n'
@ 3 C
|
o 1 B
|
o 0 A
Having a bookmark on a commit, obsolete the commit, remove the bookmark
$ rm -rf .hg && hg init && drawdag <<'EOS'
> C E
> | |
> B D
> |/
> A
> EOS
$ hg bookmark -i book-e -r $E
$ hg debugobsolete `HGPLAIN=1 hg log -r $D -T '{node}'`
obsoleted 1 changesets
$ hg debugobsolete `HGPLAIN=1 hg log -r $E -T '{node}'`
obsoleted 1 changesets
$ hg log -G -T '{rev} {desc} {bookmarks}\n'
x 4 E book-e
|
| o 3 C
| |
x | 2 D
| |
| o 1 B
|/
o 0 A
$ hg bookmark -d book-e
$ hg log -G -T '{rev} {desc} {bookmarks}\n'
o 3 C
|
o 1 B
|
o 0 A
Uncommit and hiddenoverride. This is uncommon but the last uncommit should make
"A" invisible:
$ newrepo
$ drawdag <<'EOS'
> B
> |
> A
> |
> Z
> EOS
$ hg up $A
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg uncommit
$ hg log -T '{desc}' -G
o B
|
x A
|
@ Z
$ hg up -C $B
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg uncommit
$ hg log -T '{desc}' -G
@ A
|
o Z
$ hg up -C .
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg uncommit
$ hg log -T '{desc}' -G
@ Z

View File

@ -13,7 +13,11 @@ sh % "cat" << r"""
amend=
undo =
[experimental]
evolution = createmarkers, allowunstable
evolution = obsolete
[mutation]
enabled = true
[visibility]
enabled = true
""" >> "$HGRCPATH"
# Create repo

View File

@ -18,7 +18,12 @@
> amend=
> rebase=
> [experimental]
> evolution=createmarkers, allowunstable
> evolution=obsolete
> [mutation]
> enabled=true
> record=false
> [visibility]
> enabled=true
> EOF
$ mkcommit() {
> echo "$1" > "$1"

View File

@ -1,7 +1,7 @@
#chg-compatible
Set up test environment.
$ enable amend obsstore rebase
$ enable mutation-norecord amend rebase
$ showgraph() {
> hg log --graph -T "{rev} {bookmarks} {desc|firstline}" | sed \$d
> }

View File

@ -14,7 +14,12 @@ sh % "cat" << r"""
amend=
rebase=
[experimental]
evolution = createmarkers
evolution = obsolete
[mutation]
enabled=true
record=false
[visibility]
enabled=true
""" >> "$HGRCPATH"
sh % "hg init repo"
sh % "cd repo"

View File

@ -1,15 +1,8 @@
#chg-compatible
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> amend=
> rebase=
> [experimental]
> evolution = createmarkers
> [ui]
> disallowemptyupdate = True
> EOF
$ enable mutation-norecord amend rebase
$ setconfig ui.disallowemptyupdate=true
$ hg init amendprevious && cd amendprevious
Check help text for new options and removal of unsupported options.

View File

@ -14,10 +14,15 @@ sh % "cat" << r"""
amend=
rebase=
[experimental]
evolution = createmarkers, allowunstable
evolution = obsolete
[mutation]
enabled=true
record=false
[visibility]
enabled=true
""" >> "$HGRCPATH"
# Test that rebased commits that would cause instability are inhibited.
# Test that rebases that cause an orphan commit are not a problem.
sh % "hg init repo"
sh % "cd repo"
sh % "hg debugbuilddag -m '+3 *3'"

View File

@ -1,11 +1,9 @@
#chg-compatible
$ . helpers-usechg.sh
$ enable amend rebase
$ enable mutation-norecord amend rebase
$ setconfig rebase.experimental.inmemory=True
$ setconfig rebase.singletransaction=True
$ setconfig experimental.evolution.allowdivergence=True
$ setconfig experimental.evolution="createmarkers, allowunstable"
$ mkcommit() {
> echo "$1" > "$1"
> hg add "$1"
@ -310,12 +308,6 @@ Test rebasing children with obsolete children themselves needing a restack.
|
@ 6 21006be03678 A
|
| x 3 b45c90359798 C
| |
| x 2 917a077edb8d B
| |
| x 1 ac2f7407182b A
|/
o 0 48b9aae0607f Z
Test not rebasing unrelated changes. When rebasing X, only X:: are expected to be rebased.

View File

@ -2,9 +2,7 @@
$ . helpers-usechg.sh
$ enable amend rebase
$ setconfig experimental.evolution.allowdivergence=True
$ setconfig experimental.evolution="createmarkers, allowunstable"
$ enable mutation-norecord amend rebase
$ mkcommit() {
> echo "$1" > "$1"
> hg add "$1"
@ -50,8 +48,6 @@ onto the newest successor of their parent.
|
| o 3 f60c1f15a70e successor 1
|/
| x 1 7c3bad9141dc add b
|/
o 0 1f0dee641bb7 add a
Test situation with divergence due to an unamend. This should actually succeed
@ -99,6 +95,6 @@ since the successor is obsolete.
|
| o 2 4538525df7e2 add c
| |
| o 1 7c3bad9141dc add b
| x 1 7c3bad9141dc add b
|/
o 0 1f0dee641bb7 add a

View File

@ -2,9 +2,7 @@
$ . helpers-usechg.sh
$ enable amend rebase
$ setconfig experimental.evolution.allowdivergence=True
$ setconfig experimental.evolution="createmarkers, allowunstable"
$ enable mutation-norecord amend rebase
$ mkcommit() {
> echo "$1" > "$1"
> hg add "$1"
@ -92,11 +90,11 @@ Restack will only restack the "current" stack and leave other stacks untouched.
| |
| | o 13 5cb8c357af9e D
| | |
o | | 9 a975bfef72d2 L
o | | 12 a975bfef72d2 L
| | |
| o | 7 889f49cd29f6 G
| o | 9 889f49cd29f6 G
| | |
| | o 5 dc0947a82db8 C
| | o 7 dc0947a82db8 C
| | |
| | | o 3 48b9aae0607f Z
| | |
@ -106,42 +104,6 @@ Restack will only restack the "current" stack and leave other stacks untouched.
/
o 0 426bada5c675 A
The "prune" cases.
$ newrepo
$ drawdag<<'EOS'
> D E
> |/
> C
> | # amend: F -> F2
> B G H # prune: A, C, F2
> | |/
> A F F2
> EOS
$ hg update -q $B
$ hg rebase --restack
rebasing 112478962961 "B"
rebasing f585351a92f8 "D"
rebasing 78d2dca436b2 "E"
$ hg update -q $H
$ hg rebase --restack
rebasing 8fdb2c1feb20 "G"
rebasing 02ac06fe83b9 "H"
$ showgraph
@ 13 3e1fefc3c8db H
o 12 0706cfb95b41 G
o 11 8c0ccd1582b3 E
|
| o 10 f88ac1d7b477 D
|/
o 9 653ee58caf75 B
Restack could resume after resolving merge conflicts.
@ -191,7 +153,7 @@ Restack could resume after resolving merge conflicts.
| |
o | 4 7fb047a69f22 E
| |
| o 2 dc0947a82db8 C
| o 3 dc0947a82db8 C
|/
o 0 426bada5c675 A

View File

@ -1,11 +1,9 @@
#chg-compatible
$ . helpers-usechg.sh
$ enable amend rebase
$ enable mutation-norecord amend rebase
$ setconfig rebase.experimental.inmemory=True
$ setconfig rebase.singletransaction=True
$ setconfig experimental.evolution.allowdivergence=True
$ setconfig experimental.evolution="createmarkers, allowunstable"
$ setconfig amend.autorestack=no-conflict
$ mkcommit() {
> echo "$1" > "$1"
@ -30,13 +28,13 @@ Test invalid value for amend.autorestack
$ showgraph
o 5 3c36beb5705f D
|
x 4 07863d11c289 C_old
|
| o 3 26805aba1e60 C
| o 4 26805aba1e60 C
| |
x | 2 3326d5194fc9 B_old
x | 3 07863d11c289 C_old
| |
| @ 1 112478962961 B
| @ 2 112478962961 B
| |
x | 1 3326d5194fc9 B_old
|/
o 0 426bada5c675 A
$ hg amend -m "B'"
@ -49,9 +47,9 @@ Test invalid value for amend.autorestack
|
| o 5 3c36beb5705f D
| |
| x 4 07863d11c289 C_old
| x 3 07863d11c289 C_old
| |
| x 2 3326d5194fc9 B_old
| x 1 3326d5194fc9 B_old
|/
o 0 426bada5c675 A
$ hg rebase --restack
@ -63,8 +61,4 @@ Test invalid value for amend.autorestack
|
@ 6 180681c3ccd0 B'
|
| x 4 07863d11c289 C_old
| |
| x 2 3326d5194fc9 B_old
|/
o 0 426bada5c675 A

View File

@ -22,8 +22,7 @@ shlib.mkcommit = mkcommit
sh % "enable amend rebase remotenames"
sh % "setconfig experimental.evolution.allowdivergence=True experimental.narrow-heads=True"
sh % 'setconfig "experimental.evolution=createmarkers, allowunstable"'
sh % "setconfig experimental.narrow-heads=True"
sh % "setconfig visibility.enabled=true mutation.record=true mutation.enabled=true mutation.date='0 0' experimental.evolution= remotenames.rename.default=remote"
sh % "hg init restack"
sh % "cd restack"

View File

@ -1,19 +1,8 @@
#chg-compatible
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> amend=
> rebase=
> [experimental]
> evolution = createmarkers, allowunstable
> [ui]
> interactive = true
> [amend]
> safestrip = false
> [hint]
> ack-hint-ack = true
> EOF
$ enable mutation-norecord amend rebase
$ setconfig ui.interactive=true amend.safestrip=false hint.ack-hint-ack=true
$ mkcommit() {
> echo "${1}1" > "${1}1"
> echo "${1}2" > "${1}2"
@ -238,10 +227,6 @@ Split using revset.
o 12 a265b3c6c419 add a1 and a2
|
o 11 5a5595e342b1 add a1 and a2
o 10 bd98a3c83a29 add d1 and d2
|
x 0 c20cc4d302fc add a1 and a2
Test that command aborts when given multiple commits.
$ hg split 11 12
@ -274,10 +259,6 @@ Test --no-rebase flag.
o 12 a265b3c6c419 add a1 and a2
|
o 11 5a5595e342b1 add a1 and a2
o 10 bd98a3c83a29 add d1 and d2
|
x 0 c20cc4d302fc add a1 and a2
$ hg split --no-rebase << EOF
> y
> y
@ -323,10 +304,6 @@ Test --no-rebase flag.
o 12 a265b3c6c419 add a1 and a2
|
o 11 5a5595e342b1 add a1 and a2
o 10 bd98a3c83a29 add d1 and d2
|
x 0 c20cc4d302fc add a1 and a2
Test that bookmarks are correctly moved.
$ reset

View File

@ -13,7 +13,12 @@ sh % "cat" << r"""
amend=
rebase=
[experimental]
evolution = createmarkers, allowunstable
evolution = obsolete
[mutation]
enabled=true
record=false
[visibility]
enabled=true
""" >> "$HGRCPATH"
sh % "hg init repo"

View File

@ -1,15 +1,7 @@
#chg-compatible
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> amend=
> directaccess=
> histedit=
> rebase=
> [experimental]
> evolution = createmarkers, allowunstable
> EOF
$ enable mutation-norecord amend directaccess histedit rebase
Test that amend --to option
$ hg init repo && cd repo
$ mkcommit() {

View File

@ -1,14 +1,8 @@
#chg-compatible
Set up test environment.
$ cat >> $HGRCPATH << EOF
> [extensions]
> amend=
> rebase=
> tweakdefaults=
> [experimental]
> evolution = createmarkers
> EOF
$ enable mutation-norecord amend rebase tweakdefaults
$ setconfig mutation.date="0 0"
$ mkcommit() {
> echo "$1" > "$1"
> hg add "$1"
@ -65,10 +59,14 @@ Test hg amend --fixup.
o 0 add a
Test that the operation field on the metadata is correctly set.
$ hg debugobsolete
7c3bad9141dcb46ff89abf5f61856facd56e476c * 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'} (glob)
4538525df7e2b9f09423636c61ef63a4cb872a2d * 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} (glob)
47d2a3944de8b013de3be9578e8e344ea2e6c097 * 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} (glob)
$ hg debugmutation "all()"
* 1f0dee641bb7258c56bd60e93edfa2405381c41e
\* * amend by test at 1970-01-01T00:00:00 from: (glob)
7c3bad9141dcb46ff89abf5f61856facd56e476c
\* * rebase by test at 1970-01-01T00:00:00 from: (glob)
4538525df7e2b9f09423636c61ef63a4cb872a2d
\* * rebase by test at 1970-01-01T00:00:00 from: (glob)
47d2a3944de8b013de3be9578e8e344ea2e6c097
Test hg amend --rebase
$ hg amend -m "amended again" --rebase

View File

@ -2,7 +2,7 @@
#chg-compatible
#testcases obsstore-off obsstore-on
#testcases obsstore-off obsstore-on mutation
$ cat << EOF >> $HGRCPATH
> [extensions]
@ -13,9 +13,13 @@
#if obsstore-on
$ setconfig experimental.evolution=createmarkers
#else
#endif
#if obsstore-off
$ setconfig experimental.evolution=
#endif
#if mutation
$ enable mutation-norecord
#endif
Basic amend
@ -188,6 +192,18 @@ Amend in the middle of a stack
|/
o 0 426bada5c675 A
#endif
#if mutation
$ hg log -T '{rev} {node|short} {desc}\n' -G
@ 3 be169c7e8dbe B
|
| o 2 26805aba1e60 C
| |
| x 1 112478962961 B
|/
o 0 426bada5c675 A
#endif
Cannot amend public changeset

View File

@ -1,6 +1,6 @@
#chg-compatible
$ enable obsstore
$ enable mutation-norecord
File node could be reused during commit --amend

View File

@ -1,5 +1,6 @@
#chg-compatible
$ enable mutation-norecord
$ setconfig extensions.treemanifest=!
$ newrepo
$ drawdag << 'EOS'

View File

@ -2,8 +2,8 @@
Crash in histpack code path where the amend destination already exists
$ enable undo treemanifest remotefilelog
$ setconfig experimental.evolution=createmarkers treemanifest.treeonly=1 remotefilelog.reponame=foo remotefilelog.cachepath=$TESTTMP/cache
$ enable mutation-norecord undo treemanifest remotefilelog
$ setconfig treemanifest.treeonly=1 remotefilelog.reponame=foo remotefilelog.cachepath=$TESTTMP/cache
$ newrepo
$ drawdag << 'EOS'
> B

View File

@ -119,7 +119,17 @@ enable() {
rcpath="$HGRCPATH"
fi
for name in "$@"; do
if [ "$name" = obsstore ]; then
if [ "$name" = "mutation-norecord" ]; then
cat >> $rcpath << EOF
[experimental]
evolution = obsolete
[mutation]
enabled=true
record=false
[visibility]
enabled=true
EOF
elif [ "$name" = obsstore ]; then
cat >> $rcpath << EOF
[experimental]
evolution = createmarkers, allowunstable