annotate tests/test-mq-pull-from-bundle.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 89630d0b3e23
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37346
45a4799174a1 tests: disallow using simple store repo with bundlerepo
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35385
diff changeset
1 #require repobundlerepo
45a4799174a1 tests: disallow using simple store repo with bundlerepo
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35385
diff changeset
2
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
3 $ cat <<EOF >> $HGRCPATH
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
4 > [extensions]
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
5 > mq=
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
6 > [alias]
35385
469b06b4c3ca tests: add commit hashes to log commands in rebase tests
Phil Cohen <phillco@fb.com>
parents: 34661
diff changeset
7 > tlog = log --template "{rev}: {node|short} {desc}\\n"
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
8 > theads = heads --template "{rev}: {desc}\\n"
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
9 > tincoming = incoming --template "{rev}: {desc}\\n"
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
10 > EOF
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
11
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
12 Setup main:
5664
da72b4d24797 Fix income/pull with bundle and -R (issue 820).
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
13
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
14 $ hg init base
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
15 $ cd base
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
16 $ echo "One" > one
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
17 $ hg add
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
18 adding one
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
19 $ hg ci -m "main: one added"
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
20 $ echo "++" >> one
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
21 $ hg ci -m "main: one updated"
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
22
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
23 Bundle main:
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
24
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
25 $ hg bundle --base=null ../main.hg
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
26 2 changesets found
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
27
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
28 $ cd ..
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
29
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
30 Incoming to fresh repo:
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
31
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
32 $ hg init fresh
5664
da72b4d24797 Fix income/pull with bundle and -R (issue 820).
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
33
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
34 $ hg -R fresh tincoming main.hg
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
35 comparing with main.hg
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
36 0: main: one added
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
37 1: main: one updated
12962
ff083040a555 bundlerepository: get rid of temporary bundle files (issue2478)
Klaus Koch <kuk42@gmx.net>
parents: 12324
diff changeset
38 $ test -f ./fresh/.hg/hg-bundle* && echo 'temp. bundle file remained' || true
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
39
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
40 $ hg -R fresh tincoming bundle:fresh+main.hg
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
41 comparing with bundle:fresh+main.hg
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
42 0: main: one added
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
43 1: main: one updated
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
44
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
45
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
46 Setup queue:
5664
da72b4d24797 Fix income/pull with bundle and -R (issue 820).
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
47
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
48 $ cd base
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
49 $ hg qinit -c
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
50 $ hg qnew -m "patch: two added" two.patch
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
51 $ echo two > two
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
52 $ hg add
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
53 adding two
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
54 $ hg qrefresh
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
55 $ hg qcommit -m "queue: two.patch added"
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
56 $ hg qpop -a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
57 popping two.patch
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
58 patch queue now empty
5664
da72b4d24797 Fix income/pull with bundle and -R (issue 820).
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
59
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
60 Bundle queue:
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
61
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
62 $ hg -R .hg/patches bundle --base=null ../queue.hgq
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
63 1 changesets found
12962
ff083040a555 bundlerepository: get rid of temporary bundle files (issue2478)
Klaus Koch <kuk42@gmx.net>
parents: 12324
diff changeset
64 $ test -f ./fresh/.hg/hg-bundle* && echo 'temp. bundle file remained' || true
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
65
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
66 $ cd ..
5664
da72b4d24797 Fix income/pull with bundle and -R (issue 820).
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
67
da72b4d24797 Fix income/pull with bundle and -R (issue 820).
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
68
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
69 Clone base:
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
70
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
71 $ hg clone base copy
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
72 updating to branch default
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
73 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
74 $ cd copy
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
75 $ hg qinit -c
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
76
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
77 Incoming queue bundle:
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
78
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
79 $ hg -R .hg/patches tincoming ../queue.hgq
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
80 comparing with ../queue.hgq
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
81 0: queue: two.patch added
12962
ff083040a555 bundlerepository: get rid of temporary bundle files (issue2478)
Klaus Koch <kuk42@gmx.net>
parents: 12324
diff changeset
82 $ test -f .hg/hg-bundle* && echo 'temp. bundle file remained' || true
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
83
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
84 Pull queue bundle:
5664
da72b4d24797 Fix income/pull with bundle and -R (issue 820).
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
85
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
86 $ hg -R .hg/patches pull --update ../queue.hgq
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
87 pulling from ../queue.hgq
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
88 requesting all changes
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
89 adding changesets
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
90 adding manifests
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
91 adding file changes
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
92 added 1 changesets with 3 changes to 3 files
39480
89630d0b3e23 phase: report number of non-public changeset alongside the new range
Boris Feld <boris.feld@octobus.net>
parents: 37346
diff changeset
93 new changesets d7553909353d (1 drafts)
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
94 merging series
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
95 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
12962
ff083040a555 bundlerepository: get rid of temporary bundle files (issue2478)
Klaus Koch <kuk42@gmx.net>
parents: 12324
diff changeset
96 $ test -f .hg/patches/hg-bundle* && echo 'temp. bundle file remained' || true
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
97
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
98 $ hg -R .hg/patches theads
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
99 0: queue: two.patch added
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
100
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
101 $ hg -R .hg/patches tlog
35385
469b06b4c3ca tests: add commit hashes to log commands in rebase tests
Phil Cohen <phillco@fb.com>
parents: 34661
diff changeset
102 0: d7553909353d queue: two.patch added
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
103
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
104 $ hg qseries
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
105 two.patch
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
106
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
107 $ cd ..
5664
da72b4d24797 Fix income/pull with bundle and -R (issue 820).
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
108
da72b4d24797 Fix income/pull with bundle and -R (issue 820).
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
109
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
110 Clone base again:
5664
da72b4d24797 Fix income/pull with bundle and -R (issue 820).
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
111
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
112 $ hg clone base copy2
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
113 updating to branch default
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
114 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
115 $ cd copy2
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
116 $ hg qinit -c
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
117
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
118 Unbundle queue bundle:
5664
da72b4d24797 Fix income/pull with bundle and -R (issue 820).
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
119
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
120 $ hg -R .hg/patches unbundle --update ../queue.hgq
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
121 adding changesets
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
122 adding manifests
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
123 adding file changes
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
124 added 1 changesets with 3 changes to 3 files
39480
89630d0b3e23 phase: report number of non-public changeset alongside the new range
Boris Feld <boris.feld@octobus.net>
parents: 37346
diff changeset
125 new changesets d7553909353d (1 drafts)
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
126 merging series
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
127 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
5664
da72b4d24797 Fix income/pull with bundle and -R (issue 820).
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
128
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
129 $ hg -R .hg/patches theads
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
130 0: queue: two.patch added
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
131
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
132 $ hg -R .hg/patches tlog
35385
469b06b4c3ca tests: add commit hashes to log commands in rebase tests
Phil Cohen <phillco@fb.com>
parents: 34661
diff changeset
133 0: d7553909353d queue: two.patch added
5664
da72b4d24797 Fix income/pull with bundle and -R (issue 820).
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
134
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
135 $ hg qseries
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
136 two.patch
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
137
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
138 $ cd ..
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 6159
diff changeset
139