Mercurial > hg
annotate tests/test-mq-symlinks.t @ 50400:95acba2c29f6
encoding: avoid quadratic time complexity when json-encoding non-UTF8 strings
Apparently the code uses "+=" with a bytes object, which is linear-time, so the
whole encoding is quadratic-time. This patch makes us use a bytearray object,
instead, which has a(n amortized-)constant-time append operation.
The encoding is still not particularly fast, but at least a 10MB file
takes tens of seconds, not many hours to encode.
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Mon, 06 Mar 2023 11:27:57 +0000 |
parents | 55c6ebd11cb9 |
children |
rev | line source |
---|---|
22046
7a9cbb315d84
tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents:
18395
diff
changeset
|
1 #require symlink |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
2 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
3 $ echo "[extensions]" >> $HGRCPATH |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
4 $ echo "mq=" >> $HGRCPATH |
5157
f6c520fd70cf
mq: teach qpop about symlinks
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
5 |
49621
55c6ebd11cb9
tests: run many tests in $TESTTMP/repo instead of $TESTTMP
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
32267
diff
changeset
|
6 $ hg init repo |
55c6ebd11cb9
tests: run many tests in $TESTTMP/repo instead of $TESTTMP
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
32267
diff
changeset
|
7 $ cd repo |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
8 $ hg qinit |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
9 $ hg qnew base.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
10 $ echo aaa > a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
11 $ echo bbb > b |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
12 $ echo ccc > c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
13 $ hg add a b c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
14 $ hg qrefresh |
25472
4d2b9b304ad0
tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents:
23749
diff
changeset
|
15 $ readlink.py a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
16 a -> a not a symlink |
6360
95413879bac9
test-mq-symlinks: skip if symlinks are not supported
Patrick Mezard <pmezard@gmail.com>
parents:
5683
diff
changeset
|
17 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
18 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
19 test replacing a file with a symlink |
5157
f6c520fd70cf
mq: teach qpop about symlinks
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
20 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
21 $ hg qnew symlink.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
22 $ rm a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
23 $ ln -s b a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
24 $ hg qrefresh --git |
25472
4d2b9b304ad0
tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents:
23749
diff
changeset
|
25 $ readlink.py a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
26 a -> b |
5157
f6c520fd70cf
mq: teach qpop about symlinks
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
27 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
28 $ hg qpop |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
29 popping symlink.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
30 now at: base.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
31 $ hg qpush |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
32 applying symlink.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
33 now at: symlink.patch |
25472
4d2b9b304ad0
tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents:
23749
diff
changeset
|
34 $ readlink.py a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
35 a -> b |
5157
f6c520fd70cf
mq: teach qpop about symlinks
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
36 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
37 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
38 test updating a symlink |
7517
49f34b43cf90
patch: handle git patches that remove symlinks (issue1438)
Brendan Cully <brendan@kublai.com>
parents:
6360
diff
changeset
|
39 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
40 $ rm a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
41 $ ln -s c a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
42 $ hg qnew --git -f updatelink |
25472
4d2b9b304ad0
tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents:
23749
diff
changeset
|
43 $ readlink.py a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
44 a -> c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
45 $ hg qpop |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
46 popping updatelink |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
47 now at: symlink.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
48 $ hg qpush --debug |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
49 applying updatelink |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
50 patching file a |
23749
a387b0390082
localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents:
22046
diff
changeset
|
51 committing files: |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
52 a |
23749
a387b0390082
localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents:
22046
diff
changeset
|
53 committing manifest |
a387b0390082
localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents:
22046
diff
changeset
|
54 committing changelog |
32267
c2380b448265
caches: move the 'updating the branch cache' message in 'updatecaches'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
25472
diff
changeset
|
55 updating the branch cache |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
56 now at: updatelink |
25472
4d2b9b304ad0
tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents:
23749
diff
changeset
|
57 $ readlink.py a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
58 a -> c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
59 $ hg st |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
60 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
61 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
62 test replacing a symlink with a file |
9586
d08099e74b81
patch: handle symlink updates/replacements (issue1785)
Patrick Mezard <pmezard@gmail.com>
parents:
9585
diff
changeset
|
63 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
64 $ ln -s c s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
65 $ hg add s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
66 $ hg qnew --git -f addlink |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
67 $ rm s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
68 $ echo sss > s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
69 $ hg qnew --git -f replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
70 $ hg qpop |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
71 popping replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
72 now at: addlink |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
73 $ hg qpush |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
74 applying replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
75 now at: replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
76 $ cat s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
77 sss |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
78 $ hg st |
9586
d08099e74b81
patch: handle symlink updates/replacements (issue1785)
Patrick Mezard <pmezard@gmail.com>
parents:
9585
diff
changeset
|
79 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
80 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
81 test symlink removal |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
82 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
83 $ hg qnew removesl.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
84 $ hg rm a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
85 $ hg qrefresh --git |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
86 $ hg qpop |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
87 popping removesl.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
88 now at: replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
89 $ hg qpush |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
90 applying removesl.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
91 now at: removesl.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
92 $ hg st -c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
93 C b |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
94 C c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
95 C s |
12345 | 96 |
97 replace broken symlink with another broken symlink | |
12340
b0bb72460c44
patch: fix target when patching broken symlinks (issue2368)
Patrick Mezard <pmezard@gmail.com>
parents:
10397
diff
changeset
|
98 |
12345 | 99 $ ln -s linka linka |
100 $ hg add linka | |
101 $ hg qnew link | |
102 $ hg mv linka linkb | |
12398 | 103 $ rm linkb |
104 $ ln -s linkb linkb | |
12345 | 105 $ hg qnew movelink |
106 $ hg qpop | |
107 popping movelink | |
108 now at: link | |
109 $ hg qpush | |
110 applying movelink | |
111 now at: movelink | |
25472
4d2b9b304ad0
tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents:
23749
diff
changeset
|
112 $ readlink.py linkb |
12345 | 113 linkb -> linkb |