##// END OF EJS Templates
help: allow commands to be hidden...
rdamazio@google.com -
r40448:ab09e797 default
parent child Browse files
Show More
@@ -0,0 +1,127 b''
1 Test hiding some commands (which also happens to hide an entire category).
2
3 $ hg --config help.hidden-command.clone=true \
4 > --config help.hidden-command.init=true help
5 Mercurial Distributed SCM
6
7 list of commands:
8
9 Remote repository management:
10
11 incoming show new changesets found in source
12 outgoing show changesets not found in the destination
13 paths show aliases for remote repositories
14 pull pull changes from the specified source
15 push push changes to the specified destination
16 serve start stand-alone webserver
17
18 Change creation:
19
20 commit commit the specified files or all outstanding changes
21
22 Change manipulation:
23
24 backout reverse effect of earlier changeset
25 graft copy changes from other branches onto the current branch
26 merge merge another revision into working directory
27
28 Change organization:
29
30 bookmarks create a new bookmark or list existing bookmarks
31 branch set or show the current branch name
32 branches list repository named branches
33 phase set or show the current phase name
34 tag add one or more tags for the current or given revision
35 tags list repository tags
36
37 File content management:
38
39 annotate show changeset information by line for each file
40 cat output the current or given revision of files
41 copy mark files as copied for the next commit
42 diff diff repository (or selected files)
43 grep search revision history for a pattern in specified files
44
45 Change navigation:
46
47 bisect subdivision search of changesets
48 heads show branch heads
49 identify identify the working directory or specified revision
50 log show revision history of entire repository or files
51
52 Working directory management:
53
54 add add the specified files on the next commit
55 addremove add all new files, delete all missing files
56 files list tracked files
57 forget forget the specified files on the next commit
58 remove remove the specified files on the next commit
59 rename rename files; equivalent of copy + remove
60 resolve redo merges or set/view the merge status of files
61 revert restore files to their checkout state
62 root print the root (top) of the current working directory
63 status show changed files in the working directory
64 summary summarize working directory state
65 update update working directory (or switch revisions)
66
67 Change import/export:
68
69 archive create an unversioned archive of a repository revision
70 bundle create a bundle file
71 export dump the header and diffs for one or more changesets
72 import import an ordered set of patches
73 unbundle apply one or more bundle files
74
75 Repository maintenance:
76
77 manifest output the current or given revision of the project manifest
78 recover roll back an interrupted transaction
79 verify verify the integrity of the repository
80
81 Help:
82
83 config show combined config settings from all hgrc files
84 help show help for a given topic or a help overview
85 version output version and copyright information
86
87 additional help topics:
88
89 Mercurial identifiers:
90
91 filesets Specifying File Sets
92 hgignore Syntax for Mercurial Ignore Files
93 patterns File Name Patterns
94 revisions Specifying Revisions
95 urls URL Paths
96
97 Mercurial output:
98
99 color Colorizing Outputs
100 dates Date Formats
101 diffs Diff Formats
102 templating Template Usage
103
104 Mercurial configuration:
105
106 config Configuration Files
107 environment Environment Variables
108 extensions Using Additional Features
109 flags Command-line flags
110 hgweb Configuring hgweb
111 merge-tools Merge Tools
112 pager Pager Support
113
114 Concepts:
115
116 bundlespec Bundle File Formats
117 glossary Glossary
118 phases Working with Phases
119 subrepos Subrepositories
120
121 Miscellaneous:
122
123 deprecated Deprecated Features
124 internals Technical implementation topics
125 scripting Using Mercurial from scripts and automation
126
127 (use 'hg help -v' to show built-in aliases and global options)
@@ -1,1427 +1,1431 b''
1 # configitems.py - centralized declaration of configuration option
1 # configitems.py - centralized declaration of configuration option
2 #
2 #
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import functools
10 import functools
11 import re
11 import re
12
12
13 from . import (
13 from . import (
14 encoding,
14 encoding,
15 error,
15 error,
16 )
16 )
17
17
18 def loadconfigtable(ui, extname, configtable):
18 def loadconfigtable(ui, extname, configtable):
19 """update config item known to the ui with the extension ones"""
19 """update config item known to the ui with the extension ones"""
20 for section, items in sorted(configtable.items()):
20 for section, items in sorted(configtable.items()):
21 knownitems = ui._knownconfig.setdefault(section, itemregister())
21 knownitems = ui._knownconfig.setdefault(section, itemregister())
22 knownkeys = set(knownitems)
22 knownkeys = set(knownitems)
23 newkeys = set(items)
23 newkeys = set(items)
24 for key in sorted(knownkeys & newkeys):
24 for key in sorted(knownkeys & newkeys):
25 msg = "extension '%s' overwrite config item '%s.%s'"
25 msg = "extension '%s' overwrite config item '%s.%s'"
26 msg %= (extname, section, key)
26 msg %= (extname, section, key)
27 ui.develwarn(msg, config='warn-config')
27 ui.develwarn(msg, config='warn-config')
28
28
29 knownitems.update(items)
29 knownitems.update(items)
30
30
31 class configitem(object):
31 class configitem(object):
32 """represent a known config item
32 """represent a known config item
33
33
34 :section: the official config section where to find this item,
34 :section: the official config section where to find this item,
35 :name: the official name within the section,
35 :name: the official name within the section,
36 :default: default value for this item,
36 :default: default value for this item,
37 :alias: optional list of tuples as alternatives,
37 :alias: optional list of tuples as alternatives,
38 :generic: this is a generic definition, match name using regular expression.
38 :generic: this is a generic definition, match name using regular expression.
39 """
39 """
40
40
41 def __init__(self, section, name, default=None, alias=(),
41 def __init__(self, section, name, default=None, alias=(),
42 generic=False, priority=0):
42 generic=False, priority=0):
43 self.section = section
43 self.section = section
44 self.name = name
44 self.name = name
45 self.default = default
45 self.default = default
46 self.alias = list(alias)
46 self.alias = list(alias)
47 self.generic = generic
47 self.generic = generic
48 self.priority = priority
48 self.priority = priority
49 self._re = None
49 self._re = None
50 if generic:
50 if generic:
51 self._re = re.compile(self.name)
51 self._re = re.compile(self.name)
52
52
53 class itemregister(dict):
53 class itemregister(dict):
54 """A specialized dictionary that can handle wild-card selection"""
54 """A specialized dictionary that can handle wild-card selection"""
55
55
56 def __init__(self):
56 def __init__(self):
57 super(itemregister, self).__init__()
57 super(itemregister, self).__init__()
58 self._generics = set()
58 self._generics = set()
59
59
60 def update(self, other):
60 def update(self, other):
61 super(itemregister, self).update(other)
61 super(itemregister, self).update(other)
62 self._generics.update(other._generics)
62 self._generics.update(other._generics)
63
63
64 def __setitem__(self, key, item):
64 def __setitem__(self, key, item):
65 super(itemregister, self).__setitem__(key, item)
65 super(itemregister, self).__setitem__(key, item)
66 if item.generic:
66 if item.generic:
67 self._generics.add(item)
67 self._generics.add(item)
68
68
69 def get(self, key):
69 def get(self, key):
70 baseitem = super(itemregister, self).get(key)
70 baseitem = super(itemregister, self).get(key)
71 if baseitem is not None and not baseitem.generic:
71 if baseitem is not None and not baseitem.generic:
72 return baseitem
72 return baseitem
73
73
74 # search for a matching generic item
74 # search for a matching generic item
75 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
75 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
76 for item in generics:
76 for item in generics:
77 # we use 'match' instead of 'search' to make the matching simpler
77 # we use 'match' instead of 'search' to make the matching simpler
78 # for people unfamiliar with regular expression. Having the match
78 # for people unfamiliar with regular expression. Having the match
79 # rooted to the start of the string will produce less surprising
79 # rooted to the start of the string will produce less surprising
80 # result for user writing simple regex for sub-attribute.
80 # result for user writing simple regex for sub-attribute.
81 #
81 #
82 # For example using "color\..*" match produces an unsurprising
82 # For example using "color\..*" match produces an unsurprising
83 # result, while using search could suddenly match apparently
83 # result, while using search could suddenly match apparently
84 # unrelated configuration that happens to contains "color."
84 # unrelated configuration that happens to contains "color."
85 # anywhere. This is a tradeoff where we favor requiring ".*" on
85 # anywhere. This is a tradeoff where we favor requiring ".*" on
86 # some match to avoid the need to prefix most pattern with "^".
86 # some match to avoid the need to prefix most pattern with "^".
87 # The "^" seems more error prone.
87 # The "^" seems more error prone.
88 if item._re.match(key):
88 if item._re.match(key):
89 return item
89 return item
90
90
91 return None
91 return None
92
92
93 coreitems = {}
93 coreitems = {}
94
94
95 def _register(configtable, *args, **kwargs):
95 def _register(configtable, *args, **kwargs):
96 item = configitem(*args, **kwargs)
96 item = configitem(*args, **kwargs)
97 section = configtable.setdefault(item.section, itemregister())
97 section = configtable.setdefault(item.section, itemregister())
98 if item.name in section:
98 if item.name in section:
99 msg = "duplicated config item registration for '%s.%s'"
99 msg = "duplicated config item registration for '%s.%s'"
100 raise error.ProgrammingError(msg % (item.section, item.name))
100 raise error.ProgrammingError(msg % (item.section, item.name))
101 section[item.name] = item
101 section[item.name] = item
102
102
103 # special value for case where the default is derived from other values
103 # special value for case where the default is derived from other values
104 dynamicdefault = object()
104 dynamicdefault = object()
105
105
106 # Registering actual config items
106 # Registering actual config items
107
107
108 def getitemregister(configtable):
108 def getitemregister(configtable):
109 f = functools.partial(_register, configtable)
109 f = functools.partial(_register, configtable)
110 # export pseudo enum as configitem.*
110 # export pseudo enum as configitem.*
111 f.dynamicdefault = dynamicdefault
111 f.dynamicdefault = dynamicdefault
112 return f
112 return f
113
113
114 coreconfigitem = getitemregister(coreitems)
114 coreconfigitem = getitemregister(coreitems)
115
115
116 coreconfigitem('alias', '.*',
116 coreconfigitem('alias', '.*',
117 default=dynamicdefault,
117 default=dynamicdefault,
118 generic=True,
118 generic=True,
119 )
119 )
120 coreconfigitem('annotate', 'nodates',
120 coreconfigitem('annotate', 'nodates',
121 default=False,
121 default=False,
122 )
122 )
123 coreconfigitem('annotate', 'showfunc',
123 coreconfigitem('annotate', 'showfunc',
124 default=False,
124 default=False,
125 )
125 )
126 coreconfigitem('annotate', 'unified',
126 coreconfigitem('annotate', 'unified',
127 default=None,
127 default=None,
128 )
128 )
129 coreconfigitem('annotate', 'git',
129 coreconfigitem('annotate', 'git',
130 default=False,
130 default=False,
131 )
131 )
132 coreconfigitem('annotate', 'ignorews',
132 coreconfigitem('annotate', 'ignorews',
133 default=False,
133 default=False,
134 )
134 )
135 coreconfigitem('annotate', 'ignorewsamount',
135 coreconfigitem('annotate', 'ignorewsamount',
136 default=False,
136 default=False,
137 )
137 )
138 coreconfigitem('annotate', 'ignoreblanklines',
138 coreconfigitem('annotate', 'ignoreblanklines',
139 default=False,
139 default=False,
140 )
140 )
141 coreconfigitem('annotate', 'ignorewseol',
141 coreconfigitem('annotate', 'ignorewseol',
142 default=False,
142 default=False,
143 )
143 )
144 coreconfigitem('annotate', 'nobinary',
144 coreconfigitem('annotate', 'nobinary',
145 default=False,
145 default=False,
146 )
146 )
147 coreconfigitem('annotate', 'noprefix',
147 coreconfigitem('annotate', 'noprefix',
148 default=False,
148 default=False,
149 )
149 )
150 coreconfigitem('annotate', 'word-diff',
150 coreconfigitem('annotate', 'word-diff',
151 default=False,
151 default=False,
152 )
152 )
153 coreconfigitem('auth', 'cookiefile',
153 coreconfigitem('auth', 'cookiefile',
154 default=None,
154 default=None,
155 )
155 )
156 # bookmarks.pushing: internal hack for discovery
156 # bookmarks.pushing: internal hack for discovery
157 coreconfigitem('bookmarks', 'pushing',
157 coreconfigitem('bookmarks', 'pushing',
158 default=list,
158 default=list,
159 )
159 )
160 # bundle.mainreporoot: internal hack for bundlerepo
160 # bundle.mainreporoot: internal hack for bundlerepo
161 coreconfigitem('bundle', 'mainreporoot',
161 coreconfigitem('bundle', 'mainreporoot',
162 default='',
162 default='',
163 )
163 )
164 coreconfigitem('censor', 'policy',
164 coreconfigitem('censor', 'policy',
165 default='abort',
165 default='abort',
166 )
166 )
167 coreconfigitem('chgserver', 'idletimeout',
167 coreconfigitem('chgserver', 'idletimeout',
168 default=3600,
168 default=3600,
169 )
169 )
170 coreconfigitem('chgserver', 'skiphash',
170 coreconfigitem('chgserver', 'skiphash',
171 default=False,
171 default=False,
172 )
172 )
173 coreconfigitem('cmdserver', 'log',
173 coreconfigitem('cmdserver', 'log',
174 default=None,
174 default=None,
175 )
175 )
176 coreconfigitem('color', '.*',
176 coreconfigitem('color', '.*',
177 default=None,
177 default=None,
178 generic=True,
178 generic=True,
179 )
179 )
180 coreconfigitem('color', 'mode',
180 coreconfigitem('color', 'mode',
181 default='auto',
181 default='auto',
182 )
182 )
183 coreconfigitem('color', 'pagermode',
183 coreconfigitem('color', 'pagermode',
184 default=dynamicdefault,
184 default=dynamicdefault,
185 )
185 )
186 coreconfigitem('commands', 'grep.all-files',
186 coreconfigitem('commands', 'grep.all-files',
187 default=False,
187 default=False,
188 )
188 )
189 coreconfigitem('commands', 'resolve.confirm',
189 coreconfigitem('commands', 'resolve.confirm',
190 default=False,
190 default=False,
191 )
191 )
192 coreconfigitem('commands', 'resolve.explicit-re-merge',
192 coreconfigitem('commands', 'resolve.explicit-re-merge',
193 default=False,
193 default=False,
194 )
194 )
195 coreconfigitem('commands', 'resolve.mark-check',
195 coreconfigitem('commands', 'resolve.mark-check',
196 default='none',
196 default='none',
197 )
197 )
198 coreconfigitem('commands', 'show.aliasprefix',
198 coreconfigitem('commands', 'show.aliasprefix',
199 default=list,
199 default=list,
200 )
200 )
201 coreconfigitem('commands', 'status.relative',
201 coreconfigitem('commands', 'status.relative',
202 default=False,
202 default=False,
203 )
203 )
204 coreconfigitem('commands', 'status.skipstates',
204 coreconfigitem('commands', 'status.skipstates',
205 default=[],
205 default=[],
206 )
206 )
207 coreconfigitem('commands', 'status.terse',
207 coreconfigitem('commands', 'status.terse',
208 default='',
208 default='',
209 )
209 )
210 coreconfigitem('commands', 'status.verbose',
210 coreconfigitem('commands', 'status.verbose',
211 default=False,
211 default=False,
212 )
212 )
213 coreconfigitem('commands', 'update.check',
213 coreconfigitem('commands', 'update.check',
214 default=None,
214 default=None,
215 )
215 )
216 coreconfigitem('commands', 'update.requiredest',
216 coreconfigitem('commands', 'update.requiredest',
217 default=False,
217 default=False,
218 )
218 )
219 coreconfigitem('committemplate', '.*',
219 coreconfigitem('committemplate', '.*',
220 default=None,
220 default=None,
221 generic=True,
221 generic=True,
222 )
222 )
223 coreconfigitem('convert', 'bzr.saverev',
223 coreconfigitem('convert', 'bzr.saverev',
224 default=True,
224 default=True,
225 )
225 )
226 coreconfigitem('convert', 'cvsps.cache',
226 coreconfigitem('convert', 'cvsps.cache',
227 default=True,
227 default=True,
228 )
228 )
229 coreconfigitem('convert', 'cvsps.fuzz',
229 coreconfigitem('convert', 'cvsps.fuzz',
230 default=60,
230 default=60,
231 )
231 )
232 coreconfigitem('convert', 'cvsps.logencoding',
232 coreconfigitem('convert', 'cvsps.logencoding',
233 default=None,
233 default=None,
234 )
234 )
235 coreconfigitem('convert', 'cvsps.mergefrom',
235 coreconfigitem('convert', 'cvsps.mergefrom',
236 default=None,
236 default=None,
237 )
237 )
238 coreconfigitem('convert', 'cvsps.mergeto',
238 coreconfigitem('convert', 'cvsps.mergeto',
239 default=None,
239 default=None,
240 )
240 )
241 coreconfigitem('convert', 'git.committeractions',
241 coreconfigitem('convert', 'git.committeractions',
242 default=lambda: ['messagedifferent'],
242 default=lambda: ['messagedifferent'],
243 )
243 )
244 coreconfigitem('convert', 'git.extrakeys',
244 coreconfigitem('convert', 'git.extrakeys',
245 default=list,
245 default=list,
246 )
246 )
247 coreconfigitem('convert', 'git.findcopiesharder',
247 coreconfigitem('convert', 'git.findcopiesharder',
248 default=False,
248 default=False,
249 )
249 )
250 coreconfigitem('convert', 'git.remoteprefix',
250 coreconfigitem('convert', 'git.remoteprefix',
251 default='remote',
251 default='remote',
252 )
252 )
253 coreconfigitem('convert', 'git.renamelimit',
253 coreconfigitem('convert', 'git.renamelimit',
254 default=400,
254 default=400,
255 )
255 )
256 coreconfigitem('convert', 'git.saverev',
256 coreconfigitem('convert', 'git.saverev',
257 default=True,
257 default=True,
258 )
258 )
259 coreconfigitem('convert', 'git.similarity',
259 coreconfigitem('convert', 'git.similarity',
260 default=50,
260 default=50,
261 )
261 )
262 coreconfigitem('convert', 'git.skipsubmodules',
262 coreconfigitem('convert', 'git.skipsubmodules',
263 default=False,
263 default=False,
264 )
264 )
265 coreconfigitem('convert', 'hg.clonebranches',
265 coreconfigitem('convert', 'hg.clonebranches',
266 default=False,
266 default=False,
267 )
267 )
268 coreconfigitem('convert', 'hg.ignoreerrors',
268 coreconfigitem('convert', 'hg.ignoreerrors',
269 default=False,
269 default=False,
270 )
270 )
271 coreconfigitem('convert', 'hg.revs',
271 coreconfigitem('convert', 'hg.revs',
272 default=None,
272 default=None,
273 )
273 )
274 coreconfigitem('convert', 'hg.saverev',
274 coreconfigitem('convert', 'hg.saverev',
275 default=False,
275 default=False,
276 )
276 )
277 coreconfigitem('convert', 'hg.sourcename',
277 coreconfigitem('convert', 'hg.sourcename',
278 default=None,
278 default=None,
279 )
279 )
280 coreconfigitem('convert', 'hg.startrev',
280 coreconfigitem('convert', 'hg.startrev',
281 default=None,
281 default=None,
282 )
282 )
283 coreconfigitem('convert', 'hg.tagsbranch',
283 coreconfigitem('convert', 'hg.tagsbranch',
284 default='default',
284 default='default',
285 )
285 )
286 coreconfigitem('convert', 'hg.usebranchnames',
286 coreconfigitem('convert', 'hg.usebranchnames',
287 default=True,
287 default=True,
288 )
288 )
289 coreconfigitem('convert', 'ignoreancestorcheck',
289 coreconfigitem('convert', 'ignoreancestorcheck',
290 default=False,
290 default=False,
291 )
291 )
292 coreconfigitem('convert', 'localtimezone',
292 coreconfigitem('convert', 'localtimezone',
293 default=False,
293 default=False,
294 )
294 )
295 coreconfigitem('convert', 'p4.encoding',
295 coreconfigitem('convert', 'p4.encoding',
296 default=dynamicdefault,
296 default=dynamicdefault,
297 )
297 )
298 coreconfigitem('convert', 'p4.startrev',
298 coreconfigitem('convert', 'p4.startrev',
299 default=0,
299 default=0,
300 )
300 )
301 coreconfigitem('convert', 'skiptags',
301 coreconfigitem('convert', 'skiptags',
302 default=False,
302 default=False,
303 )
303 )
304 coreconfigitem('convert', 'svn.debugsvnlog',
304 coreconfigitem('convert', 'svn.debugsvnlog',
305 default=True,
305 default=True,
306 )
306 )
307 coreconfigitem('convert', 'svn.trunk',
307 coreconfigitem('convert', 'svn.trunk',
308 default=None,
308 default=None,
309 )
309 )
310 coreconfigitem('convert', 'svn.tags',
310 coreconfigitem('convert', 'svn.tags',
311 default=None,
311 default=None,
312 )
312 )
313 coreconfigitem('convert', 'svn.branches',
313 coreconfigitem('convert', 'svn.branches',
314 default=None,
314 default=None,
315 )
315 )
316 coreconfigitem('convert', 'svn.startrev',
316 coreconfigitem('convert', 'svn.startrev',
317 default=0,
317 default=0,
318 )
318 )
319 coreconfigitem('debug', 'dirstate.delaywrite',
319 coreconfigitem('debug', 'dirstate.delaywrite',
320 default=0,
320 default=0,
321 )
321 )
322 coreconfigitem('defaults', '.*',
322 coreconfigitem('defaults', '.*',
323 default=None,
323 default=None,
324 generic=True,
324 generic=True,
325 )
325 )
326 coreconfigitem('devel', 'all-warnings',
326 coreconfigitem('devel', 'all-warnings',
327 default=False,
327 default=False,
328 )
328 )
329 coreconfigitem('devel', 'bundle2.debug',
329 coreconfigitem('devel', 'bundle2.debug',
330 default=False,
330 default=False,
331 )
331 )
332 coreconfigitem('devel', 'cache-vfs',
332 coreconfigitem('devel', 'cache-vfs',
333 default=None,
333 default=None,
334 )
334 )
335 coreconfigitem('devel', 'check-locks',
335 coreconfigitem('devel', 'check-locks',
336 default=False,
336 default=False,
337 )
337 )
338 coreconfigitem('devel', 'check-relroot',
338 coreconfigitem('devel', 'check-relroot',
339 default=False,
339 default=False,
340 )
340 )
341 coreconfigitem('devel', 'default-date',
341 coreconfigitem('devel', 'default-date',
342 default=None,
342 default=None,
343 )
343 )
344 coreconfigitem('devel', 'deprec-warn',
344 coreconfigitem('devel', 'deprec-warn',
345 default=False,
345 default=False,
346 )
346 )
347 coreconfigitem('devel', 'disableloaddefaultcerts',
347 coreconfigitem('devel', 'disableloaddefaultcerts',
348 default=False,
348 default=False,
349 )
349 )
350 coreconfigitem('devel', 'warn-empty-changegroup',
350 coreconfigitem('devel', 'warn-empty-changegroup',
351 default=False,
351 default=False,
352 )
352 )
353 coreconfigitem('devel', 'legacy.exchange',
353 coreconfigitem('devel', 'legacy.exchange',
354 default=list,
354 default=list,
355 )
355 )
356 coreconfigitem('devel', 'servercafile',
356 coreconfigitem('devel', 'servercafile',
357 default='',
357 default='',
358 )
358 )
359 coreconfigitem('devel', 'serverexactprotocol',
359 coreconfigitem('devel', 'serverexactprotocol',
360 default='',
360 default='',
361 )
361 )
362 coreconfigitem('devel', 'serverrequirecert',
362 coreconfigitem('devel', 'serverrequirecert',
363 default=False,
363 default=False,
364 )
364 )
365 coreconfigitem('devel', 'strip-obsmarkers',
365 coreconfigitem('devel', 'strip-obsmarkers',
366 default=True,
366 default=True,
367 )
367 )
368 coreconfigitem('devel', 'warn-config',
368 coreconfigitem('devel', 'warn-config',
369 default=None,
369 default=None,
370 )
370 )
371 coreconfigitem('devel', 'warn-config-default',
371 coreconfigitem('devel', 'warn-config-default',
372 default=None,
372 default=None,
373 )
373 )
374 coreconfigitem('devel', 'user.obsmarker',
374 coreconfigitem('devel', 'user.obsmarker',
375 default=None,
375 default=None,
376 )
376 )
377 coreconfigitem('devel', 'warn-config-unknown',
377 coreconfigitem('devel', 'warn-config-unknown',
378 default=None,
378 default=None,
379 )
379 )
380 coreconfigitem('devel', 'debug.copies',
380 coreconfigitem('devel', 'debug.copies',
381 default=False,
381 default=False,
382 )
382 )
383 coreconfigitem('devel', 'debug.extensions',
383 coreconfigitem('devel', 'debug.extensions',
384 default=False,
384 default=False,
385 )
385 )
386 coreconfigitem('devel', 'debug.peer-request',
386 coreconfigitem('devel', 'debug.peer-request',
387 default=False,
387 default=False,
388 )
388 )
389 coreconfigitem('diff', 'nodates',
389 coreconfigitem('diff', 'nodates',
390 default=False,
390 default=False,
391 )
391 )
392 coreconfigitem('diff', 'showfunc',
392 coreconfigitem('diff', 'showfunc',
393 default=False,
393 default=False,
394 )
394 )
395 coreconfigitem('diff', 'unified',
395 coreconfigitem('diff', 'unified',
396 default=None,
396 default=None,
397 )
397 )
398 coreconfigitem('diff', 'git',
398 coreconfigitem('diff', 'git',
399 default=False,
399 default=False,
400 )
400 )
401 coreconfigitem('diff', 'ignorews',
401 coreconfigitem('diff', 'ignorews',
402 default=False,
402 default=False,
403 )
403 )
404 coreconfigitem('diff', 'ignorewsamount',
404 coreconfigitem('diff', 'ignorewsamount',
405 default=False,
405 default=False,
406 )
406 )
407 coreconfigitem('diff', 'ignoreblanklines',
407 coreconfigitem('diff', 'ignoreblanklines',
408 default=False,
408 default=False,
409 )
409 )
410 coreconfigitem('diff', 'ignorewseol',
410 coreconfigitem('diff', 'ignorewseol',
411 default=False,
411 default=False,
412 )
412 )
413 coreconfigitem('diff', 'nobinary',
413 coreconfigitem('diff', 'nobinary',
414 default=False,
414 default=False,
415 )
415 )
416 coreconfigitem('diff', 'noprefix',
416 coreconfigitem('diff', 'noprefix',
417 default=False,
417 default=False,
418 )
418 )
419 coreconfigitem('diff', 'word-diff',
419 coreconfigitem('diff', 'word-diff',
420 default=False,
420 default=False,
421 )
421 )
422 coreconfigitem('email', 'bcc',
422 coreconfigitem('email', 'bcc',
423 default=None,
423 default=None,
424 )
424 )
425 coreconfigitem('email', 'cc',
425 coreconfigitem('email', 'cc',
426 default=None,
426 default=None,
427 )
427 )
428 coreconfigitem('email', 'charsets',
428 coreconfigitem('email', 'charsets',
429 default=list,
429 default=list,
430 )
430 )
431 coreconfigitem('email', 'from',
431 coreconfigitem('email', 'from',
432 default=None,
432 default=None,
433 )
433 )
434 coreconfigitem('email', 'method',
434 coreconfigitem('email', 'method',
435 default='smtp',
435 default='smtp',
436 )
436 )
437 coreconfigitem('email', 'reply-to',
437 coreconfigitem('email', 'reply-to',
438 default=None,
438 default=None,
439 )
439 )
440 coreconfigitem('email', 'to',
440 coreconfigitem('email', 'to',
441 default=None,
441 default=None,
442 )
442 )
443 coreconfigitem('experimental', 'archivemetatemplate',
443 coreconfigitem('experimental', 'archivemetatemplate',
444 default=dynamicdefault,
444 default=dynamicdefault,
445 )
445 )
446 coreconfigitem('experimental', 'bundle-phases',
446 coreconfigitem('experimental', 'bundle-phases',
447 default=False,
447 default=False,
448 )
448 )
449 coreconfigitem('experimental', 'bundle2-advertise',
449 coreconfigitem('experimental', 'bundle2-advertise',
450 default=True,
450 default=True,
451 )
451 )
452 coreconfigitem('experimental', 'bundle2-output-capture',
452 coreconfigitem('experimental', 'bundle2-output-capture',
453 default=False,
453 default=False,
454 )
454 )
455 coreconfigitem('experimental', 'bundle2.pushback',
455 coreconfigitem('experimental', 'bundle2.pushback',
456 default=False,
456 default=False,
457 )
457 )
458 coreconfigitem('experimental', 'bundle2lazylocking',
458 coreconfigitem('experimental', 'bundle2lazylocking',
459 default=False,
459 default=False,
460 )
460 )
461 coreconfigitem('experimental', 'bundlecomplevel',
461 coreconfigitem('experimental', 'bundlecomplevel',
462 default=None,
462 default=None,
463 )
463 )
464 coreconfigitem('experimental', 'bundlecomplevel.bzip2',
464 coreconfigitem('experimental', 'bundlecomplevel.bzip2',
465 default=None,
465 default=None,
466 )
466 )
467 coreconfigitem('experimental', 'bundlecomplevel.gzip',
467 coreconfigitem('experimental', 'bundlecomplevel.gzip',
468 default=None,
468 default=None,
469 )
469 )
470 coreconfigitem('experimental', 'bundlecomplevel.none',
470 coreconfigitem('experimental', 'bundlecomplevel.none',
471 default=None,
471 default=None,
472 )
472 )
473 coreconfigitem('experimental', 'bundlecomplevel.zstd',
473 coreconfigitem('experimental', 'bundlecomplevel.zstd',
474 default=None,
474 default=None,
475 )
475 )
476 coreconfigitem('experimental', 'changegroup3',
476 coreconfigitem('experimental', 'changegroup3',
477 default=False,
477 default=False,
478 )
478 )
479 coreconfigitem('experimental', 'clientcompressionengines',
479 coreconfigitem('experimental', 'clientcompressionengines',
480 default=list,
480 default=list,
481 )
481 )
482 coreconfigitem('experimental', 'copytrace',
482 coreconfigitem('experimental', 'copytrace',
483 default='on',
483 default='on',
484 )
484 )
485 coreconfigitem('experimental', 'copytrace.movecandidateslimit',
485 coreconfigitem('experimental', 'copytrace.movecandidateslimit',
486 default=100,
486 default=100,
487 )
487 )
488 coreconfigitem('experimental', 'copytrace.sourcecommitlimit',
488 coreconfigitem('experimental', 'copytrace.sourcecommitlimit',
489 default=100,
489 default=100,
490 )
490 )
491 coreconfigitem('experimental', 'crecordtest',
491 coreconfigitem('experimental', 'crecordtest',
492 default=None,
492 default=None,
493 )
493 )
494 coreconfigitem('experimental', 'directaccess',
494 coreconfigitem('experimental', 'directaccess',
495 default=False,
495 default=False,
496 )
496 )
497 coreconfigitem('experimental', 'directaccess.revnums',
497 coreconfigitem('experimental', 'directaccess.revnums',
498 default=False,
498 default=False,
499 )
499 )
500 coreconfigitem('experimental', 'editortmpinhg',
500 coreconfigitem('experimental', 'editortmpinhg',
501 default=False,
501 default=False,
502 )
502 )
503 coreconfigitem('experimental', 'evolution',
503 coreconfigitem('experimental', 'evolution',
504 default=list,
504 default=list,
505 )
505 )
506 coreconfigitem('experimental', 'evolution.allowdivergence',
506 coreconfigitem('experimental', 'evolution.allowdivergence',
507 default=False,
507 default=False,
508 alias=[('experimental', 'allowdivergence')]
508 alias=[('experimental', 'allowdivergence')]
509 )
509 )
510 coreconfigitem('experimental', 'evolution.allowunstable',
510 coreconfigitem('experimental', 'evolution.allowunstable',
511 default=None,
511 default=None,
512 )
512 )
513 coreconfigitem('experimental', 'evolution.createmarkers',
513 coreconfigitem('experimental', 'evolution.createmarkers',
514 default=None,
514 default=None,
515 )
515 )
516 coreconfigitem('experimental', 'evolution.effect-flags',
516 coreconfigitem('experimental', 'evolution.effect-flags',
517 default=True,
517 default=True,
518 alias=[('experimental', 'effect-flags')]
518 alias=[('experimental', 'effect-flags')]
519 )
519 )
520 coreconfigitem('experimental', 'evolution.exchange',
520 coreconfigitem('experimental', 'evolution.exchange',
521 default=None,
521 default=None,
522 )
522 )
523 coreconfigitem('experimental', 'evolution.bundle-obsmarker',
523 coreconfigitem('experimental', 'evolution.bundle-obsmarker',
524 default=False,
524 default=False,
525 )
525 )
526 coreconfigitem('experimental', 'evolution.report-instabilities',
526 coreconfigitem('experimental', 'evolution.report-instabilities',
527 default=True,
527 default=True,
528 )
528 )
529 coreconfigitem('experimental', 'evolution.track-operation',
529 coreconfigitem('experimental', 'evolution.track-operation',
530 default=True,
530 default=True,
531 )
531 )
532 coreconfigitem('experimental', 'maxdeltachainspan',
532 coreconfigitem('experimental', 'maxdeltachainspan',
533 default=-1,
533 default=-1,
534 )
534 )
535 coreconfigitem('experimental', 'mergetempdirprefix',
535 coreconfigitem('experimental', 'mergetempdirprefix',
536 default=None,
536 default=None,
537 )
537 )
538 coreconfigitem('experimental', 'mmapindexthreshold',
538 coreconfigitem('experimental', 'mmapindexthreshold',
539 default=None,
539 default=None,
540 )
540 )
541 coreconfigitem('experimental', 'narrow',
541 coreconfigitem('experimental', 'narrow',
542 default=False,
542 default=False,
543 )
543 )
544 coreconfigitem('experimental', 'nonnormalparanoidcheck',
544 coreconfigitem('experimental', 'nonnormalparanoidcheck',
545 default=False,
545 default=False,
546 )
546 )
547 coreconfigitem('experimental', 'exportableenviron',
547 coreconfigitem('experimental', 'exportableenviron',
548 default=list,
548 default=list,
549 )
549 )
550 coreconfigitem('experimental', 'extendedheader.index',
550 coreconfigitem('experimental', 'extendedheader.index',
551 default=None,
551 default=None,
552 )
552 )
553 coreconfigitem('experimental', 'extendedheader.similarity',
553 coreconfigitem('experimental', 'extendedheader.similarity',
554 default=False,
554 default=False,
555 )
555 )
556 coreconfigitem('experimental', 'format.compression',
556 coreconfigitem('experimental', 'format.compression',
557 default='zlib',
557 default='zlib',
558 )
558 )
559 coreconfigitem('experimental', 'graphshorten',
559 coreconfigitem('experimental', 'graphshorten',
560 default=False,
560 default=False,
561 )
561 )
562 coreconfigitem('experimental', 'graphstyle.parent',
562 coreconfigitem('experimental', 'graphstyle.parent',
563 default=dynamicdefault,
563 default=dynamicdefault,
564 )
564 )
565 coreconfigitem('experimental', 'graphstyle.missing',
565 coreconfigitem('experimental', 'graphstyle.missing',
566 default=dynamicdefault,
566 default=dynamicdefault,
567 )
567 )
568 coreconfigitem('experimental', 'graphstyle.grandparent',
568 coreconfigitem('experimental', 'graphstyle.grandparent',
569 default=dynamicdefault,
569 default=dynamicdefault,
570 )
570 )
571 coreconfigitem('experimental', 'hook-track-tags',
571 coreconfigitem('experimental', 'hook-track-tags',
572 default=False,
572 default=False,
573 )
573 )
574 coreconfigitem('experimental', 'httppeer.advertise-v2',
574 coreconfigitem('experimental', 'httppeer.advertise-v2',
575 default=False,
575 default=False,
576 )
576 )
577 coreconfigitem('experimental', 'httppeer.v2-encoder-order',
577 coreconfigitem('experimental', 'httppeer.v2-encoder-order',
578 default=None,
578 default=None,
579 )
579 )
580 coreconfigitem('experimental', 'httppostargs',
580 coreconfigitem('experimental', 'httppostargs',
581 default=False,
581 default=False,
582 )
582 )
583 coreconfigitem('experimental', 'mergedriver',
583 coreconfigitem('experimental', 'mergedriver',
584 default=None,
584 default=None,
585 )
585 )
586 coreconfigitem('experimental', 'nointerrupt', default=False)
586 coreconfigitem('experimental', 'nointerrupt', default=False)
587 coreconfigitem('experimental', 'nointerrupt-interactiveonly', default=True)
587 coreconfigitem('experimental', 'nointerrupt-interactiveonly', default=True)
588
588
589 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
589 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
590 default=False,
590 default=False,
591 )
591 )
592 coreconfigitem('experimental', 'remotenames',
592 coreconfigitem('experimental', 'remotenames',
593 default=False,
593 default=False,
594 )
594 )
595 coreconfigitem('experimental', 'removeemptydirs',
595 coreconfigitem('experimental', 'removeemptydirs',
596 default=True,
596 default=True,
597 )
597 )
598 coreconfigitem('experimental', 'revisions.prefixhexnode',
598 coreconfigitem('experimental', 'revisions.prefixhexnode',
599 default=False,
599 default=False,
600 )
600 )
601 coreconfigitem('experimental', 'revlogv2',
601 coreconfigitem('experimental', 'revlogv2',
602 default=None,
602 default=None,
603 )
603 )
604 coreconfigitem('experimental', 'revisions.disambiguatewithin',
604 coreconfigitem('experimental', 'revisions.disambiguatewithin',
605 default=None,
605 default=None,
606 )
606 )
607 coreconfigitem('experimental', 'server.filesdata.recommended-batch-size',
607 coreconfigitem('experimental', 'server.filesdata.recommended-batch-size',
608 default=50000,
608 default=50000,
609 )
609 )
610 coreconfigitem('experimental', 'server.manifestdata.recommended-batch-size',
610 coreconfigitem('experimental', 'server.manifestdata.recommended-batch-size',
611 default=100000,
611 default=100000,
612 )
612 )
613 coreconfigitem('experimental.server', 'stream-narrow-clones',
613 coreconfigitem('experimental.server', 'stream-narrow-clones',
614 default=False,
614 default=False,
615 )
615 )
616 coreconfigitem('experimental', 'single-head-per-branch',
616 coreconfigitem('experimental', 'single-head-per-branch',
617 default=False,
617 default=False,
618 )
618 )
619 coreconfigitem('experimental', 'sshserver.support-v2',
619 coreconfigitem('experimental', 'sshserver.support-v2',
620 default=False,
620 default=False,
621 )
621 )
622 coreconfigitem('experimental', 'sparse-read',
622 coreconfigitem('experimental', 'sparse-read',
623 default=False,
623 default=False,
624 )
624 )
625 coreconfigitem('experimental', 'sparse-read.density-threshold',
625 coreconfigitem('experimental', 'sparse-read.density-threshold',
626 default=0.50,
626 default=0.50,
627 )
627 )
628 coreconfigitem('experimental', 'sparse-read.min-gap-size',
628 coreconfigitem('experimental', 'sparse-read.min-gap-size',
629 default='65K',
629 default='65K',
630 )
630 )
631 coreconfigitem('experimental', 'treemanifest',
631 coreconfigitem('experimental', 'treemanifest',
632 default=False,
632 default=False,
633 )
633 )
634 coreconfigitem('experimental', 'update.atomic-file',
634 coreconfigitem('experimental', 'update.atomic-file',
635 default=False,
635 default=False,
636 )
636 )
637 coreconfigitem('experimental', 'sshpeer.advertise-v2',
637 coreconfigitem('experimental', 'sshpeer.advertise-v2',
638 default=False,
638 default=False,
639 )
639 )
640 coreconfigitem('experimental', 'web.apiserver',
640 coreconfigitem('experimental', 'web.apiserver',
641 default=False,
641 default=False,
642 )
642 )
643 coreconfigitem('experimental', 'web.api.http-v2',
643 coreconfigitem('experimental', 'web.api.http-v2',
644 default=False,
644 default=False,
645 )
645 )
646 coreconfigitem('experimental', 'web.api.debugreflect',
646 coreconfigitem('experimental', 'web.api.debugreflect',
647 default=False,
647 default=False,
648 )
648 )
649 coreconfigitem('experimental', 'worker.wdir-get-thread-safe',
649 coreconfigitem('experimental', 'worker.wdir-get-thread-safe',
650 default=False,
650 default=False,
651 )
651 )
652 coreconfigitem('experimental', 'xdiff',
652 coreconfigitem('experimental', 'xdiff',
653 default=False,
653 default=False,
654 )
654 )
655 coreconfigitem('extensions', '.*',
655 coreconfigitem('extensions', '.*',
656 default=None,
656 default=None,
657 generic=True,
657 generic=True,
658 )
658 )
659 coreconfigitem('extdata', '.*',
659 coreconfigitem('extdata', '.*',
660 default=None,
660 default=None,
661 generic=True,
661 generic=True,
662 )
662 )
663 coreconfigitem('format', 'chunkcachesize',
663 coreconfigitem('format', 'chunkcachesize',
664 default=None,
664 default=None,
665 )
665 )
666 coreconfigitem('format', 'dotencode',
666 coreconfigitem('format', 'dotencode',
667 default=True,
667 default=True,
668 )
668 )
669 coreconfigitem('format', 'generaldelta',
669 coreconfigitem('format', 'generaldelta',
670 default=False,
670 default=False,
671 )
671 )
672 coreconfigitem('format', 'manifestcachesize',
672 coreconfigitem('format', 'manifestcachesize',
673 default=None,
673 default=None,
674 )
674 )
675 coreconfigitem('format', 'maxchainlen',
675 coreconfigitem('format', 'maxchainlen',
676 default=dynamicdefault,
676 default=dynamicdefault,
677 )
677 )
678 coreconfigitem('format', 'obsstore-version',
678 coreconfigitem('format', 'obsstore-version',
679 default=None,
679 default=None,
680 )
680 )
681 coreconfigitem('format', 'sparse-revlog',
681 coreconfigitem('format', 'sparse-revlog',
682 default=False,
682 default=False,
683 )
683 )
684 coreconfigitem('format', 'usefncache',
684 coreconfigitem('format', 'usefncache',
685 default=True,
685 default=True,
686 )
686 )
687 coreconfigitem('format', 'usegeneraldelta',
687 coreconfigitem('format', 'usegeneraldelta',
688 default=True,
688 default=True,
689 )
689 )
690 coreconfigitem('format', 'usestore',
690 coreconfigitem('format', 'usestore',
691 default=True,
691 default=True,
692 )
692 )
693 coreconfigitem('format', 'internal-phase',
693 coreconfigitem('format', 'internal-phase',
694 default=False,
694 default=False,
695 )
695 )
696 coreconfigitem('fsmonitor', 'warn_when_unused',
696 coreconfigitem('fsmonitor', 'warn_when_unused',
697 default=True,
697 default=True,
698 )
698 )
699 coreconfigitem('fsmonitor', 'warn_update_file_count',
699 coreconfigitem('fsmonitor', 'warn_update_file_count',
700 default=50000,
700 default=50000,
701 )
701 )
702 coreconfigitem('help', 'hidden-command\..*',
703 default=False,
704 generic=True,
705 )
702 coreconfigitem('hooks', '.*',
706 coreconfigitem('hooks', '.*',
703 default=dynamicdefault,
707 default=dynamicdefault,
704 generic=True,
708 generic=True,
705 )
709 )
706 coreconfigitem('hgweb-paths', '.*',
710 coreconfigitem('hgweb-paths', '.*',
707 default=list,
711 default=list,
708 generic=True,
712 generic=True,
709 )
713 )
710 coreconfigitem('hostfingerprints', '.*',
714 coreconfigitem('hostfingerprints', '.*',
711 default=list,
715 default=list,
712 generic=True,
716 generic=True,
713 )
717 )
714 coreconfigitem('hostsecurity', 'ciphers',
718 coreconfigitem('hostsecurity', 'ciphers',
715 default=None,
719 default=None,
716 )
720 )
717 coreconfigitem('hostsecurity', 'disabletls10warning',
721 coreconfigitem('hostsecurity', 'disabletls10warning',
718 default=False,
722 default=False,
719 )
723 )
720 coreconfigitem('hostsecurity', 'minimumprotocol',
724 coreconfigitem('hostsecurity', 'minimumprotocol',
721 default=dynamicdefault,
725 default=dynamicdefault,
722 )
726 )
723 coreconfigitem('hostsecurity', '.*:minimumprotocol$',
727 coreconfigitem('hostsecurity', '.*:minimumprotocol$',
724 default=dynamicdefault,
728 default=dynamicdefault,
725 generic=True,
729 generic=True,
726 )
730 )
727 coreconfigitem('hostsecurity', '.*:ciphers$',
731 coreconfigitem('hostsecurity', '.*:ciphers$',
728 default=dynamicdefault,
732 default=dynamicdefault,
729 generic=True,
733 generic=True,
730 )
734 )
731 coreconfigitem('hostsecurity', '.*:fingerprints$',
735 coreconfigitem('hostsecurity', '.*:fingerprints$',
732 default=list,
736 default=list,
733 generic=True,
737 generic=True,
734 )
738 )
735 coreconfigitem('hostsecurity', '.*:verifycertsfile$',
739 coreconfigitem('hostsecurity', '.*:verifycertsfile$',
736 default=None,
740 default=None,
737 generic=True,
741 generic=True,
738 )
742 )
739
743
740 coreconfigitem('http_proxy', 'always',
744 coreconfigitem('http_proxy', 'always',
741 default=False,
745 default=False,
742 )
746 )
743 coreconfigitem('http_proxy', 'host',
747 coreconfigitem('http_proxy', 'host',
744 default=None,
748 default=None,
745 )
749 )
746 coreconfigitem('http_proxy', 'no',
750 coreconfigitem('http_proxy', 'no',
747 default=list,
751 default=list,
748 )
752 )
749 coreconfigitem('http_proxy', 'passwd',
753 coreconfigitem('http_proxy', 'passwd',
750 default=None,
754 default=None,
751 )
755 )
752 coreconfigitem('http_proxy', 'user',
756 coreconfigitem('http_proxy', 'user',
753 default=None,
757 default=None,
754 )
758 )
755
759
756 coreconfigitem('http', 'timeout',
760 coreconfigitem('http', 'timeout',
757 default=None,
761 default=None,
758 )
762 )
759
763
760 coreconfigitem('logtoprocess', 'commandexception',
764 coreconfigitem('logtoprocess', 'commandexception',
761 default=None,
765 default=None,
762 )
766 )
763 coreconfigitem('logtoprocess', 'commandfinish',
767 coreconfigitem('logtoprocess', 'commandfinish',
764 default=None,
768 default=None,
765 )
769 )
766 coreconfigitem('logtoprocess', 'command',
770 coreconfigitem('logtoprocess', 'command',
767 default=None,
771 default=None,
768 )
772 )
769 coreconfigitem('logtoprocess', 'develwarn',
773 coreconfigitem('logtoprocess', 'develwarn',
770 default=None,
774 default=None,
771 )
775 )
772 coreconfigitem('logtoprocess', 'uiblocked',
776 coreconfigitem('logtoprocess', 'uiblocked',
773 default=None,
777 default=None,
774 )
778 )
775 coreconfigitem('merge', 'checkunknown',
779 coreconfigitem('merge', 'checkunknown',
776 default='abort',
780 default='abort',
777 )
781 )
778 coreconfigitem('merge', 'checkignored',
782 coreconfigitem('merge', 'checkignored',
779 default='abort',
783 default='abort',
780 )
784 )
781 coreconfigitem('experimental', 'merge.checkpathconflicts',
785 coreconfigitem('experimental', 'merge.checkpathconflicts',
782 default=False,
786 default=False,
783 )
787 )
784 coreconfigitem('merge', 'followcopies',
788 coreconfigitem('merge', 'followcopies',
785 default=True,
789 default=True,
786 )
790 )
787 coreconfigitem('merge', 'on-failure',
791 coreconfigitem('merge', 'on-failure',
788 default='continue',
792 default='continue',
789 )
793 )
790 coreconfigitem('merge', 'preferancestor',
794 coreconfigitem('merge', 'preferancestor',
791 default=lambda: ['*'],
795 default=lambda: ['*'],
792 )
796 )
793 coreconfigitem('merge', 'strict-capability-check',
797 coreconfigitem('merge', 'strict-capability-check',
794 default=False,
798 default=False,
795 )
799 )
796 coreconfigitem('merge-tools', '.*',
800 coreconfigitem('merge-tools', '.*',
797 default=None,
801 default=None,
798 generic=True,
802 generic=True,
799 )
803 )
800 coreconfigitem('merge-tools', br'.*\.args$',
804 coreconfigitem('merge-tools', br'.*\.args$',
801 default="$local $base $other",
805 default="$local $base $other",
802 generic=True,
806 generic=True,
803 priority=-1,
807 priority=-1,
804 )
808 )
805 coreconfigitem('merge-tools', br'.*\.binary$',
809 coreconfigitem('merge-tools', br'.*\.binary$',
806 default=False,
810 default=False,
807 generic=True,
811 generic=True,
808 priority=-1,
812 priority=-1,
809 )
813 )
810 coreconfigitem('merge-tools', br'.*\.check$',
814 coreconfigitem('merge-tools', br'.*\.check$',
811 default=list,
815 default=list,
812 generic=True,
816 generic=True,
813 priority=-1,
817 priority=-1,
814 )
818 )
815 coreconfigitem('merge-tools', br'.*\.checkchanged$',
819 coreconfigitem('merge-tools', br'.*\.checkchanged$',
816 default=False,
820 default=False,
817 generic=True,
821 generic=True,
818 priority=-1,
822 priority=-1,
819 )
823 )
820 coreconfigitem('merge-tools', br'.*\.executable$',
824 coreconfigitem('merge-tools', br'.*\.executable$',
821 default=dynamicdefault,
825 default=dynamicdefault,
822 generic=True,
826 generic=True,
823 priority=-1,
827 priority=-1,
824 )
828 )
825 coreconfigitem('merge-tools', br'.*\.fixeol$',
829 coreconfigitem('merge-tools', br'.*\.fixeol$',
826 default=False,
830 default=False,
827 generic=True,
831 generic=True,
828 priority=-1,
832 priority=-1,
829 )
833 )
830 coreconfigitem('merge-tools', br'.*\.gui$',
834 coreconfigitem('merge-tools', br'.*\.gui$',
831 default=False,
835 default=False,
832 generic=True,
836 generic=True,
833 priority=-1,
837 priority=-1,
834 )
838 )
835 coreconfigitem('merge-tools', br'.*\.mergemarkers$',
839 coreconfigitem('merge-tools', br'.*\.mergemarkers$',
836 default='basic',
840 default='basic',
837 generic=True,
841 generic=True,
838 priority=-1,
842 priority=-1,
839 )
843 )
840 coreconfigitem('merge-tools', br'.*\.mergemarkertemplate$',
844 coreconfigitem('merge-tools', br'.*\.mergemarkertemplate$',
841 default=dynamicdefault, # take from ui.mergemarkertemplate
845 default=dynamicdefault, # take from ui.mergemarkertemplate
842 generic=True,
846 generic=True,
843 priority=-1,
847 priority=-1,
844 )
848 )
845 coreconfigitem('merge-tools', br'.*\.priority$',
849 coreconfigitem('merge-tools', br'.*\.priority$',
846 default=0,
850 default=0,
847 generic=True,
851 generic=True,
848 priority=-1,
852 priority=-1,
849 )
853 )
850 coreconfigitem('merge-tools', br'.*\.premerge$',
854 coreconfigitem('merge-tools', br'.*\.premerge$',
851 default=dynamicdefault,
855 default=dynamicdefault,
852 generic=True,
856 generic=True,
853 priority=-1,
857 priority=-1,
854 )
858 )
855 coreconfigitem('merge-tools', br'.*\.symlink$',
859 coreconfigitem('merge-tools', br'.*\.symlink$',
856 default=False,
860 default=False,
857 generic=True,
861 generic=True,
858 priority=-1,
862 priority=-1,
859 )
863 )
860 coreconfigitem('pager', 'attend-.*',
864 coreconfigitem('pager', 'attend-.*',
861 default=dynamicdefault,
865 default=dynamicdefault,
862 generic=True,
866 generic=True,
863 )
867 )
864 coreconfigitem('pager', 'ignore',
868 coreconfigitem('pager', 'ignore',
865 default=list,
869 default=list,
866 )
870 )
867 coreconfigitem('pager', 'pager',
871 coreconfigitem('pager', 'pager',
868 default=dynamicdefault,
872 default=dynamicdefault,
869 )
873 )
870 coreconfigitem('patch', 'eol',
874 coreconfigitem('patch', 'eol',
871 default='strict',
875 default='strict',
872 )
876 )
873 coreconfigitem('patch', 'fuzz',
877 coreconfigitem('patch', 'fuzz',
874 default=2,
878 default=2,
875 )
879 )
876 coreconfigitem('paths', 'default',
880 coreconfigitem('paths', 'default',
877 default=None,
881 default=None,
878 )
882 )
879 coreconfigitem('paths', 'default-push',
883 coreconfigitem('paths', 'default-push',
880 default=None,
884 default=None,
881 )
885 )
882 coreconfigitem('paths', '.*',
886 coreconfigitem('paths', '.*',
883 default=None,
887 default=None,
884 generic=True,
888 generic=True,
885 )
889 )
886 coreconfigitem('phases', 'checksubrepos',
890 coreconfigitem('phases', 'checksubrepos',
887 default='follow',
891 default='follow',
888 )
892 )
889 coreconfigitem('phases', 'new-commit',
893 coreconfigitem('phases', 'new-commit',
890 default='draft',
894 default='draft',
891 )
895 )
892 coreconfigitem('phases', 'publish',
896 coreconfigitem('phases', 'publish',
893 default=True,
897 default=True,
894 )
898 )
895 coreconfigitem('profiling', 'enabled',
899 coreconfigitem('profiling', 'enabled',
896 default=False,
900 default=False,
897 )
901 )
898 coreconfigitem('profiling', 'format',
902 coreconfigitem('profiling', 'format',
899 default='text',
903 default='text',
900 )
904 )
901 coreconfigitem('profiling', 'freq',
905 coreconfigitem('profiling', 'freq',
902 default=1000,
906 default=1000,
903 )
907 )
904 coreconfigitem('profiling', 'limit',
908 coreconfigitem('profiling', 'limit',
905 default=30,
909 default=30,
906 )
910 )
907 coreconfigitem('profiling', 'nested',
911 coreconfigitem('profiling', 'nested',
908 default=0,
912 default=0,
909 )
913 )
910 coreconfigitem('profiling', 'output',
914 coreconfigitem('profiling', 'output',
911 default=None,
915 default=None,
912 )
916 )
913 coreconfigitem('profiling', 'showmax',
917 coreconfigitem('profiling', 'showmax',
914 default=0.999,
918 default=0.999,
915 )
919 )
916 coreconfigitem('profiling', 'showmin',
920 coreconfigitem('profiling', 'showmin',
917 default=dynamicdefault,
921 default=dynamicdefault,
918 )
922 )
919 coreconfigitem('profiling', 'sort',
923 coreconfigitem('profiling', 'sort',
920 default='inlinetime',
924 default='inlinetime',
921 )
925 )
922 coreconfigitem('profiling', 'statformat',
926 coreconfigitem('profiling', 'statformat',
923 default='hotpath',
927 default='hotpath',
924 )
928 )
925 coreconfigitem('profiling', 'time-track',
929 coreconfigitem('profiling', 'time-track',
926 default='real',
930 default='real',
927 )
931 )
928 coreconfigitem('profiling', 'type',
932 coreconfigitem('profiling', 'type',
929 default='stat',
933 default='stat',
930 )
934 )
931 coreconfigitem('progress', 'assume-tty',
935 coreconfigitem('progress', 'assume-tty',
932 default=False,
936 default=False,
933 )
937 )
934 coreconfigitem('progress', 'changedelay',
938 coreconfigitem('progress', 'changedelay',
935 default=1,
939 default=1,
936 )
940 )
937 coreconfigitem('progress', 'clear-complete',
941 coreconfigitem('progress', 'clear-complete',
938 default=True,
942 default=True,
939 )
943 )
940 coreconfigitem('progress', 'debug',
944 coreconfigitem('progress', 'debug',
941 default=False,
945 default=False,
942 )
946 )
943 coreconfigitem('progress', 'delay',
947 coreconfigitem('progress', 'delay',
944 default=3,
948 default=3,
945 )
949 )
946 coreconfigitem('progress', 'disable',
950 coreconfigitem('progress', 'disable',
947 default=False,
951 default=False,
948 )
952 )
949 coreconfigitem('progress', 'estimateinterval',
953 coreconfigitem('progress', 'estimateinterval',
950 default=60.0,
954 default=60.0,
951 )
955 )
952 coreconfigitem('progress', 'format',
956 coreconfigitem('progress', 'format',
953 default=lambda: ['topic', 'bar', 'number', 'estimate'],
957 default=lambda: ['topic', 'bar', 'number', 'estimate'],
954 )
958 )
955 coreconfigitem('progress', 'refresh',
959 coreconfigitem('progress', 'refresh',
956 default=0.1,
960 default=0.1,
957 )
961 )
958 coreconfigitem('progress', 'width',
962 coreconfigitem('progress', 'width',
959 default=dynamicdefault,
963 default=dynamicdefault,
960 )
964 )
961 coreconfigitem('push', 'pushvars.server',
965 coreconfigitem('push', 'pushvars.server',
962 default=False,
966 default=False,
963 )
967 )
964 coreconfigitem('storage', 'new-repo-backend',
968 coreconfigitem('storage', 'new-repo-backend',
965 default='revlogv1',
969 default='revlogv1',
966 )
970 )
967 coreconfigitem('storage', 'revlog.optimize-delta-parent-choice',
971 coreconfigitem('storage', 'revlog.optimize-delta-parent-choice',
968 default=True,
972 default=True,
969 alias=[('format', 'aggressivemergedeltas')],
973 alias=[('format', 'aggressivemergedeltas')],
970 )
974 )
971 coreconfigitem('server', 'bookmarks-pushkey-compat',
975 coreconfigitem('server', 'bookmarks-pushkey-compat',
972 default=True,
976 default=True,
973 )
977 )
974 coreconfigitem('server', 'bundle1',
978 coreconfigitem('server', 'bundle1',
975 default=True,
979 default=True,
976 )
980 )
977 coreconfigitem('server', 'bundle1gd',
981 coreconfigitem('server', 'bundle1gd',
978 default=None,
982 default=None,
979 )
983 )
980 coreconfigitem('server', 'bundle1.pull',
984 coreconfigitem('server', 'bundle1.pull',
981 default=None,
985 default=None,
982 )
986 )
983 coreconfigitem('server', 'bundle1gd.pull',
987 coreconfigitem('server', 'bundle1gd.pull',
984 default=None,
988 default=None,
985 )
989 )
986 coreconfigitem('server', 'bundle1.push',
990 coreconfigitem('server', 'bundle1.push',
987 default=None,
991 default=None,
988 )
992 )
989 coreconfigitem('server', 'bundle1gd.push',
993 coreconfigitem('server', 'bundle1gd.push',
990 default=None,
994 default=None,
991 )
995 )
992 coreconfigitem('server', 'bundle2.stream',
996 coreconfigitem('server', 'bundle2.stream',
993 default=True,
997 default=True,
994 alias=[('experimental', 'bundle2.stream')]
998 alias=[('experimental', 'bundle2.stream')]
995 )
999 )
996 coreconfigitem('server', 'compressionengines',
1000 coreconfigitem('server', 'compressionengines',
997 default=list,
1001 default=list,
998 )
1002 )
999 coreconfigitem('server', 'concurrent-push-mode',
1003 coreconfigitem('server', 'concurrent-push-mode',
1000 default='strict',
1004 default='strict',
1001 )
1005 )
1002 coreconfigitem('server', 'disablefullbundle',
1006 coreconfigitem('server', 'disablefullbundle',
1003 default=False,
1007 default=False,
1004 )
1008 )
1005 coreconfigitem('server', 'maxhttpheaderlen',
1009 coreconfigitem('server', 'maxhttpheaderlen',
1006 default=1024,
1010 default=1024,
1007 )
1011 )
1008 coreconfigitem('server', 'pullbundle',
1012 coreconfigitem('server', 'pullbundle',
1009 default=False,
1013 default=False,
1010 )
1014 )
1011 coreconfigitem('server', 'preferuncompressed',
1015 coreconfigitem('server', 'preferuncompressed',
1012 default=False,
1016 default=False,
1013 )
1017 )
1014 coreconfigitem('server', 'streamunbundle',
1018 coreconfigitem('server', 'streamunbundle',
1015 default=False,
1019 default=False,
1016 )
1020 )
1017 coreconfigitem('server', 'uncompressed',
1021 coreconfigitem('server', 'uncompressed',
1018 default=True,
1022 default=True,
1019 )
1023 )
1020 coreconfigitem('server', 'uncompressedallowsecret',
1024 coreconfigitem('server', 'uncompressedallowsecret',
1021 default=False,
1025 default=False,
1022 )
1026 )
1023 coreconfigitem('server', 'validate',
1027 coreconfigitem('server', 'validate',
1024 default=False,
1028 default=False,
1025 )
1029 )
1026 coreconfigitem('server', 'zliblevel',
1030 coreconfigitem('server', 'zliblevel',
1027 default=-1,
1031 default=-1,
1028 )
1032 )
1029 coreconfigitem('server', 'zstdlevel',
1033 coreconfigitem('server', 'zstdlevel',
1030 default=3,
1034 default=3,
1031 )
1035 )
1032 coreconfigitem('share', 'pool',
1036 coreconfigitem('share', 'pool',
1033 default=None,
1037 default=None,
1034 )
1038 )
1035 coreconfigitem('share', 'poolnaming',
1039 coreconfigitem('share', 'poolnaming',
1036 default='identity',
1040 default='identity',
1037 )
1041 )
1038 coreconfigitem('smtp', 'host',
1042 coreconfigitem('smtp', 'host',
1039 default=None,
1043 default=None,
1040 )
1044 )
1041 coreconfigitem('smtp', 'local_hostname',
1045 coreconfigitem('smtp', 'local_hostname',
1042 default=None,
1046 default=None,
1043 )
1047 )
1044 coreconfigitem('smtp', 'password',
1048 coreconfigitem('smtp', 'password',
1045 default=None,
1049 default=None,
1046 )
1050 )
1047 coreconfigitem('smtp', 'port',
1051 coreconfigitem('smtp', 'port',
1048 default=dynamicdefault,
1052 default=dynamicdefault,
1049 )
1053 )
1050 coreconfigitem('smtp', 'tls',
1054 coreconfigitem('smtp', 'tls',
1051 default='none',
1055 default='none',
1052 )
1056 )
1053 coreconfigitem('smtp', 'username',
1057 coreconfigitem('smtp', 'username',
1054 default=None,
1058 default=None,
1055 )
1059 )
1056 coreconfigitem('sparse', 'missingwarning',
1060 coreconfigitem('sparse', 'missingwarning',
1057 default=True,
1061 default=True,
1058 )
1062 )
1059 coreconfigitem('subrepos', 'allowed',
1063 coreconfigitem('subrepos', 'allowed',
1060 default=dynamicdefault, # to make backporting simpler
1064 default=dynamicdefault, # to make backporting simpler
1061 )
1065 )
1062 coreconfigitem('subrepos', 'hg:allowed',
1066 coreconfigitem('subrepos', 'hg:allowed',
1063 default=dynamicdefault,
1067 default=dynamicdefault,
1064 )
1068 )
1065 coreconfigitem('subrepos', 'git:allowed',
1069 coreconfigitem('subrepos', 'git:allowed',
1066 default=dynamicdefault,
1070 default=dynamicdefault,
1067 )
1071 )
1068 coreconfigitem('subrepos', 'svn:allowed',
1072 coreconfigitem('subrepos', 'svn:allowed',
1069 default=dynamicdefault,
1073 default=dynamicdefault,
1070 )
1074 )
1071 coreconfigitem('templates', '.*',
1075 coreconfigitem('templates', '.*',
1072 default=None,
1076 default=None,
1073 generic=True,
1077 generic=True,
1074 )
1078 )
1075 coreconfigitem('trusted', 'groups',
1079 coreconfigitem('trusted', 'groups',
1076 default=list,
1080 default=list,
1077 )
1081 )
1078 coreconfigitem('trusted', 'users',
1082 coreconfigitem('trusted', 'users',
1079 default=list,
1083 default=list,
1080 )
1084 )
1081 coreconfigitem('ui', '_usedassubrepo',
1085 coreconfigitem('ui', '_usedassubrepo',
1082 default=False,
1086 default=False,
1083 )
1087 )
1084 coreconfigitem('ui', 'allowemptycommit',
1088 coreconfigitem('ui', 'allowemptycommit',
1085 default=False,
1089 default=False,
1086 )
1090 )
1087 coreconfigitem('ui', 'archivemeta',
1091 coreconfigitem('ui', 'archivemeta',
1088 default=True,
1092 default=True,
1089 )
1093 )
1090 coreconfigitem('ui', 'askusername',
1094 coreconfigitem('ui', 'askusername',
1091 default=False,
1095 default=False,
1092 )
1096 )
1093 coreconfigitem('ui', 'clonebundlefallback',
1097 coreconfigitem('ui', 'clonebundlefallback',
1094 default=False,
1098 default=False,
1095 )
1099 )
1096 coreconfigitem('ui', 'clonebundleprefers',
1100 coreconfigitem('ui', 'clonebundleprefers',
1097 default=list,
1101 default=list,
1098 )
1102 )
1099 coreconfigitem('ui', 'clonebundles',
1103 coreconfigitem('ui', 'clonebundles',
1100 default=True,
1104 default=True,
1101 )
1105 )
1102 coreconfigitem('ui', 'color',
1106 coreconfigitem('ui', 'color',
1103 default='auto',
1107 default='auto',
1104 )
1108 )
1105 coreconfigitem('ui', 'commitsubrepos',
1109 coreconfigitem('ui', 'commitsubrepos',
1106 default=False,
1110 default=False,
1107 )
1111 )
1108 coreconfigitem('ui', 'debug',
1112 coreconfigitem('ui', 'debug',
1109 default=False,
1113 default=False,
1110 )
1114 )
1111 coreconfigitem('ui', 'debugger',
1115 coreconfigitem('ui', 'debugger',
1112 default=None,
1116 default=None,
1113 )
1117 )
1114 coreconfigitem('ui', 'editor',
1118 coreconfigitem('ui', 'editor',
1115 default=dynamicdefault,
1119 default=dynamicdefault,
1116 )
1120 )
1117 coreconfigitem('ui', 'fallbackencoding',
1121 coreconfigitem('ui', 'fallbackencoding',
1118 default=None,
1122 default=None,
1119 )
1123 )
1120 coreconfigitem('ui', 'forcecwd',
1124 coreconfigitem('ui', 'forcecwd',
1121 default=None,
1125 default=None,
1122 )
1126 )
1123 coreconfigitem('ui', 'forcemerge',
1127 coreconfigitem('ui', 'forcemerge',
1124 default=None,
1128 default=None,
1125 )
1129 )
1126 coreconfigitem('ui', 'formatdebug',
1130 coreconfigitem('ui', 'formatdebug',
1127 default=False,
1131 default=False,
1128 )
1132 )
1129 coreconfigitem('ui', 'formatjson',
1133 coreconfigitem('ui', 'formatjson',
1130 default=False,
1134 default=False,
1131 )
1135 )
1132 coreconfigitem('ui', 'formatted',
1136 coreconfigitem('ui', 'formatted',
1133 default=None,
1137 default=None,
1134 )
1138 )
1135 coreconfigitem('ui', 'graphnodetemplate',
1139 coreconfigitem('ui', 'graphnodetemplate',
1136 default=None,
1140 default=None,
1137 )
1141 )
1138 coreconfigitem('ui', 'history-editing-backup',
1142 coreconfigitem('ui', 'history-editing-backup',
1139 default=True,
1143 default=True,
1140 )
1144 )
1141 coreconfigitem('ui', 'interactive',
1145 coreconfigitem('ui', 'interactive',
1142 default=None,
1146 default=None,
1143 )
1147 )
1144 coreconfigitem('ui', 'interface',
1148 coreconfigitem('ui', 'interface',
1145 default=None,
1149 default=None,
1146 )
1150 )
1147 coreconfigitem('ui', 'interface.chunkselector',
1151 coreconfigitem('ui', 'interface.chunkselector',
1148 default=None,
1152 default=None,
1149 )
1153 )
1150 coreconfigitem('ui', 'large-file-limit',
1154 coreconfigitem('ui', 'large-file-limit',
1151 default=10000000,
1155 default=10000000,
1152 )
1156 )
1153 coreconfigitem('ui', 'logblockedtimes',
1157 coreconfigitem('ui', 'logblockedtimes',
1154 default=False,
1158 default=False,
1155 )
1159 )
1156 coreconfigitem('ui', 'logtemplate',
1160 coreconfigitem('ui', 'logtemplate',
1157 default=None,
1161 default=None,
1158 )
1162 )
1159 coreconfigitem('ui', 'merge',
1163 coreconfigitem('ui', 'merge',
1160 default=None,
1164 default=None,
1161 )
1165 )
1162 coreconfigitem('ui', 'mergemarkers',
1166 coreconfigitem('ui', 'mergemarkers',
1163 default='basic',
1167 default='basic',
1164 )
1168 )
1165 coreconfigitem('ui', 'mergemarkertemplate',
1169 coreconfigitem('ui', 'mergemarkertemplate',
1166 default=('{node|short} '
1170 default=('{node|short} '
1167 '{ifeq(tags, "tip", "", '
1171 '{ifeq(tags, "tip", "", '
1168 'ifeq(tags, "", "", "{tags} "))}'
1172 'ifeq(tags, "", "", "{tags} "))}'
1169 '{if(bookmarks, "{bookmarks} ")}'
1173 '{if(bookmarks, "{bookmarks} ")}'
1170 '{ifeq(branch, "default", "", "{branch} ")}'
1174 '{ifeq(branch, "default", "", "{branch} ")}'
1171 '- {author|user}: {desc|firstline}')
1175 '- {author|user}: {desc|firstline}')
1172 )
1176 )
1173 coreconfigitem('ui', 'nontty',
1177 coreconfigitem('ui', 'nontty',
1174 default=False,
1178 default=False,
1175 )
1179 )
1176 coreconfigitem('ui', 'origbackuppath',
1180 coreconfigitem('ui', 'origbackuppath',
1177 default=None,
1181 default=None,
1178 )
1182 )
1179 coreconfigitem('ui', 'paginate',
1183 coreconfigitem('ui', 'paginate',
1180 default=True,
1184 default=True,
1181 )
1185 )
1182 coreconfigitem('ui', 'patch',
1186 coreconfigitem('ui', 'patch',
1183 default=None,
1187 default=None,
1184 )
1188 )
1185 coreconfigitem('ui', 'portablefilenames',
1189 coreconfigitem('ui', 'portablefilenames',
1186 default='warn',
1190 default='warn',
1187 )
1191 )
1188 coreconfigitem('ui', 'promptecho',
1192 coreconfigitem('ui', 'promptecho',
1189 default=False,
1193 default=False,
1190 )
1194 )
1191 coreconfigitem('ui', 'quiet',
1195 coreconfigitem('ui', 'quiet',
1192 default=False,
1196 default=False,
1193 )
1197 )
1194 coreconfigitem('ui', 'quietbookmarkmove',
1198 coreconfigitem('ui', 'quietbookmarkmove',
1195 default=False,
1199 default=False,
1196 )
1200 )
1197 coreconfigitem('ui', 'remotecmd',
1201 coreconfigitem('ui', 'remotecmd',
1198 default='hg',
1202 default='hg',
1199 )
1203 )
1200 coreconfigitem('ui', 'report_untrusted',
1204 coreconfigitem('ui', 'report_untrusted',
1201 default=True,
1205 default=True,
1202 )
1206 )
1203 coreconfigitem('ui', 'rollback',
1207 coreconfigitem('ui', 'rollback',
1204 default=True,
1208 default=True,
1205 )
1209 )
1206 coreconfigitem('ui', 'signal-safe-lock',
1210 coreconfigitem('ui', 'signal-safe-lock',
1207 default=True,
1211 default=True,
1208 )
1212 )
1209 coreconfigitem('ui', 'slash',
1213 coreconfigitem('ui', 'slash',
1210 default=False,
1214 default=False,
1211 )
1215 )
1212 coreconfigitem('ui', 'ssh',
1216 coreconfigitem('ui', 'ssh',
1213 default='ssh',
1217 default='ssh',
1214 )
1218 )
1215 coreconfigitem('ui', 'ssherrorhint',
1219 coreconfigitem('ui', 'ssherrorhint',
1216 default=None,
1220 default=None,
1217 )
1221 )
1218 coreconfigitem('ui', 'statuscopies',
1222 coreconfigitem('ui', 'statuscopies',
1219 default=False,
1223 default=False,
1220 )
1224 )
1221 coreconfigitem('ui', 'strict',
1225 coreconfigitem('ui', 'strict',
1222 default=False,
1226 default=False,
1223 )
1227 )
1224 coreconfigitem('ui', 'style',
1228 coreconfigitem('ui', 'style',
1225 default='',
1229 default='',
1226 )
1230 )
1227 coreconfigitem('ui', 'supportcontact',
1231 coreconfigitem('ui', 'supportcontact',
1228 default=None,
1232 default=None,
1229 )
1233 )
1230 coreconfigitem('ui', 'textwidth',
1234 coreconfigitem('ui', 'textwidth',
1231 default=78,
1235 default=78,
1232 )
1236 )
1233 coreconfigitem('ui', 'timeout',
1237 coreconfigitem('ui', 'timeout',
1234 default='600',
1238 default='600',
1235 )
1239 )
1236 coreconfigitem('ui', 'timeout.warn',
1240 coreconfigitem('ui', 'timeout.warn',
1237 default=0,
1241 default=0,
1238 )
1242 )
1239 coreconfigitem('ui', 'traceback',
1243 coreconfigitem('ui', 'traceback',
1240 default=False,
1244 default=False,
1241 )
1245 )
1242 coreconfigitem('ui', 'tweakdefaults',
1246 coreconfigitem('ui', 'tweakdefaults',
1243 default=False,
1247 default=False,
1244 )
1248 )
1245 coreconfigitem('ui', 'username',
1249 coreconfigitem('ui', 'username',
1246 alias=[('ui', 'user')]
1250 alias=[('ui', 'user')]
1247 )
1251 )
1248 coreconfigitem('ui', 'verbose',
1252 coreconfigitem('ui', 'verbose',
1249 default=False,
1253 default=False,
1250 )
1254 )
1251 coreconfigitem('verify', 'skipflags',
1255 coreconfigitem('verify', 'skipflags',
1252 default=None,
1256 default=None,
1253 )
1257 )
1254 coreconfigitem('web', 'allowbz2',
1258 coreconfigitem('web', 'allowbz2',
1255 default=False,
1259 default=False,
1256 )
1260 )
1257 coreconfigitem('web', 'allowgz',
1261 coreconfigitem('web', 'allowgz',
1258 default=False,
1262 default=False,
1259 )
1263 )
1260 coreconfigitem('web', 'allow-pull',
1264 coreconfigitem('web', 'allow-pull',
1261 alias=[('web', 'allowpull')],
1265 alias=[('web', 'allowpull')],
1262 default=True,
1266 default=True,
1263 )
1267 )
1264 coreconfigitem('web', 'allow-push',
1268 coreconfigitem('web', 'allow-push',
1265 alias=[('web', 'allow_push')],
1269 alias=[('web', 'allow_push')],
1266 default=list,
1270 default=list,
1267 )
1271 )
1268 coreconfigitem('web', 'allowzip',
1272 coreconfigitem('web', 'allowzip',
1269 default=False,
1273 default=False,
1270 )
1274 )
1271 coreconfigitem('web', 'archivesubrepos',
1275 coreconfigitem('web', 'archivesubrepos',
1272 default=False,
1276 default=False,
1273 )
1277 )
1274 coreconfigitem('web', 'cache',
1278 coreconfigitem('web', 'cache',
1275 default=True,
1279 default=True,
1276 )
1280 )
1277 coreconfigitem('web', 'contact',
1281 coreconfigitem('web', 'contact',
1278 default=None,
1282 default=None,
1279 )
1283 )
1280 coreconfigitem('web', 'deny_push',
1284 coreconfigitem('web', 'deny_push',
1281 default=list,
1285 default=list,
1282 )
1286 )
1283 coreconfigitem('web', 'guessmime',
1287 coreconfigitem('web', 'guessmime',
1284 default=False,
1288 default=False,
1285 )
1289 )
1286 coreconfigitem('web', 'hidden',
1290 coreconfigitem('web', 'hidden',
1287 default=False,
1291 default=False,
1288 )
1292 )
1289 coreconfigitem('web', 'labels',
1293 coreconfigitem('web', 'labels',
1290 default=list,
1294 default=list,
1291 )
1295 )
1292 coreconfigitem('web', 'logoimg',
1296 coreconfigitem('web', 'logoimg',
1293 default='hglogo.png',
1297 default='hglogo.png',
1294 )
1298 )
1295 coreconfigitem('web', 'logourl',
1299 coreconfigitem('web', 'logourl',
1296 default='https://mercurial-scm.org/',
1300 default='https://mercurial-scm.org/',
1297 )
1301 )
1298 coreconfigitem('web', 'accesslog',
1302 coreconfigitem('web', 'accesslog',
1299 default='-',
1303 default='-',
1300 )
1304 )
1301 coreconfigitem('web', 'address',
1305 coreconfigitem('web', 'address',
1302 default='',
1306 default='',
1303 )
1307 )
1304 coreconfigitem('web', 'allow-archive',
1308 coreconfigitem('web', 'allow-archive',
1305 alias=[('web', 'allow_archive')],
1309 alias=[('web', 'allow_archive')],
1306 default=list,
1310 default=list,
1307 )
1311 )
1308 coreconfigitem('web', 'allow_read',
1312 coreconfigitem('web', 'allow_read',
1309 default=list,
1313 default=list,
1310 )
1314 )
1311 coreconfigitem('web', 'baseurl',
1315 coreconfigitem('web', 'baseurl',
1312 default=None,
1316 default=None,
1313 )
1317 )
1314 coreconfigitem('web', 'cacerts',
1318 coreconfigitem('web', 'cacerts',
1315 default=None,
1319 default=None,
1316 )
1320 )
1317 coreconfigitem('web', 'certificate',
1321 coreconfigitem('web', 'certificate',
1318 default=None,
1322 default=None,
1319 )
1323 )
1320 coreconfigitem('web', 'collapse',
1324 coreconfigitem('web', 'collapse',
1321 default=False,
1325 default=False,
1322 )
1326 )
1323 coreconfigitem('web', 'csp',
1327 coreconfigitem('web', 'csp',
1324 default=None,
1328 default=None,
1325 )
1329 )
1326 coreconfigitem('web', 'deny_read',
1330 coreconfigitem('web', 'deny_read',
1327 default=list,
1331 default=list,
1328 )
1332 )
1329 coreconfigitem('web', 'descend',
1333 coreconfigitem('web', 'descend',
1330 default=True,
1334 default=True,
1331 )
1335 )
1332 coreconfigitem('web', 'description',
1336 coreconfigitem('web', 'description',
1333 default="",
1337 default="",
1334 )
1338 )
1335 coreconfigitem('web', 'encoding',
1339 coreconfigitem('web', 'encoding',
1336 default=lambda: encoding.encoding,
1340 default=lambda: encoding.encoding,
1337 )
1341 )
1338 coreconfigitem('web', 'errorlog',
1342 coreconfigitem('web', 'errorlog',
1339 default='-',
1343 default='-',
1340 )
1344 )
1341 coreconfigitem('web', 'ipv6',
1345 coreconfigitem('web', 'ipv6',
1342 default=False,
1346 default=False,
1343 )
1347 )
1344 coreconfigitem('web', 'maxchanges',
1348 coreconfigitem('web', 'maxchanges',
1345 default=10,
1349 default=10,
1346 )
1350 )
1347 coreconfigitem('web', 'maxfiles',
1351 coreconfigitem('web', 'maxfiles',
1348 default=10,
1352 default=10,
1349 )
1353 )
1350 coreconfigitem('web', 'maxshortchanges',
1354 coreconfigitem('web', 'maxshortchanges',
1351 default=60,
1355 default=60,
1352 )
1356 )
1353 coreconfigitem('web', 'motd',
1357 coreconfigitem('web', 'motd',
1354 default='',
1358 default='',
1355 )
1359 )
1356 coreconfigitem('web', 'name',
1360 coreconfigitem('web', 'name',
1357 default=dynamicdefault,
1361 default=dynamicdefault,
1358 )
1362 )
1359 coreconfigitem('web', 'port',
1363 coreconfigitem('web', 'port',
1360 default=8000,
1364 default=8000,
1361 )
1365 )
1362 coreconfigitem('web', 'prefix',
1366 coreconfigitem('web', 'prefix',
1363 default='',
1367 default='',
1364 )
1368 )
1365 coreconfigitem('web', 'push_ssl',
1369 coreconfigitem('web', 'push_ssl',
1366 default=True,
1370 default=True,
1367 )
1371 )
1368 coreconfigitem('web', 'refreshinterval',
1372 coreconfigitem('web', 'refreshinterval',
1369 default=20,
1373 default=20,
1370 )
1374 )
1371 coreconfigitem('web', 'server-header',
1375 coreconfigitem('web', 'server-header',
1372 default=None,
1376 default=None,
1373 )
1377 )
1374 coreconfigitem('web', 'static',
1378 coreconfigitem('web', 'static',
1375 default=None,
1379 default=None,
1376 )
1380 )
1377 coreconfigitem('web', 'staticurl',
1381 coreconfigitem('web', 'staticurl',
1378 default=None,
1382 default=None,
1379 )
1383 )
1380 coreconfigitem('web', 'stripes',
1384 coreconfigitem('web', 'stripes',
1381 default=1,
1385 default=1,
1382 )
1386 )
1383 coreconfigitem('web', 'style',
1387 coreconfigitem('web', 'style',
1384 default='paper',
1388 default='paper',
1385 )
1389 )
1386 coreconfigitem('web', 'templates',
1390 coreconfigitem('web', 'templates',
1387 default=None,
1391 default=None,
1388 )
1392 )
1389 coreconfigitem('web', 'view',
1393 coreconfigitem('web', 'view',
1390 default='served',
1394 default='served',
1391 )
1395 )
1392 coreconfigitem('worker', 'backgroundclose',
1396 coreconfigitem('worker', 'backgroundclose',
1393 default=dynamicdefault,
1397 default=dynamicdefault,
1394 )
1398 )
1395 # Windows defaults to a limit of 512 open files. A buffer of 128
1399 # Windows defaults to a limit of 512 open files. A buffer of 128
1396 # should give us enough headway.
1400 # should give us enough headway.
1397 coreconfigitem('worker', 'backgroundclosemaxqueue',
1401 coreconfigitem('worker', 'backgroundclosemaxqueue',
1398 default=384,
1402 default=384,
1399 )
1403 )
1400 coreconfigitem('worker', 'backgroundcloseminfilecount',
1404 coreconfigitem('worker', 'backgroundcloseminfilecount',
1401 default=2048,
1405 default=2048,
1402 )
1406 )
1403 coreconfigitem('worker', 'backgroundclosethreadcount',
1407 coreconfigitem('worker', 'backgroundclosethreadcount',
1404 default=4,
1408 default=4,
1405 )
1409 )
1406 coreconfigitem('worker', 'enabled',
1410 coreconfigitem('worker', 'enabled',
1407 default=True,
1411 default=True,
1408 )
1412 )
1409 coreconfigitem('worker', 'numcpus',
1413 coreconfigitem('worker', 'numcpus',
1410 default=None,
1414 default=None,
1411 )
1415 )
1412
1416
1413 # Rebase related configuration moved to core because other extension are doing
1417 # Rebase related configuration moved to core because other extension are doing
1414 # strange things. For example, shelve import the extensions to reuse some bit
1418 # strange things. For example, shelve import the extensions to reuse some bit
1415 # without formally loading it.
1419 # without formally loading it.
1416 coreconfigitem('commands', 'rebase.requiredest',
1420 coreconfigitem('commands', 'rebase.requiredest',
1417 default=False,
1421 default=False,
1418 )
1422 )
1419 coreconfigitem('experimental', 'rebaseskipobsolete',
1423 coreconfigitem('experimental', 'rebaseskipobsolete',
1420 default=True,
1424 default=True,
1421 )
1425 )
1422 coreconfigitem('rebase', 'singletransaction',
1426 coreconfigitem('rebase', 'singletransaction',
1423 default=False,
1427 default=False,
1424 )
1428 )
1425 coreconfigitem('rebase', 'experimental.inmemory',
1429 coreconfigitem('rebase', 'experimental.inmemory',
1426 default=False,
1430 default=False,
1427 )
1431 )
@@ -1,828 +1,830 b''
1 # help.py - help data for mercurial
1 # help.py - help data for mercurial
2 #
2 #
3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import itertools
10 import itertools
11 import os
11 import os
12 import textwrap
12 import textwrap
13
13
14 from .i18n import (
14 from .i18n import (
15 _,
15 _,
16 gettext,
16 gettext,
17 )
17 )
18 from . import (
18 from . import (
19 cmdutil,
19 cmdutil,
20 encoding,
20 encoding,
21 error,
21 error,
22 extensions,
22 extensions,
23 fancyopts,
23 fancyopts,
24 filemerge,
24 filemerge,
25 fileset,
25 fileset,
26 minirst,
26 minirst,
27 pycompat,
27 pycompat,
28 registrar,
28 registrar,
29 revset,
29 revset,
30 templatefilters,
30 templatefilters,
31 templatefuncs,
31 templatefuncs,
32 templatekw,
32 templatekw,
33 util,
33 util,
34 )
34 )
35 from .hgweb import (
35 from .hgweb import (
36 webcommands,
36 webcommands,
37 )
37 )
38
38
39 _exclkeywords = {
39 _exclkeywords = {
40 "(ADVANCED)",
40 "(ADVANCED)",
41 "(DEPRECATED)",
41 "(DEPRECATED)",
42 "(EXPERIMENTAL)",
42 "(EXPERIMENTAL)",
43 # i18n: "(ADVANCED)" is a keyword, must be translated consistently
43 # i18n: "(ADVANCED)" is a keyword, must be translated consistently
44 _("(ADVANCED)"),
44 _("(ADVANCED)"),
45 # i18n: "(DEPRECATED)" is a keyword, must be translated consistently
45 # i18n: "(DEPRECATED)" is a keyword, must be translated consistently
46 _("(DEPRECATED)"),
46 _("(DEPRECATED)"),
47 # i18n: "(EXPERIMENTAL)" is a keyword, must be translated consistently
47 # i18n: "(EXPERIMENTAL)" is a keyword, must be translated consistently
48 _("(EXPERIMENTAL)"),
48 _("(EXPERIMENTAL)"),
49 }
49 }
50
50
51 # The order in which command categories will be displayed.
51 # The order in which command categories will be displayed.
52 # Extensions with custom categories should insert them into this list
52 # Extensions with custom categories should insert them into this list
53 # after/before the appropriate item, rather than replacing the list or
53 # after/before the appropriate item, rather than replacing the list or
54 # assuming absolute positions.
54 # assuming absolute positions.
55 CATEGORY_ORDER = [
55 CATEGORY_ORDER = [
56 registrar.command.CATEGORY_REPO_CREATION,
56 registrar.command.CATEGORY_REPO_CREATION,
57 registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT,
57 registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT,
58 registrar.command.CATEGORY_COMMITTING,
58 registrar.command.CATEGORY_COMMITTING,
59 registrar.command.CATEGORY_CHANGE_MANAGEMENT,
59 registrar.command.CATEGORY_CHANGE_MANAGEMENT,
60 registrar.command.CATEGORY_CHANGE_ORGANIZATION,
60 registrar.command.CATEGORY_CHANGE_ORGANIZATION,
61 registrar.command.CATEGORY_FILE_CONTENTS,
61 registrar.command.CATEGORY_FILE_CONTENTS,
62 registrar.command.CATEGORY_CHANGE_NAVIGATION ,
62 registrar.command.CATEGORY_CHANGE_NAVIGATION ,
63 registrar.command.CATEGORY_WORKING_DIRECTORY,
63 registrar.command.CATEGORY_WORKING_DIRECTORY,
64 registrar.command.CATEGORY_IMPORT_EXPORT,
64 registrar.command.CATEGORY_IMPORT_EXPORT,
65 registrar.command.CATEGORY_MAINTENANCE,
65 registrar.command.CATEGORY_MAINTENANCE,
66 registrar.command.CATEGORY_HELP,
66 registrar.command.CATEGORY_HELP,
67 registrar.command.CATEGORY_MISC,
67 registrar.command.CATEGORY_MISC,
68 registrar.command.CATEGORY_NONE,
68 registrar.command.CATEGORY_NONE,
69 ]
69 ]
70
70
71 # Human-readable category names. These are translated.
71 # Human-readable category names. These are translated.
72 # Extensions with custom categories should add their names here.
72 # Extensions with custom categories should add their names here.
73 CATEGORY_NAMES = {
73 CATEGORY_NAMES = {
74 registrar.command.CATEGORY_REPO_CREATION: 'Repository creation',
74 registrar.command.CATEGORY_REPO_CREATION: 'Repository creation',
75 registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT:
75 registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT:
76 'Remote repository management',
76 'Remote repository management',
77 registrar.command.CATEGORY_COMMITTING: 'Change creation',
77 registrar.command.CATEGORY_COMMITTING: 'Change creation',
78 registrar.command.CATEGORY_CHANGE_NAVIGATION: 'Change navigation',
78 registrar.command.CATEGORY_CHANGE_NAVIGATION: 'Change navigation',
79 registrar.command.CATEGORY_CHANGE_MANAGEMENT: 'Change manipulation',
79 registrar.command.CATEGORY_CHANGE_MANAGEMENT: 'Change manipulation',
80 registrar.command.CATEGORY_CHANGE_ORGANIZATION: 'Change organization',
80 registrar.command.CATEGORY_CHANGE_ORGANIZATION: 'Change organization',
81 registrar.command.CATEGORY_WORKING_DIRECTORY:
81 registrar.command.CATEGORY_WORKING_DIRECTORY:
82 'Working directory management',
82 'Working directory management',
83 registrar.command.CATEGORY_FILE_CONTENTS: 'File content management',
83 registrar.command.CATEGORY_FILE_CONTENTS: 'File content management',
84 registrar.command.CATEGORY_IMPORT_EXPORT: 'Change import/export',
84 registrar.command.CATEGORY_IMPORT_EXPORT: 'Change import/export',
85 registrar.command.CATEGORY_MAINTENANCE: 'Repository maintenance',
85 registrar.command.CATEGORY_MAINTENANCE: 'Repository maintenance',
86 registrar.command.CATEGORY_HELP: 'Help',
86 registrar.command.CATEGORY_HELP: 'Help',
87 registrar.command.CATEGORY_MISC: 'Miscellaneous commands',
87 registrar.command.CATEGORY_MISC: 'Miscellaneous commands',
88 registrar.command.CATEGORY_NONE: 'Uncategorized commands',
88 registrar.command.CATEGORY_NONE: 'Uncategorized commands',
89 }
89 }
90
90
91 # Topic categories.
91 # Topic categories.
92 TOPIC_CATEGORY_IDS = 'ids'
92 TOPIC_CATEGORY_IDS = 'ids'
93 TOPIC_CATEGORY_OUTPUT = 'output'
93 TOPIC_CATEGORY_OUTPUT = 'output'
94 TOPIC_CATEGORY_CONFIG = 'config'
94 TOPIC_CATEGORY_CONFIG = 'config'
95 TOPIC_CATEGORY_CONCEPTS = 'concepts'
95 TOPIC_CATEGORY_CONCEPTS = 'concepts'
96 TOPIC_CATEGORY_MISC = 'misc'
96 TOPIC_CATEGORY_MISC = 'misc'
97 TOPIC_CATEGORY_NONE = 'none'
97 TOPIC_CATEGORY_NONE = 'none'
98
98
99 # The order in which topic categories will be displayed.
99 # The order in which topic categories will be displayed.
100 # Extensions with custom categories should insert them into this list
100 # Extensions with custom categories should insert them into this list
101 # after/before the appropriate item, rather than replacing the list or
101 # after/before the appropriate item, rather than replacing the list or
102 # assuming absolute positions.
102 # assuming absolute positions.
103 TOPIC_CATEGORY_ORDER = [
103 TOPIC_CATEGORY_ORDER = [
104 TOPIC_CATEGORY_IDS,
104 TOPIC_CATEGORY_IDS,
105 TOPIC_CATEGORY_OUTPUT,
105 TOPIC_CATEGORY_OUTPUT,
106 TOPIC_CATEGORY_CONFIG,
106 TOPIC_CATEGORY_CONFIG,
107 TOPIC_CATEGORY_CONCEPTS,
107 TOPIC_CATEGORY_CONCEPTS,
108 TOPIC_CATEGORY_MISC,
108 TOPIC_CATEGORY_MISC,
109 TOPIC_CATEGORY_NONE,
109 TOPIC_CATEGORY_NONE,
110 ]
110 ]
111
111
112 # Human-readable topic category names. These are translated.
112 # Human-readable topic category names. These are translated.
113 TOPIC_CATEGORY_NAMES = {
113 TOPIC_CATEGORY_NAMES = {
114 TOPIC_CATEGORY_IDS: 'Mercurial identifiers',
114 TOPIC_CATEGORY_IDS: 'Mercurial identifiers',
115 TOPIC_CATEGORY_OUTPUT: 'Mercurial output',
115 TOPIC_CATEGORY_OUTPUT: 'Mercurial output',
116 TOPIC_CATEGORY_CONFIG: 'Mercurial configuration',
116 TOPIC_CATEGORY_CONFIG: 'Mercurial configuration',
117 TOPIC_CATEGORY_CONCEPTS: 'Concepts',
117 TOPIC_CATEGORY_CONCEPTS: 'Concepts',
118 TOPIC_CATEGORY_MISC: 'Miscellaneous',
118 TOPIC_CATEGORY_MISC: 'Miscellaneous',
119 TOPIC_CATEGORY_NONE: 'Uncategorized topics',
119 TOPIC_CATEGORY_NONE: 'Uncategorized topics',
120 TOPIC_CATEGORY_NONE: 'Uncategorized topics',
120 TOPIC_CATEGORY_NONE: 'Uncategorized topics',
121 }
121 }
122
122
123 def listexts(header, exts, indent=1, showdeprecated=False):
123 def listexts(header, exts, indent=1, showdeprecated=False):
124 '''return a text listing of the given extensions'''
124 '''return a text listing of the given extensions'''
125 rst = []
125 rst = []
126 if exts:
126 if exts:
127 for name, desc in sorted(exts.iteritems()):
127 for name, desc in sorted(exts.iteritems()):
128 if not showdeprecated and any(w in desc for w in _exclkeywords):
128 if not showdeprecated and any(w in desc for w in _exclkeywords):
129 continue
129 continue
130 rst.append('%s:%s: %s\n' % (' ' * indent, name, desc))
130 rst.append('%s:%s: %s\n' % (' ' * indent, name, desc))
131 if rst:
131 if rst:
132 rst.insert(0, '\n%s\n\n' % header)
132 rst.insert(0, '\n%s\n\n' % header)
133 return rst
133 return rst
134
134
135 def extshelp(ui):
135 def extshelp(ui):
136 rst = loaddoc('extensions')(ui).splitlines(True)
136 rst = loaddoc('extensions')(ui).splitlines(True)
137 rst.extend(listexts(
137 rst.extend(listexts(
138 _('enabled extensions:'), extensions.enabled(), showdeprecated=True))
138 _('enabled extensions:'), extensions.enabled(), showdeprecated=True))
139 rst.extend(listexts(_('disabled extensions:'), extensions.disabled(),
139 rst.extend(listexts(_('disabled extensions:'), extensions.disabled(),
140 showdeprecated=ui.verbose))
140 showdeprecated=ui.verbose))
141 doc = ''.join(rst)
141 doc = ''.join(rst)
142 return doc
142 return doc
143
143
144 def optrst(header, options, verbose):
144 def optrst(header, options, verbose):
145 data = []
145 data = []
146 multioccur = False
146 multioccur = False
147 for option in options:
147 for option in options:
148 if len(option) == 5:
148 if len(option) == 5:
149 shortopt, longopt, default, desc, optlabel = option
149 shortopt, longopt, default, desc, optlabel = option
150 else:
150 else:
151 shortopt, longopt, default, desc = option
151 shortopt, longopt, default, desc = option
152 optlabel = _("VALUE") # default label
152 optlabel = _("VALUE") # default label
153
153
154 if not verbose and any(w in desc for w in _exclkeywords):
154 if not verbose and any(w in desc for w in _exclkeywords):
155 continue
155 continue
156
156
157 so = ''
157 so = ''
158 if shortopt:
158 if shortopt:
159 so = '-' + shortopt
159 so = '-' + shortopt
160 lo = '--' + longopt
160 lo = '--' + longopt
161
161
162 if isinstance(default, fancyopts.customopt):
162 if isinstance(default, fancyopts.customopt):
163 default = default.getdefaultvalue()
163 default = default.getdefaultvalue()
164 if default and not callable(default):
164 if default and not callable(default):
165 # default is of unknown type, and in Python 2 we abused
165 # default is of unknown type, and in Python 2 we abused
166 # the %s-shows-repr property to handle integers etc. To
166 # the %s-shows-repr property to handle integers etc. To
167 # match that behavior on Python 3, we do str(default) and
167 # match that behavior on Python 3, we do str(default) and
168 # then convert it to bytes.
168 # then convert it to bytes.
169 desc += _(" (default: %s)") % pycompat.bytestr(default)
169 desc += _(" (default: %s)") % pycompat.bytestr(default)
170
170
171 if isinstance(default, list):
171 if isinstance(default, list):
172 lo += " %s [+]" % optlabel
172 lo += " %s [+]" % optlabel
173 multioccur = True
173 multioccur = True
174 elif (default is not None) and not isinstance(default, bool):
174 elif (default is not None) and not isinstance(default, bool):
175 lo += " %s" % optlabel
175 lo += " %s" % optlabel
176
176
177 data.append((so, lo, desc))
177 data.append((so, lo, desc))
178
178
179 if multioccur:
179 if multioccur:
180 header += (_(" ([+] can be repeated)"))
180 header += (_(" ([+] can be repeated)"))
181
181
182 rst = ['\n%s:\n\n' % header]
182 rst = ['\n%s:\n\n' % header]
183 rst.extend(minirst.maketable(data, 1))
183 rst.extend(minirst.maketable(data, 1))
184
184
185 return ''.join(rst)
185 return ''.join(rst)
186
186
187 def indicateomitted(rst, omitted, notomitted=None):
187 def indicateomitted(rst, omitted, notomitted=None):
188 rst.append('\n\n.. container:: omitted\n\n %s\n\n' % omitted)
188 rst.append('\n\n.. container:: omitted\n\n %s\n\n' % omitted)
189 if notomitted:
189 if notomitted:
190 rst.append('\n\n.. container:: notomitted\n\n %s\n\n' % notomitted)
190 rst.append('\n\n.. container:: notomitted\n\n %s\n\n' % notomitted)
191
191
192 def filtercmd(ui, cmd, kw, doc):
192 def filtercmd(ui, cmd, kw, doc):
193 if not ui.debugflag and cmd.startswith("debug") and kw != "debug":
193 if not ui.debugflag and cmd.startswith("debug") and kw != "debug":
194 return True
194 return True
195 if not ui.verbose and doc and any(w in doc for w in _exclkeywords):
195 if not ui.verbose and doc and any(w in doc for w in _exclkeywords):
196 return True
196 return True
197 if ui.configbool('help', 'hidden-command.%s' % cmd):
198 return True
197 return False
199 return False
198
200
199 def topicmatch(ui, commands, kw):
201 def topicmatch(ui, commands, kw):
200 """Return help topics matching kw.
202 """Return help topics matching kw.
201
203
202 Returns {'section': [(name, summary), ...], ...} where section is
204 Returns {'section': [(name, summary), ...], ...} where section is
203 one of topics, commands, extensions, or extensioncommands.
205 one of topics, commands, extensions, or extensioncommands.
204 """
206 """
205 kw = encoding.lower(kw)
207 kw = encoding.lower(kw)
206 def lowercontains(container):
208 def lowercontains(container):
207 return kw in encoding.lower(container) # translated in helptable
209 return kw in encoding.lower(container) # translated in helptable
208 results = {'topics': [],
210 results = {'topics': [],
209 'commands': [],
211 'commands': [],
210 'extensions': [],
212 'extensions': [],
211 'extensioncommands': [],
213 'extensioncommands': [],
212 }
214 }
213 for topic in helptable:
215 for topic in helptable:
214 names, header, doc = topic[0:3]
216 names, header, doc = topic[0:3]
215 # Old extensions may use a str as doc.
217 # Old extensions may use a str as doc.
216 if (sum(map(lowercontains, names))
218 if (sum(map(lowercontains, names))
217 or lowercontains(header)
219 or lowercontains(header)
218 or (callable(doc) and lowercontains(doc(ui)))):
220 or (callable(doc) and lowercontains(doc(ui)))):
219 results['topics'].append((names[0], header))
221 results['topics'].append((names[0], header))
220 for cmd, entry in commands.table.iteritems():
222 for cmd, entry in commands.table.iteritems():
221 if len(entry) == 3:
223 if len(entry) == 3:
222 summary = entry[2]
224 summary = entry[2]
223 else:
225 else:
224 summary = ''
226 summary = ''
225 # translate docs *before* searching there
227 # translate docs *before* searching there
226 docs = _(pycompat.getdoc(entry[0])) or ''
228 docs = _(pycompat.getdoc(entry[0])) or ''
227 if kw in cmd or lowercontains(summary) or lowercontains(docs):
229 if kw in cmd or lowercontains(summary) or lowercontains(docs):
228 doclines = docs.splitlines()
230 doclines = docs.splitlines()
229 if doclines:
231 if doclines:
230 summary = doclines[0]
232 summary = doclines[0]
231 cmdname = cmdutil.parsealiases(cmd)[0]
233 cmdname = cmdutil.parsealiases(cmd)[0]
232 if filtercmd(ui, cmdname, kw, docs):
234 if filtercmd(ui, cmdname, kw, docs):
233 continue
235 continue
234 results['commands'].append((cmdname, summary))
236 results['commands'].append((cmdname, summary))
235 for name, docs in itertools.chain(
237 for name, docs in itertools.chain(
236 extensions.enabled(False).iteritems(),
238 extensions.enabled(False).iteritems(),
237 extensions.disabled().iteritems()):
239 extensions.disabled().iteritems()):
238 if not docs:
240 if not docs:
239 continue
241 continue
240 name = name.rpartition('.')[-1]
242 name = name.rpartition('.')[-1]
241 if lowercontains(name) or lowercontains(docs):
243 if lowercontains(name) or lowercontains(docs):
242 # extension docs are already translated
244 # extension docs are already translated
243 results['extensions'].append((name, docs.splitlines()[0]))
245 results['extensions'].append((name, docs.splitlines()[0]))
244 try:
246 try:
245 mod = extensions.load(ui, name, '')
247 mod = extensions.load(ui, name, '')
246 except ImportError:
248 except ImportError:
247 # debug message would be printed in extensions.load()
249 # debug message would be printed in extensions.load()
248 continue
250 continue
249 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
251 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
250 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
252 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
251 cmdname = cmdutil.parsealiases(cmd)[0]
253 cmdname = cmdutil.parsealiases(cmd)[0]
252 cmddoc = pycompat.getdoc(entry[0])
254 cmddoc = pycompat.getdoc(entry[0])
253 if cmddoc:
255 if cmddoc:
254 cmddoc = gettext(cmddoc).splitlines()[0]
256 cmddoc = gettext(cmddoc).splitlines()[0]
255 else:
257 else:
256 cmddoc = _('(no help text available)')
258 cmddoc = _('(no help text available)')
257 if filtercmd(ui, cmdname, kw, cmddoc):
259 if filtercmd(ui, cmdname, kw, cmddoc):
258 continue
260 continue
259 results['extensioncommands'].append((cmdname, cmddoc))
261 results['extensioncommands'].append((cmdname, cmddoc))
260 return results
262 return results
261
263
262 def loaddoc(topic, subdir=None):
264 def loaddoc(topic, subdir=None):
263 """Return a delayed loader for help/topic.txt."""
265 """Return a delayed loader for help/topic.txt."""
264
266
265 def loader(ui):
267 def loader(ui):
266 docdir = os.path.join(util.datapath, 'help')
268 docdir = os.path.join(util.datapath, 'help')
267 if subdir:
269 if subdir:
268 docdir = os.path.join(docdir, subdir)
270 docdir = os.path.join(docdir, subdir)
269 path = os.path.join(docdir, topic + ".txt")
271 path = os.path.join(docdir, topic + ".txt")
270 doc = gettext(util.readfile(path))
272 doc = gettext(util.readfile(path))
271 for rewriter in helphooks.get(topic, []):
273 for rewriter in helphooks.get(topic, []):
272 doc = rewriter(ui, topic, doc)
274 doc = rewriter(ui, topic, doc)
273 return doc
275 return doc
274
276
275 return loader
277 return loader
276
278
277 internalstable = sorted([
279 internalstable = sorted([
278 (['bundle2'], _('Bundle2'),
280 (['bundle2'], _('Bundle2'),
279 loaddoc('bundle2', subdir='internals')),
281 loaddoc('bundle2', subdir='internals')),
280 (['bundles'], _('Bundles'),
282 (['bundles'], _('Bundles'),
281 loaddoc('bundles', subdir='internals')),
283 loaddoc('bundles', subdir='internals')),
282 (['cbor'], _('CBOR'),
284 (['cbor'], _('CBOR'),
283 loaddoc('cbor', subdir='internals')),
285 loaddoc('cbor', subdir='internals')),
284 (['censor'], _('Censor'),
286 (['censor'], _('Censor'),
285 loaddoc('censor', subdir='internals')),
287 loaddoc('censor', subdir='internals')),
286 (['changegroups'], _('Changegroups'),
288 (['changegroups'], _('Changegroups'),
287 loaddoc('changegroups', subdir='internals')),
289 loaddoc('changegroups', subdir='internals')),
288 (['config'], _('Config Registrar'),
290 (['config'], _('Config Registrar'),
289 loaddoc('config', subdir='internals')),
291 loaddoc('config', subdir='internals')),
290 (['requirements'], _('Repository Requirements'),
292 (['requirements'], _('Repository Requirements'),
291 loaddoc('requirements', subdir='internals')),
293 loaddoc('requirements', subdir='internals')),
292 (['revlogs'], _('Revision Logs'),
294 (['revlogs'], _('Revision Logs'),
293 loaddoc('revlogs', subdir='internals')),
295 loaddoc('revlogs', subdir='internals')),
294 (['wireprotocol'], _('Wire Protocol'),
296 (['wireprotocol'], _('Wire Protocol'),
295 loaddoc('wireprotocol', subdir='internals')),
297 loaddoc('wireprotocol', subdir='internals')),
296 (['wireprotocolrpc'], _('Wire Protocol RPC'),
298 (['wireprotocolrpc'], _('Wire Protocol RPC'),
297 loaddoc('wireprotocolrpc', subdir='internals')),
299 loaddoc('wireprotocolrpc', subdir='internals')),
298 (['wireprotocolv2'], _('Wire Protocol Version 2'),
300 (['wireprotocolv2'], _('Wire Protocol Version 2'),
299 loaddoc('wireprotocolv2', subdir='internals')),
301 loaddoc('wireprotocolv2', subdir='internals')),
300 ])
302 ])
301
303
302 def internalshelp(ui):
304 def internalshelp(ui):
303 """Generate the index for the "internals" topic."""
305 """Generate the index for the "internals" topic."""
304 lines = ['To access a subtopic, use "hg help internals.{subtopic-name}"\n',
306 lines = ['To access a subtopic, use "hg help internals.{subtopic-name}"\n',
305 '\n']
307 '\n']
306 for names, header, doc in internalstable:
308 for names, header, doc in internalstable:
307 lines.append(' :%s: %s\n' % (names[0], header))
309 lines.append(' :%s: %s\n' % (names[0], header))
308
310
309 return ''.join(lines)
311 return ''.join(lines)
310
312
311 helptable = sorted([
313 helptable = sorted([
312 (['bundlespec'], _("Bundle File Formats"), loaddoc('bundlespec'),
314 (['bundlespec'], _("Bundle File Formats"), loaddoc('bundlespec'),
313 TOPIC_CATEGORY_CONCEPTS),
315 TOPIC_CATEGORY_CONCEPTS),
314 (['color'], _("Colorizing Outputs"), loaddoc('color'),
316 (['color'], _("Colorizing Outputs"), loaddoc('color'),
315 TOPIC_CATEGORY_OUTPUT),
317 TOPIC_CATEGORY_OUTPUT),
316 (["config", "hgrc"], _("Configuration Files"), loaddoc('config'),
318 (["config", "hgrc"], _("Configuration Files"), loaddoc('config'),
317 TOPIC_CATEGORY_CONFIG),
319 TOPIC_CATEGORY_CONFIG),
318 (['deprecated'], _("Deprecated Features"), loaddoc('deprecated'),
320 (['deprecated'], _("Deprecated Features"), loaddoc('deprecated'),
319 TOPIC_CATEGORY_MISC),
321 TOPIC_CATEGORY_MISC),
320 (["dates"], _("Date Formats"), loaddoc('dates'), TOPIC_CATEGORY_OUTPUT),
322 (["dates"], _("Date Formats"), loaddoc('dates'), TOPIC_CATEGORY_OUTPUT),
321 (["flags"], _("Command-line flags"), loaddoc('flags'),
323 (["flags"], _("Command-line flags"), loaddoc('flags'),
322 TOPIC_CATEGORY_CONFIG),
324 TOPIC_CATEGORY_CONFIG),
323 (["patterns"], _("File Name Patterns"), loaddoc('patterns'),
325 (["patterns"], _("File Name Patterns"), loaddoc('patterns'),
324 TOPIC_CATEGORY_IDS),
326 TOPIC_CATEGORY_IDS),
325 (['environment', 'env'], _('Environment Variables'),
327 (['environment', 'env'], _('Environment Variables'),
326 loaddoc('environment'), TOPIC_CATEGORY_CONFIG),
328 loaddoc('environment'), TOPIC_CATEGORY_CONFIG),
327 (['revisions', 'revs', 'revsets', 'revset', 'multirevs', 'mrevs'],
329 (['revisions', 'revs', 'revsets', 'revset', 'multirevs', 'mrevs'],
328 _('Specifying Revisions'), loaddoc('revisions'), TOPIC_CATEGORY_IDS),
330 _('Specifying Revisions'), loaddoc('revisions'), TOPIC_CATEGORY_IDS),
329 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets'),
331 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets'),
330 TOPIC_CATEGORY_IDS),
332 TOPIC_CATEGORY_IDS),
331 (['diffs'], _('Diff Formats'), loaddoc('diffs'), TOPIC_CATEGORY_OUTPUT),
333 (['diffs'], _('Diff Formats'), loaddoc('diffs'), TOPIC_CATEGORY_OUTPUT),
332 (['merge-tools', 'mergetools', 'mergetool'], _('Merge Tools'),
334 (['merge-tools', 'mergetools', 'mergetool'], _('Merge Tools'),
333 loaddoc('merge-tools'), TOPIC_CATEGORY_CONFIG),
335 loaddoc('merge-tools'), TOPIC_CATEGORY_CONFIG),
334 (['templating', 'templates', 'template', 'style'], _('Template Usage'),
336 (['templating', 'templates', 'template', 'style'], _('Template Usage'),
335 loaddoc('templates'), TOPIC_CATEGORY_OUTPUT),
337 loaddoc('templates'), TOPIC_CATEGORY_OUTPUT),
336 (['urls'], _('URL Paths'), loaddoc('urls'), TOPIC_CATEGORY_IDS),
338 (['urls'], _('URL Paths'), loaddoc('urls'), TOPIC_CATEGORY_IDS),
337 (["extensions"], _("Using Additional Features"), extshelp,
339 (["extensions"], _("Using Additional Features"), extshelp,
338 TOPIC_CATEGORY_CONFIG),
340 TOPIC_CATEGORY_CONFIG),
339 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos'),
341 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos'),
340 TOPIC_CATEGORY_CONCEPTS),
342 TOPIC_CATEGORY_CONCEPTS),
341 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb'),
343 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb'),
342 TOPIC_CATEGORY_CONFIG),
344 TOPIC_CATEGORY_CONFIG),
343 (["glossary"], _("Glossary"), loaddoc('glossary'), TOPIC_CATEGORY_CONCEPTS),
345 (["glossary"], _("Glossary"), loaddoc('glossary'), TOPIC_CATEGORY_CONCEPTS),
344 (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
346 (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
345 loaddoc('hgignore'), TOPIC_CATEGORY_IDS),
347 loaddoc('hgignore'), TOPIC_CATEGORY_IDS),
346 (["phases"], _("Working with Phases"), loaddoc('phases'),
348 (["phases"], _("Working with Phases"), loaddoc('phases'),
347 TOPIC_CATEGORY_CONCEPTS),
349 TOPIC_CATEGORY_CONCEPTS),
348 (['scripting'], _('Using Mercurial from scripts and automation'),
350 (['scripting'], _('Using Mercurial from scripts and automation'),
349 loaddoc('scripting'), TOPIC_CATEGORY_MISC),
351 loaddoc('scripting'), TOPIC_CATEGORY_MISC),
350 (['internals'], _("Technical implementation topics"), internalshelp,
352 (['internals'], _("Technical implementation topics"), internalshelp,
351 TOPIC_CATEGORY_MISC),
353 TOPIC_CATEGORY_MISC),
352 (['pager'], _("Pager Support"), loaddoc('pager'), TOPIC_CATEGORY_CONFIG),
354 (['pager'], _("Pager Support"), loaddoc('pager'), TOPIC_CATEGORY_CONFIG),
353 ])
355 ])
354
356
355 # Maps topics with sub-topics to a list of their sub-topics.
357 # Maps topics with sub-topics to a list of their sub-topics.
356 subtopics = {
358 subtopics = {
357 'internals': internalstable,
359 'internals': internalstable,
358 }
360 }
359
361
360 # Map topics to lists of callable taking the current topic help and
362 # Map topics to lists of callable taking the current topic help and
361 # returning the updated version
363 # returning the updated version
362 helphooks = {}
364 helphooks = {}
363
365
364 def addtopichook(topic, rewriter):
366 def addtopichook(topic, rewriter):
365 helphooks.setdefault(topic, []).append(rewriter)
367 helphooks.setdefault(topic, []).append(rewriter)
366
368
367 def makeitemsdoc(ui, topic, doc, marker, items, dedent=False):
369 def makeitemsdoc(ui, topic, doc, marker, items, dedent=False):
368 """Extract docstring from the items key to function mapping, build a
370 """Extract docstring from the items key to function mapping, build a
369 single documentation block and use it to overwrite the marker in doc.
371 single documentation block and use it to overwrite the marker in doc.
370 """
372 """
371 entries = []
373 entries = []
372 for name in sorted(items):
374 for name in sorted(items):
373 text = (pycompat.getdoc(items[name]) or '').rstrip()
375 text = (pycompat.getdoc(items[name]) or '').rstrip()
374 if (not text
376 if (not text
375 or not ui.verbose and any(w in text for w in _exclkeywords)):
377 or not ui.verbose and any(w in text for w in _exclkeywords)):
376 continue
378 continue
377 text = gettext(text)
379 text = gettext(text)
378 if dedent:
380 if dedent:
379 # Abuse latin1 to use textwrap.dedent() on bytes.
381 # Abuse latin1 to use textwrap.dedent() on bytes.
380 text = textwrap.dedent(text.decode('latin1')).encode('latin1')
382 text = textwrap.dedent(text.decode('latin1')).encode('latin1')
381 lines = text.splitlines()
383 lines = text.splitlines()
382 doclines = [(lines[0])]
384 doclines = [(lines[0])]
383 for l in lines[1:]:
385 for l in lines[1:]:
384 # Stop once we find some Python doctest
386 # Stop once we find some Python doctest
385 if l.strip().startswith('>>>'):
387 if l.strip().startswith('>>>'):
386 break
388 break
387 if dedent:
389 if dedent:
388 doclines.append(l.rstrip())
390 doclines.append(l.rstrip())
389 else:
391 else:
390 doclines.append(' ' + l.strip())
392 doclines.append(' ' + l.strip())
391 entries.append('\n'.join(doclines))
393 entries.append('\n'.join(doclines))
392 entries = '\n\n'.join(entries)
394 entries = '\n\n'.join(entries)
393 return doc.replace(marker, entries)
395 return doc.replace(marker, entries)
394
396
395 def addtopicsymbols(topic, marker, symbols, dedent=False):
397 def addtopicsymbols(topic, marker, symbols, dedent=False):
396 def add(ui, topic, doc):
398 def add(ui, topic, doc):
397 return makeitemsdoc(ui, topic, doc, marker, symbols, dedent=dedent)
399 return makeitemsdoc(ui, topic, doc, marker, symbols, dedent=dedent)
398 addtopichook(topic, add)
400 addtopichook(topic, add)
399
401
400 addtopicsymbols('bundlespec', '.. bundlecompressionmarker',
402 addtopicsymbols('bundlespec', '.. bundlecompressionmarker',
401 util.bundlecompressiontopics())
403 util.bundlecompressiontopics())
402 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
404 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
403 addtopicsymbols('merge-tools', '.. internaltoolsmarker',
405 addtopicsymbols('merge-tools', '.. internaltoolsmarker',
404 filemerge.internalsdoc)
406 filemerge.internalsdoc)
405 addtopicsymbols('revisions', '.. predicatesmarker', revset.symbols)
407 addtopicsymbols('revisions', '.. predicatesmarker', revset.symbols)
406 addtopicsymbols('templates', '.. keywordsmarker', templatekw.keywords)
408 addtopicsymbols('templates', '.. keywordsmarker', templatekw.keywords)
407 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
409 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
408 addtopicsymbols('templates', '.. functionsmarker', templatefuncs.funcs)
410 addtopicsymbols('templates', '.. functionsmarker', templatefuncs.funcs)
409 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
411 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
410 dedent=True)
412 dedent=True)
411
413
412 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
414 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
413 **opts):
415 **opts):
414 '''
416 '''
415 Generate the help for 'name' as unformatted restructured text. If
417 Generate the help for 'name' as unformatted restructured text. If
416 'name' is None, describe the commands available.
418 'name' is None, describe the commands available.
417 '''
419 '''
418
420
419 opts = pycompat.byteskwargs(opts)
421 opts = pycompat.byteskwargs(opts)
420
422
421 def helpcmd(name, subtopic=None):
423 def helpcmd(name, subtopic=None):
422 try:
424 try:
423 aliases, entry = cmdutil.findcmd(name, commands.table,
425 aliases, entry = cmdutil.findcmd(name, commands.table,
424 strict=unknowncmd)
426 strict=unknowncmd)
425 except error.AmbiguousCommand as inst:
427 except error.AmbiguousCommand as inst:
426 # py3 fix: except vars can't be used outside the scope of the
428 # py3 fix: except vars can't be used outside the scope of the
427 # except block, nor can be used inside a lambda. python issue4617
429 # except block, nor can be used inside a lambda. python issue4617
428 prefix = inst.args[0]
430 prefix = inst.args[0]
429 select = lambda c: cmdutil.parsealiases(c)[0].startswith(prefix)
431 select = lambda c: cmdutil.parsealiases(c)[0].startswith(prefix)
430 rst = helplist(select)
432 rst = helplist(select)
431 return rst
433 return rst
432
434
433 rst = []
435 rst = []
434
436
435 # check if it's an invalid alias and display its error if it is
437 # check if it's an invalid alias and display its error if it is
436 if getattr(entry[0], 'badalias', None):
438 if getattr(entry[0], 'badalias', None):
437 rst.append(entry[0].badalias + '\n')
439 rst.append(entry[0].badalias + '\n')
438 if entry[0].unknowncmd:
440 if entry[0].unknowncmd:
439 try:
441 try:
440 rst.extend(helpextcmd(entry[0].cmdname))
442 rst.extend(helpextcmd(entry[0].cmdname))
441 except error.UnknownCommand:
443 except error.UnknownCommand:
442 pass
444 pass
443 return rst
445 return rst
444
446
445 # synopsis
447 # synopsis
446 if len(entry) > 2:
448 if len(entry) > 2:
447 if entry[2].startswith('hg'):
449 if entry[2].startswith('hg'):
448 rst.append("%s\n" % entry[2])
450 rst.append("%s\n" % entry[2])
449 else:
451 else:
450 rst.append('hg %s %s\n' % (aliases[0], entry[2]))
452 rst.append('hg %s %s\n' % (aliases[0], entry[2]))
451 else:
453 else:
452 rst.append('hg %s\n' % aliases[0])
454 rst.append('hg %s\n' % aliases[0])
453 # aliases
455 # aliases
454 if full and not ui.quiet and len(aliases) > 1:
456 if full and not ui.quiet and len(aliases) > 1:
455 rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:]))
457 rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:]))
456 rst.append('\n')
458 rst.append('\n')
457
459
458 # description
460 # description
459 doc = gettext(pycompat.getdoc(entry[0]))
461 doc = gettext(pycompat.getdoc(entry[0]))
460 if not doc:
462 if not doc:
461 doc = _("(no help text available)")
463 doc = _("(no help text available)")
462 if util.safehasattr(entry[0], 'definition'): # aliased command
464 if util.safehasattr(entry[0], 'definition'): # aliased command
463 source = entry[0].source
465 source = entry[0].source
464 if entry[0].definition.startswith('!'): # shell alias
466 if entry[0].definition.startswith('!'): # shell alias
465 doc = (_('shell alias for: %s\n\n%s\n\ndefined by: %s\n') %
467 doc = (_('shell alias for: %s\n\n%s\n\ndefined by: %s\n') %
466 (entry[0].definition[1:], doc, source))
468 (entry[0].definition[1:], doc, source))
467 else:
469 else:
468 doc = (_('alias for: hg %s\n\n%s\n\ndefined by: %s\n') %
470 doc = (_('alias for: hg %s\n\n%s\n\ndefined by: %s\n') %
469 (entry[0].definition, doc, source))
471 (entry[0].definition, doc, source))
470 doc = doc.splitlines(True)
472 doc = doc.splitlines(True)
471 if ui.quiet or not full:
473 if ui.quiet or not full:
472 rst.append(doc[0])
474 rst.append(doc[0])
473 else:
475 else:
474 rst.extend(doc)
476 rst.extend(doc)
475 rst.append('\n')
477 rst.append('\n')
476
478
477 # check if this command shadows a non-trivial (multi-line)
479 # check if this command shadows a non-trivial (multi-line)
478 # extension help text
480 # extension help text
479 try:
481 try:
480 mod = extensions.find(name)
482 mod = extensions.find(name)
481 doc = gettext(pycompat.getdoc(mod)) or ''
483 doc = gettext(pycompat.getdoc(mod)) or ''
482 if '\n' in doc.strip():
484 if '\n' in doc.strip():
483 msg = _("(use 'hg help -e %s' to show help for "
485 msg = _("(use 'hg help -e %s' to show help for "
484 "the %s extension)") % (name, name)
486 "the %s extension)") % (name, name)
485 rst.append('\n%s\n' % msg)
487 rst.append('\n%s\n' % msg)
486 except KeyError:
488 except KeyError:
487 pass
489 pass
488
490
489 # options
491 # options
490 if not ui.quiet and entry[1]:
492 if not ui.quiet and entry[1]:
491 rst.append(optrst(_("options"), entry[1], ui.verbose))
493 rst.append(optrst(_("options"), entry[1], ui.verbose))
492
494
493 if ui.verbose:
495 if ui.verbose:
494 rst.append(optrst(_("global options"),
496 rst.append(optrst(_("global options"),
495 commands.globalopts, ui.verbose))
497 commands.globalopts, ui.verbose))
496
498
497 if not ui.verbose:
499 if not ui.verbose:
498 if not full:
500 if not full:
499 rst.append(_("\n(use 'hg %s -h' to show more help)\n")
501 rst.append(_("\n(use 'hg %s -h' to show more help)\n")
500 % name)
502 % name)
501 elif not ui.quiet:
503 elif not ui.quiet:
502 rst.append(_('\n(some details hidden, use --verbose '
504 rst.append(_('\n(some details hidden, use --verbose '
503 'to show complete help)'))
505 'to show complete help)'))
504
506
505 return rst
507 return rst
506
508
507 def helplist(select=None, **opts):
509 def helplist(select=None, **opts):
508 # Category -> list of commands
510 # Category -> list of commands
509 cats = {}
511 cats = {}
510 # Command -> short description
512 # Command -> short description
511 h = {}
513 h = {}
512 # Command -> string showing synonyms
514 # Command -> string showing synonyms
513 syns = {}
515 syns = {}
514 for c, e in commands.table.iteritems():
516 for c, e in commands.table.iteritems():
515 fs = cmdutil.parsealiases(c)
517 fs = cmdutil.parsealiases(c)
516 f = fs[0]
518 f = fs[0]
517 syns[f] = ', '.join(fs)
519 syns[f] = ', '.join(fs)
518 func = e[0]
520 func = e[0]
519 if select and not select(f):
521 if select and not select(f):
520 continue
522 continue
521 if (not select and name != 'shortlist' and
523 if (not select and name != 'shortlist' and
522 func.__module__ != commands.__name__):
524 func.__module__ != commands.__name__):
523 continue
525 continue
524 if name == "shortlist":
526 if name == "shortlist":
525 if not getattr(func, 'helpbasic', False):
527 if not getattr(func, 'helpbasic', False):
526 continue
528 continue
527 doc = pycompat.getdoc(func)
529 doc = pycompat.getdoc(func)
528 if filtercmd(ui, f, name, doc):
530 if filtercmd(ui, f, name, doc):
529 continue
531 continue
530 doc = gettext(doc)
532 doc = gettext(doc)
531 if not doc:
533 if not doc:
532 doc = _("(no help text available)")
534 doc = _("(no help text available)")
533 h[f] = doc.splitlines()[0].rstrip()
535 h[f] = doc.splitlines()[0].rstrip()
534
536
535 cat = getattr(func, 'helpcategory', None) or (
537 cat = getattr(func, 'helpcategory', None) or (
536 registrar.command.CATEGORY_NONE)
538 registrar.command.CATEGORY_NONE)
537 cats.setdefault(cat, []).append(f)
539 cats.setdefault(cat, []).append(f)
538
540
539 rst = []
541 rst = []
540 if not h:
542 if not h:
541 if not ui.quiet:
543 if not ui.quiet:
542 rst.append(_('no commands defined\n'))
544 rst.append(_('no commands defined\n'))
543 return rst
545 return rst
544
546
545 # Output top header.
547 # Output top header.
546 if not ui.quiet:
548 if not ui.quiet:
547 if name == "shortlist":
549 if name == "shortlist":
548 rst.append(_('basic commands:\n\n'))
550 rst.append(_('basic commands:\n\n'))
549 elif name == "debug":
551 elif name == "debug":
550 rst.append(_('debug commands (internal and unsupported):\n\n'))
552 rst.append(_('debug commands (internal and unsupported):\n\n'))
551 else:
553 else:
552 rst.append(_('list of commands:\n'))
554 rst.append(_('list of commands:\n'))
553
555
554 def appendcmds(cmds):
556 def appendcmds(cmds):
555 cmds = sorted(cmds)
557 cmds = sorted(cmds)
556 for c in cmds:
558 for c in cmds:
557 if ui.verbose:
559 if ui.verbose:
558 rst.append(" :%s: %s\n" % (syns[c], h[c]))
560 rst.append(" :%s: %s\n" % (syns[c], h[c]))
559 else:
561 else:
560 rst.append(' :%s: %s\n' % (c, h[c]))
562 rst.append(' :%s: %s\n' % (c, h[c]))
561
563
562 if name in ('shortlist', 'debug'):
564 if name in ('shortlist', 'debug'):
563 # List without categories.
565 # List without categories.
564 appendcmds(h)
566 appendcmds(h)
565 else:
567 else:
566 # Check that all categories have an order.
568 # Check that all categories have an order.
567 missing_order = set(cats.keys()) - set(CATEGORY_ORDER)
569 missing_order = set(cats.keys()) - set(CATEGORY_ORDER)
568 if missing_order:
570 if missing_order:
569 ui.develwarn('help categories missing from CATEGORY_ORDER: %s' %
571 ui.develwarn('help categories missing from CATEGORY_ORDER: %s' %
570 missing_order)
572 missing_order)
571
573
572 # List per category.
574 # List per category.
573 for cat in CATEGORY_ORDER:
575 for cat in CATEGORY_ORDER:
574 catfns = cats.get(cat, [])
576 catfns = cats.get(cat, [])
575 if catfns:
577 if catfns:
576 if len(cats) > 1:
578 if len(cats) > 1:
577 catname = gettext(CATEGORY_NAMES[cat])
579 catname = gettext(CATEGORY_NAMES[cat])
578 rst.append("\n%s:\n" % catname)
580 rst.append("\n%s:\n" % catname)
579 rst.append("\n")
581 rst.append("\n")
580 appendcmds(catfns)
582 appendcmds(catfns)
581
583
582 ex = opts.get
584 ex = opts.get
583 anyopts = (ex(r'keyword') or not (ex(r'command') or ex(r'extension')))
585 anyopts = (ex(r'keyword') or not (ex(r'command') or ex(r'extension')))
584 if not name and anyopts:
586 if not name and anyopts:
585 exts = listexts(_('enabled extensions:'), extensions.enabled())
587 exts = listexts(_('enabled extensions:'), extensions.enabled())
586 if exts:
588 if exts:
587 rst.append('\n')
589 rst.append('\n')
588 rst.extend(exts)
590 rst.extend(exts)
589
591
590 rst.append(_("\nadditional help topics:\n"))
592 rst.append(_("\nadditional help topics:\n"))
591 # Group commands by category.
593 # Group commands by category.
592 topiccats = {}
594 topiccats = {}
593 for topic in helptable:
595 for topic in helptable:
594 names, header, doc = topic[0:3]
596 names, header, doc = topic[0:3]
595 if len(topic) > 3 and topic[3]:
597 if len(topic) > 3 and topic[3]:
596 category = topic[3]
598 category = topic[3]
597 else:
599 else:
598 category = TOPIC_CATEGORY_NONE
600 category = TOPIC_CATEGORY_NONE
599
601
600 topiccats.setdefault(category, []).append((names[0], header))
602 topiccats.setdefault(category, []).append((names[0], header))
601
603
602 # Check that all categories have an order.
604 # Check that all categories have an order.
603 missing_order = set(topiccats.keys()) - set(TOPIC_CATEGORY_ORDER)
605 missing_order = set(topiccats.keys()) - set(TOPIC_CATEGORY_ORDER)
604 if missing_order:
606 if missing_order:
605 ui.develwarn(
607 ui.develwarn(
606 'help categories missing from TOPIC_CATEGORY_ORDER: %s' %
608 'help categories missing from TOPIC_CATEGORY_ORDER: %s' %
607 missing_order)
609 missing_order)
608
610
609 # Output topics per category.
611 # Output topics per category.
610 for cat in TOPIC_CATEGORY_ORDER:
612 for cat in TOPIC_CATEGORY_ORDER:
611 topics = topiccats.get(cat, [])
613 topics = topiccats.get(cat, [])
612 if topics:
614 if topics:
613 if len(topiccats) > 1:
615 if len(topiccats) > 1:
614 catname = gettext(TOPIC_CATEGORY_NAMES[cat])
616 catname = gettext(TOPIC_CATEGORY_NAMES[cat])
615 rst.append("\n%s:\n" % catname)
617 rst.append("\n%s:\n" % catname)
616 rst.append("\n")
618 rst.append("\n")
617 for t, desc in topics:
619 for t, desc in topics:
618 rst.append(" :%s: %s\n" % (t, desc))
620 rst.append(" :%s: %s\n" % (t, desc))
619
621
620 if ui.quiet:
622 if ui.quiet:
621 pass
623 pass
622 elif ui.verbose:
624 elif ui.verbose:
623 rst.append('\n%s\n' % optrst(_("global options"),
625 rst.append('\n%s\n' % optrst(_("global options"),
624 commands.globalopts, ui.verbose))
626 commands.globalopts, ui.verbose))
625 if name == 'shortlist':
627 if name == 'shortlist':
626 rst.append(_("\n(use 'hg help' for the full list "
628 rst.append(_("\n(use 'hg help' for the full list "
627 "of commands)\n"))
629 "of commands)\n"))
628 else:
630 else:
629 if name == 'shortlist':
631 if name == 'shortlist':
630 rst.append(_("\n(use 'hg help' for the full list of commands "
632 rst.append(_("\n(use 'hg help' for the full list of commands "
631 "or 'hg -v' for details)\n"))
633 "or 'hg -v' for details)\n"))
632 elif name and not full:
634 elif name and not full:
633 rst.append(_("\n(use 'hg help %s' to show the full help "
635 rst.append(_("\n(use 'hg help %s' to show the full help "
634 "text)\n") % name)
636 "text)\n") % name)
635 elif name and syns and name in syns.keys():
637 elif name and syns and name in syns.keys():
636 rst.append(_("\n(use 'hg help -v -e %s' to show built-in "
638 rst.append(_("\n(use 'hg help -v -e %s' to show built-in "
637 "aliases and global options)\n") % name)
639 "aliases and global options)\n") % name)
638 else:
640 else:
639 rst.append(_("\n(use 'hg help -v%s' to show built-in aliases "
641 rst.append(_("\n(use 'hg help -v%s' to show built-in aliases "
640 "and global options)\n")
642 "and global options)\n")
641 % (name and " " + name or ""))
643 % (name and " " + name or ""))
642 return rst
644 return rst
643
645
644 def helptopic(name, subtopic=None):
646 def helptopic(name, subtopic=None):
645 # Look for sub-topic entry first.
647 # Look for sub-topic entry first.
646 header, doc = None, None
648 header, doc = None, None
647 if subtopic and name in subtopics:
649 if subtopic and name in subtopics:
648 for names, header, doc in subtopics[name]:
650 for names, header, doc in subtopics[name]:
649 if subtopic in names:
651 if subtopic in names:
650 break
652 break
651
653
652 if not header:
654 if not header:
653 for topic in helptable:
655 for topic in helptable:
654 names, header, doc = topic[0:3]
656 names, header, doc = topic[0:3]
655 if name in names:
657 if name in names:
656 break
658 break
657 else:
659 else:
658 raise error.UnknownCommand(name)
660 raise error.UnknownCommand(name)
659
661
660 rst = [minirst.section(header)]
662 rst = [minirst.section(header)]
661
663
662 # description
664 # description
663 if not doc:
665 if not doc:
664 rst.append(" %s\n" % _("(no help text available)"))
666 rst.append(" %s\n" % _("(no help text available)"))
665 if callable(doc):
667 if callable(doc):
666 rst += [" %s\n" % l for l in doc(ui).splitlines()]
668 rst += [" %s\n" % l for l in doc(ui).splitlines()]
667
669
668 if not ui.verbose:
670 if not ui.verbose:
669 omitted = _('(some details hidden, use --verbose'
671 omitted = _('(some details hidden, use --verbose'
670 ' to show complete help)')
672 ' to show complete help)')
671 indicateomitted(rst, omitted)
673 indicateomitted(rst, omitted)
672
674
673 try:
675 try:
674 cmdutil.findcmd(name, commands.table)
676 cmdutil.findcmd(name, commands.table)
675 rst.append(_("\nuse 'hg help -c %s' to see help for "
677 rst.append(_("\nuse 'hg help -c %s' to see help for "
676 "the %s command\n") % (name, name))
678 "the %s command\n") % (name, name))
677 except error.UnknownCommand:
679 except error.UnknownCommand:
678 pass
680 pass
679 return rst
681 return rst
680
682
681 def helpext(name, subtopic=None):
683 def helpext(name, subtopic=None):
682 try:
684 try:
683 mod = extensions.find(name)
685 mod = extensions.find(name)
684 doc = gettext(pycompat.getdoc(mod)) or _('no help text available')
686 doc = gettext(pycompat.getdoc(mod)) or _('no help text available')
685 except KeyError:
687 except KeyError:
686 mod = None
688 mod = None
687 doc = extensions.disabledext(name)
689 doc = extensions.disabledext(name)
688 if not doc:
690 if not doc:
689 raise error.UnknownCommand(name)
691 raise error.UnknownCommand(name)
690
692
691 if '\n' not in doc:
693 if '\n' not in doc:
692 head, tail = doc, ""
694 head, tail = doc, ""
693 else:
695 else:
694 head, tail = doc.split('\n', 1)
696 head, tail = doc.split('\n', 1)
695 rst = [_('%s extension - %s\n\n') % (name.rpartition('.')[-1], head)]
697 rst = [_('%s extension - %s\n\n') % (name.rpartition('.')[-1], head)]
696 if tail:
698 if tail:
697 rst.extend(tail.splitlines(True))
699 rst.extend(tail.splitlines(True))
698 rst.append('\n')
700 rst.append('\n')
699
701
700 if not ui.verbose:
702 if not ui.verbose:
701 omitted = _('(some details hidden, use --verbose'
703 omitted = _('(some details hidden, use --verbose'
702 ' to show complete help)')
704 ' to show complete help)')
703 indicateomitted(rst, omitted)
705 indicateomitted(rst, omitted)
704
706
705 if mod:
707 if mod:
706 try:
708 try:
707 ct = mod.cmdtable
709 ct = mod.cmdtable
708 except AttributeError:
710 except AttributeError:
709 ct = {}
711 ct = {}
710 modcmds = set([c.partition('|')[0] for c in ct])
712 modcmds = set([c.partition('|')[0] for c in ct])
711 rst.extend(helplist(modcmds.__contains__))
713 rst.extend(helplist(modcmds.__contains__))
712 else:
714 else:
713 rst.append(_("(use 'hg help extensions' for information on enabling"
715 rst.append(_("(use 'hg help extensions' for information on enabling"
714 " extensions)\n"))
716 " extensions)\n"))
715 return rst
717 return rst
716
718
717 def helpextcmd(name, subtopic=None):
719 def helpextcmd(name, subtopic=None):
718 cmd, ext, doc = extensions.disabledcmd(ui, name,
720 cmd, ext, doc = extensions.disabledcmd(ui, name,
719 ui.configbool('ui', 'strict'))
721 ui.configbool('ui', 'strict'))
720 doc = doc.splitlines()[0]
722 doc = doc.splitlines()[0]
721
723
722 rst = listexts(_("'%s' is provided by the following "
724 rst = listexts(_("'%s' is provided by the following "
723 "extension:") % cmd, {ext: doc}, indent=4,
725 "extension:") % cmd, {ext: doc}, indent=4,
724 showdeprecated=True)
726 showdeprecated=True)
725 rst.append('\n')
727 rst.append('\n')
726 rst.append(_("(use 'hg help extensions' for information on enabling "
728 rst.append(_("(use 'hg help extensions' for information on enabling "
727 "extensions)\n"))
729 "extensions)\n"))
728 return rst
730 return rst
729
731
730
732
731 rst = []
733 rst = []
732 kw = opts.get('keyword')
734 kw = opts.get('keyword')
733 if kw or name is None and any(opts[o] for o in opts):
735 if kw or name is None and any(opts[o] for o in opts):
734 matches = topicmatch(ui, commands, name or '')
736 matches = topicmatch(ui, commands, name or '')
735 helpareas = []
737 helpareas = []
736 if opts.get('extension'):
738 if opts.get('extension'):
737 helpareas += [('extensions', _('Extensions'))]
739 helpareas += [('extensions', _('Extensions'))]
738 if opts.get('command'):
740 if opts.get('command'):
739 helpareas += [('commands', _('Commands'))]
741 helpareas += [('commands', _('Commands'))]
740 if not helpareas:
742 if not helpareas:
741 helpareas = [('topics', _('Topics')),
743 helpareas = [('topics', _('Topics')),
742 ('commands', _('Commands')),
744 ('commands', _('Commands')),
743 ('extensions', _('Extensions')),
745 ('extensions', _('Extensions')),
744 ('extensioncommands', _('Extension Commands'))]
746 ('extensioncommands', _('Extension Commands'))]
745 for t, title in helpareas:
747 for t, title in helpareas:
746 if matches[t]:
748 if matches[t]:
747 rst.append('%s:\n\n' % title)
749 rst.append('%s:\n\n' % title)
748 rst.extend(minirst.maketable(sorted(matches[t]), 1))
750 rst.extend(minirst.maketable(sorted(matches[t]), 1))
749 rst.append('\n')
751 rst.append('\n')
750 if not rst:
752 if not rst:
751 msg = _('no matches')
753 msg = _('no matches')
752 hint = _("try 'hg help' for a list of topics")
754 hint = _("try 'hg help' for a list of topics")
753 raise error.Abort(msg, hint=hint)
755 raise error.Abort(msg, hint=hint)
754 elif name and name != 'shortlist':
756 elif name and name != 'shortlist':
755 queries = []
757 queries = []
756 if unknowncmd:
758 if unknowncmd:
757 queries += [helpextcmd]
759 queries += [helpextcmd]
758 if opts.get('extension'):
760 if opts.get('extension'):
759 queries += [helpext]
761 queries += [helpext]
760 if opts.get('command'):
762 if opts.get('command'):
761 queries += [helpcmd]
763 queries += [helpcmd]
762 if not queries:
764 if not queries:
763 queries = (helptopic, helpcmd, helpext, helpextcmd)
765 queries = (helptopic, helpcmd, helpext, helpextcmd)
764 for f in queries:
766 for f in queries:
765 try:
767 try:
766 rst = f(name, subtopic)
768 rst = f(name, subtopic)
767 break
769 break
768 except error.UnknownCommand:
770 except error.UnknownCommand:
769 pass
771 pass
770 else:
772 else:
771 if unknowncmd:
773 if unknowncmd:
772 raise error.UnknownCommand(name)
774 raise error.UnknownCommand(name)
773 else:
775 else:
774 msg = _('no such help topic: %s') % name
776 msg = _('no such help topic: %s') % name
775 hint = _("try 'hg help --keyword %s'") % name
777 hint = _("try 'hg help --keyword %s'") % name
776 raise error.Abort(msg, hint=hint)
778 raise error.Abort(msg, hint=hint)
777 else:
779 else:
778 # program name
780 # program name
779 if not ui.quiet:
781 if not ui.quiet:
780 rst = [_("Mercurial Distributed SCM\n"), '\n']
782 rst = [_("Mercurial Distributed SCM\n"), '\n']
781 rst.extend(helplist(None, **pycompat.strkwargs(opts)))
783 rst.extend(helplist(None, **pycompat.strkwargs(opts)))
782
784
783 return ''.join(rst)
785 return ''.join(rst)
784
786
785 def formattedhelp(ui, commands, fullname, keep=None, unknowncmd=False,
787 def formattedhelp(ui, commands, fullname, keep=None, unknowncmd=False,
786 full=True, **opts):
788 full=True, **opts):
787 """get help for a given topic (as a dotted name) as rendered rst
789 """get help for a given topic (as a dotted name) as rendered rst
788
790
789 Either returns the rendered help text or raises an exception.
791 Either returns the rendered help text or raises an exception.
790 """
792 """
791 if keep is None:
793 if keep is None:
792 keep = []
794 keep = []
793 else:
795 else:
794 keep = list(keep) # make a copy so we can mutate this later
796 keep = list(keep) # make a copy so we can mutate this later
795
797
796 # <fullname> := <name>[.<subtopic][.<section>]
798 # <fullname> := <name>[.<subtopic][.<section>]
797 name = subtopic = section = None
799 name = subtopic = section = None
798 if fullname is not None:
800 if fullname is not None:
799 nameparts = fullname.split('.')
801 nameparts = fullname.split('.')
800 name = nameparts.pop(0)
802 name = nameparts.pop(0)
801 if nameparts and name in subtopics:
803 if nameparts and name in subtopics:
802 subtopic = nameparts.pop(0)
804 subtopic = nameparts.pop(0)
803 if nameparts:
805 if nameparts:
804 section = encoding.lower('.'.join(nameparts))
806 section = encoding.lower('.'.join(nameparts))
805
807
806 textwidth = ui.configint('ui', 'textwidth')
808 textwidth = ui.configint('ui', 'textwidth')
807 termwidth = ui.termwidth() - 2
809 termwidth = ui.termwidth() - 2
808 if textwidth <= 0 or termwidth < textwidth:
810 if textwidth <= 0 or termwidth < textwidth:
809 textwidth = termwidth
811 textwidth = termwidth
810 text = help_(ui, commands, name,
812 text = help_(ui, commands, name,
811 subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
813 subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
812
814
813 blocks, pruned = minirst.parse(text, keep=keep)
815 blocks, pruned = minirst.parse(text, keep=keep)
814 if 'verbose' in pruned:
816 if 'verbose' in pruned:
815 keep.append('omitted')
817 keep.append('omitted')
816 else:
818 else:
817 keep.append('notomitted')
819 keep.append('notomitted')
818 blocks, pruned = minirst.parse(text, keep=keep)
820 blocks, pruned = minirst.parse(text, keep=keep)
819 if section:
821 if section:
820 blocks = minirst.filtersections(blocks, section)
822 blocks = minirst.filtersections(blocks, section)
821
823
822 # We could have been given a weird ".foo" section without a name
824 # We could have been given a weird ".foo" section without a name
823 # to look for, or we could have simply failed to found "foo.bar"
825 # to look for, or we could have simply failed to found "foo.bar"
824 # because bar isn't a section of foo
826 # because bar isn't a section of foo
825 if section and not (blocks and name):
827 if section and not (blocks and name):
826 raise error.Abort(_("help section not found: %s") % fullname)
828 raise error.Abort(_("help section not found: %s") % fullname)
827
829
828 return minirst.formatplain(blocks, textwidth)
830 return minirst.formatplain(blocks, textwidth)
General Comments 0
You need to be logged in to leave comments. Login now