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