mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
1183f14f11
Summary: This was a hack to allow the tests to produce the same hashes as before. Let's disable this and fix the remaining test failures. A future diff will remove the feature entirely. Where possible I changed input hashes to desc() and output hashes to globs so hopefully future hash changes are a little easier. Differential Revision: D29567762 fbshipit-source-id: cf5150c112c56b08f583feba80e5a636cc07db0a
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 * "prefix FILE with 0" (base_1) (glob)
|
|
generators version = BASE
|
|
base's someFunction() called
|
|
artifact rebuild required (in FILE); switching to on-disk merge
|
|
rebasing * "prefix FILE with 0" (base_1) (glob)
|
|
generators version = NEW
|
|
new_required_arg = new_required
|
|
note: rebase of * created no changes to commit (glob)
|
|
|