##// END OF EJS Templates
merge: with stable
Augie Fackler -
r49579:3199b575 merge default
parent child Browse files
Show More
@@ -1,1152 +1,1145 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 # $Id: manpage.py 6110 2009-08-31 14:40:33Z grubert $
2 # $Id: manpage.py 6110 2009-08-31 14:40:33Z grubert $
3 # Author: Engelbert Gruber <grubert@users.sourceforge.net>
3 # Author: Engelbert Gruber <grubert@users.sourceforge.net>
4 # Copyright: This module is put into the public domain.
4 # Copyright: This module is put into the public domain.
5
5
6 """
6 """
7 Simple man page writer for reStructuredText.
7 Simple man page writer for reStructuredText.
8
8
9 Man pages (short for "manual pages") contain system documentation on unix-like
9 Man pages (short for "manual pages") contain system documentation on unix-like
10 systems. The pages are grouped in numbered sections:
10 systems. The pages are grouped in numbered sections:
11
11
12 1 executable programs and shell commands
12 1 executable programs and shell commands
13 2 system calls
13 2 system calls
14 3 library functions
14 3 library functions
15 4 special files
15 4 special files
16 5 file formats
16 5 file formats
17 6 games
17 6 games
18 7 miscellaneous
18 7 miscellaneous
19 8 system administration
19 8 system administration
20
20
21 Man pages are written in *troff*, a text file formatting system.
21 Man pages are written in *troff*, a text file formatting system.
22
22
23 See http://www.tldp.org/HOWTO/Man-Page for a start.
23 See http://www.tldp.org/HOWTO/Man-Page for a start.
24
24
25 Man pages have no subsections only parts.
25 Man pages have no subsections only parts.
26 Standard parts
26 Standard parts
27
27
28 NAME ,
28 NAME ,
29 SYNOPSIS ,
29 SYNOPSIS ,
30 DESCRIPTION ,
30 DESCRIPTION ,
31 OPTIONS ,
31 OPTIONS ,
32 FILES ,
32 FILES ,
33 SEE ALSO ,
33 SEE ALSO ,
34 BUGS ,
34 BUGS ,
35
35
36 and
36 and
37
37
38 AUTHOR .
38 AUTHOR .
39
39
40 A unix-like system keeps an index of the DESCRIPTIONs, which is accesable
40 A unix-like system keeps an index of the DESCRIPTIONs, which is accesable
41 by the command whatis or apropos.
41 by the command whatis or apropos.
42
42
43 """
43 """
44 from __future__ import absolute_import
44 from __future__ import absolute_import
45
45
46 __docformat__ = 'reStructuredText'
46 __docformat__ = 'reStructuredText'
47
47
48 import inspect
49 import re
48 import re
50
49
51 from docutils import (
50 from docutils import (
52 languages,
51 languages,
53 nodes,
52 nodes,
54 writers,
53 writers,
55 )
54 )
56
55
57 try:
56 try:
58 import roman
57 import roman
59 except ImportError:
58 except ImportError:
60 from docutils.utils import roman
59 from docutils.utils import roman
61
60
62 FIELD_LIST_INDENT = 7
61 FIELD_LIST_INDENT = 7
63 DEFINITION_LIST_INDENT = 7
62 DEFINITION_LIST_INDENT = 7
64 OPTION_LIST_INDENT = 7
63 OPTION_LIST_INDENT = 7
65 BLOCKQOUTE_INDENT = 3.5
64 BLOCKQOUTE_INDENT = 3.5
66
65
67 # Define two macros so man/roff can calculate the
66 # Define two macros so man/roff can calculate the
68 # indent/unindent margins by itself
67 # indent/unindent margins by itself
69 MACRO_DEF = r""".
68 MACRO_DEF = r""".
70 .nr rst2man-indent-level 0
69 .nr rst2man-indent-level 0
71 .
70 .
72 .de1 rstReportMargin
71 .de1 rstReportMargin
73 \\$1 \\n[an-margin]
72 \\$1 \\n[an-margin]
74 level \\n[rst2man-indent-level]
73 level \\n[rst2man-indent-level]
75 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
74 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
76 -
75 -
77 \\n[rst2man-indent0]
76 \\n[rst2man-indent0]
78 \\n[rst2man-indent1]
77 \\n[rst2man-indent1]
79 \\n[rst2man-indent2]
78 \\n[rst2man-indent2]
80 ..
79 ..
81 .de1 INDENT
80 .de1 INDENT
82 .\" .rstReportMargin pre:
81 .\" .rstReportMargin pre:
83 . RS \\$1
82 . RS \\$1
84 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
83 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
85 . nr rst2man-indent-level +1
84 . nr rst2man-indent-level +1
86 .\" .rstReportMargin post:
85 .\" .rstReportMargin post:
87 ..
86 ..
88 .de UNINDENT
87 .de UNINDENT
89 . RE
88 . RE
90 .\" indent \\n[an-margin]
89 .\" indent \\n[an-margin]
91 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
90 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
92 .nr rst2man-indent-level -1
91 .nr rst2man-indent-level -1
93 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
92 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
94 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
93 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
95 ..
94 ..
96 """
95 """
97
96
98
97
99 class Writer(writers.Writer):
98 class Writer(writers.Writer):
100
99
101 supported = 'manpage'
100 supported = 'manpage'
102 """Formats this writer supports."""
101 """Formats this writer supports."""
103
102
104 output = None
103 output = None
105 """Final translated form of `document`."""
104 """Final translated form of `document`."""
106
105
107 def __init__(self):
106 def __init__(self):
108 writers.Writer.__init__(self)
107 writers.Writer.__init__(self)
109 self.translator_class = Translator
108 self.translator_class = Translator
110
109
111 def translate(self):
110 def translate(self):
112 visitor = self.translator_class(self.document)
111 visitor = self.translator_class(self.document)
113 self.document.walkabout(visitor)
112 self.document.walkabout(visitor)
114 self.output = visitor.astext()
113 self.output = visitor.astext()
115
114
116
115
117 class Table(object):
116 class Table(object):
118 def __init__(self):
117 def __init__(self):
119 self._rows = []
118 self._rows = []
120 self._options = ['center']
119 self._options = ['center']
121 self._tab_char = '\t'
120 self._tab_char = '\t'
122 self._coldefs = []
121 self._coldefs = []
123
122
124 def new_row(self):
123 def new_row(self):
125 self._rows.append([])
124 self._rows.append([])
126
125
127 def append_separator(self, separator):
126 def append_separator(self, separator):
128 """Append the separator for table head."""
127 """Append the separator for table head."""
129 self._rows.append([separator])
128 self._rows.append([separator])
130
129
131 def append_cell(self, cell_lines):
130 def append_cell(self, cell_lines):
132 """cell_lines is an array of lines"""
131 """cell_lines is an array of lines"""
133 start = 0
132 start = 0
134 if len(cell_lines) > 0 and cell_lines[0] == '.sp\n':
133 if len(cell_lines) > 0 and cell_lines[0] == '.sp\n':
135 start = 1
134 start = 1
136 self._rows[-1].append(cell_lines[start:])
135 self._rows[-1].append(cell_lines[start:])
137 if len(self._coldefs) < len(self._rows[-1]):
136 if len(self._coldefs) < len(self._rows[-1]):
138 self._coldefs.append('l')
137 self._coldefs.append('l')
139
138
140 def _minimize_cell(self, cell_lines):
139 def _minimize_cell(self, cell_lines):
141 """Remove leading and trailing blank and ``.sp`` lines"""
140 """Remove leading and trailing blank and ``.sp`` lines"""
142 while cell_lines and cell_lines[0] in ('\n', '.sp\n'):
141 while cell_lines and cell_lines[0] in ('\n', '.sp\n'):
143 del cell_lines[0]
142 del cell_lines[0]
144 while cell_lines and cell_lines[-1] in ('\n', '.sp\n'):
143 while cell_lines and cell_lines[-1] in ('\n', '.sp\n'):
145 del cell_lines[-1]
144 del cell_lines[-1]
146
145
147 def as_list(self):
146 def as_list(self):
148 text = ['.TS\n']
147 text = ['.TS\n']
149 text.append(' '.join(self._options) + ';\n')
148 text.append(' '.join(self._options) + ';\n')
150 text.append('|%s|.\n' % ('|'.join(self._coldefs)))
149 text.append('|%s|.\n' % ('|'.join(self._coldefs)))
151 for row in self._rows:
150 for row in self._rows:
152 # row = array of cells. cell = array of lines.
151 # row = array of cells. cell = array of lines.
153 text.append('_\n') # line above
152 text.append('_\n') # line above
154 text.append('T{\n')
153 text.append('T{\n')
155 for i in range(len(row)):
154 for i in range(len(row)):
156 cell = row[i]
155 cell = row[i]
157 self._minimize_cell(cell)
156 self._minimize_cell(cell)
158 text.extend(cell)
157 text.extend(cell)
159 if not text[-1].endswith('\n'):
158 if not text[-1].endswith('\n'):
160 text[-1] += '\n'
159 text[-1] += '\n'
161 if i < len(row) - 1:
160 if i < len(row) - 1:
162 text.append('T}' + self._tab_char + 'T{\n')
161 text.append('T}' + self._tab_char + 'T{\n')
163 else:
162 else:
164 text.append('T}\n')
163 text.append('T}\n')
165 text.append('_\n')
164 text.append('_\n')
166 text.append('.TE\n')
165 text.append('.TE\n')
167 return text
166 return text
168
167
169
168
170 class Translator(nodes.NodeVisitor):
169 class Translator(nodes.NodeVisitor):
171 """ """
170 """ """
172
171
173 words_and_spaces = re.compile(r'\S+| +|\n')
172 words_and_spaces = re.compile(r'\S+| +|\n')
174 document_start = """Man page generated from reStructuredText."""
173 document_start = """Man page generated from reStructuredText."""
175
174
176 def __init__(self, document):
175 def __init__(self, document):
177 nodes.NodeVisitor.__init__(self, document)
176 nodes.NodeVisitor.__init__(self, document)
178 self.settings = settings = document.settings
177 self.settings = settings = document.settings
179 lcode = settings.language_code
178 lcode = settings.language_code
180 arglen = len(inspect.getargspec(languages.get_language)[0])
179 self.language = languages.get_language(lcode, self.document.reporter)
181 if arglen == 2:
182 self.language = languages.get_language(
183 lcode, self.document.reporter
184 )
185 else:
186 self.language = languages.get_language(lcode)
187 self.head = []
180 self.head = []
188 self.body = []
181 self.body = []
189 self.foot = []
182 self.foot = []
190 self.section_level = 0
183 self.section_level = 0
191 self.context = []
184 self.context = []
192 self.topic_class = ''
185 self.topic_class = ''
193 self.colspecs = []
186 self.colspecs = []
194 self.compact_p = 1
187 self.compact_p = 1
195 self.compact_simple = None
188 self.compact_simple = None
196 # the list style "*" bullet or "#" numbered
189 # the list style "*" bullet or "#" numbered
197 self._list_char = []
190 self._list_char = []
198 # writing the header .TH and .SH NAME is postboned after
191 # writing the header .TH and .SH NAME is postboned after
199 # docinfo.
192 # docinfo.
200 self._docinfo = {
193 self._docinfo = {
201 "title": "",
194 "title": "",
202 "title_upper": "",
195 "title_upper": "",
203 "subtitle": "",
196 "subtitle": "",
204 "manual_section": "",
197 "manual_section": "",
205 "manual_group": "",
198 "manual_group": "",
206 "author": [],
199 "author": [],
207 "date": "",
200 "date": "",
208 "copyright": "",
201 "copyright": "",
209 "version": "",
202 "version": "",
210 }
203 }
211 self._docinfo_keys = [] # a list to keep the sequence as in source.
204 self._docinfo_keys = [] # a list to keep the sequence as in source.
212 self._docinfo_names = {} # to get name from text not normalized.
205 self._docinfo_names = {} # to get name from text not normalized.
213 self._in_docinfo = None
206 self._in_docinfo = None
214 self._active_table = None
207 self._active_table = None
215 self._in_literal = False
208 self._in_literal = False
216 self.header_written = 0
209 self.header_written = 0
217 self._line_block = 0
210 self._line_block = 0
218 self.authors = []
211 self.authors = []
219 self.section_level = 0
212 self.section_level = 0
220 self._indent = [0]
213 self._indent = [0]
221 # central definition of simple processing rules
214 # central definition of simple processing rules
222 # what to output on : visit, depart
215 # what to output on : visit, depart
223 # Do not use paragraph requests ``.PP`` because these set indentation.
216 # Do not use paragraph requests ``.PP`` because these set indentation.
224 # use ``.sp``. Remove superfluous ``.sp`` in ``astext``.
217 # use ``.sp``. Remove superfluous ``.sp`` in ``astext``.
225 #
218 #
226 # Fonts are put on a stack, the top one is used.
219 # Fonts are put on a stack, the top one is used.
227 # ``.ft P`` or ``\\fP`` pop from stack.
220 # ``.ft P`` or ``\\fP`` pop from stack.
228 # ``B`` bold, ``I`` italic, ``R`` roman should be available.
221 # ``B`` bold, ``I`` italic, ``R`` roman should be available.
229 # Hopefully ``C`` courier too.
222 # Hopefully ``C`` courier too.
230 self.defs = {
223 self.defs = {
231 'indent': ('.INDENT %.1f\n', '.UNINDENT\n'),
224 'indent': ('.INDENT %.1f\n', '.UNINDENT\n'),
232 'definition_list_item': ('.TP', ''),
225 'definition_list_item': ('.TP', ''),
233 'field_name': ('.TP\n.B ', '\n'),
226 'field_name': ('.TP\n.B ', '\n'),
234 'literal': ('\\fB', '\\fP'),
227 'literal': ('\\fB', '\\fP'),
235 'literal_block': ('.sp\n.nf\n.ft C\n', '\n.ft P\n.fi\n'),
228 'literal_block': ('.sp\n.nf\n.ft C\n', '\n.ft P\n.fi\n'),
236 'option_list_item': ('.TP\n', ''),
229 'option_list_item': ('.TP\n', ''),
237 'reference': (r'\%', r'\:'),
230 'reference': (r'\%', r'\:'),
238 'emphasis': ('\\fI', '\\fP'),
231 'emphasis': ('\\fI', '\\fP'),
239 'strong': ('\\fB', '\\fP'),
232 'strong': ('\\fB', '\\fP'),
240 'term': ('\n.B ', '\n'),
233 'term': ('\n.B ', '\n'),
241 'title_reference': ('\\fI', '\\fP'),
234 'title_reference': ('\\fI', '\\fP'),
242 'topic-title': ('.SS ',),
235 'topic-title': ('.SS ',),
243 'sidebar-title': ('.SS ',),
236 'sidebar-title': ('.SS ',),
244 'problematic': ('\n.nf\n', '\n.fi\n'),
237 'problematic': ('\n.nf\n', '\n.fi\n'),
245 }
238 }
246 # NOTE don't specify the newline before a dot-command, but ensure
239 # NOTE don't specify the newline before a dot-command, but ensure
247 # it is there.
240 # it is there.
248
241
249 def comment_begin(self, text):
242 def comment_begin(self, text):
250 """Return commented version of the passed text WITHOUT end of
243 """Return commented version of the passed text WITHOUT end of
251 line/comment."""
244 line/comment."""
252 prefix = '.\\" '
245 prefix = '.\\" '
253 out_text = ''.join(
246 out_text = ''.join(
254 [(prefix + in_line + '\n') for in_line in text.split('\n')]
247 [(prefix + in_line + '\n') for in_line in text.split('\n')]
255 )
248 )
256 return out_text
249 return out_text
257
250
258 def comment(self, text):
251 def comment(self, text):
259 """Return commented version of the passed text."""
252 """Return commented version of the passed text."""
260 return self.comment_begin(text) + '.\n'
253 return self.comment_begin(text) + '.\n'
261
254
262 def ensure_eol(self):
255 def ensure_eol(self):
263 """Ensure the last line in body is terminated by new line."""
256 """Ensure the last line in body is terminated by new line."""
264 if self.body[-1][-1] != '\n':
257 if self.body[-1][-1] != '\n':
265 self.body.append('\n')
258 self.body.append('\n')
266
259
267 def astext(self):
260 def astext(self):
268 """Return the final formatted document as a string."""
261 """Return the final formatted document as a string."""
269 if not self.header_written:
262 if not self.header_written:
270 # ensure we get a ".TH" as viewers require it.
263 # ensure we get a ".TH" as viewers require it.
271 self.head.append(self.header())
264 self.head.append(self.header())
272 # filter body
265 # filter body
273 for i in range(len(self.body) - 1, 0, -1):
266 for i in range(len(self.body) - 1, 0, -1):
274 # remove superfluous vertical gaps.
267 # remove superfluous vertical gaps.
275 if self.body[i] == '.sp\n':
268 if self.body[i] == '.sp\n':
276 if self.body[i - 1][:4] in ('.BI ', '.IP '):
269 if self.body[i - 1][:4] in ('.BI ', '.IP '):
277 self.body[i] = '.\n'
270 self.body[i] = '.\n'
278 elif (
271 elif (
279 self.body[i - 1][:3] == '.B '
272 self.body[i - 1][:3] == '.B '
280 and self.body[i - 2][:4] == '.TP\n'
273 and self.body[i - 2][:4] == '.TP\n'
281 ):
274 ):
282 self.body[i] = '.\n'
275 self.body[i] = '.\n'
283 elif (
276 elif (
284 self.body[i - 1] == '\n'
277 self.body[i - 1] == '\n'
285 and self.body[i - 2][0] != '.'
278 and self.body[i - 2][0] != '.'
286 and (
279 and (
287 self.body[i - 3][:7] == '.TP\n.B '
280 self.body[i - 3][:7] == '.TP\n.B '
288 or self.body[i - 3][:4] == '\n.B '
281 or self.body[i - 3][:4] == '\n.B '
289 )
282 )
290 ):
283 ):
291 self.body[i] = '.\n'
284 self.body[i] = '.\n'
292 return ''.join(self.head + self.body + self.foot)
285 return ''.join(self.head + self.body + self.foot)
293
286
294 def deunicode(self, text):
287 def deunicode(self, text):
295 text = text.replace(u'\xa0', '\\ ')
288 text = text.replace(u'\xa0', '\\ ')
296 text = text.replace(u'\u2020', '\\(dg')
289 text = text.replace(u'\u2020', '\\(dg')
297 return text
290 return text
298
291
299 def visit_Text(self, node):
292 def visit_Text(self, node):
300 text = node.astext()
293 text = node.astext()
301 text = text.replace('\\', '\\e')
294 text = text.replace('\\', '\\e')
302 replace_pairs = [
295 replace_pairs = [
303 (u'-', u'\\-'),
296 (u'-', u'\\-'),
304 (u"'", u'\\(aq'),
297 (u"'", u'\\(aq'),
305 (u'Β΄', u"\\'"),
298 (u'Β΄', u"\\'"),
306 (u'`', u'\\(ga'),
299 (u'`', u'\\(ga'),
307 ]
300 ]
308 for (in_char, out_markup) in replace_pairs:
301 for (in_char, out_markup) in replace_pairs:
309 text = text.replace(in_char, out_markup)
302 text = text.replace(in_char, out_markup)
310 # unicode
303 # unicode
311 text = self.deunicode(text)
304 text = self.deunicode(text)
312 if self._in_literal:
305 if self._in_literal:
313 # prevent interpretation of "." at line start
306 # prevent interpretation of "." at line start
314 if text[0] == '.':
307 if text[0] == '.':
315 text = '\\&' + text
308 text = '\\&' + text
316 text = text.replace('\n.', '\n\\&.')
309 text = text.replace('\n.', '\n\\&.')
317 self.body.append(text)
310 self.body.append(text)
318
311
319 def depart_Text(self, node):
312 def depart_Text(self, node):
320 pass
313 pass
321
314
322 def list_start(self, node):
315 def list_start(self, node):
323 class enum_char(object):
316 class enum_char(object):
324 enum_style = {
317 enum_style = {
325 'bullet': '\\(bu',
318 'bullet': '\\(bu',
326 'emdash': '\\(em',
319 'emdash': '\\(em',
327 }
320 }
328
321
329 def __init__(self, style):
322 def __init__(self, style):
330 self._style = style
323 self._style = style
331 if 'start' in node:
324 if 'start' in node:
332 self._cnt = node['start'] - 1
325 self._cnt = node['start'] - 1
333 else:
326 else:
334 self._cnt = 0
327 self._cnt = 0
335 self._indent = 2
328 self._indent = 2
336 if style == 'arabic':
329 if style == 'arabic':
337 # indentation depends on number of children
330 # indentation depends on number of children
338 # and start value.
331 # and start value.
339 self._indent = len(str(len(node.children)))
332 self._indent = len(str(len(node.children)))
340 self._indent += len(str(self._cnt)) + 1
333 self._indent += len(str(self._cnt)) + 1
341 elif style == 'loweralpha':
334 elif style == 'loweralpha':
342 self._cnt += ord('a') - 1
335 self._cnt += ord('a') - 1
343 self._indent = 3
336 self._indent = 3
344 elif style == 'upperalpha':
337 elif style == 'upperalpha':
345 self._cnt += ord('A') - 1
338 self._cnt += ord('A') - 1
346 self._indent = 3
339 self._indent = 3
347 elif style.endswith('roman'):
340 elif style.endswith('roman'):
348 self._indent = 5
341 self._indent = 5
349
342
350 def __next__(self):
343 def __next__(self):
351 if self._style == 'bullet':
344 if self._style == 'bullet':
352 return self.enum_style[self._style]
345 return self.enum_style[self._style]
353 elif self._style == 'emdash':
346 elif self._style == 'emdash':
354 return self.enum_style[self._style]
347 return self.enum_style[self._style]
355 self._cnt += 1
348 self._cnt += 1
356 # TODO add prefix postfix
349 # TODO add prefix postfix
357 if self._style == 'arabic':
350 if self._style == 'arabic':
358 return "%d." % self._cnt
351 return "%d." % self._cnt
359 elif self._style in ('loweralpha', 'upperalpha'):
352 elif self._style in ('loweralpha', 'upperalpha'):
360 return "%c." % self._cnt
353 return "%c." % self._cnt
361 elif self._style.endswith('roman'):
354 elif self._style.endswith('roman'):
362 res = roman.toRoman(self._cnt) + '.'
355 res = roman.toRoman(self._cnt) + '.'
363 if self._style.startswith('upper'):
356 if self._style.startswith('upper'):
364 return res.upper()
357 return res.upper()
365 return res.lower()
358 return res.lower()
366 else:
359 else:
367 return "%d." % self._cnt
360 return "%d." % self._cnt
368
361
369 next = __next__
362 next = __next__
370
363
371 def get_width(self):
364 def get_width(self):
372 return self._indent
365 return self._indent
373
366
374 def __repr__(self):
367 def __repr__(self):
375 return 'enum_style-%s' % list(self._style)
368 return 'enum_style-%s' % list(self._style)
376
369
377 if 'enumtype' in node:
370 if 'enumtype' in node:
378 self._list_char.append(enum_char(node['enumtype']))
371 self._list_char.append(enum_char(node['enumtype']))
379 else:
372 else:
380 self._list_char.append(enum_char('bullet'))
373 self._list_char.append(enum_char('bullet'))
381 if len(self._list_char) > 1:
374 if len(self._list_char) > 1:
382 # indent nested lists
375 # indent nested lists
383 self.indent(self._list_char[-2].get_width())
376 self.indent(self._list_char[-2].get_width())
384 else:
377 else:
385 self.indent(self._list_char[-1].get_width())
378 self.indent(self._list_char[-1].get_width())
386
379
387 def list_end(self):
380 def list_end(self):
388 self.dedent()
381 self.dedent()
389 self._list_char.pop()
382 self._list_char.pop()
390
383
391 def header(self):
384 def header(self):
392 tmpl = (
385 tmpl = (
393 ".TH %(title_upper)s %(manual_section)s"
386 ".TH %(title_upper)s %(manual_section)s"
394 " \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n"
387 " \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n"
395 ".SH NAME\n"
388 ".SH NAME\n"
396 "%(title)s \\- %(subtitle)s\n"
389 "%(title)s \\- %(subtitle)s\n"
397 )
390 )
398 return tmpl % self._docinfo
391 return tmpl % self._docinfo
399
392
400 def append_header(self):
393 def append_header(self):
401 """append header with .TH and .SH NAME"""
394 """append header with .TH and .SH NAME"""
402 # NOTE before everything
395 # NOTE before everything
403 # .TH title_upper section date source manual
396 # .TH title_upper section date source manual
404 if self.header_written:
397 if self.header_written:
405 return
398 return
406 self.body.append(self.header())
399 self.body.append(self.header())
407 self.body.append(MACRO_DEF)
400 self.body.append(MACRO_DEF)
408 self.header_written = 1
401 self.header_written = 1
409
402
410 def visit_address(self, node):
403 def visit_address(self, node):
411 self.visit_docinfo_item(node, 'address')
404 self.visit_docinfo_item(node, 'address')
412
405
413 def depart_address(self, node):
406 def depart_address(self, node):
414 pass
407 pass
415
408
416 def visit_admonition(self, node, name=None):
409 def visit_admonition(self, node, name=None):
417 if name:
410 if name:
418 self.body.append('.IP %s\n' % self.language.labels.get(name, name))
411 self.body.append('.IP %s\n' % self.language.labels.get(name, name))
419
412
420 def depart_admonition(self, node):
413 def depart_admonition(self, node):
421 self.body.append('.RE\n')
414 self.body.append('.RE\n')
422
415
423 def visit_attention(self, node):
416 def visit_attention(self, node):
424 self.visit_admonition(node, 'attention')
417 self.visit_admonition(node, 'attention')
425
418
426 depart_attention = depart_admonition
419 depart_attention = depart_admonition
427
420
428 def visit_docinfo_item(self, node, name):
421 def visit_docinfo_item(self, node, name):
429 if name == 'author':
422 if name == 'author':
430 self._docinfo[name].append(node.astext())
423 self._docinfo[name].append(node.astext())
431 else:
424 else:
432 self._docinfo[name] = node.astext()
425 self._docinfo[name] = node.astext()
433 self._docinfo_keys.append(name)
426 self._docinfo_keys.append(name)
434 raise nodes.SkipNode()
427 raise nodes.SkipNode()
435
428
436 def depart_docinfo_item(self, node):
429 def depart_docinfo_item(self, node):
437 pass
430 pass
438
431
439 def visit_author(self, node):
432 def visit_author(self, node):
440 self.visit_docinfo_item(node, 'author')
433 self.visit_docinfo_item(node, 'author')
441
434
442 depart_author = depart_docinfo_item
435 depart_author = depart_docinfo_item
443
436
444 def visit_authors(self, node):
437 def visit_authors(self, node):
445 # _author is called anyway.
438 # _author is called anyway.
446 pass
439 pass
447
440
448 def depart_authors(self, node):
441 def depart_authors(self, node):
449 pass
442 pass
450
443
451 def visit_block_quote(self, node):
444 def visit_block_quote(self, node):
452 # BUG/HACK: indent always uses the _last_ indentation,
445 # BUG/HACK: indent always uses the _last_ indentation,
453 # thus we need two of them.
446 # thus we need two of them.
454 self.indent(BLOCKQOUTE_INDENT)
447 self.indent(BLOCKQOUTE_INDENT)
455 self.indent(0)
448 self.indent(0)
456
449
457 def depart_block_quote(self, node):
450 def depart_block_quote(self, node):
458 self.dedent()
451 self.dedent()
459 self.dedent()
452 self.dedent()
460
453
461 def visit_bullet_list(self, node):
454 def visit_bullet_list(self, node):
462 self.list_start(node)
455 self.list_start(node)
463
456
464 def depart_bullet_list(self, node):
457 def depart_bullet_list(self, node):
465 self.list_end()
458 self.list_end()
466
459
467 def visit_caption(self, node):
460 def visit_caption(self, node):
468 pass
461 pass
469
462
470 def depart_caption(self, node):
463 def depart_caption(self, node):
471 pass
464 pass
472
465
473 def visit_caution(self, node):
466 def visit_caution(self, node):
474 self.visit_admonition(node, 'caution')
467 self.visit_admonition(node, 'caution')
475
468
476 depart_caution = depart_admonition
469 depart_caution = depart_admonition
477
470
478 def visit_citation(self, node):
471 def visit_citation(self, node):
479 num, text = node.astext().split(None, 1)
472 num, text = node.astext().split(None, 1)
480 num = num.strip()
473 num = num.strip()
481 self.body.append('.IP [%s] 5\n' % num)
474 self.body.append('.IP [%s] 5\n' % num)
482
475
483 def depart_citation(self, node):
476 def depart_citation(self, node):
484 pass
477 pass
485
478
486 def visit_citation_reference(self, node):
479 def visit_citation_reference(self, node):
487 self.body.append('[' + node.astext() + ']')
480 self.body.append('[' + node.astext() + ']')
488 raise nodes.SkipNode()
481 raise nodes.SkipNode()
489
482
490 def visit_classifier(self, node):
483 def visit_classifier(self, node):
491 pass
484 pass
492
485
493 def depart_classifier(self, node):
486 def depart_classifier(self, node):
494 pass
487 pass
495
488
496 def visit_colspec(self, node):
489 def visit_colspec(self, node):
497 self.colspecs.append(node)
490 self.colspecs.append(node)
498
491
499 def depart_colspec(self, node):
492 def depart_colspec(self, node):
500 pass
493 pass
501
494
502 def write_colspecs(self):
495 def write_colspecs(self):
503 self.body.append("%s.\n" % ('L ' * len(self.colspecs)))
496 self.body.append("%s.\n" % ('L ' * len(self.colspecs)))
504
497
505 def visit_comment(self, node, sub=re.compile('-(?=-)').sub):
498 def visit_comment(self, node, sub=re.compile('-(?=-)').sub):
506 self.body.append(self.comment(node.astext()))
499 self.body.append(self.comment(node.astext()))
507 raise nodes.SkipNode()
500 raise nodes.SkipNode()
508
501
509 def visit_contact(self, node):
502 def visit_contact(self, node):
510 self.visit_docinfo_item(node, 'contact')
503 self.visit_docinfo_item(node, 'contact')
511
504
512 depart_contact = depart_docinfo_item
505 depart_contact = depart_docinfo_item
513
506
514 def visit_container(self, node):
507 def visit_container(self, node):
515 pass
508 pass
516
509
517 def depart_container(self, node):
510 def depart_container(self, node):
518 pass
511 pass
519
512
520 def visit_compound(self, node):
513 def visit_compound(self, node):
521 pass
514 pass
522
515
523 def depart_compound(self, node):
516 def depart_compound(self, node):
524 pass
517 pass
525
518
526 def visit_copyright(self, node):
519 def visit_copyright(self, node):
527 self.visit_docinfo_item(node, 'copyright')
520 self.visit_docinfo_item(node, 'copyright')
528
521
529 def visit_danger(self, node):
522 def visit_danger(self, node):
530 self.visit_admonition(node, 'danger')
523 self.visit_admonition(node, 'danger')
531
524
532 depart_danger = depart_admonition
525 depart_danger = depart_admonition
533
526
534 def visit_date(self, node):
527 def visit_date(self, node):
535 self.visit_docinfo_item(node, 'date')
528 self.visit_docinfo_item(node, 'date')
536
529
537 def visit_decoration(self, node):
530 def visit_decoration(self, node):
538 pass
531 pass
539
532
540 def depart_decoration(self, node):
533 def depart_decoration(self, node):
541 pass
534 pass
542
535
543 def visit_definition(self, node):
536 def visit_definition(self, node):
544 pass
537 pass
545
538
546 def depart_definition(self, node):
539 def depart_definition(self, node):
547 pass
540 pass
548
541
549 def visit_definition_list(self, node):
542 def visit_definition_list(self, node):
550 self.indent(DEFINITION_LIST_INDENT)
543 self.indent(DEFINITION_LIST_INDENT)
551
544
552 def depart_definition_list(self, node):
545 def depart_definition_list(self, node):
553 self.dedent()
546 self.dedent()
554
547
555 def visit_definition_list_item(self, node):
548 def visit_definition_list_item(self, node):
556 self.body.append(self.defs['definition_list_item'][0])
549 self.body.append(self.defs['definition_list_item'][0])
557
550
558 def depart_definition_list_item(self, node):
551 def depart_definition_list_item(self, node):
559 self.body.append(self.defs['definition_list_item'][1])
552 self.body.append(self.defs['definition_list_item'][1])
560
553
561 def visit_description(self, node):
554 def visit_description(self, node):
562 pass
555 pass
563
556
564 def depart_description(self, node):
557 def depart_description(self, node):
565 pass
558 pass
566
559
567 def visit_docinfo(self, node):
560 def visit_docinfo(self, node):
568 self._in_docinfo = 1
561 self._in_docinfo = 1
569
562
570 def depart_docinfo(self, node):
563 def depart_docinfo(self, node):
571 self._in_docinfo = None
564 self._in_docinfo = None
572 # NOTE nothing should be written before this
565 # NOTE nothing should be written before this
573 self.append_header()
566 self.append_header()
574
567
575 def visit_doctest_block(self, node):
568 def visit_doctest_block(self, node):
576 self.body.append(self.defs['literal_block'][0])
569 self.body.append(self.defs['literal_block'][0])
577 self._in_literal = True
570 self._in_literal = True
578
571
579 def depart_doctest_block(self, node):
572 def depart_doctest_block(self, node):
580 self._in_literal = False
573 self._in_literal = False
581 self.body.append(self.defs['literal_block'][1])
574 self.body.append(self.defs['literal_block'][1])
582
575
583 def visit_document(self, node):
576 def visit_document(self, node):
584 # no blank line between comment and header.
577 # no blank line between comment and header.
585 self.body.append(self.comment(self.document_start).rstrip() + '\n')
578 self.body.append(self.comment(self.document_start).rstrip() + '\n')
586 # writing header is postboned
579 # writing header is postboned
587 self.header_written = 0
580 self.header_written = 0
588
581
589 def depart_document(self, node):
582 def depart_document(self, node):
590 if self._docinfo['author']:
583 if self._docinfo['author']:
591 self.body.append(
584 self.body.append(
592 '.SH AUTHOR\n%s\n' % ', '.join(self._docinfo['author'])
585 '.SH AUTHOR\n%s\n' % ', '.join(self._docinfo['author'])
593 )
586 )
594 skip = (
587 skip = (
595 'author',
588 'author',
596 'copyright',
589 'copyright',
597 'date',
590 'date',
598 'manual_group',
591 'manual_group',
599 'manual_section',
592 'manual_section',
600 'subtitle',
593 'subtitle',
601 'title',
594 'title',
602 'title_upper',
595 'title_upper',
603 'version',
596 'version',
604 )
597 )
605 for name in self._docinfo_keys:
598 for name in self._docinfo_keys:
606 if name == 'address':
599 if name == 'address':
607 self.body.append(
600 self.body.append(
608 "\n%s:\n%s%s.nf\n%s\n.fi\n%s%s"
601 "\n%s:\n%s%s.nf\n%s\n.fi\n%s%s"
609 % (
602 % (
610 self.language.labels.get(name, name),
603 self.language.labels.get(name, name),
611 self.defs['indent'][0] % 0,
604 self.defs['indent'][0] % 0,
612 self.defs['indent'][0] % BLOCKQOUTE_INDENT,
605 self.defs['indent'][0] % BLOCKQOUTE_INDENT,
613 self._docinfo[name],
606 self._docinfo[name],
614 self.defs['indent'][1],
607 self.defs['indent'][1],
615 self.defs['indent'][1],
608 self.defs['indent'][1],
616 )
609 )
617 )
610 )
618 elif name not in skip:
611 elif name not in skip:
619 if name in self._docinfo_names:
612 if name in self._docinfo_names:
620 label = self._docinfo_names[name]
613 label = self._docinfo_names[name]
621 else:
614 else:
622 label = self.language.labels.get(name, name)
615 label = self.language.labels.get(name, name)
623 self.body.append("\n%s: %s\n" % (label, self._docinfo[name]))
616 self.body.append("\n%s: %s\n" % (label, self._docinfo[name]))
624 if self._docinfo['copyright']:
617 if self._docinfo['copyright']:
625 self.body.append('.SH COPYRIGHT\n%s\n' % self._docinfo['copyright'])
618 self.body.append('.SH COPYRIGHT\n%s\n' % self._docinfo['copyright'])
626 self.body.append(
619 self.body.append(
627 self.comment('Generated by docutils manpage writer.\n')
620 self.comment('Generated by docutils manpage writer.\n')
628 )
621 )
629
622
630 def visit_emphasis(self, node):
623 def visit_emphasis(self, node):
631 self.body.append(self.defs['emphasis'][0])
624 self.body.append(self.defs['emphasis'][0])
632
625
633 def depart_emphasis(self, node):
626 def depart_emphasis(self, node):
634 self.body.append(self.defs['emphasis'][1])
627 self.body.append(self.defs['emphasis'][1])
635
628
636 def visit_entry(self, node):
629 def visit_entry(self, node):
637 # a cell in a table row
630 # a cell in a table row
638 if 'morerows' in node:
631 if 'morerows' in node:
639 self.document.reporter.warning(
632 self.document.reporter.warning(
640 '"table row spanning" not supported', base_node=node
633 '"table row spanning" not supported', base_node=node
641 )
634 )
642 if 'morecols' in node:
635 if 'morecols' in node:
643 self.document.reporter.warning(
636 self.document.reporter.warning(
644 '"table cell spanning" not supported', base_node=node
637 '"table cell spanning" not supported', base_node=node
645 )
638 )
646 self.context.append(len(self.body))
639 self.context.append(len(self.body))
647
640
648 def depart_entry(self, node):
641 def depart_entry(self, node):
649 start = self.context.pop()
642 start = self.context.pop()
650 self._active_table.append_cell(self.body[start:])
643 self._active_table.append_cell(self.body[start:])
651 del self.body[start:]
644 del self.body[start:]
652
645
653 def visit_enumerated_list(self, node):
646 def visit_enumerated_list(self, node):
654 self.list_start(node)
647 self.list_start(node)
655
648
656 def depart_enumerated_list(self, node):
649 def depart_enumerated_list(self, node):
657 self.list_end()
650 self.list_end()
658
651
659 def visit_error(self, node):
652 def visit_error(self, node):
660 self.visit_admonition(node, 'error')
653 self.visit_admonition(node, 'error')
661
654
662 depart_error = depart_admonition
655 depart_error = depart_admonition
663
656
664 def visit_field(self, node):
657 def visit_field(self, node):
665 pass
658 pass
666
659
667 def depart_field(self, node):
660 def depart_field(self, node):
668 pass
661 pass
669
662
670 def visit_field_body(self, node):
663 def visit_field_body(self, node):
671 if self._in_docinfo:
664 if self._in_docinfo:
672 name_normalized = self._field_name.lower().replace(" ", "_")
665 name_normalized = self._field_name.lower().replace(" ", "_")
673 self._docinfo_names[name_normalized] = self._field_name
666 self._docinfo_names[name_normalized] = self._field_name
674 self.visit_docinfo_item(node, name_normalized)
667 self.visit_docinfo_item(node, name_normalized)
675 raise nodes.SkipNode()
668 raise nodes.SkipNode()
676
669
677 def depart_field_body(self, node):
670 def depart_field_body(self, node):
678 pass
671 pass
679
672
680 def visit_field_list(self, node):
673 def visit_field_list(self, node):
681 self.indent(FIELD_LIST_INDENT)
674 self.indent(FIELD_LIST_INDENT)
682
675
683 def depart_field_list(self, node):
676 def depart_field_list(self, node):
684 self.dedent()
677 self.dedent()
685
678
686 def visit_field_name(self, node):
679 def visit_field_name(self, node):
687 if self._in_docinfo:
680 if self._in_docinfo:
688 self._field_name = node.astext()
681 self._field_name = node.astext()
689 raise nodes.SkipNode()
682 raise nodes.SkipNode()
690 else:
683 else:
691 self.body.append(self.defs['field_name'][0])
684 self.body.append(self.defs['field_name'][0])
692
685
693 def depart_field_name(self, node):
686 def depart_field_name(self, node):
694 self.body.append(self.defs['field_name'][1])
687 self.body.append(self.defs['field_name'][1])
695
688
696 def visit_figure(self, node):
689 def visit_figure(self, node):
697 self.indent(2.5)
690 self.indent(2.5)
698 self.indent(0)
691 self.indent(0)
699
692
700 def depart_figure(self, node):
693 def depart_figure(self, node):
701 self.dedent()
694 self.dedent()
702 self.dedent()
695 self.dedent()
703
696
704 def visit_footer(self, node):
697 def visit_footer(self, node):
705 self.document.reporter.warning('"footer" not supported', base_node=node)
698 self.document.reporter.warning('"footer" not supported', base_node=node)
706
699
707 def depart_footer(self, node):
700 def depart_footer(self, node):
708 pass
701 pass
709
702
710 def visit_footnote(self, node):
703 def visit_footnote(self, node):
711 num, text = node.astext().split(None, 1)
704 num, text = node.astext().split(None, 1)
712 num = num.strip()
705 num = num.strip()
713 self.body.append('.IP [%s] 5\n' % self.deunicode(num))
706 self.body.append('.IP [%s] 5\n' % self.deunicode(num))
714
707
715 def depart_footnote(self, node):
708 def depart_footnote(self, node):
716 pass
709 pass
717
710
718 def footnote_backrefs(self, node):
711 def footnote_backrefs(self, node):
719 self.document.reporter.warning(
712 self.document.reporter.warning(
720 '"footnote_backrefs" not supported', base_node=node
713 '"footnote_backrefs" not supported', base_node=node
721 )
714 )
722
715
723 def visit_footnote_reference(self, node):
716 def visit_footnote_reference(self, node):
724 self.body.append('[' + self.deunicode(node.astext()) + ']')
717 self.body.append('[' + self.deunicode(node.astext()) + ']')
725 raise nodes.SkipNode()
718 raise nodes.SkipNode()
726
719
727 def depart_footnote_reference(self, node):
720 def depart_footnote_reference(self, node):
728 pass
721 pass
729
722
730 def visit_generated(self, node):
723 def visit_generated(self, node):
731 pass
724 pass
732
725
733 def depart_generated(self, node):
726 def depart_generated(self, node):
734 pass
727 pass
735
728
736 def visit_header(self, node):
729 def visit_header(self, node):
737 raise NotImplementedError(node.astext())
730 raise NotImplementedError(node.astext())
738
731
739 def depart_header(self, node):
732 def depart_header(self, node):
740 pass
733 pass
741
734
742 def visit_hint(self, node):
735 def visit_hint(self, node):
743 self.visit_admonition(node, 'hint')
736 self.visit_admonition(node, 'hint')
744
737
745 depart_hint = depart_admonition
738 depart_hint = depart_admonition
746
739
747 def visit_subscript(self, node):
740 def visit_subscript(self, node):
748 self.body.append('\\s-2\\d')
741 self.body.append('\\s-2\\d')
749
742
750 def depart_subscript(self, node):
743 def depart_subscript(self, node):
751 self.body.append('\\u\\s0')
744 self.body.append('\\u\\s0')
752
745
753 def visit_superscript(self, node):
746 def visit_superscript(self, node):
754 self.body.append('\\s-2\\u')
747 self.body.append('\\s-2\\u')
755
748
756 def depart_superscript(self, node):
749 def depart_superscript(self, node):
757 self.body.append('\\d\\s0')
750 self.body.append('\\d\\s0')
758
751
759 def visit_attribution(self, node):
752 def visit_attribution(self, node):
760 self.body.append('\\(em ')
753 self.body.append('\\(em ')
761
754
762 def depart_attribution(self, node):
755 def depart_attribution(self, node):
763 self.body.append('\n')
756 self.body.append('\n')
764
757
765 def visit_image(self, node):
758 def visit_image(self, node):
766 self.document.reporter.warning('"image" not supported', base_node=node)
759 self.document.reporter.warning('"image" not supported', base_node=node)
767 text = []
760 text = []
768 if 'alt' in node.attributes:
761 if 'alt' in node.attributes:
769 text.append(node.attributes['alt'])
762 text.append(node.attributes['alt'])
770 if 'uri' in node.attributes:
763 if 'uri' in node.attributes:
771 text.append(node.attributes['uri'])
764 text.append(node.attributes['uri'])
772 self.body.append('[image: %s]\n' % ('/'.join(text)))
765 self.body.append('[image: %s]\n' % ('/'.join(text)))
773 raise nodes.SkipNode()
766 raise nodes.SkipNode()
774
767
775 def visit_important(self, node):
768 def visit_important(self, node):
776 self.visit_admonition(node, 'important')
769 self.visit_admonition(node, 'important')
777
770
778 depart_important = depart_admonition
771 depart_important = depart_admonition
779
772
780 def visit_label(self, node):
773 def visit_label(self, node):
781 # footnote and citation
774 # footnote and citation
782 if isinstance(node.parent, nodes.footnote) or isinstance(
775 if isinstance(node.parent, nodes.footnote) or isinstance(
783 node.parent, nodes.citation
776 node.parent, nodes.citation
784 ):
777 ):
785 raise nodes.SkipNode()
778 raise nodes.SkipNode()
786 self.document.reporter.warning('"unsupported "label"', base_node=node)
779 self.document.reporter.warning('"unsupported "label"', base_node=node)
787 self.body.append('[')
780 self.body.append('[')
788
781
789 def depart_label(self, node):
782 def depart_label(self, node):
790 self.body.append(']\n')
783 self.body.append(']\n')
791
784
792 def visit_legend(self, node):
785 def visit_legend(self, node):
793 pass
786 pass
794
787
795 def depart_legend(self, node):
788 def depart_legend(self, node):
796 pass
789 pass
797
790
798 # WHAT should we use .INDENT, .UNINDENT ?
791 # WHAT should we use .INDENT, .UNINDENT ?
799 def visit_line_block(self, node):
792 def visit_line_block(self, node):
800 self._line_block += 1
793 self._line_block += 1
801 if self._line_block == 1:
794 if self._line_block == 1:
802 self.body.append('.sp\n')
795 self.body.append('.sp\n')
803 self.body.append('.nf\n')
796 self.body.append('.nf\n')
804 else:
797 else:
805 self.body.append('.in +2\n')
798 self.body.append('.in +2\n')
806
799
807 def depart_line_block(self, node):
800 def depart_line_block(self, node):
808 self._line_block -= 1
801 self._line_block -= 1
809 if self._line_block == 0:
802 if self._line_block == 0:
810 self.body.append('.fi\n')
803 self.body.append('.fi\n')
811 self.body.append('.sp\n')
804 self.body.append('.sp\n')
812 else:
805 else:
813 self.body.append('.in -2\n')
806 self.body.append('.in -2\n')
814
807
815 def visit_line(self, node):
808 def visit_line(self, node):
816 pass
809 pass
817
810
818 def depart_line(self, node):
811 def depart_line(self, node):
819 self.body.append('\n')
812 self.body.append('\n')
820
813
821 def visit_list_item(self, node):
814 def visit_list_item(self, node):
822 # man 7 man argues to use ".IP" instead of ".TP"
815 # man 7 man argues to use ".IP" instead of ".TP"
823 self.body.append(
816 self.body.append(
824 '.IP %s %d\n'
817 '.IP %s %d\n'
825 % (
818 % (
826 next(self._list_char[-1]),
819 next(self._list_char[-1]),
827 self._list_char[-1].get_width(),
820 self._list_char[-1].get_width(),
828 )
821 )
829 )
822 )
830
823
831 def depart_list_item(self, node):
824 def depart_list_item(self, node):
832 pass
825 pass
833
826
834 def visit_literal(self, node):
827 def visit_literal(self, node):
835 self.body.append(self.defs['literal'][0])
828 self.body.append(self.defs['literal'][0])
836
829
837 def depart_literal(self, node):
830 def depart_literal(self, node):
838 self.body.append(self.defs['literal'][1])
831 self.body.append(self.defs['literal'][1])
839
832
840 def visit_literal_block(self, node):
833 def visit_literal_block(self, node):
841 self.body.append(self.defs['literal_block'][0])
834 self.body.append(self.defs['literal_block'][0])
842 self._in_literal = True
835 self._in_literal = True
843
836
844 def depart_literal_block(self, node):
837 def depart_literal_block(self, node):
845 self._in_literal = False
838 self._in_literal = False
846 self.body.append(self.defs['literal_block'][1])
839 self.body.append(self.defs['literal_block'][1])
847
840
848 def visit_meta(self, node):
841 def visit_meta(self, node):
849 raise NotImplementedError(node.astext())
842 raise NotImplementedError(node.astext())
850
843
851 def depart_meta(self, node):
844 def depart_meta(self, node):
852 pass
845 pass
853
846
854 def visit_note(self, node):
847 def visit_note(self, node):
855 self.visit_admonition(node, 'note')
848 self.visit_admonition(node, 'note')
856
849
857 depart_note = depart_admonition
850 depart_note = depart_admonition
858
851
859 def indent(self, by=0.5):
852 def indent(self, by=0.5):
860 # if we are in a section ".SH" there already is a .RS
853 # if we are in a section ".SH" there already is a .RS
861 step = self._indent[-1]
854 step = self._indent[-1]
862 self._indent.append(by)
855 self._indent.append(by)
863 self.body.append(self.defs['indent'][0] % step)
856 self.body.append(self.defs['indent'][0] % step)
864
857
865 def dedent(self):
858 def dedent(self):
866 self._indent.pop()
859 self._indent.pop()
867 self.body.append(self.defs['indent'][1])
860 self.body.append(self.defs['indent'][1])
868
861
869 def visit_option_list(self, node):
862 def visit_option_list(self, node):
870 self.indent(OPTION_LIST_INDENT)
863 self.indent(OPTION_LIST_INDENT)
871
864
872 def depart_option_list(self, node):
865 def depart_option_list(self, node):
873 self.dedent()
866 self.dedent()
874
867
875 def visit_option_list_item(self, node):
868 def visit_option_list_item(self, node):
876 # one item of the list
869 # one item of the list
877 self.body.append(self.defs['option_list_item'][0])
870 self.body.append(self.defs['option_list_item'][0])
878
871
879 def depart_option_list_item(self, node):
872 def depart_option_list_item(self, node):
880 self.body.append(self.defs['option_list_item'][1])
873 self.body.append(self.defs['option_list_item'][1])
881
874
882 def visit_option_group(self, node):
875 def visit_option_group(self, node):
883 # as one option could have several forms it is a group
876 # as one option could have several forms it is a group
884 # options without parameter bold only, .B, -v
877 # options without parameter bold only, .B, -v
885 # options with parameter bold italic, .BI, -f file
878 # options with parameter bold italic, .BI, -f file
886 #
879 #
887 # we do not know if .B or .BI
880 # we do not know if .B or .BI
888 self.context.append('.B') # blind guess
881 self.context.append('.B') # blind guess
889 self.context.append(len(self.body)) # to be able to insert later
882 self.context.append(len(self.body)) # to be able to insert later
890 self.context.append(0) # option counter
883 self.context.append(0) # option counter
891
884
892 def depart_option_group(self, node):
885 def depart_option_group(self, node):
893 self.context.pop() # the counter
886 self.context.pop() # the counter
894 start_position = self.context.pop()
887 start_position = self.context.pop()
895 text = self.body[start_position:]
888 text = self.body[start_position:]
896 del self.body[start_position:]
889 del self.body[start_position:]
897 self.body.append('%s%s\n' % (self.context.pop(), ''.join(text)))
890 self.body.append('%s%s\n' % (self.context.pop(), ''.join(text)))
898
891
899 def visit_option(self, node):
892 def visit_option(self, node):
900 # each form of the option will be presented separately
893 # each form of the option will be presented separately
901 if self.context[-1] > 0:
894 if self.context[-1] > 0:
902 self.body.append(', ')
895 self.body.append(', ')
903 if self.context[-3] == '.BI':
896 if self.context[-3] == '.BI':
904 self.body.append('\\')
897 self.body.append('\\')
905 self.body.append(' ')
898 self.body.append(' ')
906
899
907 def depart_option(self, node):
900 def depart_option(self, node):
908 self.context[-1] += 1
901 self.context[-1] += 1
909
902
910 def visit_option_string(self, node):
903 def visit_option_string(self, node):
911 # do not know if .B or .BI
904 # do not know if .B or .BI
912 pass
905 pass
913
906
914 def depart_option_string(self, node):
907 def depart_option_string(self, node):
915 pass
908 pass
916
909
917 def visit_option_argument(self, node):
910 def visit_option_argument(self, node):
918 self.context[-3] = '.BI' # bold/italic alternate
911 self.context[-3] = '.BI' # bold/italic alternate
919 if node['delimiter'] != ' ':
912 if node['delimiter'] != ' ':
920 self.body.append('\\fB%s ' % node['delimiter'])
913 self.body.append('\\fB%s ' % node['delimiter'])
921 elif self.body[len(self.body) - 1].endswith('='):
914 elif self.body[len(self.body) - 1].endswith('='):
922 # a blank only means no blank in output, just changing font
915 # a blank only means no blank in output, just changing font
923 self.body.append(' ')
916 self.body.append(' ')
924 else:
917 else:
925 # blank backslash blank, switch font then a blank
918 # blank backslash blank, switch font then a blank
926 self.body.append(' \\ ')
919 self.body.append(' \\ ')
927
920
928 def depart_option_argument(self, node):
921 def depart_option_argument(self, node):
929 pass
922 pass
930
923
931 def visit_organization(self, node):
924 def visit_organization(self, node):
932 self.visit_docinfo_item(node, 'organization')
925 self.visit_docinfo_item(node, 'organization')
933
926
934 def depart_organization(self, node):
927 def depart_organization(self, node):
935 pass
928 pass
936
929
937 def visit_paragraph(self, node):
930 def visit_paragraph(self, node):
938 # ``.PP`` : Start standard indented paragraph.
931 # ``.PP`` : Start standard indented paragraph.
939 # ``.LP`` : Start block paragraph, all except the first.
932 # ``.LP`` : Start block paragraph, all except the first.
940 # ``.P [type]`` : Start paragraph type.
933 # ``.P [type]`` : Start paragraph type.
941 # NOTE don't use paragraph starts because they reset indentation.
934 # NOTE don't use paragraph starts because they reset indentation.
942 # ``.sp`` is only vertical space
935 # ``.sp`` is only vertical space
943 self.ensure_eol()
936 self.ensure_eol()
944 self.body.append('.sp\n')
937 self.body.append('.sp\n')
945
938
946 def depart_paragraph(self, node):
939 def depart_paragraph(self, node):
947 self.body.append('\n')
940 self.body.append('\n')
948
941
949 def visit_problematic(self, node):
942 def visit_problematic(self, node):
950 self.body.append(self.defs['problematic'][0])
943 self.body.append(self.defs['problematic'][0])
951
944
952 def depart_problematic(self, node):
945 def depart_problematic(self, node):
953 self.body.append(self.defs['problematic'][1])
946 self.body.append(self.defs['problematic'][1])
954
947
955 def visit_raw(self, node):
948 def visit_raw(self, node):
956 if node.get('format') == 'manpage':
949 if node.get('format') == 'manpage':
957 self.body.append(node.astext() + "\n")
950 self.body.append(node.astext() + "\n")
958 # Keep non-manpage raw text out of output:
951 # Keep non-manpage raw text out of output:
959 raise nodes.SkipNode()
952 raise nodes.SkipNode()
960
953
961 def visit_reference(self, node):
954 def visit_reference(self, node):
962 """E.g. link or email address."""
955 """E.g. link or email address."""
963 self.body.append(self.defs['reference'][0])
956 self.body.append(self.defs['reference'][0])
964
957
965 def depart_reference(self, node):
958 def depart_reference(self, node):
966 self.body.append(self.defs['reference'][1])
959 self.body.append(self.defs['reference'][1])
967
960
968 def visit_revision(self, node):
961 def visit_revision(self, node):
969 self.visit_docinfo_item(node, 'revision')
962 self.visit_docinfo_item(node, 'revision')
970
963
971 depart_revision = depart_docinfo_item
964 depart_revision = depart_docinfo_item
972
965
973 def visit_row(self, node):
966 def visit_row(self, node):
974 self._active_table.new_row()
967 self._active_table.new_row()
975
968
976 def depart_row(self, node):
969 def depart_row(self, node):
977 pass
970 pass
978
971
979 def visit_section(self, node):
972 def visit_section(self, node):
980 self.section_level += 1
973 self.section_level += 1
981
974
982 def depart_section(self, node):
975 def depart_section(self, node):
983 self.section_level -= 1
976 self.section_level -= 1
984
977
985 def visit_status(self, node):
978 def visit_status(self, node):
986 self.visit_docinfo_item(node, 'status')
979 self.visit_docinfo_item(node, 'status')
987
980
988 depart_status = depart_docinfo_item
981 depart_status = depart_docinfo_item
989
982
990 def visit_strong(self, node):
983 def visit_strong(self, node):
991 self.body.append(self.defs['strong'][0])
984 self.body.append(self.defs['strong'][0])
992
985
993 def depart_strong(self, node):
986 def depart_strong(self, node):
994 self.body.append(self.defs['strong'][1])
987 self.body.append(self.defs['strong'][1])
995
988
996 def visit_substitution_definition(self, node):
989 def visit_substitution_definition(self, node):
997 """Internal only."""
990 """Internal only."""
998 raise nodes.SkipNode()
991 raise nodes.SkipNode()
999
992
1000 def visit_substitution_reference(self, node):
993 def visit_substitution_reference(self, node):
1001 self.document.reporter.warning(
994 self.document.reporter.warning(
1002 '"substitution_reference" not supported', base_node=node
995 '"substitution_reference" not supported', base_node=node
1003 )
996 )
1004
997
1005 def visit_subtitle(self, node):
998 def visit_subtitle(self, node):
1006 if isinstance(node.parent, nodes.sidebar):
999 if isinstance(node.parent, nodes.sidebar):
1007 self.body.append(self.defs['strong'][0])
1000 self.body.append(self.defs['strong'][0])
1008 elif isinstance(node.parent, nodes.document):
1001 elif isinstance(node.parent, nodes.document):
1009 self.visit_docinfo_item(node, 'subtitle')
1002 self.visit_docinfo_item(node, 'subtitle')
1010 elif isinstance(node.parent, nodes.section):
1003 elif isinstance(node.parent, nodes.section):
1011 self.body.append(self.defs['strong'][0])
1004 self.body.append(self.defs['strong'][0])
1012
1005
1013 def depart_subtitle(self, node):
1006 def depart_subtitle(self, node):
1014 # document subtitle calls SkipNode
1007 # document subtitle calls SkipNode
1015 self.body.append(self.defs['strong'][1] + '\n.PP\n')
1008 self.body.append(self.defs['strong'][1] + '\n.PP\n')
1016
1009
1017 def visit_system_message(self, node):
1010 def visit_system_message(self, node):
1018 # TODO add report_level
1011 # TODO add report_level
1019 # if node['level'] < self.document.reporter['writer'].report_level:
1012 # if node['level'] < self.document.reporter['writer'].report_level:
1020 # Level is too low to display:
1013 # Level is too low to display:
1021 # raise nodes.SkipNode
1014 # raise nodes.SkipNode
1022 attr = {}
1015 attr = {}
1023 if node.hasattr('id'):
1016 if node.hasattr('id'):
1024 attr['name'] = node['id']
1017 attr['name'] = node['id']
1025 if node.hasattr('line'):
1018 if node.hasattr('line'):
1026 line = ', line %s' % node['line']
1019 line = ', line %s' % node['line']
1027 else:
1020 else:
1028 line = ''
1021 line = ''
1029 self.body.append(
1022 self.body.append(
1030 '.IP "System Message: %s/%s (%s:%s)"\n'
1023 '.IP "System Message: %s/%s (%s:%s)"\n'
1031 % (node['type'], node['level'], node['source'], line)
1024 % (node['type'], node['level'], node['source'], line)
1032 )
1025 )
1033
1026
1034 def depart_system_message(self, node):
1027 def depart_system_message(self, node):
1035 pass
1028 pass
1036
1029
1037 def visit_table(self, node):
1030 def visit_table(self, node):
1038 self._active_table = Table()
1031 self._active_table = Table()
1039
1032
1040 def depart_table(self, node):
1033 def depart_table(self, node):
1041 self.ensure_eol()
1034 self.ensure_eol()
1042 self.body.extend(self._active_table.as_list())
1035 self.body.extend(self._active_table.as_list())
1043 self._active_table = None
1036 self._active_table = None
1044
1037
1045 def visit_target(self, node):
1038 def visit_target(self, node):
1046 # targets are in-document hyper targets, without any use for man-pages.
1039 # targets are in-document hyper targets, without any use for man-pages.
1047 raise nodes.SkipNode()
1040 raise nodes.SkipNode()
1048
1041
1049 def visit_tbody(self, node):
1042 def visit_tbody(self, node):
1050 pass
1043 pass
1051
1044
1052 def depart_tbody(self, node):
1045 def depart_tbody(self, node):
1053 pass
1046 pass
1054
1047
1055 def visit_term(self, node):
1048 def visit_term(self, node):
1056 self.body.append(self.defs['term'][0])
1049 self.body.append(self.defs['term'][0])
1057
1050
1058 def depart_term(self, node):
1051 def depart_term(self, node):
1059 self.body.append(self.defs['term'][1])
1052 self.body.append(self.defs['term'][1])
1060
1053
1061 def visit_tgroup(self, node):
1054 def visit_tgroup(self, node):
1062 pass
1055 pass
1063
1056
1064 def depart_tgroup(self, node):
1057 def depart_tgroup(self, node):
1065 pass
1058 pass
1066
1059
1067 def visit_thead(self, node):
1060 def visit_thead(self, node):
1068 # MAYBE double line '='
1061 # MAYBE double line '='
1069 pass
1062 pass
1070
1063
1071 def depart_thead(self, node):
1064 def depart_thead(self, node):
1072 # MAYBE double line '='
1065 # MAYBE double line '='
1073 pass
1066 pass
1074
1067
1075 def visit_tip(self, node):
1068 def visit_tip(self, node):
1076 self.visit_admonition(node, 'tip')
1069 self.visit_admonition(node, 'tip')
1077
1070
1078 depart_tip = depart_admonition
1071 depart_tip = depart_admonition
1079
1072
1080 def visit_title(self, node):
1073 def visit_title(self, node):
1081 if isinstance(node.parent, nodes.topic):
1074 if isinstance(node.parent, nodes.topic):
1082 self.body.append(self.defs['topic-title'][0])
1075 self.body.append(self.defs['topic-title'][0])
1083 elif isinstance(node.parent, nodes.sidebar):
1076 elif isinstance(node.parent, nodes.sidebar):
1084 self.body.append(self.defs['sidebar-title'][0])
1077 self.body.append(self.defs['sidebar-title'][0])
1085 elif isinstance(node.parent, nodes.admonition):
1078 elif isinstance(node.parent, nodes.admonition):
1086 self.body.append('.IP "')
1079 self.body.append('.IP "')
1087 elif self.section_level == 0:
1080 elif self.section_level == 0:
1088 self._docinfo['title'] = node.astext()
1081 self._docinfo['title'] = node.astext()
1089 # document title for .TH
1082 # document title for .TH
1090 self._docinfo['title_upper'] = node.astext().upper()
1083 self._docinfo['title_upper'] = node.astext().upper()
1091 raise nodes.SkipNode()
1084 raise nodes.SkipNode()
1092 elif self.section_level == 1:
1085 elif self.section_level == 1:
1093 self.body.append('.SH ')
1086 self.body.append('.SH ')
1094 for n in node.traverse(nodes.Text):
1087 for n in node.traverse(nodes.Text):
1095 n.parent.replace(n, nodes.Text(n.astext().upper()))
1088 n.parent.replace(n, nodes.Text(n.astext().upper()))
1096 else:
1089 else:
1097 self.body.append('.SS ')
1090 self.body.append('.SS ')
1098
1091
1099 def depart_title(self, node):
1092 def depart_title(self, node):
1100 if isinstance(node.parent, nodes.admonition):
1093 if isinstance(node.parent, nodes.admonition):
1101 self.body.append('"')
1094 self.body.append('"')
1102 self.body.append('\n')
1095 self.body.append('\n')
1103
1096
1104 def visit_title_reference(self, node):
1097 def visit_title_reference(self, node):
1105 """inline citation reference"""
1098 """inline citation reference"""
1106 self.body.append(self.defs['title_reference'][0])
1099 self.body.append(self.defs['title_reference'][0])
1107
1100
1108 def depart_title_reference(self, node):
1101 def depart_title_reference(self, node):
1109 self.body.append(self.defs['title_reference'][1])
1102 self.body.append(self.defs['title_reference'][1])
1110
1103
1111 def visit_topic(self, node):
1104 def visit_topic(self, node):
1112 pass
1105 pass
1113
1106
1114 def depart_topic(self, node):
1107 def depart_topic(self, node):
1115 pass
1108 pass
1116
1109
1117 def visit_sidebar(self, node):
1110 def visit_sidebar(self, node):
1118 pass
1111 pass
1119
1112
1120 def depart_sidebar(self, node):
1113 def depart_sidebar(self, node):
1121 pass
1114 pass
1122
1115
1123 def visit_rubric(self, node):
1116 def visit_rubric(self, node):
1124 pass
1117 pass
1125
1118
1126 def depart_rubric(self, node):
1119 def depart_rubric(self, node):
1127 pass
1120 pass
1128
1121
1129 def visit_transition(self, node):
1122 def visit_transition(self, node):
1130 # .PP Begin a new paragraph and reset prevailing indent.
1123 # .PP Begin a new paragraph and reset prevailing indent.
1131 # .sp N leaves N lines of blank space.
1124 # .sp N leaves N lines of blank space.
1132 # .ce centers the next line
1125 # .ce centers the next line
1133 self.body.append('\n.sp\n.ce\n----\n')
1126 self.body.append('\n.sp\n.ce\n----\n')
1134
1127
1135 def depart_transition(self, node):
1128 def depart_transition(self, node):
1136 self.body.append('\n.ce 0\n.sp\n')
1129 self.body.append('\n.ce 0\n.sp\n')
1137
1130
1138 def visit_version(self, node):
1131 def visit_version(self, node):
1139 self.visit_docinfo_item(node, 'version')
1132 self.visit_docinfo_item(node, 'version')
1140
1133
1141 def visit_warning(self, node):
1134 def visit_warning(self, node):
1142 self.visit_admonition(node, 'warning')
1135 self.visit_admonition(node, 'warning')
1143
1136
1144 depart_warning = depart_admonition
1137 depart_warning = depart_admonition
1145
1138
1146 def unimplemented_visit(self, node):
1139 def unimplemented_visit(self, node):
1147 raise NotImplementedError(
1140 raise NotImplementedError(
1148 'visiting unimplemented node type: %s' % node.__class__.__name__
1141 'visiting unimplemented node type: %s' % node.__class__.__name__
1149 )
1142 )
1150
1143
1151
1144
1152 # vim: set fileencoding=utf-8 et ts=4 ai :
1145 # vim: set fileencoding=utf-8 et ts=4 ai :
@@ -1,3210 +1,3208 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``.
516 ``linear``, and ``noconflict``.
517
517
518 - ``abort`` always fails if the working directory has uncommitted changes.
518 - ``abort`` always fails if the working directory has uncommitted changes.
519
519
520 - ``none`` performs no checking, and may result in a merge with uncommitted changes.
520 - ``none`` performs no checking, and may result in a merge with uncommitted changes.
521
521
522 - ``linear`` allows any update as long as it follows a straight line in the
522 - ``linear`` allows any update as long as it follows a straight line in the
523 revision history, and may trigger a merge with uncommitted changes.
523 revision history, and may trigger a merge with uncommitted changes.
524
524
525 - ``noconflict`` will allow any update which would not trigger a merge with
525 - ``noconflict`` will allow any update which would not trigger a merge with
526 uncommitted changes, if any are present.
526 uncommitted changes, if any are present.
527
527
528 (default: ``linear``)
528 (default: ``linear``)
529
529
530 ``update.requiredest``
530 ``update.requiredest``
531 Require that the user pass a destination when running :hg:`update`.
531 Require that the user pass a destination when running :hg:`update`.
532 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
532 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
533 will be disallowed.
533 will be disallowed.
534 (default: False)
534 (default: False)
535
535
536 ``committemplate``
536 ``committemplate``
537 ------------------
537 ------------------
538
538
539 ``changeset``
539 ``changeset``
540 String: configuration in this section is used as the template to
540 String: configuration in this section is used as the template to
541 customize the text shown in the editor when committing.
541 customize the text shown in the editor when committing.
542
542
543 In addition to pre-defined template keywords, commit log specific one
543 In addition to pre-defined template keywords, commit log specific one
544 below can be used for customization:
544 below can be used for customization:
545
545
546 ``extramsg``
546 ``extramsg``
547 String: Extra message (typically 'Leave message empty to abort
547 String: Extra message (typically 'Leave message empty to abort
548 commit.'). This may be changed by some commands or extensions.
548 commit.'). This may be changed by some commands or extensions.
549
549
550 For example, the template configuration below shows as same text as
550 For example, the template configuration below shows as same text as
551 one shown by default::
551 one shown by default::
552
552
553 [committemplate]
553 [committemplate]
554 changeset = {desc}\n\n
554 changeset = {desc}\n\n
555 HG: Enter commit message. Lines beginning with 'HG:' are removed.
555 HG: Enter commit message. Lines beginning with 'HG:' are removed.
556 HG: {extramsg}
556 HG: {extramsg}
557 HG: --
557 HG: --
558 HG: user: {author}\n{ifeq(p2rev, "-1", "",
558 HG: user: {author}\n{ifeq(p2rev, "-1", "",
559 "HG: branch merge\n")
559 "HG: branch merge\n")
560 }HG: branch '{branch}'\n{if(activebookmark,
560 }HG: branch '{branch}'\n{if(activebookmark,
561 "HG: bookmark '{activebookmark}'\n") }{subrepos %
561 "HG: bookmark '{activebookmark}'\n") }{subrepos %
562 "HG: subrepo {subrepo}\n" }{file_adds %
562 "HG: subrepo {subrepo}\n" }{file_adds %
563 "HG: added {file}\n" }{file_mods %
563 "HG: added {file}\n" }{file_mods %
564 "HG: changed {file}\n" }{file_dels %
564 "HG: changed {file}\n" }{file_dels %
565 "HG: removed {file}\n" }{if(files, "",
565 "HG: removed {file}\n" }{if(files, "",
566 "HG: no files changed\n")}
566 "HG: no files changed\n")}
567
567
568 ``diff()``
568 ``diff()``
569 String: show the diff (see :hg:`help templates` for detail)
569 String: show the diff (see :hg:`help templates` for detail)
570
570
571 Sometimes it is helpful to show the diff of the changeset in the editor without
571 Sometimes it is helpful to show the diff of the changeset in the editor without
572 having to prefix 'HG: ' to each line so that highlighting works correctly. For
572 having to prefix 'HG: ' to each line so that highlighting works correctly. For
573 this, Mercurial provides a special string which will ignore everything below
573 this, Mercurial provides a special string which will ignore everything below
574 it::
574 it::
575
575
576 HG: ------------------------ >8 ------------------------
576 HG: ------------------------ >8 ------------------------
577
577
578 For example, the template configuration below will show the diff below the
578 For example, the template configuration below will show the diff below the
579 extra message::
579 extra message::
580
580
581 [committemplate]
581 [committemplate]
582 changeset = {desc}\n\n
582 changeset = {desc}\n\n
583 HG: Enter commit message. Lines beginning with 'HG:' are removed.
583 HG: Enter commit message. Lines beginning with 'HG:' are removed.
584 HG: {extramsg}
584 HG: {extramsg}
585 HG: ------------------------ >8 ------------------------
585 HG: ------------------------ >8 ------------------------
586 HG: Do not touch the line above.
586 HG: Do not touch the line above.
587 HG: Everything below will be removed.
587 HG: Everything below will be removed.
588 {diff()}
588 {diff()}
589
589
590 .. note::
590 .. note::
591
591
592 For some problematic encodings (see :hg:`help win32mbcs` for
592 For some problematic encodings (see :hg:`help win32mbcs` for
593 detail), this customization should be configured carefully, to
593 detail), this customization should be configured carefully, to
594 avoid showing broken characters.
594 avoid showing broken characters.
595
595
596 For example, if a multibyte character ending with backslash (0x5c) is
596 For example, if a multibyte character ending with backslash (0x5c) is
597 followed by the ASCII character 'n' in the customized template,
597 followed by the ASCII character 'n' in the customized template,
598 the sequence of backslash and 'n' is treated as line-feed unexpectedly
598 the sequence of backslash and 'n' is treated as line-feed unexpectedly
599 (and the multibyte character is broken, too).
599 (and the multibyte character is broken, too).
600
600
601 Customized template is used for commands below (``--edit`` may be
601 Customized template is used for commands below (``--edit`` may be
602 required):
602 required):
603
603
604 - :hg:`backout`
604 - :hg:`backout`
605 - :hg:`commit`
605 - :hg:`commit`
606 - :hg:`fetch` (for merge commit only)
606 - :hg:`fetch` (for merge commit only)
607 - :hg:`graft`
607 - :hg:`graft`
608 - :hg:`histedit`
608 - :hg:`histedit`
609 - :hg:`import`
609 - :hg:`import`
610 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
610 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
611 - :hg:`rebase`
611 - :hg:`rebase`
612 - :hg:`shelve`
612 - :hg:`shelve`
613 - :hg:`sign`
613 - :hg:`sign`
614 - :hg:`tag`
614 - :hg:`tag`
615 - :hg:`transplant`
615 - :hg:`transplant`
616
616
617 Configuring items below instead of ``changeset`` allows showing
617 Configuring items below instead of ``changeset`` allows showing
618 customized message only for specific actions, or showing different
618 customized message only for specific actions, or showing different
619 messages for each action.
619 messages for each action.
620
620
621 - ``changeset.backout`` for :hg:`backout`
621 - ``changeset.backout`` for :hg:`backout`
622 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
622 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
623 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
623 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
624 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
624 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
625 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
625 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
626 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
626 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
627 - ``changeset.gpg.sign`` for :hg:`sign`
627 - ``changeset.gpg.sign`` for :hg:`sign`
628 - ``changeset.graft`` for :hg:`graft`
628 - ``changeset.graft`` for :hg:`graft`
629 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
629 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
630 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
630 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
631 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
631 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
632 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
632 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
633 - ``changeset.import.bypass`` for :hg:`import --bypass`
633 - ``changeset.import.bypass`` for :hg:`import --bypass`
634 - ``changeset.import.normal.merge`` for :hg:`import` on merges
634 - ``changeset.import.normal.merge`` for :hg:`import` on merges
635 - ``changeset.import.normal.normal`` for :hg:`import` on other
635 - ``changeset.import.normal.normal`` for :hg:`import` on other
636 - ``changeset.mq.qnew`` for :hg:`qnew`
636 - ``changeset.mq.qnew`` for :hg:`qnew`
637 - ``changeset.mq.qfold`` for :hg:`qfold`
637 - ``changeset.mq.qfold`` for :hg:`qfold`
638 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
638 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
639 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
639 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
640 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
640 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
641 - ``changeset.rebase.normal`` for :hg:`rebase` on other
641 - ``changeset.rebase.normal`` for :hg:`rebase` on other
642 - ``changeset.shelve.shelve`` for :hg:`shelve`
642 - ``changeset.shelve.shelve`` for :hg:`shelve`
643 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
643 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
644 - ``changeset.tag.remove`` for :hg:`tag --remove`
644 - ``changeset.tag.remove`` for :hg:`tag --remove`
645 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
645 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
646 - ``changeset.transplant.normal`` for :hg:`transplant` on other
646 - ``changeset.transplant.normal`` for :hg:`transplant` on other
647
647
648 These dot-separated lists of names are treated as hierarchical ones.
648 These dot-separated lists of names are treated as hierarchical ones.
649 For example, ``changeset.tag.remove`` customizes the commit message
649 For example, ``changeset.tag.remove`` customizes the commit message
650 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
650 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
651 commit message for :hg:`tag` regardless of ``--remove`` option.
651 commit message for :hg:`tag` regardless of ``--remove`` option.
652
652
653 When the external editor is invoked for a commit, the corresponding
653 When the external editor is invoked for a commit, the corresponding
654 dot-separated list of names without the ``changeset.`` prefix
654 dot-separated list of names without the ``changeset.`` prefix
655 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
655 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
656 variable.
656 variable.
657
657
658 In this section, items other than ``changeset`` can be referred from
658 In this section, items other than ``changeset`` can be referred from
659 others. For example, the configuration to list committed files up
659 others. For example, the configuration to list committed files up
660 below can be referred as ``{listupfiles}``::
660 below can be referred as ``{listupfiles}``::
661
661
662 [committemplate]
662 [committemplate]
663 listupfiles = {file_adds %
663 listupfiles = {file_adds %
664 "HG: added {file}\n" }{file_mods %
664 "HG: added {file}\n" }{file_mods %
665 "HG: changed {file}\n" }{file_dels %
665 "HG: changed {file}\n" }{file_dels %
666 "HG: removed {file}\n" }{if(files, "",
666 "HG: removed {file}\n" }{if(files, "",
667 "HG: no files changed\n")}
667 "HG: no files changed\n")}
668
668
669 ``decode/encode``
669 ``decode/encode``
670 -----------------
670 -----------------
671
671
672 Filters for transforming files on checkout/checkin. This would
672 Filters for transforming files on checkout/checkin. This would
673 typically be used for newline processing or other
673 typically be used for newline processing or other
674 localization/canonicalization of files.
674 localization/canonicalization of files.
675
675
676 Filters consist of a filter pattern followed by a filter command.
676 Filters consist of a filter pattern followed by a filter command.
677 Filter patterns are globs by default, rooted at the repository root.
677 Filter patterns are globs by default, rooted at the repository root.
678 For example, to match any file ending in ``.txt`` in the root
678 For example, to match any file ending in ``.txt`` in the root
679 directory only, use the pattern ``*.txt``. To match any file ending
679 directory only, use the pattern ``*.txt``. To match any file ending
680 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
680 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
681 For each file only the first matching filter applies.
681 For each file only the first matching filter applies.
682
682
683 The filter command can start with a specifier, either ``pipe:`` or
683 The filter command can start with a specifier, either ``pipe:`` or
684 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
684 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
685
685
686 A ``pipe:`` command must accept data on stdin and return the transformed
686 A ``pipe:`` command must accept data on stdin and return the transformed
687 data on stdout.
687 data on stdout.
688
688
689 Pipe example::
689 Pipe example::
690
690
691 [encode]
691 [encode]
692 # uncompress gzip files on checkin to improve delta compression
692 # uncompress gzip files on checkin to improve delta compression
693 # note: not necessarily a good idea, just an example
693 # note: not necessarily a good idea, just an example
694 *.gz = pipe: gunzip
694 *.gz = pipe: gunzip
695
695
696 [decode]
696 [decode]
697 # recompress gzip files when writing them to the working dir (we
697 # recompress gzip files when writing them to the working dir (we
698 # can safely omit "pipe:", because it's the default)
698 # can safely omit "pipe:", because it's the default)
699 *.gz = gzip
699 *.gz = gzip
700
700
701 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
701 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
702 with the name of a temporary file that contains the data to be
702 with the name of a temporary file that contains the data to be
703 filtered by the command. The string ``OUTFILE`` is replaced with the name
703 filtered by the command. The string ``OUTFILE`` is replaced with the name
704 of an empty temporary file, where the filtered data must be written by
704 of an empty temporary file, where the filtered data must be written by
705 the command.
705 the command.
706
706
707 .. container:: windows
707 .. container:: windows
708
708
709 .. note::
709 .. note::
710
710
711 The tempfile mechanism is recommended for Windows systems,
711 The tempfile mechanism is recommended for Windows systems,
712 where the standard shell I/O redirection operators often have
712 where the standard shell I/O redirection operators often have
713 strange effects and may corrupt the contents of your files.
713 strange effects and may corrupt the contents of your files.
714
714
715 This filter mechanism is used internally by the ``eol`` extension to
715 This filter mechanism is used internally by the ``eol`` extension to
716 translate line ending characters between Windows (CRLF) and Unix (LF)
716 translate line ending characters between Windows (CRLF) and Unix (LF)
717 format. We suggest you use the ``eol`` extension for convenience.
717 format. We suggest you use the ``eol`` extension for convenience.
718
718
719
719
720 ``defaults``
720 ``defaults``
721 ------------
721 ------------
722
722
723 (defaults are deprecated. Don't use them. Use aliases instead.)
723 (defaults are deprecated. Don't use them. Use aliases instead.)
724
724
725 Use the ``[defaults]`` section to define command defaults, i.e. the
725 Use the ``[defaults]`` section to define command defaults, i.e. the
726 default options/arguments to pass to the specified commands.
726 default options/arguments to pass to the specified commands.
727
727
728 The following example makes :hg:`log` run in verbose mode, and
728 The following example makes :hg:`log` run in verbose mode, and
729 :hg:`status` show only the modified files, by default::
729 :hg:`status` show only the modified files, by default::
730
730
731 [defaults]
731 [defaults]
732 log = -v
732 log = -v
733 status = -m
733 status = -m
734
734
735 The actual commands, instead of their aliases, must be used when
735 The actual commands, instead of their aliases, must be used when
736 defining command defaults. The command defaults will also be applied
736 defining command defaults. The command defaults will also be applied
737 to the aliases of the commands defined.
737 to the aliases of the commands defined.
738
738
739
739
740 ``diff``
740 ``diff``
741 --------
741 --------
742
742
743 Settings used when displaying diffs. Everything except for ``unified``
743 Settings used when displaying diffs. Everything except for ``unified``
744 is a Boolean and defaults to False. See :hg:`help config.annotate`
744 is a Boolean and defaults to False. See :hg:`help config.annotate`
745 for related options for the annotate command.
745 for related options for the annotate command.
746
746
747 ``git``
747 ``git``
748 Use git extended diff format.
748 Use git extended diff format.
749
749
750 ``nobinary``
750 ``nobinary``
751 Omit git binary patches.
751 Omit git binary patches.
752
752
753 ``nodates``
753 ``nodates``
754 Don't include dates in diff headers.
754 Don't include dates in diff headers.
755
755
756 ``noprefix``
756 ``noprefix``
757 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
757 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
758
758
759 ``showfunc``
759 ``showfunc``
760 Show which function each change is in.
760 Show which function each change is in.
761
761
762 ``ignorews``
762 ``ignorews``
763 Ignore white space when comparing lines.
763 Ignore white space when comparing lines.
764
764
765 ``ignorewsamount``
765 ``ignorewsamount``
766 Ignore changes in the amount of white space.
766 Ignore changes in the amount of white space.
767
767
768 ``ignoreblanklines``
768 ``ignoreblanklines``
769 Ignore changes whose lines are all blank.
769 Ignore changes whose lines are all blank.
770
770
771 ``unified``
771 ``unified``
772 Number of lines of context to show.
772 Number of lines of context to show.
773
773
774 ``word-diff``
774 ``word-diff``
775 Highlight changed words.
775 Highlight changed words.
776
776
777 ``email``
777 ``email``
778 ---------
778 ---------
779
779
780 Settings for extensions that send email messages.
780 Settings for extensions that send email messages.
781
781
782 ``from``
782 ``from``
783 Optional. Email address to use in "From" header and SMTP envelope
783 Optional. Email address to use in "From" header and SMTP envelope
784 of outgoing messages.
784 of outgoing messages.
785
785
786 ``to``
786 ``to``
787 Optional. Comma-separated list of recipients' email addresses.
787 Optional. Comma-separated list of recipients' email addresses.
788
788
789 ``cc``
789 ``cc``
790 Optional. Comma-separated list of carbon copy recipients'
790 Optional. Comma-separated list of carbon copy recipients'
791 email addresses.
791 email addresses.
792
792
793 ``bcc``
793 ``bcc``
794 Optional. Comma-separated list of blind carbon copy recipients'
794 Optional. Comma-separated list of blind carbon copy recipients'
795 email addresses.
795 email addresses.
796
796
797 ``method``
797 ``method``
798 Optional. Method to use to send email messages. If value is ``smtp``
798 Optional. Method to use to send email messages. If value is ``smtp``
799 (default), use SMTP (see the ``[smtp]`` section for configuration).
799 (default), use SMTP (see the ``[smtp]`` section for configuration).
800 Otherwise, use as name of program to run that acts like sendmail
800 Otherwise, use as name of program to run that acts like sendmail
801 (takes ``-f`` option for sender, list of recipients on command line,
801 (takes ``-f`` option for sender, list of recipients on command line,
802 message on stdin). Normally, setting this to ``sendmail`` or
802 message on stdin). Normally, setting this to ``sendmail`` or
803 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
803 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
804
804
805 ``charsets``
805 ``charsets``
806 Optional. Comma-separated list of character sets considered
806 Optional. Comma-separated list of character sets considered
807 convenient for recipients. Addresses, headers, and parts not
807 convenient for recipients. Addresses, headers, and parts not
808 containing patches of outgoing messages will be encoded in the
808 containing patches of outgoing messages will be encoded in the
809 first character set to which conversion from local encoding
809 first character set to which conversion from local encoding
810 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
810 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
811 conversion fails, the text in question is sent as is.
811 conversion fails, the text in question is sent as is.
812 (default: '')
812 (default: '')
813
813
814 Order of outgoing email character sets:
814 Order of outgoing email character sets:
815
815
816 1. ``us-ascii``: always first, regardless of settings
816 1. ``us-ascii``: always first, regardless of settings
817 2. ``email.charsets``: in order given by user
817 2. ``email.charsets``: in order given by user
818 3. ``ui.fallbackencoding``: if not in email.charsets
818 3. ``ui.fallbackencoding``: if not in email.charsets
819 4. ``$HGENCODING``: if not in email.charsets
819 4. ``$HGENCODING``: if not in email.charsets
820 5. ``utf-8``: always last, regardless of settings
820 5. ``utf-8``: always last, regardless of settings
821
821
822 Email example::
822 Email example::
823
823
824 [email]
824 [email]
825 from = Joseph User <joe.user@example.com>
825 from = Joseph User <joe.user@example.com>
826 method = /usr/sbin/sendmail
826 method = /usr/sbin/sendmail
827 # charsets for western Europeans
827 # charsets for western Europeans
828 # us-ascii, utf-8 omitted, as they are tried first and last
828 # us-ascii, utf-8 omitted, as they are tried first and last
829 charsets = iso-8859-1, iso-8859-15, windows-1252
829 charsets = iso-8859-1, iso-8859-15, windows-1252
830
830
831
831
832 ``extensions``
832 ``extensions``
833 --------------
833 --------------
834
834
835 Mercurial has an extension mechanism for adding new features. To
835 Mercurial has an extension mechanism for adding new features. To
836 enable an extension, create an entry for it in this section.
836 enable an extension, create an entry for it in this section.
837
837
838 If you know that the extension is already in Python's search path,
838 If you know that the extension is already in Python's search path,
839 you can give the name of the module, followed by ``=``, with nothing
839 you can give the name of the module, followed by ``=``, with nothing
840 after the ``=``.
840 after the ``=``.
841
841
842 Otherwise, give a name that you choose, followed by ``=``, followed by
842 Otherwise, give a name that you choose, followed by ``=``, followed by
843 the path to the ``.py`` file (including the file name extension) that
843 the path to the ``.py`` file (including the file name extension) that
844 defines the extension.
844 defines the extension.
845
845
846 To explicitly disable an extension that is enabled in an hgrc of
846 To explicitly disable an extension that is enabled in an hgrc of
847 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
847 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
848 or ``foo = !`` when path is not supplied.
848 or ``foo = !`` when path is not supplied.
849
849
850 Example for ``~/.hgrc``::
850 Example for ``~/.hgrc``::
851
851
852 [extensions]
852 [extensions]
853 # (the churn extension will get loaded from Mercurial's path)
853 # (the churn extension will get loaded from Mercurial's path)
854 churn =
854 churn =
855 # (this extension will get loaded from the file specified)
855 # (this extension will get loaded from the file specified)
856 myfeature = ~/.hgext/myfeature.py
856 myfeature = ~/.hgext/myfeature.py
857
857
858 If an extension fails to load, a warning will be issued, and Mercurial will
858 If an extension fails to load, a warning will be issued, and Mercurial will
859 proceed. To enforce that an extension must be loaded, one can set the `required`
859 proceed. To enforce that an extension must be loaded, one can set the `required`
860 suboption in the config::
860 suboption in the config::
861
861
862 [extensions]
862 [extensions]
863 myfeature = ~/.hgext/myfeature.py
863 myfeature = ~/.hgext/myfeature.py
864 myfeature:required = yes
864 myfeature:required = yes
865
865
866 To debug extension loading issue, one can add `--traceback` to their mercurial
866 To debug extension loading issue, one can add `--traceback` to their mercurial
867 invocation.
867 invocation.
868
868
869 A default setting can we set using the special `*` extension key::
869 A default setting can we set using the special `*` extension key::
870
870
871 [extensions]
871 [extensions]
872 *:required = yes
872 *:required = yes
873 myfeature = ~/.hgext/myfeature.py
873 myfeature = ~/.hgext/myfeature.py
874 rebase=
874 rebase=
875
875
876
876
877 ``format``
877 ``format``
878 ----------
878 ----------
879
879
880 Configuration that controls the repository format. Newer format options are more
880 Configuration that controls the repository format. Newer format options are more
881 powerful, but incompatible with some older versions of Mercurial. Format options
881 powerful, but incompatible with some older versions of Mercurial. Format options
882 are considered at repository initialization only. You need to make a new clone
882 are considered at repository initialization only. You need to make a new clone
883 for config changes to be taken into account.
883 for config changes to be taken into account.
884
884
885 For more details about repository format and version compatibility, see
885 For more details about repository format and version compatibility, see
886 https://www.mercurial-scm.org/wiki/MissingRequirement
886 https://www.mercurial-scm.org/wiki/MissingRequirement
887
887
888 ``usegeneraldelta``
888 ``usegeneraldelta``
889 Enable or disable the "generaldelta" repository format which improves
889 Enable or disable the "generaldelta" repository format which improves
890 repository compression by allowing "revlog" to store deltas against
890 repository compression by allowing "revlog" to store deltas against
891 arbitrary revisions instead of the previously stored one. This provides
891 arbitrary revisions instead of the previously stored one. This provides
892 significant improvement for repositories with branches.
892 significant improvement for repositories with branches.
893
893
894 Repositories with this on-disk format require Mercurial version 1.9.
894 Repositories with this on-disk format require Mercurial version 1.9.
895
895
896 Enabled by default.
896 Enabled by default.
897
897
898 ``dotencode``
898 ``dotencode``
899 Enable or disable the "dotencode" repository format which enhances
899 Enable or disable the "dotencode" repository format which enhances
900 the "fncache" repository format (which has to be enabled to use
900 the "fncache" repository format (which has to be enabled to use
901 dotencode) to avoid issues with filenames starting with "._" on
901 dotencode) to avoid issues with filenames starting with "._" on
902 Mac OS X and spaces on Windows.
902 Mac OS X and spaces on Windows.
903
903
904 Repositories with this on-disk format require Mercurial version 1.7.
904 Repositories with this on-disk format require Mercurial version 1.7.
905
905
906 Enabled by default.
906 Enabled by default.
907
907
908 ``usefncache``
908 ``usefncache``
909 Enable or disable the "fncache" repository format which enhances
909 Enable or disable the "fncache" repository format which enhances
910 the "store" repository format (which has to be enabled to use
910 the "store" repository format (which has to be enabled to use
911 fncache) to allow longer filenames and avoids using Windows
911 fncache) to allow longer filenames and avoids using Windows
912 reserved names, e.g. "nul".
912 reserved names, e.g. "nul".
913
913
914 Repositories with this on-disk format require Mercurial version 1.1.
914 Repositories with this on-disk format require Mercurial version 1.1.
915
915
916 Enabled by default.
916 Enabled by default.
917
917
918 ``use-dirstate-v2``
918 ``use-dirstate-v2``
919 Enable or disable the experimental "dirstate-v2" feature. The dirstate
919 Enable or disable the experimental "dirstate-v2" feature. The dirstate
920 functionality is shared by all commands interacting with the working copy.
920 functionality is shared by all commands interacting with the working copy.
921 The new version is more robust, faster and stores more information.
921 The new version is more robust, faster and stores more information.
922
922
923 The performance-improving version of this feature is currently only
923 The performance-improving version of this feature is currently only
924 implemented in Rust (see :hg:`help rust`), so people not using a version of
924 implemented in Rust (see :hg:`help rust`), so people not using a version of
925 Mercurial compiled with the Rust parts might actually suffer some slowdown.
925 Mercurial compiled with the Rust parts might actually suffer some slowdown.
926 For this reason, such versions will by default refuse to access repositories
926 For this reason, such versions will by default refuse to access repositories
927 with "dirstate-v2" enabled.
927 with "dirstate-v2" enabled.
928
928
929 This behavior can be adjusted via configuration: check
929 This behavior can be adjusted via configuration: check
930 :hg:`help config.storage.dirstate-v2.slow-path` for details.
930 :hg:`help config.storage.dirstate-v2.slow-path` for details.
931
931
932 Repositories with this on-disk format require Mercurial 6.0 or above.
932 Repositories with this on-disk format require Mercurial 6.0 or above.
933
933
934 By default this format variant is disabled if the fast implementation is not
934 By default this format variant is disabled if the fast implementation is not
935 available, and enabled by default if the fast implementation is available.
935 available, and enabled by default if the fast implementation is available.
936
936
937 To accomodate installations of Mercurial without the fast implementation,
937 To accomodate installations of Mercurial without the fast implementation,
938 you can downgrade your repository. To do so run the following command:
938 you can downgrade your repository. To do so run the following command:
939
939
940 $ hg debugupgraderepo \
940 $ hg debugupgraderepo \
941 --run \
941 --run \
942 --config format.use-dirstate-v2=False \
942 --config format.use-dirstate-v2=False \
943 --config storage.dirstate-v2.slow-path=allow
943 --config storage.dirstate-v2.slow-path=allow
944
944
945 For a more comprehensive guide, see :hg:`help internals.dirstate-v2`.
945 For a more comprehensive guide, see :hg:`help internals.dirstate-v2`.
946
946
947 ``exp-dirstate-tracked-key-version``
947 ``exp-dirstate-tracked-key-version``
948 Enable or disable the writing of "tracked key" file alongside the dirstate.
948 Enable or disable the writing of "tracked key" file alongside the dirstate.
949
949
950 That "tracked-key" can help external automations to detect changes to the
950 That "tracked-key" can help external automations to detect changes to the
951 set of tracked files.
951 set of tracked files.
952
952
953 Two values are currently supported:
953 Two values are currently supported:
954 - 0: no file is written (the default),
954 - 0: no file is written (the default),
955 - 1: a file in version "1" is written.
955 - 1: a file in version "1" is written.
956
956
957 The tracked-key is written in a new `.hg/dirstate-tracked-key`. That file
957 The tracked-key is written in a new `.hg/dirstate-tracked-key`. That file
958 contains two lines:
958 contains two lines:
959 - the first line is the file version (currently: 1),
959 - the first line is the file version (currently: 1),
960 - the second line contains the "tracked-key".
960 - the second line contains the "tracked-key".
961
961
962 The tracked-key changes whenever the set of file tracked in the dirstate
962 The tracked-key changes whenever the set of file tracked in the dirstate
963 changes. The general guarantees are:
963 changes. The general guarantees are:
964 - if the tracked key is identical, the set of tracked file MUST not have changed,
964 - if the tracked key is identical, the set of tracked file MUST not have changed,
965 - if the tracked key is different, the set of tracked file MIGHT differ.
965 - if the tracked key is different, the set of tracked file MIGHT differ.
966
966
967 They are two "ways" to use this feature:
967 They are two "ways" to use this feature:
968
968
969 1) monitoring changes to the `.hg/dirstate-tracked-key`, if the file changes
969 1) monitoring changes to the `.hg/dirstate-tracked-key`, if the file changes
970 the tracked set might have changed.
970 the tracked set might have changed.
971
971
972 2) storing the value and comparing it to a later value. Beware that it is
972 2) storing the value and comparing it to a later value. Beware that it is
973 impossible to achieve atomic writing or reading of the two files involved
973 impossible to achieve atomic writing or reading of the two files involved
974 files (`.hg/dirstate` and `.hg/dirstate-tracked-key`). So it is needed to
974 files (`.hg/dirstate` and `.hg/dirstate-tracked-key`). So it is needed to
975 read the `tracked-key` files twice: before and after reading the tracked
975 read the `tracked-key` files twice: before and after reading the tracked
976 set. The `tracked-key` is only usable as a cache key if it had the same
976 set. The `tracked-key` is only usable as a cache key if it had the same
977 value in both cases and must be discarded otherwise.
977 value in both cases and must be discarded otherwise.
978
978
979 To enforce that the `tracked-key` value can be used race-free (with double
979 To enforce that the `tracked-key` value can be used race-free (with double
980 reading as explained in (2)), the `.hg/dirstate-tracked-key` is written
980 reading as explained in (2)), the `.hg/dirstate-tracked-key` is written
981 twice: before and after we change the associated `.hg/dirstate` file.
981 twice: before and after we change the associated `.hg/dirstate` file.
982
982
983 ``use-persistent-nodemap``
983 ``use-persistent-nodemap``
984 Enable or disable the "persistent-nodemap" feature which improves
984 Enable or disable the "persistent-nodemap" feature which improves
985 performance if the Rust extensions are available.
985 performance if the Rust extensions are available.
986
986
987 The "persistent-nodemap" persist the "node -> rev" on disk removing the
987 The "persistent-nodemap" persist the "node -> rev" on disk removing the
988 need to dynamically build that mapping for each Mercurial invocation. This
988 need to dynamically build that mapping for each Mercurial invocation. This
989 significantly reduces the startup cost of various local and server-side
989 significantly reduces the startup cost of various local and server-side
990 operation for larger repositories.
990 operation for larger repositories.
991
991
992 The performance-improving version of this feature is currently only
992 The performance-improving version of this feature is currently only
993 implemented in Rust (see :hg:`help rust`), so people not using a version of
993 implemented in Rust (see :hg:`help rust`), so people not using a version of
994 Mercurial compiled with the Rust parts might actually suffer some slowdown.
994 Mercurial compiled with the Rust parts might actually suffer some slowdown.
995 For this reason, such versions will by default refuse to access repositories
995 For this reason, such versions will by default refuse to access repositories
996 with "persistent-nodemap".
996 with "persistent-nodemap".
997
997
998 This behavior can be adjusted via configuration: check
998 This behavior can be adjusted via configuration: check
999 :hg:`help config.storage.revlog.persistent-nodemap.slow-path` for details.
999 :hg:`help config.storage.revlog.persistent-nodemap.slow-path` for details.
1000
1000
1001 Repositories with this on-disk format require Mercurial 5.4 or above.
1001 Repositories with this on-disk format require Mercurial 5.4 or above.
1002
1002
1003 By default this format variant is disabled if the fast implementation is not
1003 By default this format variant is disabled if the fast implementation is not
1004 available, and enabled by default if the fast implementation is available.
1004 available, and enabled by default if the fast implementation is available.
1005
1005
1006 To accomodate installations of Mercurial without the fast implementation,
1006 To accomodate installations of Mercurial without the fast implementation,
1007 you can downgrade your repository. To do so run the following command:
1007 you can downgrade your repository. To do so run the following command:
1008
1008
1009 $ hg debugupgraderepo \
1009 $ hg debugupgraderepo \
1010 --run \
1010 --run \
1011 --config format.use-persistent-nodemap=False \
1011 --config format.use-persistent-nodemap=False \
1012 --config storage.revlog.persistent-nodemap.slow-path=allow
1012 --config storage.revlog.persistent-nodemap.slow-path=allow
1013
1013
1014 ``use-share-safe``
1014 ``use-share-safe``
1015 Enforce "safe" behaviors for all "shares" that access this repository.
1015 Enforce "safe" behaviors for all "shares" that access this repository.
1016
1016
1017 With this feature, "shares" using this repository as a source will:
1017 With this feature, "shares" using this repository as a source will:
1018
1018
1019 * read the source repository's configuration (`<source>/.hg/hgrc`).
1019 * read the source repository's configuration (`<source>/.hg/hgrc`).
1020 * read and use the source repository's "requirements"
1020 * read and use the source repository's "requirements"
1021 (except the working copy specific one).
1021 (except the working copy specific one).
1022
1022
1023 Without this feature, "shares" using this repository as a source will:
1023 Without this feature, "shares" using this repository as a source will:
1024
1024
1025 * keep tracking the repository "requirements" in the share only, ignoring
1025 * keep tracking the repository "requirements" in the share only, ignoring
1026 the source "requirements", possibly diverging from them.
1026 the source "requirements", possibly diverging from them.
1027 * ignore source repository config. This can create problems, like silently
1027 * ignore source repository config. This can create problems, like silently
1028 ignoring important hooks.
1028 ignoring important hooks.
1029
1029
1030 Beware that existing shares will not be upgraded/downgraded, and by
1030 Beware that existing shares will not be upgraded/downgraded, and by
1031 default, Mercurial will refuse to interact with them until the mismatch
1031 default, Mercurial will refuse to interact with them until the mismatch
1032 is resolved. See :hg:`help config share.safe-mismatch.source-safe` and
1032 is resolved. See :hg:`help config.share.safe-mismatch.source-safe` and
1033 :hg:`help config share.safe-mismatch.source-not-safe` for details.
1033 :hg:`help config.share.safe-mismatch.source-not-safe` for details.
1034
1034
1035 Introduced in Mercurial 5.7.
1035 Introduced in Mercurial 5.7.
1036
1036
1037 Enabled by default in Mercurial 6.1.
1037 Enabled by default in Mercurial 6.1.
1038
1038
1039 ``usestore``
1039 ``usestore``
1040 Enable or disable the "store" repository format which improves
1040 Enable or disable the "store" repository format which improves
1041 compatibility with systems that fold case or otherwise mangle
1041 compatibility with systems that fold case or otherwise mangle
1042 filenames. Disabling this option will allow you to store longer filenames
1042 filenames. Disabling this option will allow you to store longer filenames
1043 in some situations at the expense of compatibility.
1043 in some situations at the expense of compatibility.
1044
1044
1045 Repositories with this on-disk format require Mercurial version 0.9.4.
1045 Repositories with this on-disk format require Mercurial version 0.9.4.
1046
1046
1047 Enabled by default.
1047 Enabled by default.
1048
1048
1049 ``sparse-revlog``
1049 ``sparse-revlog``
1050 Enable or disable the ``sparse-revlog`` delta strategy. This format improves
1050 Enable or disable the ``sparse-revlog`` delta strategy. This format improves
1051 delta re-use inside revlog. For very branchy repositories, it results in a
1051 delta re-use inside revlog. For very branchy repositories, it results in a
1052 smaller store. For repositories with many revisions, it also helps
1052 smaller store. For repositories with many revisions, it also helps
1053 performance (by using shortened delta chains.)
1053 performance (by using shortened delta chains.)
1054
1054
1055 Repositories with this on-disk format require Mercurial version 4.7
1055 Repositories with this on-disk format require Mercurial version 4.7
1056
1056
1057 Enabled by default.
1057 Enabled by default.
1058
1058
1059 ``revlog-compression``
1059 ``revlog-compression``
1060 Compression algorithm used by revlog. Supported values are `zlib` and
1060 Compression algorithm used by revlog. Supported values are `zlib` and
1061 `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is
1061 `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is
1062 a newer format that is usually a net win over `zlib`, operating faster at
1062 a newer format that is usually a net win over `zlib`, operating faster at
1063 better compression rates. Use `zstd` to reduce CPU usage. Multiple values
1063 better compression rates. Use `zstd` to reduce CPU usage. Multiple values
1064 can be specified, the first available one will be used.
1064 can be specified, the first available one will be used.
1065
1065
1066 On some systems, the Mercurial installation may lack `zstd` support.
1066 On some systems, the Mercurial installation may lack `zstd` support.
1067
1067
1068 Default is `zstd` if available, `zlib` otherwise.
1068 Default is `zstd` if available, `zlib` otherwise.
1069
1069
1070 ``bookmarks-in-store``
1070 ``bookmarks-in-store``
1071 Store bookmarks in .hg/store/. This means that bookmarks are shared when
1071 Store bookmarks in .hg/store/. This means that bookmarks are shared when
1072 using `hg share` regardless of the `-B` option.
1072 using `hg share` regardless of the `-B` option.
1073
1073
1074 Repositories with this on-disk format require Mercurial version 5.1.
1074 Repositories with this on-disk format require Mercurial version 5.1.
1075
1075
1076 Disabled by default.
1076 Disabled by default.
1077
1077
1078
1078
1079 ``graph``
1079 ``graph``
1080 ---------
1080 ---------
1081
1081
1082 Web graph view configuration. This section let you change graph
1082 Web graph view configuration. This section let you change graph
1083 elements display properties by branches, for instance to make the
1083 elements display properties by branches, for instance to make the
1084 ``default`` branch stand out.
1084 ``default`` branch stand out.
1085
1085
1086 Each line has the following format::
1086 Each line has the following format::
1087
1087
1088 <branch>.<argument> = <value>
1088 <branch>.<argument> = <value>
1089
1089
1090 where ``<branch>`` is the name of the branch being
1090 where ``<branch>`` is the name of the branch being
1091 customized. Example::
1091 customized. Example::
1092
1092
1093 [graph]
1093 [graph]
1094 # 2px width
1094 # 2px width
1095 default.width = 2
1095 default.width = 2
1096 # red color
1096 # red color
1097 default.color = FF0000
1097 default.color = FF0000
1098
1098
1099 Supported arguments:
1099 Supported arguments:
1100
1100
1101 ``width``
1101 ``width``
1102 Set branch edges width in pixels.
1102 Set branch edges width in pixels.
1103
1103
1104 ``color``
1104 ``color``
1105 Set branch edges color in hexadecimal RGB notation.
1105 Set branch edges color in hexadecimal RGB notation.
1106
1106
1107 ``hooks``
1107 ``hooks``
1108 ---------
1108 ---------
1109
1109
1110 Commands or Python functions that get automatically executed by
1110 Commands or Python functions that get automatically executed by
1111 various actions such as starting or finishing a commit. Multiple
1111 various actions such as starting or finishing a commit. Multiple
1112 hooks can be run for the same action by appending a suffix to the
1112 hooks can be run for the same action by appending a suffix to the
1113 action. Overriding a site-wide hook can be done by changing its
1113 action. Overriding a site-wide hook can be done by changing its
1114 value or setting it to an empty string. Hooks can be prioritized
1114 value or setting it to an empty string. Hooks can be prioritized
1115 by adding a prefix of ``priority.`` to the hook name on a new line
1115 by adding a prefix of ``priority.`` to the hook name on a new line
1116 and setting the priority. The default priority is 0.
1116 and setting the priority. The default priority is 0.
1117
1117
1118 Example ``.hg/hgrc``::
1118 Example ``.hg/hgrc``::
1119
1119
1120 [hooks]
1120 [hooks]
1121 # update working directory after adding changesets
1121 # update working directory after adding changesets
1122 changegroup.update = hg update
1122 changegroup.update = hg update
1123 # do not use the site-wide hook
1123 # do not use the site-wide hook
1124 incoming =
1124 incoming =
1125 incoming.email = /my/email/hook
1125 incoming.email = /my/email/hook
1126 incoming.autobuild = /my/build/hook
1126 incoming.autobuild = /my/build/hook
1127 # force autobuild hook to run before other incoming hooks
1127 # force autobuild hook to run before other incoming hooks
1128 priority.incoming.autobuild = 1
1128 priority.incoming.autobuild = 1
1129 ### control HGPLAIN setting when running autobuild hook
1129 ### control HGPLAIN setting when running autobuild hook
1130 # HGPLAIN always set (default from Mercurial 5.7)
1130 # HGPLAIN always set (default from Mercurial 5.7)
1131 incoming.autobuild:run-with-plain = yes
1131 incoming.autobuild:run-with-plain = yes
1132 # HGPLAIN never set
1132 # HGPLAIN never set
1133 incoming.autobuild:run-with-plain = no
1133 incoming.autobuild:run-with-plain = no
1134 # HGPLAIN inherited from environment (default before Mercurial 5.7)
1134 # HGPLAIN inherited from environment (default before Mercurial 5.7)
1135 incoming.autobuild:run-with-plain = auto
1135 incoming.autobuild:run-with-plain = auto
1136
1136
1137 Most hooks are run with environment variables set that give useful
1137 Most hooks are run with environment variables set that give useful
1138 additional information. For each hook below, the environment variables
1138 additional information. For each hook below, the environment variables
1139 it is passed are listed with names in the form ``$HG_foo``. The
1139 it is passed are listed with names in the form ``$HG_foo``. The
1140 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
1140 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
1141 They contain the type of hook which triggered the run and the full name
1141 They contain the type of hook which triggered the run and the full name
1142 of the hook in the config, respectively. In the example above, this will
1142 of the hook in the config, respectively. In the example above, this will
1143 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
1143 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
1144
1144
1145 .. container:: windows
1145 .. container:: windows
1146
1146
1147 Some basic Unix syntax can be enabled for portability, including ``$VAR``
1147 Some basic Unix syntax can be enabled for portability, including ``$VAR``
1148 and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will
1148 and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will
1149 be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion
1149 be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion
1150 on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back
1150 on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back
1151 slash or inside of a strong quote. Strong quotes will be replaced by
1151 slash or inside of a strong quote. Strong quotes will be replaced by
1152 double quotes after processing.
1152 double quotes after processing.
1153
1153
1154 This feature is enabled by adding a prefix of ``tonative.`` to the hook
1154 This feature is enabled by adding a prefix of ``tonative.`` to the hook
1155 name on a new line, and setting it to ``True``. For example::
1155 name on a new line, and setting it to ``True``. For example::
1156
1156
1157 [hooks]
1157 [hooks]
1158 incoming.autobuild = /my/build/hook
1158 incoming.autobuild = /my/build/hook
1159 # enable translation to cmd.exe syntax for autobuild hook
1159 # enable translation to cmd.exe syntax for autobuild hook
1160 tonative.incoming.autobuild = True
1160 tonative.incoming.autobuild = True
1161
1161
1162 ``changegroup``
1162 ``changegroup``
1163 Run after a changegroup has been added via push, pull or unbundle. The ID of
1163 Run after a changegroup has been added via push, pull or unbundle. The ID of
1164 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
1164 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
1165 The URL from which changes came is in ``$HG_URL``.
1165 The URL from which changes came is in ``$HG_URL``.
1166
1166
1167 ``commit``
1167 ``commit``
1168 Run after a changeset has been created in the local repository. The ID
1168 Run after a changeset has been created in the local repository. The ID
1169 of the newly created changeset is in ``$HG_NODE``. Parent changeset
1169 of the newly created changeset is in ``$HG_NODE``. Parent changeset
1170 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1170 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1171
1171
1172 ``incoming``
1172 ``incoming``
1173 Run after a changeset has been pulled, pushed, or unbundled into
1173 Run after a changeset has been pulled, pushed, or unbundled into
1174 the local repository. The ID of the newly arrived changeset is in
1174 the local repository. The ID of the newly arrived changeset is in
1175 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
1175 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
1176
1176
1177 ``outgoing``
1177 ``outgoing``
1178 Run after sending changes from the local repository to another. The ID of
1178 Run after sending changes from the local repository to another. The ID of
1179 first changeset sent is in ``$HG_NODE``. The source of operation is in
1179 first changeset sent is in ``$HG_NODE``. The source of operation is in
1180 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
1180 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
1181
1181
1182 ``post-<command>``
1182 ``post-<command>``
1183 Run after successful invocations of the associated command. The
1183 Run after successful invocations of the associated command. The
1184 contents of the command line are passed as ``$HG_ARGS`` and the result
1184 contents of the command line are passed as ``$HG_ARGS`` and the result
1185 code in ``$HG_RESULT``. Parsed command line arguments are passed as
1185 code in ``$HG_RESULT``. Parsed command line arguments are passed as
1186 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
1186 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
1187 the python data internally passed to <command>. ``$HG_OPTS`` is a
1187 the python data internally passed to <command>. ``$HG_OPTS`` is a
1188 dictionary of options (with unspecified options set to their defaults).
1188 dictionary of options (with unspecified options set to their defaults).
1189 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
1189 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
1190
1190
1191 ``fail-<command>``
1191 ``fail-<command>``
1192 Run after a failed invocation of an associated command. The contents
1192 Run after a failed invocation of an associated command. The contents
1193 of the command line are passed as ``$HG_ARGS``. Parsed command line
1193 of the command line are passed as ``$HG_ARGS``. Parsed command line
1194 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
1194 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
1195 string representations of the python data internally passed to
1195 string representations of the python data internally passed to
1196 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
1196 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
1197 options set to their defaults). ``$HG_PATS`` is a list of arguments.
1197 options set to their defaults). ``$HG_PATS`` is a list of arguments.
1198 Hook failure is ignored.
1198 Hook failure is ignored.
1199
1199
1200 ``pre-<command>``
1200 ``pre-<command>``
1201 Run before executing the associated command. The contents of the
1201 Run before executing the associated command. The contents of the
1202 command line are passed as ``$HG_ARGS``. Parsed command line arguments
1202 command line are passed as ``$HG_ARGS``. Parsed command line arguments
1203 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
1203 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
1204 representations of the data internally passed to <command>. ``$HG_OPTS``
1204 representations of the data internally passed to <command>. ``$HG_OPTS``
1205 is a dictionary of options (with unspecified options set to their
1205 is a dictionary of options (with unspecified options set to their
1206 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
1206 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
1207 failure, the command doesn't execute and Mercurial returns the failure
1207 failure, the command doesn't execute and Mercurial returns the failure
1208 code.
1208 code.
1209
1209
1210 ``prechangegroup``
1210 ``prechangegroup``
1211 Run before a changegroup is added via push, pull or unbundle. Exit
1211 Run before a changegroup is added via push, pull or unbundle. Exit
1212 status 0 allows the changegroup to proceed. A non-zero status will
1212 status 0 allows the changegroup to proceed. A non-zero status will
1213 cause the push, pull or unbundle to fail. The URL from which changes
1213 cause the push, pull or unbundle to fail. The URL from which changes
1214 will come is in ``$HG_URL``.
1214 will come is in ``$HG_URL``.
1215
1215
1216 ``precommit``
1216 ``precommit``
1217 Run before starting a local commit. Exit status 0 allows the
1217 Run before starting a local commit. Exit status 0 allows the
1218 commit to proceed. A non-zero status will cause the commit to fail.
1218 commit to proceed. A non-zero status will cause the commit to fail.
1219 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1219 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1220
1220
1221 ``prelistkeys``
1221 ``prelistkeys``
1222 Run before listing pushkeys (like bookmarks) in the
1222 Run before listing pushkeys (like bookmarks) in the
1223 repository. A non-zero status will cause failure. The key namespace is
1223 repository. A non-zero status will cause failure. The key namespace is
1224 in ``$HG_NAMESPACE``.
1224 in ``$HG_NAMESPACE``.
1225
1225
1226 ``preoutgoing``
1226 ``preoutgoing``
1227 Run before collecting changes to send from the local repository to
1227 Run before collecting changes to send from the local repository to
1228 another. A non-zero status will cause failure. This lets you prevent
1228 another. A non-zero status will cause failure. This lets you prevent
1229 pull over HTTP or SSH. It can also prevent propagating commits (via
1229 pull over HTTP or SSH. It can also prevent propagating commits (via
1230 local pull, push (outbound) or bundle commands), but not completely,
1230 local pull, push (outbound) or bundle commands), but not completely,
1231 since you can just copy files instead. The source of operation is in
1231 since you can just copy files instead. The source of operation is in
1232 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
1232 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
1233 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
1233 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
1234 is happening on behalf of a repository on same system.
1234 is happening on behalf of a repository on same system.
1235
1235
1236 ``prepushkey``
1236 ``prepushkey``
1237 Run before a pushkey (like a bookmark) is added to the
1237 Run before a pushkey (like a bookmark) is added to the
1238 repository. A non-zero status will cause the key to be rejected. The
1238 repository. A non-zero status will cause the key to be rejected. The
1239 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
1239 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
1240 the old value (if any) is in ``$HG_OLD``, and the new value is in
1240 the old value (if any) is in ``$HG_OLD``, and the new value is in
1241 ``$HG_NEW``.
1241 ``$HG_NEW``.
1242
1242
1243 ``pretag``
1243 ``pretag``
1244 Run before creating a tag. Exit status 0 allows the tag to be
1244 Run before creating a tag. Exit status 0 allows the tag to be
1245 created. A non-zero status will cause the tag to fail. The ID of the
1245 created. A non-zero status will cause the tag to fail. The ID of the
1246 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
1246 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
1247 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
1247 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
1248
1248
1249 ``pretxnopen``
1249 ``pretxnopen``
1250 Run before any new repository transaction is open. The reason for the
1250 Run before any new repository transaction is open. The reason for the
1251 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
1251 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
1252 transaction will be in ``$HG_TXNID``. A non-zero status will prevent the
1252 transaction will be in ``$HG_TXNID``. A non-zero status will prevent the
1253 transaction from being opened.
1253 transaction from being opened.
1254
1254
1255 ``pretxnclose``
1255 ``pretxnclose``
1256 Run right before the transaction is actually finalized. Any repository change
1256 Run right before the transaction is actually finalized. Any repository change
1257 will be visible to the hook program. This lets you validate the transaction
1257 will be visible to the hook program. This lets you validate the transaction
1258 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1258 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1259 status will cause the transaction to be rolled back. The reason for the
1259 status will cause the transaction to be rolled back. The reason for the
1260 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1260 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1261 the transaction will be in ``$HG_TXNID``. The rest of the available data will
1261 the transaction will be in ``$HG_TXNID``. The rest of the available data will
1262 vary according the transaction type. Changes unbundled to the repository will
1262 vary according the transaction type. Changes unbundled to the repository will
1263 add ``$HG_URL`` and ``$HG_SOURCE``. New changesets will add ``$HG_NODE`` (the
1263 add ``$HG_URL`` and ``$HG_SOURCE``. New changesets will add ``$HG_NODE`` (the
1264 ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last added
1264 ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last added
1265 changeset). Bookmark and phase changes will set ``$HG_BOOKMARK_MOVED`` and
1265 changeset). Bookmark and phase changes will set ``$HG_BOOKMARK_MOVED`` and
1266 ``$HG_PHASES_MOVED`` to ``1`` respectively. The number of new obsmarkers, if
1266 ``$HG_PHASES_MOVED`` to ``1`` respectively. The number of new obsmarkers, if
1267 any, will be in ``$HG_NEW_OBSMARKERS``, etc.
1267 any, will be in ``$HG_NEW_OBSMARKERS``, etc.
1268
1268
1269 ``pretxnclose-bookmark``
1269 ``pretxnclose-bookmark``
1270 Run right before a bookmark change is actually finalized. Any repository
1270 Run right before a bookmark change is actually finalized. Any repository
1271 change will be visible to the hook program. This lets you validate the
1271 change will be visible to the hook program. This lets you validate the
1272 transaction content or change it. Exit status 0 allows the commit to
1272 transaction content or change it. Exit status 0 allows the commit to
1273 proceed. A non-zero status will cause the transaction to be rolled back.
1273 proceed. A non-zero status will cause the transaction to be rolled back.
1274 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1274 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1275 bookmark location will be available in ``$HG_NODE`` while the previous
1275 bookmark location will be available in ``$HG_NODE`` while the previous
1276 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1276 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1277 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1277 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1278 will be empty.
1278 will be empty.
1279 In addition, the reason for the transaction opening will be in
1279 In addition, the reason for the transaction opening will be in
1280 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1280 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1281 ``$HG_TXNID``.
1281 ``$HG_TXNID``.
1282
1282
1283 ``pretxnclose-phase``
1283 ``pretxnclose-phase``
1284 Run right before a phase change is actually finalized. Any repository change
1284 Run right before a phase change is actually finalized. Any repository change
1285 will be visible to the hook program. This lets you validate the transaction
1285 will be visible to the hook program. This lets you validate the transaction
1286 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1286 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1287 status will cause the transaction to be rolled back. The hook is called
1287 status will cause the transaction to be rolled back. The hook is called
1288 multiple times, once for each revision affected by a phase change.
1288 multiple times, once for each revision affected by a phase change.
1289 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1289 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1290 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1290 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1291 will be empty. In addition, the reason for the transaction opening will be in
1291 will be empty. In addition, the reason for the transaction opening will be in
1292 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1292 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1293 ``$HG_TXNID``. The hook is also run for newly added revisions. In this case
1293 ``$HG_TXNID``. The hook is also run for newly added revisions. In this case
1294 the ``$HG_OLDPHASE`` entry will be empty.
1294 the ``$HG_OLDPHASE`` entry will be empty.
1295
1295
1296 ``txnclose``
1296 ``txnclose``
1297 Run after any repository transaction has been committed. At this
1297 Run after any repository transaction has been committed. At this
1298 point, the transaction can no longer be rolled back. The hook will run
1298 point, the transaction can no longer be rolled back. The hook will run
1299 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1299 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1300 details about available variables.
1300 details about available variables.
1301
1301
1302 ``txnclose-bookmark``
1302 ``txnclose-bookmark``
1303 Run after any bookmark change has been committed. At this point, the
1303 Run after any bookmark change has been committed. At this point, the
1304 transaction can no longer be rolled back. The hook will run after the lock
1304 transaction can no longer be rolled back. The hook will run after the lock
1305 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1305 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1306 about available variables.
1306 about available variables.
1307
1307
1308 ``txnclose-phase``
1308 ``txnclose-phase``
1309 Run after any phase change has been committed. At this point, the
1309 Run after any phase change has been committed. At this point, the
1310 transaction can no longer be rolled back. The hook will run after the lock
1310 transaction can no longer be rolled back. The hook will run after the lock
1311 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1311 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1312 available variables.
1312 available variables.
1313
1313
1314 ``txnabort``
1314 ``txnabort``
1315 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1315 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1316 for details about available variables.
1316 for details about available variables.
1317
1317
1318 ``pretxnchangegroup``
1318 ``pretxnchangegroup``
1319 Run after a changegroup has been added via push, pull or unbundle, but before
1319 Run after a changegroup has been added via push, pull or unbundle, but before
1320 the transaction has been committed. The changegroup is visible to the hook
1320 the transaction has been committed. The changegroup is visible to the hook
1321 program. This allows validation of incoming changes before accepting them.
1321 program. This allows validation of incoming changes before accepting them.
1322 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1322 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1323 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1323 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1324 status will cause the transaction to be rolled back, and the push, pull or
1324 status will cause the transaction to be rolled back, and the push, pull or
1325 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1325 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1326
1326
1327 ``pretxncommit``
1327 ``pretxncommit``
1328 Run after a changeset has been created, but before the transaction is
1328 Run after a changeset has been created, but before the transaction is
1329 committed. The changeset is visible to the hook program. This allows
1329 committed. The changeset is visible to the hook program. This allows
1330 validation of the commit message and changes. Exit status 0 allows the
1330 validation of the commit message and changes. Exit status 0 allows the
1331 commit to proceed. A non-zero status will cause the transaction to
1331 commit to proceed. A non-zero status will cause the transaction to
1332 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1332 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1333 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1333 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1334
1334
1335 ``preupdate``
1335 ``preupdate``
1336 Run before updating the working directory. Exit status 0 allows
1336 Run before updating the working directory. Exit status 0 allows
1337 the update to proceed. A non-zero status will prevent the update.
1337 the update to proceed. A non-zero status will prevent the update.
1338 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1338 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1339 merge, the ID of second new parent is in ``$HG_PARENT2``.
1339 merge, the ID of second new parent is in ``$HG_PARENT2``.
1340
1340
1341 ``listkeys``
1341 ``listkeys``
1342 Run after listing pushkeys (like bookmarks) in the repository. The
1342 Run after listing pushkeys (like bookmarks) in the repository. The
1343 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1343 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1344 dictionary containing the keys and values.
1344 dictionary containing the keys and values.
1345
1345
1346 ``pushkey``
1346 ``pushkey``
1347 Run after a pushkey (like a bookmark) is added to the
1347 Run after a pushkey (like a bookmark) is added to the
1348 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1348 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1349 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1349 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1350 value is in ``$HG_NEW``.
1350 value is in ``$HG_NEW``.
1351
1351
1352 ``tag``
1352 ``tag``
1353 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1353 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1354 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1354 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1355 the repository if ``$HG_LOCAL=0``.
1355 the repository if ``$HG_LOCAL=0``.
1356
1356
1357 ``update``
1357 ``update``
1358 Run after updating the working directory. The changeset ID of first
1358 Run after updating the working directory. The changeset ID of first
1359 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1359 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1360 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1360 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1361 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1361 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1362
1362
1363 .. note::
1363 .. note::
1364
1364
1365 It is generally better to use standard hooks rather than the
1365 It is generally better to use standard hooks rather than the
1366 generic pre- and post- command hooks, as they are guaranteed to be
1366 generic pre- and post- command hooks, as they are guaranteed to be
1367 called in the appropriate contexts for influencing transactions.
1367 called in the appropriate contexts for influencing transactions.
1368 Also, hooks like "commit" will be called in all contexts that
1368 Also, hooks like "commit" will be called in all contexts that
1369 generate a commit (e.g. tag) and not just the commit command.
1369 generate a commit (e.g. tag) and not just the commit command.
1370
1370
1371 .. note::
1371 .. note::
1372
1372
1373 Environment variables with empty values may not be passed to
1373 Environment variables with empty values may not be passed to
1374 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1374 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1375 will have an empty value under Unix-like platforms for non-merge
1375 will have an empty value under Unix-like platforms for non-merge
1376 changesets, while it will not be available at all under Windows.
1376 changesets, while it will not be available at all under Windows.
1377
1377
1378 The syntax for Python hooks is as follows::
1378 The syntax for Python hooks is as follows::
1379
1379
1380 hookname = python:modulename.submodule.callable
1380 hookname = python:modulename.submodule.callable
1381 hookname = python:/path/to/python/module.py:callable
1381 hookname = python:/path/to/python/module.py:callable
1382
1382
1383 Python hooks are run within the Mercurial process. Each hook is
1383 Python hooks are run within the Mercurial process. Each hook is
1384 called with at least three keyword arguments: a ui object (keyword
1384 called with at least three keyword arguments: a ui object (keyword
1385 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1385 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1386 keyword that tells what kind of hook is used. Arguments listed as
1386 keyword that tells what kind of hook is used. Arguments listed as
1387 environment variables above are passed as keyword arguments, with no
1387 environment variables above are passed as keyword arguments, with no
1388 ``HG_`` prefix, and names in lower case.
1388 ``HG_`` prefix, and names in lower case.
1389
1389
1390 If a Python hook returns a "true" value or raises an exception, this
1390 If a Python hook returns a "true" value or raises an exception, this
1391 is treated as a failure.
1391 is treated as a failure.
1392
1392
1393
1393
1394 ``hostfingerprints``
1394 ``hostfingerprints``
1395 --------------------
1395 --------------------
1396
1396
1397 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1397 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1398
1398
1399 Fingerprints of the certificates of known HTTPS servers.
1399 Fingerprints of the certificates of known HTTPS servers.
1400
1400
1401 A HTTPS connection to a server with a fingerprint configured here will
1401 A HTTPS connection to a server with a fingerprint configured here will
1402 only succeed if the servers certificate matches the fingerprint.
1402 only succeed if the servers certificate matches the fingerprint.
1403 This is very similar to how ssh known hosts works.
1403 This is very similar to how ssh known hosts works.
1404
1404
1405 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1405 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1406 Multiple values can be specified (separated by spaces or commas). This can
1406 Multiple values can be specified (separated by spaces or commas). This can
1407 be used to define both old and new fingerprints while a host transitions
1407 be used to define both old and new fingerprints while a host transitions
1408 to a new certificate.
1408 to a new certificate.
1409
1409
1410 The CA chain and web.cacerts is not used for servers with a fingerprint.
1410 The CA chain and web.cacerts is not used for servers with a fingerprint.
1411
1411
1412 For example::
1412 For example::
1413
1413
1414 [hostfingerprints]
1414 [hostfingerprints]
1415 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1415 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1416 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1416 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1417
1417
1418 ``hostsecurity``
1418 ``hostsecurity``
1419 ----------------
1419 ----------------
1420
1420
1421 Used to specify global and per-host security settings for connecting to
1421 Used to specify global and per-host security settings for connecting to
1422 other machines.
1422 other machines.
1423
1423
1424 The following options control default behavior for all hosts.
1424 The following options control default behavior for all hosts.
1425
1425
1426 ``ciphers``
1426 ``ciphers``
1427 Defines the cryptographic ciphers to use for connections.
1427 Defines the cryptographic ciphers to use for connections.
1428
1428
1429 Value must be a valid OpenSSL Cipher List Format as documented at
1429 Value must be a valid OpenSSL Cipher List Format as documented at
1430 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1430 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1431
1431
1432 This setting is for advanced users only. Setting to incorrect values
1432 This setting is for advanced users only. Setting to incorrect values
1433 can significantly lower connection security or decrease performance.
1433 can significantly lower connection security or decrease performance.
1434 You have been warned.
1434 You have been warned.
1435
1435
1436 This option requires Python 2.7.
1436 This option requires Python 2.7.
1437
1437
1438 ``minimumprotocol``
1438 ``minimumprotocol``
1439 Defines the minimum channel encryption protocol to use.
1439 Defines the minimum channel encryption protocol to use.
1440
1440
1441 By default, the highest version of TLS supported by both client and server
1441 By default, the highest version of TLS supported by both client and server
1442 is used.
1442 is used.
1443
1443
1444 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1444 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1445
1445
1446 When running on an old Python version, only ``tls1.0`` is allowed since
1446 When running on an old Python version, only ``tls1.0`` is allowed since
1447 old versions of Python only support up to TLS 1.0.
1447 old versions of Python only support up to TLS 1.0.
1448
1448
1449 When running a Python that supports modern TLS versions, the default is
1449 When running a Python that supports modern TLS versions, the default is
1450 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1450 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1451 weakens security and should only be used as a feature of last resort if
1451 weakens security and should only be used as a feature of last resort if
1452 a server does not support TLS 1.1+.
1452 a server does not support TLS 1.1+.
1453
1453
1454 Options in the ``[hostsecurity]`` section can have the form
1454 Options in the ``[hostsecurity]`` section can have the form
1455 ``hostname``:``setting``. This allows multiple settings to be defined on a
1455 ``hostname``:``setting``. This allows multiple settings to be defined on a
1456 per-host basis.
1456 per-host basis.
1457
1457
1458 The following per-host settings can be defined.
1458 The following per-host settings can be defined.
1459
1459
1460 ``ciphers``
1460 ``ciphers``
1461 This behaves like ``ciphers`` as described above except it only applies
1461 This behaves like ``ciphers`` as described above except it only applies
1462 to the host on which it is defined.
1462 to the host on which it is defined.
1463
1463
1464 ``fingerprints``
1464 ``fingerprints``
1465 A list of hashes of the DER encoded peer/remote certificate. Values have
1465 A list of hashes of the DER encoded peer/remote certificate. Values have
1466 the form ``algorithm``:``fingerprint``. e.g.
1466 the form ``algorithm``:``fingerprint``. e.g.
1467 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1467 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1468 In addition, colons (``:``) can appear in the fingerprint part.
1468 In addition, colons (``:``) can appear in the fingerprint part.
1469
1469
1470 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1470 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1471 ``sha512``.
1471 ``sha512``.
1472
1472
1473 Use of ``sha256`` or ``sha512`` is preferred.
1473 Use of ``sha256`` or ``sha512`` is preferred.
1474
1474
1475 If a fingerprint is specified, the CA chain is not validated for this
1475 If a fingerprint is specified, the CA chain is not validated for this
1476 host and Mercurial will require the remote certificate to match one
1476 host and Mercurial will require the remote certificate to match one
1477 of the fingerprints specified. This means if the server updates its
1477 of the fingerprints specified. This means if the server updates its
1478 certificate, Mercurial will abort until a new fingerprint is defined.
1478 certificate, Mercurial will abort until a new fingerprint is defined.
1479 This can provide stronger security than traditional CA-based validation
1479 This can provide stronger security than traditional CA-based validation
1480 at the expense of convenience.
1480 at the expense of convenience.
1481
1481
1482 This option takes precedence over ``verifycertsfile``.
1482 This option takes precedence over ``verifycertsfile``.
1483
1483
1484 ``minimumprotocol``
1484 ``minimumprotocol``
1485 This behaves like ``minimumprotocol`` as described above except it
1485 This behaves like ``minimumprotocol`` as described above except it
1486 only applies to the host on which it is defined.
1486 only applies to the host on which it is defined.
1487
1487
1488 ``verifycertsfile``
1488 ``verifycertsfile``
1489 Path to file a containing a list of PEM encoded certificates used to
1489 Path to file a containing a list of PEM encoded certificates used to
1490 verify the server certificate. Environment variables and ``~user``
1490 verify the server certificate. Environment variables and ``~user``
1491 constructs are expanded in the filename.
1491 constructs are expanded in the filename.
1492
1492
1493 The server certificate or the certificate's certificate authority (CA)
1493 The server certificate or the certificate's certificate authority (CA)
1494 must match a certificate from this file or certificate verification
1494 must match a certificate from this file or certificate verification
1495 will fail and connections to the server will be refused.
1495 will fail and connections to the server will be refused.
1496
1496
1497 If defined, only certificates provided by this file will be used:
1497 If defined, only certificates provided by this file will be used:
1498 ``web.cacerts`` and any system/default certificates will not be
1498 ``web.cacerts`` and any system/default certificates will not be
1499 used.
1499 used.
1500
1500
1501 This option has no effect if the per-host ``fingerprints`` option
1501 This option has no effect if the per-host ``fingerprints`` option
1502 is set.
1502 is set.
1503
1503
1504 The format of the file is as follows::
1504 The format of the file is as follows::
1505
1505
1506 -----BEGIN CERTIFICATE-----
1506 -----BEGIN CERTIFICATE-----
1507 ... (certificate in base64 PEM encoding) ...
1507 ... (certificate in base64 PEM encoding) ...
1508 -----END CERTIFICATE-----
1508 -----END CERTIFICATE-----
1509 -----BEGIN CERTIFICATE-----
1509 -----BEGIN CERTIFICATE-----
1510 ... (certificate in base64 PEM encoding) ...
1510 ... (certificate in base64 PEM encoding) ...
1511 -----END CERTIFICATE-----
1511 -----END CERTIFICATE-----
1512
1512
1513 For example::
1513 For example::
1514
1514
1515 [hostsecurity]
1515 [hostsecurity]
1516 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1516 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1517 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
1517 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
1518 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
1518 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
1519 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1519 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1520
1520
1521 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1521 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1522 when connecting to ``hg.example.com``::
1522 when connecting to ``hg.example.com``::
1523
1523
1524 [hostsecurity]
1524 [hostsecurity]
1525 minimumprotocol = tls1.2
1525 minimumprotocol = tls1.2
1526 hg.example.com:minimumprotocol = tls1.1
1526 hg.example.com:minimumprotocol = tls1.1
1527
1527
1528 ``http_proxy``
1528 ``http_proxy``
1529 --------------
1529 --------------
1530
1530
1531 Used to access web-based Mercurial repositories through a HTTP
1531 Used to access web-based Mercurial repositories through a HTTP
1532 proxy.
1532 proxy.
1533
1533
1534 ``host``
1534 ``host``
1535 Host name and (optional) port of the proxy server, for example
1535 Host name and (optional) port of the proxy server, for example
1536 "myproxy:8000".
1536 "myproxy:8000".
1537
1537
1538 ``no``
1538 ``no``
1539 Optional. Comma-separated list of host names that should bypass
1539 Optional. Comma-separated list of host names that should bypass
1540 the proxy.
1540 the proxy.
1541
1541
1542 ``passwd``
1542 ``passwd``
1543 Optional. Password to authenticate with at the proxy server.
1543 Optional. Password to authenticate with at the proxy server.
1544
1544
1545 ``user``
1545 ``user``
1546 Optional. User name to authenticate with at the proxy server.
1546 Optional. User name to authenticate with at the proxy server.
1547
1547
1548 ``always``
1548 ``always``
1549 Optional. Always use the proxy, even for localhost and any entries
1549 Optional. Always use the proxy, even for localhost and any entries
1550 in ``http_proxy.no``. (default: False)
1550 in ``http_proxy.no``. (default: False)
1551
1551
1552 ``http``
1552 ``http``
1553 ----------
1553 ----------
1554
1554
1555 Used to configure access to Mercurial repositories via HTTP.
1555 Used to configure access to Mercurial repositories via HTTP.
1556
1556
1557 ``timeout``
1557 ``timeout``
1558 If set, blocking operations will timeout after that many seconds.
1558 If set, blocking operations will timeout after that many seconds.
1559 (default: None)
1559 (default: None)
1560
1560
1561 ``merge``
1561 ``merge``
1562 ---------
1562 ---------
1563
1563
1564 This section specifies behavior during merges and updates.
1564 This section specifies behavior during merges and updates.
1565
1565
1566 ``checkignored``
1566 ``checkignored``
1567 Controls behavior when an ignored file on disk has the same name as a tracked
1567 Controls behavior when an ignored file on disk has the same name as a tracked
1568 file in the changeset being merged or updated to, and has different
1568 file in the changeset being merged or updated to, and has different
1569 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1569 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1570 abort on such files. With ``warn``, warn on such files and back them up as
1570 abort on such files. With ``warn``, warn on such files and back them up as
1571 ``.orig``. With ``ignore``, don't print a warning and back them up as
1571 ``.orig``. With ``ignore``, don't print a warning and back them up as
1572 ``.orig``. (default: ``abort``)
1572 ``.orig``. (default: ``abort``)
1573
1573
1574 ``checkunknown``
1574 ``checkunknown``
1575 Controls behavior when an unknown file that isn't ignored has the same name
1575 Controls behavior when an unknown file that isn't ignored has the same name
1576 as a tracked file in the changeset being merged or updated to, and has
1576 as a tracked file in the changeset being merged or updated to, and has
1577 different contents. Similar to ``merge.checkignored``, except for files that
1577 different contents. Similar to ``merge.checkignored``, except for files that
1578 are not ignored. (default: ``abort``)
1578 are not ignored. (default: ``abort``)
1579
1579
1580 ``on-failure``
1580 ``on-failure``
1581 When set to ``continue`` (the default), the merge process attempts to
1581 When set to ``continue`` (the default), the merge process attempts to
1582 merge all unresolved files using the merge chosen tool, regardless of
1582 merge all unresolved files using the merge chosen tool, regardless of
1583 whether previous file merge attempts during the process succeeded or not.
1583 whether previous file merge attempts during the process succeeded or not.
1584 Setting this to ``prompt`` will prompt after any merge failure continue
1584 Setting this to ``prompt`` will prompt after any merge failure continue
1585 or halt the merge process. Setting this to ``halt`` will automatically
1585 or halt the merge process. Setting this to ``halt`` will automatically
1586 halt the merge process on any merge tool failure. The merge process
1586 halt the merge process on any merge tool failure. The merge process
1587 can be restarted by using the ``resolve`` command. When a merge is
1587 can be restarted by using the ``resolve`` command. When a merge is
1588 halted, the repository is left in a normal ``unresolved`` merge state.
1588 halted, the repository is left in a normal ``unresolved`` merge state.
1589 (default: ``continue``)
1589 (default: ``continue``)
1590
1590
1591 ``strict-capability-check``
1591 ``strict-capability-check``
1592 Whether capabilities of internal merge tools are checked strictly
1592 Whether capabilities of internal merge tools are checked strictly
1593 or not, while examining rules to decide merge tool to be used.
1593 or not, while examining rules to decide merge tool to be used.
1594 (default: False)
1594 (default: False)
1595
1595
1596 ``merge-patterns``
1596 ``merge-patterns``
1597 ------------------
1597 ------------------
1598
1598
1599 This section specifies merge tools to associate with particular file
1599 This section specifies merge tools to associate with particular file
1600 patterns. Tools matched here will take precedence over the default
1600 patterns. Tools matched here will take precedence over the default
1601 merge tool. Patterns are globs by default, rooted at the repository
1601 merge tool. Patterns are globs by default, rooted at the repository
1602 root.
1602 root.
1603
1603
1604 Example::
1604 Example::
1605
1605
1606 [merge-patterns]
1606 [merge-patterns]
1607 **.c = kdiff3
1607 **.c = kdiff3
1608 **.jpg = myimgmerge
1608 **.jpg = myimgmerge
1609
1609
1610 ``merge-tools``
1610 ``merge-tools``
1611 ---------------
1611 ---------------
1612
1612
1613 This section configures external merge tools to use for file-level
1613 This section configures external merge tools to use for file-level
1614 merges. This section has likely been preconfigured at install time.
1614 merges. This section has likely been preconfigured at install time.
1615 Use :hg:`config merge-tools` to check the existing configuration.
1615 Use :hg:`config merge-tools` to check the existing configuration.
1616 Also see :hg:`help merge-tools` for more details.
1616 Also see :hg:`help merge-tools` for more details.
1617
1617
1618 Example ``~/.hgrc``::
1618 Example ``~/.hgrc``::
1619
1619
1620 [merge-tools]
1620 [merge-tools]
1621 # Override stock tool location
1621 # Override stock tool location
1622 kdiff3.executable = ~/bin/kdiff3
1622 kdiff3.executable = ~/bin/kdiff3
1623 # Specify command line
1623 # Specify command line
1624 kdiff3.args = $base $local $other -o $output
1624 kdiff3.args = $base $local $other -o $output
1625 # Give higher priority
1625 # Give higher priority
1626 kdiff3.priority = 1
1626 kdiff3.priority = 1
1627
1627
1628 # Changing the priority of preconfigured tool
1628 # Changing the priority of preconfigured tool
1629 meld.priority = 0
1629 meld.priority = 0
1630
1630
1631 # Disable a preconfigured tool
1631 # Disable a preconfigured tool
1632 vimdiff.disabled = yes
1632 vimdiff.disabled = yes
1633
1633
1634 # Define new tool
1634 # Define new tool
1635 myHtmlTool.args = -m $local $other $base $output
1635 myHtmlTool.args = -m $local $other $base $output
1636 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1636 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1637 myHtmlTool.priority = 1
1637 myHtmlTool.priority = 1
1638
1638
1639 Supported arguments:
1639 Supported arguments:
1640
1640
1641 ``priority``
1641 ``priority``
1642 The priority in which to evaluate this tool.
1642 The priority in which to evaluate this tool.
1643 (default: 0)
1643 (default: 0)
1644
1644
1645 ``executable``
1645 ``executable``
1646 Either just the name of the executable or its pathname.
1646 Either just the name of the executable or its pathname.
1647
1647
1648 .. container:: windows
1648 .. container:: windows
1649
1649
1650 On Windows, the path can use environment variables with ${ProgramFiles}
1650 On Windows, the path can use environment variables with ${ProgramFiles}
1651 syntax.
1651 syntax.
1652
1652
1653 (default: the tool name)
1653 (default: the tool name)
1654
1654
1655 ``args``
1655 ``args``
1656 The arguments to pass to the tool executable. You can refer to the
1656 The arguments to pass to the tool executable. You can refer to the
1657 files being merged as well as the output file through these
1657 files being merged as well as the output file through these
1658 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1658 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1659
1659
1660 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1660 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1661 being performed. During an update or merge, ``$local`` represents the original
1661 being performed. During an update or merge, ``$local`` represents the original
1662 state of the file, while ``$other`` represents the commit you are updating to or
1662 state of the file, while ``$other`` represents the commit you are updating to or
1663 the commit you are merging with. During a rebase, ``$local`` represents the
1663 the commit you are merging with. During a rebase, ``$local`` represents the
1664 destination of the rebase, and ``$other`` represents the commit being rebased.
1664 destination of the rebase, and ``$other`` represents the commit being rebased.
1665
1665
1666 Some operations define custom labels to assist with identifying the revisions,
1666 Some operations define custom labels to assist with identifying the revisions,
1667 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1667 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1668 labels are not available, these will be ``local``, ``other``, and ``base``,
1668 labels are not available, these will be ``local``, ``other``, and ``base``,
1669 respectively.
1669 respectively.
1670 (default: ``$local $base $other``)
1670 (default: ``$local $base $other``)
1671
1671
1672 ``premerge``
1672 ``premerge``
1673 Attempt to run internal non-interactive 3-way merge tool before
1673 Attempt to run internal non-interactive 3-way merge tool before
1674 launching external tool. Options are ``true``, ``false``, ``keep``,
1674 launching external tool. Options are ``true``, ``false``, ``keep``,
1675 ``keep-merge3``, or ``keep-mergediff`` (experimental). The ``keep`` option
1675 ``keep-merge3``, or ``keep-mergediff`` (experimental). The ``keep`` option
1676 will leave markers in the file if the premerge fails. The ``keep-merge3``
1676 will leave markers in the file if the premerge fails. The ``keep-merge3``
1677 will do the same but include information about the base of the merge in the
1677 will do the same but include information about the base of the merge in the
1678 marker (see internal :merge3 in :hg:`help merge-tools`). The
1678 marker (see internal :merge3 in :hg:`help merge-tools`). The
1679 ``keep-mergediff`` option is similar but uses a different marker style
1679 ``keep-mergediff`` option is similar but uses a different marker style
1680 (see internal :merge3 in :hg:`help merge-tools`). (default: True)
1680 (see internal :merge3 in :hg:`help merge-tools`). (default: True)
1681
1681
1682 ``binary``
1682 ``binary``
1683 This tool can merge binary files. (default: False, unless tool
1683 This tool can merge binary files. (default: False, unless tool
1684 was selected by file pattern match)
1684 was selected by file pattern match)
1685
1685
1686 ``symlink``
1686 ``symlink``
1687 This tool can merge symlinks. (default: False)
1687 This tool can merge symlinks. (default: False)
1688
1688
1689 ``check``
1689 ``check``
1690 A list of merge success-checking options:
1690 A list of merge success-checking options:
1691
1691
1692 ``changed``
1692 ``changed``
1693 Ask whether merge was successful when the merged file shows no changes.
1693 Ask whether merge was successful when the merged file shows no changes.
1694 ``conflicts``
1694 ``conflicts``
1695 Check whether there are conflicts even though the tool reported success.
1695 Check whether there are conflicts even though the tool reported success.
1696 ``prompt``
1696 ``prompt``
1697 Always prompt for merge success, regardless of success reported by tool.
1697 Always prompt for merge success, regardless of success reported by tool.
1698
1698
1699 ``fixeol``
1699 ``fixeol``
1700 Attempt to fix up EOL changes caused by the merge tool.
1700 Attempt to fix up EOL changes caused by the merge tool.
1701 (default: False)
1701 (default: False)
1702
1702
1703 ``gui``
1703 ``gui``
1704 This tool requires a graphical interface to run. (default: False)
1704 This tool requires a graphical interface to run. (default: False)
1705
1705
1706 ``mergemarkers``
1706 ``mergemarkers``
1707 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1707 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1708 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1708 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1709 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1709 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1710 markers generated during premerge will be ``detailed`` if either this option or
1710 markers generated during premerge will be ``detailed`` if either this option or
1711 the corresponding option in the ``[ui]`` section is ``detailed``.
1711 the corresponding option in the ``[ui]`` section is ``detailed``.
1712 (default: ``basic``)
1712 (default: ``basic``)
1713
1713
1714 ``mergemarkertemplate``
1714 ``mergemarkertemplate``
1715 This setting can be used to override ``mergemarker`` from the
1715 This setting can be used to override ``mergemarker`` from the
1716 ``[command-templates]`` section on a per-tool basis; this applies to the
1716 ``[command-templates]`` section on a per-tool basis; this applies to the
1717 ``$label``-prefixed variables and to the conflict markers that are generated
1717 ``$label``-prefixed variables and to the conflict markers that are generated
1718 if ``premerge`` is ``keep` or ``keep-merge3``. See the corresponding variable
1718 if ``premerge`` is ``keep` or ``keep-merge3``. See the corresponding variable
1719 in ``[ui]`` for more information.
1719 in ``[ui]`` for more information.
1720
1720
1721 .. container:: windows
1721 .. container:: windows
1722
1722
1723 ``regkey``
1723 ``regkey``
1724 Windows registry key which describes install location of this
1724 Windows registry key which describes install location of this
1725 tool. Mercurial will search for this key first under
1725 tool. Mercurial will search for this key first under
1726 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1726 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1727 (default: None)
1727 (default: None)
1728
1728
1729 ``regkeyalt``
1729 ``regkeyalt``
1730 An alternate Windows registry key to try if the first key is not
1730 An alternate Windows registry key to try if the first key is not
1731 found. The alternate key uses the same ``regname`` and ``regappend``
1731 found. The alternate key uses the same ``regname`` and ``regappend``
1732 semantics of the primary key. The most common use for this key
1732 semantics of the primary key. The most common use for this key
1733 is to search for 32bit applications on 64bit operating systems.
1733 is to search for 32bit applications on 64bit operating systems.
1734 (default: None)
1734 (default: None)
1735
1735
1736 ``regname``
1736 ``regname``
1737 Name of value to read from specified registry key.
1737 Name of value to read from specified registry key.
1738 (default: the unnamed (default) value)
1738 (default: the unnamed (default) value)
1739
1739
1740 ``regappend``
1740 ``regappend``
1741 String to append to the value read from the registry, typically
1741 String to append to the value read from the registry, typically
1742 the executable name of the tool.
1742 the executable name of the tool.
1743 (default: None)
1743 (default: None)
1744
1744
1745 ``pager``
1745 ``pager``
1746 ---------
1746 ---------
1747
1747
1748 Setting used to control when to paginate and with what external tool. See
1748 Setting used to control when to paginate and with what external tool. See
1749 :hg:`help pager` for details.
1749 :hg:`help pager` for details.
1750
1750
1751 ``pager``
1751 ``pager``
1752 Define the external tool used as pager.
1752 Define the external tool used as pager.
1753
1753
1754 If no pager is set, Mercurial uses the environment variable $PAGER.
1754 If no pager is set, Mercurial uses the environment variable $PAGER.
1755 If neither pager.pager, nor $PAGER is set, a default pager will be
1755 If neither pager.pager, nor $PAGER is set, a default pager will be
1756 used, typically `less` on Unix and `more` on Windows. Example::
1756 used, typically `less` on Unix and `more` on Windows. Example::
1757
1757
1758 [pager]
1758 [pager]
1759 pager = less -FRX
1759 pager = less -FRX
1760
1760
1761 ``ignore``
1761 ``ignore``
1762 List of commands to disable the pager for. Example::
1762 List of commands to disable the pager for. Example::
1763
1763
1764 [pager]
1764 [pager]
1765 ignore = version, help, update
1765 ignore = version, help, update
1766
1766
1767 ``patch``
1767 ``patch``
1768 ---------
1768 ---------
1769
1769
1770 Settings used when applying patches, for instance through the 'import'
1770 Settings used when applying patches, for instance through the 'import'
1771 command or with Mercurial Queues extension.
1771 command or with Mercurial Queues extension.
1772
1772
1773 ``eol``
1773 ``eol``
1774 When set to 'strict' patch content and patched files end of lines
1774 When set to 'strict' patch content and patched files end of lines
1775 are preserved. When set to ``lf`` or ``crlf``, both files end of
1775 are preserved. When set to ``lf`` or ``crlf``, both files end of
1776 lines are ignored when patching and the result line endings are
1776 lines are ignored when patching and the result line endings are
1777 normalized to either LF (Unix) or CRLF (Windows). When set to
1777 normalized to either LF (Unix) or CRLF (Windows). When set to
1778 ``auto``, end of lines are again ignored while patching but line
1778 ``auto``, end of lines are again ignored while patching but line
1779 endings in patched files are normalized to their original setting
1779 endings in patched files are normalized to their original setting
1780 on a per-file basis. If target file does not exist or has no end
1780 on a per-file basis. If target file does not exist or has no end
1781 of line, patch line endings are preserved.
1781 of line, patch line endings are preserved.
1782 (default: strict)
1782 (default: strict)
1783
1783
1784 ``fuzz``
1784 ``fuzz``
1785 The number of lines of 'fuzz' to allow when applying patches. This
1785 The number of lines of 'fuzz' to allow when applying patches. This
1786 controls how much context the patcher is allowed to ignore when
1786 controls how much context the patcher is allowed to ignore when
1787 trying to apply a patch.
1787 trying to apply a patch.
1788 (default: 2)
1788 (default: 2)
1789
1789
1790 ``paths``
1790 ``paths``
1791 ---------
1791 ---------
1792
1792
1793 Assigns symbolic names and behavior to repositories.
1793 Assigns symbolic names and behavior to repositories.
1794
1794
1795 Options are symbolic names defining the URL or directory that is the
1795 Options are symbolic names defining the URL or directory that is the
1796 location of the repository. Example::
1796 location of the repository. Example::
1797
1797
1798 [paths]
1798 [paths]
1799 my_server = https://example.com/my_repo
1799 my_server = https://example.com/my_repo
1800 local_path = /home/me/repo
1800 local_path = /home/me/repo
1801
1801
1802 These symbolic names can be used from the command line. To pull
1802 These symbolic names can be used from the command line. To pull
1803 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1803 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1804 :hg:`push local_path`. You can check :hg:`help urls` for details about
1804 :hg:`push local_path`. You can check :hg:`help urls` for details about
1805 valid URLs.
1805 valid URLs.
1806
1806
1807 Options containing colons (``:``) denote sub-options that can influence
1807 Options containing colons (``:``) denote sub-options that can influence
1808 behavior for that specific path. Example::
1808 behavior for that specific path. Example::
1809
1809
1810 [paths]
1810 [paths]
1811 my_server = https://example.com/my_path
1811 my_server = https://example.com/my_path
1812 my_server:pushurl = ssh://example.com/my_path
1812 my_server:pushurl = ssh://example.com/my_path
1813
1813
1814 Paths using the `path://otherpath` scheme will inherit the sub-options value from
1814 Paths using the `path://otherpath` scheme will inherit the sub-options value from
1815 the path they point to.
1815 the path they point to.
1816
1816
1817 The following sub-options can be defined:
1817 The following sub-options can be defined:
1818
1818
1819 ``multi-urls``
1819 ``multi-urls``
1820 A boolean option. When enabled the value of the `[paths]` entry will be
1820 A boolean option. When enabled the value of the `[paths]` entry will be
1821 parsed as a list and the alias will resolve to multiple destination. If some
1821 parsed as a list and the alias will resolve to multiple destination. If some
1822 of the list entry use the `path://` syntax, the suboption will be inherited
1822 of the list entry use the `path://` syntax, the suboption will be inherited
1823 individually.
1823 individually.
1824
1824
1825 ``pushurl``
1825 ``pushurl``
1826 The URL to use for push operations. If not defined, the location
1826 The URL to use for push operations. If not defined, the location
1827 defined by the path's main entry is used.
1827 defined by the path's main entry is used.
1828
1828
1829 ``pushrev``
1829 ``pushrev``
1830 A revset defining which revisions to push by default.
1830 A revset defining which revisions to push by default.
1831
1831
1832 When :hg:`push` is executed without a ``-r`` argument, the revset
1832 When :hg:`push` is executed without a ``-r`` argument, the revset
1833 defined by this sub-option is evaluated to determine what to push.
1833 defined by this sub-option is evaluated to determine what to push.
1834
1834
1835 For example, a value of ``.`` will push the working directory's
1835 For example, a value of ``.`` will push the working directory's
1836 revision by default.
1836 revision by default.
1837
1837
1838 Revsets specifying bookmarks will not result in the bookmark being
1838 Revsets specifying bookmarks will not result in the bookmark being
1839 pushed.
1839 pushed.
1840
1840
1841 ``bookmarks.mode``
1841 ``bookmarks.mode``
1842 How bookmark will be dealt during the exchange. It support the following value
1842 How bookmark will be dealt during the exchange. It support the following value
1843
1843
1844 - ``default``: the default behavior, local and remote bookmarks are "merged"
1844 - ``default``: the default behavior, local and remote bookmarks are "merged"
1845 on push/pull.
1845 on push/pull.
1846
1846
1847 - ``mirror``: when pulling, replace local bookmarks by remote bookmarks. This
1847 - ``mirror``: when pulling, replace local bookmarks by remote bookmarks. This
1848 is useful to replicate a repository, or as an optimization.
1848 is useful to replicate a repository, or as an optimization.
1849
1849
1850 - ``ignore``: ignore bookmarks during exchange.
1850 - ``ignore``: ignore bookmarks during exchange.
1851 (This currently only affect pulling)
1851 (This currently only affect pulling)
1852
1852
1853 The following special named paths exist:
1853 The following special named paths exist:
1854
1854
1855 ``default``
1855 ``default``
1856 The URL or directory to use when no source or remote is specified.
1856 The URL or directory to use when no source or remote is specified.
1857
1857
1858 :hg:`clone` will automatically define this path to the location the
1858 :hg:`clone` will automatically define this path to the location the
1859 repository was cloned from.
1859 repository was cloned from.
1860
1860
1861 ``default-push``
1861 ``default-push``
1862 (deprecated) The URL or directory for the default :hg:`push` location.
1862 (deprecated) The URL or directory for the default :hg:`push` location.
1863 ``default:pushurl`` should be used instead.
1863 ``default:pushurl`` should be used instead.
1864
1864
1865 ``phases``
1865 ``phases``
1866 ----------
1866 ----------
1867
1867
1868 Specifies default handling of phases. See :hg:`help phases` for more
1868 Specifies default handling of phases. See :hg:`help phases` for more
1869 information about working with phases.
1869 information about working with phases.
1870
1870
1871 ``publish``
1871 ``publish``
1872 Controls draft phase behavior when working as a server. When true,
1872 Controls draft phase behavior when working as a server. When true,
1873 pushed changesets are set to public in both client and server and
1873 pushed changesets are set to public in both client and server and
1874 pulled or cloned changesets are set to public in the client.
1874 pulled or cloned changesets are set to public in the client.
1875 (default: True)
1875 (default: True)
1876
1876
1877 ``new-commit``
1877 ``new-commit``
1878 Phase of newly-created commits.
1878 Phase of newly-created commits.
1879 (default: draft)
1879 (default: draft)
1880
1880
1881 ``checksubrepos``
1881 ``checksubrepos``
1882 Check the phase of the current revision of each subrepository. Allowed
1882 Check the phase of the current revision of each subrepository. Allowed
1883 values are "ignore", "follow" and "abort". For settings other than
1883 values are "ignore", "follow" and "abort". For settings other than
1884 "ignore", the phase of the current revision of each subrepository is
1884 "ignore", the phase of the current revision of each subrepository is
1885 checked before committing the parent repository. If any of those phases is
1885 checked before committing the parent repository. If any of those phases is
1886 greater than the phase of the parent repository (e.g. if a subrepo is in a
1886 greater than the phase of the parent repository (e.g. if a subrepo is in a
1887 "secret" phase while the parent repo is in "draft" phase), the commit is
1887 "secret" phase while the parent repo is in "draft" phase), the commit is
1888 either aborted (if checksubrepos is set to "abort") or the higher phase is
1888 either aborted (if checksubrepos is set to "abort") or the higher phase is
1889 used for the parent repository commit (if set to "follow").
1889 used for the parent repository commit (if set to "follow").
1890 (default: follow)
1890 (default: follow)
1891
1891
1892
1892
1893 ``profiling``
1893 ``profiling``
1894 -------------
1894 -------------
1895
1895
1896 Specifies profiling type, format, and file output. Two profilers are
1896 Specifies profiling type, format, and file output. Two profilers are
1897 supported: an instrumenting profiler (named ``ls``), and a sampling
1897 supported: an instrumenting profiler (named ``ls``), and a sampling
1898 profiler (named ``stat``).
1898 profiler (named ``stat``).
1899
1899
1900 In this section description, 'profiling data' stands for the raw data
1900 In this section description, 'profiling data' stands for the raw data
1901 collected during profiling, while 'profiling report' stands for a
1901 collected during profiling, while 'profiling report' stands for a
1902 statistical text report generated from the profiling data.
1902 statistical text report generated from the profiling data.
1903
1903
1904 ``enabled``
1904 ``enabled``
1905 Enable the profiler.
1905 Enable the profiler.
1906 (default: false)
1906 (default: false)
1907
1907
1908 This is equivalent to passing ``--profile`` on the command line.
1908 This is equivalent to passing ``--profile`` on the command line.
1909
1909
1910 ``type``
1910 ``type``
1911 The type of profiler to use.
1911 The type of profiler to use.
1912 (default: stat)
1912 (default: stat)
1913
1913
1914 ``ls``
1914 ``ls``
1915 Use Python's built-in instrumenting profiler. This profiler
1915 Use Python's built-in instrumenting profiler. This profiler
1916 works on all platforms, but each line number it reports is the
1916 works on all platforms, but each line number it reports is the
1917 first line of a function. This restriction makes it difficult to
1917 first line of a function. This restriction makes it difficult to
1918 identify the expensive parts of a non-trivial function.
1918 identify the expensive parts of a non-trivial function.
1919 ``stat``
1919 ``stat``
1920 Use a statistical profiler, statprof. This profiler is most
1920 Use a statistical profiler, statprof. This profiler is most
1921 useful for profiling commands that run for longer than about 0.1
1921 useful for profiling commands that run for longer than about 0.1
1922 seconds.
1922 seconds.
1923
1923
1924 ``format``
1924 ``format``
1925 Profiling format. Specific to the ``ls`` instrumenting profiler.
1925 Profiling format. Specific to the ``ls`` instrumenting profiler.
1926 (default: text)
1926 (default: text)
1927
1927
1928 ``text``
1928 ``text``
1929 Generate a profiling report. When saving to a file, it should be
1929 Generate a profiling report. When saving to a file, it should be
1930 noted that only the report is saved, and the profiling data is
1930 noted that only the report is saved, and the profiling data is
1931 not kept.
1931 not kept.
1932 ``kcachegrind``
1932 ``kcachegrind``
1933 Format profiling data for kcachegrind use: when saving to a
1933 Format profiling data for kcachegrind use: when saving to a
1934 file, the generated file can directly be loaded into
1934 file, the generated file can directly be loaded into
1935 kcachegrind.
1935 kcachegrind.
1936
1936
1937 ``statformat``
1937 ``statformat``
1938 Profiling format for the ``stat`` profiler.
1938 Profiling format for the ``stat`` profiler.
1939 (default: hotpath)
1939 (default: hotpath)
1940
1940
1941 ``hotpath``
1941 ``hotpath``
1942 Show a tree-based display containing the hot path of execution (where
1942 Show a tree-based display containing the hot path of execution (where
1943 most time was spent).
1943 most time was spent).
1944 ``bymethod``
1944 ``bymethod``
1945 Show a table of methods ordered by how frequently they are active.
1945 Show a table of methods ordered by how frequently they are active.
1946 ``byline``
1946 ``byline``
1947 Show a table of lines in files ordered by how frequently they are active.
1947 Show a table of lines in files ordered by how frequently they are active.
1948 ``json``
1948 ``json``
1949 Render profiling data as JSON.
1949 Render profiling data as JSON.
1950
1950
1951 ``freq``
1951 ``freq``
1952 Sampling frequency. Specific to the ``stat`` sampling profiler.
1952 Sampling frequency. Specific to the ``stat`` sampling profiler.
1953 (default: 1000)
1953 (default: 1000)
1954
1954
1955 ``output``
1955 ``output``
1956 File path where profiling data or report should be saved. If the
1956 File path where profiling data or report should be saved. If the
1957 file exists, it is replaced. (default: None, data is printed on
1957 file exists, it is replaced. (default: None, data is printed on
1958 stderr)
1958 stderr)
1959
1959
1960 ``sort``
1960 ``sort``
1961 Sort field. Specific to the ``ls`` instrumenting profiler.
1961 Sort field. Specific to the ``ls`` instrumenting profiler.
1962 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1962 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1963 ``inlinetime``.
1963 ``inlinetime``.
1964 (default: inlinetime)
1964 (default: inlinetime)
1965
1965
1966 ``time-track``
1966 ``time-track``
1967 Control if the stat profiler track ``cpu`` or ``real`` time.
1967 Control if the stat profiler track ``cpu`` or ``real`` time.
1968 (default: ``cpu`` on Windows, otherwise ``real``)
1968 (default: ``cpu`` on Windows, otherwise ``real``)
1969
1969
1970 ``limit``
1970 ``limit``
1971 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1971 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1972 (default: 30)
1972 (default: 30)
1973
1973
1974 ``nested``
1974 ``nested``
1975 Show at most this number of lines of drill-down info after each main entry.
1975 Show at most this number of lines of drill-down info after each main entry.
1976 This can help explain the difference between Total and Inline.
1976 This can help explain the difference between Total and Inline.
1977 Specific to the ``ls`` instrumenting profiler.
1977 Specific to the ``ls`` instrumenting profiler.
1978 (default: 0)
1978 (default: 0)
1979
1979
1980 ``showmin``
1980 ``showmin``
1981 Minimum fraction of samples an entry must have for it to be displayed.
1981 Minimum fraction of samples an entry must have for it to be displayed.
1982 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1982 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1983 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1983 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1984
1984
1985 Only used by the ``stat`` profiler.
1985 Only used by the ``stat`` profiler.
1986
1986
1987 For the ``hotpath`` format, default is ``0.05``.
1987 For the ``hotpath`` format, default is ``0.05``.
1988 For the ``chrome`` format, default is ``0.005``.
1988 For the ``chrome`` format, default is ``0.005``.
1989
1989
1990 The option is unused on other formats.
1990 The option is unused on other formats.
1991
1991
1992 ``showmax``
1992 ``showmax``
1993 Maximum fraction of samples an entry can have before it is ignored in
1993 Maximum fraction of samples an entry can have before it is ignored in
1994 display. Values format is the same as ``showmin``.
1994 display. Values format is the same as ``showmin``.
1995
1995
1996 Only used by the ``stat`` profiler.
1996 Only used by the ``stat`` profiler.
1997
1997
1998 For the ``chrome`` format, default is ``0.999``.
1998 For the ``chrome`` format, default is ``0.999``.
1999
1999
2000 The option is unused on other formats.
2000 The option is unused on other formats.
2001
2001
2002 ``showtime``
2002 ``showtime``
2003 Show time taken as absolute durations, in addition to percentages.
2003 Show time taken as absolute durations, in addition to percentages.
2004 Only used by the ``hotpath`` format.
2004 Only used by the ``hotpath`` format.
2005 (default: true)
2005 (default: true)
2006
2006
2007 ``progress``
2007 ``progress``
2008 ------------
2008 ------------
2009
2009
2010 Mercurial commands can draw progress bars that are as informative as
2010 Mercurial commands can draw progress bars that are as informative as
2011 possible. Some progress bars only offer indeterminate information, while others
2011 possible. Some progress bars only offer indeterminate information, while others
2012 have a definite end point.
2012 have a definite end point.
2013
2013
2014 ``debug``
2014 ``debug``
2015 Whether to print debug info when updating the progress bar. (default: False)
2015 Whether to print debug info when updating the progress bar. (default: False)
2016
2016
2017 ``delay``
2017 ``delay``
2018 Number of seconds (float) before showing the progress bar. (default: 3)
2018 Number of seconds (float) before showing the progress bar. (default: 3)
2019
2019
2020 ``changedelay``
2020 ``changedelay``
2021 Minimum delay before showing a new topic. When set to less than 3 * refresh,
2021 Minimum delay before showing a new topic. When set to less than 3 * refresh,
2022 that value will be used instead. (default: 1)
2022 that value will be used instead. (default: 1)
2023
2023
2024 ``estimateinterval``
2024 ``estimateinterval``
2025 Maximum sampling interval in seconds for speed and estimated time
2025 Maximum sampling interval in seconds for speed and estimated time
2026 calculation. (default: 60)
2026 calculation. (default: 60)
2027
2027
2028 ``refresh``
2028 ``refresh``
2029 Time in seconds between refreshes of the progress bar. (default: 0.1)
2029 Time in seconds between refreshes of the progress bar. (default: 0.1)
2030
2030
2031 ``format``
2031 ``format``
2032 Format of the progress bar.
2032 Format of the progress bar.
2033
2033
2034 Valid entries for the format field are ``topic``, ``bar``, ``number``,
2034 Valid entries for the format field are ``topic``, ``bar``, ``number``,
2035 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
2035 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
2036 last 20 characters of the item, but this can be changed by adding either
2036 last 20 characters of the item, but this can be changed by adding either
2037 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
2037 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
2038 first num characters.
2038 first num characters.
2039
2039
2040 (default: topic bar number estimate)
2040 (default: topic bar number estimate)
2041
2041
2042 ``width``
2042 ``width``
2043 If set, the maximum width of the progress information (that is, min(width,
2043 If set, the maximum width of the progress information (that is, min(width,
2044 term width) will be used).
2044 term width) will be used).
2045
2045
2046 ``clear-complete``
2046 ``clear-complete``
2047 Clear the progress bar after it's done. (default: True)
2047 Clear the progress bar after it's done. (default: True)
2048
2048
2049 ``disable``
2049 ``disable``
2050 If true, don't show a progress bar.
2050 If true, don't show a progress bar.
2051
2051
2052 ``assume-tty``
2052 ``assume-tty``
2053 If true, ALWAYS show a progress bar, unless disable is given.
2053 If true, ALWAYS show a progress bar, unless disable is given.
2054
2054
2055 ``rebase``
2055 ``rebase``
2056 ----------
2056 ----------
2057
2057
2058 ``evolution.allowdivergence``
2058 ``evolution.allowdivergence``
2059 Default to False, when True allow creating divergence when performing
2059 Default to False, when True allow creating divergence when performing
2060 rebase of obsolete changesets.
2060 rebase of obsolete changesets.
2061
2061
2062 ``revsetalias``
2062 ``revsetalias``
2063 ---------------
2063 ---------------
2064
2064
2065 Alias definitions for revsets. See :hg:`help revsets` for details.
2065 Alias definitions for revsets. See :hg:`help revsets` for details.
2066
2066
2067 ``rewrite``
2067 ``rewrite``
2068 -----------
2068 -----------
2069
2069
2070 ``backup-bundle``
2070 ``backup-bundle``
2071 Whether to save stripped changesets to a bundle file. (default: True)
2071 Whether to save stripped changesets to a bundle file. (default: True)
2072
2072
2073 ``update-timestamp``
2073 ``update-timestamp``
2074 If true, updates the date and time of the changeset to current. It is only
2074 If true, updates the date and time of the changeset to current. It is only
2075 applicable for `hg amend`, `hg commit --amend` and `hg uncommit` in the
2075 applicable for `hg amend`, `hg commit --amend` and `hg uncommit` in the
2076 current version.
2076 current version.
2077
2077
2078 ``empty-successor``
2078 ``empty-successor``
2079
2079
2080 Control what happens with empty successors that are the result of rewrite
2080 Control what happens with empty successors that are the result of rewrite
2081 operations. If set to ``skip``, the successor is not created. If set to
2081 operations. If set to ``skip``, the successor is not created. If set to
2082 ``keep``, the empty successor is created and kept.
2082 ``keep``, the empty successor is created and kept.
2083
2083
2084 Currently, only the rebase and absorb commands consider this configuration.
2084 Currently, only the rebase and absorb commands consider this configuration.
2085 (EXPERIMENTAL)
2085 (EXPERIMENTAL)
2086
2086
2087 ``share``
2087 ``share``
2088 ---------
2088 ---------
2089
2089
2090 ``safe-mismatch.source-safe``
2090 ``safe-mismatch.source-safe``
2091
2092 Controls what happens when the shared repository does not use the
2091 Controls what happens when the shared repository does not use the
2093 share-safe mechanism but its source repository does.
2092 share-safe mechanism but its source repository does.
2094
2093
2095 Possible values are `abort` (default), `allow`, `upgrade-abort` and
2094 Possible values are `abort` (default), `allow`, `upgrade-abort` and
2096 `upgrade-abort`.
2095 `upgrade-allow`.
2097
2096
2098 ``abort``
2097 ``abort``
2099 Disallows running any command and aborts
2098 Disallows running any command and aborts
2100 ``allow``
2099 ``allow``
2101 Respects the feature presence in the share source
2100 Respects the feature presence in the share source
2102 ``upgrade-abort``
2101 ``upgrade-abort``
2103 tries to upgrade the share to use share-safe; if it fails, aborts
2102 tries to upgrade the share to use share-safe; if it fails, aborts
2104 ``upgrade-allow``
2103 ``upgrade-allow``
2105 tries to upgrade the share; if it fails, continue by
2104 tries to upgrade the share; if it fails, continue by
2106 respecting the share source setting
2105 respecting the share source setting
2107
2106
2108 Check :hg:`help config format.use-share-safe` for details about the
2107 Check :hg:`help config.format.use-share-safe` for details about the
2109 share-safe feature.
2108 share-safe feature.
2110
2109
2111 ``safe-mismatch.source-safe.warn``
2110 ``safe-mismatch.source-safe.warn``
2112 Shows a warning on operations if the shared repository does not use
2111 Shows a warning on operations if the shared repository does not use
2113 share-safe, but the source repository does.
2112 share-safe, but the source repository does.
2114 (default: True)
2113 (default: True)
2115
2114
2116 ``safe-mismatch.source-not-safe``
2115 ``safe-mismatch.source-not-safe``
2117
2118 Controls what happens when the shared repository uses the share-safe
2116 Controls what happens when the shared repository uses the share-safe
2119 mechanism but its source does not.
2117 mechanism but its source does not.
2120
2118
2121 Possible values are `abort` (default), `allow`, `downgrade-abort` and
2119 Possible values are `abort` (default), `allow`, `downgrade-abort` and
2122 `downgrade-abort`.
2120 `downgrade-allow`.
2123
2121
2124 ``abort``
2122 ``abort``
2125 Disallows running any command and aborts
2123 Disallows running any command and aborts
2126 ``allow``
2124 ``allow``
2127 Respects the feature presence in the share source
2125 Respects the feature presence in the share source
2128 ``downgrade-abort``
2126 ``downgrade-abort``
2129 tries to downgrade the share to not use share-safe; if it fails, aborts
2127 tries to downgrade the share to not use share-safe; if it fails, aborts
2130 ``downgrade-allow``
2128 ``downgrade-allow``
2131 tries to downgrade the share to not use share-safe;
2129 tries to downgrade the share to not use share-safe;
2132 if it fails, continue by respecting the shared source setting
2130 if it fails, continue by respecting the shared source setting
2133
2131
2134 Check :hg:`help config format.use-share-safe` for details about the
2132 Check :hg:`help config.format.use-share-safe` for details about the
2135 share-safe feature.
2133 share-safe feature.
2136
2134
2137 ``safe-mismatch.source-not-safe.warn``
2135 ``safe-mismatch.source-not-safe.warn``
2138 Shows a warning on operations if the shared repository uses share-safe,
2136 Shows a warning on operations if the shared repository uses share-safe,
2139 but the source repository does not.
2137 but the source repository does not.
2140 (default: True)
2138 (default: True)
2141
2139
2142 ``storage``
2140 ``storage``
2143 -----------
2141 -----------
2144
2142
2145 Control the strategy Mercurial uses internally to store history. Options in this
2143 Control the strategy Mercurial uses internally to store history. Options in this
2146 category impact performance and repository size.
2144 category impact performance and repository size.
2147
2145
2148 ``revlog.issue6528.fix-incoming``
2146 ``revlog.issue6528.fix-incoming``
2149 Version 5.8 of Mercurial had a bug leading to altering the parent of file
2147 Version 5.8 of Mercurial had a bug leading to altering the parent of file
2150 revision with copy information (or any other metadata) on exchange. This
2148 revision with copy information (or any other metadata) on exchange. This
2151 leads to the copy metadata to be overlooked by various internal logic. The
2149 leads to the copy metadata to be overlooked by various internal logic. The
2152 issue was fixed in Mercurial 5.8.1.
2150 issue was fixed in Mercurial 5.8.1.
2153 (See https://bz.mercurial-scm.org/show_bug.cgi?id=6528 for details)
2151 (See https://bz.mercurial-scm.org/show_bug.cgi?id=6528 for details)
2154
2152
2155 As a result Mercurial is now checking and fixing incoming file revisions to
2153 As a result Mercurial is now checking and fixing incoming file revisions to
2156 make sure there parents are in the right order. This behavior can be
2154 make sure there parents are in the right order. This behavior can be
2157 disabled by setting this option to `no`. This apply to revisions added
2155 disabled by setting this option to `no`. This apply to revisions added
2158 through push, pull, clone and unbundle.
2156 through push, pull, clone and unbundle.
2159
2157
2160 To fix affected revisions that already exist within the repository, one can
2158 To fix affected revisions that already exist within the repository, one can
2161 use :hg:`debug-repair-issue-6528`.
2159 use :hg:`debug-repair-issue-6528`.
2162
2160
2163 ``revlog.optimize-delta-parent-choice``
2161 ``revlog.optimize-delta-parent-choice``
2164 When storing a merge revision, both parents will be equally considered as
2162 When storing a merge revision, both parents will be equally considered as
2165 a possible delta base. This results in better delta selection and improved
2163 a possible delta base. This results in better delta selection and improved
2166 revlog compression. This option is enabled by default.
2164 revlog compression. This option is enabled by default.
2167
2165
2168 Turning this option off can result in large increase of repository size for
2166 Turning this option off can result in large increase of repository size for
2169 repository with many merges.
2167 repository with many merges.
2170
2168
2171 ``revlog.persistent-nodemap.mmap``
2169 ``revlog.persistent-nodemap.mmap``
2172 Whether to use the Operating System "memory mapping" feature (when
2170 Whether to use the Operating System "memory mapping" feature (when
2173 possible) to access the persistent nodemap data. This improve performance
2171 possible) to access the persistent nodemap data. This improve performance
2174 and reduce memory pressure.
2172 and reduce memory pressure.
2175
2173
2176 Default to True.
2174 Default to True.
2177
2175
2178 For details on the "persistent-nodemap" feature, see:
2176 For details on the "persistent-nodemap" feature, see:
2179 :hg:`help config format.use-persistent-nodemap`.
2177 :hg:`help config.format.use-persistent-nodemap`.
2180
2178
2181 ``revlog.persistent-nodemap.slow-path``
2179 ``revlog.persistent-nodemap.slow-path``
2182 Control the behavior of Merucrial when using a repository with "persistent"
2180 Control the behavior of Merucrial when using a repository with "persistent"
2183 nodemap with an installation of Mercurial without a fast implementation for
2181 nodemap with an installation of Mercurial without a fast implementation for
2184 the feature:
2182 the feature:
2185
2183
2186 ``allow``: Silently use the slower implementation to access the repository.
2184 ``allow``: Silently use the slower implementation to access the repository.
2187 ``warn``: Warn, but use the slower implementation to access the repository.
2185 ``warn``: Warn, but use the slower implementation to access the repository.
2188 ``abort``: Prevent access to such repositories. (This is the default)
2186 ``abort``: Prevent access to such repositories. (This is the default)
2189
2187
2190 For details on the "persistent-nodemap" feature, see:
2188 For details on the "persistent-nodemap" feature, see:
2191 :hg:`help config format.use-persistent-nodemap`.
2189 :hg:`help config.format.use-persistent-nodemap`.
2192
2190
2193 ``revlog.reuse-external-delta-parent``
2191 ``revlog.reuse-external-delta-parent``
2194 Control the order in which delta parents are considered when adding new
2192 Control the order in which delta parents are considered when adding new
2195 revisions from an external source.
2193 revisions from an external source.
2196 (typically: apply bundle from `hg pull` or `hg push`).
2194 (typically: apply bundle from `hg pull` or `hg push`).
2197
2195
2198 New revisions are usually provided as a delta against other revisions. By
2196 New revisions are usually provided as a delta against other revisions. By
2199 default, Mercurial will try to reuse this delta first, therefore using the
2197 default, Mercurial will try to reuse this delta first, therefore using the
2200 same "delta parent" as the source. Directly using delta's from the source
2198 same "delta parent" as the source. Directly using delta's from the source
2201 reduces CPU usage and usually speeds up operation. However, in some case,
2199 reduces CPU usage and usually speeds up operation. However, in some case,
2202 the source might have sub-optimal delta bases and forcing their reevaluation
2200 the source might have sub-optimal delta bases and forcing their reevaluation
2203 is useful. For example, pushes from an old client could have sub-optimal
2201 is useful. For example, pushes from an old client could have sub-optimal
2204 delta's parent that the server want to optimize. (lack of general delta, bad
2202 delta's parent that the server want to optimize. (lack of general delta, bad
2205 parents, choice, lack of sparse-revlog, etc).
2203 parents, choice, lack of sparse-revlog, etc).
2206
2204
2207 This option is enabled by default. Turning it off will ensure bad delta
2205 This option is enabled by default. Turning it off will ensure bad delta
2208 parent choices from older client do not propagate to this repository, at
2206 parent choices from older client do not propagate to this repository, at
2209 the cost of a small increase in CPU consumption.
2207 the cost of a small increase in CPU consumption.
2210
2208
2211 Note: this option only control the order in which delta parents are
2209 Note: this option only control the order in which delta parents are
2212 considered. Even when disabled, the existing delta from the source will be
2210 considered. Even when disabled, the existing delta from the source will be
2213 reused if the same delta parent is selected.
2211 reused if the same delta parent is selected.
2214
2212
2215 ``revlog.reuse-external-delta``
2213 ``revlog.reuse-external-delta``
2216 Control the reuse of delta from external source.
2214 Control the reuse of delta from external source.
2217 (typically: apply bundle from `hg pull` or `hg push`).
2215 (typically: apply bundle from `hg pull` or `hg push`).
2218
2216
2219 New revisions are usually provided as a delta against another revision. By
2217 New revisions are usually provided as a delta against another revision. By
2220 default, Mercurial will not recompute the same delta again, trusting
2218 default, Mercurial will not recompute the same delta again, trusting
2221 externally provided deltas. There have been rare cases of small adjustment
2219 externally provided deltas. There have been rare cases of small adjustment
2222 to the diffing algorithm in the past. So in some rare case, recomputing
2220 to the diffing algorithm in the past. So in some rare case, recomputing
2223 delta provided by ancient clients can provides better results. Disabling
2221 delta provided by ancient clients can provides better results. Disabling
2224 this option means going through a full delta recomputation for all incoming
2222 this option means going through a full delta recomputation for all incoming
2225 revisions. It means a large increase in CPU usage and will slow operations
2223 revisions. It means a large increase in CPU usage and will slow operations
2226 down.
2224 down.
2227
2225
2228 This option is enabled by default. When disabled, it also disables the
2226 This option is enabled by default. When disabled, it also disables the
2229 related ``storage.revlog.reuse-external-delta-parent`` option.
2227 related ``storage.revlog.reuse-external-delta-parent`` option.
2230
2228
2231 ``revlog.zlib.level``
2229 ``revlog.zlib.level``
2232 Zlib compression level used when storing data into the repository. Accepted
2230 Zlib compression level used when storing data into the repository. Accepted
2233 Value range from 1 (lowest compression) to 9 (highest compression). Zlib
2231 Value range from 1 (lowest compression) to 9 (highest compression). Zlib
2234 default value is 6.
2232 default value is 6.
2235
2233
2236
2234
2237 ``revlog.zstd.level``
2235 ``revlog.zstd.level``
2238 zstd compression level used when storing data into the repository. Accepted
2236 zstd compression level used when storing data into the repository. Accepted
2239 Value range from 1 (lowest compression) to 22 (highest compression).
2237 Value range from 1 (lowest compression) to 22 (highest compression).
2240 (default 3)
2238 (default 3)
2241
2239
2242 ``server``
2240 ``server``
2243 ----------
2241 ----------
2244
2242
2245 Controls generic server settings.
2243 Controls generic server settings.
2246
2244
2247 ``bookmarks-pushkey-compat``
2245 ``bookmarks-pushkey-compat``
2248 Trigger pushkey hook when being pushed bookmark updates. This config exist
2246 Trigger pushkey hook when being pushed bookmark updates. This config exist
2249 for compatibility purpose (default to True)
2247 for compatibility purpose (default to True)
2250
2248
2251 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
2249 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
2252 movement we recommend you migrate them to ``txnclose-bookmark`` and
2250 movement we recommend you migrate them to ``txnclose-bookmark`` and
2253 ``pretxnclose-bookmark``.
2251 ``pretxnclose-bookmark``.
2254
2252
2255 ``compressionengines``
2253 ``compressionengines``
2256 List of compression engines and their relative priority to advertise
2254 List of compression engines and their relative priority to advertise
2257 to clients.
2255 to clients.
2258
2256
2259 The order of compression engines determines their priority, the first
2257 The order of compression engines determines their priority, the first
2260 having the highest priority. If a compression engine is not listed
2258 having the highest priority. If a compression engine is not listed
2261 here, it won't be advertised to clients.
2259 here, it won't be advertised to clients.
2262
2260
2263 If not set (the default), built-in defaults are used. Run
2261 If not set (the default), built-in defaults are used. Run
2264 :hg:`debuginstall` to list available compression engines and their
2262 :hg:`debuginstall` to list available compression engines and their
2265 default wire protocol priority.
2263 default wire protocol priority.
2266
2264
2267 Older Mercurial clients only support zlib compression and this setting
2265 Older Mercurial clients only support zlib compression and this setting
2268 has no effect for legacy clients.
2266 has no effect for legacy clients.
2269
2267
2270 ``uncompressed``
2268 ``uncompressed``
2271 Whether to allow clients to clone a repository using the
2269 Whether to allow clients to clone a repository using the
2272 uncompressed streaming protocol. This transfers about 40% more
2270 uncompressed streaming protocol. This transfers about 40% more
2273 data than a regular clone, but uses less memory and CPU on both
2271 data than a regular clone, but uses less memory and CPU on both
2274 server and client. Over a LAN (100 Mbps or better) or a very fast
2272 server and client. Over a LAN (100 Mbps or better) or a very fast
2275 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
2273 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
2276 regular clone. Over most WAN connections (anything slower than
2274 regular clone. Over most WAN connections (anything slower than
2277 about 6 Mbps), uncompressed streaming is slower, because of the
2275 about 6 Mbps), uncompressed streaming is slower, because of the
2278 extra data transfer overhead. This mode will also temporarily hold
2276 extra data transfer overhead. This mode will also temporarily hold
2279 the write lock while determining what data to transfer.
2277 the write lock while determining what data to transfer.
2280 (default: True)
2278 (default: True)
2281
2279
2282 ``uncompressedallowsecret``
2280 ``uncompressedallowsecret``
2283 Whether to allow stream clones when the repository contains secret
2281 Whether to allow stream clones when the repository contains secret
2284 changesets. (default: False)
2282 changesets. (default: False)
2285
2283
2286 ``preferuncompressed``
2284 ``preferuncompressed``
2287 When set, clients will try to use the uncompressed streaming
2285 When set, clients will try to use the uncompressed streaming
2288 protocol. (default: False)
2286 protocol. (default: False)
2289
2287
2290 ``disablefullbundle``
2288 ``disablefullbundle``
2291 When set, servers will refuse attempts to do pull-based clones.
2289 When set, servers will refuse attempts to do pull-based clones.
2292 If this option is set, ``preferuncompressed`` and/or clone bundles
2290 If this option is set, ``preferuncompressed`` and/or clone bundles
2293 are highly recommended. Partial clones will still be allowed.
2291 are highly recommended. Partial clones will still be allowed.
2294 (default: False)
2292 (default: False)
2295
2293
2296 ``streamunbundle``
2294 ``streamunbundle``
2297 When set, servers will apply data sent from the client directly,
2295 When set, servers will apply data sent from the client directly,
2298 otherwise it will be written to a temporary file first. This option
2296 otherwise it will be written to a temporary file first. This option
2299 effectively prevents concurrent pushes.
2297 effectively prevents concurrent pushes.
2300
2298
2301 ``pullbundle``
2299 ``pullbundle``
2302 When set, the server will check pullbundle.manifest for bundles
2300 When set, the server will check pullbundle.manifest for bundles
2303 covering the requested heads and common nodes. The first matching
2301 covering the requested heads and common nodes. The first matching
2304 entry will be streamed to the client.
2302 entry will be streamed to the client.
2305
2303
2306 For HTTP transport, the stream will still use zlib compression
2304 For HTTP transport, the stream will still use zlib compression
2307 for older clients.
2305 for older clients.
2308
2306
2309 ``concurrent-push-mode``
2307 ``concurrent-push-mode``
2310 Level of allowed race condition between two pushing clients.
2308 Level of allowed race condition between two pushing clients.
2311
2309
2312 - 'strict': push is abort if another client touched the repository
2310 - 'strict': push is abort if another client touched the repository
2313 while the push was preparing.
2311 while the push was preparing.
2314 - 'check-related': push is only aborted if it affects head that got also
2312 - 'check-related': push is only aborted if it affects head that got also
2315 affected while the push was preparing. (default since 5.4)
2313 affected while the push was preparing. (default since 5.4)
2316
2314
2317 'check-related' only takes effect for compatible clients (version
2315 'check-related' only takes effect for compatible clients (version
2318 4.3 and later). Older clients will use 'strict'.
2316 4.3 and later). Older clients will use 'strict'.
2319
2317
2320 ``validate``
2318 ``validate``
2321 Whether to validate the completeness of pushed changesets by
2319 Whether to validate the completeness of pushed changesets by
2322 checking that all new file revisions specified in manifests are
2320 checking that all new file revisions specified in manifests are
2323 present. (default: False)
2321 present. (default: False)
2324
2322
2325 ``maxhttpheaderlen``
2323 ``maxhttpheaderlen``
2326 Instruct HTTP clients not to send request headers longer than this
2324 Instruct HTTP clients not to send request headers longer than this
2327 many bytes. (default: 1024)
2325 many bytes. (default: 1024)
2328
2326
2329 ``bundle1``
2327 ``bundle1``
2330 Whether to allow clients to push and pull using the legacy bundle1
2328 Whether to allow clients to push and pull using the legacy bundle1
2331 exchange format. (default: True)
2329 exchange format. (default: True)
2332
2330
2333 ``bundle1gd``
2331 ``bundle1gd``
2334 Like ``bundle1`` but only used if the repository is using the
2332 Like ``bundle1`` but only used if the repository is using the
2335 *generaldelta* storage format. (default: True)
2333 *generaldelta* storage format. (default: True)
2336
2334
2337 ``bundle1.push``
2335 ``bundle1.push``
2338 Whether to allow clients to push using the legacy bundle1 exchange
2336 Whether to allow clients to push using the legacy bundle1 exchange
2339 format. (default: True)
2337 format. (default: True)
2340
2338
2341 ``bundle1gd.push``
2339 ``bundle1gd.push``
2342 Like ``bundle1.push`` but only used if the repository is using the
2340 Like ``bundle1.push`` but only used if the repository is using the
2343 *generaldelta* storage format. (default: True)
2341 *generaldelta* storage format. (default: True)
2344
2342
2345 ``bundle1.pull``
2343 ``bundle1.pull``
2346 Whether to allow clients to pull using the legacy bundle1 exchange
2344 Whether to allow clients to pull using the legacy bundle1 exchange
2347 format. (default: True)
2345 format. (default: True)
2348
2346
2349 ``bundle1gd.pull``
2347 ``bundle1gd.pull``
2350 Like ``bundle1.pull`` but only used if the repository is using the
2348 Like ``bundle1.pull`` but only used if the repository is using the
2351 *generaldelta* storage format. (default: True)
2349 *generaldelta* storage format. (default: True)
2352
2350
2353 Large repositories using the *generaldelta* storage format should
2351 Large repositories using the *generaldelta* storage format should
2354 consider setting this option because converting *generaldelta*
2352 consider setting this option because converting *generaldelta*
2355 repositories to the exchange format required by the bundle1 data
2353 repositories to the exchange format required by the bundle1 data
2356 format can consume a lot of CPU.
2354 format can consume a lot of CPU.
2357
2355
2358 ``bundle2.stream``
2356 ``bundle2.stream``
2359 Whether to allow clients to pull using the bundle2 streaming protocol.
2357 Whether to allow clients to pull using the bundle2 streaming protocol.
2360 (default: True)
2358 (default: True)
2361
2359
2362 ``zliblevel``
2360 ``zliblevel``
2363 Integer between ``-1`` and ``9`` that controls the zlib compression level
2361 Integer between ``-1`` and ``9`` that controls the zlib compression level
2364 for wire protocol commands that send zlib compressed output (notably the
2362 for wire protocol commands that send zlib compressed output (notably the
2365 commands that send repository history data).
2363 commands that send repository history data).
2366
2364
2367 The default (``-1``) uses the default zlib compression level, which is
2365 The default (``-1``) uses the default zlib compression level, which is
2368 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
2366 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
2369 maximum compression.
2367 maximum compression.
2370
2368
2371 Setting this option allows server operators to make trade-offs between
2369 Setting this option allows server operators to make trade-offs between
2372 bandwidth and CPU used. Lowering the compression lowers CPU utilization
2370 bandwidth and CPU used. Lowering the compression lowers CPU utilization
2373 but sends more bytes to clients.
2371 but sends more bytes to clients.
2374
2372
2375 This option only impacts the HTTP server.
2373 This option only impacts the HTTP server.
2376
2374
2377 ``zstdlevel``
2375 ``zstdlevel``
2378 Integer between ``1`` and ``22`` that controls the zstd compression level
2376 Integer between ``1`` and ``22`` that controls the zstd compression level
2379 for wire protocol commands. ``1`` is the minimal amount of compression and
2377 for wire protocol commands. ``1`` is the minimal amount of compression and
2380 ``22`` is the highest amount of compression.
2378 ``22`` is the highest amount of compression.
2381
2379
2382 The default (``3``) should be significantly faster than zlib while likely
2380 The default (``3``) should be significantly faster than zlib while likely
2383 delivering better compression ratios.
2381 delivering better compression ratios.
2384
2382
2385 This option only impacts the HTTP server.
2383 This option only impacts the HTTP server.
2386
2384
2387 See also ``server.zliblevel``.
2385 See also ``server.zliblevel``.
2388
2386
2389 ``view``
2387 ``view``
2390 Repository filter used when exchanging revisions with the peer.
2388 Repository filter used when exchanging revisions with the peer.
2391
2389
2392 The default view (``served``) excludes secret and hidden changesets.
2390 The default view (``served``) excludes secret and hidden changesets.
2393 Another useful value is ``immutable`` (no draft, secret or hidden
2391 Another useful value is ``immutable`` (no draft, secret or hidden
2394 changesets). (EXPERIMENTAL)
2392 changesets). (EXPERIMENTAL)
2395
2393
2396 ``smtp``
2394 ``smtp``
2397 --------
2395 --------
2398
2396
2399 Configuration for extensions that need to send email messages.
2397 Configuration for extensions that need to send email messages.
2400
2398
2401 ``host``
2399 ``host``
2402 Host name of mail server, e.g. "mail.example.com".
2400 Host name of mail server, e.g. "mail.example.com".
2403
2401
2404 ``port``
2402 ``port``
2405 Optional. Port to connect to on mail server. (default: 465 if
2403 Optional. Port to connect to on mail server. (default: 465 if
2406 ``tls`` is smtps; 25 otherwise)
2404 ``tls`` is smtps; 25 otherwise)
2407
2405
2408 ``tls``
2406 ``tls``
2409 Optional. Method to enable TLS when connecting to mail server: starttls,
2407 Optional. Method to enable TLS when connecting to mail server: starttls,
2410 smtps or none. (default: none)
2408 smtps or none. (default: none)
2411
2409
2412 ``username``
2410 ``username``
2413 Optional. User name for authenticating with the SMTP server.
2411 Optional. User name for authenticating with the SMTP server.
2414 (default: None)
2412 (default: None)
2415
2413
2416 ``password``
2414 ``password``
2417 Optional. Password for authenticating with the SMTP server. If not
2415 Optional. Password for authenticating with the SMTP server. If not
2418 specified, interactive sessions will prompt the user for a
2416 specified, interactive sessions will prompt the user for a
2419 password; non-interactive sessions will fail. (default: None)
2417 password; non-interactive sessions will fail. (default: None)
2420
2418
2421 ``local_hostname``
2419 ``local_hostname``
2422 Optional. The hostname that the sender can use to identify
2420 Optional. The hostname that the sender can use to identify
2423 itself to the MTA.
2421 itself to the MTA.
2424
2422
2425
2423
2426 ``subpaths``
2424 ``subpaths``
2427 ------------
2425 ------------
2428
2426
2429 Subrepository source URLs can go stale if a remote server changes name
2427 Subrepository source URLs can go stale if a remote server changes name
2430 or becomes temporarily unavailable. This section lets you define
2428 or becomes temporarily unavailable. This section lets you define
2431 rewrite rules of the form::
2429 rewrite rules of the form::
2432
2430
2433 <pattern> = <replacement>
2431 <pattern> = <replacement>
2434
2432
2435 where ``pattern`` is a regular expression matching a subrepository
2433 where ``pattern`` is a regular expression matching a subrepository
2436 source URL and ``replacement`` is the replacement string used to
2434 source URL and ``replacement`` is the replacement string used to
2437 rewrite it. Groups can be matched in ``pattern`` and referenced in
2435 rewrite it. Groups can be matched in ``pattern`` and referenced in
2438 ``replacements``. For instance::
2436 ``replacements``. For instance::
2439
2437
2440 http://server/(.*)-hg/ = http://hg.server/\1/
2438 http://server/(.*)-hg/ = http://hg.server/\1/
2441
2439
2442 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
2440 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
2443
2441
2444 Relative subrepository paths are first made absolute, and the
2442 Relative subrepository paths are first made absolute, and the
2445 rewrite rules are then applied on the full (absolute) path. If ``pattern``
2443 rewrite rules are then applied on the full (absolute) path. If ``pattern``
2446 doesn't match the full path, an attempt is made to apply it on the
2444 doesn't match the full path, an attempt is made to apply it on the
2447 relative path alone. The rules are applied in definition order.
2445 relative path alone. The rules are applied in definition order.
2448
2446
2449 ``subrepos``
2447 ``subrepos``
2450 ------------
2448 ------------
2451
2449
2452 This section contains options that control the behavior of the
2450 This section contains options that control the behavior of the
2453 subrepositories feature. See also :hg:`help subrepos`.
2451 subrepositories feature. See also :hg:`help subrepos`.
2454
2452
2455 Security note: auditing in Mercurial is known to be insufficient to
2453 Security note: auditing in Mercurial is known to be insufficient to
2456 prevent clone-time code execution with carefully constructed Git
2454 prevent clone-time code execution with carefully constructed Git
2457 subrepos. It is unknown if a similar detect is present in Subversion
2455 subrepos. It is unknown if a similar detect is present in Subversion
2458 subrepos. Both Git and Subversion subrepos are disabled by default
2456 subrepos. Both Git and Subversion subrepos are disabled by default
2459 out of security concerns. These subrepo types can be enabled using
2457 out of security concerns. These subrepo types can be enabled using
2460 the respective options below.
2458 the respective options below.
2461
2459
2462 ``allowed``
2460 ``allowed``
2463 Whether subrepositories are allowed in the working directory.
2461 Whether subrepositories are allowed in the working directory.
2464
2462
2465 When false, commands involving subrepositories (like :hg:`update`)
2463 When false, commands involving subrepositories (like :hg:`update`)
2466 will fail for all subrepository types.
2464 will fail for all subrepository types.
2467 (default: true)
2465 (default: true)
2468
2466
2469 ``hg:allowed``
2467 ``hg:allowed``
2470 Whether Mercurial subrepositories are allowed in the working
2468 Whether Mercurial subrepositories are allowed in the working
2471 directory. This option only has an effect if ``subrepos.allowed``
2469 directory. This option only has an effect if ``subrepos.allowed``
2472 is true.
2470 is true.
2473 (default: true)
2471 (default: true)
2474
2472
2475 ``git:allowed``
2473 ``git:allowed``
2476 Whether Git subrepositories are allowed in the working directory.
2474 Whether Git subrepositories are allowed in the working directory.
2477 This option only has an effect if ``subrepos.allowed`` is true.
2475 This option only has an effect if ``subrepos.allowed`` is true.
2478
2476
2479 See the security note above before enabling Git subrepos.
2477 See the security note above before enabling Git subrepos.
2480 (default: false)
2478 (default: false)
2481
2479
2482 ``svn:allowed``
2480 ``svn:allowed``
2483 Whether Subversion subrepositories are allowed in the working
2481 Whether Subversion subrepositories are allowed in the working
2484 directory. This option only has an effect if ``subrepos.allowed``
2482 directory. This option only has an effect if ``subrepos.allowed``
2485 is true.
2483 is true.
2486
2484
2487 See the security note above before enabling Subversion subrepos.
2485 See the security note above before enabling Subversion subrepos.
2488 (default: false)
2486 (default: false)
2489
2487
2490 ``templatealias``
2488 ``templatealias``
2491 -----------------
2489 -----------------
2492
2490
2493 Alias definitions for templates. See :hg:`help templates` for details.
2491 Alias definitions for templates. See :hg:`help templates` for details.
2494
2492
2495 ``templates``
2493 ``templates``
2496 -------------
2494 -------------
2497
2495
2498 Use the ``[templates]`` section to define template strings.
2496 Use the ``[templates]`` section to define template strings.
2499 See :hg:`help templates` for details.
2497 See :hg:`help templates` for details.
2500
2498
2501 ``trusted``
2499 ``trusted``
2502 -----------
2500 -----------
2503
2501
2504 Mercurial will not use the settings in the
2502 Mercurial will not use the settings in the
2505 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2503 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2506 user or to a trusted group, as various hgrc features allow arbitrary
2504 user or to a trusted group, as various hgrc features allow arbitrary
2507 commands to be run. This issue is often encountered when configuring
2505 commands to be run. This issue is often encountered when configuring
2508 hooks or extensions for shared repositories or servers. However,
2506 hooks or extensions for shared repositories or servers. However,
2509 the web interface will use some safe settings from the ``[web]``
2507 the web interface will use some safe settings from the ``[web]``
2510 section.
2508 section.
2511
2509
2512 This section specifies what users and groups are trusted. The
2510 This section specifies what users and groups are trusted. The
2513 current user is always trusted. To trust everybody, list a user or a
2511 current user is always trusted. To trust everybody, list a user or a
2514 group with name ``*``. These settings must be placed in an
2512 group with name ``*``. These settings must be placed in an
2515 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2513 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2516 user or service running Mercurial.
2514 user or service running Mercurial.
2517
2515
2518 ``users``
2516 ``users``
2519 Comma-separated list of trusted users.
2517 Comma-separated list of trusted users.
2520
2518
2521 ``groups``
2519 ``groups``
2522 Comma-separated list of trusted groups.
2520 Comma-separated list of trusted groups.
2523
2521
2524
2522
2525 ``ui``
2523 ``ui``
2526 ------
2524 ------
2527
2525
2528 User interface controls.
2526 User interface controls.
2529
2527
2530 ``archivemeta``
2528 ``archivemeta``
2531 Whether to include the .hg_archival.txt file containing meta data
2529 Whether to include the .hg_archival.txt file containing meta data
2532 (hashes for the repository base and for tip) in archives created
2530 (hashes for the repository base and for tip) in archives created
2533 by the :hg:`archive` command or downloaded via hgweb.
2531 by the :hg:`archive` command or downloaded via hgweb.
2534 (default: True)
2532 (default: True)
2535
2533
2536 ``askusername``
2534 ``askusername``
2537 Whether to prompt for a username when committing. If True, and
2535 Whether to prompt for a username when committing. If True, and
2538 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2536 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2539 be prompted to enter a username. If no username is entered, the
2537 be prompted to enter a username. If no username is entered, the
2540 default ``USER@HOST`` is used instead.
2538 default ``USER@HOST`` is used instead.
2541 (default: False)
2539 (default: False)
2542
2540
2543 ``clonebundles``
2541 ``clonebundles``
2544 Whether the "clone bundles" feature is enabled.
2542 Whether the "clone bundles" feature is enabled.
2545
2543
2546 When enabled, :hg:`clone` may download and apply a server-advertised
2544 When enabled, :hg:`clone` may download and apply a server-advertised
2547 bundle file from a URL instead of using the normal exchange mechanism.
2545 bundle file from a URL instead of using the normal exchange mechanism.
2548
2546
2549 This can likely result in faster and more reliable clones.
2547 This can likely result in faster and more reliable clones.
2550
2548
2551 (default: True)
2549 (default: True)
2552
2550
2553 ``clonebundlefallback``
2551 ``clonebundlefallback``
2554 Whether failure to apply an advertised "clone bundle" from a server
2552 Whether failure to apply an advertised "clone bundle" from a server
2555 should result in fallback to a regular clone.
2553 should result in fallback to a regular clone.
2556
2554
2557 This is disabled by default because servers advertising "clone
2555 This is disabled by default because servers advertising "clone
2558 bundles" often do so to reduce server load. If advertised bundles
2556 bundles" often do so to reduce server load. If advertised bundles
2559 start mass failing and clients automatically fall back to a regular
2557 start mass failing and clients automatically fall back to a regular
2560 clone, this would add significant and unexpected load to the server
2558 clone, this would add significant and unexpected load to the server
2561 since the server is expecting clone operations to be offloaded to
2559 since the server is expecting clone operations to be offloaded to
2562 pre-generated bundles. Failing fast (the default behavior) ensures
2560 pre-generated bundles. Failing fast (the default behavior) ensures
2563 clients don't overwhelm the server when "clone bundle" application
2561 clients don't overwhelm the server when "clone bundle" application
2564 fails.
2562 fails.
2565
2563
2566 (default: False)
2564 (default: False)
2567
2565
2568 ``clonebundleprefers``
2566 ``clonebundleprefers``
2569 Defines preferences for which "clone bundles" to use.
2567 Defines preferences for which "clone bundles" to use.
2570
2568
2571 Servers advertising "clone bundles" may advertise multiple available
2569 Servers advertising "clone bundles" may advertise multiple available
2572 bundles. Each bundle may have different attributes, such as the bundle
2570 bundles. Each bundle may have different attributes, such as the bundle
2573 type and compression format. This option is used to prefer a particular
2571 type and compression format. This option is used to prefer a particular
2574 bundle over another.
2572 bundle over another.
2575
2573
2576 The following keys are defined by Mercurial:
2574 The following keys are defined by Mercurial:
2577
2575
2578 BUNDLESPEC
2576 BUNDLESPEC
2579 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2577 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2580 e.g. ``gzip-v2`` or ``bzip2-v1``.
2578 e.g. ``gzip-v2`` or ``bzip2-v1``.
2581
2579
2582 COMPRESSION
2580 COMPRESSION
2583 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2581 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2584
2582
2585 Server operators may define custom keys.
2583 Server operators may define custom keys.
2586
2584
2587 Example values: ``COMPRESSION=bzip2``,
2585 Example values: ``COMPRESSION=bzip2``,
2588 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2586 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2589
2587
2590 By default, the first bundle advertised by the server is used.
2588 By default, the first bundle advertised by the server is used.
2591
2589
2592 ``color``
2590 ``color``
2593 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2591 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2594 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2592 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2595 seems possible. See :hg:`help color` for details.
2593 seems possible. See :hg:`help color` for details.
2596
2594
2597 ``commitsubrepos``
2595 ``commitsubrepos``
2598 Whether to commit modified subrepositories when committing the
2596 Whether to commit modified subrepositories when committing the
2599 parent repository. If False and one subrepository has uncommitted
2597 parent repository. If False and one subrepository has uncommitted
2600 changes, abort the commit.
2598 changes, abort the commit.
2601 (default: False)
2599 (default: False)
2602
2600
2603 ``debug``
2601 ``debug``
2604 Print debugging information. (default: False)
2602 Print debugging information. (default: False)
2605
2603
2606 ``editor``
2604 ``editor``
2607 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2605 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2608
2606
2609 ``fallbackencoding``
2607 ``fallbackencoding``
2610 Encoding to try if it's not possible to decode the changelog using
2608 Encoding to try if it's not possible to decode the changelog using
2611 UTF-8. (default: ISO-8859-1)
2609 UTF-8. (default: ISO-8859-1)
2612
2610
2613 ``graphnodetemplate``
2611 ``graphnodetemplate``
2614 (DEPRECATED) Use ``command-templates.graphnode`` instead.
2612 (DEPRECATED) Use ``command-templates.graphnode`` instead.
2615
2613
2616 ``ignore``
2614 ``ignore``
2617 A file to read per-user ignore patterns from. This file should be
2615 A file to read per-user ignore patterns from. This file should be
2618 in the same format as a repository-wide .hgignore file. Filenames
2616 in the same format as a repository-wide .hgignore file. Filenames
2619 are relative to the repository root. This option supports hook syntax,
2617 are relative to the repository root. This option supports hook syntax,
2620 so if you want to specify multiple ignore files, you can do so by
2618 so if you want to specify multiple ignore files, you can do so by
2621 setting something like ``ignore.other = ~/.hgignore2``. For details
2619 setting something like ``ignore.other = ~/.hgignore2``. For details
2622 of the ignore file format, see the ``hgignore(5)`` man page.
2620 of the ignore file format, see the ``hgignore(5)`` man page.
2623
2621
2624 ``interactive``
2622 ``interactive``
2625 Allow to prompt the user. (default: True)
2623 Allow to prompt the user. (default: True)
2626
2624
2627 ``interface``
2625 ``interface``
2628 Select the default interface for interactive features (default: text).
2626 Select the default interface for interactive features (default: text).
2629 Possible values are 'text' and 'curses'.
2627 Possible values are 'text' and 'curses'.
2630
2628
2631 ``interface.chunkselector``
2629 ``interface.chunkselector``
2632 Select the interface for change recording (e.g. :hg:`commit -i`).
2630 Select the interface for change recording (e.g. :hg:`commit -i`).
2633 Possible values are 'text' and 'curses'.
2631 Possible values are 'text' and 'curses'.
2634 This config overrides the interface specified by ui.interface.
2632 This config overrides the interface specified by ui.interface.
2635
2633
2636 ``large-file-limit``
2634 ``large-file-limit``
2637 Largest file size that gives no memory use warning.
2635 Largest file size that gives no memory use warning.
2638 Possible values are integers or 0 to disable the check.
2636 Possible values are integers or 0 to disable the check.
2639 (default: 10000000)
2637 (default: 10000000)
2640
2638
2641 ``logtemplate``
2639 ``logtemplate``
2642 (DEPRECATED) Use ``command-templates.log`` instead.
2640 (DEPRECATED) Use ``command-templates.log`` instead.
2643
2641
2644 ``merge``
2642 ``merge``
2645 The conflict resolution program to use during a manual merge.
2643 The conflict resolution program to use during a manual merge.
2646 For more information on merge tools see :hg:`help merge-tools`.
2644 For more information on merge tools see :hg:`help merge-tools`.
2647 For configuring merge tools see the ``[merge-tools]`` section.
2645 For configuring merge tools see the ``[merge-tools]`` section.
2648
2646
2649 ``mergemarkers``
2647 ``mergemarkers``
2650 Sets the merge conflict marker label styling. The ``detailed`` style
2648 Sets the merge conflict marker label styling. The ``detailed`` style
2651 uses the ``command-templates.mergemarker`` setting to style the labels.
2649 uses the ``command-templates.mergemarker`` setting to style the labels.
2652 The ``basic`` style just uses 'local' and 'other' as the marker label.
2650 The ``basic`` style just uses 'local' and 'other' as the marker label.
2653 One of ``basic`` or ``detailed``.
2651 One of ``basic`` or ``detailed``.
2654 (default: ``basic``)
2652 (default: ``basic``)
2655
2653
2656 ``mergemarkertemplate``
2654 ``mergemarkertemplate``
2657 (DEPRECATED) Use ``command-templates.mergemarker`` instead.
2655 (DEPRECATED) Use ``command-templates.mergemarker`` instead.
2658
2656
2659 ``message-output``
2657 ``message-output``
2660 Where to write status and error messages. (default: ``stdio``)
2658 Where to write status and error messages. (default: ``stdio``)
2661
2659
2662 ``channel``
2660 ``channel``
2663 Use separate channel for structured output. (Command-server only)
2661 Use separate channel for structured output. (Command-server only)
2664 ``stderr``
2662 ``stderr``
2665 Everything to stderr.
2663 Everything to stderr.
2666 ``stdio``
2664 ``stdio``
2667 Status to stdout, and error to stderr.
2665 Status to stdout, and error to stderr.
2668
2666
2669 ``origbackuppath``
2667 ``origbackuppath``
2670 The path to a directory used to store generated .orig files. If the path is
2668 The path to a directory used to store generated .orig files. If the path is
2671 not a directory, one will be created. If set, files stored in this
2669 not a directory, one will be created. If set, files stored in this
2672 directory have the same name as the original file and do not have a .orig
2670 directory have the same name as the original file and do not have a .orig
2673 suffix.
2671 suffix.
2674
2672
2675 ``paginate``
2673 ``paginate``
2676 Control the pagination of command output (default: True). See :hg:`help pager`
2674 Control the pagination of command output (default: True). See :hg:`help pager`
2677 for details.
2675 for details.
2678
2676
2679 ``patch``
2677 ``patch``
2680 An optional external tool that ``hg import`` and some extensions
2678 An optional external tool that ``hg import`` and some extensions
2681 will use for applying patches. By default Mercurial uses an
2679 will use for applying patches. By default Mercurial uses an
2682 internal patch utility. The external tool must work as the common
2680 internal patch utility. The external tool must work as the common
2683 Unix ``patch`` program. In particular, it must accept a ``-p``
2681 Unix ``patch`` program. In particular, it must accept a ``-p``
2684 argument to strip patch headers, a ``-d`` argument to specify the
2682 argument to strip patch headers, a ``-d`` argument to specify the
2685 current directory, a file name to patch, and a patch file to take
2683 current directory, a file name to patch, and a patch file to take
2686 from stdin.
2684 from stdin.
2687
2685
2688 It is possible to specify a patch tool together with extra
2686 It is possible to specify a patch tool together with extra
2689 arguments. For example, setting this option to ``patch --merge``
2687 arguments. For example, setting this option to ``patch --merge``
2690 will use the ``patch`` program with its 2-way merge option.
2688 will use the ``patch`` program with its 2-way merge option.
2691
2689
2692 ``portablefilenames``
2690 ``portablefilenames``
2693 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2691 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2694 (default: ``warn``)
2692 (default: ``warn``)
2695
2693
2696 ``warn``
2694 ``warn``
2697 Print a warning message on POSIX platforms, if a file with a non-portable
2695 Print a warning message on POSIX platforms, if a file with a non-portable
2698 filename is added (e.g. a file with a name that can't be created on
2696 filename is added (e.g. a file with a name that can't be created on
2699 Windows because it contains reserved parts like ``AUX``, reserved
2697 Windows because it contains reserved parts like ``AUX``, reserved
2700 characters like ``:``, or would cause a case collision with an existing
2698 characters like ``:``, or would cause a case collision with an existing
2701 file).
2699 file).
2702
2700
2703 ``ignore``
2701 ``ignore``
2704 Don't print a warning.
2702 Don't print a warning.
2705
2703
2706 ``abort``
2704 ``abort``
2707 The command is aborted.
2705 The command is aborted.
2708
2706
2709 ``true``
2707 ``true``
2710 Alias for ``warn``.
2708 Alias for ``warn``.
2711
2709
2712 ``false``
2710 ``false``
2713 Alias for ``ignore``.
2711 Alias for ``ignore``.
2714
2712
2715 .. container:: windows
2713 .. container:: windows
2716
2714
2717 On Windows, this configuration option is ignored and the command aborted.
2715 On Windows, this configuration option is ignored and the command aborted.
2718
2716
2719 ``pre-merge-tool-output-template``
2717 ``pre-merge-tool-output-template``
2720 (DEPRECATED) Use ``command-template.pre-merge-tool-output`` instead.
2718 (DEPRECATED) Use ``command-template.pre-merge-tool-output`` instead.
2721
2719
2722 ``quiet``
2720 ``quiet``
2723 Reduce the amount of output printed.
2721 Reduce the amount of output printed.
2724 (default: False)
2722 (default: False)
2725
2723
2726 ``relative-paths``
2724 ``relative-paths``
2727 Prefer relative paths in the UI.
2725 Prefer relative paths in the UI.
2728
2726
2729 ``remotecmd``
2727 ``remotecmd``
2730 Remote command to use for clone/push/pull operations.
2728 Remote command to use for clone/push/pull operations.
2731 (default: ``hg``)
2729 (default: ``hg``)
2732
2730
2733 ``report_untrusted``
2731 ``report_untrusted``
2734 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2732 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2735 trusted user or group.
2733 trusted user or group.
2736 (default: True)
2734 (default: True)
2737
2735
2738 ``slash``
2736 ``slash``
2739 (Deprecated. Use ``slashpath`` template filter instead.)
2737 (Deprecated. Use ``slashpath`` template filter instead.)
2740
2738
2741 Display paths using a slash (``/``) as the path separator. This
2739 Display paths using a slash (``/``) as the path separator. This
2742 only makes a difference on systems where the default path
2740 only makes a difference on systems where the default path
2743 separator is not the slash character (e.g. Windows uses the
2741 separator is not the slash character (e.g. Windows uses the
2744 backslash character (``\``)).
2742 backslash character (``\``)).
2745 (default: False)
2743 (default: False)
2746
2744
2747 ``statuscopies``
2745 ``statuscopies``
2748 Display copies in the status command.
2746 Display copies in the status command.
2749
2747
2750 ``ssh``
2748 ``ssh``
2751 Command to use for SSH connections. (default: ``ssh``)
2749 Command to use for SSH connections. (default: ``ssh``)
2752
2750
2753 ``ssherrorhint``
2751 ``ssherrorhint``
2754 A hint shown to the user in the case of SSH error (e.g.
2752 A hint shown to the user in the case of SSH error (e.g.
2755 ``Please see http://company/internalwiki/ssh.html``)
2753 ``Please see http://company/internalwiki/ssh.html``)
2756
2754
2757 ``strict``
2755 ``strict``
2758 Require exact command names, instead of allowing unambiguous
2756 Require exact command names, instead of allowing unambiguous
2759 abbreviations. (default: False)
2757 abbreviations. (default: False)
2760
2758
2761 ``style``
2759 ``style``
2762 Name of style to use for command output.
2760 Name of style to use for command output.
2763
2761
2764 ``supportcontact``
2762 ``supportcontact``
2765 A URL where users should report a Mercurial traceback. Use this if you are a
2763 A URL where users should report a Mercurial traceback. Use this if you are a
2766 large organisation with its own Mercurial deployment process and crash
2764 large organisation with its own Mercurial deployment process and crash
2767 reports should be addressed to your internal support.
2765 reports should be addressed to your internal support.
2768
2766
2769 ``textwidth``
2767 ``textwidth``
2770 Maximum width of help text. A longer line generated by ``hg help`` or
2768 Maximum width of help text. A longer line generated by ``hg help`` or
2771 ``hg subcommand --help`` will be broken after white space to get this
2769 ``hg subcommand --help`` will be broken after white space to get this
2772 width or the terminal width, whichever comes first.
2770 width or the terminal width, whichever comes first.
2773 A non-positive value will disable this and the terminal width will be
2771 A non-positive value will disable this and the terminal width will be
2774 used. (default: 78)
2772 used. (default: 78)
2775
2773
2776 ``timeout``
2774 ``timeout``
2777 The timeout used when a lock is held (in seconds), a negative value
2775 The timeout used when a lock is held (in seconds), a negative value
2778 means no timeout. (default: 600)
2776 means no timeout. (default: 600)
2779
2777
2780 ``timeout.warn``
2778 ``timeout.warn``
2781 Time (in seconds) before a warning is printed about held lock. A negative
2779 Time (in seconds) before a warning is printed about held lock. A negative
2782 value means no warning. (default: 0)
2780 value means no warning. (default: 0)
2783
2781
2784 ``traceback``
2782 ``traceback``
2785 Mercurial always prints a traceback when an unknown exception
2783 Mercurial always prints a traceback when an unknown exception
2786 occurs. Setting this to True will make Mercurial print a traceback
2784 occurs. Setting this to True will make Mercurial print a traceback
2787 on all exceptions, even those recognized by Mercurial (such as
2785 on all exceptions, even those recognized by Mercurial (such as
2788 IOError or MemoryError). (default: False)
2786 IOError or MemoryError). (default: False)
2789
2787
2790 ``tweakdefaults``
2788 ``tweakdefaults``
2791
2789
2792 By default Mercurial's behavior changes very little from release
2790 By default Mercurial's behavior changes very little from release
2793 to release, but over time the recommended config settings
2791 to release, but over time the recommended config settings
2794 shift. Enable this config to opt in to get automatic tweaks to
2792 shift. Enable this config to opt in to get automatic tweaks to
2795 Mercurial's behavior over time. This config setting will have no
2793 Mercurial's behavior over time. This config setting will have no
2796 effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
2794 effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
2797 not include ``tweakdefaults``. (default: False)
2795 not include ``tweakdefaults``. (default: False)
2798
2796
2799 It currently means::
2797 It currently means::
2800
2798
2801 .. tweakdefaultsmarker
2799 .. tweakdefaultsmarker
2802
2800
2803 ``username``
2801 ``username``
2804 The committer of a changeset created when running "commit".
2802 The committer of a changeset created when running "commit".
2805 Typically a person's name and email address, e.g. ``Fred Widget
2803 Typically a person's name and email address, e.g. ``Fred Widget
2806 <fred@example.com>``. Environment variables in the
2804 <fred@example.com>``. Environment variables in the
2807 username are expanded.
2805 username are expanded.
2808
2806
2809 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2807 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2810 hgrc is empty, e.g. if the system admin set ``username =`` in the
2808 hgrc is empty, e.g. if the system admin set ``username =`` in the
2811 system hgrc, it has to be specified manually or in a different
2809 system hgrc, it has to be specified manually or in a different
2812 hgrc file)
2810 hgrc file)
2813
2811
2814 ``verbose``
2812 ``verbose``
2815 Increase the amount of output printed. (default: False)
2813 Increase the amount of output printed. (default: False)
2816
2814
2817
2815
2818 ``command-templates``
2816 ``command-templates``
2819 ---------------------
2817 ---------------------
2820
2818
2821 Templates used for customizing the output of commands.
2819 Templates used for customizing the output of commands.
2822
2820
2823 ``graphnode``
2821 ``graphnode``
2824 The template used to print changeset nodes in an ASCII revision graph.
2822 The template used to print changeset nodes in an ASCII revision graph.
2825 (default: ``{graphnode}``)
2823 (default: ``{graphnode}``)
2826
2824
2827 ``log``
2825 ``log``
2828 Template string for commands that print changesets.
2826 Template string for commands that print changesets.
2829
2827
2830 ``mergemarker``
2828 ``mergemarker``
2831 The template used to print the commit description next to each conflict
2829 The template used to print the commit description next to each conflict
2832 marker during merge conflicts. See :hg:`help templates` for the template
2830 marker during merge conflicts. See :hg:`help templates` for the template
2833 format.
2831 format.
2834
2832
2835 Defaults to showing the hash, tags, branches, bookmarks, author, and
2833 Defaults to showing the hash, tags, branches, bookmarks, author, and
2836 the first line of the commit description.
2834 the first line of the commit description.
2837
2835
2838 If you use non-ASCII characters in names for tags, branches, bookmarks,
2836 If you use non-ASCII characters in names for tags, branches, bookmarks,
2839 authors, and/or commit descriptions, you must pay attention to encodings of
2837 authors, and/or commit descriptions, you must pay attention to encodings of
2840 managed files. At template expansion, non-ASCII characters use the encoding
2838 managed files. At template expansion, non-ASCII characters use the encoding
2841 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2839 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2842 environment variables that govern your locale. If the encoding of the merge
2840 environment variables that govern your locale. If the encoding of the merge
2843 markers is different from the encoding of the merged files,
2841 markers is different from the encoding of the merged files,
2844 serious problems may occur.
2842 serious problems may occur.
2845
2843
2846 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2844 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2847
2845
2848 ``oneline-summary``
2846 ``oneline-summary``
2849 A template used by `hg rebase` and other commands for showing a one-line
2847 A template used by `hg rebase` and other commands for showing a one-line
2850 summary of a commit. If the template configured here is longer than one
2848 summary of a commit. If the template configured here is longer than one
2851 line, then only the first line is used.
2849 line, then only the first line is used.
2852
2850
2853 The template can be overridden per command by defining a template in
2851 The template can be overridden per command by defining a template in
2854 `oneline-summary.<command>`, where `<command>` can be e.g. "rebase".
2852 `oneline-summary.<command>`, where `<command>` can be e.g. "rebase".
2855
2853
2856 ``pre-merge-tool-output``
2854 ``pre-merge-tool-output``
2857 A template that is printed before executing an external merge tool. This can
2855 A template that is printed before executing an external merge tool. This can
2858 be used to print out additional context that might be useful to have during
2856 be used to print out additional context that might be useful to have during
2859 the conflict resolution, such as the description of the various commits
2857 the conflict resolution, such as the description of the various commits
2860 involved or bookmarks/tags.
2858 involved or bookmarks/tags.
2861
2859
2862 Additional information is available in the ``local`, ``base``, and ``other``
2860 Additional information is available in the ``local`, ``base``, and ``other``
2863 dicts. For example: ``{local.label}``, ``{base.name}``, or
2861 dicts. For example: ``{local.label}``, ``{base.name}``, or
2864 ``{other.islink}``.
2862 ``{other.islink}``.
2865
2863
2866
2864
2867 ``web``
2865 ``web``
2868 -------
2866 -------
2869
2867
2870 Web interface configuration. The settings in this section apply to
2868 Web interface configuration. The settings in this section apply to
2871 both the builtin webserver (started by :hg:`serve`) and the script you
2869 both the builtin webserver (started by :hg:`serve`) and the script you
2872 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2870 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2873 and WSGI).
2871 and WSGI).
2874
2872
2875 The Mercurial webserver does no authentication (it does not prompt for
2873 The Mercurial webserver does no authentication (it does not prompt for
2876 usernames and passwords to validate *who* users are), but it does do
2874 usernames and passwords to validate *who* users are), but it does do
2877 authorization (it grants or denies access for *authenticated users*
2875 authorization (it grants or denies access for *authenticated users*
2878 based on settings in this section). You must either configure your
2876 based on settings in this section). You must either configure your
2879 webserver to do authentication for you, or disable the authorization
2877 webserver to do authentication for you, or disable the authorization
2880 checks.
2878 checks.
2881
2879
2882 For a quick setup in a trusted environment, e.g., a private LAN, where
2880 For a quick setup in a trusted environment, e.g., a private LAN, where
2883 you want it to accept pushes from anybody, you can use the following
2881 you want it to accept pushes from anybody, you can use the following
2884 command line::
2882 command line::
2885
2883
2886 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2884 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2887
2885
2888 Note that this will allow anybody to push anything to the server and
2886 Note that this will allow anybody to push anything to the server and
2889 that this should not be used for public servers.
2887 that this should not be used for public servers.
2890
2888
2891 The full set of options is:
2889 The full set of options is:
2892
2890
2893 ``accesslog``
2891 ``accesslog``
2894 Where to output the access log. (default: stdout)
2892 Where to output the access log. (default: stdout)
2895
2893
2896 ``address``
2894 ``address``
2897 Interface address to bind to. (default: all)
2895 Interface address to bind to. (default: all)
2898
2896
2899 ``allow-archive``
2897 ``allow-archive``
2900 List of archive format (bz2, gz, zip) allowed for downloading.
2898 List of archive format (bz2, gz, zip) allowed for downloading.
2901 (default: empty)
2899 (default: empty)
2902
2900
2903 ``allowbz2``
2901 ``allowbz2``
2904 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2902 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2905 revisions.
2903 revisions.
2906 (default: False)
2904 (default: False)
2907
2905
2908 ``allowgz``
2906 ``allowgz``
2909 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2907 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2910 revisions.
2908 revisions.
2911 (default: False)
2909 (default: False)
2912
2910
2913 ``allow-pull``
2911 ``allow-pull``
2914 Whether to allow pulling from the repository. (default: True)
2912 Whether to allow pulling from the repository. (default: True)
2915
2913
2916 ``allow-push``
2914 ``allow-push``
2917 Whether to allow pushing to the repository. If empty or not set,
2915 Whether to allow pushing to the repository. If empty or not set,
2918 pushing is not allowed. If the special value ``*``, any remote
2916 pushing is not allowed. If the special value ``*``, any remote
2919 user can push, including unauthenticated users. Otherwise, the
2917 user can push, including unauthenticated users. Otherwise, the
2920 remote user must have been authenticated, and the authenticated
2918 remote user must have been authenticated, and the authenticated
2921 user name must be present in this list. The contents of the
2919 user name must be present in this list. The contents of the
2922 allow-push list are examined after the deny_push list.
2920 allow-push list are examined after the deny_push list.
2923
2921
2924 ``allow_read``
2922 ``allow_read``
2925 If the user has not already been denied repository access due to
2923 If the user has not already been denied repository access due to
2926 the contents of deny_read, this list determines whether to grant
2924 the contents of deny_read, this list determines whether to grant
2927 repository access to the user. If this list is not empty, and the
2925 repository access to the user. If this list is not empty, and the
2928 user is unauthenticated or not present in the list, then access is
2926 user is unauthenticated or not present in the list, then access is
2929 denied for the user. If the list is empty or not set, then access
2927 denied for the user. If the list is empty or not set, then access
2930 is permitted to all users by default. Setting allow_read to the
2928 is permitted to all users by default. Setting allow_read to the
2931 special value ``*`` is equivalent to it not being set (i.e. access
2929 special value ``*`` is equivalent to it not being set (i.e. access
2932 is permitted to all users). The contents of the allow_read list are
2930 is permitted to all users). The contents of the allow_read list are
2933 examined after the deny_read list.
2931 examined after the deny_read list.
2934
2932
2935 ``allowzip``
2933 ``allowzip``
2936 (DEPRECATED) Whether to allow .zip downloading of repository
2934 (DEPRECATED) Whether to allow .zip downloading of repository
2937 revisions. This feature creates temporary files.
2935 revisions. This feature creates temporary files.
2938 (default: False)
2936 (default: False)
2939
2937
2940 ``archivesubrepos``
2938 ``archivesubrepos``
2941 Whether to recurse into subrepositories when archiving.
2939 Whether to recurse into subrepositories when archiving.
2942 (default: False)
2940 (default: False)
2943
2941
2944 ``baseurl``
2942 ``baseurl``
2945 Base URL to use when publishing URLs in other locations, so
2943 Base URL to use when publishing URLs in other locations, so
2946 third-party tools like email notification hooks can construct
2944 third-party tools like email notification hooks can construct
2947 URLs. Example: ``http://hgserver/repos/``.
2945 URLs. Example: ``http://hgserver/repos/``.
2948
2946
2949 ``cacerts``
2947 ``cacerts``
2950 Path to file containing a list of PEM encoded certificate
2948 Path to file containing a list of PEM encoded certificate
2951 authority certificates. Environment variables and ``~user``
2949 authority certificates. Environment variables and ``~user``
2952 constructs are expanded in the filename. If specified on the
2950 constructs are expanded in the filename. If specified on the
2953 client, then it will verify the identity of remote HTTPS servers
2951 client, then it will verify the identity of remote HTTPS servers
2954 with these certificates.
2952 with these certificates.
2955
2953
2956 To disable SSL verification temporarily, specify ``--insecure`` from
2954 To disable SSL verification temporarily, specify ``--insecure`` from
2957 command line.
2955 command line.
2958
2956
2959 You can use OpenSSL's CA certificate file if your platform has
2957 You can use OpenSSL's CA certificate file if your platform has
2960 one. On most Linux systems this will be
2958 one. On most Linux systems this will be
2961 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2959 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2962 generate this file manually. The form must be as follows::
2960 generate this file manually. The form must be as follows::
2963
2961
2964 -----BEGIN CERTIFICATE-----
2962 -----BEGIN CERTIFICATE-----
2965 ... (certificate in base64 PEM encoding) ...
2963 ... (certificate in base64 PEM encoding) ...
2966 -----END CERTIFICATE-----
2964 -----END CERTIFICATE-----
2967 -----BEGIN CERTIFICATE-----
2965 -----BEGIN CERTIFICATE-----
2968 ... (certificate in base64 PEM encoding) ...
2966 ... (certificate in base64 PEM encoding) ...
2969 -----END CERTIFICATE-----
2967 -----END CERTIFICATE-----
2970
2968
2971 ``cache``
2969 ``cache``
2972 Whether to support caching in hgweb. (default: True)
2970 Whether to support caching in hgweb. (default: True)
2973
2971
2974 ``certificate``
2972 ``certificate``
2975 Certificate to use when running :hg:`serve`.
2973 Certificate to use when running :hg:`serve`.
2976
2974
2977 ``collapse``
2975 ``collapse``
2978 With ``descend`` enabled, repositories in subdirectories are shown at
2976 With ``descend`` enabled, repositories in subdirectories are shown at
2979 a single level alongside repositories in the current path. With
2977 a single level alongside repositories in the current path. With
2980 ``collapse`` also enabled, repositories residing at a deeper level than
2978 ``collapse`` also enabled, repositories residing at a deeper level than
2981 the current path are grouped behind navigable directory entries that
2979 the current path are grouped behind navigable directory entries that
2982 lead to the locations of these repositories. In effect, this setting
2980 lead to the locations of these repositories. In effect, this setting
2983 collapses each collection of repositories found within a subdirectory
2981 collapses each collection of repositories found within a subdirectory
2984 into a single entry for that subdirectory. (default: False)
2982 into a single entry for that subdirectory. (default: False)
2985
2983
2986 ``comparisoncontext``
2984 ``comparisoncontext``
2987 Number of lines of context to show in side-by-side file comparison. If
2985 Number of lines of context to show in side-by-side file comparison. If
2988 negative or the value ``full``, whole files are shown. (default: 5)
2986 negative or the value ``full``, whole files are shown. (default: 5)
2989
2987
2990 This setting can be overridden by a ``context`` request parameter to the
2988 This setting can be overridden by a ``context`` request parameter to the
2991 ``comparison`` command, taking the same values.
2989 ``comparison`` command, taking the same values.
2992
2990
2993 ``contact``
2991 ``contact``
2994 Name or email address of the person in charge of the repository.
2992 Name or email address of the person in charge of the repository.
2995 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2993 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2996
2994
2997 ``csp``
2995 ``csp``
2998 Send a ``Content-Security-Policy`` HTTP header with this value.
2996 Send a ``Content-Security-Policy`` HTTP header with this value.
2999
2997
3000 The value may contain a special string ``%nonce%``, which will be replaced
2998 The value may contain a special string ``%nonce%``, which will be replaced
3001 by a randomly-generated one-time use value. If the value contains
2999 by a randomly-generated one-time use value. If the value contains
3002 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
3000 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
3003 one-time property of the nonce. This nonce will also be inserted into
3001 one-time property of the nonce. This nonce will also be inserted into
3004 ``<script>`` elements containing inline JavaScript.
3002 ``<script>`` elements containing inline JavaScript.
3005
3003
3006 Note: lots of HTML content sent by the server is derived from repository
3004 Note: lots of HTML content sent by the server is derived from repository
3007 data. Please consider the potential for malicious repository data to
3005 data. Please consider the potential for malicious repository data to
3008 "inject" itself into generated HTML content as part of your security
3006 "inject" itself into generated HTML content as part of your security
3009 threat model.
3007 threat model.
3010
3008
3011 ``deny_push``
3009 ``deny_push``
3012 Whether to deny pushing to the repository. If empty or not set,
3010 Whether to deny pushing to the repository. If empty or not set,
3013 push is not denied. If the special value ``*``, all remote users are
3011 push is not denied. If the special value ``*``, all remote users are
3014 denied push. Otherwise, unauthenticated users are all denied, and
3012 denied push. Otherwise, unauthenticated users are all denied, and
3015 any authenticated user name present in this list is also denied. The
3013 any authenticated user name present in this list is also denied. The
3016 contents of the deny_push list are examined before the allow-push list.
3014 contents of the deny_push list are examined before the allow-push list.
3017
3015
3018 ``deny_read``
3016 ``deny_read``
3019 Whether to deny reading/viewing of the repository. If this list is
3017 Whether to deny reading/viewing of the repository. If this list is
3020 not empty, unauthenticated users are all denied, and any
3018 not empty, unauthenticated users are all denied, and any
3021 authenticated user name present in this list is also denied access to
3019 authenticated user name present in this list is also denied access to
3022 the repository. If set to the special value ``*``, all remote users
3020 the repository. If set to the special value ``*``, all remote users
3023 are denied access (rarely needed ;). If deny_read is empty or not set,
3021 are denied access (rarely needed ;). If deny_read is empty or not set,
3024 the determination of repository access depends on the presence and
3022 the determination of repository access depends on the presence and
3025 content of the allow_read list (see description). If both
3023 content of the allow_read list (see description). If both
3026 deny_read and allow_read are empty or not set, then access is
3024 deny_read and allow_read are empty or not set, then access is
3027 permitted to all users by default. If the repository is being
3025 permitted to all users by default. If the repository is being
3028 served via hgwebdir, denied users will not be able to see it in
3026 served via hgwebdir, denied users will not be able to see it in
3029 the list of repositories. The contents of the deny_read list have
3027 the list of repositories. The contents of the deny_read list have
3030 priority over (are examined before) the contents of the allow_read
3028 priority over (are examined before) the contents of the allow_read
3031 list.
3029 list.
3032
3030
3033 ``descend``
3031 ``descend``
3034 hgwebdir indexes will not descend into subdirectories. Only repositories
3032 hgwebdir indexes will not descend into subdirectories. Only repositories
3035 directly in the current path will be shown (other repositories are still
3033 directly in the current path will be shown (other repositories are still
3036 available from the index corresponding to their containing path).
3034 available from the index corresponding to their containing path).
3037
3035
3038 ``description``
3036 ``description``
3039 Textual description of the repository's purpose or contents.
3037 Textual description of the repository's purpose or contents.
3040 (default: "unknown")
3038 (default: "unknown")
3041
3039
3042 ``encoding``
3040 ``encoding``
3043 Character encoding name. (default: the current locale charset)
3041 Character encoding name. (default: the current locale charset)
3044 Example: "UTF-8".
3042 Example: "UTF-8".
3045
3043
3046 ``errorlog``
3044 ``errorlog``
3047 Where to output the error log. (default: stderr)
3045 Where to output the error log. (default: stderr)
3048
3046
3049 ``guessmime``
3047 ``guessmime``
3050 Control MIME types for raw download of file content.
3048 Control MIME types for raw download of file content.
3051 Set to True to let hgweb guess the content type from the file
3049 Set to True to let hgweb guess the content type from the file
3052 extension. This will serve HTML files as ``text/html`` and might
3050 extension. This will serve HTML files as ``text/html`` and might
3053 allow cross-site scripting attacks when serving untrusted
3051 allow cross-site scripting attacks when serving untrusted
3054 repositories. (default: False)
3052 repositories. (default: False)
3055
3053
3056 ``hidden``
3054 ``hidden``
3057 Whether to hide the repository in the hgwebdir index.
3055 Whether to hide the repository in the hgwebdir index.
3058 (default: False)
3056 (default: False)
3059
3057
3060 ``ipv6``
3058 ``ipv6``
3061 Whether to use IPv6. (default: False)
3059 Whether to use IPv6. (default: False)
3062
3060
3063 ``labels``
3061 ``labels``
3064 List of string *labels* associated with the repository.
3062 List of string *labels* associated with the repository.
3065
3063
3066 Labels are exposed as a template keyword and can be used to customize
3064 Labels are exposed as a template keyword and can be used to customize
3067 output. e.g. the ``index`` template can group or filter repositories
3065 output. e.g. the ``index`` template can group or filter repositories
3068 by labels and the ``summary`` template can display additional content
3066 by labels and the ``summary`` template can display additional content
3069 if a specific label is present.
3067 if a specific label is present.
3070
3068
3071 ``logoimg``
3069 ``logoimg``
3072 File name of the logo image that some templates display on each page.
3070 File name of the logo image that some templates display on each page.
3073 The file name is relative to ``staticurl``. That is, the full path to
3071 The file name is relative to ``staticurl``. That is, the full path to
3074 the logo image is "staticurl/logoimg".
3072 the logo image is "staticurl/logoimg".
3075 If unset, ``hglogo.png`` will be used.
3073 If unset, ``hglogo.png`` will be used.
3076
3074
3077 ``logourl``
3075 ``logourl``
3078 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
3076 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
3079 will be used.
3077 will be used.
3080
3078
3081 ``maxchanges``
3079 ``maxchanges``
3082 Maximum number of changes to list on the changelog. (default: 10)
3080 Maximum number of changes to list on the changelog. (default: 10)
3083
3081
3084 ``maxfiles``
3082 ``maxfiles``
3085 Maximum number of files to list per changeset. (default: 10)
3083 Maximum number of files to list per changeset. (default: 10)
3086
3084
3087 ``maxshortchanges``
3085 ``maxshortchanges``
3088 Maximum number of changes to list on the shortlog, graph or filelog
3086 Maximum number of changes to list on the shortlog, graph or filelog
3089 pages. (default: 60)
3087 pages. (default: 60)
3090
3088
3091 ``name``
3089 ``name``
3092 Repository name to use in the web interface.
3090 Repository name to use in the web interface.
3093 (default: current working directory)
3091 (default: current working directory)
3094
3092
3095 ``port``
3093 ``port``
3096 Port to listen on. (default: 8000)
3094 Port to listen on. (default: 8000)
3097
3095
3098 ``prefix``
3096 ``prefix``
3099 Prefix path to serve from. (default: '' (server root))
3097 Prefix path to serve from. (default: '' (server root))
3100
3098
3101 ``push_ssl``
3099 ``push_ssl``
3102 Whether to require that inbound pushes be transported over SSL to
3100 Whether to require that inbound pushes be transported over SSL to
3103 prevent password sniffing. (default: True)
3101 prevent password sniffing. (default: True)
3104
3102
3105 ``refreshinterval``
3103 ``refreshinterval``
3106 How frequently directory listings re-scan the filesystem for new
3104 How frequently directory listings re-scan the filesystem for new
3107 repositories, in seconds. This is relevant when wildcards are used
3105 repositories, in seconds. This is relevant when wildcards are used
3108 to define paths. Depending on how much filesystem traversal is
3106 to define paths. Depending on how much filesystem traversal is
3109 required, refreshing may negatively impact performance.
3107 required, refreshing may negatively impact performance.
3110
3108
3111 Values less than or equal to 0 always refresh.
3109 Values less than or equal to 0 always refresh.
3112 (default: 20)
3110 (default: 20)
3113
3111
3114 ``server-header``
3112 ``server-header``
3115 Value for HTTP ``Server`` response header.
3113 Value for HTTP ``Server`` response header.
3116
3114
3117 ``static``
3115 ``static``
3118 Directory where static files are served from.
3116 Directory where static files are served from.
3119
3117
3120 ``staticurl``
3118 ``staticurl``
3121 Base URL to use for static files. If unset, static files (e.g. the
3119 Base URL to use for static files. If unset, static files (e.g. the
3122 hgicon.png favicon) will be served by the CGI script itself. Use
3120 hgicon.png favicon) will be served by the CGI script itself. Use
3123 this setting to serve them directly with the HTTP server.
3121 this setting to serve them directly with the HTTP server.
3124 Example: ``http://hgserver/static/``.
3122 Example: ``http://hgserver/static/``.
3125
3123
3126 ``stripes``
3124 ``stripes``
3127 How many lines a "zebra stripe" should span in multi-line output.
3125 How many lines a "zebra stripe" should span in multi-line output.
3128 Set to 0 to disable. (default: 1)
3126 Set to 0 to disable. (default: 1)
3129
3127
3130 ``style``
3128 ``style``
3131 Which template map style to use. The available options are the names of
3129 Which template map style to use. The available options are the names of
3132 subdirectories in the HTML templates path. (default: ``paper``)
3130 subdirectories in the HTML templates path. (default: ``paper``)
3133 Example: ``monoblue``.
3131 Example: ``monoblue``.
3134
3132
3135 ``templates``
3133 ``templates``
3136 Where to find the HTML templates. The default path to the HTML templates
3134 Where to find the HTML templates. The default path to the HTML templates
3137 can be obtained from ``hg debuginstall``.
3135 can be obtained from ``hg debuginstall``.
3138
3136
3139 ``websub``
3137 ``websub``
3140 ----------
3138 ----------
3141
3139
3142 Web substitution filter definition. You can use this section to
3140 Web substitution filter definition. You can use this section to
3143 define a set of regular expression substitution patterns which
3141 define a set of regular expression substitution patterns which
3144 let you automatically modify the hgweb server output.
3142 let you automatically modify the hgweb server output.
3145
3143
3146 The default hgweb templates only apply these substitution patterns
3144 The default hgweb templates only apply these substitution patterns
3147 on the revision description fields. You can apply them anywhere
3145 on the revision description fields. You can apply them anywhere
3148 you want when you create your own templates by adding calls to the
3146 you want when you create your own templates by adding calls to the
3149 "websub" filter (usually after calling the "escape" filter).
3147 "websub" filter (usually after calling the "escape" filter).
3150
3148
3151 This can be used, for example, to convert issue references to links
3149 This can be used, for example, to convert issue references to links
3152 to your issue tracker, or to convert "markdown-like" syntax into
3150 to your issue tracker, or to convert "markdown-like" syntax into
3153 HTML (see the examples below).
3151 HTML (see the examples below).
3154
3152
3155 Each entry in this section names a substitution filter.
3153 Each entry in this section names a substitution filter.
3156 The value of each entry defines the substitution expression itself.
3154 The value of each entry defines the substitution expression itself.
3157 The websub expressions follow the old interhg extension syntax,
3155 The websub expressions follow the old interhg extension syntax,
3158 which in turn imitates the Unix sed replacement syntax::
3156 which in turn imitates the Unix sed replacement syntax::
3159
3157
3160 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
3158 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
3161
3159
3162 You can use any separator other than "/". The final "i" is optional
3160 You can use any separator other than "/". The final "i" is optional
3163 and indicates that the search must be case insensitive.
3161 and indicates that the search must be case insensitive.
3164
3162
3165 Examples::
3163 Examples::
3166
3164
3167 [websub]
3165 [websub]
3168 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
3166 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
3169 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
3167 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
3170 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
3168 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
3171
3169
3172 ``worker``
3170 ``worker``
3173 ----------
3171 ----------
3174
3172
3175 Parallel master/worker configuration. We currently perform working
3173 Parallel master/worker configuration. We currently perform working
3176 directory updates in parallel on Unix-like systems, which greatly
3174 directory updates in parallel on Unix-like systems, which greatly
3177 helps performance.
3175 helps performance.
3178
3176
3179 ``enabled``
3177 ``enabled``
3180 Whether to enable workers code to be used.
3178 Whether to enable workers code to be used.
3181 (default: true)
3179 (default: true)
3182
3180
3183 ``numcpus``
3181 ``numcpus``
3184 Number of CPUs to use for parallel operations. A zero or
3182 Number of CPUs to use for parallel operations. A zero or
3185 negative value is treated as ``use the default``.
3183 negative value is treated as ``use the default``.
3186 (default: 4 or the number of CPUs on the system, whichever is larger)
3184 (default: 4 or the number of CPUs on the system, whichever is larger)
3187
3185
3188 ``backgroundclose``
3186 ``backgroundclose``
3189 Whether to enable closing file handles on background threads during certain
3187 Whether to enable closing file handles on background threads during certain
3190 operations. Some platforms aren't very efficient at closing file
3188 operations. Some platforms aren't very efficient at closing file
3191 handles that have been written or appended to. By performing file closing
3189 handles that have been written or appended to. By performing file closing
3192 on background threads, file write rate can increase substantially.
3190 on background threads, file write rate can increase substantially.
3193 (default: true on Windows, false elsewhere)
3191 (default: true on Windows, false elsewhere)
3194
3192
3195 ``backgroundcloseminfilecount``
3193 ``backgroundcloseminfilecount``
3196 Minimum number of files required to trigger background file closing.
3194 Minimum number of files required to trigger background file closing.
3197 Operations not writing this many files won't start background close
3195 Operations not writing this many files won't start background close
3198 threads.
3196 threads.
3199 (default: 2048)
3197 (default: 2048)
3200
3198
3201 ``backgroundclosemaxqueue``
3199 ``backgroundclosemaxqueue``
3202 The maximum number of opened file handles waiting to be closed in the
3200 The maximum number of opened file handles waiting to be closed in the
3203 background. This option only has an effect if ``backgroundclose`` is
3201 background. This option only has an effect if ``backgroundclose`` is
3204 enabled.
3202 enabled.
3205 (default: 384)
3203 (default: 384)
3206
3204
3207 ``backgroundclosethreadcount``
3205 ``backgroundclosethreadcount``
3208 Number of threads to process background file closes. Only relevant if
3206 Number of threads to process background file closes. Only relevant if
3209 ``backgroundclose`` is enabled.
3207 ``backgroundclose`` is enabled.
3210 (default: 4)
3208 (default: 4)
General Comments 0
You need to be logged in to leave comments. Login now