annotate tests/test-rebase-legacy.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 f90a5c211251
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
42613
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
1 #testcases continuecommand continueflag
34004
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
2 Test rebase --continue with rebasestate written by legacy client
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
3
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
4 $ cat >> $HGRCPATH <<EOF
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
5 > [extensions]
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
6 > rebase=
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
7 > drawdag=$TESTDIR/drawdag.py
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
8 > EOF
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
9
42613
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
10 #if continueflag
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
11 $ cat >> $HGRCPATH <<EOF
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
12 > [alias]
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
13 > continue = rebase --continue
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
14 > EOF
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
15 #endif
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
16
34004
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
17 $ hg init
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
18 $ hg debugdrawdag <<'EOF'
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
19 > D H
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
20 > | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
21 > C G
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
22 > | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
23 > B F
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
24 > | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
25 > Z A E
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
26 > \|/
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
27 > R
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
28 > EOF
45110
503d0dd2af18 tests: avoid "magic" nodeids in test-rebase-legacy.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42613
diff changeset
29 $ for r in A B C D E F G H R Z
503d0dd2af18 tests: avoid "magic" nodeids in test-rebase-legacy.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42613
diff changeset
30 > do
503d0dd2af18 tests: avoid "magic" nodeids in test-rebase-legacy.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42613
diff changeset
31 > eval node_$r=$(hg log -r $r -T '{node}')
503d0dd2af18 tests: avoid "magic" nodeids in test-rebase-legacy.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42613
diff changeset
32 > done
34004
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
33
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
34 rebasestate generated by a legacy client running "hg rebase -r B+D+E+G+H -d Z"
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
35
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
36 $ touch .hg/last-message.txt
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
37 $ cat > .hg/rebasestate <<EOF
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
38 > 0000000000000000000000000000000000000000
45110
503d0dd2af18 tests: avoid "magic" nodeids in test-rebase-legacy.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42613
diff changeset
39 > $node_Z
34004
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
40 > 0000000000000000000000000000000000000000
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
41 > 0
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
42 > 0
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
43 > 0
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
44 >
45110
503d0dd2af18 tests: avoid "magic" nodeids in test-rebase-legacy.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42613
diff changeset
45 > $node_A:-2
503d0dd2af18 tests: avoid "magic" nodeids in test-rebase-legacy.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42613
diff changeset
46 > $node_E:0000000000000000000000000000000000000000
503d0dd2af18 tests: avoid "magic" nodeids in test-rebase-legacy.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42613
diff changeset
47 > $node_B:0000000000000000000000000000000000000000
503d0dd2af18 tests: avoid "magic" nodeids in test-rebase-legacy.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42613
diff changeset
48 > $node_F:-3
503d0dd2af18 tests: avoid "magic" nodeids in test-rebase-legacy.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42613
diff changeset
49 > $node_C:-3
503d0dd2af18 tests: avoid "magic" nodeids in test-rebase-legacy.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42613
diff changeset
50 > $node_G:0000000000000000000000000000000000000000
503d0dd2af18 tests: avoid "magic" nodeids in test-rebase-legacy.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42613
diff changeset
51 > $node_D:0000000000000000000000000000000000000000
503d0dd2af18 tests: avoid "magic" nodeids in test-rebase-legacy.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 42613
diff changeset
52 > $node_H:0000000000000000000000000000000000000000
34004
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
53 > EOF
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
54
42613
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
55 #if continuecommand
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
56 $ hg continue --dry-run
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
57 rebase in progress, will be resumed
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
58 #endif
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
59
35ebdbb38efb continue: added support for rebase
Taapas Agrawal <taapas2897@gmail.com>
parents: 35393
diff changeset
60 $ hg continue
45771
f90a5c211251 rebase: change and standarize template for rebase's one-line summary
Martin von Zweigbergk <martinvonz@google.com>
parents: 45110
diff changeset
61 rebasing 4:c1e6b162678d B "B"
f90a5c211251 rebase: change and standarize template for rebase's one-line summary
Martin von Zweigbergk <martinvonz@google.com>
parents: 45110
diff changeset
62 rebasing 8:6f7a236de685 D "D"
f90a5c211251 rebase: change and standarize template for rebase's one-line summary
Martin von Zweigbergk <martinvonz@google.com>
parents: 45110
diff changeset
63 rebasing 2:de008c61a447 E "E"
f90a5c211251 rebase: change and standarize template for rebase's one-line summary
Martin von Zweigbergk <martinvonz@google.com>
parents: 45110
diff changeset
64 rebasing 7:d2fa1c02b240 G "G"
f90a5c211251 rebase: change and standarize template for rebase's one-line summary
Martin von Zweigbergk <martinvonz@google.com>
parents: 45110
diff changeset
65 rebasing 9:6582e6951a9c H tip "H"
34004
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
66 warning: orphaned descendants detected, not stripping c1e6b162678d, de008c61a447
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34004
diff changeset
67 saved backup bundle to $TESTTMP/.hg/strip-backup/6f7a236de685-9880a3dc-rebase.hg
34004
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
68
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
69 $ hg log -G -T '{rev}:{node|short} {desc}\n'
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
70 o 11:721b8da0a708 H
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
71 |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
72 o 10:9d65695ec3c2 G
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
73 |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
74 o 9:21c8397a5d68 E
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
75 |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
76 | o 8:fc52970345e8 D
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
77 | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
78 | o 7:eac96551b107 B
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
79 |/
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
80 | o 6:bd5548558fcf C
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
81 | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
82 | | o 5:aeba276fcb7d F
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
83 | | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
84 | o | 4:c1e6b162678d B
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
85 | | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
86 o | | 3:f424eb6a8c01 Z
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
87 | | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
88 +---o 2:de008c61a447 E
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
89 | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
90 | o 1:21a6c4502885 A
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
91 |/
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
92 o 0:b41ce7760717 R
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
93