mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
98d9269874
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
100 lines
3.3 KiB
Perl
100 lines
3.3 KiB
Perl
$ configure mutation-norecord
|
|
Test mergedriver invalidation with IMM.
|
|
|
|
$ newrepo
|
|
$ enable rebase
|
|
$ setconfig rebase.singletransaction=True
|
|
$ setconfig rebase.experimental.inmemory=True
|
|
$ setconfig rebase.experimental.inmemorywarning="rebasing in-memory!"
|
|
|
|
$ mkdir driver
|
|
$ cat > driver/__init__.py <<EOF
|
|
> from .generators import someFunction, VERSION
|
|
> def preprocess(ui, repo, hooktype, mergestate, wctx, labels=None):
|
|
> unresolved_files = list(mergestate.unresolved())
|
|
> ui.warn("generators version = %s\n" % VERSION)
|
|
> someFunction(repo)
|
|
> for unresolved_file in unresolved_files:
|
|
> mergestate.mark(unresolved_file, 'd')
|
|
> mergestate.commit()
|
|
> def conclude(ui, repo, hooktype, mergestate, wctx, labels=None):
|
|
> pass
|
|
> EOF
|
|
|
|
$ cat > driver/generators.py <<EOF
|
|
> VERSION = "BASE"
|
|
> def someFunction(repo):
|
|
> repo.ui.warn("base's someFunction() called\n")
|
|
> pass
|
|
> EOF
|
|
$ setconfig experimental.mergedriver=python:driver/
|
|
|
|
|
|
A dummy file (FILE) is created to force a simple three-way merge (without
|
|
conflicts, though a conflict would work too). Otherwise, mergedriver won't run.
|
|
|
|
$ $TESTDIR/seq.py 1 10 > FILE
|
|
$ hg add FILE
|
|
$ hg commit -Aq -m "base mergedriver"
|
|
$ hg book -r . "base"
|
|
|
|
Next, off of BASE, make an API change to the driver.
|
|
|
|
$ cat > driver/__init__.py <<EOF
|
|
> from .generators import someFunction, VERSION
|
|
>
|
|
> def preprocess(ui, repo, hooktype, mergestate, wctx, labels=None):
|
|
> unresolved_files = list(mergestate.unresolved())
|
|
> ui.warn("generators version = %s\n" % VERSION)
|
|
> someFunction(repo, "new_required")
|
|
>
|
|
> for unresolved_file in unresolved_files:
|
|
> mergestate.mark(unresolved_file, 'd')
|
|
>
|
|
> mergestate.commit()
|
|
>
|
|
> def conclude(ui, repo, hooktype, mergestate, wctx, labels=None):
|
|
> pass
|
|
> EOF
|
|
$ cat > driver/generators.py <<EOF
|
|
> VERSION = "NEW"
|
|
>
|
|
> def someFunction(repo, new_required_arg):
|
|
> repo.ui.write("new_required_arg = %s\n" % new_required_arg)
|
|
> pass
|
|
> EOF
|
|
$ $TESTDIR/seq.py 1 11 > FILE
|
|
$ hg com -m "new driver"
|
|
$ hg book -r . new_driver
|
|
$ hg up -q .~1
|
|
|
|
|
|
Next make a change to the dummy file off BASE.
|
|
$ hg up base
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
(activating bookmark base)
|
|
$ hg up -C .
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
(leaving bookmark base)
|
|
$ $TESTDIR/seq.py 0 10 > FILE
|
|
$ hg commit -m "prefix FILE with 0"
|
|
$ hg book -r . "base_1"
|
|
|
|
Rebase on top of the new driver, with the old driver checked out.
|
|
- We expect to see "generators version = BASE" as we run preprocess() with the old driver.
|
|
- Then, after restarting and using on-disk merge (and thus, checking out dest, which has the new driver),
|
|
we expect to see "generators version = NEW".
|
|
- If mergedriver isn't invalidated correctly, it'll say "generators version = BASE".
|
|
|
|
$ hg rebase -d new_driver
|
|
rebasing in-memory!
|
|
rebasing 83615e50cada "prefix FILE with 0" (base_1)
|
|
generators version = BASE
|
|
base's someFunction() called
|
|
artifact rebuild required (in FILE); switching to on-disk merge
|
|
rebasing 83615e50cada "prefix FILE with 0" (base_1)
|
|
generators version = NEW
|
|
new_required_arg = new_required
|
|
note: rebase of 83615e50cada created no changes to commit
|
|
|