Mercurial > hg
annotate tests/test-filebranch.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 | 2f2682f40ea0 |
children |
rev | line source |
---|---|
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
1 This test makes sure that we don't mark a file as merged with its ancestor |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
2 when we do a merge. |
990 | 3 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
4 $ cat <<EOF > merge |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
5 > import sys, os |
33721
24849d53697d
tests: clean up many print statements to be print functions instead
Augie Fackler <augie@google.com>
parents:
33286
diff
changeset
|
6 > print("merging for", os.path.basename(sys.argv[1])) |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
7 > EOF |
40872
07e181ed82ef
py3: quote several instances of $PYTHON for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
39760
diff
changeset
|
8 $ HGMERGE="\"$PYTHON\" ../merge"; export HGMERGE |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
9 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
10 Creating base: |
990 | 11 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
12 $ hg init a |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
13 $ cd a |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
14 $ echo 1 > foo |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
15 $ echo 1 > bar |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
16 $ echo 1 > baz |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
17 $ echo 1 > quux |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
18 $ hg add foo bar baz quux |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
19 $ hg commit -m "base" |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
20 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
21 $ cd .. |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
22 $ hg clone a b |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
23 updating to branch default |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
24 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
25 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
26 Creating branch a: |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
27 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
28 $ cd a |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
29 $ echo 2a > foo |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
30 $ echo 2a > bar |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
31 $ hg commit -m "branch a" |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
32 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
33 Creating branch b: |
990 | 34 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
35 $ cd .. |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
36 $ cd b |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
37 $ echo 2b > foo |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
38 $ echo 2b > baz |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
39 $ hg commit -m "branch b" |
990 | 40 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
41 We shouldn't have anything but n state here: |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
42 |
39760
7e99b02768ef
debugdirstate: deprecate --nodates in favor of --no-dates
Martin von Zweigbergk <martinvonz@google.com>
parents:
39489
diff
changeset
|
43 $ hg debugstate --no-dates | grep -v "^n" |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12192
diff
changeset
|
44 [1] |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
45 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
46 Merging: |
990 | 47 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
48 $ hg pull ../a |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
49 pulling from ../a |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
50 searching for changes |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
51 adding changesets |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
52 adding manifests |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
53 adding file changes |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
54 added 1 changesets with 2 changes to 2 files (+1 heads) |
34661
eb586ed5d8ce
transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
33721
diff
changeset
|
55 new changesets bdd988058d16 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
56 (run 'hg heads' to see heads, 'hg merge' to merge) |
990 | 57 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
58 $ hg merge -v |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
59 resolving manifests |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
60 getting bar |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
61 merging foo |
13439
d724a69309e0
util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents:
12316
diff
changeset
|
62 merging for foo |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
63 1 files updated, 1 files merged, 0 files removed, 0 files unresolved |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
64 (branch merge, don't forget to commit) |
990 | 65 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
66 $ echo 2m > foo |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
67 $ echo 2b > baz |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
68 $ echo new > quux |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
69 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
70 $ hg ci -m "merge" |
990 | 71 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
72 main: we should have a merge here: |
990 | 73 |
14323
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14182
diff
changeset
|
74 $ hg debugindex --changelog |
49252
4141951dacff
debugindex: rename the parent column to mention nodeid
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49251
diff
changeset
|
75 rev linkrev nodeid p1-nodeid p2-nodeid |
37283
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
76 0 0 cdca01651b96 000000000000 000000000000 |
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
77 1 1 f6718a9cb7f3 cdca01651b96 000000000000 |
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
78 2 2 bdd988058d16 cdca01651b96 000000000000 |
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
79 3 3 d8a521142a3c f6718a9cb7f3 bdd988058d16 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
80 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
81 log should show foo and quux changed: |
990 | 82 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
83 $ hg log -v -r tip |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
84 changeset: 3:d8a521142a3c |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
85 tag: tip |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
86 parent: 1:f6718a9cb7f3 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
87 parent: 2:bdd988058d16 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
88 user: test |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
89 date: Thu Jan 01 00:00:00 1970 +0000 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
90 files: foo quux |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
91 description: |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
92 merge |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
93 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
94 |
990 | 95 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
96 foo: we should have a merge here: |
990 | 97 |
14182
ec5886db9dc6
tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents:
13439
diff
changeset
|
98 $ hg debugindex foo |
49252
4141951dacff
debugindex: rename the parent column to mention nodeid
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49251
diff
changeset
|
99 rev linkrev nodeid p1-nodeid p2-nodeid |
37283
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
100 0 0 b8e02f643373 000000000000 000000000000 |
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
101 1 1 2ffeddde1b65 b8e02f643373 000000000000 |
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
102 2 2 33d1fb69067a b8e02f643373 000000000000 |
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
103 3 3 aa27919ee430 2ffeddde1b65 33d1fb69067a |
990 | 104 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
105 bar: we should not have a merge here: |
990 | 106 |
14182
ec5886db9dc6
tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents:
13439
diff
changeset
|
107 $ hg debugindex bar |
49252
4141951dacff
debugindex: rename the parent column to mention nodeid
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49251
diff
changeset
|
108 rev linkrev nodeid p1-nodeid p2-nodeid |
37283
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
109 0 0 b8e02f643373 000000000000 000000000000 |
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
110 1 2 33d1fb69067a b8e02f643373 000000000000 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
111 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
112 baz: we should not have a merge here: |
993 | 113 |
14182
ec5886db9dc6
tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents:
13439
diff
changeset
|
114 $ hg debugindex baz |
49252
4141951dacff
debugindex: rename the parent column to mention nodeid
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49251
diff
changeset
|
115 rev linkrev nodeid p1-nodeid p2-nodeid |
37283
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
116 0 0 b8e02f643373 000000000000 000000000000 |
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
117 1 1 2ffeddde1b65 b8e02f643373 000000000000 |
990 | 118 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
119 quux: we should not have a merge here: |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
120 |
14182
ec5886db9dc6
tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents:
13439
diff
changeset
|
121 $ hg debugindex quux |
49252
4141951dacff
debugindex: rename the parent column to mention nodeid
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49251
diff
changeset
|
122 rev linkrev nodeid p1-nodeid p2-nodeid |
37283
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
123 0 0 b8e02f643373 000000000000 000000000000 |
d4e62df1c73d
debugcommands: drop offset and length from debugindex by default
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37282
diff
changeset
|
124 1 3 6128c0f33108 b8e02f643373 000000000000 |
990 | 125 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
126 Manifest entries should match tips of all files: |
990 | 127 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
128 $ hg manifest --debug |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
129 33d1fb69067a0139622a3fa3b7ba1cdb1367972e 644 bar |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
130 2ffeddde1b65b4827f6746174a145474129fa2ce 644 baz |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
131 aa27919ee4303cfd575e1fb932dd64d75aa08be4 644 foo |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
132 6128c0f33108e8cfbb4e0824d13ae48b466d7280 644 quux |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
133 |
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
134 Everything should be clean now: |
990 | 135 |
12192
968e9057ab8a
tests: unify test-filebranch
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
136 $ hg status |
993 | 137 |
49825
2f2682f40ea0
tests: use the `--quiet` flag for verify when applicable
Raphaël Gomès <rgomes@octobus.net>
parents:
49252
diff
changeset
|
138 $ hg verify -q |
990 | 139 |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
14323
diff
changeset
|
140 $ cd .. |