##// END OF EJS Templates
extension: add a `required` suboption to enforce the use of an extensions...
marmoute -
r49184:0d0ce252 default
parent child Browse files
Show More
@@ -1,2731 +1,2737 b''
1 # configitems.py - centralized declaration of configuration option
1 # configitems.py - centralized declaration of configuration option
2 #
2 #
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import functools
10 import functools
11 import re
11 import re
12
12
13 from . import (
13 from . import (
14 encoding,
14 encoding,
15 error,
15 error,
16 )
16 )
17
17
18
18
19 def loadconfigtable(ui, extname, configtable):
19 def loadconfigtable(ui, extname, configtable):
20 """update config item known to the ui with the extension ones"""
20 """update config item known to the ui with the extension ones"""
21 for section, items in sorted(configtable.items()):
21 for section, items in sorted(configtable.items()):
22 knownitems = ui._knownconfig.setdefault(section, itemregister())
22 knownitems = ui._knownconfig.setdefault(section, itemregister())
23 knownkeys = set(knownitems)
23 knownkeys = set(knownitems)
24 newkeys = set(items)
24 newkeys = set(items)
25 for key in sorted(knownkeys & newkeys):
25 for key in sorted(knownkeys & newkeys):
26 msg = b"extension '%s' overwrite config item '%s.%s'"
26 msg = b"extension '%s' overwrite config item '%s.%s'"
27 msg %= (extname, section, key)
27 msg %= (extname, section, key)
28 ui.develwarn(msg, config=b'warn-config')
28 ui.develwarn(msg, config=b'warn-config')
29
29
30 knownitems.update(items)
30 knownitems.update(items)
31
31
32
32
33 class configitem(object):
33 class configitem(object):
34 """represent a known config item
34 """represent a known config item
35
35
36 :section: the official config section where to find this item,
36 :section: the official config section where to find this item,
37 :name: the official name within the section,
37 :name: the official name within the section,
38 :default: default value for this item,
38 :default: default value for this item,
39 :alias: optional list of tuples as alternatives,
39 :alias: optional list of tuples as alternatives,
40 :generic: this is a generic definition, match name using regular expression.
40 :generic: this is a generic definition, match name using regular expression.
41 """
41 """
42
42
43 def __init__(
43 def __init__(
44 self,
44 self,
45 section,
45 section,
46 name,
46 name,
47 default=None,
47 default=None,
48 alias=(),
48 alias=(),
49 generic=False,
49 generic=False,
50 priority=0,
50 priority=0,
51 experimental=False,
51 experimental=False,
52 ):
52 ):
53 self.section = section
53 self.section = section
54 self.name = name
54 self.name = name
55 self.default = default
55 self.default = default
56 self.alias = list(alias)
56 self.alias = list(alias)
57 self.generic = generic
57 self.generic = generic
58 self.priority = priority
58 self.priority = priority
59 self.experimental = experimental
59 self.experimental = experimental
60 self._re = None
60 self._re = None
61 if generic:
61 if generic:
62 self._re = re.compile(self.name)
62 self._re = re.compile(self.name)
63
63
64
64
65 class itemregister(dict):
65 class itemregister(dict):
66 """A specialized dictionary that can handle wild-card selection"""
66 """A specialized dictionary that can handle wild-card selection"""
67
67
68 def __init__(self):
68 def __init__(self):
69 super(itemregister, self).__init__()
69 super(itemregister, self).__init__()
70 self._generics = set()
70 self._generics = set()
71
71
72 def update(self, other):
72 def update(self, other):
73 super(itemregister, self).update(other)
73 super(itemregister, self).update(other)
74 self._generics.update(other._generics)
74 self._generics.update(other._generics)
75
75
76 def __setitem__(self, key, item):
76 def __setitem__(self, key, item):
77 super(itemregister, self).__setitem__(key, item)
77 super(itemregister, self).__setitem__(key, item)
78 if item.generic:
78 if item.generic:
79 self._generics.add(item)
79 self._generics.add(item)
80
80
81 def get(self, key):
81 def get(self, key):
82 baseitem = super(itemregister, self).get(key)
82 baseitem = super(itemregister, self).get(key)
83 if baseitem is not None and not baseitem.generic:
83 if baseitem is not None and not baseitem.generic:
84 return baseitem
84 return baseitem
85
85
86 # search for a matching generic item
86 # search for a matching generic item
87 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
87 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
88 for item in generics:
88 for item in generics:
89 # we use 'match' instead of 'search' to make the matching simpler
89 # we use 'match' instead of 'search' to make the matching simpler
90 # for people unfamiliar with regular expression. Having the match
90 # for people unfamiliar with regular expression. Having the match
91 # rooted to the start of the string will produce less surprising
91 # rooted to the start of the string will produce less surprising
92 # result for user writing simple regex for sub-attribute.
92 # result for user writing simple regex for sub-attribute.
93 #
93 #
94 # For example using "color\..*" match produces an unsurprising
94 # For example using "color\..*" match produces an unsurprising
95 # result, while using search could suddenly match apparently
95 # result, while using search could suddenly match apparently
96 # unrelated configuration that happens to contains "color."
96 # unrelated configuration that happens to contains "color."
97 # anywhere. This is a tradeoff where we favor requiring ".*" on
97 # anywhere. This is a tradeoff where we favor requiring ".*" on
98 # some match to avoid the need to prefix most pattern with "^".
98 # some match to avoid the need to prefix most pattern with "^".
99 # The "^" seems more error prone.
99 # The "^" seems more error prone.
100 if item._re.match(key):
100 if item._re.match(key):
101 return item
101 return item
102
102
103 return None
103 return None
104
104
105
105
106 coreitems = {}
106 coreitems = {}
107
107
108
108
109 def _register(configtable, *args, **kwargs):
109 def _register(configtable, *args, **kwargs):
110 item = configitem(*args, **kwargs)
110 item = configitem(*args, **kwargs)
111 section = configtable.setdefault(item.section, itemregister())
111 section = configtable.setdefault(item.section, itemregister())
112 if item.name in section:
112 if item.name in section:
113 msg = b"duplicated config item registration for '%s.%s'"
113 msg = b"duplicated config item registration for '%s.%s'"
114 raise error.ProgrammingError(msg % (item.section, item.name))
114 raise error.ProgrammingError(msg % (item.section, item.name))
115 section[item.name] = item
115 section[item.name] = item
116
116
117
117
118 # special value for case where the default is derived from other values
118 # special value for case where the default is derived from other values
119 dynamicdefault = object()
119 dynamicdefault = object()
120
120
121 # Registering actual config items
121 # Registering actual config items
122
122
123
123
124 def getitemregister(configtable):
124 def getitemregister(configtable):
125 f = functools.partial(_register, configtable)
125 f = functools.partial(_register, configtable)
126 # export pseudo enum as configitem.*
126 # export pseudo enum as configitem.*
127 f.dynamicdefault = dynamicdefault
127 f.dynamicdefault = dynamicdefault
128 return f
128 return f
129
129
130
130
131 coreconfigitem = getitemregister(coreitems)
131 coreconfigitem = getitemregister(coreitems)
132
132
133
133
134 def _registerdiffopts(section, configprefix=b''):
134 def _registerdiffopts(section, configprefix=b''):
135 coreconfigitem(
135 coreconfigitem(
136 section,
136 section,
137 configprefix + b'nodates',
137 configprefix + b'nodates',
138 default=False,
138 default=False,
139 )
139 )
140 coreconfigitem(
140 coreconfigitem(
141 section,
141 section,
142 configprefix + b'showfunc',
142 configprefix + b'showfunc',
143 default=False,
143 default=False,
144 )
144 )
145 coreconfigitem(
145 coreconfigitem(
146 section,
146 section,
147 configprefix + b'unified',
147 configprefix + b'unified',
148 default=None,
148 default=None,
149 )
149 )
150 coreconfigitem(
150 coreconfigitem(
151 section,
151 section,
152 configprefix + b'git',
152 configprefix + b'git',
153 default=False,
153 default=False,
154 )
154 )
155 coreconfigitem(
155 coreconfigitem(
156 section,
156 section,
157 configprefix + b'ignorews',
157 configprefix + b'ignorews',
158 default=False,
158 default=False,
159 )
159 )
160 coreconfigitem(
160 coreconfigitem(
161 section,
161 section,
162 configprefix + b'ignorewsamount',
162 configprefix + b'ignorewsamount',
163 default=False,
163 default=False,
164 )
164 )
165 coreconfigitem(
165 coreconfigitem(
166 section,
166 section,
167 configprefix + b'ignoreblanklines',
167 configprefix + b'ignoreblanklines',
168 default=False,
168 default=False,
169 )
169 )
170 coreconfigitem(
170 coreconfigitem(
171 section,
171 section,
172 configprefix + b'ignorewseol',
172 configprefix + b'ignorewseol',
173 default=False,
173 default=False,
174 )
174 )
175 coreconfigitem(
175 coreconfigitem(
176 section,
176 section,
177 configprefix + b'nobinary',
177 configprefix + b'nobinary',
178 default=False,
178 default=False,
179 )
179 )
180 coreconfigitem(
180 coreconfigitem(
181 section,
181 section,
182 configprefix + b'noprefix',
182 configprefix + b'noprefix',
183 default=False,
183 default=False,
184 )
184 )
185 coreconfigitem(
185 coreconfigitem(
186 section,
186 section,
187 configprefix + b'word-diff',
187 configprefix + b'word-diff',
188 default=False,
188 default=False,
189 )
189 )
190
190
191
191
192 coreconfigitem(
192 coreconfigitem(
193 b'alias',
193 b'alias',
194 b'.*',
194 b'.*',
195 default=dynamicdefault,
195 default=dynamicdefault,
196 generic=True,
196 generic=True,
197 )
197 )
198 coreconfigitem(
198 coreconfigitem(
199 b'auth',
199 b'auth',
200 b'cookiefile',
200 b'cookiefile',
201 default=None,
201 default=None,
202 )
202 )
203 _registerdiffopts(section=b'annotate')
203 _registerdiffopts(section=b'annotate')
204 # bookmarks.pushing: internal hack for discovery
204 # bookmarks.pushing: internal hack for discovery
205 coreconfigitem(
205 coreconfigitem(
206 b'bookmarks',
206 b'bookmarks',
207 b'pushing',
207 b'pushing',
208 default=list,
208 default=list,
209 )
209 )
210 # bundle.mainreporoot: internal hack for bundlerepo
210 # bundle.mainreporoot: internal hack for bundlerepo
211 coreconfigitem(
211 coreconfigitem(
212 b'bundle',
212 b'bundle',
213 b'mainreporoot',
213 b'mainreporoot',
214 default=b'',
214 default=b'',
215 )
215 )
216 coreconfigitem(
216 coreconfigitem(
217 b'censor',
217 b'censor',
218 b'policy',
218 b'policy',
219 default=b'abort',
219 default=b'abort',
220 experimental=True,
220 experimental=True,
221 )
221 )
222 coreconfigitem(
222 coreconfigitem(
223 b'chgserver',
223 b'chgserver',
224 b'idletimeout',
224 b'idletimeout',
225 default=3600,
225 default=3600,
226 )
226 )
227 coreconfigitem(
227 coreconfigitem(
228 b'chgserver',
228 b'chgserver',
229 b'skiphash',
229 b'skiphash',
230 default=False,
230 default=False,
231 )
231 )
232 coreconfigitem(
232 coreconfigitem(
233 b'cmdserver',
233 b'cmdserver',
234 b'log',
234 b'log',
235 default=None,
235 default=None,
236 )
236 )
237 coreconfigitem(
237 coreconfigitem(
238 b'cmdserver',
238 b'cmdserver',
239 b'max-log-files',
239 b'max-log-files',
240 default=7,
240 default=7,
241 )
241 )
242 coreconfigitem(
242 coreconfigitem(
243 b'cmdserver',
243 b'cmdserver',
244 b'max-log-size',
244 b'max-log-size',
245 default=b'1 MB',
245 default=b'1 MB',
246 )
246 )
247 coreconfigitem(
247 coreconfigitem(
248 b'cmdserver',
248 b'cmdserver',
249 b'max-repo-cache',
249 b'max-repo-cache',
250 default=0,
250 default=0,
251 experimental=True,
251 experimental=True,
252 )
252 )
253 coreconfigitem(
253 coreconfigitem(
254 b'cmdserver',
254 b'cmdserver',
255 b'message-encodings',
255 b'message-encodings',
256 default=list,
256 default=list,
257 )
257 )
258 coreconfigitem(
258 coreconfigitem(
259 b'cmdserver',
259 b'cmdserver',
260 b'track-log',
260 b'track-log',
261 default=lambda: [b'chgserver', b'cmdserver', b'repocache'],
261 default=lambda: [b'chgserver', b'cmdserver', b'repocache'],
262 )
262 )
263 coreconfigitem(
263 coreconfigitem(
264 b'cmdserver',
264 b'cmdserver',
265 b'shutdown-on-interrupt',
265 b'shutdown-on-interrupt',
266 default=True,
266 default=True,
267 )
267 )
268 coreconfigitem(
268 coreconfigitem(
269 b'color',
269 b'color',
270 b'.*',
270 b'.*',
271 default=None,
271 default=None,
272 generic=True,
272 generic=True,
273 )
273 )
274 coreconfigitem(
274 coreconfigitem(
275 b'color',
275 b'color',
276 b'mode',
276 b'mode',
277 default=b'auto',
277 default=b'auto',
278 )
278 )
279 coreconfigitem(
279 coreconfigitem(
280 b'color',
280 b'color',
281 b'pagermode',
281 b'pagermode',
282 default=dynamicdefault,
282 default=dynamicdefault,
283 )
283 )
284 coreconfigitem(
284 coreconfigitem(
285 b'command-templates',
285 b'command-templates',
286 b'graphnode',
286 b'graphnode',
287 default=None,
287 default=None,
288 alias=[(b'ui', b'graphnodetemplate')],
288 alias=[(b'ui', b'graphnodetemplate')],
289 )
289 )
290 coreconfigitem(
290 coreconfigitem(
291 b'command-templates',
291 b'command-templates',
292 b'log',
292 b'log',
293 default=None,
293 default=None,
294 alias=[(b'ui', b'logtemplate')],
294 alias=[(b'ui', b'logtemplate')],
295 )
295 )
296 coreconfigitem(
296 coreconfigitem(
297 b'command-templates',
297 b'command-templates',
298 b'mergemarker',
298 b'mergemarker',
299 default=(
299 default=(
300 b'{node|short} '
300 b'{node|short} '
301 b'{ifeq(tags, "tip", "", '
301 b'{ifeq(tags, "tip", "", '
302 b'ifeq(tags, "", "", "{tags} "))}'
302 b'ifeq(tags, "", "", "{tags} "))}'
303 b'{if(bookmarks, "{bookmarks} ")}'
303 b'{if(bookmarks, "{bookmarks} ")}'
304 b'{ifeq(branch, "default", "", "{branch} ")}'
304 b'{ifeq(branch, "default", "", "{branch} ")}'
305 b'- {author|user}: {desc|firstline}'
305 b'- {author|user}: {desc|firstline}'
306 ),
306 ),
307 alias=[(b'ui', b'mergemarkertemplate')],
307 alias=[(b'ui', b'mergemarkertemplate')],
308 )
308 )
309 coreconfigitem(
309 coreconfigitem(
310 b'command-templates',
310 b'command-templates',
311 b'pre-merge-tool-output',
311 b'pre-merge-tool-output',
312 default=None,
312 default=None,
313 alias=[(b'ui', b'pre-merge-tool-output-template')],
313 alias=[(b'ui', b'pre-merge-tool-output-template')],
314 )
314 )
315 coreconfigitem(
315 coreconfigitem(
316 b'command-templates',
316 b'command-templates',
317 b'oneline-summary',
317 b'oneline-summary',
318 default=None,
318 default=None,
319 )
319 )
320 coreconfigitem(
320 coreconfigitem(
321 b'command-templates',
321 b'command-templates',
322 b'oneline-summary.*',
322 b'oneline-summary.*',
323 default=dynamicdefault,
323 default=dynamicdefault,
324 generic=True,
324 generic=True,
325 )
325 )
326 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
326 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
327 coreconfigitem(
327 coreconfigitem(
328 b'commands',
328 b'commands',
329 b'commit.post-status',
329 b'commit.post-status',
330 default=False,
330 default=False,
331 )
331 )
332 coreconfigitem(
332 coreconfigitem(
333 b'commands',
333 b'commands',
334 b'grep.all-files',
334 b'grep.all-files',
335 default=False,
335 default=False,
336 experimental=True,
336 experimental=True,
337 )
337 )
338 coreconfigitem(
338 coreconfigitem(
339 b'commands',
339 b'commands',
340 b'merge.require-rev',
340 b'merge.require-rev',
341 default=False,
341 default=False,
342 )
342 )
343 coreconfigitem(
343 coreconfigitem(
344 b'commands',
344 b'commands',
345 b'push.require-revs',
345 b'push.require-revs',
346 default=False,
346 default=False,
347 )
347 )
348 coreconfigitem(
348 coreconfigitem(
349 b'commands',
349 b'commands',
350 b'resolve.confirm',
350 b'resolve.confirm',
351 default=False,
351 default=False,
352 )
352 )
353 coreconfigitem(
353 coreconfigitem(
354 b'commands',
354 b'commands',
355 b'resolve.explicit-re-merge',
355 b'resolve.explicit-re-merge',
356 default=False,
356 default=False,
357 )
357 )
358 coreconfigitem(
358 coreconfigitem(
359 b'commands',
359 b'commands',
360 b'resolve.mark-check',
360 b'resolve.mark-check',
361 default=b'none',
361 default=b'none',
362 )
362 )
363 _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.')
363 _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.')
364 coreconfigitem(
364 coreconfigitem(
365 b'commands',
365 b'commands',
366 b'show.aliasprefix',
366 b'show.aliasprefix',
367 default=list,
367 default=list,
368 )
368 )
369 coreconfigitem(
369 coreconfigitem(
370 b'commands',
370 b'commands',
371 b'status.relative',
371 b'status.relative',
372 default=False,
372 default=False,
373 )
373 )
374 coreconfigitem(
374 coreconfigitem(
375 b'commands',
375 b'commands',
376 b'status.skipstates',
376 b'status.skipstates',
377 default=[],
377 default=[],
378 experimental=True,
378 experimental=True,
379 )
379 )
380 coreconfigitem(
380 coreconfigitem(
381 b'commands',
381 b'commands',
382 b'status.terse',
382 b'status.terse',
383 default=b'',
383 default=b'',
384 )
384 )
385 coreconfigitem(
385 coreconfigitem(
386 b'commands',
386 b'commands',
387 b'status.verbose',
387 b'status.verbose',
388 default=False,
388 default=False,
389 )
389 )
390 coreconfigitem(
390 coreconfigitem(
391 b'commands',
391 b'commands',
392 b'update.check',
392 b'update.check',
393 default=None,
393 default=None,
394 )
394 )
395 coreconfigitem(
395 coreconfigitem(
396 b'commands',
396 b'commands',
397 b'update.requiredest',
397 b'update.requiredest',
398 default=False,
398 default=False,
399 )
399 )
400 coreconfigitem(
400 coreconfigitem(
401 b'committemplate',
401 b'committemplate',
402 b'.*',
402 b'.*',
403 default=None,
403 default=None,
404 generic=True,
404 generic=True,
405 )
405 )
406 coreconfigitem(
406 coreconfigitem(
407 b'convert',
407 b'convert',
408 b'bzr.saverev',
408 b'bzr.saverev',
409 default=True,
409 default=True,
410 )
410 )
411 coreconfigitem(
411 coreconfigitem(
412 b'convert',
412 b'convert',
413 b'cvsps.cache',
413 b'cvsps.cache',
414 default=True,
414 default=True,
415 )
415 )
416 coreconfigitem(
416 coreconfigitem(
417 b'convert',
417 b'convert',
418 b'cvsps.fuzz',
418 b'cvsps.fuzz',
419 default=60,
419 default=60,
420 )
420 )
421 coreconfigitem(
421 coreconfigitem(
422 b'convert',
422 b'convert',
423 b'cvsps.logencoding',
423 b'cvsps.logencoding',
424 default=None,
424 default=None,
425 )
425 )
426 coreconfigitem(
426 coreconfigitem(
427 b'convert',
427 b'convert',
428 b'cvsps.mergefrom',
428 b'cvsps.mergefrom',
429 default=None,
429 default=None,
430 )
430 )
431 coreconfigitem(
431 coreconfigitem(
432 b'convert',
432 b'convert',
433 b'cvsps.mergeto',
433 b'cvsps.mergeto',
434 default=None,
434 default=None,
435 )
435 )
436 coreconfigitem(
436 coreconfigitem(
437 b'convert',
437 b'convert',
438 b'git.committeractions',
438 b'git.committeractions',
439 default=lambda: [b'messagedifferent'],
439 default=lambda: [b'messagedifferent'],
440 )
440 )
441 coreconfigitem(
441 coreconfigitem(
442 b'convert',
442 b'convert',
443 b'git.extrakeys',
443 b'git.extrakeys',
444 default=list,
444 default=list,
445 )
445 )
446 coreconfigitem(
446 coreconfigitem(
447 b'convert',
447 b'convert',
448 b'git.findcopiesharder',
448 b'git.findcopiesharder',
449 default=False,
449 default=False,
450 )
450 )
451 coreconfigitem(
451 coreconfigitem(
452 b'convert',
452 b'convert',
453 b'git.remoteprefix',
453 b'git.remoteprefix',
454 default=b'remote',
454 default=b'remote',
455 )
455 )
456 coreconfigitem(
456 coreconfigitem(
457 b'convert',
457 b'convert',
458 b'git.renamelimit',
458 b'git.renamelimit',
459 default=400,
459 default=400,
460 )
460 )
461 coreconfigitem(
461 coreconfigitem(
462 b'convert',
462 b'convert',
463 b'git.saverev',
463 b'git.saverev',
464 default=True,
464 default=True,
465 )
465 )
466 coreconfigitem(
466 coreconfigitem(
467 b'convert',
467 b'convert',
468 b'git.similarity',
468 b'git.similarity',
469 default=50,
469 default=50,
470 )
470 )
471 coreconfigitem(
471 coreconfigitem(
472 b'convert',
472 b'convert',
473 b'git.skipsubmodules',
473 b'git.skipsubmodules',
474 default=False,
474 default=False,
475 )
475 )
476 coreconfigitem(
476 coreconfigitem(
477 b'convert',
477 b'convert',
478 b'hg.clonebranches',
478 b'hg.clonebranches',
479 default=False,
479 default=False,
480 )
480 )
481 coreconfigitem(
481 coreconfigitem(
482 b'convert',
482 b'convert',
483 b'hg.ignoreerrors',
483 b'hg.ignoreerrors',
484 default=False,
484 default=False,
485 )
485 )
486 coreconfigitem(
486 coreconfigitem(
487 b'convert',
487 b'convert',
488 b'hg.preserve-hash',
488 b'hg.preserve-hash',
489 default=False,
489 default=False,
490 )
490 )
491 coreconfigitem(
491 coreconfigitem(
492 b'convert',
492 b'convert',
493 b'hg.revs',
493 b'hg.revs',
494 default=None,
494 default=None,
495 )
495 )
496 coreconfigitem(
496 coreconfigitem(
497 b'convert',
497 b'convert',
498 b'hg.saverev',
498 b'hg.saverev',
499 default=False,
499 default=False,
500 )
500 )
501 coreconfigitem(
501 coreconfigitem(
502 b'convert',
502 b'convert',
503 b'hg.sourcename',
503 b'hg.sourcename',
504 default=None,
504 default=None,
505 )
505 )
506 coreconfigitem(
506 coreconfigitem(
507 b'convert',
507 b'convert',
508 b'hg.startrev',
508 b'hg.startrev',
509 default=None,
509 default=None,
510 )
510 )
511 coreconfigitem(
511 coreconfigitem(
512 b'convert',
512 b'convert',
513 b'hg.tagsbranch',
513 b'hg.tagsbranch',
514 default=b'default',
514 default=b'default',
515 )
515 )
516 coreconfigitem(
516 coreconfigitem(
517 b'convert',
517 b'convert',
518 b'hg.usebranchnames',
518 b'hg.usebranchnames',
519 default=True,
519 default=True,
520 )
520 )
521 coreconfigitem(
521 coreconfigitem(
522 b'convert',
522 b'convert',
523 b'ignoreancestorcheck',
523 b'ignoreancestorcheck',
524 default=False,
524 default=False,
525 experimental=True,
525 experimental=True,
526 )
526 )
527 coreconfigitem(
527 coreconfigitem(
528 b'convert',
528 b'convert',
529 b'localtimezone',
529 b'localtimezone',
530 default=False,
530 default=False,
531 )
531 )
532 coreconfigitem(
532 coreconfigitem(
533 b'convert',
533 b'convert',
534 b'p4.encoding',
534 b'p4.encoding',
535 default=dynamicdefault,
535 default=dynamicdefault,
536 )
536 )
537 coreconfigitem(
537 coreconfigitem(
538 b'convert',
538 b'convert',
539 b'p4.startrev',
539 b'p4.startrev',
540 default=0,
540 default=0,
541 )
541 )
542 coreconfigitem(
542 coreconfigitem(
543 b'convert',
543 b'convert',
544 b'skiptags',
544 b'skiptags',
545 default=False,
545 default=False,
546 )
546 )
547 coreconfigitem(
547 coreconfigitem(
548 b'convert',
548 b'convert',
549 b'svn.debugsvnlog',
549 b'svn.debugsvnlog',
550 default=True,
550 default=True,
551 )
551 )
552 coreconfigitem(
552 coreconfigitem(
553 b'convert',
553 b'convert',
554 b'svn.trunk',
554 b'svn.trunk',
555 default=None,
555 default=None,
556 )
556 )
557 coreconfigitem(
557 coreconfigitem(
558 b'convert',
558 b'convert',
559 b'svn.tags',
559 b'svn.tags',
560 default=None,
560 default=None,
561 )
561 )
562 coreconfigitem(
562 coreconfigitem(
563 b'convert',
563 b'convert',
564 b'svn.branches',
564 b'svn.branches',
565 default=None,
565 default=None,
566 )
566 )
567 coreconfigitem(
567 coreconfigitem(
568 b'convert',
568 b'convert',
569 b'svn.startrev',
569 b'svn.startrev',
570 default=0,
570 default=0,
571 )
571 )
572 coreconfigitem(
572 coreconfigitem(
573 b'convert',
573 b'convert',
574 b'svn.dangerous-set-commit-dates',
574 b'svn.dangerous-set-commit-dates',
575 default=False,
575 default=False,
576 )
576 )
577 coreconfigitem(
577 coreconfigitem(
578 b'debug',
578 b'debug',
579 b'dirstate.delaywrite',
579 b'dirstate.delaywrite',
580 default=0,
580 default=0,
581 )
581 )
582 coreconfigitem(
582 coreconfigitem(
583 b'debug',
583 b'debug',
584 b'revlog.verifyposition.changelog',
584 b'revlog.verifyposition.changelog',
585 default=b'',
585 default=b'',
586 )
586 )
587 coreconfigitem(
587 coreconfigitem(
588 b'defaults',
588 b'defaults',
589 b'.*',
589 b'.*',
590 default=None,
590 default=None,
591 generic=True,
591 generic=True,
592 )
592 )
593 coreconfigitem(
593 coreconfigitem(
594 b'devel',
594 b'devel',
595 b'all-warnings',
595 b'all-warnings',
596 default=False,
596 default=False,
597 )
597 )
598 coreconfigitem(
598 coreconfigitem(
599 b'devel',
599 b'devel',
600 b'bundle2.debug',
600 b'bundle2.debug',
601 default=False,
601 default=False,
602 )
602 )
603 coreconfigitem(
603 coreconfigitem(
604 b'devel',
604 b'devel',
605 b'bundle.delta',
605 b'bundle.delta',
606 default=b'',
606 default=b'',
607 )
607 )
608 coreconfigitem(
608 coreconfigitem(
609 b'devel',
609 b'devel',
610 b'cache-vfs',
610 b'cache-vfs',
611 default=None,
611 default=None,
612 )
612 )
613 coreconfigitem(
613 coreconfigitem(
614 b'devel',
614 b'devel',
615 b'check-locks',
615 b'check-locks',
616 default=False,
616 default=False,
617 )
617 )
618 coreconfigitem(
618 coreconfigitem(
619 b'devel',
619 b'devel',
620 b'check-relroot',
620 b'check-relroot',
621 default=False,
621 default=False,
622 )
622 )
623 # Track copy information for all file, not just "added" one (very slow)
623 # Track copy information for all file, not just "added" one (very slow)
624 coreconfigitem(
624 coreconfigitem(
625 b'devel',
625 b'devel',
626 b'copy-tracing.trace-all-files',
626 b'copy-tracing.trace-all-files',
627 default=False,
627 default=False,
628 )
628 )
629 coreconfigitem(
629 coreconfigitem(
630 b'devel',
630 b'devel',
631 b'default-date',
631 b'default-date',
632 default=None,
632 default=None,
633 )
633 )
634 coreconfigitem(
634 coreconfigitem(
635 b'devel',
635 b'devel',
636 b'deprec-warn',
636 b'deprec-warn',
637 default=False,
637 default=False,
638 )
638 )
639 coreconfigitem(
639 coreconfigitem(
640 b'devel',
640 b'devel',
641 b'disableloaddefaultcerts',
641 b'disableloaddefaultcerts',
642 default=False,
642 default=False,
643 )
643 )
644 coreconfigitem(
644 coreconfigitem(
645 b'devel',
645 b'devel',
646 b'warn-empty-changegroup',
646 b'warn-empty-changegroup',
647 default=False,
647 default=False,
648 )
648 )
649 coreconfigitem(
649 coreconfigitem(
650 b'devel',
650 b'devel',
651 b'legacy.exchange',
651 b'legacy.exchange',
652 default=list,
652 default=list,
653 )
653 )
654 # When True, revlogs use a special reference version of the nodemap, that is not
654 # When True, revlogs use a special reference version of the nodemap, that is not
655 # performant but is "known" to behave properly.
655 # performant but is "known" to behave properly.
656 coreconfigitem(
656 coreconfigitem(
657 b'devel',
657 b'devel',
658 b'persistent-nodemap',
658 b'persistent-nodemap',
659 default=False,
659 default=False,
660 )
660 )
661 coreconfigitem(
661 coreconfigitem(
662 b'devel',
662 b'devel',
663 b'servercafile',
663 b'servercafile',
664 default=b'',
664 default=b'',
665 )
665 )
666 coreconfigitem(
666 coreconfigitem(
667 b'devel',
667 b'devel',
668 b'serverexactprotocol',
668 b'serverexactprotocol',
669 default=b'',
669 default=b'',
670 )
670 )
671 coreconfigitem(
671 coreconfigitem(
672 b'devel',
672 b'devel',
673 b'serverrequirecert',
673 b'serverrequirecert',
674 default=False,
674 default=False,
675 )
675 )
676 coreconfigitem(
676 coreconfigitem(
677 b'devel',
677 b'devel',
678 b'strip-obsmarkers',
678 b'strip-obsmarkers',
679 default=True,
679 default=True,
680 )
680 )
681 coreconfigitem(
681 coreconfigitem(
682 b'devel',
682 b'devel',
683 b'warn-config',
683 b'warn-config',
684 default=None,
684 default=None,
685 )
685 )
686 coreconfigitem(
686 coreconfigitem(
687 b'devel',
687 b'devel',
688 b'warn-config-default',
688 b'warn-config-default',
689 default=None,
689 default=None,
690 )
690 )
691 coreconfigitem(
691 coreconfigitem(
692 b'devel',
692 b'devel',
693 b'user.obsmarker',
693 b'user.obsmarker',
694 default=None,
694 default=None,
695 )
695 )
696 coreconfigitem(
696 coreconfigitem(
697 b'devel',
697 b'devel',
698 b'warn-config-unknown',
698 b'warn-config-unknown',
699 default=None,
699 default=None,
700 )
700 )
701 coreconfigitem(
701 coreconfigitem(
702 b'devel',
702 b'devel',
703 b'debug.copies',
703 b'debug.copies',
704 default=False,
704 default=False,
705 )
705 )
706 coreconfigitem(
706 coreconfigitem(
707 b'devel',
707 b'devel',
708 b'copy-tracing.multi-thread',
708 b'copy-tracing.multi-thread',
709 default=True,
709 default=True,
710 )
710 )
711 coreconfigitem(
711 coreconfigitem(
712 b'devel',
712 b'devel',
713 b'debug.extensions',
713 b'debug.extensions',
714 default=False,
714 default=False,
715 )
715 )
716 coreconfigitem(
716 coreconfigitem(
717 b'devel',
717 b'devel',
718 b'debug.repo-filters',
718 b'debug.repo-filters',
719 default=False,
719 default=False,
720 )
720 )
721 coreconfigitem(
721 coreconfigitem(
722 b'devel',
722 b'devel',
723 b'debug.peer-request',
723 b'debug.peer-request',
724 default=False,
724 default=False,
725 )
725 )
726 # If discovery.exchange-heads is False, the discovery will not start with
726 # If discovery.exchange-heads is False, the discovery will not start with
727 # remote head fetching and local head querying.
727 # remote head fetching and local head querying.
728 coreconfigitem(
728 coreconfigitem(
729 b'devel',
729 b'devel',
730 b'discovery.exchange-heads',
730 b'discovery.exchange-heads',
731 default=True,
731 default=True,
732 )
732 )
733 # If discovery.grow-sample is False, the sample size used in set discovery will
733 # If discovery.grow-sample is False, the sample size used in set discovery will
734 # not be increased through the process
734 # not be increased through the process
735 coreconfigitem(
735 coreconfigitem(
736 b'devel',
736 b'devel',
737 b'discovery.grow-sample',
737 b'discovery.grow-sample',
738 default=True,
738 default=True,
739 )
739 )
740 # When discovery.grow-sample.dynamic is True, the default, the sample size is
740 # When discovery.grow-sample.dynamic is True, the default, the sample size is
741 # adapted to the shape of the undecided set (it is set to the max of:
741 # adapted to the shape of the undecided set (it is set to the max of:
742 # <target-size>, len(roots(undecided)), len(heads(undecided)
742 # <target-size>, len(roots(undecided)), len(heads(undecided)
743 coreconfigitem(
743 coreconfigitem(
744 b'devel',
744 b'devel',
745 b'discovery.grow-sample.dynamic',
745 b'discovery.grow-sample.dynamic',
746 default=True,
746 default=True,
747 )
747 )
748 # discovery.grow-sample.rate control the rate at which the sample grow
748 # discovery.grow-sample.rate control the rate at which the sample grow
749 coreconfigitem(
749 coreconfigitem(
750 b'devel',
750 b'devel',
751 b'discovery.grow-sample.rate',
751 b'discovery.grow-sample.rate',
752 default=1.05,
752 default=1.05,
753 )
753 )
754 # If discovery.randomize is False, random sampling during discovery are
754 # If discovery.randomize is False, random sampling during discovery are
755 # deterministic. It is meant for integration tests.
755 # deterministic. It is meant for integration tests.
756 coreconfigitem(
756 coreconfigitem(
757 b'devel',
757 b'devel',
758 b'discovery.randomize',
758 b'discovery.randomize',
759 default=True,
759 default=True,
760 )
760 )
761 # Control the initial size of the discovery sample
761 # Control the initial size of the discovery sample
762 coreconfigitem(
762 coreconfigitem(
763 b'devel',
763 b'devel',
764 b'discovery.sample-size',
764 b'discovery.sample-size',
765 default=200,
765 default=200,
766 )
766 )
767 # Control the initial size of the discovery for initial change
767 # Control the initial size of the discovery for initial change
768 coreconfigitem(
768 coreconfigitem(
769 b'devel',
769 b'devel',
770 b'discovery.sample-size.initial',
770 b'discovery.sample-size.initial',
771 default=100,
771 default=100,
772 )
772 )
773 _registerdiffopts(section=b'diff')
773 _registerdiffopts(section=b'diff')
774 coreconfigitem(
774 coreconfigitem(
775 b'diff',
775 b'diff',
776 b'merge',
776 b'merge',
777 default=False,
777 default=False,
778 experimental=True,
778 experimental=True,
779 )
779 )
780 coreconfigitem(
780 coreconfigitem(
781 b'email',
781 b'email',
782 b'bcc',
782 b'bcc',
783 default=None,
783 default=None,
784 )
784 )
785 coreconfigitem(
785 coreconfigitem(
786 b'email',
786 b'email',
787 b'cc',
787 b'cc',
788 default=None,
788 default=None,
789 )
789 )
790 coreconfigitem(
790 coreconfigitem(
791 b'email',
791 b'email',
792 b'charsets',
792 b'charsets',
793 default=list,
793 default=list,
794 )
794 )
795 coreconfigitem(
795 coreconfigitem(
796 b'email',
796 b'email',
797 b'from',
797 b'from',
798 default=None,
798 default=None,
799 )
799 )
800 coreconfigitem(
800 coreconfigitem(
801 b'email',
801 b'email',
802 b'method',
802 b'method',
803 default=b'smtp',
803 default=b'smtp',
804 )
804 )
805 coreconfigitem(
805 coreconfigitem(
806 b'email',
806 b'email',
807 b'reply-to',
807 b'reply-to',
808 default=None,
808 default=None,
809 )
809 )
810 coreconfigitem(
810 coreconfigitem(
811 b'email',
811 b'email',
812 b'to',
812 b'to',
813 default=None,
813 default=None,
814 )
814 )
815 coreconfigitem(
815 coreconfigitem(
816 b'experimental',
816 b'experimental',
817 b'archivemetatemplate',
817 b'archivemetatemplate',
818 default=dynamicdefault,
818 default=dynamicdefault,
819 )
819 )
820 coreconfigitem(
820 coreconfigitem(
821 b'experimental',
821 b'experimental',
822 b'auto-publish',
822 b'auto-publish',
823 default=b'publish',
823 default=b'publish',
824 )
824 )
825 coreconfigitem(
825 coreconfigitem(
826 b'experimental',
826 b'experimental',
827 b'bundle-phases',
827 b'bundle-phases',
828 default=False,
828 default=False,
829 )
829 )
830 coreconfigitem(
830 coreconfigitem(
831 b'experimental',
831 b'experimental',
832 b'bundle2-advertise',
832 b'bundle2-advertise',
833 default=True,
833 default=True,
834 )
834 )
835 coreconfigitem(
835 coreconfigitem(
836 b'experimental',
836 b'experimental',
837 b'bundle2-output-capture',
837 b'bundle2-output-capture',
838 default=False,
838 default=False,
839 )
839 )
840 coreconfigitem(
840 coreconfigitem(
841 b'experimental',
841 b'experimental',
842 b'bundle2.pushback',
842 b'bundle2.pushback',
843 default=False,
843 default=False,
844 )
844 )
845 coreconfigitem(
845 coreconfigitem(
846 b'experimental',
846 b'experimental',
847 b'bundle2lazylocking',
847 b'bundle2lazylocking',
848 default=False,
848 default=False,
849 )
849 )
850 coreconfigitem(
850 coreconfigitem(
851 b'experimental',
851 b'experimental',
852 b'bundlecomplevel',
852 b'bundlecomplevel',
853 default=None,
853 default=None,
854 )
854 )
855 coreconfigitem(
855 coreconfigitem(
856 b'experimental',
856 b'experimental',
857 b'bundlecomplevel.bzip2',
857 b'bundlecomplevel.bzip2',
858 default=None,
858 default=None,
859 )
859 )
860 coreconfigitem(
860 coreconfigitem(
861 b'experimental',
861 b'experimental',
862 b'bundlecomplevel.gzip',
862 b'bundlecomplevel.gzip',
863 default=None,
863 default=None,
864 )
864 )
865 coreconfigitem(
865 coreconfigitem(
866 b'experimental',
866 b'experimental',
867 b'bundlecomplevel.none',
867 b'bundlecomplevel.none',
868 default=None,
868 default=None,
869 )
869 )
870 coreconfigitem(
870 coreconfigitem(
871 b'experimental',
871 b'experimental',
872 b'bundlecomplevel.zstd',
872 b'bundlecomplevel.zstd',
873 default=None,
873 default=None,
874 )
874 )
875 coreconfigitem(
875 coreconfigitem(
876 b'experimental',
876 b'experimental',
877 b'bundlecompthreads',
877 b'bundlecompthreads',
878 default=None,
878 default=None,
879 )
879 )
880 coreconfigitem(
880 coreconfigitem(
881 b'experimental',
881 b'experimental',
882 b'bundlecompthreads.bzip2',
882 b'bundlecompthreads.bzip2',
883 default=None,
883 default=None,
884 )
884 )
885 coreconfigitem(
885 coreconfigitem(
886 b'experimental',
886 b'experimental',
887 b'bundlecompthreads.gzip',
887 b'bundlecompthreads.gzip',
888 default=None,
888 default=None,
889 )
889 )
890 coreconfigitem(
890 coreconfigitem(
891 b'experimental',
891 b'experimental',
892 b'bundlecompthreads.none',
892 b'bundlecompthreads.none',
893 default=None,
893 default=None,
894 )
894 )
895 coreconfigitem(
895 coreconfigitem(
896 b'experimental',
896 b'experimental',
897 b'bundlecompthreads.zstd',
897 b'bundlecompthreads.zstd',
898 default=None,
898 default=None,
899 )
899 )
900 coreconfigitem(
900 coreconfigitem(
901 b'experimental',
901 b'experimental',
902 b'changegroup3',
902 b'changegroup3',
903 default=False,
903 default=False,
904 )
904 )
905 coreconfigitem(
905 coreconfigitem(
906 b'experimental',
906 b'experimental',
907 b'changegroup4',
907 b'changegroup4',
908 default=False,
908 default=False,
909 )
909 )
910 coreconfigitem(
910 coreconfigitem(
911 b'experimental',
911 b'experimental',
912 b'cleanup-as-archived',
912 b'cleanup-as-archived',
913 default=False,
913 default=False,
914 )
914 )
915 coreconfigitem(
915 coreconfigitem(
916 b'experimental',
916 b'experimental',
917 b'clientcompressionengines',
917 b'clientcompressionengines',
918 default=list,
918 default=list,
919 )
919 )
920 coreconfigitem(
920 coreconfigitem(
921 b'experimental',
921 b'experimental',
922 b'copytrace',
922 b'copytrace',
923 default=b'on',
923 default=b'on',
924 )
924 )
925 coreconfigitem(
925 coreconfigitem(
926 b'experimental',
926 b'experimental',
927 b'copytrace.movecandidateslimit',
927 b'copytrace.movecandidateslimit',
928 default=100,
928 default=100,
929 )
929 )
930 coreconfigitem(
930 coreconfigitem(
931 b'experimental',
931 b'experimental',
932 b'copytrace.sourcecommitlimit',
932 b'copytrace.sourcecommitlimit',
933 default=100,
933 default=100,
934 )
934 )
935 coreconfigitem(
935 coreconfigitem(
936 b'experimental',
936 b'experimental',
937 b'copies.read-from',
937 b'copies.read-from',
938 default=b"filelog-only",
938 default=b"filelog-only",
939 )
939 )
940 coreconfigitem(
940 coreconfigitem(
941 b'experimental',
941 b'experimental',
942 b'copies.write-to',
942 b'copies.write-to',
943 default=b'filelog-only',
943 default=b'filelog-only',
944 )
944 )
945 coreconfigitem(
945 coreconfigitem(
946 b'experimental',
946 b'experimental',
947 b'crecordtest',
947 b'crecordtest',
948 default=None,
948 default=None,
949 )
949 )
950 coreconfigitem(
950 coreconfigitem(
951 b'experimental',
951 b'experimental',
952 b'directaccess',
952 b'directaccess',
953 default=False,
953 default=False,
954 )
954 )
955 coreconfigitem(
955 coreconfigitem(
956 b'experimental',
956 b'experimental',
957 b'directaccess.revnums',
957 b'directaccess.revnums',
958 default=False,
958 default=False,
959 )
959 )
960 coreconfigitem(
960 coreconfigitem(
961 b'experimental',
961 b'experimental',
962 b'editortmpinhg',
962 b'editortmpinhg',
963 default=False,
963 default=False,
964 )
964 )
965 coreconfigitem(
965 coreconfigitem(
966 b'experimental',
966 b'experimental',
967 b'evolution',
967 b'evolution',
968 default=list,
968 default=list,
969 )
969 )
970 coreconfigitem(
970 coreconfigitem(
971 b'experimental',
971 b'experimental',
972 b'evolution.allowdivergence',
972 b'evolution.allowdivergence',
973 default=False,
973 default=False,
974 alias=[(b'experimental', b'allowdivergence')],
974 alias=[(b'experimental', b'allowdivergence')],
975 )
975 )
976 coreconfigitem(
976 coreconfigitem(
977 b'experimental',
977 b'experimental',
978 b'evolution.allowunstable',
978 b'evolution.allowunstable',
979 default=None,
979 default=None,
980 )
980 )
981 coreconfigitem(
981 coreconfigitem(
982 b'experimental',
982 b'experimental',
983 b'evolution.createmarkers',
983 b'evolution.createmarkers',
984 default=None,
984 default=None,
985 )
985 )
986 coreconfigitem(
986 coreconfigitem(
987 b'experimental',
987 b'experimental',
988 b'evolution.effect-flags',
988 b'evolution.effect-flags',
989 default=True,
989 default=True,
990 alias=[(b'experimental', b'effect-flags')],
990 alias=[(b'experimental', b'effect-flags')],
991 )
991 )
992 coreconfigitem(
992 coreconfigitem(
993 b'experimental',
993 b'experimental',
994 b'evolution.exchange',
994 b'evolution.exchange',
995 default=None,
995 default=None,
996 )
996 )
997 coreconfigitem(
997 coreconfigitem(
998 b'experimental',
998 b'experimental',
999 b'evolution.bundle-obsmarker',
999 b'evolution.bundle-obsmarker',
1000 default=False,
1000 default=False,
1001 )
1001 )
1002 coreconfigitem(
1002 coreconfigitem(
1003 b'experimental',
1003 b'experimental',
1004 b'evolution.bundle-obsmarker:mandatory',
1004 b'evolution.bundle-obsmarker:mandatory',
1005 default=True,
1005 default=True,
1006 )
1006 )
1007 coreconfigitem(
1007 coreconfigitem(
1008 b'experimental',
1008 b'experimental',
1009 b'log.topo',
1009 b'log.topo',
1010 default=False,
1010 default=False,
1011 )
1011 )
1012 coreconfigitem(
1012 coreconfigitem(
1013 b'experimental',
1013 b'experimental',
1014 b'evolution.report-instabilities',
1014 b'evolution.report-instabilities',
1015 default=True,
1015 default=True,
1016 )
1016 )
1017 coreconfigitem(
1017 coreconfigitem(
1018 b'experimental',
1018 b'experimental',
1019 b'evolution.track-operation',
1019 b'evolution.track-operation',
1020 default=True,
1020 default=True,
1021 )
1021 )
1022 # repo-level config to exclude a revset visibility
1022 # repo-level config to exclude a revset visibility
1023 #
1023 #
1024 # The target use case is to use `share` to expose different subset of the same
1024 # The target use case is to use `share` to expose different subset of the same
1025 # repository, especially server side. See also `server.view`.
1025 # repository, especially server side. See also `server.view`.
1026 coreconfigitem(
1026 coreconfigitem(
1027 b'experimental',
1027 b'experimental',
1028 b'extra-filter-revs',
1028 b'extra-filter-revs',
1029 default=None,
1029 default=None,
1030 )
1030 )
1031 coreconfigitem(
1031 coreconfigitem(
1032 b'experimental',
1032 b'experimental',
1033 b'maxdeltachainspan',
1033 b'maxdeltachainspan',
1034 default=-1,
1034 default=-1,
1035 )
1035 )
1036 # tracks files which were undeleted (merge might delete them but we explicitly
1036 # tracks files which were undeleted (merge might delete them but we explicitly
1037 # kept/undeleted them) and creates new filenodes for them
1037 # kept/undeleted them) and creates new filenodes for them
1038 coreconfigitem(
1038 coreconfigitem(
1039 b'experimental',
1039 b'experimental',
1040 b'merge-track-salvaged',
1040 b'merge-track-salvaged',
1041 default=False,
1041 default=False,
1042 )
1042 )
1043 coreconfigitem(
1043 coreconfigitem(
1044 b'experimental',
1044 b'experimental',
1045 b'mergetempdirprefix',
1045 b'mergetempdirprefix',
1046 default=None,
1046 default=None,
1047 )
1047 )
1048 coreconfigitem(
1048 coreconfigitem(
1049 b'experimental',
1049 b'experimental',
1050 b'mmapindexthreshold',
1050 b'mmapindexthreshold',
1051 default=None,
1051 default=None,
1052 )
1052 )
1053 coreconfigitem(
1053 coreconfigitem(
1054 b'experimental',
1054 b'experimental',
1055 b'narrow',
1055 b'narrow',
1056 default=False,
1056 default=False,
1057 )
1057 )
1058 coreconfigitem(
1058 coreconfigitem(
1059 b'experimental',
1059 b'experimental',
1060 b'nonnormalparanoidcheck',
1060 b'nonnormalparanoidcheck',
1061 default=False,
1061 default=False,
1062 )
1062 )
1063 coreconfigitem(
1063 coreconfigitem(
1064 b'experimental',
1064 b'experimental',
1065 b'exportableenviron',
1065 b'exportableenviron',
1066 default=list,
1066 default=list,
1067 )
1067 )
1068 coreconfigitem(
1068 coreconfigitem(
1069 b'experimental',
1069 b'experimental',
1070 b'extendedheader.index',
1070 b'extendedheader.index',
1071 default=None,
1071 default=None,
1072 )
1072 )
1073 coreconfigitem(
1073 coreconfigitem(
1074 b'experimental',
1074 b'experimental',
1075 b'extendedheader.similarity',
1075 b'extendedheader.similarity',
1076 default=False,
1076 default=False,
1077 )
1077 )
1078 coreconfigitem(
1078 coreconfigitem(
1079 b'experimental',
1079 b'experimental',
1080 b'graphshorten',
1080 b'graphshorten',
1081 default=False,
1081 default=False,
1082 )
1082 )
1083 coreconfigitem(
1083 coreconfigitem(
1084 b'experimental',
1084 b'experimental',
1085 b'graphstyle.parent',
1085 b'graphstyle.parent',
1086 default=dynamicdefault,
1086 default=dynamicdefault,
1087 )
1087 )
1088 coreconfigitem(
1088 coreconfigitem(
1089 b'experimental',
1089 b'experimental',
1090 b'graphstyle.missing',
1090 b'graphstyle.missing',
1091 default=dynamicdefault,
1091 default=dynamicdefault,
1092 )
1092 )
1093 coreconfigitem(
1093 coreconfigitem(
1094 b'experimental',
1094 b'experimental',
1095 b'graphstyle.grandparent',
1095 b'graphstyle.grandparent',
1096 default=dynamicdefault,
1096 default=dynamicdefault,
1097 )
1097 )
1098 coreconfigitem(
1098 coreconfigitem(
1099 b'experimental',
1099 b'experimental',
1100 b'hook-track-tags',
1100 b'hook-track-tags',
1101 default=False,
1101 default=False,
1102 )
1102 )
1103 coreconfigitem(
1103 coreconfigitem(
1104 b'experimental',
1104 b'experimental',
1105 b'httppeer.advertise-v2',
1105 b'httppeer.advertise-v2',
1106 default=False,
1106 default=False,
1107 )
1107 )
1108 coreconfigitem(
1108 coreconfigitem(
1109 b'experimental',
1109 b'experimental',
1110 b'httppeer.v2-encoder-order',
1110 b'httppeer.v2-encoder-order',
1111 default=None,
1111 default=None,
1112 )
1112 )
1113 coreconfigitem(
1113 coreconfigitem(
1114 b'experimental',
1114 b'experimental',
1115 b'httppostargs',
1115 b'httppostargs',
1116 default=False,
1116 default=False,
1117 )
1117 )
1118 coreconfigitem(b'experimental', b'nointerrupt', default=False)
1118 coreconfigitem(b'experimental', b'nointerrupt', default=False)
1119 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
1119 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
1120
1120
1121 coreconfigitem(
1121 coreconfigitem(
1122 b'experimental',
1122 b'experimental',
1123 b'obsmarkers-exchange-debug',
1123 b'obsmarkers-exchange-debug',
1124 default=False,
1124 default=False,
1125 )
1125 )
1126 coreconfigitem(
1126 coreconfigitem(
1127 b'experimental',
1127 b'experimental',
1128 b'remotenames',
1128 b'remotenames',
1129 default=False,
1129 default=False,
1130 )
1130 )
1131 coreconfigitem(
1131 coreconfigitem(
1132 b'experimental',
1132 b'experimental',
1133 b'removeemptydirs',
1133 b'removeemptydirs',
1134 default=True,
1134 default=True,
1135 )
1135 )
1136 coreconfigitem(
1136 coreconfigitem(
1137 b'experimental',
1137 b'experimental',
1138 b'revert.interactive.select-to-keep',
1138 b'revert.interactive.select-to-keep',
1139 default=False,
1139 default=False,
1140 )
1140 )
1141 coreconfigitem(
1141 coreconfigitem(
1142 b'experimental',
1142 b'experimental',
1143 b'revisions.prefixhexnode',
1143 b'revisions.prefixhexnode',
1144 default=False,
1144 default=False,
1145 )
1145 )
1146 # "out of experimental" todo list.
1146 # "out of experimental" todo list.
1147 #
1147 #
1148 # * include management of a persistent nodemap in the main docket
1148 # * include management of a persistent nodemap in the main docket
1149 # * enforce a "no-truncate" policy for mmap safety
1149 # * enforce a "no-truncate" policy for mmap safety
1150 # - for censoring operation
1150 # - for censoring operation
1151 # - for stripping operation
1151 # - for stripping operation
1152 # - for rollback operation
1152 # - for rollback operation
1153 # * proper streaming (race free) of the docket file
1153 # * proper streaming (race free) of the docket file
1154 # * track garbage data to evemtually allow rewriting -existing- sidedata.
1154 # * track garbage data to evemtually allow rewriting -existing- sidedata.
1155 # * Exchange-wise, we will also need to do something more efficient than
1155 # * Exchange-wise, we will also need to do something more efficient than
1156 # keeping references to the affected revlogs, especially memory-wise when
1156 # keeping references to the affected revlogs, especially memory-wise when
1157 # rewriting sidedata.
1157 # rewriting sidedata.
1158 # * introduce a proper solution to reduce the number of filelog related files.
1158 # * introduce a proper solution to reduce the number of filelog related files.
1159 # * use caching for reading sidedata (similar to what we do for data).
1159 # * use caching for reading sidedata (similar to what we do for data).
1160 # * no longer set offset=0 if sidedata_size=0 (simplify cutoff computation).
1160 # * no longer set offset=0 if sidedata_size=0 (simplify cutoff computation).
1161 # * Improvement to consider
1161 # * Improvement to consider
1162 # - avoid compression header in chunk using the default compression?
1162 # - avoid compression header in chunk using the default compression?
1163 # - forbid "inline" compression mode entirely?
1163 # - forbid "inline" compression mode entirely?
1164 # - split the data offset and flag field (the 2 bytes save are mostly trouble)
1164 # - split the data offset and flag field (the 2 bytes save are mostly trouble)
1165 # - keep track of uncompressed -chunk- size (to preallocate memory better)
1165 # - keep track of uncompressed -chunk- size (to preallocate memory better)
1166 # - keep track of chain base or size (probably not that useful anymore)
1166 # - keep track of chain base or size (probably not that useful anymore)
1167 coreconfigitem(
1167 coreconfigitem(
1168 b'experimental',
1168 b'experimental',
1169 b'revlogv2',
1169 b'revlogv2',
1170 default=None,
1170 default=None,
1171 )
1171 )
1172 coreconfigitem(
1172 coreconfigitem(
1173 b'experimental',
1173 b'experimental',
1174 b'revisions.disambiguatewithin',
1174 b'revisions.disambiguatewithin',
1175 default=None,
1175 default=None,
1176 )
1176 )
1177 coreconfigitem(
1177 coreconfigitem(
1178 b'experimental',
1178 b'experimental',
1179 b'rust.index',
1179 b'rust.index',
1180 default=False,
1180 default=False,
1181 )
1181 )
1182 coreconfigitem(
1182 coreconfigitem(
1183 b'experimental',
1183 b'experimental',
1184 b'server.filesdata.recommended-batch-size',
1184 b'server.filesdata.recommended-batch-size',
1185 default=50000,
1185 default=50000,
1186 )
1186 )
1187 coreconfigitem(
1187 coreconfigitem(
1188 b'experimental',
1188 b'experimental',
1189 b'server.manifestdata.recommended-batch-size',
1189 b'server.manifestdata.recommended-batch-size',
1190 default=100000,
1190 default=100000,
1191 )
1191 )
1192 coreconfigitem(
1192 coreconfigitem(
1193 b'experimental',
1193 b'experimental',
1194 b'server.stream-narrow-clones',
1194 b'server.stream-narrow-clones',
1195 default=False,
1195 default=False,
1196 )
1196 )
1197 coreconfigitem(
1197 coreconfigitem(
1198 b'experimental',
1198 b'experimental',
1199 b'single-head-per-branch',
1199 b'single-head-per-branch',
1200 default=False,
1200 default=False,
1201 )
1201 )
1202 coreconfigitem(
1202 coreconfigitem(
1203 b'experimental',
1203 b'experimental',
1204 b'single-head-per-branch:account-closed-heads',
1204 b'single-head-per-branch:account-closed-heads',
1205 default=False,
1205 default=False,
1206 )
1206 )
1207 coreconfigitem(
1207 coreconfigitem(
1208 b'experimental',
1208 b'experimental',
1209 b'single-head-per-branch:public-changes-only',
1209 b'single-head-per-branch:public-changes-only',
1210 default=False,
1210 default=False,
1211 )
1211 )
1212 coreconfigitem(
1212 coreconfigitem(
1213 b'experimental',
1213 b'experimental',
1214 b'sshserver.support-v2',
1214 b'sshserver.support-v2',
1215 default=False,
1215 default=False,
1216 )
1216 )
1217 coreconfigitem(
1217 coreconfigitem(
1218 b'experimental',
1218 b'experimental',
1219 b'sparse-read',
1219 b'sparse-read',
1220 default=False,
1220 default=False,
1221 )
1221 )
1222 coreconfigitem(
1222 coreconfigitem(
1223 b'experimental',
1223 b'experimental',
1224 b'sparse-read.density-threshold',
1224 b'sparse-read.density-threshold',
1225 default=0.50,
1225 default=0.50,
1226 )
1226 )
1227 coreconfigitem(
1227 coreconfigitem(
1228 b'experimental',
1228 b'experimental',
1229 b'sparse-read.min-gap-size',
1229 b'sparse-read.min-gap-size',
1230 default=b'65K',
1230 default=b'65K',
1231 )
1231 )
1232 coreconfigitem(
1232 coreconfigitem(
1233 b'experimental',
1233 b'experimental',
1234 b'treemanifest',
1234 b'treemanifest',
1235 default=False,
1235 default=False,
1236 )
1236 )
1237 coreconfigitem(
1237 coreconfigitem(
1238 b'experimental',
1238 b'experimental',
1239 b'update.atomic-file',
1239 b'update.atomic-file',
1240 default=False,
1240 default=False,
1241 )
1241 )
1242 coreconfigitem(
1242 coreconfigitem(
1243 b'experimental',
1243 b'experimental',
1244 b'sshpeer.advertise-v2',
1244 b'sshpeer.advertise-v2',
1245 default=False,
1245 default=False,
1246 )
1246 )
1247 coreconfigitem(
1247 coreconfigitem(
1248 b'experimental',
1248 b'experimental',
1249 b'web.apiserver',
1249 b'web.apiserver',
1250 default=False,
1250 default=False,
1251 )
1251 )
1252 coreconfigitem(
1252 coreconfigitem(
1253 b'experimental',
1253 b'experimental',
1254 b'web.api.http-v2',
1254 b'web.api.http-v2',
1255 default=False,
1255 default=False,
1256 )
1256 )
1257 coreconfigitem(
1257 coreconfigitem(
1258 b'experimental',
1258 b'experimental',
1259 b'web.api.debugreflect',
1259 b'web.api.debugreflect',
1260 default=False,
1260 default=False,
1261 )
1261 )
1262 coreconfigitem(
1262 coreconfigitem(
1263 b'experimental',
1263 b'experimental',
1264 b'web.full-garbage-collection-rate',
1264 b'web.full-garbage-collection-rate',
1265 default=1, # still forcing a full collection on each request
1265 default=1, # still forcing a full collection on each request
1266 )
1266 )
1267 coreconfigitem(
1267 coreconfigitem(
1268 b'experimental',
1268 b'experimental',
1269 b'worker.wdir-get-thread-safe',
1269 b'worker.wdir-get-thread-safe',
1270 default=False,
1270 default=False,
1271 )
1271 )
1272 coreconfigitem(
1272 coreconfigitem(
1273 b'experimental',
1273 b'experimental',
1274 b'worker.repository-upgrade',
1274 b'worker.repository-upgrade',
1275 default=False,
1275 default=False,
1276 )
1276 )
1277 coreconfigitem(
1277 coreconfigitem(
1278 b'experimental',
1278 b'experimental',
1279 b'xdiff',
1279 b'xdiff',
1280 default=False,
1280 default=False,
1281 )
1281 )
1282 coreconfigitem(
1282 coreconfigitem(
1283 b'extensions',
1283 b'extensions',
1284 b'[^:]*',
1284 b'[^:]*',
1285 default=None,
1285 default=None,
1286 generic=True,
1286 generic=True,
1287 )
1287 )
1288 coreconfigitem(
1288 coreconfigitem(
1289 b'extensions',
1290 b'[^:]*:required',
1291 default=False,
1292 generic=True,
1293 )
1294 coreconfigitem(
1289 b'extdata',
1295 b'extdata',
1290 b'.*',
1296 b'.*',
1291 default=None,
1297 default=None,
1292 generic=True,
1298 generic=True,
1293 )
1299 )
1294 coreconfigitem(
1300 coreconfigitem(
1295 b'format',
1301 b'format',
1296 b'bookmarks-in-store',
1302 b'bookmarks-in-store',
1297 default=False,
1303 default=False,
1298 )
1304 )
1299 coreconfigitem(
1305 coreconfigitem(
1300 b'format',
1306 b'format',
1301 b'chunkcachesize',
1307 b'chunkcachesize',
1302 default=None,
1308 default=None,
1303 experimental=True,
1309 experimental=True,
1304 )
1310 )
1305 coreconfigitem(
1311 coreconfigitem(
1306 # Enable this dirstate format *when creating a new repository*.
1312 # Enable this dirstate format *when creating a new repository*.
1307 # Which format to use for existing repos is controlled by .hg/requires
1313 # Which format to use for existing repos is controlled by .hg/requires
1308 b'format',
1314 b'format',
1309 b'exp-rc-dirstate-v2',
1315 b'exp-rc-dirstate-v2',
1310 default=False,
1316 default=False,
1311 experimental=True,
1317 experimental=True,
1312 )
1318 )
1313 coreconfigitem(
1319 coreconfigitem(
1314 b'format',
1320 b'format',
1315 b'dotencode',
1321 b'dotencode',
1316 default=True,
1322 default=True,
1317 )
1323 )
1318 coreconfigitem(
1324 coreconfigitem(
1319 b'format',
1325 b'format',
1320 b'generaldelta',
1326 b'generaldelta',
1321 default=False,
1327 default=False,
1322 experimental=True,
1328 experimental=True,
1323 )
1329 )
1324 coreconfigitem(
1330 coreconfigitem(
1325 b'format',
1331 b'format',
1326 b'manifestcachesize',
1332 b'manifestcachesize',
1327 default=None,
1333 default=None,
1328 experimental=True,
1334 experimental=True,
1329 )
1335 )
1330 coreconfigitem(
1336 coreconfigitem(
1331 b'format',
1337 b'format',
1332 b'maxchainlen',
1338 b'maxchainlen',
1333 default=dynamicdefault,
1339 default=dynamicdefault,
1334 experimental=True,
1340 experimental=True,
1335 )
1341 )
1336 coreconfigitem(
1342 coreconfigitem(
1337 b'format',
1343 b'format',
1338 b'obsstore-version',
1344 b'obsstore-version',
1339 default=None,
1345 default=None,
1340 )
1346 )
1341 coreconfigitem(
1347 coreconfigitem(
1342 b'format',
1348 b'format',
1343 b'sparse-revlog',
1349 b'sparse-revlog',
1344 default=True,
1350 default=True,
1345 )
1351 )
1346 coreconfigitem(
1352 coreconfigitem(
1347 b'format',
1353 b'format',
1348 b'revlog-compression',
1354 b'revlog-compression',
1349 default=lambda: [b'zstd', b'zlib'],
1355 default=lambda: [b'zstd', b'zlib'],
1350 alias=[(b'experimental', b'format.compression')],
1356 alias=[(b'experimental', b'format.compression')],
1351 )
1357 )
1352 # Experimental TODOs:
1358 # Experimental TODOs:
1353 #
1359 #
1354 # * Same as for evlogv2 (but for the reduction of the number of files)
1360 # * Same as for evlogv2 (but for the reduction of the number of files)
1355 # * Improvement to investigate
1361 # * Improvement to investigate
1356 # - storing .hgtags fnode
1362 # - storing .hgtags fnode
1357 # - storing `rank` of changesets
1363 # - storing `rank` of changesets
1358 # - storing branch related identifier
1364 # - storing branch related identifier
1359
1365
1360 coreconfigitem(
1366 coreconfigitem(
1361 b'format',
1367 b'format',
1362 b'exp-use-changelog-v2',
1368 b'exp-use-changelog-v2',
1363 default=None,
1369 default=None,
1364 experimental=True,
1370 experimental=True,
1365 )
1371 )
1366 coreconfigitem(
1372 coreconfigitem(
1367 b'format',
1373 b'format',
1368 b'usefncache',
1374 b'usefncache',
1369 default=True,
1375 default=True,
1370 )
1376 )
1371 coreconfigitem(
1377 coreconfigitem(
1372 b'format',
1378 b'format',
1373 b'usegeneraldelta',
1379 b'usegeneraldelta',
1374 default=True,
1380 default=True,
1375 )
1381 )
1376 coreconfigitem(
1382 coreconfigitem(
1377 b'format',
1383 b'format',
1378 b'usestore',
1384 b'usestore',
1379 default=True,
1385 default=True,
1380 )
1386 )
1381
1387
1382
1388
1383 def _persistent_nodemap_default():
1389 def _persistent_nodemap_default():
1384 """compute `use-persistent-nodemap` default value
1390 """compute `use-persistent-nodemap` default value
1385
1391
1386 The feature is disabled unless a fast implementation is available.
1392 The feature is disabled unless a fast implementation is available.
1387 """
1393 """
1388 from . import policy
1394 from . import policy
1389
1395
1390 return policy.importrust('revlog') is not None
1396 return policy.importrust('revlog') is not None
1391
1397
1392
1398
1393 coreconfigitem(
1399 coreconfigitem(
1394 b'format',
1400 b'format',
1395 b'use-persistent-nodemap',
1401 b'use-persistent-nodemap',
1396 default=_persistent_nodemap_default,
1402 default=_persistent_nodemap_default,
1397 )
1403 )
1398 coreconfigitem(
1404 coreconfigitem(
1399 b'format',
1405 b'format',
1400 b'exp-use-copies-side-data-changeset',
1406 b'exp-use-copies-side-data-changeset',
1401 default=False,
1407 default=False,
1402 experimental=True,
1408 experimental=True,
1403 )
1409 )
1404 coreconfigitem(
1410 coreconfigitem(
1405 b'format',
1411 b'format',
1406 b'use-share-safe',
1412 b'use-share-safe',
1407 default=False,
1413 default=False,
1408 )
1414 )
1409 coreconfigitem(
1415 coreconfigitem(
1410 b'format',
1416 b'format',
1411 b'internal-phase',
1417 b'internal-phase',
1412 default=False,
1418 default=False,
1413 experimental=True,
1419 experimental=True,
1414 )
1420 )
1415 coreconfigitem(
1421 coreconfigitem(
1416 b'fsmonitor',
1422 b'fsmonitor',
1417 b'warn_when_unused',
1423 b'warn_when_unused',
1418 default=True,
1424 default=True,
1419 )
1425 )
1420 coreconfigitem(
1426 coreconfigitem(
1421 b'fsmonitor',
1427 b'fsmonitor',
1422 b'warn_update_file_count',
1428 b'warn_update_file_count',
1423 default=50000,
1429 default=50000,
1424 )
1430 )
1425 coreconfigitem(
1431 coreconfigitem(
1426 b'fsmonitor',
1432 b'fsmonitor',
1427 b'warn_update_file_count_rust',
1433 b'warn_update_file_count_rust',
1428 default=400000,
1434 default=400000,
1429 )
1435 )
1430 coreconfigitem(
1436 coreconfigitem(
1431 b'help',
1437 b'help',
1432 br'hidden-command\..*',
1438 br'hidden-command\..*',
1433 default=False,
1439 default=False,
1434 generic=True,
1440 generic=True,
1435 )
1441 )
1436 coreconfigitem(
1442 coreconfigitem(
1437 b'help',
1443 b'help',
1438 br'hidden-topic\..*',
1444 br'hidden-topic\..*',
1439 default=False,
1445 default=False,
1440 generic=True,
1446 generic=True,
1441 )
1447 )
1442 coreconfigitem(
1448 coreconfigitem(
1443 b'hooks',
1449 b'hooks',
1444 b'[^:]*',
1450 b'[^:]*',
1445 default=dynamicdefault,
1451 default=dynamicdefault,
1446 generic=True,
1452 generic=True,
1447 )
1453 )
1448 coreconfigitem(
1454 coreconfigitem(
1449 b'hooks',
1455 b'hooks',
1450 b'.*:run-with-plain',
1456 b'.*:run-with-plain',
1451 default=True,
1457 default=True,
1452 generic=True,
1458 generic=True,
1453 )
1459 )
1454 coreconfigitem(
1460 coreconfigitem(
1455 b'hgweb-paths',
1461 b'hgweb-paths',
1456 b'.*',
1462 b'.*',
1457 default=list,
1463 default=list,
1458 generic=True,
1464 generic=True,
1459 )
1465 )
1460 coreconfigitem(
1466 coreconfigitem(
1461 b'hostfingerprints',
1467 b'hostfingerprints',
1462 b'.*',
1468 b'.*',
1463 default=list,
1469 default=list,
1464 generic=True,
1470 generic=True,
1465 )
1471 )
1466 coreconfigitem(
1472 coreconfigitem(
1467 b'hostsecurity',
1473 b'hostsecurity',
1468 b'ciphers',
1474 b'ciphers',
1469 default=None,
1475 default=None,
1470 )
1476 )
1471 coreconfigitem(
1477 coreconfigitem(
1472 b'hostsecurity',
1478 b'hostsecurity',
1473 b'minimumprotocol',
1479 b'minimumprotocol',
1474 default=dynamicdefault,
1480 default=dynamicdefault,
1475 )
1481 )
1476 coreconfigitem(
1482 coreconfigitem(
1477 b'hostsecurity',
1483 b'hostsecurity',
1478 b'.*:minimumprotocol$',
1484 b'.*:minimumprotocol$',
1479 default=dynamicdefault,
1485 default=dynamicdefault,
1480 generic=True,
1486 generic=True,
1481 )
1487 )
1482 coreconfigitem(
1488 coreconfigitem(
1483 b'hostsecurity',
1489 b'hostsecurity',
1484 b'.*:ciphers$',
1490 b'.*:ciphers$',
1485 default=dynamicdefault,
1491 default=dynamicdefault,
1486 generic=True,
1492 generic=True,
1487 )
1493 )
1488 coreconfigitem(
1494 coreconfigitem(
1489 b'hostsecurity',
1495 b'hostsecurity',
1490 b'.*:fingerprints$',
1496 b'.*:fingerprints$',
1491 default=list,
1497 default=list,
1492 generic=True,
1498 generic=True,
1493 )
1499 )
1494 coreconfigitem(
1500 coreconfigitem(
1495 b'hostsecurity',
1501 b'hostsecurity',
1496 b'.*:verifycertsfile$',
1502 b'.*:verifycertsfile$',
1497 default=None,
1503 default=None,
1498 generic=True,
1504 generic=True,
1499 )
1505 )
1500
1506
1501 coreconfigitem(
1507 coreconfigitem(
1502 b'http_proxy',
1508 b'http_proxy',
1503 b'always',
1509 b'always',
1504 default=False,
1510 default=False,
1505 )
1511 )
1506 coreconfigitem(
1512 coreconfigitem(
1507 b'http_proxy',
1513 b'http_proxy',
1508 b'host',
1514 b'host',
1509 default=None,
1515 default=None,
1510 )
1516 )
1511 coreconfigitem(
1517 coreconfigitem(
1512 b'http_proxy',
1518 b'http_proxy',
1513 b'no',
1519 b'no',
1514 default=list,
1520 default=list,
1515 )
1521 )
1516 coreconfigitem(
1522 coreconfigitem(
1517 b'http_proxy',
1523 b'http_proxy',
1518 b'passwd',
1524 b'passwd',
1519 default=None,
1525 default=None,
1520 )
1526 )
1521 coreconfigitem(
1527 coreconfigitem(
1522 b'http_proxy',
1528 b'http_proxy',
1523 b'user',
1529 b'user',
1524 default=None,
1530 default=None,
1525 )
1531 )
1526
1532
1527 coreconfigitem(
1533 coreconfigitem(
1528 b'http',
1534 b'http',
1529 b'timeout',
1535 b'timeout',
1530 default=None,
1536 default=None,
1531 )
1537 )
1532
1538
1533 coreconfigitem(
1539 coreconfigitem(
1534 b'logtoprocess',
1540 b'logtoprocess',
1535 b'commandexception',
1541 b'commandexception',
1536 default=None,
1542 default=None,
1537 )
1543 )
1538 coreconfigitem(
1544 coreconfigitem(
1539 b'logtoprocess',
1545 b'logtoprocess',
1540 b'commandfinish',
1546 b'commandfinish',
1541 default=None,
1547 default=None,
1542 )
1548 )
1543 coreconfigitem(
1549 coreconfigitem(
1544 b'logtoprocess',
1550 b'logtoprocess',
1545 b'command',
1551 b'command',
1546 default=None,
1552 default=None,
1547 )
1553 )
1548 coreconfigitem(
1554 coreconfigitem(
1549 b'logtoprocess',
1555 b'logtoprocess',
1550 b'develwarn',
1556 b'develwarn',
1551 default=None,
1557 default=None,
1552 )
1558 )
1553 coreconfigitem(
1559 coreconfigitem(
1554 b'logtoprocess',
1560 b'logtoprocess',
1555 b'uiblocked',
1561 b'uiblocked',
1556 default=None,
1562 default=None,
1557 )
1563 )
1558 coreconfigitem(
1564 coreconfigitem(
1559 b'merge',
1565 b'merge',
1560 b'checkunknown',
1566 b'checkunknown',
1561 default=b'abort',
1567 default=b'abort',
1562 )
1568 )
1563 coreconfigitem(
1569 coreconfigitem(
1564 b'merge',
1570 b'merge',
1565 b'checkignored',
1571 b'checkignored',
1566 default=b'abort',
1572 default=b'abort',
1567 )
1573 )
1568 coreconfigitem(
1574 coreconfigitem(
1569 b'experimental',
1575 b'experimental',
1570 b'merge.checkpathconflicts',
1576 b'merge.checkpathconflicts',
1571 default=False,
1577 default=False,
1572 )
1578 )
1573 coreconfigitem(
1579 coreconfigitem(
1574 b'merge',
1580 b'merge',
1575 b'followcopies',
1581 b'followcopies',
1576 default=True,
1582 default=True,
1577 )
1583 )
1578 coreconfigitem(
1584 coreconfigitem(
1579 b'merge',
1585 b'merge',
1580 b'on-failure',
1586 b'on-failure',
1581 default=b'continue',
1587 default=b'continue',
1582 )
1588 )
1583 coreconfigitem(
1589 coreconfigitem(
1584 b'merge',
1590 b'merge',
1585 b'preferancestor',
1591 b'preferancestor',
1586 default=lambda: [b'*'],
1592 default=lambda: [b'*'],
1587 experimental=True,
1593 experimental=True,
1588 )
1594 )
1589 coreconfigitem(
1595 coreconfigitem(
1590 b'merge',
1596 b'merge',
1591 b'strict-capability-check',
1597 b'strict-capability-check',
1592 default=False,
1598 default=False,
1593 )
1599 )
1594 coreconfigitem(
1600 coreconfigitem(
1595 b'merge-tools',
1601 b'merge-tools',
1596 b'.*',
1602 b'.*',
1597 default=None,
1603 default=None,
1598 generic=True,
1604 generic=True,
1599 )
1605 )
1600 coreconfigitem(
1606 coreconfigitem(
1601 b'merge-tools',
1607 b'merge-tools',
1602 br'.*\.args$',
1608 br'.*\.args$',
1603 default=b"$local $base $other",
1609 default=b"$local $base $other",
1604 generic=True,
1610 generic=True,
1605 priority=-1,
1611 priority=-1,
1606 )
1612 )
1607 coreconfigitem(
1613 coreconfigitem(
1608 b'merge-tools',
1614 b'merge-tools',
1609 br'.*\.binary$',
1615 br'.*\.binary$',
1610 default=False,
1616 default=False,
1611 generic=True,
1617 generic=True,
1612 priority=-1,
1618 priority=-1,
1613 )
1619 )
1614 coreconfigitem(
1620 coreconfigitem(
1615 b'merge-tools',
1621 b'merge-tools',
1616 br'.*\.check$',
1622 br'.*\.check$',
1617 default=list,
1623 default=list,
1618 generic=True,
1624 generic=True,
1619 priority=-1,
1625 priority=-1,
1620 )
1626 )
1621 coreconfigitem(
1627 coreconfigitem(
1622 b'merge-tools',
1628 b'merge-tools',
1623 br'.*\.checkchanged$',
1629 br'.*\.checkchanged$',
1624 default=False,
1630 default=False,
1625 generic=True,
1631 generic=True,
1626 priority=-1,
1632 priority=-1,
1627 )
1633 )
1628 coreconfigitem(
1634 coreconfigitem(
1629 b'merge-tools',
1635 b'merge-tools',
1630 br'.*\.executable$',
1636 br'.*\.executable$',
1631 default=dynamicdefault,
1637 default=dynamicdefault,
1632 generic=True,
1638 generic=True,
1633 priority=-1,
1639 priority=-1,
1634 )
1640 )
1635 coreconfigitem(
1641 coreconfigitem(
1636 b'merge-tools',
1642 b'merge-tools',
1637 br'.*\.fixeol$',
1643 br'.*\.fixeol$',
1638 default=False,
1644 default=False,
1639 generic=True,
1645 generic=True,
1640 priority=-1,
1646 priority=-1,
1641 )
1647 )
1642 coreconfigitem(
1648 coreconfigitem(
1643 b'merge-tools',
1649 b'merge-tools',
1644 br'.*\.gui$',
1650 br'.*\.gui$',
1645 default=False,
1651 default=False,
1646 generic=True,
1652 generic=True,
1647 priority=-1,
1653 priority=-1,
1648 )
1654 )
1649 coreconfigitem(
1655 coreconfigitem(
1650 b'merge-tools',
1656 b'merge-tools',
1651 br'.*\.mergemarkers$',
1657 br'.*\.mergemarkers$',
1652 default=b'basic',
1658 default=b'basic',
1653 generic=True,
1659 generic=True,
1654 priority=-1,
1660 priority=-1,
1655 )
1661 )
1656 coreconfigitem(
1662 coreconfigitem(
1657 b'merge-tools',
1663 b'merge-tools',
1658 br'.*\.mergemarkertemplate$',
1664 br'.*\.mergemarkertemplate$',
1659 default=dynamicdefault, # take from command-templates.mergemarker
1665 default=dynamicdefault, # take from command-templates.mergemarker
1660 generic=True,
1666 generic=True,
1661 priority=-1,
1667 priority=-1,
1662 )
1668 )
1663 coreconfigitem(
1669 coreconfigitem(
1664 b'merge-tools',
1670 b'merge-tools',
1665 br'.*\.priority$',
1671 br'.*\.priority$',
1666 default=0,
1672 default=0,
1667 generic=True,
1673 generic=True,
1668 priority=-1,
1674 priority=-1,
1669 )
1675 )
1670 coreconfigitem(
1676 coreconfigitem(
1671 b'merge-tools',
1677 b'merge-tools',
1672 br'.*\.premerge$',
1678 br'.*\.premerge$',
1673 default=dynamicdefault,
1679 default=dynamicdefault,
1674 generic=True,
1680 generic=True,
1675 priority=-1,
1681 priority=-1,
1676 )
1682 )
1677 coreconfigitem(
1683 coreconfigitem(
1678 b'merge-tools',
1684 b'merge-tools',
1679 br'.*\.symlink$',
1685 br'.*\.symlink$',
1680 default=False,
1686 default=False,
1681 generic=True,
1687 generic=True,
1682 priority=-1,
1688 priority=-1,
1683 )
1689 )
1684 coreconfigitem(
1690 coreconfigitem(
1685 b'pager',
1691 b'pager',
1686 b'attend-.*',
1692 b'attend-.*',
1687 default=dynamicdefault,
1693 default=dynamicdefault,
1688 generic=True,
1694 generic=True,
1689 )
1695 )
1690 coreconfigitem(
1696 coreconfigitem(
1691 b'pager',
1697 b'pager',
1692 b'ignore',
1698 b'ignore',
1693 default=list,
1699 default=list,
1694 )
1700 )
1695 coreconfigitem(
1701 coreconfigitem(
1696 b'pager',
1702 b'pager',
1697 b'pager',
1703 b'pager',
1698 default=dynamicdefault,
1704 default=dynamicdefault,
1699 )
1705 )
1700 coreconfigitem(
1706 coreconfigitem(
1701 b'patch',
1707 b'patch',
1702 b'eol',
1708 b'eol',
1703 default=b'strict',
1709 default=b'strict',
1704 )
1710 )
1705 coreconfigitem(
1711 coreconfigitem(
1706 b'patch',
1712 b'patch',
1707 b'fuzz',
1713 b'fuzz',
1708 default=2,
1714 default=2,
1709 )
1715 )
1710 coreconfigitem(
1716 coreconfigitem(
1711 b'paths',
1717 b'paths',
1712 b'default',
1718 b'default',
1713 default=None,
1719 default=None,
1714 )
1720 )
1715 coreconfigitem(
1721 coreconfigitem(
1716 b'paths',
1722 b'paths',
1717 b'default-push',
1723 b'default-push',
1718 default=None,
1724 default=None,
1719 )
1725 )
1720 coreconfigitem(
1726 coreconfigitem(
1721 b'paths',
1727 b'paths',
1722 b'.*',
1728 b'.*',
1723 default=None,
1729 default=None,
1724 generic=True,
1730 generic=True,
1725 )
1731 )
1726 coreconfigitem(
1732 coreconfigitem(
1727 b'phases',
1733 b'phases',
1728 b'checksubrepos',
1734 b'checksubrepos',
1729 default=b'follow',
1735 default=b'follow',
1730 )
1736 )
1731 coreconfigitem(
1737 coreconfigitem(
1732 b'phases',
1738 b'phases',
1733 b'new-commit',
1739 b'new-commit',
1734 default=b'draft',
1740 default=b'draft',
1735 )
1741 )
1736 coreconfigitem(
1742 coreconfigitem(
1737 b'phases',
1743 b'phases',
1738 b'publish',
1744 b'publish',
1739 default=True,
1745 default=True,
1740 )
1746 )
1741 coreconfigitem(
1747 coreconfigitem(
1742 b'profiling',
1748 b'profiling',
1743 b'enabled',
1749 b'enabled',
1744 default=False,
1750 default=False,
1745 )
1751 )
1746 coreconfigitem(
1752 coreconfigitem(
1747 b'profiling',
1753 b'profiling',
1748 b'format',
1754 b'format',
1749 default=b'text',
1755 default=b'text',
1750 )
1756 )
1751 coreconfigitem(
1757 coreconfigitem(
1752 b'profiling',
1758 b'profiling',
1753 b'freq',
1759 b'freq',
1754 default=1000,
1760 default=1000,
1755 )
1761 )
1756 coreconfigitem(
1762 coreconfigitem(
1757 b'profiling',
1763 b'profiling',
1758 b'limit',
1764 b'limit',
1759 default=30,
1765 default=30,
1760 )
1766 )
1761 coreconfigitem(
1767 coreconfigitem(
1762 b'profiling',
1768 b'profiling',
1763 b'nested',
1769 b'nested',
1764 default=0,
1770 default=0,
1765 )
1771 )
1766 coreconfigitem(
1772 coreconfigitem(
1767 b'profiling',
1773 b'profiling',
1768 b'output',
1774 b'output',
1769 default=None,
1775 default=None,
1770 )
1776 )
1771 coreconfigitem(
1777 coreconfigitem(
1772 b'profiling',
1778 b'profiling',
1773 b'showmax',
1779 b'showmax',
1774 default=0.999,
1780 default=0.999,
1775 )
1781 )
1776 coreconfigitem(
1782 coreconfigitem(
1777 b'profiling',
1783 b'profiling',
1778 b'showmin',
1784 b'showmin',
1779 default=dynamicdefault,
1785 default=dynamicdefault,
1780 )
1786 )
1781 coreconfigitem(
1787 coreconfigitem(
1782 b'profiling',
1788 b'profiling',
1783 b'showtime',
1789 b'showtime',
1784 default=True,
1790 default=True,
1785 )
1791 )
1786 coreconfigitem(
1792 coreconfigitem(
1787 b'profiling',
1793 b'profiling',
1788 b'sort',
1794 b'sort',
1789 default=b'inlinetime',
1795 default=b'inlinetime',
1790 )
1796 )
1791 coreconfigitem(
1797 coreconfigitem(
1792 b'profiling',
1798 b'profiling',
1793 b'statformat',
1799 b'statformat',
1794 default=b'hotpath',
1800 default=b'hotpath',
1795 )
1801 )
1796 coreconfigitem(
1802 coreconfigitem(
1797 b'profiling',
1803 b'profiling',
1798 b'time-track',
1804 b'time-track',
1799 default=dynamicdefault,
1805 default=dynamicdefault,
1800 )
1806 )
1801 coreconfigitem(
1807 coreconfigitem(
1802 b'profiling',
1808 b'profiling',
1803 b'type',
1809 b'type',
1804 default=b'stat',
1810 default=b'stat',
1805 )
1811 )
1806 coreconfigitem(
1812 coreconfigitem(
1807 b'progress',
1813 b'progress',
1808 b'assume-tty',
1814 b'assume-tty',
1809 default=False,
1815 default=False,
1810 )
1816 )
1811 coreconfigitem(
1817 coreconfigitem(
1812 b'progress',
1818 b'progress',
1813 b'changedelay',
1819 b'changedelay',
1814 default=1,
1820 default=1,
1815 )
1821 )
1816 coreconfigitem(
1822 coreconfigitem(
1817 b'progress',
1823 b'progress',
1818 b'clear-complete',
1824 b'clear-complete',
1819 default=True,
1825 default=True,
1820 )
1826 )
1821 coreconfigitem(
1827 coreconfigitem(
1822 b'progress',
1828 b'progress',
1823 b'debug',
1829 b'debug',
1824 default=False,
1830 default=False,
1825 )
1831 )
1826 coreconfigitem(
1832 coreconfigitem(
1827 b'progress',
1833 b'progress',
1828 b'delay',
1834 b'delay',
1829 default=3,
1835 default=3,
1830 )
1836 )
1831 coreconfigitem(
1837 coreconfigitem(
1832 b'progress',
1838 b'progress',
1833 b'disable',
1839 b'disable',
1834 default=False,
1840 default=False,
1835 )
1841 )
1836 coreconfigitem(
1842 coreconfigitem(
1837 b'progress',
1843 b'progress',
1838 b'estimateinterval',
1844 b'estimateinterval',
1839 default=60.0,
1845 default=60.0,
1840 )
1846 )
1841 coreconfigitem(
1847 coreconfigitem(
1842 b'progress',
1848 b'progress',
1843 b'format',
1849 b'format',
1844 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1850 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1845 )
1851 )
1846 coreconfigitem(
1852 coreconfigitem(
1847 b'progress',
1853 b'progress',
1848 b'refresh',
1854 b'refresh',
1849 default=0.1,
1855 default=0.1,
1850 )
1856 )
1851 coreconfigitem(
1857 coreconfigitem(
1852 b'progress',
1858 b'progress',
1853 b'width',
1859 b'width',
1854 default=dynamicdefault,
1860 default=dynamicdefault,
1855 )
1861 )
1856 coreconfigitem(
1862 coreconfigitem(
1857 b'pull',
1863 b'pull',
1858 b'confirm',
1864 b'confirm',
1859 default=False,
1865 default=False,
1860 )
1866 )
1861 coreconfigitem(
1867 coreconfigitem(
1862 b'push',
1868 b'push',
1863 b'pushvars.server',
1869 b'pushvars.server',
1864 default=False,
1870 default=False,
1865 )
1871 )
1866 coreconfigitem(
1872 coreconfigitem(
1867 b'rewrite',
1873 b'rewrite',
1868 b'backup-bundle',
1874 b'backup-bundle',
1869 default=True,
1875 default=True,
1870 alias=[(b'ui', b'history-editing-backup')],
1876 alias=[(b'ui', b'history-editing-backup')],
1871 )
1877 )
1872 coreconfigitem(
1878 coreconfigitem(
1873 b'rewrite',
1879 b'rewrite',
1874 b'update-timestamp',
1880 b'update-timestamp',
1875 default=False,
1881 default=False,
1876 )
1882 )
1877 coreconfigitem(
1883 coreconfigitem(
1878 b'rewrite',
1884 b'rewrite',
1879 b'empty-successor',
1885 b'empty-successor',
1880 default=b'skip',
1886 default=b'skip',
1881 experimental=True,
1887 experimental=True,
1882 )
1888 )
1883 # experimental as long as format.exp-rc-dirstate-v2 is.
1889 # experimental as long as format.exp-rc-dirstate-v2 is.
1884 coreconfigitem(
1890 coreconfigitem(
1885 b'storage',
1891 b'storage',
1886 b'dirstate-v2.slow-path',
1892 b'dirstate-v2.slow-path',
1887 default=b"abort",
1893 default=b"abort",
1888 experimental=True,
1894 experimental=True,
1889 )
1895 )
1890 coreconfigitem(
1896 coreconfigitem(
1891 b'storage',
1897 b'storage',
1892 b'new-repo-backend',
1898 b'new-repo-backend',
1893 default=b'revlogv1',
1899 default=b'revlogv1',
1894 experimental=True,
1900 experimental=True,
1895 )
1901 )
1896 coreconfigitem(
1902 coreconfigitem(
1897 b'storage',
1903 b'storage',
1898 b'revlog.optimize-delta-parent-choice',
1904 b'revlog.optimize-delta-parent-choice',
1899 default=True,
1905 default=True,
1900 alias=[(b'format', b'aggressivemergedeltas')],
1906 alias=[(b'format', b'aggressivemergedeltas')],
1901 )
1907 )
1902 coreconfigitem(
1908 coreconfigitem(
1903 b'storage',
1909 b'storage',
1904 b'revlog.issue6528.fix-incoming',
1910 b'revlog.issue6528.fix-incoming',
1905 default=True,
1911 default=True,
1906 )
1912 )
1907 # experimental as long as rust is experimental (or a C version is implemented)
1913 # experimental as long as rust is experimental (or a C version is implemented)
1908 coreconfigitem(
1914 coreconfigitem(
1909 b'storage',
1915 b'storage',
1910 b'revlog.persistent-nodemap.mmap',
1916 b'revlog.persistent-nodemap.mmap',
1911 default=True,
1917 default=True,
1912 )
1918 )
1913 # experimental as long as format.use-persistent-nodemap is.
1919 # experimental as long as format.use-persistent-nodemap is.
1914 coreconfigitem(
1920 coreconfigitem(
1915 b'storage',
1921 b'storage',
1916 b'revlog.persistent-nodemap.slow-path',
1922 b'revlog.persistent-nodemap.slow-path',
1917 default=b"abort",
1923 default=b"abort",
1918 )
1924 )
1919
1925
1920 coreconfigitem(
1926 coreconfigitem(
1921 b'storage',
1927 b'storage',
1922 b'revlog.reuse-external-delta',
1928 b'revlog.reuse-external-delta',
1923 default=True,
1929 default=True,
1924 )
1930 )
1925 coreconfigitem(
1931 coreconfigitem(
1926 b'storage',
1932 b'storage',
1927 b'revlog.reuse-external-delta-parent',
1933 b'revlog.reuse-external-delta-parent',
1928 default=None,
1934 default=None,
1929 )
1935 )
1930 coreconfigitem(
1936 coreconfigitem(
1931 b'storage',
1937 b'storage',
1932 b'revlog.zlib.level',
1938 b'revlog.zlib.level',
1933 default=None,
1939 default=None,
1934 )
1940 )
1935 coreconfigitem(
1941 coreconfigitem(
1936 b'storage',
1942 b'storage',
1937 b'revlog.zstd.level',
1943 b'revlog.zstd.level',
1938 default=None,
1944 default=None,
1939 )
1945 )
1940 coreconfigitem(
1946 coreconfigitem(
1941 b'server',
1947 b'server',
1942 b'bookmarks-pushkey-compat',
1948 b'bookmarks-pushkey-compat',
1943 default=True,
1949 default=True,
1944 )
1950 )
1945 coreconfigitem(
1951 coreconfigitem(
1946 b'server',
1952 b'server',
1947 b'bundle1',
1953 b'bundle1',
1948 default=True,
1954 default=True,
1949 )
1955 )
1950 coreconfigitem(
1956 coreconfigitem(
1951 b'server',
1957 b'server',
1952 b'bundle1gd',
1958 b'bundle1gd',
1953 default=None,
1959 default=None,
1954 )
1960 )
1955 coreconfigitem(
1961 coreconfigitem(
1956 b'server',
1962 b'server',
1957 b'bundle1.pull',
1963 b'bundle1.pull',
1958 default=None,
1964 default=None,
1959 )
1965 )
1960 coreconfigitem(
1966 coreconfigitem(
1961 b'server',
1967 b'server',
1962 b'bundle1gd.pull',
1968 b'bundle1gd.pull',
1963 default=None,
1969 default=None,
1964 )
1970 )
1965 coreconfigitem(
1971 coreconfigitem(
1966 b'server',
1972 b'server',
1967 b'bundle1.push',
1973 b'bundle1.push',
1968 default=None,
1974 default=None,
1969 )
1975 )
1970 coreconfigitem(
1976 coreconfigitem(
1971 b'server',
1977 b'server',
1972 b'bundle1gd.push',
1978 b'bundle1gd.push',
1973 default=None,
1979 default=None,
1974 )
1980 )
1975 coreconfigitem(
1981 coreconfigitem(
1976 b'server',
1982 b'server',
1977 b'bundle2.stream',
1983 b'bundle2.stream',
1978 default=True,
1984 default=True,
1979 alias=[(b'experimental', b'bundle2.stream')],
1985 alias=[(b'experimental', b'bundle2.stream')],
1980 )
1986 )
1981 coreconfigitem(
1987 coreconfigitem(
1982 b'server',
1988 b'server',
1983 b'compressionengines',
1989 b'compressionengines',
1984 default=list,
1990 default=list,
1985 )
1991 )
1986 coreconfigitem(
1992 coreconfigitem(
1987 b'server',
1993 b'server',
1988 b'concurrent-push-mode',
1994 b'concurrent-push-mode',
1989 default=b'check-related',
1995 default=b'check-related',
1990 )
1996 )
1991 coreconfigitem(
1997 coreconfigitem(
1992 b'server',
1998 b'server',
1993 b'disablefullbundle',
1999 b'disablefullbundle',
1994 default=False,
2000 default=False,
1995 )
2001 )
1996 coreconfigitem(
2002 coreconfigitem(
1997 b'server',
2003 b'server',
1998 b'maxhttpheaderlen',
2004 b'maxhttpheaderlen',
1999 default=1024,
2005 default=1024,
2000 )
2006 )
2001 coreconfigitem(
2007 coreconfigitem(
2002 b'server',
2008 b'server',
2003 b'pullbundle',
2009 b'pullbundle',
2004 default=False,
2010 default=False,
2005 )
2011 )
2006 coreconfigitem(
2012 coreconfigitem(
2007 b'server',
2013 b'server',
2008 b'preferuncompressed',
2014 b'preferuncompressed',
2009 default=False,
2015 default=False,
2010 )
2016 )
2011 coreconfigitem(
2017 coreconfigitem(
2012 b'server',
2018 b'server',
2013 b'streamunbundle',
2019 b'streamunbundle',
2014 default=False,
2020 default=False,
2015 )
2021 )
2016 coreconfigitem(
2022 coreconfigitem(
2017 b'server',
2023 b'server',
2018 b'uncompressed',
2024 b'uncompressed',
2019 default=True,
2025 default=True,
2020 )
2026 )
2021 coreconfigitem(
2027 coreconfigitem(
2022 b'server',
2028 b'server',
2023 b'uncompressedallowsecret',
2029 b'uncompressedallowsecret',
2024 default=False,
2030 default=False,
2025 )
2031 )
2026 coreconfigitem(
2032 coreconfigitem(
2027 b'server',
2033 b'server',
2028 b'view',
2034 b'view',
2029 default=b'served',
2035 default=b'served',
2030 )
2036 )
2031 coreconfigitem(
2037 coreconfigitem(
2032 b'server',
2038 b'server',
2033 b'validate',
2039 b'validate',
2034 default=False,
2040 default=False,
2035 )
2041 )
2036 coreconfigitem(
2042 coreconfigitem(
2037 b'server',
2043 b'server',
2038 b'zliblevel',
2044 b'zliblevel',
2039 default=-1,
2045 default=-1,
2040 )
2046 )
2041 coreconfigitem(
2047 coreconfigitem(
2042 b'server',
2048 b'server',
2043 b'zstdlevel',
2049 b'zstdlevel',
2044 default=3,
2050 default=3,
2045 )
2051 )
2046 coreconfigitem(
2052 coreconfigitem(
2047 b'share',
2053 b'share',
2048 b'pool',
2054 b'pool',
2049 default=None,
2055 default=None,
2050 )
2056 )
2051 coreconfigitem(
2057 coreconfigitem(
2052 b'share',
2058 b'share',
2053 b'poolnaming',
2059 b'poolnaming',
2054 default=b'identity',
2060 default=b'identity',
2055 )
2061 )
2056 coreconfigitem(
2062 coreconfigitem(
2057 b'share',
2063 b'share',
2058 b'safe-mismatch.source-not-safe',
2064 b'safe-mismatch.source-not-safe',
2059 default=b'abort',
2065 default=b'abort',
2060 )
2066 )
2061 coreconfigitem(
2067 coreconfigitem(
2062 b'share',
2068 b'share',
2063 b'safe-mismatch.source-safe',
2069 b'safe-mismatch.source-safe',
2064 default=b'abort',
2070 default=b'abort',
2065 )
2071 )
2066 coreconfigitem(
2072 coreconfigitem(
2067 b'share',
2073 b'share',
2068 b'safe-mismatch.source-not-safe.warn',
2074 b'safe-mismatch.source-not-safe.warn',
2069 default=True,
2075 default=True,
2070 )
2076 )
2071 coreconfigitem(
2077 coreconfigitem(
2072 b'share',
2078 b'share',
2073 b'safe-mismatch.source-safe.warn',
2079 b'safe-mismatch.source-safe.warn',
2074 default=True,
2080 default=True,
2075 )
2081 )
2076 coreconfigitem(
2082 coreconfigitem(
2077 b'shelve',
2083 b'shelve',
2078 b'maxbackups',
2084 b'maxbackups',
2079 default=10,
2085 default=10,
2080 )
2086 )
2081 coreconfigitem(
2087 coreconfigitem(
2082 b'smtp',
2088 b'smtp',
2083 b'host',
2089 b'host',
2084 default=None,
2090 default=None,
2085 )
2091 )
2086 coreconfigitem(
2092 coreconfigitem(
2087 b'smtp',
2093 b'smtp',
2088 b'local_hostname',
2094 b'local_hostname',
2089 default=None,
2095 default=None,
2090 )
2096 )
2091 coreconfigitem(
2097 coreconfigitem(
2092 b'smtp',
2098 b'smtp',
2093 b'password',
2099 b'password',
2094 default=None,
2100 default=None,
2095 )
2101 )
2096 coreconfigitem(
2102 coreconfigitem(
2097 b'smtp',
2103 b'smtp',
2098 b'port',
2104 b'port',
2099 default=dynamicdefault,
2105 default=dynamicdefault,
2100 )
2106 )
2101 coreconfigitem(
2107 coreconfigitem(
2102 b'smtp',
2108 b'smtp',
2103 b'tls',
2109 b'tls',
2104 default=b'none',
2110 default=b'none',
2105 )
2111 )
2106 coreconfigitem(
2112 coreconfigitem(
2107 b'smtp',
2113 b'smtp',
2108 b'username',
2114 b'username',
2109 default=None,
2115 default=None,
2110 )
2116 )
2111 coreconfigitem(
2117 coreconfigitem(
2112 b'sparse',
2118 b'sparse',
2113 b'missingwarning',
2119 b'missingwarning',
2114 default=True,
2120 default=True,
2115 experimental=True,
2121 experimental=True,
2116 )
2122 )
2117 coreconfigitem(
2123 coreconfigitem(
2118 b'subrepos',
2124 b'subrepos',
2119 b'allowed',
2125 b'allowed',
2120 default=dynamicdefault, # to make backporting simpler
2126 default=dynamicdefault, # to make backporting simpler
2121 )
2127 )
2122 coreconfigitem(
2128 coreconfigitem(
2123 b'subrepos',
2129 b'subrepos',
2124 b'hg:allowed',
2130 b'hg:allowed',
2125 default=dynamicdefault,
2131 default=dynamicdefault,
2126 )
2132 )
2127 coreconfigitem(
2133 coreconfigitem(
2128 b'subrepos',
2134 b'subrepos',
2129 b'git:allowed',
2135 b'git:allowed',
2130 default=dynamicdefault,
2136 default=dynamicdefault,
2131 )
2137 )
2132 coreconfigitem(
2138 coreconfigitem(
2133 b'subrepos',
2139 b'subrepos',
2134 b'svn:allowed',
2140 b'svn:allowed',
2135 default=dynamicdefault,
2141 default=dynamicdefault,
2136 )
2142 )
2137 coreconfigitem(
2143 coreconfigitem(
2138 b'templates',
2144 b'templates',
2139 b'.*',
2145 b'.*',
2140 default=None,
2146 default=None,
2141 generic=True,
2147 generic=True,
2142 )
2148 )
2143 coreconfigitem(
2149 coreconfigitem(
2144 b'templateconfig',
2150 b'templateconfig',
2145 b'.*',
2151 b'.*',
2146 default=dynamicdefault,
2152 default=dynamicdefault,
2147 generic=True,
2153 generic=True,
2148 )
2154 )
2149 coreconfigitem(
2155 coreconfigitem(
2150 b'trusted',
2156 b'trusted',
2151 b'groups',
2157 b'groups',
2152 default=list,
2158 default=list,
2153 )
2159 )
2154 coreconfigitem(
2160 coreconfigitem(
2155 b'trusted',
2161 b'trusted',
2156 b'users',
2162 b'users',
2157 default=list,
2163 default=list,
2158 )
2164 )
2159 coreconfigitem(
2165 coreconfigitem(
2160 b'ui',
2166 b'ui',
2161 b'_usedassubrepo',
2167 b'_usedassubrepo',
2162 default=False,
2168 default=False,
2163 )
2169 )
2164 coreconfigitem(
2170 coreconfigitem(
2165 b'ui',
2171 b'ui',
2166 b'allowemptycommit',
2172 b'allowemptycommit',
2167 default=False,
2173 default=False,
2168 )
2174 )
2169 coreconfigitem(
2175 coreconfigitem(
2170 b'ui',
2176 b'ui',
2171 b'archivemeta',
2177 b'archivemeta',
2172 default=True,
2178 default=True,
2173 )
2179 )
2174 coreconfigitem(
2180 coreconfigitem(
2175 b'ui',
2181 b'ui',
2176 b'askusername',
2182 b'askusername',
2177 default=False,
2183 default=False,
2178 )
2184 )
2179 coreconfigitem(
2185 coreconfigitem(
2180 b'ui',
2186 b'ui',
2181 b'available-memory',
2187 b'available-memory',
2182 default=None,
2188 default=None,
2183 )
2189 )
2184
2190
2185 coreconfigitem(
2191 coreconfigitem(
2186 b'ui',
2192 b'ui',
2187 b'clonebundlefallback',
2193 b'clonebundlefallback',
2188 default=False,
2194 default=False,
2189 )
2195 )
2190 coreconfigitem(
2196 coreconfigitem(
2191 b'ui',
2197 b'ui',
2192 b'clonebundleprefers',
2198 b'clonebundleprefers',
2193 default=list,
2199 default=list,
2194 )
2200 )
2195 coreconfigitem(
2201 coreconfigitem(
2196 b'ui',
2202 b'ui',
2197 b'clonebundles',
2203 b'clonebundles',
2198 default=True,
2204 default=True,
2199 )
2205 )
2200 coreconfigitem(
2206 coreconfigitem(
2201 b'ui',
2207 b'ui',
2202 b'color',
2208 b'color',
2203 default=b'auto',
2209 default=b'auto',
2204 )
2210 )
2205 coreconfigitem(
2211 coreconfigitem(
2206 b'ui',
2212 b'ui',
2207 b'commitsubrepos',
2213 b'commitsubrepos',
2208 default=False,
2214 default=False,
2209 )
2215 )
2210 coreconfigitem(
2216 coreconfigitem(
2211 b'ui',
2217 b'ui',
2212 b'debug',
2218 b'debug',
2213 default=False,
2219 default=False,
2214 )
2220 )
2215 coreconfigitem(
2221 coreconfigitem(
2216 b'ui',
2222 b'ui',
2217 b'debugger',
2223 b'debugger',
2218 default=None,
2224 default=None,
2219 )
2225 )
2220 coreconfigitem(
2226 coreconfigitem(
2221 b'ui',
2227 b'ui',
2222 b'editor',
2228 b'editor',
2223 default=dynamicdefault,
2229 default=dynamicdefault,
2224 )
2230 )
2225 coreconfigitem(
2231 coreconfigitem(
2226 b'ui',
2232 b'ui',
2227 b'detailed-exit-code',
2233 b'detailed-exit-code',
2228 default=False,
2234 default=False,
2229 experimental=True,
2235 experimental=True,
2230 )
2236 )
2231 coreconfigitem(
2237 coreconfigitem(
2232 b'ui',
2238 b'ui',
2233 b'fallbackencoding',
2239 b'fallbackencoding',
2234 default=None,
2240 default=None,
2235 )
2241 )
2236 coreconfigitem(
2242 coreconfigitem(
2237 b'ui',
2243 b'ui',
2238 b'forcecwd',
2244 b'forcecwd',
2239 default=None,
2245 default=None,
2240 )
2246 )
2241 coreconfigitem(
2247 coreconfigitem(
2242 b'ui',
2248 b'ui',
2243 b'forcemerge',
2249 b'forcemerge',
2244 default=None,
2250 default=None,
2245 )
2251 )
2246 coreconfigitem(
2252 coreconfigitem(
2247 b'ui',
2253 b'ui',
2248 b'formatdebug',
2254 b'formatdebug',
2249 default=False,
2255 default=False,
2250 )
2256 )
2251 coreconfigitem(
2257 coreconfigitem(
2252 b'ui',
2258 b'ui',
2253 b'formatjson',
2259 b'formatjson',
2254 default=False,
2260 default=False,
2255 )
2261 )
2256 coreconfigitem(
2262 coreconfigitem(
2257 b'ui',
2263 b'ui',
2258 b'formatted',
2264 b'formatted',
2259 default=None,
2265 default=None,
2260 )
2266 )
2261 coreconfigitem(
2267 coreconfigitem(
2262 b'ui',
2268 b'ui',
2263 b'interactive',
2269 b'interactive',
2264 default=None,
2270 default=None,
2265 )
2271 )
2266 coreconfigitem(
2272 coreconfigitem(
2267 b'ui',
2273 b'ui',
2268 b'interface',
2274 b'interface',
2269 default=None,
2275 default=None,
2270 )
2276 )
2271 coreconfigitem(
2277 coreconfigitem(
2272 b'ui',
2278 b'ui',
2273 b'interface.chunkselector',
2279 b'interface.chunkselector',
2274 default=None,
2280 default=None,
2275 )
2281 )
2276 coreconfigitem(
2282 coreconfigitem(
2277 b'ui',
2283 b'ui',
2278 b'large-file-limit',
2284 b'large-file-limit',
2279 default=10000000,
2285 default=10000000,
2280 )
2286 )
2281 coreconfigitem(
2287 coreconfigitem(
2282 b'ui',
2288 b'ui',
2283 b'logblockedtimes',
2289 b'logblockedtimes',
2284 default=False,
2290 default=False,
2285 )
2291 )
2286 coreconfigitem(
2292 coreconfigitem(
2287 b'ui',
2293 b'ui',
2288 b'merge',
2294 b'merge',
2289 default=None,
2295 default=None,
2290 )
2296 )
2291 coreconfigitem(
2297 coreconfigitem(
2292 b'ui',
2298 b'ui',
2293 b'mergemarkers',
2299 b'mergemarkers',
2294 default=b'basic',
2300 default=b'basic',
2295 )
2301 )
2296 coreconfigitem(
2302 coreconfigitem(
2297 b'ui',
2303 b'ui',
2298 b'message-output',
2304 b'message-output',
2299 default=b'stdio',
2305 default=b'stdio',
2300 )
2306 )
2301 coreconfigitem(
2307 coreconfigitem(
2302 b'ui',
2308 b'ui',
2303 b'nontty',
2309 b'nontty',
2304 default=False,
2310 default=False,
2305 )
2311 )
2306 coreconfigitem(
2312 coreconfigitem(
2307 b'ui',
2313 b'ui',
2308 b'origbackuppath',
2314 b'origbackuppath',
2309 default=None,
2315 default=None,
2310 )
2316 )
2311 coreconfigitem(
2317 coreconfigitem(
2312 b'ui',
2318 b'ui',
2313 b'paginate',
2319 b'paginate',
2314 default=True,
2320 default=True,
2315 )
2321 )
2316 coreconfigitem(
2322 coreconfigitem(
2317 b'ui',
2323 b'ui',
2318 b'patch',
2324 b'patch',
2319 default=None,
2325 default=None,
2320 )
2326 )
2321 coreconfigitem(
2327 coreconfigitem(
2322 b'ui',
2328 b'ui',
2323 b'portablefilenames',
2329 b'portablefilenames',
2324 default=b'warn',
2330 default=b'warn',
2325 )
2331 )
2326 coreconfigitem(
2332 coreconfigitem(
2327 b'ui',
2333 b'ui',
2328 b'promptecho',
2334 b'promptecho',
2329 default=False,
2335 default=False,
2330 )
2336 )
2331 coreconfigitem(
2337 coreconfigitem(
2332 b'ui',
2338 b'ui',
2333 b'quiet',
2339 b'quiet',
2334 default=False,
2340 default=False,
2335 )
2341 )
2336 coreconfigitem(
2342 coreconfigitem(
2337 b'ui',
2343 b'ui',
2338 b'quietbookmarkmove',
2344 b'quietbookmarkmove',
2339 default=False,
2345 default=False,
2340 )
2346 )
2341 coreconfigitem(
2347 coreconfigitem(
2342 b'ui',
2348 b'ui',
2343 b'relative-paths',
2349 b'relative-paths',
2344 default=b'legacy',
2350 default=b'legacy',
2345 )
2351 )
2346 coreconfigitem(
2352 coreconfigitem(
2347 b'ui',
2353 b'ui',
2348 b'remotecmd',
2354 b'remotecmd',
2349 default=b'hg',
2355 default=b'hg',
2350 )
2356 )
2351 coreconfigitem(
2357 coreconfigitem(
2352 b'ui',
2358 b'ui',
2353 b'report_untrusted',
2359 b'report_untrusted',
2354 default=True,
2360 default=True,
2355 )
2361 )
2356 coreconfigitem(
2362 coreconfigitem(
2357 b'ui',
2363 b'ui',
2358 b'rollback',
2364 b'rollback',
2359 default=True,
2365 default=True,
2360 )
2366 )
2361 coreconfigitem(
2367 coreconfigitem(
2362 b'ui',
2368 b'ui',
2363 b'signal-safe-lock',
2369 b'signal-safe-lock',
2364 default=True,
2370 default=True,
2365 )
2371 )
2366 coreconfigitem(
2372 coreconfigitem(
2367 b'ui',
2373 b'ui',
2368 b'slash',
2374 b'slash',
2369 default=False,
2375 default=False,
2370 )
2376 )
2371 coreconfigitem(
2377 coreconfigitem(
2372 b'ui',
2378 b'ui',
2373 b'ssh',
2379 b'ssh',
2374 default=b'ssh',
2380 default=b'ssh',
2375 )
2381 )
2376 coreconfigitem(
2382 coreconfigitem(
2377 b'ui',
2383 b'ui',
2378 b'ssherrorhint',
2384 b'ssherrorhint',
2379 default=None,
2385 default=None,
2380 )
2386 )
2381 coreconfigitem(
2387 coreconfigitem(
2382 b'ui',
2388 b'ui',
2383 b'statuscopies',
2389 b'statuscopies',
2384 default=False,
2390 default=False,
2385 )
2391 )
2386 coreconfigitem(
2392 coreconfigitem(
2387 b'ui',
2393 b'ui',
2388 b'strict',
2394 b'strict',
2389 default=False,
2395 default=False,
2390 )
2396 )
2391 coreconfigitem(
2397 coreconfigitem(
2392 b'ui',
2398 b'ui',
2393 b'style',
2399 b'style',
2394 default=b'',
2400 default=b'',
2395 )
2401 )
2396 coreconfigitem(
2402 coreconfigitem(
2397 b'ui',
2403 b'ui',
2398 b'supportcontact',
2404 b'supportcontact',
2399 default=None,
2405 default=None,
2400 )
2406 )
2401 coreconfigitem(
2407 coreconfigitem(
2402 b'ui',
2408 b'ui',
2403 b'textwidth',
2409 b'textwidth',
2404 default=78,
2410 default=78,
2405 )
2411 )
2406 coreconfigitem(
2412 coreconfigitem(
2407 b'ui',
2413 b'ui',
2408 b'timeout',
2414 b'timeout',
2409 default=b'600',
2415 default=b'600',
2410 )
2416 )
2411 coreconfigitem(
2417 coreconfigitem(
2412 b'ui',
2418 b'ui',
2413 b'timeout.warn',
2419 b'timeout.warn',
2414 default=0,
2420 default=0,
2415 )
2421 )
2416 coreconfigitem(
2422 coreconfigitem(
2417 b'ui',
2423 b'ui',
2418 b'timestamp-output',
2424 b'timestamp-output',
2419 default=False,
2425 default=False,
2420 )
2426 )
2421 coreconfigitem(
2427 coreconfigitem(
2422 b'ui',
2428 b'ui',
2423 b'traceback',
2429 b'traceback',
2424 default=False,
2430 default=False,
2425 )
2431 )
2426 coreconfigitem(
2432 coreconfigitem(
2427 b'ui',
2433 b'ui',
2428 b'tweakdefaults',
2434 b'tweakdefaults',
2429 default=False,
2435 default=False,
2430 )
2436 )
2431 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
2437 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
2432 coreconfigitem(
2438 coreconfigitem(
2433 b'ui',
2439 b'ui',
2434 b'verbose',
2440 b'verbose',
2435 default=False,
2441 default=False,
2436 )
2442 )
2437 coreconfigitem(
2443 coreconfigitem(
2438 b'verify',
2444 b'verify',
2439 b'skipflags',
2445 b'skipflags',
2440 default=None,
2446 default=None,
2441 )
2447 )
2442 coreconfigitem(
2448 coreconfigitem(
2443 b'web',
2449 b'web',
2444 b'allowbz2',
2450 b'allowbz2',
2445 default=False,
2451 default=False,
2446 )
2452 )
2447 coreconfigitem(
2453 coreconfigitem(
2448 b'web',
2454 b'web',
2449 b'allowgz',
2455 b'allowgz',
2450 default=False,
2456 default=False,
2451 )
2457 )
2452 coreconfigitem(
2458 coreconfigitem(
2453 b'web',
2459 b'web',
2454 b'allow-pull',
2460 b'allow-pull',
2455 alias=[(b'web', b'allowpull')],
2461 alias=[(b'web', b'allowpull')],
2456 default=True,
2462 default=True,
2457 )
2463 )
2458 coreconfigitem(
2464 coreconfigitem(
2459 b'web',
2465 b'web',
2460 b'allow-push',
2466 b'allow-push',
2461 alias=[(b'web', b'allow_push')],
2467 alias=[(b'web', b'allow_push')],
2462 default=list,
2468 default=list,
2463 )
2469 )
2464 coreconfigitem(
2470 coreconfigitem(
2465 b'web',
2471 b'web',
2466 b'allowzip',
2472 b'allowzip',
2467 default=False,
2473 default=False,
2468 )
2474 )
2469 coreconfigitem(
2475 coreconfigitem(
2470 b'web',
2476 b'web',
2471 b'archivesubrepos',
2477 b'archivesubrepos',
2472 default=False,
2478 default=False,
2473 )
2479 )
2474 coreconfigitem(
2480 coreconfigitem(
2475 b'web',
2481 b'web',
2476 b'cache',
2482 b'cache',
2477 default=True,
2483 default=True,
2478 )
2484 )
2479 coreconfigitem(
2485 coreconfigitem(
2480 b'web',
2486 b'web',
2481 b'comparisoncontext',
2487 b'comparisoncontext',
2482 default=5,
2488 default=5,
2483 )
2489 )
2484 coreconfigitem(
2490 coreconfigitem(
2485 b'web',
2491 b'web',
2486 b'contact',
2492 b'contact',
2487 default=None,
2493 default=None,
2488 )
2494 )
2489 coreconfigitem(
2495 coreconfigitem(
2490 b'web',
2496 b'web',
2491 b'deny_push',
2497 b'deny_push',
2492 default=list,
2498 default=list,
2493 )
2499 )
2494 coreconfigitem(
2500 coreconfigitem(
2495 b'web',
2501 b'web',
2496 b'guessmime',
2502 b'guessmime',
2497 default=False,
2503 default=False,
2498 )
2504 )
2499 coreconfigitem(
2505 coreconfigitem(
2500 b'web',
2506 b'web',
2501 b'hidden',
2507 b'hidden',
2502 default=False,
2508 default=False,
2503 )
2509 )
2504 coreconfigitem(
2510 coreconfigitem(
2505 b'web',
2511 b'web',
2506 b'labels',
2512 b'labels',
2507 default=list,
2513 default=list,
2508 )
2514 )
2509 coreconfigitem(
2515 coreconfigitem(
2510 b'web',
2516 b'web',
2511 b'logoimg',
2517 b'logoimg',
2512 default=b'hglogo.png',
2518 default=b'hglogo.png',
2513 )
2519 )
2514 coreconfigitem(
2520 coreconfigitem(
2515 b'web',
2521 b'web',
2516 b'logourl',
2522 b'logourl',
2517 default=b'https://mercurial-scm.org/',
2523 default=b'https://mercurial-scm.org/',
2518 )
2524 )
2519 coreconfigitem(
2525 coreconfigitem(
2520 b'web',
2526 b'web',
2521 b'accesslog',
2527 b'accesslog',
2522 default=b'-',
2528 default=b'-',
2523 )
2529 )
2524 coreconfigitem(
2530 coreconfigitem(
2525 b'web',
2531 b'web',
2526 b'address',
2532 b'address',
2527 default=b'',
2533 default=b'',
2528 )
2534 )
2529 coreconfigitem(
2535 coreconfigitem(
2530 b'web',
2536 b'web',
2531 b'allow-archive',
2537 b'allow-archive',
2532 alias=[(b'web', b'allow_archive')],
2538 alias=[(b'web', b'allow_archive')],
2533 default=list,
2539 default=list,
2534 )
2540 )
2535 coreconfigitem(
2541 coreconfigitem(
2536 b'web',
2542 b'web',
2537 b'allow_read',
2543 b'allow_read',
2538 default=list,
2544 default=list,
2539 )
2545 )
2540 coreconfigitem(
2546 coreconfigitem(
2541 b'web',
2547 b'web',
2542 b'baseurl',
2548 b'baseurl',
2543 default=None,
2549 default=None,
2544 )
2550 )
2545 coreconfigitem(
2551 coreconfigitem(
2546 b'web',
2552 b'web',
2547 b'cacerts',
2553 b'cacerts',
2548 default=None,
2554 default=None,
2549 )
2555 )
2550 coreconfigitem(
2556 coreconfigitem(
2551 b'web',
2557 b'web',
2552 b'certificate',
2558 b'certificate',
2553 default=None,
2559 default=None,
2554 )
2560 )
2555 coreconfigitem(
2561 coreconfigitem(
2556 b'web',
2562 b'web',
2557 b'collapse',
2563 b'collapse',
2558 default=False,
2564 default=False,
2559 )
2565 )
2560 coreconfigitem(
2566 coreconfigitem(
2561 b'web',
2567 b'web',
2562 b'csp',
2568 b'csp',
2563 default=None,
2569 default=None,
2564 )
2570 )
2565 coreconfigitem(
2571 coreconfigitem(
2566 b'web',
2572 b'web',
2567 b'deny_read',
2573 b'deny_read',
2568 default=list,
2574 default=list,
2569 )
2575 )
2570 coreconfigitem(
2576 coreconfigitem(
2571 b'web',
2577 b'web',
2572 b'descend',
2578 b'descend',
2573 default=True,
2579 default=True,
2574 )
2580 )
2575 coreconfigitem(
2581 coreconfigitem(
2576 b'web',
2582 b'web',
2577 b'description',
2583 b'description',
2578 default=b"",
2584 default=b"",
2579 )
2585 )
2580 coreconfigitem(
2586 coreconfigitem(
2581 b'web',
2587 b'web',
2582 b'encoding',
2588 b'encoding',
2583 default=lambda: encoding.encoding,
2589 default=lambda: encoding.encoding,
2584 )
2590 )
2585 coreconfigitem(
2591 coreconfigitem(
2586 b'web',
2592 b'web',
2587 b'errorlog',
2593 b'errorlog',
2588 default=b'-',
2594 default=b'-',
2589 )
2595 )
2590 coreconfigitem(
2596 coreconfigitem(
2591 b'web',
2597 b'web',
2592 b'ipv6',
2598 b'ipv6',
2593 default=False,
2599 default=False,
2594 )
2600 )
2595 coreconfigitem(
2601 coreconfigitem(
2596 b'web',
2602 b'web',
2597 b'maxchanges',
2603 b'maxchanges',
2598 default=10,
2604 default=10,
2599 )
2605 )
2600 coreconfigitem(
2606 coreconfigitem(
2601 b'web',
2607 b'web',
2602 b'maxfiles',
2608 b'maxfiles',
2603 default=10,
2609 default=10,
2604 )
2610 )
2605 coreconfigitem(
2611 coreconfigitem(
2606 b'web',
2612 b'web',
2607 b'maxshortchanges',
2613 b'maxshortchanges',
2608 default=60,
2614 default=60,
2609 )
2615 )
2610 coreconfigitem(
2616 coreconfigitem(
2611 b'web',
2617 b'web',
2612 b'motd',
2618 b'motd',
2613 default=b'',
2619 default=b'',
2614 )
2620 )
2615 coreconfigitem(
2621 coreconfigitem(
2616 b'web',
2622 b'web',
2617 b'name',
2623 b'name',
2618 default=dynamicdefault,
2624 default=dynamicdefault,
2619 )
2625 )
2620 coreconfigitem(
2626 coreconfigitem(
2621 b'web',
2627 b'web',
2622 b'port',
2628 b'port',
2623 default=8000,
2629 default=8000,
2624 )
2630 )
2625 coreconfigitem(
2631 coreconfigitem(
2626 b'web',
2632 b'web',
2627 b'prefix',
2633 b'prefix',
2628 default=b'',
2634 default=b'',
2629 )
2635 )
2630 coreconfigitem(
2636 coreconfigitem(
2631 b'web',
2637 b'web',
2632 b'push_ssl',
2638 b'push_ssl',
2633 default=True,
2639 default=True,
2634 )
2640 )
2635 coreconfigitem(
2641 coreconfigitem(
2636 b'web',
2642 b'web',
2637 b'refreshinterval',
2643 b'refreshinterval',
2638 default=20,
2644 default=20,
2639 )
2645 )
2640 coreconfigitem(
2646 coreconfigitem(
2641 b'web',
2647 b'web',
2642 b'server-header',
2648 b'server-header',
2643 default=None,
2649 default=None,
2644 )
2650 )
2645 coreconfigitem(
2651 coreconfigitem(
2646 b'web',
2652 b'web',
2647 b'static',
2653 b'static',
2648 default=None,
2654 default=None,
2649 )
2655 )
2650 coreconfigitem(
2656 coreconfigitem(
2651 b'web',
2657 b'web',
2652 b'staticurl',
2658 b'staticurl',
2653 default=None,
2659 default=None,
2654 )
2660 )
2655 coreconfigitem(
2661 coreconfigitem(
2656 b'web',
2662 b'web',
2657 b'stripes',
2663 b'stripes',
2658 default=1,
2664 default=1,
2659 )
2665 )
2660 coreconfigitem(
2666 coreconfigitem(
2661 b'web',
2667 b'web',
2662 b'style',
2668 b'style',
2663 default=b'paper',
2669 default=b'paper',
2664 )
2670 )
2665 coreconfigitem(
2671 coreconfigitem(
2666 b'web',
2672 b'web',
2667 b'templates',
2673 b'templates',
2668 default=None,
2674 default=None,
2669 )
2675 )
2670 coreconfigitem(
2676 coreconfigitem(
2671 b'web',
2677 b'web',
2672 b'view',
2678 b'view',
2673 default=b'served',
2679 default=b'served',
2674 experimental=True,
2680 experimental=True,
2675 )
2681 )
2676 coreconfigitem(
2682 coreconfigitem(
2677 b'worker',
2683 b'worker',
2678 b'backgroundclose',
2684 b'backgroundclose',
2679 default=dynamicdefault,
2685 default=dynamicdefault,
2680 )
2686 )
2681 # Windows defaults to a limit of 512 open files. A buffer of 128
2687 # Windows defaults to a limit of 512 open files. A buffer of 128
2682 # should give us enough headway.
2688 # should give us enough headway.
2683 coreconfigitem(
2689 coreconfigitem(
2684 b'worker',
2690 b'worker',
2685 b'backgroundclosemaxqueue',
2691 b'backgroundclosemaxqueue',
2686 default=384,
2692 default=384,
2687 )
2693 )
2688 coreconfigitem(
2694 coreconfigitem(
2689 b'worker',
2695 b'worker',
2690 b'backgroundcloseminfilecount',
2696 b'backgroundcloseminfilecount',
2691 default=2048,
2697 default=2048,
2692 )
2698 )
2693 coreconfigitem(
2699 coreconfigitem(
2694 b'worker',
2700 b'worker',
2695 b'backgroundclosethreadcount',
2701 b'backgroundclosethreadcount',
2696 default=4,
2702 default=4,
2697 )
2703 )
2698 coreconfigitem(
2704 coreconfigitem(
2699 b'worker',
2705 b'worker',
2700 b'enabled',
2706 b'enabled',
2701 default=True,
2707 default=True,
2702 )
2708 )
2703 coreconfigitem(
2709 coreconfigitem(
2704 b'worker',
2710 b'worker',
2705 b'numcpus',
2711 b'numcpus',
2706 default=None,
2712 default=None,
2707 )
2713 )
2708
2714
2709 # Rebase related configuration moved to core because other extension are doing
2715 # Rebase related configuration moved to core because other extension are doing
2710 # strange things. For example, shelve import the extensions to reuse some bit
2716 # strange things. For example, shelve import the extensions to reuse some bit
2711 # without formally loading it.
2717 # without formally loading it.
2712 coreconfigitem(
2718 coreconfigitem(
2713 b'commands',
2719 b'commands',
2714 b'rebase.requiredest',
2720 b'rebase.requiredest',
2715 default=False,
2721 default=False,
2716 )
2722 )
2717 coreconfigitem(
2723 coreconfigitem(
2718 b'experimental',
2724 b'experimental',
2719 b'rebaseskipobsolete',
2725 b'rebaseskipobsolete',
2720 default=True,
2726 default=True,
2721 )
2727 )
2722 coreconfigitem(
2728 coreconfigitem(
2723 b'rebase',
2729 b'rebase',
2724 b'singletransaction',
2730 b'singletransaction',
2725 default=False,
2731 default=False,
2726 )
2732 )
2727 coreconfigitem(
2733 coreconfigitem(
2728 b'rebase',
2734 b'rebase',
2729 b'experimental.inmemory',
2735 b'experimental.inmemory',
2730 default=False,
2736 default=False,
2731 )
2737 )
@@ -1,957 +1,970 b''
1 # extensions.py - extension handling for mercurial
1 # extensions.py - extension handling for mercurial
2 #
2 #
3 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
3 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import ast
10 import ast
11 import collections
11 import collections
12 import functools
12 import functools
13 import imp
13 import imp
14 import inspect
14 import inspect
15 import os
15 import os
16
16
17 from .i18n import (
17 from .i18n import (
18 _,
18 _,
19 gettext,
19 gettext,
20 )
20 )
21 from .pycompat import (
21 from .pycompat import (
22 getattr,
22 getattr,
23 open,
23 open,
24 setattr,
24 setattr,
25 )
25 )
26
26
27 from . import (
27 from . import (
28 cmdutil,
28 cmdutil,
29 configitems,
29 configitems,
30 error,
30 error,
31 pycompat,
31 pycompat,
32 util,
32 util,
33 )
33 )
34
34
35 from .utils import stringutil
35 from .utils import stringutil
36
36
37 _extensions = {}
37 _extensions = {}
38 _disabledextensions = {}
38 _disabledextensions = {}
39 _aftercallbacks = {}
39 _aftercallbacks = {}
40 _order = []
40 _order = []
41 _builtin = {
41 _builtin = {
42 b'hbisect',
42 b'hbisect',
43 b'bookmarks',
43 b'bookmarks',
44 b'color',
44 b'color',
45 b'parentrevspec',
45 b'parentrevspec',
46 b'progress',
46 b'progress',
47 b'interhg',
47 b'interhg',
48 b'inotify',
48 b'inotify',
49 b'hgcia',
49 b'hgcia',
50 b'shelve',
50 b'shelve',
51 }
51 }
52
52
53
53
54 def extensions(ui=None):
54 def extensions(ui=None):
55 if ui:
55 if ui:
56
56
57 def enabled(name):
57 def enabled(name):
58 for format in [b'%s', b'hgext.%s']:
58 for format in [b'%s', b'hgext.%s']:
59 conf = ui.config(b'extensions', format % name)
59 conf = ui.config(b'extensions', format % name)
60 if conf is not None and not conf.startswith(b'!'):
60 if conf is not None and not conf.startswith(b'!'):
61 return True
61 return True
62
62
63 else:
63 else:
64 enabled = lambda name: True
64 enabled = lambda name: True
65 for name in _order:
65 for name in _order:
66 module = _extensions[name]
66 module = _extensions[name]
67 if module and enabled(name):
67 if module and enabled(name):
68 yield name, module
68 yield name, module
69
69
70
70
71 def find(name):
71 def find(name):
72 '''return module with given extension name'''
72 '''return module with given extension name'''
73 mod = None
73 mod = None
74 try:
74 try:
75 mod = _extensions[name]
75 mod = _extensions[name]
76 except KeyError:
76 except KeyError:
77 for k, v in pycompat.iteritems(_extensions):
77 for k, v in pycompat.iteritems(_extensions):
78 if k.endswith(b'.' + name) or k.endswith(b'/' + name):
78 if k.endswith(b'.' + name) or k.endswith(b'/' + name):
79 mod = v
79 mod = v
80 break
80 break
81 if not mod:
81 if not mod:
82 raise KeyError(name)
82 raise KeyError(name)
83 return mod
83 return mod
84
84
85
85
86 def loadpath(path, module_name):
86 def loadpath(path, module_name):
87 module_name = module_name.replace(b'.', b'_')
87 module_name = module_name.replace(b'.', b'_')
88 path = util.normpath(util.expandpath(path))
88 path = util.normpath(util.expandpath(path))
89 module_name = pycompat.fsdecode(module_name)
89 module_name = pycompat.fsdecode(module_name)
90 path = pycompat.fsdecode(path)
90 path = pycompat.fsdecode(path)
91 if os.path.isdir(path):
91 if os.path.isdir(path):
92 # module/__init__.py style
92 # module/__init__.py style
93 d, f = os.path.split(path)
93 d, f = os.path.split(path)
94 fd, fpath, desc = imp.find_module(f, [d])
94 fd, fpath, desc = imp.find_module(f, [d])
95 # When https://github.com/python/typeshed/issues/3466 is fixed
95 # When https://github.com/python/typeshed/issues/3466 is fixed
96 # and in a pytype release we can drop this disable.
96 # and in a pytype release we can drop this disable.
97 return imp.load_module(
97 return imp.load_module(
98 module_name, fd, fpath, desc # pytype: disable=wrong-arg-types
98 module_name, fd, fpath, desc # pytype: disable=wrong-arg-types
99 )
99 )
100 else:
100 else:
101 try:
101 try:
102 return imp.load_source(module_name, path)
102 return imp.load_source(module_name, path)
103 except IOError as exc:
103 except IOError as exc:
104 if not exc.filename:
104 if not exc.filename:
105 exc.filename = path # python does not fill this
105 exc.filename = path # python does not fill this
106 raise
106 raise
107
107
108
108
109 def _importh(name):
109 def _importh(name):
110 """import and return the <name> module"""
110 """import and return the <name> module"""
111 mod = __import__(pycompat.sysstr(name))
111 mod = __import__(pycompat.sysstr(name))
112 components = name.split(b'.')
112 components = name.split(b'.')
113 for comp in components[1:]:
113 for comp in components[1:]:
114 mod = getattr(mod, comp)
114 mod = getattr(mod, comp)
115 return mod
115 return mod
116
116
117
117
118 def _importext(name, path=None, reportfunc=None):
118 def _importext(name, path=None, reportfunc=None):
119 if path:
119 if path:
120 # the module will be loaded in sys.modules
120 # the module will be loaded in sys.modules
121 # choose an unique name so that it doesn't
121 # choose an unique name so that it doesn't
122 # conflicts with other modules
122 # conflicts with other modules
123 mod = loadpath(path, b'hgext.%s' % name)
123 mod = loadpath(path, b'hgext.%s' % name)
124 else:
124 else:
125 try:
125 try:
126 mod = _importh(b"hgext.%s" % name)
126 mod = _importh(b"hgext.%s" % name)
127 except ImportError as err:
127 except ImportError as err:
128 if reportfunc:
128 if reportfunc:
129 reportfunc(err, b"hgext.%s" % name, b"hgext3rd.%s" % name)
129 reportfunc(err, b"hgext.%s" % name, b"hgext3rd.%s" % name)
130 try:
130 try:
131 mod = _importh(b"hgext3rd.%s" % name)
131 mod = _importh(b"hgext3rd.%s" % name)
132 except ImportError as err:
132 except ImportError as err:
133 if reportfunc:
133 if reportfunc:
134 reportfunc(err, b"hgext3rd.%s" % name, name)
134 reportfunc(err, b"hgext3rd.%s" % name, name)
135 mod = _importh(name)
135 mod = _importh(name)
136 return mod
136 return mod
137
137
138
138
139 def _reportimporterror(ui, err, failed, next):
139 def _reportimporterror(ui, err, failed, next):
140 # note: this ui.log happens before --debug is processed,
140 # note: this ui.log happens before --debug is processed,
141 # Use --config ui.debug=1 to see them.
141 # Use --config ui.debug=1 to see them.
142 ui.log(
142 ui.log(
143 b'extension',
143 b'extension',
144 b' - could not import %s (%s): trying %s\n',
144 b' - could not import %s (%s): trying %s\n',
145 failed,
145 failed,
146 stringutil.forcebytestr(err),
146 stringutil.forcebytestr(err),
147 next,
147 next,
148 )
148 )
149 if ui.debugflag and ui.configbool(b'devel', b'debug.extensions'):
149 if ui.debugflag and ui.configbool(b'devel', b'debug.extensions'):
150 ui.traceback()
150 ui.traceback()
151
151
152
152
153 def _rejectunicode(name, xs):
153 def _rejectunicode(name, xs):
154 if isinstance(xs, (list, set, tuple)):
154 if isinstance(xs, (list, set, tuple)):
155 for x in xs:
155 for x in xs:
156 _rejectunicode(name, x)
156 _rejectunicode(name, x)
157 elif isinstance(xs, dict):
157 elif isinstance(xs, dict):
158 for k, v in xs.items():
158 for k, v in xs.items():
159 _rejectunicode(name, k)
159 _rejectunicode(name, k)
160 _rejectunicode(b'%s.%s' % (name, stringutil.forcebytestr(k)), v)
160 _rejectunicode(b'%s.%s' % (name, stringutil.forcebytestr(k)), v)
161 elif isinstance(xs, type(u'')):
161 elif isinstance(xs, type(u'')):
162 raise error.ProgrammingError(
162 raise error.ProgrammingError(
163 b"unicode %r found in %s" % (xs, name),
163 b"unicode %r found in %s" % (xs, name),
164 hint=b"use b'' to make it byte string",
164 hint=b"use b'' to make it byte string",
165 )
165 )
166
166
167
167
168 # attributes set by registrar.command
168 # attributes set by registrar.command
169 _cmdfuncattrs = (b'norepo', b'optionalrepo', b'inferrepo')
169 _cmdfuncattrs = (b'norepo', b'optionalrepo', b'inferrepo')
170
170
171
171
172 def _validatecmdtable(ui, cmdtable):
172 def _validatecmdtable(ui, cmdtable):
173 """Check if extension commands have required attributes"""
173 """Check if extension commands have required attributes"""
174 for c, e in pycompat.iteritems(cmdtable):
174 for c, e in pycompat.iteritems(cmdtable):
175 f = e[0]
175 f = e[0]
176 missing = [a for a in _cmdfuncattrs if not util.safehasattr(f, a)]
176 missing = [a for a in _cmdfuncattrs if not util.safehasattr(f, a)]
177 if not missing:
177 if not missing:
178 continue
178 continue
179 raise error.ProgrammingError(
179 raise error.ProgrammingError(
180 b'missing attributes: %s' % b', '.join(missing),
180 b'missing attributes: %s' % b', '.join(missing),
181 hint=b"use @command decorator to register '%s'" % c,
181 hint=b"use @command decorator to register '%s'" % c,
182 )
182 )
183
183
184
184
185 def _validatetables(ui, mod):
185 def _validatetables(ui, mod):
186 """Sanity check for loadable tables provided by extension module"""
186 """Sanity check for loadable tables provided by extension module"""
187 for t in [b'cmdtable', b'colortable', b'configtable']:
187 for t in [b'cmdtable', b'colortable', b'configtable']:
188 _rejectunicode(t, getattr(mod, t, {}))
188 _rejectunicode(t, getattr(mod, t, {}))
189 for t in [
189 for t in [
190 b'filesetpredicate',
190 b'filesetpredicate',
191 b'internalmerge',
191 b'internalmerge',
192 b'revsetpredicate',
192 b'revsetpredicate',
193 b'templatefilter',
193 b'templatefilter',
194 b'templatefunc',
194 b'templatefunc',
195 b'templatekeyword',
195 b'templatekeyword',
196 ]:
196 ]:
197 o = getattr(mod, t, None)
197 o = getattr(mod, t, None)
198 if o:
198 if o:
199 _rejectunicode(t, o._table)
199 _rejectunicode(t, o._table)
200 _validatecmdtable(ui, getattr(mod, 'cmdtable', {}))
200 _validatecmdtable(ui, getattr(mod, 'cmdtable', {}))
201
201
202
202
203 def load(ui, name, path, loadingtime=None):
203 def load(ui, name, path, loadingtime=None):
204 if name.startswith(b'hgext.') or name.startswith(b'hgext/'):
204 if name.startswith(b'hgext.') or name.startswith(b'hgext/'):
205 shortname = name[6:]
205 shortname = name[6:]
206 else:
206 else:
207 shortname = name
207 shortname = name
208 if shortname in _builtin:
208 if shortname in _builtin:
209 return None
209 return None
210 if shortname in _extensions:
210 if shortname in _extensions:
211 return _extensions[shortname]
211 return _extensions[shortname]
212 ui.log(b'extension', b' - loading extension: %s\n', shortname)
212 ui.log(b'extension', b' - loading extension: %s\n', shortname)
213 _extensions[shortname] = None
213 _extensions[shortname] = None
214 with util.timedcm('load extension %s', shortname) as stats:
214 with util.timedcm('load extension %s', shortname) as stats:
215 mod = _importext(name, path, bind(_reportimporterror, ui))
215 mod = _importext(name, path, bind(_reportimporterror, ui))
216 ui.log(b'extension', b' > %s extension loaded in %s\n', shortname, stats)
216 ui.log(b'extension', b' > %s extension loaded in %s\n', shortname, stats)
217 if loadingtime is not None:
217 if loadingtime is not None:
218 loadingtime[shortname] += stats.elapsed
218 loadingtime[shortname] += stats.elapsed
219
219
220 # Before we do anything with the extension, check against minimum stated
220 # Before we do anything with the extension, check against minimum stated
221 # compatibility. This gives extension authors a mechanism to have their
221 # compatibility. This gives extension authors a mechanism to have their
222 # extensions short circuit when loaded with a known incompatible version
222 # extensions short circuit when loaded with a known incompatible version
223 # of Mercurial.
223 # of Mercurial.
224 minver = getattr(mod, 'minimumhgversion', None)
224 minver = getattr(mod, 'minimumhgversion', None)
225 if minver:
225 if minver:
226 curver = util.versiontuple(n=2)
226 curver = util.versiontuple(n=2)
227 extmin = util.versiontuple(stringutil.forcebytestr(minver), 2)
227 extmin = util.versiontuple(stringutil.forcebytestr(minver), 2)
228
228
229 if None in extmin:
229 if None in extmin:
230 extmin = (extmin[0] or 0, extmin[1] or 0)
230 extmin = (extmin[0] or 0, extmin[1] or 0)
231
231
232 if None in curver or extmin > curver:
232 if None in curver or extmin > curver:
233 msg = _(
233 msg = _(
234 b'(third party extension %s requires version %s or newer '
234 b'(third party extension %s requires version %s or newer '
235 b'of Mercurial (current: %s); disabling)\n'
235 b'of Mercurial (current: %s); disabling)\n'
236 )
236 )
237 ui.warn(msg % (shortname, minver, util.version()))
237 ui.warn(msg % (shortname, minver, util.version()))
238 return
238 return
239 ui.log(b'extension', b' - validating extension tables: %s\n', shortname)
239 ui.log(b'extension', b' - validating extension tables: %s\n', shortname)
240 _validatetables(ui, mod)
240 _validatetables(ui, mod)
241
241
242 _extensions[shortname] = mod
242 _extensions[shortname] = mod
243 _order.append(shortname)
243 _order.append(shortname)
244 ui.log(
244 ui.log(
245 b'extension', b' - invoking registered callbacks: %s\n', shortname
245 b'extension', b' - invoking registered callbacks: %s\n', shortname
246 )
246 )
247 with util.timedcm('callbacks extension %s', shortname) as stats:
247 with util.timedcm('callbacks extension %s', shortname) as stats:
248 for fn in _aftercallbacks.get(shortname, []):
248 for fn in _aftercallbacks.get(shortname, []):
249 fn(loaded=True)
249 fn(loaded=True)
250 ui.log(b'extension', b' > callbacks completed in %s\n', stats)
250 ui.log(b'extension', b' > callbacks completed in %s\n', stats)
251 return mod
251 return mod
252
252
253
253
254 def _runuisetup(name, ui):
254 def _runuisetup(name, ui):
255 uisetup = getattr(_extensions[name], 'uisetup', None)
255 uisetup = getattr(_extensions[name], 'uisetup', None)
256 if uisetup:
256 if uisetup:
257 try:
257 try:
258 uisetup(ui)
258 uisetup(ui)
259 except Exception as inst:
259 except Exception as inst:
260 ui.traceback(force=True)
260 ui.traceback(force=True)
261 msg = stringutil.forcebytestr(inst)
261 msg = stringutil.forcebytestr(inst)
262 ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg))
262 ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg))
263 return False
263 return False
264 return True
264 return True
265
265
266
266
267 def _runextsetup(name, ui):
267 def _runextsetup(name, ui):
268 extsetup = getattr(_extensions[name], 'extsetup', None)
268 extsetup = getattr(_extensions[name], 'extsetup', None)
269 if extsetup:
269 if extsetup:
270 try:
270 try:
271 extsetup(ui)
271 extsetup(ui)
272 except Exception as inst:
272 except Exception as inst:
273 ui.traceback(force=True)
273 ui.traceback(force=True)
274 msg = stringutil.forcebytestr(inst)
274 msg = stringutil.forcebytestr(inst)
275 ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg))
275 ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg))
276 return False
276 return False
277 return True
277 return True
278
278
279
279
280 def loadall(ui, whitelist=None):
280 def loadall(ui, whitelist=None):
281 loadingtime = collections.defaultdict(int)
281 loadingtime = collections.defaultdict(int)
282 result = ui.configitems(b"extensions")
282 result = ui.configitems(b"extensions")
283 if whitelist is not None:
283 if whitelist is not None:
284 result = [(k, v) for (k, v) in result if k in whitelist]
284 result = [(k, v) for (k, v) in result if k in whitelist]
285 result = [(k, v) for (k, v) in result if b':' not in k]
285 result = [(k, v) for (k, v) in result if b':' not in k]
286 newindex = len(_order)
286 newindex = len(_order)
287 ui.log(
287 ui.log(
288 b'extension',
288 b'extension',
289 b'loading %sextensions\n',
289 b'loading %sextensions\n',
290 b'additional ' if newindex else b'',
290 b'additional ' if newindex else b'',
291 )
291 )
292 ui.log(b'extension', b'- processing %d entries\n', len(result))
292 ui.log(b'extension', b'- processing %d entries\n', len(result))
293 with util.timedcm('load all extensions') as stats:
293 with util.timedcm('load all extensions') as stats:
294 for (name, path) in result:
294 for (name, path) in result:
295 if path:
295 if path:
296 if path[0:1] == b'!':
296 if path[0:1] == b'!':
297 if name not in _disabledextensions:
297 if name not in _disabledextensions:
298 ui.log(
298 ui.log(
299 b'extension',
299 b'extension',
300 b' - skipping disabled extension: %s\n',
300 b' - skipping disabled extension: %s\n',
301 name,
301 name,
302 )
302 )
303 _disabledextensions[name] = path[1:]
303 _disabledextensions[name] = path[1:]
304 continue
304 continue
305 try:
305 try:
306 load(ui, name, path, loadingtime)
306 load(ui, name, path, loadingtime)
307 except Exception as inst:
307 except Exception as inst:
308 msg = stringutil.forcebytestr(inst)
308 msg = stringutil.forcebytestr(inst)
309 if path:
309 if path:
310 error_msg = _(
310 error_msg = _(
311 b'failed to import extension "%s" from %s: %s'
311 b'failed to import extension "%s" from %s: %s'
312 )
312 )
313 error_msg %= (name, path, msg)
313 error_msg %= (name, path, msg)
314 else:
314 else:
315 error_msg = _(b'failed to import extension "%s": %s')
315 error_msg = _(b'failed to import extension "%s": %s')
316 error_msg %= (name, msg)
316 error_msg %= (name, msg)
317
318 ext_options = ui.configsuboptions(b"extensions", name)[1]
319 if stringutil.parsebool(ext_options.get(b"required", b'no')):
320 hint = None
321 if isinstance(inst, error.Hint) and inst.hint:
322 hint = inst.hint
323 if hint is None:
324 hint = _(
325 b"loading of this extension was required, "
326 b"see `hg help config.extensions` for details"
327 )
328 raise error.Abort(error_msg, hint=hint)
329 else:
317 ui.warn((b"*** %s\n") % error_msg)
330 ui.warn((b"*** %s\n") % error_msg)
318 if isinstance(inst, error.Hint) and inst.hint:
331 if isinstance(inst, error.Hint) and inst.hint:
319 ui.warn(_(b"*** (%s)\n") % inst.hint)
332 ui.warn(_(b"*** (%s)\n") % inst.hint)
320 ui.traceback()
333 ui.traceback()
321
334
322 ui.log(
335 ui.log(
323 b'extension',
336 b'extension',
324 b'> loaded %d extensions, total time %s\n',
337 b'> loaded %d extensions, total time %s\n',
325 len(_order) - newindex,
338 len(_order) - newindex,
326 stats,
339 stats,
327 )
340 )
328 # list of (objname, loadermod, loadername) tuple:
341 # list of (objname, loadermod, loadername) tuple:
329 # - objname is the name of an object in extension module,
342 # - objname is the name of an object in extension module,
330 # from which extra information is loaded
343 # from which extra information is loaded
331 # - loadermod is the module where loader is placed
344 # - loadermod is the module where loader is placed
332 # - loadername is the name of the function,
345 # - loadername is the name of the function,
333 # which takes (ui, extensionname, extraobj) arguments
346 # which takes (ui, extensionname, extraobj) arguments
334 #
347 #
335 # This one is for the list of item that must be run before running any setup
348 # This one is for the list of item that must be run before running any setup
336 earlyextraloaders = [
349 earlyextraloaders = [
337 (b'configtable', configitems, b'loadconfigtable'),
350 (b'configtable', configitems, b'loadconfigtable'),
338 ]
351 ]
339
352
340 ui.log(b'extension', b'- loading configtable attributes\n')
353 ui.log(b'extension', b'- loading configtable attributes\n')
341 _loadextra(ui, newindex, earlyextraloaders)
354 _loadextra(ui, newindex, earlyextraloaders)
342
355
343 broken = set()
356 broken = set()
344 ui.log(b'extension', b'- executing uisetup hooks\n')
357 ui.log(b'extension', b'- executing uisetup hooks\n')
345 with util.timedcm('all uisetup') as alluisetupstats:
358 with util.timedcm('all uisetup') as alluisetupstats:
346 for name in _order[newindex:]:
359 for name in _order[newindex:]:
347 ui.log(b'extension', b' - running uisetup for %s\n', name)
360 ui.log(b'extension', b' - running uisetup for %s\n', name)
348 with util.timedcm('uisetup %s', name) as stats:
361 with util.timedcm('uisetup %s', name) as stats:
349 if not _runuisetup(name, ui):
362 if not _runuisetup(name, ui):
350 ui.log(
363 ui.log(
351 b'extension',
364 b'extension',
352 b' - the %s extension uisetup failed\n',
365 b' - the %s extension uisetup failed\n',
353 name,
366 name,
354 )
367 )
355 broken.add(name)
368 broken.add(name)
356 ui.log(b'extension', b' > uisetup for %s took %s\n', name, stats)
369 ui.log(b'extension', b' > uisetup for %s took %s\n', name, stats)
357 loadingtime[name] += stats.elapsed
370 loadingtime[name] += stats.elapsed
358 ui.log(b'extension', b'> all uisetup took %s\n', alluisetupstats)
371 ui.log(b'extension', b'> all uisetup took %s\n', alluisetupstats)
359
372
360 ui.log(b'extension', b'- executing extsetup hooks\n')
373 ui.log(b'extension', b'- executing extsetup hooks\n')
361 with util.timedcm('all extsetup') as allextetupstats:
374 with util.timedcm('all extsetup') as allextetupstats:
362 for name in _order[newindex:]:
375 for name in _order[newindex:]:
363 if name in broken:
376 if name in broken:
364 continue
377 continue
365 ui.log(b'extension', b' - running extsetup for %s\n', name)
378 ui.log(b'extension', b' - running extsetup for %s\n', name)
366 with util.timedcm('extsetup %s', name) as stats:
379 with util.timedcm('extsetup %s', name) as stats:
367 if not _runextsetup(name, ui):
380 if not _runextsetup(name, ui):
368 ui.log(
381 ui.log(
369 b'extension',
382 b'extension',
370 b' - the %s extension extsetup failed\n',
383 b' - the %s extension extsetup failed\n',
371 name,
384 name,
372 )
385 )
373 broken.add(name)
386 broken.add(name)
374 ui.log(b'extension', b' > extsetup for %s took %s\n', name, stats)
387 ui.log(b'extension', b' > extsetup for %s took %s\n', name, stats)
375 loadingtime[name] += stats.elapsed
388 loadingtime[name] += stats.elapsed
376 ui.log(b'extension', b'> all extsetup took %s\n', allextetupstats)
389 ui.log(b'extension', b'> all extsetup took %s\n', allextetupstats)
377
390
378 for name in broken:
391 for name in broken:
379 ui.log(b'extension', b' - disabling broken %s extension\n', name)
392 ui.log(b'extension', b' - disabling broken %s extension\n', name)
380 _extensions[name] = None
393 _extensions[name] = None
381
394
382 # Call aftercallbacks that were never met.
395 # Call aftercallbacks that were never met.
383 ui.log(b'extension', b'- executing remaining aftercallbacks\n')
396 ui.log(b'extension', b'- executing remaining aftercallbacks\n')
384 with util.timedcm('aftercallbacks') as stats:
397 with util.timedcm('aftercallbacks') as stats:
385 for shortname in _aftercallbacks:
398 for shortname in _aftercallbacks:
386 if shortname in _extensions:
399 if shortname in _extensions:
387 continue
400 continue
388
401
389 for fn in _aftercallbacks[shortname]:
402 for fn in _aftercallbacks[shortname]:
390 ui.log(
403 ui.log(
391 b'extension',
404 b'extension',
392 b' - extension %s not loaded, notify callbacks\n',
405 b' - extension %s not loaded, notify callbacks\n',
393 shortname,
406 shortname,
394 )
407 )
395 fn(loaded=False)
408 fn(loaded=False)
396 ui.log(b'extension', b'> remaining aftercallbacks completed in %s\n', stats)
409 ui.log(b'extension', b'> remaining aftercallbacks completed in %s\n', stats)
397
410
398 # loadall() is called multiple times and lingering _aftercallbacks
411 # loadall() is called multiple times and lingering _aftercallbacks
399 # entries could result in double execution. See issue4646.
412 # entries could result in double execution. See issue4646.
400 _aftercallbacks.clear()
413 _aftercallbacks.clear()
401
414
402 # delay importing avoids cyclic dependency (especially commands)
415 # delay importing avoids cyclic dependency (especially commands)
403 from . import (
416 from . import (
404 color,
417 color,
405 commands,
418 commands,
406 filemerge,
419 filemerge,
407 fileset,
420 fileset,
408 revset,
421 revset,
409 templatefilters,
422 templatefilters,
410 templatefuncs,
423 templatefuncs,
411 templatekw,
424 templatekw,
412 )
425 )
413
426
414 # list of (objname, loadermod, loadername) tuple:
427 # list of (objname, loadermod, loadername) tuple:
415 # - objname is the name of an object in extension module,
428 # - objname is the name of an object in extension module,
416 # from which extra information is loaded
429 # from which extra information is loaded
417 # - loadermod is the module where loader is placed
430 # - loadermod is the module where loader is placed
418 # - loadername is the name of the function,
431 # - loadername is the name of the function,
419 # which takes (ui, extensionname, extraobj) arguments
432 # which takes (ui, extensionname, extraobj) arguments
420 ui.log(b'extension', b'- loading extension registration objects\n')
433 ui.log(b'extension', b'- loading extension registration objects\n')
421 extraloaders = [
434 extraloaders = [
422 (b'cmdtable', commands, b'loadcmdtable'),
435 (b'cmdtable', commands, b'loadcmdtable'),
423 (b'colortable', color, b'loadcolortable'),
436 (b'colortable', color, b'loadcolortable'),
424 (b'filesetpredicate', fileset, b'loadpredicate'),
437 (b'filesetpredicate', fileset, b'loadpredicate'),
425 (b'internalmerge', filemerge, b'loadinternalmerge'),
438 (b'internalmerge', filemerge, b'loadinternalmerge'),
426 (b'revsetpredicate', revset, b'loadpredicate'),
439 (b'revsetpredicate', revset, b'loadpredicate'),
427 (b'templatefilter', templatefilters, b'loadfilter'),
440 (b'templatefilter', templatefilters, b'loadfilter'),
428 (b'templatefunc', templatefuncs, b'loadfunction'),
441 (b'templatefunc', templatefuncs, b'loadfunction'),
429 (b'templatekeyword', templatekw, b'loadkeyword'),
442 (b'templatekeyword', templatekw, b'loadkeyword'),
430 ]
443 ]
431 with util.timedcm('load registration objects') as stats:
444 with util.timedcm('load registration objects') as stats:
432 _loadextra(ui, newindex, extraloaders)
445 _loadextra(ui, newindex, extraloaders)
433 ui.log(
446 ui.log(
434 b'extension',
447 b'extension',
435 b'> extension registration object loading took %s\n',
448 b'> extension registration object loading took %s\n',
436 stats,
449 stats,
437 )
450 )
438
451
439 # Report per extension loading time (except reposetup)
452 # Report per extension loading time (except reposetup)
440 for name in sorted(loadingtime):
453 for name in sorted(loadingtime):
441 ui.log(
454 ui.log(
442 b'extension',
455 b'extension',
443 b'> extension %s take a total of %s to load\n',
456 b'> extension %s take a total of %s to load\n',
444 name,
457 name,
445 util.timecount(loadingtime[name]),
458 util.timecount(loadingtime[name]),
446 )
459 )
447
460
448 ui.log(b'extension', b'extension loading complete\n')
461 ui.log(b'extension', b'extension loading complete\n')
449
462
450
463
451 def _loadextra(ui, newindex, extraloaders):
464 def _loadextra(ui, newindex, extraloaders):
452 for name in _order[newindex:]:
465 for name in _order[newindex:]:
453 module = _extensions[name]
466 module = _extensions[name]
454 if not module:
467 if not module:
455 continue # loading this module failed
468 continue # loading this module failed
456
469
457 for objname, loadermod, loadername in extraloaders:
470 for objname, loadermod, loadername in extraloaders:
458 extraobj = getattr(module, objname, None)
471 extraobj = getattr(module, objname, None)
459 if extraobj is not None:
472 if extraobj is not None:
460 getattr(loadermod, loadername)(ui, name, extraobj)
473 getattr(loadermod, loadername)(ui, name, extraobj)
461
474
462
475
463 def afterloaded(extension, callback):
476 def afterloaded(extension, callback):
464 """Run the specified function after a named extension is loaded.
477 """Run the specified function after a named extension is loaded.
465
478
466 If the named extension is already loaded, the callback will be called
479 If the named extension is already loaded, the callback will be called
467 immediately.
480 immediately.
468
481
469 If the named extension never loads, the callback will be called after
482 If the named extension never loads, the callback will be called after
470 all extensions have been loaded.
483 all extensions have been loaded.
471
484
472 The callback receives the named argument ``loaded``, which is a boolean
485 The callback receives the named argument ``loaded``, which is a boolean
473 indicating whether the dependent extension actually loaded.
486 indicating whether the dependent extension actually loaded.
474 """
487 """
475
488
476 if extension in _extensions:
489 if extension in _extensions:
477 # Report loaded as False if the extension is disabled
490 # Report loaded as False if the extension is disabled
478 loaded = _extensions[extension] is not None
491 loaded = _extensions[extension] is not None
479 callback(loaded=loaded)
492 callback(loaded=loaded)
480 else:
493 else:
481 _aftercallbacks.setdefault(extension, []).append(callback)
494 _aftercallbacks.setdefault(extension, []).append(callback)
482
495
483
496
484 def populateui(ui):
497 def populateui(ui):
485 """Run extension hooks on the given ui to populate additional members,
498 """Run extension hooks on the given ui to populate additional members,
486 extend the class dynamically, etc.
499 extend the class dynamically, etc.
487
500
488 This will be called after the configuration is loaded, and/or extensions
501 This will be called after the configuration is loaded, and/or extensions
489 are loaded. In general, it's once per ui instance, but in command-server
502 are loaded. In general, it's once per ui instance, but in command-server
490 and hgweb, this may be called more than once with the same ui.
503 and hgweb, this may be called more than once with the same ui.
491 """
504 """
492 for name, mod in extensions(ui):
505 for name, mod in extensions(ui):
493 hook = getattr(mod, 'uipopulate', None)
506 hook = getattr(mod, 'uipopulate', None)
494 if not hook:
507 if not hook:
495 continue
508 continue
496 try:
509 try:
497 hook(ui)
510 hook(ui)
498 except Exception as inst:
511 except Exception as inst:
499 ui.traceback(force=True)
512 ui.traceback(force=True)
500 ui.warn(
513 ui.warn(
501 _(b'*** failed to populate ui by extension %s: %s\n')
514 _(b'*** failed to populate ui by extension %s: %s\n')
502 % (name, stringutil.forcebytestr(inst))
515 % (name, stringutil.forcebytestr(inst))
503 )
516 )
504
517
505
518
506 def bind(func, *args):
519 def bind(func, *args):
507 """Partial function application
520 """Partial function application
508
521
509 Returns a new function that is the partial application of args and kwargs
522 Returns a new function that is the partial application of args and kwargs
510 to func. For example,
523 to func. For example,
511
524
512 f(1, 2, bar=3) === bind(f, 1)(2, bar=3)"""
525 f(1, 2, bar=3) === bind(f, 1)(2, bar=3)"""
513 assert callable(func)
526 assert callable(func)
514
527
515 def closure(*a, **kw):
528 def closure(*a, **kw):
516 return func(*(args + a), **kw)
529 return func(*(args + a), **kw)
517
530
518 return closure
531 return closure
519
532
520
533
521 def _updatewrapper(wrap, origfn, unboundwrapper):
534 def _updatewrapper(wrap, origfn, unboundwrapper):
522 '''Copy and add some useful attributes to wrapper'''
535 '''Copy and add some useful attributes to wrapper'''
523 try:
536 try:
524 wrap.__name__ = origfn.__name__
537 wrap.__name__ = origfn.__name__
525 except AttributeError:
538 except AttributeError:
526 pass
539 pass
527 wrap.__module__ = getattr(origfn, '__module__')
540 wrap.__module__ = getattr(origfn, '__module__')
528 wrap.__doc__ = getattr(origfn, '__doc__')
541 wrap.__doc__ = getattr(origfn, '__doc__')
529 wrap.__dict__.update(getattr(origfn, '__dict__', {}))
542 wrap.__dict__.update(getattr(origfn, '__dict__', {}))
530 wrap._origfunc = origfn
543 wrap._origfunc = origfn
531 wrap._unboundwrapper = unboundwrapper
544 wrap._unboundwrapper = unboundwrapper
532
545
533
546
534 def wrapcommand(table, command, wrapper, synopsis=None, docstring=None):
547 def wrapcommand(table, command, wrapper, synopsis=None, docstring=None):
535 '''Wrap the command named `command' in table
548 '''Wrap the command named `command' in table
536
549
537 Replace command in the command table with wrapper. The wrapped command will
550 Replace command in the command table with wrapper. The wrapped command will
538 be inserted into the command table specified by the table argument.
551 be inserted into the command table specified by the table argument.
539
552
540 The wrapper will be called like
553 The wrapper will be called like
541
554
542 wrapper(orig, *args, **kwargs)
555 wrapper(orig, *args, **kwargs)
543
556
544 where orig is the original (wrapped) function, and *args, **kwargs
557 where orig is the original (wrapped) function, and *args, **kwargs
545 are the arguments passed to it.
558 are the arguments passed to it.
546
559
547 Optionally append to the command synopsis and docstring, used for help.
560 Optionally append to the command synopsis and docstring, used for help.
548 For example, if your extension wraps the ``bookmarks`` command to add the
561 For example, if your extension wraps the ``bookmarks`` command to add the
549 flags ``--remote`` and ``--all`` you might call this function like so:
562 flags ``--remote`` and ``--all`` you might call this function like so:
550
563
551 synopsis = ' [-a] [--remote]'
564 synopsis = ' [-a] [--remote]'
552 docstring = """
565 docstring = """
553
566
554 The ``remotenames`` extension adds the ``--remote`` and ``--all`` (``-a``)
567 The ``remotenames`` extension adds the ``--remote`` and ``--all`` (``-a``)
555 flags to the bookmarks command. Either flag will show the remote bookmarks
568 flags to the bookmarks command. Either flag will show the remote bookmarks
556 known to the repository; ``--remote`` will also suppress the output of the
569 known to the repository; ``--remote`` will also suppress the output of the
557 local bookmarks.
570 local bookmarks.
558 """
571 """
559
572
560 extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks,
573 extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks,
561 synopsis, docstring)
574 synopsis, docstring)
562 '''
575 '''
563 assert callable(wrapper)
576 assert callable(wrapper)
564 aliases, entry = cmdutil.findcmd(command, table)
577 aliases, entry = cmdutil.findcmd(command, table)
565 for alias, e in pycompat.iteritems(table):
578 for alias, e in pycompat.iteritems(table):
566 if e is entry:
579 if e is entry:
567 key = alias
580 key = alias
568 break
581 break
569
582
570 origfn = entry[0]
583 origfn = entry[0]
571 wrap = functools.partial(
584 wrap = functools.partial(
572 util.checksignature(wrapper), util.checksignature(origfn)
585 util.checksignature(wrapper), util.checksignature(origfn)
573 )
586 )
574 _updatewrapper(wrap, origfn, wrapper)
587 _updatewrapper(wrap, origfn, wrapper)
575 if docstring is not None:
588 if docstring is not None:
576 wrap.__doc__ += docstring
589 wrap.__doc__ += docstring
577
590
578 newentry = list(entry)
591 newentry = list(entry)
579 newentry[0] = wrap
592 newentry[0] = wrap
580 if synopsis is not None:
593 if synopsis is not None:
581 newentry[2] += synopsis
594 newentry[2] += synopsis
582 table[key] = tuple(newentry)
595 table[key] = tuple(newentry)
583 return entry
596 return entry
584
597
585
598
586 def wrapfilecache(cls, propname, wrapper):
599 def wrapfilecache(cls, propname, wrapper):
587 """Wraps a filecache property.
600 """Wraps a filecache property.
588
601
589 These can't be wrapped using the normal wrapfunction.
602 These can't be wrapped using the normal wrapfunction.
590 """
603 """
591 propname = pycompat.sysstr(propname)
604 propname = pycompat.sysstr(propname)
592 assert callable(wrapper)
605 assert callable(wrapper)
593 for currcls in cls.__mro__:
606 for currcls in cls.__mro__:
594 if propname in currcls.__dict__:
607 if propname in currcls.__dict__:
595 origfn = currcls.__dict__[propname].func
608 origfn = currcls.__dict__[propname].func
596 assert callable(origfn)
609 assert callable(origfn)
597
610
598 def wrap(*args, **kwargs):
611 def wrap(*args, **kwargs):
599 return wrapper(origfn, *args, **kwargs)
612 return wrapper(origfn, *args, **kwargs)
600
613
601 currcls.__dict__[propname].func = wrap
614 currcls.__dict__[propname].func = wrap
602 break
615 break
603
616
604 if currcls is object:
617 if currcls is object:
605 raise AttributeError("type '%s' has no property '%s'" % (cls, propname))
618 raise AttributeError("type '%s' has no property '%s'" % (cls, propname))
606
619
607
620
608 class wrappedfunction(object):
621 class wrappedfunction(object):
609 '''context manager for temporarily wrapping a function'''
622 '''context manager for temporarily wrapping a function'''
610
623
611 def __init__(self, container, funcname, wrapper):
624 def __init__(self, container, funcname, wrapper):
612 assert callable(wrapper)
625 assert callable(wrapper)
613 self._container = container
626 self._container = container
614 self._funcname = funcname
627 self._funcname = funcname
615 self._wrapper = wrapper
628 self._wrapper = wrapper
616
629
617 def __enter__(self):
630 def __enter__(self):
618 wrapfunction(self._container, self._funcname, self._wrapper)
631 wrapfunction(self._container, self._funcname, self._wrapper)
619
632
620 def __exit__(self, exctype, excvalue, traceback):
633 def __exit__(self, exctype, excvalue, traceback):
621 unwrapfunction(self._container, self._funcname, self._wrapper)
634 unwrapfunction(self._container, self._funcname, self._wrapper)
622
635
623
636
624 def wrapfunction(container, funcname, wrapper):
637 def wrapfunction(container, funcname, wrapper):
625 """Wrap the function named funcname in container
638 """Wrap the function named funcname in container
626
639
627 Replace the funcname member in the given container with the specified
640 Replace the funcname member in the given container with the specified
628 wrapper. The container is typically a module, class, or instance.
641 wrapper. The container is typically a module, class, or instance.
629
642
630 The wrapper will be called like
643 The wrapper will be called like
631
644
632 wrapper(orig, *args, **kwargs)
645 wrapper(orig, *args, **kwargs)
633
646
634 where orig is the original (wrapped) function, and *args, **kwargs
647 where orig is the original (wrapped) function, and *args, **kwargs
635 are the arguments passed to it.
648 are the arguments passed to it.
636
649
637 Wrapping methods of the repository object is not recommended since
650 Wrapping methods of the repository object is not recommended since
638 it conflicts with extensions that extend the repository by
651 it conflicts with extensions that extend the repository by
639 subclassing. All extensions that need to extend methods of
652 subclassing. All extensions that need to extend methods of
640 localrepository should use this subclassing trick: namely,
653 localrepository should use this subclassing trick: namely,
641 reposetup() should look like
654 reposetup() should look like
642
655
643 def reposetup(ui, repo):
656 def reposetup(ui, repo):
644 class myrepo(repo.__class__):
657 class myrepo(repo.__class__):
645 def whatever(self, *args, **kwargs):
658 def whatever(self, *args, **kwargs):
646 [...extension stuff...]
659 [...extension stuff...]
647 super(myrepo, self).whatever(*args, **kwargs)
660 super(myrepo, self).whatever(*args, **kwargs)
648 [...extension stuff...]
661 [...extension stuff...]
649
662
650 repo.__class__ = myrepo
663 repo.__class__ = myrepo
651
664
652 In general, combining wrapfunction() with subclassing does not
665 In general, combining wrapfunction() with subclassing does not
653 work. Since you cannot control what other extensions are loaded by
666 work. Since you cannot control what other extensions are loaded by
654 your end users, you should play nicely with others by using the
667 your end users, you should play nicely with others by using the
655 subclass trick.
668 subclass trick.
656 """
669 """
657 assert callable(wrapper)
670 assert callable(wrapper)
658
671
659 origfn = getattr(container, funcname)
672 origfn = getattr(container, funcname)
660 assert callable(origfn)
673 assert callable(origfn)
661 if inspect.ismodule(container):
674 if inspect.ismodule(container):
662 # origfn is not an instance or class method. "partial" can be used.
675 # origfn is not an instance or class method. "partial" can be used.
663 # "partial" won't insert a frame in traceback.
676 # "partial" won't insert a frame in traceback.
664 wrap = functools.partial(wrapper, origfn)
677 wrap = functools.partial(wrapper, origfn)
665 else:
678 else:
666 # "partial" cannot be safely used. Emulate its effect by using "bind".
679 # "partial" cannot be safely used. Emulate its effect by using "bind".
667 # The downside is one more frame in traceback.
680 # The downside is one more frame in traceback.
668 wrap = bind(wrapper, origfn)
681 wrap = bind(wrapper, origfn)
669 _updatewrapper(wrap, origfn, wrapper)
682 _updatewrapper(wrap, origfn, wrapper)
670 setattr(container, funcname, wrap)
683 setattr(container, funcname, wrap)
671 return origfn
684 return origfn
672
685
673
686
674 def unwrapfunction(container, funcname, wrapper=None):
687 def unwrapfunction(container, funcname, wrapper=None):
675 """undo wrapfunction
688 """undo wrapfunction
676
689
677 If wrappers is None, undo the last wrap. Otherwise removes the wrapper
690 If wrappers is None, undo the last wrap. Otherwise removes the wrapper
678 from the chain of wrappers.
691 from the chain of wrappers.
679
692
680 Return the removed wrapper.
693 Return the removed wrapper.
681 Raise IndexError if wrapper is None and nothing to unwrap; ValueError if
694 Raise IndexError if wrapper is None and nothing to unwrap; ValueError if
682 wrapper is not None but is not found in the wrapper chain.
695 wrapper is not None but is not found in the wrapper chain.
683 """
696 """
684 chain = getwrapperchain(container, funcname)
697 chain = getwrapperchain(container, funcname)
685 origfn = chain.pop()
698 origfn = chain.pop()
686 if wrapper is None:
699 if wrapper is None:
687 wrapper = chain[0]
700 wrapper = chain[0]
688 chain.remove(wrapper)
701 chain.remove(wrapper)
689 setattr(container, funcname, origfn)
702 setattr(container, funcname, origfn)
690 for w in reversed(chain):
703 for w in reversed(chain):
691 wrapfunction(container, funcname, w)
704 wrapfunction(container, funcname, w)
692 return wrapper
705 return wrapper
693
706
694
707
695 def getwrapperchain(container, funcname):
708 def getwrapperchain(container, funcname):
696 """get a chain of wrappers of a function
709 """get a chain of wrappers of a function
697
710
698 Return a list of functions: [newest wrapper, ..., oldest wrapper, origfunc]
711 Return a list of functions: [newest wrapper, ..., oldest wrapper, origfunc]
699
712
700 The wrapper functions are the ones passed to wrapfunction, whose first
713 The wrapper functions are the ones passed to wrapfunction, whose first
701 argument is origfunc.
714 argument is origfunc.
702 """
715 """
703 result = []
716 result = []
704 fn = getattr(container, funcname)
717 fn = getattr(container, funcname)
705 while fn:
718 while fn:
706 assert callable(fn)
719 assert callable(fn)
707 result.append(getattr(fn, '_unboundwrapper', fn))
720 result.append(getattr(fn, '_unboundwrapper', fn))
708 fn = getattr(fn, '_origfunc', None)
721 fn = getattr(fn, '_origfunc', None)
709 return result
722 return result
710
723
711
724
712 def _disabledpaths():
725 def _disabledpaths():
713 '''find paths of disabled extensions. returns a dict of {name: path}'''
726 '''find paths of disabled extensions. returns a dict of {name: path}'''
714 import hgext
727 import hgext
715
728
716 # The hgext might not have a __file__ attribute (e.g. in PyOxidizer) and
729 # The hgext might not have a __file__ attribute (e.g. in PyOxidizer) and
717 # it might not be on a filesystem even if it does.
730 # it might not be on a filesystem even if it does.
718 if util.safehasattr(hgext, '__file__'):
731 if util.safehasattr(hgext, '__file__'):
719 extpath = os.path.dirname(
732 extpath = os.path.dirname(
720 util.abspath(pycompat.fsencode(hgext.__file__))
733 util.abspath(pycompat.fsencode(hgext.__file__))
721 )
734 )
722 try:
735 try:
723 files = os.listdir(extpath)
736 files = os.listdir(extpath)
724 except OSError:
737 except OSError:
725 return {}
738 return {}
726 else:
739 else:
727 return {}
740 return {}
728
741
729 exts = {}
742 exts = {}
730 for e in files:
743 for e in files:
731 if e.endswith(b'.py'):
744 if e.endswith(b'.py'):
732 name = e.rsplit(b'.', 1)[0]
745 name = e.rsplit(b'.', 1)[0]
733 path = os.path.join(extpath, e)
746 path = os.path.join(extpath, e)
734 else:
747 else:
735 name = e
748 name = e
736 path = os.path.join(extpath, e, b'__init__.py')
749 path = os.path.join(extpath, e, b'__init__.py')
737 if not os.path.exists(path):
750 if not os.path.exists(path):
738 continue
751 continue
739 if name in exts or name in _order or name == b'__init__':
752 if name in exts or name in _order or name == b'__init__':
740 continue
753 continue
741 exts[name] = path
754 exts[name] = path
742 for name, path in pycompat.iteritems(_disabledextensions):
755 for name, path in pycompat.iteritems(_disabledextensions):
743 # If no path was provided for a disabled extension (e.g. "color=!"),
756 # If no path was provided for a disabled extension (e.g. "color=!"),
744 # don't replace the path we already found by the scan above.
757 # don't replace the path we already found by the scan above.
745 if path:
758 if path:
746 exts[name] = path
759 exts[name] = path
747 return exts
760 return exts
748
761
749
762
750 def _moduledoc(file):
763 def _moduledoc(file):
751 """return the top-level python documentation for the given file
764 """return the top-level python documentation for the given file
752
765
753 Loosely inspired by pydoc.source_synopsis(), but rewritten to
766 Loosely inspired by pydoc.source_synopsis(), but rewritten to
754 handle triple quotes and to return the whole text instead of just
767 handle triple quotes and to return the whole text instead of just
755 the synopsis"""
768 the synopsis"""
756 result = []
769 result = []
757
770
758 line = file.readline()
771 line = file.readline()
759 while line[:1] == b'#' or not line.strip():
772 while line[:1] == b'#' or not line.strip():
760 line = file.readline()
773 line = file.readline()
761 if not line:
774 if not line:
762 break
775 break
763
776
764 start = line[:3]
777 start = line[:3]
765 if start == b'"""' or start == b"'''":
778 if start == b'"""' or start == b"'''":
766 line = line[3:]
779 line = line[3:]
767 while line:
780 while line:
768 if line.rstrip().endswith(start):
781 if line.rstrip().endswith(start):
769 line = line.split(start)[0]
782 line = line.split(start)[0]
770 if line:
783 if line:
771 result.append(line)
784 result.append(line)
772 break
785 break
773 elif not line:
786 elif not line:
774 return None # unmatched delimiter
787 return None # unmatched delimiter
775 result.append(line)
788 result.append(line)
776 line = file.readline()
789 line = file.readline()
777 else:
790 else:
778 return None
791 return None
779
792
780 return b''.join(result)
793 return b''.join(result)
781
794
782
795
783 def _disabledhelp(path):
796 def _disabledhelp(path):
784 '''retrieve help synopsis of a disabled extension (without importing)'''
797 '''retrieve help synopsis of a disabled extension (without importing)'''
785 try:
798 try:
786 with open(path, b'rb') as src:
799 with open(path, b'rb') as src:
787 doc = _moduledoc(src)
800 doc = _moduledoc(src)
788 except IOError:
801 except IOError:
789 return
802 return
790
803
791 if doc: # extracting localized synopsis
804 if doc: # extracting localized synopsis
792 return gettext(doc)
805 return gettext(doc)
793 else:
806 else:
794 return _(b'(no help text available)')
807 return _(b'(no help text available)')
795
808
796
809
797 def disabled():
810 def disabled():
798 '''find disabled extensions from hgext. returns a dict of {name: desc}'''
811 '''find disabled extensions from hgext. returns a dict of {name: desc}'''
799 try:
812 try:
800 from hgext import __index__ # pytype: disable=import-error
813 from hgext import __index__ # pytype: disable=import-error
801
814
802 return {
815 return {
803 name: gettext(desc)
816 name: gettext(desc)
804 for name, desc in pycompat.iteritems(__index__.docs)
817 for name, desc in pycompat.iteritems(__index__.docs)
805 if name not in _order
818 if name not in _order
806 }
819 }
807 except (ImportError, AttributeError):
820 except (ImportError, AttributeError):
808 pass
821 pass
809
822
810 paths = _disabledpaths()
823 paths = _disabledpaths()
811 if not paths:
824 if not paths:
812 return {}
825 return {}
813
826
814 exts = {}
827 exts = {}
815 for name, path in pycompat.iteritems(paths):
828 for name, path in pycompat.iteritems(paths):
816 doc = _disabledhelp(path)
829 doc = _disabledhelp(path)
817 if doc and name != b'__index__':
830 if doc and name != b'__index__':
818 exts[name] = doc.splitlines()[0]
831 exts[name] = doc.splitlines()[0]
819
832
820 return exts
833 return exts
821
834
822
835
823 def disabled_help(name):
836 def disabled_help(name):
824 """Obtain the full help text for a disabled extension, or None."""
837 """Obtain the full help text for a disabled extension, or None."""
825 paths = _disabledpaths()
838 paths = _disabledpaths()
826 if name in paths:
839 if name in paths:
827 return _disabledhelp(paths[name])
840 return _disabledhelp(paths[name])
828
841
829
842
830 def _walkcommand(node):
843 def _walkcommand(node):
831 """Scan @command() decorators in the tree starting at node"""
844 """Scan @command() decorators in the tree starting at node"""
832 todo = collections.deque([node])
845 todo = collections.deque([node])
833 while todo:
846 while todo:
834 node = todo.popleft()
847 node = todo.popleft()
835 if not isinstance(node, ast.FunctionDef):
848 if not isinstance(node, ast.FunctionDef):
836 todo.extend(ast.iter_child_nodes(node))
849 todo.extend(ast.iter_child_nodes(node))
837 continue
850 continue
838 for d in node.decorator_list:
851 for d in node.decorator_list:
839 if not isinstance(d, ast.Call):
852 if not isinstance(d, ast.Call):
840 continue
853 continue
841 if not isinstance(d.func, ast.Name):
854 if not isinstance(d.func, ast.Name):
842 continue
855 continue
843 if d.func.id != 'command':
856 if d.func.id != 'command':
844 continue
857 continue
845 yield d
858 yield d
846
859
847
860
848 def _disabledcmdtable(path):
861 def _disabledcmdtable(path):
849 """Construct a dummy command table without loading the extension module
862 """Construct a dummy command table without loading the extension module
850
863
851 This may raise IOError or SyntaxError.
864 This may raise IOError or SyntaxError.
852 """
865 """
853 with open(path, b'rb') as src:
866 with open(path, b'rb') as src:
854 root = ast.parse(src.read(), path)
867 root = ast.parse(src.read(), path)
855 cmdtable = {}
868 cmdtable = {}
856 for node in _walkcommand(root):
869 for node in _walkcommand(root):
857 if not node.args:
870 if not node.args:
858 continue
871 continue
859 a = node.args[0]
872 a = node.args[0]
860 if isinstance(a, ast.Str):
873 if isinstance(a, ast.Str):
861 name = pycompat.sysbytes(a.s)
874 name = pycompat.sysbytes(a.s)
862 elif pycompat.ispy3 and isinstance(a, ast.Bytes):
875 elif pycompat.ispy3 and isinstance(a, ast.Bytes):
863 name = a.s
876 name = a.s
864 else:
877 else:
865 continue
878 continue
866 cmdtable[name] = (None, [], b'')
879 cmdtable[name] = (None, [], b'')
867 return cmdtable
880 return cmdtable
868
881
869
882
870 def _finddisabledcmd(ui, cmd, name, path, strict):
883 def _finddisabledcmd(ui, cmd, name, path, strict):
871 try:
884 try:
872 cmdtable = _disabledcmdtable(path)
885 cmdtable = _disabledcmdtable(path)
873 except (IOError, SyntaxError):
886 except (IOError, SyntaxError):
874 return
887 return
875 try:
888 try:
876 aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict)
889 aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict)
877 except (error.AmbiguousCommand, error.UnknownCommand):
890 except (error.AmbiguousCommand, error.UnknownCommand):
878 return
891 return
879 for c in aliases:
892 for c in aliases:
880 if c.startswith(cmd):
893 if c.startswith(cmd):
881 cmd = c
894 cmd = c
882 break
895 break
883 else:
896 else:
884 cmd = aliases[0]
897 cmd = aliases[0]
885 doc = _disabledhelp(path)
898 doc = _disabledhelp(path)
886 return (cmd, name, doc)
899 return (cmd, name, doc)
887
900
888
901
889 def disabledcmd(ui, cmd, strict=False):
902 def disabledcmd(ui, cmd, strict=False):
890 """find cmd from disabled extensions without importing.
903 """find cmd from disabled extensions without importing.
891 returns (cmdname, extname, doc)"""
904 returns (cmdname, extname, doc)"""
892
905
893 paths = _disabledpaths()
906 paths = _disabledpaths()
894 if not paths:
907 if not paths:
895 raise error.UnknownCommand(cmd)
908 raise error.UnknownCommand(cmd)
896
909
897 ext = None
910 ext = None
898 # first, search for an extension with the same name as the command
911 # first, search for an extension with the same name as the command
899 path = paths.pop(cmd, None)
912 path = paths.pop(cmd, None)
900 if path:
913 if path:
901 ext = _finddisabledcmd(ui, cmd, cmd, path, strict=strict)
914 ext = _finddisabledcmd(ui, cmd, cmd, path, strict=strict)
902 if not ext:
915 if not ext:
903 # otherwise, interrogate each extension until there's a match
916 # otherwise, interrogate each extension until there's a match
904 for name, path in pycompat.iteritems(paths):
917 for name, path in pycompat.iteritems(paths):
905 ext = _finddisabledcmd(ui, cmd, name, path, strict=strict)
918 ext = _finddisabledcmd(ui, cmd, name, path, strict=strict)
906 if ext:
919 if ext:
907 break
920 break
908 if ext:
921 if ext:
909 return ext
922 return ext
910
923
911 raise error.UnknownCommand(cmd)
924 raise error.UnknownCommand(cmd)
912
925
913
926
914 def enabled(shortname=True):
927 def enabled(shortname=True):
915 '''return a dict of {name: desc} of extensions'''
928 '''return a dict of {name: desc} of extensions'''
916 exts = {}
929 exts = {}
917 for ename, ext in extensions():
930 for ename, ext in extensions():
918 doc = gettext(ext.__doc__) or _(b'(no help text available)')
931 doc = gettext(ext.__doc__) or _(b'(no help text available)')
919 assert doc is not None # help pytype
932 assert doc is not None # help pytype
920 if shortname:
933 if shortname:
921 ename = ename.split(b'.')[-1]
934 ename = ename.split(b'.')[-1]
922 exts[ename] = doc.splitlines()[0].strip()
935 exts[ename] = doc.splitlines()[0].strip()
923
936
924 return exts
937 return exts
925
938
926
939
927 def notloaded():
940 def notloaded():
928 '''return short names of extensions that failed to load'''
941 '''return short names of extensions that failed to load'''
929 return [
942 return [
930 name for name, mod in pycompat.iteritems(_extensions) if mod is None
943 name for name, mod in pycompat.iteritems(_extensions) if mod is None
931 ]
944 ]
932
945
933
946
934 def moduleversion(module):
947 def moduleversion(module):
935 '''return version information from given module as a string'''
948 '''return version information from given module as a string'''
936 if util.safehasattr(module, b'getversion') and callable(module.getversion):
949 if util.safehasattr(module, b'getversion') and callable(module.getversion):
937 try:
950 try:
938 version = module.getversion()
951 version = module.getversion()
939 except Exception:
952 except Exception:
940 version = b'unknown'
953 version = b'unknown'
941
954
942 elif util.safehasattr(module, b'__version__'):
955 elif util.safehasattr(module, b'__version__'):
943 version = module.__version__
956 version = module.__version__
944 else:
957 else:
945 version = b''
958 version = b''
946 if isinstance(version, (list, tuple)):
959 if isinstance(version, (list, tuple)):
947 version = b'.'.join(pycompat.bytestr(o) for o in version)
960 version = b'.'.join(pycompat.bytestr(o) for o in version)
948 else:
961 else:
949 # version data should be bytes, but not all extensions are ported
962 # version data should be bytes, but not all extensions are ported
950 # to py3.
963 # to py3.
951 version = stringutil.forcebytestr(version)
964 version = stringutil.forcebytestr(version)
952 return version
965 return version
953
966
954
967
955 def ismoduleinternal(module):
968 def ismoduleinternal(module):
956 exttestedwith = getattr(module, 'testedwith', None)
969 exttestedwith = getattr(module, 'testedwith', None)
957 return exttestedwith == b"ships-with-hg-core"
970 return exttestedwith == b"ships-with-hg-core"
@@ -1,3120 +1,3131 b''
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 --source` can help you understand what is introducing
8 :hg:`config --source` 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-not-shared`` (per-repository)
57 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
58 - ``<repo>/.hg/hgrc`` (per-repository)
58 - ``<repo>/.hg/hgrc`` (per-repository)
59 - ``$HOME/.hgrc`` (per-user)
59 - ``$HOME/.hgrc`` (per-user)
60 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
60 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
61 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
62 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
62 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
63 - ``/etc/mercurial/hgrc`` (per-system)
63 - ``/etc/mercurial/hgrc`` (per-system)
64 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
64 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
65 - ``<internal>/*.rc`` (defaults)
65 - ``<internal>/*.rc`` (defaults)
66
66
67 .. container:: verbose.windows
67 .. container:: verbose.windows
68
68
69 On Windows, the following files are consulted:
69 On Windows, the following files are consulted:
70
70
71 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
71 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
72 - ``<repo>/.hg/hgrc`` (per-repository)
72 - ``<repo>/.hg/hgrc`` (per-repository)
73 - ``%USERPROFILE%\.hgrc`` (per-user)
73 - ``%USERPROFILE%\.hgrc`` (per-user)
74 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
74 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
75 - ``%HOME%\.hgrc`` (per-user)
75 - ``%HOME%\.hgrc`` (per-user)
76 - ``%HOME%\Mercurial.ini`` (per-user)
76 - ``%HOME%\Mercurial.ini`` (per-user)
77 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-system)
77 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-system)
78 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
78 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
79 - ``<install-dir>\Mercurial.ini`` (per-installation)
79 - ``<install-dir>\Mercurial.ini`` (per-installation)
80 - ``%PROGRAMDATA%\Mercurial\hgrc`` (per-system)
80 - ``%PROGRAMDATA%\Mercurial\hgrc`` (per-system)
81 - ``%PROGRAMDATA%\Mercurial\Mercurial.ini`` (per-system)
81 - ``%PROGRAMDATA%\Mercurial\Mercurial.ini`` (per-system)
82 - ``%PROGRAMDATA%\Mercurial\hgrc.d\*.rc`` (per-system)
82 - ``%PROGRAMDATA%\Mercurial\hgrc.d\*.rc`` (per-system)
83 - ``<internal>/*.rc`` (defaults)
83 - ``<internal>/*.rc`` (defaults)
84
84
85 .. note::
85 .. note::
86
86
87 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
87 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
88 is used when running 32-bit Python on 64-bit Windows.
88 is used when running 32-bit Python on 64-bit Windows.
89
89
90 .. container:: verbose.plan9
90 .. container:: verbose.plan9
91
91
92 On Plan9, the following files are consulted:
92 On Plan9, the following files are consulted:
93
93
94 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
94 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
95 - ``<repo>/.hg/hgrc`` (per-repository)
95 - ``<repo>/.hg/hgrc`` (per-repository)
96 - ``$home/lib/hgrc`` (per-user)
96 - ``$home/lib/hgrc`` (per-user)
97 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
97 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
98 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
98 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
99 - ``/lib/mercurial/hgrc`` (per-system)
99 - ``/lib/mercurial/hgrc`` (per-system)
100 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
100 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
101 - ``<internal>/*.rc`` (defaults)
101 - ``<internal>/*.rc`` (defaults)
102
102
103 Per-repository configuration options only apply in a
103 Per-repository configuration options only apply in a
104 particular repository. This file is not version-controlled, and
104 particular repository. This file is not version-controlled, and
105 will not get transferred during a "clone" operation. Options in
105 will not get transferred during a "clone" operation. Options in
106 this file override options in all other configuration files.
106 this file override options in all other configuration files.
107
107
108 .. container:: unix.plan9
108 .. container:: unix.plan9
109
109
110 On Plan 9 and Unix, most of this file will be ignored if it doesn't
110 On Plan 9 and Unix, most of this file will be ignored if it doesn't
111 belong to a trusted user or to a trusted group. See
111 belong to a trusted user or to a trusted group. See
112 :hg:`help config.trusted` for more details.
112 :hg:`help config.trusted` for more details.
113
113
114 Per-user configuration file(s) are for the user running Mercurial. Options
114 Per-user configuration file(s) are for the user running Mercurial. Options
115 in these files apply to all Mercurial commands executed by this user in any
115 in these files apply to all Mercurial commands executed by this user in any
116 directory. Options in these files override per-system and per-installation
116 directory. Options in these files override per-system and per-installation
117 options.
117 options.
118
118
119 Per-installation configuration files are searched for in the
119 Per-installation configuration files are searched for in the
120 directory where Mercurial is installed. ``<install-root>`` is the
120 directory where Mercurial is installed. ``<install-root>`` is the
121 parent directory of the **hg** executable (or symlink) being run.
121 parent directory of the **hg** executable (or symlink) being run.
122
122
123 .. container:: unix.plan9
123 .. container:: unix.plan9
124
124
125 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
125 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
126 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
126 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
127 files apply to all Mercurial commands executed by any user in any
127 files apply to all Mercurial commands executed by any user in any
128 directory.
128 directory.
129
129
130 Per-installation configuration files are for the system on
130 Per-installation configuration files are for the system on
131 which Mercurial is running. Options in these files apply to all
131 which Mercurial is running. Options in these files apply to all
132 Mercurial commands executed by any user in any directory. Registry
132 Mercurial commands executed by any user in any directory. Registry
133 keys contain PATH-like strings, every part of which must reference
133 keys contain PATH-like strings, every part of which must reference
134 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
134 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
135 be read. Mercurial checks each of these locations in the specified
135 be read. Mercurial checks each of these locations in the specified
136 order until one or more configuration files are detected.
136 order until one or more configuration files are detected.
137
137
138 Per-system configuration files are for the system on which Mercurial
138 Per-system configuration files are for the system on which Mercurial
139 is running. Options in these files apply to all Mercurial commands
139 is running. Options in these files apply to all Mercurial commands
140 executed by any user in any directory. Options in these files
140 executed by any user in any directory. Options in these files
141 override per-installation options.
141 override per-installation options.
142
142
143 Mercurial comes with some default configuration. The default configuration
143 Mercurial comes with some default configuration. The default configuration
144 files are installed with Mercurial and will be overwritten on upgrades. Default
144 files are installed with Mercurial and will be overwritten on upgrades. Default
145 configuration files should never be edited by users or administrators but can
145 configuration files should never be edited by users or administrators but can
146 be overridden in other configuration files. So far the directory only contains
146 be overridden in other configuration files. So far the directory only contains
147 merge tool configuration but packagers can also put other default configuration
147 merge tool configuration but packagers can also put other default configuration
148 there.
148 there.
149
149
150 On versions 5.7 and later, if share-safe functionality is enabled,
150 On versions 5.7 and later, if share-safe functionality is enabled,
151 shares will read config file of share source too.
151 shares will read config file of share source too.
152 `<share-source/.hg/hgrc>` is read before reading `<repo/.hg/hgrc>`.
152 `<share-source/.hg/hgrc>` is read before reading `<repo/.hg/hgrc>`.
153
153
154 For configs which should not be shared, `<repo/.hg/hgrc-not-shared>`
154 For configs which should not be shared, `<repo/.hg/hgrc-not-shared>`
155 should be used.
155 should be used.
156
156
157 Syntax
157 Syntax
158 ======
158 ======
159
159
160 A configuration file consists of sections, led by a ``[section]`` header
160 A configuration file consists of sections, led by a ``[section]`` header
161 and followed by ``name = value`` entries (sometimes called
161 and followed by ``name = value`` entries (sometimes called
162 ``configuration keys``)::
162 ``configuration keys``)::
163
163
164 [spam]
164 [spam]
165 eggs=ham
165 eggs=ham
166 green=
166 green=
167 eggs
167 eggs
168
168
169 Each line contains one entry. If the lines that follow are indented,
169 Each line contains one entry. If the lines that follow are indented,
170 they are treated as continuations of that entry. Leading whitespace is
170 they are treated as continuations of that entry. Leading whitespace is
171 removed from values. Empty lines are skipped. Lines beginning with
171 removed from values. Empty lines are skipped. Lines beginning with
172 ``#`` or ``;`` are ignored and may be used to provide comments.
172 ``#`` or ``;`` are ignored and may be used to provide comments.
173
173
174 Configuration keys can be set multiple times, in which case Mercurial
174 Configuration keys can be set multiple times, in which case Mercurial
175 will use the value that was configured last. As an example::
175 will use the value that was configured last. As an example::
176
176
177 [spam]
177 [spam]
178 eggs=large
178 eggs=large
179 ham=serrano
179 ham=serrano
180 eggs=small
180 eggs=small
181
181
182 This would set the configuration key named ``eggs`` to ``small``.
182 This would set the configuration key named ``eggs`` to ``small``.
183
183
184 It is also possible to define a section multiple times. A section can
184 It is also possible to define a section multiple times. A section can
185 be redefined on the same and/or on different configuration files. For
185 be redefined on the same and/or on different configuration files. For
186 example::
186 example::
187
187
188 [foo]
188 [foo]
189 eggs=large
189 eggs=large
190 ham=serrano
190 ham=serrano
191 eggs=small
191 eggs=small
192
192
193 [bar]
193 [bar]
194 eggs=ham
194 eggs=ham
195 green=
195 green=
196 eggs
196 eggs
197
197
198 [foo]
198 [foo]
199 ham=prosciutto
199 ham=prosciutto
200 eggs=medium
200 eggs=medium
201 bread=toasted
201 bread=toasted
202
202
203 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
203 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
204 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
204 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
205 respectively. As you can see there only thing that matters is the last
205 respectively. As you can see there only thing that matters is the last
206 value that was set for each of the configuration keys.
206 value that was set for each of the configuration keys.
207
207
208 If a configuration key is set multiple times in different
208 If a configuration key is set multiple times in different
209 configuration files the final value will depend on the order in which
209 configuration files the final value will depend on the order in which
210 the different configuration files are read, with settings from earlier
210 the different configuration files are read, with settings from earlier
211 paths overriding later ones as described on the ``Files`` section
211 paths overriding later ones as described on the ``Files`` section
212 above.
212 above.
213
213
214 A line of the form ``%include file`` will include ``file`` into the
214 A line of the form ``%include file`` will include ``file`` into the
215 current configuration file. The inclusion is recursive, which means
215 current configuration file. The inclusion is recursive, which means
216 that included files can include other files. Filenames are relative to
216 that included files can include other files. Filenames are relative to
217 the configuration file in which the ``%include`` directive is found.
217 the configuration file in which the ``%include`` directive is found.
218 Environment variables and ``~user`` constructs are expanded in
218 Environment variables and ``~user`` constructs are expanded in
219 ``file``. This lets you do something like::
219 ``file``. This lets you do something like::
220
220
221 %include ~/.hgrc.d/$HOST.rc
221 %include ~/.hgrc.d/$HOST.rc
222
222
223 to include a different configuration file on each computer you use.
223 to include a different configuration file on each computer you use.
224
224
225 A line with ``%unset name`` will remove ``name`` from the current
225 A line with ``%unset name`` will remove ``name`` from the current
226 section, if it has been set previously.
226 section, if it has been set previously.
227
227
228 The values are either free-form text strings, lists of text strings,
228 The values are either free-form text strings, lists of text strings,
229 or Boolean values. Boolean values can be set to true using any of "1",
229 or Boolean values. Boolean values can be set to true using any of "1",
230 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
230 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
231 (all case insensitive).
231 (all case insensitive).
232
232
233 List values are separated by whitespace or comma, except when values are
233 List values are separated by whitespace or comma, except when values are
234 placed in double quotation marks::
234 placed in double quotation marks::
235
235
236 allow_read = "John Doe, PhD", brian, betty
236 allow_read = "John Doe, PhD", brian, betty
237
237
238 Quotation marks can be escaped by prefixing them with a backslash. Only
238 Quotation marks can be escaped by prefixing them with a backslash. Only
239 quotation marks at the beginning of a word is counted as a quotation
239 quotation marks at the beginning of a word is counted as a quotation
240 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
240 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
241
241
242 Sections
242 Sections
243 ========
243 ========
244
244
245 This section describes the different sections that may appear in a
245 This section describes the different sections that may appear in a
246 Mercurial configuration file, the purpose of each section, its possible
246 Mercurial configuration file, the purpose of each section, its possible
247 keys, and their possible values.
247 keys, and their possible values.
248
248
249 ``alias``
249 ``alias``
250 ---------
250 ---------
251
251
252 Defines command aliases.
252 Defines command aliases.
253
253
254 Aliases allow you to define your own commands in terms of other
254 Aliases allow you to define your own commands in terms of other
255 commands (or aliases), optionally including arguments. Positional
255 commands (or aliases), optionally including arguments. Positional
256 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
256 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
257 are expanded by Mercurial before execution. Positional arguments not
257 are expanded by Mercurial before execution. Positional arguments not
258 already used by ``$N`` in the definition are put at the end of the
258 already used by ``$N`` in the definition are put at the end of the
259 command to be executed.
259 command to be executed.
260
260
261 Alias definitions consist of lines of the form::
261 Alias definitions consist of lines of the form::
262
262
263 <alias> = <command> [<argument>]...
263 <alias> = <command> [<argument>]...
264
264
265 For example, this definition::
265 For example, this definition::
266
266
267 latest = log --limit 5
267 latest = log --limit 5
268
268
269 creates a new command ``latest`` that shows only the five most recent
269 creates a new command ``latest`` that shows only the five most recent
270 changesets. You can define subsequent aliases using earlier ones::
270 changesets. You can define subsequent aliases using earlier ones::
271
271
272 stable5 = latest -b stable
272 stable5 = latest -b stable
273
273
274 .. note::
274 .. note::
275
275
276 It is possible to create aliases with the same names as
276 It is possible to create aliases with the same names as
277 existing commands, which will then override the original
277 existing commands, which will then override the original
278 definitions. This is almost always a bad idea!
278 definitions. This is almost always a bad idea!
279
279
280 An alias can start with an exclamation point (``!``) to make it a
280 An alias can start with an exclamation point (``!``) to make it a
281 shell alias. A shell alias is executed with the shell and will let you
281 shell alias. A shell alias is executed with the shell and will let you
282 run arbitrary commands. As an example, ::
282 run arbitrary commands. As an example, ::
283
283
284 echo = !echo $@
284 echo = !echo $@
285
285
286 will let you do ``hg echo foo`` to have ``foo`` printed in your
286 will let you do ``hg echo foo`` to have ``foo`` printed in your
287 terminal. A better example might be::
287 terminal. A better example might be::
288
288
289 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
289 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
290
290
291 which will make ``hg purge`` delete all unknown files in the
291 which will make ``hg purge`` delete all unknown files in the
292 repository in the same manner as the purge extension.
292 repository in the same manner as the purge extension.
293
293
294 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
294 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
295 expand to the command arguments. Unmatched arguments are
295 expand to the command arguments. Unmatched arguments are
296 removed. ``$0`` expands to the alias name and ``$@`` expands to all
296 removed. ``$0`` expands to the alias name and ``$@`` expands to all
297 arguments separated by a space. ``"$@"`` (with quotes) expands to all
297 arguments separated by a space. ``"$@"`` (with quotes) expands to all
298 arguments quoted individually and separated by a space. These expansions
298 arguments quoted individually and separated by a space. These expansions
299 happen before the command is passed to the shell.
299 happen before the command is passed to the shell.
300
300
301 Shell aliases are executed in an environment where ``$HG`` expands to
301 Shell aliases are executed in an environment where ``$HG`` expands to
302 the path of the Mercurial that was used to execute the alias. This is
302 the path of the Mercurial that was used to execute the alias. This is
303 useful when you want to call further Mercurial commands in a shell
303 useful when you want to call further Mercurial commands in a shell
304 alias, as was done above for the purge alias. In addition,
304 alias, as was done above for the purge alias. In addition,
305 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
305 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
306 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
306 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
307
307
308 .. note::
308 .. note::
309
309
310 Some global configuration options such as ``-R`` are
310 Some global configuration options such as ``-R`` are
311 processed before shell aliases and will thus not be passed to
311 processed before shell aliases and will thus not be passed to
312 aliases.
312 aliases.
313
313
314
314
315 ``annotate``
315 ``annotate``
316 ------------
316 ------------
317
317
318 Settings used when displaying file annotations. All values are
318 Settings used when displaying file annotations. All values are
319 Booleans and default to False. See :hg:`help config.diff` for
319 Booleans and default to False. See :hg:`help config.diff` for
320 related options for the diff command.
320 related options for the diff command.
321
321
322 ``ignorews``
322 ``ignorews``
323 Ignore white space when comparing lines.
323 Ignore white space when comparing lines.
324
324
325 ``ignorewseol``
325 ``ignorewseol``
326 Ignore white space at the end of a line when comparing lines.
326 Ignore white space at the end of a line when comparing lines.
327
327
328 ``ignorewsamount``
328 ``ignorewsamount``
329 Ignore changes in the amount of white space.
329 Ignore changes in the amount of white space.
330
330
331 ``ignoreblanklines``
331 ``ignoreblanklines``
332 Ignore changes whose lines are all blank.
332 Ignore changes whose lines are all blank.
333
333
334
334
335 ``auth``
335 ``auth``
336 --------
336 --------
337
337
338 Authentication credentials and other authentication-like configuration
338 Authentication credentials and other authentication-like configuration
339 for HTTP connections. This section allows you to store usernames and
339 for HTTP connections. This section allows you to store usernames and
340 passwords for use when logging *into* HTTP servers. See
340 passwords for use when logging *into* HTTP servers. See
341 :hg:`help config.web` if you want to configure *who* can login to
341 :hg:`help config.web` if you want to configure *who* can login to
342 your HTTP server.
342 your HTTP server.
343
343
344 The following options apply to all hosts.
344 The following options apply to all hosts.
345
345
346 ``cookiefile``
346 ``cookiefile``
347 Path to a file containing HTTP cookie lines. Cookies matching a
347 Path to a file containing HTTP cookie lines. Cookies matching a
348 host will be sent automatically.
348 host will be sent automatically.
349
349
350 The file format uses the Mozilla cookies.txt format, which defines cookies
350 The file format uses the Mozilla cookies.txt format, which defines cookies
351 on their own lines. Each line contains 7 fields delimited by the tab
351 on their own lines. Each line contains 7 fields delimited by the tab
352 character (domain, is_domain_cookie, path, is_secure, expires, name,
352 character (domain, is_domain_cookie, path, is_secure, expires, name,
353 value). For more info, do an Internet search for "Netscape cookies.txt
353 value). For more info, do an Internet search for "Netscape cookies.txt
354 format."
354 format."
355
355
356 Note: the cookies parser does not handle port numbers on domains. You
356 Note: the cookies parser does not handle port numbers on domains. You
357 will need to remove ports from the domain for the cookie to be recognized.
357 will need to remove ports from the domain for the cookie to be recognized.
358 This could result in a cookie being disclosed to an unwanted server.
358 This could result in a cookie being disclosed to an unwanted server.
359
359
360 The cookies file is read-only.
360 The cookies file is read-only.
361
361
362 Other options in this section are grouped by name and have the following
362 Other options in this section are grouped by name and have the following
363 format::
363 format::
364
364
365 <name>.<argument> = <value>
365 <name>.<argument> = <value>
366
366
367 where ``<name>`` is used to group arguments into authentication
367 where ``<name>`` is used to group arguments into authentication
368 entries. Example::
368 entries. Example::
369
369
370 foo.prefix = hg.intevation.de/mercurial
370 foo.prefix = hg.intevation.de/mercurial
371 foo.username = foo
371 foo.username = foo
372 foo.password = bar
372 foo.password = bar
373 foo.schemes = http https
373 foo.schemes = http https
374
374
375 bar.prefix = secure.example.org
375 bar.prefix = secure.example.org
376 bar.key = path/to/file.key
376 bar.key = path/to/file.key
377 bar.cert = path/to/file.cert
377 bar.cert = path/to/file.cert
378 bar.schemes = https
378 bar.schemes = https
379
379
380 Supported arguments:
380 Supported arguments:
381
381
382 ``prefix``
382 ``prefix``
383 Either ``*`` or a URI prefix with or without the scheme part.
383 Either ``*`` or a URI prefix with or without the scheme part.
384 The authentication entry with the longest matching prefix is used
384 The authentication entry with the longest matching prefix is used
385 (where ``*`` matches everything and counts as a match of length
385 (where ``*`` matches everything and counts as a match of length
386 1). If the prefix doesn't include a scheme, the match is performed
386 1). If the prefix doesn't include a scheme, the match is performed
387 against the URI with its scheme stripped as well, and the schemes
387 against the URI with its scheme stripped as well, and the schemes
388 argument, q.v., is then subsequently consulted.
388 argument, q.v., is then subsequently consulted.
389
389
390 ``username``
390 ``username``
391 Optional. Username to authenticate with. If not given, and the
391 Optional. Username to authenticate with. If not given, and the
392 remote site requires basic or digest authentication, the user will
392 remote site requires basic or digest authentication, the user will
393 be prompted for it. Environment variables are expanded in the
393 be prompted for it. Environment variables are expanded in the
394 username letting you do ``foo.username = $USER``. If the URI
394 username letting you do ``foo.username = $USER``. If the URI
395 includes a username, only ``[auth]`` entries with a matching
395 includes a username, only ``[auth]`` entries with a matching
396 username or without a username will be considered.
396 username or without a username will be considered.
397
397
398 ``password``
398 ``password``
399 Optional. Password to authenticate with. If not given, and the
399 Optional. Password to authenticate with. If not given, and the
400 remote site requires basic or digest authentication, the user
400 remote site requires basic or digest authentication, the user
401 will be prompted for it.
401 will be prompted for it.
402
402
403 ``key``
403 ``key``
404 Optional. PEM encoded client certificate key file. Environment
404 Optional. PEM encoded client certificate key file. Environment
405 variables are expanded in the filename.
405 variables are expanded in the filename.
406
406
407 ``cert``
407 ``cert``
408 Optional. PEM encoded client certificate chain file. Environment
408 Optional. PEM encoded client certificate chain file. Environment
409 variables are expanded in the filename.
409 variables are expanded in the filename.
410
410
411 ``schemes``
411 ``schemes``
412 Optional. Space separated list of URI schemes to use this
412 Optional. Space separated list of URI schemes to use this
413 authentication entry with. Only used if the prefix doesn't include
413 authentication entry with. Only used if the prefix doesn't include
414 a scheme. Supported schemes are http and https. They will match
414 a scheme. Supported schemes are http and https. They will match
415 static-http and static-https respectively, as well.
415 static-http and static-https respectively, as well.
416 (default: https)
416 (default: https)
417
417
418 If no suitable authentication entry is found, the user is prompted
418 If no suitable authentication entry is found, the user is prompted
419 for credentials as usual if required by the remote.
419 for credentials as usual if required by the remote.
420
420
421 ``cmdserver``
421 ``cmdserver``
422 -------------
422 -------------
423
423
424 Controls command server settings. (ADVANCED)
424 Controls command server settings. (ADVANCED)
425
425
426 ``message-encodings``
426 ``message-encodings``
427 List of encodings for the ``m`` (message) channel. The first encoding
427 List of encodings for the ``m`` (message) channel. The first encoding
428 supported by the server will be selected and advertised in the hello
428 supported by the server will be selected and advertised in the hello
429 message. This is useful only when ``ui.message-output`` is set to
429 message. This is useful only when ``ui.message-output`` is set to
430 ``channel``. Supported encodings are ``cbor``.
430 ``channel``. Supported encodings are ``cbor``.
431
431
432 ``shutdown-on-interrupt``
432 ``shutdown-on-interrupt``
433 If set to false, the server's main loop will continue running after
433 If set to false, the server's main loop will continue running after
434 SIGINT received. ``runcommand`` requests can still be interrupted by
434 SIGINT received. ``runcommand`` requests can still be interrupted by
435 SIGINT. Close the write end of the pipe to shut down the server
435 SIGINT. Close the write end of the pipe to shut down the server
436 process gracefully.
436 process gracefully.
437 (default: True)
437 (default: True)
438
438
439 ``color``
439 ``color``
440 ---------
440 ---------
441
441
442 Configure the Mercurial color mode. For details about how to define your custom
442 Configure the Mercurial color mode. For details about how to define your custom
443 effect and style see :hg:`help color`.
443 effect and style see :hg:`help color`.
444
444
445 ``mode``
445 ``mode``
446 String: control the method used to output color. One of ``auto``, ``ansi``,
446 String: control the method used to output color. One of ``auto``, ``ansi``,
447 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
447 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
448 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
448 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
449 terminal. Any invalid value will disable color.
449 terminal. Any invalid value will disable color.
450
450
451 ``pagermode``
451 ``pagermode``
452 String: optional override of ``color.mode`` used with pager.
452 String: optional override of ``color.mode`` used with pager.
453
453
454 On some systems, terminfo mode may cause problems when using
454 On some systems, terminfo mode may cause problems when using
455 color with ``less -R`` as a pager program. less with the -R option
455 color with ``less -R`` as a pager program. less with the -R option
456 will only display ECMA-48 color codes, and terminfo mode may sometimes
456 will only display ECMA-48 color codes, and terminfo mode may sometimes
457 emit codes that less doesn't understand. You can work around this by
457 emit codes that less doesn't understand. You can work around this by
458 either using ansi mode (or auto mode), or by using less -r (which will
458 either using ansi mode (or auto mode), or by using less -r (which will
459 pass through all terminal control codes, not just color control
459 pass through all terminal control codes, not just color control
460 codes).
460 codes).
461
461
462 On some systems (such as MSYS in Windows), the terminal may support
462 On some systems (such as MSYS in Windows), the terminal may support
463 a different color mode than the pager program.
463 a different color mode than the pager program.
464
464
465 ``commands``
465 ``commands``
466 ------------
466 ------------
467
467
468 ``commit.post-status``
468 ``commit.post-status``
469 Show status of files in the working directory after successful commit.
469 Show status of files in the working directory after successful commit.
470 (default: False)
470 (default: False)
471
471
472 ``merge.require-rev``
472 ``merge.require-rev``
473 Require that the revision to merge the current commit with be specified on
473 Require that the revision to merge the current commit with be specified on
474 the command line. If this is enabled and a revision is not specified, the
474 the command line. If this is enabled and a revision is not specified, the
475 command aborts.
475 command aborts.
476 (default: False)
476 (default: False)
477
477
478 ``push.require-revs``
478 ``push.require-revs``
479 Require revisions to push be specified using one or more mechanisms such as
479 Require revisions to push be specified using one or more mechanisms such as
480 specifying them positionally on the command line, using ``-r``, ``-b``,
480 specifying them positionally on the command line, using ``-r``, ``-b``,
481 and/or ``-B`` on the command line, or using ``paths.<path>:pushrev`` in the
481 and/or ``-B`` on the command line, or using ``paths.<path>:pushrev`` in the
482 configuration. If this is enabled and revisions are not specified, the
482 configuration. If this is enabled and revisions are not specified, the
483 command aborts.
483 command aborts.
484 (default: False)
484 (default: False)
485
485
486 ``resolve.confirm``
486 ``resolve.confirm``
487 Confirm before performing action if no filename is passed.
487 Confirm before performing action if no filename is passed.
488 (default: False)
488 (default: False)
489
489
490 ``resolve.explicit-re-merge``
490 ``resolve.explicit-re-merge``
491 Require uses of ``hg resolve`` to specify which action it should perform,
491 Require uses of ``hg resolve`` to specify which action it should perform,
492 instead of re-merging files by default.
492 instead of re-merging files by default.
493 (default: False)
493 (default: False)
494
494
495 ``resolve.mark-check``
495 ``resolve.mark-check``
496 Determines what level of checking :hg:`resolve --mark` will perform before
496 Determines what level of checking :hg:`resolve --mark` will perform before
497 marking files as resolved. Valid values are ``none`, ``warn``, and
497 marking files as resolved. Valid values are ``none`, ``warn``, and
498 ``abort``. ``warn`` will output a warning listing the file(s) that still
498 ``abort``. ``warn`` will output a warning listing the file(s) that still
499 have conflict markers in them, but will still mark everything resolved.
499 have conflict markers in them, but will still mark everything resolved.
500 ``abort`` will output the same warning but will not mark things as resolved.
500 ``abort`` will output the same warning but will not mark things as resolved.
501 If --all is passed and this is set to ``abort``, only a warning will be
501 If --all is passed and this is set to ``abort``, only a warning will be
502 shown (an error will not be raised).
502 shown (an error will not be raised).
503 (default: ``none``)
503 (default: ``none``)
504
504
505 ``status.relative``
505 ``status.relative``
506 Make paths in :hg:`status` output relative to the current directory.
506 Make paths in :hg:`status` output relative to the current directory.
507 (default: False)
507 (default: False)
508
508
509 ``status.terse``
509 ``status.terse``
510 Default value for the --terse flag, which condenses status output.
510 Default value for the --terse flag, which condenses status output.
511 (default: empty)
511 (default: empty)
512
512
513 ``update.check``
513 ``update.check``
514 Determines what level of checking :hg:`update` will perform before moving
514 Determines what level of checking :hg:`update` will perform before moving
515 to a destination revision. Valid values are ``abort``, ``none``,
515 to a destination revision. Valid values are ``abort``, ``none``,
516 ``linear``, and ``noconflict``. ``abort`` always fails if the working
516 ``linear``, and ``noconflict``. ``abort`` always fails if the working
517 directory has uncommitted changes. ``none`` performs no checking, and may
517 directory has uncommitted changes. ``none`` performs no checking, and may
518 result in a merge with uncommitted changes. ``linear`` allows any update
518 result in a merge with uncommitted changes. ``linear`` allows any update
519 as long as it follows a straight line in the revision history, and may
519 as long as it follows a straight line in the revision history, and may
520 trigger a merge with uncommitted changes. ``noconflict`` will allow any
520 trigger a merge with uncommitted changes. ``noconflict`` will allow any
521 update which would not trigger a merge with uncommitted changes, if any
521 update which would not trigger a merge with uncommitted changes, if any
522 are present.
522 are present.
523 (default: ``linear``)
523 (default: ``linear``)
524
524
525 ``update.requiredest``
525 ``update.requiredest``
526 Require that the user pass a destination when running :hg:`update`.
526 Require that the user pass a destination when running :hg:`update`.
527 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
527 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
528 will be disallowed.
528 will be disallowed.
529 (default: False)
529 (default: False)
530
530
531 ``committemplate``
531 ``committemplate``
532 ------------------
532 ------------------
533
533
534 ``changeset``
534 ``changeset``
535 String: configuration in this section is used as the template to
535 String: configuration in this section is used as the template to
536 customize the text shown in the editor when committing.
536 customize the text shown in the editor when committing.
537
537
538 In addition to pre-defined template keywords, commit log specific one
538 In addition to pre-defined template keywords, commit log specific one
539 below can be used for customization:
539 below can be used for customization:
540
540
541 ``extramsg``
541 ``extramsg``
542 String: Extra message (typically 'Leave message empty to abort
542 String: Extra message (typically 'Leave message empty to abort
543 commit.'). This may be changed by some commands or extensions.
543 commit.'). This may be changed by some commands or extensions.
544
544
545 For example, the template configuration below shows as same text as
545 For example, the template configuration below shows as same text as
546 one shown by default::
546 one shown by default::
547
547
548 [committemplate]
548 [committemplate]
549 changeset = {desc}\n\n
549 changeset = {desc}\n\n
550 HG: Enter commit message. Lines beginning with 'HG:' are removed.
550 HG: Enter commit message. Lines beginning with 'HG:' are removed.
551 HG: {extramsg}
551 HG: {extramsg}
552 HG: --
552 HG: --
553 HG: user: {author}\n{ifeq(p2rev, "-1", "",
553 HG: user: {author}\n{ifeq(p2rev, "-1", "",
554 "HG: branch merge\n")
554 "HG: branch merge\n")
555 }HG: branch '{branch}'\n{if(activebookmark,
555 }HG: branch '{branch}'\n{if(activebookmark,
556 "HG: bookmark '{activebookmark}'\n") }{subrepos %
556 "HG: bookmark '{activebookmark}'\n") }{subrepos %
557 "HG: subrepo {subrepo}\n" }{file_adds %
557 "HG: subrepo {subrepo}\n" }{file_adds %
558 "HG: added {file}\n" }{file_mods %
558 "HG: added {file}\n" }{file_mods %
559 "HG: changed {file}\n" }{file_dels %
559 "HG: changed {file}\n" }{file_dels %
560 "HG: removed {file}\n" }{if(files, "",
560 "HG: removed {file}\n" }{if(files, "",
561 "HG: no files changed\n")}
561 "HG: no files changed\n")}
562
562
563 ``diff()``
563 ``diff()``
564 String: show the diff (see :hg:`help templates` for detail)
564 String: show the diff (see :hg:`help templates` for detail)
565
565
566 Sometimes it is helpful to show the diff of the changeset in the editor without
566 Sometimes it is helpful to show the diff of the changeset in the editor without
567 having to prefix 'HG: ' to each line so that highlighting works correctly. For
567 having to prefix 'HG: ' to each line so that highlighting works correctly. For
568 this, Mercurial provides a special string which will ignore everything below
568 this, Mercurial provides a special string which will ignore everything below
569 it::
569 it::
570
570
571 HG: ------------------------ >8 ------------------------
571 HG: ------------------------ >8 ------------------------
572
572
573 For example, the template configuration below will show the diff below the
573 For example, the template configuration below will show the diff below the
574 extra message::
574 extra message::
575
575
576 [committemplate]
576 [committemplate]
577 changeset = {desc}\n\n
577 changeset = {desc}\n\n
578 HG: Enter commit message. Lines beginning with 'HG:' are removed.
578 HG: Enter commit message. Lines beginning with 'HG:' are removed.
579 HG: {extramsg}
579 HG: {extramsg}
580 HG: ------------------------ >8 ------------------------
580 HG: ------------------------ >8 ------------------------
581 HG: Do not touch the line above.
581 HG: Do not touch the line above.
582 HG: Everything below will be removed.
582 HG: Everything below will be removed.
583 {diff()}
583 {diff()}
584
584
585 .. note::
585 .. note::
586
586
587 For some problematic encodings (see :hg:`help win32mbcs` for
587 For some problematic encodings (see :hg:`help win32mbcs` for
588 detail), this customization should be configured carefully, to
588 detail), this customization should be configured carefully, to
589 avoid showing broken characters.
589 avoid showing broken characters.
590
590
591 For example, if a multibyte character ending with backslash (0x5c) is
591 For example, if a multibyte character ending with backslash (0x5c) is
592 followed by the ASCII character 'n' in the customized template,
592 followed by the ASCII character 'n' in the customized template,
593 the sequence of backslash and 'n' is treated as line-feed unexpectedly
593 the sequence of backslash and 'n' is treated as line-feed unexpectedly
594 (and the multibyte character is broken, too).
594 (and the multibyte character is broken, too).
595
595
596 Customized template is used for commands below (``--edit`` may be
596 Customized template is used for commands below (``--edit`` may be
597 required):
597 required):
598
598
599 - :hg:`backout`
599 - :hg:`backout`
600 - :hg:`commit`
600 - :hg:`commit`
601 - :hg:`fetch` (for merge commit only)
601 - :hg:`fetch` (for merge commit only)
602 - :hg:`graft`
602 - :hg:`graft`
603 - :hg:`histedit`
603 - :hg:`histedit`
604 - :hg:`import`
604 - :hg:`import`
605 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
605 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
606 - :hg:`rebase`
606 - :hg:`rebase`
607 - :hg:`shelve`
607 - :hg:`shelve`
608 - :hg:`sign`
608 - :hg:`sign`
609 - :hg:`tag`
609 - :hg:`tag`
610 - :hg:`transplant`
610 - :hg:`transplant`
611
611
612 Configuring items below instead of ``changeset`` allows showing
612 Configuring items below instead of ``changeset`` allows showing
613 customized message only for specific actions, or showing different
613 customized message only for specific actions, or showing different
614 messages for each action.
614 messages for each action.
615
615
616 - ``changeset.backout`` for :hg:`backout`
616 - ``changeset.backout`` for :hg:`backout`
617 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
617 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
618 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
618 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
619 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
619 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
620 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
620 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
621 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
621 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
622 - ``changeset.gpg.sign`` for :hg:`sign`
622 - ``changeset.gpg.sign`` for :hg:`sign`
623 - ``changeset.graft`` for :hg:`graft`
623 - ``changeset.graft`` for :hg:`graft`
624 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
624 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
625 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
625 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
626 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
626 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
627 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
627 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
628 - ``changeset.import.bypass`` for :hg:`import --bypass`
628 - ``changeset.import.bypass`` for :hg:`import --bypass`
629 - ``changeset.import.normal.merge`` for :hg:`import` on merges
629 - ``changeset.import.normal.merge`` for :hg:`import` on merges
630 - ``changeset.import.normal.normal`` for :hg:`import` on other
630 - ``changeset.import.normal.normal`` for :hg:`import` on other
631 - ``changeset.mq.qnew`` for :hg:`qnew`
631 - ``changeset.mq.qnew`` for :hg:`qnew`
632 - ``changeset.mq.qfold`` for :hg:`qfold`
632 - ``changeset.mq.qfold`` for :hg:`qfold`
633 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
633 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
634 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
634 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
635 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
635 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
636 - ``changeset.rebase.normal`` for :hg:`rebase` on other
636 - ``changeset.rebase.normal`` for :hg:`rebase` on other
637 - ``changeset.shelve.shelve`` for :hg:`shelve`
637 - ``changeset.shelve.shelve`` for :hg:`shelve`
638 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
638 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
639 - ``changeset.tag.remove`` for :hg:`tag --remove`
639 - ``changeset.tag.remove`` for :hg:`tag --remove`
640 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
640 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
641 - ``changeset.transplant.normal`` for :hg:`transplant` on other
641 - ``changeset.transplant.normal`` for :hg:`transplant` on other
642
642
643 These dot-separated lists of names are treated as hierarchical ones.
643 These dot-separated lists of names are treated as hierarchical ones.
644 For example, ``changeset.tag.remove`` customizes the commit message
644 For example, ``changeset.tag.remove`` customizes the commit message
645 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
645 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
646 commit message for :hg:`tag` regardless of ``--remove`` option.
646 commit message for :hg:`tag` regardless of ``--remove`` option.
647
647
648 When the external editor is invoked for a commit, the corresponding
648 When the external editor is invoked for a commit, the corresponding
649 dot-separated list of names without the ``changeset.`` prefix
649 dot-separated list of names without the ``changeset.`` prefix
650 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
650 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
651 variable.
651 variable.
652
652
653 In this section, items other than ``changeset`` can be referred from
653 In this section, items other than ``changeset`` can be referred from
654 others. For example, the configuration to list committed files up
654 others. For example, the configuration to list committed files up
655 below can be referred as ``{listupfiles}``::
655 below can be referred as ``{listupfiles}``::
656
656
657 [committemplate]
657 [committemplate]
658 listupfiles = {file_adds %
658 listupfiles = {file_adds %
659 "HG: added {file}\n" }{file_mods %
659 "HG: added {file}\n" }{file_mods %
660 "HG: changed {file}\n" }{file_dels %
660 "HG: changed {file}\n" }{file_dels %
661 "HG: removed {file}\n" }{if(files, "",
661 "HG: removed {file}\n" }{if(files, "",
662 "HG: no files changed\n")}
662 "HG: no files changed\n")}
663
663
664 ``decode/encode``
664 ``decode/encode``
665 -----------------
665 -----------------
666
666
667 Filters for transforming files on checkout/checkin. This would
667 Filters for transforming files on checkout/checkin. This would
668 typically be used for newline processing or other
668 typically be used for newline processing or other
669 localization/canonicalization of files.
669 localization/canonicalization of files.
670
670
671 Filters consist of a filter pattern followed by a filter command.
671 Filters consist of a filter pattern followed by a filter command.
672 Filter patterns are globs by default, rooted at the repository root.
672 Filter patterns are globs by default, rooted at the repository root.
673 For example, to match any file ending in ``.txt`` in the root
673 For example, to match any file ending in ``.txt`` in the root
674 directory only, use the pattern ``*.txt``. To match any file ending
674 directory only, use the pattern ``*.txt``. To match any file ending
675 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
675 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
676 For each file only the first matching filter applies.
676 For each file only the first matching filter applies.
677
677
678 The filter command can start with a specifier, either ``pipe:`` or
678 The filter command can start with a specifier, either ``pipe:`` or
679 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
679 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
680
680
681 A ``pipe:`` command must accept data on stdin and return the transformed
681 A ``pipe:`` command must accept data on stdin and return the transformed
682 data on stdout.
682 data on stdout.
683
683
684 Pipe example::
684 Pipe example::
685
685
686 [encode]
686 [encode]
687 # uncompress gzip files on checkin to improve delta compression
687 # uncompress gzip files on checkin to improve delta compression
688 # note: not necessarily a good idea, just an example
688 # note: not necessarily a good idea, just an example
689 *.gz = pipe: gunzip
689 *.gz = pipe: gunzip
690
690
691 [decode]
691 [decode]
692 # recompress gzip files when writing them to the working dir (we
692 # recompress gzip files when writing them to the working dir (we
693 # can safely omit "pipe:", because it's the default)
693 # can safely omit "pipe:", because it's the default)
694 *.gz = gzip
694 *.gz = gzip
695
695
696 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
696 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
697 with the name of a temporary file that contains the data to be
697 with the name of a temporary file that contains the data to be
698 filtered by the command. The string ``OUTFILE`` is replaced with the name
698 filtered by the command. The string ``OUTFILE`` is replaced with the name
699 of an empty temporary file, where the filtered data must be written by
699 of an empty temporary file, where the filtered data must be written by
700 the command.
700 the command.
701
701
702 .. container:: windows
702 .. container:: windows
703
703
704 .. note::
704 .. note::
705
705
706 The tempfile mechanism is recommended for Windows systems,
706 The tempfile mechanism is recommended for Windows systems,
707 where the standard shell I/O redirection operators often have
707 where the standard shell I/O redirection operators often have
708 strange effects and may corrupt the contents of your files.
708 strange effects and may corrupt the contents of your files.
709
709
710 This filter mechanism is used internally by the ``eol`` extension to
710 This filter mechanism is used internally by the ``eol`` extension to
711 translate line ending characters between Windows (CRLF) and Unix (LF)
711 translate line ending characters between Windows (CRLF) and Unix (LF)
712 format. We suggest you use the ``eol`` extension for convenience.
712 format. We suggest you use the ``eol`` extension for convenience.
713
713
714
714
715 ``defaults``
715 ``defaults``
716 ------------
716 ------------
717
717
718 (defaults are deprecated. Don't use them. Use aliases instead.)
718 (defaults are deprecated. Don't use them. Use aliases instead.)
719
719
720 Use the ``[defaults]`` section to define command defaults, i.e. the
720 Use the ``[defaults]`` section to define command defaults, i.e. the
721 default options/arguments to pass to the specified commands.
721 default options/arguments to pass to the specified commands.
722
722
723 The following example makes :hg:`log` run in verbose mode, and
723 The following example makes :hg:`log` run in verbose mode, and
724 :hg:`status` show only the modified files, by default::
724 :hg:`status` show only the modified files, by default::
725
725
726 [defaults]
726 [defaults]
727 log = -v
727 log = -v
728 status = -m
728 status = -m
729
729
730 The actual commands, instead of their aliases, must be used when
730 The actual commands, instead of their aliases, must be used when
731 defining command defaults. The command defaults will also be applied
731 defining command defaults. The command defaults will also be applied
732 to the aliases of the commands defined.
732 to the aliases of the commands defined.
733
733
734
734
735 ``diff``
735 ``diff``
736 --------
736 --------
737
737
738 Settings used when displaying diffs. Everything except for ``unified``
738 Settings used when displaying diffs. Everything except for ``unified``
739 is a Boolean and defaults to False. See :hg:`help config.annotate`
739 is a Boolean and defaults to False. See :hg:`help config.annotate`
740 for related options for the annotate command.
740 for related options for the annotate command.
741
741
742 ``git``
742 ``git``
743 Use git extended diff format.
743 Use git extended diff format.
744
744
745 ``nobinary``
745 ``nobinary``
746 Omit git binary patches.
746 Omit git binary patches.
747
747
748 ``nodates``
748 ``nodates``
749 Don't include dates in diff headers.
749 Don't include dates in diff headers.
750
750
751 ``noprefix``
751 ``noprefix``
752 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
752 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
753
753
754 ``showfunc``
754 ``showfunc``
755 Show which function each change is in.
755 Show which function each change is in.
756
756
757 ``ignorews``
757 ``ignorews``
758 Ignore white space when comparing lines.
758 Ignore white space when comparing lines.
759
759
760 ``ignorewsamount``
760 ``ignorewsamount``
761 Ignore changes in the amount of white space.
761 Ignore changes in the amount of white space.
762
762
763 ``ignoreblanklines``
763 ``ignoreblanklines``
764 Ignore changes whose lines are all blank.
764 Ignore changes whose lines are all blank.
765
765
766 ``unified``
766 ``unified``
767 Number of lines of context to show.
767 Number of lines of context to show.
768
768
769 ``word-diff``
769 ``word-diff``
770 Highlight changed words.
770 Highlight changed words.
771
771
772 ``email``
772 ``email``
773 ---------
773 ---------
774
774
775 Settings for extensions that send email messages.
775 Settings for extensions that send email messages.
776
776
777 ``from``
777 ``from``
778 Optional. Email address to use in "From" header and SMTP envelope
778 Optional. Email address to use in "From" header and SMTP envelope
779 of outgoing messages.
779 of outgoing messages.
780
780
781 ``to``
781 ``to``
782 Optional. Comma-separated list of recipients' email addresses.
782 Optional. Comma-separated list of recipients' email addresses.
783
783
784 ``cc``
784 ``cc``
785 Optional. Comma-separated list of carbon copy recipients'
785 Optional. Comma-separated list of carbon copy recipients'
786 email addresses.
786 email addresses.
787
787
788 ``bcc``
788 ``bcc``
789 Optional. Comma-separated list of blind carbon copy recipients'
789 Optional. Comma-separated list of blind carbon copy recipients'
790 email addresses.
790 email addresses.
791
791
792 ``method``
792 ``method``
793 Optional. Method to use to send email messages. If value is ``smtp``
793 Optional. Method to use to send email messages. If value is ``smtp``
794 (default), use SMTP (see the ``[smtp]`` section for configuration).
794 (default), use SMTP (see the ``[smtp]`` section for configuration).
795 Otherwise, use as name of program to run that acts like sendmail
795 Otherwise, use as name of program to run that acts like sendmail
796 (takes ``-f`` option for sender, list of recipients on command line,
796 (takes ``-f`` option for sender, list of recipients on command line,
797 message on stdin). Normally, setting this to ``sendmail`` or
797 message on stdin). Normally, setting this to ``sendmail`` or
798 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
798 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
799
799
800 ``charsets``
800 ``charsets``
801 Optional. Comma-separated list of character sets considered
801 Optional. Comma-separated list of character sets considered
802 convenient for recipients. Addresses, headers, and parts not
802 convenient for recipients. Addresses, headers, and parts not
803 containing patches of outgoing messages will be encoded in the
803 containing patches of outgoing messages will be encoded in the
804 first character set to which conversion from local encoding
804 first character set to which conversion from local encoding
805 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
805 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
806 conversion fails, the text in question is sent as is.
806 conversion fails, the text in question is sent as is.
807 (default: '')
807 (default: '')
808
808
809 Order of outgoing email character sets:
809 Order of outgoing email character sets:
810
810
811 1. ``us-ascii``: always first, regardless of settings
811 1. ``us-ascii``: always first, regardless of settings
812 2. ``email.charsets``: in order given by user
812 2. ``email.charsets``: in order given by user
813 3. ``ui.fallbackencoding``: if not in email.charsets
813 3. ``ui.fallbackencoding``: if not in email.charsets
814 4. ``$HGENCODING``: if not in email.charsets
814 4. ``$HGENCODING``: if not in email.charsets
815 5. ``utf-8``: always last, regardless of settings
815 5. ``utf-8``: always last, regardless of settings
816
816
817 Email example::
817 Email example::
818
818
819 [email]
819 [email]
820 from = Joseph User <joe.user@example.com>
820 from = Joseph User <joe.user@example.com>
821 method = /usr/sbin/sendmail
821 method = /usr/sbin/sendmail
822 # charsets for western Europeans
822 # charsets for western Europeans
823 # us-ascii, utf-8 omitted, as they are tried first and last
823 # us-ascii, utf-8 omitted, as they are tried first and last
824 charsets = iso-8859-1, iso-8859-15, windows-1252
824 charsets = iso-8859-1, iso-8859-15, windows-1252
825
825
826
826
827 ``extensions``
827 ``extensions``
828 --------------
828 --------------
829
829
830 Mercurial has an extension mechanism for adding new features. To
830 Mercurial has an extension mechanism for adding new features. To
831 enable an extension, create an entry for it in this section.
831 enable an extension, create an entry for it in this section.
832
832
833 If you know that the extension is already in Python's search path,
833 If you know that the extension is already in Python's search path,
834 you can give the name of the module, followed by ``=``, with nothing
834 you can give the name of the module, followed by ``=``, with nothing
835 after the ``=``.
835 after the ``=``.
836
836
837 Otherwise, give a name that you choose, followed by ``=``, followed by
837 Otherwise, give a name that you choose, followed by ``=``, followed by
838 the path to the ``.py`` file (including the file name extension) that
838 the path to the ``.py`` file (including the file name extension) that
839 defines the extension.
839 defines the extension.
840
840
841 To explicitly disable an extension that is enabled in an hgrc of
841 To explicitly disable an extension that is enabled in an hgrc of
842 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
842 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
843 or ``foo = !`` when path is not supplied.
843 or ``foo = !`` when path is not supplied.
844
844
845 Example for ``~/.hgrc``::
845 Example for ``~/.hgrc``::
846
846
847 [extensions]
847 [extensions]
848 # (the churn extension will get loaded from Mercurial's path)
848 # (the churn extension will get loaded from Mercurial's path)
849 churn =
849 churn =
850 # (this extension will get loaded from the file specified)
850 # (this extension will get loaded from the file specified)
851 myfeature = ~/.hgext/myfeature.py
851 myfeature = ~/.hgext/myfeature.py
852
852
853 If an extension fails to load, a warning will be issued, and Mercurial will
854 proceed. To enforce that an extension must be loaded, one can set the `required`
855 suboption in the config::
856
857 [extensions]
858 myfeature = ~/.hgext/myfeature.py
859 myfeature:required = yes
860
861 To debug extension loading issue, one can add `--traceback` to their mercurial
862 invocation.
863
853
864
854 ``format``
865 ``format``
855 ----------
866 ----------
856
867
857 Configuration that controls the repository format. Newer format options are more
868 Configuration that controls the repository format. Newer format options are more
858 powerful, but incompatible with some older versions of Mercurial. Format options
869 powerful, but incompatible with some older versions of Mercurial. Format options
859 are considered at repository initialization only. You need to make a new clone
870 are considered at repository initialization only. You need to make a new clone
860 for config changes to be taken into account.
871 for config changes to be taken into account.
861
872
862 For more details about repository format and version compatibility, see
873 For more details about repository format and version compatibility, see
863 https://www.mercurial-scm.org/wiki/MissingRequirement
874 https://www.mercurial-scm.org/wiki/MissingRequirement
864
875
865 ``usegeneraldelta``
876 ``usegeneraldelta``
866 Enable or disable the "generaldelta" repository format which improves
877 Enable or disable the "generaldelta" repository format which improves
867 repository compression by allowing "revlog" to store deltas against
878 repository compression by allowing "revlog" to store deltas against
868 arbitrary revisions instead of the previously stored one. This provides
879 arbitrary revisions instead of the previously stored one. This provides
869 significant improvement for repositories with branches.
880 significant improvement for repositories with branches.
870
881
871 Repositories with this on-disk format require Mercurial version 1.9.
882 Repositories with this on-disk format require Mercurial version 1.9.
872
883
873 Enabled by default.
884 Enabled by default.
874
885
875 ``dotencode``
886 ``dotencode``
876 Enable or disable the "dotencode" repository format which enhances
887 Enable or disable the "dotencode" repository format which enhances
877 the "fncache" repository format (which has to be enabled to use
888 the "fncache" repository format (which has to be enabled to use
878 dotencode) to avoid issues with filenames starting with "._" on
889 dotencode) to avoid issues with filenames starting with "._" on
879 Mac OS X and spaces on Windows.
890 Mac OS X and spaces on Windows.
880
891
881 Repositories with this on-disk format require Mercurial version 1.7.
892 Repositories with this on-disk format require Mercurial version 1.7.
882
893
883 Enabled by default.
894 Enabled by default.
884
895
885 ``usefncache``
896 ``usefncache``
886 Enable or disable the "fncache" repository format which enhances
897 Enable or disable the "fncache" repository format which enhances
887 the "store" repository format (which has to be enabled to use
898 the "store" repository format (which has to be enabled to use
888 fncache) to allow longer filenames and avoids using Windows
899 fncache) to allow longer filenames and avoids using Windows
889 reserved names, e.g. "nul".
900 reserved names, e.g. "nul".
890
901
891 Repositories with this on-disk format require Mercurial version 1.1.
902 Repositories with this on-disk format require Mercurial version 1.1.
892
903
893 Enabled by default.
904 Enabled by default.
894
905
895 ``use-persistent-nodemap``
906 ``use-persistent-nodemap``
896 Enable or disable the "persistent-nodemap" feature which improves
907 Enable or disable the "persistent-nodemap" feature which improves
897 performance if the rust extensions are available.
908 performance if the rust extensions are available.
898
909
899 The "persistence-nodemap" persist the "node -> rev" on disk removing the
910 The "persistence-nodemap" persist the "node -> rev" on disk removing the
900 need to dynamically build that mapping for each Mercurial invocation. This
911 need to dynamically build that mapping for each Mercurial invocation. This
901 significantly reduce the startup cost of various local and server-side
912 significantly reduce the startup cost of various local and server-side
902 operation for larger repository.
913 operation for larger repository.
903
914
904 The performance improving version of this feature is currently only
915 The performance improving version of this feature is currently only
905 implemented in Rust, so people not using a version of Mercurial compiled
916 implemented in Rust, so people not using a version of Mercurial compiled
906 with the Rust part might actually suffer some slowdown. For this reason,
917 with the Rust part might actually suffer some slowdown. For this reason,
907 Such version will by default refuse to access such repositories. That
918 Such version will by default refuse to access such repositories. That
908 behavior can be controlled by configuration. Check
919 behavior can be controlled by configuration. Check
909 :hg:`help config.storage.revlog.persistent-nodemap.slow-path` for details.
920 :hg:`help config.storage.revlog.persistent-nodemap.slow-path` for details.
910
921
911 Repository with this on-disk format require Mercurial version 5.4 or above.
922 Repository with this on-disk format require Mercurial version 5.4 or above.
912
923
913 By default this format variant is disabled if fast implementation is not
924 By default this format variant is disabled if fast implementation is not
914 available and enabled by default if the fast implementation is available.
925 available and enabled by default if the fast implementation is available.
915
926
916 To accomodate install of Mercurial without the fast implementation you can
927 To accomodate install of Mercurial without the fast implementation you can
917 downgrade your repository. To do so run the following command:
928 downgrade your repository. To do so run the following command:
918
929
919 $ hg debugupgraderepo \
930 $ hg debugupgraderepo \
920 --run \
931 --run \
921 --config format.use-persistent-nodemap=False \
932 --config format.use-persistent-nodemap=False \
922 --config storage.revlog.persistent-nodemap.slow-path=allow
933 --config storage.revlog.persistent-nodemap.slow-path=allow
923
934
924 ``use-share-safe``
935 ``use-share-safe``
925 Enforce "safe" behaviors for all "shares" that access this repository.
936 Enforce "safe" behaviors for all "shares" that access this repository.
926
937
927 With this feature, "shares" using this repository as a source will:
938 With this feature, "shares" using this repository as a source will:
928
939
929 * read the source repository's configuration (`<source>/.hg/hgrc`).
940 * read the source repository's configuration (`<source>/.hg/hgrc`).
930 * read and use the source repository's "requirements"
941 * read and use the source repository's "requirements"
931 (except the working copy specific one).
942 (except the working copy specific one).
932
943
933 Without this feature, "shares" using this repository as a source will:
944 Without this feature, "shares" using this repository as a source will:
934
945
935 * keep tracking the repository "requirements" in the share only, ignoring
946 * keep tracking the repository "requirements" in the share only, ignoring
936 the source "requirements", possibly diverging from them.
947 the source "requirements", possibly diverging from them.
937 * ignore source repository config. This can create problems, like silently
948 * ignore source repository config. This can create problems, like silently
938 ignoring important hooks.
949 ignoring important hooks.
939
950
940 Beware that existing shares will not be upgraded/downgraded, and by
951 Beware that existing shares will not be upgraded/downgraded, and by
941 default, Mercurial will refuse to interact with them until the mismatch
952 default, Mercurial will refuse to interact with them until the mismatch
942 is resolved. See :hg:`help config share.safe-mismatch.source-safe` and
953 is resolved. See :hg:`help config share.safe-mismatch.source-safe` and
943 :hg:`help config share.safe-mismatch.source-not-safe` for details.
954 :hg:`help config share.safe-mismatch.source-not-safe` for details.
944
955
945 Introduced in Mercurial 5.7.
956 Introduced in Mercurial 5.7.
946
957
947 Disabled by default.
958 Disabled by default.
948
959
949 ``usestore``
960 ``usestore``
950 Enable or disable the "store" repository format which improves
961 Enable or disable the "store" repository format which improves
951 compatibility with systems that fold case or otherwise mangle
962 compatibility with systems that fold case or otherwise mangle
952 filenames. Disabling this option will allow you to store longer filenames
963 filenames. Disabling this option will allow you to store longer filenames
953 in some situations at the expense of compatibility.
964 in some situations at the expense of compatibility.
954
965
955 Repositories with this on-disk format require Mercurial version 0.9.4.
966 Repositories with this on-disk format require Mercurial version 0.9.4.
956
967
957 Enabled by default.
968 Enabled by default.
958
969
959 ``sparse-revlog``
970 ``sparse-revlog``
960 Enable or disable the ``sparse-revlog`` delta strategy. This format improves
971 Enable or disable the ``sparse-revlog`` delta strategy. This format improves
961 delta re-use inside revlog. For very branchy repositories, it results in a
972 delta re-use inside revlog. For very branchy repositories, it results in a
962 smaller store. For repositories with many revisions, it also helps
973 smaller store. For repositories with many revisions, it also helps
963 performance (by using shortened delta chains.)
974 performance (by using shortened delta chains.)
964
975
965 Repositories with this on-disk format require Mercurial version 4.7
976 Repositories with this on-disk format require Mercurial version 4.7
966
977
967 Enabled by default.
978 Enabled by default.
968
979
969 ``revlog-compression``
980 ``revlog-compression``
970 Compression algorithm used by revlog. Supported values are `zlib` and
981 Compression algorithm used by revlog. Supported values are `zlib` and
971 `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is
982 `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is
972 a newer format that is usually a net win over `zlib`, operating faster at
983 a newer format that is usually a net win over `zlib`, operating faster at
973 better compression rates. Use `zstd` to reduce CPU usage. Multiple values
984 better compression rates. Use `zstd` to reduce CPU usage. Multiple values
974 can be specified, the first available one will be used.
985 can be specified, the first available one will be used.
975
986
976 On some systems, the Mercurial installation may lack `zstd` support.
987 On some systems, the Mercurial installation may lack `zstd` support.
977
988
978 Default is `zstd` if available, `zlib` otherwise.
989 Default is `zstd` if available, `zlib` otherwise.
979
990
980 ``bookmarks-in-store``
991 ``bookmarks-in-store``
981 Store bookmarks in .hg/store/. This means that bookmarks are shared when
992 Store bookmarks in .hg/store/. This means that bookmarks are shared when
982 using `hg share` regardless of the `-B` option.
993 using `hg share` regardless of the `-B` option.
983
994
984 Repositories with this on-disk format require Mercurial version 5.1.
995 Repositories with this on-disk format require Mercurial version 5.1.
985
996
986 Disabled by default.
997 Disabled by default.
987
998
988
999
989 ``graph``
1000 ``graph``
990 ---------
1001 ---------
991
1002
992 Web graph view configuration. This section let you change graph
1003 Web graph view configuration. This section let you change graph
993 elements display properties by branches, for instance to make the
1004 elements display properties by branches, for instance to make the
994 ``default`` branch stand out.
1005 ``default`` branch stand out.
995
1006
996 Each line has the following format::
1007 Each line has the following format::
997
1008
998 <branch>.<argument> = <value>
1009 <branch>.<argument> = <value>
999
1010
1000 where ``<branch>`` is the name of the branch being
1011 where ``<branch>`` is the name of the branch being
1001 customized. Example::
1012 customized. Example::
1002
1013
1003 [graph]
1014 [graph]
1004 # 2px width
1015 # 2px width
1005 default.width = 2
1016 default.width = 2
1006 # red color
1017 # red color
1007 default.color = FF0000
1018 default.color = FF0000
1008
1019
1009 Supported arguments:
1020 Supported arguments:
1010
1021
1011 ``width``
1022 ``width``
1012 Set branch edges width in pixels.
1023 Set branch edges width in pixels.
1013
1024
1014 ``color``
1025 ``color``
1015 Set branch edges color in hexadecimal RGB notation.
1026 Set branch edges color in hexadecimal RGB notation.
1016
1027
1017 ``hooks``
1028 ``hooks``
1018 ---------
1029 ---------
1019
1030
1020 Commands or Python functions that get automatically executed by
1031 Commands or Python functions that get automatically executed by
1021 various actions such as starting or finishing a commit. Multiple
1032 various actions such as starting or finishing a commit. Multiple
1022 hooks can be run for the same action by appending a suffix to the
1033 hooks can be run for the same action by appending a suffix to the
1023 action. Overriding a site-wide hook can be done by changing its
1034 action. Overriding a site-wide hook can be done by changing its
1024 value or setting it to an empty string. Hooks can be prioritized
1035 value or setting it to an empty string. Hooks can be prioritized
1025 by adding a prefix of ``priority.`` to the hook name on a new line
1036 by adding a prefix of ``priority.`` to the hook name on a new line
1026 and setting the priority. The default priority is 0.
1037 and setting the priority. The default priority is 0.
1027
1038
1028 Example ``.hg/hgrc``::
1039 Example ``.hg/hgrc``::
1029
1040
1030 [hooks]
1041 [hooks]
1031 # update working directory after adding changesets
1042 # update working directory after adding changesets
1032 changegroup.update = hg update
1043 changegroup.update = hg update
1033 # do not use the site-wide hook
1044 # do not use the site-wide hook
1034 incoming =
1045 incoming =
1035 incoming.email = /my/email/hook
1046 incoming.email = /my/email/hook
1036 incoming.autobuild = /my/build/hook
1047 incoming.autobuild = /my/build/hook
1037 # force autobuild hook to run before other incoming hooks
1048 # force autobuild hook to run before other incoming hooks
1038 priority.incoming.autobuild = 1
1049 priority.incoming.autobuild = 1
1039 ### control HGPLAIN setting when running autobuild hook
1050 ### control HGPLAIN setting when running autobuild hook
1040 # HGPLAIN always set (default from Mercurial 5.7)
1051 # HGPLAIN always set (default from Mercurial 5.7)
1041 incoming.autobuild:run-with-plain = yes
1052 incoming.autobuild:run-with-plain = yes
1042 # HGPLAIN never set
1053 # HGPLAIN never set
1043 incoming.autobuild:run-with-plain = no
1054 incoming.autobuild:run-with-plain = no
1044 # HGPLAIN inherited from environment (default before Mercurial 5.7)
1055 # HGPLAIN inherited from environment (default before Mercurial 5.7)
1045 incoming.autobuild:run-with-plain = auto
1056 incoming.autobuild:run-with-plain = auto
1046
1057
1047 Most hooks are run with environment variables set that give useful
1058 Most hooks are run with environment variables set that give useful
1048 additional information. For each hook below, the environment variables
1059 additional information. For each hook below, the environment variables
1049 it is passed are listed with names in the form ``$HG_foo``. The
1060 it is passed are listed with names in the form ``$HG_foo``. The
1050 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
1061 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
1051 They contain the type of hook which triggered the run and the full name
1062 They contain the type of hook which triggered the run and the full name
1052 of the hook in the config, respectively. In the example above, this will
1063 of the hook in the config, respectively. In the example above, this will
1053 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
1064 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
1054
1065
1055 .. container:: windows
1066 .. container:: windows
1056
1067
1057 Some basic Unix syntax can be enabled for portability, including ``$VAR``
1068 Some basic Unix syntax can be enabled for portability, including ``$VAR``
1058 and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will
1069 and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will
1059 be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion
1070 be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion
1060 on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back
1071 on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back
1061 slash or inside of a strong quote. Strong quotes will be replaced by
1072 slash or inside of a strong quote. Strong quotes will be replaced by
1062 double quotes after processing.
1073 double quotes after processing.
1063
1074
1064 This feature is enabled by adding a prefix of ``tonative.`` to the hook
1075 This feature is enabled by adding a prefix of ``tonative.`` to the hook
1065 name on a new line, and setting it to ``True``. For example::
1076 name on a new line, and setting it to ``True``. For example::
1066
1077
1067 [hooks]
1078 [hooks]
1068 incoming.autobuild = /my/build/hook
1079 incoming.autobuild = /my/build/hook
1069 # enable translation to cmd.exe syntax for autobuild hook
1080 # enable translation to cmd.exe syntax for autobuild hook
1070 tonative.incoming.autobuild = True
1081 tonative.incoming.autobuild = True
1071
1082
1072 ``changegroup``
1083 ``changegroup``
1073 Run after a changegroup has been added via push, pull or unbundle. The ID of
1084 Run after a changegroup has been added via push, pull or unbundle. The ID of
1074 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
1085 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
1075 The URL from which changes came is in ``$HG_URL``.
1086 The URL from which changes came is in ``$HG_URL``.
1076
1087
1077 ``commit``
1088 ``commit``
1078 Run after a changeset has been created in the local repository. The ID
1089 Run after a changeset has been created in the local repository. The ID
1079 of the newly created changeset is in ``$HG_NODE``. Parent changeset
1090 of the newly created changeset is in ``$HG_NODE``. Parent changeset
1080 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1091 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1081
1092
1082 ``incoming``
1093 ``incoming``
1083 Run after a changeset has been pulled, pushed, or unbundled into
1094 Run after a changeset has been pulled, pushed, or unbundled into
1084 the local repository. The ID of the newly arrived changeset is in
1095 the local repository. The ID of the newly arrived changeset is in
1085 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
1096 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
1086
1097
1087 ``outgoing``
1098 ``outgoing``
1088 Run after sending changes from the local repository to another. The ID of
1099 Run after sending changes from the local repository to another. The ID of
1089 first changeset sent is in ``$HG_NODE``. The source of operation is in
1100 first changeset sent is in ``$HG_NODE``. The source of operation is in
1090 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
1101 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
1091
1102
1092 ``post-<command>``
1103 ``post-<command>``
1093 Run after successful invocations of the associated command. The
1104 Run after successful invocations of the associated command. The
1094 contents of the command line are passed as ``$HG_ARGS`` and the result
1105 contents of the command line are passed as ``$HG_ARGS`` and the result
1095 code in ``$HG_RESULT``. Parsed command line arguments are passed as
1106 code in ``$HG_RESULT``. Parsed command line arguments are passed as
1096 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
1107 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
1097 the python data internally passed to <command>. ``$HG_OPTS`` is a
1108 the python data internally passed to <command>. ``$HG_OPTS`` is a
1098 dictionary of options (with unspecified options set to their defaults).
1109 dictionary of options (with unspecified options set to their defaults).
1099 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
1110 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
1100
1111
1101 ``fail-<command>``
1112 ``fail-<command>``
1102 Run after a failed invocation of an associated command. The contents
1113 Run after a failed invocation of an associated command. The contents
1103 of the command line are passed as ``$HG_ARGS``. Parsed command line
1114 of the command line are passed as ``$HG_ARGS``. Parsed command line
1104 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
1115 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
1105 string representations of the python data internally passed to
1116 string representations of the python data internally passed to
1106 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
1117 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
1107 options set to their defaults). ``$HG_PATS`` is a list of arguments.
1118 options set to their defaults). ``$HG_PATS`` is a list of arguments.
1108 Hook failure is ignored.
1119 Hook failure is ignored.
1109
1120
1110 ``pre-<command>``
1121 ``pre-<command>``
1111 Run before executing the associated command. The contents of the
1122 Run before executing the associated command. The contents of the
1112 command line are passed as ``$HG_ARGS``. Parsed command line arguments
1123 command line are passed as ``$HG_ARGS``. Parsed command line arguments
1113 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
1124 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
1114 representations of the data internally passed to <command>. ``$HG_OPTS``
1125 representations of the data internally passed to <command>. ``$HG_OPTS``
1115 is a dictionary of options (with unspecified options set to their
1126 is a dictionary of options (with unspecified options set to their
1116 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
1127 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
1117 failure, the command doesn't execute and Mercurial returns the failure
1128 failure, the command doesn't execute and Mercurial returns the failure
1118 code.
1129 code.
1119
1130
1120 ``prechangegroup``
1131 ``prechangegroup``
1121 Run before a changegroup is added via push, pull or unbundle. Exit
1132 Run before a changegroup is added via push, pull or unbundle. Exit
1122 status 0 allows the changegroup to proceed. A non-zero status will
1133 status 0 allows the changegroup to proceed. A non-zero status will
1123 cause the push, pull or unbundle to fail. The URL from which changes
1134 cause the push, pull or unbundle to fail. The URL from which changes
1124 will come is in ``$HG_URL``.
1135 will come is in ``$HG_URL``.
1125
1136
1126 ``precommit``
1137 ``precommit``
1127 Run before starting a local commit. Exit status 0 allows the
1138 Run before starting a local commit. Exit status 0 allows the
1128 commit to proceed. A non-zero status will cause the commit to fail.
1139 commit to proceed. A non-zero status will cause the commit to fail.
1129 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1140 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1130
1141
1131 ``prelistkeys``
1142 ``prelistkeys``
1132 Run before listing pushkeys (like bookmarks) in the
1143 Run before listing pushkeys (like bookmarks) in the
1133 repository. A non-zero status will cause failure. The key namespace is
1144 repository. A non-zero status will cause failure. The key namespace is
1134 in ``$HG_NAMESPACE``.
1145 in ``$HG_NAMESPACE``.
1135
1146
1136 ``preoutgoing``
1147 ``preoutgoing``
1137 Run before collecting changes to send from the local repository to
1148 Run before collecting changes to send from the local repository to
1138 another. A non-zero status will cause failure. This lets you prevent
1149 another. A non-zero status will cause failure. This lets you prevent
1139 pull over HTTP or SSH. It can also prevent propagating commits (via
1150 pull over HTTP or SSH. It can also prevent propagating commits (via
1140 local pull, push (outbound) or bundle commands), but not completely,
1151 local pull, push (outbound) or bundle commands), but not completely,
1141 since you can just copy files instead. The source of operation is in
1152 since you can just copy files instead. The source of operation is in
1142 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
1153 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
1143 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
1154 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
1144 is happening on behalf of a repository on same system.
1155 is happening on behalf of a repository on same system.
1145
1156
1146 ``prepushkey``
1157 ``prepushkey``
1147 Run before a pushkey (like a bookmark) is added to the
1158 Run before a pushkey (like a bookmark) is added to the
1148 repository. A non-zero status will cause the key to be rejected. The
1159 repository. A non-zero status will cause the key to be rejected. The
1149 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
1160 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
1150 the old value (if any) is in ``$HG_OLD``, and the new value is in
1161 the old value (if any) is in ``$HG_OLD``, and the new value is in
1151 ``$HG_NEW``.
1162 ``$HG_NEW``.
1152
1163
1153 ``pretag``
1164 ``pretag``
1154 Run before creating a tag. Exit status 0 allows the tag to be
1165 Run before creating a tag. Exit status 0 allows the tag to be
1155 created. A non-zero status will cause the tag to fail. The ID of the
1166 created. A non-zero status will cause the tag to fail. The ID of the
1156 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
1167 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
1157 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
1168 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
1158
1169
1159 ``pretxnopen``
1170 ``pretxnopen``
1160 Run before any new repository transaction is open. The reason for the
1171 Run before any new repository transaction is open. The reason for the
1161 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
1172 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
1162 transaction will be in ``$HG_TXNID``. A non-zero status will prevent the
1173 transaction will be in ``$HG_TXNID``. A non-zero status will prevent the
1163 transaction from being opened.
1174 transaction from being opened.
1164
1175
1165 ``pretxnclose``
1176 ``pretxnclose``
1166 Run right before the transaction is actually finalized. Any repository change
1177 Run right before the transaction is actually finalized. Any repository change
1167 will be visible to the hook program. This lets you validate the transaction
1178 will be visible to the hook program. This lets you validate the transaction
1168 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1179 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1169 status will cause the transaction to be rolled back. The reason for the
1180 status will cause the transaction to be rolled back. The reason for the
1170 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1181 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1171 the transaction will be in ``$HG_TXNID``. The rest of the available data will
1182 the transaction will be in ``$HG_TXNID``. The rest of the available data will
1172 vary according the transaction type. Changes unbundled to the repository will
1183 vary according the transaction type. Changes unbundled to the repository will
1173 add ``$HG_URL`` and ``$HG_SOURCE``. New changesets will add ``$HG_NODE`` (the
1184 add ``$HG_URL`` and ``$HG_SOURCE``. New changesets will add ``$HG_NODE`` (the
1174 ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last added
1185 ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last added
1175 changeset). Bookmark and phase changes will set ``$HG_BOOKMARK_MOVED`` and
1186 changeset). Bookmark and phase changes will set ``$HG_BOOKMARK_MOVED`` and
1176 ``$HG_PHASES_MOVED`` to ``1`` respectively. The number of new obsmarkers, if
1187 ``$HG_PHASES_MOVED`` to ``1`` respectively. The number of new obsmarkers, if
1177 any, will be in ``$HG_NEW_OBSMARKERS``, etc.
1188 any, will be in ``$HG_NEW_OBSMARKERS``, etc.
1178
1189
1179 ``pretxnclose-bookmark``
1190 ``pretxnclose-bookmark``
1180 Run right before a bookmark change is actually finalized. Any repository
1191 Run right before a bookmark change is actually finalized. Any repository
1181 change will be visible to the hook program. This lets you validate the
1192 change will be visible to the hook program. This lets you validate the
1182 transaction content or change it. Exit status 0 allows the commit to
1193 transaction content or change it. Exit status 0 allows the commit to
1183 proceed. A non-zero status will cause the transaction to be rolled back.
1194 proceed. A non-zero status will cause the transaction to be rolled back.
1184 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1195 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1185 bookmark location will be available in ``$HG_NODE`` while the previous
1196 bookmark location will be available in ``$HG_NODE`` while the previous
1186 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1197 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1187 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1198 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1188 will be empty.
1199 will be empty.
1189 In addition, the reason for the transaction opening will be in
1200 In addition, the reason for the transaction opening will be in
1190 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1201 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1191 ``$HG_TXNID``.
1202 ``$HG_TXNID``.
1192
1203
1193 ``pretxnclose-phase``
1204 ``pretxnclose-phase``
1194 Run right before a phase change is actually finalized. Any repository change
1205 Run right before a phase change is actually finalized. Any repository change
1195 will be visible to the hook program. This lets you validate the transaction
1206 will be visible to the hook program. This lets you validate the transaction
1196 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1207 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1197 status will cause the transaction to be rolled back. The hook is called
1208 status will cause the transaction to be rolled back. The hook is called
1198 multiple times, once for each revision affected by a phase change.
1209 multiple times, once for each revision affected by a phase change.
1199 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1210 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1200 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1211 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1201 will be empty. In addition, the reason for the transaction opening will be in
1212 will be empty. In addition, the reason for the transaction opening will be in
1202 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1213 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1203 ``$HG_TXNID``. The hook is also run for newly added revisions. In this case
1214 ``$HG_TXNID``. The hook is also run for newly added revisions. In this case
1204 the ``$HG_OLDPHASE`` entry will be empty.
1215 the ``$HG_OLDPHASE`` entry will be empty.
1205
1216
1206 ``txnclose``
1217 ``txnclose``
1207 Run after any repository transaction has been committed. At this
1218 Run after any repository transaction has been committed. At this
1208 point, the transaction can no longer be rolled back. The hook will run
1219 point, the transaction can no longer be rolled back. The hook will run
1209 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1220 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1210 details about available variables.
1221 details about available variables.
1211
1222
1212 ``txnclose-bookmark``
1223 ``txnclose-bookmark``
1213 Run after any bookmark change has been committed. At this point, the
1224 Run after any bookmark change has been committed. At this point, the
1214 transaction can no longer be rolled back. The hook will run after the lock
1225 transaction can no longer be rolled back. The hook will run after the lock
1215 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1226 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1216 about available variables.
1227 about available variables.
1217
1228
1218 ``txnclose-phase``
1229 ``txnclose-phase``
1219 Run after any phase change has been committed. At this point, the
1230 Run after any phase change has been committed. At this point, the
1220 transaction can no longer be rolled back. The hook will run after the lock
1231 transaction can no longer be rolled back. The hook will run after the lock
1221 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1232 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1222 available variables.
1233 available variables.
1223
1234
1224 ``txnabort``
1235 ``txnabort``
1225 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1236 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1226 for details about available variables.
1237 for details about available variables.
1227
1238
1228 ``pretxnchangegroup``
1239 ``pretxnchangegroup``
1229 Run after a changegroup has been added via push, pull or unbundle, but before
1240 Run after a changegroup has been added via push, pull or unbundle, but before
1230 the transaction has been committed. The changegroup is visible to the hook
1241 the transaction has been committed. The changegroup is visible to the hook
1231 program. This allows validation of incoming changes before accepting them.
1242 program. This allows validation of incoming changes before accepting them.
1232 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1243 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1233 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1244 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1234 status will cause the transaction to be rolled back, and the push, pull or
1245 status will cause the transaction to be rolled back, and the push, pull or
1235 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1246 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1236
1247
1237 ``pretxncommit``
1248 ``pretxncommit``
1238 Run after a changeset has been created, but before the transaction is
1249 Run after a changeset has been created, but before the transaction is
1239 committed. The changeset is visible to the hook program. This allows
1250 committed. The changeset is visible to the hook program. This allows
1240 validation of the commit message and changes. Exit status 0 allows the
1251 validation of the commit message and changes. Exit status 0 allows the
1241 commit to proceed. A non-zero status will cause the transaction to
1252 commit to proceed. A non-zero status will cause the transaction to
1242 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1253 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1243 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1254 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1244
1255
1245 ``preupdate``
1256 ``preupdate``
1246 Run before updating the working directory. Exit status 0 allows
1257 Run before updating the working directory. Exit status 0 allows
1247 the update to proceed. A non-zero status will prevent the update.
1258 the update to proceed. A non-zero status will prevent the update.
1248 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1259 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1249 merge, the ID of second new parent is in ``$HG_PARENT2``.
1260 merge, the ID of second new parent is in ``$HG_PARENT2``.
1250
1261
1251 ``listkeys``
1262 ``listkeys``
1252 Run after listing pushkeys (like bookmarks) in the repository. The
1263 Run after listing pushkeys (like bookmarks) in the repository. The
1253 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1264 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1254 dictionary containing the keys and values.
1265 dictionary containing the keys and values.
1255
1266
1256 ``pushkey``
1267 ``pushkey``
1257 Run after a pushkey (like a bookmark) is added to the
1268 Run after a pushkey (like a bookmark) is added to the
1258 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1269 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1259 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1270 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1260 value is in ``$HG_NEW``.
1271 value is in ``$HG_NEW``.
1261
1272
1262 ``tag``
1273 ``tag``
1263 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1274 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1264 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1275 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1265 the repository if ``$HG_LOCAL=0``.
1276 the repository if ``$HG_LOCAL=0``.
1266
1277
1267 ``update``
1278 ``update``
1268 Run after updating the working directory. The changeset ID of first
1279 Run after updating the working directory. The changeset ID of first
1269 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1280 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1270 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1281 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1271 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1282 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1272
1283
1273 .. note::
1284 .. note::
1274
1285
1275 It is generally better to use standard hooks rather than the
1286 It is generally better to use standard hooks rather than the
1276 generic pre- and post- command hooks, as they are guaranteed to be
1287 generic pre- and post- command hooks, as they are guaranteed to be
1277 called in the appropriate contexts for influencing transactions.
1288 called in the appropriate contexts for influencing transactions.
1278 Also, hooks like "commit" will be called in all contexts that
1289 Also, hooks like "commit" will be called in all contexts that
1279 generate a commit (e.g. tag) and not just the commit command.
1290 generate a commit (e.g. tag) and not just the commit command.
1280
1291
1281 .. note::
1292 .. note::
1282
1293
1283 Environment variables with empty values may not be passed to
1294 Environment variables with empty values may not be passed to
1284 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1295 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1285 will have an empty value under Unix-like platforms for non-merge
1296 will have an empty value under Unix-like platforms for non-merge
1286 changesets, while it will not be available at all under Windows.
1297 changesets, while it will not be available at all under Windows.
1287
1298
1288 The syntax for Python hooks is as follows::
1299 The syntax for Python hooks is as follows::
1289
1300
1290 hookname = python:modulename.submodule.callable
1301 hookname = python:modulename.submodule.callable
1291 hookname = python:/path/to/python/module.py:callable
1302 hookname = python:/path/to/python/module.py:callable
1292
1303
1293 Python hooks are run within the Mercurial process. Each hook is
1304 Python hooks are run within the Mercurial process. Each hook is
1294 called with at least three keyword arguments: a ui object (keyword
1305 called with at least three keyword arguments: a ui object (keyword
1295 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1306 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1296 keyword that tells what kind of hook is used. Arguments listed as
1307 keyword that tells what kind of hook is used. Arguments listed as
1297 environment variables above are passed as keyword arguments, with no
1308 environment variables above are passed as keyword arguments, with no
1298 ``HG_`` prefix, and names in lower case.
1309 ``HG_`` prefix, and names in lower case.
1299
1310
1300 If a Python hook returns a "true" value or raises an exception, this
1311 If a Python hook returns a "true" value or raises an exception, this
1301 is treated as a failure.
1312 is treated as a failure.
1302
1313
1303
1314
1304 ``hostfingerprints``
1315 ``hostfingerprints``
1305 --------------------
1316 --------------------
1306
1317
1307 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1318 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1308
1319
1309 Fingerprints of the certificates of known HTTPS servers.
1320 Fingerprints of the certificates of known HTTPS servers.
1310
1321
1311 A HTTPS connection to a server with a fingerprint configured here will
1322 A HTTPS connection to a server with a fingerprint configured here will
1312 only succeed if the servers certificate matches the fingerprint.
1323 only succeed if the servers certificate matches the fingerprint.
1313 This is very similar to how ssh known hosts works.
1324 This is very similar to how ssh known hosts works.
1314
1325
1315 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1326 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1316 Multiple values can be specified (separated by spaces or commas). This can
1327 Multiple values can be specified (separated by spaces or commas). This can
1317 be used to define both old and new fingerprints while a host transitions
1328 be used to define both old and new fingerprints while a host transitions
1318 to a new certificate.
1329 to a new certificate.
1319
1330
1320 The CA chain and web.cacerts is not used for servers with a fingerprint.
1331 The CA chain and web.cacerts is not used for servers with a fingerprint.
1321
1332
1322 For example::
1333 For example::
1323
1334
1324 [hostfingerprints]
1335 [hostfingerprints]
1325 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1336 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1326 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1337 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1327
1338
1328 ``hostsecurity``
1339 ``hostsecurity``
1329 ----------------
1340 ----------------
1330
1341
1331 Used to specify global and per-host security settings for connecting to
1342 Used to specify global and per-host security settings for connecting to
1332 other machines.
1343 other machines.
1333
1344
1334 The following options control default behavior for all hosts.
1345 The following options control default behavior for all hosts.
1335
1346
1336 ``ciphers``
1347 ``ciphers``
1337 Defines the cryptographic ciphers to use for connections.
1348 Defines the cryptographic ciphers to use for connections.
1338
1349
1339 Value must be a valid OpenSSL Cipher List Format as documented at
1350 Value must be a valid OpenSSL Cipher List Format as documented at
1340 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1351 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1341
1352
1342 This setting is for advanced users only. Setting to incorrect values
1353 This setting is for advanced users only. Setting to incorrect values
1343 can significantly lower connection security or decrease performance.
1354 can significantly lower connection security or decrease performance.
1344 You have been warned.
1355 You have been warned.
1345
1356
1346 This option requires Python 2.7.
1357 This option requires Python 2.7.
1347
1358
1348 ``minimumprotocol``
1359 ``minimumprotocol``
1349 Defines the minimum channel encryption protocol to use.
1360 Defines the minimum channel encryption protocol to use.
1350
1361
1351 By default, the highest version of TLS supported by both client and server
1362 By default, the highest version of TLS supported by both client and server
1352 is used.
1363 is used.
1353
1364
1354 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1365 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1355
1366
1356 When running on an old Python version, only ``tls1.0`` is allowed since
1367 When running on an old Python version, only ``tls1.0`` is allowed since
1357 old versions of Python only support up to TLS 1.0.
1368 old versions of Python only support up to TLS 1.0.
1358
1369
1359 When running a Python that supports modern TLS versions, the default is
1370 When running a Python that supports modern TLS versions, the default is
1360 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1371 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1361 weakens security and should only be used as a feature of last resort if
1372 weakens security and should only be used as a feature of last resort if
1362 a server does not support TLS 1.1+.
1373 a server does not support TLS 1.1+.
1363
1374
1364 Options in the ``[hostsecurity]`` section can have the form
1375 Options in the ``[hostsecurity]`` section can have the form
1365 ``hostname``:``setting``. This allows multiple settings to be defined on a
1376 ``hostname``:``setting``. This allows multiple settings to be defined on a
1366 per-host basis.
1377 per-host basis.
1367
1378
1368 The following per-host settings can be defined.
1379 The following per-host settings can be defined.
1369
1380
1370 ``ciphers``
1381 ``ciphers``
1371 This behaves like ``ciphers`` as described above except it only applies
1382 This behaves like ``ciphers`` as described above except it only applies
1372 to the host on which it is defined.
1383 to the host on which it is defined.
1373
1384
1374 ``fingerprints``
1385 ``fingerprints``
1375 A list of hashes of the DER encoded peer/remote certificate. Values have
1386 A list of hashes of the DER encoded peer/remote certificate. Values have
1376 the form ``algorithm``:``fingerprint``. e.g.
1387 the form ``algorithm``:``fingerprint``. e.g.
1377 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1388 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1378 In addition, colons (``:``) can appear in the fingerprint part.
1389 In addition, colons (``:``) can appear in the fingerprint part.
1379
1390
1380 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1391 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1381 ``sha512``.
1392 ``sha512``.
1382
1393
1383 Use of ``sha256`` or ``sha512`` is preferred.
1394 Use of ``sha256`` or ``sha512`` is preferred.
1384
1395
1385 If a fingerprint is specified, the CA chain is not validated for this
1396 If a fingerprint is specified, the CA chain is not validated for this
1386 host and Mercurial will require the remote certificate to match one
1397 host and Mercurial will require the remote certificate to match one
1387 of the fingerprints specified. This means if the server updates its
1398 of the fingerprints specified. This means if the server updates its
1388 certificate, Mercurial will abort until a new fingerprint is defined.
1399 certificate, Mercurial will abort until a new fingerprint is defined.
1389 This can provide stronger security than traditional CA-based validation
1400 This can provide stronger security than traditional CA-based validation
1390 at the expense of convenience.
1401 at the expense of convenience.
1391
1402
1392 This option takes precedence over ``verifycertsfile``.
1403 This option takes precedence over ``verifycertsfile``.
1393
1404
1394 ``minimumprotocol``
1405 ``minimumprotocol``
1395 This behaves like ``minimumprotocol`` as described above except it
1406 This behaves like ``minimumprotocol`` as described above except it
1396 only applies to the host on which it is defined.
1407 only applies to the host on which it is defined.
1397
1408
1398 ``verifycertsfile``
1409 ``verifycertsfile``
1399 Path to file a containing a list of PEM encoded certificates used to
1410 Path to file a containing a list of PEM encoded certificates used to
1400 verify the server certificate. Environment variables and ``~user``
1411 verify the server certificate. Environment variables and ``~user``
1401 constructs are expanded in the filename.
1412 constructs are expanded in the filename.
1402
1413
1403 The server certificate or the certificate's certificate authority (CA)
1414 The server certificate or the certificate's certificate authority (CA)
1404 must match a certificate from this file or certificate verification
1415 must match a certificate from this file or certificate verification
1405 will fail and connections to the server will be refused.
1416 will fail and connections to the server will be refused.
1406
1417
1407 If defined, only certificates provided by this file will be used:
1418 If defined, only certificates provided by this file will be used:
1408 ``web.cacerts`` and any system/default certificates will not be
1419 ``web.cacerts`` and any system/default certificates will not be
1409 used.
1420 used.
1410
1421
1411 This option has no effect if the per-host ``fingerprints`` option
1422 This option has no effect if the per-host ``fingerprints`` option
1412 is set.
1423 is set.
1413
1424
1414 The format of the file is as follows::
1425 The format of the file is as follows::
1415
1426
1416 -----BEGIN CERTIFICATE-----
1427 -----BEGIN CERTIFICATE-----
1417 ... (certificate in base64 PEM encoding) ...
1428 ... (certificate in base64 PEM encoding) ...
1418 -----END CERTIFICATE-----
1429 -----END CERTIFICATE-----
1419 -----BEGIN CERTIFICATE-----
1430 -----BEGIN CERTIFICATE-----
1420 ... (certificate in base64 PEM encoding) ...
1431 ... (certificate in base64 PEM encoding) ...
1421 -----END CERTIFICATE-----
1432 -----END CERTIFICATE-----
1422
1433
1423 For example::
1434 For example::
1424
1435
1425 [hostsecurity]
1436 [hostsecurity]
1426 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1437 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1427 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
1438 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
1428 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
1439 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
1429 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1440 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1430
1441
1431 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1442 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1432 when connecting to ``hg.example.com``::
1443 when connecting to ``hg.example.com``::
1433
1444
1434 [hostsecurity]
1445 [hostsecurity]
1435 minimumprotocol = tls1.2
1446 minimumprotocol = tls1.2
1436 hg.example.com:minimumprotocol = tls1.1
1447 hg.example.com:minimumprotocol = tls1.1
1437
1448
1438 ``http_proxy``
1449 ``http_proxy``
1439 --------------
1450 --------------
1440
1451
1441 Used to access web-based Mercurial repositories through a HTTP
1452 Used to access web-based Mercurial repositories through a HTTP
1442 proxy.
1453 proxy.
1443
1454
1444 ``host``
1455 ``host``
1445 Host name and (optional) port of the proxy server, for example
1456 Host name and (optional) port of the proxy server, for example
1446 "myproxy:8000".
1457 "myproxy:8000".
1447
1458
1448 ``no``
1459 ``no``
1449 Optional. Comma-separated list of host names that should bypass
1460 Optional. Comma-separated list of host names that should bypass
1450 the proxy.
1461 the proxy.
1451
1462
1452 ``passwd``
1463 ``passwd``
1453 Optional. Password to authenticate with at the proxy server.
1464 Optional. Password to authenticate with at the proxy server.
1454
1465
1455 ``user``
1466 ``user``
1456 Optional. User name to authenticate with at the proxy server.
1467 Optional. User name to authenticate with at the proxy server.
1457
1468
1458 ``always``
1469 ``always``
1459 Optional. Always use the proxy, even for localhost and any entries
1470 Optional. Always use the proxy, even for localhost and any entries
1460 in ``http_proxy.no``. (default: False)
1471 in ``http_proxy.no``. (default: False)
1461
1472
1462 ``http``
1473 ``http``
1463 ----------
1474 ----------
1464
1475
1465 Used to configure access to Mercurial repositories via HTTP.
1476 Used to configure access to Mercurial repositories via HTTP.
1466
1477
1467 ``timeout``
1478 ``timeout``
1468 If set, blocking operations will timeout after that many seconds.
1479 If set, blocking operations will timeout after that many seconds.
1469 (default: None)
1480 (default: None)
1470
1481
1471 ``merge``
1482 ``merge``
1472 ---------
1483 ---------
1473
1484
1474 This section specifies behavior during merges and updates.
1485 This section specifies behavior during merges and updates.
1475
1486
1476 ``checkignored``
1487 ``checkignored``
1477 Controls behavior when an ignored file on disk has the same name as a tracked
1488 Controls behavior when an ignored file on disk has the same name as a tracked
1478 file in the changeset being merged or updated to, and has different
1489 file in the changeset being merged or updated to, and has different
1479 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1490 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1480 abort on such files. With ``warn``, warn on such files and back them up as
1491 abort on such files. With ``warn``, warn on such files and back them up as
1481 ``.orig``. With ``ignore``, don't print a warning and back them up as
1492 ``.orig``. With ``ignore``, don't print a warning and back them up as
1482 ``.orig``. (default: ``abort``)
1493 ``.orig``. (default: ``abort``)
1483
1494
1484 ``checkunknown``
1495 ``checkunknown``
1485 Controls behavior when an unknown file that isn't ignored has the same name
1496 Controls behavior when an unknown file that isn't ignored has the same name
1486 as a tracked file in the changeset being merged or updated to, and has
1497 as a tracked file in the changeset being merged or updated to, and has
1487 different contents. Similar to ``merge.checkignored``, except for files that
1498 different contents. Similar to ``merge.checkignored``, except for files that
1488 are not ignored. (default: ``abort``)
1499 are not ignored. (default: ``abort``)
1489
1500
1490 ``on-failure``
1501 ``on-failure``
1491 When set to ``continue`` (the default), the merge process attempts to
1502 When set to ``continue`` (the default), the merge process attempts to
1492 merge all unresolved files using the merge chosen tool, regardless of
1503 merge all unresolved files using the merge chosen tool, regardless of
1493 whether previous file merge attempts during the process succeeded or not.
1504 whether previous file merge attempts during the process succeeded or not.
1494 Setting this to ``prompt`` will prompt after any merge failure continue
1505 Setting this to ``prompt`` will prompt after any merge failure continue
1495 or halt the merge process. Setting this to ``halt`` will automatically
1506 or halt the merge process. Setting this to ``halt`` will automatically
1496 halt the merge process on any merge tool failure. The merge process
1507 halt the merge process on any merge tool failure. The merge process
1497 can be restarted by using the ``resolve`` command. When a merge is
1508 can be restarted by using the ``resolve`` command. When a merge is
1498 halted, the repository is left in a normal ``unresolved`` merge state.
1509 halted, the repository is left in a normal ``unresolved`` merge state.
1499 (default: ``continue``)
1510 (default: ``continue``)
1500
1511
1501 ``strict-capability-check``
1512 ``strict-capability-check``
1502 Whether capabilities of internal merge tools are checked strictly
1513 Whether capabilities of internal merge tools are checked strictly
1503 or not, while examining rules to decide merge tool to be used.
1514 or not, while examining rules to decide merge tool to be used.
1504 (default: False)
1515 (default: False)
1505
1516
1506 ``merge-patterns``
1517 ``merge-patterns``
1507 ------------------
1518 ------------------
1508
1519
1509 This section specifies merge tools to associate with particular file
1520 This section specifies merge tools to associate with particular file
1510 patterns. Tools matched here will take precedence over the default
1521 patterns. Tools matched here will take precedence over the default
1511 merge tool. Patterns are globs by default, rooted at the repository
1522 merge tool. Patterns are globs by default, rooted at the repository
1512 root.
1523 root.
1513
1524
1514 Example::
1525 Example::
1515
1526
1516 [merge-patterns]
1527 [merge-patterns]
1517 **.c = kdiff3
1528 **.c = kdiff3
1518 **.jpg = myimgmerge
1529 **.jpg = myimgmerge
1519
1530
1520 ``merge-tools``
1531 ``merge-tools``
1521 ---------------
1532 ---------------
1522
1533
1523 This section configures external merge tools to use for file-level
1534 This section configures external merge tools to use for file-level
1524 merges. This section has likely been preconfigured at install time.
1535 merges. This section has likely been preconfigured at install time.
1525 Use :hg:`config merge-tools` to check the existing configuration.
1536 Use :hg:`config merge-tools` to check the existing configuration.
1526 Also see :hg:`help merge-tools` for more details.
1537 Also see :hg:`help merge-tools` for more details.
1527
1538
1528 Example ``~/.hgrc``::
1539 Example ``~/.hgrc``::
1529
1540
1530 [merge-tools]
1541 [merge-tools]
1531 # Override stock tool location
1542 # Override stock tool location
1532 kdiff3.executable = ~/bin/kdiff3
1543 kdiff3.executable = ~/bin/kdiff3
1533 # Specify command line
1544 # Specify command line
1534 kdiff3.args = $base $local $other -o $output
1545 kdiff3.args = $base $local $other -o $output
1535 # Give higher priority
1546 # Give higher priority
1536 kdiff3.priority = 1
1547 kdiff3.priority = 1
1537
1548
1538 # Changing the priority of preconfigured tool
1549 # Changing the priority of preconfigured tool
1539 meld.priority = 0
1550 meld.priority = 0
1540
1551
1541 # Disable a preconfigured tool
1552 # Disable a preconfigured tool
1542 vimdiff.disabled = yes
1553 vimdiff.disabled = yes
1543
1554
1544 # Define new tool
1555 # Define new tool
1545 myHtmlTool.args = -m $local $other $base $output
1556 myHtmlTool.args = -m $local $other $base $output
1546 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1557 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1547 myHtmlTool.priority = 1
1558 myHtmlTool.priority = 1
1548
1559
1549 Supported arguments:
1560 Supported arguments:
1550
1561
1551 ``priority``
1562 ``priority``
1552 The priority in which to evaluate this tool.
1563 The priority in which to evaluate this tool.
1553 (default: 0)
1564 (default: 0)
1554
1565
1555 ``executable``
1566 ``executable``
1556 Either just the name of the executable or its pathname.
1567 Either just the name of the executable or its pathname.
1557
1568
1558 .. container:: windows
1569 .. container:: windows
1559
1570
1560 On Windows, the path can use environment variables with ${ProgramFiles}
1571 On Windows, the path can use environment variables with ${ProgramFiles}
1561 syntax.
1572 syntax.
1562
1573
1563 (default: the tool name)
1574 (default: the tool name)
1564
1575
1565 ``args``
1576 ``args``
1566 The arguments to pass to the tool executable. You can refer to the
1577 The arguments to pass to the tool executable. You can refer to the
1567 files being merged as well as the output file through these
1578 files being merged as well as the output file through these
1568 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1579 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1569
1580
1570 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1581 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1571 being performed. During an update or merge, ``$local`` represents the original
1582 being performed. During an update or merge, ``$local`` represents the original
1572 state of the file, while ``$other`` represents the commit you are updating to or
1583 state of the file, while ``$other`` represents the commit you are updating to or
1573 the commit you are merging with. During a rebase, ``$local`` represents the
1584 the commit you are merging with. During a rebase, ``$local`` represents the
1574 destination of the rebase, and ``$other`` represents the commit being rebased.
1585 destination of the rebase, and ``$other`` represents the commit being rebased.
1575
1586
1576 Some operations define custom labels to assist with identifying the revisions,
1587 Some operations define custom labels to assist with identifying the revisions,
1577 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1588 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1578 labels are not available, these will be ``local``, ``other``, and ``base``,
1589 labels are not available, these will be ``local``, ``other``, and ``base``,
1579 respectively.
1590 respectively.
1580 (default: ``$local $base $other``)
1591 (default: ``$local $base $other``)
1581
1592
1582 ``premerge``
1593 ``premerge``
1583 Attempt to run internal non-interactive 3-way merge tool before
1594 Attempt to run internal non-interactive 3-way merge tool before
1584 launching external tool. Options are ``true``, ``false``, ``keep``,
1595 launching external tool. Options are ``true``, ``false``, ``keep``,
1585 ``keep-merge3``, or ``keep-mergediff`` (experimental). The ``keep`` option
1596 ``keep-merge3``, or ``keep-mergediff`` (experimental). The ``keep`` option
1586 will leave markers in the file if the premerge fails. The ``keep-merge3``
1597 will leave markers in the file if the premerge fails. The ``keep-merge3``
1587 will do the same but include information about the base of the merge in the
1598 will do the same but include information about the base of the merge in the
1588 marker (see internal :merge3 in :hg:`help merge-tools`). The
1599 marker (see internal :merge3 in :hg:`help merge-tools`). The
1589 ``keep-mergediff`` option is similar but uses a different marker style
1600 ``keep-mergediff`` option is similar but uses a different marker style
1590 (see internal :merge3 in :hg:`help merge-tools`). (default: True)
1601 (see internal :merge3 in :hg:`help merge-tools`). (default: True)
1591
1602
1592 ``binary``
1603 ``binary``
1593 This tool can merge binary files. (default: False, unless tool
1604 This tool can merge binary files. (default: False, unless tool
1594 was selected by file pattern match)
1605 was selected by file pattern match)
1595
1606
1596 ``symlink``
1607 ``symlink``
1597 This tool can merge symlinks. (default: False)
1608 This tool can merge symlinks. (default: False)
1598
1609
1599 ``check``
1610 ``check``
1600 A list of merge success-checking options:
1611 A list of merge success-checking options:
1601
1612
1602 ``changed``
1613 ``changed``
1603 Ask whether merge was successful when the merged file shows no changes.
1614 Ask whether merge was successful when the merged file shows no changes.
1604 ``conflicts``
1615 ``conflicts``
1605 Check whether there are conflicts even though the tool reported success.
1616 Check whether there are conflicts even though the tool reported success.
1606 ``prompt``
1617 ``prompt``
1607 Always prompt for merge success, regardless of success reported by tool.
1618 Always prompt for merge success, regardless of success reported by tool.
1608
1619
1609 ``fixeol``
1620 ``fixeol``
1610 Attempt to fix up EOL changes caused by the merge tool.
1621 Attempt to fix up EOL changes caused by the merge tool.
1611 (default: False)
1622 (default: False)
1612
1623
1613 ``gui``
1624 ``gui``
1614 This tool requires a graphical interface to run. (default: False)
1625 This tool requires a graphical interface to run. (default: False)
1615
1626
1616 ``mergemarkers``
1627 ``mergemarkers``
1617 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1628 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1618 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1629 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1619 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1630 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1620 markers generated during premerge will be ``detailed`` if either this option or
1631 markers generated during premerge will be ``detailed`` if either this option or
1621 the corresponding option in the ``[ui]`` section is ``detailed``.
1632 the corresponding option in the ``[ui]`` section is ``detailed``.
1622 (default: ``basic``)
1633 (default: ``basic``)
1623
1634
1624 ``mergemarkertemplate``
1635 ``mergemarkertemplate``
1625 This setting can be used to override ``mergemarker`` from the
1636 This setting can be used to override ``mergemarker`` from the
1626 ``[command-templates]`` section on a per-tool basis; this applies to the
1637 ``[command-templates]`` section on a per-tool basis; this applies to the
1627 ``$label``-prefixed variables and to the conflict markers that are generated
1638 ``$label``-prefixed variables and to the conflict markers that are generated
1628 if ``premerge`` is ``keep` or ``keep-merge3``. See the corresponding variable
1639 if ``premerge`` is ``keep` or ``keep-merge3``. See the corresponding variable
1629 in ``[ui]`` for more information.
1640 in ``[ui]`` for more information.
1630
1641
1631 .. container:: windows
1642 .. container:: windows
1632
1643
1633 ``regkey``
1644 ``regkey``
1634 Windows registry key which describes install location of this
1645 Windows registry key which describes install location of this
1635 tool. Mercurial will search for this key first under
1646 tool. Mercurial will search for this key first under
1636 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1647 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1637 (default: None)
1648 (default: None)
1638
1649
1639 ``regkeyalt``
1650 ``regkeyalt``
1640 An alternate Windows registry key to try if the first key is not
1651 An alternate Windows registry key to try if the first key is not
1641 found. The alternate key uses the same ``regname`` and ``regappend``
1652 found. The alternate key uses the same ``regname`` and ``regappend``
1642 semantics of the primary key. The most common use for this key
1653 semantics of the primary key. The most common use for this key
1643 is to search for 32bit applications on 64bit operating systems.
1654 is to search for 32bit applications on 64bit operating systems.
1644 (default: None)
1655 (default: None)
1645
1656
1646 ``regname``
1657 ``regname``
1647 Name of value to read from specified registry key.
1658 Name of value to read from specified registry key.
1648 (default: the unnamed (default) value)
1659 (default: the unnamed (default) value)
1649
1660
1650 ``regappend``
1661 ``regappend``
1651 String to append to the value read from the registry, typically
1662 String to append to the value read from the registry, typically
1652 the executable name of the tool.
1663 the executable name of the tool.
1653 (default: None)
1664 (default: None)
1654
1665
1655 ``pager``
1666 ``pager``
1656 ---------
1667 ---------
1657
1668
1658 Setting used to control when to paginate and with what external tool. See
1669 Setting used to control when to paginate and with what external tool. See
1659 :hg:`help pager` for details.
1670 :hg:`help pager` for details.
1660
1671
1661 ``pager``
1672 ``pager``
1662 Define the external tool used as pager.
1673 Define the external tool used as pager.
1663
1674
1664 If no pager is set, Mercurial uses the environment variable $PAGER.
1675 If no pager is set, Mercurial uses the environment variable $PAGER.
1665 If neither pager.pager, nor $PAGER is set, a default pager will be
1676 If neither pager.pager, nor $PAGER is set, a default pager will be
1666 used, typically `less` on Unix and `more` on Windows. Example::
1677 used, typically `less` on Unix and `more` on Windows. Example::
1667
1678
1668 [pager]
1679 [pager]
1669 pager = less -FRX
1680 pager = less -FRX
1670
1681
1671 ``ignore``
1682 ``ignore``
1672 List of commands to disable the pager for. Example::
1683 List of commands to disable the pager for. Example::
1673
1684
1674 [pager]
1685 [pager]
1675 ignore = version, help, update
1686 ignore = version, help, update
1676
1687
1677 ``patch``
1688 ``patch``
1678 ---------
1689 ---------
1679
1690
1680 Settings used when applying patches, for instance through the 'import'
1691 Settings used when applying patches, for instance through the 'import'
1681 command or with Mercurial Queues extension.
1692 command or with Mercurial Queues extension.
1682
1693
1683 ``eol``
1694 ``eol``
1684 When set to 'strict' patch content and patched files end of lines
1695 When set to 'strict' patch content and patched files end of lines
1685 are preserved. When set to ``lf`` or ``crlf``, both files end of
1696 are preserved. When set to ``lf`` or ``crlf``, both files end of
1686 lines are ignored when patching and the result line endings are
1697 lines are ignored when patching and the result line endings are
1687 normalized to either LF (Unix) or CRLF (Windows). When set to
1698 normalized to either LF (Unix) or CRLF (Windows). When set to
1688 ``auto``, end of lines are again ignored while patching but line
1699 ``auto``, end of lines are again ignored while patching but line
1689 endings in patched files are normalized to their original setting
1700 endings in patched files are normalized to their original setting
1690 on a per-file basis. If target file does not exist or has no end
1701 on a per-file basis. If target file does not exist or has no end
1691 of line, patch line endings are preserved.
1702 of line, patch line endings are preserved.
1692 (default: strict)
1703 (default: strict)
1693
1704
1694 ``fuzz``
1705 ``fuzz``
1695 The number of lines of 'fuzz' to allow when applying patches. This
1706 The number of lines of 'fuzz' to allow when applying patches. This
1696 controls how much context the patcher is allowed to ignore when
1707 controls how much context the patcher is allowed to ignore when
1697 trying to apply a patch.
1708 trying to apply a patch.
1698 (default: 2)
1709 (default: 2)
1699
1710
1700 ``paths``
1711 ``paths``
1701 ---------
1712 ---------
1702
1713
1703 Assigns symbolic names and behavior to repositories.
1714 Assigns symbolic names and behavior to repositories.
1704
1715
1705 Options are symbolic names defining the URL or directory that is the
1716 Options are symbolic names defining the URL or directory that is the
1706 location of the repository. Example::
1717 location of the repository. Example::
1707
1718
1708 [paths]
1719 [paths]
1709 my_server = https://example.com/my_repo
1720 my_server = https://example.com/my_repo
1710 local_path = /home/me/repo
1721 local_path = /home/me/repo
1711
1722
1712 These symbolic names can be used from the command line. To pull
1723 These symbolic names can be used from the command line. To pull
1713 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1724 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1714 :hg:`push local_path`. You can check :hg:`help urls` for details about
1725 :hg:`push local_path`. You can check :hg:`help urls` for details about
1715 valid URLs.
1726 valid URLs.
1716
1727
1717 Options containing colons (``:``) denote sub-options that can influence
1728 Options containing colons (``:``) denote sub-options that can influence
1718 behavior for that specific path. Example::
1729 behavior for that specific path. Example::
1719
1730
1720 [paths]
1731 [paths]
1721 my_server = https://example.com/my_path
1732 my_server = https://example.com/my_path
1722 my_server:pushurl = ssh://example.com/my_path
1733 my_server:pushurl = ssh://example.com/my_path
1723
1734
1724 Paths using the `path://otherpath` scheme will inherit the sub-options value from
1735 Paths using the `path://otherpath` scheme will inherit the sub-options value from
1725 the path they point to.
1736 the path they point to.
1726
1737
1727 The following sub-options can be defined:
1738 The following sub-options can be defined:
1728
1739
1729 ``multi-urls``
1740 ``multi-urls``
1730 A boolean option. When enabled the value of the `[paths]` entry will be
1741 A boolean option. When enabled the value of the `[paths]` entry will be
1731 parsed as a list and the alias will resolve to multiple destination. If some
1742 parsed as a list and the alias will resolve to multiple destination. If some
1732 of the list entry use the `path://` syntax, the suboption will be inherited
1743 of the list entry use the `path://` syntax, the suboption will be inherited
1733 individually.
1744 individually.
1734
1745
1735 ``pushurl``
1746 ``pushurl``
1736 The URL to use for push operations. If not defined, the location
1747 The URL to use for push operations. If not defined, the location
1737 defined by the path's main entry is used.
1748 defined by the path's main entry is used.
1738
1749
1739 ``pushrev``
1750 ``pushrev``
1740 A revset defining which revisions to push by default.
1751 A revset defining which revisions to push by default.
1741
1752
1742 When :hg:`push` is executed without a ``-r`` argument, the revset
1753 When :hg:`push` is executed without a ``-r`` argument, the revset
1743 defined by this sub-option is evaluated to determine what to push.
1754 defined by this sub-option is evaluated to determine what to push.
1744
1755
1745 For example, a value of ``.`` will push the working directory's
1756 For example, a value of ``.`` will push the working directory's
1746 revision by default.
1757 revision by default.
1747
1758
1748 Revsets specifying bookmarks will not result in the bookmark being
1759 Revsets specifying bookmarks will not result in the bookmark being
1749 pushed.
1760 pushed.
1750
1761
1751 ``bookmarks.mode``
1762 ``bookmarks.mode``
1752 How bookmark will be dealt during the exchange. It support the following value
1763 How bookmark will be dealt during the exchange. It support the following value
1753
1764
1754 - ``default``: the default behavior, local and remote bookmarks are "merged"
1765 - ``default``: the default behavior, local and remote bookmarks are "merged"
1755 on push/pull.
1766 on push/pull.
1756
1767
1757 - ``mirror``: when pulling, replace local bookmarks by remote bookmarks. This
1768 - ``mirror``: when pulling, replace local bookmarks by remote bookmarks. This
1758 is useful to replicate a repository, or as an optimization.
1769 is useful to replicate a repository, or as an optimization.
1759
1770
1760 - ``ignore``: ignore bookmarks during exchange.
1771 - ``ignore``: ignore bookmarks during exchange.
1761 (This currently only affect pulling)
1772 (This currently only affect pulling)
1762
1773
1763 The following special named paths exist:
1774 The following special named paths exist:
1764
1775
1765 ``default``
1776 ``default``
1766 The URL or directory to use when no source or remote is specified.
1777 The URL or directory to use when no source or remote is specified.
1767
1778
1768 :hg:`clone` will automatically define this path to the location the
1779 :hg:`clone` will automatically define this path to the location the
1769 repository was cloned from.
1780 repository was cloned from.
1770
1781
1771 ``default-push``
1782 ``default-push``
1772 (deprecated) The URL or directory for the default :hg:`push` location.
1783 (deprecated) The URL or directory for the default :hg:`push` location.
1773 ``default:pushurl`` should be used instead.
1784 ``default:pushurl`` should be used instead.
1774
1785
1775 ``phases``
1786 ``phases``
1776 ----------
1787 ----------
1777
1788
1778 Specifies default handling of phases. See :hg:`help phases` for more
1789 Specifies default handling of phases. See :hg:`help phases` for more
1779 information about working with phases.
1790 information about working with phases.
1780
1791
1781 ``publish``
1792 ``publish``
1782 Controls draft phase behavior when working as a server. When true,
1793 Controls draft phase behavior when working as a server. When true,
1783 pushed changesets are set to public in both client and server and
1794 pushed changesets are set to public in both client and server and
1784 pulled or cloned changesets are set to public in the client.
1795 pulled or cloned changesets are set to public in the client.
1785 (default: True)
1796 (default: True)
1786
1797
1787 ``new-commit``
1798 ``new-commit``
1788 Phase of newly-created commits.
1799 Phase of newly-created commits.
1789 (default: draft)
1800 (default: draft)
1790
1801
1791 ``checksubrepos``
1802 ``checksubrepos``
1792 Check the phase of the current revision of each subrepository. Allowed
1803 Check the phase of the current revision of each subrepository. Allowed
1793 values are "ignore", "follow" and "abort". For settings other than
1804 values are "ignore", "follow" and "abort". For settings other than
1794 "ignore", the phase of the current revision of each subrepository is
1805 "ignore", the phase of the current revision of each subrepository is
1795 checked before committing the parent repository. If any of those phases is
1806 checked before committing the parent repository. If any of those phases is
1796 greater than the phase of the parent repository (e.g. if a subrepo is in a
1807 greater than the phase of the parent repository (e.g. if a subrepo is in a
1797 "secret" phase while the parent repo is in "draft" phase), the commit is
1808 "secret" phase while the parent repo is in "draft" phase), the commit is
1798 either aborted (if checksubrepos is set to "abort") or the higher phase is
1809 either aborted (if checksubrepos is set to "abort") or the higher phase is
1799 used for the parent repository commit (if set to "follow").
1810 used for the parent repository commit (if set to "follow").
1800 (default: follow)
1811 (default: follow)
1801
1812
1802
1813
1803 ``profiling``
1814 ``profiling``
1804 -------------
1815 -------------
1805
1816
1806 Specifies profiling type, format, and file output. Two profilers are
1817 Specifies profiling type, format, and file output. Two profilers are
1807 supported: an instrumenting profiler (named ``ls``), and a sampling
1818 supported: an instrumenting profiler (named ``ls``), and a sampling
1808 profiler (named ``stat``).
1819 profiler (named ``stat``).
1809
1820
1810 In this section description, 'profiling data' stands for the raw data
1821 In this section description, 'profiling data' stands for the raw data
1811 collected during profiling, while 'profiling report' stands for a
1822 collected during profiling, while 'profiling report' stands for a
1812 statistical text report generated from the profiling data.
1823 statistical text report generated from the profiling data.
1813
1824
1814 ``enabled``
1825 ``enabled``
1815 Enable the profiler.
1826 Enable the profiler.
1816 (default: false)
1827 (default: false)
1817
1828
1818 This is equivalent to passing ``--profile`` on the command line.
1829 This is equivalent to passing ``--profile`` on the command line.
1819
1830
1820 ``type``
1831 ``type``
1821 The type of profiler to use.
1832 The type of profiler to use.
1822 (default: stat)
1833 (default: stat)
1823
1834
1824 ``ls``
1835 ``ls``
1825 Use Python's built-in instrumenting profiler. This profiler
1836 Use Python's built-in instrumenting profiler. This profiler
1826 works on all platforms, but each line number it reports is the
1837 works on all platforms, but each line number it reports is the
1827 first line of a function. This restriction makes it difficult to
1838 first line of a function. This restriction makes it difficult to
1828 identify the expensive parts of a non-trivial function.
1839 identify the expensive parts of a non-trivial function.
1829 ``stat``
1840 ``stat``
1830 Use a statistical profiler, statprof. This profiler is most
1841 Use a statistical profiler, statprof. This profiler is most
1831 useful for profiling commands that run for longer than about 0.1
1842 useful for profiling commands that run for longer than about 0.1
1832 seconds.
1843 seconds.
1833
1844
1834 ``format``
1845 ``format``
1835 Profiling format. Specific to the ``ls`` instrumenting profiler.
1846 Profiling format. Specific to the ``ls`` instrumenting profiler.
1836 (default: text)
1847 (default: text)
1837
1848
1838 ``text``
1849 ``text``
1839 Generate a profiling report. When saving to a file, it should be
1850 Generate a profiling report. When saving to a file, it should be
1840 noted that only the report is saved, and the profiling data is
1851 noted that only the report is saved, and the profiling data is
1841 not kept.
1852 not kept.
1842 ``kcachegrind``
1853 ``kcachegrind``
1843 Format profiling data for kcachegrind use: when saving to a
1854 Format profiling data for kcachegrind use: when saving to a
1844 file, the generated file can directly be loaded into
1855 file, the generated file can directly be loaded into
1845 kcachegrind.
1856 kcachegrind.
1846
1857
1847 ``statformat``
1858 ``statformat``
1848 Profiling format for the ``stat`` profiler.
1859 Profiling format for the ``stat`` profiler.
1849 (default: hotpath)
1860 (default: hotpath)
1850
1861
1851 ``hotpath``
1862 ``hotpath``
1852 Show a tree-based display containing the hot path of execution (where
1863 Show a tree-based display containing the hot path of execution (where
1853 most time was spent).
1864 most time was spent).
1854 ``bymethod``
1865 ``bymethod``
1855 Show a table of methods ordered by how frequently they are active.
1866 Show a table of methods ordered by how frequently they are active.
1856 ``byline``
1867 ``byline``
1857 Show a table of lines in files ordered by how frequently they are active.
1868 Show a table of lines in files ordered by how frequently they are active.
1858 ``json``
1869 ``json``
1859 Render profiling data as JSON.
1870 Render profiling data as JSON.
1860
1871
1861 ``freq``
1872 ``freq``
1862 Sampling frequency. Specific to the ``stat`` sampling profiler.
1873 Sampling frequency. Specific to the ``stat`` sampling profiler.
1863 (default: 1000)
1874 (default: 1000)
1864
1875
1865 ``output``
1876 ``output``
1866 File path where profiling data or report should be saved. If the
1877 File path where profiling data or report should be saved. If the
1867 file exists, it is replaced. (default: None, data is printed on
1878 file exists, it is replaced. (default: None, data is printed on
1868 stderr)
1879 stderr)
1869
1880
1870 ``sort``
1881 ``sort``
1871 Sort field. Specific to the ``ls`` instrumenting profiler.
1882 Sort field. Specific to the ``ls`` instrumenting profiler.
1872 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1883 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1873 ``inlinetime``.
1884 ``inlinetime``.
1874 (default: inlinetime)
1885 (default: inlinetime)
1875
1886
1876 ``time-track``
1887 ``time-track``
1877 Control if the stat profiler track ``cpu`` or ``real`` time.
1888 Control if the stat profiler track ``cpu`` or ``real`` time.
1878 (default: ``cpu`` on Windows, otherwise ``real``)
1889 (default: ``cpu`` on Windows, otherwise ``real``)
1879
1890
1880 ``limit``
1891 ``limit``
1881 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1892 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1882 (default: 30)
1893 (default: 30)
1883
1894
1884 ``nested``
1895 ``nested``
1885 Show at most this number of lines of drill-down info after each main entry.
1896 Show at most this number of lines of drill-down info after each main entry.
1886 This can help explain the difference between Total and Inline.
1897 This can help explain the difference between Total and Inline.
1887 Specific to the ``ls`` instrumenting profiler.
1898 Specific to the ``ls`` instrumenting profiler.
1888 (default: 0)
1899 (default: 0)
1889
1900
1890 ``showmin``
1901 ``showmin``
1891 Minimum fraction of samples an entry must have for it to be displayed.
1902 Minimum fraction of samples an entry must have for it to be displayed.
1892 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1903 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1893 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1904 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1894
1905
1895 Only used by the ``stat`` profiler.
1906 Only used by the ``stat`` profiler.
1896
1907
1897 For the ``hotpath`` format, default is ``0.05``.
1908 For the ``hotpath`` format, default is ``0.05``.
1898 For the ``chrome`` format, default is ``0.005``.
1909 For the ``chrome`` format, default is ``0.005``.
1899
1910
1900 The option is unused on other formats.
1911 The option is unused on other formats.
1901
1912
1902 ``showmax``
1913 ``showmax``
1903 Maximum fraction of samples an entry can have before it is ignored in
1914 Maximum fraction of samples an entry can have before it is ignored in
1904 display. Values format is the same as ``showmin``.
1915 display. Values format is the same as ``showmin``.
1905
1916
1906 Only used by the ``stat`` profiler.
1917 Only used by the ``stat`` profiler.
1907
1918
1908 For the ``chrome`` format, default is ``0.999``.
1919 For the ``chrome`` format, default is ``0.999``.
1909
1920
1910 The option is unused on other formats.
1921 The option is unused on other formats.
1911
1922
1912 ``showtime``
1923 ``showtime``
1913 Show time taken as absolute durations, in addition to percentages.
1924 Show time taken as absolute durations, in addition to percentages.
1914 Only used by the ``hotpath`` format.
1925 Only used by the ``hotpath`` format.
1915 (default: true)
1926 (default: true)
1916
1927
1917 ``progress``
1928 ``progress``
1918 ------------
1929 ------------
1919
1930
1920 Mercurial commands can draw progress bars that are as informative as
1931 Mercurial commands can draw progress bars that are as informative as
1921 possible. Some progress bars only offer indeterminate information, while others
1932 possible. Some progress bars only offer indeterminate information, while others
1922 have a definite end point.
1933 have a definite end point.
1923
1934
1924 ``debug``
1935 ``debug``
1925 Whether to print debug info when updating the progress bar. (default: False)
1936 Whether to print debug info when updating the progress bar. (default: False)
1926
1937
1927 ``delay``
1938 ``delay``
1928 Number of seconds (float) before showing the progress bar. (default: 3)
1939 Number of seconds (float) before showing the progress bar. (default: 3)
1929
1940
1930 ``changedelay``
1941 ``changedelay``
1931 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1942 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1932 that value will be used instead. (default: 1)
1943 that value will be used instead. (default: 1)
1933
1944
1934 ``estimateinterval``
1945 ``estimateinterval``
1935 Maximum sampling interval in seconds for speed and estimated time
1946 Maximum sampling interval in seconds for speed and estimated time
1936 calculation. (default: 60)
1947 calculation. (default: 60)
1937
1948
1938 ``refresh``
1949 ``refresh``
1939 Time in seconds between refreshes of the progress bar. (default: 0.1)
1950 Time in seconds between refreshes of the progress bar. (default: 0.1)
1940
1951
1941 ``format``
1952 ``format``
1942 Format of the progress bar.
1953 Format of the progress bar.
1943
1954
1944 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1955 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1945 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1956 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1946 last 20 characters of the item, but this can be changed by adding either
1957 last 20 characters of the item, but this can be changed by adding either
1947 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1958 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1948 first num characters.
1959 first num characters.
1949
1960
1950 (default: topic bar number estimate)
1961 (default: topic bar number estimate)
1951
1962
1952 ``width``
1963 ``width``
1953 If set, the maximum width of the progress information (that is, min(width,
1964 If set, the maximum width of the progress information (that is, min(width,
1954 term width) will be used).
1965 term width) will be used).
1955
1966
1956 ``clear-complete``
1967 ``clear-complete``
1957 Clear the progress bar after it's done. (default: True)
1968 Clear the progress bar after it's done. (default: True)
1958
1969
1959 ``disable``
1970 ``disable``
1960 If true, don't show a progress bar.
1971 If true, don't show a progress bar.
1961
1972
1962 ``assume-tty``
1973 ``assume-tty``
1963 If true, ALWAYS show a progress bar, unless disable is given.
1974 If true, ALWAYS show a progress bar, unless disable is given.
1964
1975
1965 ``rebase``
1976 ``rebase``
1966 ----------
1977 ----------
1967
1978
1968 ``evolution.allowdivergence``
1979 ``evolution.allowdivergence``
1969 Default to False, when True allow creating divergence when performing
1980 Default to False, when True allow creating divergence when performing
1970 rebase of obsolete changesets.
1981 rebase of obsolete changesets.
1971
1982
1972 ``revsetalias``
1983 ``revsetalias``
1973 ---------------
1984 ---------------
1974
1985
1975 Alias definitions for revsets. See :hg:`help revsets` for details.
1986 Alias definitions for revsets. See :hg:`help revsets` for details.
1976
1987
1977 ``rewrite``
1988 ``rewrite``
1978 -----------
1989 -----------
1979
1990
1980 ``backup-bundle``
1991 ``backup-bundle``
1981 Whether to save stripped changesets to a bundle file. (default: True)
1992 Whether to save stripped changesets to a bundle file. (default: True)
1982
1993
1983 ``update-timestamp``
1994 ``update-timestamp``
1984 If true, updates the date and time of the changeset to current. It is only
1995 If true, updates the date and time of the changeset to current. It is only
1985 applicable for `hg amend`, `hg commit --amend` and `hg uncommit` in the
1996 applicable for `hg amend`, `hg commit --amend` and `hg uncommit` in the
1986 current version.
1997 current version.
1987
1998
1988 ``empty-successor``
1999 ``empty-successor``
1989
2000
1990 Control what happens with empty successors that are the result of rewrite
2001 Control what happens with empty successors that are the result of rewrite
1991 operations. If set to ``skip``, the successor is not created. If set to
2002 operations. If set to ``skip``, the successor is not created. If set to
1992 ``keep``, the empty successor is created and kept.
2003 ``keep``, the empty successor is created and kept.
1993
2004
1994 Currently, only the rebase and absorb commands consider this configuration.
2005 Currently, only the rebase and absorb commands consider this configuration.
1995 (EXPERIMENTAL)
2006 (EXPERIMENTAL)
1996
2007
1997 ``share``
2008 ``share``
1998 ---------
2009 ---------
1999
2010
2000 ``safe-mismatch.source-safe``
2011 ``safe-mismatch.source-safe``
2001
2012
2002 Controls what happens when the shared repository does not use the
2013 Controls what happens when the shared repository does not use the
2003 share-safe mechanism but its source repository does.
2014 share-safe mechanism but its source repository does.
2004
2015
2005 Possible values are `abort` (default), `allow`, `upgrade-abort` and
2016 Possible values are `abort` (default), `allow`, `upgrade-abort` and
2006 `upgrade-abort`.
2017 `upgrade-abort`.
2007
2018
2008 ``abort``
2019 ``abort``
2009 Disallows running any command and aborts
2020 Disallows running any command and aborts
2010 ``allow``
2021 ``allow``
2011 Respects the feature presence in the share source
2022 Respects the feature presence in the share source
2012 ``upgrade-abort``
2023 ``upgrade-abort``
2013 tries to upgrade the share to use share-safe; if it fails, aborts
2024 tries to upgrade the share to use share-safe; if it fails, aborts
2014 ``upgrade-allow``
2025 ``upgrade-allow``
2015 tries to upgrade the share; if it fails, continue by
2026 tries to upgrade the share; if it fails, continue by
2016 respecting the share source setting
2027 respecting the share source setting
2017
2028
2018 Check :hg:`help config format.use-share-safe` for details about the
2029 Check :hg:`help config format.use-share-safe` for details about the
2019 share-safe feature.
2030 share-safe feature.
2020
2031
2021 ``safe-mismatch.source-safe.warn``
2032 ``safe-mismatch.source-safe.warn``
2022 Shows a warning on operations if the shared repository does not use
2033 Shows a warning on operations if the shared repository does not use
2023 share-safe, but the source repository does.
2034 share-safe, but the source repository does.
2024 (default: True)
2035 (default: True)
2025
2036
2026 ``safe-mismatch.source-not-safe``
2037 ``safe-mismatch.source-not-safe``
2027
2038
2028 Controls what happens when the shared repository uses the share-safe
2039 Controls what happens when the shared repository uses the share-safe
2029 mechanism but its source does not.
2040 mechanism but its source does not.
2030
2041
2031 Possible values are `abort` (default), `allow`, `downgrade-abort` and
2042 Possible values are `abort` (default), `allow`, `downgrade-abort` and
2032 `downgrade-abort`.
2043 `downgrade-abort`.
2033
2044
2034 ``abort``
2045 ``abort``
2035 Disallows running any command and aborts
2046 Disallows running any command and aborts
2036 ``allow``
2047 ``allow``
2037 Respects the feature presence in the share source
2048 Respects the feature presence in the share source
2038 ``downgrade-abort``
2049 ``downgrade-abort``
2039 tries to downgrade the share to not use share-safe; if it fails, aborts
2050 tries to downgrade the share to not use share-safe; if it fails, aborts
2040 ``downgrade-allow``
2051 ``downgrade-allow``
2041 tries to downgrade the share to not use share-safe;
2052 tries to downgrade the share to not use share-safe;
2042 if it fails, continue by respecting the shared source setting
2053 if it fails, continue by respecting the shared source setting
2043
2054
2044 Check :hg:`help config format.use-share-safe` for details about the
2055 Check :hg:`help config format.use-share-safe` for details about the
2045 share-safe feature.
2056 share-safe feature.
2046
2057
2047 ``safe-mismatch.source-not-safe.warn``
2058 ``safe-mismatch.source-not-safe.warn``
2048 Shows a warning on operations if the shared repository uses share-safe,
2059 Shows a warning on operations if the shared repository uses share-safe,
2049 but the source repository does not.
2060 but the source repository does not.
2050 (default: True)
2061 (default: True)
2051
2062
2052 ``storage``
2063 ``storage``
2053 -----------
2064 -----------
2054
2065
2055 Control the strategy Mercurial uses internally to store history. Options in this
2066 Control the strategy Mercurial uses internally to store history. Options in this
2056 category impact performance and repository size.
2067 category impact performance and repository size.
2057
2068
2058 ``revlog.issue6528.fix-incoming``
2069 ``revlog.issue6528.fix-incoming``
2059 Version 5.8 of Mercurial had a bug leading to altering the parent of file
2070 Version 5.8 of Mercurial had a bug leading to altering the parent of file
2060 revision with copy information (or any other metadata) on exchange. This
2071 revision with copy information (or any other metadata) on exchange. This
2061 leads to the copy metadata to be overlooked by various internal logic. The
2072 leads to the copy metadata to be overlooked by various internal logic. The
2062 issue was fixed in Mercurial 5.8.1.
2073 issue was fixed in Mercurial 5.8.1.
2063 (See https://bz.mercurial-scm.org/show_bug.cgi?id=6528 for details)
2074 (See https://bz.mercurial-scm.org/show_bug.cgi?id=6528 for details)
2064
2075
2065 As a result Mercurial is now checking and fixing incoming file revisions to
2076 As a result Mercurial is now checking and fixing incoming file revisions to
2066 make sure there parents are in the right order. This behavior can be
2077 make sure there parents are in the right order. This behavior can be
2067 disabled by setting this option to `no`. This apply to revisions added
2078 disabled by setting this option to `no`. This apply to revisions added
2068 through push, pull, clone and unbundle.
2079 through push, pull, clone and unbundle.
2069
2080
2070 To fix affected revisions that already exist within the repository, one can
2081 To fix affected revisions that already exist within the repository, one can
2071 use :hg:`debug-repair-issue-6528`.
2082 use :hg:`debug-repair-issue-6528`.
2072
2083
2073 ``revlog.optimize-delta-parent-choice``
2084 ``revlog.optimize-delta-parent-choice``
2074 When storing a merge revision, both parents will be equally considered as
2085 When storing a merge revision, both parents will be equally considered as
2075 a possible delta base. This results in better delta selection and improved
2086 a possible delta base. This results in better delta selection and improved
2076 revlog compression. This option is enabled by default.
2087 revlog compression. This option is enabled by default.
2077
2088
2078 Turning this option off can result in large increase of repository size for
2089 Turning this option off can result in large increase of repository size for
2079 repository with many merges.
2090 repository with many merges.
2080
2091
2081 ``revlog.persistent-nodemap.mmap``
2092 ``revlog.persistent-nodemap.mmap``
2082 Whether to use the Operating System "memory mapping" feature (when
2093 Whether to use the Operating System "memory mapping" feature (when
2083 possible) to access the persistent nodemap data. This improve performance
2094 possible) to access the persistent nodemap data. This improve performance
2084 and reduce memory pressure.
2095 and reduce memory pressure.
2085
2096
2086 Default to True.
2097 Default to True.
2087
2098
2088 For details on the "persistent-nodemap" feature, see:
2099 For details on the "persistent-nodemap" feature, see:
2089 :hg:`help config format.use-persistent-nodemap`.
2100 :hg:`help config format.use-persistent-nodemap`.
2090
2101
2091 ``revlog.persistent-nodemap.slow-path``
2102 ``revlog.persistent-nodemap.slow-path``
2092 Control the behavior of Merucrial when using a repository with "persistent"
2103 Control the behavior of Merucrial when using a repository with "persistent"
2093 nodemap with an installation of Mercurial without a fast implementation for
2104 nodemap with an installation of Mercurial without a fast implementation for
2094 the feature:
2105 the feature:
2095
2106
2096 ``allow``: Silently use the slower implementation to access the repository.
2107 ``allow``: Silently use the slower implementation to access the repository.
2097 ``warn``: Warn, but use the slower implementation to access the repository.
2108 ``warn``: Warn, but use the slower implementation to access the repository.
2098 ``abort``: Prevent access to such repositories. (This is the default)
2109 ``abort``: Prevent access to such repositories. (This is the default)
2099
2110
2100 For details on the "persistent-nodemap" feature, see:
2111 For details on the "persistent-nodemap" feature, see:
2101 :hg:`help config format.use-persistent-nodemap`.
2112 :hg:`help config format.use-persistent-nodemap`.
2102
2113
2103 ``revlog.reuse-external-delta-parent``
2114 ``revlog.reuse-external-delta-parent``
2104 Control the order in which delta parents are considered when adding new
2115 Control the order in which delta parents are considered when adding new
2105 revisions from an external source.
2116 revisions from an external source.
2106 (typically: apply bundle from `hg pull` or `hg push`).
2117 (typically: apply bundle from `hg pull` or `hg push`).
2107
2118
2108 New revisions are usually provided as a delta against other revisions. By
2119 New revisions are usually provided as a delta against other revisions. By
2109 default, Mercurial will try to reuse this delta first, therefore using the
2120 default, Mercurial will try to reuse this delta first, therefore using the
2110 same "delta parent" as the source. Directly using delta's from the source
2121 same "delta parent" as the source. Directly using delta's from the source
2111 reduces CPU usage and usually speeds up operation. However, in some case,
2122 reduces CPU usage and usually speeds up operation. However, in some case,
2112 the source might have sub-optimal delta bases and forcing their reevaluation
2123 the source might have sub-optimal delta bases and forcing their reevaluation
2113 is useful. For example, pushes from an old client could have sub-optimal
2124 is useful. For example, pushes from an old client could have sub-optimal
2114 delta's parent that the server want to optimize. (lack of general delta, bad
2125 delta's parent that the server want to optimize. (lack of general delta, bad
2115 parents, choice, lack of sparse-revlog, etc).
2126 parents, choice, lack of sparse-revlog, etc).
2116
2127
2117 This option is enabled by default. Turning it off will ensure bad delta
2128 This option is enabled by default. Turning it off will ensure bad delta
2118 parent choices from older client do not propagate to this repository, at
2129 parent choices from older client do not propagate to this repository, at
2119 the cost of a small increase in CPU consumption.
2130 the cost of a small increase in CPU consumption.
2120
2131
2121 Note: this option only control the order in which delta parents are
2132 Note: this option only control the order in which delta parents are
2122 considered. Even when disabled, the existing delta from the source will be
2133 considered. Even when disabled, the existing delta from the source will be
2123 reused if the same delta parent is selected.
2134 reused if the same delta parent is selected.
2124
2135
2125 ``revlog.reuse-external-delta``
2136 ``revlog.reuse-external-delta``
2126 Control the reuse of delta from external source.
2137 Control the reuse of delta from external source.
2127 (typically: apply bundle from `hg pull` or `hg push`).
2138 (typically: apply bundle from `hg pull` or `hg push`).
2128
2139
2129 New revisions are usually provided as a delta against another revision. By
2140 New revisions are usually provided as a delta against another revision. By
2130 default, Mercurial will not recompute the same delta again, trusting
2141 default, Mercurial will not recompute the same delta again, trusting
2131 externally provided deltas. There have been rare cases of small adjustment
2142 externally provided deltas. There have been rare cases of small adjustment
2132 to the diffing algorithm in the past. So in some rare case, recomputing
2143 to the diffing algorithm in the past. So in some rare case, recomputing
2133 delta provided by ancient clients can provides better results. Disabling
2144 delta provided by ancient clients can provides better results. Disabling
2134 this option means going through a full delta recomputation for all incoming
2145 this option means going through a full delta recomputation for all incoming
2135 revisions. It means a large increase in CPU usage and will slow operations
2146 revisions. It means a large increase in CPU usage and will slow operations
2136 down.
2147 down.
2137
2148
2138 This option is enabled by default. When disabled, it also disables the
2149 This option is enabled by default. When disabled, it also disables the
2139 related ``storage.revlog.reuse-external-delta-parent`` option.
2150 related ``storage.revlog.reuse-external-delta-parent`` option.
2140
2151
2141 ``revlog.zlib.level``
2152 ``revlog.zlib.level``
2142 Zlib compression level used when storing data into the repository. Accepted
2153 Zlib compression level used when storing data into the repository. Accepted
2143 Value range from 1 (lowest compression) to 9 (highest compression). Zlib
2154 Value range from 1 (lowest compression) to 9 (highest compression). Zlib
2144 default value is 6.
2155 default value is 6.
2145
2156
2146
2157
2147 ``revlog.zstd.level``
2158 ``revlog.zstd.level``
2148 zstd compression level used when storing data into the repository. Accepted
2159 zstd compression level used when storing data into the repository. Accepted
2149 Value range from 1 (lowest compression) to 22 (highest compression).
2160 Value range from 1 (lowest compression) to 22 (highest compression).
2150 (default 3)
2161 (default 3)
2151
2162
2152 ``server``
2163 ``server``
2153 ----------
2164 ----------
2154
2165
2155 Controls generic server settings.
2166 Controls generic server settings.
2156
2167
2157 ``bookmarks-pushkey-compat``
2168 ``bookmarks-pushkey-compat``
2158 Trigger pushkey hook when being pushed bookmark updates. This config exist
2169 Trigger pushkey hook when being pushed bookmark updates. This config exist
2159 for compatibility purpose (default to True)
2170 for compatibility purpose (default to True)
2160
2171
2161 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
2172 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
2162 movement we recommend you migrate them to ``txnclose-bookmark`` and
2173 movement we recommend you migrate them to ``txnclose-bookmark`` and
2163 ``pretxnclose-bookmark``.
2174 ``pretxnclose-bookmark``.
2164
2175
2165 ``compressionengines``
2176 ``compressionengines``
2166 List of compression engines and their relative priority to advertise
2177 List of compression engines and their relative priority to advertise
2167 to clients.
2178 to clients.
2168
2179
2169 The order of compression engines determines their priority, the first
2180 The order of compression engines determines their priority, the first
2170 having the highest priority. If a compression engine is not listed
2181 having the highest priority. If a compression engine is not listed
2171 here, it won't be advertised to clients.
2182 here, it won't be advertised to clients.
2172
2183
2173 If not set (the default), built-in defaults are used. Run
2184 If not set (the default), built-in defaults are used. Run
2174 :hg:`debuginstall` to list available compression engines and their
2185 :hg:`debuginstall` to list available compression engines and their
2175 default wire protocol priority.
2186 default wire protocol priority.
2176
2187
2177 Older Mercurial clients only support zlib compression and this setting
2188 Older Mercurial clients only support zlib compression and this setting
2178 has no effect for legacy clients.
2189 has no effect for legacy clients.
2179
2190
2180 ``uncompressed``
2191 ``uncompressed``
2181 Whether to allow clients to clone a repository using the
2192 Whether to allow clients to clone a repository using the
2182 uncompressed streaming protocol. This transfers about 40% more
2193 uncompressed streaming protocol. This transfers about 40% more
2183 data than a regular clone, but uses less memory and CPU on both
2194 data than a regular clone, but uses less memory and CPU on both
2184 server and client. Over a LAN (100 Mbps or better) or a very fast
2195 server and client. Over a LAN (100 Mbps or better) or a very fast
2185 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
2196 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
2186 regular clone. Over most WAN connections (anything slower than
2197 regular clone. Over most WAN connections (anything slower than
2187 about 6 Mbps), uncompressed streaming is slower, because of the
2198 about 6 Mbps), uncompressed streaming is slower, because of the
2188 extra data transfer overhead. This mode will also temporarily hold
2199 extra data transfer overhead. This mode will also temporarily hold
2189 the write lock while determining what data to transfer.
2200 the write lock while determining what data to transfer.
2190 (default: True)
2201 (default: True)
2191
2202
2192 ``uncompressedallowsecret``
2203 ``uncompressedallowsecret``
2193 Whether to allow stream clones when the repository contains secret
2204 Whether to allow stream clones when the repository contains secret
2194 changesets. (default: False)
2205 changesets. (default: False)
2195
2206
2196 ``preferuncompressed``
2207 ``preferuncompressed``
2197 When set, clients will try to use the uncompressed streaming
2208 When set, clients will try to use the uncompressed streaming
2198 protocol. (default: False)
2209 protocol. (default: False)
2199
2210
2200 ``disablefullbundle``
2211 ``disablefullbundle``
2201 When set, servers will refuse attempts to do pull-based clones.
2212 When set, servers will refuse attempts to do pull-based clones.
2202 If this option is set, ``preferuncompressed`` and/or clone bundles
2213 If this option is set, ``preferuncompressed`` and/or clone bundles
2203 are highly recommended. Partial clones will still be allowed.
2214 are highly recommended. Partial clones will still be allowed.
2204 (default: False)
2215 (default: False)
2205
2216
2206 ``streamunbundle``
2217 ``streamunbundle``
2207 When set, servers will apply data sent from the client directly,
2218 When set, servers will apply data sent from the client directly,
2208 otherwise it will be written to a temporary file first. This option
2219 otherwise it will be written to a temporary file first. This option
2209 effectively prevents concurrent pushes.
2220 effectively prevents concurrent pushes.
2210
2221
2211 ``pullbundle``
2222 ``pullbundle``
2212 When set, the server will check pullbundle.manifest for bundles
2223 When set, the server will check pullbundle.manifest for bundles
2213 covering the requested heads and common nodes. The first matching
2224 covering the requested heads and common nodes. The first matching
2214 entry will be streamed to the client.
2225 entry will be streamed to the client.
2215
2226
2216 For HTTP transport, the stream will still use zlib compression
2227 For HTTP transport, the stream will still use zlib compression
2217 for older clients.
2228 for older clients.
2218
2229
2219 ``concurrent-push-mode``
2230 ``concurrent-push-mode``
2220 Level of allowed race condition between two pushing clients.
2231 Level of allowed race condition between two pushing clients.
2221
2232
2222 - 'strict': push is abort if another client touched the repository
2233 - 'strict': push is abort if another client touched the repository
2223 while the push was preparing.
2234 while the push was preparing.
2224 - 'check-related': push is only aborted if it affects head that got also
2235 - 'check-related': push is only aborted if it affects head that got also
2225 affected while the push was preparing. (default since 5.4)
2236 affected while the push was preparing. (default since 5.4)
2226
2237
2227 'check-related' only takes effect for compatible clients (version
2238 'check-related' only takes effect for compatible clients (version
2228 4.3 and later). Older clients will use 'strict'.
2239 4.3 and later). Older clients will use 'strict'.
2229
2240
2230 ``validate``
2241 ``validate``
2231 Whether to validate the completeness of pushed changesets by
2242 Whether to validate the completeness of pushed changesets by
2232 checking that all new file revisions specified in manifests are
2243 checking that all new file revisions specified in manifests are
2233 present. (default: False)
2244 present. (default: False)
2234
2245
2235 ``maxhttpheaderlen``
2246 ``maxhttpheaderlen``
2236 Instruct HTTP clients not to send request headers longer than this
2247 Instruct HTTP clients not to send request headers longer than this
2237 many bytes. (default: 1024)
2248 many bytes. (default: 1024)
2238
2249
2239 ``bundle1``
2250 ``bundle1``
2240 Whether to allow clients to push and pull using the legacy bundle1
2251 Whether to allow clients to push and pull using the legacy bundle1
2241 exchange format. (default: True)
2252 exchange format. (default: True)
2242
2253
2243 ``bundle1gd``
2254 ``bundle1gd``
2244 Like ``bundle1`` but only used if the repository is using the
2255 Like ``bundle1`` but only used if the repository is using the
2245 *generaldelta* storage format. (default: True)
2256 *generaldelta* storage format. (default: True)
2246
2257
2247 ``bundle1.push``
2258 ``bundle1.push``
2248 Whether to allow clients to push using the legacy bundle1 exchange
2259 Whether to allow clients to push using the legacy bundle1 exchange
2249 format. (default: True)
2260 format. (default: True)
2250
2261
2251 ``bundle1gd.push``
2262 ``bundle1gd.push``
2252 Like ``bundle1.push`` but only used if the repository is using the
2263 Like ``bundle1.push`` but only used if the repository is using the
2253 *generaldelta* storage format. (default: True)
2264 *generaldelta* storage format. (default: True)
2254
2265
2255 ``bundle1.pull``
2266 ``bundle1.pull``
2256 Whether to allow clients to pull using the legacy bundle1 exchange
2267 Whether to allow clients to pull using the legacy bundle1 exchange
2257 format. (default: True)
2268 format. (default: True)
2258
2269
2259 ``bundle1gd.pull``
2270 ``bundle1gd.pull``
2260 Like ``bundle1.pull`` but only used if the repository is using the
2271 Like ``bundle1.pull`` but only used if the repository is using the
2261 *generaldelta* storage format. (default: True)
2272 *generaldelta* storage format. (default: True)
2262
2273
2263 Large repositories using the *generaldelta* storage format should
2274 Large repositories using the *generaldelta* storage format should
2264 consider setting this option because converting *generaldelta*
2275 consider setting this option because converting *generaldelta*
2265 repositories to the exchange format required by the bundle1 data
2276 repositories to the exchange format required by the bundle1 data
2266 format can consume a lot of CPU.
2277 format can consume a lot of CPU.
2267
2278
2268 ``bundle2.stream``
2279 ``bundle2.stream``
2269 Whether to allow clients to pull using the bundle2 streaming protocol.
2280 Whether to allow clients to pull using the bundle2 streaming protocol.
2270 (default: True)
2281 (default: True)
2271
2282
2272 ``zliblevel``
2283 ``zliblevel``
2273 Integer between ``-1`` and ``9`` that controls the zlib compression level
2284 Integer between ``-1`` and ``9`` that controls the zlib compression level
2274 for wire protocol commands that send zlib compressed output (notably the
2285 for wire protocol commands that send zlib compressed output (notably the
2275 commands that send repository history data).
2286 commands that send repository history data).
2276
2287
2277 The default (``-1``) uses the default zlib compression level, which is
2288 The default (``-1``) uses the default zlib compression level, which is
2278 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
2289 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
2279 maximum compression.
2290 maximum compression.
2280
2291
2281 Setting this option allows server operators to make trade-offs between
2292 Setting this option allows server operators to make trade-offs between
2282 bandwidth and CPU used. Lowering the compression lowers CPU utilization
2293 bandwidth and CPU used. Lowering the compression lowers CPU utilization
2283 but sends more bytes to clients.
2294 but sends more bytes to clients.
2284
2295
2285 This option only impacts the HTTP server.
2296 This option only impacts the HTTP server.
2286
2297
2287 ``zstdlevel``
2298 ``zstdlevel``
2288 Integer between ``1`` and ``22`` that controls the zstd compression level
2299 Integer between ``1`` and ``22`` that controls the zstd compression level
2289 for wire protocol commands. ``1`` is the minimal amount of compression and
2300 for wire protocol commands. ``1`` is the minimal amount of compression and
2290 ``22`` is the highest amount of compression.
2301 ``22`` is the highest amount of compression.
2291
2302
2292 The default (``3``) should be significantly faster than zlib while likely
2303 The default (``3``) should be significantly faster than zlib while likely
2293 delivering better compression ratios.
2304 delivering better compression ratios.
2294
2305
2295 This option only impacts the HTTP server.
2306 This option only impacts the HTTP server.
2296
2307
2297 See also ``server.zliblevel``.
2308 See also ``server.zliblevel``.
2298
2309
2299 ``view``
2310 ``view``
2300 Repository filter used when exchanging revisions with the peer.
2311 Repository filter used when exchanging revisions with the peer.
2301
2312
2302 The default view (``served``) excludes secret and hidden changesets.
2313 The default view (``served``) excludes secret and hidden changesets.
2303 Another useful value is ``immutable`` (no draft, secret or hidden
2314 Another useful value is ``immutable`` (no draft, secret or hidden
2304 changesets). (EXPERIMENTAL)
2315 changesets). (EXPERIMENTAL)
2305
2316
2306 ``smtp``
2317 ``smtp``
2307 --------
2318 --------
2308
2319
2309 Configuration for extensions that need to send email messages.
2320 Configuration for extensions that need to send email messages.
2310
2321
2311 ``host``
2322 ``host``
2312 Host name of mail server, e.g. "mail.example.com".
2323 Host name of mail server, e.g. "mail.example.com".
2313
2324
2314 ``port``
2325 ``port``
2315 Optional. Port to connect to on mail server. (default: 465 if
2326 Optional. Port to connect to on mail server. (default: 465 if
2316 ``tls`` is smtps; 25 otherwise)
2327 ``tls`` is smtps; 25 otherwise)
2317
2328
2318 ``tls``
2329 ``tls``
2319 Optional. Method to enable TLS when connecting to mail server: starttls,
2330 Optional. Method to enable TLS when connecting to mail server: starttls,
2320 smtps or none. (default: none)
2331 smtps or none. (default: none)
2321
2332
2322 ``username``
2333 ``username``
2323 Optional. User name for authenticating with the SMTP server.
2334 Optional. User name for authenticating with the SMTP server.
2324 (default: None)
2335 (default: None)
2325
2336
2326 ``password``
2337 ``password``
2327 Optional. Password for authenticating with the SMTP server. If not
2338 Optional. Password for authenticating with the SMTP server. If not
2328 specified, interactive sessions will prompt the user for a
2339 specified, interactive sessions will prompt the user for a
2329 password; non-interactive sessions will fail. (default: None)
2340 password; non-interactive sessions will fail. (default: None)
2330
2341
2331 ``local_hostname``
2342 ``local_hostname``
2332 Optional. The hostname that the sender can use to identify
2343 Optional. The hostname that the sender can use to identify
2333 itself to the MTA.
2344 itself to the MTA.
2334
2345
2335
2346
2336 ``subpaths``
2347 ``subpaths``
2337 ------------
2348 ------------
2338
2349
2339 Subrepository source URLs can go stale if a remote server changes name
2350 Subrepository source URLs can go stale if a remote server changes name
2340 or becomes temporarily unavailable. This section lets you define
2351 or becomes temporarily unavailable. This section lets you define
2341 rewrite rules of the form::
2352 rewrite rules of the form::
2342
2353
2343 <pattern> = <replacement>
2354 <pattern> = <replacement>
2344
2355
2345 where ``pattern`` is a regular expression matching a subrepository
2356 where ``pattern`` is a regular expression matching a subrepository
2346 source URL and ``replacement`` is the replacement string used to
2357 source URL and ``replacement`` is the replacement string used to
2347 rewrite it. Groups can be matched in ``pattern`` and referenced in
2358 rewrite it. Groups can be matched in ``pattern`` and referenced in
2348 ``replacements``. For instance::
2359 ``replacements``. For instance::
2349
2360
2350 http://server/(.*)-hg/ = http://hg.server/\1/
2361 http://server/(.*)-hg/ = http://hg.server/\1/
2351
2362
2352 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
2363 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
2353
2364
2354 Relative subrepository paths are first made absolute, and the
2365 Relative subrepository paths are first made absolute, and the
2355 rewrite rules are then applied on the full (absolute) path. If ``pattern``
2366 rewrite rules are then applied on the full (absolute) path. If ``pattern``
2356 doesn't match the full path, an attempt is made to apply it on the
2367 doesn't match the full path, an attempt is made to apply it on the
2357 relative path alone. The rules are applied in definition order.
2368 relative path alone. The rules are applied in definition order.
2358
2369
2359 ``subrepos``
2370 ``subrepos``
2360 ------------
2371 ------------
2361
2372
2362 This section contains options that control the behavior of the
2373 This section contains options that control the behavior of the
2363 subrepositories feature. See also :hg:`help subrepos`.
2374 subrepositories feature. See also :hg:`help subrepos`.
2364
2375
2365 Security note: auditing in Mercurial is known to be insufficient to
2376 Security note: auditing in Mercurial is known to be insufficient to
2366 prevent clone-time code execution with carefully constructed Git
2377 prevent clone-time code execution with carefully constructed Git
2367 subrepos. It is unknown if a similar detect is present in Subversion
2378 subrepos. It is unknown if a similar detect is present in Subversion
2368 subrepos. Both Git and Subversion subrepos are disabled by default
2379 subrepos. Both Git and Subversion subrepos are disabled by default
2369 out of security concerns. These subrepo types can be enabled using
2380 out of security concerns. These subrepo types can be enabled using
2370 the respective options below.
2381 the respective options below.
2371
2382
2372 ``allowed``
2383 ``allowed``
2373 Whether subrepositories are allowed in the working directory.
2384 Whether subrepositories are allowed in the working directory.
2374
2385
2375 When false, commands involving subrepositories (like :hg:`update`)
2386 When false, commands involving subrepositories (like :hg:`update`)
2376 will fail for all subrepository types.
2387 will fail for all subrepository types.
2377 (default: true)
2388 (default: true)
2378
2389
2379 ``hg:allowed``
2390 ``hg:allowed``
2380 Whether Mercurial subrepositories are allowed in the working
2391 Whether Mercurial subrepositories are allowed in the working
2381 directory. This option only has an effect if ``subrepos.allowed``
2392 directory. This option only has an effect if ``subrepos.allowed``
2382 is true.
2393 is true.
2383 (default: true)
2394 (default: true)
2384
2395
2385 ``git:allowed``
2396 ``git:allowed``
2386 Whether Git subrepositories are allowed in the working directory.
2397 Whether Git subrepositories are allowed in the working directory.
2387 This option only has an effect if ``subrepos.allowed`` is true.
2398 This option only has an effect if ``subrepos.allowed`` is true.
2388
2399
2389 See the security note above before enabling Git subrepos.
2400 See the security note above before enabling Git subrepos.
2390 (default: false)
2401 (default: false)
2391
2402
2392 ``svn:allowed``
2403 ``svn:allowed``
2393 Whether Subversion subrepositories are allowed in the working
2404 Whether Subversion subrepositories are allowed in the working
2394 directory. This option only has an effect if ``subrepos.allowed``
2405 directory. This option only has an effect if ``subrepos.allowed``
2395 is true.
2406 is true.
2396
2407
2397 See the security note above before enabling Subversion subrepos.
2408 See the security note above before enabling Subversion subrepos.
2398 (default: false)
2409 (default: false)
2399
2410
2400 ``templatealias``
2411 ``templatealias``
2401 -----------------
2412 -----------------
2402
2413
2403 Alias definitions for templates. See :hg:`help templates` for details.
2414 Alias definitions for templates. See :hg:`help templates` for details.
2404
2415
2405 ``templates``
2416 ``templates``
2406 -------------
2417 -------------
2407
2418
2408 Use the ``[templates]`` section to define template strings.
2419 Use the ``[templates]`` section to define template strings.
2409 See :hg:`help templates` for details.
2420 See :hg:`help templates` for details.
2410
2421
2411 ``trusted``
2422 ``trusted``
2412 -----------
2423 -----------
2413
2424
2414 Mercurial will not use the settings in the
2425 Mercurial will not use the settings in the
2415 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2426 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2416 user or to a trusted group, as various hgrc features allow arbitrary
2427 user or to a trusted group, as various hgrc features allow arbitrary
2417 commands to be run. This issue is often encountered when configuring
2428 commands to be run. This issue is often encountered when configuring
2418 hooks or extensions for shared repositories or servers. However,
2429 hooks or extensions for shared repositories or servers. However,
2419 the web interface will use some safe settings from the ``[web]``
2430 the web interface will use some safe settings from the ``[web]``
2420 section.
2431 section.
2421
2432
2422 This section specifies what users and groups are trusted. The
2433 This section specifies what users and groups are trusted. The
2423 current user is always trusted. To trust everybody, list a user or a
2434 current user is always trusted. To trust everybody, list a user or a
2424 group with name ``*``. These settings must be placed in an
2435 group with name ``*``. These settings must be placed in an
2425 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2436 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2426 user or service running Mercurial.
2437 user or service running Mercurial.
2427
2438
2428 ``users``
2439 ``users``
2429 Comma-separated list of trusted users.
2440 Comma-separated list of trusted users.
2430
2441
2431 ``groups``
2442 ``groups``
2432 Comma-separated list of trusted groups.
2443 Comma-separated list of trusted groups.
2433
2444
2434
2445
2435 ``ui``
2446 ``ui``
2436 ------
2447 ------
2437
2448
2438 User interface controls.
2449 User interface controls.
2439
2450
2440 ``archivemeta``
2451 ``archivemeta``
2441 Whether to include the .hg_archival.txt file containing meta data
2452 Whether to include the .hg_archival.txt file containing meta data
2442 (hashes for the repository base and for tip) in archives created
2453 (hashes for the repository base and for tip) in archives created
2443 by the :hg:`archive` command or downloaded via hgweb.
2454 by the :hg:`archive` command or downloaded via hgweb.
2444 (default: True)
2455 (default: True)
2445
2456
2446 ``askusername``
2457 ``askusername``
2447 Whether to prompt for a username when committing. If True, and
2458 Whether to prompt for a username when committing. If True, and
2448 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2459 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2449 be prompted to enter a username. If no username is entered, the
2460 be prompted to enter a username. If no username is entered, the
2450 default ``USER@HOST`` is used instead.
2461 default ``USER@HOST`` is used instead.
2451 (default: False)
2462 (default: False)
2452
2463
2453 ``clonebundles``
2464 ``clonebundles``
2454 Whether the "clone bundles" feature is enabled.
2465 Whether the "clone bundles" feature is enabled.
2455
2466
2456 When enabled, :hg:`clone` may download and apply a server-advertised
2467 When enabled, :hg:`clone` may download and apply a server-advertised
2457 bundle file from a URL instead of using the normal exchange mechanism.
2468 bundle file from a URL instead of using the normal exchange mechanism.
2458
2469
2459 This can likely result in faster and more reliable clones.
2470 This can likely result in faster and more reliable clones.
2460
2471
2461 (default: True)
2472 (default: True)
2462
2473
2463 ``clonebundlefallback``
2474 ``clonebundlefallback``
2464 Whether failure to apply an advertised "clone bundle" from a server
2475 Whether failure to apply an advertised "clone bundle" from a server
2465 should result in fallback to a regular clone.
2476 should result in fallback to a regular clone.
2466
2477
2467 This is disabled by default because servers advertising "clone
2478 This is disabled by default because servers advertising "clone
2468 bundles" often do so to reduce server load. If advertised bundles
2479 bundles" often do so to reduce server load. If advertised bundles
2469 start mass failing and clients automatically fall back to a regular
2480 start mass failing and clients automatically fall back to a regular
2470 clone, this would add significant and unexpected load to the server
2481 clone, this would add significant and unexpected load to the server
2471 since the server is expecting clone operations to be offloaded to
2482 since the server is expecting clone operations to be offloaded to
2472 pre-generated bundles. Failing fast (the default behavior) ensures
2483 pre-generated bundles. Failing fast (the default behavior) ensures
2473 clients don't overwhelm the server when "clone bundle" application
2484 clients don't overwhelm the server when "clone bundle" application
2474 fails.
2485 fails.
2475
2486
2476 (default: False)
2487 (default: False)
2477
2488
2478 ``clonebundleprefers``
2489 ``clonebundleprefers``
2479 Defines preferences for which "clone bundles" to use.
2490 Defines preferences for which "clone bundles" to use.
2480
2491
2481 Servers advertising "clone bundles" may advertise multiple available
2492 Servers advertising "clone bundles" may advertise multiple available
2482 bundles. Each bundle may have different attributes, such as the bundle
2493 bundles. Each bundle may have different attributes, such as the bundle
2483 type and compression format. This option is used to prefer a particular
2494 type and compression format. This option is used to prefer a particular
2484 bundle over another.
2495 bundle over another.
2485
2496
2486 The following keys are defined by Mercurial:
2497 The following keys are defined by Mercurial:
2487
2498
2488 BUNDLESPEC
2499 BUNDLESPEC
2489 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2500 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2490 e.g. ``gzip-v2`` or ``bzip2-v1``.
2501 e.g. ``gzip-v2`` or ``bzip2-v1``.
2491
2502
2492 COMPRESSION
2503 COMPRESSION
2493 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2504 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2494
2505
2495 Server operators may define custom keys.
2506 Server operators may define custom keys.
2496
2507
2497 Example values: ``COMPRESSION=bzip2``,
2508 Example values: ``COMPRESSION=bzip2``,
2498 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2509 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2499
2510
2500 By default, the first bundle advertised by the server is used.
2511 By default, the first bundle advertised by the server is used.
2501
2512
2502 ``color``
2513 ``color``
2503 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2514 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2504 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2515 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2505 seems possible. See :hg:`help color` for details.
2516 seems possible. See :hg:`help color` for details.
2506
2517
2507 ``commitsubrepos``
2518 ``commitsubrepos``
2508 Whether to commit modified subrepositories when committing the
2519 Whether to commit modified subrepositories when committing the
2509 parent repository. If False and one subrepository has uncommitted
2520 parent repository. If False and one subrepository has uncommitted
2510 changes, abort the commit.
2521 changes, abort the commit.
2511 (default: False)
2522 (default: False)
2512
2523
2513 ``debug``
2524 ``debug``
2514 Print debugging information. (default: False)
2525 Print debugging information. (default: False)
2515
2526
2516 ``editor``
2527 ``editor``
2517 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2528 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2518
2529
2519 ``fallbackencoding``
2530 ``fallbackencoding``
2520 Encoding to try if it's not possible to decode the changelog using
2531 Encoding to try if it's not possible to decode the changelog using
2521 UTF-8. (default: ISO-8859-1)
2532 UTF-8. (default: ISO-8859-1)
2522
2533
2523 ``graphnodetemplate``
2534 ``graphnodetemplate``
2524 (DEPRECATED) Use ``command-templates.graphnode`` instead.
2535 (DEPRECATED) Use ``command-templates.graphnode`` instead.
2525
2536
2526 ``ignore``
2537 ``ignore``
2527 A file to read per-user ignore patterns from. This file should be
2538 A file to read per-user ignore patterns from. This file should be
2528 in the same format as a repository-wide .hgignore file. Filenames
2539 in the same format as a repository-wide .hgignore file. Filenames
2529 are relative to the repository root. This option supports hook syntax,
2540 are relative to the repository root. This option supports hook syntax,
2530 so if you want to specify multiple ignore files, you can do so by
2541 so if you want to specify multiple ignore files, you can do so by
2531 setting something like ``ignore.other = ~/.hgignore2``. For details
2542 setting something like ``ignore.other = ~/.hgignore2``. For details
2532 of the ignore file format, see the ``hgignore(5)`` man page.
2543 of the ignore file format, see the ``hgignore(5)`` man page.
2533
2544
2534 ``interactive``
2545 ``interactive``
2535 Allow to prompt the user. (default: True)
2546 Allow to prompt the user. (default: True)
2536
2547
2537 ``interface``
2548 ``interface``
2538 Select the default interface for interactive features (default: text).
2549 Select the default interface for interactive features (default: text).
2539 Possible values are 'text' and 'curses'.
2550 Possible values are 'text' and 'curses'.
2540
2551
2541 ``interface.chunkselector``
2552 ``interface.chunkselector``
2542 Select the interface for change recording (e.g. :hg:`commit -i`).
2553 Select the interface for change recording (e.g. :hg:`commit -i`).
2543 Possible values are 'text' and 'curses'.
2554 Possible values are 'text' and 'curses'.
2544 This config overrides the interface specified by ui.interface.
2555 This config overrides the interface specified by ui.interface.
2545
2556
2546 ``large-file-limit``
2557 ``large-file-limit``
2547 Largest file size that gives no memory use warning.
2558 Largest file size that gives no memory use warning.
2548 Possible values are integers or 0 to disable the check.
2559 Possible values are integers or 0 to disable the check.
2549 (default: 10000000)
2560 (default: 10000000)
2550
2561
2551 ``logtemplate``
2562 ``logtemplate``
2552 (DEPRECATED) Use ``command-templates.log`` instead.
2563 (DEPRECATED) Use ``command-templates.log`` instead.
2553
2564
2554 ``merge``
2565 ``merge``
2555 The conflict resolution program to use during a manual merge.
2566 The conflict resolution program to use during a manual merge.
2556 For more information on merge tools see :hg:`help merge-tools`.
2567 For more information on merge tools see :hg:`help merge-tools`.
2557 For configuring merge tools see the ``[merge-tools]`` section.
2568 For configuring merge tools see the ``[merge-tools]`` section.
2558
2569
2559 ``mergemarkers``
2570 ``mergemarkers``
2560 Sets the merge conflict marker label styling. The ``detailed`` style
2571 Sets the merge conflict marker label styling. The ``detailed`` style
2561 uses the ``command-templates.mergemarker`` setting to style the labels.
2572 uses the ``command-templates.mergemarker`` setting to style the labels.
2562 The ``basic`` style just uses 'local' and 'other' as the marker label.
2573 The ``basic`` style just uses 'local' and 'other' as the marker label.
2563 One of ``basic`` or ``detailed``.
2574 One of ``basic`` or ``detailed``.
2564 (default: ``basic``)
2575 (default: ``basic``)
2565
2576
2566 ``mergemarkertemplate``
2577 ``mergemarkertemplate``
2567 (DEPRECATED) Use ``command-templates.mergemarker`` instead.
2578 (DEPRECATED) Use ``command-templates.mergemarker`` instead.
2568
2579
2569 ``message-output``
2580 ``message-output``
2570 Where to write status and error messages. (default: ``stdio``)
2581 Where to write status and error messages. (default: ``stdio``)
2571
2582
2572 ``channel``
2583 ``channel``
2573 Use separate channel for structured output. (Command-server only)
2584 Use separate channel for structured output. (Command-server only)
2574 ``stderr``
2585 ``stderr``
2575 Everything to stderr.
2586 Everything to stderr.
2576 ``stdio``
2587 ``stdio``
2577 Status to stdout, and error to stderr.
2588 Status to stdout, and error to stderr.
2578
2589
2579 ``origbackuppath``
2590 ``origbackuppath``
2580 The path to a directory used to store generated .orig files. If the path is
2591 The path to a directory used to store generated .orig files. If the path is
2581 not a directory, one will be created. If set, files stored in this
2592 not a directory, one will be created. If set, files stored in this
2582 directory have the same name as the original file and do not have a .orig
2593 directory have the same name as the original file and do not have a .orig
2583 suffix.
2594 suffix.
2584
2595
2585 ``paginate``
2596 ``paginate``
2586 Control the pagination of command output (default: True). See :hg:`help pager`
2597 Control the pagination of command output (default: True). See :hg:`help pager`
2587 for details.
2598 for details.
2588
2599
2589 ``patch``
2600 ``patch``
2590 An optional external tool that ``hg import`` and some extensions
2601 An optional external tool that ``hg import`` and some extensions
2591 will use for applying patches. By default Mercurial uses an
2602 will use for applying patches. By default Mercurial uses an
2592 internal patch utility. The external tool must work as the common
2603 internal patch utility. The external tool must work as the common
2593 Unix ``patch`` program. In particular, it must accept a ``-p``
2604 Unix ``patch`` program. In particular, it must accept a ``-p``
2594 argument to strip patch headers, a ``-d`` argument to specify the
2605 argument to strip patch headers, a ``-d`` argument to specify the
2595 current directory, a file name to patch, and a patch file to take
2606 current directory, a file name to patch, and a patch file to take
2596 from stdin.
2607 from stdin.
2597
2608
2598 It is possible to specify a patch tool together with extra
2609 It is possible to specify a patch tool together with extra
2599 arguments. For example, setting this option to ``patch --merge``
2610 arguments. For example, setting this option to ``patch --merge``
2600 will use the ``patch`` program with its 2-way merge option.
2611 will use the ``patch`` program with its 2-way merge option.
2601
2612
2602 ``portablefilenames``
2613 ``portablefilenames``
2603 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2614 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2604 (default: ``warn``)
2615 (default: ``warn``)
2605
2616
2606 ``warn``
2617 ``warn``
2607 Print a warning message on POSIX platforms, if a file with a non-portable
2618 Print a warning message on POSIX platforms, if a file with a non-portable
2608 filename is added (e.g. a file with a name that can't be created on
2619 filename is added (e.g. a file with a name that can't be created on
2609 Windows because it contains reserved parts like ``AUX``, reserved
2620 Windows because it contains reserved parts like ``AUX``, reserved
2610 characters like ``:``, or would cause a case collision with an existing
2621 characters like ``:``, or would cause a case collision with an existing
2611 file).
2622 file).
2612
2623
2613 ``ignore``
2624 ``ignore``
2614 Don't print a warning.
2625 Don't print a warning.
2615
2626
2616 ``abort``
2627 ``abort``
2617 The command is aborted.
2628 The command is aborted.
2618
2629
2619 ``true``
2630 ``true``
2620 Alias for ``warn``.
2631 Alias for ``warn``.
2621
2632
2622 ``false``
2633 ``false``
2623 Alias for ``ignore``.
2634 Alias for ``ignore``.
2624
2635
2625 .. container:: windows
2636 .. container:: windows
2626
2637
2627 On Windows, this configuration option is ignored and the command aborted.
2638 On Windows, this configuration option is ignored and the command aborted.
2628
2639
2629 ``pre-merge-tool-output-template``
2640 ``pre-merge-tool-output-template``
2630 (DEPRECATED) Use ``command-template.pre-merge-tool-output`` instead.
2641 (DEPRECATED) Use ``command-template.pre-merge-tool-output`` instead.
2631
2642
2632 ``quiet``
2643 ``quiet``
2633 Reduce the amount of output printed.
2644 Reduce the amount of output printed.
2634 (default: False)
2645 (default: False)
2635
2646
2636 ``relative-paths``
2647 ``relative-paths``
2637 Prefer relative paths in the UI.
2648 Prefer relative paths in the UI.
2638
2649
2639 ``remotecmd``
2650 ``remotecmd``
2640 Remote command to use for clone/push/pull operations.
2651 Remote command to use for clone/push/pull operations.
2641 (default: ``hg``)
2652 (default: ``hg``)
2642
2653
2643 ``report_untrusted``
2654 ``report_untrusted``
2644 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2655 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2645 trusted user or group.
2656 trusted user or group.
2646 (default: True)
2657 (default: True)
2647
2658
2648 ``slash``
2659 ``slash``
2649 (Deprecated. Use ``slashpath`` template filter instead.)
2660 (Deprecated. Use ``slashpath`` template filter instead.)
2650
2661
2651 Display paths using a slash (``/``) as the path separator. This
2662 Display paths using a slash (``/``) as the path separator. This
2652 only makes a difference on systems where the default path
2663 only makes a difference on systems where the default path
2653 separator is not the slash character (e.g. Windows uses the
2664 separator is not the slash character (e.g. Windows uses the
2654 backslash character (``\``)).
2665 backslash character (``\``)).
2655 (default: False)
2666 (default: False)
2656
2667
2657 ``statuscopies``
2668 ``statuscopies``
2658 Display copies in the status command.
2669 Display copies in the status command.
2659
2670
2660 ``ssh``
2671 ``ssh``
2661 Command to use for SSH connections. (default: ``ssh``)
2672 Command to use for SSH connections. (default: ``ssh``)
2662
2673
2663 ``ssherrorhint``
2674 ``ssherrorhint``
2664 A hint shown to the user in the case of SSH error (e.g.
2675 A hint shown to the user in the case of SSH error (e.g.
2665 ``Please see http://company/internalwiki/ssh.html``)
2676 ``Please see http://company/internalwiki/ssh.html``)
2666
2677
2667 ``strict``
2678 ``strict``
2668 Require exact command names, instead of allowing unambiguous
2679 Require exact command names, instead of allowing unambiguous
2669 abbreviations. (default: False)
2680 abbreviations. (default: False)
2670
2681
2671 ``style``
2682 ``style``
2672 Name of style to use for command output.
2683 Name of style to use for command output.
2673
2684
2674 ``supportcontact``
2685 ``supportcontact``
2675 A URL where users should report a Mercurial traceback. Use this if you are a
2686 A URL where users should report a Mercurial traceback. Use this if you are a
2676 large organisation with its own Mercurial deployment process and crash
2687 large organisation with its own Mercurial deployment process and crash
2677 reports should be addressed to your internal support.
2688 reports should be addressed to your internal support.
2678
2689
2679 ``textwidth``
2690 ``textwidth``
2680 Maximum width of help text. A longer line generated by ``hg help`` or
2691 Maximum width of help text. A longer line generated by ``hg help`` or
2681 ``hg subcommand --help`` will be broken after white space to get this
2692 ``hg subcommand --help`` will be broken after white space to get this
2682 width or the terminal width, whichever comes first.
2693 width or the terminal width, whichever comes first.
2683 A non-positive value will disable this and the terminal width will be
2694 A non-positive value will disable this and the terminal width will be
2684 used. (default: 78)
2695 used. (default: 78)
2685
2696
2686 ``timeout``
2697 ``timeout``
2687 The timeout used when a lock is held (in seconds), a negative value
2698 The timeout used when a lock is held (in seconds), a negative value
2688 means no timeout. (default: 600)
2699 means no timeout. (default: 600)
2689
2700
2690 ``timeout.warn``
2701 ``timeout.warn``
2691 Time (in seconds) before a warning is printed about held lock. A negative
2702 Time (in seconds) before a warning is printed about held lock. A negative
2692 value means no warning. (default: 0)
2703 value means no warning. (default: 0)
2693
2704
2694 ``traceback``
2705 ``traceback``
2695 Mercurial always prints a traceback when an unknown exception
2706 Mercurial always prints a traceback when an unknown exception
2696 occurs. Setting this to True will make Mercurial print a traceback
2707 occurs. Setting this to True will make Mercurial print a traceback
2697 on all exceptions, even those recognized by Mercurial (such as
2708 on all exceptions, even those recognized by Mercurial (such as
2698 IOError or MemoryError). (default: False)
2709 IOError or MemoryError). (default: False)
2699
2710
2700 ``tweakdefaults``
2711 ``tweakdefaults``
2701
2712
2702 By default Mercurial's behavior changes very little from release
2713 By default Mercurial's behavior changes very little from release
2703 to release, but over time the recommended config settings
2714 to release, but over time the recommended config settings
2704 shift. Enable this config to opt in to get automatic tweaks to
2715 shift. Enable this config to opt in to get automatic tweaks to
2705 Mercurial's behavior over time. This config setting will have no
2716 Mercurial's behavior over time. This config setting will have no
2706 effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
2717 effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
2707 not include ``tweakdefaults``. (default: False)
2718 not include ``tweakdefaults``. (default: False)
2708
2719
2709 It currently means::
2720 It currently means::
2710
2721
2711 .. tweakdefaultsmarker
2722 .. tweakdefaultsmarker
2712
2723
2713 ``username``
2724 ``username``
2714 The committer of a changeset created when running "commit".
2725 The committer of a changeset created when running "commit".
2715 Typically a person's name and email address, e.g. ``Fred Widget
2726 Typically a person's name and email address, e.g. ``Fred Widget
2716 <fred@example.com>``. Environment variables in the
2727 <fred@example.com>``. Environment variables in the
2717 username are expanded.
2728 username are expanded.
2718
2729
2719 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2730 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2720 hgrc is empty, e.g. if the system admin set ``username =`` in the
2731 hgrc is empty, e.g. if the system admin set ``username =`` in the
2721 system hgrc, it has to be specified manually or in a different
2732 system hgrc, it has to be specified manually or in a different
2722 hgrc file)
2733 hgrc file)
2723
2734
2724 ``verbose``
2735 ``verbose``
2725 Increase the amount of output printed. (default: False)
2736 Increase the amount of output printed. (default: False)
2726
2737
2727
2738
2728 ``command-templates``
2739 ``command-templates``
2729 ---------------------
2740 ---------------------
2730
2741
2731 Templates used for customizing the output of commands.
2742 Templates used for customizing the output of commands.
2732
2743
2733 ``graphnode``
2744 ``graphnode``
2734 The template used to print changeset nodes in an ASCII revision graph.
2745 The template used to print changeset nodes in an ASCII revision graph.
2735 (default: ``{graphnode}``)
2746 (default: ``{graphnode}``)
2736
2747
2737 ``log``
2748 ``log``
2738 Template string for commands that print changesets.
2749 Template string for commands that print changesets.
2739
2750
2740 ``mergemarker``
2751 ``mergemarker``
2741 The template used to print the commit description next to each conflict
2752 The template used to print the commit description next to each conflict
2742 marker during merge conflicts. See :hg:`help templates` for the template
2753 marker during merge conflicts. See :hg:`help templates` for the template
2743 format.
2754 format.
2744
2755
2745 Defaults to showing the hash, tags, branches, bookmarks, author, and
2756 Defaults to showing the hash, tags, branches, bookmarks, author, and
2746 the first line of the commit description.
2757 the first line of the commit description.
2747
2758
2748 If you use non-ASCII characters in names for tags, branches, bookmarks,
2759 If you use non-ASCII characters in names for tags, branches, bookmarks,
2749 authors, and/or commit descriptions, you must pay attention to encodings of
2760 authors, and/or commit descriptions, you must pay attention to encodings of
2750 managed files. At template expansion, non-ASCII characters use the encoding
2761 managed files. At template expansion, non-ASCII characters use the encoding
2751 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2762 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2752 environment variables that govern your locale. If the encoding of the merge
2763 environment variables that govern your locale. If the encoding of the merge
2753 markers is different from the encoding of the merged files,
2764 markers is different from the encoding of the merged files,
2754 serious problems may occur.
2765 serious problems may occur.
2755
2766
2756 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2767 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2757
2768
2758 ``oneline-summary``
2769 ``oneline-summary``
2759 A template used by `hg rebase` and other commands for showing a one-line
2770 A template used by `hg rebase` and other commands for showing a one-line
2760 summary of a commit. If the template configured here is longer than one
2771 summary of a commit. If the template configured here is longer than one
2761 line, then only the first line is used.
2772 line, then only the first line is used.
2762
2773
2763 The template can be overridden per command by defining a template in
2774 The template can be overridden per command by defining a template in
2764 `oneline-summary.<command>`, where `<command>` can be e.g. "rebase".
2775 `oneline-summary.<command>`, where `<command>` can be e.g. "rebase".
2765
2776
2766 ``pre-merge-tool-output``
2777 ``pre-merge-tool-output``
2767 A template that is printed before executing an external merge tool. This can
2778 A template that is printed before executing an external merge tool. This can
2768 be used to print out additional context that might be useful to have during
2779 be used to print out additional context that might be useful to have during
2769 the conflict resolution, such as the description of the various commits
2780 the conflict resolution, such as the description of the various commits
2770 involved or bookmarks/tags.
2781 involved or bookmarks/tags.
2771
2782
2772 Additional information is available in the ``local`, ``base``, and ``other``
2783 Additional information is available in the ``local`, ``base``, and ``other``
2773 dicts. For example: ``{local.label}``, ``{base.name}``, or
2784 dicts. For example: ``{local.label}``, ``{base.name}``, or
2774 ``{other.islink}``.
2785 ``{other.islink}``.
2775
2786
2776
2787
2777 ``web``
2788 ``web``
2778 -------
2789 -------
2779
2790
2780 Web interface configuration. The settings in this section apply to
2791 Web interface configuration. The settings in this section apply to
2781 both the builtin webserver (started by :hg:`serve`) and the script you
2792 both the builtin webserver (started by :hg:`serve`) and the script you
2782 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2793 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2783 and WSGI).
2794 and WSGI).
2784
2795
2785 The Mercurial webserver does no authentication (it does not prompt for
2796 The Mercurial webserver does no authentication (it does not prompt for
2786 usernames and passwords to validate *who* users are), but it does do
2797 usernames and passwords to validate *who* users are), but it does do
2787 authorization (it grants or denies access for *authenticated users*
2798 authorization (it grants or denies access for *authenticated users*
2788 based on settings in this section). You must either configure your
2799 based on settings in this section). You must either configure your
2789 webserver to do authentication for you, or disable the authorization
2800 webserver to do authentication for you, or disable the authorization
2790 checks.
2801 checks.
2791
2802
2792 For a quick setup in a trusted environment, e.g., a private LAN, where
2803 For a quick setup in a trusted environment, e.g., a private LAN, where
2793 you want it to accept pushes from anybody, you can use the following
2804 you want it to accept pushes from anybody, you can use the following
2794 command line::
2805 command line::
2795
2806
2796 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2807 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2797
2808
2798 Note that this will allow anybody to push anything to the server and
2809 Note that this will allow anybody to push anything to the server and
2799 that this should not be used for public servers.
2810 that this should not be used for public servers.
2800
2811
2801 The full set of options is:
2812 The full set of options is:
2802
2813
2803 ``accesslog``
2814 ``accesslog``
2804 Where to output the access log. (default: stdout)
2815 Where to output the access log. (default: stdout)
2805
2816
2806 ``address``
2817 ``address``
2807 Interface address to bind to. (default: all)
2818 Interface address to bind to. (default: all)
2808
2819
2809 ``allow-archive``
2820 ``allow-archive``
2810 List of archive format (bz2, gz, zip) allowed for downloading.
2821 List of archive format (bz2, gz, zip) allowed for downloading.
2811 (default: empty)
2822 (default: empty)
2812
2823
2813 ``allowbz2``
2824 ``allowbz2``
2814 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2825 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2815 revisions.
2826 revisions.
2816 (default: False)
2827 (default: False)
2817
2828
2818 ``allowgz``
2829 ``allowgz``
2819 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2830 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2820 revisions.
2831 revisions.
2821 (default: False)
2832 (default: False)
2822
2833
2823 ``allow-pull``
2834 ``allow-pull``
2824 Whether to allow pulling from the repository. (default: True)
2835 Whether to allow pulling from the repository. (default: True)
2825
2836
2826 ``allow-push``
2837 ``allow-push``
2827 Whether to allow pushing to the repository. If empty or not set,
2838 Whether to allow pushing to the repository. If empty or not set,
2828 pushing is not allowed. If the special value ``*``, any remote
2839 pushing is not allowed. If the special value ``*``, any remote
2829 user can push, including unauthenticated users. Otherwise, the
2840 user can push, including unauthenticated users. Otherwise, the
2830 remote user must have been authenticated, and the authenticated
2841 remote user must have been authenticated, and the authenticated
2831 user name must be present in this list. The contents of the
2842 user name must be present in this list. The contents of the
2832 allow-push list are examined after the deny_push list.
2843 allow-push list are examined after the deny_push list.
2833
2844
2834 ``allow_read``
2845 ``allow_read``
2835 If the user has not already been denied repository access due to
2846 If the user has not already been denied repository access due to
2836 the contents of deny_read, this list determines whether to grant
2847 the contents of deny_read, this list determines whether to grant
2837 repository access to the user. If this list is not empty, and the
2848 repository access to the user. If this list is not empty, and the
2838 user is unauthenticated or not present in the list, then access is
2849 user is unauthenticated or not present in the list, then access is
2839 denied for the user. If the list is empty or not set, then access
2850 denied for the user. If the list is empty or not set, then access
2840 is permitted to all users by default. Setting allow_read to the
2851 is permitted to all users by default. Setting allow_read to the
2841 special value ``*`` is equivalent to it not being set (i.e. access
2852 special value ``*`` is equivalent to it not being set (i.e. access
2842 is permitted to all users). The contents of the allow_read list are
2853 is permitted to all users). The contents of the allow_read list are
2843 examined after the deny_read list.
2854 examined after the deny_read list.
2844
2855
2845 ``allowzip``
2856 ``allowzip``
2846 (DEPRECATED) Whether to allow .zip downloading of repository
2857 (DEPRECATED) Whether to allow .zip downloading of repository
2847 revisions. This feature creates temporary files.
2858 revisions. This feature creates temporary files.
2848 (default: False)
2859 (default: False)
2849
2860
2850 ``archivesubrepos``
2861 ``archivesubrepos``
2851 Whether to recurse into subrepositories when archiving.
2862 Whether to recurse into subrepositories when archiving.
2852 (default: False)
2863 (default: False)
2853
2864
2854 ``baseurl``
2865 ``baseurl``
2855 Base URL to use when publishing URLs in other locations, so
2866 Base URL to use when publishing URLs in other locations, so
2856 third-party tools like email notification hooks can construct
2867 third-party tools like email notification hooks can construct
2857 URLs. Example: ``http://hgserver/repos/``.
2868 URLs. Example: ``http://hgserver/repos/``.
2858
2869
2859 ``cacerts``
2870 ``cacerts``
2860 Path to file containing a list of PEM encoded certificate
2871 Path to file containing a list of PEM encoded certificate
2861 authority certificates. Environment variables and ``~user``
2872 authority certificates. Environment variables and ``~user``
2862 constructs are expanded in the filename. If specified on the
2873 constructs are expanded in the filename. If specified on the
2863 client, then it will verify the identity of remote HTTPS servers
2874 client, then it will verify the identity of remote HTTPS servers
2864 with these certificates.
2875 with these certificates.
2865
2876
2866 To disable SSL verification temporarily, specify ``--insecure`` from
2877 To disable SSL verification temporarily, specify ``--insecure`` from
2867 command line.
2878 command line.
2868
2879
2869 You can use OpenSSL's CA certificate file if your platform has
2880 You can use OpenSSL's CA certificate file if your platform has
2870 one. On most Linux systems this will be
2881 one. On most Linux systems this will be
2871 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2882 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2872 generate this file manually. The form must be as follows::
2883 generate this file manually. The form must be as follows::
2873
2884
2874 -----BEGIN CERTIFICATE-----
2885 -----BEGIN CERTIFICATE-----
2875 ... (certificate in base64 PEM encoding) ...
2886 ... (certificate in base64 PEM encoding) ...
2876 -----END CERTIFICATE-----
2887 -----END CERTIFICATE-----
2877 -----BEGIN CERTIFICATE-----
2888 -----BEGIN CERTIFICATE-----
2878 ... (certificate in base64 PEM encoding) ...
2889 ... (certificate in base64 PEM encoding) ...
2879 -----END CERTIFICATE-----
2890 -----END CERTIFICATE-----
2880
2891
2881 ``cache``
2892 ``cache``
2882 Whether to support caching in hgweb. (default: True)
2893 Whether to support caching in hgweb. (default: True)
2883
2894
2884 ``certificate``
2895 ``certificate``
2885 Certificate to use when running :hg:`serve`.
2896 Certificate to use when running :hg:`serve`.
2886
2897
2887 ``collapse``
2898 ``collapse``
2888 With ``descend`` enabled, repositories in subdirectories are shown at
2899 With ``descend`` enabled, repositories in subdirectories are shown at
2889 a single level alongside repositories in the current path. With
2900 a single level alongside repositories in the current path. With
2890 ``collapse`` also enabled, repositories residing at a deeper level than
2901 ``collapse`` also enabled, repositories residing at a deeper level than
2891 the current path are grouped behind navigable directory entries that
2902 the current path are grouped behind navigable directory entries that
2892 lead to the locations of these repositories. In effect, this setting
2903 lead to the locations of these repositories. In effect, this setting
2893 collapses each collection of repositories found within a subdirectory
2904 collapses each collection of repositories found within a subdirectory
2894 into a single entry for that subdirectory. (default: False)
2905 into a single entry for that subdirectory. (default: False)
2895
2906
2896 ``comparisoncontext``
2907 ``comparisoncontext``
2897 Number of lines of context to show in side-by-side file comparison. If
2908 Number of lines of context to show in side-by-side file comparison. If
2898 negative or the value ``full``, whole files are shown. (default: 5)
2909 negative or the value ``full``, whole files are shown. (default: 5)
2899
2910
2900 This setting can be overridden by a ``context`` request parameter to the
2911 This setting can be overridden by a ``context`` request parameter to the
2901 ``comparison`` command, taking the same values.
2912 ``comparison`` command, taking the same values.
2902
2913
2903 ``contact``
2914 ``contact``
2904 Name or email address of the person in charge of the repository.
2915 Name or email address of the person in charge of the repository.
2905 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2916 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2906
2917
2907 ``csp``
2918 ``csp``
2908 Send a ``Content-Security-Policy`` HTTP header with this value.
2919 Send a ``Content-Security-Policy`` HTTP header with this value.
2909
2920
2910 The value may contain a special string ``%nonce%``, which will be replaced
2921 The value may contain a special string ``%nonce%``, which will be replaced
2911 by a randomly-generated one-time use value. If the value contains
2922 by a randomly-generated one-time use value. If the value contains
2912 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2923 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2913 one-time property of the nonce. This nonce will also be inserted into
2924 one-time property of the nonce. This nonce will also be inserted into
2914 ``<script>`` elements containing inline JavaScript.
2925 ``<script>`` elements containing inline JavaScript.
2915
2926
2916 Note: lots of HTML content sent by the server is derived from repository
2927 Note: lots of HTML content sent by the server is derived from repository
2917 data. Please consider the potential for malicious repository data to
2928 data. Please consider the potential for malicious repository data to
2918 "inject" itself into generated HTML content as part of your security
2929 "inject" itself into generated HTML content as part of your security
2919 threat model.
2930 threat model.
2920
2931
2921 ``deny_push``
2932 ``deny_push``
2922 Whether to deny pushing to the repository. If empty or not set,
2933 Whether to deny pushing to the repository. If empty or not set,
2923 push is not denied. If the special value ``*``, all remote users are
2934 push is not denied. If the special value ``*``, all remote users are
2924 denied push. Otherwise, unauthenticated users are all denied, and
2935 denied push. Otherwise, unauthenticated users are all denied, and
2925 any authenticated user name present in this list is also denied. The
2936 any authenticated user name present in this list is also denied. The
2926 contents of the deny_push list are examined before the allow-push list.
2937 contents of the deny_push list are examined before the allow-push list.
2927
2938
2928 ``deny_read``
2939 ``deny_read``
2929 Whether to deny reading/viewing of the repository. If this list is
2940 Whether to deny reading/viewing of the repository. If this list is
2930 not empty, unauthenticated users are all denied, and any
2941 not empty, unauthenticated users are all denied, and any
2931 authenticated user name present in this list is also denied access to
2942 authenticated user name present in this list is also denied access to
2932 the repository. If set to the special value ``*``, all remote users
2943 the repository. If set to the special value ``*``, all remote users
2933 are denied access (rarely needed ;). If deny_read is empty or not set,
2944 are denied access (rarely needed ;). If deny_read is empty or not set,
2934 the determination of repository access depends on the presence and
2945 the determination of repository access depends on the presence and
2935 content of the allow_read list (see description). If both
2946 content of the allow_read list (see description). If both
2936 deny_read and allow_read are empty or not set, then access is
2947 deny_read and allow_read are empty or not set, then access is
2937 permitted to all users by default. If the repository is being
2948 permitted to all users by default. If the repository is being
2938 served via hgwebdir, denied users will not be able to see it in
2949 served via hgwebdir, denied users will not be able to see it in
2939 the list of repositories. The contents of the deny_read list have
2950 the list of repositories. The contents of the deny_read list have
2940 priority over (are examined before) the contents of the allow_read
2951 priority over (are examined before) the contents of the allow_read
2941 list.
2952 list.
2942
2953
2943 ``descend``
2954 ``descend``
2944 hgwebdir indexes will not descend into subdirectories. Only repositories
2955 hgwebdir indexes will not descend into subdirectories. Only repositories
2945 directly in the current path will be shown (other repositories are still
2956 directly in the current path will be shown (other repositories are still
2946 available from the index corresponding to their containing path).
2957 available from the index corresponding to their containing path).
2947
2958
2948 ``description``
2959 ``description``
2949 Textual description of the repository's purpose or contents.
2960 Textual description of the repository's purpose or contents.
2950 (default: "unknown")
2961 (default: "unknown")
2951
2962
2952 ``encoding``
2963 ``encoding``
2953 Character encoding name. (default: the current locale charset)
2964 Character encoding name. (default: the current locale charset)
2954 Example: "UTF-8".
2965 Example: "UTF-8".
2955
2966
2956 ``errorlog``
2967 ``errorlog``
2957 Where to output the error log. (default: stderr)
2968 Where to output the error log. (default: stderr)
2958
2969
2959 ``guessmime``
2970 ``guessmime``
2960 Control MIME types for raw download of file content.
2971 Control MIME types for raw download of file content.
2961 Set to True to let hgweb guess the content type from the file
2972 Set to True to let hgweb guess the content type from the file
2962 extension. This will serve HTML files as ``text/html`` and might
2973 extension. This will serve HTML files as ``text/html`` and might
2963 allow cross-site scripting attacks when serving untrusted
2974 allow cross-site scripting attacks when serving untrusted
2964 repositories. (default: False)
2975 repositories. (default: False)
2965
2976
2966 ``hidden``
2977 ``hidden``
2967 Whether to hide the repository in the hgwebdir index.
2978 Whether to hide the repository in the hgwebdir index.
2968 (default: False)
2979 (default: False)
2969
2980
2970 ``ipv6``
2981 ``ipv6``
2971 Whether to use IPv6. (default: False)
2982 Whether to use IPv6. (default: False)
2972
2983
2973 ``labels``
2984 ``labels``
2974 List of string *labels* associated with the repository.
2985 List of string *labels* associated with the repository.
2975
2986
2976 Labels are exposed as a template keyword and can be used to customize
2987 Labels are exposed as a template keyword and can be used to customize
2977 output. e.g. the ``index`` template can group or filter repositories
2988 output. e.g. the ``index`` template can group or filter repositories
2978 by labels and the ``summary`` template can display additional content
2989 by labels and the ``summary`` template can display additional content
2979 if a specific label is present.
2990 if a specific label is present.
2980
2991
2981 ``logoimg``
2992 ``logoimg``
2982 File name of the logo image that some templates display on each page.
2993 File name of the logo image that some templates display on each page.
2983 The file name is relative to ``staticurl``. That is, the full path to
2994 The file name is relative to ``staticurl``. That is, the full path to
2984 the logo image is "staticurl/logoimg".
2995 the logo image is "staticurl/logoimg".
2985 If unset, ``hglogo.png`` will be used.
2996 If unset, ``hglogo.png`` will be used.
2986
2997
2987 ``logourl``
2998 ``logourl``
2988 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2999 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2989 will be used.
3000 will be used.
2990
3001
2991 ``maxchanges``
3002 ``maxchanges``
2992 Maximum number of changes to list on the changelog. (default: 10)
3003 Maximum number of changes to list on the changelog. (default: 10)
2993
3004
2994 ``maxfiles``
3005 ``maxfiles``
2995 Maximum number of files to list per changeset. (default: 10)
3006 Maximum number of files to list per changeset. (default: 10)
2996
3007
2997 ``maxshortchanges``
3008 ``maxshortchanges``
2998 Maximum number of changes to list on the shortlog, graph or filelog
3009 Maximum number of changes to list on the shortlog, graph or filelog
2999 pages. (default: 60)
3010 pages. (default: 60)
3000
3011
3001 ``name``
3012 ``name``
3002 Repository name to use in the web interface.
3013 Repository name to use in the web interface.
3003 (default: current working directory)
3014 (default: current working directory)
3004
3015
3005 ``port``
3016 ``port``
3006 Port to listen on. (default: 8000)
3017 Port to listen on. (default: 8000)
3007
3018
3008 ``prefix``
3019 ``prefix``
3009 Prefix path to serve from. (default: '' (server root))
3020 Prefix path to serve from. (default: '' (server root))
3010
3021
3011 ``push_ssl``
3022 ``push_ssl``
3012 Whether to require that inbound pushes be transported over SSL to
3023 Whether to require that inbound pushes be transported over SSL to
3013 prevent password sniffing. (default: True)
3024 prevent password sniffing. (default: True)
3014
3025
3015 ``refreshinterval``
3026 ``refreshinterval``
3016 How frequently directory listings re-scan the filesystem for new
3027 How frequently directory listings re-scan the filesystem for new
3017 repositories, in seconds. This is relevant when wildcards are used
3028 repositories, in seconds. This is relevant when wildcards are used
3018 to define paths. Depending on how much filesystem traversal is
3029 to define paths. Depending on how much filesystem traversal is
3019 required, refreshing may negatively impact performance.
3030 required, refreshing may negatively impact performance.
3020
3031
3021 Values less than or equal to 0 always refresh.
3032 Values less than or equal to 0 always refresh.
3022 (default: 20)
3033 (default: 20)
3023
3034
3024 ``server-header``
3035 ``server-header``
3025 Value for HTTP ``Server`` response header.
3036 Value for HTTP ``Server`` response header.
3026
3037
3027 ``static``
3038 ``static``
3028 Directory where static files are served from.
3039 Directory where static files are served from.
3029
3040
3030 ``staticurl``
3041 ``staticurl``
3031 Base URL to use for static files. If unset, static files (e.g. the
3042 Base URL to use for static files. If unset, static files (e.g. the
3032 hgicon.png favicon) will be served by the CGI script itself. Use
3043 hgicon.png favicon) will be served by the CGI script itself. Use
3033 this setting to serve them directly with the HTTP server.
3044 this setting to serve them directly with the HTTP server.
3034 Example: ``http://hgserver/static/``.
3045 Example: ``http://hgserver/static/``.
3035
3046
3036 ``stripes``
3047 ``stripes``
3037 How many lines a "zebra stripe" should span in multi-line output.
3048 How many lines a "zebra stripe" should span in multi-line output.
3038 Set to 0 to disable. (default: 1)
3049 Set to 0 to disable. (default: 1)
3039
3050
3040 ``style``
3051 ``style``
3041 Which template map style to use. The available options are the names of
3052 Which template map style to use. The available options are the names of
3042 subdirectories in the HTML templates path. (default: ``paper``)
3053 subdirectories in the HTML templates path. (default: ``paper``)
3043 Example: ``monoblue``.
3054 Example: ``monoblue``.
3044
3055
3045 ``templates``
3056 ``templates``
3046 Where to find the HTML templates. The default path to the HTML templates
3057 Where to find the HTML templates. The default path to the HTML templates
3047 can be obtained from ``hg debuginstall``.
3058 can be obtained from ``hg debuginstall``.
3048
3059
3049 ``websub``
3060 ``websub``
3050 ----------
3061 ----------
3051
3062
3052 Web substitution filter definition. You can use this section to
3063 Web substitution filter definition. You can use this section to
3053 define a set of regular expression substitution patterns which
3064 define a set of regular expression substitution patterns which
3054 let you automatically modify the hgweb server output.
3065 let you automatically modify the hgweb server output.
3055
3066
3056 The default hgweb templates only apply these substitution patterns
3067 The default hgweb templates only apply these substitution patterns
3057 on the revision description fields. You can apply them anywhere
3068 on the revision description fields. You can apply them anywhere
3058 you want when you create your own templates by adding calls to the
3069 you want when you create your own templates by adding calls to the
3059 "websub" filter (usually after calling the "escape" filter).
3070 "websub" filter (usually after calling the "escape" filter).
3060
3071
3061 This can be used, for example, to convert issue references to links
3072 This can be used, for example, to convert issue references to links
3062 to your issue tracker, or to convert "markdown-like" syntax into
3073 to your issue tracker, or to convert "markdown-like" syntax into
3063 HTML (see the examples below).
3074 HTML (see the examples below).
3064
3075
3065 Each entry in this section names a substitution filter.
3076 Each entry in this section names a substitution filter.
3066 The value of each entry defines the substitution expression itself.
3077 The value of each entry defines the substitution expression itself.
3067 The websub expressions follow the old interhg extension syntax,
3078 The websub expressions follow the old interhg extension syntax,
3068 which in turn imitates the Unix sed replacement syntax::
3079 which in turn imitates the Unix sed replacement syntax::
3069
3080
3070 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
3081 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
3071
3082
3072 You can use any separator other than "/". The final "i" is optional
3083 You can use any separator other than "/". The final "i" is optional
3073 and indicates that the search must be case insensitive.
3084 and indicates that the search must be case insensitive.
3074
3085
3075 Examples::
3086 Examples::
3076
3087
3077 [websub]
3088 [websub]
3078 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
3089 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
3079 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
3090 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
3080 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
3091 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
3081
3092
3082 ``worker``
3093 ``worker``
3083 ----------
3094 ----------
3084
3095
3085 Parallel master/worker configuration. We currently perform working
3096 Parallel master/worker configuration. We currently perform working
3086 directory updates in parallel on Unix-like systems, which greatly
3097 directory updates in parallel on Unix-like systems, which greatly
3087 helps performance.
3098 helps performance.
3088
3099
3089 ``enabled``
3100 ``enabled``
3090 Whether to enable workers code to be used.
3101 Whether to enable workers code to be used.
3091 (default: true)
3102 (default: true)
3092
3103
3093 ``numcpus``
3104 ``numcpus``
3094 Number of CPUs to use for parallel operations. A zero or
3105 Number of CPUs to use for parallel operations. A zero or
3095 negative value is treated as ``use the default``.
3106 negative value is treated as ``use the default``.
3096 (default: 4 or the number of CPUs on the system, whichever is larger)
3107 (default: 4 or the number of CPUs on the system, whichever is larger)
3097
3108
3098 ``backgroundclose``
3109 ``backgroundclose``
3099 Whether to enable closing file handles on background threads during certain
3110 Whether to enable closing file handles on background threads during certain
3100 operations. Some platforms aren't very efficient at closing file
3111 operations. Some platforms aren't very efficient at closing file
3101 handles that have been written or appended to. By performing file closing
3112 handles that have been written or appended to. By performing file closing
3102 on background threads, file write rate can increase substantially.
3113 on background threads, file write rate can increase substantially.
3103 (default: true on Windows, false elsewhere)
3114 (default: true on Windows, false elsewhere)
3104
3115
3105 ``backgroundcloseminfilecount``
3116 ``backgroundcloseminfilecount``
3106 Minimum number of files required to trigger background file closing.
3117 Minimum number of files required to trigger background file closing.
3107 Operations not writing this many files won't start background close
3118 Operations not writing this many files won't start background close
3108 threads.
3119 threads.
3109 (default: 2048)
3120 (default: 2048)
3110
3121
3111 ``backgroundclosemaxqueue``
3122 ``backgroundclosemaxqueue``
3112 The maximum number of opened file handles waiting to be closed in the
3123 The maximum number of opened file handles waiting to be closed in the
3113 background. This option only has an effect if ``backgroundclose`` is
3124 background. This option only has an effect if ``backgroundclose`` is
3114 enabled.
3125 enabled.
3115 (default: 384)
3126 (default: 384)
3116
3127
3117 ``backgroundclosethreadcount``
3128 ``backgroundclosethreadcount``
3118 Number of threads to process background file closes. Only relevant if
3129 Number of threads to process background file closes. Only relevant if
3119 ``backgroundclose`` is enabled.
3130 ``backgroundclose`` is enabled.
3120 (default: 4)
3131 (default: 4)
@@ -1,1946 +1,2037 b''
1 Test basic extension support
1 Test basic extension support
2 $ cat > unflush.py <<EOF
2 $ cat > unflush.py <<EOF
3 > import sys
3 > import sys
4 > from mercurial import pycompat
4 > from mercurial import pycompat
5 > if pycompat.ispy3:
5 > if pycompat.ispy3:
6 > # no changes required
6 > # no changes required
7 > sys.exit(0)
7 > sys.exit(0)
8 > with open(sys.argv[1], 'rb') as f:
8 > with open(sys.argv[1], 'rb') as f:
9 > data = f.read()
9 > data = f.read()
10 > with open(sys.argv[1], 'wb') as f:
10 > with open(sys.argv[1], 'wb') as f:
11 > f.write(data.replace(b', flush=True', b''))
11 > f.write(data.replace(b', flush=True', b''))
12 > EOF
12 > EOF
13
13
14 $ cat > foobar.py <<EOF
14 $ cat > foobar.py <<EOF
15 > import os
15 > import os
16 > from mercurial import commands, exthelper, registrar
16 > from mercurial import commands, exthelper, registrar
17 >
17 >
18 > eh = exthelper.exthelper()
18 > eh = exthelper.exthelper()
19 > eh.configitem(b'tests', b'foo', default=b"Foo")
19 > eh.configitem(b'tests', b'foo', default=b"Foo")
20 >
20 >
21 > uisetup = eh.finaluisetup
21 > uisetup = eh.finaluisetup
22 > uipopulate = eh.finaluipopulate
22 > uipopulate = eh.finaluipopulate
23 > reposetup = eh.finalreposetup
23 > reposetup = eh.finalreposetup
24 > cmdtable = eh.cmdtable
24 > cmdtable = eh.cmdtable
25 > configtable = eh.configtable
25 > configtable = eh.configtable
26 >
26 >
27 > @eh.uisetup
27 > @eh.uisetup
28 > def _uisetup(ui):
28 > def _uisetup(ui):
29 > ui.debug(b"uisetup called [debug]\\n")
29 > ui.debug(b"uisetup called [debug]\\n")
30 > ui.write(b"uisetup called\\n")
30 > ui.write(b"uisetup called\\n")
31 > ui.status(b"uisetup called [status]\\n")
31 > ui.status(b"uisetup called [status]\\n")
32 > ui.flush()
32 > ui.flush()
33 > @eh.uipopulate
33 > @eh.uipopulate
34 > def _uipopulate(ui):
34 > def _uipopulate(ui):
35 > ui._populatecnt = getattr(ui, "_populatecnt", 0) + 1
35 > ui._populatecnt = getattr(ui, "_populatecnt", 0) + 1
36 > ui.write(b"uipopulate called (%d times)\n" % ui._populatecnt)
36 > ui.write(b"uipopulate called (%d times)\n" % ui._populatecnt)
37 > @eh.reposetup
37 > @eh.reposetup
38 > def _reposetup(ui, repo):
38 > def _reposetup(ui, repo):
39 > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root))
39 > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root))
40 > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!"))
40 > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!"))
41 > ui.flush()
41 > ui.flush()
42 > @eh.command(b'foo', [], b'hg foo')
42 > @eh.command(b'foo', [], b'hg foo')
43 > def foo(ui, *args, **kwargs):
43 > def foo(ui, *args, **kwargs):
44 > foo = ui.config(b'tests', b'foo')
44 > foo = ui.config(b'tests', b'foo')
45 > ui.write(foo)
45 > ui.write(foo)
46 > ui.write(b"\\n")
46 > ui.write(b"\\n")
47 > @eh.command(b'bar', [], b'hg bar', norepo=True)
47 > @eh.command(b'bar', [], b'hg bar', norepo=True)
48 > def bar(ui, *args, **kwargs):
48 > def bar(ui, *args, **kwargs):
49 > ui.write(b"Bar\\n")
49 > ui.write(b"Bar\\n")
50 > EOF
50 > EOF
51 $ abspath=`pwd`/foobar.py
51 $ abspath=`pwd`/foobar.py
52
52
53 $ mkdir barfoo
53 $ mkdir barfoo
54 $ cp foobar.py barfoo/__init__.py
54 $ cp foobar.py barfoo/__init__.py
55 $ barfoopath=`pwd`/barfoo
55 $ barfoopath=`pwd`/barfoo
56
56
57 $ hg init a
57 $ hg init a
58 $ cd a
58 $ cd a
59 $ echo foo > file
59 $ echo foo > file
60 $ hg add file
60 $ hg add file
61 $ hg commit -m 'add file'
61 $ hg commit -m 'add file'
62
62
63 $ echo '[extensions]' >> $HGRCPATH
63 $ echo '[extensions]' >> $HGRCPATH
64 $ echo "foobar = $abspath" >> $HGRCPATH
64 $ echo "foobar = $abspath" >> $HGRCPATH
65 $ hg foo
65 $ hg foo
66 uisetup called
66 uisetup called
67 uisetup called [status]
67 uisetup called [status]
68 uipopulate called (1 times)
68 uipopulate called (1 times)
69 uipopulate called (1 times)
69 uipopulate called (1 times)
70 uipopulate called (1 times)
70 uipopulate called (1 times)
71 reposetup called for a
71 reposetup called for a
72 ui == repo.ui
72 ui == repo.ui
73 uipopulate called (1 times) (chg !)
73 uipopulate called (1 times) (chg !)
74 uipopulate called (1 times) (chg !)
74 uipopulate called (1 times) (chg !)
75 uipopulate called (1 times) (chg !)
75 uipopulate called (1 times) (chg !)
76 uipopulate called (1 times) (chg !)
76 uipopulate called (1 times) (chg !)
77 uipopulate called (1 times) (chg !)
77 uipopulate called (1 times) (chg !)
78 reposetup called for a (chg !)
78 reposetup called for a (chg !)
79 ui == repo.ui (chg !)
79 ui == repo.ui (chg !)
80 Foo
80 Foo
81 $ hg foo --quiet
81 $ hg foo --quiet
82 uisetup called (no-chg !)
82 uisetup called (no-chg !)
83 uipopulate called (1 times)
83 uipopulate called (1 times)
84 uipopulate called (1 times)
84 uipopulate called (1 times)
85 uipopulate called (1 times) (chg !)
85 uipopulate called (1 times) (chg !)
86 uipopulate called (1 times) (chg !)
86 uipopulate called (1 times) (chg !)
87 uipopulate called (1 times)
87 uipopulate called (1 times)
88 reposetup called for a
88 reposetup called for a
89 ui == repo.ui
89 ui == repo.ui
90 Foo
90 Foo
91 $ hg foo --debug
91 $ hg foo --debug
92 uisetup called [debug] (no-chg !)
92 uisetup called [debug] (no-chg !)
93 uisetup called (no-chg !)
93 uisetup called (no-chg !)
94 uisetup called [status] (no-chg !)
94 uisetup called [status] (no-chg !)
95 uipopulate called (1 times)
95 uipopulate called (1 times)
96 uipopulate called (1 times)
96 uipopulate called (1 times)
97 uipopulate called (1 times) (chg !)
97 uipopulate called (1 times) (chg !)
98 uipopulate called (1 times) (chg !)
98 uipopulate called (1 times) (chg !)
99 uipopulate called (1 times)
99 uipopulate called (1 times)
100 reposetup called for a
100 reposetup called for a
101 ui == repo.ui
101 ui == repo.ui
102 Foo
102 Foo
103
103
104 $ cd ..
104 $ cd ..
105 $ hg clone a b
105 $ hg clone a b
106 uisetup called (no-chg !)
106 uisetup called (no-chg !)
107 uisetup called [status] (no-chg !)
107 uisetup called [status] (no-chg !)
108 uipopulate called (1 times)
108 uipopulate called (1 times)
109 uipopulate called (1 times) (chg !)
109 uipopulate called (1 times) (chg !)
110 uipopulate called (1 times)
110 uipopulate called (1 times)
111 reposetup called for a
111 reposetup called for a
112 ui == repo.ui
112 ui == repo.ui
113 uipopulate called (1 times)
113 uipopulate called (1 times)
114 uipopulate called (1 times)
114 uipopulate called (1 times)
115 reposetup called for b
115 reposetup called for b
116 ui == repo.ui
116 ui == repo.ui
117 updating to branch default
117 updating to branch default
118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
119
119
120 $ hg bar
120 $ hg bar
121 uisetup called (no-chg !)
121 uisetup called (no-chg !)
122 uisetup called [status] (no-chg !)
122 uisetup called [status] (no-chg !)
123 uipopulate called (1 times)
123 uipopulate called (1 times)
124 uipopulate called (1 times) (chg !)
124 uipopulate called (1 times) (chg !)
125 Bar
125 Bar
126 $ echo 'foobar = !' >> $HGRCPATH
126 $ echo 'foobar = !' >> $HGRCPATH
127
127
128 module/__init__.py-style
128 module/__init__.py-style
129
129
130 $ echo "barfoo = $barfoopath" >> $HGRCPATH
130 $ echo "barfoo = $barfoopath" >> $HGRCPATH
131 $ cd a
131 $ cd a
132 $ hg foo
132 $ hg foo
133 uisetup called
133 uisetup called
134 uisetup called [status]
134 uisetup called [status]
135 uipopulate called (1 times)
135 uipopulate called (1 times)
136 uipopulate called (1 times)
136 uipopulate called (1 times)
137 uipopulate called (1 times)
137 uipopulate called (1 times)
138 reposetup called for a
138 reposetup called for a
139 ui == repo.ui
139 ui == repo.ui
140 uipopulate called (1 times) (chg !)
140 uipopulate called (1 times) (chg !)
141 uipopulate called (1 times) (chg !)
141 uipopulate called (1 times) (chg !)
142 uipopulate called (1 times) (chg !)
142 uipopulate called (1 times) (chg !)
143 uipopulate called (1 times) (chg !)
143 uipopulate called (1 times) (chg !)
144 uipopulate called (1 times) (chg !)
144 uipopulate called (1 times) (chg !)
145 reposetup called for a (chg !)
145 reposetup called for a (chg !)
146 ui == repo.ui (chg !)
146 ui == repo.ui (chg !)
147 Foo
147 Foo
148 $ echo 'barfoo = !' >> $HGRCPATH
148 $ echo 'barfoo = !' >> $HGRCPATH
149
149
150 Check that extensions are loaded in phases:
150 Check that extensions are loaded in phases:
151
151
152 $ cat > foo.py <<EOF
152 $ cat > foo.py <<EOF
153 > from __future__ import print_function
153 > from __future__ import print_function
154 > import os
154 > import os
155 > from mercurial import exthelper
155 > from mercurial import exthelper
156 > from mercurial.utils import procutil
156 > from mercurial.utils import procutil
157 >
157 >
158 > def write(msg):
158 > def write(msg):
159 > procutil.stdout.write(msg)
159 > procutil.stdout.write(msg)
160 > procutil.stdout.flush()
160 > procutil.stdout.flush()
161 >
161 >
162 > name = os.path.basename(__file__).rsplit('.', 1)[0]
162 > name = os.path.basename(__file__).rsplit('.', 1)[0]
163 > bytesname = name.encode('utf-8')
163 > bytesname = name.encode('utf-8')
164 > write(b"1) %s imported\n" % bytesname)
164 > write(b"1) %s imported\n" % bytesname)
165 > eh = exthelper.exthelper()
165 > eh = exthelper.exthelper()
166 > @eh.uisetup
166 > @eh.uisetup
167 > def _uisetup(ui):
167 > def _uisetup(ui):
168 > write(b"2) %s uisetup\n" % bytesname)
168 > write(b"2) %s uisetup\n" % bytesname)
169 > @eh.extsetup
169 > @eh.extsetup
170 > def _extsetup(ui):
170 > def _extsetup(ui):
171 > write(b"3) %s extsetup\n" % bytesname)
171 > write(b"3) %s extsetup\n" % bytesname)
172 > @eh.uipopulate
172 > @eh.uipopulate
173 > def _uipopulate(ui):
173 > def _uipopulate(ui):
174 > write(b"4) %s uipopulate\n" % bytesname)
174 > write(b"4) %s uipopulate\n" % bytesname)
175 > @eh.reposetup
175 > @eh.reposetup
176 > def _reposetup(ui, repo):
176 > def _reposetup(ui, repo):
177 > write(b"5) %s reposetup\n" % bytesname)
177 > write(b"5) %s reposetup\n" % bytesname)
178 >
178 >
179 > extsetup = eh.finalextsetup
179 > extsetup = eh.finalextsetup
180 > reposetup = eh.finalreposetup
180 > reposetup = eh.finalreposetup
181 > uipopulate = eh.finaluipopulate
181 > uipopulate = eh.finaluipopulate
182 > uisetup = eh.finaluisetup
182 > uisetup = eh.finaluisetup
183 > revsetpredicate = eh.revsetpredicate
183 > revsetpredicate = eh.revsetpredicate
184 >
184 >
185 > # custom predicate to check registration of functions at loading
185 > # custom predicate to check registration of functions at loading
186 > from mercurial import (
186 > from mercurial import (
187 > smartset,
187 > smartset,
188 > )
188 > )
189 > @eh.revsetpredicate(bytesname, safe=True) # safe=True for query via hgweb
189 > @eh.revsetpredicate(bytesname, safe=True) # safe=True for query via hgweb
190 > def custompredicate(repo, subset, x):
190 > def custompredicate(repo, subset, x):
191 > return smartset.baseset([r for r in subset if r in {0}])
191 > return smartset.baseset([r for r in subset if r in {0}])
192 > EOF
192 > EOF
193 $ "$PYTHON" $TESTTMP/unflush.py foo.py
193 $ "$PYTHON" $TESTTMP/unflush.py foo.py
194
194
195 $ cp foo.py bar.py
195 $ cp foo.py bar.py
196 $ echo 'foo = foo.py' >> $HGRCPATH
196 $ echo 'foo = foo.py' >> $HGRCPATH
197 $ echo 'bar = bar.py' >> $HGRCPATH
197 $ echo 'bar = bar.py' >> $HGRCPATH
198
198
199 Check normal command's load order of extensions and registration of functions
199 Check normal command's load order of extensions and registration of functions
200
200
201 On chg server, extension should be first set up by the server. Then
201 On chg server, extension should be first set up by the server. Then
202 object-level setup should follow in the worker process.
202 object-level setup should follow in the worker process.
203
203
204 $ hg log -r "foo() and bar()" -q
204 $ hg log -r "foo() and bar()" -q
205 1) foo imported
205 1) foo imported
206 1) bar imported
206 1) bar imported
207 2) foo uisetup
207 2) foo uisetup
208 2) bar uisetup
208 2) bar uisetup
209 3) foo extsetup
209 3) foo extsetup
210 3) bar extsetup
210 3) bar extsetup
211 4) foo uipopulate
211 4) foo uipopulate
212 4) bar uipopulate
212 4) bar uipopulate
213 4) foo uipopulate
213 4) foo uipopulate
214 4) bar uipopulate
214 4) bar uipopulate
215 4) foo uipopulate
215 4) foo uipopulate
216 4) bar uipopulate
216 4) bar uipopulate
217 5) foo reposetup
217 5) foo reposetup
218 5) bar reposetup
218 5) bar reposetup
219 4) foo uipopulate (chg !)
219 4) foo uipopulate (chg !)
220 4) bar uipopulate (chg !)
220 4) bar uipopulate (chg !)
221 4) foo uipopulate (chg !)
221 4) foo uipopulate (chg !)
222 4) bar uipopulate (chg !)
222 4) bar uipopulate (chg !)
223 4) foo uipopulate (chg !)
223 4) foo uipopulate (chg !)
224 4) bar uipopulate (chg !)
224 4) bar uipopulate (chg !)
225 4) foo uipopulate (chg !)
225 4) foo uipopulate (chg !)
226 4) bar uipopulate (chg !)
226 4) bar uipopulate (chg !)
227 4) foo uipopulate (chg !)
227 4) foo uipopulate (chg !)
228 4) bar uipopulate (chg !)
228 4) bar uipopulate (chg !)
229 5) foo reposetup (chg !)
229 5) foo reposetup (chg !)
230 5) bar reposetup (chg !)
230 5) bar reposetup (chg !)
231 0:c24b9ac61126
231 0:c24b9ac61126
232
232
233 Check hgweb's load order of extensions and registration of functions
233 Check hgweb's load order of extensions and registration of functions
234
234
235 $ cat > hgweb.cgi <<EOF
235 $ cat > hgweb.cgi <<EOF
236 > #!$PYTHON
236 > #!$PYTHON
237 > from mercurial import demandimport; demandimport.enable()
237 > from mercurial import demandimport; demandimport.enable()
238 > from mercurial.hgweb import hgweb
238 > from mercurial.hgweb import hgweb
239 > from mercurial.hgweb import wsgicgi
239 > from mercurial.hgweb import wsgicgi
240 > application = hgweb(b'.', b'test repo')
240 > application = hgweb(b'.', b'test repo')
241 > wsgicgi.launch(application)
241 > wsgicgi.launch(application)
242 > EOF
242 > EOF
243 $ . "$TESTDIR/cgienv"
243 $ . "$TESTDIR/cgienv"
244
244
245 $ PATH_INFO='/' SCRIPT_NAME='' "$PYTHON" hgweb.cgi \
245 $ PATH_INFO='/' SCRIPT_NAME='' "$PYTHON" hgweb.cgi \
246 > | grep '^[0-9]) ' # ignores HTML output
246 > | grep '^[0-9]) ' # ignores HTML output
247 1) foo imported
247 1) foo imported
248 1) bar imported
248 1) bar imported
249 2) foo uisetup
249 2) foo uisetup
250 2) bar uisetup
250 2) bar uisetup
251 3) foo extsetup
251 3) foo extsetup
252 3) bar extsetup
252 3) bar extsetup
253 4) foo uipopulate
253 4) foo uipopulate
254 4) bar uipopulate
254 4) bar uipopulate
255 4) foo uipopulate
255 4) foo uipopulate
256 4) bar uipopulate
256 4) bar uipopulate
257 5) foo reposetup
257 5) foo reposetup
258 5) bar reposetup
258 5) bar reposetup
259
259
260 (check that revset predicate foo() and bar() are available)
260 (check that revset predicate foo() and bar() are available)
261
261
262 #if msys
262 #if msys
263 $ PATH_INFO='//shortlog'
263 $ PATH_INFO='//shortlog'
264 #else
264 #else
265 $ PATH_INFO='/shortlog'
265 $ PATH_INFO='/shortlog'
266 #endif
266 #endif
267 $ export PATH_INFO
267 $ export PATH_INFO
268 $ SCRIPT_NAME='' QUERY_STRING='rev=foo() and bar()' "$PYTHON" hgweb.cgi \
268 $ SCRIPT_NAME='' QUERY_STRING='rev=foo() and bar()' "$PYTHON" hgweb.cgi \
269 > | grep '<a href="/rev/[0-9a-z]*">'
269 > | grep '<a href="/rev/[0-9a-z]*">'
270 <a href="/rev/c24b9ac61126">add file</a>
270 <a href="/rev/c24b9ac61126">add file</a>
271
271
272 $ echo 'foo = !' >> $HGRCPATH
272 $ echo 'foo = !' >> $HGRCPATH
273 $ echo 'bar = !' >> $HGRCPATH
273 $ echo 'bar = !' >> $HGRCPATH
274
274
275 Check "from __future__ import absolute_import" support for external libraries
275 Check "from __future__ import absolute_import" support for external libraries
276
276
277 (import-checker.py reports issues for some of heredoc python code
277 (import-checker.py reports issues for some of heredoc python code
278 fragments below, because import-checker.py does not know test specific
278 fragments below, because import-checker.py does not know test specific
279 package hierarchy. NO_CHECK_* should be used as a limit mark of
279 package hierarchy. NO_CHECK_* should be used as a limit mark of
280 heredoc, in order to make import-checker.py ignore them. For
280 heredoc, in order to make import-checker.py ignore them. For
281 simplicity, all python code fragments below are generated with such
281 simplicity, all python code fragments below are generated with such
282 limit mark, regardless of importing module or not.)
282 limit mark, regardless of importing module or not.)
283
283
284 #if windows
284 #if windows
285 $ PATHSEP=";"
285 $ PATHSEP=";"
286 #else
286 #else
287 $ PATHSEP=":"
287 $ PATHSEP=":"
288 #endif
288 #endif
289 $ export PATHSEP
289 $ export PATHSEP
290
290
291 $ mkdir $TESTTMP/libroot
291 $ mkdir $TESTTMP/libroot
292 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
292 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
293 $ mkdir $TESTTMP/libroot/mod
293 $ mkdir $TESTTMP/libroot/mod
294 $ touch $TESTTMP/libroot/mod/__init__.py
294 $ touch $TESTTMP/libroot/mod/__init__.py
295 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
295 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
296
296
297 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<NO_CHECK_EOF
297 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<NO_CHECK_EOF
298 > from __future__ import absolute_import, print_function
298 > from __future__ import absolute_import, print_function
299 > import ambig # should load "libroot/ambig.py"
299 > import ambig # should load "libroot/ambig.py"
300 > s = ambig.s
300 > s = ambig.s
301 > NO_CHECK_EOF
301 > NO_CHECK_EOF
302 $ cat > loadabs.py <<NO_CHECK_EOF
302 $ cat > loadabs.py <<NO_CHECK_EOF
303 > import mod.ambigabs as ambigabs
303 > import mod.ambigabs as ambigabs
304 > def extsetup(ui):
304 > def extsetup(ui):
305 > print('ambigabs.s=%s' % ambigabs.s, flush=True)
305 > print('ambigabs.s=%s' % ambigabs.s, flush=True)
306 > NO_CHECK_EOF
306 > NO_CHECK_EOF
307 $ "$PYTHON" $TESTTMP/unflush.py loadabs.py
307 $ "$PYTHON" $TESTTMP/unflush.py loadabs.py
308 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
308 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
309 ambigabs.s=libroot/ambig.py
309 ambigabs.s=libroot/ambig.py
310 $TESTTMP/a
310 $TESTTMP/a
311
311
312 #if no-py3
312 #if no-py3
313 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<NO_CHECK_EOF
313 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<NO_CHECK_EOF
314 > from __future__ import print_function
314 > from __future__ import print_function
315 > import ambig # should load "libroot/mod/ambig.py"
315 > import ambig # should load "libroot/mod/ambig.py"
316 > s = ambig.s
316 > s = ambig.s
317 > NO_CHECK_EOF
317 > NO_CHECK_EOF
318 $ cat > loadrel.py <<NO_CHECK_EOF
318 $ cat > loadrel.py <<NO_CHECK_EOF
319 > import mod.ambigrel as ambigrel
319 > import mod.ambigrel as ambigrel
320 > def extsetup(ui):
320 > def extsetup(ui):
321 > print('ambigrel.s=%s' % ambigrel.s, flush=True)
321 > print('ambigrel.s=%s' % ambigrel.s, flush=True)
322 > NO_CHECK_EOF
322 > NO_CHECK_EOF
323 $ "$PYTHON" $TESTTMP/unflush.py loadrel.py
323 $ "$PYTHON" $TESTTMP/unflush.py loadrel.py
324 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
324 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
325 ambigrel.s=libroot/mod/ambig.py
325 ambigrel.s=libroot/mod/ambig.py
326 $TESTTMP/a
326 $TESTTMP/a
327 #endif
327 #endif
328
328
329 Check absolute/relative import of extension specific modules
329 Check absolute/relative import of extension specific modules
330
330
331 $ mkdir $TESTTMP/extroot
331 $ mkdir $TESTTMP/extroot
332 $ cat > $TESTTMP/extroot/bar.py <<NO_CHECK_EOF
332 $ cat > $TESTTMP/extroot/bar.py <<NO_CHECK_EOF
333 > s = b'this is extroot.bar'
333 > s = b'this is extroot.bar'
334 > NO_CHECK_EOF
334 > NO_CHECK_EOF
335 $ mkdir $TESTTMP/extroot/sub1
335 $ mkdir $TESTTMP/extroot/sub1
336 $ cat > $TESTTMP/extroot/sub1/__init__.py <<NO_CHECK_EOF
336 $ cat > $TESTTMP/extroot/sub1/__init__.py <<NO_CHECK_EOF
337 > s = b'this is extroot.sub1.__init__'
337 > s = b'this is extroot.sub1.__init__'
338 > NO_CHECK_EOF
338 > NO_CHECK_EOF
339 $ cat > $TESTTMP/extroot/sub1/baz.py <<NO_CHECK_EOF
339 $ cat > $TESTTMP/extroot/sub1/baz.py <<NO_CHECK_EOF
340 > s = b'this is extroot.sub1.baz'
340 > s = b'this is extroot.sub1.baz'
341 > NO_CHECK_EOF
341 > NO_CHECK_EOF
342 $ cat > $TESTTMP/extroot/__init__.py <<NO_CHECK_EOF
342 $ cat > $TESTTMP/extroot/__init__.py <<NO_CHECK_EOF
343 > from __future__ import absolute_import
343 > from __future__ import absolute_import
344 > s = b'this is extroot.__init__'
344 > s = b'this is extroot.__init__'
345 > from . import foo
345 > from . import foo
346 > def extsetup(ui):
346 > def extsetup(ui):
347 > ui.write(b'(extroot) ', foo.func(), b'\n')
347 > ui.write(b'(extroot) ', foo.func(), b'\n')
348 > ui.flush()
348 > ui.flush()
349 > NO_CHECK_EOF
349 > NO_CHECK_EOF
350
350
351 $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF
351 $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF
352 > # test absolute import
352 > # test absolute import
353 > buf = []
353 > buf = []
354 > def func():
354 > def func():
355 > # "not locals" case
355 > # "not locals" case
356 > import extroot.bar
356 > import extroot.bar
357 > buf.append(b'import extroot.bar in func(): %s' % extroot.bar.s)
357 > buf.append(b'import extroot.bar in func(): %s' % extroot.bar.s)
358 > return b'\n(extroot) '.join(buf)
358 > return b'\n(extroot) '.join(buf)
359 > # b"fromlist == ('*',)" case
359 > # b"fromlist == ('*',)" case
360 > from extroot.bar import *
360 > from extroot.bar import *
361 > buf.append(b'from extroot.bar import *: %s' % s)
361 > buf.append(b'from extroot.bar import *: %s' % s)
362 > # "not fromlist" and "if '.' in name" case
362 > # "not fromlist" and "if '.' in name" case
363 > import extroot.sub1.baz
363 > import extroot.sub1.baz
364 > buf.append(b'import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
364 > buf.append(b'import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
365 > # "not fromlist" and NOT "if '.' in name" case
365 > # "not fromlist" and NOT "if '.' in name" case
366 > import extroot
366 > import extroot
367 > buf.append(b'import extroot: %s' % extroot.s)
367 > buf.append(b'import extroot: %s' % extroot.s)
368 > # NOT "not fromlist" and NOT "level != -1" case
368 > # NOT "not fromlist" and NOT "level != -1" case
369 > from extroot.bar import s
369 > from extroot.bar import s
370 > buf.append(b'from extroot.bar import s: %s' % s)
370 > buf.append(b'from extroot.bar import s: %s' % s)
371 > NO_CHECK_EOF
371 > NO_CHECK_EOF
372 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root)
372 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root)
373 (extroot) from extroot.bar import *: this is extroot.bar
373 (extroot) from extroot.bar import *: this is extroot.bar
374 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
374 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
375 (extroot) import extroot: this is extroot.__init__
375 (extroot) import extroot: this is extroot.__init__
376 (extroot) from extroot.bar import s: this is extroot.bar
376 (extroot) from extroot.bar import s: this is extroot.bar
377 (extroot) import extroot.bar in func(): this is extroot.bar
377 (extroot) import extroot.bar in func(): this is extroot.bar
378 $TESTTMP/a
378 $TESTTMP/a
379
379
380 #if no-py3
380 #if no-py3
381 $ rm "$TESTTMP"/extroot/foo.*
381 $ rm "$TESTTMP"/extroot/foo.*
382 $ rm -Rf "$TESTTMP/extroot/__pycache__"
382 $ rm -Rf "$TESTTMP/extroot/__pycache__"
383 $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF
383 $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF
384 > # test relative import
384 > # test relative import
385 > buf = []
385 > buf = []
386 > def func():
386 > def func():
387 > # "not locals" case
387 > # "not locals" case
388 > import bar
388 > import bar
389 > buf.append('import bar in func(): %s' % bar.s)
389 > buf.append('import bar in func(): %s' % bar.s)
390 > return '\n(extroot) '.join(buf)
390 > return '\n(extroot) '.join(buf)
391 > # "fromlist == ('*',)" case
391 > # "fromlist == ('*',)" case
392 > from bar import *
392 > from bar import *
393 > buf.append('from bar import *: %s' % s)
393 > buf.append('from bar import *: %s' % s)
394 > # "not fromlist" and "if '.' in name" case
394 > # "not fromlist" and "if '.' in name" case
395 > import sub1.baz
395 > import sub1.baz
396 > buf.append('import sub1.baz: %s' % sub1.baz.s)
396 > buf.append('import sub1.baz: %s' % sub1.baz.s)
397 > # "not fromlist" and NOT "if '.' in name" case
397 > # "not fromlist" and NOT "if '.' in name" case
398 > import sub1
398 > import sub1
399 > buf.append('import sub1: %s' % sub1.s)
399 > buf.append('import sub1: %s' % sub1.s)
400 > # NOT "not fromlist" and NOT "level != -1" case
400 > # NOT "not fromlist" and NOT "level != -1" case
401 > from bar import s
401 > from bar import s
402 > buf.append('from bar import s: %s' % s)
402 > buf.append('from bar import s: %s' % s)
403 > NO_CHECK_EOF
403 > NO_CHECK_EOF
404 $ hg --config extensions.extroot=$TESTTMP/extroot root
404 $ hg --config extensions.extroot=$TESTTMP/extroot root
405 (extroot) from bar import *: this is extroot.bar
405 (extroot) from bar import *: this is extroot.bar
406 (extroot) import sub1.baz: this is extroot.sub1.baz
406 (extroot) import sub1.baz: this is extroot.sub1.baz
407 (extroot) import sub1: this is extroot.sub1.__init__
407 (extroot) import sub1: this is extroot.sub1.__init__
408 (extroot) from bar import s: this is extroot.bar
408 (extroot) from bar import s: this is extroot.bar
409 (extroot) import bar in func(): this is extroot.bar
409 (extroot) import bar in func(): this is extroot.bar
410 $TESTTMP/a
410 $TESTTMP/a
411 #endif
411 #endif
412
412
413 #if demandimport
413 #if demandimport
414
414
415 Examine whether module loading is delayed until actual referring, even
415 Examine whether module loading is delayed until actual referring, even
416 though module is imported with "absolute_import" feature.
416 though module is imported with "absolute_import" feature.
417
417
418 Files below in each packages are used for described purpose:
418 Files below in each packages are used for described purpose:
419
419
420 - "called": examine whether "from MODULE import ATTR" works correctly
420 - "called": examine whether "from MODULE import ATTR" works correctly
421 - "unused": examine whether loading is delayed correctly
421 - "unused": examine whether loading is delayed correctly
422 - "used": examine whether "from PACKAGE import MODULE" works correctly
422 - "used": examine whether "from PACKAGE import MODULE" works correctly
423
423
424 Package hierarchy is needed to examine whether demand importing works
424 Package hierarchy is needed to examine whether demand importing works
425 as expected for "from SUB.PACK.AGE import MODULE".
425 as expected for "from SUB.PACK.AGE import MODULE".
426
426
427 Setup "external library" to be imported with "absolute_import"
427 Setup "external library" to be imported with "absolute_import"
428 feature.
428 feature.
429
429
430 $ mkdir -p $TESTTMP/extlibroot/lsub1/lsub2
430 $ mkdir -p $TESTTMP/extlibroot/lsub1/lsub2
431 $ touch $TESTTMP/extlibroot/__init__.py
431 $ touch $TESTTMP/extlibroot/__init__.py
432 $ touch $TESTTMP/extlibroot/lsub1/__init__.py
432 $ touch $TESTTMP/extlibroot/lsub1/__init__.py
433 $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py
433 $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py
434
434
435 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<NO_CHECK_EOF
435 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<NO_CHECK_EOF
436 > def func():
436 > def func():
437 > return b"this is extlibroot.lsub1.lsub2.called.func()"
437 > return b"this is extlibroot.lsub1.lsub2.called.func()"
438 > NO_CHECK_EOF
438 > NO_CHECK_EOF
439 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<NO_CHECK_EOF
439 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<NO_CHECK_EOF
440 > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally")
440 > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally")
441 > NO_CHECK_EOF
441 > NO_CHECK_EOF
442 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<NO_CHECK_EOF
442 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<NO_CHECK_EOF
443 > detail = b"this is extlibroot.lsub1.lsub2.used"
443 > detail = b"this is extlibroot.lsub1.lsub2.used"
444 > NO_CHECK_EOF
444 > NO_CHECK_EOF
445
445
446 Setup sub-package of "external library", which causes instantiation of
446 Setup sub-package of "external library", which causes instantiation of
447 demandmod in "recurse down the module chain" code path. Relative
447 demandmod in "recurse down the module chain" code path. Relative
448 importing with "absolute_import" feature isn't tested, because "level
448 importing with "absolute_import" feature isn't tested, because "level
449 >=1 " doesn't cause instantiation of demandmod.
449 >=1 " doesn't cause instantiation of demandmod.
450
450
451 $ mkdir -p $TESTTMP/extlibroot/recursedown/abs
451 $ mkdir -p $TESTTMP/extlibroot/recursedown/abs
452 $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<NO_CHECK_EOF
452 $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<NO_CHECK_EOF
453 > detail = b"this is extlibroot.recursedown.abs.used"
453 > detail = b"this is extlibroot.recursedown.abs.used"
454 > NO_CHECK_EOF
454 > NO_CHECK_EOF
455 $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<NO_CHECK_EOF
455 $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<NO_CHECK_EOF
456 > from __future__ import absolute_import
456 > from __future__ import absolute_import
457 > from extlibroot.recursedown.abs.used import detail
457 > from extlibroot.recursedown.abs.used import detail
458 > NO_CHECK_EOF
458 > NO_CHECK_EOF
459
459
460 $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy
460 $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy
461 $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<NO_CHECK_EOF
461 $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<NO_CHECK_EOF
462 > detail = b"this is extlibroot.recursedown.legacy.used"
462 > detail = b"this is extlibroot.recursedown.legacy.used"
463 > NO_CHECK_EOF
463 > NO_CHECK_EOF
464 $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<NO_CHECK_EOF
464 $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<NO_CHECK_EOF
465 > # legacy style (level == -1) import
465 > # legacy style (level == -1) import
466 > from extlibroot.recursedown.legacy.used import detail
466 > from extlibroot.recursedown.legacy.used import detail
467 > NO_CHECK_EOF
467 > NO_CHECK_EOF
468
468
469 $ cat > $TESTTMP/extlibroot/recursedown/__init__.py <<NO_CHECK_EOF
469 $ cat > $TESTTMP/extlibroot/recursedown/__init__.py <<NO_CHECK_EOF
470 > from __future__ import absolute_import
470 > from __future__ import absolute_import
471 > from extlibroot.recursedown.abs import detail as absdetail
471 > from extlibroot.recursedown.abs import detail as absdetail
472 > from .legacy import detail as legacydetail
472 > from .legacy import detail as legacydetail
473 > NO_CHECK_EOF
473 > NO_CHECK_EOF
474
474
475 Setup package that re-exports an attribute of its submodule as the same
475 Setup package that re-exports an attribute of its submodule as the same
476 name. This leaves 'shadowing.used' pointing to 'used.detail', but still
476 name. This leaves 'shadowing.used' pointing to 'used.detail', but still
477 the submodule 'used' should be somehow accessible. (issue5617)
477 the submodule 'used' should be somehow accessible. (issue5617)
478
478
479 $ mkdir -p $TESTTMP/extlibroot/shadowing
479 $ mkdir -p $TESTTMP/extlibroot/shadowing
480 $ cat > $TESTTMP/extlibroot/shadowing/used.py <<NO_CHECK_EOF
480 $ cat > $TESTTMP/extlibroot/shadowing/used.py <<NO_CHECK_EOF
481 > detail = b"this is extlibroot.shadowing.used"
481 > detail = b"this is extlibroot.shadowing.used"
482 > NO_CHECK_EOF
482 > NO_CHECK_EOF
483 $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<NO_CHECK_EOF
483 $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<NO_CHECK_EOF
484 > from __future__ import absolute_import
484 > from __future__ import absolute_import
485 > from extlibroot.shadowing.used import detail
485 > from extlibroot.shadowing.used import detail
486 > NO_CHECK_EOF
486 > NO_CHECK_EOF
487 $ cat > $TESTTMP/extlibroot/shadowing/__init__.py <<NO_CHECK_EOF
487 $ cat > $TESTTMP/extlibroot/shadowing/__init__.py <<NO_CHECK_EOF
488 > from __future__ import absolute_import
488 > from __future__ import absolute_import
489 > from .used import detail as used
489 > from .used import detail as used
490 > NO_CHECK_EOF
490 > NO_CHECK_EOF
491
491
492 Setup extension local modules to be imported with "absolute_import"
492 Setup extension local modules to be imported with "absolute_import"
493 feature.
493 feature.
494
494
495 $ mkdir -p $TESTTMP/absextroot/xsub1/xsub2
495 $ mkdir -p $TESTTMP/absextroot/xsub1/xsub2
496 $ touch $TESTTMP/absextroot/xsub1/__init__.py
496 $ touch $TESTTMP/absextroot/xsub1/__init__.py
497 $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py
497 $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py
498
498
499 $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<NO_CHECK_EOF
499 $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<NO_CHECK_EOF
500 > def func():
500 > def func():
501 > return b"this is absextroot.xsub1.xsub2.called.func()"
501 > return b"this is absextroot.xsub1.xsub2.called.func()"
502 > NO_CHECK_EOF
502 > NO_CHECK_EOF
503 $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<NO_CHECK_EOF
503 $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<NO_CHECK_EOF
504 > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally")
504 > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally")
505 > NO_CHECK_EOF
505 > NO_CHECK_EOF
506 $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<NO_CHECK_EOF
506 $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<NO_CHECK_EOF
507 > detail = b"this is absextroot.xsub1.xsub2.used"
507 > detail = b"this is absextroot.xsub1.xsub2.used"
508 > NO_CHECK_EOF
508 > NO_CHECK_EOF
509
509
510 Setup extension local modules to examine whether demand importing
510 Setup extension local modules to examine whether demand importing
511 works as expected in "level > 1" case.
511 works as expected in "level > 1" case.
512
512
513 $ cat > $TESTTMP/absextroot/relimportee.py <<NO_CHECK_EOF
513 $ cat > $TESTTMP/absextroot/relimportee.py <<NO_CHECK_EOF
514 > detail = b"this is absextroot.relimportee"
514 > detail = b"this is absextroot.relimportee"
515 > NO_CHECK_EOF
515 > NO_CHECK_EOF
516 $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<NO_CHECK_EOF
516 $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<NO_CHECK_EOF
517 > from __future__ import absolute_import
517 > from __future__ import absolute_import
518 > from mercurial import pycompat
518 > from mercurial import pycompat
519 > from ... import relimportee
519 > from ... import relimportee
520 > detail = b"this relimporter imports %r" % (
520 > detail = b"this relimporter imports %r" % (
521 > pycompat.bytestr(relimportee.detail))
521 > pycompat.bytestr(relimportee.detail))
522 > NO_CHECK_EOF
522 > NO_CHECK_EOF
523
523
524 Setup modules, which actually import extension local modules at
524 Setup modules, which actually import extension local modules at
525 runtime.
525 runtime.
526
526
527 $ cat > $TESTTMP/absextroot/absolute.py << NO_CHECK_EOF
527 $ cat > $TESTTMP/absextroot/absolute.py << NO_CHECK_EOF
528 > from __future__ import absolute_import
528 > from __future__ import absolute_import
529 >
529 >
530 > # import extension local modules absolutely (level = 0)
530 > # import extension local modules absolutely (level = 0)
531 > from absextroot.xsub1.xsub2 import used, unused
531 > from absextroot.xsub1.xsub2 import used, unused
532 > from absextroot.xsub1.xsub2.called import func
532 > from absextroot.xsub1.xsub2.called import func
533 >
533 >
534 > def getresult():
534 > def getresult():
535 > result = []
535 > result = []
536 > result.append(used.detail)
536 > result.append(used.detail)
537 > result.append(func())
537 > result.append(func())
538 > return result
538 > return result
539 > NO_CHECK_EOF
539 > NO_CHECK_EOF
540
540
541 $ cat > $TESTTMP/absextroot/relative.py << NO_CHECK_EOF
541 $ cat > $TESTTMP/absextroot/relative.py << NO_CHECK_EOF
542 > from __future__ import absolute_import
542 > from __future__ import absolute_import
543 >
543 >
544 > # import extension local modules relatively (level == 1)
544 > # import extension local modules relatively (level == 1)
545 > from .xsub1.xsub2 import used, unused
545 > from .xsub1.xsub2 import used, unused
546 > from .xsub1.xsub2.called import func
546 > from .xsub1.xsub2.called import func
547 >
547 >
548 > # import a module, which implies "importing with level > 1"
548 > # import a module, which implies "importing with level > 1"
549 > from .xsub1.xsub2 import relimporter
549 > from .xsub1.xsub2 import relimporter
550 >
550 >
551 > def getresult():
551 > def getresult():
552 > result = []
552 > result = []
553 > result.append(used.detail)
553 > result.append(used.detail)
554 > result.append(func())
554 > result.append(func())
555 > result.append(relimporter.detail)
555 > result.append(relimporter.detail)
556 > return result
556 > return result
557 > NO_CHECK_EOF
557 > NO_CHECK_EOF
558
558
559 Setup main procedure of extension.
559 Setup main procedure of extension.
560
560
561 $ cat > $TESTTMP/absextroot/__init__.py <<NO_CHECK_EOF
561 $ cat > $TESTTMP/absextroot/__init__.py <<NO_CHECK_EOF
562 > from __future__ import absolute_import
562 > from __future__ import absolute_import
563 > from mercurial import registrar
563 > from mercurial import registrar
564 > cmdtable = {}
564 > cmdtable = {}
565 > command = registrar.command(cmdtable)
565 > command = registrar.command(cmdtable)
566 >
566 >
567 > # "absolute" and "relative" shouldn't be imported before actual
567 > # "absolute" and "relative" shouldn't be imported before actual
568 > # command execution, because (1) they import same modules, and (2)
568 > # command execution, because (1) they import same modules, and (2)
569 > # preceding import (= instantiate "demandmod" object instead of
569 > # preceding import (= instantiate "demandmod" object instead of
570 > # real "module" object) might hide problem of succeeding import.
570 > # real "module" object) might hide problem of succeeding import.
571 >
571 >
572 > @command(b'showabsolute', [], norepo=True)
572 > @command(b'showabsolute', [], norepo=True)
573 > def showabsolute(ui, *args, **opts):
573 > def showabsolute(ui, *args, **opts):
574 > from absextroot import absolute
574 > from absextroot import absolute
575 > ui.write(b'ABS: %s\n' % b'\nABS: '.join(absolute.getresult()))
575 > ui.write(b'ABS: %s\n' % b'\nABS: '.join(absolute.getresult()))
576 >
576 >
577 > @command(b'showrelative', [], norepo=True)
577 > @command(b'showrelative', [], norepo=True)
578 > def showrelative(ui, *args, **opts):
578 > def showrelative(ui, *args, **opts):
579 > from . import relative
579 > from . import relative
580 > ui.write(b'REL: %s\n' % b'\nREL: '.join(relative.getresult()))
580 > ui.write(b'REL: %s\n' % b'\nREL: '.join(relative.getresult()))
581 >
581 >
582 > # import modules from external library
582 > # import modules from external library
583 > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused
583 > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused
584 > from extlibroot.lsub1.lsub2.called import func as lfunc
584 > from extlibroot.lsub1.lsub2.called import func as lfunc
585 > from extlibroot.recursedown import absdetail, legacydetail
585 > from extlibroot.recursedown import absdetail, legacydetail
586 > from extlibroot.shadowing import proxied
586 > from extlibroot.shadowing import proxied
587 >
587 >
588 > def uisetup(ui):
588 > def uisetup(ui):
589 > result = []
589 > result = []
590 > result.append(lused.detail)
590 > result.append(lused.detail)
591 > result.append(lfunc())
591 > result.append(lfunc())
592 > result.append(absdetail)
592 > result.append(absdetail)
593 > result.append(legacydetail)
593 > result.append(legacydetail)
594 > result.append(proxied.detail)
594 > result.append(proxied.detail)
595 > ui.write(b'LIB: %s\n' % b'\nLIB: '.join(result))
595 > ui.write(b'LIB: %s\n' % b'\nLIB: '.join(result))
596 > NO_CHECK_EOF
596 > NO_CHECK_EOF
597
597
598 Examine module importing.
598 Examine module importing.
599
599
600 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute)
600 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute)
601 LIB: this is extlibroot.lsub1.lsub2.used
601 LIB: this is extlibroot.lsub1.lsub2.used
602 LIB: this is extlibroot.lsub1.lsub2.called.func()
602 LIB: this is extlibroot.lsub1.lsub2.called.func()
603 LIB: this is extlibroot.recursedown.abs.used
603 LIB: this is extlibroot.recursedown.abs.used
604 LIB: this is extlibroot.recursedown.legacy.used
604 LIB: this is extlibroot.recursedown.legacy.used
605 LIB: this is extlibroot.shadowing.used
605 LIB: this is extlibroot.shadowing.used
606 ABS: this is absextroot.xsub1.xsub2.used
606 ABS: this is absextroot.xsub1.xsub2.used
607 ABS: this is absextroot.xsub1.xsub2.called.func()
607 ABS: this is absextroot.xsub1.xsub2.called.func()
608
608
609 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative)
609 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative)
610 LIB: this is extlibroot.lsub1.lsub2.used
610 LIB: this is extlibroot.lsub1.lsub2.used
611 LIB: this is extlibroot.lsub1.lsub2.called.func()
611 LIB: this is extlibroot.lsub1.lsub2.called.func()
612 LIB: this is extlibroot.recursedown.abs.used
612 LIB: this is extlibroot.recursedown.abs.used
613 LIB: this is extlibroot.recursedown.legacy.used
613 LIB: this is extlibroot.recursedown.legacy.used
614 LIB: this is extlibroot.shadowing.used
614 LIB: this is extlibroot.shadowing.used
615 REL: this is absextroot.xsub1.xsub2.used
615 REL: this is absextroot.xsub1.xsub2.used
616 REL: this is absextroot.xsub1.xsub2.called.func()
616 REL: this is absextroot.xsub1.xsub2.called.func()
617 REL: this relimporter imports 'this is absextroot.relimportee'
617 REL: this relimporter imports 'this is absextroot.relimportee'
618
618
619 Examine whether sub-module is imported relatively as expected.
619 Examine whether sub-module is imported relatively as expected.
620
620
621 See also issue5208 for detail about example case on Python 3.x.
621 See also issue5208 for detail about example case on Python 3.x.
622
622
623 $ f -q $TESTTMP/extlibroot/lsub1/lsub2/notexist.py
623 $ f -q $TESTTMP/extlibroot/lsub1/lsub2/notexist.py
624 $TESTTMP/extlibroot/lsub1/lsub2/notexist.py: file not found
624 $TESTTMP/extlibroot/lsub1/lsub2/notexist.py: file not found
625
625
626 $ cat > $TESTTMP/notexist.py <<NO_CHECK_EOF
626 $ cat > $TESTTMP/notexist.py <<NO_CHECK_EOF
627 > text = 'notexist.py at root is loaded unintentionally\n'
627 > text = 'notexist.py at root is loaded unintentionally\n'
628 > NO_CHECK_EOF
628 > NO_CHECK_EOF
629
629
630 $ cat > $TESTTMP/checkrelativity.py <<NO_CHECK_EOF
630 $ cat > $TESTTMP/checkrelativity.py <<NO_CHECK_EOF
631 > from mercurial import registrar
631 > from mercurial import registrar
632 > cmdtable = {}
632 > cmdtable = {}
633 > command = registrar.command(cmdtable)
633 > command = registrar.command(cmdtable)
634 >
634 >
635 > # demand import avoids failure of importing notexist here, but only on
635 > # demand import avoids failure of importing notexist here, but only on
636 > # Python 2.
636 > # Python 2.
637 > import extlibroot.lsub1.lsub2.notexist
637 > import extlibroot.lsub1.lsub2.notexist
638 >
638 >
639 > @command(b'checkrelativity', [], norepo=True)
639 > @command(b'checkrelativity', [], norepo=True)
640 > def checkrelativity(ui, *args, **opts):
640 > def checkrelativity(ui, *args, **opts):
641 > try:
641 > try:
642 > ui.write(extlibroot.lsub1.lsub2.notexist.text)
642 > ui.write(extlibroot.lsub1.lsub2.notexist.text)
643 > return 1 # unintentional success
643 > return 1 # unintentional success
644 > except ImportError:
644 > except ImportError:
645 > pass # intentional failure
645 > pass # intentional failure
646 > NO_CHECK_EOF
646 > NO_CHECK_EOF
647
647
648 Python 3's lazy importer verifies modules exist before returning the lazy
648 Python 3's lazy importer verifies modules exist before returning the lazy
649 module stub. Our custom lazy importer for Python 2 always returns a stub.
649 module stub. Our custom lazy importer for Python 2 always returns a stub.
650
650
651 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity) || true
651 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity) || true
652 *** failed to import extension "checkrelativity" from $TESTTMP/checkrelativity.py: No module named 'extlibroot.lsub1.lsub2.notexist'
652 *** failed to import extension "checkrelativity" from $TESTTMP/checkrelativity.py: No module named 'extlibroot.lsub1.lsub2.notexist'
653 hg: unknown command 'checkrelativity' (py3 !)
653 hg: unknown command 'checkrelativity' (py3 !)
654 (use 'hg help' for a list of commands) (py3 !)
654 (use 'hg help' for a list of commands) (py3 !)
655
655
656 #endif
656 #endif
657
657
658 (Here, module importing tests are finished. Therefore, use other than
658 (Here, module importing tests are finished. Therefore, use other than
659 NO_CHECK_* limit mark for heredoc python files, in order to apply
659 NO_CHECK_* limit mark for heredoc python files, in order to apply
660 import-checker.py or so on their contents)
660 import-checker.py or so on their contents)
661
661
662 Make sure a broken uisetup doesn't globally break hg:
662 Make sure a broken uisetup doesn't globally break hg:
663 $ cat > $TESTTMP/baduisetup.py <<EOF
663 $ cat > $TESTTMP/baduisetup.py <<EOF
664 > def uisetup(ui):
664 > def uisetup(ui):
665 > 1 / 0
665 > 1 / 0
666 > EOF
666 > EOF
667
667
668 Even though the extension fails during uisetup, hg is still basically usable:
668 Even though the extension fails during uisetup, hg is still basically usable:
669 $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version
669 $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version
670 Traceback (most recent call last):
670 Traceback (most recent call last):
671 File "*/mercurial/extensions.py", line *, in _runuisetup (glob) (no-pyoxidizer !)
671 File "*/mercurial/extensions.py", line *, in _runuisetup (glob) (no-pyoxidizer !)
672 File "mercurial.extensions", line *, in _runuisetup (glob) (pyoxidizer !)
672 File "mercurial.extensions", line *, in _runuisetup (glob) (pyoxidizer !)
673 uisetup(ui)
673 uisetup(ui)
674 File "$TESTTMP/baduisetup.py", line 2, in uisetup
674 File "$TESTTMP/baduisetup.py", line 2, in uisetup
675 1 / 0
675 1 / 0
676 ZeroDivisionError: * by zero (glob)
676 ZeroDivisionError: * by zero (glob)
677 *** failed to set up extension baduisetup: * by zero (glob)
677 *** failed to set up extension baduisetup: * by zero (glob)
678 Mercurial Distributed SCM (version *) (glob)
678 Mercurial Distributed SCM (version *) (glob)
679 (see https://mercurial-scm.org for more information)
679 (see https://mercurial-scm.org for more information)
680
680
681 Copyright (C) 2005-* Olivia Mackall and others (glob)
681 Copyright (C) 2005-* Olivia Mackall and others (glob)
682 This is free software; see the source for copying conditions. There is NO
682 This is free software; see the source for copying conditions. There is NO
683 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
683 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
684
684
685 $ cd ..
685 $ cd ..
686
686
687 hide outer repo
687 hide outer repo
688 $ hg init
688 $ hg init
689
689
690 $ cat > empty.py <<EOF
690 $ cat > empty.py <<EOF
691 > '''empty cmdtable
691 > '''empty cmdtable
692 > '''
692 > '''
693 > cmdtable = {}
693 > cmdtable = {}
694 > EOF
694 > EOF
695 $ emptypath=`pwd`/empty.py
695 $ emptypath=`pwd`/empty.py
696 $ echo "empty = $emptypath" >> $HGRCPATH
696 $ echo "empty = $emptypath" >> $HGRCPATH
697 $ hg help empty
697 $ hg help empty
698 empty extension - empty cmdtable
698 empty extension - empty cmdtable
699
699
700 no commands defined
700 no commands defined
701
701
702
702
703 $ echo 'empty = !' >> $HGRCPATH
703 $ echo 'empty = !' >> $HGRCPATH
704
704
705 $ cat > debugextension.py <<EOF
705 $ cat > debugextension.py <<EOF
706 > '''only debugcommands
706 > '''only debugcommands
707 > '''
707 > '''
708 > from mercurial import registrar
708 > from mercurial import registrar
709 > cmdtable = {}
709 > cmdtable = {}
710 > command = registrar.command(cmdtable)
710 > command = registrar.command(cmdtable)
711 > @command(b'debugfoobar', [], b'hg debugfoobar')
711 > @command(b'debugfoobar', [], b'hg debugfoobar')
712 > def debugfoobar(ui, repo, *args, **opts):
712 > def debugfoobar(ui, repo, *args, **opts):
713 > "yet another debug command"
713 > "yet another debug command"
714 > @command(b'foo', [], b'hg foo')
714 > @command(b'foo', [], b'hg foo')
715 > def foo(ui, repo, *args, **opts):
715 > def foo(ui, repo, *args, **opts):
716 > """yet another foo command
716 > """yet another foo command
717 > This command has been DEPRECATED since forever.
717 > This command has been DEPRECATED since forever.
718 > """
718 > """
719 > EOF
719 > EOF
720 $ debugpath=`pwd`/debugextension.py
720 $ debugpath=`pwd`/debugextension.py
721 $ echo "debugextension = $debugpath" >> $HGRCPATH
721 $ echo "debugextension = $debugpath" >> $HGRCPATH
722
722
723 $ hg help debugextension
723 $ hg help debugextension
724 hg debugextensions
724 hg debugextensions
725
725
726 show information about active extensions
726 show information about active extensions
727
727
728 options:
728 options:
729
729
730 -T --template TEMPLATE display with template
730 -T --template TEMPLATE display with template
731
731
732 (some details hidden, use --verbose to show complete help)
732 (some details hidden, use --verbose to show complete help)
733
733
734
734
735 $ hg --verbose help debugextension
735 $ hg --verbose help debugextension
736 hg debugextensions
736 hg debugextensions
737
737
738 show information about active extensions
738 show information about active extensions
739
739
740 options:
740 options:
741
741
742 -T --template TEMPLATE display with template
742 -T --template TEMPLATE display with template
743
743
744 global options ([+] can be repeated):
744 global options ([+] can be repeated):
745
745
746 -R --repository REPO repository root directory or name of overlay bundle
746 -R --repository REPO repository root directory or name of overlay bundle
747 file
747 file
748 --cwd DIR change working directory
748 --cwd DIR change working directory
749 -y --noninteractive do not prompt, automatically pick the first choice for
749 -y --noninteractive do not prompt, automatically pick the first choice for
750 all prompts
750 all prompts
751 -q --quiet suppress output
751 -q --quiet suppress output
752 -v --verbose enable additional output
752 -v --verbose enable additional output
753 --color TYPE when to colorize (boolean, always, auto, never, or
753 --color TYPE when to colorize (boolean, always, auto, never, or
754 debug)
754 debug)
755 --config CONFIG [+] set/override config option (use 'section.name=value')
755 --config CONFIG [+] set/override config option (use 'section.name=value')
756 --debug enable debugging output
756 --debug enable debugging output
757 --debugger start debugger
757 --debugger start debugger
758 --encoding ENCODE set the charset encoding (default: ascii)
758 --encoding ENCODE set the charset encoding (default: ascii)
759 --encodingmode MODE set the charset encoding mode (default: strict)
759 --encodingmode MODE set the charset encoding mode (default: strict)
760 --traceback always print a traceback on exception
760 --traceback always print a traceback on exception
761 --time time how long the command takes
761 --time time how long the command takes
762 --profile print command execution profile
762 --profile print command execution profile
763 --version output version information and exit
763 --version output version information and exit
764 -h --help display help and exit
764 -h --help display help and exit
765 --hidden consider hidden changesets
765 --hidden consider hidden changesets
766 --pager TYPE when to paginate (boolean, always, auto, or never)
766 --pager TYPE when to paginate (boolean, always, auto, or never)
767 (default: auto)
767 (default: auto)
768
768
769
769
770
770
771
771
772
772
773
773
774 $ hg --debug help debugextension
774 $ hg --debug help debugextension
775 hg debugextensions
775 hg debugextensions
776
776
777 show information about active extensions
777 show information about active extensions
778
778
779 options:
779 options:
780
780
781 -T --template TEMPLATE display with template
781 -T --template TEMPLATE display with template
782
782
783 global options ([+] can be repeated):
783 global options ([+] can be repeated):
784
784
785 -R --repository REPO repository root directory or name of overlay bundle
785 -R --repository REPO repository root directory or name of overlay bundle
786 file
786 file
787 --cwd DIR change working directory
787 --cwd DIR change working directory
788 -y --noninteractive do not prompt, automatically pick the first choice for
788 -y --noninteractive do not prompt, automatically pick the first choice for
789 all prompts
789 all prompts
790 -q --quiet suppress output
790 -q --quiet suppress output
791 -v --verbose enable additional output
791 -v --verbose enable additional output
792 --color TYPE when to colorize (boolean, always, auto, never, or
792 --color TYPE when to colorize (boolean, always, auto, never, or
793 debug)
793 debug)
794 --config CONFIG [+] set/override config option (use 'section.name=value')
794 --config CONFIG [+] set/override config option (use 'section.name=value')
795 --debug enable debugging output
795 --debug enable debugging output
796 --debugger start debugger
796 --debugger start debugger
797 --encoding ENCODE set the charset encoding (default: ascii)
797 --encoding ENCODE set the charset encoding (default: ascii)
798 --encodingmode MODE set the charset encoding mode (default: strict)
798 --encodingmode MODE set the charset encoding mode (default: strict)
799 --traceback always print a traceback on exception
799 --traceback always print a traceback on exception
800 --time time how long the command takes
800 --time time how long the command takes
801 --profile print command execution profile
801 --profile print command execution profile
802 --version output version information and exit
802 --version output version information and exit
803 -h --help display help and exit
803 -h --help display help and exit
804 --hidden consider hidden changesets
804 --hidden consider hidden changesets
805 --pager TYPE when to paginate (boolean, always, auto, or never)
805 --pager TYPE when to paginate (boolean, always, auto, or never)
806 (default: auto)
806 (default: auto)
807
807
808
808
809
809
810
810
811
811
812 $ echo 'debugextension = !' >> $HGRCPATH
812 $ echo 'debugextension = !' >> $HGRCPATH
813
813
814 Asking for help about a deprecated extension should do something useful:
814 Asking for help about a deprecated extension should do something useful:
815
815
816 $ hg help glog
816 $ hg help glog
817 'glog' is provided by the following extension:
817 'glog' is provided by the following extension:
818
818
819 graphlog command to view revision graphs from a shell (DEPRECATED)
819 graphlog command to view revision graphs from a shell (DEPRECATED)
820
820
821 (use 'hg help extensions' for information on enabling extensions)
821 (use 'hg help extensions' for information on enabling extensions)
822
822
823 Extension module help vs command help:
823 Extension module help vs command help:
824
824
825 $ echo 'extdiff =' >> $HGRCPATH
825 $ echo 'extdiff =' >> $HGRCPATH
826 $ hg help extdiff
826 $ hg help extdiff
827 hg extdiff [OPT]... [FILE]...
827 hg extdiff [OPT]... [FILE]...
828
828
829 use external program to diff repository (or selected files)
829 use external program to diff repository (or selected files)
830
830
831 Show differences between revisions for the specified files, using an
831 Show differences between revisions for the specified files, using an
832 external program. The default program used is diff, with default options
832 external program. The default program used is diff, with default options
833 "-Npru".
833 "-Npru".
834
834
835 To select a different program, use the -p/--program option. The program
835 To select a different program, use the -p/--program option. The program
836 will be passed the names of two directories to compare, unless the --per-
836 will be passed the names of two directories to compare, unless the --per-
837 file option is specified (see below). To pass additional options to the
837 file option is specified (see below). To pass additional options to the
838 program, use -o/--option. These will be passed before the names of the
838 program, use -o/--option. These will be passed before the names of the
839 directories or files to compare.
839 directories or files to compare.
840
840
841 The --from, --to, and --change options work the same way they do for 'hg
841 The --from, --to, and --change options work the same way they do for 'hg
842 diff'.
842 diff'.
843
843
844 The --per-file option runs the external program repeatedly on each file to
844 The --per-file option runs the external program repeatedly on each file to
845 diff, instead of once on two directories. By default, this happens one by
845 diff, instead of once on two directories. By default, this happens one by
846 one, where the next file diff is open in the external program only once
846 one, where the next file diff is open in the external program only once
847 the previous external program (for the previous file diff) has exited. If
847 the previous external program (for the previous file diff) has exited. If
848 the external program has a graphical interface, it can open all the file
848 the external program has a graphical interface, it can open all the file
849 diffs at once instead of one by one. See 'hg help -e extdiff' for
849 diffs at once instead of one by one. See 'hg help -e extdiff' for
850 information about how to tell Mercurial that a given program has a
850 information about how to tell Mercurial that a given program has a
851 graphical interface.
851 graphical interface.
852
852
853 The --confirm option will prompt the user before each invocation of the
853 The --confirm option will prompt the user before each invocation of the
854 external program. It is ignored if --per-file isn't specified.
854 external program. It is ignored if --per-file isn't specified.
855
855
856 (use 'hg help -e extdiff' to show help for the extdiff extension)
856 (use 'hg help -e extdiff' to show help for the extdiff extension)
857
857
858 options ([+] can be repeated):
858 options ([+] can be repeated):
859
859
860 -p --program CMD comparison program to run
860 -p --program CMD comparison program to run
861 -o --option OPT [+] pass option to comparison program
861 -o --option OPT [+] pass option to comparison program
862 --from REV1 revision to diff from
862 --from REV1 revision to diff from
863 --to REV2 revision to diff to
863 --to REV2 revision to diff to
864 -c --change REV change made by revision
864 -c --change REV change made by revision
865 --per-file compare each file instead of revision snapshots
865 --per-file compare each file instead of revision snapshots
866 --confirm prompt user before each external program invocation
866 --confirm prompt user before each external program invocation
867 --patch compare patches for two revisions
867 --patch compare patches for two revisions
868 -I --include PATTERN [+] include names matching the given patterns
868 -I --include PATTERN [+] include names matching the given patterns
869 -X --exclude PATTERN [+] exclude names matching the given patterns
869 -X --exclude PATTERN [+] exclude names matching the given patterns
870 -S --subrepos recurse into subrepositories
870 -S --subrepos recurse into subrepositories
871
871
872 (some details hidden, use --verbose to show complete help)
872 (some details hidden, use --verbose to show complete help)
873
873
874
874
875
875
876
876
877
877
878
878
879
879
880
880
881
881
882
882
883 $ hg help --extension extdiff
883 $ hg help --extension extdiff
884 extdiff extension - command to allow external programs to compare revisions
884 extdiff extension - command to allow external programs to compare revisions
885
885
886 The extdiff Mercurial extension allows you to use external programs to compare
886 The extdiff Mercurial extension allows you to use external programs to compare
887 revisions, or revision with working directory. The external diff programs are
887 revisions, or revision with working directory. The external diff programs are
888 called with a configurable set of options and two non-option arguments: paths
888 called with a configurable set of options and two non-option arguments: paths
889 to directories containing snapshots of files to compare.
889 to directories containing snapshots of files to compare.
890
890
891 If there is more than one file being compared and the "child" revision is the
891 If there is more than one file being compared and the "child" revision is the
892 working directory, any modifications made in the external diff program will be
892 working directory, any modifications made in the external diff program will be
893 copied back to the working directory from the temporary directory.
893 copied back to the working directory from the temporary directory.
894
894
895 The extdiff extension also allows you to configure new diff commands, so you
895 The extdiff extension also allows you to configure new diff commands, so you
896 do not need to type 'hg extdiff -p kdiff3' always.
896 do not need to type 'hg extdiff -p kdiff3' always.
897
897
898 [extdiff]
898 [extdiff]
899 # add new command that runs GNU diff(1) in 'context diff' mode
899 # add new command that runs GNU diff(1) in 'context diff' mode
900 cdiff = gdiff -Nprc5
900 cdiff = gdiff -Nprc5
901 ## or the old way:
901 ## or the old way:
902 #cmd.cdiff = gdiff
902 #cmd.cdiff = gdiff
903 #opts.cdiff = -Nprc5
903 #opts.cdiff = -Nprc5
904
904
905 # add new command called meld, runs meld (no need to name twice). If
905 # add new command called meld, runs meld (no need to name twice). If
906 # the meld executable is not available, the meld tool in [merge-tools]
906 # the meld executable is not available, the meld tool in [merge-tools]
907 # will be used, if available
907 # will be used, if available
908 meld =
908 meld =
909
909
910 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
910 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
911 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
911 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
912 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
912 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
913 # your .vimrc
913 # your .vimrc
914 vimdiff = gvim -f "+next" \
914 vimdiff = gvim -f "+next" \
915 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
915 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
916
916
917 Tool arguments can include variables that are expanded at runtime:
917 Tool arguments can include variables that are expanded at runtime:
918
918
919 $parent1, $plabel1 - filename, descriptive label of first parent
919 $parent1, $plabel1 - filename, descriptive label of first parent
920 $child, $clabel - filename, descriptive label of child revision
920 $child, $clabel - filename, descriptive label of child revision
921 $parent2, $plabel2 - filename, descriptive label of second parent
921 $parent2, $plabel2 - filename, descriptive label of second parent
922 $root - repository root
922 $root - repository root
923 $parent is an alias for $parent1.
923 $parent is an alias for $parent1.
924
924
925 The extdiff extension will look in your [diff-tools] and [merge-tools]
925 The extdiff extension will look in your [diff-tools] and [merge-tools]
926 sections for diff tool arguments, when none are specified in [extdiff].
926 sections for diff tool arguments, when none are specified in [extdiff].
927
927
928 [extdiff]
928 [extdiff]
929 kdiff3 =
929 kdiff3 =
930
930
931 [diff-tools]
931 [diff-tools]
932 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
932 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
933
933
934 If a program has a graphical interface, it might be interesting to tell
934 If a program has a graphical interface, it might be interesting to tell
935 Mercurial about it. It will prevent the program from being mistakenly used in
935 Mercurial about it. It will prevent the program from being mistakenly used in
936 a terminal-only environment (such as an SSH terminal session), and will make
936 a terminal-only environment (such as an SSH terminal session), and will make
937 'hg extdiff --per-file' open multiple file diffs at once instead of one by one
937 'hg extdiff --per-file' open multiple file diffs at once instead of one by one
938 (if you still want to open file diffs one by one, you can use the --confirm
938 (if you still want to open file diffs one by one, you can use the --confirm
939 option).
939 option).
940
940
941 Declaring that a tool has a graphical interface can be done with the "gui"
941 Declaring that a tool has a graphical interface can be done with the "gui"
942 flag next to where "diffargs" are specified:
942 flag next to where "diffargs" are specified:
943
943
944 [diff-tools]
944 [diff-tools]
945 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
945 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
946 kdiff3.gui = true
946 kdiff3.gui = true
947
947
948 You can use -I/-X and list of file or directory names like normal 'hg diff'
948 You can use -I/-X and list of file or directory names like normal 'hg diff'
949 command. The extdiff extension makes snapshots of only needed files, so
949 command. The extdiff extension makes snapshots of only needed files, so
950 running the external diff program will actually be pretty fast (at least
950 running the external diff program will actually be pretty fast (at least
951 faster than having to compare the entire tree).
951 faster than having to compare the entire tree).
952
952
953 list of commands:
953 list of commands:
954
954
955 extdiff use external program to diff repository (or selected files)
955 extdiff use external program to diff repository (or selected files)
956
956
957 (use 'hg help -v -e extdiff' to show built-in aliases and global options)
957 (use 'hg help -v -e extdiff' to show built-in aliases and global options)
958
958
959
959
960
960
961
961
962
962
963
963
964
964
965
965
966
966
967
967
968
968
969
969
970
970
971
971
972
972
973
973
974 $ echo 'extdiff = !' >> $HGRCPATH
974 $ echo 'extdiff = !' >> $HGRCPATH
975
975
976 Test help topic with same name as extension
976 Test help topic with same name as extension
977
977
978 $ cat > multirevs.py <<EOF
978 $ cat > multirevs.py <<EOF
979 > from mercurial import commands, registrar
979 > from mercurial import commands, registrar
980 > cmdtable = {}
980 > cmdtable = {}
981 > command = registrar.command(cmdtable)
981 > command = registrar.command(cmdtable)
982 > """multirevs extension
982 > """multirevs extension
983 > Big multi-line module docstring."""
983 > Big multi-line module docstring."""
984 > @command(b'multirevs', [], b'ARG', norepo=True)
984 > @command(b'multirevs', [], b'ARG', norepo=True)
985 > def multirevs(ui, repo, arg, *args, **opts):
985 > def multirevs(ui, repo, arg, *args, **opts):
986 > """multirevs command"""
986 > """multirevs command"""
987 > EOF
987 > EOF
988 $ echo "multirevs = multirevs.py" >> $HGRCPATH
988 $ echo "multirevs = multirevs.py" >> $HGRCPATH
989
989
990 $ hg help multirevs | tail
990 $ hg help multirevs | tail
991 used):
991 used):
992
992
993 hg update :@
993 hg update :@
994
994
995 - Show diff between tags 1.3 and 1.5 (this works because the first and the
995 - Show diff between tags 1.3 and 1.5 (this works because the first and the
996 last revisions of the revset are used):
996 last revisions of the revset are used):
997
997
998 hg diff -r 1.3::1.5
998 hg diff -r 1.3::1.5
999
999
1000 use 'hg help -c multirevs' to see help for the multirevs command
1000 use 'hg help -c multirevs' to see help for the multirevs command
1001
1001
1002
1002
1003
1003
1004
1004
1005
1005
1006
1006
1007 $ hg help -c multirevs
1007 $ hg help -c multirevs
1008 hg multirevs ARG
1008 hg multirevs ARG
1009
1009
1010 multirevs command
1010 multirevs command
1011
1011
1012 (some details hidden, use --verbose to show complete help)
1012 (some details hidden, use --verbose to show complete help)
1013
1013
1014
1014
1015
1015
1016 $ hg multirevs
1016 $ hg multirevs
1017 hg multirevs: invalid arguments
1017 hg multirevs: invalid arguments
1018 hg multirevs ARG
1018 hg multirevs ARG
1019
1019
1020 multirevs command
1020 multirevs command
1021
1021
1022 (use 'hg multirevs -h' to show more help)
1022 (use 'hg multirevs -h' to show more help)
1023 [10]
1023 [10]
1024
1024
1025
1025
1026
1026
1027 $ echo "multirevs = !" >> $HGRCPATH
1027 $ echo "multirevs = !" >> $HGRCPATH
1028
1028
1029 Issue811: Problem loading extensions twice (by site and by user)
1029 Issue811: Problem loading extensions twice (by site and by user)
1030
1030
1031 $ cat <<EOF >> $HGRCPATH
1031 $ cat <<EOF >> $HGRCPATH
1032 > mq =
1032 > mq =
1033 > strip =
1033 > strip =
1034 > hgext.mq =
1034 > hgext.mq =
1035 > hgext/mq =
1035 > hgext/mq =
1036 > EOF
1036 > EOF
1037
1037
1038 Show extensions:
1038 Show extensions:
1039 (note that mq force load strip, also checking it's not loaded twice)
1039 (note that mq force load strip, also checking it's not loaded twice)
1040
1040
1041 #if no-extraextensions
1041 #if no-extraextensions
1042 $ hg debugextensions
1042 $ hg debugextensions
1043 mq
1043 mq
1044 strip
1044 strip
1045 #endif
1045 #endif
1046
1046
1047 For extensions, which name matches one of its commands, help
1047 For extensions, which name matches one of its commands, help
1048 message should ask '-v -e' to get list of built-in aliases
1048 message should ask '-v -e' to get list of built-in aliases
1049 along with extension help itself
1049 along with extension help itself
1050
1050
1051 $ mkdir $TESTTMP/d
1051 $ mkdir $TESTTMP/d
1052 $ cat > $TESTTMP/d/dodo.py <<EOF
1052 $ cat > $TESTTMP/d/dodo.py <<EOF
1053 > """
1053 > """
1054 > This is an awesome 'dodo' extension. It does nothing and
1054 > This is an awesome 'dodo' extension. It does nothing and
1055 > writes 'Foo foo'
1055 > writes 'Foo foo'
1056 > """
1056 > """
1057 > from mercurial import commands, registrar
1057 > from mercurial import commands, registrar
1058 > cmdtable = {}
1058 > cmdtable = {}
1059 > command = registrar.command(cmdtable)
1059 > command = registrar.command(cmdtable)
1060 > @command(b'dodo', [], b'hg dodo')
1060 > @command(b'dodo', [], b'hg dodo')
1061 > def dodo(ui, *args, **kwargs):
1061 > def dodo(ui, *args, **kwargs):
1062 > """Does nothing"""
1062 > """Does nothing"""
1063 > ui.write(b"I do nothing. Yay\\n")
1063 > ui.write(b"I do nothing. Yay\\n")
1064 > @command(b'foofoo', [], b'hg foofoo')
1064 > @command(b'foofoo', [], b'hg foofoo')
1065 > def foofoo(ui, *args, **kwargs):
1065 > def foofoo(ui, *args, **kwargs):
1066 > """Writes 'Foo foo'"""
1066 > """Writes 'Foo foo'"""
1067 > ui.write(b"Foo foo\\n")
1067 > ui.write(b"Foo foo\\n")
1068 > EOF
1068 > EOF
1069 $ dodopath=$TESTTMP/d/dodo.py
1069 $ dodopath=$TESTTMP/d/dodo.py
1070
1070
1071 $ echo "dodo = $dodopath" >> $HGRCPATH
1071 $ echo "dodo = $dodopath" >> $HGRCPATH
1072
1072
1073 Make sure that user is asked to enter '-v -e' to get list of built-in aliases
1073 Make sure that user is asked to enter '-v -e' to get list of built-in aliases
1074 $ hg help -e dodo
1074 $ hg help -e dodo
1075 dodo extension -
1075 dodo extension -
1076
1076
1077 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
1077 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
1078
1078
1079 list of commands:
1079 list of commands:
1080
1080
1081 dodo Does nothing
1081 dodo Does nothing
1082 foofoo Writes 'Foo foo'
1082 foofoo Writes 'Foo foo'
1083
1083
1084 (use 'hg help -v -e dodo' to show built-in aliases and global options)
1084 (use 'hg help -v -e dodo' to show built-in aliases and global options)
1085
1085
1086 Make sure that '-v -e' prints list of built-in aliases along with
1086 Make sure that '-v -e' prints list of built-in aliases along with
1087 extension help itself
1087 extension help itself
1088 $ hg help -v -e dodo
1088 $ hg help -v -e dodo
1089 dodo extension -
1089 dodo extension -
1090
1090
1091 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
1091 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
1092
1092
1093 list of commands:
1093 list of commands:
1094
1094
1095 dodo Does nothing
1095 dodo Does nothing
1096 foofoo Writes 'Foo foo'
1096 foofoo Writes 'Foo foo'
1097
1097
1098 global options ([+] can be repeated):
1098 global options ([+] can be repeated):
1099
1099
1100 -R --repository REPO repository root directory or name of overlay bundle
1100 -R --repository REPO repository root directory or name of overlay bundle
1101 file
1101 file
1102 --cwd DIR change working directory
1102 --cwd DIR change working directory
1103 -y --noninteractive do not prompt, automatically pick the first choice for
1103 -y --noninteractive do not prompt, automatically pick the first choice for
1104 all prompts
1104 all prompts
1105 -q --quiet suppress output
1105 -q --quiet suppress output
1106 -v --verbose enable additional output
1106 -v --verbose enable additional output
1107 --color TYPE when to colorize (boolean, always, auto, never, or
1107 --color TYPE when to colorize (boolean, always, auto, never, or
1108 debug)
1108 debug)
1109 --config CONFIG [+] set/override config option (use 'section.name=value')
1109 --config CONFIG [+] set/override config option (use 'section.name=value')
1110 --debug enable debugging output
1110 --debug enable debugging output
1111 --debugger start debugger
1111 --debugger start debugger
1112 --encoding ENCODE set the charset encoding (default: ascii)
1112 --encoding ENCODE set the charset encoding (default: ascii)
1113 --encodingmode MODE set the charset encoding mode (default: strict)
1113 --encodingmode MODE set the charset encoding mode (default: strict)
1114 --traceback always print a traceback on exception
1114 --traceback always print a traceback on exception
1115 --time time how long the command takes
1115 --time time how long the command takes
1116 --profile print command execution profile
1116 --profile print command execution profile
1117 --version output version information and exit
1117 --version output version information and exit
1118 -h --help display help and exit
1118 -h --help display help and exit
1119 --hidden consider hidden changesets
1119 --hidden consider hidden changesets
1120 --pager TYPE when to paginate (boolean, always, auto, or never)
1120 --pager TYPE when to paginate (boolean, always, auto, or never)
1121 (default: auto)
1121 (default: auto)
1122
1122
1123 Make sure that single '-v' option shows help and built-ins only for 'dodo' command
1123 Make sure that single '-v' option shows help and built-ins only for 'dodo' command
1124 $ hg help -v dodo
1124 $ hg help -v dodo
1125 hg dodo
1125 hg dodo
1126
1126
1127 Does nothing
1127 Does nothing
1128
1128
1129 (use 'hg help -e dodo' to show help for the dodo extension)
1129 (use 'hg help -e dodo' to show help for the dodo extension)
1130
1130
1131 options:
1131 options:
1132
1132
1133 --mq operate on patch repository
1133 --mq operate on patch repository
1134
1134
1135 global options ([+] can be repeated):
1135 global options ([+] can be repeated):
1136
1136
1137 -R --repository REPO repository root directory or name of overlay bundle
1137 -R --repository REPO repository root directory or name of overlay bundle
1138 file
1138 file
1139 --cwd DIR change working directory
1139 --cwd DIR change working directory
1140 -y --noninteractive do not prompt, automatically pick the first choice for
1140 -y --noninteractive do not prompt, automatically pick the first choice for
1141 all prompts
1141 all prompts
1142 -q --quiet suppress output
1142 -q --quiet suppress output
1143 -v --verbose enable additional output
1143 -v --verbose enable additional output
1144 --color TYPE when to colorize (boolean, always, auto, never, or
1144 --color TYPE when to colorize (boolean, always, auto, never, or
1145 debug)
1145 debug)
1146 --config CONFIG [+] set/override config option (use 'section.name=value')
1146 --config CONFIG [+] set/override config option (use 'section.name=value')
1147 --debug enable debugging output
1147 --debug enable debugging output
1148 --debugger start debugger
1148 --debugger start debugger
1149 --encoding ENCODE set the charset encoding (default: ascii)
1149 --encoding ENCODE set the charset encoding (default: ascii)
1150 --encodingmode MODE set the charset encoding mode (default: strict)
1150 --encodingmode MODE set the charset encoding mode (default: strict)
1151 --traceback always print a traceback on exception
1151 --traceback always print a traceback on exception
1152 --time time how long the command takes
1152 --time time how long the command takes
1153 --profile print command execution profile
1153 --profile print command execution profile
1154 --version output version information and exit
1154 --version output version information and exit
1155 -h --help display help and exit
1155 -h --help display help and exit
1156 --hidden consider hidden changesets
1156 --hidden consider hidden changesets
1157 --pager TYPE when to paginate (boolean, always, auto, or never)
1157 --pager TYPE when to paginate (boolean, always, auto, or never)
1158 (default: auto)
1158 (default: auto)
1159
1159
1160 In case when extension name doesn't match any of its commands,
1160 In case when extension name doesn't match any of its commands,
1161 help message should ask for '-v' to get list of built-in aliases
1161 help message should ask for '-v' to get list of built-in aliases
1162 along with extension help
1162 along with extension help
1163 $ cat > $TESTTMP/d/dudu.py <<EOF
1163 $ cat > $TESTTMP/d/dudu.py <<EOF
1164 > """
1164 > """
1165 > This is an awesome 'dudu' extension. It does something and
1165 > This is an awesome 'dudu' extension. It does something and
1166 > also writes 'Beep beep'
1166 > also writes 'Beep beep'
1167 > """
1167 > """
1168 > from mercurial import commands, registrar
1168 > from mercurial import commands, registrar
1169 > cmdtable = {}
1169 > cmdtable = {}
1170 > command = registrar.command(cmdtable)
1170 > command = registrar.command(cmdtable)
1171 > @command(b'something', [], b'hg something')
1171 > @command(b'something', [], b'hg something')
1172 > def something(ui, *args, **kwargs):
1172 > def something(ui, *args, **kwargs):
1173 > """Does something"""
1173 > """Does something"""
1174 > ui.write(b"I do something. Yaaay\\n")
1174 > ui.write(b"I do something. Yaaay\\n")
1175 > @command(b'beep', [], b'hg beep')
1175 > @command(b'beep', [], b'hg beep')
1176 > def beep(ui, *args, **kwargs):
1176 > def beep(ui, *args, **kwargs):
1177 > """Writes 'Beep beep'"""
1177 > """Writes 'Beep beep'"""
1178 > ui.write(b"Beep beep\\n")
1178 > ui.write(b"Beep beep\\n")
1179 > EOF
1179 > EOF
1180 $ dudupath=$TESTTMP/d/dudu.py
1180 $ dudupath=$TESTTMP/d/dudu.py
1181
1181
1182 $ echo "dudu = $dudupath" >> $HGRCPATH
1182 $ echo "dudu = $dudupath" >> $HGRCPATH
1183
1183
1184 $ hg help -e dudu
1184 $ hg help -e dudu
1185 dudu extension -
1185 dudu extension -
1186
1186
1187 This is an awesome 'dudu' extension. It does something and also writes 'Beep
1187 This is an awesome 'dudu' extension. It does something and also writes 'Beep
1188 beep'
1188 beep'
1189
1189
1190 list of commands:
1190 list of commands:
1191
1191
1192 beep Writes 'Beep beep'
1192 beep Writes 'Beep beep'
1193 something Does something
1193 something Does something
1194
1194
1195 (use 'hg help -v dudu' to show built-in aliases and global options)
1195 (use 'hg help -v dudu' to show built-in aliases and global options)
1196
1196
1197 In case when extension name doesn't match any of its commands,
1197 In case when extension name doesn't match any of its commands,
1198 help options '-v' and '-v -e' should be equivalent
1198 help options '-v' and '-v -e' should be equivalent
1199 $ hg help -v dudu
1199 $ hg help -v dudu
1200 dudu extension -
1200 dudu extension -
1201
1201
1202 This is an awesome 'dudu' extension. It does something and also writes 'Beep
1202 This is an awesome 'dudu' extension. It does something and also writes 'Beep
1203 beep'
1203 beep'
1204
1204
1205 list of commands:
1205 list of commands:
1206
1206
1207 beep Writes 'Beep beep'
1207 beep Writes 'Beep beep'
1208 something Does something
1208 something Does something
1209
1209
1210 global options ([+] can be repeated):
1210 global options ([+] can be repeated):
1211
1211
1212 -R --repository REPO repository root directory or name of overlay bundle
1212 -R --repository REPO repository root directory or name of overlay bundle
1213 file
1213 file
1214 --cwd DIR change working directory
1214 --cwd DIR change working directory
1215 -y --noninteractive do not prompt, automatically pick the first choice for
1215 -y --noninteractive do not prompt, automatically pick the first choice for
1216 all prompts
1216 all prompts
1217 -q --quiet suppress output
1217 -q --quiet suppress output
1218 -v --verbose enable additional output
1218 -v --verbose enable additional output
1219 --color TYPE when to colorize (boolean, always, auto, never, or
1219 --color TYPE when to colorize (boolean, always, auto, never, or
1220 debug)
1220 debug)
1221 --config CONFIG [+] set/override config option (use 'section.name=value')
1221 --config CONFIG [+] set/override config option (use 'section.name=value')
1222 --debug enable debugging output
1222 --debug enable debugging output
1223 --debugger start debugger
1223 --debugger start debugger
1224 --encoding ENCODE set the charset encoding (default: ascii)
1224 --encoding ENCODE set the charset encoding (default: ascii)
1225 --encodingmode MODE set the charset encoding mode (default: strict)
1225 --encodingmode MODE set the charset encoding mode (default: strict)
1226 --traceback always print a traceback on exception
1226 --traceback always print a traceback on exception
1227 --time time how long the command takes
1227 --time time how long the command takes
1228 --profile print command execution profile
1228 --profile print command execution profile
1229 --version output version information and exit
1229 --version output version information and exit
1230 -h --help display help and exit
1230 -h --help display help and exit
1231 --hidden consider hidden changesets
1231 --hidden consider hidden changesets
1232 --pager TYPE when to paginate (boolean, always, auto, or never)
1232 --pager TYPE when to paginate (boolean, always, auto, or never)
1233 (default: auto)
1233 (default: auto)
1234
1234
1235 $ hg help -v -e dudu
1235 $ hg help -v -e dudu
1236 dudu extension -
1236 dudu extension -
1237
1237
1238 This is an awesome 'dudu' extension. It does something and also writes 'Beep
1238 This is an awesome 'dudu' extension. It does something and also writes 'Beep
1239 beep'
1239 beep'
1240
1240
1241 list of commands:
1241 list of commands:
1242
1242
1243 beep Writes 'Beep beep'
1243 beep Writes 'Beep beep'
1244 something Does something
1244 something Does something
1245
1245
1246 global options ([+] can be repeated):
1246 global options ([+] can be repeated):
1247
1247
1248 -R --repository REPO repository root directory or name of overlay bundle
1248 -R --repository REPO repository root directory or name of overlay bundle
1249 file
1249 file
1250 --cwd DIR change working directory
1250 --cwd DIR change working directory
1251 -y --noninteractive do not prompt, automatically pick the first choice for
1251 -y --noninteractive do not prompt, automatically pick the first choice for
1252 all prompts
1252 all prompts
1253 -q --quiet suppress output
1253 -q --quiet suppress output
1254 -v --verbose enable additional output
1254 -v --verbose enable additional output
1255 --color TYPE when to colorize (boolean, always, auto, never, or
1255 --color TYPE when to colorize (boolean, always, auto, never, or
1256 debug)
1256 debug)
1257 --config CONFIG [+] set/override config option (use 'section.name=value')
1257 --config CONFIG [+] set/override config option (use 'section.name=value')
1258 --debug enable debugging output
1258 --debug enable debugging output
1259 --debugger start debugger
1259 --debugger start debugger
1260 --encoding ENCODE set the charset encoding (default: ascii)
1260 --encoding ENCODE set the charset encoding (default: ascii)
1261 --encodingmode MODE set the charset encoding mode (default: strict)
1261 --encodingmode MODE set the charset encoding mode (default: strict)
1262 --traceback always print a traceback on exception
1262 --traceback always print a traceback on exception
1263 --time time how long the command takes
1263 --time time how long the command takes
1264 --profile print command execution profile
1264 --profile print command execution profile
1265 --version output version information and exit
1265 --version output version information and exit
1266 -h --help display help and exit
1266 -h --help display help and exit
1267 --hidden consider hidden changesets
1267 --hidden consider hidden changesets
1268 --pager TYPE when to paginate (boolean, always, auto, or never)
1268 --pager TYPE when to paginate (boolean, always, auto, or never)
1269 (default: auto)
1269 (default: auto)
1270
1270
1271 Disabled extension commands:
1271 Disabled extension commands:
1272
1272
1273 $ ORGHGRCPATH=$HGRCPATH
1273 $ ORGHGRCPATH=$HGRCPATH
1274 $ HGRCPATH=
1274 $ HGRCPATH=
1275 $ export HGRCPATH
1275 $ export HGRCPATH
1276 $ hg help email
1276 $ hg help email
1277 'email' is provided by the following extension:
1277 'email' is provided by the following extension:
1278
1278
1279 patchbomb command to send changesets as (a series of) patch emails
1279 patchbomb command to send changesets as (a series of) patch emails
1280
1280
1281 (use 'hg help extensions' for information on enabling extensions)
1281 (use 'hg help extensions' for information on enabling extensions)
1282
1282
1283
1283
1284 $ hg qdel
1284 $ hg qdel
1285 hg: unknown command 'qdel'
1285 hg: unknown command 'qdel'
1286 'qdelete' is provided by the following extension:
1286 'qdelete' is provided by the following extension:
1287
1287
1288 mq manage a stack of patches
1288 mq manage a stack of patches
1289
1289
1290 (use 'hg help extensions' for information on enabling extensions)
1290 (use 'hg help extensions' for information on enabling extensions)
1291 [255]
1291 [255]
1292
1292
1293
1293
1294 $ hg churn
1294 $ hg churn
1295 hg: unknown command 'churn'
1295 hg: unknown command 'churn'
1296 'churn' is provided by the following extension:
1296 'churn' is provided by the following extension:
1297
1297
1298 churn command to display statistics about repository history
1298 churn command to display statistics about repository history
1299
1299
1300 (use 'hg help extensions' for information on enabling extensions)
1300 (use 'hg help extensions' for information on enabling extensions)
1301 [255]
1301 [255]
1302
1302
1303
1303
1304
1304
1305 Disabled extensions:
1305 Disabled extensions:
1306
1306
1307 $ hg help churn
1307 $ hg help churn
1308 churn extension - command to display statistics about repository history
1308 churn extension - command to display statistics about repository history
1309
1309
1310 (use 'hg help extensions' for information on enabling extensions)
1310 (use 'hg help extensions' for information on enabling extensions)
1311
1311
1312 $ hg help patchbomb
1312 $ hg help patchbomb
1313 patchbomb extension - command to send changesets as (a series of) patch emails
1313 patchbomb extension - command to send changesets as (a series of) patch emails
1314
1314
1315 The series is started off with a "[PATCH 0 of N]" introduction, which
1315 The series is started off with a "[PATCH 0 of N]" introduction, which
1316 describes the series as a whole.
1316 describes the series as a whole.
1317
1317
1318 Each patch email has a Subject line of "[PATCH M of N] ...", using the first
1318 Each patch email has a Subject line of "[PATCH M of N] ...", using the first
1319 line of the changeset description as the subject text. The message contains
1319 line of the changeset description as the subject text. The message contains
1320 two or three body parts:
1320 two or three body parts:
1321
1321
1322 - The changeset description.
1322 - The changeset description.
1323 - [Optional] The result of running diffstat on the patch.
1323 - [Optional] The result of running diffstat on the patch.
1324 - The patch itself, as generated by 'hg export'.
1324 - The patch itself, as generated by 'hg export'.
1325
1325
1326 Each message refers to the first in the series using the In-Reply-To and
1326 Each message refers to the first in the series using the In-Reply-To and
1327 References headers, so they will show up as a sequence in threaded mail and
1327 References headers, so they will show up as a sequence in threaded mail and
1328 news readers, and in mail archives.
1328 news readers, and in mail archives.
1329
1329
1330 To configure other defaults, add a section like this to your configuration
1330 To configure other defaults, add a section like this to your configuration
1331 file:
1331 file:
1332
1332
1333 [email]
1333 [email]
1334 from = My Name <my@email>
1334 from = My Name <my@email>
1335 to = recipient1, recipient2, ...
1335 to = recipient1, recipient2, ...
1336 cc = cc1, cc2, ...
1336 cc = cc1, cc2, ...
1337 bcc = bcc1, bcc2, ...
1337 bcc = bcc1, bcc2, ...
1338 reply-to = address1, address2, ...
1338 reply-to = address1, address2, ...
1339
1339
1340 Use "[patchbomb]" as configuration section name if you need to override global
1340 Use "[patchbomb]" as configuration section name if you need to override global
1341 "[email]" address settings.
1341 "[email]" address settings.
1342
1342
1343 Then you can use the 'hg email' command to mail a series of changesets as a
1343 Then you can use the 'hg email' command to mail a series of changesets as a
1344 patchbomb.
1344 patchbomb.
1345
1345
1346 You can also either configure the method option in the email section to be a
1346 You can also either configure the method option in the email section to be a
1347 sendmail compatible mailer or fill out the [smtp] section so that the
1347 sendmail compatible mailer or fill out the [smtp] section so that the
1348 patchbomb extension can automatically send patchbombs directly from the
1348 patchbomb extension can automatically send patchbombs directly from the
1349 commandline. See the [email] and [smtp] sections in hgrc(5) for details.
1349 commandline. See the [email] and [smtp] sections in hgrc(5) for details.
1350
1350
1351 By default, 'hg email' will prompt for a "To" or "CC" header if you do not
1351 By default, 'hg email' will prompt for a "To" or "CC" header if you do not
1352 supply one via configuration or the command line. You can override this to
1352 supply one via configuration or the command line. You can override this to
1353 never prompt by configuring an empty value:
1353 never prompt by configuring an empty value:
1354
1354
1355 [email]
1355 [email]
1356 cc =
1356 cc =
1357
1357
1358 You can control the default inclusion of an introduction message with the
1358 You can control the default inclusion of an introduction message with the
1359 "patchbomb.intro" configuration option. The configuration is always
1359 "patchbomb.intro" configuration option. The configuration is always
1360 overwritten by command line flags like --intro and --desc:
1360 overwritten by command line flags like --intro and --desc:
1361
1361
1362 [patchbomb]
1362 [patchbomb]
1363 intro=auto # include introduction message if more than 1 patch (default)
1363 intro=auto # include introduction message if more than 1 patch (default)
1364 intro=never # never include an introduction message
1364 intro=never # never include an introduction message
1365 intro=always # always include an introduction message
1365 intro=always # always include an introduction message
1366
1366
1367 You can specify a template for flags to be added in subject prefixes. Flags
1367 You can specify a template for flags to be added in subject prefixes. Flags
1368 specified by --flag option are exported as "{flags}" keyword:
1368 specified by --flag option are exported as "{flags}" keyword:
1369
1369
1370 [patchbomb]
1370 [patchbomb]
1371 flagtemplate = "{separate(' ',
1371 flagtemplate = "{separate(' ',
1372 ifeq(branch, 'default', '', branch|upper),
1372 ifeq(branch, 'default', '', branch|upper),
1373 flags)}"
1373 flags)}"
1374
1374
1375 You can set patchbomb to always ask for confirmation by setting
1375 You can set patchbomb to always ask for confirmation by setting
1376 "patchbomb.confirm" to true.
1376 "patchbomb.confirm" to true.
1377
1377
1378 (use 'hg help extensions' for information on enabling extensions)
1378 (use 'hg help extensions' for information on enabling extensions)
1379
1379
1380
1380
1381 Help can find unimported extensions
1381 Help can find unimported extensions
1382 -----------------------------------
1382 -----------------------------------
1383
1383
1384 XXX-PYOXIDIZER since the frozen binary does not have source directory tree,
1384 XXX-PYOXIDIZER since the frozen binary does not have source directory tree,
1385 this make the checking for actual file under `hgext` a bit complicated. In
1385 this make the checking for actual file under `hgext` a bit complicated. In
1386 addition these tests do some strange dance to ensure some other module are the
1386 addition these tests do some strange dance to ensure some other module are the
1387 first in `sys.path` (since the current install path is always in front
1387 first in `sys.path` (since the current install path is always in front
1388 otherwise) that are fragile and that does not match reality in the field. So
1388 otherwise) that are fragile and that does not match reality in the field. So
1389 for now we disable this test untill a deeper rework of that logic is done.
1389 for now we disable this test untill a deeper rework of that logic is done.
1390
1390
1391 #if no-pyoxidizer
1391 #if no-pyoxidizer
1392
1392
1393 Broken disabled extension and command:
1393 Broken disabled extension and command:
1394
1394
1395 $ mkdir hgext
1395 $ mkdir hgext
1396 $ echo > hgext/__init__.py
1396 $ echo > hgext/__init__.py
1397 $ cat > hgext/broken.py <<NO_CHECK_EOF
1397 $ cat > hgext/broken.py <<NO_CHECK_EOF
1398 > "broken extension'
1398 > "broken extension'
1399 > NO_CHECK_EOF
1399 > NO_CHECK_EOF
1400 $ cat > path.py <<EOF
1400 $ cat > path.py <<EOF
1401 > import os
1401 > import os
1402 > import sys
1402 > import sys
1403 > sys.path.insert(0, os.environ['HGEXTPATH'])
1403 > sys.path.insert(0, os.environ['HGEXTPATH'])
1404 > EOF
1404 > EOF
1405 $ HGEXTPATH=`pwd`
1405 $ HGEXTPATH=`pwd`
1406 $ export HGEXTPATH
1406 $ export HGEXTPATH
1407
1407
1408 $ hg --config extensions.path=./path.py help broken
1408 $ hg --config extensions.path=./path.py help broken
1409 broken extension - (no help text available)
1409 broken extension - (no help text available)
1410
1410
1411 (use 'hg help extensions' for information on enabling extensions)
1411 (use 'hg help extensions' for information on enabling extensions)
1412
1412
1413
1413
1414 $ cat > hgext/forest.py <<EOF
1414 $ cat > hgext/forest.py <<EOF
1415 > cmdtable = None
1415 > cmdtable = None
1416 > @command()
1416 > @command()
1417 > def f():
1417 > def f():
1418 > pass
1418 > pass
1419 > @command(123)
1419 > @command(123)
1420 > def g():
1420 > def g():
1421 > pass
1421 > pass
1422 > EOF
1422 > EOF
1423 $ hg --config extensions.path=./path.py help foo
1423 $ hg --config extensions.path=./path.py help foo
1424 abort: no such help topic: foo
1424 abort: no such help topic: foo
1425 (try 'hg help --keyword foo')
1425 (try 'hg help --keyword foo')
1426 [255]
1426 [255]
1427
1427
1428 #endif
1428 #endif
1429
1429
1430 ---
1430 ---
1431
1431
1432 $ cat > throw.py <<EOF
1432 $ cat > throw.py <<EOF
1433 > from mercurial import commands, registrar, util
1433 > from mercurial import commands, registrar, util
1434 > cmdtable = {}
1434 > cmdtable = {}
1435 > command = registrar.command(cmdtable)
1435 > command = registrar.command(cmdtable)
1436 > class Bogon(Exception): pass
1436 > class Bogon(Exception): pass
1437 > # NB: version should be bytes; simulating extension not ported to py3
1437 > # NB: version should be bytes; simulating extension not ported to py3
1438 > __version__ = '1.0.0'
1438 > __version__ = '1.0.0'
1439 > @command(b'throw', [], b'hg throw', norepo=True)
1439 > @command(b'throw', [], b'hg throw', norepo=True)
1440 > def throw(ui, **opts):
1440 > def throw(ui, **opts):
1441 > """throws an exception"""
1441 > """throws an exception"""
1442 > raise Bogon()
1442 > raise Bogon()
1443 > EOF
1443 > EOF
1444
1444
1445 Test extension without proper byteification of key attributes doesn't crash when
1445 Test extension without proper byteification of key attributes doesn't crash when
1446 accessed.
1446 accessed.
1447
1447
1448 $ hg version -v --config extensions.throw=throw.py | grep '^ '
1448 $ hg version -v --config extensions.throw=throw.py | grep '^ '
1449 throw external 1.0.0
1449 throw external 1.0.0
1450
1450
1451 No declared supported version, extension complains:
1451 No declared supported version, extension complains:
1452 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1452 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1453 ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0
1453 ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0
1454 ** which supports versions unknown of Mercurial.
1454 ** which supports versions unknown of Mercurial.
1455 ** Please disable "throw" and try your action again.
1455 ** Please disable "throw" and try your action again.
1456 ** If that fixes the bug please report it to the extension author.
1456 ** If that fixes the bug please report it to the extension author.
1457 ** Python * (glob)
1457 ** Python * (glob)
1458 ** Mercurial Distributed SCM * (glob)
1458 ** Mercurial Distributed SCM * (glob)
1459 ** Extensions loaded: throw 1.0.0
1459 ** Extensions loaded: throw 1.0.0
1460
1460
1461 empty declaration of supported version, extension complains (but doesn't choke if
1461 empty declaration of supported version, extension complains (but doesn't choke if
1462 the value is improperly a str instead of bytes):
1462 the value is improperly a str instead of bytes):
1463 $ echo "testedwith = ''" >> throw.py
1463 $ echo "testedwith = ''" >> throw.py
1464 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1464 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1465 ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0
1465 ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0
1466 ** which supports versions unknown of Mercurial.
1466 ** which supports versions unknown of Mercurial.
1467 ** Please disable "throw" and try your action again.
1467 ** Please disable "throw" and try your action again.
1468 ** If that fixes the bug please report it to the extension author.
1468 ** If that fixes the bug please report it to the extension author.
1469 ** Python * (glob)
1469 ** Python * (glob)
1470 ** Mercurial Distributed SCM (*) (glob)
1470 ** Mercurial Distributed SCM (*) (glob)
1471 ** Extensions loaded: throw 1.0.0
1471 ** Extensions loaded: throw 1.0.0
1472
1472
1473 If the extension specifies a buglink, show that (but don't choke if the value is
1473 If the extension specifies a buglink, show that (but don't choke if the value is
1474 improperly a str instead of bytes):
1474 improperly a str instead of bytes):
1475 $ echo 'buglink = "http://example.com/bts"' >> throw.py
1475 $ echo 'buglink = "http://example.com/bts"' >> throw.py
1476 $ rm -f throw.pyc throw.pyo
1476 $ rm -f throw.pyc throw.pyo
1477 $ rm -Rf __pycache__
1477 $ rm -Rf __pycache__
1478 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1478 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1479 ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0
1479 ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0
1480 ** which supports versions unknown of Mercurial.
1480 ** which supports versions unknown of Mercurial.
1481 ** Please disable "throw" and try your action again.
1481 ** Please disable "throw" and try your action again.
1482 ** If that fixes the bug please report it to http://example.com/bts
1482 ** If that fixes the bug please report it to http://example.com/bts
1483 ** Python * (glob)
1483 ** Python * (glob)
1484 ** Mercurial Distributed SCM (*) (glob)
1484 ** Mercurial Distributed SCM (*) (glob)
1485 ** Extensions loaded: throw 1.0.0
1485 ** Extensions loaded: throw 1.0.0
1486
1486
1487 If the extensions declare outdated versions, accuse the older extension first:
1487 If the extensions declare outdated versions, accuse the older extension first:
1488 $ echo "from mercurial import util" >> older.py
1488 $ echo "from mercurial import util" >> older.py
1489 $ echo "util.version = lambda:b'2.2'" >> older.py
1489 $ echo "util.version = lambda:b'2.2'" >> older.py
1490 $ echo "testedwith = b'1.9.3'" >> older.py
1490 $ echo "testedwith = b'1.9.3'" >> older.py
1491 $ echo "testedwith = b'2.1.1'" >> throw.py
1491 $ echo "testedwith = b'2.1.1'" >> throw.py
1492 $ rm -f throw.pyc throw.pyo
1492 $ rm -f throw.pyc throw.pyo
1493 $ rm -Rf __pycache__
1493 $ rm -Rf __pycache__
1494 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1494 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1495 > throw 2>&1 | egrep '^\*\*'
1495 > throw 2>&1 | egrep '^\*\*'
1496 ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A)
1496 ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A)
1497 ** which supports versions 1.9 of Mercurial.
1497 ** which supports versions 1.9 of Mercurial.
1498 ** Please disable "older" and try your action again.
1498 ** Please disable "older" and try your action again.
1499 ** If that fixes the bug please report it to the extension author.
1499 ** If that fixes the bug please report it to the extension author.
1500 ** Python * (glob)
1500 ** Python * (glob)
1501 ** Mercurial Distributed SCM (version 2.2)
1501 ** Mercurial Distributed SCM (version 2.2)
1502 ** Extensions loaded: older, throw 1.0.0
1502 ** Extensions loaded: older, throw 1.0.0
1503
1503
1504 One extension only tested with older, one only with newer versions:
1504 One extension only tested with older, one only with newer versions:
1505 $ echo "util.version = lambda:b'2.1'" >> older.py
1505 $ echo "util.version = lambda:b'2.1'" >> older.py
1506 $ rm -f older.pyc older.pyo
1506 $ rm -f older.pyc older.pyo
1507 $ rm -Rf __pycache__
1507 $ rm -Rf __pycache__
1508 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1508 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1509 > throw 2>&1 | egrep '^\*\*'
1509 > throw 2>&1 | egrep '^\*\*'
1510 ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A)
1510 ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A)
1511 ** which supports versions 1.9 of Mercurial.
1511 ** which supports versions 1.9 of Mercurial.
1512 ** Please disable "older" and try your action again.
1512 ** Please disable "older" and try your action again.
1513 ** If that fixes the bug please report it to the extension author.
1513 ** If that fixes the bug please report it to the extension author.
1514 ** Python * (glob)
1514 ** Python * (glob)
1515 ** Mercurial Distributed SCM (version 2.1)
1515 ** Mercurial Distributed SCM (version 2.1)
1516 ** Extensions loaded: older, throw 1.0.0
1516 ** Extensions loaded: older, throw 1.0.0
1517
1517
1518 Older extension is tested with current version, the other only with newer:
1518 Older extension is tested with current version, the other only with newer:
1519 $ echo "util.version = lambda:b'1.9.3'" >> older.py
1519 $ echo "util.version = lambda:b'1.9.3'" >> older.py
1520 $ rm -f older.pyc older.pyo
1520 $ rm -f older.pyc older.pyo
1521 $ rm -Rf __pycache__
1521 $ rm -Rf __pycache__
1522 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1522 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1523 > throw 2>&1 | egrep '^\*\*'
1523 > throw 2>&1 | egrep '^\*\*'
1524 ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0
1524 ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0
1525 ** which supports versions 2.1 of Mercurial.
1525 ** which supports versions 2.1 of Mercurial.
1526 ** Please disable "throw" and try your action again.
1526 ** Please disable "throw" and try your action again.
1527 ** If that fixes the bug please report it to http://example.com/bts
1527 ** If that fixes the bug please report it to http://example.com/bts
1528 ** Python * (glob)
1528 ** Python * (glob)
1529 ** Mercurial Distributed SCM (version 1.9.3)
1529 ** Mercurial Distributed SCM (version 1.9.3)
1530 ** Extensions loaded: older, throw 1.0.0
1530 ** Extensions loaded: older, throw 1.0.0
1531
1531
1532 Ability to point to a different point
1532 Ability to point to a different point
1533 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1533 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1534 > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*'
1534 > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*'
1535 ** unknown exception encountered, please report by visiting
1535 ** unknown exception encountered, please report by visiting
1536 ** Your Local Goat Lenders
1536 ** Your Local Goat Lenders
1537 ** Python * (glob)
1537 ** Python * (glob)
1538 ** Mercurial Distributed SCM (*) (glob)
1538 ** Mercurial Distributed SCM (*) (glob)
1539 ** Extensions loaded: older, throw 1.0.0
1539 ** Extensions loaded: older, throw 1.0.0
1540
1540
1541 Declare the version as supporting this hg version, show regular bts link:
1541 Declare the version as supporting this hg version, show regular bts link:
1542 $ hgver=`hg debuginstall -T '{hgver}'`
1542 $ hgver=`hg debuginstall -T '{hgver}'`
1543 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
1543 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
1544 $ if [ -z "$hgver" ]; then
1544 $ if [ -z "$hgver" ]; then
1545 > echo "unable to fetch a mercurial version. Make sure __version__ is correct";
1545 > echo "unable to fetch a mercurial version. Make sure __version__ is correct";
1546 > fi
1546 > fi
1547 $ rm -f throw.pyc throw.pyo
1547 $ rm -f throw.pyc throw.pyo
1548 $ rm -Rf __pycache__
1548 $ rm -Rf __pycache__
1549 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1549 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1550 ** unknown exception encountered, please report by visiting
1550 ** unknown exception encountered, please report by visiting
1551 ** https://mercurial-scm.org/wiki/BugTracker
1551 ** https://mercurial-scm.org/wiki/BugTracker
1552 ** Python * (glob)
1552 ** Python * (glob)
1553 ** Mercurial Distributed SCM (*) (glob)
1553 ** Mercurial Distributed SCM (*) (glob)
1554 ** Extensions loaded: throw 1.0.0
1554 ** Extensions loaded: throw 1.0.0
1555
1555
1556 Patch version is ignored during compatibility check
1556 Patch version is ignored during compatibility check
1557 $ echo "testedwith = b'3.2'" >> throw.py
1557 $ echo "testedwith = b'3.2'" >> throw.py
1558 $ echo "util.version = lambda:b'3.2.2'" >> throw.py
1558 $ echo "util.version = lambda:b'3.2.2'" >> throw.py
1559 $ rm -f throw.pyc throw.pyo
1559 $ rm -f throw.pyc throw.pyo
1560 $ rm -Rf __pycache__
1560 $ rm -Rf __pycache__
1561 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1561 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1562 ** unknown exception encountered, please report by visiting
1562 ** unknown exception encountered, please report by visiting
1563 ** https://mercurial-scm.org/wiki/BugTracker
1563 ** https://mercurial-scm.org/wiki/BugTracker
1564 ** Python * (glob)
1564 ** Python * (glob)
1565 ** Mercurial Distributed SCM (*) (glob)
1565 ** Mercurial Distributed SCM (*) (glob)
1566 ** Extensions loaded: throw 1.0.0
1566 ** Extensions loaded: throw 1.0.0
1567
1567
1568 Test version number support in 'hg version':
1568 Test version number support in 'hg version':
1569 $ echo '__version__ = (1, 2, 3)' >> throw.py
1569 $ echo '__version__ = (1, 2, 3)' >> throw.py
1570 $ rm -f throw.pyc throw.pyo
1570 $ rm -f throw.pyc throw.pyo
1571 $ rm -Rf __pycache__
1571 $ rm -Rf __pycache__
1572 $ hg version -v
1572 $ hg version -v
1573 Mercurial Distributed SCM (version *) (glob)
1573 Mercurial Distributed SCM (version *) (glob)
1574 (see https://mercurial-scm.org for more information)
1574 (see https://mercurial-scm.org for more information)
1575
1575
1576 Copyright (C) 2005-* Olivia Mackall and others (glob)
1576 Copyright (C) 2005-* Olivia Mackall and others (glob)
1577 This is free software; see the source for copying conditions. There is NO
1577 This is free software; see the source for copying conditions. There is NO
1578 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1578 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1579
1579
1580 Enabled extensions:
1580 Enabled extensions:
1581
1581
1582
1582
1583 $ hg version -v --config extensions.throw=throw.py
1583 $ hg version -v --config extensions.throw=throw.py
1584 Mercurial Distributed SCM (version *) (glob)
1584 Mercurial Distributed SCM (version *) (glob)
1585 (see https://mercurial-scm.org for more information)
1585 (see https://mercurial-scm.org for more information)
1586
1586
1587 Copyright (C) 2005-* Olivia Mackall and others (glob)
1587 Copyright (C) 2005-* Olivia Mackall and others (glob)
1588 This is free software; see the source for copying conditions. There is NO
1588 This is free software; see the source for copying conditions. There is NO
1589 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1589 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1590
1590
1591 Enabled extensions:
1591 Enabled extensions:
1592
1592
1593 throw external 1.2.3
1593 throw external 1.2.3
1594 $ echo 'getversion = lambda: b"1.twentythree"' >> throw.py
1594 $ echo 'getversion = lambda: b"1.twentythree"' >> throw.py
1595 $ rm -f throw.pyc throw.pyo
1595 $ rm -f throw.pyc throw.pyo
1596 $ rm -Rf __pycache__
1596 $ rm -Rf __pycache__
1597 $ hg version -v --config extensions.throw=throw.py --config extensions.strip=
1597 $ hg version -v --config extensions.throw=throw.py --config extensions.strip=
1598 Mercurial Distributed SCM (version *) (glob)
1598 Mercurial Distributed SCM (version *) (glob)
1599 (see https://mercurial-scm.org for more information)
1599 (see https://mercurial-scm.org for more information)
1600
1600
1601 Copyright (C) 2005-* Olivia Mackall and others (glob)
1601 Copyright (C) 2005-* Olivia Mackall and others (glob)
1602 This is free software; see the source for copying conditions. There is NO
1602 This is free software; see the source for copying conditions. There is NO
1603 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1603 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1604
1604
1605 Enabled extensions:
1605 Enabled extensions:
1606
1606
1607 strip internal
1607 strip internal
1608 throw external 1.twentythree
1608 throw external 1.twentythree
1609
1609
1610 $ hg version -q --config extensions.throw=throw.py
1610 $ hg version -q --config extensions.throw=throw.py
1611 Mercurial Distributed SCM (version *) (glob)
1611 Mercurial Distributed SCM (version *) (glob)
1612
1612
1613 Test template output:
1613 Test template output:
1614
1614
1615 $ hg version --config extensions.strip= -T'{extensions}'
1615 $ hg version --config extensions.strip= -T'{extensions}'
1616 strip
1616 strip
1617
1617
1618 Test JSON output of version:
1618 Test JSON output of version:
1619
1619
1620 $ hg version -Tjson
1620 $ hg version -Tjson
1621 [
1621 [
1622 {
1622 {
1623 "extensions": [],
1623 "extensions": [],
1624 "ver": "*" (glob)
1624 "ver": "*" (glob)
1625 }
1625 }
1626 ]
1626 ]
1627
1627
1628 $ hg version --config extensions.throw=throw.py -Tjson
1628 $ hg version --config extensions.throw=throw.py -Tjson
1629 [
1629 [
1630 {
1630 {
1631 "extensions": [{"bundled": false, "name": "throw", "ver": "1.twentythree"}],
1631 "extensions": [{"bundled": false, "name": "throw", "ver": "1.twentythree"}],
1632 "ver": "3.2.2"
1632 "ver": "3.2.2"
1633 }
1633 }
1634 ]
1634 ]
1635
1635
1636 $ hg version --config extensions.strip= -Tjson
1636 $ hg version --config extensions.strip= -Tjson
1637 [
1637 [
1638 {
1638 {
1639 "extensions": [{"bundled": true, "name": "strip", "ver": null}],
1639 "extensions": [{"bundled": true, "name": "strip", "ver": null}],
1640 "ver": "*" (glob)
1640 "ver": "*" (glob)
1641 }
1641 }
1642 ]
1642 ]
1643
1643
1644 Test template output of version:
1644 Test template output of version:
1645
1645
1646 $ hg version --config extensions.throw=throw.py --config extensions.strip= \
1646 $ hg version --config extensions.throw=throw.py --config extensions.strip= \
1647 > -T'{extensions % "{name} {pad(ver, 16)} ({if(bundled, "internal", "external")})\n"}'
1647 > -T'{extensions % "{name} {pad(ver, 16)} ({if(bundled, "internal", "external")})\n"}'
1648 strip (internal)
1648 strip (internal)
1649 throw 1.twentythree (external)
1649 throw 1.twentythree (external)
1650
1650
1651 Refuse to load extensions with minimum version requirements
1651 Refuse to load extensions with minimum version requirements
1652
1652
1653 $ cat > minversion1.py << EOF
1653 $ cat > minversion1.py << EOF
1654 > from mercurial import util
1654 > from mercurial import util
1655 > util.version = lambda: b'3.5.2'
1655 > util.version = lambda: b'3.5.2'
1656 > minimumhgversion = b'3.6'
1656 > minimumhgversion = b'3.6'
1657 > EOF
1657 > EOF
1658 $ hg --config extensions.minversion=minversion1.py version
1658 $ hg --config extensions.minversion=minversion1.py version
1659 (third party extension minversion requires version 3.6 or newer of Mercurial (current: 3.5.2); disabling)
1659 (third party extension minversion requires version 3.6 or newer of Mercurial (current: 3.5.2); disabling)
1660 Mercurial Distributed SCM (version 3.5.2)
1660 Mercurial Distributed SCM (version 3.5.2)
1661 (see https://mercurial-scm.org for more information)
1661 (see https://mercurial-scm.org for more information)
1662
1662
1663 Copyright (C) 2005-* Olivia Mackall and others (glob)
1663 Copyright (C) 2005-* Olivia Mackall and others (glob)
1664 This is free software; see the source for copying conditions. There is NO
1664 This is free software; see the source for copying conditions. There is NO
1665 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1665 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1666
1666
1667 $ cat > minversion2.py << EOF
1667 $ cat > minversion2.py << EOF
1668 > from mercurial import util
1668 > from mercurial import util
1669 > util.version = lambda: b'3.6'
1669 > util.version = lambda: b'3.6'
1670 > minimumhgversion = b'3.7'
1670 > minimumhgversion = b'3.7'
1671 > EOF
1671 > EOF
1672 $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third'
1672 $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third'
1673 (third party extension minversion requires version 3.7 or newer of Mercurial (current: 3.6); disabling)
1673 (third party extension minversion requires version 3.7 or newer of Mercurial (current: 3.6); disabling)
1674
1674
1675 Can load version that is only off by point release
1675 Can load version that is only off by point release
1676
1676
1677 $ cat > minversion2.py << EOF
1677 $ cat > minversion2.py << EOF
1678 > from mercurial import util
1678 > from mercurial import util
1679 > util.version = lambda: b'3.6.1'
1679 > util.version = lambda: b'3.6.1'
1680 > minimumhgversion = b'3.6'
1680 > minimumhgversion = b'3.6'
1681 > EOF
1681 > EOF
1682 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1682 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1683 [1]
1683 [1]
1684
1684
1685 Can load minimum version identical to current
1685 Can load minimum version identical to current
1686
1686
1687 $ cat > minversion3.py << EOF
1687 $ cat > minversion3.py << EOF
1688 > from mercurial import util
1688 > from mercurial import util
1689 > util.version = lambda: b'3.5'
1689 > util.version = lambda: b'3.5'
1690 > minimumhgversion = b'3.5'
1690 > minimumhgversion = b'3.5'
1691 > EOF
1691 > EOF
1692 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1692 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1693 [1]
1693 [1]
1694
1694
1695 Don't explode on py3 with a bad version number (both str vs bytes, and not enough
1695 Don't explode on py3 with a bad version number (both str vs bytes, and not enough
1696 parts)
1696 parts)
1697
1697
1698 $ cat > minversion4.py << EOF
1698 $ cat > minversion4.py << EOF
1699 > from mercurial import util
1699 > from mercurial import util
1700 > util.version = lambda: b'3.5'
1700 > util.version = lambda: b'3.5'
1701 > minimumhgversion = '3'
1701 > minimumhgversion = '3'
1702 > EOF
1702 > EOF
1703 $ hg --config extensions.minversion=minversion4.py version -v
1703 $ hg --config extensions.minversion=minversion4.py version -v
1704 Mercurial Distributed SCM (version 3.5)
1704 Mercurial Distributed SCM (version 3.5)
1705 (see https://mercurial-scm.org for more information)
1705 (see https://mercurial-scm.org for more information)
1706
1706
1707 Copyright (C) 2005-* Olivia Mackall and others (glob)
1707 Copyright (C) 2005-* Olivia Mackall and others (glob)
1708 This is free software; see the source for copying conditions. There is NO
1708 This is free software; see the source for copying conditions. There is NO
1709 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1709 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1710
1710
1711 Enabled extensions:
1711 Enabled extensions:
1712
1712
1713 minversion external
1713 minversion external
1714
1714
1715 Restore HGRCPATH
1715 Restore HGRCPATH
1716
1716
1717 $ HGRCPATH=$ORGHGRCPATH
1717 $ HGRCPATH=$ORGHGRCPATH
1718 $ export HGRCPATH
1718 $ export HGRCPATH
1719
1719
1720 Commands handling multiple repositories at a time should invoke only
1720 Commands handling multiple repositories at a time should invoke only
1721 "reposetup()" of extensions enabling in the target repository.
1721 "reposetup()" of extensions enabling in the target repository.
1722
1722
1723 $ mkdir reposetup-test
1723 $ mkdir reposetup-test
1724 $ cd reposetup-test
1724 $ cd reposetup-test
1725
1725
1726 $ cat > $TESTTMP/reposetuptest.py <<EOF
1726 $ cat > $TESTTMP/reposetuptest.py <<EOF
1727 > from mercurial import extensions
1727 > from mercurial import extensions
1728 > def reposetup(ui, repo):
1728 > def reposetup(ui, repo):
1729 > ui.write(b'reposetup() for %s\n' % (repo.root))
1729 > ui.write(b'reposetup() for %s\n' % (repo.root))
1730 > ui.flush()
1730 > ui.flush()
1731 > EOF
1731 > EOF
1732 $ hg init src
1732 $ hg init src
1733 $ echo a > src/a
1733 $ echo a > src/a
1734 $ hg -R src commit -Am '#0 at src/a'
1734 $ hg -R src commit -Am '#0 at src/a'
1735 adding a
1735 adding a
1736 $ echo '[extensions]' >> src/.hg/hgrc
1736 $ echo '[extensions]' >> src/.hg/hgrc
1737 $ echo '# enable extension locally' >> src/.hg/hgrc
1737 $ echo '# enable extension locally' >> src/.hg/hgrc
1738 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
1738 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
1739 $ hg -R src status
1739 $ hg -R src status
1740 reposetup() for $TESTTMP/reposetup-test/src
1740 reposetup() for $TESTTMP/reposetup-test/src
1741 reposetup() for $TESTTMP/reposetup-test/src (chg !)
1741 reposetup() for $TESTTMP/reposetup-test/src (chg !)
1742
1742
1743 #if no-extraextensions
1743 #if no-extraextensions
1744 $ hg --cwd src debugextensions
1744 $ hg --cwd src debugextensions
1745 reposetup() for $TESTTMP/reposetup-test/src
1745 reposetup() for $TESTTMP/reposetup-test/src
1746 dodo (untested!)
1746 dodo (untested!)
1747 dudu (untested!)
1747 dudu (untested!)
1748 mq
1748 mq
1749 reposetuptest (untested!)
1749 reposetuptest (untested!)
1750 strip
1750 strip
1751 #endif
1751 #endif
1752
1752
1753 $ hg clone -U src clone-dst1
1753 $ hg clone -U src clone-dst1
1754 reposetup() for $TESTTMP/reposetup-test/src
1754 reposetup() for $TESTTMP/reposetup-test/src
1755 $ hg init push-dst1
1755 $ hg init push-dst1
1756 $ hg -q -R src push push-dst1
1756 $ hg -q -R src push push-dst1
1757 reposetup() for $TESTTMP/reposetup-test/src
1757 reposetup() for $TESTTMP/reposetup-test/src
1758 $ hg init pull-src1
1758 $ hg init pull-src1
1759 $ hg -q -R pull-src1 pull src
1759 $ hg -q -R pull-src1 pull src
1760 reposetup() for $TESTTMP/reposetup-test/src
1760 reposetup() for $TESTTMP/reposetup-test/src
1761
1761
1762 $ cat <<EOF >> $HGRCPATH
1762 $ cat <<EOF >> $HGRCPATH
1763 > [extensions]
1763 > [extensions]
1764 > # disable extension globally and explicitly
1764 > # disable extension globally and explicitly
1765 > reposetuptest = !
1765 > reposetuptest = !
1766 > EOF
1766 > EOF
1767 $ hg clone -U src clone-dst2
1767 $ hg clone -U src clone-dst2
1768 reposetup() for $TESTTMP/reposetup-test/src
1768 reposetup() for $TESTTMP/reposetup-test/src
1769 $ hg init push-dst2
1769 $ hg init push-dst2
1770 $ hg -q -R src push push-dst2
1770 $ hg -q -R src push push-dst2
1771 reposetup() for $TESTTMP/reposetup-test/src
1771 reposetup() for $TESTTMP/reposetup-test/src
1772 $ hg init pull-src2
1772 $ hg init pull-src2
1773 $ hg -q -R pull-src2 pull src
1773 $ hg -q -R pull-src2 pull src
1774 reposetup() for $TESTTMP/reposetup-test/src
1774 reposetup() for $TESTTMP/reposetup-test/src
1775
1775
1776 $ cat <<EOF >> $HGRCPATH
1776 $ cat <<EOF >> $HGRCPATH
1777 > [extensions]
1777 > [extensions]
1778 > # enable extension globally
1778 > # enable extension globally
1779 > reposetuptest = $TESTTMP/reposetuptest.py
1779 > reposetuptest = $TESTTMP/reposetuptest.py
1780 > EOF
1780 > EOF
1781 $ hg clone -U src clone-dst3
1781 $ hg clone -U src clone-dst3
1782 reposetup() for $TESTTMP/reposetup-test/src
1782 reposetup() for $TESTTMP/reposetup-test/src
1783 reposetup() for $TESTTMP/reposetup-test/clone-dst3
1783 reposetup() for $TESTTMP/reposetup-test/clone-dst3
1784 $ hg init push-dst3
1784 $ hg init push-dst3
1785 reposetup() for $TESTTMP/reposetup-test/push-dst3
1785 reposetup() for $TESTTMP/reposetup-test/push-dst3
1786 $ hg -q -R src push push-dst3
1786 $ hg -q -R src push push-dst3
1787 reposetup() for $TESTTMP/reposetup-test/src
1787 reposetup() for $TESTTMP/reposetup-test/src
1788 reposetup() for $TESTTMP/reposetup-test/push-dst3
1788 reposetup() for $TESTTMP/reposetup-test/push-dst3
1789 $ hg init pull-src3
1789 $ hg init pull-src3
1790 reposetup() for $TESTTMP/reposetup-test/pull-src3
1790 reposetup() for $TESTTMP/reposetup-test/pull-src3
1791 $ hg -q -R pull-src3 pull src
1791 $ hg -q -R pull-src3 pull src
1792 reposetup() for $TESTTMP/reposetup-test/pull-src3
1792 reposetup() for $TESTTMP/reposetup-test/pull-src3
1793 reposetup() for $TESTTMP/reposetup-test/src
1793 reposetup() for $TESTTMP/reposetup-test/src
1794
1794
1795 $ echo '[extensions]' >> src/.hg/hgrc
1795 $ echo '[extensions]' >> src/.hg/hgrc
1796 $ echo '# disable extension locally' >> src/.hg/hgrc
1796 $ echo '# disable extension locally' >> src/.hg/hgrc
1797 $ echo 'reposetuptest = !' >> src/.hg/hgrc
1797 $ echo 'reposetuptest = !' >> src/.hg/hgrc
1798 $ hg clone -U src clone-dst4
1798 $ hg clone -U src clone-dst4
1799 reposetup() for $TESTTMP/reposetup-test/clone-dst4
1799 reposetup() for $TESTTMP/reposetup-test/clone-dst4
1800 $ hg init push-dst4
1800 $ hg init push-dst4
1801 reposetup() for $TESTTMP/reposetup-test/push-dst4
1801 reposetup() for $TESTTMP/reposetup-test/push-dst4
1802 $ hg -q -R src push push-dst4
1802 $ hg -q -R src push push-dst4
1803 reposetup() for $TESTTMP/reposetup-test/push-dst4
1803 reposetup() for $TESTTMP/reposetup-test/push-dst4
1804 $ hg init pull-src4
1804 $ hg init pull-src4
1805 reposetup() for $TESTTMP/reposetup-test/pull-src4
1805 reposetup() for $TESTTMP/reposetup-test/pull-src4
1806 $ hg -q -R pull-src4 pull src
1806 $ hg -q -R pull-src4 pull src
1807 reposetup() for $TESTTMP/reposetup-test/pull-src4
1807 reposetup() for $TESTTMP/reposetup-test/pull-src4
1808
1808
1809 disabling in command line overlays with all configuration
1809 disabling in command line overlays with all configuration
1810 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
1810 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
1811 $ hg --config extensions.reposetuptest=! init push-dst5
1811 $ hg --config extensions.reposetuptest=! init push-dst5
1812 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
1812 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
1813 $ hg --config extensions.reposetuptest=! init pull-src5
1813 $ hg --config extensions.reposetuptest=! init pull-src5
1814 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
1814 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
1815
1815
1816 $ cat <<EOF >> $HGRCPATH
1816 $ cat <<EOF >> $HGRCPATH
1817 > [extensions]
1817 > [extensions]
1818 > # disable extension globally and explicitly
1818 > # disable extension globally and explicitly
1819 > reposetuptest = !
1819 > reposetuptest = !
1820 > EOF
1820 > EOF
1821 $ hg init parent
1821 $ hg init parent
1822 $ hg init parent/sub1
1822 $ hg init parent/sub1
1823 $ echo 1 > parent/sub1/1
1823 $ echo 1 > parent/sub1/1
1824 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
1824 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
1825 adding 1
1825 adding 1
1826 $ hg init parent/sub2
1826 $ hg init parent/sub2
1827 $ hg init parent/sub2/sub21
1827 $ hg init parent/sub2/sub21
1828 $ echo 21 > parent/sub2/sub21/21
1828 $ echo 21 > parent/sub2/sub21/21
1829 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
1829 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
1830 adding 21
1830 adding 21
1831 $ cat > parent/sub2/.hgsub <<EOF
1831 $ cat > parent/sub2/.hgsub <<EOF
1832 > sub21 = sub21
1832 > sub21 = sub21
1833 > EOF
1833 > EOF
1834 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
1834 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
1835 adding .hgsub
1835 adding .hgsub
1836 $ hg init parent/sub3
1836 $ hg init parent/sub3
1837 $ echo 3 > parent/sub3/3
1837 $ echo 3 > parent/sub3/3
1838 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
1838 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
1839 adding 3
1839 adding 3
1840 $ cat > parent/.hgsub <<EOF
1840 $ cat > parent/.hgsub <<EOF
1841 > sub1 = sub1
1841 > sub1 = sub1
1842 > sub2 = sub2
1842 > sub2 = sub2
1843 > sub3 = sub3
1843 > sub3 = sub3
1844 > EOF
1844 > EOF
1845 $ hg -R parent commit -Am '#0 at parent'
1845 $ hg -R parent commit -Am '#0 at parent'
1846 adding .hgsub
1846 adding .hgsub
1847 $ echo '[extensions]' >> parent/.hg/hgrc
1847 $ echo '[extensions]' >> parent/.hg/hgrc
1848 $ echo '# enable extension locally' >> parent/.hg/hgrc
1848 $ echo '# enable extension locally' >> parent/.hg/hgrc
1849 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
1849 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
1850 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
1850 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
1851 $ hg -R parent status -S -A
1851 $ hg -R parent status -S -A
1852 reposetup() for $TESTTMP/reposetup-test/parent
1852 reposetup() for $TESTTMP/reposetup-test/parent
1853 reposetup() for $TESTTMP/reposetup-test/parent/sub2
1853 reposetup() for $TESTTMP/reposetup-test/parent/sub2
1854 C .hgsub
1854 C .hgsub
1855 C .hgsubstate
1855 C .hgsubstate
1856 C sub1/1
1856 C sub1/1
1857 C sub2/.hgsub
1857 C sub2/.hgsub
1858 C sub2/.hgsubstate
1858 C sub2/.hgsubstate
1859 C sub2/sub21/21
1859 C sub2/sub21/21
1860 C sub3/3
1860 C sub3/3
1861
1861
1862 $ cd ..
1862 $ cd ..
1863
1863
1864 Prohibit registration of commands that don't use @command (issue5137)
1864 Prohibit registration of commands that don't use @command (issue5137)
1865
1865
1866 $ hg init deprecated
1866 $ hg init deprecated
1867 $ cd deprecated
1867 $ cd deprecated
1868
1868
1869 $ cat <<EOF > deprecatedcmd.py
1869 $ cat <<EOF > deprecatedcmd.py
1870 > def deprecatedcmd(repo, ui):
1870 > def deprecatedcmd(repo, ui):
1871 > pass
1871 > pass
1872 > cmdtable = {
1872 > cmdtable = {
1873 > b'deprecatedcmd': (deprecatedcmd, [], b''),
1873 > b'deprecatedcmd': (deprecatedcmd, [], b''),
1874 > }
1874 > }
1875 > EOF
1875 > EOF
1876 $ cat <<EOF > .hg/hgrc
1876 $ cat <<EOF > .hg/hgrc
1877 > [extensions]
1877 > [extensions]
1878 > deprecatedcmd = `pwd`/deprecatedcmd.py
1878 > deprecatedcmd = `pwd`/deprecatedcmd.py
1879 > mq = !
1879 > mq = !
1880 > hgext.mq = !
1880 > hgext.mq = !
1881 > hgext/mq = !
1881 > hgext/mq = !
1882 > EOF
1882 > EOF
1883
1883
1884 $ hg deprecatedcmd > /dev/null
1884 $ hg deprecatedcmd > /dev/null
1885 *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
1885 *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
1886 *** (use @command decorator to register 'deprecatedcmd')
1886 *** (use @command decorator to register 'deprecatedcmd')
1887 hg: unknown command 'deprecatedcmd'
1887 hg: unknown command 'deprecatedcmd'
1888 (use 'hg help' for a list of commands)
1888 (use 'hg help' for a list of commands)
1889 [10]
1889 [10]
1890
1890
1891 the extension shouldn't be loaded at all so the mq works:
1891 the extension shouldn't be loaded at all so the mq works:
1892
1892
1893 $ hg qseries --config extensions.mq= > /dev/null
1893 $ hg qseries --config extensions.mq= > /dev/null
1894 *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
1894 *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
1895 *** (use @command decorator to register 'deprecatedcmd')
1895 *** (use @command decorator to register 'deprecatedcmd')
1896
1896
1897 $ cd ..
1897 $ cd ..
1898
1898
1899 Test synopsis and docstring extending
1899 Test synopsis and docstring extending
1900
1900
1901 $ hg init exthelp
1901 $ hg init exthelp
1902 $ cat > exthelp.py <<EOF
1902 $ cat > exthelp.py <<EOF
1903 > from mercurial import commands, extensions
1903 > from mercurial import commands, extensions
1904 > def exbookmarks(orig, *args, **opts):
1904 > def exbookmarks(orig, *args, **opts):
1905 > return orig(*args, **opts)
1905 > return orig(*args, **opts)
1906 > def uisetup(ui):
1906 > def uisetup(ui):
1907 > synopsis = b' GREPME [--foo] [-x]'
1907 > synopsis = b' GREPME [--foo] [-x]'
1908 > docstring = '''
1908 > docstring = '''
1909 > GREPME make sure that this is in the help!
1909 > GREPME make sure that this is in the help!
1910 > '''
1910 > '''
1911 > extensions.wrapcommand(commands.table, b'bookmarks', exbookmarks,
1911 > extensions.wrapcommand(commands.table, b'bookmarks', exbookmarks,
1912 > synopsis, docstring)
1912 > synopsis, docstring)
1913 > EOF
1913 > EOF
1914 $ abspath=`pwd`/exthelp.py
1914 $ abspath=`pwd`/exthelp.py
1915 $ echo '[extensions]' >> $HGRCPATH
1915 $ echo '[extensions]' >> $HGRCPATH
1916 $ echo "exthelp = $abspath" >> $HGRCPATH
1916 $ echo "exthelp = $abspath" >> $HGRCPATH
1917 $ cd exthelp
1917 $ cd exthelp
1918 $ hg help bookmarks | grep GREPME
1918 $ hg help bookmarks | grep GREPME
1919 hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x]
1919 hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x]
1920 GREPME make sure that this is in the help!
1920 GREPME make sure that this is in the help!
1921 $ cd ..
1921 $ cd ..
1922
1922
1923 Prohibit the use of unicode strings as the default value of options
1923 Prohibit the use of unicode strings as the default value of options
1924
1924
1925 $ hg init $TESTTMP/opt-unicode-default
1925 $ hg init $TESTTMP/opt-unicode-default
1926
1926
1927 $ cat > $TESTTMP/test_unicode_default_value.py << EOF
1927 $ cat > $TESTTMP/test_unicode_default_value.py << EOF
1928 > from __future__ import print_function
1928 > from __future__ import print_function
1929 > from mercurial import registrar
1929 > from mercurial import registrar
1930 > cmdtable = {}
1930 > cmdtable = {}
1931 > command = registrar.command(cmdtable)
1931 > command = registrar.command(cmdtable)
1932 > @command(b'dummy', [(b'', b'opt', u'value', u'help')], 'ext [OPTIONS]')
1932 > @command(b'dummy', [(b'', b'opt', u'value', u'help')], 'ext [OPTIONS]')
1933 > def ext(*args, **opts):
1933 > def ext(*args, **opts):
1934 > print(opts[b'opt'], flush=True)
1934 > print(opts[b'opt'], flush=True)
1935 > EOF
1935 > EOF
1936 $ "$PYTHON" $TESTTMP/unflush.py $TESTTMP/test_unicode_default_value.py
1936 $ "$PYTHON" $TESTTMP/unflush.py $TESTTMP/test_unicode_default_value.py
1937 $ cat > $TESTTMP/opt-unicode-default/.hg/hgrc << EOF
1937 $ cat > $TESTTMP/opt-unicode-default/.hg/hgrc << EOF
1938 > [extensions]
1938 > [extensions]
1939 > test_unicode_default_value = $TESTTMP/test_unicode_default_value.py
1939 > test_unicode_default_value = $TESTTMP/test_unicode_default_value.py
1940 > EOF
1940 > EOF
1941 $ hg -R $TESTTMP/opt-unicode-default dummy
1941 $ hg -R $TESTTMP/opt-unicode-default dummy
1942 *** failed to import extension "test_unicode_default_value" from $TESTTMP/test_unicode_default_value.py: unicode 'value' found in cmdtable.dummy
1942 *** failed to import extension "test_unicode_default_value" from $TESTTMP/test_unicode_default_value.py: unicode 'value' found in cmdtable.dummy
1943 *** (use b'' to make it byte string)
1943 *** (use b'' to make it byte string)
1944 hg: unknown command 'dummy'
1944 hg: unknown command 'dummy'
1945 (did you mean summary?)
1945 (did you mean summary?)
1946 [10]
1946 [10]
1947
1948 Check the mandatory extension feature
1949 -------------------------------------
1950
1951 $ hg init mandatory-extensions
1952 $ cat > $TESTTMP/mandatory-extensions/.hg/good.py << EOF
1953 > pass
1954 > EOF
1955 $ cat > $TESTTMP/mandatory-extensions/.hg/bad.py << EOF
1956 > raise RuntimeError("babar")
1957 > EOF
1958 $ cat > $TESTTMP/mandatory-extensions/.hg/syntax.py << EOF
1959 > def (
1960 > EOF
1961
1962 Check that the good one load :
1963
1964 $ cat > $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
1965 > [extensions]
1966 > good = $TESTTMP/mandatory-extensions/.hg/good.py
1967 > EOF
1968
1969 $ hg -R mandatory-extensions id
1970 000000000000 tip
1971
1972 Make it mandatory to load
1973
1974 $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
1975 > good:required = yes
1976 > EOF
1977
1978 $ hg -R mandatory-extensions id
1979 000000000000 tip
1980
1981 Check that the bad one does not load
1982
1983 $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
1984 > bad = $TESTTMP/mandatory-extensions/.hg/bad.py
1985 > EOF
1986
1987 $ hg -R mandatory-extensions id
1988 *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar
1989 000000000000 tip
1990
1991 Make it mandatory to load
1992
1993 $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
1994 > bad:required = yes
1995 > EOF
1996
1997 $ hg -R mandatory-extensions id
1998 abort: failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar
1999 (loading of this extension was required, see `hg help config.extensions` for details)
2000 [255]
2001
2002 Make it not mandatory to load
2003
2004 $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
2005 > bad:required = no
2006 > EOF
2007
2008 $ hg -R mandatory-extensions id
2009 *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar
2010 000000000000 tip
2011
2012 Same check with the syntax error one
2013
2014 $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
2015 > bad = !
2016 > syntax = $TESTTMP/mandatory-extensions/.hg/syntax.py
2017 > syntax:required = yes
2018 > EOF
2019
2020 $ hg -R mandatory-extensions id
2021 abort: failed to import extension "syntax" from $TESTTMP/mandatory-extensions/.hg/syntax.py: invalid syntax (*syntax.py, line 1) (glob)
2022 (loading of this extension was required, see `hg help config.extensions` for details)
2023 [255]
2024
2025 Same check with a missing one
2026
2027 $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF
2028 > syntax = !
2029 > syntax:required =
2030 > missing = foo/bar/baz/I/do/not/exist/
2031 > missing:required = yes
2032 > EOF
2033
2034 $ hg -R mandatory-extensions id
2035 abort: failed to import extension "missing" from foo/bar/baz/I/do/not/exist/: [Errno 2] $ENOENT$: 'foo/bar/baz/I/do/not/exist'
2036 (loading of this extension was required, see `hg help config.extensions` for details)
2037 [255]
General Comments 0
You need to be logged in to leave comments. Login now