annotate tests/test-branch-option.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 701df761aa94
children eb586ed5d8ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
1 test branch selection options
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
3 $ hg init branch
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
4 $ cd branch
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
5 $ hg branch a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
6 marked working directory as branch a
15615
41885892796e branch: warn on branching
Matt Mackall <mpm@selenic.com>
parents: 12942
diff changeset
7 (branches are permanent and global, did you want a bookmark?)
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
8 $ echo a > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
9 $ hg ci -d '0 0' -Ama
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
10 adding foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
11 $ echo a2 > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
12 $ hg ci -d '0 0' -ma2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
13 $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
14 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
15 $ hg branch c
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
16 marked working directory as branch c
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
17 $ echo c > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
18 $ hg ci -d '0 0' -mc
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
19 $ hg tag -l z
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
20 $ cd ..
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
21 $ hg clone -r 0 branch branch2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
22 adding changesets
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
23 adding manifests
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
24 adding file changes
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
25 added 1 changesets with 1 changes to 1 files
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
26 updating to branch a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
27 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
28 $ cd branch2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
29 $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
30 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
31 $ hg branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
32 marked working directory as branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
33 $ echo b > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
34 $ hg ci -d '0 0' -mb
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
35 $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
37 $ hg --encoding utf-8 branch æ
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12847
diff changeset
38 marked working directory as branch \xc3\xa6 (esc)
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
39 $ echo ae1 > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
40 $ hg ci -d '0 0' -mae1
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
41 $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
42 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
43 $ hg --encoding utf-8 branch -f æ
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12847
diff changeset
44 marked working directory as branch \xc3\xa6 (esc)
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
45 $ echo ae2 > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
46 $ hg ci -d '0 0' -mae2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
47 created new head
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
48 $ hg up 0
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
49 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
50 $ hg branch -f b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
51 marked working directory as branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
52 $ echo b2 > foo
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
53 $ hg ci -d '0 0' -mb2
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
54 created new head
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
56 unknown branch and fallback
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
57
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
58 $ hg in -qbz
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
59 abort: unknown branch 'z'!
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11869
diff changeset
60 [255]
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
61 $ hg in -q ../branch#z
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
62 2:f25d57ab0566
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
63 $ hg out -qbz
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
64 abort: unknown branch 'z'!
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11869
diff changeset
65 [255]
10365
d757bc0c7865 interpret repo#name url syntax as branch instead of revision
Sune Foldager <cryo@cyanite.org>
parents:
diff changeset
66
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
67 in rev c branch a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
68
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
69 $ hg in -qr c ../branch#a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
70 1:dd6e60a716c6
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
71 2:f25d57ab0566
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
72 $ hg in -qr c -b a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
73 1:dd6e60a716c6
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
74 2:f25d57ab0566
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
75
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
76 out branch .
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
77
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
78 $ hg out -q ../branch#.
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
79 1:b84708d77ab7
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
80 4:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
81 $ hg out -q -b .
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
82 1:b84708d77ab7
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
83 4:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
84
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
85 out branch . non-ascii
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
86
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
87 $ hg --encoding utf-8 up æ
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
88 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
89 $ hg --encoding latin1 out -q ../branch#.
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
90 2:df5a44224d4e
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
91 3:4f4a5125ca10
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
92 $ hg --encoding latin1 out -q -b .
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
93 2:df5a44224d4e
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
94 3:4f4a5125ca10
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
95
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
96 clone branch b
10365
d757bc0c7865 interpret repo#name url syntax as branch instead of revision
Sune Foldager <cryo@cyanite.org>
parents:
diff changeset
97
11869
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
98 $ cd ..
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
99 $ hg clone branch2#b branch3
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
100 adding changesets
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
101 adding manifests
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
102 adding file changes
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
103 added 3 changesets with 3 changes to 1 files (+1 heads)
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
104 updating to branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
105 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
106 $ hg -q -R branch3 heads b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
107 2:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
108 1:b84708d77ab7
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
109 $ hg -q -R branch3 parents
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
110 2:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
111 $ rm -rf branch3
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
112
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
113 clone rev a branch b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
114
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
115 $ hg clone -r a branch2#b branch3
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
116 adding changesets
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
117 adding manifests
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
118 adding file changes
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
119 added 3 changesets with 3 changes to 1 files (+1 heads)
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
120 updating to branch a
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
121 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
122 $ hg -q -R branch3 heads b
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
123 2:65511d0e2b55
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
124 1:b84708d77ab7
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
125 $ hg -q -R branch3 parents
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
126 0:5b65ba7c951d
36a5e7cb6c8d tests: unify test-branch-option
Martin Geisler <mg@lazybytes.net>
parents: 11322
diff changeset
127 $ rm -rf branch3