mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +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
97 lines
2.6 KiB
Perl
97 lines
2.6 KiB
Perl
#chg-compatible
|
|
|
|
Test adding, removing, changing files in both merge parents, without telling
|
|
mergedriver the exact file list to change at "preprocess" time.
|
|
|
|
$ enable mergedriver
|
|
|
|
$ newrepo
|
|
$ drawdag << 'EOS'
|
|
> B C # C/A=1
|
|
> |/ # B/A=2
|
|
> A # C/C_del=C
|
|
> | # B/B_del=B
|
|
> Z # C/C_change=C
|
|
> # B/B_change=B
|
|
> EOS
|
|
$ hg up -q $B
|
|
|
|
The merge driver wants to delete B_del and C_del, change B_change and C_change,
|
|
and add B_add and C_add. Note: there are no conflicts.
|
|
|
|
$ setconfig experimental.mergedriver=python:$TESTTMP/mergedriver-test.py
|
|
|
|
$ cat > $TESTTMP/mergedriver-test.py << EOF
|
|
> from edenscm.mercurial import node
|
|
> from mercurial import node as node2
|
|
> assert node is node2
|
|
> import os
|
|
> def preprocess(ui, repo, hooktype, mergestate, wctx, labels):
|
|
> from edenscm.mercurial import util
|
|
> from mercurial import util as util2
|
|
> assert util is util2
|
|
> ui.write("merge driver preprocess\n")
|
|
> # Right now, need to mark at least one file to get mergedriver running
|
|
> mergestate.mark("A", "d") # driver-resovled
|
|
> # Intentionally not marking all touched files as "driver-resolved", to
|
|
> # emulate some practical use-cases where it is impossible to know the
|
|
> # file list before hand.
|
|
>
|
|
> def conclude(ui, repo, hooktype, mergestate, wctx, labels):
|
|
> ui.write("merge driver conclude\n")
|
|
>
|
|
> # emulating an external script making changes to the working copy
|
|
> os.unlink("A")
|
|
> os.unlink("B_del")
|
|
> os.unlink("C_del")
|
|
>
|
|
> _ = open("B_add", "w").write("B")
|
|
> _ = open("C_add", "w").write("C")
|
|
>
|
|
> _ = open("B_change", "a").write("B")
|
|
> _ = open("C_change", "a").write("C")
|
|
>
|
|
> # mark files using mergedriver APIs
|
|
> mergestate.queueremove("A")
|
|
> mergestate.queueremove("B_del")
|
|
> mergestate.queueremove("C_del")
|
|
> mergestate.queueadd("B_add")
|
|
> mergestate.queueadd("C_add")
|
|
> mergestate.queueget("B_change")
|
|
> mergestate.queueget("C_change")
|
|
> EOF
|
|
|
|
Do the merge:
|
|
|
|
$ hg graft $C
|
|
grafting cb95dc195621 "C"
|
|
merge driver preprocess
|
|
merge driver conclude
|
|
|
|
Status should be clean:
|
|
|
|
$ hg status
|
|
|
|
Working copy and commit made should have expected changes:
|
|
|
|
>>> import glob
|
|
>>> for path in sorted(glob.glob("*")):
|
|
... print("%s: %s" % (path, open(path).read().strip()))
|
|
B: B
|
|
B_add: B
|
|
B_change: BB
|
|
C: C
|
|
C_add: C
|
|
C_change: CC
|
|
Z: Z
|
|
|
|
$ hg diff -r 'p1(.)' -r '.' --stat
|
|
A | 1 -
|
|
B_add | 1 +
|
|
B_change | 2 +-
|
|
B_del | 1 -
|
|
C | 1 +
|
|
C_add | 1 +
|
|
C_change | 1 +
|
|
7 files changed, 5 insertions(+), 3 deletions(-)
|