mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +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
101 lines
2.5 KiB
Perl
101 lines
2.5 KiB
Perl
#chg-compatible
|
|
|
|
Setup:
|
|
$ newext eval <<EOF
|
|
> from __future__ import absolute_import
|
|
> import filecmp
|
|
> from edenscm.mercurial import commands, context, registrar
|
|
> cmdtable = {}
|
|
> command = registrar.command(cmdtable)
|
|
> @command('eval', [], 'hg eval CMD')
|
|
> def eval_(ui, repo, *cmds, **opts):
|
|
> cmd = " ".join(cmds)
|
|
> res = str(eval(cmd, globals(), locals()))
|
|
> ui.warn("%s" % res)
|
|
> EOF
|
|
|
|
Arbitraryfilectx.cmp does not follow symlinks:
|
|
$ mkdir case1
|
|
$ cd case1
|
|
$ hg init
|
|
#if symlink
|
|
$ printf "A" > real_A
|
|
$ printf "foo" > A
|
|
$ printf "foo" > B
|
|
$ ln -s A sym_A
|
|
$ hg add .
|
|
adding A
|
|
adding B
|
|
adding real_A
|
|
adding sym_A
|
|
$ hg commit -m "base"
|
|
#else
|
|
$ hg import -q --bypass - <<EOF
|
|
> # HG changeset patch
|
|
> # User test
|
|
> # Date 0 0
|
|
> base
|
|
>
|
|
> diff --git a/A b/A
|
|
> new file mode 100644
|
|
> --- /dev/null
|
|
> +++ b/A
|
|
> @@ -0,0 +1,1 @@
|
|
> +foo
|
|
> \ No newline at end of file
|
|
> diff --git a/B b/B
|
|
> new file mode 100644
|
|
> --- /dev/null
|
|
> +++ b/B
|
|
> @@ -0,0 +1,1 @@
|
|
> +foo
|
|
> \ No newline at end of file
|
|
> diff --git a/real_A b/real_A
|
|
> new file mode 100644
|
|
> --- /dev/null
|
|
> +++ b/real_A
|
|
> @@ -0,0 +1,1 @@
|
|
> +A
|
|
> \ No newline at end of file
|
|
> diff --git a/sym_A b/sym_A
|
|
> new file mode 120000
|
|
> --- /dev/null
|
|
> +++ b/sym_A
|
|
> @@ -0,0 +1,1 @@
|
|
> +A
|
|
> \ No newline at end of file
|
|
> EOF
|
|
$ hg up -q
|
|
#endif
|
|
|
|
These files are different and should return True (different):
|
|
(Note that filecmp.cmp's return semantics are inverted from ours, so we invert
|
|
for simplicity):
|
|
$ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['real_A'])"
|
|
True (no-eol)
|
|
$ hg eval "not filecmp.cmp('A', 'real_A')"
|
|
True (no-eol)
|
|
|
|
These files are identical and should return False (same):
|
|
$ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['A'])"
|
|
False (no-eol)
|
|
$ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['B'])"
|
|
False (no-eol)
|
|
$ hg eval "not filecmp.cmp('A', 'B')"
|
|
False (no-eol)
|
|
|
|
This comparison should also return False, since A and sym_A are substantially
|
|
the same in the eyes of ``filectx.cmp``, which looks at data only.
|
|
$ hg eval "context.arbitraryfilectx('real_A', repo).cmp(repo[None]['sym_A'])"
|
|
False (no-eol)
|
|
|
|
A naive use of filecmp on those two would wrongly return True, since it follows
|
|
the symlink to "A", which has different contents.
|
|
#if symlink
|
|
$ hg eval "not filecmp.cmp('real_A', 'sym_A')"
|
|
True (no-eol)
|
|
#else
|
|
$ hg eval "not filecmp.cmp('real_A', 'sym_A')"
|
|
False (no-eol)
|
|
#endif
|