Mercurial > hg
annotate mercurial/revlogutils/debug.py @ 49254:69983adfed06
debugindex: introduce a concept of "verbose-only" column
We are about to add a bunch of new column and most of them are probably only
relevant to --verbose.
We add some more testing of the `--verbose` mode in a sidedata context.
author | Pierre-Yves DAVID <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 01 Jun 2022 00:54:19 +0200 |
parents | a321304269cf |
children | 251650844331 |
rev | line source |
---|---|
49250
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
1 # revlogutils/debug.py - utility used for revlog debuging |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
2 # |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
3 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com> |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
4 # Copyright 2022 Octobus <contact@octobus.net> |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
5 # |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
6 # This software may be used and distributed according to the terms of the |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
7 # GNU General Public License version 2 or any later version. |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
8 |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
9 from .. import ( |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
10 node as nodemod, |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
11 ) |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
12 |
49253
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
13 from . import ( |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
14 constants, |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
15 ) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
16 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
17 INDEX_ENTRY_DEBUG_COLUMN = [] |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
18 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
19 NODE_SIZE = object() |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
20 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
21 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
22 class _column_base: |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
23 """constains the definition of a revlog column |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
24 |
49254
69983adfed06
debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49253
diff
changeset
|
25 name: the column header, |
69983adfed06
debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49253
diff
changeset
|
26 value_func: the function called to get a value, |
69983adfed06
debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49253
diff
changeset
|
27 size: the width of the column, |
69983adfed06
debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49253
diff
changeset
|
28 verbose_only: only include the column in verbose mode. |
49253
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
29 """ |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
30 |
49254
69983adfed06
debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49253
diff
changeset
|
31 def __init__(self, name, value_func, size=None, verbose=False): |
49253
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
32 self.name = name |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
33 self.value_func = value_func |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
34 if size is not NODE_SIZE: |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
35 if size is None: |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
36 size = 8 # arbitrary default |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
37 size = max(len(name), size) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
38 self._size = size |
49254
69983adfed06
debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49253
diff
changeset
|
39 self.verbose_only = verbose |
49253
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
40 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
41 def get_size(self, node_size): |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
42 if self._size is NODE_SIZE: |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
43 return node_size |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
44 else: |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
45 return self._size |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
46 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
47 |
49254
69983adfed06
debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49253
diff
changeset
|
48 def debug_column(name, size=None, verbose=False): |
49253
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
49 """decorated function is registered as a column |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
50 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
51 name: the name of the column, |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
52 size: the expected size of the column. |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
53 """ |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
54 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
55 def register(func): |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
56 entry = _column_base( |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
57 name=name, |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
58 value_func=func, |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
59 size=size, |
49254
69983adfed06
debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49253
diff
changeset
|
60 verbose=verbose, |
49253
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
61 ) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
62 INDEX_ENTRY_DEBUG_COLUMN.append(entry) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
63 return entry |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
64 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
65 return register |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
66 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
67 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
68 @debug_column(b"rev", size=6) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
69 def _rev(index, rev, entry, hexfn): |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
70 return b"%d" % rev |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
71 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
72 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
73 @debug_column(b"linkrev", size=6) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
74 def _linkrev(index, rev, entry, hexfn): |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
75 return b"%d" % entry[constants.ENTRY_LINK_REV] |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
76 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
77 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
78 @debug_column(b"nodeid", size=NODE_SIZE) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
79 def _nodeid(index, rev, entry, hexfn): |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
80 return hexfn(entry[constants.ENTRY_NODE_ID]) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
81 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
82 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
83 @debug_column(b"p1-nodeid", size=NODE_SIZE) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
84 def _p1_node(index, rev, entry, hexfn): |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
85 parent = entry[constants.ENTRY_PARENT_1] |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
86 p_entry = index[parent] |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
87 return hexfn(p_entry[constants.ENTRY_NODE_ID]) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
88 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
89 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
90 @debug_column(b"p2-nodeid", size=NODE_SIZE) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
91 def _p2_node(index, rev, entry, hexfn): |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
92 parent = entry[constants.ENTRY_PARENT_2] |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
93 p_entry = index[parent] |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
94 return hexfn(p_entry[constants.ENTRY_NODE_ID]) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
95 |
49250
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
96 |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
97 def debug_index( |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
98 ui, |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
99 repo, |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
100 formatter, |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
101 revlog, |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
102 full_node, |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
103 ): |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
104 """display index data for a revlog""" |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
105 if full_node: |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
106 hexfn = nodemod.hex |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
107 else: |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
108 hexfn = nodemod.short |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
109 |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
110 idlen = 12 |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
111 for i in revlog: |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
112 idlen = len(hexfn(revlog.node(i))) |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
113 break |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
114 |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
115 fm = formatter |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
116 |
49253
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
117 header_pieces = [] |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
118 for column in INDEX_ENTRY_DEBUG_COLUMN: |
49254
69983adfed06
debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49253
diff
changeset
|
119 if column.verbose_only and not ui.verbose: |
69983adfed06
debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49253
diff
changeset
|
120 continue |
49253
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
121 size = column.get_size(idlen) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
122 name = column.name |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
123 header_pieces.append(name.rjust(size)) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
124 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
125 fm.plain(b' '.join(header_pieces) + b'\n') |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
126 |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
127 index = revlog.index |
49250
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
128 |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
129 for rev in revlog: |
49253
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
130 fm.startitem() |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
131 entry = index[rev] |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
132 first = True |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
133 for column in INDEX_ENTRY_DEBUG_COLUMN: |
49254
69983adfed06
debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49253
diff
changeset
|
134 if column.verbose_only and not ui.verbose: |
69983adfed06
debugindex: introduce a concept of "verbose-only" column
Pierre-Yves DAVID <pierre-yves.david@octobus.net>
parents:
49253
diff
changeset
|
135 continue |
49253
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
136 if not first: |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
137 fm.plain(b' ') |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
138 first = False |
49250
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
139 |
49253
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
140 size = column.get_size(idlen) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
141 value = column.value_func(index, rev, entry, hexfn) |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
142 display = b"%%%ds" % size |
a321304269cf
debugindex: move to a flexible column
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49252
diff
changeset
|
143 fm.write(column.name, display, value) |
49250
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
144 fm.plain(b'\n') |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
145 |
61cf3d39fd9e
debugindex: move the logic into its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
146 fm.end() |