sapling/eden/hg-server/tests/test-mutation-fromobsmarkers.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

74 lines
2.6 KiB
Perl

#chg-compatible
$ configure dummyssh
$ enable amend rebase
$ setconfig ui.interactive=true
Create a commit graph using obsmarkers.
$ newrepo
$ drawdag << EOS
> O J M # amend: A -> D -> F
> | | | # amend: B -> C
> B C E G I L # rebase: C -> E
> |/ / / | | # split: A -> H, I
> A D F H K N # rebase: C -> J
> \|/ \|/ # fold: I, J -> M
> Z Z # split: H -> K, L
> # fold: K, L, M -> N
> # split: E -> G, O
> EOS
It's possible for obsmarkers to get duplicated with slightly different
timestamps, due to floating-point number precision issues. This can
cause problems for mutation import, so fake the situation by deliberately
duplicating obsmarkers.
$ cat > $TESTTMP/dupobsmarkers.py <<EOF
> from edenscm.mercurial import obsolete, registrar
> cmdtable = {}
> command = registrar.command(cmdtable)
> @command('debugdupobsmarkers')
> def debugdupobsmarkers(ui, repo, **opts):
> newmarkers = []
> for marker in repo.obsstore._all:
> newmarker = list(marker)
> newmarker[4] = (newmarker[4][0] - 0.001, newmarker[4][1])
> newmarkers.append(tuple(newmarker))
> with repo.lock(), repo.svfs("obsstore", "ab") as f:
> f.write(b"".join(obsolete.encodemarkers(newmarkers, False, repo.obsstore._version)))
> EOF
$ hg debugdupobsmarkers --config extensions.dupobsmarkers=$TESTTMP/dupobsmarkers.py
Backfill the obsmarkers into mutation information.
$ setconfig mutation.record=true mutation.enabled=true mutation.date="0 0"
$ hg debugmutationfromobsmarkers
wrote 10 of 10 entries for 10 commits
The successors and predecessors information should be correct.
$ hg unhide $B
$ tglogm
o 11164ffef7a9 'O'
o e1beb503e4fb 'G'
│ x 917a077edb8d 'B' (Rewritten using rewrite into 69a19cab35b2) (Rewritten using split into e1beb503e4fb, 11164ffef7a9)
│ │
│ │ o 69a19cab35b2 'N'
│ │ │
o │ │ 847007ced9a7 'F'
├───╯
│ x ac2f7407182b 'A' (Rewritten using rewrite into 69a19cab35b2) (Rewritten using rewrite into 847007ced9a7)
├─╯
o 48b9aae0607f 'Z'
$ hg debugmutation -r $O
* 11164ffef7a9840cc182930dae0e032875937b6a split by test at 1970-01-01T00:00:01 (split into this and: e1beb503e4fb1cec5df43ac57edfcff177d705ec) from:
e900f94a0435abcada5fcbc21f0ff399981ad817 rebase by test at 1970-01-01T00:00:00 from:
daf025dd63009f8b02a358a8b98a29347717170f amend by test at 1970-01-01T00:00:00 from:
917a077edb8d775c96bc95d34025c800b243ce6f