Mercurial > hg
annotate tests/test-requires.t @ 30435:b86a448a2965
zstd: vendor python-zstandard 0.5.0
As the commit message for the previous changeset says, we wish
for zstd to be a 1st class citizen in Mercurial. To make that
happen, we need to enable Python to talk to the zstd C API. And
that requires bindings.
This commit vendors a copy of existing Python bindings. Why do we
need to vendor? As the commit message of the previous commit says,
relying on systems in the wild to have the bindings or zstd present
is a losing proposition. By distributing the zstd and bindings with
Mercurial, we significantly increase our chances that zstd will
work. Since zstd will deliver a better end-user experience by
achieving better performance, this benefits our users. Another
reason is that the Python bindings still aren't stable and the
API is somewhat fluid. While Mercurial could be coded to target
multiple versions of the Python bindings, it is safer to bundle
an explicit, known working version.
The added Python bindings are mostly a fully-featured interface
to the zstd C API. They allow one-shot operations, streaming,
reading and writing from objects implements the file object
protocol, dictionary compression, control over low-level compression
parameters, and more. The Python bindings work on Python 2.6,
2.7, and 3.3+ and have been tested on Linux and Windows. There are
CFFI bindings, but they are lacking compared to the C extension.
Upstream work will be needed before we can support zstd with PyPy.
But it will be possible.
The files added in this commit come from Git commit
e637c1b214d5f869cf8116c550dcae23ec13b677 from
https://github.com/indygreg/python-zstandard and are added without
modifications. Some files from the upstream repository have been
omitted, namely files related to continuous integration.
In the spirit of full disclosure, I'm the maintainer of the
"python-zstandard" project and have authored 100% of the code
added in this commit. Unfortunately, the Python bindings have
not been formally code reviewed by anyone. While I've tested
much of the code thoroughly (I even have tests that fuzz APIs),
there's a good chance there are bugs, memory leaks, not well
thought out APIs, etc. If someone wants to review the code and
send feedback to the GitHub project, it would be greatly
appreciated.
Despite my involvement with both projects, my opinions of code
style differ from Mercurial's. The code in this commit introduces
numerous code style violations in Mercurial's linters. So, the code
is excluded from most lints. However, some violations I agree with.
These have been added to the known violations ignore list for now.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 10 Nov 2016 22:15:58 -0800 |
parents | 4b0fc75f9403 |
children | bd872f64a8ba |
rev | line source |
---|---|
13956
ffb5c09ba822
tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents:
12346
diff
changeset
|
1 $ hg init t |
12116
f51858009328
tests: unify test-requires
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
3851
diff
changeset
|
2 $ cd t |
f51858009328
tests: unify test-requires
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
3851
diff
changeset
|
3 $ echo a > a |
f51858009328
tests: unify test-requires
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
3851
diff
changeset
|
4 $ hg add a |
12156
4c94b6d0fb1c
tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents:
12116
diff
changeset
|
5 $ hg commit -m test |
12116
f51858009328
tests: unify test-requires
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
3851
diff
changeset
|
6 $ rm .hg/requires |
f51858009328
tests: unify test-requires
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
3851
diff
changeset
|
7 $ hg tip |
f51858009328
tests: unify test-requires
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
3851
diff
changeset
|
8 abort: index 00changelog.i unknown format 2! |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
9 [255] |
12116
f51858009328
tests: unify test-requires
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
3851
diff
changeset
|
10 $ echo indoor-pool > .hg/requires |
f51858009328
tests: unify test-requires
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
3851
diff
changeset
|
11 $ hg tip |
20820
f8e531a3a77c
repo: rephrase the "missing requirement" error message
Mads Kiilerich <madski@unity3d.com>
parents:
20715
diff
changeset
|
12 abort: repository requires features unknown to this Mercurial: indoor-pool! |
26421
4b0fc75f9403
urls: bulk-change primary website URLs
Matt Mackall <mpm@selenic.com>
parents:
20820
diff
changeset
|
13 (see https://mercurial-scm.org/wiki/MissingRequirement for more information) |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
14 [255] |
14746
72e4fcb43227
requirements: show all missing features in the error message.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
14483
diff
changeset
|
15 $ echo outdoor-pool >> .hg/requires |
72e4fcb43227
requirements: show all missing features in the error message.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
14483
diff
changeset
|
16 $ hg tip |
20820
f8e531a3a77c
repo: rephrase the "missing requirement" error message
Mads Kiilerich <madski@unity3d.com>
parents:
20715
diff
changeset
|
17 abort: repository requires features unknown to this Mercurial: indoor-pool outdoor-pool! |
26421
4b0fc75f9403
urls: bulk-change primary website URLs
Matt Mackall <mpm@selenic.com>
parents:
20820
diff
changeset
|
18 (see https://mercurial-scm.org/wiki/MissingRequirement for more information) |
14746
72e4fcb43227
requirements: show all missing features in the error message.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
14483
diff
changeset
|
19 [255] |
19778
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
20 $ cd .. |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
21 |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
22 Test checking between features supported locally and ones required in |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
23 another repository of push/pull/clone on localhost: |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
24 |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
25 $ mkdir supported-locally |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
26 $ cd supported-locally |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
27 |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
28 $ hg init supported |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
29 $ echo a > supported/a |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
30 $ hg -R supported commit -Am '#0 at supported' |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
31 adding a |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
32 |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
33 $ echo 'featuresetup-test' >> supported/.hg/requires |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
34 $ cat > $TESTTMP/supported-locally/supportlocally.py <<EOF |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
35 > from mercurial import localrepo, extensions |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
36 > def featuresetup(ui, supported): |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
37 > for name, module in extensions.extensions(ui): |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
38 > if __name__ == module.__name__: |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
39 > # support specific feature locally |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
40 > supported |= set(['featuresetup-test']) |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
41 > return |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
42 > def uisetup(ui): |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
43 > localrepo.localrepository.featuresetupfuncs.add(featuresetup) |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
44 > EOF |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
45 $ cat > supported/.hg/hgrc <<EOF |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
46 > [extensions] |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
47 > # enable extension locally |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
48 > supportlocally = $TESTTMP/supported-locally/supportlocally.py |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
49 > EOF |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
50 $ hg -R supported status |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
51 |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
52 $ hg init push-dst |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
53 $ hg -R supported push push-dst |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
54 pushing to push-dst |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
55 abort: required features are not supported in the destination: featuresetup-test |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
56 [255] |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
57 |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
58 $ hg init pull-src |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
59 $ hg -R pull-src pull supported |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
60 pulling from supported |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
61 abort: required features are not supported in the destination: featuresetup-test |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
62 [255] |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
63 |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
64 $ hg clone supported clone-dst |
20820
f8e531a3a77c
repo: rephrase the "missing requirement" error message
Mads Kiilerich <madski@unity3d.com>
parents:
20715
diff
changeset
|
65 abort: repository requires features unknown to this Mercurial: featuresetup-test! |
26421
4b0fc75f9403
urls: bulk-change primary website URLs
Matt Mackall <mpm@selenic.com>
parents:
20820
diff
changeset
|
66 (see https://mercurial-scm.org/wiki/MissingRequirement for more information) |
19778
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
67 [255] |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
68 $ hg clone --pull supported clone-dst |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
69 abort: required features are not supported in the destination: featuresetup-test |
55ef79031009
localrepo: make supported features manageable in each repositories individually
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
70 [255] |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
14746
diff
changeset
|
71 |
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
14746
diff
changeset
|
72 $ cd .. |