sapling/eden/hg-server/tests/test-mutation-loops.t
Durham Goode 98d9269874 server: copy hg to a new hg-server directory
Summary:
Create a fork of the Mercurial code that we can use to build server
rpms. The hg servers will continue to exist for a few more months while we move
the darkstorm and ediscovery use cases off them. In the mean time, we want to
start making breaking changes to the client, so let's create a stable copy of
the hg code to produce rpms for the hg servers.

The fork is based off c7770c78d, the latest hg release.

This copies the files as is, then adds some minor tweaks to get it to build:
- Disables some lint checks that appear to be bypassed by path
- sed replace eden/scm with eden/hg-server
- Removed a dependency on scm/telemetry from the edenfs-client tests since
  scm/telemetry pulls in the original eden/scm/lib/configparser which conflicts
  with the hg-server conflict parser.

allow-large-files

Reviewed By: quark-zju

Differential Revision: D27632557

fbshipit-source-id: b2f442f4ec000ea08e4d62de068750832198e1f4
2021-04-09 10:09:06 -07:00

70 lines
2.8 KiB
Raku

$ enable amend rebase remotenames
$ setconfig experimental.evolution=obsolete
$ setconfig experimental.narrow-heads=true
$ setconfig visibility.enabled=true
$ setconfig mutation.record=true mutation.enabled=true mutation.date="0 0"
$ newrepo
$ echo "base" > base
$ hg commit -Aqm base
$ echo 1 > file
$ hg commit -Aqm commit1
$ for i in 2 3 4 5
> do
> echo $i >> file
> hg amend -m "commit$i"
> done
$ hg debugmutation
* 21c93100b04c543843a7dab4fa0d5bada061b7a0 amend by test at 1970-01-01T00:00:00 from:
672a4910c364d425231d2dd2fb0486f32a2d88f4 amend by test at 1970-01-01T00:00:00 from:
d3c8fd338cf40a496d981b2ada8df4108f575897 amend by test at 1970-01-01T00:00:00 from:
932f02c9fad3fa46e55b62560c88eb67528b02f0 amend by test at 1970-01-01T00:00:00 from:
e6c779c67aa947c951f334f4f312bd2b21d27e55
Loops are not normally possible, but they can sneak in through backfilling complex
obsmarker graphs. Create a fake one to check behaviour.
$ hg debugsh -c "with repo.lock(): m.mutation.recordentries(repo, [m.mutation.createsyntheticentry(repo, [m.node.bin(\"e6c779c67aa947c951f334f4f312bd2b21d27e55\"), m.node.bin(\"672a4910c364d425231d2dd2fb0486f32a2d88f4\")], m.node.bin(\"932f02c9fad3fa46e55b62560c88eb67528b02f0\"), \"loop\")], skipexisting=False)"
$ tglogm --hidden
@ 21c93100b04c 'commit5'
x 672a4910c364 'commit4' (Rewritten using amend into 21c93100b04c) (Rewritten using loop into 932f02c9fad3)
├─╯
x d3c8fd338cf4 'commit3' (Rewritten using amend into 672a4910c364)
├─╯
x 932f02c9fad3 'commit2' (Rewritten using amend into d3c8fd338cf4)
├─╯
x e6c779c67aa9 'commit1' (Rewritten using loop into 932f02c9fad3)
├─╯
o d20a80d4def3 'base'
$ hg unhide e6c779c67aa9
Check the normal revsets.
$ hg log -r 'predecessors(21c93100b04c)' -T '{node} {desc}\n'
e6c779c67aa947c951f334f4f312bd2b21d27e55 commit1
932f02c9fad3fa46e55b62560c88eb67528b02f0 commit2
d3c8fd338cf40a496d981b2ada8df4108f575897 commit3
672a4910c364d425231d2dd2fb0486f32a2d88f4 commit4
21c93100b04c543843a7dab4fa0d5bada061b7a0 commit5
$ hg log -r 'successors(e6c779c67aa9)' -T '{node} {desc}\n'
e6c779c67aa947c951f334f4f312bd2b21d27e55 commit1
21c93100b04c543843a7dab4fa0d5bada061b7a0 commit5
If successorssets doesn't handle loops, this next command will hang as it
continuously cycles round the commit2 to commit4 loop.
$ tglogm
@ 21c93100b04c 'commit5'
x e6c779c67aa9 'commit1' (Rewritten using rewrite into 21c93100b04c)
├─╯
o d20a80d4def3 'base'
Similarly, check that predecessorsset is also safe.
$ hg debugsh -c "ui.write(str([m.node.hex(n) for n in m.mutation.predecessorsset(repo, m.node.bin(\"21c93100b04c543843a7dab4fa0d5bada061b7a0\"))]) + '\n')"
['e6c779c67aa947c951f334f4f312bd2b21d27e55']