##// END OF EJS Templates
profiling: introduce a "profiling.time-track" option...
Boris Feld -
r38279:15a1e37f default
parent child Browse files
Show More
@@ -1,1349 +1,1352
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('auth', 'cookiefile',
150 coreconfigitem('auth', 'cookiefile',
151 default=None,
151 default=None,
152 )
152 )
153 # bookmarks.pushing: internal hack for discovery
153 # bookmarks.pushing: internal hack for discovery
154 coreconfigitem('bookmarks', 'pushing',
154 coreconfigitem('bookmarks', 'pushing',
155 default=list,
155 default=list,
156 )
156 )
157 # bundle.mainreporoot: internal hack for bundlerepo
157 # bundle.mainreporoot: internal hack for bundlerepo
158 coreconfigitem('bundle', 'mainreporoot',
158 coreconfigitem('bundle', 'mainreporoot',
159 default='',
159 default='',
160 )
160 )
161 # bundle.reorder: experimental config
161 # bundle.reorder: experimental config
162 coreconfigitem('bundle', 'reorder',
162 coreconfigitem('bundle', 'reorder',
163 default='auto',
163 default='auto',
164 )
164 )
165 coreconfigitem('censor', 'policy',
165 coreconfigitem('censor', 'policy',
166 default='abort',
166 default='abort',
167 )
167 )
168 coreconfigitem('chgserver', 'idletimeout',
168 coreconfigitem('chgserver', 'idletimeout',
169 default=3600,
169 default=3600,
170 )
170 )
171 coreconfigitem('chgserver', 'skiphash',
171 coreconfigitem('chgserver', 'skiphash',
172 default=False,
172 default=False,
173 )
173 )
174 coreconfigitem('cmdserver', 'log',
174 coreconfigitem('cmdserver', 'log',
175 default=None,
175 default=None,
176 )
176 )
177 coreconfigitem('color', '.*',
177 coreconfigitem('color', '.*',
178 default=None,
178 default=None,
179 generic=True,
179 generic=True,
180 )
180 )
181 coreconfigitem('color', 'mode',
181 coreconfigitem('color', 'mode',
182 default='auto',
182 default='auto',
183 )
183 )
184 coreconfigitem('color', 'pagermode',
184 coreconfigitem('color', 'pagermode',
185 default=dynamicdefault,
185 default=dynamicdefault,
186 )
186 )
187 coreconfigitem('commands', 'show.aliasprefix',
187 coreconfigitem('commands', 'show.aliasprefix',
188 default=list,
188 default=list,
189 )
189 )
190 coreconfigitem('commands', 'status.relative',
190 coreconfigitem('commands', 'status.relative',
191 default=False,
191 default=False,
192 )
192 )
193 coreconfigitem('commands', 'status.skipstates',
193 coreconfigitem('commands', 'status.skipstates',
194 default=[],
194 default=[],
195 )
195 )
196 coreconfigitem('commands', 'status.terse',
196 coreconfigitem('commands', 'status.terse',
197 default='',
197 default='',
198 )
198 )
199 coreconfigitem('commands', 'status.verbose',
199 coreconfigitem('commands', 'status.verbose',
200 default=False,
200 default=False,
201 )
201 )
202 coreconfigitem('commands', 'update.check',
202 coreconfigitem('commands', 'update.check',
203 default=None,
203 default=None,
204 )
204 )
205 coreconfigitem('commands', 'update.requiredest',
205 coreconfigitem('commands', 'update.requiredest',
206 default=False,
206 default=False,
207 )
207 )
208 coreconfigitem('committemplate', '.*',
208 coreconfigitem('committemplate', '.*',
209 default=None,
209 default=None,
210 generic=True,
210 generic=True,
211 )
211 )
212 coreconfigitem('convert', 'cvsps.cache',
212 coreconfigitem('convert', 'cvsps.cache',
213 default=True,
213 default=True,
214 )
214 )
215 coreconfigitem('convert', 'cvsps.fuzz',
215 coreconfigitem('convert', 'cvsps.fuzz',
216 default=60,
216 default=60,
217 )
217 )
218 coreconfigitem('convert', 'cvsps.logencoding',
218 coreconfigitem('convert', 'cvsps.logencoding',
219 default=None,
219 default=None,
220 )
220 )
221 coreconfigitem('convert', 'cvsps.mergefrom',
221 coreconfigitem('convert', 'cvsps.mergefrom',
222 default=None,
222 default=None,
223 )
223 )
224 coreconfigitem('convert', 'cvsps.mergeto',
224 coreconfigitem('convert', 'cvsps.mergeto',
225 default=None,
225 default=None,
226 )
226 )
227 coreconfigitem('convert', 'git.committeractions',
227 coreconfigitem('convert', 'git.committeractions',
228 default=lambda: ['messagedifferent'],
228 default=lambda: ['messagedifferent'],
229 )
229 )
230 coreconfigitem('convert', 'git.extrakeys',
230 coreconfigitem('convert', 'git.extrakeys',
231 default=list,
231 default=list,
232 )
232 )
233 coreconfigitem('convert', 'git.findcopiesharder',
233 coreconfigitem('convert', 'git.findcopiesharder',
234 default=False,
234 default=False,
235 )
235 )
236 coreconfigitem('convert', 'git.remoteprefix',
236 coreconfigitem('convert', 'git.remoteprefix',
237 default='remote',
237 default='remote',
238 )
238 )
239 coreconfigitem('convert', 'git.renamelimit',
239 coreconfigitem('convert', 'git.renamelimit',
240 default=400,
240 default=400,
241 )
241 )
242 coreconfigitem('convert', 'git.saverev',
242 coreconfigitem('convert', 'git.saverev',
243 default=True,
243 default=True,
244 )
244 )
245 coreconfigitem('convert', 'git.similarity',
245 coreconfigitem('convert', 'git.similarity',
246 default=50,
246 default=50,
247 )
247 )
248 coreconfigitem('convert', 'git.skipsubmodules',
248 coreconfigitem('convert', 'git.skipsubmodules',
249 default=False,
249 default=False,
250 )
250 )
251 coreconfigitem('convert', 'hg.clonebranches',
251 coreconfigitem('convert', 'hg.clonebranches',
252 default=False,
252 default=False,
253 )
253 )
254 coreconfigitem('convert', 'hg.ignoreerrors',
254 coreconfigitem('convert', 'hg.ignoreerrors',
255 default=False,
255 default=False,
256 )
256 )
257 coreconfigitem('convert', 'hg.revs',
257 coreconfigitem('convert', 'hg.revs',
258 default=None,
258 default=None,
259 )
259 )
260 coreconfigitem('convert', 'hg.saverev',
260 coreconfigitem('convert', 'hg.saverev',
261 default=False,
261 default=False,
262 )
262 )
263 coreconfigitem('convert', 'hg.sourcename',
263 coreconfigitem('convert', 'hg.sourcename',
264 default=None,
264 default=None,
265 )
265 )
266 coreconfigitem('convert', 'hg.startrev',
266 coreconfigitem('convert', 'hg.startrev',
267 default=None,
267 default=None,
268 )
268 )
269 coreconfigitem('convert', 'hg.tagsbranch',
269 coreconfigitem('convert', 'hg.tagsbranch',
270 default='default',
270 default='default',
271 )
271 )
272 coreconfigitem('convert', 'hg.usebranchnames',
272 coreconfigitem('convert', 'hg.usebranchnames',
273 default=True,
273 default=True,
274 )
274 )
275 coreconfigitem('convert', 'ignoreancestorcheck',
275 coreconfigitem('convert', 'ignoreancestorcheck',
276 default=False,
276 default=False,
277 )
277 )
278 coreconfigitem('convert', 'localtimezone',
278 coreconfigitem('convert', 'localtimezone',
279 default=False,
279 default=False,
280 )
280 )
281 coreconfigitem('convert', 'p4.encoding',
281 coreconfigitem('convert', 'p4.encoding',
282 default=dynamicdefault,
282 default=dynamicdefault,
283 )
283 )
284 coreconfigitem('convert', 'p4.startrev',
284 coreconfigitem('convert', 'p4.startrev',
285 default=0,
285 default=0,
286 )
286 )
287 coreconfigitem('convert', 'skiptags',
287 coreconfigitem('convert', 'skiptags',
288 default=False,
288 default=False,
289 )
289 )
290 coreconfigitem('convert', 'svn.debugsvnlog',
290 coreconfigitem('convert', 'svn.debugsvnlog',
291 default=True,
291 default=True,
292 )
292 )
293 coreconfigitem('convert', 'svn.trunk',
293 coreconfigitem('convert', 'svn.trunk',
294 default=None,
294 default=None,
295 )
295 )
296 coreconfigitem('convert', 'svn.tags',
296 coreconfigitem('convert', 'svn.tags',
297 default=None,
297 default=None,
298 )
298 )
299 coreconfigitem('convert', 'svn.branches',
299 coreconfigitem('convert', 'svn.branches',
300 default=None,
300 default=None,
301 )
301 )
302 coreconfigitem('convert', 'svn.startrev',
302 coreconfigitem('convert', 'svn.startrev',
303 default=0,
303 default=0,
304 )
304 )
305 coreconfigitem('debug', 'dirstate.delaywrite',
305 coreconfigitem('debug', 'dirstate.delaywrite',
306 default=0,
306 default=0,
307 )
307 )
308 coreconfigitem('defaults', '.*',
308 coreconfigitem('defaults', '.*',
309 default=None,
309 default=None,
310 generic=True,
310 generic=True,
311 )
311 )
312 coreconfigitem('devel', 'all-warnings',
312 coreconfigitem('devel', 'all-warnings',
313 default=False,
313 default=False,
314 )
314 )
315 coreconfigitem('devel', 'bundle2.debug',
315 coreconfigitem('devel', 'bundle2.debug',
316 default=False,
316 default=False,
317 )
317 )
318 coreconfigitem('devel', 'cache-vfs',
318 coreconfigitem('devel', 'cache-vfs',
319 default=None,
319 default=None,
320 )
320 )
321 coreconfigitem('devel', 'check-locks',
321 coreconfigitem('devel', 'check-locks',
322 default=False,
322 default=False,
323 )
323 )
324 coreconfigitem('devel', 'check-relroot',
324 coreconfigitem('devel', 'check-relroot',
325 default=False,
325 default=False,
326 )
326 )
327 coreconfigitem('devel', 'default-date',
327 coreconfigitem('devel', 'default-date',
328 default=None,
328 default=None,
329 )
329 )
330 coreconfigitem('devel', 'deprec-warn',
330 coreconfigitem('devel', 'deprec-warn',
331 default=False,
331 default=False,
332 )
332 )
333 coreconfigitem('devel', 'disableloaddefaultcerts',
333 coreconfigitem('devel', 'disableloaddefaultcerts',
334 default=False,
334 default=False,
335 )
335 )
336 coreconfigitem('devel', 'warn-empty-changegroup',
336 coreconfigitem('devel', 'warn-empty-changegroup',
337 default=False,
337 default=False,
338 )
338 )
339 coreconfigitem('devel', 'legacy.exchange',
339 coreconfigitem('devel', 'legacy.exchange',
340 default=list,
340 default=list,
341 )
341 )
342 coreconfigitem('devel', 'servercafile',
342 coreconfigitem('devel', 'servercafile',
343 default='',
343 default='',
344 )
344 )
345 coreconfigitem('devel', 'serverexactprotocol',
345 coreconfigitem('devel', 'serverexactprotocol',
346 default='',
346 default='',
347 )
347 )
348 coreconfigitem('devel', 'serverrequirecert',
348 coreconfigitem('devel', 'serverrequirecert',
349 default=False,
349 default=False,
350 )
350 )
351 coreconfigitem('devel', 'strip-obsmarkers',
351 coreconfigitem('devel', 'strip-obsmarkers',
352 default=True,
352 default=True,
353 )
353 )
354 coreconfigitem('devel', 'warn-config',
354 coreconfigitem('devel', 'warn-config',
355 default=None,
355 default=None,
356 )
356 )
357 coreconfigitem('devel', 'warn-config-default',
357 coreconfigitem('devel', 'warn-config-default',
358 default=None,
358 default=None,
359 )
359 )
360 coreconfigitem('devel', 'user.obsmarker',
360 coreconfigitem('devel', 'user.obsmarker',
361 default=None,
361 default=None,
362 )
362 )
363 coreconfigitem('devel', 'warn-config-unknown',
363 coreconfigitem('devel', 'warn-config-unknown',
364 default=None,
364 default=None,
365 )
365 )
366 coreconfigitem('devel', 'debug.peer-request',
366 coreconfigitem('devel', 'debug.peer-request',
367 default=False,
367 default=False,
368 )
368 )
369 coreconfigitem('diff', 'nodates',
369 coreconfigitem('diff', 'nodates',
370 default=False,
370 default=False,
371 )
371 )
372 coreconfigitem('diff', 'showfunc',
372 coreconfigitem('diff', 'showfunc',
373 default=False,
373 default=False,
374 )
374 )
375 coreconfigitem('diff', 'unified',
375 coreconfigitem('diff', 'unified',
376 default=None,
376 default=None,
377 )
377 )
378 coreconfigitem('diff', 'git',
378 coreconfigitem('diff', 'git',
379 default=False,
379 default=False,
380 )
380 )
381 coreconfigitem('diff', 'ignorews',
381 coreconfigitem('diff', 'ignorews',
382 default=False,
382 default=False,
383 )
383 )
384 coreconfigitem('diff', 'ignorewsamount',
384 coreconfigitem('diff', 'ignorewsamount',
385 default=False,
385 default=False,
386 )
386 )
387 coreconfigitem('diff', 'ignoreblanklines',
387 coreconfigitem('diff', 'ignoreblanklines',
388 default=False,
388 default=False,
389 )
389 )
390 coreconfigitem('diff', 'ignorewseol',
390 coreconfigitem('diff', 'ignorewseol',
391 default=False,
391 default=False,
392 )
392 )
393 coreconfigitem('diff', 'nobinary',
393 coreconfigitem('diff', 'nobinary',
394 default=False,
394 default=False,
395 )
395 )
396 coreconfigitem('diff', 'noprefix',
396 coreconfigitem('diff', 'noprefix',
397 default=False,
397 default=False,
398 )
398 )
399 coreconfigitem('email', 'bcc',
399 coreconfigitem('email', 'bcc',
400 default=None,
400 default=None,
401 )
401 )
402 coreconfigitem('email', 'cc',
402 coreconfigitem('email', 'cc',
403 default=None,
403 default=None,
404 )
404 )
405 coreconfigitem('email', 'charsets',
405 coreconfigitem('email', 'charsets',
406 default=list,
406 default=list,
407 )
407 )
408 coreconfigitem('email', 'from',
408 coreconfigitem('email', 'from',
409 default=None,
409 default=None,
410 )
410 )
411 coreconfigitem('email', 'method',
411 coreconfigitem('email', 'method',
412 default='smtp',
412 default='smtp',
413 )
413 )
414 coreconfigitem('email', 'reply-to',
414 coreconfigitem('email', 'reply-to',
415 default=None,
415 default=None,
416 )
416 )
417 coreconfigitem('email', 'to',
417 coreconfigitem('email', 'to',
418 default=None,
418 default=None,
419 )
419 )
420 coreconfigitem('experimental', 'archivemetatemplate',
420 coreconfigitem('experimental', 'archivemetatemplate',
421 default=dynamicdefault,
421 default=dynamicdefault,
422 )
422 )
423 coreconfigitem('experimental', 'bundle-phases',
423 coreconfigitem('experimental', 'bundle-phases',
424 default=False,
424 default=False,
425 )
425 )
426 coreconfigitem('experimental', 'bundle2-advertise',
426 coreconfigitem('experimental', 'bundle2-advertise',
427 default=True,
427 default=True,
428 )
428 )
429 coreconfigitem('experimental', 'bundle2-output-capture',
429 coreconfigitem('experimental', 'bundle2-output-capture',
430 default=False,
430 default=False,
431 )
431 )
432 coreconfigitem('experimental', 'bundle2.pushback',
432 coreconfigitem('experimental', 'bundle2.pushback',
433 default=False,
433 default=False,
434 )
434 )
435 coreconfigitem('experimental', 'bundle2.stream',
435 coreconfigitem('experimental', 'bundle2.stream',
436 default=False,
436 default=False,
437 )
437 )
438 coreconfigitem('experimental', 'bundle2lazylocking',
438 coreconfigitem('experimental', 'bundle2lazylocking',
439 default=False,
439 default=False,
440 )
440 )
441 coreconfigitem('experimental', 'bundlecomplevel',
441 coreconfigitem('experimental', 'bundlecomplevel',
442 default=None,
442 default=None,
443 )
443 )
444 coreconfigitem('experimental', 'bundlecomplevel.bzip2',
444 coreconfigitem('experimental', 'bundlecomplevel.bzip2',
445 default=None,
445 default=None,
446 )
446 )
447 coreconfigitem('experimental', 'bundlecomplevel.gzip',
447 coreconfigitem('experimental', 'bundlecomplevel.gzip',
448 default=None,
448 default=None,
449 )
449 )
450 coreconfigitem('experimental', 'bundlecomplevel.none',
450 coreconfigitem('experimental', 'bundlecomplevel.none',
451 default=None,
451 default=None,
452 )
452 )
453 coreconfigitem('experimental', 'bundlecomplevel.zstd',
453 coreconfigitem('experimental', 'bundlecomplevel.zstd',
454 default=None,
454 default=None,
455 )
455 )
456 coreconfigitem('experimental', 'changegroup3',
456 coreconfigitem('experimental', 'changegroup3',
457 default=False,
457 default=False,
458 )
458 )
459 coreconfigitem('experimental', 'clientcompressionengines',
459 coreconfigitem('experimental', 'clientcompressionengines',
460 default=list,
460 default=list,
461 )
461 )
462 coreconfigitem('experimental', 'copytrace',
462 coreconfigitem('experimental', 'copytrace',
463 default='on',
463 default='on',
464 )
464 )
465 coreconfigitem('experimental', 'copytrace.movecandidateslimit',
465 coreconfigitem('experimental', 'copytrace.movecandidateslimit',
466 default=100,
466 default=100,
467 )
467 )
468 coreconfigitem('experimental', 'copytrace.sourcecommitlimit',
468 coreconfigitem('experimental', 'copytrace.sourcecommitlimit',
469 default=100,
469 default=100,
470 )
470 )
471 coreconfigitem('experimental', 'crecordtest',
471 coreconfigitem('experimental', 'crecordtest',
472 default=None,
472 default=None,
473 )
473 )
474 coreconfigitem('experimental', 'directaccess',
474 coreconfigitem('experimental', 'directaccess',
475 default=False,
475 default=False,
476 )
476 )
477 coreconfigitem('experimental', 'directaccess.revnums',
477 coreconfigitem('experimental', 'directaccess.revnums',
478 default=False,
478 default=False,
479 )
479 )
480 coreconfigitem('experimental', 'editortmpinhg',
480 coreconfigitem('experimental', 'editortmpinhg',
481 default=False,
481 default=False,
482 )
482 )
483 coreconfigitem('experimental', 'evolution',
483 coreconfigitem('experimental', 'evolution',
484 default=list,
484 default=list,
485 )
485 )
486 coreconfigitem('experimental', 'evolution.allowdivergence',
486 coreconfigitem('experimental', 'evolution.allowdivergence',
487 default=False,
487 default=False,
488 alias=[('experimental', 'allowdivergence')]
488 alias=[('experimental', 'allowdivergence')]
489 )
489 )
490 coreconfigitem('experimental', 'evolution.allowunstable',
490 coreconfigitem('experimental', 'evolution.allowunstable',
491 default=None,
491 default=None,
492 )
492 )
493 coreconfigitem('experimental', 'evolution.createmarkers',
493 coreconfigitem('experimental', 'evolution.createmarkers',
494 default=None,
494 default=None,
495 )
495 )
496 coreconfigitem('experimental', 'evolution.effect-flags',
496 coreconfigitem('experimental', 'evolution.effect-flags',
497 default=True,
497 default=True,
498 alias=[('experimental', 'effect-flags')]
498 alias=[('experimental', 'effect-flags')]
499 )
499 )
500 coreconfigitem('experimental', 'evolution.exchange',
500 coreconfigitem('experimental', 'evolution.exchange',
501 default=None,
501 default=None,
502 )
502 )
503 coreconfigitem('experimental', 'evolution.bundle-obsmarker',
503 coreconfigitem('experimental', 'evolution.bundle-obsmarker',
504 default=False,
504 default=False,
505 )
505 )
506 coreconfigitem('experimental', 'evolution.report-instabilities',
506 coreconfigitem('experimental', 'evolution.report-instabilities',
507 default=True,
507 default=True,
508 )
508 )
509 coreconfigitem('experimental', 'evolution.track-operation',
509 coreconfigitem('experimental', 'evolution.track-operation',
510 default=True,
510 default=True,
511 )
511 )
512 coreconfigitem('experimental', 'worddiff',
512 coreconfigitem('experimental', 'worddiff',
513 default=False,
513 default=False,
514 )
514 )
515 coreconfigitem('experimental', 'maxdeltachainspan',
515 coreconfigitem('experimental', 'maxdeltachainspan',
516 default=-1,
516 default=-1,
517 )
517 )
518 coreconfigitem('experimental', 'mergetempdirprefix',
518 coreconfigitem('experimental', 'mergetempdirprefix',
519 default=None,
519 default=None,
520 )
520 )
521 coreconfigitem('experimental', 'mmapindexthreshold',
521 coreconfigitem('experimental', 'mmapindexthreshold',
522 default=None,
522 default=None,
523 )
523 )
524 coreconfigitem('experimental', 'nonnormalparanoidcheck',
524 coreconfigitem('experimental', 'nonnormalparanoidcheck',
525 default=False,
525 default=False,
526 )
526 )
527 coreconfigitem('experimental', 'exportableenviron',
527 coreconfigitem('experimental', 'exportableenviron',
528 default=list,
528 default=list,
529 )
529 )
530 coreconfigitem('experimental', 'extendedheader.index',
530 coreconfigitem('experimental', 'extendedheader.index',
531 default=None,
531 default=None,
532 )
532 )
533 coreconfigitem('experimental', 'extendedheader.similarity',
533 coreconfigitem('experimental', 'extendedheader.similarity',
534 default=False,
534 default=False,
535 )
535 )
536 coreconfigitem('experimental', 'format.compression',
536 coreconfigitem('experimental', 'format.compression',
537 default='zlib',
537 default='zlib',
538 )
538 )
539 coreconfigitem('experimental', 'graphshorten',
539 coreconfigitem('experimental', 'graphshorten',
540 default=False,
540 default=False,
541 )
541 )
542 coreconfigitem('experimental', 'graphstyle.parent',
542 coreconfigitem('experimental', 'graphstyle.parent',
543 default=dynamicdefault,
543 default=dynamicdefault,
544 )
544 )
545 coreconfigitem('experimental', 'graphstyle.missing',
545 coreconfigitem('experimental', 'graphstyle.missing',
546 default=dynamicdefault,
546 default=dynamicdefault,
547 )
547 )
548 coreconfigitem('experimental', 'graphstyle.grandparent',
548 coreconfigitem('experimental', 'graphstyle.grandparent',
549 default=dynamicdefault,
549 default=dynamicdefault,
550 )
550 )
551 coreconfigitem('experimental', 'hook-track-tags',
551 coreconfigitem('experimental', 'hook-track-tags',
552 default=False,
552 default=False,
553 )
553 )
554 coreconfigitem('experimental', 'httppeer.advertise-v2',
554 coreconfigitem('experimental', 'httppeer.advertise-v2',
555 default=False,
555 default=False,
556 )
556 )
557 coreconfigitem('experimental', 'httppostargs',
557 coreconfigitem('experimental', 'httppostargs',
558 default=False,
558 default=False,
559 )
559 )
560 coreconfigitem('experimental', 'mergedriver',
560 coreconfigitem('experimental', 'mergedriver',
561 default=None,
561 default=None,
562 )
562 )
563 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
563 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
564 default=False,
564 default=False,
565 )
565 )
566 coreconfigitem('experimental', 'remotenames',
566 coreconfigitem('experimental', 'remotenames',
567 default=False,
567 default=False,
568 )
568 )
569 coreconfigitem('experimental', 'revlogv2',
569 coreconfigitem('experimental', 'revlogv2',
570 default=None,
570 default=None,
571 )
571 )
572 coreconfigitem('experimental', 'single-head-per-branch',
572 coreconfigitem('experimental', 'single-head-per-branch',
573 default=False,
573 default=False,
574 )
574 )
575 coreconfigitem('experimental', 'sshserver.support-v2',
575 coreconfigitem('experimental', 'sshserver.support-v2',
576 default=False,
576 default=False,
577 )
577 )
578 coreconfigitem('experimental', 'spacemovesdown',
578 coreconfigitem('experimental', 'spacemovesdown',
579 default=False,
579 default=False,
580 )
580 )
581 coreconfigitem('experimental', 'sparse-read',
581 coreconfigitem('experimental', 'sparse-read',
582 default=False,
582 default=False,
583 )
583 )
584 coreconfigitem('experimental', 'sparse-read.density-threshold',
584 coreconfigitem('experimental', 'sparse-read.density-threshold',
585 default=0.25,
585 default=0.25,
586 )
586 )
587 coreconfigitem('experimental', 'sparse-read.min-gap-size',
587 coreconfigitem('experimental', 'sparse-read.min-gap-size',
588 default='256K',
588 default='256K',
589 )
589 )
590 coreconfigitem('experimental', 'treemanifest',
590 coreconfigitem('experimental', 'treemanifest',
591 default=False,
591 default=False,
592 )
592 )
593 coreconfigitem('experimental', 'update.atomic-file',
593 coreconfigitem('experimental', 'update.atomic-file',
594 default=False,
594 default=False,
595 )
595 )
596 coreconfigitem('experimental', 'sshpeer.advertise-v2',
596 coreconfigitem('experimental', 'sshpeer.advertise-v2',
597 default=False,
597 default=False,
598 )
598 )
599 coreconfigitem('experimental', 'web.apiserver',
599 coreconfigitem('experimental', 'web.apiserver',
600 default=False,
600 default=False,
601 )
601 )
602 coreconfigitem('experimental', 'web.api.http-v2',
602 coreconfigitem('experimental', 'web.api.http-v2',
603 default=False,
603 default=False,
604 )
604 )
605 coreconfigitem('experimental', 'web.api.debugreflect',
605 coreconfigitem('experimental', 'web.api.debugreflect',
606 default=False,
606 default=False,
607 )
607 )
608 coreconfigitem('experimental', 'xdiff',
608 coreconfigitem('experimental', 'xdiff',
609 default=False,
609 default=False,
610 )
610 )
611 coreconfigitem('extensions', '.*',
611 coreconfigitem('extensions', '.*',
612 default=None,
612 default=None,
613 generic=True,
613 generic=True,
614 )
614 )
615 coreconfigitem('extdata', '.*',
615 coreconfigitem('extdata', '.*',
616 default=None,
616 default=None,
617 generic=True,
617 generic=True,
618 )
618 )
619 coreconfigitem('format', 'aggressivemergedeltas',
619 coreconfigitem('format', 'aggressivemergedeltas',
620 default=False,
620 default=False,
621 )
621 )
622 coreconfigitem('format', 'chunkcachesize',
622 coreconfigitem('format', 'chunkcachesize',
623 default=None,
623 default=None,
624 )
624 )
625 coreconfigitem('format', 'dotencode',
625 coreconfigitem('format', 'dotencode',
626 default=True,
626 default=True,
627 )
627 )
628 coreconfigitem('format', 'generaldelta',
628 coreconfigitem('format', 'generaldelta',
629 default=False,
629 default=False,
630 )
630 )
631 coreconfigitem('format', 'manifestcachesize',
631 coreconfigitem('format', 'manifestcachesize',
632 default=None,
632 default=None,
633 )
633 )
634 coreconfigitem('format', 'maxchainlen',
634 coreconfigitem('format', 'maxchainlen',
635 default=None,
635 default=None,
636 )
636 )
637 coreconfigitem('format', 'obsstore-version',
637 coreconfigitem('format', 'obsstore-version',
638 default=None,
638 default=None,
639 )
639 )
640 coreconfigitem('format', 'usefncache',
640 coreconfigitem('format', 'usefncache',
641 default=True,
641 default=True,
642 )
642 )
643 coreconfigitem('format', 'usegeneraldelta',
643 coreconfigitem('format', 'usegeneraldelta',
644 default=True,
644 default=True,
645 )
645 )
646 coreconfigitem('format', 'usestore',
646 coreconfigitem('format', 'usestore',
647 default=True,
647 default=True,
648 )
648 )
649 coreconfigitem('fsmonitor', 'warn_when_unused',
649 coreconfigitem('fsmonitor', 'warn_when_unused',
650 default=True,
650 default=True,
651 )
651 )
652 coreconfigitem('fsmonitor', 'warn_update_file_count',
652 coreconfigitem('fsmonitor', 'warn_update_file_count',
653 default=50000,
653 default=50000,
654 )
654 )
655 coreconfigitem('hooks', '.*',
655 coreconfigitem('hooks', '.*',
656 default=dynamicdefault,
656 default=dynamicdefault,
657 generic=True,
657 generic=True,
658 )
658 )
659 coreconfigitem('hgweb-paths', '.*',
659 coreconfigitem('hgweb-paths', '.*',
660 default=list,
660 default=list,
661 generic=True,
661 generic=True,
662 )
662 )
663 coreconfigitem('hostfingerprints', '.*',
663 coreconfigitem('hostfingerprints', '.*',
664 default=list,
664 default=list,
665 generic=True,
665 generic=True,
666 )
666 )
667 coreconfigitem('hostsecurity', 'ciphers',
667 coreconfigitem('hostsecurity', 'ciphers',
668 default=None,
668 default=None,
669 )
669 )
670 coreconfigitem('hostsecurity', 'disabletls10warning',
670 coreconfigitem('hostsecurity', 'disabletls10warning',
671 default=False,
671 default=False,
672 )
672 )
673 coreconfigitem('hostsecurity', 'minimumprotocol',
673 coreconfigitem('hostsecurity', 'minimumprotocol',
674 default=dynamicdefault,
674 default=dynamicdefault,
675 )
675 )
676 coreconfigitem('hostsecurity', '.*:minimumprotocol$',
676 coreconfigitem('hostsecurity', '.*:minimumprotocol$',
677 default=dynamicdefault,
677 default=dynamicdefault,
678 generic=True,
678 generic=True,
679 )
679 )
680 coreconfigitem('hostsecurity', '.*:ciphers$',
680 coreconfigitem('hostsecurity', '.*:ciphers$',
681 default=dynamicdefault,
681 default=dynamicdefault,
682 generic=True,
682 generic=True,
683 )
683 )
684 coreconfigitem('hostsecurity', '.*:fingerprints$',
684 coreconfigitem('hostsecurity', '.*:fingerprints$',
685 default=list,
685 default=list,
686 generic=True,
686 generic=True,
687 )
687 )
688 coreconfigitem('hostsecurity', '.*:verifycertsfile$',
688 coreconfigitem('hostsecurity', '.*:verifycertsfile$',
689 default=None,
689 default=None,
690 generic=True,
690 generic=True,
691 )
691 )
692
692
693 coreconfigitem('http_proxy', 'always',
693 coreconfigitem('http_proxy', 'always',
694 default=False,
694 default=False,
695 )
695 )
696 coreconfigitem('http_proxy', 'host',
696 coreconfigitem('http_proxy', 'host',
697 default=None,
697 default=None,
698 )
698 )
699 coreconfigitem('http_proxy', 'no',
699 coreconfigitem('http_proxy', 'no',
700 default=list,
700 default=list,
701 )
701 )
702 coreconfigitem('http_proxy', 'passwd',
702 coreconfigitem('http_proxy', 'passwd',
703 default=None,
703 default=None,
704 )
704 )
705 coreconfigitem('http_proxy', 'user',
705 coreconfigitem('http_proxy', 'user',
706 default=None,
706 default=None,
707 )
707 )
708 coreconfigitem('logtoprocess', 'commandexception',
708 coreconfigitem('logtoprocess', 'commandexception',
709 default=None,
709 default=None,
710 )
710 )
711 coreconfigitem('logtoprocess', 'commandfinish',
711 coreconfigitem('logtoprocess', 'commandfinish',
712 default=None,
712 default=None,
713 )
713 )
714 coreconfigitem('logtoprocess', 'command',
714 coreconfigitem('logtoprocess', 'command',
715 default=None,
715 default=None,
716 )
716 )
717 coreconfigitem('logtoprocess', 'develwarn',
717 coreconfigitem('logtoprocess', 'develwarn',
718 default=None,
718 default=None,
719 )
719 )
720 coreconfigitem('logtoprocess', 'uiblocked',
720 coreconfigitem('logtoprocess', 'uiblocked',
721 default=None,
721 default=None,
722 )
722 )
723 coreconfigitem('merge', 'checkunknown',
723 coreconfigitem('merge', 'checkunknown',
724 default='abort',
724 default='abort',
725 )
725 )
726 coreconfigitem('merge', 'checkignored',
726 coreconfigitem('merge', 'checkignored',
727 default='abort',
727 default='abort',
728 )
728 )
729 coreconfigitem('experimental', 'merge.checkpathconflicts',
729 coreconfigitem('experimental', 'merge.checkpathconflicts',
730 default=False,
730 default=False,
731 )
731 )
732 coreconfigitem('merge', 'followcopies',
732 coreconfigitem('merge', 'followcopies',
733 default=True,
733 default=True,
734 )
734 )
735 coreconfigitem('merge', 'on-failure',
735 coreconfigitem('merge', 'on-failure',
736 default='continue',
736 default='continue',
737 )
737 )
738 coreconfigitem('merge', 'preferancestor',
738 coreconfigitem('merge', 'preferancestor',
739 default=lambda: ['*'],
739 default=lambda: ['*'],
740 )
740 )
741 coreconfigitem('merge-tools', '.*',
741 coreconfigitem('merge-tools', '.*',
742 default=None,
742 default=None,
743 generic=True,
743 generic=True,
744 )
744 )
745 coreconfigitem('merge-tools', br'.*\.args$',
745 coreconfigitem('merge-tools', br'.*\.args$',
746 default="$local $base $other",
746 default="$local $base $other",
747 generic=True,
747 generic=True,
748 priority=-1,
748 priority=-1,
749 )
749 )
750 coreconfigitem('merge-tools', br'.*\.binary$',
750 coreconfigitem('merge-tools', br'.*\.binary$',
751 default=False,
751 default=False,
752 generic=True,
752 generic=True,
753 priority=-1,
753 priority=-1,
754 )
754 )
755 coreconfigitem('merge-tools', br'.*\.check$',
755 coreconfigitem('merge-tools', br'.*\.check$',
756 default=list,
756 default=list,
757 generic=True,
757 generic=True,
758 priority=-1,
758 priority=-1,
759 )
759 )
760 coreconfigitem('merge-tools', br'.*\.checkchanged$',
760 coreconfigitem('merge-tools', br'.*\.checkchanged$',
761 default=False,
761 default=False,
762 generic=True,
762 generic=True,
763 priority=-1,
763 priority=-1,
764 )
764 )
765 coreconfigitem('merge-tools', br'.*\.executable$',
765 coreconfigitem('merge-tools', br'.*\.executable$',
766 default=dynamicdefault,
766 default=dynamicdefault,
767 generic=True,
767 generic=True,
768 priority=-1,
768 priority=-1,
769 )
769 )
770 coreconfigitem('merge-tools', br'.*\.fixeol$',
770 coreconfigitem('merge-tools', br'.*\.fixeol$',
771 default=False,
771 default=False,
772 generic=True,
772 generic=True,
773 priority=-1,
773 priority=-1,
774 )
774 )
775 coreconfigitem('merge-tools', br'.*\.gui$',
775 coreconfigitem('merge-tools', br'.*\.gui$',
776 default=False,
776 default=False,
777 generic=True,
777 generic=True,
778 priority=-1,
778 priority=-1,
779 )
779 )
780 coreconfigitem('merge-tools', br'.*\.mergemarkers$',
780 coreconfigitem('merge-tools', br'.*\.mergemarkers$',
781 default='basic',
781 default='basic',
782 generic=True,
782 generic=True,
783 priority=-1,
783 priority=-1,
784 )
784 )
785 coreconfigitem('merge-tools', br'.*\.mergemarkertemplate$',
785 coreconfigitem('merge-tools', br'.*\.mergemarkertemplate$',
786 default=dynamicdefault, # take from ui.mergemarkertemplate
786 default=dynamicdefault, # take from ui.mergemarkertemplate
787 generic=True,
787 generic=True,
788 priority=-1,
788 priority=-1,
789 )
789 )
790 coreconfigitem('merge-tools', br'.*\.priority$',
790 coreconfigitem('merge-tools', br'.*\.priority$',
791 default=0,
791 default=0,
792 generic=True,
792 generic=True,
793 priority=-1,
793 priority=-1,
794 )
794 )
795 coreconfigitem('merge-tools', br'.*\.premerge$',
795 coreconfigitem('merge-tools', br'.*\.premerge$',
796 default=dynamicdefault,
796 default=dynamicdefault,
797 generic=True,
797 generic=True,
798 priority=-1,
798 priority=-1,
799 )
799 )
800 coreconfigitem('merge-tools', br'.*\.symlink$',
800 coreconfigitem('merge-tools', br'.*\.symlink$',
801 default=False,
801 default=False,
802 generic=True,
802 generic=True,
803 priority=-1,
803 priority=-1,
804 )
804 )
805 coreconfigitem('pager', 'attend-.*',
805 coreconfigitem('pager', 'attend-.*',
806 default=dynamicdefault,
806 default=dynamicdefault,
807 generic=True,
807 generic=True,
808 )
808 )
809 coreconfigitem('pager', 'ignore',
809 coreconfigitem('pager', 'ignore',
810 default=list,
810 default=list,
811 )
811 )
812 coreconfigitem('pager', 'pager',
812 coreconfigitem('pager', 'pager',
813 default=dynamicdefault,
813 default=dynamicdefault,
814 )
814 )
815 coreconfigitem('patch', 'eol',
815 coreconfigitem('patch', 'eol',
816 default='strict',
816 default='strict',
817 )
817 )
818 coreconfigitem('patch', 'fuzz',
818 coreconfigitem('patch', 'fuzz',
819 default=2,
819 default=2,
820 )
820 )
821 coreconfigitem('paths', 'default',
821 coreconfigitem('paths', 'default',
822 default=None,
822 default=None,
823 )
823 )
824 coreconfigitem('paths', 'default-push',
824 coreconfigitem('paths', 'default-push',
825 default=None,
825 default=None,
826 )
826 )
827 coreconfigitem('paths', '.*',
827 coreconfigitem('paths', '.*',
828 default=None,
828 default=None,
829 generic=True,
829 generic=True,
830 )
830 )
831 coreconfigitem('phases', 'checksubrepos',
831 coreconfigitem('phases', 'checksubrepos',
832 default='follow',
832 default='follow',
833 )
833 )
834 coreconfigitem('phases', 'new-commit',
834 coreconfigitem('phases', 'new-commit',
835 default='draft',
835 default='draft',
836 )
836 )
837 coreconfigitem('phases', 'publish',
837 coreconfigitem('phases', 'publish',
838 default=True,
838 default=True,
839 )
839 )
840 coreconfigitem('profiling', 'enabled',
840 coreconfigitem('profiling', 'enabled',
841 default=False,
841 default=False,
842 )
842 )
843 coreconfigitem('profiling', 'format',
843 coreconfigitem('profiling', 'format',
844 default='text',
844 default='text',
845 )
845 )
846 coreconfigitem('profiling', 'freq',
846 coreconfigitem('profiling', 'freq',
847 default=1000,
847 default=1000,
848 )
848 )
849 coreconfigitem('profiling', 'limit',
849 coreconfigitem('profiling', 'limit',
850 default=30,
850 default=30,
851 )
851 )
852 coreconfigitem('profiling', 'nested',
852 coreconfigitem('profiling', 'nested',
853 default=0,
853 default=0,
854 )
854 )
855 coreconfigitem('profiling', 'output',
855 coreconfigitem('profiling', 'output',
856 default=None,
856 default=None,
857 )
857 )
858 coreconfigitem('profiling', 'showmax',
858 coreconfigitem('profiling', 'showmax',
859 default=0.999,
859 default=0.999,
860 )
860 )
861 coreconfigitem('profiling', 'showmin',
861 coreconfigitem('profiling', 'showmin',
862 default=dynamicdefault,
862 default=dynamicdefault,
863 )
863 )
864 coreconfigitem('profiling', 'sort',
864 coreconfigitem('profiling', 'sort',
865 default='inlinetime',
865 default='inlinetime',
866 )
866 )
867 coreconfigitem('profiling', 'statformat',
867 coreconfigitem('profiling', 'statformat',
868 default='hotpath',
868 default='hotpath',
869 )
869 )
870 coreconfigitem('profiling', 'time-track',
871 default='cpu',
872 )
870 coreconfigitem('profiling', 'type',
873 coreconfigitem('profiling', 'type',
871 default='stat',
874 default='stat',
872 )
875 )
873 coreconfigitem('progress', 'assume-tty',
876 coreconfigitem('progress', 'assume-tty',
874 default=False,
877 default=False,
875 )
878 )
876 coreconfigitem('progress', 'changedelay',
879 coreconfigitem('progress', 'changedelay',
877 default=1,
880 default=1,
878 )
881 )
879 coreconfigitem('progress', 'clear-complete',
882 coreconfigitem('progress', 'clear-complete',
880 default=True,
883 default=True,
881 )
884 )
882 coreconfigitem('progress', 'debug',
885 coreconfigitem('progress', 'debug',
883 default=False,
886 default=False,
884 )
887 )
885 coreconfigitem('progress', 'delay',
888 coreconfigitem('progress', 'delay',
886 default=3,
889 default=3,
887 )
890 )
888 coreconfigitem('progress', 'disable',
891 coreconfigitem('progress', 'disable',
889 default=False,
892 default=False,
890 )
893 )
891 coreconfigitem('progress', 'estimateinterval',
894 coreconfigitem('progress', 'estimateinterval',
892 default=60.0,
895 default=60.0,
893 )
896 )
894 coreconfigitem('progress', 'format',
897 coreconfigitem('progress', 'format',
895 default=lambda: ['topic', 'bar', 'number', 'estimate'],
898 default=lambda: ['topic', 'bar', 'number', 'estimate'],
896 )
899 )
897 coreconfigitem('progress', 'refresh',
900 coreconfigitem('progress', 'refresh',
898 default=0.1,
901 default=0.1,
899 )
902 )
900 coreconfigitem('progress', 'width',
903 coreconfigitem('progress', 'width',
901 default=dynamicdefault,
904 default=dynamicdefault,
902 )
905 )
903 coreconfigitem('push', 'pushvars.server',
906 coreconfigitem('push', 'pushvars.server',
904 default=False,
907 default=False,
905 )
908 )
906 coreconfigitem('server', 'bookmarks-pushkey-compat',
909 coreconfigitem('server', 'bookmarks-pushkey-compat',
907 default=True,
910 default=True,
908 )
911 )
909 coreconfigitem('server', 'bundle1',
912 coreconfigitem('server', 'bundle1',
910 default=True,
913 default=True,
911 )
914 )
912 coreconfigitem('server', 'bundle1gd',
915 coreconfigitem('server', 'bundle1gd',
913 default=None,
916 default=None,
914 )
917 )
915 coreconfigitem('server', 'bundle1.pull',
918 coreconfigitem('server', 'bundle1.pull',
916 default=None,
919 default=None,
917 )
920 )
918 coreconfigitem('server', 'bundle1gd.pull',
921 coreconfigitem('server', 'bundle1gd.pull',
919 default=None,
922 default=None,
920 )
923 )
921 coreconfigitem('server', 'bundle1.push',
924 coreconfigitem('server', 'bundle1.push',
922 default=None,
925 default=None,
923 )
926 )
924 coreconfigitem('server', 'bundle1gd.push',
927 coreconfigitem('server', 'bundle1gd.push',
925 default=None,
928 default=None,
926 )
929 )
927 coreconfigitem('server', 'compressionengines',
930 coreconfigitem('server', 'compressionengines',
928 default=list,
931 default=list,
929 )
932 )
930 coreconfigitem('server', 'concurrent-push-mode',
933 coreconfigitem('server', 'concurrent-push-mode',
931 default='strict',
934 default='strict',
932 )
935 )
933 coreconfigitem('server', 'disablefullbundle',
936 coreconfigitem('server', 'disablefullbundle',
934 default=False,
937 default=False,
935 )
938 )
936 coreconfigitem('server', 'streamunbundle',
939 coreconfigitem('server', 'streamunbundle',
937 default=False,
940 default=False,
938 )
941 )
939 coreconfigitem('server', 'pullbundle',
942 coreconfigitem('server', 'pullbundle',
940 default=False,
943 default=False,
941 )
944 )
942 coreconfigitem('server', 'maxhttpheaderlen',
945 coreconfigitem('server', 'maxhttpheaderlen',
943 default=1024,
946 default=1024,
944 )
947 )
945 coreconfigitem('server', 'preferuncompressed',
948 coreconfigitem('server', 'preferuncompressed',
946 default=False,
949 default=False,
947 )
950 )
948 coreconfigitem('server', 'uncompressed',
951 coreconfigitem('server', 'uncompressed',
949 default=True,
952 default=True,
950 )
953 )
951 coreconfigitem('server', 'uncompressedallowsecret',
954 coreconfigitem('server', 'uncompressedallowsecret',
952 default=False,
955 default=False,
953 )
956 )
954 coreconfigitem('server', 'validate',
957 coreconfigitem('server', 'validate',
955 default=False,
958 default=False,
956 )
959 )
957 coreconfigitem('server', 'zliblevel',
960 coreconfigitem('server', 'zliblevel',
958 default=-1,
961 default=-1,
959 )
962 )
960 coreconfigitem('server', 'zstdlevel',
963 coreconfigitem('server', 'zstdlevel',
961 default=3,
964 default=3,
962 )
965 )
963 coreconfigitem('share', 'pool',
966 coreconfigitem('share', 'pool',
964 default=None,
967 default=None,
965 )
968 )
966 coreconfigitem('share', 'poolnaming',
969 coreconfigitem('share', 'poolnaming',
967 default='identity',
970 default='identity',
968 )
971 )
969 coreconfigitem('smtp', 'host',
972 coreconfigitem('smtp', 'host',
970 default=None,
973 default=None,
971 )
974 )
972 coreconfigitem('smtp', 'local_hostname',
975 coreconfigitem('smtp', 'local_hostname',
973 default=None,
976 default=None,
974 )
977 )
975 coreconfigitem('smtp', 'password',
978 coreconfigitem('smtp', 'password',
976 default=None,
979 default=None,
977 )
980 )
978 coreconfigitem('smtp', 'port',
981 coreconfigitem('smtp', 'port',
979 default=dynamicdefault,
982 default=dynamicdefault,
980 )
983 )
981 coreconfigitem('smtp', 'tls',
984 coreconfigitem('smtp', 'tls',
982 default='none',
985 default='none',
983 )
986 )
984 coreconfigitem('smtp', 'username',
987 coreconfigitem('smtp', 'username',
985 default=None,
988 default=None,
986 )
989 )
987 coreconfigitem('sparse', 'missingwarning',
990 coreconfigitem('sparse', 'missingwarning',
988 default=True,
991 default=True,
989 )
992 )
990 coreconfigitem('subrepos', 'allowed',
993 coreconfigitem('subrepos', 'allowed',
991 default=dynamicdefault, # to make backporting simpler
994 default=dynamicdefault, # to make backporting simpler
992 )
995 )
993 coreconfigitem('subrepos', 'hg:allowed',
996 coreconfigitem('subrepos', 'hg:allowed',
994 default=dynamicdefault,
997 default=dynamicdefault,
995 )
998 )
996 coreconfigitem('subrepos', 'git:allowed',
999 coreconfigitem('subrepos', 'git:allowed',
997 default=dynamicdefault,
1000 default=dynamicdefault,
998 )
1001 )
999 coreconfigitem('subrepos', 'svn:allowed',
1002 coreconfigitem('subrepos', 'svn:allowed',
1000 default=dynamicdefault,
1003 default=dynamicdefault,
1001 )
1004 )
1002 coreconfigitem('templates', '.*',
1005 coreconfigitem('templates', '.*',
1003 default=None,
1006 default=None,
1004 generic=True,
1007 generic=True,
1005 )
1008 )
1006 coreconfigitem('trusted', 'groups',
1009 coreconfigitem('trusted', 'groups',
1007 default=list,
1010 default=list,
1008 )
1011 )
1009 coreconfigitem('trusted', 'users',
1012 coreconfigitem('trusted', 'users',
1010 default=list,
1013 default=list,
1011 )
1014 )
1012 coreconfigitem('ui', '_usedassubrepo',
1015 coreconfigitem('ui', '_usedassubrepo',
1013 default=False,
1016 default=False,
1014 )
1017 )
1015 coreconfigitem('ui', 'allowemptycommit',
1018 coreconfigitem('ui', 'allowemptycommit',
1016 default=False,
1019 default=False,
1017 )
1020 )
1018 coreconfigitem('ui', 'archivemeta',
1021 coreconfigitem('ui', 'archivemeta',
1019 default=True,
1022 default=True,
1020 )
1023 )
1021 coreconfigitem('ui', 'askusername',
1024 coreconfigitem('ui', 'askusername',
1022 default=False,
1025 default=False,
1023 )
1026 )
1024 coreconfigitem('ui', 'clonebundlefallback',
1027 coreconfigitem('ui', 'clonebundlefallback',
1025 default=False,
1028 default=False,
1026 )
1029 )
1027 coreconfigitem('ui', 'clonebundleprefers',
1030 coreconfigitem('ui', 'clonebundleprefers',
1028 default=list,
1031 default=list,
1029 )
1032 )
1030 coreconfigitem('ui', 'clonebundles',
1033 coreconfigitem('ui', 'clonebundles',
1031 default=True,
1034 default=True,
1032 )
1035 )
1033 coreconfigitem('ui', 'color',
1036 coreconfigitem('ui', 'color',
1034 default='auto',
1037 default='auto',
1035 )
1038 )
1036 coreconfigitem('ui', 'commitsubrepos',
1039 coreconfigitem('ui', 'commitsubrepos',
1037 default=False,
1040 default=False,
1038 )
1041 )
1039 coreconfigitem('ui', 'debug',
1042 coreconfigitem('ui', 'debug',
1040 default=False,
1043 default=False,
1041 )
1044 )
1042 coreconfigitem('ui', 'debugger',
1045 coreconfigitem('ui', 'debugger',
1043 default=None,
1046 default=None,
1044 )
1047 )
1045 coreconfigitem('ui', 'editor',
1048 coreconfigitem('ui', 'editor',
1046 default=dynamicdefault,
1049 default=dynamicdefault,
1047 )
1050 )
1048 coreconfigitem('ui', 'fallbackencoding',
1051 coreconfigitem('ui', 'fallbackencoding',
1049 default=None,
1052 default=None,
1050 )
1053 )
1051 coreconfigitem('ui', 'forcecwd',
1054 coreconfigitem('ui', 'forcecwd',
1052 default=None,
1055 default=None,
1053 )
1056 )
1054 coreconfigitem('ui', 'forcemerge',
1057 coreconfigitem('ui', 'forcemerge',
1055 default=None,
1058 default=None,
1056 )
1059 )
1057 coreconfigitem('ui', 'formatdebug',
1060 coreconfigitem('ui', 'formatdebug',
1058 default=False,
1061 default=False,
1059 )
1062 )
1060 coreconfigitem('ui', 'formatjson',
1063 coreconfigitem('ui', 'formatjson',
1061 default=False,
1064 default=False,
1062 )
1065 )
1063 coreconfigitem('ui', 'formatted',
1066 coreconfigitem('ui', 'formatted',
1064 default=None,
1067 default=None,
1065 )
1068 )
1066 coreconfigitem('ui', 'graphnodetemplate',
1069 coreconfigitem('ui', 'graphnodetemplate',
1067 default=None,
1070 default=None,
1068 )
1071 )
1069 coreconfigitem('ui', 'interactive',
1072 coreconfigitem('ui', 'interactive',
1070 default=None,
1073 default=None,
1071 )
1074 )
1072 coreconfigitem('ui', 'interface',
1075 coreconfigitem('ui', 'interface',
1073 default=None,
1076 default=None,
1074 )
1077 )
1075 coreconfigitem('ui', 'interface.chunkselector',
1078 coreconfigitem('ui', 'interface.chunkselector',
1076 default=None,
1079 default=None,
1077 )
1080 )
1078 coreconfigitem('ui', 'logblockedtimes',
1081 coreconfigitem('ui', 'logblockedtimes',
1079 default=False,
1082 default=False,
1080 )
1083 )
1081 coreconfigitem('ui', 'logtemplate',
1084 coreconfigitem('ui', 'logtemplate',
1082 default=None,
1085 default=None,
1083 )
1086 )
1084 coreconfigitem('ui', 'merge',
1087 coreconfigitem('ui', 'merge',
1085 default=None,
1088 default=None,
1086 )
1089 )
1087 coreconfigitem('ui', 'mergemarkers',
1090 coreconfigitem('ui', 'mergemarkers',
1088 default='basic',
1091 default='basic',
1089 )
1092 )
1090 coreconfigitem('ui', 'mergemarkertemplate',
1093 coreconfigitem('ui', 'mergemarkertemplate',
1091 default=('{node|short} '
1094 default=('{node|short} '
1092 '{ifeq(tags, "tip", "", '
1095 '{ifeq(tags, "tip", "", '
1093 'ifeq(tags, "", "", "{tags} "))}'
1096 'ifeq(tags, "", "", "{tags} "))}'
1094 '{if(bookmarks, "{bookmarks} ")}'
1097 '{if(bookmarks, "{bookmarks} ")}'
1095 '{ifeq(branch, "default", "", "{branch} ")}'
1098 '{ifeq(branch, "default", "", "{branch} ")}'
1096 '- {author|user}: {desc|firstline}')
1099 '- {author|user}: {desc|firstline}')
1097 )
1100 )
1098 coreconfigitem('ui', 'nontty',
1101 coreconfigitem('ui', 'nontty',
1099 default=False,
1102 default=False,
1100 )
1103 )
1101 coreconfigitem('ui', 'origbackuppath',
1104 coreconfigitem('ui', 'origbackuppath',
1102 default=None,
1105 default=None,
1103 )
1106 )
1104 coreconfigitem('ui', 'paginate',
1107 coreconfigitem('ui', 'paginate',
1105 default=True,
1108 default=True,
1106 )
1109 )
1107 coreconfigitem('ui', 'patch',
1110 coreconfigitem('ui', 'patch',
1108 default=None,
1111 default=None,
1109 )
1112 )
1110 coreconfigitem('ui', 'portablefilenames',
1113 coreconfigitem('ui', 'portablefilenames',
1111 default='warn',
1114 default='warn',
1112 )
1115 )
1113 coreconfigitem('ui', 'promptecho',
1116 coreconfigitem('ui', 'promptecho',
1114 default=False,
1117 default=False,
1115 )
1118 )
1116 coreconfigitem('ui', 'quiet',
1119 coreconfigitem('ui', 'quiet',
1117 default=False,
1120 default=False,
1118 )
1121 )
1119 coreconfigitem('ui', 'quietbookmarkmove',
1122 coreconfigitem('ui', 'quietbookmarkmove',
1120 default=False,
1123 default=False,
1121 )
1124 )
1122 coreconfigitem('ui', 'remotecmd',
1125 coreconfigitem('ui', 'remotecmd',
1123 default='hg',
1126 default='hg',
1124 )
1127 )
1125 coreconfigitem('ui', 'report_untrusted',
1128 coreconfigitem('ui', 'report_untrusted',
1126 default=True,
1129 default=True,
1127 )
1130 )
1128 coreconfigitem('ui', 'rollback',
1131 coreconfigitem('ui', 'rollback',
1129 default=True,
1132 default=True,
1130 )
1133 )
1131 coreconfigitem('ui', 'signal-safe-lock',
1134 coreconfigitem('ui', 'signal-safe-lock',
1132 default=True,
1135 default=True,
1133 )
1136 )
1134 coreconfigitem('ui', 'slash',
1137 coreconfigitem('ui', 'slash',
1135 default=False,
1138 default=False,
1136 )
1139 )
1137 coreconfigitem('ui', 'ssh',
1140 coreconfigitem('ui', 'ssh',
1138 default='ssh',
1141 default='ssh',
1139 )
1142 )
1140 coreconfigitem('ui', 'ssherrorhint',
1143 coreconfigitem('ui', 'ssherrorhint',
1141 default=None,
1144 default=None,
1142 )
1145 )
1143 coreconfigitem('ui', 'statuscopies',
1146 coreconfigitem('ui', 'statuscopies',
1144 default=False,
1147 default=False,
1145 )
1148 )
1146 coreconfigitem('ui', 'strict',
1149 coreconfigitem('ui', 'strict',
1147 default=False,
1150 default=False,
1148 )
1151 )
1149 coreconfigitem('ui', 'style',
1152 coreconfigitem('ui', 'style',
1150 default='',
1153 default='',
1151 )
1154 )
1152 coreconfigitem('ui', 'supportcontact',
1155 coreconfigitem('ui', 'supportcontact',
1153 default=None,
1156 default=None,
1154 )
1157 )
1155 coreconfigitem('ui', 'textwidth',
1158 coreconfigitem('ui', 'textwidth',
1156 default=78,
1159 default=78,
1157 )
1160 )
1158 coreconfigitem('ui', 'timeout',
1161 coreconfigitem('ui', 'timeout',
1159 default='600',
1162 default='600',
1160 )
1163 )
1161 coreconfigitem('ui', 'timeout.warn',
1164 coreconfigitem('ui', 'timeout.warn',
1162 default=0,
1165 default=0,
1163 )
1166 )
1164 coreconfigitem('ui', 'traceback',
1167 coreconfigitem('ui', 'traceback',
1165 default=False,
1168 default=False,
1166 )
1169 )
1167 coreconfigitem('ui', 'tweakdefaults',
1170 coreconfigitem('ui', 'tweakdefaults',
1168 default=False,
1171 default=False,
1169 )
1172 )
1170 coreconfigitem('ui', 'username',
1173 coreconfigitem('ui', 'username',
1171 alias=[('ui', 'user')]
1174 alias=[('ui', 'user')]
1172 )
1175 )
1173 coreconfigitem('ui', 'verbose',
1176 coreconfigitem('ui', 'verbose',
1174 default=False,
1177 default=False,
1175 )
1178 )
1176 coreconfigitem('verify', 'skipflags',
1179 coreconfigitem('verify', 'skipflags',
1177 default=None,
1180 default=None,
1178 )
1181 )
1179 coreconfigitem('web', 'allowbz2',
1182 coreconfigitem('web', 'allowbz2',
1180 default=False,
1183 default=False,
1181 )
1184 )
1182 coreconfigitem('web', 'allowgz',
1185 coreconfigitem('web', 'allowgz',
1183 default=False,
1186 default=False,
1184 )
1187 )
1185 coreconfigitem('web', 'allow-pull',
1188 coreconfigitem('web', 'allow-pull',
1186 alias=[('web', 'allowpull')],
1189 alias=[('web', 'allowpull')],
1187 default=True,
1190 default=True,
1188 )
1191 )
1189 coreconfigitem('web', 'allow-push',
1192 coreconfigitem('web', 'allow-push',
1190 alias=[('web', 'allow_push')],
1193 alias=[('web', 'allow_push')],
1191 default=list,
1194 default=list,
1192 )
1195 )
1193 coreconfigitem('web', 'allowzip',
1196 coreconfigitem('web', 'allowzip',
1194 default=False,
1197 default=False,
1195 )
1198 )
1196 coreconfigitem('web', 'archivesubrepos',
1199 coreconfigitem('web', 'archivesubrepos',
1197 default=False,
1200 default=False,
1198 )
1201 )
1199 coreconfigitem('web', 'cache',
1202 coreconfigitem('web', 'cache',
1200 default=True,
1203 default=True,
1201 )
1204 )
1202 coreconfigitem('web', 'contact',
1205 coreconfigitem('web', 'contact',
1203 default=None,
1206 default=None,
1204 )
1207 )
1205 coreconfigitem('web', 'deny_push',
1208 coreconfigitem('web', 'deny_push',
1206 default=list,
1209 default=list,
1207 )
1210 )
1208 coreconfigitem('web', 'guessmime',
1211 coreconfigitem('web', 'guessmime',
1209 default=False,
1212 default=False,
1210 )
1213 )
1211 coreconfigitem('web', 'hidden',
1214 coreconfigitem('web', 'hidden',
1212 default=False,
1215 default=False,
1213 )
1216 )
1214 coreconfigitem('web', 'labels',
1217 coreconfigitem('web', 'labels',
1215 default=list,
1218 default=list,
1216 )
1219 )
1217 coreconfigitem('web', 'logoimg',
1220 coreconfigitem('web', 'logoimg',
1218 default='hglogo.png',
1221 default='hglogo.png',
1219 )
1222 )
1220 coreconfigitem('web', 'logourl',
1223 coreconfigitem('web', 'logourl',
1221 default='https://mercurial-scm.org/',
1224 default='https://mercurial-scm.org/',
1222 )
1225 )
1223 coreconfigitem('web', 'accesslog',
1226 coreconfigitem('web', 'accesslog',
1224 default='-',
1227 default='-',
1225 )
1228 )
1226 coreconfigitem('web', 'address',
1229 coreconfigitem('web', 'address',
1227 default='',
1230 default='',
1228 )
1231 )
1229 coreconfigitem('web', 'allow-archive',
1232 coreconfigitem('web', 'allow-archive',
1230 alias=[('web', 'allow_archive')],
1233 alias=[('web', 'allow_archive')],
1231 default=list,
1234 default=list,
1232 )
1235 )
1233 coreconfigitem('web', 'allow_read',
1236 coreconfigitem('web', 'allow_read',
1234 default=list,
1237 default=list,
1235 )
1238 )
1236 coreconfigitem('web', 'baseurl',
1239 coreconfigitem('web', 'baseurl',
1237 default=None,
1240 default=None,
1238 )
1241 )
1239 coreconfigitem('web', 'cacerts',
1242 coreconfigitem('web', 'cacerts',
1240 default=None,
1243 default=None,
1241 )
1244 )
1242 coreconfigitem('web', 'certificate',
1245 coreconfigitem('web', 'certificate',
1243 default=None,
1246 default=None,
1244 )
1247 )
1245 coreconfigitem('web', 'collapse',
1248 coreconfigitem('web', 'collapse',
1246 default=False,
1249 default=False,
1247 )
1250 )
1248 coreconfigitem('web', 'csp',
1251 coreconfigitem('web', 'csp',
1249 default=None,
1252 default=None,
1250 )
1253 )
1251 coreconfigitem('web', 'deny_read',
1254 coreconfigitem('web', 'deny_read',
1252 default=list,
1255 default=list,
1253 )
1256 )
1254 coreconfigitem('web', 'descend',
1257 coreconfigitem('web', 'descend',
1255 default=True,
1258 default=True,
1256 )
1259 )
1257 coreconfigitem('web', 'description',
1260 coreconfigitem('web', 'description',
1258 default="",
1261 default="",
1259 )
1262 )
1260 coreconfigitem('web', 'encoding',
1263 coreconfigitem('web', 'encoding',
1261 default=lambda: encoding.encoding,
1264 default=lambda: encoding.encoding,
1262 )
1265 )
1263 coreconfigitem('web', 'errorlog',
1266 coreconfigitem('web', 'errorlog',
1264 default='-',
1267 default='-',
1265 )
1268 )
1266 coreconfigitem('web', 'ipv6',
1269 coreconfigitem('web', 'ipv6',
1267 default=False,
1270 default=False,
1268 )
1271 )
1269 coreconfigitem('web', 'maxchanges',
1272 coreconfigitem('web', 'maxchanges',
1270 default=10,
1273 default=10,
1271 )
1274 )
1272 coreconfigitem('web', 'maxfiles',
1275 coreconfigitem('web', 'maxfiles',
1273 default=10,
1276 default=10,
1274 )
1277 )
1275 coreconfigitem('web', 'maxshortchanges',
1278 coreconfigitem('web', 'maxshortchanges',
1276 default=60,
1279 default=60,
1277 )
1280 )
1278 coreconfigitem('web', 'motd',
1281 coreconfigitem('web', 'motd',
1279 default='',
1282 default='',
1280 )
1283 )
1281 coreconfigitem('web', 'name',
1284 coreconfigitem('web', 'name',
1282 default=dynamicdefault,
1285 default=dynamicdefault,
1283 )
1286 )
1284 coreconfigitem('web', 'port',
1287 coreconfigitem('web', 'port',
1285 default=8000,
1288 default=8000,
1286 )
1289 )
1287 coreconfigitem('web', 'prefix',
1290 coreconfigitem('web', 'prefix',
1288 default='',
1291 default='',
1289 )
1292 )
1290 coreconfigitem('web', 'push_ssl',
1293 coreconfigitem('web', 'push_ssl',
1291 default=True,
1294 default=True,
1292 )
1295 )
1293 coreconfigitem('web', 'refreshinterval',
1296 coreconfigitem('web', 'refreshinterval',
1294 default=20,
1297 default=20,
1295 )
1298 )
1296 coreconfigitem('web', 'server-header',
1299 coreconfigitem('web', 'server-header',
1297 default=None,
1300 default=None,
1298 )
1301 )
1299 coreconfigitem('web', 'staticurl',
1302 coreconfigitem('web', 'staticurl',
1300 default=None,
1303 default=None,
1301 )
1304 )
1302 coreconfigitem('web', 'stripes',
1305 coreconfigitem('web', 'stripes',
1303 default=1,
1306 default=1,
1304 )
1307 )
1305 coreconfigitem('web', 'style',
1308 coreconfigitem('web', 'style',
1306 default='paper',
1309 default='paper',
1307 )
1310 )
1308 coreconfigitem('web', 'templates',
1311 coreconfigitem('web', 'templates',
1309 default=None,
1312 default=None,
1310 )
1313 )
1311 coreconfigitem('web', 'view',
1314 coreconfigitem('web', 'view',
1312 default='served',
1315 default='served',
1313 )
1316 )
1314 coreconfigitem('worker', 'backgroundclose',
1317 coreconfigitem('worker', 'backgroundclose',
1315 default=dynamicdefault,
1318 default=dynamicdefault,
1316 )
1319 )
1317 # Windows defaults to a limit of 512 open files. A buffer of 128
1320 # Windows defaults to a limit of 512 open files. A buffer of 128
1318 # should give us enough headway.
1321 # should give us enough headway.
1319 coreconfigitem('worker', 'backgroundclosemaxqueue',
1322 coreconfigitem('worker', 'backgroundclosemaxqueue',
1320 default=384,
1323 default=384,
1321 )
1324 )
1322 coreconfigitem('worker', 'backgroundcloseminfilecount',
1325 coreconfigitem('worker', 'backgroundcloseminfilecount',
1323 default=2048,
1326 default=2048,
1324 )
1327 )
1325 coreconfigitem('worker', 'backgroundclosethreadcount',
1328 coreconfigitem('worker', 'backgroundclosethreadcount',
1326 default=4,
1329 default=4,
1327 )
1330 )
1328 coreconfigitem('worker', 'enabled',
1331 coreconfigitem('worker', 'enabled',
1329 default=True,
1332 default=True,
1330 )
1333 )
1331 coreconfigitem('worker', 'numcpus',
1334 coreconfigitem('worker', 'numcpus',
1332 default=None,
1335 default=None,
1333 )
1336 )
1334
1337
1335 # Rebase related configuration moved to core because other extension are doing
1338 # Rebase related configuration moved to core because other extension are doing
1336 # strange things. For example, shelve import the extensions to reuse some bit
1339 # strange things. For example, shelve import the extensions to reuse some bit
1337 # without formally loading it.
1340 # without formally loading it.
1338 coreconfigitem('commands', 'rebase.requiredest',
1341 coreconfigitem('commands', 'rebase.requiredest',
1339 default=False,
1342 default=False,
1340 )
1343 )
1341 coreconfigitem('experimental', 'rebaseskipobsolete',
1344 coreconfigitem('experimental', 'rebaseskipobsolete',
1342 default=True,
1345 default=True,
1343 )
1346 )
1344 coreconfigitem('rebase', 'singletransaction',
1347 coreconfigitem('rebase', 'singletransaction',
1345 default=False,
1348 default=False,
1346 )
1349 )
1347 coreconfigitem('rebase', 'experimental.inmemory',
1350 coreconfigitem('rebase', 'experimental.inmemory',
1348 default=False,
1351 default=False,
1349 )
1352 )
@@ -1,2640 +1,2644
1 The Mercurial system uses a set of configuration files to control
1 The Mercurial system uses a set of configuration files to control
2 aspects of its behavior.
2 aspects of its behavior.
3
3
4 Troubleshooting
4 Troubleshooting
5 ===============
5 ===============
6
6
7 If you're having problems with your configuration,
7 If you're having problems with your configuration,
8 :hg:`config --debug` can help you understand what is introducing
8 :hg:`config --debug` can help you understand what is introducing
9 a setting into your environment.
9 a setting into your environment.
10
10
11 See :hg:`help config.syntax` and :hg:`help config.files`
11 See :hg:`help config.syntax` and :hg:`help config.files`
12 for information about how and where to override things.
12 for information about how and where to override things.
13
13
14 Structure
14 Structure
15 =========
15 =========
16
16
17 The configuration files use a simple ini-file format. A configuration
17 The configuration files use a simple ini-file format. A configuration
18 file consists of sections, led by a ``[section]`` header and followed
18 file consists of sections, led by a ``[section]`` header and followed
19 by ``name = value`` entries::
19 by ``name = value`` entries::
20
20
21 [ui]
21 [ui]
22 username = Firstname Lastname <firstname.lastname@example.net>
22 username = Firstname Lastname <firstname.lastname@example.net>
23 verbose = True
23 verbose = True
24
24
25 The above entries will be referred to as ``ui.username`` and
25 The above entries will be referred to as ``ui.username`` and
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
27
27
28 Files
28 Files
29 =====
29 =====
30
30
31 Mercurial reads configuration data from several files, if they exist.
31 Mercurial reads configuration data from several files, if they exist.
32 These files do not exist by default and you will have to create the
32 These files do not exist by default and you will have to create the
33 appropriate configuration files yourself:
33 appropriate configuration files yourself:
34
34
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
36
36
37 Global configuration like the username setting is typically put into:
37 Global configuration like the username setting is typically put into:
38
38
39 .. container:: windows
39 .. container:: windows
40
40
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
42
42
43 .. container:: unix.plan9
43 .. container:: unix.plan9
44
44
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
46
46
47 The names of these files depend on the system on which Mercurial is
47 The names of these files depend on the system on which Mercurial is
48 installed. ``*.rc`` files from a single directory are read in
48 installed. ``*.rc`` files from a single directory are read in
49 alphabetical order, later ones overriding earlier ones. Where multiple
49 alphabetical order, later ones overriding earlier ones. Where multiple
50 paths are given below, settings from earlier paths override later
50 paths are given below, settings from earlier paths override later
51 ones.
51 ones.
52
52
53 .. container:: verbose.unix
53 .. container:: verbose.unix
54
54
55 On Unix, the following files are consulted:
55 On Unix, the following files are consulted:
56
56
57 - ``<repo>/.hg/hgrc`` (per-repository)
57 - ``<repo>/.hg/hgrc`` (per-repository)
58 - ``$HOME/.hgrc`` (per-user)
58 - ``$HOME/.hgrc`` (per-user)
59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
62 - ``/etc/mercurial/hgrc`` (per-system)
62 - ``/etc/mercurial/hgrc`` (per-system)
63 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
63 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
64 - ``<internal>/default.d/*.rc`` (defaults)
64 - ``<internal>/default.d/*.rc`` (defaults)
65
65
66 .. container:: verbose.windows
66 .. container:: verbose.windows
67
67
68 On Windows, the following files are consulted:
68 On Windows, the following files are consulted:
69
69
70 - ``<repo>/.hg/hgrc`` (per-repository)
70 - ``<repo>/.hg/hgrc`` (per-repository)
71 - ``%USERPROFILE%\.hgrc`` (per-user)
71 - ``%USERPROFILE%\.hgrc`` (per-user)
72 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
72 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
73 - ``%HOME%\.hgrc`` (per-user)
73 - ``%HOME%\.hgrc`` (per-user)
74 - ``%HOME%\Mercurial.ini`` (per-user)
74 - ``%HOME%\Mercurial.ini`` (per-user)
75 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
75 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
76 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
76 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
77 - ``<install-dir>\Mercurial.ini`` (per-installation)
77 - ``<install-dir>\Mercurial.ini`` (per-installation)
78 - ``<internal>/default.d/*.rc`` (defaults)
78 - ``<internal>/default.d/*.rc`` (defaults)
79
79
80 .. note::
80 .. note::
81
81
82 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
82 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
83 is used when running 32-bit Python on 64-bit Windows.
83 is used when running 32-bit Python on 64-bit Windows.
84
84
85 .. container:: windows
85 .. container:: windows
86
86
87 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
87 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
88
88
89 .. container:: verbose.plan9
89 .. container:: verbose.plan9
90
90
91 On Plan9, the following files are consulted:
91 On Plan9, the following files are consulted:
92
92
93 - ``<repo>/.hg/hgrc`` (per-repository)
93 - ``<repo>/.hg/hgrc`` (per-repository)
94 - ``$home/lib/hgrc`` (per-user)
94 - ``$home/lib/hgrc`` (per-user)
95 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
95 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
96 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
96 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
97 - ``/lib/mercurial/hgrc`` (per-system)
97 - ``/lib/mercurial/hgrc`` (per-system)
98 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
98 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
99 - ``<internal>/default.d/*.rc`` (defaults)
99 - ``<internal>/default.d/*.rc`` (defaults)
100
100
101 Per-repository configuration options only apply in a
101 Per-repository configuration options only apply in a
102 particular repository. This file is not version-controlled, and
102 particular repository. This file is not version-controlled, and
103 will not get transferred during a "clone" operation. Options in
103 will not get transferred during a "clone" operation. Options in
104 this file override options in all other configuration files.
104 this file override options in all other configuration files.
105
105
106 .. container:: unix.plan9
106 .. container:: unix.plan9
107
107
108 On Plan 9 and Unix, most of this file will be ignored if it doesn't
108 On Plan 9 and Unix, most of this file will be ignored if it doesn't
109 belong to a trusted user or to a trusted group. See
109 belong to a trusted user or to a trusted group. See
110 :hg:`help config.trusted` for more details.
110 :hg:`help config.trusted` for more details.
111
111
112 Per-user configuration file(s) are for the user running Mercurial. Options
112 Per-user configuration file(s) are for the user running Mercurial. Options
113 in these files apply to all Mercurial commands executed by this user in any
113 in these files apply to all Mercurial commands executed by this user in any
114 directory. Options in these files override per-system and per-installation
114 directory. Options in these files override per-system and per-installation
115 options.
115 options.
116
116
117 Per-installation configuration files are searched for in the
117 Per-installation configuration files are searched for in the
118 directory where Mercurial is installed. ``<install-root>`` is the
118 directory where Mercurial is installed. ``<install-root>`` is the
119 parent directory of the **hg** executable (or symlink) being run.
119 parent directory of the **hg** executable (or symlink) being run.
120
120
121 .. container:: unix.plan9
121 .. container:: unix.plan9
122
122
123 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
123 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
124 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
124 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
125 files apply to all Mercurial commands executed by any user in any
125 files apply to all Mercurial commands executed by any user in any
126 directory.
126 directory.
127
127
128 Per-installation configuration files are for the system on
128 Per-installation configuration files are for the system on
129 which Mercurial is running. Options in these files apply to all
129 which Mercurial is running. Options in these files apply to all
130 Mercurial commands executed by any user in any directory. Registry
130 Mercurial commands executed by any user in any directory. Registry
131 keys contain PATH-like strings, every part of which must reference
131 keys contain PATH-like strings, every part of which must reference
132 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
132 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
133 be read. Mercurial checks each of these locations in the specified
133 be read. Mercurial checks each of these locations in the specified
134 order until one or more configuration files are detected.
134 order until one or more configuration files are detected.
135
135
136 Per-system configuration files are for the system on which Mercurial
136 Per-system configuration files are for the system on which Mercurial
137 is running. Options in these files apply to all Mercurial commands
137 is running. Options in these files apply to all Mercurial commands
138 executed by any user in any directory. Options in these files
138 executed by any user in any directory. Options in these files
139 override per-installation options.
139 override per-installation options.
140
140
141 Mercurial comes with some default configuration. The default configuration
141 Mercurial comes with some default configuration. The default configuration
142 files are installed with Mercurial and will be overwritten on upgrades. Default
142 files are installed with Mercurial and will be overwritten on upgrades. Default
143 configuration files should never be edited by users or administrators but can
143 configuration files should never be edited by users or administrators but can
144 be overridden in other configuration files. So far the directory only contains
144 be overridden in other configuration files. So far the directory only contains
145 merge tool configuration but packagers can also put other default configuration
145 merge tool configuration but packagers can also put other default configuration
146 there.
146 there.
147
147
148 Syntax
148 Syntax
149 ======
149 ======
150
150
151 A configuration file consists of sections, led by a ``[section]`` header
151 A configuration file consists of sections, led by a ``[section]`` header
152 and followed by ``name = value`` entries (sometimes called
152 and followed by ``name = value`` entries (sometimes called
153 ``configuration keys``)::
153 ``configuration keys``)::
154
154
155 [spam]
155 [spam]
156 eggs=ham
156 eggs=ham
157 green=
157 green=
158 eggs
158 eggs
159
159
160 Each line contains one entry. If the lines that follow are indented,
160 Each line contains one entry. If the lines that follow are indented,
161 they are treated as continuations of that entry. Leading whitespace is
161 they are treated as continuations of that entry. Leading whitespace is
162 removed from values. Empty lines are skipped. Lines beginning with
162 removed from values. Empty lines are skipped. Lines beginning with
163 ``#`` or ``;`` are ignored and may be used to provide comments.
163 ``#`` or ``;`` are ignored and may be used to provide comments.
164
164
165 Configuration keys can be set multiple times, in which case Mercurial
165 Configuration keys can be set multiple times, in which case Mercurial
166 will use the value that was configured last. As an example::
166 will use the value that was configured last. As an example::
167
167
168 [spam]
168 [spam]
169 eggs=large
169 eggs=large
170 ham=serrano
170 ham=serrano
171 eggs=small
171 eggs=small
172
172
173 This would set the configuration key named ``eggs`` to ``small``.
173 This would set the configuration key named ``eggs`` to ``small``.
174
174
175 It is also possible to define a section multiple times. A section can
175 It is also possible to define a section multiple times. A section can
176 be redefined on the same and/or on different configuration files. For
176 be redefined on the same and/or on different configuration files. For
177 example::
177 example::
178
178
179 [foo]
179 [foo]
180 eggs=large
180 eggs=large
181 ham=serrano
181 ham=serrano
182 eggs=small
182 eggs=small
183
183
184 [bar]
184 [bar]
185 eggs=ham
185 eggs=ham
186 green=
186 green=
187 eggs
187 eggs
188
188
189 [foo]
189 [foo]
190 ham=prosciutto
190 ham=prosciutto
191 eggs=medium
191 eggs=medium
192 bread=toasted
192 bread=toasted
193
193
194 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
194 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
195 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
195 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
196 respectively. As you can see there only thing that matters is the last
196 respectively. As you can see there only thing that matters is the last
197 value that was set for each of the configuration keys.
197 value that was set for each of the configuration keys.
198
198
199 If a configuration key is set multiple times in different
199 If a configuration key is set multiple times in different
200 configuration files the final value will depend on the order in which
200 configuration files the final value will depend on the order in which
201 the different configuration files are read, with settings from earlier
201 the different configuration files are read, with settings from earlier
202 paths overriding later ones as described on the ``Files`` section
202 paths overriding later ones as described on the ``Files`` section
203 above.
203 above.
204
204
205 A line of the form ``%include file`` will include ``file`` into the
205 A line of the form ``%include file`` will include ``file`` into the
206 current configuration file. The inclusion is recursive, which means
206 current configuration file. The inclusion is recursive, which means
207 that included files can include other files. Filenames are relative to
207 that included files can include other files. Filenames are relative to
208 the configuration file in which the ``%include`` directive is found.
208 the configuration file in which the ``%include`` directive is found.
209 Environment variables and ``~user`` constructs are expanded in
209 Environment variables and ``~user`` constructs are expanded in
210 ``file``. This lets you do something like::
210 ``file``. This lets you do something like::
211
211
212 %include ~/.hgrc.d/$HOST.rc
212 %include ~/.hgrc.d/$HOST.rc
213
213
214 to include a different configuration file on each computer you use.
214 to include a different configuration file on each computer you use.
215
215
216 A line with ``%unset name`` will remove ``name`` from the current
216 A line with ``%unset name`` will remove ``name`` from the current
217 section, if it has been set previously.
217 section, if it has been set previously.
218
218
219 The values are either free-form text strings, lists of text strings,
219 The values are either free-form text strings, lists of text strings,
220 or Boolean values. Boolean values can be set to true using any of "1",
220 or Boolean values. Boolean values can be set to true using any of "1",
221 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
221 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
222 (all case insensitive).
222 (all case insensitive).
223
223
224 List values are separated by whitespace or comma, except when values are
224 List values are separated by whitespace or comma, except when values are
225 placed in double quotation marks::
225 placed in double quotation marks::
226
226
227 allow_read = "John Doe, PhD", brian, betty
227 allow_read = "John Doe, PhD", brian, betty
228
228
229 Quotation marks can be escaped by prefixing them with a backslash. Only
229 Quotation marks can be escaped by prefixing them with a backslash. Only
230 quotation marks at the beginning of a word is counted as a quotation
230 quotation marks at the beginning of a word is counted as a quotation
231 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
231 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
232
232
233 Sections
233 Sections
234 ========
234 ========
235
235
236 This section describes the different sections that may appear in a
236 This section describes the different sections that may appear in a
237 Mercurial configuration file, the purpose of each section, its possible
237 Mercurial configuration file, the purpose of each section, its possible
238 keys, and their possible values.
238 keys, and their possible values.
239
239
240 ``alias``
240 ``alias``
241 ---------
241 ---------
242
242
243 Defines command aliases.
243 Defines command aliases.
244
244
245 Aliases allow you to define your own commands in terms of other
245 Aliases allow you to define your own commands in terms of other
246 commands (or aliases), optionally including arguments. Positional
246 commands (or aliases), optionally including arguments. Positional
247 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
247 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
248 are expanded by Mercurial before execution. Positional arguments not
248 are expanded by Mercurial before execution. Positional arguments not
249 already used by ``$N`` in the definition are put at the end of the
249 already used by ``$N`` in the definition are put at the end of the
250 command to be executed.
250 command to be executed.
251
251
252 Alias definitions consist of lines of the form::
252 Alias definitions consist of lines of the form::
253
253
254 <alias> = <command> [<argument>]...
254 <alias> = <command> [<argument>]...
255
255
256 For example, this definition::
256 For example, this definition::
257
257
258 latest = log --limit 5
258 latest = log --limit 5
259
259
260 creates a new command ``latest`` that shows only the five most recent
260 creates a new command ``latest`` that shows only the five most recent
261 changesets. You can define subsequent aliases using earlier ones::
261 changesets. You can define subsequent aliases using earlier ones::
262
262
263 stable5 = latest -b stable
263 stable5 = latest -b stable
264
264
265 .. note::
265 .. note::
266
266
267 It is possible to create aliases with the same names as
267 It is possible to create aliases with the same names as
268 existing commands, which will then override the original
268 existing commands, which will then override the original
269 definitions. This is almost always a bad idea!
269 definitions. This is almost always a bad idea!
270
270
271 An alias can start with an exclamation point (``!``) to make it a
271 An alias can start with an exclamation point (``!``) to make it a
272 shell alias. A shell alias is executed with the shell and will let you
272 shell alias. A shell alias is executed with the shell and will let you
273 run arbitrary commands. As an example, ::
273 run arbitrary commands. As an example, ::
274
274
275 echo = !echo $@
275 echo = !echo $@
276
276
277 will let you do ``hg echo foo`` to have ``foo`` printed in your
277 will let you do ``hg echo foo`` to have ``foo`` printed in your
278 terminal. A better example might be::
278 terminal. A better example might be::
279
279
280 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
280 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
281
281
282 which will make ``hg purge`` delete all unknown files in the
282 which will make ``hg purge`` delete all unknown files in the
283 repository in the same manner as the purge extension.
283 repository in the same manner as the purge extension.
284
284
285 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
285 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
286 expand to the command arguments. Unmatched arguments are
286 expand to the command arguments. Unmatched arguments are
287 removed. ``$0`` expands to the alias name and ``$@`` expands to all
287 removed. ``$0`` expands to the alias name and ``$@`` expands to all
288 arguments separated by a space. ``"$@"`` (with quotes) expands to all
288 arguments separated by a space. ``"$@"`` (with quotes) expands to all
289 arguments quoted individually and separated by a space. These expansions
289 arguments quoted individually and separated by a space. These expansions
290 happen before the command is passed to the shell.
290 happen before the command is passed to the shell.
291
291
292 Shell aliases are executed in an environment where ``$HG`` expands to
292 Shell aliases are executed in an environment where ``$HG`` expands to
293 the path of the Mercurial that was used to execute the alias. This is
293 the path of the Mercurial that was used to execute the alias. This is
294 useful when you want to call further Mercurial commands in a shell
294 useful when you want to call further Mercurial commands in a shell
295 alias, as was done above for the purge alias. In addition,
295 alias, as was done above for the purge alias. In addition,
296 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
296 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
297 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
297 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
298
298
299 .. note::
299 .. note::
300
300
301 Some global configuration options such as ``-R`` are
301 Some global configuration options such as ``-R`` are
302 processed before shell aliases and will thus not be passed to
302 processed before shell aliases and will thus not be passed to
303 aliases.
303 aliases.
304
304
305
305
306 ``annotate``
306 ``annotate``
307 ------------
307 ------------
308
308
309 Settings used when displaying file annotations. All values are
309 Settings used when displaying file annotations. All values are
310 Booleans and default to False. See :hg:`help config.diff` for
310 Booleans and default to False. See :hg:`help config.diff` for
311 related options for the diff command.
311 related options for the diff command.
312
312
313 ``ignorews``
313 ``ignorews``
314 Ignore white space when comparing lines.
314 Ignore white space when comparing lines.
315
315
316 ``ignorewseol``
316 ``ignorewseol``
317 Ignore white space at the end of a line when comparing lines.
317 Ignore white space at the end of a line when comparing lines.
318
318
319 ``ignorewsamount``
319 ``ignorewsamount``
320 Ignore changes in the amount of white space.
320 Ignore changes in the amount of white space.
321
321
322 ``ignoreblanklines``
322 ``ignoreblanklines``
323 Ignore changes whose lines are all blank.
323 Ignore changes whose lines are all blank.
324
324
325
325
326 ``auth``
326 ``auth``
327 --------
327 --------
328
328
329 Authentication credentials and other authentication-like configuration
329 Authentication credentials and other authentication-like configuration
330 for HTTP connections. This section allows you to store usernames and
330 for HTTP connections. This section allows you to store usernames and
331 passwords for use when logging *into* HTTP servers. See
331 passwords for use when logging *into* HTTP servers. See
332 :hg:`help config.web` if you want to configure *who* can login to
332 :hg:`help config.web` if you want to configure *who* can login to
333 your HTTP server.
333 your HTTP server.
334
334
335 The following options apply to all hosts.
335 The following options apply to all hosts.
336
336
337 ``cookiefile``
337 ``cookiefile``
338 Path to a file containing HTTP cookie lines. Cookies matching a
338 Path to a file containing HTTP cookie lines. Cookies matching a
339 host will be sent automatically.
339 host will be sent automatically.
340
340
341 The file format uses the Mozilla cookies.txt format, which defines cookies
341 The file format uses the Mozilla cookies.txt format, which defines cookies
342 on their own lines. Each line contains 7 fields delimited by the tab
342 on their own lines. Each line contains 7 fields delimited by the tab
343 character (domain, is_domain_cookie, path, is_secure, expires, name,
343 character (domain, is_domain_cookie, path, is_secure, expires, name,
344 value). For more info, do an Internet search for "Netscape cookies.txt
344 value). For more info, do an Internet search for "Netscape cookies.txt
345 format."
345 format."
346
346
347 Note: the cookies parser does not handle port numbers on domains. You
347 Note: the cookies parser does not handle port numbers on domains. You
348 will need to remove ports from the domain for the cookie to be recognized.
348 will need to remove ports from the domain for the cookie to be recognized.
349 This could result in a cookie being disclosed to an unwanted server.
349 This could result in a cookie being disclosed to an unwanted server.
350
350
351 The cookies file is read-only.
351 The cookies file is read-only.
352
352
353 Other options in this section are grouped by name and have the following
353 Other options in this section are grouped by name and have the following
354 format::
354 format::
355
355
356 <name>.<argument> = <value>
356 <name>.<argument> = <value>
357
357
358 where ``<name>`` is used to group arguments into authentication
358 where ``<name>`` is used to group arguments into authentication
359 entries. Example::
359 entries. Example::
360
360
361 foo.prefix = hg.intevation.de/mercurial
361 foo.prefix = hg.intevation.de/mercurial
362 foo.username = foo
362 foo.username = foo
363 foo.password = bar
363 foo.password = bar
364 foo.schemes = http https
364 foo.schemes = http https
365
365
366 bar.prefix = secure.example.org
366 bar.prefix = secure.example.org
367 bar.key = path/to/file.key
367 bar.key = path/to/file.key
368 bar.cert = path/to/file.cert
368 bar.cert = path/to/file.cert
369 bar.schemes = https
369 bar.schemes = https
370
370
371 Supported arguments:
371 Supported arguments:
372
372
373 ``prefix``
373 ``prefix``
374 Either ``*`` or a URI prefix with or without the scheme part.
374 Either ``*`` or a URI prefix with or without the scheme part.
375 The authentication entry with the longest matching prefix is used
375 The authentication entry with the longest matching prefix is used
376 (where ``*`` matches everything and counts as a match of length
376 (where ``*`` matches everything and counts as a match of length
377 1). If the prefix doesn't include a scheme, the match is performed
377 1). If the prefix doesn't include a scheme, the match is performed
378 against the URI with its scheme stripped as well, and the schemes
378 against the URI with its scheme stripped as well, and the schemes
379 argument, q.v., is then subsequently consulted.
379 argument, q.v., is then subsequently consulted.
380
380
381 ``username``
381 ``username``
382 Optional. Username to authenticate with. If not given, and the
382 Optional. Username to authenticate with. If not given, and the
383 remote site requires basic or digest authentication, the user will
383 remote site requires basic or digest authentication, the user will
384 be prompted for it. Environment variables are expanded in the
384 be prompted for it. Environment variables are expanded in the
385 username letting you do ``foo.username = $USER``. If the URI
385 username letting you do ``foo.username = $USER``. If the URI
386 includes a username, only ``[auth]`` entries with a matching
386 includes a username, only ``[auth]`` entries with a matching
387 username or without a username will be considered.
387 username or without a username will be considered.
388
388
389 ``password``
389 ``password``
390 Optional. Password to authenticate with. If not given, and the
390 Optional. Password to authenticate with. If not given, and the
391 remote site requires basic or digest authentication, the user
391 remote site requires basic or digest authentication, the user
392 will be prompted for it.
392 will be prompted for it.
393
393
394 ``key``
394 ``key``
395 Optional. PEM encoded client certificate key file. Environment
395 Optional. PEM encoded client certificate key file. Environment
396 variables are expanded in the filename.
396 variables are expanded in the filename.
397
397
398 ``cert``
398 ``cert``
399 Optional. PEM encoded client certificate chain file. Environment
399 Optional. PEM encoded client certificate chain file. Environment
400 variables are expanded in the filename.
400 variables are expanded in the filename.
401
401
402 ``schemes``
402 ``schemes``
403 Optional. Space separated list of URI schemes to use this
403 Optional. Space separated list of URI schemes to use this
404 authentication entry with. Only used if the prefix doesn't include
404 authentication entry with. Only used if the prefix doesn't include
405 a scheme. Supported schemes are http and https. They will match
405 a scheme. Supported schemes are http and https. They will match
406 static-http and static-https respectively, as well.
406 static-http and static-https respectively, as well.
407 (default: https)
407 (default: https)
408
408
409 If no suitable authentication entry is found, the user is prompted
409 If no suitable authentication entry is found, the user is prompted
410 for credentials as usual if required by the remote.
410 for credentials as usual if required by the remote.
411
411
412 ``color``
412 ``color``
413 ---------
413 ---------
414
414
415 Configure the Mercurial color mode. For details about how to define your custom
415 Configure the Mercurial color mode. For details about how to define your custom
416 effect and style see :hg:`help color`.
416 effect and style see :hg:`help color`.
417
417
418 ``mode``
418 ``mode``
419 String: control the method used to output color. One of ``auto``, ``ansi``,
419 String: control the method used to output color. One of ``auto``, ``ansi``,
420 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
420 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
421 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
421 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
422 terminal. Any invalid value will disable color.
422 terminal. Any invalid value will disable color.
423
423
424 ``pagermode``
424 ``pagermode``
425 String: optional override of ``color.mode`` used with pager.
425 String: optional override of ``color.mode`` used with pager.
426
426
427 On some systems, terminfo mode may cause problems when using
427 On some systems, terminfo mode may cause problems when using
428 color with ``less -R`` as a pager program. less with the -R option
428 color with ``less -R`` as a pager program. less with the -R option
429 will only display ECMA-48 color codes, and terminfo mode may sometimes
429 will only display ECMA-48 color codes, and terminfo mode may sometimes
430 emit codes that less doesn't understand. You can work around this by
430 emit codes that less doesn't understand. You can work around this by
431 either using ansi mode (or auto mode), or by using less -r (which will
431 either using ansi mode (or auto mode), or by using less -r (which will
432 pass through all terminal control codes, not just color control
432 pass through all terminal control codes, not just color control
433 codes).
433 codes).
434
434
435 On some systems (such as MSYS in Windows), the terminal may support
435 On some systems (such as MSYS in Windows), the terminal may support
436 a different color mode than the pager program.
436 a different color mode than the pager program.
437
437
438 ``commands``
438 ``commands``
439 ------------
439 ------------
440
440
441 ``status.relative``
441 ``status.relative``
442 Make paths in :hg:`status` output relative to the current directory.
442 Make paths in :hg:`status` output relative to the current directory.
443 (default: False)
443 (default: False)
444
444
445 ``status.terse``
445 ``status.terse``
446 Default value for the --terse flag, which condenes status output.
446 Default value for the --terse flag, which condenes status output.
447 (default: empty)
447 (default: empty)
448
448
449 ``update.check``
449 ``update.check``
450 Determines what level of checking :hg:`update` will perform before moving
450 Determines what level of checking :hg:`update` will perform before moving
451 to a destination revision. Valid values are ``abort``, ``none``,
451 to a destination revision. Valid values are ``abort``, ``none``,
452 ``linear``, and ``noconflict``. ``abort`` always fails if the working
452 ``linear``, and ``noconflict``. ``abort`` always fails if the working
453 directory has uncommitted changes. ``none`` performs no checking, and may
453 directory has uncommitted changes. ``none`` performs no checking, and may
454 result in a merge with uncommitted changes. ``linear`` allows any update
454 result in a merge with uncommitted changes. ``linear`` allows any update
455 as long as it follows a straight line in the revision history, and may
455 as long as it follows a straight line in the revision history, and may
456 trigger a merge with uncommitted changes. ``noconflict`` will allow any
456 trigger a merge with uncommitted changes. ``noconflict`` will allow any
457 update which would not trigger a merge with uncommitted changes, if any
457 update which would not trigger a merge with uncommitted changes, if any
458 are present.
458 are present.
459 (default: ``linear``)
459 (default: ``linear``)
460
460
461 ``update.requiredest``
461 ``update.requiredest``
462 Require that the user pass a destination when running :hg:`update`.
462 Require that the user pass a destination when running :hg:`update`.
463 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
463 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
464 will be disallowed.
464 will be disallowed.
465 (default: False)
465 (default: False)
466
466
467 ``committemplate``
467 ``committemplate``
468 ------------------
468 ------------------
469
469
470 ``changeset``
470 ``changeset``
471 String: configuration in this section is used as the template to
471 String: configuration in this section is used as the template to
472 customize the text shown in the editor when committing.
472 customize the text shown in the editor when committing.
473
473
474 In addition to pre-defined template keywords, commit log specific one
474 In addition to pre-defined template keywords, commit log specific one
475 below can be used for customization:
475 below can be used for customization:
476
476
477 ``extramsg``
477 ``extramsg``
478 String: Extra message (typically 'Leave message empty to abort
478 String: Extra message (typically 'Leave message empty to abort
479 commit.'). This may be changed by some commands or extensions.
479 commit.'). This may be changed by some commands or extensions.
480
480
481 For example, the template configuration below shows as same text as
481 For example, the template configuration below shows as same text as
482 one shown by default::
482 one shown by default::
483
483
484 [committemplate]
484 [committemplate]
485 changeset = {desc}\n\n
485 changeset = {desc}\n\n
486 HG: Enter commit message. Lines beginning with 'HG:' are removed.
486 HG: Enter commit message. Lines beginning with 'HG:' are removed.
487 HG: {extramsg}
487 HG: {extramsg}
488 HG: --
488 HG: --
489 HG: user: {author}\n{ifeq(p2rev, "-1", "",
489 HG: user: {author}\n{ifeq(p2rev, "-1", "",
490 "HG: branch merge\n")
490 "HG: branch merge\n")
491 }HG: branch '{branch}'\n{if(activebookmark,
491 }HG: branch '{branch}'\n{if(activebookmark,
492 "HG: bookmark '{activebookmark}'\n") }{subrepos %
492 "HG: bookmark '{activebookmark}'\n") }{subrepos %
493 "HG: subrepo {subrepo}\n" }{file_adds %
493 "HG: subrepo {subrepo}\n" }{file_adds %
494 "HG: added {file}\n" }{file_mods %
494 "HG: added {file}\n" }{file_mods %
495 "HG: changed {file}\n" }{file_dels %
495 "HG: changed {file}\n" }{file_dels %
496 "HG: removed {file}\n" }{if(files, "",
496 "HG: removed {file}\n" }{if(files, "",
497 "HG: no files changed\n")}
497 "HG: no files changed\n")}
498
498
499 ``diff()``
499 ``diff()``
500 String: show the diff (see :hg:`help templates` for detail)
500 String: show the diff (see :hg:`help templates` for detail)
501
501
502 Sometimes it is helpful to show the diff of the changeset in the editor without
502 Sometimes it is helpful to show the diff of the changeset in the editor without
503 having to prefix 'HG: ' to each line so that highlighting works correctly. For
503 having to prefix 'HG: ' to each line so that highlighting works correctly. For
504 this, Mercurial provides a special string which will ignore everything below
504 this, Mercurial provides a special string which will ignore everything below
505 it::
505 it::
506
506
507 HG: ------------------------ >8 ------------------------
507 HG: ------------------------ >8 ------------------------
508
508
509 For example, the template configuration below will show the diff below the
509 For example, the template configuration below will show the diff below the
510 extra message::
510 extra message::
511
511
512 [committemplate]
512 [committemplate]
513 changeset = {desc}\n\n
513 changeset = {desc}\n\n
514 HG: Enter commit message. Lines beginning with 'HG:' are removed.
514 HG: Enter commit message. Lines beginning with 'HG:' are removed.
515 HG: {extramsg}
515 HG: {extramsg}
516 HG: ------------------------ >8 ------------------------
516 HG: ------------------------ >8 ------------------------
517 HG: Do not touch the line above.
517 HG: Do not touch the line above.
518 HG: Everything below will be removed.
518 HG: Everything below will be removed.
519 {diff()}
519 {diff()}
520
520
521 .. note::
521 .. note::
522
522
523 For some problematic encodings (see :hg:`help win32mbcs` for
523 For some problematic encodings (see :hg:`help win32mbcs` for
524 detail), this customization should be configured carefully, to
524 detail), this customization should be configured carefully, to
525 avoid showing broken characters.
525 avoid showing broken characters.
526
526
527 For example, if a multibyte character ending with backslash (0x5c) is
527 For example, if a multibyte character ending with backslash (0x5c) is
528 followed by the ASCII character 'n' in the customized template,
528 followed by the ASCII character 'n' in the customized template,
529 the sequence of backslash and 'n' is treated as line-feed unexpectedly
529 the sequence of backslash and 'n' is treated as line-feed unexpectedly
530 (and the multibyte character is broken, too).
530 (and the multibyte character is broken, too).
531
531
532 Customized template is used for commands below (``--edit`` may be
532 Customized template is used for commands below (``--edit`` may be
533 required):
533 required):
534
534
535 - :hg:`backout`
535 - :hg:`backout`
536 - :hg:`commit`
536 - :hg:`commit`
537 - :hg:`fetch` (for merge commit only)
537 - :hg:`fetch` (for merge commit only)
538 - :hg:`graft`
538 - :hg:`graft`
539 - :hg:`histedit`
539 - :hg:`histedit`
540 - :hg:`import`
540 - :hg:`import`
541 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
541 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
542 - :hg:`rebase`
542 - :hg:`rebase`
543 - :hg:`shelve`
543 - :hg:`shelve`
544 - :hg:`sign`
544 - :hg:`sign`
545 - :hg:`tag`
545 - :hg:`tag`
546 - :hg:`transplant`
546 - :hg:`transplant`
547
547
548 Configuring items below instead of ``changeset`` allows showing
548 Configuring items below instead of ``changeset`` allows showing
549 customized message only for specific actions, or showing different
549 customized message only for specific actions, or showing different
550 messages for each action.
550 messages for each action.
551
551
552 - ``changeset.backout`` for :hg:`backout`
552 - ``changeset.backout`` for :hg:`backout`
553 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
553 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
554 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
554 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
555 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
555 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
556 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
556 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
557 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
557 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
558 - ``changeset.gpg.sign`` for :hg:`sign`
558 - ``changeset.gpg.sign`` for :hg:`sign`
559 - ``changeset.graft`` for :hg:`graft`
559 - ``changeset.graft`` for :hg:`graft`
560 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
560 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
561 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
561 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
562 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
562 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
563 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
563 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
564 - ``changeset.import.bypass`` for :hg:`import --bypass`
564 - ``changeset.import.bypass`` for :hg:`import --bypass`
565 - ``changeset.import.normal.merge`` for :hg:`import` on merges
565 - ``changeset.import.normal.merge`` for :hg:`import` on merges
566 - ``changeset.import.normal.normal`` for :hg:`import` on other
566 - ``changeset.import.normal.normal`` for :hg:`import` on other
567 - ``changeset.mq.qnew`` for :hg:`qnew`
567 - ``changeset.mq.qnew`` for :hg:`qnew`
568 - ``changeset.mq.qfold`` for :hg:`qfold`
568 - ``changeset.mq.qfold`` for :hg:`qfold`
569 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
569 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
570 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
570 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
571 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
571 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
572 - ``changeset.rebase.normal`` for :hg:`rebase` on other
572 - ``changeset.rebase.normal`` for :hg:`rebase` on other
573 - ``changeset.shelve.shelve`` for :hg:`shelve`
573 - ``changeset.shelve.shelve`` for :hg:`shelve`
574 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
574 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
575 - ``changeset.tag.remove`` for :hg:`tag --remove`
575 - ``changeset.tag.remove`` for :hg:`tag --remove`
576 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
576 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
577 - ``changeset.transplant.normal`` for :hg:`transplant` on other
577 - ``changeset.transplant.normal`` for :hg:`transplant` on other
578
578
579 These dot-separated lists of names are treated as hierarchical ones.
579 These dot-separated lists of names are treated as hierarchical ones.
580 For example, ``changeset.tag.remove`` customizes the commit message
580 For example, ``changeset.tag.remove`` customizes the commit message
581 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
581 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
582 commit message for :hg:`tag` regardless of ``--remove`` option.
582 commit message for :hg:`tag` regardless of ``--remove`` option.
583
583
584 When the external editor is invoked for a commit, the corresponding
584 When the external editor is invoked for a commit, the corresponding
585 dot-separated list of names without the ``changeset.`` prefix
585 dot-separated list of names without the ``changeset.`` prefix
586 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
586 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
587 variable.
587 variable.
588
588
589 In this section, items other than ``changeset`` can be referred from
589 In this section, items other than ``changeset`` can be referred from
590 others. For example, the configuration to list committed files up
590 others. For example, the configuration to list committed files up
591 below can be referred as ``{listupfiles}``::
591 below can be referred as ``{listupfiles}``::
592
592
593 [committemplate]
593 [committemplate]
594 listupfiles = {file_adds %
594 listupfiles = {file_adds %
595 "HG: added {file}\n" }{file_mods %
595 "HG: added {file}\n" }{file_mods %
596 "HG: changed {file}\n" }{file_dels %
596 "HG: changed {file}\n" }{file_dels %
597 "HG: removed {file}\n" }{if(files, "",
597 "HG: removed {file}\n" }{if(files, "",
598 "HG: no files changed\n")}
598 "HG: no files changed\n")}
599
599
600 ``decode/encode``
600 ``decode/encode``
601 -----------------
601 -----------------
602
602
603 Filters for transforming files on checkout/checkin. This would
603 Filters for transforming files on checkout/checkin. This would
604 typically be used for newline processing or other
604 typically be used for newline processing or other
605 localization/canonicalization of files.
605 localization/canonicalization of files.
606
606
607 Filters consist of a filter pattern followed by a filter command.
607 Filters consist of a filter pattern followed by a filter command.
608 Filter patterns are globs by default, rooted at the repository root.
608 Filter patterns are globs by default, rooted at the repository root.
609 For example, to match any file ending in ``.txt`` in the root
609 For example, to match any file ending in ``.txt`` in the root
610 directory only, use the pattern ``*.txt``. To match any file ending
610 directory only, use the pattern ``*.txt``. To match any file ending
611 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
611 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
612 For each file only the first matching filter applies.
612 For each file only the first matching filter applies.
613
613
614 The filter command can start with a specifier, either ``pipe:`` or
614 The filter command can start with a specifier, either ``pipe:`` or
615 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
615 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
616
616
617 A ``pipe:`` command must accept data on stdin and return the transformed
617 A ``pipe:`` command must accept data on stdin and return the transformed
618 data on stdout.
618 data on stdout.
619
619
620 Pipe example::
620 Pipe example::
621
621
622 [encode]
622 [encode]
623 # uncompress gzip files on checkin to improve delta compression
623 # uncompress gzip files on checkin to improve delta compression
624 # note: not necessarily a good idea, just an example
624 # note: not necessarily a good idea, just an example
625 *.gz = pipe: gunzip
625 *.gz = pipe: gunzip
626
626
627 [decode]
627 [decode]
628 # recompress gzip files when writing them to the working dir (we
628 # recompress gzip files when writing them to the working dir (we
629 # can safely omit "pipe:", because it's the default)
629 # can safely omit "pipe:", because it's the default)
630 *.gz = gzip
630 *.gz = gzip
631
631
632 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
632 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
633 with the name of a temporary file that contains the data to be
633 with the name of a temporary file that contains the data to be
634 filtered by the command. The string ``OUTFILE`` is replaced with the name
634 filtered by the command. The string ``OUTFILE`` is replaced with the name
635 of an empty temporary file, where the filtered data must be written by
635 of an empty temporary file, where the filtered data must be written by
636 the command.
636 the command.
637
637
638 .. container:: windows
638 .. container:: windows
639
639
640 .. note::
640 .. note::
641
641
642 The tempfile mechanism is recommended for Windows systems,
642 The tempfile mechanism is recommended for Windows systems,
643 where the standard shell I/O redirection operators often have
643 where the standard shell I/O redirection operators often have
644 strange effects and may corrupt the contents of your files.
644 strange effects and may corrupt the contents of your files.
645
645
646 This filter mechanism is used internally by the ``eol`` extension to
646 This filter mechanism is used internally by the ``eol`` extension to
647 translate line ending characters between Windows (CRLF) and Unix (LF)
647 translate line ending characters between Windows (CRLF) and Unix (LF)
648 format. We suggest you use the ``eol`` extension for convenience.
648 format. We suggest you use the ``eol`` extension for convenience.
649
649
650
650
651 ``defaults``
651 ``defaults``
652 ------------
652 ------------
653
653
654 (defaults are deprecated. Don't use them. Use aliases instead.)
654 (defaults are deprecated. Don't use them. Use aliases instead.)
655
655
656 Use the ``[defaults]`` section to define command defaults, i.e. the
656 Use the ``[defaults]`` section to define command defaults, i.e. the
657 default options/arguments to pass to the specified commands.
657 default options/arguments to pass to the specified commands.
658
658
659 The following example makes :hg:`log` run in verbose mode, and
659 The following example makes :hg:`log` run in verbose mode, and
660 :hg:`status` show only the modified files, by default::
660 :hg:`status` show only the modified files, by default::
661
661
662 [defaults]
662 [defaults]
663 log = -v
663 log = -v
664 status = -m
664 status = -m
665
665
666 The actual commands, instead of their aliases, must be used when
666 The actual commands, instead of their aliases, must be used when
667 defining command defaults. The command defaults will also be applied
667 defining command defaults. The command defaults will also be applied
668 to the aliases of the commands defined.
668 to the aliases of the commands defined.
669
669
670
670
671 ``diff``
671 ``diff``
672 --------
672 --------
673
673
674 Settings used when displaying diffs. Everything except for ``unified``
674 Settings used when displaying diffs. Everything except for ``unified``
675 is a Boolean and defaults to False. See :hg:`help config.annotate`
675 is a Boolean and defaults to False. See :hg:`help config.annotate`
676 for related options for the annotate command.
676 for related options for the annotate command.
677
677
678 ``git``
678 ``git``
679 Use git extended diff format.
679 Use git extended diff format.
680
680
681 ``nobinary``
681 ``nobinary``
682 Omit git binary patches.
682 Omit git binary patches.
683
683
684 ``nodates``
684 ``nodates``
685 Don't include dates in diff headers.
685 Don't include dates in diff headers.
686
686
687 ``noprefix``
687 ``noprefix``
688 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
688 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
689
689
690 ``showfunc``
690 ``showfunc``
691 Show which function each change is in.
691 Show which function each change is in.
692
692
693 ``ignorews``
693 ``ignorews``
694 Ignore white space when comparing lines.
694 Ignore white space when comparing lines.
695
695
696 ``ignorewsamount``
696 ``ignorewsamount``
697 Ignore changes in the amount of white space.
697 Ignore changes in the amount of white space.
698
698
699 ``ignoreblanklines``
699 ``ignoreblanklines``
700 Ignore changes whose lines are all blank.
700 Ignore changes whose lines are all blank.
701
701
702 ``unified``
702 ``unified``
703 Number of lines of context to show.
703 Number of lines of context to show.
704
704
705 ``email``
705 ``email``
706 ---------
706 ---------
707
707
708 Settings for extensions that send email messages.
708 Settings for extensions that send email messages.
709
709
710 ``from``
710 ``from``
711 Optional. Email address to use in "From" header and SMTP envelope
711 Optional. Email address to use in "From" header and SMTP envelope
712 of outgoing messages.
712 of outgoing messages.
713
713
714 ``to``
714 ``to``
715 Optional. Comma-separated list of recipients' email addresses.
715 Optional. Comma-separated list of recipients' email addresses.
716
716
717 ``cc``
717 ``cc``
718 Optional. Comma-separated list of carbon copy recipients'
718 Optional. Comma-separated list of carbon copy recipients'
719 email addresses.
719 email addresses.
720
720
721 ``bcc``
721 ``bcc``
722 Optional. Comma-separated list of blind carbon copy recipients'
722 Optional. Comma-separated list of blind carbon copy recipients'
723 email addresses.
723 email addresses.
724
724
725 ``method``
725 ``method``
726 Optional. Method to use to send email messages. If value is ``smtp``
726 Optional. Method to use to send email messages. If value is ``smtp``
727 (default), use SMTP (see the ``[smtp]`` section for configuration).
727 (default), use SMTP (see the ``[smtp]`` section for configuration).
728 Otherwise, use as name of program to run that acts like sendmail
728 Otherwise, use as name of program to run that acts like sendmail
729 (takes ``-f`` option for sender, list of recipients on command line,
729 (takes ``-f`` option for sender, list of recipients on command line,
730 message on stdin). Normally, setting this to ``sendmail`` or
730 message on stdin). Normally, setting this to ``sendmail`` or
731 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
731 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
732
732
733 ``charsets``
733 ``charsets``
734 Optional. Comma-separated list of character sets considered
734 Optional. Comma-separated list of character sets considered
735 convenient for recipients. Addresses, headers, and parts not
735 convenient for recipients. Addresses, headers, and parts not
736 containing patches of outgoing messages will be encoded in the
736 containing patches of outgoing messages will be encoded in the
737 first character set to which conversion from local encoding
737 first character set to which conversion from local encoding
738 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
738 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
739 conversion fails, the text in question is sent as is.
739 conversion fails, the text in question is sent as is.
740 (default: '')
740 (default: '')
741
741
742 Order of outgoing email character sets:
742 Order of outgoing email character sets:
743
743
744 1. ``us-ascii``: always first, regardless of settings
744 1. ``us-ascii``: always first, regardless of settings
745 2. ``email.charsets``: in order given by user
745 2. ``email.charsets``: in order given by user
746 3. ``ui.fallbackencoding``: if not in email.charsets
746 3. ``ui.fallbackencoding``: if not in email.charsets
747 4. ``$HGENCODING``: if not in email.charsets
747 4. ``$HGENCODING``: if not in email.charsets
748 5. ``utf-8``: always last, regardless of settings
748 5. ``utf-8``: always last, regardless of settings
749
749
750 Email example::
750 Email example::
751
751
752 [email]
752 [email]
753 from = Joseph User <joe.user@example.com>
753 from = Joseph User <joe.user@example.com>
754 method = /usr/sbin/sendmail
754 method = /usr/sbin/sendmail
755 # charsets for western Europeans
755 # charsets for western Europeans
756 # us-ascii, utf-8 omitted, as they are tried first and last
756 # us-ascii, utf-8 omitted, as they are tried first and last
757 charsets = iso-8859-1, iso-8859-15, windows-1252
757 charsets = iso-8859-1, iso-8859-15, windows-1252
758
758
759
759
760 ``extensions``
760 ``extensions``
761 --------------
761 --------------
762
762
763 Mercurial has an extension mechanism for adding new features. To
763 Mercurial has an extension mechanism for adding new features. To
764 enable an extension, create an entry for it in this section.
764 enable an extension, create an entry for it in this section.
765
765
766 If you know that the extension is already in Python's search path,
766 If you know that the extension is already in Python's search path,
767 you can give the name of the module, followed by ``=``, with nothing
767 you can give the name of the module, followed by ``=``, with nothing
768 after the ``=``.
768 after the ``=``.
769
769
770 Otherwise, give a name that you choose, followed by ``=``, followed by
770 Otherwise, give a name that you choose, followed by ``=``, followed by
771 the path to the ``.py`` file (including the file name extension) that
771 the path to the ``.py`` file (including the file name extension) that
772 defines the extension.
772 defines the extension.
773
773
774 To explicitly disable an extension that is enabled in an hgrc of
774 To explicitly disable an extension that is enabled in an hgrc of
775 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
775 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
776 or ``foo = !`` when path is not supplied.
776 or ``foo = !`` when path is not supplied.
777
777
778 Example for ``~/.hgrc``::
778 Example for ``~/.hgrc``::
779
779
780 [extensions]
780 [extensions]
781 # (the churn extension will get loaded from Mercurial's path)
781 # (the churn extension will get loaded from Mercurial's path)
782 churn =
782 churn =
783 # (this extension will get loaded from the file specified)
783 # (this extension will get loaded from the file specified)
784 myfeature = ~/.hgext/myfeature.py
784 myfeature = ~/.hgext/myfeature.py
785
785
786
786
787 ``format``
787 ``format``
788 ----------
788 ----------
789
789
790 ``usegeneraldelta``
790 ``usegeneraldelta``
791 Enable or disable the "generaldelta" repository format which improves
791 Enable or disable the "generaldelta" repository format which improves
792 repository compression by allowing "revlog" to store delta against arbitrary
792 repository compression by allowing "revlog" to store delta against arbitrary
793 revision instead of the previous stored one. This provides significant
793 revision instead of the previous stored one. This provides significant
794 improvement for repositories with branches.
794 improvement for repositories with branches.
795
795
796 Repositories with this on-disk format require Mercurial version 1.9.
796 Repositories with this on-disk format require Mercurial version 1.9.
797
797
798 Enabled by default.
798 Enabled by default.
799
799
800 ``dotencode``
800 ``dotencode``
801 Enable or disable the "dotencode" repository format which enhances
801 Enable or disable the "dotencode" repository format which enhances
802 the "fncache" repository format (which has to be enabled to use
802 the "fncache" repository format (which has to be enabled to use
803 dotencode) to avoid issues with filenames starting with ._ on
803 dotencode) to avoid issues with filenames starting with ._ on
804 Mac OS X and spaces on Windows.
804 Mac OS X and spaces on Windows.
805
805
806 Repositories with this on-disk format require Mercurial version 1.7.
806 Repositories with this on-disk format require Mercurial version 1.7.
807
807
808 Enabled by default.
808 Enabled by default.
809
809
810 ``usefncache``
810 ``usefncache``
811 Enable or disable the "fncache" repository format which enhances
811 Enable or disable the "fncache" repository format which enhances
812 the "store" repository format (which has to be enabled to use
812 the "store" repository format (which has to be enabled to use
813 fncache) to allow longer filenames and avoids using Windows
813 fncache) to allow longer filenames and avoids using Windows
814 reserved names, e.g. "nul".
814 reserved names, e.g. "nul".
815
815
816 Repositories with this on-disk format require Mercurial version 1.1.
816 Repositories with this on-disk format require Mercurial version 1.1.
817
817
818 Enabled by default.
818 Enabled by default.
819
819
820 ``usestore``
820 ``usestore``
821 Enable or disable the "store" repository format which improves
821 Enable or disable the "store" repository format which improves
822 compatibility with systems that fold case or otherwise mangle
822 compatibility with systems that fold case or otherwise mangle
823 filenames. Disabling this option will allow you to store longer filenames
823 filenames. Disabling this option will allow you to store longer filenames
824 in some situations at the expense of compatibility.
824 in some situations at the expense of compatibility.
825
825
826 Repositories with this on-disk format require Mercurial version 0.9.4.
826 Repositories with this on-disk format require Mercurial version 0.9.4.
827
827
828 Enabled by default.
828 Enabled by default.
829
829
830 ``graph``
830 ``graph``
831 ---------
831 ---------
832
832
833 Web graph view configuration. This section let you change graph
833 Web graph view configuration. This section let you change graph
834 elements display properties by branches, for instance to make the
834 elements display properties by branches, for instance to make the
835 ``default`` branch stand out.
835 ``default`` branch stand out.
836
836
837 Each line has the following format::
837 Each line has the following format::
838
838
839 <branch>.<argument> = <value>
839 <branch>.<argument> = <value>
840
840
841 where ``<branch>`` is the name of the branch being
841 where ``<branch>`` is the name of the branch being
842 customized. Example::
842 customized. Example::
843
843
844 [graph]
844 [graph]
845 # 2px width
845 # 2px width
846 default.width = 2
846 default.width = 2
847 # red color
847 # red color
848 default.color = FF0000
848 default.color = FF0000
849
849
850 Supported arguments:
850 Supported arguments:
851
851
852 ``width``
852 ``width``
853 Set branch edges width in pixels.
853 Set branch edges width in pixels.
854
854
855 ``color``
855 ``color``
856 Set branch edges color in hexadecimal RGB notation.
856 Set branch edges color in hexadecimal RGB notation.
857
857
858 ``hooks``
858 ``hooks``
859 ---------
859 ---------
860
860
861 Commands or Python functions that get automatically executed by
861 Commands or Python functions that get automatically executed by
862 various actions such as starting or finishing a commit. Multiple
862 various actions such as starting or finishing a commit. Multiple
863 hooks can be run for the same action by appending a suffix to the
863 hooks can be run for the same action by appending a suffix to the
864 action. Overriding a site-wide hook can be done by changing its
864 action. Overriding a site-wide hook can be done by changing its
865 value or setting it to an empty string. Hooks can be prioritized
865 value or setting it to an empty string. Hooks can be prioritized
866 by adding a prefix of ``priority.`` to the hook name on a new line
866 by adding a prefix of ``priority.`` to the hook name on a new line
867 and setting the priority. The default priority is 0.
867 and setting the priority. The default priority is 0.
868
868
869 Example ``.hg/hgrc``::
869 Example ``.hg/hgrc``::
870
870
871 [hooks]
871 [hooks]
872 # update working directory after adding changesets
872 # update working directory after adding changesets
873 changegroup.update = hg update
873 changegroup.update = hg update
874 # do not use the site-wide hook
874 # do not use the site-wide hook
875 incoming =
875 incoming =
876 incoming.email = /my/email/hook
876 incoming.email = /my/email/hook
877 incoming.autobuild = /my/build/hook
877 incoming.autobuild = /my/build/hook
878 # force autobuild hook to run before other incoming hooks
878 # force autobuild hook to run before other incoming hooks
879 priority.incoming.autobuild = 1
879 priority.incoming.autobuild = 1
880
880
881 Most hooks are run with environment variables set that give useful
881 Most hooks are run with environment variables set that give useful
882 additional information. For each hook below, the environment variables
882 additional information. For each hook below, the environment variables
883 it is passed are listed with names in the form ``$HG_foo``. The
883 it is passed are listed with names in the form ``$HG_foo``. The
884 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
884 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
885 They contain the type of hook which triggered the run and the full name
885 They contain the type of hook which triggered the run and the full name
886 of the hook in the config, respectively. In the example above, this will
886 of the hook in the config, respectively. In the example above, this will
887 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
887 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
888
888
889 ``changegroup``
889 ``changegroup``
890 Run after a changegroup has been added via push, pull or unbundle. The ID of
890 Run after a changegroup has been added via push, pull or unbundle. The ID of
891 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
891 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
892 The URL from which changes came is in ``$HG_URL``.
892 The URL from which changes came is in ``$HG_URL``.
893
893
894 ``commit``
894 ``commit``
895 Run after a changeset has been created in the local repository. The ID
895 Run after a changeset has been created in the local repository. The ID
896 of the newly created changeset is in ``$HG_NODE``. Parent changeset
896 of the newly created changeset is in ``$HG_NODE``. Parent changeset
897 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
897 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
898
898
899 ``incoming``
899 ``incoming``
900 Run after a changeset has been pulled, pushed, or unbundled into
900 Run after a changeset has been pulled, pushed, or unbundled into
901 the local repository. The ID of the newly arrived changeset is in
901 the local repository. The ID of the newly arrived changeset is in
902 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
902 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
903
903
904 ``outgoing``
904 ``outgoing``
905 Run after sending changes from the local repository to another. The ID of
905 Run after sending changes from the local repository to another. The ID of
906 first changeset sent is in ``$HG_NODE``. The source of operation is in
906 first changeset sent is in ``$HG_NODE``. The source of operation is in
907 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
907 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
908
908
909 ``post-<command>``
909 ``post-<command>``
910 Run after successful invocations of the associated command. The
910 Run after successful invocations of the associated command. The
911 contents of the command line are passed as ``$HG_ARGS`` and the result
911 contents of the command line are passed as ``$HG_ARGS`` and the result
912 code in ``$HG_RESULT``. Parsed command line arguments are passed as
912 code in ``$HG_RESULT``. Parsed command line arguments are passed as
913 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
913 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
914 the python data internally passed to <command>. ``$HG_OPTS`` is a
914 the python data internally passed to <command>. ``$HG_OPTS`` is a
915 dictionary of options (with unspecified options set to their defaults).
915 dictionary of options (with unspecified options set to their defaults).
916 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
916 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
917
917
918 ``fail-<command>``
918 ``fail-<command>``
919 Run after a failed invocation of an associated command. The contents
919 Run after a failed invocation of an associated command. The contents
920 of the command line are passed as ``$HG_ARGS``. Parsed command line
920 of the command line are passed as ``$HG_ARGS``. Parsed command line
921 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
921 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
922 string representations of the python data internally passed to
922 string representations of the python data internally passed to
923 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
923 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
924 options set to their defaults). ``$HG_PATS`` is a list of arguments.
924 options set to their defaults). ``$HG_PATS`` is a list of arguments.
925 Hook failure is ignored.
925 Hook failure is ignored.
926
926
927 ``pre-<command>``
927 ``pre-<command>``
928 Run before executing the associated command. The contents of the
928 Run before executing the associated command. The contents of the
929 command line are passed as ``$HG_ARGS``. Parsed command line arguments
929 command line are passed as ``$HG_ARGS``. Parsed command line arguments
930 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
930 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
931 representations of the data internally passed to <command>. ``$HG_OPTS``
931 representations of the data internally passed to <command>. ``$HG_OPTS``
932 is a dictionary of options (with unspecified options set to their
932 is a dictionary of options (with unspecified options set to their
933 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
933 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
934 failure, the command doesn't execute and Mercurial returns the failure
934 failure, the command doesn't execute and Mercurial returns the failure
935 code.
935 code.
936
936
937 ``prechangegroup``
937 ``prechangegroup``
938 Run before a changegroup is added via push, pull or unbundle. Exit
938 Run before a changegroup is added via push, pull or unbundle. Exit
939 status 0 allows the changegroup to proceed. A non-zero status will
939 status 0 allows the changegroup to proceed. A non-zero status will
940 cause the push, pull or unbundle to fail. The URL from which changes
940 cause the push, pull or unbundle to fail. The URL from which changes
941 will come is in ``$HG_URL``.
941 will come is in ``$HG_URL``.
942
942
943 ``precommit``
943 ``precommit``
944 Run before starting a local commit. Exit status 0 allows the
944 Run before starting a local commit. Exit status 0 allows the
945 commit to proceed. A non-zero status will cause the commit to fail.
945 commit to proceed. A non-zero status will cause the commit to fail.
946 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
946 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
947
947
948 ``prelistkeys``
948 ``prelistkeys``
949 Run before listing pushkeys (like bookmarks) in the
949 Run before listing pushkeys (like bookmarks) in the
950 repository. A non-zero status will cause failure. The key namespace is
950 repository. A non-zero status will cause failure. The key namespace is
951 in ``$HG_NAMESPACE``.
951 in ``$HG_NAMESPACE``.
952
952
953 ``preoutgoing``
953 ``preoutgoing``
954 Run before collecting changes to send from the local repository to
954 Run before collecting changes to send from the local repository to
955 another. A non-zero status will cause failure. This lets you prevent
955 another. A non-zero status will cause failure. This lets you prevent
956 pull over HTTP or SSH. It can also prevent propagating commits (via
956 pull over HTTP or SSH. It can also prevent propagating commits (via
957 local pull, push (outbound) or bundle commands), but not completely,
957 local pull, push (outbound) or bundle commands), but not completely,
958 since you can just copy files instead. The source of operation is in
958 since you can just copy files instead. The source of operation is in
959 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
959 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
960 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
960 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
961 is happening on behalf of a repository on same system.
961 is happening on behalf of a repository on same system.
962
962
963 ``prepushkey``
963 ``prepushkey``
964 Run before a pushkey (like a bookmark) is added to the
964 Run before a pushkey (like a bookmark) is added to the
965 repository. A non-zero status will cause the key to be rejected. The
965 repository. A non-zero status will cause the key to be rejected. The
966 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
966 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
967 the old value (if any) is in ``$HG_OLD``, and the new value is in
967 the old value (if any) is in ``$HG_OLD``, and the new value is in
968 ``$HG_NEW``.
968 ``$HG_NEW``.
969
969
970 ``pretag``
970 ``pretag``
971 Run before creating a tag. Exit status 0 allows the tag to be
971 Run before creating a tag. Exit status 0 allows the tag to be
972 created. A non-zero status will cause the tag to fail. The ID of the
972 created. A non-zero status will cause the tag to fail. The ID of the
973 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
973 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
974 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
974 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
975
975
976 ``pretxnopen``
976 ``pretxnopen``
977 Run before any new repository transaction is open. The reason for the
977 Run before any new repository transaction is open. The reason for the
978 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
978 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
979 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
979 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
980 transaction from being opened.
980 transaction from being opened.
981
981
982 ``pretxnclose``
982 ``pretxnclose``
983 Run right before the transaction is actually finalized. Any repository change
983 Run right before the transaction is actually finalized. Any repository change
984 will be visible to the hook program. This lets you validate the transaction
984 will be visible to the hook program. This lets you validate the transaction
985 content or change it. Exit status 0 allows the commit to proceed. A non-zero
985 content or change it. Exit status 0 allows the commit to proceed. A non-zero
986 status will cause the transaction to be rolled back. The reason for the
986 status will cause the transaction to be rolled back. The reason for the
987 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
987 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
988 the transaction will be in ``HG_TXNID``. The rest of the available data will
988 the transaction will be in ``HG_TXNID``. The rest of the available data will
989 vary according the transaction type. New changesets will add ``$HG_NODE``
989 vary according the transaction type. New changesets will add ``$HG_NODE``
990 (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
990 (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
991 added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
991 added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
992 phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
992 phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
993 respectively, etc.
993 respectively, etc.
994
994
995 ``pretxnclose-bookmark``
995 ``pretxnclose-bookmark``
996 Run right before a bookmark change is actually finalized. Any repository
996 Run right before a bookmark change is actually finalized. Any repository
997 change will be visible to the hook program. This lets you validate the
997 change will be visible to the hook program. This lets you validate the
998 transaction content or change it. Exit status 0 allows the commit to
998 transaction content or change it. Exit status 0 allows the commit to
999 proceed. A non-zero status will cause the transaction to be rolled back.
999 proceed. A non-zero status will cause the transaction to be rolled back.
1000 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1000 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1001 bookmark location will be available in ``$HG_NODE`` while the previous
1001 bookmark location will be available in ``$HG_NODE`` while the previous
1002 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1002 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1003 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1003 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1004 will be empty.
1004 will be empty.
1005 In addition, the reason for the transaction opening will be in
1005 In addition, the reason for the transaction opening will be in
1006 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1006 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1007 ``HG_TXNID``.
1007 ``HG_TXNID``.
1008
1008
1009 ``pretxnclose-phase``
1009 ``pretxnclose-phase``
1010 Run right before a phase change is actually finalized. Any repository change
1010 Run right before a phase change is actually finalized. Any repository change
1011 will be visible to the hook program. This lets you validate the transaction
1011 will be visible to the hook program. This lets you validate the transaction
1012 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1012 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1013 status will cause the transaction to be rolled back. The hook is called
1013 status will cause the transaction to be rolled back. The hook is called
1014 multiple times, once for each revision affected by a phase change.
1014 multiple times, once for each revision affected by a phase change.
1015 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1015 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1016 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1016 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1017 will be empty. In addition, the reason for the transaction opening will be in
1017 will be empty. In addition, the reason for the transaction opening will be in
1018 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1018 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1019 ``HG_TXNID``. The hook is also run for newly added revisions. In this case
1019 ``HG_TXNID``. The hook is also run for newly added revisions. In this case
1020 the ``$HG_OLDPHASE`` entry will be empty.
1020 the ``$HG_OLDPHASE`` entry will be empty.
1021
1021
1022 ``txnclose``
1022 ``txnclose``
1023 Run after any repository transaction has been committed. At this
1023 Run after any repository transaction has been committed. At this
1024 point, the transaction can no longer be rolled back. The hook will run
1024 point, the transaction can no longer be rolled back. The hook will run
1025 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1025 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1026 details about available variables.
1026 details about available variables.
1027
1027
1028 ``txnclose-bookmark``
1028 ``txnclose-bookmark``
1029 Run after any bookmark change has been committed. At this point, the
1029 Run after any bookmark change has been committed. At this point, the
1030 transaction can no longer be rolled back. The hook will run after the lock
1030 transaction can no longer be rolled back. The hook will run after the lock
1031 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1031 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1032 about available variables.
1032 about available variables.
1033
1033
1034 ``txnclose-phase``
1034 ``txnclose-phase``
1035 Run after any phase change has been committed. At this point, the
1035 Run after any phase change has been committed. At this point, the
1036 transaction can no longer be rolled back. The hook will run after the lock
1036 transaction can no longer be rolled back. The hook will run after the lock
1037 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1037 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1038 available variables.
1038 available variables.
1039
1039
1040 ``txnabort``
1040 ``txnabort``
1041 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1041 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1042 for details about available variables.
1042 for details about available variables.
1043
1043
1044 ``pretxnchangegroup``
1044 ``pretxnchangegroup``
1045 Run after a changegroup has been added via push, pull or unbundle, but before
1045 Run after a changegroup has been added via push, pull or unbundle, but before
1046 the transaction has been committed. The changegroup is visible to the hook
1046 the transaction has been committed. The changegroup is visible to the hook
1047 program. This allows validation of incoming changes before accepting them.
1047 program. This allows validation of incoming changes before accepting them.
1048 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1048 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1049 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1049 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1050 status will cause the transaction to be rolled back, and the push, pull or
1050 status will cause the transaction to be rolled back, and the push, pull or
1051 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1051 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1052
1052
1053 ``pretxncommit``
1053 ``pretxncommit``
1054 Run after a changeset has been created, but before the transaction is
1054 Run after a changeset has been created, but before the transaction is
1055 committed. The changeset is visible to the hook program. This allows
1055 committed. The changeset is visible to the hook program. This allows
1056 validation of the commit message and changes. Exit status 0 allows the
1056 validation of the commit message and changes. Exit status 0 allows the
1057 commit to proceed. A non-zero status will cause the transaction to
1057 commit to proceed. A non-zero status will cause the transaction to
1058 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1058 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1059 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1059 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1060
1060
1061 ``preupdate``
1061 ``preupdate``
1062 Run before updating the working directory. Exit status 0 allows
1062 Run before updating the working directory. Exit status 0 allows
1063 the update to proceed. A non-zero status will prevent the update.
1063 the update to proceed. A non-zero status will prevent the update.
1064 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1064 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1065 merge, the ID of second new parent is in ``$HG_PARENT2``.
1065 merge, the ID of second new parent is in ``$HG_PARENT2``.
1066
1066
1067 ``listkeys``
1067 ``listkeys``
1068 Run after listing pushkeys (like bookmarks) in the repository. The
1068 Run after listing pushkeys (like bookmarks) in the repository. The
1069 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1069 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1070 dictionary containing the keys and values.
1070 dictionary containing the keys and values.
1071
1071
1072 ``pushkey``
1072 ``pushkey``
1073 Run after a pushkey (like a bookmark) is added to the
1073 Run after a pushkey (like a bookmark) is added to the
1074 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1074 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1075 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1075 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1076 value is in ``$HG_NEW``.
1076 value is in ``$HG_NEW``.
1077
1077
1078 ``tag``
1078 ``tag``
1079 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1079 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1080 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1080 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1081 the repository if ``$HG_LOCAL=0``.
1081 the repository if ``$HG_LOCAL=0``.
1082
1082
1083 ``update``
1083 ``update``
1084 Run after updating the working directory. The changeset ID of first
1084 Run after updating the working directory. The changeset ID of first
1085 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1085 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1086 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1086 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1087 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1087 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1088
1088
1089 .. note::
1089 .. note::
1090
1090
1091 It is generally better to use standard hooks rather than the
1091 It is generally better to use standard hooks rather than the
1092 generic pre- and post- command hooks, as they are guaranteed to be
1092 generic pre- and post- command hooks, as they are guaranteed to be
1093 called in the appropriate contexts for influencing transactions.
1093 called in the appropriate contexts for influencing transactions.
1094 Also, hooks like "commit" will be called in all contexts that
1094 Also, hooks like "commit" will be called in all contexts that
1095 generate a commit (e.g. tag) and not just the commit command.
1095 generate a commit (e.g. tag) and not just the commit command.
1096
1096
1097 .. note::
1097 .. note::
1098
1098
1099 Environment variables with empty values may not be passed to
1099 Environment variables with empty values may not be passed to
1100 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1100 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1101 will have an empty value under Unix-like platforms for non-merge
1101 will have an empty value under Unix-like platforms for non-merge
1102 changesets, while it will not be available at all under Windows.
1102 changesets, while it will not be available at all under Windows.
1103
1103
1104 The syntax for Python hooks is as follows::
1104 The syntax for Python hooks is as follows::
1105
1105
1106 hookname = python:modulename.submodule.callable
1106 hookname = python:modulename.submodule.callable
1107 hookname = python:/path/to/python/module.py:callable
1107 hookname = python:/path/to/python/module.py:callable
1108
1108
1109 Python hooks are run within the Mercurial process. Each hook is
1109 Python hooks are run within the Mercurial process. Each hook is
1110 called with at least three keyword arguments: a ui object (keyword
1110 called with at least three keyword arguments: a ui object (keyword
1111 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1111 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1112 keyword that tells what kind of hook is used. Arguments listed as
1112 keyword that tells what kind of hook is used. Arguments listed as
1113 environment variables above are passed as keyword arguments, with no
1113 environment variables above are passed as keyword arguments, with no
1114 ``HG_`` prefix, and names in lower case.
1114 ``HG_`` prefix, and names in lower case.
1115
1115
1116 If a Python hook returns a "true" value or raises an exception, this
1116 If a Python hook returns a "true" value or raises an exception, this
1117 is treated as a failure.
1117 is treated as a failure.
1118
1118
1119
1119
1120 ``hostfingerprints``
1120 ``hostfingerprints``
1121 --------------------
1121 --------------------
1122
1122
1123 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1123 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1124
1124
1125 Fingerprints of the certificates of known HTTPS servers.
1125 Fingerprints of the certificates of known HTTPS servers.
1126
1126
1127 A HTTPS connection to a server with a fingerprint configured here will
1127 A HTTPS connection to a server with a fingerprint configured here will
1128 only succeed if the servers certificate matches the fingerprint.
1128 only succeed if the servers certificate matches the fingerprint.
1129 This is very similar to how ssh known hosts works.
1129 This is very similar to how ssh known hosts works.
1130
1130
1131 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1131 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1132 Multiple values can be specified (separated by spaces or commas). This can
1132 Multiple values can be specified (separated by spaces or commas). This can
1133 be used to define both old and new fingerprints while a host transitions
1133 be used to define both old and new fingerprints while a host transitions
1134 to a new certificate.
1134 to a new certificate.
1135
1135
1136 The CA chain and web.cacerts is not used for servers with a fingerprint.
1136 The CA chain and web.cacerts is not used for servers with a fingerprint.
1137
1137
1138 For example::
1138 For example::
1139
1139
1140 [hostfingerprints]
1140 [hostfingerprints]
1141 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1141 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1142 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1142 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1143
1143
1144 ``hostsecurity``
1144 ``hostsecurity``
1145 ----------------
1145 ----------------
1146
1146
1147 Used to specify global and per-host security settings for connecting to
1147 Used to specify global and per-host security settings for connecting to
1148 other machines.
1148 other machines.
1149
1149
1150 The following options control default behavior for all hosts.
1150 The following options control default behavior for all hosts.
1151
1151
1152 ``ciphers``
1152 ``ciphers``
1153 Defines the cryptographic ciphers to use for connections.
1153 Defines the cryptographic ciphers to use for connections.
1154
1154
1155 Value must be a valid OpenSSL Cipher List Format as documented at
1155 Value must be a valid OpenSSL Cipher List Format as documented at
1156 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1156 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1157
1157
1158 This setting is for advanced users only. Setting to incorrect values
1158 This setting is for advanced users only. Setting to incorrect values
1159 can significantly lower connection security or decrease performance.
1159 can significantly lower connection security or decrease performance.
1160 You have been warned.
1160 You have been warned.
1161
1161
1162 This option requires Python 2.7.
1162 This option requires Python 2.7.
1163
1163
1164 ``minimumprotocol``
1164 ``minimumprotocol``
1165 Defines the minimum channel encryption protocol to use.
1165 Defines the minimum channel encryption protocol to use.
1166
1166
1167 By default, the highest version of TLS supported by both client and server
1167 By default, the highest version of TLS supported by both client and server
1168 is used.
1168 is used.
1169
1169
1170 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1170 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1171
1171
1172 When running on an old Python version, only ``tls1.0`` is allowed since
1172 When running on an old Python version, only ``tls1.0`` is allowed since
1173 old versions of Python only support up to TLS 1.0.
1173 old versions of Python only support up to TLS 1.0.
1174
1174
1175 When running a Python that supports modern TLS versions, the default is
1175 When running a Python that supports modern TLS versions, the default is
1176 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1176 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1177 weakens security and should only be used as a feature of last resort if
1177 weakens security and should only be used as a feature of last resort if
1178 a server does not support TLS 1.1+.
1178 a server does not support TLS 1.1+.
1179
1179
1180 Options in the ``[hostsecurity]`` section can have the form
1180 Options in the ``[hostsecurity]`` section can have the form
1181 ``hostname``:``setting``. This allows multiple settings to be defined on a
1181 ``hostname``:``setting``. This allows multiple settings to be defined on a
1182 per-host basis.
1182 per-host basis.
1183
1183
1184 The following per-host settings can be defined.
1184 The following per-host settings can be defined.
1185
1185
1186 ``ciphers``
1186 ``ciphers``
1187 This behaves like ``ciphers`` as described above except it only applies
1187 This behaves like ``ciphers`` as described above except it only applies
1188 to the host on which it is defined.
1188 to the host on which it is defined.
1189
1189
1190 ``fingerprints``
1190 ``fingerprints``
1191 A list of hashes of the DER encoded peer/remote certificate. Values have
1191 A list of hashes of the DER encoded peer/remote certificate. Values have
1192 the form ``algorithm``:``fingerprint``. e.g.
1192 the form ``algorithm``:``fingerprint``. e.g.
1193 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1193 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1194 In addition, colons (``:``) can appear in the fingerprint part.
1194 In addition, colons (``:``) can appear in the fingerprint part.
1195
1195
1196 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1196 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1197 ``sha512``.
1197 ``sha512``.
1198
1198
1199 Use of ``sha256`` or ``sha512`` is preferred.
1199 Use of ``sha256`` or ``sha512`` is preferred.
1200
1200
1201 If a fingerprint is specified, the CA chain is not validated for this
1201 If a fingerprint is specified, the CA chain is not validated for this
1202 host and Mercurial will require the remote certificate to match one
1202 host and Mercurial will require the remote certificate to match one
1203 of the fingerprints specified. This means if the server updates its
1203 of the fingerprints specified. This means if the server updates its
1204 certificate, Mercurial will abort until a new fingerprint is defined.
1204 certificate, Mercurial will abort until a new fingerprint is defined.
1205 This can provide stronger security than traditional CA-based validation
1205 This can provide stronger security than traditional CA-based validation
1206 at the expense of convenience.
1206 at the expense of convenience.
1207
1207
1208 This option takes precedence over ``verifycertsfile``.
1208 This option takes precedence over ``verifycertsfile``.
1209
1209
1210 ``minimumprotocol``
1210 ``minimumprotocol``
1211 This behaves like ``minimumprotocol`` as described above except it
1211 This behaves like ``minimumprotocol`` as described above except it
1212 only applies to the host on which it is defined.
1212 only applies to the host on which it is defined.
1213
1213
1214 ``verifycertsfile``
1214 ``verifycertsfile``
1215 Path to file a containing a list of PEM encoded certificates used to
1215 Path to file a containing a list of PEM encoded certificates used to
1216 verify the server certificate. Environment variables and ``~user``
1216 verify the server certificate. Environment variables and ``~user``
1217 constructs are expanded in the filename.
1217 constructs are expanded in the filename.
1218
1218
1219 The server certificate or the certificate's certificate authority (CA)
1219 The server certificate or the certificate's certificate authority (CA)
1220 must match a certificate from this file or certificate verification
1220 must match a certificate from this file or certificate verification
1221 will fail and connections to the server will be refused.
1221 will fail and connections to the server will be refused.
1222
1222
1223 If defined, only certificates provided by this file will be used:
1223 If defined, only certificates provided by this file will be used:
1224 ``web.cacerts`` and any system/default certificates will not be
1224 ``web.cacerts`` and any system/default certificates will not be
1225 used.
1225 used.
1226
1226
1227 This option has no effect if the per-host ``fingerprints`` option
1227 This option has no effect if the per-host ``fingerprints`` option
1228 is set.
1228 is set.
1229
1229
1230 The format of the file is as follows::
1230 The format of the file is as follows::
1231
1231
1232 -----BEGIN CERTIFICATE-----
1232 -----BEGIN CERTIFICATE-----
1233 ... (certificate in base64 PEM encoding) ...
1233 ... (certificate in base64 PEM encoding) ...
1234 -----END CERTIFICATE-----
1234 -----END CERTIFICATE-----
1235 -----BEGIN CERTIFICATE-----
1235 -----BEGIN CERTIFICATE-----
1236 ... (certificate in base64 PEM encoding) ...
1236 ... (certificate in base64 PEM encoding) ...
1237 -----END CERTIFICATE-----
1237 -----END CERTIFICATE-----
1238
1238
1239 For example::
1239 For example::
1240
1240
1241 [hostsecurity]
1241 [hostsecurity]
1242 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1242 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1243 hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1243 hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1244 hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2
1244 hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2
1245 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1245 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1246
1246
1247 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1247 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1248 when connecting to ``hg.example.com``::
1248 when connecting to ``hg.example.com``::
1249
1249
1250 [hostsecurity]
1250 [hostsecurity]
1251 minimumprotocol = tls1.2
1251 minimumprotocol = tls1.2
1252 hg.example.com:minimumprotocol = tls1.1
1252 hg.example.com:minimumprotocol = tls1.1
1253
1253
1254 ``http_proxy``
1254 ``http_proxy``
1255 --------------
1255 --------------
1256
1256
1257 Used to access web-based Mercurial repositories through a HTTP
1257 Used to access web-based Mercurial repositories through a HTTP
1258 proxy.
1258 proxy.
1259
1259
1260 ``host``
1260 ``host``
1261 Host name and (optional) port of the proxy server, for example
1261 Host name and (optional) port of the proxy server, for example
1262 "myproxy:8000".
1262 "myproxy:8000".
1263
1263
1264 ``no``
1264 ``no``
1265 Optional. Comma-separated list of host names that should bypass
1265 Optional. Comma-separated list of host names that should bypass
1266 the proxy.
1266 the proxy.
1267
1267
1268 ``passwd``
1268 ``passwd``
1269 Optional. Password to authenticate with at the proxy server.
1269 Optional. Password to authenticate with at the proxy server.
1270
1270
1271 ``user``
1271 ``user``
1272 Optional. User name to authenticate with at the proxy server.
1272 Optional. User name to authenticate with at the proxy server.
1273
1273
1274 ``always``
1274 ``always``
1275 Optional. Always use the proxy, even for localhost and any entries
1275 Optional. Always use the proxy, even for localhost and any entries
1276 in ``http_proxy.no``. (default: False)
1276 in ``http_proxy.no``. (default: False)
1277
1277
1278 ``merge``
1278 ``merge``
1279 ---------
1279 ---------
1280
1280
1281 This section specifies behavior during merges and updates.
1281 This section specifies behavior during merges and updates.
1282
1282
1283 ``checkignored``
1283 ``checkignored``
1284 Controls behavior when an ignored file on disk has the same name as a tracked
1284 Controls behavior when an ignored file on disk has the same name as a tracked
1285 file in the changeset being merged or updated to, and has different
1285 file in the changeset being merged or updated to, and has different
1286 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1286 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1287 abort on such files. With ``warn``, warn on such files and back them up as
1287 abort on such files. With ``warn``, warn on such files and back them up as
1288 ``.orig``. With ``ignore``, don't print a warning and back them up as
1288 ``.orig``. With ``ignore``, don't print a warning and back them up as
1289 ``.orig``. (default: ``abort``)
1289 ``.orig``. (default: ``abort``)
1290
1290
1291 ``checkunknown``
1291 ``checkunknown``
1292 Controls behavior when an unknown file that isn't ignored has the same name
1292 Controls behavior when an unknown file that isn't ignored has the same name
1293 as a tracked file in the changeset being merged or updated to, and has
1293 as a tracked file in the changeset being merged or updated to, and has
1294 different contents. Similar to ``merge.checkignored``, except for files that
1294 different contents. Similar to ``merge.checkignored``, except for files that
1295 are not ignored. (default: ``abort``)
1295 are not ignored. (default: ``abort``)
1296
1296
1297 ``on-failure``
1297 ``on-failure``
1298 When set to ``continue`` (the default), the merge process attempts to
1298 When set to ``continue`` (the default), the merge process attempts to
1299 merge all unresolved files using the merge chosen tool, regardless of
1299 merge all unresolved files using the merge chosen tool, regardless of
1300 whether previous file merge attempts during the process succeeded or not.
1300 whether previous file merge attempts during the process succeeded or not.
1301 Setting this to ``prompt`` will prompt after any merge failure continue
1301 Setting this to ``prompt`` will prompt after any merge failure continue
1302 or halt the merge process. Setting this to ``halt`` will automatically
1302 or halt the merge process. Setting this to ``halt`` will automatically
1303 halt the merge process on any merge tool failure. The merge process
1303 halt the merge process on any merge tool failure. The merge process
1304 can be restarted by using the ``resolve`` command. When a merge is
1304 can be restarted by using the ``resolve`` command. When a merge is
1305 halted, the repository is left in a normal ``unresolved`` merge state.
1305 halted, the repository is left in a normal ``unresolved`` merge state.
1306 (default: ``continue``)
1306 (default: ``continue``)
1307
1307
1308 ``merge-patterns``
1308 ``merge-patterns``
1309 ------------------
1309 ------------------
1310
1310
1311 This section specifies merge tools to associate with particular file
1311 This section specifies merge tools to associate with particular file
1312 patterns. Tools matched here will take precedence over the default
1312 patterns. Tools matched here will take precedence over the default
1313 merge tool. Patterns are globs by default, rooted at the repository
1313 merge tool. Patterns are globs by default, rooted at the repository
1314 root.
1314 root.
1315
1315
1316 Example::
1316 Example::
1317
1317
1318 [merge-patterns]
1318 [merge-patterns]
1319 **.c = kdiff3
1319 **.c = kdiff3
1320 **.jpg = myimgmerge
1320 **.jpg = myimgmerge
1321
1321
1322 ``merge-tools``
1322 ``merge-tools``
1323 ---------------
1323 ---------------
1324
1324
1325 This section configures external merge tools to use for file-level
1325 This section configures external merge tools to use for file-level
1326 merges. This section has likely been preconfigured at install time.
1326 merges. This section has likely been preconfigured at install time.
1327 Use :hg:`config merge-tools` to check the existing configuration.
1327 Use :hg:`config merge-tools` to check the existing configuration.
1328 Also see :hg:`help merge-tools` for more details.
1328 Also see :hg:`help merge-tools` for more details.
1329
1329
1330 Example ``~/.hgrc``::
1330 Example ``~/.hgrc``::
1331
1331
1332 [merge-tools]
1332 [merge-tools]
1333 # Override stock tool location
1333 # Override stock tool location
1334 kdiff3.executable = ~/bin/kdiff3
1334 kdiff3.executable = ~/bin/kdiff3
1335 # Specify command line
1335 # Specify command line
1336 kdiff3.args = $base $local $other -o $output
1336 kdiff3.args = $base $local $other -o $output
1337 # Give higher priority
1337 # Give higher priority
1338 kdiff3.priority = 1
1338 kdiff3.priority = 1
1339
1339
1340 # Changing the priority of preconfigured tool
1340 # Changing the priority of preconfigured tool
1341 meld.priority = 0
1341 meld.priority = 0
1342
1342
1343 # Disable a preconfigured tool
1343 # Disable a preconfigured tool
1344 vimdiff.disabled = yes
1344 vimdiff.disabled = yes
1345
1345
1346 # Define new tool
1346 # Define new tool
1347 myHtmlTool.args = -m $local $other $base $output
1347 myHtmlTool.args = -m $local $other $base $output
1348 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1348 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1349 myHtmlTool.priority = 1
1349 myHtmlTool.priority = 1
1350
1350
1351 Supported arguments:
1351 Supported arguments:
1352
1352
1353 ``priority``
1353 ``priority``
1354 The priority in which to evaluate this tool.
1354 The priority in which to evaluate this tool.
1355 (default: 0)
1355 (default: 0)
1356
1356
1357 ``executable``
1357 ``executable``
1358 Either just the name of the executable or its pathname.
1358 Either just the name of the executable or its pathname.
1359
1359
1360 .. container:: windows
1360 .. container:: windows
1361
1361
1362 On Windows, the path can use environment variables with ${ProgramFiles}
1362 On Windows, the path can use environment variables with ${ProgramFiles}
1363 syntax.
1363 syntax.
1364
1364
1365 (default: the tool name)
1365 (default: the tool name)
1366
1366
1367 ``args``
1367 ``args``
1368 The arguments to pass to the tool executable. You can refer to the
1368 The arguments to pass to the tool executable. You can refer to the
1369 files being merged as well as the output file through these
1369 files being merged as well as the output file through these
1370 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1370 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1371
1371
1372 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1372 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1373 being performed. During an update or merge, ``$local`` represents the original
1373 being performed. During an update or merge, ``$local`` represents the original
1374 state of the file, while ``$other`` represents the commit you are updating to or
1374 state of the file, while ``$other`` represents the commit you are updating to or
1375 the commit you are merging with. During a rebase, ``$local`` represents the
1375 the commit you are merging with. During a rebase, ``$local`` represents the
1376 destination of the rebase, and ``$other`` represents the commit being rebased.
1376 destination of the rebase, and ``$other`` represents the commit being rebased.
1377
1377
1378 Some operations define custom labels to assist with identifying the revisions,
1378 Some operations define custom labels to assist with identifying the revisions,
1379 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1379 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1380 labels are not available, these will be ``local``, ``other``, and ``base``,
1380 labels are not available, these will be ``local``, ``other``, and ``base``,
1381 respectively.
1381 respectively.
1382 (default: ``$local $base $other``)
1382 (default: ``$local $base $other``)
1383
1383
1384 ``premerge``
1384 ``premerge``
1385 Attempt to run internal non-interactive 3-way merge tool before
1385 Attempt to run internal non-interactive 3-way merge tool before
1386 launching external tool. Options are ``true``, ``false``, ``keep`` or
1386 launching external tool. Options are ``true``, ``false``, ``keep`` or
1387 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1387 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1388 premerge fails. The ``keep-merge3`` will do the same but include information
1388 premerge fails. The ``keep-merge3`` will do the same but include information
1389 about the base of the merge in the marker (see internal :merge3 in
1389 about the base of the merge in the marker (see internal :merge3 in
1390 :hg:`help merge-tools`).
1390 :hg:`help merge-tools`).
1391 (default: True)
1391 (default: True)
1392
1392
1393 ``binary``
1393 ``binary``
1394 This tool can merge binary files. (default: False, unless tool
1394 This tool can merge binary files. (default: False, unless tool
1395 was selected by file pattern match)
1395 was selected by file pattern match)
1396
1396
1397 ``symlink``
1397 ``symlink``
1398 This tool can merge symlinks. (default: False)
1398 This tool can merge symlinks. (default: False)
1399
1399
1400 ``check``
1400 ``check``
1401 A list of merge success-checking options:
1401 A list of merge success-checking options:
1402
1402
1403 ``changed``
1403 ``changed``
1404 Ask whether merge was successful when the merged file shows no changes.
1404 Ask whether merge was successful when the merged file shows no changes.
1405 ``conflicts``
1405 ``conflicts``
1406 Check whether there are conflicts even though the tool reported success.
1406 Check whether there are conflicts even though the tool reported success.
1407 ``prompt``
1407 ``prompt``
1408 Always prompt for merge success, regardless of success reported by tool.
1408 Always prompt for merge success, regardless of success reported by tool.
1409
1409
1410 ``fixeol``
1410 ``fixeol``
1411 Attempt to fix up EOL changes caused by the merge tool.
1411 Attempt to fix up EOL changes caused by the merge tool.
1412 (default: False)
1412 (default: False)
1413
1413
1414 ``gui``
1414 ``gui``
1415 This tool requires a graphical interface to run. (default: False)
1415 This tool requires a graphical interface to run. (default: False)
1416
1416
1417 ``mergemarkers``
1417 ``mergemarkers``
1418 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1418 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1419 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1419 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1420 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1420 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1421 markers generated during premerge will be ``detailed`` if either this option or
1421 markers generated during premerge will be ``detailed`` if either this option or
1422 the corresponding option in the ``[ui]`` section is ``detailed``.
1422 the corresponding option in the ``[ui]`` section is ``detailed``.
1423 (default: ``basic``)
1423 (default: ``basic``)
1424
1424
1425 ``mergemarkertemplate``
1425 ``mergemarkertemplate``
1426 This setting can be used to override ``mergemarkertemplate`` from the ``[ui]``
1426 This setting can be used to override ``mergemarkertemplate`` from the ``[ui]``
1427 section on a per-tool basis; this applies to the ``$label``-prefixed variables
1427 section on a per-tool basis; this applies to the ``$label``-prefixed variables
1428 and to the conflict markers that are generated if ``premerge`` is ``keep` or
1428 and to the conflict markers that are generated if ``premerge`` is ``keep` or
1429 ``keep-merge3``. See the corresponding variable in ``[ui]`` for more
1429 ``keep-merge3``. See the corresponding variable in ``[ui]`` for more
1430 information.
1430 information.
1431
1431
1432 .. container:: windows
1432 .. container:: windows
1433
1433
1434 ``regkey``
1434 ``regkey``
1435 Windows registry key which describes install location of this
1435 Windows registry key which describes install location of this
1436 tool. Mercurial will search for this key first under
1436 tool. Mercurial will search for this key first under
1437 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1437 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1438 (default: None)
1438 (default: None)
1439
1439
1440 ``regkeyalt``
1440 ``regkeyalt``
1441 An alternate Windows registry key to try if the first key is not
1441 An alternate Windows registry key to try if the first key is not
1442 found. The alternate key uses the same ``regname`` and ``regappend``
1442 found. The alternate key uses the same ``regname`` and ``regappend``
1443 semantics of the primary key. The most common use for this key
1443 semantics of the primary key. The most common use for this key
1444 is to search for 32bit applications on 64bit operating systems.
1444 is to search for 32bit applications on 64bit operating systems.
1445 (default: None)
1445 (default: None)
1446
1446
1447 ``regname``
1447 ``regname``
1448 Name of value to read from specified registry key.
1448 Name of value to read from specified registry key.
1449 (default: the unnamed (default) value)
1449 (default: the unnamed (default) value)
1450
1450
1451 ``regappend``
1451 ``regappend``
1452 String to append to the value read from the registry, typically
1452 String to append to the value read from the registry, typically
1453 the executable name of the tool.
1453 the executable name of the tool.
1454 (default: None)
1454 (default: None)
1455
1455
1456 ``pager``
1456 ``pager``
1457 ---------
1457 ---------
1458
1458
1459 Setting used to control when to paginate and with what external tool. See
1459 Setting used to control when to paginate and with what external tool. See
1460 :hg:`help pager` for details.
1460 :hg:`help pager` for details.
1461
1461
1462 ``pager``
1462 ``pager``
1463 Define the external tool used as pager.
1463 Define the external tool used as pager.
1464
1464
1465 If no pager is set, Mercurial uses the environment variable $PAGER.
1465 If no pager is set, Mercurial uses the environment variable $PAGER.
1466 If neither pager.pager, nor $PAGER is set, a default pager will be
1466 If neither pager.pager, nor $PAGER is set, a default pager will be
1467 used, typically `less` on Unix and `more` on Windows. Example::
1467 used, typically `less` on Unix and `more` on Windows. Example::
1468
1468
1469 [pager]
1469 [pager]
1470 pager = less -FRX
1470 pager = less -FRX
1471
1471
1472 ``ignore``
1472 ``ignore``
1473 List of commands to disable the pager for. Example::
1473 List of commands to disable the pager for. Example::
1474
1474
1475 [pager]
1475 [pager]
1476 ignore = version, help, update
1476 ignore = version, help, update
1477
1477
1478 ``patch``
1478 ``patch``
1479 ---------
1479 ---------
1480
1480
1481 Settings used when applying patches, for instance through the 'import'
1481 Settings used when applying patches, for instance through the 'import'
1482 command or with Mercurial Queues extension.
1482 command or with Mercurial Queues extension.
1483
1483
1484 ``eol``
1484 ``eol``
1485 When set to 'strict' patch content and patched files end of lines
1485 When set to 'strict' patch content and patched files end of lines
1486 are preserved. When set to ``lf`` or ``crlf``, both files end of
1486 are preserved. When set to ``lf`` or ``crlf``, both files end of
1487 lines are ignored when patching and the result line endings are
1487 lines are ignored when patching and the result line endings are
1488 normalized to either LF (Unix) or CRLF (Windows). When set to
1488 normalized to either LF (Unix) or CRLF (Windows). When set to
1489 ``auto``, end of lines are again ignored while patching but line
1489 ``auto``, end of lines are again ignored while patching but line
1490 endings in patched files are normalized to their original setting
1490 endings in patched files are normalized to their original setting
1491 on a per-file basis. If target file does not exist or has no end
1491 on a per-file basis. If target file does not exist or has no end
1492 of line, patch line endings are preserved.
1492 of line, patch line endings are preserved.
1493 (default: strict)
1493 (default: strict)
1494
1494
1495 ``fuzz``
1495 ``fuzz``
1496 The number of lines of 'fuzz' to allow when applying patches. This
1496 The number of lines of 'fuzz' to allow when applying patches. This
1497 controls how much context the patcher is allowed to ignore when
1497 controls how much context the patcher is allowed to ignore when
1498 trying to apply a patch.
1498 trying to apply a patch.
1499 (default: 2)
1499 (default: 2)
1500
1500
1501 ``paths``
1501 ``paths``
1502 ---------
1502 ---------
1503
1503
1504 Assigns symbolic names and behavior to repositories.
1504 Assigns symbolic names and behavior to repositories.
1505
1505
1506 Options are symbolic names defining the URL or directory that is the
1506 Options are symbolic names defining the URL or directory that is the
1507 location of the repository. Example::
1507 location of the repository. Example::
1508
1508
1509 [paths]
1509 [paths]
1510 my_server = https://example.com/my_repo
1510 my_server = https://example.com/my_repo
1511 local_path = /home/me/repo
1511 local_path = /home/me/repo
1512
1512
1513 These symbolic names can be used from the command line. To pull
1513 These symbolic names can be used from the command line. To pull
1514 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1514 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1515 :hg:`push local_path`.
1515 :hg:`push local_path`.
1516
1516
1517 Options containing colons (``:``) denote sub-options that can influence
1517 Options containing colons (``:``) denote sub-options that can influence
1518 behavior for that specific path. Example::
1518 behavior for that specific path. Example::
1519
1519
1520 [paths]
1520 [paths]
1521 my_server = https://example.com/my_path
1521 my_server = https://example.com/my_path
1522 my_server:pushurl = ssh://example.com/my_path
1522 my_server:pushurl = ssh://example.com/my_path
1523
1523
1524 The following sub-options can be defined:
1524 The following sub-options can be defined:
1525
1525
1526 ``pushurl``
1526 ``pushurl``
1527 The URL to use for push operations. If not defined, the location
1527 The URL to use for push operations. If not defined, the location
1528 defined by the path's main entry is used.
1528 defined by the path's main entry is used.
1529
1529
1530 ``pushrev``
1530 ``pushrev``
1531 A revset defining which revisions to push by default.
1531 A revset defining which revisions to push by default.
1532
1532
1533 When :hg:`push` is executed without a ``-r`` argument, the revset
1533 When :hg:`push` is executed without a ``-r`` argument, the revset
1534 defined by this sub-option is evaluated to determine what to push.
1534 defined by this sub-option is evaluated to determine what to push.
1535
1535
1536 For example, a value of ``.`` will push the working directory's
1536 For example, a value of ``.`` will push the working directory's
1537 revision by default.
1537 revision by default.
1538
1538
1539 Revsets specifying bookmarks will not result in the bookmark being
1539 Revsets specifying bookmarks will not result in the bookmark being
1540 pushed.
1540 pushed.
1541
1541
1542 The following special named paths exist:
1542 The following special named paths exist:
1543
1543
1544 ``default``
1544 ``default``
1545 The URL or directory to use when no source or remote is specified.
1545 The URL or directory to use when no source or remote is specified.
1546
1546
1547 :hg:`clone` will automatically define this path to the location the
1547 :hg:`clone` will automatically define this path to the location the
1548 repository was cloned from.
1548 repository was cloned from.
1549
1549
1550 ``default-push``
1550 ``default-push``
1551 (deprecated) The URL or directory for the default :hg:`push` location.
1551 (deprecated) The URL or directory for the default :hg:`push` location.
1552 ``default:pushurl`` should be used instead.
1552 ``default:pushurl`` should be used instead.
1553
1553
1554 ``phases``
1554 ``phases``
1555 ----------
1555 ----------
1556
1556
1557 Specifies default handling of phases. See :hg:`help phases` for more
1557 Specifies default handling of phases. See :hg:`help phases` for more
1558 information about working with phases.
1558 information about working with phases.
1559
1559
1560 ``publish``
1560 ``publish``
1561 Controls draft phase behavior when working as a server. When true,
1561 Controls draft phase behavior when working as a server. When true,
1562 pushed changesets are set to public in both client and server and
1562 pushed changesets are set to public in both client and server and
1563 pulled or cloned changesets are set to public in the client.
1563 pulled or cloned changesets are set to public in the client.
1564 (default: True)
1564 (default: True)
1565
1565
1566 ``new-commit``
1566 ``new-commit``
1567 Phase of newly-created commits.
1567 Phase of newly-created commits.
1568 (default: draft)
1568 (default: draft)
1569
1569
1570 ``checksubrepos``
1570 ``checksubrepos``
1571 Check the phase of the current revision of each subrepository. Allowed
1571 Check the phase of the current revision of each subrepository. Allowed
1572 values are "ignore", "follow" and "abort". For settings other than
1572 values are "ignore", "follow" and "abort". For settings other than
1573 "ignore", the phase of the current revision of each subrepository is
1573 "ignore", the phase of the current revision of each subrepository is
1574 checked before committing the parent repository. If any of those phases is
1574 checked before committing the parent repository. If any of those phases is
1575 greater than the phase of the parent repository (e.g. if a subrepo is in a
1575 greater than the phase of the parent repository (e.g. if a subrepo is in a
1576 "secret" phase while the parent repo is in "draft" phase), the commit is
1576 "secret" phase while the parent repo is in "draft" phase), the commit is
1577 either aborted (if checksubrepos is set to "abort") or the higher phase is
1577 either aborted (if checksubrepos is set to "abort") or the higher phase is
1578 used for the parent repository commit (if set to "follow").
1578 used for the parent repository commit (if set to "follow").
1579 (default: follow)
1579 (default: follow)
1580
1580
1581
1581
1582 ``profiling``
1582 ``profiling``
1583 -------------
1583 -------------
1584
1584
1585 Specifies profiling type, format, and file output. Two profilers are
1585 Specifies profiling type, format, and file output. Two profilers are
1586 supported: an instrumenting profiler (named ``ls``), and a sampling
1586 supported: an instrumenting profiler (named ``ls``), and a sampling
1587 profiler (named ``stat``).
1587 profiler (named ``stat``).
1588
1588
1589 In this section description, 'profiling data' stands for the raw data
1589 In this section description, 'profiling data' stands for the raw data
1590 collected during profiling, while 'profiling report' stands for a
1590 collected during profiling, while 'profiling report' stands for a
1591 statistical text report generated from the profiling data.
1591 statistical text report generated from the profiling data.
1592
1592
1593 ``enabled``
1593 ``enabled``
1594 Enable the profiler.
1594 Enable the profiler.
1595 (default: false)
1595 (default: false)
1596
1596
1597 This is equivalent to passing ``--profile`` on the command line.
1597 This is equivalent to passing ``--profile`` on the command line.
1598
1598
1599 ``type``
1599 ``type``
1600 The type of profiler to use.
1600 The type of profiler to use.
1601 (default: stat)
1601 (default: stat)
1602
1602
1603 ``ls``
1603 ``ls``
1604 Use Python's built-in instrumenting profiler. This profiler
1604 Use Python's built-in instrumenting profiler. This profiler
1605 works on all platforms, but each line number it reports is the
1605 works on all platforms, but each line number it reports is the
1606 first line of a function. This restriction makes it difficult to
1606 first line of a function. This restriction makes it difficult to
1607 identify the expensive parts of a non-trivial function.
1607 identify the expensive parts of a non-trivial function.
1608 ``stat``
1608 ``stat``
1609 Use a statistical profiler, statprof. This profiler is most
1609 Use a statistical profiler, statprof. This profiler is most
1610 useful for profiling commands that run for longer than about 0.1
1610 useful for profiling commands that run for longer than about 0.1
1611 seconds.
1611 seconds.
1612
1612
1613 ``format``
1613 ``format``
1614 Profiling format. Specific to the ``ls`` instrumenting profiler.
1614 Profiling format. Specific to the ``ls`` instrumenting profiler.
1615 (default: text)
1615 (default: text)
1616
1616
1617 ``text``
1617 ``text``
1618 Generate a profiling report. When saving to a file, it should be
1618 Generate a profiling report. When saving to a file, it should be
1619 noted that only the report is saved, and the profiling data is
1619 noted that only the report is saved, and the profiling data is
1620 not kept.
1620 not kept.
1621 ``kcachegrind``
1621 ``kcachegrind``
1622 Format profiling data for kcachegrind use: when saving to a
1622 Format profiling data for kcachegrind use: when saving to a
1623 file, the generated file can directly be loaded into
1623 file, the generated file can directly be loaded into
1624 kcachegrind.
1624 kcachegrind.
1625
1625
1626 ``statformat``
1626 ``statformat``
1627 Profiling format for the ``stat`` profiler.
1627 Profiling format for the ``stat`` profiler.
1628 (default: hotpath)
1628 (default: hotpath)
1629
1629
1630 ``hotpath``
1630 ``hotpath``
1631 Show a tree-based display containing the hot path of execution (where
1631 Show a tree-based display containing the hot path of execution (where
1632 most time was spent).
1632 most time was spent).
1633 ``bymethod``
1633 ``bymethod``
1634 Show a table of methods ordered by how frequently they are active.
1634 Show a table of methods ordered by how frequently they are active.
1635 ``byline``
1635 ``byline``
1636 Show a table of lines in files ordered by how frequently they are active.
1636 Show a table of lines in files ordered by how frequently they are active.
1637 ``json``
1637 ``json``
1638 Render profiling data as JSON.
1638 Render profiling data as JSON.
1639
1639
1640 ``frequency``
1640 ``frequency``
1641 Sampling frequency. Specific to the ``stat`` sampling profiler.
1641 Sampling frequency. Specific to the ``stat`` sampling profiler.
1642 (default: 1000)
1642 (default: 1000)
1643
1643
1644 ``output``
1644 ``output``
1645 File path where profiling data or report should be saved. If the
1645 File path where profiling data or report should be saved. If the
1646 file exists, it is replaced. (default: None, data is printed on
1646 file exists, it is replaced. (default: None, data is printed on
1647 stderr)
1647 stderr)
1648
1648
1649 ``sort``
1649 ``sort``
1650 Sort field. Specific to the ``ls`` instrumenting profiler.
1650 Sort field. Specific to the ``ls`` instrumenting profiler.
1651 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1651 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1652 ``inlinetime``.
1652 ``inlinetime``.
1653 (default: inlinetime)
1653 (default: inlinetime)
1654
1654
1655 ``time-track``
1656 Control if the stat profiler track ``cpu`` or ``real`` time.
1657 (default: ``cpu``)
1658
1655 ``limit``
1659 ``limit``
1656 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1660 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1657 (default: 30)
1661 (default: 30)
1658
1662
1659 ``nested``
1663 ``nested``
1660 Show at most this number of lines of drill-down info after each main entry.
1664 Show at most this number of lines of drill-down info after each main entry.
1661 This can help explain the difference between Total and Inline.
1665 This can help explain the difference between Total and Inline.
1662 Specific to the ``ls`` instrumenting profiler.
1666 Specific to the ``ls`` instrumenting profiler.
1663 (default: 0)
1667 (default: 0)
1664
1668
1665 ``showmin``
1669 ``showmin``
1666 Minimum fraction of samples an entry must have for it to be displayed.
1670 Minimum fraction of samples an entry must have for it to be displayed.
1667 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1671 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1668 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1672 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1669
1673
1670 Only used by the ``stat`` profiler.
1674 Only used by the ``stat`` profiler.
1671
1675
1672 For the ``hotpath`` format, default is ``0.05``.
1676 For the ``hotpath`` format, default is ``0.05``.
1673 For the ``chrome`` format, default is ``0.005``.
1677 For the ``chrome`` format, default is ``0.005``.
1674
1678
1675 The option is unused on other formats.
1679 The option is unused on other formats.
1676
1680
1677 ``showmax``
1681 ``showmax``
1678 Maximum fraction of samples an entry can have before it is ignored in
1682 Maximum fraction of samples an entry can have before it is ignored in
1679 display. Values format is the same as ``showmin``.
1683 display. Values format is the same as ``showmin``.
1680
1684
1681 Only used by the ``stat`` profiler.
1685 Only used by the ``stat`` profiler.
1682
1686
1683 For the ``chrome`` format, default is ``0.999``.
1687 For the ``chrome`` format, default is ``0.999``.
1684
1688
1685 The option is unused on other formats.
1689 The option is unused on other formats.
1686
1690
1687 ``progress``
1691 ``progress``
1688 ------------
1692 ------------
1689
1693
1690 Mercurial commands can draw progress bars that are as informative as
1694 Mercurial commands can draw progress bars that are as informative as
1691 possible. Some progress bars only offer indeterminate information, while others
1695 possible. Some progress bars only offer indeterminate information, while others
1692 have a definite end point.
1696 have a definite end point.
1693
1697
1694 ``delay``
1698 ``delay``
1695 Number of seconds (float) before showing the progress bar. (default: 3)
1699 Number of seconds (float) before showing the progress bar. (default: 3)
1696
1700
1697 ``changedelay``
1701 ``changedelay``
1698 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1702 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1699 that value will be used instead. (default: 1)
1703 that value will be used instead. (default: 1)
1700
1704
1701 ``estimateinterval``
1705 ``estimateinterval``
1702 Maximum sampling interval in seconds for speed and estimated time
1706 Maximum sampling interval in seconds for speed and estimated time
1703 calculation. (default: 60)
1707 calculation. (default: 60)
1704
1708
1705 ``refresh``
1709 ``refresh``
1706 Time in seconds between refreshes of the progress bar. (default: 0.1)
1710 Time in seconds between refreshes of the progress bar. (default: 0.1)
1707
1711
1708 ``format``
1712 ``format``
1709 Format of the progress bar.
1713 Format of the progress bar.
1710
1714
1711 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1715 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1712 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1716 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1713 last 20 characters of the item, but this can be changed by adding either
1717 last 20 characters of the item, but this can be changed by adding either
1714 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1718 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1715 first num characters.
1719 first num characters.
1716
1720
1717 (default: topic bar number estimate)
1721 (default: topic bar number estimate)
1718
1722
1719 ``width``
1723 ``width``
1720 If set, the maximum width of the progress information (that is, min(width,
1724 If set, the maximum width of the progress information (that is, min(width,
1721 term width) will be used).
1725 term width) will be used).
1722
1726
1723 ``clear-complete``
1727 ``clear-complete``
1724 Clear the progress bar after it's done. (default: True)
1728 Clear the progress bar after it's done. (default: True)
1725
1729
1726 ``disable``
1730 ``disable``
1727 If true, don't show a progress bar.
1731 If true, don't show a progress bar.
1728
1732
1729 ``assume-tty``
1733 ``assume-tty``
1730 If true, ALWAYS show a progress bar, unless disable is given.
1734 If true, ALWAYS show a progress bar, unless disable is given.
1731
1735
1732 ``rebase``
1736 ``rebase``
1733 ----------
1737 ----------
1734
1738
1735 ``evolution.allowdivergence``
1739 ``evolution.allowdivergence``
1736 Default to False, when True allow creating divergence when performing
1740 Default to False, when True allow creating divergence when performing
1737 rebase of obsolete changesets.
1741 rebase of obsolete changesets.
1738
1742
1739 ``revsetalias``
1743 ``revsetalias``
1740 ---------------
1744 ---------------
1741
1745
1742 Alias definitions for revsets. See :hg:`help revsets` for details.
1746 Alias definitions for revsets. See :hg:`help revsets` for details.
1743
1747
1744 ``server``
1748 ``server``
1745 ----------
1749 ----------
1746
1750
1747 Controls generic server settings.
1751 Controls generic server settings.
1748
1752
1749 ``bookmarks-pushkey-compat``
1753 ``bookmarks-pushkey-compat``
1750 Trigger pushkey hook when being pushed bookmark updates. This config exist
1754 Trigger pushkey hook when being pushed bookmark updates. This config exist
1751 for compatibility purpose (default to True)
1755 for compatibility purpose (default to True)
1752
1756
1753 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
1757 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
1754 movement we recommend you migrate them to ``txnclose-bookmark`` and
1758 movement we recommend you migrate them to ``txnclose-bookmark`` and
1755 ``pretxnclose-bookmark``.
1759 ``pretxnclose-bookmark``.
1756
1760
1757 ``compressionengines``
1761 ``compressionengines``
1758 List of compression engines and their relative priority to advertise
1762 List of compression engines and their relative priority to advertise
1759 to clients.
1763 to clients.
1760
1764
1761 The order of compression engines determines their priority, the first
1765 The order of compression engines determines their priority, the first
1762 having the highest priority. If a compression engine is not listed
1766 having the highest priority. If a compression engine is not listed
1763 here, it won't be advertised to clients.
1767 here, it won't be advertised to clients.
1764
1768
1765 If not set (the default), built-in defaults are used. Run
1769 If not set (the default), built-in defaults are used. Run
1766 :hg:`debuginstall` to list available compression engines and their
1770 :hg:`debuginstall` to list available compression engines and their
1767 default wire protocol priority.
1771 default wire protocol priority.
1768
1772
1769 Older Mercurial clients only support zlib compression and this setting
1773 Older Mercurial clients only support zlib compression and this setting
1770 has no effect for legacy clients.
1774 has no effect for legacy clients.
1771
1775
1772 ``uncompressed``
1776 ``uncompressed``
1773 Whether to allow clients to clone a repository using the
1777 Whether to allow clients to clone a repository using the
1774 uncompressed streaming protocol. This transfers about 40% more
1778 uncompressed streaming protocol. This transfers about 40% more
1775 data than a regular clone, but uses less memory and CPU on both
1779 data than a regular clone, but uses less memory and CPU on both
1776 server and client. Over a LAN (100 Mbps or better) or a very fast
1780 server and client. Over a LAN (100 Mbps or better) or a very fast
1777 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1781 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1778 regular clone. Over most WAN connections (anything slower than
1782 regular clone. Over most WAN connections (anything slower than
1779 about 6 Mbps), uncompressed streaming is slower, because of the
1783 about 6 Mbps), uncompressed streaming is slower, because of the
1780 extra data transfer overhead. This mode will also temporarily hold
1784 extra data transfer overhead. This mode will also temporarily hold
1781 the write lock while determining what data to transfer.
1785 the write lock while determining what data to transfer.
1782 (default: True)
1786 (default: True)
1783
1787
1784 ``uncompressedallowsecret``
1788 ``uncompressedallowsecret``
1785 Whether to allow stream clones when the repository contains secret
1789 Whether to allow stream clones when the repository contains secret
1786 changesets. (default: False)
1790 changesets. (default: False)
1787
1791
1788 ``preferuncompressed``
1792 ``preferuncompressed``
1789 When set, clients will try to use the uncompressed streaming
1793 When set, clients will try to use the uncompressed streaming
1790 protocol. (default: False)
1794 protocol. (default: False)
1791
1795
1792 ``disablefullbundle``
1796 ``disablefullbundle``
1793 When set, servers will refuse attempts to do pull-based clones.
1797 When set, servers will refuse attempts to do pull-based clones.
1794 If this option is set, ``preferuncompressed`` and/or clone bundles
1798 If this option is set, ``preferuncompressed`` and/or clone bundles
1795 are highly recommended. Partial clones will still be allowed.
1799 are highly recommended. Partial clones will still be allowed.
1796 (default: False)
1800 (default: False)
1797
1801
1798 ``streamunbundle``
1802 ``streamunbundle``
1799 When set, servers will apply data sent from the client directly,
1803 When set, servers will apply data sent from the client directly,
1800 otherwise it will be written to a temporary file first. This option
1804 otherwise it will be written to a temporary file first. This option
1801 effectively prevents concurrent pushes.
1805 effectively prevents concurrent pushes.
1802
1806
1803 ``pullbundle``
1807 ``pullbundle``
1804 When set, the server will check pullbundle.manifest for bundles
1808 When set, the server will check pullbundle.manifest for bundles
1805 covering the requested heads and common nodes. The first matching
1809 covering the requested heads and common nodes. The first matching
1806 entry will be streamed to the client.
1810 entry will be streamed to the client.
1807
1811
1808 For HTTP transport, the stream will still use zlib compression
1812 For HTTP transport, the stream will still use zlib compression
1809 for older clients.
1813 for older clients.
1810
1814
1811 ``concurrent-push-mode``
1815 ``concurrent-push-mode``
1812 Level of allowed race condition between two pushing clients.
1816 Level of allowed race condition between two pushing clients.
1813
1817
1814 - 'strict': push is abort if another client touched the repository
1818 - 'strict': push is abort if another client touched the repository
1815 while the push was preparing. (default)
1819 while the push was preparing. (default)
1816 - 'check-related': push is only aborted if it affects head that got also
1820 - 'check-related': push is only aborted if it affects head that got also
1817 affected while the push was preparing.
1821 affected while the push was preparing.
1818
1822
1819 This requires compatible client (version 4.3 and later). Old client will
1823 This requires compatible client (version 4.3 and later). Old client will
1820 use 'strict'.
1824 use 'strict'.
1821
1825
1822 ``validate``
1826 ``validate``
1823 Whether to validate the completeness of pushed changesets by
1827 Whether to validate the completeness of pushed changesets by
1824 checking that all new file revisions specified in manifests are
1828 checking that all new file revisions specified in manifests are
1825 present. (default: False)
1829 present. (default: False)
1826
1830
1827 ``maxhttpheaderlen``
1831 ``maxhttpheaderlen``
1828 Instruct HTTP clients not to send request headers longer than this
1832 Instruct HTTP clients not to send request headers longer than this
1829 many bytes. (default: 1024)
1833 many bytes. (default: 1024)
1830
1834
1831 ``bundle1``
1835 ``bundle1``
1832 Whether to allow clients to push and pull using the legacy bundle1
1836 Whether to allow clients to push and pull using the legacy bundle1
1833 exchange format. (default: True)
1837 exchange format. (default: True)
1834
1838
1835 ``bundle1gd``
1839 ``bundle1gd``
1836 Like ``bundle1`` but only used if the repository is using the
1840 Like ``bundle1`` but only used if the repository is using the
1837 *generaldelta* storage format. (default: True)
1841 *generaldelta* storage format. (default: True)
1838
1842
1839 ``bundle1.push``
1843 ``bundle1.push``
1840 Whether to allow clients to push using the legacy bundle1 exchange
1844 Whether to allow clients to push using the legacy bundle1 exchange
1841 format. (default: True)
1845 format. (default: True)
1842
1846
1843 ``bundle1gd.push``
1847 ``bundle1gd.push``
1844 Like ``bundle1.push`` but only used if the repository is using the
1848 Like ``bundle1.push`` but only used if the repository is using the
1845 *generaldelta* storage format. (default: True)
1849 *generaldelta* storage format. (default: True)
1846
1850
1847 ``bundle1.pull``
1851 ``bundle1.pull``
1848 Whether to allow clients to pull using the legacy bundle1 exchange
1852 Whether to allow clients to pull using the legacy bundle1 exchange
1849 format. (default: True)
1853 format. (default: True)
1850
1854
1851 ``bundle1gd.pull``
1855 ``bundle1gd.pull``
1852 Like ``bundle1.pull`` but only used if the repository is using the
1856 Like ``bundle1.pull`` but only used if the repository is using the
1853 *generaldelta* storage format. (default: True)
1857 *generaldelta* storage format. (default: True)
1854
1858
1855 Large repositories using the *generaldelta* storage format should
1859 Large repositories using the *generaldelta* storage format should
1856 consider setting this option because converting *generaldelta*
1860 consider setting this option because converting *generaldelta*
1857 repositories to the exchange format required by the bundle1 data
1861 repositories to the exchange format required by the bundle1 data
1858 format can consume a lot of CPU.
1862 format can consume a lot of CPU.
1859
1863
1860 ``zliblevel``
1864 ``zliblevel``
1861 Integer between ``-1`` and ``9`` that controls the zlib compression level
1865 Integer between ``-1`` and ``9`` that controls the zlib compression level
1862 for wire protocol commands that send zlib compressed output (notably the
1866 for wire protocol commands that send zlib compressed output (notably the
1863 commands that send repository history data).
1867 commands that send repository history data).
1864
1868
1865 The default (``-1``) uses the default zlib compression level, which is
1869 The default (``-1``) uses the default zlib compression level, which is
1866 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1870 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1867 maximum compression.
1871 maximum compression.
1868
1872
1869 Setting this option allows server operators to make trade-offs between
1873 Setting this option allows server operators to make trade-offs between
1870 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1874 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1871 but sends more bytes to clients.
1875 but sends more bytes to clients.
1872
1876
1873 This option only impacts the HTTP server.
1877 This option only impacts the HTTP server.
1874
1878
1875 ``zstdlevel``
1879 ``zstdlevel``
1876 Integer between ``1`` and ``22`` that controls the zstd compression level
1880 Integer between ``1`` and ``22`` that controls the zstd compression level
1877 for wire protocol commands. ``1`` is the minimal amount of compression and
1881 for wire protocol commands. ``1`` is the minimal amount of compression and
1878 ``22`` is the highest amount of compression.
1882 ``22`` is the highest amount of compression.
1879
1883
1880 The default (``3``) should be significantly faster than zlib while likely
1884 The default (``3``) should be significantly faster than zlib while likely
1881 delivering better compression ratios.
1885 delivering better compression ratios.
1882
1886
1883 This option only impacts the HTTP server.
1887 This option only impacts the HTTP server.
1884
1888
1885 See also ``server.zliblevel``.
1889 See also ``server.zliblevel``.
1886
1890
1887 ``smtp``
1891 ``smtp``
1888 --------
1892 --------
1889
1893
1890 Configuration for extensions that need to send email messages.
1894 Configuration for extensions that need to send email messages.
1891
1895
1892 ``host``
1896 ``host``
1893 Host name of mail server, e.g. "mail.example.com".
1897 Host name of mail server, e.g. "mail.example.com".
1894
1898
1895 ``port``
1899 ``port``
1896 Optional. Port to connect to on mail server. (default: 465 if
1900 Optional. Port to connect to on mail server. (default: 465 if
1897 ``tls`` is smtps; 25 otherwise)
1901 ``tls`` is smtps; 25 otherwise)
1898
1902
1899 ``tls``
1903 ``tls``
1900 Optional. Method to enable TLS when connecting to mail server: starttls,
1904 Optional. Method to enable TLS when connecting to mail server: starttls,
1901 smtps or none. (default: none)
1905 smtps or none. (default: none)
1902
1906
1903 ``username``
1907 ``username``
1904 Optional. User name for authenticating with the SMTP server.
1908 Optional. User name for authenticating with the SMTP server.
1905 (default: None)
1909 (default: None)
1906
1910
1907 ``password``
1911 ``password``
1908 Optional. Password for authenticating with the SMTP server. If not
1912 Optional. Password for authenticating with the SMTP server. If not
1909 specified, interactive sessions will prompt the user for a
1913 specified, interactive sessions will prompt the user for a
1910 password; non-interactive sessions will fail. (default: None)
1914 password; non-interactive sessions will fail. (default: None)
1911
1915
1912 ``local_hostname``
1916 ``local_hostname``
1913 Optional. The hostname that the sender can use to identify
1917 Optional. The hostname that the sender can use to identify
1914 itself to the MTA.
1918 itself to the MTA.
1915
1919
1916
1920
1917 ``subpaths``
1921 ``subpaths``
1918 ------------
1922 ------------
1919
1923
1920 Subrepository source URLs can go stale if a remote server changes name
1924 Subrepository source URLs can go stale if a remote server changes name
1921 or becomes temporarily unavailable. This section lets you define
1925 or becomes temporarily unavailable. This section lets you define
1922 rewrite rules of the form::
1926 rewrite rules of the form::
1923
1927
1924 <pattern> = <replacement>
1928 <pattern> = <replacement>
1925
1929
1926 where ``pattern`` is a regular expression matching a subrepository
1930 where ``pattern`` is a regular expression matching a subrepository
1927 source URL and ``replacement`` is the replacement string used to
1931 source URL and ``replacement`` is the replacement string used to
1928 rewrite it. Groups can be matched in ``pattern`` and referenced in
1932 rewrite it. Groups can be matched in ``pattern`` and referenced in
1929 ``replacements``. For instance::
1933 ``replacements``. For instance::
1930
1934
1931 http://server/(.*)-hg/ = http://hg.server/\1/
1935 http://server/(.*)-hg/ = http://hg.server/\1/
1932
1936
1933 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1937 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1934
1938
1935 Relative subrepository paths are first made absolute, and the
1939 Relative subrepository paths are first made absolute, and the
1936 rewrite rules are then applied on the full (absolute) path. If ``pattern``
1940 rewrite rules are then applied on the full (absolute) path. If ``pattern``
1937 doesn't match the full path, an attempt is made to apply it on the
1941 doesn't match the full path, an attempt is made to apply it on the
1938 relative path alone. The rules are applied in definition order.
1942 relative path alone. The rules are applied in definition order.
1939
1943
1940 ``subrepos``
1944 ``subrepos``
1941 ------------
1945 ------------
1942
1946
1943 This section contains options that control the behavior of the
1947 This section contains options that control the behavior of the
1944 subrepositories feature. See also :hg:`help subrepos`.
1948 subrepositories feature. See also :hg:`help subrepos`.
1945
1949
1946 Security note: auditing in Mercurial is known to be insufficient to
1950 Security note: auditing in Mercurial is known to be insufficient to
1947 prevent clone-time code execution with carefully constructed Git
1951 prevent clone-time code execution with carefully constructed Git
1948 subrepos. It is unknown if a similar detect is present in Subversion
1952 subrepos. It is unknown if a similar detect is present in Subversion
1949 subrepos. Both Git and Subversion subrepos are disabled by default
1953 subrepos. Both Git and Subversion subrepos are disabled by default
1950 out of security concerns. These subrepo types can be enabled using
1954 out of security concerns. These subrepo types can be enabled using
1951 the respective options below.
1955 the respective options below.
1952
1956
1953 ``allowed``
1957 ``allowed``
1954 Whether subrepositories are allowed in the working directory.
1958 Whether subrepositories are allowed in the working directory.
1955
1959
1956 When false, commands involving subrepositories (like :hg:`update`)
1960 When false, commands involving subrepositories (like :hg:`update`)
1957 will fail for all subrepository types.
1961 will fail for all subrepository types.
1958 (default: true)
1962 (default: true)
1959
1963
1960 ``hg:allowed``
1964 ``hg:allowed``
1961 Whether Mercurial subrepositories are allowed in the working
1965 Whether Mercurial subrepositories are allowed in the working
1962 directory. This option only has an effect if ``subrepos.allowed``
1966 directory. This option only has an effect if ``subrepos.allowed``
1963 is true.
1967 is true.
1964 (default: true)
1968 (default: true)
1965
1969
1966 ``git:allowed``
1970 ``git:allowed``
1967 Whether Git subrepositories are allowed in the working directory.
1971 Whether Git subrepositories are allowed in the working directory.
1968 This option only has an effect if ``subrepos.allowed`` is true.
1972 This option only has an effect if ``subrepos.allowed`` is true.
1969
1973
1970 See the security note above before enabling Git subrepos.
1974 See the security note above before enabling Git subrepos.
1971 (default: false)
1975 (default: false)
1972
1976
1973 ``svn:allowed``
1977 ``svn:allowed``
1974 Whether Subversion subrepositories are allowed in the working
1978 Whether Subversion subrepositories are allowed in the working
1975 directory. This option only has an effect if ``subrepos.allowed``
1979 directory. This option only has an effect if ``subrepos.allowed``
1976 is true.
1980 is true.
1977
1981
1978 See the security note above before enabling Subversion subrepos.
1982 See the security note above before enabling Subversion subrepos.
1979 (default: false)
1983 (default: false)
1980
1984
1981 ``templatealias``
1985 ``templatealias``
1982 -----------------
1986 -----------------
1983
1987
1984 Alias definitions for templates. See :hg:`help templates` for details.
1988 Alias definitions for templates. See :hg:`help templates` for details.
1985
1989
1986 ``templates``
1990 ``templates``
1987 -------------
1991 -------------
1988
1992
1989 Use the ``[templates]`` section to define template strings.
1993 Use the ``[templates]`` section to define template strings.
1990 See :hg:`help templates` for details.
1994 See :hg:`help templates` for details.
1991
1995
1992 ``trusted``
1996 ``trusted``
1993 -----------
1997 -----------
1994
1998
1995 Mercurial will not use the settings in the
1999 Mercurial will not use the settings in the
1996 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2000 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1997 user or to a trusted group, as various hgrc features allow arbitrary
2001 user or to a trusted group, as various hgrc features allow arbitrary
1998 commands to be run. This issue is often encountered when configuring
2002 commands to be run. This issue is often encountered when configuring
1999 hooks or extensions for shared repositories or servers. However,
2003 hooks or extensions for shared repositories or servers. However,
2000 the web interface will use some safe settings from the ``[web]``
2004 the web interface will use some safe settings from the ``[web]``
2001 section.
2005 section.
2002
2006
2003 This section specifies what users and groups are trusted. The
2007 This section specifies what users and groups are trusted. The
2004 current user is always trusted. To trust everybody, list a user or a
2008 current user is always trusted. To trust everybody, list a user or a
2005 group with name ``*``. These settings must be placed in an
2009 group with name ``*``. These settings must be placed in an
2006 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2010 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2007 user or service running Mercurial.
2011 user or service running Mercurial.
2008
2012
2009 ``users``
2013 ``users``
2010 Comma-separated list of trusted users.
2014 Comma-separated list of trusted users.
2011
2015
2012 ``groups``
2016 ``groups``
2013 Comma-separated list of trusted groups.
2017 Comma-separated list of trusted groups.
2014
2018
2015
2019
2016 ``ui``
2020 ``ui``
2017 ------
2021 ------
2018
2022
2019 User interface controls.
2023 User interface controls.
2020
2024
2021 ``archivemeta``
2025 ``archivemeta``
2022 Whether to include the .hg_archival.txt file containing meta data
2026 Whether to include the .hg_archival.txt file containing meta data
2023 (hashes for the repository base and for tip) in archives created
2027 (hashes for the repository base and for tip) in archives created
2024 by the :hg:`archive` command or downloaded via hgweb.
2028 by the :hg:`archive` command or downloaded via hgweb.
2025 (default: True)
2029 (default: True)
2026
2030
2027 ``askusername``
2031 ``askusername``
2028 Whether to prompt for a username when committing. If True, and
2032 Whether to prompt for a username when committing. If True, and
2029 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2033 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2030 be prompted to enter a username. If no username is entered, the
2034 be prompted to enter a username. If no username is entered, the
2031 default ``USER@HOST`` is used instead.
2035 default ``USER@HOST`` is used instead.
2032 (default: False)
2036 (default: False)
2033
2037
2034 ``clonebundles``
2038 ``clonebundles``
2035 Whether the "clone bundles" feature is enabled.
2039 Whether the "clone bundles" feature is enabled.
2036
2040
2037 When enabled, :hg:`clone` may download and apply a server-advertised
2041 When enabled, :hg:`clone` may download and apply a server-advertised
2038 bundle file from a URL instead of using the normal exchange mechanism.
2042 bundle file from a URL instead of using the normal exchange mechanism.
2039
2043
2040 This can likely result in faster and more reliable clones.
2044 This can likely result in faster and more reliable clones.
2041
2045
2042 (default: True)
2046 (default: True)
2043
2047
2044 ``clonebundlefallback``
2048 ``clonebundlefallback``
2045 Whether failure to apply an advertised "clone bundle" from a server
2049 Whether failure to apply an advertised "clone bundle" from a server
2046 should result in fallback to a regular clone.
2050 should result in fallback to a regular clone.
2047
2051
2048 This is disabled by default because servers advertising "clone
2052 This is disabled by default because servers advertising "clone
2049 bundles" often do so to reduce server load. If advertised bundles
2053 bundles" often do so to reduce server load. If advertised bundles
2050 start mass failing and clients automatically fall back to a regular
2054 start mass failing and clients automatically fall back to a regular
2051 clone, this would add significant and unexpected load to the server
2055 clone, this would add significant and unexpected load to the server
2052 since the server is expecting clone operations to be offloaded to
2056 since the server is expecting clone operations to be offloaded to
2053 pre-generated bundles. Failing fast (the default behavior) ensures
2057 pre-generated bundles. Failing fast (the default behavior) ensures
2054 clients don't overwhelm the server when "clone bundle" application
2058 clients don't overwhelm the server when "clone bundle" application
2055 fails.
2059 fails.
2056
2060
2057 (default: False)
2061 (default: False)
2058
2062
2059 ``clonebundleprefers``
2063 ``clonebundleprefers``
2060 Defines preferences for which "clone bundles" to use.
2064 Defines preferences for which "clone bundles" to use.
2061
2065
2062 Servers advertising "clone bundles" may advertise multiple available
2066 Servers advertising "clone bundles" may advertise multiple available
2063 bundles. Each bundle may have different attributes, such as the bundle
2067 bundles. Each bundle may have different attributes, such as the bundle
2064 type and compression format. This option is used to prefer a particular
2068 type and compression format. This option is used to prefer a particular
2065 bundle over another.
2069 bundle over another.
2066
2070
2067 The following keys are defined by Mercurial:
2071 The following keys are defined by Mercurial:
2068
2072
2069 BUNDLESPEC
2073 BUNDLESPEC
2070 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2074 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2071 e.g. ``gzip-v2`` or ``bzip2-v1``.
2075 e.g. ``gzip-v2`` or ``bzip2-v1``.
2072
2076
2073 COMPRESSION
2077 COMPRESSION
2074 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2078 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2075
2079
2076 Server operators may define custom keys.
2080 Server operators may define custom keys.
2077
2081
2078 Example values: ``COMPRESSION=bzip2``,
2082 Example values: ``COMPRESSION=bzip2``,
2079 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2083 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2080
2084
2081 By default, the first bundle advertised by the server is used.
2085 By default, the first bundle advertised by the server is used.
2082
2086
2083 ``color``
2087 ``color``
2084 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2088 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2085 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2089 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2086 seems possible. See :hg:`help color` for details.
2090 seems possible. See :hg:`help color` for details.
2087
2091
2088 ``commitsubrepos``
2092 ``commitsubrepos``
2089 Whether to commit modified subrepositories when committing the
2093 Whether to commit modified subrepositories when committing the
2090 parent repository. If False and one subrepository has uncommitted
2094 parent repository. If False and one subrepository has uncommitted
2091 changes, abort the commit.
2095 changes, abort the commit.
2092 (default: False)
2096 (default: False)
2093
2097
2094 ``debug``
2098 ``debug``
2095 Print debugging information. (default: False)
2099 Print debugging information. (default: False)
2096
2100
2097 ``editor``
2101 ``editor``
2098 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2102 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2099
2103
2100 ``fallbackencoding``
2104 ``fallbackencoding``
2101 Encoding to try if it's not possible to decode the changelog using
2105 Encoding to try if it's not possible to decode the changelog using
2102 UTF-8. (default: ISO-8859-1)
2106 UTF-8. (default: ISO-8859-1)
2103
2107
2104 ``graphnodetemplate``
2108 ``graphnodetemplate``
2105 The template used to print changeset nodes in an ASCII revision graph.
2109 The template used to print changeset nodes in an ASCII revision graph.
2106 (default: ``{graphnode}``)
2110 (default: ``{graphnode}``)
2107
2111
2108 ``ignore``
2112 ``ignore``
2109 A file to read per-user ignore patterns from. This file should be
2113 A file to read per-user ignore patterns from. This file should be
2110 in the same format as a repository-wide .hgignore file. Filenames
2114 in the same format as a repository-wide .hgignore file. Filenames
2111 are relative to the repository root. This option supports hook syntax,
2115 are relative to the repository root. This option supports hook syntax,
2112 so if you want to specify multiple ignore files, you can do so by
2116 so if you want to specify multiple ignore files, you can do so by
2113 setting something like ``ignore.other = ~/.hgignore2``. For details
2117 setting something like ``ignore.other = ~/.hgignore2``. For details
2114 of the ignore file format, see the ``hgignore(5)`` man page.
2118 of the ignore file format, see the ``hgignore(5)`` man page.
2115
2119
2116 ``interactive``
2120 ``interactive``
2117 Allow to prompt the user. (default: True)
2121 Allow to prompt the user. (default: True)
2118
2122
2119 ``interface``
2123 ``interface``
2120 Select the default interface for interactive features (default: text).
2124 Select the default interface for interactive features (default: text).
2121 Possible values are 'text' and 'curses'.
2125 Possible values are 'text' and 'curses'.
2122
2126
2123 ``interface.chunkselector``
2127 ``interface.chunkselector``
2124 Select the interface for change recording (e.g. :hg:`commit -i`).
2128 Select the interface for change recording (e.g. :hg:`commit -i`).
2125 Possible values are 'text' and 'curses'.
2129 Possible values are 'text' and 'curses'.
2126 This config overrides the interface specified by ui.interface.
2130 This config overrides the interface specified by ui.interface.
2127
2131
2128 ``logtemplate``
2132 ``logtemplate``
2129 Template string for commands that print changesets.
2133 Template string for commands that print changesets.
2130
2134
2131 ``merge``
2135 ``merge``
2132 The conflict resolution program to use during a manual merge.
2136 The conflict resolution program to use during a manual merge.
2133 For more information on merge tools see :hg:`help merge-tools`.
2137 For more information on merge tools see :hg:`help merge-tools`.
2134 For configuring merge tools see the ``[merge-tools]`` section.
2138 For configuring merge tools see the ``[merge-tools]`` section.
2135
2139
2136 ``mergemarkers``
2140 ``mergemarkers``
2137 Sets the merge conflict marker label styling. The ``detailed``
2141 Sets the merge conflict marker label styling. The ``detailed``
2138 style uses the ``mergemarkertemplate`` setting to style the labels.
2142 style uses the ``mergemarkertemplate`` setting to style the labels.
2139 The ``basic`` style just uses 'local' and 'other' as the marker label.
2143 The ``basic`` style just uses 'local' and 'other' as the marker label.
2140 One of ``basic`` or ``detailed``.
2144 One of ``basic`` or ``detailed``.
2141 (default: ``basic``)
2145 (default: ``basic``)
2142
2146
2143 ``mergemarkertemplate``
2147 ``mergemarkertemplate``
2144 The template used to print the commit description next to each conflict
2148 The template used to print the commit description next to each conflict
2145 marker during merge conflicts. See :hg:`help templates` for the template
2149 marker during merge conflicts. See :hg:`help templates` for the template
2146 format.
2150 format.
2147
2151
2148 Defaults to showing the hash, tags, branches, bookmarks, author, and
2152 Defaults to showing the hash, tags, branches, bookmarks, author, and
2149 the first line of the commit description.
2153 the first line of the commit description.
2150
2154
2151 If you use non-ASCII characters in names for tags, branches, bookmarks,
2155 If you use non-ASCII characters in names for tags, branches, bookmarks,
2152 authors, and/or commit descriptions, you must pay attention to encodings of
2156 authors, and/or commit descriptions, you must pay attention to encodings of
2153 managed files. At template expansion, non-ASCII characters use the encoding
2157 managed files. At template expansion, non-ASCII characters use the encoding
2154 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2158 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2155 environment variables that govern your locale. If the encoding of the merge
2159 environment variables that govern your locale. If the encoding of the merge
2156 markers is different from the encoding of the merged files,
2160 markers is different from the encoding of the merged files,
2157 serious problems may occur.
2161 serious problems may occur.
2158
2162
2159 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2163 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2160
2164
2161 ``origbackuppath``
2165 ``origbackuppath``
2162 The path to a directory used to store generated .orig files. If the path is
2166 The path to a directory used to store generated .orig files. If the path is
2163 not a directory, one will be created. If set, files stored in this
2167 not a directory, one will be created. If set, files stored in this
2164 directory have the same name as the original file and do not have a .orig
2168 directory have the same name as the original file and do not have a .orig
2165 suffix.
2169 suffix.
2166
2170
2167 ``paginate``
2171 ``paginate``
2168 Control the pagination of command output (default: True). See :hg:`help pager`
2172 Control the pagination of command output (default: True). See :hg:`help pager`
2169 for details.
2173 for details.
2170
2174
2171 ``patch``
2175 ``patch``
2172 An optional external tool that ``hg import`` and some extensions
2176 An optional external tool that ``hg import`` and some extensions
2173 will use for applying patches. By default Mercurial uses an
2177 will use for applying patches. By default Mercurial uses an
2174 internal patch utility. The external tool must work as the common
2178 internal patch utility. The external tool must work as the common
2175 Unix ``patch`` program. In particular, it must accept a ``-p``
2179 Unix ``patch`` program. In particular, it must accept a ``-p``
2176 argument to strip patch headers, a ``-d`` argument to specify the
2180 argument to strip patch headers, a ``-d`` argument to specify the
2177 current directory, a file name to patch, and a patch file to take
2181 current directory, a file name to patch, and a patch file to take
2178 from stdin.
2182 from stdin.
2179
2183
2180 It is possible to specify a patch tool together with extra
2184 It is possible to specify a patch tool together with extra
2181 arguments. For example, setting this option to ``patch --merge``
2185 arguments. For example, setting this option to ``patch --merge``
2182 will use the ``patch`` program with its 2-way merge option.
2186 will use the ``patch`` program with its 2-way merge option.
2183
2187
2184 ``portablefilenames``
2188 ``portablefilenames``
2185 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2189 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2186 (default: ``warn``)
2190 (default: ``warn``)
2187
2191
2188 ``warn``
2192 ``warn``
2189 Print a warning message on POSIX platforms, if a file with a non-portable
2193 Print a warning message on POSIX platforms, if a file with a non-portable
2190 filename is added (e.g. a file with a name that can't be created on
2194 filename is added (e.g. a file with a name that can't be created on
2191 Windows because it contains reserved parts like ``AUX``, reserved
2195 Windows because it contains reserved parts like ``AUX``, reserved
2192 characters like ``:``, or would cause a case collision with an existing
2196 characters like ``:``, or would cause a case collision with an existing
2193 file).
2197 file).
2194
2198
2195 ``ignore``
2199 ``ignore``
2196 Don't print a warning.
2200 Don't print a warning.
2197
2201
2198 ``abort``
2202 ``abort``
2199 The command is aborted.
2203 The command is aborted.
2200
2204
2201 ``true``
2205 ``true``
2202 Alias for ``warn``.
2206 Alias for ``warn``.
2203
2207
2204 ``false``
2208 ``false``
2205 Alias for ``ignore``.
2209 Alias for ``ignore``.
2206
2210
2207 .. container:: windows
2211 .. container:: windows
2208
2212
2209 On Windows, this configuration option is ignored and the command aborted.
2213 On Windows, this configuration option is ignored and the command aborted.
2210
2214
2211 ``quiet``
2215 ``quiet``
2212 Reduce the amount of output printed.
2216 Reduce the amount of output printed.
2213 (default: False)
2217 (default: False)
2214
2218
2215 ``remotecmd``
2219 ``remotecmd``
2216 Remote command to use for clone/push/pull operations.
2220 Remote command to use for clone/push/pull operations.
2217 (default: ``hg``)
2221 (default: ``hg``)
2218
2222
2219 ``report_untrusted``
2223 ``report_untrusted``
2220 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2224 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2221 trusted user or group.
2225 trusted user or group.
2222 (default: True)
2226 (default: True)
2223
2227
2224 ``slash``
2228 ``slash``
2225 (Deprecated. Use ``slashpath`` template filter instead.)
2229 (Deprecated. Use ``slashpath`` template filter instead.)
2226
2230
2227 Display paths using a slash (``/``) as the path separator. This
2231 Display paths using a slash (``/``) as the path separator. This
2228 only makes a difference on systems where the default path
2232 only makes a difference on systems where the default path
2229 separator is not the slash character (e.g. Windows uses the
2233 separator is not the slash character (e.g. Windows uses the
2230 backslash character (``\``)).
2234 backslash character (``\``)).
2231 (default: False)
2235 (default: False)
2232
2236
2233 ``statuscopies``
2237 ``statuscopies``
2234 Display copies in the status command.
2238 Display copies in the status command.
2235
2239
2236 ``ssh``
2240 ``ssh``
2237 Command to use for SSH connections. (default: ``ssh``)
2241 Command to use for SSH connections. (default: ``ssh``)
2238
2242
2239 ``ssherrorhint``
2243 ``ssherrorhint``
2240 A hint shown to the user in the case of SSH error (e.g.
2244 A hint shown to the user in the case of SSH error (e.g.
2241 ``Please see http://company/internalwiki/ssh.html``)
2245 ``Please see http://company/internalwiki/ssh.html``)
2242
2246
2243 ``strict``
2247 ``strict``
2244 Require exact command names, instead of allowing unambiguous
2248 Require exact command names, instead of allowing unambiguous
2245 abbreviations. (default: False)
2249 abbreviations. (default: False)
2246
2250
2247 ``style``
2251 ``style``
2248 Name of style to use for command output.
2252 Name of style to use for command output.
2249
2253
2250 ``supportcontact``
2254 ``supportcontact``
2251 A URL where users should report a Mercurial traceback. Use this if you are a
2255 A URL where users should report a Mercurial traceback. Use this if you are a
2252 large organisation with its own Mercurial deployment process and crash
2256 large organisation with its own Mercurial deployment process and crash
2253 reports should be addressed to your internal support.
2257 reports should be addressed to your internal support.
2254
2258
2255 ``textwidth``
2259 ``textwidth``
2256 Maximum width of help text. A longer line generated by ``hg help`` or
2260 Maximum width of help text. A longer line generated by ``hg help`` or
2257 ``hg subcommand --help`` will be broken after white space to get this
2261 ``hg subcommand --help`` will be broken after white space to get this
2258 width or the terminal width, whichever comes first.
2262 width or the terminal width, whichever comes first.
2259 A non-positive value will disable this and the terminal width will be
2263 A non-positive value will disable this and the terminal width will be
2260 used. (default: 78)
2264 used. (default: 78)
2261
2265
2262 ``timeout``
2266 ``timeout``
2263 The timeout used when a lock is held (in seconds), a negative value
2267 The timeout used when a lock is held (in seconds), a negative value
2264 means no timeout. (default: 600)
2268 means no timeout. (default: 600)
2265
2269
2266 ``timeout.warn``
2270 ``timeout.warn``
2267 Time (in seconds) before a warning is printed about held lock. A negative
2271 Time (in seconds) before a warning is printed about held lock. A negative
2268 value means no warning. (default: 0)
2272 value means no warning. (default: 0)
2269
2273
2270 ``traceback``
2274 ``traceback``
2271 Mercurial always prints a traceback when an unknown exception
2275 Mercurial always prints a traceback when an unknown exception
2272 occurs. Setting this to True will make Mercurial print a traceback
2276 occurs. Setting this to True will make Mercurial print a traceback
2273 on all exceptions, even those recognized by Mercurial (such as
2277 on all exceptions, even those recognized by Mercurial (such as
2274 IOError or MemoryError). (default: False)
2278 IOError or MemoryError). (default: False)
2275
2279
2276 ``tweakdefaults``
2280 ``tweakdefaults``
2277
2281
2278 By default Mercurial's behavior changes very little from release
2282 By default Mercurial's behavior changes very little from release
2279 to release, but over time the recommended config settings
2283 to release, but over time the recommended config settings
2280 shift. Enable this config to opt in to get automatic tweaks to
2284 shift. Enable this config to opt in to get automatic tweaks to
2281 Mercurial's behavior over time. This config setting will have no
2285 Mercurial's behavior over time. This config setting will have no
2282 effet if ``HGPLAIN` is set or ``HGPLAINEXCEPT`` is set and does
2286 effet if ``HGPLAIN` is set or ``HGPLAINEXCEPT`` is set and does
2283 not include ``tweakdefaults``. (default: False)
2287 not include ``tweakdefaults``. (default: False)
2284
2288
2285 ``username``
2289 ``username``
2286 The committer of a changeset created when running "commit".
2290 The committer of a changeset created when running "commit".
2287 Typically a person's name and email address, e.g. ``Fred Widget
2291 Typically a person's name and email address, e.g. ``Fred Widget
2288 <fred@example.com>``. Environment variables in the
2292 <fred@example.com>``. Environment variables in the
2289 username are expanded.
2293 username are expanded.
2290
2294
2291 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2295 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2292 hgrc is empty, e.g. if the system admin set ``username =`` in the
2296 hgrc is empty, e.g. if the system admin set ``username =`` in the
2293 system hgrc, it has to be specified manually or in a different
2297 system hgrc, it has to be specified manually or in a different
2294 hgrc file)
2298 hgrc file)
2295
2299
2296 ``verbose``
2300 ``verbose``
2297 Increase the amount of output printed. (default: False)
2301 Increase the amount of output printed. (default: False)
2298
2302
2299
2303
2300 ``web``
2304 ``web``
2301 -------
2305 -------
2302
2306
2303 Web interface configuration. The settings in this section apply to
2307 Web interface configuration. The settings in this section apply to
2304 both the builtin webserver (started by :hg:`serve`) and the script you
2308 both the builtin webserver (started by :hg:`serve`) and the script you
2305 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2309 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2306 and WSGI).
2310 and WSGI).
2307
2311
2308 The Mercurial webserver does no authentication (it does not prompt for
2312 The Mercurial webserver does no authentication (it does not prompt for
2309 usernames and passwords to validate *who* users are), but it does do
2313 usernames and passwords to validate *who* users are), but it does do
2310 authorization (it grants or denies access for *authenticated users*
2314 authorization (it grants or denies access for *authenticated users*
2311 based on settings in this section). You must either configure your
2315 based on settings in this section). You must either configure your
2312 webserver to do authentication for you, or disable the authorization
2316 webserver to do authentication for you, or disable the authorization
2313 checks.
2317 checks.
2314
2318
2315 For a quick setup in a trusted environment, e.g., a private LAN, where
2319 For a quick setup in a trusted environment, e.g., a private LAN, where
2316 you want it to accept pushes from anybody, you can use the following
2320 you want it to accept pushes from anybody, you can use the following
2317 command line::
2321 command line::
2318
2322
2319 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2323 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2320
2324
2321 Note that this will allow anybody to push anything to the server and
2325 Note that this will allow anybody to push anything to the server and
2322 that this should not be used for public servers.
2326 that this should not be used for public servers.
2323
2327
2324 The full set of options is:
2328 The full set of options is:
2325
2329
2326 ``accesslog``
2330 ``accesslog``
2327 Where to output the access log. (default: stdout)
2331 Where to output the access log. (default: stdout)
2328
2332
2329 ``address``
2333 ``address``
2330 Interface address to bind to. (default: all)
2334 Interface address to bind to. (default: all)
2331
2335
2332 ``allow-archive``
2336 ``allow-archive``
2333 List of archive format (bz2, gz, zip) allowed for downloading.
2337 List of archive format (bz2, gz, zip) allowed for downloading.
2334 (default: empty)
2338 (default: empty)
2335
2339
2336 ``allowbz2``
2340 ``allowbz2``
2337 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2341 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2338 revisions.
2342 revisions.
2339 (default: False)
2343 (default: False)
2340
2344
2341 ``allowgz``
2345 ``allowgz``
2342 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2346 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2343 revisions.
2347 revisions.
2344 (default: False)
2348 (default: False)
2345
2349
2346 ``allow-pull``
2350 ``allow-pull``
2347 Whether to allow pulling from the repository. (default: True)
2351 Whether to allow pulling from the repository. (default: True)
2348
2352
2349 ``allow-push``
2353 ``allow-push``
2350 Whether to allow pushing to the repository. If empty or not set,
2354 Whether to allow pushing to the repository. If empty or not set,
2351 pushing is not allowed. If the special value ``*``, any remote
2355 pushing is not allowed. If the special value ``*``, any remote
2352 user can push, including unauthenticated users. Otherwise, the
2356 user can push, including unauthenticated users. Otherwise, the
2353 remote user must have been authenticated, and the authenticated
2357 remote user must have been authenticated, and the authenticated
2354 user name must be present in this list. The contents of the
2358 user name must be present in this list. The contents of the
2355 allow-push list are examined after the deny_push list.
2359 allow-push list are examined after the deny_push list.
2356
2360
2357 ``allow_read``
2361 ``allow_read``
2358 If the user has not already been denied repository access due to
2362 If the user has not already been denied repository access due to
2359 the contents of deny_read, this list determines whether to grant
2363 the contents of deny_read, this list determines whether to grant
2360 repository access to the user. If this list is not empty, and the
2364 repository access to the user. If this list is not empty, and the
2361 user is unauthenticated or not present in the list, then access is
2365 user is unauthenticated or not present in the list, then access is
2362 denied for the user. If the list is empty or not set, then access
2366 denied for the user. If the list is empty or not set, then access
2363 is permitted to all users by default. Setting allow_read to the
2367 is permitted to all users by default. Setting allow_read to the
2364 special value ``*`` is equivalent to it not being set (i.e. access
2368 special value ``*`` is equivalent to it not being set (i.e. access
2365 is permitted to all users). The contents of the allow_read list are
2369 is permitted to all users). The contents of the allow_read list are
2366 examined after the deny_read list.
2370 examined after the deny_read list.
2367
2371
2368 ``allowzip``
2372 ``allowzip``
2369 (DEPRECATED) Whether to allow .zip downloading of repository
2373 (DEPRECATED) Whether to allow .zip downloading of repository
2370 revisions. This feature creates temporary files.
2374 revisions. This feature creates temporary files.
2371 (default: False)
2375 (default: False)
2372
2376
2373 ``archivesubrepos``
2377 ``archivesubrepos``
2374 Whether to recurse into subrepositories when archiving.
2378 Whether to recurse into subrepositories when archiving.
2375 (default: False)
2379 (default: False)
2376
2380
2377 ``baseurl``
2381 ``baseurl``
2378 Base URL to use when publishing URLs in other locations, so
2382 Base URL to use when publishing URLs in other locations, so
2379 third-party tools like email notification hooks can construct
2383 third-party tools like email notification hooks can construct
2380 URLs. Example: ``http://hgserver/repos/``.
2384 URLs. Example: ``http://hgserver/repos/``.
2381
2385
2382 ``cacerts``
2386 ``cacerts``
2383 Path to file containing a list of PEM encoded certificate
2387 Path to file containing a list of PEM encoded certificate
2384 authority certificates. Environment variables and ``~user``
2388 authority certificates. Environment variables and ``~user``
2385 constructs are expanded in the filename. If specified on the
2389 constructs are expanded in the filename. If specified on the
2386 client, then it will verify the identity of remote HTTPS servers
2390 client, then it will verify the identity of remote HTTPS servers
2387 with these certificates.
2391 with these certificates.
2388
2392
2389 To disable SSL verification temporarily, specify ``--insecure`` from
2393 To disable SSL verification temporarily, specify ``--insecure`` from
2390 command line.
2394 command line.
2391
2395
2392 You can use OpenSSL's CA certificate file if your platform has
2396 You can use OpenSSL's CA certificate file if your platform has
2393 one. On most Linux systems this will be
2397 one. On most Linux systems this will be
2394 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2398 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2395 generate this file manually. The form must be as follows::
2399 generate this file manually. The form must be as follows::
2396
2400
2397 -----BEGIN CERTIFICATE-----
2401 -----BEGIN CERTIFICATE-----
2398 ... (certificate in base64 PEM encoding) ...
2402 ... (certificate in base64 PEM encoding) ...
2399 -----END CERTIFICATE-----
2403 -----END CERTIFICATE-----
2400 -----BEGIN CERTIFICATE-----
2404 -----BEGIN CERTIFICATE-----
2401 ... (certificate in base64 PEM encoding) ...
2405 ... (certificate in base64 PEM encoding) ...
2402 -----END CERTIFICATE-----
2406 -----END CERTIFICATE-----
2403
2407
2404 ``cache``
2408 ``cache``
2405 Whether to support caching in hgweb. (default: True)
2409 Whether to support caching in hgweb. (default: True)
2406
2410
2407 ``certificate``
2411 ``certificate``
2408 Certificate to use when running :hg:`serve`.
2412 Certificate to use when running :hg:`serve`.
2409
2413
2410 ``collapse``
2414 ``collapse``
2411 With ``descend`` enabled, repositories in subdirectories are shown at
2415 With ``descend`` enabled, repositories in subdirectories are shown at
2412 a single level alongside repositories in the current path. With
2416 a single level alongside repositories in the current path. With
2413 ``collapse`` also enabled, repositories residing at a deeper level than
2417 ``collapse`` also enabled, repositories residing at a deeper level than
2414 the current path are grouped behind navigable directory entries that
2418 the current path are grouped behind navigable directory entries that
2415 lead to the locations of these repositories. In effect, this setting
2419 lead to the locations of these repositories. In effect, this setting
2416 collapses each collection of repositories found within a subdirectory
2420 collapses each collection of repositories found within a subdirectory
2417 into a single entry for that subdirectory. (default: False)
2421 into a single entry for that subdirectory. (default: False)
2418
2422
2419 ``comparisoncontext``
2423 ``comparisoncontext``
2420 Number of lines of context to show in side-by-side file comparison. If
2424 Number of lines of context to show in side-by-side file comparison. If
2421 negative or the value ``full``, whole files are shown. (default: 5)
2425 negative or the value ``full``, whole files are shown. (default: 5)
2422
2426
2423 This setting can be overridden by a ``context`` request parameter to the
2427 This setting can be overridden by a ``context`` request parameter to the
2424 ``comparison`` command, taking the same values.
2428 ``comparison`` command, taking the same values.
2425
2429
2426 ``contact``
2430 ``contact``
2427 Name or email address of the person in charge of the repository.
2431 Name or email address of the person in charge of the repository.
2428 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2432 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2429
2433
2430 ``csp``
2434 ``csp``
2431 Send a ``Content-Security-Policy`` HTTP header with this value.
2435 Send a ``Content-Security-Policy`` HTTP header with this value.
2432
2436
2433 The value may contain a special string ``%nonce%``, which will be replaced
2437 The value may contain a special string ``%nonce%``, which will be replaced
2434 by a randomly-generated one-time use value. If the value contains
2438 by a randomly-generated one-time use value. If the value contains
2435 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2439 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2436 one-time property of the nonce. This nonce will also be inserted into
2440 one-time property of the nonce. This nonce will also be inserted into
2437 ``<script>`` elements containing inline JavaScript.
2441 ``<script>`` elements containing inline JavaScript.
2438
2442
2439 Note: lots of HTML content sent by the server is derived from repository
2443 Note: lots of HTML content sent by the server is derived from repository
2440 data. Please consider the potential for malicious repository data to
2444 data. Please consider the potential for malicious repository data to
2441 "inject" itself into generated HTML content as part of your security
2445 "inject" itself into generated HTML content as part of your security
2442 threat model.
2446 threat model.
2443
2447
2444 ``deny_push``
2448 ``deny_push``
2445 Whether to deny pushing to the repository. If empty or not set,
2449 Whether to deny pushing to the repository. If empty or not set,
2446 push is not denied. If the special value ``*``, all remote users are
2450 push is not denied. If the special value ``*``, all remote users are
2447 denied push. Otherwise, unauthenticated users are all denied, and
2451 denied push. Otherwise, unauthenticated users are all denied, and
2448 any authenticated user name present in this list is also denied. The
2452 any authenticated user name present in this list is also denied. The
2449 contents of the deny_push list are examined before the allow-push list.
2453 contents of the deny_push list are examined before the allow-push list.
2450
2454
2451 ``deny_read``
2455 ``deny_read``
2452 Whether to deny reading/viewing of the repository. If this list is
2456 Whether to deny reading/viewing of the repository. If this list is
2453 not empty, unauthenticated users are all denied, and any
2457 not empty, unauthenticated users are all denied, and any
2454 authenticated user name present in this list is also denied access to
2458 authenticated user name present in this list is also denied access to
2455 the repository. If set to the special value ``*``, all remote users
2459 the repository. If set to the special value ``*``, all remote users
2456 are denied access (rarely needed ;). If deny_read is empty or not set,
2460 are denied access (rarely needed ;). If deny_read is empty or not set,
2457 the determination of repository access depends on the presence and
2461 the determination of repository access depends on the presence and
2458 content of the allow_read list (see description). If both
2462 content of the allow_read list (see description). If both
2459 deny_read and allow_read are empty or not set, then access is
2463 deny_read and allow_read are empty or not set, then access is
2460 permitted to all users by default. If the repository is being
2464 permitted to all users by default. If the repository is being
2461 served via hgwebdir, denied users will not be able to see it in
2465 served via hgwebdir, denied users will not be able to see it in
2462 the list of repositories. The contents of the deny_read list have
2466 the list of repositories. The contents of the deny_read list have
2463 priority over (are examined before) the contents of the allow_read
2467 priority over (are examined before) the contents of the allow_read
2464 list.
2468 list.
2465
2469
2466 ``descend``
2470 ``descend``
2467 hgwebdir indexes will not descend into subdirectories. Only repositories
2471 hgwebdir indexes will not descend into subdirectories. Only repositories
2468 directly in the current path will be shown (other repositories are still
2472 directly in the current path will be shown (other repositories are still
2469 available from the index corresponding to their containing path).
2473 available from the index corresponding to their containing path).
2470
2474
2471 ``description``
2475 ``description``
2472 Textual description of the repository's purpose or contents.
2476 Textual description of the repository's purpose or contents.
2473 (default: "unknown")
2477 (default: "unknown")
2474
2478
2475 ``encoding``
2479 ``encoding``
2476 Character encoding name. (default: the current locale charset)
2480 Character encoding name. (default: the current locale charset)
2477 Example: "UTF-8".
2481 Example: "UTF-8".
2478
2482
2479 ``errorlog``
2483 ``errorlog``
2480 Where to output the error log. (default: stderr)
2484 Where to output the error log. (default: stderr)
2481
2485
2482 ``guessmime``
2486 ``guessmime``
2483 Control MIME types for raw download of file content.
2487 Control MIME types for raw download of file content.
2484 Set to True to let hgweb guess the content type from the file
2488 Set to True to let hgweb guess the content type from the file
2485 extension. This will serve HTML files as ``text/html`` and might
2489 extension. This will serve HTML files as ``text/html`` and might
2486 allow cross-site scripting attacks when serving untrusted
2490 allow cross-site scripting attacks when serving untrusted
2487 repositories. (default: False)
2491 repositories. (default: False)
2488
2492
2489 ``hidden``
2493 ``hidden``
2490 Whether to hide the repository in the hgwebdir index.
2494 Whether to hide the repository in the hgwebdir index.
2491 (default: False)
2495 (default: False)
2492
2496
2493 ``ipv6``
2497 ``ipv6``
2494 Whether to use IPv6. (default: False)
2498 Whether to use IPv6. (default: False)
2495
2499
2496 ``labels``
2500 ``labels``
2497 List of string *labels* associated with the repository.
2501 List of string *labels* associated with the repository.
2498
2502
2499 Labels are exposed as a template keyword and can be used to customize
2503 Labels are exposed as a template keyword and can be used to customize
2500 output. e.g. the ``index`` template can group or filter repositories
2504 output. e.g. the ``index`` template can group or filter repositories
2501 by labels and the ``summary`` template can display additional content
2505 by labels and the ``summary`` template can display additional content
2502 if a specific label is present.
2506 if a specific label is present.
2503
2507
2504 ``logoimg``
2508 ``logoimg``
2505 File name of the logo image that some templates display on each page.
2509 File name of the logo image that some templates display on each page.
2506 The file name is relative to ``staticurl``. That is, the full path to
2510 The file name is relative to ``staticurl``. That is, the full path to
2507 the logo image is "staticurl/logoimg".
2511 the logo image is "staticurl/logoimg".
2508 If unset, ``hglogo.png`` will be used.
2512 If unset, ``hglogo.png`` will be used.
2509
2513
2510 ``logourl``
2514 ``logourl``
2511 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2515 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2512 will be used.
2516 will be used.
2513
2517
2514 ``maxchanges``
2518 ``maxchanges``
2515 Maximum number of changes to list on the changelog. (default: 10)
2519 Maximum number of changes to list on the changelog. (default: 10)
2516
2520
2517 ``maxfiles``
2521 ``maxfiles``
2518 Maximum number of files to list per changeset. (default: 10)
2522 Maximum number of files to list per changeset. (default: 10)
2519
2523
2520 ``maxshortchanges``
2524 ``maxshortchanges``
2521 Maximum number of changes to list on the shortlog, graph or filelog
2525 Maximum number of changes to list on the shortlog, graph or filelog
2522 pages. (default: 60)
2526 pages. (default: 60)
2523
2527
2524 ``name``
2528 ``name``
2525 Repository name to use in the web interface.
2529 Repository name to use in the web interface.
2526 (default: current working directory)
2530 (default: current working directory)
2527
2531
2528 ``port``
2532 ``port``
2529 Port to listen on. (default: 8000)
2533 Port to listen on. (default: 8000)
2530
2534
2531 ``prefix``
2535 ``prefix``
2532 Prefix path to serve from. (default: '' (server root))
2536 Prefix path to serve from. (default: '' (server root))
2533
2537
2534 ``push_ssl``
2538 ``push_ssl``
2535 Whether to require that inbound pushes be transported over SSL to
2539 Whether to require that inbound pushes be transported over SSL to
2536 prevent password sniffing. (default: True)
2540 prevent password sniffing. (default: True)
2537
2541
2538 ``refreshinterval``
2542 ``refreshinterval``
2539 How frequently directory listings re-scan the filesystem for new
2543 How frequently directory listings re-scan the filesystem for new
2540 repositories, in seconds. This is relevant when wildcards are used
2544 repositories, in seconds. This is relevant when wildcards are used
2541 to define paths. Depending on how much filesystem traversal is
2545 to define paths. Depending on how much filesystem traversal is
2542 required, refreshing may negatively impact performance.
2546 required, refreshing may negatively impact performance.
2543
2547
2544 Values less than or equal to 0 always refresh.
2548 Values less than or equal to 0 always refresh.
2545 (default: 20)
2549 (default: 20)
2546
2550
2547 ``server-header``
2551 ``server-header``
2548 Value for HTTP ``Server`` response header.
2552 Value for HTTP ``Server`` response header.
2549
2553
2550 ``staticurl``
2554 ``staticurl``
2551 Base URL to use for static files. If unset, static files (e.g. the
2555 Base URL to use for static files. If unset, static files (e.g. the
2552 hgicon.png favicon) will be served by the CGI script itself. Use
2556 hgicon.png favicon) will be served by the CGI script itself. Use
2553 this setting to serve them directly with the HTTP server.
2557 this setting to serve them directly with the HTTP server.
2554 Example: ``http://hgserver/static/``.
2558 Example: ``http://hgserver/static/``.
2555
2559
2556 ``stripes``
2560 ``stripes``
2557 How many lines a "zebra stripe" should span in multi-line output.
2561 How many lines a "zebra stripe" should span in multi-line output.
2558 Set to 0 to disable. (default: 1)
2562 Set to 0 to disable. (default: 1)
2559
2563
2560 ``style``
2564 ``style``
2561 Which template map style to use. The available options are the names of
2565 Which template map style to use. The available options are the names of
2562 subdirectories in the HTML templates path. (default: ``paper``)
2566 subdirectories in the HTML templates path. (default: ``paper``)
2563 Example: ``monoblue``.
2567 Example: ``monoblue``.
2564
2568
2565 ``templates``
2569 ``templates``
2566 Where to find the HTML templates. The default path to the HTML templates
2570 Where to find the HTML templates. The default path to the HTML templates
2567 can be obtained from ``hg debuginstall``.
2571 can be obtained from ``hg debuginstall``.
2568
2572
2569 ``websub``
2573 ``websub``
2570 ----------
2574 ----------
2571
2575
2572 Web substitution filter definition. You can use this section to
2576 Web substitution filter definition. You can use this section to
2573 define a set of regular expression substitution patterns which
2577 define a set of regular expression substitution patterns which
2574 let you automatically modify the hgweb server output.
2578 let you automatically modify the hgweb server output.
2575
2579
2576 The default hgweb templates only apply these substitution patterns
2580 The default hgweb templates only apply these substitution patterns
2577 on the revision description fields. You can apply them anywhere
2581 on the revision description fields. You can apply them anywhere
2578 you want when you create your own templates by adding calls to the
2582 you want when you create your own templates by adding calls to the
2579 "websub" filter (usually after calling the "escape" filter).
2583 "websub" filter (usually after calling the "escape" filter).
2580
2584
2581 This can be used, for example, to convert issue references to links
2585 This can be used, for example, to convert issue references to links
2582 to your issue tracker, or to convert "markdown-like" syntax into
2586 to your issue tracker, or to convert "markdown-like" syntax into
2583 HTML (see the examples below).
2587 HTML (see the examples below).
2584
2588
2585 Each entry in this section names a substitution filter.
2589 Each entry in this section names a substitution filter.
2586 The value of each entry defines the substitution expression itself.
2590 The value of each entry defines the substitution expression itself.
2587 The websub expressions follow the old interhg extension syntax,
2591 The websub expressions follow the old interhg extension syntax,
2588 which in turn imitates the Unix sed replacement syntax::
2592 which in turn imitates the Unix sed replacement syntax::
2589
2593
2590 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2594 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2591
2595
2592 You can use any separator other than "/". The final "i" is optional
2596 You can use any separator other than "/". The final "i" is optional
2593 and indicates that the search must be case insensitive.
2597 and indicates that the search must be case insensitive.
2594
2598
2595 Examples::
2599 Examples::
2596
2600
2597 [websub]
2601 [websub]
2598 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2602 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2599 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2603 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2600 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2604 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2601
2605
2602 ``worker``
2606 ``worker``
2603 ----------
2607 ----------
2604
2608
2605 Parallel master/worker configuration. We currently perform working
2609 Parallel master/worker configuration. We currently perform working
2606 directory updates in parallel on Unix-like systems, which greatly
2610 directory updates in parallel on Unix-like systems, which greatly
2607 helps performance.
2611 helps performance.
2608
2612
2609 ``enabled``
2613 ``enabled``
2610 Whether to enable workers code to be used.
2614 Whether to enable workers code to be used.
2611 (default: true)
2615 (default: true)
2612
2616
2613 ``numcpus``
2617 ``numcpus``
2614 Number of CPUs to use for parallel operations. A zero or
2618 Number of CPUs to use for parallel operations. A zero or
2615 negative value is treated as ``use the default``.
2619 negative value is treated as ``use the default``.
2616 (default: 4 or the number of CPUs on the system, whichever is larger)
2620 (default: 4 or the number of CPUs on the system, whichever is larger)
2617
2621
2618 ``backgroundclose``
2622 ``backgroundclose``
2619 Whether to enable closing file handles on background threads during certain
2623 Whether to enable closing file handles on background threads during certain
2620 operations. Some platforms aren't very efficient at closing file
2624 operations. Some platforms aren't very efficient at closing file
2621 handles that have been written or appended to. By performing file closing
2625 handles that have been written or appended to. By performing file closing
2622 on background threads, file write rate can increase substantially.
2626 on background threads, file write rate can increase substantially.
2623 (default: true on Windows, false elsewhere)
2627 (default: true on Windows, false elsewhere)
2624
2628
2625 ``backgroundcloseminfilecount``
2629 ``backgroundcloseminfilecount``
2626 Minimum number of files required to trigger background file closing.
2630 Minimum number of files required to trigger background file closing.
2627 Operations not writing this many files won't start background close
2631 Operations not writing this many files won't start background close
2628 threads.
2632 threads.
2629 (default: 2048)
2633 (default: 2048)
2630
2634
2631 ``backgroundclosemaxqueue``
2635 ``backgroundclosemaxqueue``
2632 The maximum number of opened file handles waiting to be closed in the
2636 The maximum number of opened file handles waiting to be closed in the
2633 background. This option only has an effect if ``backgroundclose`` is
2637 background. This option only has an effect if ``backgroundclose`` is
2634 enabled.
2638 enabled.
2635 (default: 384)
2639 (default: 384)
2636
2640
2637 ``backgroundclosethreadcount``
2641 ``backgroundclosethreadcount``
2638 Number of threads to process background file closes. Only relevant if
2642 Number of threads to process background file closes. Only relevant if
2639 ``backgroundclose`` is enabled.
2643 ``backgroundclose`` is enabled.
2640 (default: 4)
2644 (default: 4)
@@ -1,250 +1,251
1 # profiling.py - profiling functions
1 # profiling.py - profiling functions
2 #
2 #
3 # Copyright 2016 Gregory Szorc <gregory.szorc@gmail.com>
3 # Copyright 2016 Gregory Szorc <gregory.szorc@gmail.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, print_function
8 from __future__ import absolute_import, print_function
9
9
10 import contextlib
10 import contextlib
11
11
12 from .i18n import _
12 from .i18n import _
13 from . import (
13 from . import (
14 encoding,
14 encoding,
15 error,
15 error,
16 extensions,
16 extensions,
17 pycompat,
17 pycompat,
18 util,
18 util,
19 )
19 )
20
20
21 def _loadprofiler(ui, profiler):
21 def _loadprofiler(ui, profiler):
22 """load profiler extension. return profile method, or None on failure"""
22 """load profiler extension. return profile method, or None on failure"""
23 extname = profiler
23 extname = profiler
24 extensions.loadall(ui, whitelist=[extname])
24 extensions.loadall(ui, whitelist=[extname])
25 try:
25 try:
26 mod = extensions.find(extname)
26 mod = extensions.find(extname)
27 except KeyError:
27 except KeyError:
28 return None
28 return None
29 else:
29 else:
30 return getattr(mod, 'profile', None)
30 return getattr(mod, 'profile', None)
31
31
32 @contextlib.contextmanager
32 @contextlib.contextmanager
33 def lsprofile(ui, fp):
33 def lsprofile(ui, fp):
34 format = ui.config('profiling', 'format')
34 format = ui.config('profiling', 'format')
35 field = ui.config('profiling', 'sort')
35 field = ui.config('profiling', 'sort')
36 limit = ui.configint('profiling', 'limit')
36 limit = ui.configint('profiling', 'limit')
37 climit = ui.configint('profiling', 'nested')
37 climit = ui.configint('profiling', 'nested')
38
38
39 if format not in ['text', 'kcachegrind']:
39 if format not in ['text', 'kcachegrind']:
40 ui.warn(_("unrecognized profiling format '%s'"
40 ui.warn(_("unrecognized profiling format '%s'"
41 " - Ignored\n") % format)
41 " - Ignored\n") % format)
42 format = 'text'
42 format = 'text'
43
43
44 try:
44 try:
45 from . import lsprof
45 from . import lsprof
46 except ImportError:
46 except ImportError:
47 raise error.Abort(_(
47 raise error.Abort(_(
48 'lsprof not available - install from '
48 'lsprof not available - install from '
49 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))
49 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))
50 p = lsprof.Profiler()
50 p = lsprof.Profiler()
51 p.enable(subcalls=True)
51 p.enable(subcalls=True)
52 try:
52 try:
53 yield
53 yield
54 finally:
54 finally:
55 p.disable()
55 p.disable()
56
56
57 if format == 'kcachegrind':
57 if format == 'kcachegrind':
58 from . import lsprofcalltree
58 from . import lsprofcalltree
59 calltree = lsprofcalltree.KCacheGrind(p)
59 calltree = lsprofcalltree.KCacheGrind(p)
60 calltree.output(fp)
60 calltree.output(fp)
61 else:
61 else:
62 # format == 'text'
62 # format == 'text'
63 stats = lsprof.Stats(p.getstats())
63 stats = lsprof.Stats(p.getstats())
64 stats.sort(field)
64 stats.sort(field)
65 stats.pprint(limit=limit, file=fp, climit=climit)
65 stats.pprint(limit=limit, file=fp, climit=climit)
66
66
67 @contextlib.contextmanager
67 @contextlib.contextmanager
68 def flameprofile(ui, fp):
68 def flameprofile(ui, fp):
69 try:
69 try:
70 from flamegraph import flamegraph
70 from flamegraph import flamegraph
71 except ImportError:
71 except ImportError:
72 raise error.Abort(_(
72 raise error.Abort(_(
73 'flamegraph not available - install from '
73 'flamegraph not available - install from '
74 'https://github.com/evanhempel/python-flamegraph'))
74 'https://github.com/evanhempel/python-flamegraph'))
75 # developer config: profiling.freq
75 # developer config: profiling.freq
76 freq = ui.configint('profiling', 'freq')
76 freq = ui.configint('profiling', 'freq')
77 filter_ = None
77 filter_ = None
78 collapse_recursion = True
78 collapse_recursion = True
79 thread = flamegraph.ProfileThread(fp, 1.0 / freq,
79 thread = flamegraph.ProfileThread(fp, 1.0 / freq,
80 filter_, collapse_recursion)
80 filter_, collapse_recursion)
81 start_time = util.timer()
81 start_time = util.timer()
82 try:
82 try:
83 thread.start()
83 thread.start()
84 yield
84 yield
85 finally:
85 finally:
86 thread.stop()
86 thread.stop()
87 thread.join()
87 thread.join()
88 print('Collected %d stack frames (%d unique) in %2.2f seconds.' % (
88 print('Collected %d stack frames (%d unique) in %2.2f seconds.' % (
89 util.timer() - start_time, thread.num_frames(),
89 util.timer() - start_time, thread.num_frames(),
90 thread.num_frames(unique=True)))
90 thread.num_frames(unique=True)))
91
91
92 @contextlib.contextmanager
92 @contextlib.contextmanager
93 def statprofile(ui, fp):
93 def statprofile(ui, fp):
94 from . import statprof
94 from . import statprof
95
95
96 freq = ui.configint('profiling', 'freq')
96 freq = ui.configint('profiling', 'freq')
97 if freq > 0:
97 if freq > 0:
98 # Cannot reset when profiler is already active. So silently no-op.
98 # Cannot reset when profiler is already active. So silently no-op.
99 if statprof.state.profile_level == 0:
99 if statprof.state.profile_level == 0:
100 statprof.reset(freq)
100 statprof.reset(freq)
101 else:
101 else:
102 ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq)
102 ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq)
103
103
104 statprof.start(mechanism='thread')
104 track = ui.config('profiling', 'time-track')
105 statprof.start(mechanism='thread', track=track)
105
106
106 try:
107 try:
107 yield
108 yield
108 finally:
109 finally:
109 data = statprof.stop()
110 data = statprof.stop()
110
111
111 profformat = ui.config('profiling', 'statformat')
112 profformat = ui.config('profiling', 'statformat')
112
113
113 formats = {
114 formats = {
114 'byline': statprof.DisplayFormats.ByLine,
115 'byline': statprof.DisplayFormats.ByLine,
115 'bymethod': statprof.DisplayFormats.ByMethod,
116 'bymethod': statprof.DisplayFormats.ByMethod,
116 'hotpath': statprof.DisplayFormats.Hotpath,
117 'hotpath': statprof.DisplayFormats.Hotpath,
117 'json': statprof.DisplayFormats.Json,
118 'json': statprof.DisplayFormats.Json,
118 'chrome': statprof.DisplayFormats.Chrome,
119 'chrome': statprof.DisplayFormats.Chrome,
119 }
120 }
120
121
121 if profformat in formats:
122 if profformat in formats:
122 displayformat = formats[profformat]
123 displayformat = formats[profformat]
123 else:
124 else:
124 ui.warn(_('unknown profiler output format: %s\n') % profformat)
125 ui.warn(_('unknown profiler output format: %s\n') % profformat)
125 displayformat = statprof.DisplayFormats.Hotpath
126 displayformat = statprof.DisplayFormats.Hotpath
126
127
127 kwargs = {}
128 kwargs = {}
128
129
129 def fraction(s):
130 def fraction(s):
130 if isinstance(s, (float, int)):
131 if isinstance(s, (float, int)):
131 return float(s)
132 return float(s)
132 if s.endswith('%'):
133 if s.endswith('%'):
133 v = float(s[:-1]) / 100
134 v = float(s[:-1]) / 100
134 else:
135 else:
135 v = float(s)
136 v = float(s)
136 if 0 <= v <= 1:
137 if 0 <= v <= 1:
137 return v
138 return v
138 raise ValueError(s)
139 raise ValueError(s)
139
140
140 if profformat == 'chrome':
141 if profformat == 'chrome':
141 showmin = ui.configwith(fraction, 'profiling', 'showmin', 0.005)
142 showmin = ui.configwith(fraction, 'profiling', 'showmin', 0.005)
142 showmax = ui.configwith(fraction, 'profiling', 'showmax')
143 showmax = ui.configwith(fraction, 'profiling', 'showmax')
143 kwargs.update(minthreshold=showmin, maxthreshold=showmax)
144 kwargs.update(minthreshold=showmin, maxthreshold=showmax)
144 elif profformat == 'hotpath':
145 elif profformat == 'hotpath':
145 # inconsistent config: profiling.showmin
146 # inconsistent config: profiling.showmin
146 limit = ui.configwith(fraction, 'profiling', 'showmin', 0.05)
147 limit = ui.configwith(fraction, 'profiling', 'showmin', 0.05)
147 kwargs[r'limit'] = limit
148 kwargs[r'limit'] = limit
148
149
149 statprof.display(fp, data=data, format=displayformat, **kwargs)
150 statprof.display(fp, data=data, format=displayformat, **kwargs)
150
151
151 class profile(object):
152 class profile(object):
152 """Start profiling.
153 """Start profiling.
153
154
154 Profiling is active when the context manager is active. When the context
155 Profiling is active when the context manager is active. When the context
155 manager exits, profiling results will be written to the configured output.
156 manager exits, profiling results will be written to the configured output.
156 """
157 """
157 def __init__(self, ui, enabled=True):
158 def __init__(self, ui, enabled=True):
158 self._ui = ui
159 self._ui = ui
159 self._output = None
160 self._output = None
160 self._fp = None
161 self._fp = None
161 self._fpdoclose = True
162 self._fpdoclose = True
162 self._profiler = None
163 self._profiler = None
163 self._enabled = enabled
164 self._enabled = enabled
164 self._entered = False
165 self._entered = False
165 self._started = False
166 self._started = False
166
167
167 def __enter__(self):
168 def __enter__(self):
168 self._entered = True
169 self._entered = True
169 if self._enabled:
170 if self._enabled:
170 self.start()
171 self.start()
171 return self
172 return self
172
173
173 def start(self):
174 def start(self):
174 """Start profiling.
175 """Start profiling.
175
176
176 The profiling will stop at the context exit.
177 The profiling will stop at the context exit.
177
178
178 If the profiler was already started, this has no effect."""
179 If the profiler was already started, this has no effect."""
179 if not self._entered:
180 if not self._entered:
180 raise error.ProgrammingError()
181 raise error.ProgrammingError()
181 if self._started:
182 if self._started:
182 return
183 return
183 self._started = True
184 self._started = True
184 profiler = encoding.environ.get('HGPROF')
185 profiler = encoding.environ.get('HGPROF')
185 proffn = None
186 proffn = None
186 if profiler is None:
187 if profiler is None:
187 profiler = self._ui.config('profiling', 'type')
188 profiler = self._ui.config('profiling', 'type')
188 if profiler not in ('ls', 'stat', 'flame'):
189 if profiler not in ('ls', 'stat', 'flame'):
189 # try load profiler from extension with the same name
190 # try load profiler from extension with the same name
190 proffn = _loadprofiler(self._ui, profiler)
191 proffn = _loadprofiler(self._ui, profiler)
191 if proffn is None:
192 if proffn is None:
192 self._ui.warn(_("unrecognized profiler '%s' - ignored\n")
193 self._ui.warn(_("unrecognized profiler '%s' - ignored\n")
193 % profiler)
194 % profiler)
194 profiler = 'stat'
195 profiler = 'stat'
195
196
196 self._output = self._ui.config('profiling', 'output')
197 self._output = self._ui.config('profiling', 'output')
197
198
198 try:
199 try:
199 if self._output == 'blackbox':
200 if self._output == 'blackbox':
200 self._fp = util.stringio()
201 self._fp = util.stringio()
201 elif self._output:
202 elif self._output:
202 path = self._ui.expandpath(self._output)
203 path = self._ui.expandpath(self._output)
203 self._fp = open(path, 'wb')
204 self._fp = open(path, 'wb')
204 elif pycompat.iswindows:
205 elif pycompat.iswindows:
205 # parse escape sequence by win32print()
206 # parse escape sequence by win32print()
206 class uifp(object):
207 class uifp(object):
207 def __init__(self, ui):
208 def __init__(self, ui):
208 self._ui = ui
209 self._ui = ui
209 def write(self, data):
210 def write(self, data):
210 self._ui.write_err(data)
211 self._ui.write_err(data)
211 def flush(self):
212 def flush(self):
212 self._ui.flush()
213 self._ui.flush()
213 self._fpdoclose = False
214 self._fpdoclose = False
214 self._fp = uifp(self._ui)
215 self._fp = uifp(self._ui)
215 else:
216 else:
216 self._fpdoclose = False
217 self._fpdoclose = False
217 self._fp = self._ui.ferr
218 self._fp = self._ui.ferr
218
219
219 if proffn is not None:
220 if proffn is not None:
220 pass
221 pass
221 elif profiler == 'ls':
222 elif profiler == 'ls':
222 proffn = lsprofile
223 proffn = lsprofile
223 elif profiler == 'flame':
224 elif profiler == 'flame':
224 proffn = flameprofile
225 proffn = flameprofile
225 else:
226 else:
226 proffn = statprofile
227 proffn = statprofile
227
228
228 self._profiler = proffn(self._ui, self._fp)
229 self._profiler = proffn(self._ui, self._fp)
229 self._profiler.__enter__()
230 self._profiler.__enter__()
230 except: # re-raises
231 except: # re-raises
231 self._closefp()
232 self._closefp()
232 raise
233 raise
233
234
234 def __exit__(self, exception_type, exception_value, traceback):
235 def __exit__(self, exception_type, exception_value, traceback):
235 propagate = None
236 propagate = None
236 if self._profiler is not None:
237 if self._profiler is not None:
237 propagate = self._profiler.__exit__(exception_type, exception_value,
238 propagate = self._profiler.__exit__(exception_type, exception_value,
238 traceback)
239 traceback)
239 if self._output == 'blackbox':
240 if self._output == 'blackbox':
240 val = 'Profile:\n%s' % self._fp.getvalue()
241 val = 'Profile:\n%s' % self._fp.getvalue()
241 # ui.log treats the input as a format string,
242 # ui.log treats the input as a format string,
242 # so we need to escape any % signs.
243 # so we need to escape any % signs.
243 val = val.replace('%', '%%')
244 val = val.replace('%', '%%')
244 self._ui.log('profile', val)
245 self._ui.log('profile', val)
245 self._closefp()
246 self._closefp()
246 return propagate
247 return propagate
247
248
248 def _closefp(self):
249 def _closefp(self):
249 if self._fpdoclose and self._fp is not None:
250 if self._fpdoclose and self._fp is not None:
250 self._fp.close()
251 self._fp.close()
@@ -1,936 +1,947
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 ## statprof.py
2 ## statprof.py
3 ## Copyright (C) 2012 Bryan O'Sullivan <bos@serpentine.com>
3 ## Copyright (C) 2012 Bryan O'Sullivan <bos@serpentine.com>
4 ## Copyright (C) 2011 Alex Fraser <alex at phatcore dot com>
4 ## Copyright (C) 2011 Alex Fraser <alex at phatcore dot com>
5 ## Copyright (C) 2004,2005 Andy Wingo <wingo at pobox dot com>
5 ## Copyright (C) 2004,2005 Andy Wingo <wingo at pobox dot com>
6 ## Copyright (C) 2001 Rob Browning <rlb at defaultvalue dot org>
6 ## Copyright (C) 2001 Rob Browning <rlb at defaultvalue dot org>
7
7
8 ## This library is free software; you can redistribute it and/or
8 ## This library is free software; you can redistribute it and/or
9 ## modify it under the terms of the GNU Lesser General Public
9 ## modify it under the terms of the GNU Lesser General Public
10 ## License as published by the Free Software Foundation; either
10 ## License as published by the Free Software Foundation; either
11 ## version 2.1 of the License, or (at your option) any later version.
11 ## version 2.1 of the License, or (at your option) any later version.
12 ##
12 ##
13 ## This library is distributed in the hope that it will be useful,
13 ## This library is distributed in the hope that it will be useful,
14 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ## Lesser General Public License for more details.
16 ## Lesser General Public License for more details.
17 ##
17 ##
18 ## You should have received a copy of the GNU Lesser General Public
18 ## You should have received a copy of the GNU Lesser General Public
19 ## License along with this program; if not, contact:
19 ## License along with this program; if not, contact:
20 ##
20 ##
21 ## Free Software Foundation Voice: +1-617-542-5942
21 ## Free Software Foundation Voice: +1-617-542-5942
22 ## 59 Temple Place - Suite 330 Fax: +1-617-542-2652
22 ## 59 Temple Place - Suite 330 Fax: +1-617-542-2652
23 ## Boston, MA 02111-1307, USA gnu@gnu.org
23 ## Boston, MA 02111-1307, USA gnu@gnu.org
24
24
25 """
25 """
26 statprof is intended to be a fairly simple statistical profiler for
26 statprof is intended to be a fairly simple statistical profiler for
27 python. It was ported directly from a statistical profiler for guile,
27 python. It was ported directly from a statistical profiler for guile,
28 also named statprof, available from guile-lib [0].
28 also named statprof, available from guile-lib [0].
29
29
30 [0] http://wingolog.org/software/guile-lib/statprof/
30 [0] http://wingolog.org/software/guile-lib/statprof/
31
31
32 To start profiling, call statprof.start():
32 To start profiling, call statprof.start():
33 >>> start()
33 >>> start()
34
34
35 Then run whatever it is that you want to profile, for example:
35 Then run whatever it is that you want to profile, for example:
36 >>> import test.pystone; test.pystone.pystones()
36 >>> import test.pystone; test.pystone.pystones()
37
37
38 Then stop the profiling and print out the results:
38 Then stop the profiling and print out the results:
39 >>> stop()
39 >>> stop()
40 >>> display()
40 >>> display()
41 % cumulative self
41 % cumulative self
42 time seconds seconds name
42 time seconds seconds name
43 26.72 1.40 0.37 pystone.py:79:Proc0
43 26.72 1.40 0.37 pystone.py:79:Proc0
44 13.79 0.56 0.19 pystone.py:133:Proc1
44 13.79 0.56 0.19 pystone.py:133:Proc1
45 13.79 0.19 0.19 pystone.py:208:Proc8
45 13.79 0.19 0.19 pystone.py:208:Proc8
46 10.34 0.16 0.14 pystone.py:229:Func2
46 10.34 0.16 0.14 pystone.py:229:Func2
47 6.90 0.10 0.10 pystone.py:45:__init__
47 6.90 0.10 0.10 pystone.py:45:__init__
48 4.31 0.16 0.06 pystone.py:53:copy
48 4.31 0.16 0.06 pystone.py:53:copy
49 ...
49 ...
50
50
51 All of the numerical data is statistically approximate. In the
51 All of the numerical data is statistically approximate. In the
52 following column descriptions, and in all of statprof, "time" refers
52 following column descriptions, and in all of statprof, "time" refers
53 to execution time (both user and system), not wall clock time.
53 to execution time (both user and system), not wall clock time.
54
54
55 % time
55 % time
56 The percent of the time spent inside the procedure itself (not
56 The percent of the time spent inside the procedure itself (not
57 counting children).
57 counting children).
58
58
59 cumulative seconds
59 cumulative seconds
60 The total number of seconds spent in the procedure, including
60 The total number of seconds spent in the procedure, including
61 children.
61 children.
62
62
63 self seconds
63 self seconds
64 The total number of seconds spent in the procedure itself (not
64 The total number of seconds spent in the procedure itself (not
65 counting children).
65 counting children).
66
66
67 name
67 name
68 The name of the procedure.
68 The name of the procedure.
69
69
70 By default statprof keeps the data collected from previous runs. If you
70 By default statprof keeps the data collected from previous runs. If you
71 want to clear the collected data, call reset():
71 want to clear the collected data, call reset():
72 >>> reset()
72 >>> reset()
73
73
74 reset() can also be used to change the sampling frequency from the
74 reset() can also be used to change the sampling frequency from the
75 default of 1000 Hz. For example, to tell statprof to sample 50 times a
75 default of 1000 Hz. For example, to tell statprof to sample 50 times a
76 second:
76 second:
77 >>> reset(50)
77 >>> reset(50)
78
78
79 This means that statprof will sample the call stack after every 1/50 of
79 This means that statprof will sample the call stack after every 1/50 of
80 a second of user + system time spent running on behalf of the python
80 a second of user + system time spent running on behalf of the python
81 process. When your process is idle (for example, blocking in a read(),
81 process. When your process is idle (for example, blocking in a read(),
82 as is the case at the listener), the clock does not advance. For this
82 as is the case at the listener), the clock does not advance. For this
83 reason statprof is not currently not suitable for profiling io-bound
83 reason statprof is not currently not suitable for profiling io-bound
84 operations.
84 operations.
85
85
86 The profiler uses the hash of the code object itself to identify the
86 The profiler uses the hash of the code object itself to identify the
87 procedures, so it won't confuse different procedures with the same name.
87 procedures, so it won't confuse different procedures with the same name.
88 They will show up as two different rows in the output.
88 They will show up as two different rows in the output.
89
89
90 Right now the profiler is quite simplistic. I cannot provide
90 Right now the profiler is quite simplistic. I cannot provide
91 call-graphs or other higher level information. What you see in the
91 call-graphs or other higher level information. What you see in the
92 table is pretty much all there is. Patches are welcome :-)
92 table is pretty much all there is. Patches are welcome :-)
93
93
94
94
95 Threading
95 Threading
96 ---------
96 ---------
97
97
98 Because signals only get delivered to the main thread in Python,
98 Because signals only get delivered to the main thread in Python,
99 statprof only profiles the main thread. However because the time
99 statprof only profiles the main thread. However because the time
100 reporting function uses per-process timers, the results can be
100 reporting function uses per-process timers, the results can be
101 significantly off if other threads' work patterns are not similar to the
101 significantly off if other threads' work patterns are not similar to the
102 main thread's work patterns.
102 main thread's work patterns.
103 """
103 """
104 # no-check-code
104 # no-check-code
105 from __future__ import absolute_import, division, print_function
105 from __future__ import absolute_import, division, print_function
106
106
107 import collections
107 import collections
108 import contextlib
108 import contextlib
109 import getopt
109 import getopt
110 import inspect
110 import inspect
111 import json
111 import json
112 import os
112 import os
113 import signal
113 import signal
114 import sys
114 import sys
115 import threading
115 import threading
116 import time
116 import time
117
117
118 from . import (
118 from . import (
119 encoding,
119 encoding,
120 pycompat,
120 pycompat,
121 )
121 )
122
122
123 defaultdict = collections.defaultdict
123 defaultdict = collections.defaultdict
124 contextmanager = contextlib.contextmanager
124 contextmanager = contextlib.contextmanager
125
125
126 __all__ = ['start', 'stop', 'reset', 'display', 'profile']
126 __all__ = ['start', 'stop', 'reset', 'display', 'profile']
127
127
128 skips = {"util.py:check", "extensions.py:closure",
128 skips = {"util.py:check", "extensions.py:closure",
129 "color.py:colorcmd", "dispatch.py:checkargs",
129 "color.py:colorcmd", "dispatch.py:checkargs",
130 "dispatch.py:<lambda>", "dispatch.py:_runcatch",
130 "dispatch.py:<lambda>", "dispatch.py:_runcatch",
131 "dispatch.py:_dispatch", "dispatch.py:_runcommand",
131 "dispatch.py:_dispatch", "dispatch.py:_runcommand",
132 "pager.py:pagecmd", "dispatch.py:run",
132 "pager.py:pagecmd", "dispatch.py:run",
133 "dispatch.py:dispatch", "dispatch.py:runcommand",
133 "dispatch.py:dispatch", "dispatch.py:runcommand",
134 "hg.py:<module>", "evolve.py:warnobserrors",
134 "hg.py:<module>", "evolve.py:warnobserrors",
135 }
135 }
136
136
137 ###########################################################################
137 ###########################################################################
138 ## Utils
138 ## Utils
139
139
140 def clock():
140 def clock():
141 times = os.times()
141 times = os.times()
142 return (times[0] + times[1], times[4])
142 return (times[0] + times[1], times[4])
143
143
144
144
145 ###########################################################################
145 ###########################################################################
146 ## Collection data structures
146 ## Collection data structures
147
147
148 class ProfileState(object):
148 class ProfileState(object):
149 def __init__(self, frequency=None):
149 def __init__(self, frequency=None):
150 self.reset(frequency)
150 self.reset(frequency)
151 self.track = 'cpu'
151
152
152 def reset(self, frequency=None):
153 def reset(self, frequency=None):
153 # total so far
154 # total so far
154 self.accumulated_time = (0.0, 0.0)
155 self.accumulated_time = (0.0, 0.0)
155 # start_time when timer is active
156 # start_time when timer is active
156 self.last_start_time = None
157 self.last_start_time = None
157 # a float
158 # a float
158 if frequency:
159 if frequency:
159 self.sample_interval = 1.0 / frequency
160 self.sample_interval = 1.0 / frequency
160 elif not hasattr(self, 'sample_interval'):
161 elif not hasattr(self, 'sample_interval'):
161 # default to 1000 Hz
162 # default to 1000 Hz
162 self.sample_interval = 1.0 / 1000.0
163 self.sample_interval = 1.0 / 1000.0
163 else:
164 else:
164 # leave the frequency as it was
165 # leave the frequency as it was
165 pass
166 pass
166 self.remaining_prof_time = None
167 self.remaining_prof_time = None
167 # for user start/stop nesting
168 # for user start/stop nesting
168 self.profile_level = 0
169 self.profile_level = 0
169
170
170 self.samples = []
171 self.samples = []
171
172
172 def accumulate_time(self, stop_time):
173 def accumulate_time(self, stop_time):
173 increment = (
174 increment = (
174 stop_time[0] - self.last_start_time[0],
175 stop_time[0] - self.last_start_time[0],
175 stop_time[1] - self.last_start_time[1],
176 stop_time[1] - self.last_start_time[1],
176 )
177 )
177 self.accumulated_time = (
178 self.accumulated_time = (
178 self.accumulated_time[0] + increment[0],
179 self.accumulated_time[0] + increment[0],
179 self.accumulated_time[1] + increment[1],
180 self.accumulated_time[1] + increment[1],
180 )
181 )
181
182
182 def seconds_per_sample(self):
183 def seconds_per_sample(self):
183 return self.accumulated_time[0] / len(self.samples)
184 return self.accumulated_time[self.timeidx] / len(self.samples)
185
186 @property
187 def timeidx(self):
188 if self.track == 'real':
189 return 1
190 return 0
184
191
185 state = ProfileState()
192 state = ProfileState()
186
193
187
194
188 class CodeSite(object):
195 class CodeSite(object):
189 cache = {}
196 cache = {}
190
197
191 __slots__ = (u'path', u'lineno', u'function', u'source')
198 __slots__ = (u'path', u'lineno', u'function', u'source')
192
199
193 def __init__(self, path, lineno, function):
200 def __init__(self, path, lineno, function):
194 self.path = path
201 self.path = path
195 self.lineno = lineno
202 self.lineno = lineno
196 self.function = function
203 self.function = function
197 self.source = None
204 self.source = None
198
205
199 def __eq__(self, other):
206 def __eq__(self, other):
200 try:
207 try:
201 return (self.lineno == other.lineno and
208 return (self.lineno == other.lineno and
202 self.path == other.path)
209 self.path == other.path)
203 except:
210 except:
204 return False
211 return False
205
212
206 def __hash__(self):
213 def __hash__(self):
207 return hash((self.lineno, self.path))
214 return hash((self.lineno, self.path))
208
215
209 @classmethod
216 @classmethod
210 def get(cls, path, lineno, function):
217 def get(cls, path, lineno, function):
211 k = (path, lineno)
218 k = (path, lineno)
212 try:
219 try:
213 return cls.cache[k]
220 return cls.cache[k]
214 except KeyError:
221 except KeyError:
215 v = cls(path, lineno, function)
222 v = cls(path, lineno, function)
216 cls.cache[k] = v
223 cls.cache[k] = v
217 return v
224 return v
218
225
219 def getsource(self, length):
226 def getsource(self, length):
220 if self.source is None:
227 if self.source is None:
221 lineno = self.lineno - 1
228 lineno = self.lineno - 1
222 fp = None
229 fp = None
223 try:
230 try:
224 fp = open(self.path)
231 fp = open(self.path)
225 for i, line in enumerate(fp):
232 for i, line in enumerate(fp):
226 if i == lineno:
233 if i == lineno:
227 self.source = line.strip()
234 self.source = line.strip()
228 break
235 break
229 except:
236 except:
230 pass
237 pass
231 finally:
238 finally:
232 if fp:
239 if fp:
233 fp.close()
240 fp.close()
234 if self.source is None:
241 if self.source is None:
235 self.source = ''
242 self.source = ''
236
243
237 source = self.source
244 source = self.source
238 if len(source) > length:
245 if len(source) > length:
239 source = source[:(length - 3)] + "..."
246 source = source[:(length - 3)] + "..."
240 return source
247 return source
241
248
242 def filename(self):
249 def filename(self):
243 return os.path.basename(self.path)
250 return os.path.basename(self.path)
244
251
245 class Sample(object):
252 class Sample(object):
246 __slots__ = (u'stack', u'time')
253 __slots__ = (u'stack', u'time')
247
254
248 def __init__(self, stack, time):
255 def __init__(self, stack, time):
249 self.stack = stack
256 self.stack = stack
250 self.time = time
257 self.time = time
251
258
252 @classmethod
259 @classmethod
253 def from_frame(cls, frame, time):
260 def from_frame(cls, frame, time):
254 stack = []
261 stack = []
255
262
256 while frame:
263 while frame:
257 stack.append(CodeSite.get(frame.f_code.co_filename, frame.f_lineno,
264 stack.append(CodeSite.get(frame.f_code.co_filename, frame.f_lineno,
258 frame.f_code.co_name))
265 frame.f_code.co_name))
259 frame = frame.f_back
266 frame = frame.f_back
260
267
261 return Sample(stack, time)
268 return Sample(stack, time)
262
269
263 ###########################################################################
270 ###########################################################################
264 ## SIGPROF handler
271 ## SIGPROF handler
265
272
266 def profile_signal_handler(signum, frame):
273 def profile_signal_handler(signum, frame):
267 if state.profile_level > 0:
274 if state.profile_level > 0:
268 now = clock()
275 now = clock()
269 state.accumulate_time(now)
276 state.accumulate_time(now)
270
277
271 state.samples.append(Sample.from_frame(frame, state.accumulated_time[0]))
278 timestamp = state.accumulated_time[state.timeidx]
279 state.samples.append(Sample.from_frame(frame, timestamp))
272
280
273 signal.setitimer(signal.ITIMER_PROF,
281 signal.setitimer(signal.ITIMER_PROF,
274 state.sample_interval, 0.0)
282 state.sample_interval, 0.0)
275 state.last_start_time = now
283 state.last_start_time = now
276
284
277 stopthread = threading.Event()
285 stopthread = threading.Event()
278 def samplerthread(tid):
286 def samplerthread(tid):
279 while not stopthread.is_set():
287 while not stopthread.is_set():
280 now = clock()
288 now = clock()
281 state.accumulate_time(now)
289 state.accumulate_time(now)
282
290
283 frame = sys._current_frames()[tid]
291 frame = sys._current_frames()[tid]
284 state.samples.append(Sample.from_frame(frame, state.accumulated_time[0]))
292
293 timestamp = state.accumulated_time[state.timeidx]
294 state.samples.append(Sample.from_frame(frame, timestamp))
285
295
286 state.last_start_time = now
296 state.last_start_time = now
287 time.sleep(state.sample_interval)
297 time.sleep(state.sample_interval)
288
298
289 stopthread.clear()
299 stopthread.clear()
290
300
291 ###########################################################################
301 ###########################################################################
292 ## Profiling API
302 ## Profiling API
293
303
294 def is_active():
304 def is_active():
295 return state.profile_level > 0
305 return state.profile_level > 0
296
306
297 lastmechanism = None
307 lastmechanism = None
298 def start(mechanism='thread'):
308 def start(mechanism='thread', track='cpu'):
299 '''Install the profiling signal handler, and start profiling.'''
309 '''Install the profiling signal handler, and start profiling.'''
310 state.track = track # note: nesting different mode won't work
300 state.profile_level += 1
311 state.profile_level += 1
301 if state.profile_level == 1:
312 if state.profile_level == 1:
302 state.last_start_time = clock()
313 state.last_start_time = clock()
303 rpt = state.remaining_prof_time
314 rpt = state.remaining_prof_time
304 state.remaining_prof_time = None
315 state.remaining_prof_time = None
305
316
306 global lastmechanism
317 global lastmechanism
307 lastmechanism = mechanism
318 lastmechanism = mechanism
308
319
309 if mechanism == 'signal':
320 if mechanism == 'signal':
310 signal.signal(signal.SIGPROF, profile_signal_handler)
321 signal.signal(signal.SIGPROF, profile_signal_handler)
311 signal.setitimer(signal.ITIMER_PROF,
322 signal.setitimer(signal.ITIMER_PROF,
312 rpt or state.sample_interval, 0.0)
323 rpt or state.sample_interval, 0.0)
313 elif mechanism == 'thread':
324 elif mechanism == 'thread':
314 frame = inspect.currentframe()
325 frame = inspect.currentframe()
315 tid = [k for k, f in sys._current_frames().items() if f == frame][0]
326 tid = [k for k, f in sys._current_frames().items() if f == frame][0]
316 state.thread = threading.Thread(target=samplerthread,
327 state.thread = threading.Thread(target=samplerthread,
317 args=(tid,), name="samplerthread")
328 args=(tid,), name="samplerthread")
318 state.thread.start()
329 state.thread.start()
319
330
320 def stop():
331 def stop():
321 '''Stop profiling, and uninstall the profiling signal handler.'''
332 '''Stop profiling, and uninstall the profiling signal handler.'''
322 state.profile_level -= 1
333 state.profile_level -= 1
323 if state.profile_level == 0:
334 if state.profile_level == 0:
324 if lastmechanism == 'signal':
335 if lastmechanism == 'signal':
325 rpt = signal.setitimer(signal.ITIMER_PROF, 0.0, 0.0)
336 rpt = signal.setitimer(signal.ITIMER_PROF, 0.0, 0.0)
326 signal.signal(signal.SIGPROF, signal.SIG_IGN)
337 signal.signal(signal.SIGPROF, signal.SIG_IGN)
327 state.remaining_prof_time = rpt[0]
338 state.remaining_prof_time = rpt[0]
328 elif lastmechanism == 'thread':
339 elif lastmechanism == 'thread':
329 stopthread.set()
340 stopthread.set()
330 state.thread.join()
341 state.thread.join()
331
342
332 state.accumulate_time(clock())
343 state.accumulate_time(clock())
333 state.last_start_time = None
344 state.last_start_time = None
334 statprofpath = encoding.environ.get('STATPROF_DEST')
345 statprofpath = encoding.environ.get('STATPROF_DEST')
335 if statprofpath:
346 if statprofpath:
336 save_data(statprofpath)
347 save_data(statprofpath)
337
348
338 return state
349 return state
339
350
340 def save_data(path):
351 def save_data(path):
341 with open(path, 'w+') as file:
352 with open(path, 'w+') as file:
342 file.write(str(state.accumulated_time) + '\n')
353 file.write(str(state.accumulated_time) + '\n')
343 for sample in state.samples:
354 for sample in state.samples:
344 time = str(sample.time)
355 time = str(sample.time)
345 stack = sample.stack
356 stack = sample.stack
346 sites = ['\1'.join([s.path, str(s.lineno), s.function])
357 sites = ['\1'.join([s.path, str(s.lineno), s.function])
347 for s in stack]
358 for s in stack]
348 file.write(time + '\0' + '\0'.join(sites) + '\n')
359 file.write(time + '\0' + '\0'.join(sites) + '\n')
349
360
350 def load_data(path):
361 def load_data(path):
351 lines = open(path, 'r').read().splitlines()
362 lines = open(path, 'r').read().splitlines()
352
363
353 state.accumulated_time = float(lines[0])
364 state.accumulated_time = float(lines[0])
354 state.samples = []
365 state.samples = []
355 for line in lines[1:]:
366 for line in lines[1:]:
356 parts = line.split('\0')
367 parts = line.split('\0')
357 time = float(parts[0])
368 time = float(parts[0])
358 rawsites = parts[1:]
369 rawsites = parts[1:]
359 sites = []
370 sites = []
360 for rawsite in rawsites:
371 for rawsite in rawsites:
361 siteparts = rawsite.split('\1')
372 siteparts = rawsite.split('\1')
362 sites.append(CodeSite.get(siteparts[0], int(siteparts[1]),
373 sites.append(CodeSite.get(siteparts[0], int(siteparts[1]),
363 siteparts[2]))
374 siteparts[2]))
364
375
365 state.samples.append(Sample(sites, time))
376 state.samples.append(Sample(sites, time))
366
377
367
378
368
379
369 def reset(frequency=None):
380 def reset(frequency=None):
370 '''Clear out the state of the profiler. Do not call while the
381 '''Clear out the state of the profiler. Do not call while the
371 profiler is running.
382 profiler is running.
372
383
373 The optional frequency argument specifies the number of samples to
384 The optional frequency argument specifies the number of samples to
374 collect per second.'''
385 collect per second.'''
375 assert state.profile_level == 0, "Can't reset() while statprof is running"
386 assert state.profile_level == 0, "Can't reset() while statprof is running"
376 CodeSite.cache.clear()
387 CodeSite.cache.clear()
377 state.reset(frequency)
388 state.reset(frequency)
378
389
379
390
380 @contextmanager
391 @contextmanager
381 def profile():
392 def profile():
382 start()
393 start()
383 try:
394 try:
384 yield
395 yield
385 finally:
396 finally:
386 stop()
397 stop()
387 display()
398 display()
388
399
389
400
390 ###########################################################################
401 ###########################################################################
391 ## Reporting API
402 ## Reporting API
392
403
393 class SiteStats(object):
404 class SiteStats(object):
394 def __init__(self, site):
405 def __init__(self, site):
395 self.site = site
406 self.site = site
396 self.selfcount = 0
407 self.selfcount = 0
397 self.totalcount = 0
408 self.totalcount = 0
398
409
399 def addself(self):
410 def addself(self):
400 self.selfcount += 1
411 self.selfcount += 1
401
412
402 def addtotal(self):
413 def addtotal(self):
403 self.totalcount += 1
414 self.totalcount += 1
404
415
405 def selfpercent(self):
416 def selfpercent(self):
406 return self.selfcount / len(state.samples) * 100
417 return self.selfcount / len(state.samples) * 100
407
418
408 def totalpercent(self):
419 def totalpercent(self):
409 return self.totalcount / len(state.samples) * 100
420 return self.totalcount / len(state.samples) * 100
410
421
411 def selfseconds(self):
422 def selfseconds(self):
412 return self.selfcount * state.seconds_per_sample()
423 return self.selfcount * state.seconds_per_sample()
413
424
414 def totalseconds(self):
425 def totalseconds(self):
415 return self.totalcount * state.seconds_per_sample()
426 return self.totalcount * state.seconds_per_sample()
416
427
417 @classmethod
428 @classmethod
418 def buildstats(cls, samples):
429 def buildstats(cls, samples):
419 stats = {}
430 stats = {}
420
431
421 for sample in samples:
432 for sample in samples:
422 for i, site in enumerate(sample.stack):
433 for i, site in enumerate(sample.stack):
423 sitestat = stats.get(site)
434 sitestat = stats.get(site)
424 if not sitestat:
435 if not sitestat:
425 sitestat = SiteStats(site)
436 sitestat = SiteStats(site)
426 stats[site] = sitestat
437 stats[site] = sitestat
427
438
428 sitestat.addtotal()
439 sitestat.addtotal()
429
440
430 if i == 0:
441 if i == 0:
431 sitestat.addself()
442 sitestat.addself()
432
443
433 return [s for s in stats.itervalues()]
444 return [s for s in stats.itervalues()]
434
445
435 class DisplayFormats:
446 class DisplayFormats:
436 ByLine = 0
447 ByLine = 0
437 ByMethod = 1
448 ByMethod = 1
438 AboutMethod = 2
449 AboutMethod = 2
439 Hotpath = 3
450 Hotpath = 3
440 FlameGraph = 4
451 FlameGraph = 4
441 Json = 5
452 Json = 5
442 Chrome = 6
453 Chrome = 6
443
454
444 def display(fp=None, format=3, data=None, **kwargs):
455 def display(fp=None, format=3, data=None, **kwargs):
445 '''Print statistics, either to stdout or the given file object.'''
456 '''Print statistics, either to stdout or the given file object.'''
446 data = data or state
457 data = data or state
447
458
448 if fp is None:
459 if fp is None:
449 import sys
460 import sys
450 fp = sys.stdout
461 fp = sys.stdout
451 if len(data.samples) == 0:
462 if len(data.samples) == 0:
452 print('No samples recorded.', file=fp)
463 print('No samples recorded.', file=fp)
453 return
464 return
454
465
455 if format == DisplayFormats.ByLine:
466 if format == DisplayFormats.ByLine:
456 display_by_line(data, fp)
467 display_by_line(data, fp)
457 elif format == DisplayFormats.ByMethod:
468 elif format == DisplayFormats.ByMethod:
458 display_by_method(data, fp)
469 display_by_method(data, fp)
459 elif format == DisplayFormats.AboutMethod:
470 elif format == DisplayFormats.AboutMethod:
460 display_about_method(data, fp, **kwargs)
471 display_about_method(data, fp, **kwargs)
461 elif format == DisplayFormats.Hotpath:
472 elif format == DisplayFormats.Hotpath:
462 display_hotpath(data, fp, **kwargs)
473 display_hotpath(data, fp, **kwargs)
463 elif format == DisplayFormats.FlameGraph:
474 elif format == DisplayFormats.FlameGraph:
464 write_to_flame(data, fp, **kwargs)
475 write_to_flame(data, fp, **kwargs)
465 elif format == DisplayFormats.Json:
476 elif format == DisplayFormats.Json:
466 write_to_json(data, fp)
477 write_to_json(data, fp)
467 elif format == DisplayFormats.Chrome:
478 elif format == DisplayFormats.Chrome:
468 write_to_chrome(data, fp, **kwargs)
479 write_to_chrome(data, fp, **kwargs)
469 else:
480 else:
470 raise Exception("Invalid display format")
481 raise Exception("Invalid display format")
471
482
472 if format not in (DisplayFormats.Json, DisplayFormats.Chrome):
483 if format not in (DisplayFormats.Json, DisplayFormats.Chrome):
473 print('---', file=fp)
484 print('---', file=fp)
474 print('Sample count: %d' % len(data.samples), file=fp)
485 print('Sample count: %d' % len(data.samples), file=fp)
475 print('Total time: %f seconds (%f wall)' % data.accumulated_time,
486 print('Total time: %f seconds (%f wall)' % data.accumulated_time,
476 file=fp)
487 file=fp)
477
488
478 def display_by_line(data, fp):
489 def display_by_line(data, fp):
479 '''Print the profiler data with each sample line represented
490 '''Print the profiler data with each sample line represented
480 as one row in a table. Sorted by self-time per line.'''
491 as one row in a table. Sorted by self-time per line.'''
481 stats = SiteStats.buildstats(data.samples)
492 stats = SiteStats.buildstats(data.samples)
482 stats.sort(reverse=True, key=lambda x: x.selfseconds())
493 stats.sort(reverse=True, key=lambda x: x.selfseconds())
483
494
484 print('%5.5s %10.10s %7.7s %-8.8s' %
495 print('%5.5s %10.10s %7.7s %-8.8s' %
485 ('% ', 'cumulative', 'self', ''), file=fp)
496 ('% ', 'cumulative', 'self', ''), file=fp)
486 print('%5.5s %9.9s %8.8s %-8.8s' %
497 print('%5.5s %9.9s %8.8s %-8.8s' %
487 ("time", "seconds", "seconds", "name"), file=fp)
498 ("time", "seconds", "seconds", "name"), file=fp)
488
499
489 for stat in stats:
500 for stat in stats:
490 site = stat.site
501 site = stat.site
491 sitelabel = '%s:%d:%s' % (site.filename(), site.lineno, site.function)
502 sitelabel = '%s:%d:%s' % (site.filename(), site.lineno, site.function)
492 print('%6.2f %9.2f %9.2f %s' % (stat.selfpercent(),
503 print('%6.2f %9.2f %9.2f %s' % (stat.selfpercent(),
493 stat.totalseconds(),
504 stat.totalseconds(),
494 stat.selfseconds(),
505 stat.selfseconds(),
495 sitelabel),
506 sitelabel),
496 file=fp)
507 file=fp)
497
508
498 def display_by_method(data, fp):
509 def display_by_method(data, fp):
499 '''Print the profiler data with each sample function represented
510 '''Print the profiler data with each sample function represented
500 as one row in a table. Important lines within that function are
511 as one row in a table. Important lines within that function are
501 output as nested rows. Sorted by self-time per line.'''
512 output as nested rows. Sorted by self-time per line.'''
502 print('%5.5s %10.10s %7.7s %-8.8s' %
513 print('%5.5s %10.10s %7.7s %-8.8s' %
503 ('% ', 'cumulative', 'self', ''), file=fp)
514 ('% ', 'cumulative', 'self', ''), file=fp)
504 print('%5.5s %9.9s %8.8s %-8.8s' %
515 print('%5.5s %9.9s %8.8s %-8.8s' %
505 ("time", "seconds", "seconds", "name"), file=fp)
516 ("time", "seconds", "seconds", "name"), file=fp)
506
517
507 stats = SiteStats.buildstats(data.samples)
518 stats = SiteStats.buildstats(data.samples)
508
519
509 grouped = defaultdict(list)
520 grouped = defaultdict(list)
510 for stat in stats:
521 for stat in stats:
511 grouped[stat.site.filename() + ":" + stat.site.function].append(stat)
522 grouped[stat.site.filename() + ":" + stat.site.function].append(stat)
512
523
513 # compute sums for each function
524 # compute sums for each function
514 functiondata = []
525 functiondata = []
515 for fname, sitestats in grouped.iteritems():
526 for fname, sitestats in grouped.iteritems():
516 total_cum_sec = 0
527 total_cum_sec = 0
517 total_self_sec = 0
528 total_self_sec = 0
518 total_percent = 0
529 total_percent = 0
519 for stat in sitestats:
530 for stat in sitestats:
520 total_cum_sec += stat.totalseconds()
531 total_cum_sec += stat.totalseconds()
521 total_self_sec += stat.selfseconds()
532 total_self_sec += stat.selfseconds()
522 total_percent += stat.selfpercent()
533 total_percent += stat.selfpercent()
523
534
524 functiondata.append((fname,
535 functiondata.append((fname,
525 total_cum_sec,
536 total_cum_sec,
526 total_self_sec,
537 total_self_sec,
527 total_percent,
538 total_percent,
528 sitestats))
539 sitestats))
529
540
530 # sort by total self sec
541 # sort by total self sec
531 functiondata.sort(reverse=True, key=lambda x: x[2])
542 functiondata.sort(reverse=True, key=lambda x: x[2])
532
543
533 for function in functiondata:
544 for function in functiondata:
534 if function[3] < 0.05:
545 if function[3] < 0.05:
535 continue
546 continue
536 print('%6.2f %9.2f %9.2f %s' % (function[3], # total percent
547 print('%6.2f %9.2f %9.2f %s' % (function[3], # total percent
537 function[1], # total cum sec
548 function[1], # total cum sec
538 function[2], # total self sec
549 function[2], # total self sec
539 function[0]), # file:function
550 function[0]), # file:function
540 file=fp)
551 file=fp)
541 function[4].sort(reverse=True, key=lambda i: i.selfseconds())
552 function[4].sort(reverse=True, key=lambda i: i.selfseconds())
542 for stat in function[4]:
553 for stat in function[4]:
543 # only show line numbers for significant locations (>1% time spent)
554 # only show line numbers for significant locations (>1% time spent)
544 if stat.selfpercent() > 1:
555 if stat.selfpercent() > 1:
545 source = stat.site.getsource(25)
556 source = stat.site.getsource(25)
546 stattuple = (stat.selfpercent(), stat.selfseconds(),
557 stattuple = (stat.selfpercent(), stat.selfseconds(),
547 stat.site.lineno, source)
558 stat.site.lineno, source)
548
559
549 print('%33.0f%% %6.2f line %s: %s' % (stattuple), file=fp)
560 print('%33.0f%% %6.2f line %s: %s' % (stattuple), file=fp)
550
561
551 def display_about_method(data, fp, function=None, **kwargs):
562 def display_about_method(data, fp, function=None, **kwargs):
552 if function is None:
563 if function is None:
553 raise Exception("Invalid function")
564 raise Exception("Invalid function")
554
565
555 filename = None
566 filename = None
556 if ':' in function:
567 if ':' in function:
557 filename, function = function.split(':')
568 filename, function = function.split(':')
558
569
559 relevant_samples = 0
570 relevant_samples = 0
560 parents = {}
571 parents = {}
561 children = {}
572 children = {}
562
573
563 for sample in data.samples:
574 for sample in data.samples:
564 for i, site in enumerate(sample.stack):
575 for i, site in enumerate(sample.stack):
565 if site.function == function and (not filename
576 if site.function == function and (not filename
566 or site.filename() == filename):
577 or site.filename() == filename):
567 relevant_samples += 1
578 relevant_samples += 1
568 if i != len(sample.stack) - 1:
579 if i != len(sample.stack) - 1:
569 parent = sample.stack[i + 1]
580 parent = sample.stack[i + 1]
570 if parent in parents:
581 if parent in parents:
571 parents[parent] = parents[parent] + 1
582 parents[parent] = parents[parent] + 1
572 else:
583 else:
573 parents[parent] = 1
584 parents[parent] = 1
574
585
575 if site in children:
586 if site in children:
576 children[site] = children[site] + 1
587 children[site] = children[site] + 1
577 else:
588 else:
578 children[site] = 1
589 children[site] = 1
579
590
580 parents = [(parent, count) for parent, count in parents.iteritems()]
591 parents = [(parent, count) for parent, count in parents.iteritems()]
581 parents.sort(reverse=True, key=lambda x: x[1])
592 parents.sort(reverse=True, key=lambda x: x[1])
582 for parent, count in parents:
593 for parent, count in parents:
583 print('%6.2f%% %s:%s line %s: %s' %
594 print('%6.2f%% %s:%s line %s: %s' %
584 (count / relevant_samples * 100, parent.filename(),
595 (count / relevant_samples * 100, parent.filename(),
585 parent.function, parent.lineno, parent.getsource(50)), file=fp)
596 parent.function, parent.lineno, parent.getsource(50)), file=fp)
586
597
587 stats = SiteStats.buildstats(data.samples)
598 stats = SiteStats.buildstats(data.samples)
588 stats = [s for s in stats
599 stats = [s for s in stats
589 if s.site.function == function and
600 if s.site.function == function and
590 (not filename or s.site.filename() == filename)]
601 (not filename or s.site.filename() == filename)]
591
602
592 total_cum_sec = 0
603 total_cum_sec = 0
593 total_self_sec = 0
604 total_self_sec = 0
594 total_self_percent = 0
605 total_self_percent = 0
595 total_cum_percent = 0
606 total_cum_percent = 0
596 for stat in stats:
607 for stat in stats:
597 total_cum_sec += stat.totalseconds()
608 total_cum_sec += stat.totalseconds()
598 total_self_sec += stat.selfseconds()
609 total_self_sec += stat.selfseconds()
599 total_self_percent += stat.selfpercent()
610 total_self_percent += stat.selfpercent()
600 total_cum_percent += stat.totalpercent()
611 total_cum_percent += stat.totalpercent()
601
612
602 print(
613 print(
603 '\n %s:%s Total: %0.2fs (%0.2f%%) Self: %0.2fs (%0.2f%%)\n' %
614 '\n %s:%s Total: %0.2fs (%0.2f%%) Self: %0.2fs (%0.2f%%)\n' %
604 (
615 (
605 filename or '___',
616 filename or '___',
606 function,
617 function,
607 total_cum_sec,
618 total_cum_sec,
608 total_cum_percent,
619 total_cum_percent,
609 total_self_sec,
620 total_self_sec,
610 total_self_percent
621 total_self_percent
611 ), file=fp)
622 ), file=fp)
612
623
613 children = [(child, count) for child, count in children.iteritems()]
624 children = [(child, count) for child, count in children.iteritems()]
614 children.sort(reverse=True, key=lambda x: x[1])
625 children.sort(reverse=True, key=lambda x: x[1])
615 for child, count in children:
626 for child, count in children:
616 print(' %6.2f%% line %s: %s' %
627 print(' %6.2f%% line %s: %s' %
617 (count / relevant_samples * 100, child.lineno,
628 (count / relevant_samples * 100, child.lineno,
618 child.getsource(50)), file=fp)
629 child.getsource(50)), file=fp)
619
630
620 def display_hotpath(data, fp, limit=0.05, **kwargs):
631 def display_hotpath(data, fp, limit=0.05, **kwargs):
621 class HotNode(object):
632 class HotNode(object):
622 def __init__(self, site):
633 def __init__(self, site):
623 self.site = site
634 self.site = site
624 self.count = 0
635 self.count = 0
625 self.children = {}
636 self.children = {}
626
637
627 def add(self, stack, time):
638 def add(self, stack, time):
628 self.count += time
639 self.count += time
629 site = stack[0]
640 site = stack[0]
630 child = self.children.get(site)
641 child = self.children.get(site)
631 if not child:
642 if not child:
632 child = HotNode(site)
643 child = HotNode(site)
633 self.children[site] = child
644 self.children[site] = child
634
645
635 if len(stack) > 1:
646 if len(stack) > 1:
636 i = 1
647 i = 1
637 # Skip boiler plate parts of the stack
648 # Skip boiler plate parts of the stack
638 while i < len(stack) and '%s:%s' % (stack[i].filename(), stack[i].function) in skips:
649 while i < len(stack) and '%s:%s' % (stack[i].filename(), stack[i].function) in skips:
639 i += 1
650 i += 1
640 if i < len(stack):
651 if i < len(stack):
641 child.add(stack[i:], time)
652 child.add(stack[i:], time)
642
653
643 root = HotNode(None)
654 root = HotNode(None)
644 lasttime = data.samples[0].time
655 lasttime = data.samples[0].time
645 for sample in data.samples:
656 for sample in data.samples:
646 root.add(sample.stack[::-1], sample.time - lasttime)
657 root.add(sample.stack[::-1], sample.time - lasttime)
647 lasttime = sample.time
658 lasttime = sample.time
648
659
649 def _write(node, depth, multiple_siblings):
660 def _write(node, depth, multiple_siblings):
650 site = node.site
661 site = node.site
651 visiblechildren = [c for c in node.children.itervalues()
662 visiblechildren = [c for c in node.children.itervalues()
652 if c.count >= (limit * root.count)]
663 if c.count >= (limit * root.count)]
653 if site:
664 if site:
654 indent = depth * 2 - 1
665 indent = depth * 2 - 1
655 filename = ''
666 filename = ''
656 function = ''
667 function = ''
657 if len(node.children) > 0:
668 if len(node.children) > 0:
658 childsite = list(node.children.itervalues())[0].site
669 childsite = list(node.children.itervalues())[0].site
659 filename = (childsite.filename() + ':').ljust(15)
670 filename = (childsite.filename() + ':').ljust(15)
660 function = childsite.function
671 function = childsite.function
661
672
662 # lots of string formatting
673 # lots of string formatting
663 listpattern = ''.ljust(indent) +\
674 listpattern = ''.ljust(indent) +\
664 ('\\' if multiple_siblings else '|') +\
675 ('\\' if multiple_siblings else '|') +\
665 ' %4.1f%% %s %s'
676 ' %4.1f%% %s %s'
666 liststring = listpattern % (node.count / root.count * 100,
677 liststring = listpattern % (node.count / root.count * 100,
667 filename, function)
678 filename, function)
668 codepattern = '%' + str(55 - len(liststring)) + 's %s: %s'
679 codepattern = '%' + str(55 - len(liststring)) + 's %s: %s'
669 codestring = codepattern % ('line', site.lineno, site.getsource(30))
680 codestring = codepattern % ('line', site.lineno, site.getsource(30))
670
681
671 finalstring = liststring + codestring
682 finalstring = liststring + codestring
672 childrensamples = sum([c.count for c in node.children.itervalues()])
683 childrensamples = sum([c.count for c in node.children.itervalues()])
673 # Make frames that performed more than 10% of the operation red
684 # Make frames that performed more than 10% of the operation red
674 if node.count - childrensamples > (0.1 * root.count):
685 if node.count - childrensamples > (0.1 * root.count):
675 finalstring = '\033[91m' + finalstring + '\033[0m'
686 finalstring = '\033[91m' + finalstring + '\033[0m'
676 # Make frames that didn't actually perform work dark grey
687 # Make frames that didn't actually perform work dark grey
677 elif node.count - childrensamples == 0:
688 elif node.count - childrensamples == 0:
678 finalstring = '\033[90m' + finalstring + '\033[0m'
689 finalstring = '\033[90m' + finalstring + '\033[0m'
679 print(finalstring, file=fp)
690 print(finalstring, file=fp)
680
691
681 newdepth = depth
692 newdepth = depth
682 if len(visiblechildren) > 1 or multiple_siblings:
693 if len(visiblechildren) > 1 or multiple_siblings:
683 newdepth += 1
694 newdepth += 1
684
695
685 visiblechildren.sort(reverse=True, key=lambda x: x.count)
696 visiblechildren.sort(reverse=True, key=lambda x: x.count)
686 for child in visiblechildren:
697 for child in visiblechildren:
687 _write(child, newdepth, len(visiblechildren) > 1)
698 _write(child, newdepth, len(visiblechildren) > 1)
688
699
689 if root.count > 0:
700 if root.count > 0:
690 _write(root, 0, False)
701 _write(root, 0, False)
691
702
692 def write_to_flame(data, fp, scriptpath=None, outputfile=None, **kwargs):
703 def write_to_flame(data, fp, scriptpath=None, outputfile=None, **kwargs):
693 if scriptpath is None:
704 if scriptpath is None:
694 scriptpath = encoding.environ['HOME'] + '/flamegraph.pl'
705 scriptpath = encoding.environ['HOME'] + '/flamegraph.pl'
695 if not os.path.exists(scriptpath):
706 if not os.path.exists(scriptpath):
696 print("error: missing %s" % scriptpath, file=fp)
707 print("error: missing %s" % scriptpath, file=fp)
697 print("get it here: https://github.com/brendangregg/FlameGraph",
708 print("get it here: https://github.com/brendangregg/FlameGraph",
698 file=fp)
709 file=fp)
699 return
710 return
700
711
701 fd, path = pycompat.mkstemp()
712 fd, path = pycompat.mkstemp()
702
713
703 file = open(path, "w+")
714 file = open(path, "w+")
704
715
705 lines = {}
716 lines = {}
706 for sample in data.samples:
717 for sample in data.samples:
707 sites = [s.function for s in sample.stack]
718 sites = [s.function for s in sample.stack]
708 sites.reverse()
719 sites.reverse()
709 line = ';'.join(sites)
720 line = ';'.join(sites)
710 if line in lines:
721 if line in lines:
711 lines[line] = lines[line] + 1
722 lines[line] = lines[line] + 1
712 else:
723 else:
713 lines[line] = 1
724 lines[line] = 1
714
725
715 for line, count in lines.iteritems():
726 for line, count in lines.iteritems():
716 file.write("%s %s\n" % (line, count))
727 file.write("%s %s\n" % (line, count))
717
728
718 file.close()
729 file.close()
719
730
720 if outputfile is None:
731 if outputfile is None:
721 outputfile = '~/flamegraph.svg'
732 outputfile = '~/flamegraph.svg'
722
733
723 os.system("perl ~/flamegraph.pl %s > %s" % (path, outputfile))
734 os.system("perl ~/flamegraph.pl %s > %s" % (path, outputfile))
724 print("Written to %s" % outputfile, file=fp)
735 print("Written to %s" % outputfile, file=fp)
725
736
726 _pathcache = {}
737 _pathcache = {}
727 def simplifypath(path):
738 def simplifypath(path):
728 '''Attempt to make the path to a Python module easier to read by
739 '''Attempt to make the path to a Python module easier to read by
729 removing whatever part of the Python search path it was found
740 removing whatever part of the Python search path it was found
730 on.'''
741 on.'''
731
742
732 if path in _pathcache:
743 if path in _pathcache:
733 return _pathcache[path]
744 return _pathcache[path]
734 hgpath = pycompat.fsencode(encoding.__file__).rsplit(os.sep, 2)[0]
745 hgpath = pycompat.fsencode(encoding.__file__).rsplit(os.sep, 2)[0]
735 for p in [hgpath] + sys.path:
746 for p in [hgpath] + sys.path:
736 prefix = p + os.sep
747 prefix = p + os.sep
737 if path.startswith(prefix):
748 if path.startswith(prefix):
738 path = path[len(prefix):]
749 path = path[len(prefix):]
739 break
750 break
740 _pathcache[path] = path
751 _pathcache[path] = path
741 return path
752 return path
742
753
743 def write_to_json(data, fp):
754 def write_to_json(data, fp):
744 samples = []
755 samples = []
745
756
746 for sample in data.samples:
757 for sample in data.samples:
747 stack = []
758 stack = []
748
759
749 for frame in sample.stack:
760 for frame in sample.stack:
750 stack.append((frame.path, frame.lineno, frame.function))
761 stack.append((frame.path, frame.lineno, frame.function))
751
762
752 samples.append((sample.time, stack))
763 samples.append((sample.time, stack))
753
764
754 print(json.dumps(samples), file=fp)
765 print(json.dumps(samples), file=fp)
755
766
756 def write_to_chrome(data, fp, minthreshold=0.005, maxthreshold=0.999):
767 def write_to_chrome(data, fp, minthreshold=0.005, maxthreshold=0.999):
757 samples = []
768 samples = []
758 laststack = collections.deque()
769 laststack = collections.deque()
759 lastseen = collections.deque()
770 lastseen = collections.deque()
760
771
761 # The Chrome tracing format allows us to use a compact stack
772 # The Chrome tracing format allows us to use a compact stack
762 # representation to save space. It's fiddly but worth it.
773 # representation to save space. It's fiddly but worth it.
763 # We maintain a bijection between stack and ID.
774 # We maintain a bijection between stack and ID.
764 stack2id = {}
775 stack2id = {}
765 id2stack = [] # will eventually be rendered
776 id2stack = [] # will eventually be rendered
766
777
767 def stackid(stack):
778 def stackid(stack):
768 if not stack:
779 if not stack:
769 return
780 return
770 if stack in stack2id:
781 if stack in stack2id:
771 return stack2id[stack]
782 return stack2id[stack]
772 parent = stackid(stack[1:])
783 parent = stackid(stack[1:])
773 myid = len(stack2id)
784 myid = len(stack2id)
774 stack2id[stack] = myid
785 stack2id[stack] = myid
775 id2stack.append(dict(category=stack[0][0], name='%s %s' % stack[0]))
786 id2stack.append(dict(category=stack[0][0], name='%s %s' % stack[0]))
776 if parent is not None:
787 if parent is not None:
777 id2stack[-1].update(parent=parent)
788 id2stack[-1].update(parent=parent)
778 return myid
789 return myid
779
790
780 def endswith(a, b):
791 def endswith(a, b):
781 return list(a)[-len(b):] == list(b)
792 return list(a)[-len(b):] == list(b)
782
793
783 # The sampling profiler can sample multiple times without
794 # The sampling profiler can sample multiple times without
784 # advancing the clock, potentially causing the Chrome trace viewer
795 # advancing the clock, potentially causing the Chrome trace viewer
785 # to render single-pixel columns that we cannot zoom in on. We
796 # to render single-pixel columns that we cannot zoom in on. We
786 # work around this by pretending that zero-duration samples are a
797 # work around this by pretending that zero-duration samples are a
787 # millisecond in length.
798 # millisecond in length.
788
799
789 clamp = 0.001
800 clamp = 0.001
790
801
791 # We provide knobs that by default attempt to filter out stack
802 # We provide knobs that by default attempt to filter out stack
792 # frames that are too noisy:
803 # frames that are too noisy:
793 #
804 #
794 # * A few take almost all execution time. These are usually boring
805 # * A few take almost all execution time. These are usually boring
795 # setup functions, giving a stack that is deep but uninformative.
806 # setup functions, giving a stack that is deep but uninformative.
796 #
807 #
797 # * Numerous samples take almost no time, but introduce lots of
808 # * Numerous samples take almost no time, but introduce lots of
798 # noisy, oft-deep "spines" into a rendered profile.
809 # noisy, oft-deep "spines" into a rendered profile.
799
810
800 blacklist = set()
811 blacklist = set()
801 totaltime = data.samples[-1].time - data.samples[0].time
812 totaltime = data.samples[-1].time - data.samples[0].time
802 minthreshold = totaltime * minthreshold
813 minthreshold = totaltime * minthreshold
803 maxthreshold = max(totaltime * maxthreshold, clamp)
814 maxthreshold = max(totaltime * maxthreshold, clamp)
804
815
805 def poplast():
816 def poplast():
806 oldsid = stackid(tuple(laststack))
817 oldsid = stackid(tuple(laststack))
807 oldcat, oldfunc = laststack.popleft()
818 oldcat, oldfunc = laststack.popleft()
808 oldtime, oldidx = lastseen.popleft()
819 oldtime, oldidx = lastseen.popleft()
809 duration = sample.time - oldtime
820 duration = sample.time - oldtime
810 if minthreshold <= duration <= maxthreshold:
821 if minthreshold <= duration <= maxthreshold:
811 # ensure no zero-duration events
822 # ensure no zero-duration events
812 sampletime = max(oldtime + clamp, sample.time)
823 sampletime = max(oldtime + clamp, sample.time)
813 samples.append(dict(ph='E', name=oldfunc, cat=oldcat, sf=oldsid,
824 samples.append(dict(ph='E', name=oldfunc, cat=oldcat, sf=oldsid,
814 ts=sampletime*1e6, pid=0))
825 ts=sampletime*1e6, pid=0))
815 else:
826 else:
816 blacklist.add(oldidx)
827 blacklist.add(oldidx)
817
828
818 # Much fiddling to synthesize correctly(ish) nested begin/end
829 # Much fiddling to synthesize correctly(ish) nested begin/end
819 # events given only stack snapshots.
830 # events given only stack snapshots.
820
831
821 for sample in data.samples:
832 for sample in data.samples:
822 tos = sample.stack[0]
833 tos = sample.stack[0]
823 name = tos.function
834 name = tos.function
824 path = simplifypath(tos.path)
835 path = simplifypath(tos.path)
825 stack = tuple((('%s:%d' % (simplifypath(frame.path), frame.lineno),
836 stack = tuple((('%s:%d' % (simplifypath(frame.path), frame.lineno),
826 frame.function) for frame in sample.stack))
837 frame.function) for frame in sample.stack))
827 qstack = collections.deque(stack)
838 qstack = collections.deque(stack)
828 if laststack == qstack:
839 if laststack == qstack:
829 continue
840 continue
830 while laststack and qstack and laststack[-1] == qstack[-1]:
841 while laststack and qstack and laststack[-1] == qstack[-1]:
831 laststack.pop()
842 laststack.pop()
832 qstack.pop()
843 qstack.pop()
833 while laststack:
844 while laststack:
834 poplast()
845 poplast()
835 for f in reversed(qstack):
846 for f in reversed(qstack):
836 lastseen.appendleft((sample.time, len(samples)))
847 lastseen.appendleft((sample.time, len(samples)))
837 laststack.appendleft(f)
848 laststack.appendleft(f)
838 path, name = f
849 path, name = f
839 sid = stackid(tuple(laststack))
850 sid = stackid(tuple(laststack))
840 samples.append(dict(ph='B', name=name, cat=path, ts=sample.time*1e6,
851 samples.append(dict(ph='B', name=name, cat=path, ts=sample.time*1e6,
841 sf=sid, pid=0))
852 sf=sid, pid=0))
842 laststack = collections.deque(stack)
853 laststack = collections.deque(stack)
843 while laststack:
854 while laststack:
844 poplast()
855 poplast()
845 events = [s[1] for s in enumerate(samples) if s[0] not in blacklist]
856 events = [s[1] for s in enumerate(samples) if s[0] not in blacklist]
846 frames = collections.OrderedDict((str(k), v)
857 frames = collections.OrderedDict((str(k), v)
847 for (k,v) in enumerate(id2stack))
858 for (k,v) in enumerate(id2stack))
848 json.dump(dict(traceEvents=events, stackFrames=frames), fp, indent=1)
859 json.dump(dict(traceEvents=events, stackFrames=frames), fp, indent=1)
849 fp.write('\n')
860 fp.write('\n')
850
861
851 def printusage():
862 def printusage():
852 print("""
863 print("""
853 The statprof command line allows you to inspect the last profile's results in
864 The statprof command line allows you to inspect the last profile's results in
854 the following forms:
865 the following forms:
855
866
856 usage:
867 usage:
857 hotpath [-l --limit percent]
868 hotpath [-l --limit percent]
858 Shows a graph of calls with the percent of time each takes.
869 Shows a graph of calls with the percent of time each takes.
859 Red calls take over 10%% of the total time themselves.
870 Red calls take over 10%% of the total time themselves.
860 lines
871 lines
861 Shows the actual sampled lines.
872 Shows the actual sampled lines.
862 functions
873 functions
863 Shows the samples grouped by function.
874 Shows the samples grouped by function.
864 function [filename:]functionname
875 function [filename:]functionname
865 Shows the callers and callees of a particular function.
876 Shows the callers and callees of a particular function.
866 flame [-s --script-path] [-o --output-file path]
877 flame [-s --script-path] [-o --output-file path]
867 Writes out a flamegraph to output-file (defaults to ~/flamegraph.svg)
878 Writes out a flamegraph to output-file (defaults to ~/flamegraph.svg)
868 Requires that ~/flamegraph.pl exist.
879 Requires that ~/flamegraph.pl exist.
869 (Specify alternate script path with --script-path.)""")
880 (Specify alternate script path with --script-path.)""")
870
881
871 def main(argv=None):
882 def main(argv=None):
872 if argv is None:
883 if argv is None:
873 argv = sys.argv
884 argv = sys.argv
874
885
875 if len(argv) == 1:
886 if len(argv) == 1:
876 printusage()
887 printusage()
877 return 0
888 return 0
878
889
879 displayargs = {}
890 displayargs = {}
880
891
881 optstart = 2
892 optstart = 2
882 displayargs['function'] = None
893 displayargs['function'] = None
883 if argv[1] == 'hotpath':
894 if argv[1] == 'hotpath':
884 displayargs['format'] = DisplayFormats.Hotpath
895 displayargs['format'] = DisplayFormats.Hotpath
885 elif argv[1] == 'lines':
896 elif argv[1] == 'lines':
886 displayargs['format'] = DisplayFormats.ByLine
897 displayargs['format'] = DisplayFormats.ByLine
887 elif argv[1] == 'functions':
898 elif argv[1] == 'functions':
888 displayargs['format'] = DisplayFormats.ByMethod
899 displayargs['format'] = DisplayFormats.ByMethod
889 elif argv[1] == 'function':
900 elif argv[1] == 'function':
890 displayargs['format'] = DisplayFormats.AboutMethod
901 displayargs['format'] = DisplayFormats.AboutMethod
891 displayargs['function'] = argv[2]
902 displayargs['function'] = argv[2]
892 optstart = 3
903 optstart = 3
893 elif argv[1] == 'flame':
904 elif argv[1] == 'flame':
894 displayargs['format'] = DisplayFormats.FlameGraph
905 displayargs['format'] = DisplayFormats.FlameGraph
895 else:
906 else:
896 printusage()
907 printusage()
897 return 0
908 return 0
898
909
899 # process options
910 # process options
900 try:
911 try:
901 opts, args = pycompat.getoptb(sys.argv[optstart:], "hl:f:o:p:",
912 opts, args = pycompat.getoptb(sys.argv[optstart:], "hl:f:o:p:",
902 ["help", "limit=", "file=", "output-file=", "script-path="])
913 ["help", "limit=", "file=", "output-file=", "script-path="])
903 except getopt.error as msg:
914 except getopt.error as msg:
904 print(msg)
915 print(msg)
905 printusage()
916 printusage()
906 return 2
917 return 2
907
918
908 displayargs['limit'] = 0.05
919 displayargs['limit'] = 0.05
909 path = None
920 path = None
910 for o, value in opts:
921 for o, value in opts:
911 if o in ("-l", "--limit"):
922 if o in ("-l", "--limit"):
912 displayargs['limit'] = float(value)
923 displayargs['limit'] = float(value)
913 elif o in ("-f", "--file"):
924 elif o in ("-f", "--file"):
914 path = value
925 path = value
915 elif o in ("-o", "--output-file"):
926 elif o in ("-o", "--output-file"):
916 displayargs['outputfile'] = value
927 displayargs['outputfile'] = value
917 elif o in ("-p", "--script-path"):
928 elif o in ("-p", "--script-path"):
918 displayargs['scriptpath'] = value
929 displayargs['scriptpath'] = value
919 elif o in ("-h", "help"):
930 elif o in ("-h", "help"):
920 printusage()
931 printusage()
921 return 0
932 return 0
922 else:
933 else:
923 assert False, "unhandled option %s" % o
934 assert False, "unhandled option %s" % o
924
935
925 if not path:
936 if not path:
926 print('must specify --file to load')
937 print('must specify --file to load')
927 return 1
938 return 1
928
939
929 load_data(path=path)
940 load_data(path=path)
930
941
931 display(**pycompat.strkwargs(displayargs))
942 display(**pycompat.strkwargs(displayargs))
932
943
933 return 0
944 return 0
934
945
935 if __name__ == "__main__":
946 if __name__ == "__main__":
936 sys.exit(main())
947 sys.exit(main())
General Comments 0
You need to be logged in to leave comments. Login now