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