Show More
@@ -1,213 +1,218 | |||
|
1 | 1 | # revlogutils/debug.py - utility used for revlog debuging |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com> |
|
4 | 4 | # Copyright 2022 Octobus <contact@octobus.net> |
|
5 | 5 | # |
|
6 | 6 | # This software may be used and distributed according to the terms of the |
|
7 | 7 | # GNU General Public License version 2 or any later version. |
|
8 | 8 | |
|
9 | 9 | from .. import ( |
|
10 | 10 | node as nodemod, |
|
11 | 11 | ) |
|
12 | 12 | |
|
13 | 13 | from . import ( |
|
14 | 14 | constants, |
|
15 | 15 | ) |
|
16 | 16 | |
|
17 | 17 | INDEX_ENTRY_DEBUG_COLUMN = [] |
|
18 | 18 | |
|
19 | 19 | NODE_SIZE = object() |
|
20 | 20 | |
|
21 | 21 | |
|
22 | 22 | class _column_base: |
|
23 | 23 | """constains the definition of a revlog column |
|
24 | 24 | |
|
25 | 25 | name: the column header, |
|
26 | 26 | value_func: the function called to get a value, |
|
27 | 27 | size: the width of the column, |
|
28 | 28 | verbose_only: only include the column in verbose mode. |
|
29 | 29 | """ |
|
30 | 30 | |
|
31 | 31 | def __init__(self, name, value_func, size=None, verbose=False): |
|
32 | 32 | self.name = name |
|
33 | 33 | self.value_func = value_func |
|
34 | 34 | if size is not NODE_SIZE: |
|
35 | 35 | if size is None: |
|
36 | 36 | size = 8 # arbitrary default |
|
37 | 37 | size = max(len(name), size) |
|
38 | 38 | self._size = size |
|
39 | 39 | self.verbose_only = verbose |
|
40 | 40 | |
|
41 | 41 | def get_size(self, node_size): |
|
42 | 42 | if self._size is NODE_SIZE: |
|
43 | 43 | return node_size |
|
44 | 44 | else: |
|
45 | 45 | return self._size |
|
46 | 46 | |
|
47 | 47 | |
|
48 | 48 | def debug_column(name, size=None, verbose=False): |
|
49 | 49 | """decorated function is registered as a column |
|
50 | 50 | |
|
51 | 51 | name: the name of the column, |
|
52 | 52 | size: the expected size of the column. |
|
53 | 53 | """ |
|
54 | 54 | |
|
55 | 55 | def register(func): |
|
56 | 56 | entry = _column_base( |
|
57 | 57 | name=name, |
|
58 | 58 | value_func=func, |
|
59 | 59 | size=size, |
|
60 | 60 | verbose=verbose, |
|
61 | 61 | ) |
|
62 | 62 | INDEX_ENTRY_DEBUG_COLUMN.append(entry) |
|
63 | 63 | return entry |
|
64 | 64 | |
|
65 | 65 | return register |
|
66 | 66 | |
|
67 | 67 | |
|
68 | 68 | @debug_column(b"rev", size=6) |
|
69 | 69 | def _rev(index, rev, entry, hexfn): |
|
70 | 70 | return b"%d" % rev |
|
71 | 71 | |
|
72 | 72 | |
|
73 | @debug_column(b"rank", size=6, verbose=True) | |
|
74 | def rank(index, rev, entry, hexfn): | |
|
75 | return b"%d" % entry[constants.ENTRY_RANK] | |
|
76 | ||
|
77 | ||
|
73 | 78 | @debug_column(b"linkrev", size=6) |
|
74 | 79 | def _linkrev(index, rev, entry, hexfn): |
|
75 | 80 | return b"%d" % entry[constants.ENTRY_LINK_REV] |
|
76 | 81 | |
|
77 | 82 | |
|
78 | 83 | @debug_column(b"nodeid", size=NODE_SIZE) |
|
79 | 84 | def _nodeid(index, rev, entry, hexfn): |
|
80 | 85 | return hexfn(entry[constants.ENTRY_NODE_ID]) |
|
81 | 86 | |
|
82 | 87 | |
|
83 | 88 | @debug_column(b"p1-rev", size=6, verbose=True) |
|
84 | 89 | def _p1_rev(index, rev, entry, hexfn): |
|
85 | 90 | return b"%d" % entry[constants.ENTRY_PARENT_1] |
|
86 | 91 | |
|
87 | 92 | |
|
88 | 93 | @debug_column(b"p1-nodeid", size=NODE_SIZE) |
|
89 | 94 | def _p1_node(index, rev, entry, hexfn): |
|
90 | 95 | parent = entry[constants.ENTRY_PARENT_1] |
|
91 | 96 | p_entry = index[parent] |
|
92 | 97 | return hexfn(p_entry[constants.ENTRY_NODE_ID]) |
|
93 | 98 | |
|
94 | 99 | |
|
95 | 100 | @debug_column(b"p2-rev", size=6, verbose=True) |
|
96 | 101 | def _p2_rev(index, rev, entry, hexfn): |
|
97 | 102 | return b"%d" % entry[constants.ENTRY_PARENT_2] |
|
98 | 103 | |
|
99 | 104 | |
|
100 | 105 | @debug_column(b"p2-nodeid", size=NODE_SIZE) |
|
101 | 106 | def _p2_node(index, rev, entry, hexfn): |
|
102 | 107 | parent = entry[constants.ENTRY_PARENT_2] |
|
103 | 108 | p_entry = index[parent] |
|
104 | 109 | return hexfn(p_entry[constants.ENTRY_NODE_ID]) |
|
105 | 110 | |
|
106 | 111 | |
|
107 | 112 | @debug_column(b"full-size", size=20, verbose=True) |
|
108 | 113 | def full_size(index, rev, entry, hexfn): |
|
109 | 114 | return b"%d" % entry[constants.ENTRY_DATA_UNCOMPRESSED_LENGTH] |
|
110 | 115 | |
|
111 | 116 | |
|
112 | 117 | @debug_column(b"delta-base", size=6, verbose=True) |
|
113 | 118 | def delta_base(index, rev, entry, hexfn): |
|
114 | 119 | return b"%d" % entry[constants.ENTRY_DELTA_BASE] |
|
115 | 120 | |
|
116 | 121 | |
|
117 | 122 | @debug_column(b"flags", size=2, verbose=True) |
|
118 | 123 | def flags(index, rev, entry, hexfn): |
|
119 | 124 | field = entry[constants.ENTRY_DATA_OFFSET] |
|
120 | 125 | field &= 0xFFFF |
|
121 | 126 | return b"%d" % field |
|
122 | 127 | |
|
123 | 128 | |
|
124 | 129 | @debug_column(b"comp-mode", size=4, verbose=True) |
|
125 | 130 | def compression_mode(index, rev, entry, hexfn): |
|
126 | 131 | return b"%d" % entry[constants.ENTRY_DATA_COMPRESSION_MODE] |
|
127 | 132 | |
|
128 | 133 | |
|
129 | 134 | @debug_column(b"data-offset", size=20, verbose=True) |
|
130 | 135 | def data_offset(index, rev, entry, hexfn): |
|
131 | 136 | field = entry[constants.ENTRY_DATA_OFFSET] |
|
132 | 137 | field >>= 16 |
|
133 | 138 | return b"%d" % field |
|
134 | 139 | |
|
135 | 140 | |
|
136 | 141 | @debug_column(b"chunk-size", size=10, verbose=True) |
|
137 | 142 | def data_chunk_size(index, rev, entry, hexfn): |
|
138 | 143 | return b"%d" % entry[constants.ENTRY_DATA_COMPRESSED_LENGTH] |
|
139 | 144 | |
|
140 | 145 | |
|
141 | 146 | @debug_column(b"sd-comp-mode", size=7, verbose=True) |
|
142 | 147 | def sidedata_compression_mode(index, rev, entry, hexfn): |
|
143 | 148 | compression = entry[constants.ENTRY_SIDEDATA_COMPRESSION_MODE] |
|
144 | 149 | if compression == constants.COMP_MODE_PLAIN: |
|
145 | 150 | return b"plain" |
|
146 | 151 | elif compression == constants.COMP_MODE_DEFAULT: |
|
147 | 152 | return b"default" |
|
148 | 153 | elif compression == constants.COMP_MODE_INLINE: |
|
149 | 154 | return b"inline" |
|
150 | 155 | else: |
|
151 | 156 | return b"%d" % compression |
|
152 | 157 | |
|
153 | 158 | |
|
154 | 159 | @debug_column(b"sidedata-offset", size=20, verbose=True) |
|
155 | 160 | def sidedata_offset(index, rev, entry, hexfn): |
|
156 | 161 | return b"%d" % entry[constants.ENTRY_SIDEDATA_OFFSET] |
|
157 | 162 | |
|
158 | 163 | |
|
159 | 164 | @debug_column(b"sd-chunk-size", size=10, verbose=True) |
|
160 | 165 | def sidedata_chunk_size(index, rev, entry, hexfn): |
|
161 | 166 | return b"%d" % entry[constants.ENTRY_SIDEDATA_COMPRESSED_LENGTH] |
|
162 | 167 | |
|
163 | 168 | |
|
164 | 169 | def debug_index( |
|
165 | 170 | ui, |
|
166 | 171 | repo, |
|
167 | 172 | formatter, |
|
168 | 173 | revlog, |
|
169 | 174 | full_node, |
|
170 | 175 | ): |
|
171 | 176 | """display index data for a revlog""" |
|
172 | 177 | if full_node: |
|
173 | 178 | hexfn = nodemod.hex |
|
174 | 179 | else: |
|
175 | 180 | hexfn = nodemod.short |
|
176 | 181 | |
|
177 | 182 | idlen = 12 |
|
178 | 183 | for i in revlog: |
|
179 | 184 | idlen = len(hexfn(revlog.node(i))) |
|
180 | 185 | break |
|
181 | 186 | |
|
182 | 187 | fm = formatter |
|
183 | 188 | |
|
184 | 189 | header_pieces = [] |
|
185 | 190 | for column in INDEX_ENTRY_DEBUG_COLUMN: |
|
186 | 191 | if column.verbose_only and not ui.verbose: |
|
187 | 192 | continue |
|
188 | 193 | size = column.get_size(idlen) |
|
189 | 194 | name = column.name |
|
190 | 195 | header_pieces.append(name.rjust(size)) |
|
191 | 196 | |
|
192 | 197 | fm.plain(b' '.join(header_pieces) + b'\n') |
|
193 | 198 | |
|
194 | 199 | index = revlog.index |
|
195 | 200 | |
|
196 | 201 | for rev in revlog: |
|
197 | 202 | fm.startitem() |
|
198 | 203 | entry = index[rev] |
|
199 | 204 | first = True |
|
200 | 205 | for column in INDEX_ENTRY_DEBUG_COLUMN: |
|
201 | 206 | if column.verbose_only and not ui.verbose: |
|
202 | 207 | continue |
|
203 | 208 | if not first: |
|
204 | 209 | fm.plain(b' ') |
|
205 | 210 | first = False |
|
206 | 211 | |
|
207 | 212 | size = column.get_size(idlen) |
|
208 | 213 | value = column.value_func(index, rev, entry, hexfn) |
|
209 | 214 | display = b"%%%ds" % size |
|
210 | 215 | fm.write(column.name, display, value) |
|
211 | 216 | fm.plain(b'\n') |
|
212 | 217 | |
|
213 | 218 | fm.end() |
@@ -1,717 +1,717 | |||
|
1 | 1 | $ cat << EOF >> $HGRCPATH |
|
2 | 2 | > [ui] |
|
3 | 3 | > interactive=yes |
|
4 | 4 | > EOF |
|
5 | 5 | |
|
6 | 6 | $ hg init debugrevlog |
|
7 | 7 | $ cd debugrevlog |
|
8 | 8 | $ echo a > a |
|
9 | 9 | $ hg ci -Am adda |
|
10 | 10 | adding a |
|
11 | 11 | $ hg rm . |
|
12 | 12 | removing a |
|
13 | 13 | $ hg ci -Am make-it-empty |
|
14 | 14 | $ hg revert --all -r 0 |
|
15 | 15 | adding a |
|
16 | 16 | $ hg ci -Am make-it-full |
|
17 | 17 | #if reporevlogstore |
|
18 | 18 | $ hg debugrevlog -c |
|
19 | 19 | format : 1 |
|
20 | 20 | flags : inline |
|
21 | 21 | |
|
22 | 22 | revisions : 3 |
|
23 | 23 | merges : 0 ( 0.00%) |
|
24 | 24 | normal : 3 (100.00%) |
|
25 | 25 | revisions : 3 |
|
26 | 26 | empty : 0 ( 0.00%) |
|
27 | 27 | text : 0 (100.00%) |
|
28 | 28 | delta : 0 (100.00%) |
|
29 | 29 | snapshot : 3 (100.00%) |
|
30 | 30 | lvl-0 : 3 (100.00%) |
|
31 | 31 | deltas : 0 ( 0.00%) |
|
32 | 32 | revision size : 191 |
|
33 | 33 | snapshot : 191 (100.00%) |
|
34 | 34 | lvl-0 : 191 (100.00%) |
|
35 | 35 | deltas : 0 ( 0.00%) |
|
36 | 36 | |
|
37 | 37 | chunks : 3 |
|
38 | 38 | 0x75 (u) : 3 (100.00%) |
|
39 | 39 | chunks size : 191 |
|
40 | 40 | 0x75 (u) : 191 (100.00%) |
|
41 | 41 | |
|
42 | 42 | avg chain length : 0 |
|
43 | 43 | max chain length : 0 |
|
44 | 44 | max chain reach : 67 |
|
45 | 45 | compression ratio : 0 |
|
46 | 46 | |
|
47 | 47 | uncompressed data size (min/max/avg) : 57 / 66 / 62 |
|
48 | 48 | full revision size (min/max/avg) : 58 / 67 / 63 |
|
49 | 49 | inter-snapshot size (min/max/avg) : 0 / 0 / 0 |
|
50 | 50 | delta size (min/max/avg) : 0 / 0 / 0 |
|
51 | 51 | $ hg debugrevlog -m |
|
52 | 52 | format : 1 |
|
53 | 53 | flags : inline, generaldelta |
|
54 | 54 | |
|
55 | 55 | revisions : 3 |
|
56 | 56 | merges : 0 ( 0.00%) |
|
57 | 57 | normal : 3 (100.00%) |
|
58 | 58 | revisions : 3 |
|
59 | 59 | empty : 1 (33.33%) |
|
60 | 60 | text : 1 (100.00%) |
|
61 | 61 | delta : 0 ( 0.00%) |
|
62 | 62 | snapshot : 2 (66.67%) |
|
63 | 63 | lvl-0 : 2 (66.67%) |
|
64 | 64 | deltas : 0 ( 0.00%) |
|
65 | 65 | revision size : 88 |
|
66 | 66 | snapshot : 88 (100.00%) |
|
67 | 67 | lvl-0 : 88 (100.00%) |
|
68 | 68 | deltas : 0 ( 0.00%) |
|
69 | 69 | |
|
70 | 70 | chunks : 3 |
|
71 | 71 | empty : 1 (33.33%) |
|
72 | 72 | 0x75 (u) : 2 (66.67%) |
|
73 | 73 | chunks size : 88 |
|
74 | 74 | empty : 0 ( 0.00%) |
|
75 | 75 | 0x75 (u) : 88 (100.00%) |
|
76 | 76 | |
|
77 | 77 | avg chain length : 0 |
|
78 | 78 | max chain length : 0 |
|
79 | 79 | max chain reach : 44 |
|
80 | 80 | compression ratio : 0 |
|
81 | 81 | |
|
82 | 82 | uncompressed data size (min/max/avg) : 0 / 43 / 28 |
|
83 | 83 | full revision size (min/max/avg) : 44 / 44 / 44 |
|
84 | 84 | inter-snapshot size (min/max/avg) : 0 / 0 / 0 |
|
85 | 85 | delta size (min/max/avg) : 0 / 0 / 0 |
|
86 | 86 | $ hg debugrevlog a |
|
87 | 87 | format : 1 |
|
88 | 88 | flags : inline, generaldelta |
|
89 | 89 | |
|
90 | 90 | revisions : 1 |
|
91 | 91 | merges : 0 ( 0.00%) |
|
92 | 92 | normal : 1 (100.00%) |
|
93 | 93 | revisions : 1 |
|
94 | 94 | empty : 0 ( 0.00%) |
|
95 | 95 | text : 0 (100.00%) |
|
96 | 96 | delta : 0 (100.00%) |
|
97 | 97 | snapshot : 1 (100.00%) |
|
98 | 98 | lvl-0 : 1 (100.00%) |
|
99 | 99 | deltas : 0 ( 0.00%) |
|
100 | 100 | revision size : 3 |
|
101 | 101 | snapshot : 3 (100.00%) |
|
102 | 102 | lvl-0 : 3 (100.00%) |
|
103 | 103 | deltas : 0 ( 0.00%) |
|
104 | 104 | |
|
105 | 105 | chunks : 1 |
|
106 | 106 | 0x75 (u) : 1 (100.00%) |
|
107 | 107 | chunks size : 3 |
|
108 | 108 | 0x75 (u) : 3 (100.00%) |
|
109 | 109 | |
|
110 | 110 | avg chain length : 0 |
|
111 | 111 | max chain length : 0 |
|
112 | 112 | max chain reach : 3 |
|
113 | 113 | compression ratio : 0 |
|
114 | 114 | |
|
115 | 115 | uncompressed data size (min/max/avg) : 2 / 2 / 2 |
|
116 | 116 | full revision size (min/max/avg) : 3 / 3 / 3 |
|
117 | 117 | inter-snapshot size (min/max/avg) : 0 / 0 / 0 |
|
118 | 118 | delta size (min/max/avg) : 0 / 0 / 0 |
|
119 | 119 | #endif |
|
120 | 120 | |
|
121 | 121 | Test debugindex, with and without the --verbose/--debug flag |
|
122 | 122 | $ hg debugrevlogindex a |
|
123 | 123 | rev linkrev nodeid p1 p2 |
|
124 | 124 | 0 0 b789fdd96dc2 000000000000 000000000000 |
|
125 | 125 | |
|
126 | 126 | #if no-reposimplestore |
|
127 | 127 | $ hg --verbose debugrevlogindex a |
|
128 | 128 | rev offset length linkrev nodeid p1 p2 |
|
129 | 129 | 0 0 3 0 b789fdd96dc2 000000000000 000000000000 |
|
130 | 130 | |
|
131 | 131 | $ hg --debug debugrevlogindex a |
|
132 | 132 | rev offset length linkrev nodeid p1 p2 |
|
133 | 133 | 0 0 3 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 |
|
134 | 134 | #endif |
|
135 | 135 | |
|
136 | 136 | $ hg debugrevlogindex -f 1 a |
|
137 | 137 | rev flag size link p1 p2 nodeid |
|
138 | 138 | 0 0000 2 0 -1 -1 b789fdd96dc2 |
|
139 | 139 | |
|
140 | 140 | #if no-reposimplestore |
|
141 | 141 | $ hg --verbose debugrevlogindex -f 1 a |
|
142 | 142 | rev flag offset length size link p1 p2 nodeid |
|
143 | 143 | 0 0000 0 3 2 0 -1 -1 b789fdd96dc2 |
|
144 | 144 | |
|
145 | 145 | $ hg --debug debugrevlogindex -f 1 a |
|
146 | 146 | rev flag offset length size link p1 p2 nodeid |
|
147 | 147 | 0 0000 0 3 2 0 -1 -1 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 |
|
148 | 148 | #endif |
|
149 | 149 | |
|
150 | 150 | $ hg debugindex -c |
|
151 | 151 | rev linkrev nodeid p1-nodeid p2-nodeid |
|
152 | 152 | 0 0 07f494440405 000000000000 000000000000 |
|
153 | 153 | 1 1 8cccb4b5fec2 07f494440405 000000000000 |
|
154 | 154 | 2 2 b1e228c512c5 8cccb4b5fec2 000000000000 |
|
155 | 155 | $ hg debugindex -c --debug |
|
156 | rev linkrev nodeid p1-rev p1-nodeid p2-rev p2-nodeid full-size delta-base flags comp-mode data-offset chunk-size sd-comp-mode sidedata-offset sd-chunk-size | |
|
157 | 0 0 07f4944404050f47db2e5c5071e0e84e7a27bba9 -1 0000000000000000000000000000000000000000 -1 0000000000000000000000000000000000000000 57 0 0 2 0 58 inline 0 0 | |
|
158 | 1 1 8cccb4b5fec20cafeb99dd01c26d4dee8ea4388a 0 07f4944404050f47db2e5c5071e0e84e7a27bba9 -1 0000000000000000000000000000000000000000 66 1 0 2 58 67 inline 0 0 | |
|
159 | 2 2 b1e228c512c5d7066d70562ed839c3323a62d6d2 1 8cccb4b5fec20cafeb99dd01c26d4dee8ea4388a -1 0000000000000000000000000000000000000000 65 2 0 2 125 66 inline 0 0 | |
|
156 | rev rank linkrev nodeid p1-rev p1-nodeid p2-rev p2-nodeid full-size delta-base flags comp-mode data-offset chunk-size sd-comp-mode sidedata-offset sd-chunk-size | |
|
157 | 0 -1 0 07f4944404050f47db2e5c5071e0e84e7a27bba9 -1 0000000000000000000000000000000000000000 -1 0000000000000000000000000000000000000000 57 0 0 2 0 58 inline 0 0 | |
|
158 | 1 -1 1 8cccb4b5fec20cafeb99dd01c26d4dee8ea4388a 0 07f4944404050f47db2e5c5071e0e84e7a27bba9 -1 0000000000000000000000000000000000000000 66 1 0 2 58 67 inline 0 0 | |
|
159 | 2 -1 2 b1e228c512c5d7066d70562ed839c3323a62d6d2 1 8cccb4b5fec20cafeb99dd01c26d4dee8ea4388a -1 0000000000000000000000000000000000000000 65 2 0 2 125 66 inline 0 0 | |
|
160 | 160 | $ hg debugindex -m |
|
161 | 161 | rev linkrev nodeid p1-nodeid p2-nodeid |
|
162 | 162 | 0 0 a0c8bcbbb45c 000000000000 000000000000 |
|
163 | 163 | 1 1 57faf8a737ae a0c8bcbbb45c 000000000000 |
|
164 | 164 | 2 2 a35b10320954 57faf8a737ae 000000000000 |
|
165 | 165 | $ hg debugindex -m --debug |
|
166 | rev linkrev nodeid p1-rev p1-nodeid p2-rev p2-nodeid full-size delta-base flags comp-mode data-offset chunk-size sd-comp-mode sidedata-offset sd-chunk-size | |
|
167 | 0 0 a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 -1 0000000000000000000000000000000000000000 -1 0000000000000000000000000000000000000000 43 0 0 2 0 44 inline 0 0 | |
|
168 | 1 1 57faf8a737ae7faf490582941a82319ba6529dca 0 a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 -1 0000000000000000000000000000000000000000 0 1 0 2 44 0 inline 0 0 | |
|
169 | 2 2 a35b103209548032201c16c7688cb2657f037a38 1 57faf8a737ae7faf490582941a82319ba6529dca -1 0000000000000000000000000000000000000000 43 2 0 2 44 44 inline 0 0 | |
|
166 | rev rank linkrev nodeid p1-rev p1-nodeid p2-rev p2-nodeid full-size delta-base flags comp-mode data-offset chunk-size sd-comp-mode sidedata-offset sd-chunk-size | |
|
167 | 0 -1 0 a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 -1 0000000000000000000000000000000000000000 -1 0000000000000000000000000000000000000000 43 0 0 2 0 44 inline 0 0 | |
|
168 | 1 -1 1 57faf8a737ae7faf490582941a82319ba6529dca 0 a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 -1 0000000000000000000000000000000000000000 0 1 0 2 44 0 inline 0 0 | |
|
169 | 2 -1 2 a35b103209548032201c16c7688cb2657f037a38 1 57faf8a737ae7faf490582941a82319ba6529dca -1 0000000000000000000000000000000000000000 43 2 0 2 44 44 inline 0 0 | |
|
170 | 170 | $ hg debugindex a |
|
171 | 171 | rev linkrev nodeid p1-nodeid p2-nodeid |
|
172 | 172 | 0 0 b789fdd96dc2 000000000000 000000000000 |
|
173 | 173 | $ hg debugindex --debug a |
|
174 | rev linkrev nodeid p1-rev p1-nodeid p2-rev p2-nodeid full-size delta-base flags comp-mode data-offset chunk-size sd-comp-mode sidedata-offset sd-chunk-size | |
|
175 | 0 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 -1 0000000000000000000000000000000000000000 -1 0000000000000000000000000000000000000000 2 0 0 2 0 3 inline 0 0 | |
|
174 | rev rank linkrev nodeid p1-rev p1-nodeid p2-rev p2-nodeid full-size delta-base flags comp-mode data-offset chunk-size sd-comp-mode sidedata-offset sd-chunk-size | |
|
175 | 0 -1 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 -1 0000000000000000000000000000000000000000 -1 0000000000000000000000000000000000000000 2 0 0 2 0 3 inline 0 0 | |
|
176 | 176 | |
|
177 | 177 | debugdelta chain basic output |
|
178 | 178 | |
|
179 | 179 | #if reporevlogstore pure |
|
180 | 180 | $ hg debugindexstats |
|
181 | 181 | abort: debugindexstats only works with native code |
|
182 | 182 | [255] |
|
183 | 183 | #endif |
|
184 | 184 | #if reporevlogstore no-pure |
|
185 | 185 | $ hg debugindexstats |
|
186 | 186 | node trie capacity: 4 |
|
187 | 187 | node trie count: 2 |
|
188 | 188 | node trie depth: 1 |
|
189 | 189 | node trie last rev scanned: -1 (no-rust !) |
|
190 | 190 | node trie last rev scanned: 3 (rust !) |
|
191 | 191 | node trie lookups: 4 (no-rust !) |
|
192 | 192 | node trie lookups: 2 (rust !) |
|
193 | 193 | node trie misses: 1 |
|
194 | 194 | node trie splits: 1 |
|
195 | 195 | revs in memory: 3 |
|
196 | 196 | #endif |
|
197 | 197 | |
|
198 | 198 | #if reporevlogstore no-pure |
|
199 | 199 | $ hg debugdeltachain -m |
|
200 | 200 | rev p1 p2 chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks |
|
201 | 201 | 0 -1 -1 1 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1 |
|
202 | 202 | 1 0 -1 2 1 -1 base 0 0 0 0.00000 0 0 0.00000 0 0 1.00000 1 |
|
203 | 203 | 2 1 -1 3 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1 |
|
204 | 204 | |
|
205 | 205 | $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen}\n' |
|
206 | 206 | 0 1 1 |
|
207 | 207 | 1 2 1 |
|
208 | 208 | 2 3 1 |
|
209 | 209 | |
|
210 | 210 | $ hg debugdeltachain -m -Tjson |
|
211 | 211 | [ |
|
212 | 212 | { |
|
213 | 213 | "chainid": 1, |
|
214 | 214 | "chainlen": 1, |
|
215 | 215 | "chainratio": 1.0232558139534884, (py3 !) |
|
216 | 216 | "chainsize": 44, |
|
217 | 217 | "compsize": 44, |
|
218 | 218 | "deltatype": "base", |
|
219 | 219 | "extradist": 0, |
|
220 | 220 | "extraratio": 0.0, |
|
221 | 221 | "largestblock": 44, |
|
222 | 222 | "lindist": 44, |
|
223 | 223 | "p1": -1, |
|
224 | 224 | "p2": -1, |
|
225 | 225 | "prevrev": -1, |
|
226 | 226 | "readdensity": 1.0, |
|
227 | 227 | "readsize": 44, |
|
228 | 228 | "rev": 0, |
|
229 | 229 | "srchunks": 1, |
|
230 | 230 | "uncompsize": 43 |
|
231 | 231 | }, |
|
232 | 232 | { |
|
233 | 233 | "chainid": 2, |
|
234 | 234 | "chainlen": 1, |
|
235 | 235 | "chainratio": 0, |
|
236 | 236 | "chainsize": 0, |
|
237 | 237 | "compsize": 0, |
|
238 | 238 | "deltatype": "base", |
|
239 | 239 | "extradist": 0, |
|
240 | 240 | "extraratio": 0, |
|
241 | 241 | "largestblock": 0, |
|
242 | 242 | "lindist": 0, |
|
243 | 243 | "p1": 0, |
|
244 | 244 | "p2": -1, |
|
245 | 245 | "prevrev": -1, |
|
246 | 246 | "readdensity": 1, |
|
247 | 247 | "readsize": 0, |
|
248 | 248 | "rev": 1, |
|
249 | 249 | "srchunks": 1, |
|
250 | 250 | "uncompsize": 0 |
|
251 | 251 | }, |
|
252 | 252 | { |
|
253 | 253 | "chainid": 3, |
|
254 | 254 | "chainlen": 1, |
|
255 | 255 | "chainratio": 1.0232558139534884, (py3 !) |
|
256 | 256 | "chainsize": 44, |
|
257 | 257 | "compsize": 44, |
|
258 | 258 | "deltatype": "base", |
|
259 | 259 | "extradist": 0, |
|
260 | 260 | "extraratio": 0.0, |
|
261 | 261 | "largestblock": 44, |
|
262 | 262 | "lindist": 44, |
|
263 | 263 | "p1": 1, |
|
264 | 264 | "p2": -1, |
|
265 | 265 | "prevrev": -1, |
|
266 | 266 | "readdensity": 1.0, |
|
267 | 267 | "readsize": 44, |
|
268 | 268 | "rev": 2, |
|
269 | 269 | "srchunks": 1, |
|
270 | 270 | "uncompsize": 43 |
|
271 | 271 | } |
|
272 | 272 | ] |
|
273 | 273 | |
|
274 | 274 | debugdelta chain with sparse read enabled |
|
275 | 275 | |
|
276 | 276 | $ cat >> $HGRCPATH <<EOF |
|
277 | 277 | > [experimental] |
|
278 | 278 | > sparse-read = True |
|
279 | 279 | > EOF |
|
280 | 280 | $ hg debugdeltachain -m |
|
281 | 281 | rev p1 p2 chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks |
|
282 | 282 | 0 -1 -1 1 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1 |
|
283 | 283 | 1 0 -1 2 1 -1 base 0 0 0 0.00000 0 0 0.00000 0 0 1.00000 1 |
|
284 | 284 | 2 1 -1 3 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1 |
|
285 | 285 | |
|
286 | 286 | $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen} {readsize} {largestblock} {readdensity}\n' |
|
287 | 287 | 0 1 1 44 44 1.0 |
|
288 | 288 | 1 2 1 0 0 1 |
|
289 | 289 | 2 3 1 44 44 1.0 |
|
290 | 290 | |
|
291 | 291 | $ hg debugdeltachain -m -Tjson |
|
292 | 292 | [ |
|
293 | 293 | { |
|
294 | 294 | "chainid": 1, |
|
295 | 295 | "chainlen": 1, |
|
296 | 296 | "chainratio": 1.0232558139534884, (py3 !) |
|
297 | 297 | "chainsize": 44, |
|
298 | 298 | "compsize": 44, |
|
299 | 299 | "deltatype": "base", |
|
300 | 300 | "extradist": 0, |
|
301 | 301 | "extraratio": 0.0, |
|
302 | 302 | "largestblock": 44, |
|
303 | 303 | "lindist": 44, |
|
304 | 304 | "p1": -1, |
|
305 | 305 | "p2": -1, |
|
306 | 306 | "prevrev": -1, |
|
307 | 307 | "readdensity": 1.0, |
|
308 | 308 | "readsize": 44, |
|
309 | 309 | "rev": 0, |
|
310 | 310 | "srchunks": 1, |
|
311 | 311 | "uncompsize": 43 |
|
312 | 312 | }, |
|
313 | 313 | { |
|
314 | 314 | "chainid": 2, |
|
315 | 315 | "chainlen": 1, |
|
316 | 316 | "chainratio": 0, |
|
317 | 317 | "chainsize": 0, |
|
318 | 318 | "compsize": 0, |
|
319 | 319 | "deltatype": "base", |
|
320 | 320 | "extradist": 0, |
|
321 | 321 | "extraratio": 0, |
|
322 | 322 | "largestblock": 0, |
|
323 | 323 | "lindist": 0, |
|
324 | 324 | "p1": 0, |
|
325 | 325 | "p2": -1, |
|
326 | 326 | "prevrev": -1, |
|
327 | 327 | "readdensity": 1, |
|
328 | 328 | "readsize": 0, |
|
329 | 329 | "rev": 1, |
|
330 | 330 | "srchunks": 1, |
|
331 | 331 | "uncompsize": 0 |
|
332 | 332 | }, |
|
333 | 333 | { |
|
334 | 334 | "chainid": 3, |
|
335 | 335 | "chainlen": 1, |
|
336 | 336 | "chainratio": 1.0232558139534884, (py3 !) |
|
337 | 337 | "chainsize": 44, |
|
338 | 338 | "compsize": 44, |
|
339 | 339 | "deltatype": "base", |
|
340 | 340 | "extradist": 0, |
|
341 | 341 | "extraratio": 0.0, |
|
342 | 342 | "largestblock": 44, |
|
343 | 343 | "lindist": 44, |
|
344 | 344 | "p1": 1, |
|
345 | 345 | "p2": -1, |
|
346 | 346 | "prevrev": -1, |
|
347 | 347 | "readdensity": 1.0, |
|
348 | 348 | "readsize": 44, |
|
349 | 349 | "rev": 2, |
|
350 | 350 | "srchunks": 1, |
|
351 | 351 | "uncompsize": 43 |
|
352 | 352 | } |
|
353 | 353 | ] |
|
354 | 354 | |
|
355 | 355 | $ printf "This test checks things.\n" >> a |
|
356 | 356 | $ hg ci -m a |
|
357 | 357 | $ hg branch other |
|
358 | 358 | marked working directory as branch other |
|
359 | 359 | (branches are permanent and global, did you want a bookmark?) |
|
360 | 360 | $ for i in `$TESTDIR/seq.py 5`; do |
|
361 | 361 | > printf "shorter ${i}" >> a |
|
362 | 362 | > hg ci -m "a other:$i" |
|
363 | 363 | > hg up -q default |
|
364 | 364 | > printf "for the branch default we want longer chains: ${i}" >> a |
|
365 | 365 | > hg ci -m "a default:$i" |
|
366 | 366 | > hg up -q other |
|
367 | 367 | > done |
|
368 | 368 | $ hg debugdeltachain a -T '{rev} {srchunks}\n' \ |
|
369 | 369 | > --config experimental.sparse-read.density-threshold=0.50 \ |
|
370 | 370 | > --config experimental.sparse-read.min-gap-size=0 |
|
371 | 371 | 0 1 |
|
372 | 372 | 1 1 |
|
373 | 373 | 2 1 |
|
374 | 374 | 3 1 |
|
375 | 375 | 4 1 |
|
376 | 376 | 5 1 |
|
377 | 377 | 6 1 |
|
378 | 378 | 7 1 |
|
379 | 379 | 8 1 |
|
380 | 380 | 9 1 |
|
381 | 381 | 10 2 (no-zstd !) |
|
382 | 382 | 10 1 (zstd !) |
|
383 | 383 | 11 1 |
|
384 | 384 | $ hg --config extensions.strip= strip --no-backup -r 1 |
|
385 | 385 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
386 | 386 | |
|
387 | 387 | Test max chain len |
|
388 | 388 | $ cat >> $HGRCPATH << EOF |
|
389 | 389 | > [format] |
|
390 | 390 | > maxchainlen=4 |
|
391 | 391 | > EOF |
|
392 | 392 | |
|
393 | 393 | $ printf "This test checks if maxchainlen config value is respected also it can serve as basic test for debugrevlog -d <file>.\n" >> a |
|
394 | 394 | $ hg ci -m a |
|
395 | 395 | $ printf "b\n" >> a |
|
396 | 396 | $ hg ci -m a |
|
397 | 397 | $ printf "c\n" >> a |
|
398 | 398 | $ hg ci -m a |
|
399 | 399 | $ printf "d\n" >> a |
|
400 | 400 | $ hg ci -m a |
|
401 | 401 | $ printf "e\n" >> a |
|
402 | 402 | $ hg ci -m a |
|
403 | 403 | $ printf "f\n" >> a |
|
404 | 404 | $ hg ci -m a |
|
405 | 405 | $ printf 'g\n' >> a |
|
406 | 406 | $ hg ci -m a |
|
407 | 407 | $ printf 'h\n' >> a |
|
408 | 408 | $ hg ci -m a |
|
409 | 409 | |
|
410 | 410 | $ hg debugrevlog -d a |
|
411 | 411 | # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen |
|
412 | 412 | 0 -1 -1 0 ??? 0 0 0 0 ??? ???? ? 1 0 (glob) |
|
413 | 413 | 1 0 -1 ??? ??? 0 0 0 0 ??? ???? ? 1 1 (glob) |
|
414 | 414 | 2 1 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob) |
|
415 | 415 | 3 2 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob) |
|
416 | 416 | 4 3 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 4 (glob) |
|
417 | 417 | 5 4 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 0 (glob) |
|
418 | 418 | 6 5 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 1 (glob) |
|
419 | 419 | 7 6 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob) |
|
420 | 420 | 8 7 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob) |
|
421 | 421 | #endif |
|
422 | 422 | |
|
423 | 423 | Test debuglocks command: |
|
424 | 424 | |
|
425 | 425 | $ hg debuglocks |
|
426 | 426 | lock: free |
|
427 | 427 | wlock: free |
|
428 | 428 | |
|
429 | 429 | * Test setting the lock |
|
430 | 430 | |
|
431 | 431 | waitlock <file> will wait for file to be created. If it isn't in a reasonable |
|
432 | 432 | amount of time, displays error message and returns 1 |
|
433 | 433 | $ waitlock() { |
|
434 | 434 | > start=`date +%s` |
|
435 | 435 | > timeout=5 |
|
436 | 436 | > while [ \( ! -f $1 \) -a \( ! -L $1 \) ]; do |
|
437 | 437 | > now=`date +%s` |
|
438 | 438 | > if [ "`expr $now - $start`" -gt $timeout ]; then |
|
439 | 439 | > echo "timeout: $1 was not created in $timeout seconds" |
|
440 | 440 | > return 1 |
|
441 | 441 | > fi |
|
442 | 442 | > sleep 0.1 |
|
443 | 443 | > done |
|
444 | 444 | > } |
|
445 | 445 | $ dolock() { |
|
446 | 446 | > { |
|
447 | 447 | > waitlock .hg/unlock |
|
448 | 448 | > rm -f .hg/unlock |
|
449 | 449 | > echo y |
|
450 | 450 | > } | hg debuglocks "$@" > /dev/null |
|
451 | 451 | > } |
|
452 | 452 | $ dolock -s & |
|
453 | 453 | $ waitlock .hg/store/lock |
|
454 | 454 | |
|
455 | 455 | $ hg debuglocks |
|
456 | 456 | lock: user *, process * (*s) (glob) |
|
457 | 457 | wlock: free |
|
458 | 458 | [1] |
|
459 | 459 | $ touch .hg/unlock |
|
460 | 460 | $ wait |
|
461 | 461 | $ [ -f .hg/store/lock ] || echo "There is no lock" |
|
462 | 462 | There is no lock |
|
463 | 463 | |
|
464 | 464 | * Test setting the wlock |
|
465 | 465 | |
|
466 | 466 | $ dolock -S & |
|
467 | 467 | $ waitlock .hg/wlock |
|
468 | 468 | |
|
469 | 469 | $ hg debuglocks |
|
470 | 470 | lock: free |
|
471 | 471 | wlock: user *, process * (*s) (glob) |
|
472 | 472 | [1] |
|
473 | 473 | $ touch .hg/unlock |
|
474 | 474 | $ wait |
|
475 | 475 | $ [ -f .hg/wlock ] || echo "There is no wlock" |
|
476 | 476 | There is no wlock |
|
477 | 477 | |
|
478 | 478 | * Test setting both locks |
|
479 | 479 | |
|
480 | 480 | $ dolock -Ss & |
|
481 | 481 | $ waitlock .hg/wlock && waitlock .hg/store/lock |
|
482 | 482 | |
|
483 | 483 | $ hg debuglocks |
|
484 | 484 | lock: user *, process * (*s) (glob) |
|
485 | 485 | wlock: user *, process * (*s) (glob) |
|
486 | 486 | [2] |
|
487 | 487 | |
|
488 | 488 | * Test failing to set a lock |
|
489 | 489 | |
|
490 | 490 | $ hg debuglocks -s |
|
491 | 491 | abort: lock is already held |
|
492 | 492 | [255] |
|
493 | 493 | |
|
494 | 494 | $ hg debuglocks -S |
|
495 | 495 | abort: wlock is already held |
|
496 | 496 | [255] |
|
497 | 497 | |
|
498 | 498 | $ touch .hg/unlock |
|
499 | 499 | $ wait |
|
500 | 500 | |
|
501 | 501 | $ hg debuglocks |
|
502 | 502 | lock: free |
|
503 | 503 | wlock: free |
|
504 | 504 | |
|
505 | 505 | * Test forcing the lock |
|
506 | 506 | |
|
507 | 507 | $ dolock -s & |
|
508 | 508 | $ waitlock .hg/store/lock |
|
509 | 509 | |
|
510 | 510 | $ hg debuglocks |
|
511 | 511 | lock: user *, process * (*s) (glob) |
|
512 | 512 | wlock: free |
|
513 | 513 | [1] |
|
514 | 514 | |
|
515 | 515 | $ hg debuglocks -L |
|
516 | 516 | |
|
517 | 517 | $ hg debuglocks |
|
518 | 518 | lock: free |
|
519 | 519 | wlock: free |
|
520 | 520 | |
|
521 | 521 | $ touch .hg/unlock |
|
522 | 522 | $ wait |
|
523 | 523 | |
|
524 | 524 | * Test forcing the wlock |
|
525 | 525 | |
|
526 | 526 | $ dolock -S & |
|
527 | 527 | $ waitlock .hg/wlock |
|
528 | 528 | |
|
529 | 529 | $ hg debuglocks |
|
530 | 530 | lock: free |
|
531 | 531 | wlock: user *, process * (*s) (glob) |
|
532 | 532 | [1] |
|
533 | 533 | |
|
534 | 534 | $ hg debuglocks -W |
|
535 | 535 | |
|
536 | 536 | $ hg debuglocks |
|
537 | 537 | lock: free |
|
538 | 538 | wlock: free |
|
539 | 539 | |
|
540 | 540 | $ touch .hg/unlock |
|
541 | 541 | $ wait |
|
542 | 542 | |
|
543 | 543 | Test WdirUnsupported exception |
|
544 | 544 | |
|
545 | 545 | $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff |
|
546 | 546 | abort: working directory revision cannot be specified |
|
547 | 547 | [255] |
|
548 | 548 | |
|
549 | 549 | Test cache warming command |
|
550 | 550 | |
|
551 | 551 | $ rm -rf .hg/cache/ |
|
552 | 552 | $ hg debugupdatecaches --debug |
|
553 | 553 | updating the branch cache |
|
554 | 554 | $ ls -r .hg/cache/* |
|
555 | 555 | .hg/cache/tags2-served |
|
556 | 556 | .hg/cache/tags2 |
|
557 | 557 | .hg/cache/rbc-revs-v1 |
|
558 | 558 | .hg/cache/rbc-names-v1 |
|
559 | 559 | .hg/cache/hgtagsfnodes1 |
|
560 | 560 | .hg/cache/branch2-visible-hidden |
|
561 | 561 | .hg/cache/branch2-visible |
|
562 | 562 | .hg/cache/branch2-served.hidden |
|
563 | 563 | .hg/cache/branch2-served |
|
564 | 564 | .hg/cache/branch2-immutable |
|
565 | 565 | .hg/cache/branch2-base |
|
566 | 566 | |
|
567 | 567 | Test debugcolor |
|
568 | 568 | |
|
569 | 569 | #if no-windows |
|
570 | 570 | $ hg debugcolor --style --color always | egrep 'mode|style|log\.' |
|
571 | 571 | color mode: 'ansi' |
|
572 | 572 | available style: |
|
573 | 573 | \x1b[0;33mlog.changeset\x1b[0m: \x1b[0;33myellow\x1b[0m (esc) |
|
574 | 574 | #endif |
|
575 | 575 | |
|
576 | 576 | $ hg debugcolor --style --color never |
|
577 | 577 | color mode: None |
|
578 | 578 | available style: |
|
579 | 579 | |
|
580 | 580 | $ cd .. |
|
581 | 581 | |
|
582 | 582 | Test internal debugstacktrace command |
|
583 | 583 | |
|
584 | 584 | $ cat > debugstacktrace.py << EOF |
|
585 | 585 | > from mercurial import ( |
|
586 | 586 | > util, |
|
587 | 587 | > ) |
|
588 | 588 | > from mercurial.utils import ( |
|
589 | 589 | > procutil, |
|
590 | 590 | > ) |
|
591 | 591 | > def f(): |
|
592 | 592 | > util.debugstacktrace(f=procutil.stdout) |
|
593 | 593 | > g() |
|
594 | 594 | > def g(): |
|
595 | 595 | > util.dst(b'hello from g\\n', skip=1) |
|
596 | 596 | > h() |
|
597 | 597 | > def h(): |
|
598 | 598 | > util.dst(b'hi ...\\nfrom h hidden in g', 1, depth=2) |
|
599 | 599 | > f() |
|
600 | 600 | > EOF |
|
601 | 601 | $ "$PYTHON" debugstacktrace.py |
|
602 | 602 | stacktrace at: |
|
603 | 603 | *debugstacktrace.py:15 in * (glob) |
|
604 | 604 | *debugstacktrace.py:8 in f (glob) |
|
605 | 605 | hello from g at: |
|
606 | 606 | *debugstacktrace.py:15 in * (glob) |
|
607 | 607 | *debugstacktrace.py:9 in f (glob) |
|
608 | 608 | hi ... |
|
609 | 609 | from h hidden in g at: |
|
610 | 610 | *debugstacktrace.py:9 in f (glob) |
|
611 | 611 | *debugstacktrace.py:12 in g (glob) |
|
612 | 612 | |
|
613 | 613 | Test debugcapabilities command: |
|
614 | 614 | |
|
615 | 615 | $ hg debugcapabilities ./debugrevlog/ |
|
616 | 616 | Main capabilities: |
|
617 | 617 | branchmap |
|
618 | 618 | $USUAL_BUNDLE2_CAPS$ |
|
619 | 619 | getbundle |
|
620 | 620 | known |
|
621 | 621 | lookup |
|
622 | 622 | pushkey |
|
623 | 623 | unbundle |
|
624 | 624 | Bundle2 capabilities: |
|
625 | 625 | HG20 |
|
626 | 626 | bookmarks |
|
627 | 627 | changegroup |
|
628 | 628 | 01 |
|
629 | 629 | 02 |
|
630 | 630 | checkheads |
|
631 | 631 | related |
|
632 | 632 | digests |
|
633 | 633 | md5 |
|
634 | 634 | sha1 |
|
635 | 635 | sha512 |
|
636 | 636 | error |
|
637 | 637 | abort |
|
638 | 638 | unsupportedcontent |
|
639 | 639 | pushraced |
|
640 | 640 | pushkey |
|
641 | 641 | hgtagsfnodes |
|
642 | 642 | listkeys |
|
643 | 643 | phases |
|
644 | 644 | heads |
|
645 | 645 | pushkey |
|
646 | 646 | remote-changegroup |
|
647 | 647 | http |
|
648 | 648 | https |
|
649 | 649 | stream |
|
650 | 650 | v2 |
|
651 | 651 | |
|
652 | 652 | Test debugpeer |
|
653 | 653 | |
|
654 | 654 | $ hg debugpeer ssh://user@dummy/debugrevlog |
|
655 | 655 | url: ssh://user@dummy/debugrevlog |
|
656 | 656 | local: no |
|
657 | 657 | pushable: yes |
|
658 | 658 | |
|
659 | 659 | #if rust |
|
660 | 660 | |
|
661 | 661 | $ hg --debug debugpeer ssh://user@dummy/debugrevlog |
|
662 | 662 | running .* ".*[/\\]dummyssh" ['"]user@dummy['"] ['"]hg -R debugrevlog serve --stdio['"] (re) |
|
663 | 663 | devel-peer-request: hello+between |
|
664 | 664 | devel-peer-request: pairs: 81 bytes |
|
665 | 665 | sending hello command |
|
666 | 666 | sending between command |
|
667 | 667 | remote: 468 |
|
668 | 668 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlog-compression-zstd,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
669 | 669 | remote: 1 |
|
670 | 670 | devel-peer-request: protocaps |
|
671 | 671 | devel-peer-request: caps: * bytes (glob) |
|
672 | 672 | sending protocaps command |
|
673 | 673 | url: ssh://user@dummy/debugrevlog |
|
674 | 674 | local: no |
|
675 | 675 | pushable: yes |
|
676 | 676 | |
|
677 | 677 | #endif |
|
678 | 678 | |
|
679 | 679 | #if no-rust zstd |
|
680 | 680 | |
|
681 | 681 | $ hg --debug debugpeer ssh://user@dummy/debugrevlog |
|
682 | 682 | running .* ".*[/\\]dummyssh" ['"]user@dummy['"] ['"]hg -R debugrevlog serve --stdio['"] (re) |
|
683 | 683 | devel-peer-request: hello+between |
|
684 | 684 | devel-peer-request: pairs: 81 bytes |
|
685 | 685 | sending hello command |
|
686 | 686 | sending between command |
|
687 | 687 | remote: 468 |
|
688 | 688 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlog-compression-zstd,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
689 | 689 | remote: 1 |
|
690 | 690 | devel-peer-request: protocaps |
|
691 | 691 | devel-peer-request: caps: * bytes (glob) |
|
692 | 692 | sending protocaps command |
|
693 | 693 | url: ssh://user@dummy/debugrevlog |
|
694 | 694 | local: no |
|
695 | 695 | pushable: yes |
|
696 | 696 | |
|
697 | 697 | #endif |
|
698 | 698 | |
|
699 | 699 | #if no-rust no-zstd |
|
700 | 700 | |
|
701 | 701 | $ hg --debug debugpeer ssh://user@dummy/debugrevlog |
|
702 | 702 | running .* ".*[/\\]dummyssh" ['"]user@dummy['"] ['"]hg -R debugrevlog serve --stdio['"] (re) |
|
703 | 703 | devel-peer-request: hello+between |
|
704 | 704 | devel-peer-request: pairs: 81 bytes |
|
705 | 705 | sending hello command |
|
706 | 706 | sending between command |
|
707 | 707 | remote: 444 |
|
708 | 708 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
709 | 709 | remote: 1 |
|
710 | 710 | devel-peer-request: protocaps |
|
711 | 711 | devel-peer-request: caps: * bytes (glob) |
|
712 | 712 | sending protocaps command |
|
713 | 713 | url: ssh://user@dummy/debugrevlog |
|
714 | 714 | local: no |
|
715 | 715 | pushable: yes |
|
716 | 716 | |
|
717 | 717 | #endif |
@@ -1,82 +1,82 | |||
|
1 | 1 | ========================================================== |
|
2 | 2 | Test file dedicated to checking side-data related behavior |
|
3 | 3 | ========================================================== |
|
4 | 4 | |
|
5 | 5 | Check data can be written/read from sidedata |
|
6 | 6 | ============================================ |
|
7 | 7 | |
|
8 | 8 | $ cat << EOF >> $HGRCPATH |
|
9 | 9 | > [extensions] |
|
10 | 10 | > testsidedata=$TESTDIR/testlib/ext-sidedata.py |
|
11 | 11 | > EOF |
|
12 | 12 | |
|
13 | 13 | $ hg init test-sidedata --config experimental.revlogv2=enable-unstable-format-and-corrupt-my-data |
|
14 | 14 | $ cd test-sidedata |
|
15 | 15 | $ echo aaa > a |
|
16 | 16 | $ hg add a |
|
17 | 17 | $ hg commit -m a --traceback |
|
18 | 18 | $ echo aaa > b |
|
19 | 19 | $ hg add b |
|
20 | 20 | $ hg commit -m b |
|
21 | 21 | $ echo xxx >> a |
|
22 | 22 | $ hg commit -m aa |
|
23 | 23 | |
|
24 | 24 | $ hg debugsidedata -c 0 |
|
25 | 25 | 2 sidedata entries |
|
26 | 26 | entry-0001 size 4 |
|
27 | 27 | entry-0002 size 32 |
|
28 | 28 | $ hg debugsidedata -c 1 -v |
|
29 | 29 | 2 sidedata entries |
|
30 | 30 | entry-0001 size 4 |
|
31 | 31 | '\x00\x00\x006' |
|
32 | 32 | entry-0002 size 32 |
|
33 | 33 | '\x98\t\xf9\xc4v\xf0\xc5P\x90\xf7wRf\xe8\xe27e\xfc\xc1\x93\xa4\x96\xd0\x1d\x97\xaaG\x1d\xd7t\xfa\xde' |
|
34 | 34 | $ hg debugsidedata -m 2 |
|
35 | 35 | 2 sidedata entries |
|
36 | 36 | entry-0001 size 4 |
|
37 | 37 | entry-0002 size 32 |
|
38 | 38 | $ hg debugsidedata a 1 |
|
39 | 39 | 2 sidedata entries |
|
40 | 40 | entry-0001 size 4 |
|
41 | 41 | entry-0002 size 32 |
|
42 | 42 | |
|
43 | 43 | $ hg debug-revlog-index --verbose -c |
|
44 | rev linkrev nodeid p1-rev p1-nodeid p2-rev p2-nodeid full-size delta-base flags comp-mode data-offset chunk-size sd-comp-mode sidedata-offset sd-chunk-size | |
|
45 | 0 0 7049e48789d7 -1 000000000000 -1 000000000000 54 0 0 0 0 54 plain 0 90 | |
|
46 | 1 1 2707720c6597 0 7049e48789d7 -1 000000000000 54 1 0 0 54 54 plain 90 90 | |
|
47 | 2 2 40f977031323 1 2707720c6597 -1 000000000000 55 2 0 0 108 55 plain 180 90 | |
|
44 | rev rank linkrev nodeid p1-rev p1-nodeid p2-rev p2-nodeid full-size delta-base flags comp-mode data-offset chunk-size sd-comp-mode sidedata-offset sd-chunk-size | |
|
45 | 0 -1 0 7049e48789d7 -1 000000000000 -1 000000000000 54 0 0 0 0 54 plain 0 90 | |
|
46 | 1 -1 1 2707720c6597 0 7049e48789d7 -1 000000000000 54 1 0 0 54 54 plain 90 90 | |
|
47 | 2 -1 2 40f977031323 1 2707720c6597 -1 000000000000 55 2 0 0 108 55 plain 180 90 | |
|
48 | 48 | |
|
49 | 49 | $ hg debug-revlog-index --verbose -m |
|
50 | rev linkrev nodeid p1-rev p1-nodeid p2-rev p2-nodeid full-size delta-base flags comp-mode data-offset chunk-size sd-comp-mode sidedata-offset sd-chunk-size | |
|
51 | 0 0 b85d294330e3 -1 000000000000 -1 000000000000 43 0 0 0 0 43 plain 0 90 | |
|
52 | 1 1 1a0aec305c63 0 b85d294330e3 -1 000000000000 86 0 0 0 43 55 plain 90 90 | |
|
53 | 2 2 104258a4f75f 1 1a0aec305c63 -1 000000000000 86 1 0 0 98 55 plain 180 90 | |
|
50 | rev rank linkrev nodeid p1-rev p1-nodeid p2-rev p2-nodeid full-size delta-base flags comp-mode data-offset chunk-size sd-comp-mode sidedata-offset sd-chunk-size | |
|
51 | 0 -1 0 b85d294330e3 -1 000000000000 -1 000000000000 43 0 0 0 0 43 plain 0 90 | |
|
52 | 1 -1 1 1a0aec305c63 0 b85d294330e3 -1 000000000000 86 0 0 0 43 55 plain 90 90 | |
|
53 | 2 -1 2 104258a4f75f 1 1a0aec305c63 -1 000000000000 86 1 0 0 98 55 plain 180 90 | |
|
54 | 54 | |
|
55 | 55 | Check upgrade behavior |
|
56 | 56 | ====================== |
|
57 | 57 | |
|
58 | 58 | Right now, sidedata has not upgrade support |
|
59 | 59 | |
|
60 | 60 | Check that we can upgrade to sidedata |
|
61 | 61 | ------------------------------------- |
|
62 | 62 | |
|
63 | 63 | $ hg init up-no-side-data --config experimental.revlogv2=no |
|
64 | 64 | $ hg debugformat -v -R up-no-side-data | egrep 'changelog-v2|revlog-v2' |
|
65 | 65 | revlog-v2: no no no |
|
66 | 66 | changelog-v2: no no no |
|
67 | 67 | $ hg debugformat -v -R up-no-side-data --config experimental.revlogv2=enable-unstable-format-and-corrupt-my-data | egrep 'changelog-v2|revlog-v2' |
|
68 | 68 | revlog-v2: no yes no |
|
69 | 69 | changelog-v2: no no no |
|
70 | 70 | $ hg debugupgraderepo -R up-no-side-data --config experimental.revlogv2=enable-unstable-format-and-corrupt-my-data > /dev/null |
|
71 | 71 | |
|
72 | 72 | Check that we can downgrade from sidedata |
|
73 | 73 | ----------------------------------------- |
|
74 | 74 | |
|
75 | 75 | $ hg init up-side-data --config experimental.revlogv2=enable-unstable-format-and-corrupt-my-data |
|
76 | 76 | $ hg debugformat -v -R up-side-data | egrep 'changelog-v2|revlog-v2' |
|
77 | 77 | revlog-v2: yes no no |
|
78 | 78 | changelog-v2: no no no |
|
79 | 79 | $ hg debugformat -v -R up-side-data --config experimental.revlogv2=no | egrep 'changelog-v2|revlog-v2' |
|
80 | 80 | revlog-v2: yes no no |
|
81 | 81 | changelog-v2: no no no |
|
82 | 82 | $ hg debugupgraderepo -R up-side-data --config experimental.revlogv2=no > /dev/null |
General Comments 0
You need to be logged in to leave comments.
Login now