##// END OF EJS Templates
aggressivemergedelta: document rename and move to `revlog` section...
Boris Feld -
r38760:913ca175 @87 default
parent child Browse files
Show More
@@ -1,1382 +1,1383 b''
1 # configitems.py - centralized declaration of configuration option
1 # configitems.py - centralized declaration of configuration option
2 #
2 #
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import functools
10 import functools
11 import re
11 import re
12
12
13 from . import (
13 from . import (
14 encoding,
14 encoding,
15 error,
15 error,
16 )
16 )
17
17
18 def loadconfigtable(ui, extname, configtable):
18 def loadconfigtable(ui, extname, configtable):
19 """update config item known to the ui with the extension ones"""
19 """update config item known to the ui with the extension ones"""
20 for section, items in sorted(configtable.items()):
20 for section, items in sorted(configtable.items()):
21 knownitems = ui._knownconfig.setdefault(section, itemregister())
21 knownitems = ui._knownconfig.setdefault(section, itemregister())
22 knownkeys = set(knownitems)
22 knownkeys = set(knownitems)
23 newkeys = set(items)
23 newkeys = set(items)
24 for key in sorted(knownkeys & newkeys):
24 for key in sorted(knownkeys & newkeys):
25 msg = "extension '%s' overwrite config item '%s.%s'"
25 msg = "extension '%s' overwrite config item '%s.%s'"
26 msg %= (extname, section, key)
26 msg %= (extname, section, key)
27 ui.develwarn(msg, config='warn-config')
27 ui.develwarn(msg, config='warn-config')
28
28
29 knownitems.update(items)
29 knownitems.update(items)
30
30
31 class configitem(object):
31 class configitem(object):
32 """represent a known config item
32 """represent a known config item
33
33
34 :section: the official config section where to find this item,
34 :section: the official config section where to find this item,
35 :name: the official name within the section,
35 :name: the official name within the section,
36 :default: default value for this item,
36 :default: default value for this item,
37 :alias: optional list of tuples as alternatives,
37 :alias: optional list of tuples as alternatives,
38 :generic: this is a generic definition, match name using regular expression.
38 :generic: this is a generic definition, match name using regular expression.
39 """
39 """
40
40
41 def __init__(self, section, name, default=None, alias=(),
41 def __init__(self, section, name, default=None, alias=(),
42 generic=False, priority=0):
42 generic=False, priority=0):
43 self.section = section
43 self.section = section
44 self.name = name
44 self.name = name
45 self.default = default
45 self.default = default
46 self.alias = list(alias)
46 self.alias = list(alias)
47 self.generic = generic
47 self.generic = generic
48 self.priority = priority
48 self.priority = priority
49 self._re = None
49 self._re = None
50 if generic:
50 if generic:
51 self._re = re.compile(self.name)
51 self._re = re.compile(self.name)
52
52
53 class itemregister(dict):
53 class itemregister(dict):
54 """A specialized dictionary that can handle wild-card selection"""
54 """A specialized dictionary that can handle wild-card selection"""
55
55
56 def __init__(self):
56 def __init__(self):
57 super(itemregister, self).__init__()
57 super(itemregister, self).__init__()
58 self._generics = set()
58 self._generics = set()
59
59
60 def update(self, other):
60 def update(self, other):
61 super(itemregister, self).update(other)
61 super(itemregister, self).update(other)
62 self._generics.update(other._generics)
62 self._generics.update(other._generics)
63
63
64 def __setitem__(self, key, item):
64 def __setitem__(self, key, item):
65 super(itemregister, self).__setitem__(key, item)
65 super(itemregister, self).__setitem__(key, item)
66 if item.generic:
66 if item.generic:
67 self._generics.add(item)
67 self._generics.add(item)
68
68
69 def get(self, key):
69 def get(self, key):
70 baseitem = super(itemregister, self).get(key)
70 baseitem = super(itemregister, self).get(key)
71 if baseitem is not None and not baseitem.generic:
71 if baseitem is not None and not baseitem.generic:
72 return baseitem
72 return baseitem
73
73
74 # search for a matching generic item
74 # search for a matching generic item
75 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
75 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
76 for item in generics:
76 for item in generics:
77 # we use 'match' instead of 'search' to make the matching simpler
77 # we use 'match' instead of 'search' to make the matching simpler
78 # for people unfamiliar with regular expression. Having the match
78 # for people unfamiliar with regular expression. Having the match
79 # rooted to the start of the string will produce less surprising
79 # rooted to the start of the string will produce less surprising
80 # result for user writing simple regex for sub-attribute.
80 # result for user writing simple regex for sub-attribute.
81 #
81 #
82 # For example using "color\..*" match produces an unsurprising
82 # For example using "color\..*" match produces an unsurprising
83 # result, while using search could suddenly match apparently
83 # result, while using search could suddenly match apparently
84 # unrelated configuration that happens to contains "color."
84 # unrelated configuration that happens to contains "color."
85 # anywhere. This is a tradeoff where we favor requiring ".*" on
85 # anywhere. This is a tradeoff where we favor requiring ".*" on
86 # some match to avoid the need to prefix most pattern with "^".
86 # some match to avoid the need to prefix most pattern with "^".
87 # The "^" seems more error prone.
87 # The "^" seems more error prone.
88 if item._re.match(key):
88 if item._re.match(key):
89 return item
89 return item
90
90
91 return None
91 return None
92
92
93 coreitems = {}
93 coreitems = {}
94
94
95 def _register(configtable, *args, **kwargs):
95 def _register(configtable, *args, **kwargs):
96 item = configitem(*args, **kwargs)
96 item = configitem(*args, **kwargs)
97 section = configtable.setdefault(item.section, itemregister())
97 section = configtable.setdefault(item.section, itemregister())
98 if item.name in section:
98 if item.name in section:
99 msg = "duplicated config item registration for '%s.%s'"
99 msg = "duplicated config item registration for '%s.%s'"
100 raise error.ProgrammingError(msg % (item.section, item.name))
100 raise error.ProgrammingError(msg % (item.section, item.name))
101 section[item.name] = item
101 section[item.name] = item
102
102
103 # special value for case where the default is derived from other values
103 # special value for case where the default is derived from other values
104 dynamicdefault = object()
104 dynamicdefault = object()
105
105
106 # Registering actual config items
106 # Registering actual config items
107
107
108 def getitemregister(configtable):
108 def getitemregister(configtable):
109 f = functools.partial(_register, configtable)
109 f = functools.partial(_register, configtable)
110 # export pseudo enum as configitem.*
110 # export pseudo enum as configitem.*
111 f.dynamicdefault = dynamicdefault
111 f.dynamicdefault = dynamicdefault
112 return f
112 return f
113
113
114 coreconfigitem = getitemregister(coreitems)
114 coreconfigitem = getitemregister(coreitems)
115
115
116 coreconfigitem('alias', '.*',
116 coreconfigitem('alias', '.*',
117 default=dynamicdefault,
117 default=dynamicdefault,
118 generic=True,
118 generic=True,
119 )
119 )
120 coreconfigitem('annotate', 'nodates',
120 coreconfigitem('annotate', 'nodates',
121 default=False,
121 default=False,
122 )
122 )
123 coreconfigitem('annotate', 'showfunc',
123 coreconfigitem('annotate', 'showfunc',
124 default=False,
124 default=False,
125 )
125 )
126 coreconfigitem('annotate', 'unified',
126 coreconfigitem('annotate', 'unified',
127 default=None,
127 default=None,
128 )
128 )
129 coreconfigitem('annotate', 'git',
129 coreconfigitem('annotate', 'git',
130 default=False,
130 default=False,
131 )
131 )
132 coreconfigitem('annotate', 'ignorews',
132 coreconfigitem('annotate', 'ignorews',
133 default=False,
133 default=False,
134 )
134 )
135 coreconfigitem('annotate', 'ignorewsamount',
135 coreconfigitem('annotate', 'ignorewsamount',
136 default=False,
136 default=False,
137 )
137 )
138 coreconfigitem('annotate', 'ignoreblanklines',
138 coreconfigitem('annotate', 'ignoreblanklines',
139 default=False,
139 default=False,
140 )
140 )
141 coreconfigitem('annotate', 'ignorewseol',
141 coreconfigitem('annotate', 'ignorewseol',
142 default=False,
142 default=False,
143 )
143 )
144 coreconfigitem('annotate', 'nobinary',
144 coreconfigitem('annotate', 'nobinary',
145 default=False,
145 default=False,
146 )
146 )
147 coreconfigitem('annotate', 'noprefix',
147 coreconfigitem('annotate', 'noprefix',
148 default=False,
148 default=False,
149 )
149 )
150 coreconfigitem('annotate', 'word-diff',
150 coreconfigitem('annotate', 'word-diff',
151 default=False,
151 default=False,
152 )
152 )
153 coreconfigitem('auth', 'cookiefile',
153 coreconfigitem('auth', 'cookiefile',
154 default=None,
154 default=None,
155 )
155 )
156 # bookmarks.pushing: internal hack for discovery
156 # bookmarks.pushing: internal hack for discovery
157 coreconfigitem('bookmarks', 'pushing',
157 coreconfigitem('bookmarks', 'pushing',
158 default=list,
158 default=list,
159 )
159 )
160 # bundle.mainreporoot: internal hack for bundlerepo
160 # bundle.mainreporoot: internal hack for bundlerepo
161 coreconfigitem('bundle', 'mainreporoot',
161 coreconfigitem('bundle', 'mainreporoot',
162 default='',
162 default='',
163 )
163 )
164 # bundle.reorder: experimental config
164 # bundle.reorder: experimental config
165 coreconfigitem('bundle', 'reorder',
165 coreconfigitem('bundle', 'reorder',
166 default='auto',
166 default='auto',
167 )
167 )
168 coreconfigitem('censor', 'policy',
168 coreconfigitem('censor', 'policy',
169 default='abort',
169 default='abort',
170 )
170 )
171 coreconfigitem('chgserver', 'idletimeout',
171 coreconfigitem('chgserver', 'idletimeout',
172 default=3600,
172 default=3600,
173 )
173 )
174 coreconfigitem('chgserver', 'skiphash',
174 coreconfigitem('chgserver', 'skiphash',
175 default=False,
175 default=False,
176 )
176 )
177 coreconfigitem('cmdserver', 'log',
177 coreconfigitem('cmdserver', 'log',
178 default=None,
178 default=None,
179 )
179 )
180 coreconfigitem('color', '.*',
180 coreconfigitem('color', '.*',
181 default=None,
181 default=None,
182 generic=True,
182 generic=True,
183 )
183 )
184 coreconfigitem('color', 'mode',
184 coreconfigitem('color', 'mode',
185 default='auto',
185 default='auto',
186 )
186 )
187 coreconfigitem('color', 'pagermode',
187 coreconfigitem('color', 'pagermode',
188 default=dynamicdefault,
188 default=dynamicdefault,
189 )
189 )
190 coreconfigitem('commands', 'grep.all-files',
190 coreconfigitem('commands', 'grep.all-files',
191 default=False,
191 default=False,
192 )
192 )
193 coreconfigitem('commands', 'show.aliasprefix',
193 coreconfigitem('commands', 'show.aliasprefix',
194 default=list,
194 default=list,
195 )
195 )
196 coreconfigitem('commands', 'status.relative',
196 coreconfigitem('commands', 'status.relative',
197 default=False,
197 default=False,
198 )
198 )
199 coreconfigitem('commands', 'status.skipstates',
199 coreconfigitem('commands', 'status.skipstates',
200 default=[],
200 default=[],
201 )
201 )
202 coreconfigitem('commands', 'status.terse',
202 coreconfigitem('commands', 'status.terse',
203 default='',
203 default='',
204 )
204 )
205 coreconfigitem('commands', 'status.verbose',
205 coreconfigitem('commands', 'status.verbose',
206 default=False,
206 default=False,
207 )
207 )
208 coreconfigitem('commands', 'update.check',
208 coreconfigitem('commands', 'update.check',
209 default=None,
209 default=None,
210 )
210 )
211 coreconfigitem('commands', 'update.requiredest',
211 coreconfigitem('commands', 'update.requiredest',
212 default=False,
212 default=False,
213 )
213 )
214 coreconfigitem('committemplate', '.*',
214 coreconfigitem('committemplate', '.*',
215 default=None,
215 default=None,
216 generic=True,
216 generic=True,
217 )
217 )
218 coreconfigitem('convert', 'bzr.saverev',
218 coreconfigitem('convert', 'bzr.saverev',
219 default=True,
219 default=True,
220 )
220 )
221 coreconfigitem('convert', 'cvsps.cache',
221 coreconfigitem('convert', 'cvsps.cache',
222 default=True,
222 default=True,
223 )
223 )
224 coreconfigitem('convert', 'cvsps.fuzz',
224 coreconfigitem('convert', 'cvsps.fuzz',
225 default=60,
225 default=60,
226 )
226 )
227 coreconfigitem('convert', 'cvsps.logencoding',
227 coreconfigitem('convert', 'cvsps.logencoding',
228 default=None,
228 default=None,
229 )
229 )
230 coreconfigitem('convert', 'cvsps.mergefrom',
230 coreconfigitem('convert', 'cvsps.mergefrom',
231 default=None,
231 default=None,
232 )
232 )
233 coreconfigitem('convert', 'cvsps.mergeto',
233 coreconfigitem('convert', 'cvsps.mergeto',
234 default=None,
234 default=None,
235 )
235 )
236 coreconfigitem('convert', 'git.committeractions',
236 coreconfigitem('convert', 'git.committeractions',
237 default=lambda: ['messagedifferent'],
237 default=lambda: ['messagedifferent'],
238 )
238 )
239 coreconfigitem('convert', 'git.extrakeys',
239 coreconfigitem('convert', 'git.extrakeys',
240 default=list,
240 default=list,
241 )
241 )
242 coreconfigitem('convert', 'git.findcopiesharder',
242 coreconfigitem('convert', 'git.findcopiesharder',
243 default=False,
243 default=False,
244 )
244 )
245 coreconfigitem('convert', 'git.remoteprefix',
245 coreconfigitem('convert', 'git.remoteprefix',
246 default='remote',
246 default='remote',
247 )
247 )
248 coreconfigitem('convert', 'git.renamelimit',
248 coreconfigitem('convert', 'git.renamelimit',
249 default=400,
249 default=400,
250 )
250 )
251 coreconfigitem('convert', 'git.saverev',
251 coreconfigitem('convert', 'git.saverev',
252 default=True,
252 default=True,
253 )
253 )
254 coreconfigitem('convert', 'git.similarity',
254 coreconfigitem('convert', 'git.similarity',
255 default=50,
255 default=50,
256 )
256 )
257 coreconfigitem('convert', 'git.skipsubmodules',
257 coreconfigitem('convert', 'git.skipsubmodules',
258 default=False,
258 default=False,
259 )
259 )
260 coreconfigitem('convert', 'hg.clonebranches',
260 coreconfigitem('convert', 'hg.clonebranches',
261 default=False,
261 default=False,
262 )
262 )
263 coreconfigitem('convert', 'hg.ignoreerrors',
263 coreconfigitem('convert', 'hg.ignoreerrors',
264 default=False,
264 default=False,
265 )
265 )
266 coreconfigitem('convert', 'hg.revs',
266 coreconfigitem('convert', 'hg.revs',
267 default=None,
267 default=None,
268 )
268 )
269 coreconfigitem('convert', 'hg.saverev',
269 coreconfigitem('convert', 'hg.saverev',
270 default=False,
270 default=False,
271 )
271 )
272 coreconfigitem('convert', 'hg.sourcename',
272 coreconfigitem('convert', 'hg.sourcename',
273 default=None,
273 default=None,
274 )
274 )
275 coreconfigitem('convert', 'hg.startrev',
275 coreconfigitem('convert', 'hg.startrev',
276 default=None,
276 default=None,
277 )
277 )
278 coreconfigitem('convert', 'hg.tagsbranch',
278 coreconfigitem('convert', 'hg.tagsbranch',
279 default='default',
279 default='default',
280 )
280 )
281 coreconfigitem('convert', 'hg.usebranchnames',
281 coreconfigitem('convert', 'hg.usebranchnames',
282 default=True,
282 default=True,
283 )
283 )
284 coreconfigitem('convert', 'ignoreancestorcheck',
284 coreconfigitem('convert', 'ignoreancestorcheck',
285 default=False,
285 default=False,
286 )
286 )
287 coreconfigitem('convert', 'localtimezone',
287 coreconfigitem('convert', 'localtimezone',
288 default=False,
288 default=False,
289 )
289 )
290 coreconfigitem('convert', 'p4.encoding',
290 coreconfigitem('convert', 'p4.encoding',
291 default=dynamicdefault,
291 default=dynamicdefault,
292 )
292 )
293 coreconfigitem('convert', 'p4.startrev',
293 coreconfigitem('convert', 'p4.startrev',
294 default=0,
294 default=0,
295 )
295 )
296 coreconfigitem('convert', 'skiptags',
296 coreconfigitem('convert', 'skiptags',
297 default=False,
297 default=False,
298 )
298 )
299 coreconfigitem('convert', 'svn.debugsvnlog',
299 coreconfigitem('convert', 'svn.debugsvnlog',
300 default=True,
300 default=True,
301 )
301 )
302 coreconfigitem('convert', 'svn.trunk',
302 coreconfigitem('convert', 'svn.trunk',
303 default=None,
303 default=None,
304 )
304 )
305 coreconfigitem('convert', 'svn.tags',
305 coreconfigitem('convert', 'svn.tags',
306 default=None,
306 default=None,
307 )
307 )
308 coreconfigitem('convert', 'svn.branches',
308 coreconfigitem('convert', 'svn.branches',
309 default=None,
309 default=None,
310 )
310 )
311 coreconfigitem('convert', 'svn.startrev',
311 coreconfigitem('convert', 'svn.startrev',
312 default=0,
312 default=0,
313 )
313 )
314 coreconfigitem('debug', 'dirstate.delaywrite',
314 coreconfigitem('debug', 'dirstate.delaywrite',
315 default=0,
315 default=0,
316 )
316 )
317 coreconfigitem('defaults', '.*',
317 coreconfigitem('defaults', '.*',
318 default=None,
318 default=None,
319 generic=True,
319 generic=True,
320 )
320 )
321 coreconfigitem('devel', 'all-warnings',
321 coreconfigitem('devel', 'all-warnings',
322 default=False,
322 default=False,
323 )
323 )
324 coreconfigitem('devel', 'bundle2.debug',
324 coreconfigitem('devel', 'bundle2.debug',
325 default=False,
325 default=False,
326 )
326 )
327 coreconfigitem('devel', 'cache-vfs',
327 coreconfigitem('devel', 'cache-vfs',
328 default=None,
328 default=None,
329 )
329 )
330 coreconfigitem('devel', 'check-locks',
330 coreconfigitem('devel', 'check-locks',
331 default=False,
331 default=False,
332 )
332 )
333 coreconfigitem('devel', 'check-relroot',
333 coreconfigitem('devel', 'check-relroot',
334 default=False,
334 default=False,
335 )
335 )
336 coreconfigitem('devel', 'default-date',
336 coreconfigitem('devel', 'default-date',
337 default=None,
337 default=None,
338 )
338 )
339 coreconfigitem('devel', 'deprec-warn',
339 coreconfigitem('devel', 'deprec-warn',
340 default=False,
340 default=False,
341 )
341 )
342 coreconfigitem('devel', 'disableloaddefaultcerts',
342 coreconfigitem('devel', 'disableloaddefaultcerts',
343 default=False,
343 default=False,
344 )
344 )
345 coreconfigitem('devel', 'warn-empty-changegroup',
345 coreconfigitem('devel', 'warn-empty-changegroup',
346 default=False,
346 default=False,
347 )
347 )
348 coreconfigitem('devel', 'legacy.exchange',
348 coreconfigitem('devel', 'legacy.exchange',
349 default=list,
349 default=list,
350 )
350 )
351 coreconfigitem('devel', 'servercafile',
351 coreconfigitem('devel', 'servercafile',
352 default='',
352 default='',
353 )
353 )
354 coreconfigitem('devel', 'serverexactprotocol',
354 coreconfigitem('devel', 'serverexactprotocol',
355 default='',
355 default='',
356 )
356 )
357 coreconfigitem('devel', 'serverrequirecert',
357 coreconfigitem('devel', 'serverrequirecert',
358 default=False,
358 default=False,
359 )
359 )
360 coreconfigitem('devel', 'strip-obsmarkers',
360 coreconfigitem('devel', 'strip-obsmarkers',
361 default=True,
361 default=True,
362 )
362 )
363 coreconfigitem('devel', 'warn-config',
363 coreconfigitem('devel', 'warn-config',
364 default=None,
364 default=None,
365 )
365 )
366 coreconfigitem('devel', 'warn-config-default',
366 coreconfigitem('devel', 'warn-config-default',
367 default=None,
367 default=None,
368 )
368 )
369 coreconfigitem('devel', 'user.obsmarker',
369 coreconfigitem('devel', 'user.obsmarker',
370 default=None,
370 default=None,
371 )
371 )
372 coreconfigitem('devel', 'warn-config-unknown',
372 coreconfigitem('devel', 'warn-config-unknown',
373 default=None,
373 default=None,
374 )
374 )
375 coreconfigitem('devel', 'debug.extensions',
375 coreconfigitem('devel', 'debug.extensions',
376 default=False,
376 default=False,
377 )
377 )
378 coreconfigitem('devel', 'debug.peer-request',
378 coreconfigitem('devel', 'debug.peer-request',
379 default=False,
379 default=False,
380 )
380 )
381 coreconfigitem('diff', 'nodates',
381 coreconfigitem('diff', 'nodates',
382 default=False,
382 default=False,
383 )
383 )
384 coreconfigitem('diff', 'showfunc',
384 coreconfigitem('diff', 'showfunc',
385 default=False,
385 default=False,
386 )
386 )
387 coreconfigitem('diff', 'unified',
387 coreconfigitem('diff', 'unified',
388 default=None,
388 default=None,
389 )
389 )
390 coreconfigitem('diff', 'git',
390 coreconfigitem('diff', 'git',
391 default=False,
391 default=False,
392 )
392 )
393 coreconfigitem('diff', 'ignorews',
393 coreconfigitem('diff', 'ignorews',
394 default=False,
394 default=False,
395 )
395 )
396 coreconfigitem('diff', 'ignorewsamount',
396 coreconfigitem('diff', 'ignorewsamount',
397 default=False,
397 default=False,
398 )
398 )
399 coreconfigitem('diff', 'ignoreblanklines',
399 coreconfigitem('diff', 'ignoreblanklines',
400 default=False,
400 default=False,
401 )
401 )
402 coreconfigitem('diff', 'ignorewseol',
402 coreconfigitem('diff', 'ignorewseol',
403 default=False,
403 default=False,
404 )
404 )
405 coreconfigitem('diff', 'nobinary',
405 coreconfigitem('diff', 'nobinary',
406 default=False,
406 default=False,
407 )
407 )
408 coreconfigitem('diff', 'noprefix',
408 coreconfigitem('diff', 'noprefix',
409 default=False,
409 default=False,
410 )
410 )
411 coreconfigitem('diff', 'word-diff',
411 coreconfigitem('diff', 'word-diff',
412 default=False,
412 default=False,
413 )
413 )
414 coreconfigitem('email', 'bcc',
414 coreconfigitem('email', 'bcc',
415 default=None,
415 default=None,
416 )
416 )
417 coreconfigitem('email', 'cc',
417 coreconfigitem('email', 'cc',
418 default=None,
418 default=None,
419 )
419 )
420 coreconfigitem('email', 'charsets',
420 coreconfigitem('email', 'charsets',
421 default=list,
421 default=list,
422 )
422 )
423 coreconfigitem('email', 'from',
423 coreconfigitem('email', 'from',
424 default=None,
424 default=None,
425 )
425 )
426 coreconfigitem('email', 'method',
426 coreconfigitem('email', 'method',
427 default='smtp',
427 default='smtp',
428 )
428 )
429 coreconfigitem('email', 'reply-to',
429 coreconfigitem('email', 'reply-to',
430 default=None,
430 default=None,
431 )
431 )
432 coreconfigitem('email', 'to',
432 coreconfigitem('email', 'to',
433 default=None,
433 default=None,
434 )
434 )
435 coreconfigitem('experimental', 'archivemetatemplate',
435 coreconfigitem('experimental', 'archivemetatemplate',
436 default=dynamicdefault,
436 default=dynamicdefault,
437 )
437 )
438 coreconfigitem('experimental', 'bundle-phases',
438 coreconfigitem('experimental', 'bundle-phases',
439 default=False,
439 default=False,
440 )
440 )
441 coreconfigitem('experimental', 'bundle2-advertise',
441 coreconfigitem('experimental', 'bundle2-advertise',
442 default=True,
442 default=True,
443 )
443 )
444 coreconfigitem('experimental', 'bundle2-output-capture',
444 coreconfigitem('experimental', 'bundle2-output-capture',
445 default=False,
445 default=False,
446 )
446 )
447 coreconfigitem('experimental', 'bundle2.pushback',
447 coreconfigitem('experimental', 'bundle2.pushback',
448 default=False,
448 default=False,
449 )
449 )
450 coreconfigitem('experimental', 'bundle2.stream',
450 coreconfigitem('experimental', 'bundle2.stream',
451 default=False,
451 default=False,
452 )
452 )
453 coreconfigitem('experimental', 'bundle2lazylocking',
453 coreconfigitem('experimental', 'bundle2lazylocking',
454 default=False,
454 default=False,
455 )
455 )
456 coreconfigitem('experimental', 'bundlecomplevel',
456 coreconfigitem('experimental', 'bundlecomplevel',
457 default=None,
457 default=None,
458 )
458 )
459 coreconfigitem('experimental', 'bundlecomplevel.bzip2',
459 coreconfigitem('experimental', 'bundlecomplevel.bzip2',
460 default=None,
460 default=None,
461 )
461 )
462 coreconfigitem('experimental', 'bundlecomplevel.gzip',
462 coreconfigitem('experimental', 'bundlecomplevel.gzip',
463 default=None,
463 default=None,
464 )
464 )
465 coreconfigitem('experimental', 'bundlecomplevel.none',
465 coreconfigitem('experimental', 'bundlecomplevel.none',
466 default=None,
466 default=None,
467 )
467 )
468 coreconfigitem('experimental', 'bundlecomplevel.zstd',
468 coreconfigitem('experimental', 'bundlecomplevel.zstd',
469 default=None,
469 default=None,
470 )
470 )
471 coreconfigitem('experimental', 'changegroup3',
471 coreconfigitem('experimental', 'changegroup3',
472 default=False,
472 default=False,
473 )
473 )
474 coreconfigitem('experimental', 'clientcompressionengines',
474 coreconfigitem('experimental', 'clientcompressionengines',
475 default=list,
475 default=list,
476 )
476 )
477 coreconfigitem('experimental', 'copytrace',
477 coreconfigitem('experimental', 'copytrace',
478 default='on',
478 default='on',
479 )
479 )
480 coreconfigitem('experimental', 'copytrace.movecandidateslimit',
480 coreconfigitem('experimental', 'copytrace.movecandidateslimit',
481 default=100,
481 default=100,
482 )
482 )
483 coreconfigitem('experimental', 'copytrace.sourcecommitlimit',
483 coreconfigitem('experimental', 'copytrace.sourcecommitlimit',
484 default=100,
484 default=100,
485 )
485 )
486 coreconfigitem('experimental', 'crecordtest',
486 coreconfigitem('experimental', 'crecordtest',
487 default=None,
487 default=None,
488 )
488 )
489 coreconfigitem('experimental', 'directaccess',
489 coreconfigitem('experimental', 'directaccess',
490 default=False,
490 default=False,
491 )
491 )
492 coreconfigitem('experimental', 'directaccess.revnums',
492 coreconfigitem('experimental', 'directaccess.revnums',
493 default=False,
493 default=False,
494 )
494 )
495 coreconfigitem('experimental', 'editortmpinhg',
495 coreconfigitem('experimental', 'editortmpinhg',
496 default=False,
496 default=False,
497 )
497 )
498 coreconfigitem('experimental', 'evolution',
498 coreconfigitem('experimental', 'evolution',
499 default=list,
499 default=list,
500 )
500 )
501 coreconfigitem('experimental', 'evolution.allowdivergence',
501 coreconfigitem('experimental', 'evolution.allowdivergence',
502 default=False,
502 default=False,
503 alias=[('experimental', 'allowdivergence')]
503 alias=[('experimental', 'allowdivergence')]
504 )
504 )
505 coreconfigitem('experimental', 'evolution.allowunstable',
505 coreconfigitem('experimental', 'evolution.allowunstable',
506 default=None,
506 default=None,
507 )
507 )
508 coreconfigitem('experimental', 'evolution.createmarkers',
508 coreconfigitem('experimental', 'evolution.createmarkers',
509 default=None,
509 default=None,
510 )
510 )
511 coreconfigitem('experimental', 'evolution.effect-flags',
511 coreconfigitem('experimental', 'evolution.effect-flags',
512 default=True,
512 default=True,
513 alias=[('experimental', 'effect-flags')]
513 alias=[('experimental', 'effect-flags')]
514 )
514 )
515 coreconfigitem('experimental', 'evolution.exchange',
515 coreconfigitem('experimental', 'evolution.exchange',
516 default=None,
516 default=None,
517 )
517 )
518 coreconfigitem('experimental', 'evolution.bundle-obsmarker',
518 coreconfigitem('experimental', 'evolution.bundle-obsmarker',
519 default=False,
519 default=False,
520 )
520 )
521 coreconfigitem('experimental', 'evolution.report-instabilities',
521 coreconfigitem('experimental', 'evolution.report-instabilities',
522 default=True,
522 default=True,
523 )
523 )
524 coreconfigitem('experimental', 'evolution.track-operation',
524 coreconfigitem('experimental', 'evolution.track-operation',
525 default=True,
525 default=True,
526 )
526 )
527 coreconfigitem('experimental', 'maxdeltachainspan',
527 coreconfigitem('experimental', 'maxdeltachainspan',
528 default=-1,
528 default=-1,
529 )
529 )
530 coreconfigitem('experimental', 'mergetempdirprefix',
530 coreconfigitem('experimental', 'mergetempdirprefix',
531 default=None,
531 default=None,
532 )
532 )
533 coreconfigitem('experimental', 'mmapindexthreshold',
533 coreconfigitem('experimental', 'mmapindexthreshold',
534 default=None,
534 default=None,
535 )
535 )
536 coreconfigitem('experimental', 'nonnormalparanoidcheck',
536 coreconfigitem('experimental', 'nonnormalparanoidcheck',
537 default=False,
537 default=False,
538 )
538 )
539 coreconfigitem('experimental', 'exportableenviron',
539 coreconfigitem('experimental', 'exportableenviron',
540 default=list,
540 default=list,
541 )
541 )
542 coreconfigitem('experimental', 'extendedheader.index',
542 coreconfigitem('experimental', 'extendedheader.index',
543 default=None,
543 default=None,
544 )
544 )
545 coreconfigitem('experimental', 'extendedheader.similarity',
545 coreconfigitem('experimental', 'extendedheader.similarity',
546 default=False,
546 default=False,
547 )
547 )
548 coreconfigitem('experimental', 'format.compression',
548 coreconfigitem('experimental', 'format.compression',
549 default='zlib',
549 default='zlib',
550 )
550 )
551 coreconfigitem('experimental', 'graphshorten',
551 coreconfigitem('experimental', 'graphshorten',
552 default=False,
552 default=False,
553 )
553 )
554 coreconfigitem('experimental', 'graphstyle.parent',
554 coreconfigitem('experimental', 'graphstyle.parent',
555 default=dynamicdefault,
555 default=dynamicdefault,
556 )
556 )
557 coreconfigitem('experimental', 'graphstyle.missing',
557 coreconfigitem('experimental', 'graphstyle.missing',
558 default=dynamicdefault,
558 default=dynamicdefault,
559 )
559 )
560 coreconfigitem('experimental', 'graphstyle.grandparent',
560 coreconfigitem('experimental', 'graphstyle.grandparent',
561 default=dynamicdefault,
561 default=dynamicdefault,
562 )
562 )
563 coreconfigitem('experimental', 'hook-track-tags',
563 coreconfigitem('experimental', 'hook-track-tags',
564 default=False,
564 default=False,
565 )
565 )
566 coreconfigitem('experimental', 'httppeer.advertise-v2',
566 coreconfigitem('experimental', 'httppeer.advertise-v2',
567 default=False,
567 default=False,
568 )
568 )
569 coreconfigitem('experimental', 'httppostargs',
569 coreconfigitem('experimental', 'httppostargs',
570 default=False,
570 default=False,
571 )
571 )
572 coreconfigitem('experimental', 'mergedriver',
572 coreconfigitem('experimental', 'mergedriver',
573 default=None,
573 default=None,
574 )
574 )
575 coreconfigitem('experimental', 'nointerrupt', default=False)
575 coreconfigitem('experimental', 'nointerrupt', default=False)
576 coreconfigitem('experimental', 'nointerrupt-interactiveonly', default=True)
576 coreconfigitem('experimental', 'nointerrupt-interactiveonly', default=True)
577
577
578 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
578 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
579 default=False,
579 default=False,
580 )
580 )
581 coreconfigitem('experimental', 'remotenames',
581 coreconfigitem('experimental', 'remotenames',
582 default=False,
582 default=False,
583 )
583 )
584 coreconfigitem('experimental', 'removeemptydirs',
584 coreconfigitem('experimental', 'removeemptydirs',
585 default=True,
585 default=True,
586 )
586 )
587 coreconfigitem('experimental', 'revlogv2',
587 coreconfigitem('experimental', 'revlogv2',
588 default=None,
588 default=None,
589 )
589 )
590 coreconfigitem('experimental', 'single-head-per-branch',
590 coreconfigitem('experimental', 'single-head-per-branch',
591 default=False,
591 default=False,
592 )
592 )
593 coreconfigitem('experimental', 'sshserver.support-v2',
593 coreconfigitem('experimental', 'sshserver.support-v2',
594 default=False,
594 default=False,
595 )
595 )
596 coreconfigitem('experimental', 'spacemovesdown',
596 coreconfigitem('experimental', 'spacemovesdown',
597 default=False,
597 default=False,
598 )
598 )
599 coreconfigitem('experimental', 'sparse-read',
599 coreconfigitem('experimental', 'sparse-read',
600 default=False,
600 default=False,
601 )
601 )
602 coreconfigitem('experimental', 'sparse-read.density-threshold',
602 coreconfigitem('experimental', 'sparse-read.density-threshold',
603 default=0.50,
603 default=0.50,
604 )
604 )
605 coreconfigitem('experimental', 'sparse-read.min-gap-size',
605 coreconfigitem('experimental', 'sparse-read.min-gap-size',
606 default='65K',
606 default='65K',
607 )
607 )
608 coreconfigitem('experimental', 'treemanifest',
608 coreconfigitem('experimental', 'treemanifest',
609 default=False,
609 default=False,
610 )
610 )
611 coreconfigitem('experimental', 'update.atomic-file',
611 coreconfigitem('experimental', 'update.atomic-file',
612 default=False,
612 default=False,
613 )
613 )
614 coreconfigitem('experimental', 'sshpeer.advertise-v2',
614 coreconfigitem('experimental', 'sshpeer.advertise-v2',
615 default=False,
615 default=False,
616 )
616 )
617 coreconfigitem('experimental', 'web.apiserver',
617 coreconfigitem('experimental', 'web.apiserver',
618 default=False,
618 default=False,
619 )
619 )
620 coreconfigitem('experimental', 'web.api.http-v2',
620 coreconfigitem('experimental', 'web.api.http-v2',
621 default=False,
621 default=False,
622 )
622 )
623 coreconfigitem('experimental', 'web.api.debugreflect',
623 coreconfigitem('experimental', 'web.api.debugreflect',
624 default=False,
624 default=False,
625 )
625 )
626 coreconfigitem('experimental', 'worker.wdir-get-thread-safe',
626 coreconfigitem('experimental', 'worker.wdir-get-thread-safe',
627 default=False,
627 default=False,
628 )
628 )
629 coreconfigitem('experimental', 'xdiff',
629 coreconfigitem('experimental', 'xdiff',
630 default=False,
630 default=False,
631 )
631 )
632 coreconfigitem('extensions', '.*',
632 coreconfigitem('extensions', '.*',
633 default=None,
633 default=None,
634 generic=True,
634 generic=True,
635 )
635 )
636 coreconfigitem('extdata', '.*',
636 coreconfigitem('extdata', '.*',
637 default=None,
637 default=None,
638 generic=True,
638 generic=True,
639 )
639 )
640 coreconfigitem('format', 'aggressivemergedeltas',
641 default=True,
642 )
643 coreconfigitem('format', 'chunkcachesize',
640 coreconfigitem('format', 'chunkcachesize',
644 default=None,
641 default=None,
645 )
642 )
646 coreconfigitem('format', 'dotencode',
643 coreconfigitem('format', 'dotencode',
647 default=True,
644 default=True,
648 )
645 )
649 coreconfigitem('format', 'generaldelta',
646 coreconfigitem('format', 'generaldelta',
650 default=False,
647 default=False,
651 )
648 )
652 coreconfigitem('format', 'manifestcachesize',
649 coreconfigitem('format', 'manifestcachesize',
653 default=None,
650 default=None,
654 )
651 )
655 coreconfigitem('format', 'maxchainlen',
652 coreconfigitem('format', 'maxchainlen',
656 default=None,
653 default=None,
657 )
654 )
658 coreconfigitem('format', 'obsstore-version',
655 coreconfigitem('format', 'obsstore-version',
659 default=None,
656 default=None,
660 )
657 )
661 coreconfigitem('format', 'sparse-revlog',
658 coreconfigitem('format', 'sparse-revlog',
662 default=False,
659 default=False,
663 )
660 )
664 coreconfigitem('format', 'usefncache',
661 coreconfigitem('format', 'usefncache',
665 default=True,
662 default=True,
666 )
663 )
667 coreconfigitem('format', 'usegeneraldelta',
664 coreconfigitem('format', 'usegeneraldelta',
668 default=True,
665 default=True,
669 )
666 )
670 coreconfigitem('format', 'usestore',
667 coreconfigitem('format', 'usestore',
671 default=True,
668 default=True,
672 )
669 )
673 coreconfigitem('fsmonitor', 'warn_when_unused',
670 coreconfigitem('fsmonitor', 'warn_when_unused',
674 default=True,
671 default=True,
675 )
672 )
676 coreconfigitem('fsmonitor', 'warn_update_file_count',
673 coreconfigitem('fsmonitor', 'warn_update_file_count',
677 default=50000,
674 default=50000,
678 )
675 )
679 coreconfigitem('hooks', '.*',
676 coreconfigitem('hooks', '.*',
680 default=dynamicdefault,
677 default=dynamicdefault,
681 generic=True,
678 generic=True,
682 )
679 )
683 coreconfigitem('hgweb-paths', '.*',
680 coreconfigitem('hgweb-paths', '.*',
684 default=list,
681 default=list,
685 generic=True,
682 generic=True,
686 )
683 )
687 coreconfigitem('hostfingerprints', '.*',
684 coreconfigitem('hostfingerprints', '.*',
688 default=list,
685 default=list,
689 generic=True,
686 generic=True,
690 )
687 )
691 coreconfigitem('hostsecurity', 'ciphers',
688 coreconfigitem('hostsecurity', 'ciphers',
692 default=None,
689 default=None,
693 )
690 )
694 coreconfigitem('hostsecurity', 'disabletls10warning',
691 coreconfigitem('hostsecurity', 'disabletls10warning',
695 default=False,
692 default=False,
696 )
693 )
697 coreconfigitem('hostsecurity', 'minimumprotocol',
694 coreconfigitem('hostsecurity', 'minimumprotocol',
698 default=dynamicdefault,
695 default=dynamicdefault,
699 )
696 )
700 coreconfigitem('hostsecurity', '.*:minimumprotocol$',
697 coreconfigitem('hostsecurity', '.*:minimumprotocol$',
701 default=dynamicdefault,
698 default=dynamicdefault,
702 generic=True,
699 generic=True,
703 )
700 )
704 coreconfigitem('hostsecurity', '.*:ciphers$',
701 coreconfigitem('hostsecurity', '.*:ciphers$',
705 default=dynamicdefault,
702 default=dynamicdefault,
706 generic=True,
703 generic=True,
707 )
704 )
708 coreconfigitem('hostsecurity', '.*:fingerprints$',
705 coreconfigitem('hostsecurity', '.*:fingerprints$',
709 default=list,
706 default=list,
710 generic=True,
707 generic=True,
711 )
708 )
712 coreconfigitem('hostsecurity', '.*:verifycertsfile$',
709 coreconfigitem('hostsecurity', '.*:verifycertsfile$',
713 default=None,
710 default=None,
714 generic=True,
711 generic=True,
715 )
712 )
716
713
717 coreconfigitem('http_proxy', 'always',
714 coreconfigitem('http_proxy', 'always',
718 default=False,
715 default=False,
719 )
716 )
720 coreconfigitem('http_proxy', 'host',
717 coreconfigitem('http_proxy', 'host',
721 default=None,
718 default=None,
722 )
719 )
723 coreconfigitem('http_proxy', 'no',
720 coreconfigitem('http_proxy', 'no',
724 default=list,
721 default=list,
725 )
722 )
726 coreconfigitem('http_proxy', 'passwd',
723 coreconfigitem('http_proxy', 'passwd',
727 default=None,
724 default=None,
728 )
725 )
729 coreconfigitem('http_proxy', 'user',
726 coreconfigitem('http_proxy', 'user',
730 default=None,
727 default=None,
731 )
728 )
732 coreconfigitem('logtoprocess', 'commandexception',
729 coreconfigitem('logtoprocess', 'commandexception',
733 default=None,
730 default=None,
734 )
731 )
735 coreconfigitem('logtoprocess', 'commandfinish',
732 coreconfigitem('logtoprocess', 'commandfinish',
736 default=None,
733 default=None,
737 )
734 )
738 coreconfigitem('logtoprocess', 'command',
735 coreconfigitem('logtoprocess', 'command',
739 default=None,
736 default=None,
740 )
737 )
741 coreconfigitem('logtoprocess', 'develwarn',
738 coreconfigitem('logtoprocess', 'develwarn',
742 default=None,
739 default=None,
743 )
740 )
744 coreconfigitem('logtoprocess', 'uiblocked',
741 coreconfigitem('logtoprocess', 'uiblocked',
745 default=None,
742 default=None,
746 )
743 )
747 coreconfigitem('merge', 'checkunknown',
744 coreconfigitem('merge', 'checkunknown',
748 default='abort',
745 default='abort',
749 )
746 )
750 coreconfigitem('merge', 'checkignored',
747 coreconfigitem('merge', 'checkignored',
751 default='abort',
748 default='abort',
752 )
749 )
753 coreconfigitem('experimental', 'merge.checkpathconflicts',
750 coreconfigitem('experimental', 'merge.checkpathconflicts',
754 default=False,
751 default=False,
755 )
752 )
756 coreconfigitem('merge', 'followcopies',
753 coreconfigitem('merge', 'followcopies',
757 default=True,
754 default=True,
758 )
755 )
759 coreconfigitem('merge', 'on-failure',
756 coreconfigitem('merge', 'on-failure',
760 default='continue',
757 default='continue',
761 )
758 )
762 coreconfigitem('merge', 'preferancestor',
759 coreconfigitem('merge', 'preferancestor',
763 default=lambda: ['*'],
760 default=lambda: ['*'],
764 )
761 )
765 coreconfigitem('merge-tools', '.*',
762 coreconfigitem('merge-tools', '.*',
766 default=None,
763 default=None,
767 generic=True,
764 generic=True,
768 )
765 )
769 coreconfigitem('merge-tools', br'.*\.args$',
766 coreconfigitem('merge-tools', br'.*\.args$',
770 default="$local $base $other",
767 default="$local $base $other",
771 generic=True,
768 generic=True,
772 priority=-1,
769 priority=-1,
773 )
770 )
774 coreconfigitem('merge-tools', br'.*\.binary$',
771 coreconfigitem('merge-tools', br'.*\.binary$',
775 default=False,
772 default=False,
776 generic=True,
773 generic=True,
777 priority=-1,
774 priority=-1,
778 )
775 )
779 coreconfigitem('merge-tools', br'.*\.check$',
776 coreconfigitem('merge-tools', br'.*\.check$',
780 default=list,
777 default=list,
781 generic=True,
778 generic=True,
782 priority=-1,
779 priority=-1,
783 )
780 )
784 coreconfigitem('merge-tools', br'.*\.checkchanged$',
781 coreconfigitem('merge-tools', br'.*\.checkchanged$',
785 default=False,
782 default=False,
786 generic=True,
783 generic=True,
787 priority=-1,
784 priority=-1,
788 )
785 )
789 coreconfigitem('merge-tools', br'.*\.executable$',
786 coreconfigitem('merge-tools', br'.*\.executable$',
790 default=dynamicdefault,
787 default=dynamicdefault,
791 generic=True,
788 generic=True,
792 priority=-1,
789 priority=-1,
793 )
790 )
794 coreconfigitem('merge-tools', br'.*\.fixeol$',
791 coreconfigitem('merge-tools', br'.*\.fixeol$',
795 default=False,
792 default=False,
796 generic=True,
793 generic=True,
797 priority=-1,
794 priority=-1,
798 )
795 )
799 coreconfigitem('merge-tools', br'.*\.gui$',
796 coreconfigitem('merge-tools', br'.*\.gui$',
800 default=False,
797 default=False,
801 generic=True,
798 generic=True,
802 priority=-1,
799 priority=-1,
803 )
800 )
804 coreconfigitem('merge-tools', br'.*\.mergemarkers$',
801 coreconfigitem('merge-tools', br'.*\.mergemarkers$',
805 default='basic',
802 default='basic',
806 generic=True,
803 generic=True,
807 priority=-1,
804 priority=-1,
808 )
805 )
809 coreconfigitem('merge-tools', br'.*\.mergemarkertemplate$',
806 coreconfigitem('merge-tools', br'.*\.mergemarkertemplate$',
810 default=dynamicdefault, # take from ui.mergemarkertemplate
807 default=dynamicdefault, # take from ui.mergemarkertemplate
811 generic=True,
808 generic=True,
812 priority=-1,
809 priority=-1,
813 )
810 )
814 coreconfigitem('merge-tools', br'.*\.priority$',
811 coreconfigitem('merge-tools', br'.*\.priority$',
815 default=0,
812 default=0,
816 generic=True,
813 generic=True,
817 priority=-1,
814 priority=-1,
818 )
815 )
819 coreconfigitem('merge-tools', br'.*\.premerge$',
816 coreconfigitem('merge-tools', br'.*\.premerge$',
820 default=dynamicdefault,
817 default=dynamicdefault,
821 generic=True,
818 generic=True,
822 priority=-1,
819 priority=-1,
823 )
820 )
824 coreconfigitem('merge-tools', br'.*\.symlink$',
821 coreconfigitem('merge-tools', br'.*\.symlink$',
825 default=False,
822 default=False,
826 generic=True,
823 generic=True,
827 priority=-1,
824 priority=-1,
828 )
825 )
829 coreconfigitem('pager', 'attend-.*',
826 coreconfigitem('pager', 'attend-.*',
830 default=dynamicdefault,
827 default=dynamicdefault,
831 generic=True,
828 generic=True,
832 )
829 )
833 coreconfigitem('pager', 'ignore',
830 coreconfigitem('pager', 'ignore',
834 default=list,
831 default=list,
835 )
832 )
836 coreconfigitem('pager', 'pager',
833 coreconfigitem('pager', 'pager',
837 default=dynamicdefault,
834 default=dynamicdefault,
838 )
835 )
839 coreconfigitem('patch', 'eol',
836 coreconfigitem('patch', 'eol',
840 default='strict',
837 default='strict',
841 )
838 )
842 coreconfigitem('patch', 'fuzz',
839 coreconfigitem('patch', 'fuzz',
843 default=2,
840 default=2,
844 )
841 )
845 coreconfigitem('paths', 'default',
842 coreconfigitem('paths', 'default',
846 default=None,
843 default=None,
847 )
844 )
848 coreconfigitem('paths', 'default-push',
845 coreconfigitem('paths', 'default-push',
849 default=None,
846 default=None,
850 )
847 )
851 coreconfigitem('paths', '.*',
848 coreconfigitem('paths', '.*',
852 default=None,
849 default=None,
853 generic=True,
850 generic=True,
854 )
851 )
855 coreconfigitem('phases', 'checksubrepos',
852 coreconfigitem('phases', 'checksubrepos',
856 default='follow',
853 default='follow',
857 )
854 )
858 coreconfigitem('phases', 'new-commit',
855 coreconfigitem('phases', 'new-commit',
859 default='draft',
856 default='draft',
860 )
857 )
861 coreconfigitem('phases', 'publish',
858 coreconfigitem('phases', 'publish',
862 default=True,
859 default=True,
863 )
860 )
864 coreconfigitem('profiling', 'enabled',
861 coreconfigitem('profiling', 'enabled',
865 default=False,
862 default=False,
866 )
863 )
867 coreconfigitem('profiling', 'format',
864 coreconfigitem('profiling', 'format',
868 default='text',
865 default='text',
869 )
866 )
870 coreconfigitem('profiling', 'freq',
867 coreconfigitem('profiling', 'freq',
871 default=1000,
868 default=1000,
872 )
869 )
873 coreconfigitem('profiling', 'limit',
870 coreconfigitem('profiling', 'limit',
874 default=30,
871 default=30,
875 )
872 )
876 coreconfigitem('profiling', 'nested',
873 coreconfigitem('profiling', 'nested',
877 default=0,
874 default=0,
878 )
875 )
879 coreconfigitem('profiling', 'output',
876 coreconfigitem('profiling', 'output',
880 default=None,
877 default=None,
881 )
878 )
882 coreconfigitem('profiling', 'showmax',
879 coreconfigitem('profiling', 'showmax',
883 default=0.999,
880 default=0.999,
884 )
881 )
885 coreconfigitem('profiling', 'showmin',
882 coreconfigitem('profiling', 'showmin',
886 default=dynamicdefault,
883 default=dynamicdefault,
887 )
884 )
888 coreconfigitem('profiling', 'sort',
885 coreconfigitem('profiling', 'sort',
889 default='inlinetime',
886 default='inlinetime',
890 )
887 )
891 coreconfigitem('profiling', 'statformat',
888 coreconfigitem('profiling', 'statformat',
892 default='hotpath',
889 default='hotpath',
893 )
890 )
894 coreconfigitem('profiling', 'time-track',
891 coreconfigitem('profiling', 'time-track',
895 default='cpu',
892 default='cpu',
896 )
893 )
897 coreconfigitem('profiling', 'type',
894 coreconfigitem('profiling', 'type',
898 default='stat',
895 default='stat',
899 )
896 )
900 coreconfigitem('progress', 'assume-tty',
897 coreconfigitem('progress', 'assume-tty',
901 default=False,
898 default=False,
902 )
899 )
903 coreconfigitem('progress', 'changedelay',
900 coreconfigitem('progress', 'changedelay',
904 default=1,
901 default=1,
905 )
902 )
906 coreconfigitem('progress', 'clear-complete',
903 coreconfigitem('progress', 'clear-complete',
907 default=True,
904 default=True,
908 )
905 )
909 coreconfigitem('progress', 'debug',
906 coreconfigitem('progress', 'debug',
910 default=False,
907 default=False,
911 )
908 )
912 coreconfigitem('progress', 'delay',
909 coreconfigitem('progress', 'delay',
913 default=3,
910 default=3,
914 )
911 )
915 coreconfigitem('progress', 'disable',
912 coreconfigitem('progress', 'disable',
916 default=False,
913 default=False,
917 )
914 )
918 coreconfigitem('progress', 'estimateinterval',
915 coreconfigitem('progress', 'estimateinterval',
919 default=60.0,
916 default=60.0,
920 )
917 )
921 coreconfigitem('progress', 'format',
918 coreconfigitem('progress', 'format',
922 default=lambda: ['topic', 'bar', 'number', 'estimate'],
919 default=lambda: ['topic', 'bar', 'number', 'estimate'],
923 )
920 )
924 coreconfigitem('progress', 'refresh',
921 coreconfigitem('progress', 'refresh',
925 default=0.1,
922 default=0.1,
926 )
923 )
927 coreconfigitem('progress', 'width',
924 coreconfigitem('progress', 'width',
928 default=dynamicdefault,
925 default=dynamicdefault,
929 )
926 )
930 coreconfigitem('push', 'pushvars.server',
927 coreconfigitem('push', 'pushvars.server',
931 default=False,
928 default=False,
932 )
929 )
930 coreconfigitem('revlog', 'optimize-delta-parent-choice',
931 default=True,
932 # formely an experimental option: format.aggressivemergedeltas
933 )
933 coreconfigitem('server', 'bookmarks-pushkey-compat',
934 coreconfigitem('server', 'bookmarks-pushkey-compat',
934 default=True,
935 default=True,
935 )
936 )
936 coreconfigitem('server', 'bundle1',
937 coreconfigitem('server', 'bundle1',
937 default=True,
938 default=True,
938 )
939 )
939 coreconfigitem('server', 'bundle1gd',
940 coreconfigitem('server', 'bundle1gd',
940 default=None,
941 default=None,
941 )
942 )
942 coreconfigitem('server', 'bundle1.pull',
943 coreconfigitem('server', 'bundle1.pull',
943 default=None,
944 default=None,
944 )
945 )
945 coreconfigitem('server', 'bundle1gd.pull',
946 coreconfigitem('server', 'bundle1gd.pull',
946 default=None,
947 default=None,
947 )
948 )
948 coreconfigitem('server', 'bundle1.push',
949 coreconfigitem('server', 'bundle1.push',
949 default=None,
950 default=None,
950 )
951 )
951 coreconfigitem('server', 'bundle1gd.push',
952 coreconfigitem('server', 'bundle1gd.push',
952 default=None,
953 default=None,
953 )
954 )
954 coreconfigitem('server', 'compressionengines',
955 coreconfigitem('server', 'compressionengines',
955 default=list,
956 default=list,
956 )
957 )
957 coreconfigitem('server', 'concurrent-push-mode',
958 coreconfigitem('server', 'concurrent-push-mode',
958 default='strict',
959 default='strict',
959 )
960 )
960 coreconfigitem('server', 'disablefullbundle',
961 coreconfigitem('server', 'disablefullbundle',
961 default=False,
962 default=False,
962 )
963 )
963 coreconfigitem('server', 'maxhttpheaderlen',
964 coreconfigitem('server', 'maxhttpheaderlen',
964 default=1024,
965 default=1024,
965 )
966 )
966 coreconfigitem('server', 'pullbundle',
967 coreconfigitem('server', 'pullbundle',
967 default=False,
968 default=False,
968 )
969 )
969 coreconfigitem('server', 'preferuncompressed',
970 coreconfigitem('server', 'preferuncompressed',
970 default=False,
971 default=False,
971 )
972 )
972 coreconfigitem('server', 'streamunbundle',
973 coreconfigitem('server', 'streamunbundle',
973 default=False,
974 default=False,
974 )
975 )
975 coreconfigitem('server', 'uncompressed',
976 coreconfigitem('server', 'uncompressed',
976 default=True,
977 default=True,
977 )
978 )
978 coreconfigitem('server', 'uncompressedallowsecret',
979 coreconfigitem('server', 'uncompressedallowsecret',
979 default=False,
980 default=False,
980 )
981 )
981 coreconfigitem('server', 'validate',
982 coreconfigitem('server', 'validate',
982 default=False,
983 default=False,
983 )
984 )
984 coreconfigitem('server', 'zliblevel',
985 coreconfigitem('server', 'zliblevel',
985 default=-1,
986 default=-1,
986 )
987 )
987 coreconfigitem('server', 'zstdlevel',
988 coreconfigitem('server', 'zstdlevel',
988 default=3,
989 default=3,
989 )
990 )
990 coreconfigitem('share', 'pool',
991 coreconfigitem('share', 'pool',
991 default=None,
992 default=None,
992 )
993 )
993 coreconfigitem('share', 'poolnaming',
994 coreconfigitem('share', 'poolnaming',
994 default='identity',
995 default='identity',
995 )
996 )
996 coreconfigitem('smtp', 'host',
997 coreconfigitem('smtp', 'host',
997 default=None,
998 default=None,
998 )
999 )
999 coreconfigitem('smtp', 'local_hostname',
1000 coreconfigitem('smtp', 'local_hostname',
1000 default=None,
1001 default=None,
1001 )
1002 )
1002 coreconfigitem('smtp', 'password',
1003 coreconfigitem('smtp', 'password',
1003 default=None,
1004 default=None,
1004 )
1005 )
1005 coreconfigitem('smtp', 'port',
1006 coreconfigitem('smtp', 'port',
1006 default=dynamicdefault,
1007 default=dynamicdefault,
1007 )
1008 )
1008 coreconfigitem('smtp', 'tls',
1009 coreconfigitem('smtp', 'tls',
1009 default='none',
1010 default='none',
1010 )
1011 )
1011 coreconfigitem('smtp', 'username',
1012 coreconfigitem('smtp', 'username',
1012 default=None,
1013 default=None,
1013 )
1014 )
1014 coreconfigitem('sparse', 'missingwarning',
1015 coreconfigitem('sparse', 'missingwarning',
1015 default=True,
1016 default=True,
1016 )
1017 )
1017 coreconfigitem('subrepos', 'allowed',
1018 coreconfigitem('subrepos', 'allowed',
1018 default=dynamicdefault, # to make backporting simpler
1019 default=dynamicdefault, # to make backporting simpler
1019 )
1020 )
1020 coreconfigitem('subrepos', 'hg:allowed',
1021 coreconfigitem('subrepos', 'hg:allowed',
1021 default=dynamicdefault,
1022 default=dynamicdefault,
1022 )
1023 )
1023 coreconfigitem('subrepos', 'git:allowed',
1024 coreconfigitem('subrepos', 'git:allowed',
1024 default=dynamicdefault,
1025 default=dynamicdefault,
1025 )
1026 )
1026 coreconfigitem('subrepos', 'svn:allowed',
1027 coreconfigitem('subrepos', 'svn:allowed',
1027 default=dynamicdefault,
1028 default=dynamicdefault,
1028 )
1029 )
1029 coreconfigitem('templates', '.*',
1030 coreconfigitem('templates', '.*',
1030 default=None,
1031 default=None,
1031 generic=True,
1032 generic=True,
1032 )
1033 )
1033 coreconfigitem('trusted', 'groups',
1034 coreconfigitem('trusted', 'groups',
1034 default=list,
1035 default=list,
1035 )
1036 )
1036 coreconfigitem('trusted', 'users',
1037 coreconfigitem('trusted', 'users',
1037 default=list,
1038 default=list,
1038 )
1039 )
1039 coreconfigitem('ui', '_usedassubrepo',
1040 coreconfigitem('ui', '_usedassubrepo',
1040 default=False,
1041 default=False,
1041 )
1042 )
1042 coreconfigitem('ui', 'allowemptycommit',
1043 coreconfigitem('ui', 'allowemptycommit',
1043 default=False,
1044 default=False,
1044 )
1045 )
1045 coreconfigitem('ui', 'archivemeta',
1046 coreconfigitem('ui', 'archivemeta',
1046 default=True,
1047 default=True,
1047 )
1048 )
1048 coreconfigitem('ui', 'askusername',
1049 coreconfigitem('ui', 'askusername',
1049 default=False,
1050 default=False,
1050 )
1051 )
1051 coreconfigitem('ui', 'clonebundlefallback',
1052 coreconfigitem('ui', 'clonebundlefallback',
1052 default=False,
1053 default=False,
1053 )
1054 )
1054 coreconfigitem('ui', 'clonebundleprefers',
1055 coreconfigitem('ui', 'clonebundleprefers',
1055 default=list,
1056 default=list,
1056 )
1057 )
1057 coreconfigitem('ui', 'clonebundles',
1058 coreconfigitem('ui', 'clonebundles',
1058 default=True,
1059 default=True,
1059 )
1060 )
1060 coreconfigitem('ui', 'color',
1061 coreconfigitem('ui', 'color',
1061 default='auto',
1062 default='auto',
1062 )
1063 )
1063 coreconfigitem('ui', 'commitsubrepos',
1064 coreconfigitem('ui', 'commitsubrepos',
1064 default=False,
1065 default=False,
1065 )
1066 )
1066 coreconfigitem('ui', 'debug',
1067 coreconfigitem('ui', 'debug',
1067 default=False,
1068 default=False,
1068 )
1069 )
1069 coreconfigitem('ui', 'debugger',
1070 coreconfigitem('ui', 'debugger',
1070 default=None,
1071 default=None,
1071 )
1072 )
1072 coreconfigitem('ui', 'editor',
1073 coreconfigitem('ui', 'editor',
1073 default=dynamicdefault,
1074 default=dynamicdefault,
1074 )
1075 )
1075 coreconfigitem('ui', 'fallbackencoding',
1076 coreconfigitem('ui', 'fallbackencoding',
1076 default=None,
1077 default=None,
1077 )
1078 )
1078 coreconfigitem('ui', 'forcecwd',
1079 coreconfigitem('ui', 'forcecwd',
1079 default=None,
1080 default=None,
1080 )
1081 )
1081 coreconfigitem('ui', 'forcemerge',
1082 coreconfigitem('ui', 'forcemerge',
1082 default=None,
1083 default=None,
1083 )
1084 )
1084 coreconfigitem('ui', 'formatdebug',
1085 coreconfigitem('ui', 'formatdebug',
1085 default=False,
1086 default=False,
1086 )
1087 )
1087 coreconfigitem('ui', 'formatjson',
1088 coreconfigitem('ui', 'formatjson',
1088 default=False,
1089 default=False,
1089 )
1090 )
1090 coreconfigitem('ui', 'formatted',
1091 coreconfigitem('ui', 'formatted',
1091 default=None,
1092 default=None,
1092 )
1093 )
1093 coreconfigitem('ui', 'graphnodetemplate',
1094 coreconfigitem('ui', 'graphnodetemplate',
1094 default=None,
1095 default=None,
1095 )
1096 )
1096 coreconfigitem('ui', 'history-editing-backup',
1097 coreconfigitem('ui', 'history-editing-backup',
1097 default=True,
1098 default=True,
1098 )
1099 )
1099 coreconfigitem('ui', 'interactive',
1100 coreconfigitem('ui', 'interactive',
1100 default=None,
1101 default=None,
1101 )
1102 )
1102 coreconfigitem('ui', 'interface',
1103 coreconfigitem('ui', 'interface',
1103 default=None,
1104 default=None,
1104 )
1105 )
1105 coreconfigitem('ui', 'interface.chunkselector',
1106 coreconfigitem('ui', 'interface.chunkselector',
1106 default=None,
1107 default=None,
1107 )
1108 )
1108 coreconfigitem('ui', 'large-file-limit',
1109 coreconfigitem('ui', 'large-file-limit',
1109 default=10000000,
1110 default=10000000,
1110 )
1111 )
1111 coreconfigitem('ui', 'logblockedtimes',
1112 coreconfigitem('ui', 'logblockedtimes',
1112 default=False,
1113 default=False,
1113 )
1114 )
1114 coreconfigitem('ui', 'logtemplate',
1115 coreconfigitem('ui', 'logtemplate',
1115 default=None,
1116 default=None,
1116 )
1117 )
1117 coreconfigitem('ui', 'merge',
1118 coreconfigitem('ui', 'merge',
1118 default=None,
1119 default=None,
1119 )
1120 )
1120 coreconfigitem('ui', 'mergemarkers',
1121 coreconfigitem('ui', 'mergemarkers',
1121 default='basic',
1122 default='basic',
1122 )
1123 )
1123 coreconfigitem('ui', 'mergemarkertemplate',
1124 coreconfigitem('ui', 'mergemarkertemplate',
1124 default=('{node|short} '
1125 default=('{node|short} '
1125 '{ifeq(tags, "tip", "", '
1126 '{ifeq(tags, "tip", "", '
1126 'ifeq(tags, "", "", "{tags} "))}'
1127 'ifeq(tags, "", "", "{tags} "))}'
1127 '{if(bookmarks, "{bookmarks} ")}'
1128 '{if(bookmarks, "{bookmarks} ")}'
1128 '{ifeq(branch, "default", "", "{branch} ")}'
1129 '{ifeq(branch, "default", "", "{branch} ")}'
1129 '- {author|user}: {desc|firstline}')
1130 '- {author|user}: {desc|firstline}')
1130 )
1131 )
1131 coreconfigitem('ui', 'nontty',
1132 coreconfigitem('ui', 'nontty',
1132 default=False,
1133 default=False,
1133 )
1134 )
1134 coreconfigitem('ui', 'origbackuppath',
1135 coreconfigitem('ui', 'origbackuppath',
1135 default=None,
1136 default=None,
1136 )
1137 )
1137 coreconfigitem('ui', 'paginate',
1138 coreconfigitem('ui', 'paginate',
1138 default=True,
1139 default=True,
1139 )
1140 )
1140 coreconfigitem('ui', 'patch',
1141 coreconfigitem('ui', 'patch',
1141 default=None,
1142 default=None,
1142 )
1143 )
1143 coreconfigitem('ui', 'portablefilenames',
1144 coreconfigitem('ui', 'portablefilenames',
1144 default='warn',
1145 default='warn',
1145 )
1146 )
1146 coreconfigitem('ui', 'promptecho',
1147 coreconfigitem('ui', 'promptecho',
1147 default=False,
1148 default=False,
1148 )
1149 )
1149 coreconfigitem('ui', 'quiet',
1150 coreconfigitem('ui', 'quiet',
1150 default=False,
1151 default=False,
1151 )
1152 )
1152 coreconfigitem('ui', 'quietbookmarkmove',
1153 coreconfigitem('ui', 'quietbookmarkmove',
1153 default=False,
1154 default=False,
1154 )
1155 )
1155 coreconfigitem('ui', 'remotecmd',
1156 coreconfigitem('ui', 'remotecmd',
1156 default='hg',
1157 default='hg',
1157 )
1158 )
1158 coreconfigitem('ui', 'report_untrusted',
1159 coreconfigitem('ui', 'report_untrusted',
1159 default=True,
1160 default=True,
1160 )
1161 )
1161 coreconfigitem('ui', 'rollback',
1162 coreconfigitem('ui', 'rollback',
1162 default=True,
1163 default=True,
1163 )
1164 )
1164 coreconfigitem('ui', 'signal-safe-lock',
1165 coreconfigitem('ui', 'signal-safe-lock',
1165 default=True,
1166 default=True,
1166 )
1167 )
1167 coreconfigitem('ui', 'slash',
1168 coreconfigitem('ui', 'slash',
1168 default=False,
1169 default=False,
1169 )
1170 )
1170 coreconfigitem('ui', 'ssh',
1171 coreconfigitem('ui', 'ssh',
1171 default='ssh',
1172 default='ssh',
1172 )
1173 )
1173 coreconfigitem('ui', 'ssherrorhint',
1174 coreconfigitem('ui', 'ssherrorhint',
1174 default=None,
1175 default=None,
1175 )
1176 )
1176 coreconfigitem('ui', 'statuscopies',
1177 coreconfigitem('ui', 'statuscopies',
1177 default=False,
1178 default=False,
1178 )
1179 )
1179 coreconfigitem('ui', 'strict',
1180 coreconfigitem('ui', 'strict',
1180 default=False,
1181 default=False,
1181 )
1182 )
1182 coreconfigitem('ui', 'style',
1183 coreconfigitem('ui', 'style',
1183 default='',
1184 default='',
1184 )
1185 )
1185 coreconfigitem('ui', 'supportcontact',
1186 coreconfigitem('ui', 'supportcontact',
1186 default=None,
1187 default=None,
1187 )
1188 )
1188 coreconfigitem('ui', 'textwidth',
1189 coreconfigitem('ui', 'textwidth',
1189 default=78,
1190 default=78,
1190 )
1191 )
1191 coreconfigitem('ui', 'timeout',
1192 coreconfigitem('ui', 'timeout',
1192 default='600',
1193 default='600',
1193 )
1194 )
1194 coreconfigitem('ui', 'timeout.warn',
1195 coreconfigitem('ui', 'timeout.warn',
1195 default=0,
1196 default=0,
1196 )
1197 )
1197 coreconfigitem('ui', 'traceback',
1198 coreconfigitem('ui', 'traceback',
1198 default=False,
1199 default=False,
1199 )
1200 )
1200 coreconfigitem('ui', 'tweakdefaults',
1201 coreconfigitem('ui', 'tweakdefaults',
1201 default=False,
1202 default=False,
1202 )
1203 )
1203 coreconfigitem('ui', 'username',
1204 coreconfigitem('ui', 'username',
1204 alias=[('ui', 'user')]
1205 alias=[('ui', 'user')]
1205 )
1206 )
1206 coreconfigitem('ui', 'verbose',
1207 coreconfigitem('ui', 'verbose',
1207 default=False,
1208 default=False,
1208 )
1209 )
1209 coreconfigitem('verify', 'skipflags',
1210 coreconfigitem('verify', 'skipflags',
1210 default=None,
1211 default=None,
1211 )
1212 )
1212 coreconfigitem('web', 'allowbz2',
1213 coreconfigitem('web', 'allowbz2',
1213 default=False,
1214 default=False,
1214 )
1215 )
1215 coreconfigitem('web', 'allowgz',
1216 coreconfigitem('web', 'allowgz',
1216 default=False,
1217 default=False,
1217 )
1218 )
1218 coreconfigitem('web', 'allow-pull',
1219 coreconfigitem('web', 'allow-pull',
1219 alias=[('web', 'allowpull')],
1220 alias=[('web', 'allowpull')],
1220 default=True,
1221 default=True,
1221 )
1222 )
1222 coreconfigitem('web', 'allow-push',
1223 coreconfigitem('web', 'allow-push',
1223 alias=[('web', 'allow_push')],
1224 alias=[('web', 'allow_push')],
1224 default=list,
1225 default=list,
1225 )
1226 )
1226 coreconfigitem('web', 'allowzip',
1227 coreconfigitem('web', 'allowzip',
1227 default=False,
1228 default=False,
1228 )
1229 )
1229 coreconfigitem('web', 'archivesubrepos',
1230 coreconfigitem('web', 'archivesubrepos',
1230 default=False,
1231 default=False,
1231 )
1232 )
1232 coreconfigitem('web', 'cache',
1233 coreconfigitem('web', 'cache',
1233 default=True,
1234 default=True,
1234 )
1235 )
1235 coreconfigitem('web', 'contact',
1236 coreconfigitem('web', 'contact',
1236 default=None,
1237 default=None,
1237 )
1238 )
1238 coreconfigitem('web', 'deny_push',
1239 coreconfigitem('web', 'deny_push',
1239 default=list,
1240 default=list,
1240 )
1241 )
1241 coreconfigitem('web', 'guessmime',
1242 coreconfigitem('web', 'guessmime',
1242 default=False,
1243 default=False,
1243 )
1244 )
1244 coreconfigitem('web', 'hidden',
1245 coreconfigitem('web', 'hidden',
1245 default=False,
1246 default=False,
1246 )
1247 )
1247 coreconfigitem('web', 'labels',
1248 coreconfigitem('web', 'labels',
1248 default=list,
1249 default=list,
1249 )
1250 )
1250 coreconfigitem('web', 'logoimg',
1251 coreconfigitem('web', 'logoimg',
1251 default='hglogo.png',
1252 default='hglogo.png',
1252 )
1253 )
1253 coreconfigitem('web', 'logourl',
1254 coreconfigitem('web', 'logourl',
1254 default='https://mercurial-scm.org/',
1255 default='https://mercurial-scm.org/',
1255 )
1256 )
1256 coreconfigitem('web', 'accesslog',
1257 coreconfigitem('web', 'accesslog',
1257 default='-',
1258 default='-',
1258 )
1259 )
1259 coreconfigitem('web', 'address',
1260 coreconfigitem('web', 'address',
1260 default='',
1261 default='',
1261 )
1262 )
1262 coreconfigitem('web', 'allow-archive',
1263 coreconfigitem('web', 'allow-archive',
1263 alias=[('web', 'allow_archive')],
1264 alias=[('web', 'allow_archive')],
1264 default=list,
1265 default=list,
1265 )
1266 )
1266 coreconfigitem('web', 'allow_read',
1267 coreconfigitem('web', 'allow_read',
1267 default=list,
1268 default=list,
1268 )
1269 )
1269 coreconfigitem('web', 'baseurl',
1270 coreconfigitem('web', 'baseurl',
1270 default=None,
1271 default=None,
1271 )
1272 )
1272 coreconfigitem('web', 'cacerts',
1273 coreconfigitem('web', 'cacerts',
1273 default=None,
1274 default=None,
1274 )
1275 )
1275 coreconfigitem('web', 'certificate',
1276 coreconfigitem('web', 'certificate',
1276 default=None,
1277 default=None,
1277 )
1278 )
1278 coreconfigitem('web', 'collapse',
1279 coreconfigitem('web', 'collapse',
1279 default=False,
1280 default=False,
1280 )
1281 )
1281 coreconfigitem('web', 'csp',
1282 coreconfigitem('web', 'csp',
1282 default=None,
1283 default=None,
1283 )
1284 )
1284 coreconfigitem('web', 'deny_read',
1285 coreconfigitem('web', 'deny_read',
1285 default=list,
1286 default=list,
1286 )
1287 )
1287 coreconfigitem('web', 'descend',
1288 coreconfigitem('web', 'descend',
1288 default=True,
1289 default=True,
1289 )
1290 )
1290 coreconfigitem('web', 'description',
1291 coreconfigitem('web', 'description',
1291 default="",
1292 default="",
1292 )
1293 )
1293 coreconfigitem('web', 'encoding',
1294 coreconfigitem('web', 'encoding',
1294 default=lambda: encoding.encoding,
1295 default=lambda: encoding.encoding,
1295 )
1296 )
1296 coreconfigitem('web', 'errorlog',
1297 coreconfigitem('web', 'errorlog',
1297 default='-',
1298 default='-',
1298 )
1299 )
1299 coreconfigitem('web', 'ipv6',
1300 coreconfigitem('web', 'ipv6',
1300 default=False,
1301 default=False,
1301 )
1302 )
1302 coreconfigitem('web', 'maxchanges',
1303 coreconfigitem('web', 'maxchanges',
1303 default=10,
1304 default=10,
1304 )
1305 )
1305 coreconfigitem('web', 'maxfiles',
1306 coreconfigitem('web', 'maxfiles',
1306 default=10,
1307 default=10,
1307 )
1308 )
1308 coreconfigitem('web', 'maxshortchanges',
1309 coreconfigitem('web', 'maxshortchanges',
1309 default=60,
1310 default=60,
1310 )
1311 )
1311 coreconfigitem('web', 'motd',
1312 coreconfigitem('web', 'motd',
1312 default='',
1313 default='',
1313 )
1314 )
1314 coreconfigitem('web', 'name',
1315 coreconfigitem('web', 'name',
1315 default=dynamicdefault,
1316 default=dynamicdefault,
1316 )
1317 )
1317 coreconfigitem('web', 'port',
1318 coreconfigitem('web', 'port',
1318 default=8000,
1319 default=8000,
1319 )
1320 )
1320 coreconfigitem('web', 'prefix',
1321 coreconfigitem('web', 'prefix',
1321 default='',
1322 default='',
1322 )
1323 )
1323 coreconfigitem('web', 'push_ssl',
1324 coreconfigitem('web', 'push_ssl',
1324 default=True,
1325 default=True,
1325 )
1326 )
1326 coreconfigitem('web', 'refreshinterval',
1327 coreconfigitem('web', 'refreshinterval',
1327 default=20,
1328 default=20,
1328 )
1329 )
1329 coreconfigitem('web', 'server-header',
1330 coreconfigitem('web', 'server-header',
1330 default=None,
1331 default=None,
1331 )
1332 )
1332 coreconfigitem('web', 'staticurl',
1333 coreconfigitem('web', 'staticurl',
1333 default=None,
1334 default=None,
1334 )
1335 )
1335 coreconfigitem('web', 'stripes',
1336 coreconfigitem('web', 'stripes',
1336 default=1,
1337 default=1,
1337 )
1338 )
1338 coreconfigitem('web', 'style',
1339 coreconfigitem('web', 'style',
1339 default='paper',
1340 default='paper',
1340 )
1341 )
1341 coreconfigitem('web', 'templates',
1342 coreconfigitem('web', 'templates',
1342 default=None,
1343 default=None,
1343 )
1344 )
1344 coreconfigitem('web', 'view',
1345 coreconfigitem('web', 'view',
1345 default='served',
1346 default='served',
1346 )
1347 )
1347 coreconfigitem('worker', 'backgroundclose',
1348 coreconfigitem('worker', 'backgroundclose',
1348 default=dynamicdefault,
1349 default=dynamicdefault,
1349 )
1350 )
1350 # Windows defaults to a limit of 512 open files. A buffer of 128
1351 # Windows defaults to a limit of 512 open files. A buffer of 128
1351 # should give us enough headway.
1352 # should give us enough headway.
1352 coreconfigitem('worker', 'backgroundclosemaxqueue',
1353 coreconfigitem('worker', 'backgroundclosemaxqueue',
1353 default=384,
1354 default=384,
1354 )
1355 )
1355 coreconfigitem('worker', 'backgroundcloseminfilecount',
1356 coreconfigitem('worker', 'backgroundcloseminfilecount',
1356 default=2048,
1357 default=2048,
1357 )
1358 )
1358 coreconfigitem('worker', 'backgroundclosethreadcount',
1359 coreconfigitem('worker', 'backgroundclosethreadcount',
1359 default=4,
1360 default=4,
1360 )
1361 )
1361 coreconfigitem('worker', 'enabled',
1362 coreconfigitem('worker', 'enabled',
1362 default=True,
1363 default=True,
1363 )
1364 )
1364 coreconfigitem('worker', 'numcpus',
1365 coreconfigitem('worker', 'numcpus',
1365 default=None,
1366 default=None,
1366 )
1367 )
1367
1368
1368 # Rebase related configuration moved to core because other extension are doing
1369 # Rebase related configuration moved to core because other extension are doing
1369 # strange things. For example, shelve import the extensions to reuse some bit
1370 # strange things. For example, shelve import the extensions to reuse some bit
1370 # without formally loading it.
1371 # without formally loading it.
1371 coreconfigitem('commands', 'rebase.requiredest',
1372 coreconfigitem('commands', 'rebase.requiredest',
1372 default=False,
1373 default=False,
1373 )
1374 )
1374 coreconfigitem('experimental', 'rebaseskipobsolete',
1375 coreconfigitem('experimental', 'rebaseskipobsolete',
1375 default=True,
1376 default=True,
1376 )
1377 )
1377 coreconfigitem('rebase', 'singletransaction',
1378 coreconfigitem('rebase', 'singletransaction',
1378 default=False,
1379 default=False,
1379 )
1380 )
1380 coreconfigitem('rebase', 'experimental.inmemory',
1381 coreconfigitem('rebase', 'experimental.inmemory',
1381 default=False,
1382 default=False,
1382 )
1383 )
@@ -1,2677 +1,2691 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 --debug` can help you understand what is introducing
8 :hg:`config --debug` can help you understand what is introducing
9 a setting into your environment.
9 a setting into your environment.
10
10
11 See :hg:`help config.syntax` and :hg:`help config.files`
11 See :hg:`help config.syntax` and :hg:`help config.files`
12 for information about how and where to override things.
12 for information about how and where to override things.
13
13
14 Structure
14 Structure
15 =========
15 =========
16
16
17 The configuration files use a simple ini-file format. A configuration
17 The configuration files use a simple ini-file format. A configuration
18 file consists of sections, led by a ``[section]`` header and followed
18 file consists of sections, led by a ``[section]`` header and followed
19 by ``name = value`` entries::
19 by ``name = value`` entries::
20
20
21 [ui]
21 [ui]
22 username = Firstname Lastname <firstname.lastname@example.net>
22 username = Firstname Lastname <firstname.lastname@example.net>
23 verbose = True
23 verbose = True
24
24
25 The above entries will be referred to as ``ui.username`` and
25 The above entries will be referred to as ``ui.username`` and
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
27
27
28 Files
28 Files
29 =====
29 =====
30
30
31 Mercurial reads configuration data from several files, if they exist.
31 Mercurial reads configuration data from several files, if they exist.
32 These files do not exist by default and you will have to create the
32 These files do not exist by default and you will have to create the
33 appropriate configuration files yourself:
33 appropriate configuration files yourself:
34
34
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
36
36
37 Global configuration like the username setting is typically put into:
37 Global configuration like the username setting is typically put into:
38
38
39 .. container:: windows
39 .. container:: windows
40
40
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
42
42
43 .. container:: unix.plan9
43 .. container:: unix.plan9
44
44
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
46
46
47 The names of these files depend on the system on which Mercurial is
47 The names of these files depend on the system on which Mercurial is
48 installed. ``*.rc`` files from a single directory are read in
48 installed. ``*.rc`` files from a single directory are read in
49 alphabetical order, later ones overriding earlier ones. Where multiple
49 alphabetical order, later ones overriding earlier ones. Where multiple
50 paths are given below, settings from earlier paths override later
50 paths are given below, settings from earlier paths override later
51 ones.
51 ones.
52
52
53 .. container:: verbose.unix
53 .. container:: verbose.unix
54
54
55 On Unix, the following files are consulted:
55 On Unix, the following files are consulted:
56
56
57 - ``<repo>/.hg/hgrc`` (per-repository)
57 - ``<repo>/.hg/hgrc`` (per-repository)
58 - ``$HOME/.hgrc`` (per-user)
58 - ``$HOME/.hgrc`` (per-user)
59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
62 - ``/etc/mercurial/hgrc`` (per-system)
62 - ``/etc/mercurial/hgrc`` (per-system)
63 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
63 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
64 - ``<internal>/default.d/*.rc`` (defaults)
64 - ``<internal>/default.d/*.rc`` (defaults)
65
65
66 .. container:: verbose.windows
66 .. container:: verbose.windows
67
67
68 On Windows, the following files are consulted:
68 On Windows, the following files are consulted:
69
69
70 - ``<repo>/.hg/hgrc`` (per-repository)
70 - ``<repo>/.hg/hgrc`` (per-repository)
71 - ``%USERPROFILE%\.hgrc`` (per-user)
71 - ``%USERPROFILE%\.hgrc`` (per-user)
72 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
72 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
73 - ``%HOME%\.hgrc`` (per-user)
73 - ``%HOME%\.hgrc`` (per-user)
74 - ``%HOME%\Mercurial.ini`` (per-user)
74 - ``%HOME%\Mercurial.ini`` (per-user)
75 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
75 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
76 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
76 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
77 - ``<install-dir>\Mercurial.ini`` (per-installation)
77 - ``<install-dir>\Mercurial.ini`` (per-installation)
78 - ``<internal>/default.d/*.rc`` (defaults)
78 - ``<internal>/default.d/*.rc`` (defaults)
79
79
80 .. note::
80 .. note::
81
81
82 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
82 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
83 is used when running 32-bit Python on 64-bit Windows.
83 is used when running 32-bit Python on 64-bit Windows.
84
84
85 .. container:: windows
85 .. container:: windows
86
86
87 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
87 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
88
88
89 .. container:: verbose.plan9
89 .. container:: verbose.plan9
90
90
91 On Plan9, the following files are consulted:
91 On Plan9, the following files are consulted:
92
92
93 - ``<repo>/.hg/hgrc`` (per-repository)
93 - ``<repo>/.hg/hgrc`` (per-repository)
94 - ``$home/lib/hgrc`` (per-user)
94 - ``$home/lib/hgrc`` (per-user)
95 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
95 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
96 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
96 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
97 - ``/lib/mercurial/hgrc`` (per-system)
97 - ``/lib/mercurial/hgrc`` (per-system)
98 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
98 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
99 - ``<internal>/default.d/*.rc`` (defaults)
99 - ``<internal>/default.d/*.rc`` (defaults)
100
100
101 Per-repository configuration options only apply in a
101 Per-repository configuration options only apply in a
102 particular repository. This file is not version-controlled, and
102 particular repository. This file is not version-controlled, and
103 will not get transferred during a "clone" operation. Options in
103 will not get transferred during a "clone" operation. Options in
104 this file override options in all other configuration files.
104 this file override options in all other configuration files.
105
105
106 .. container:: unix.plan9
106 .. container:: unix.plan9
107
107
108 On Plan 9 and Unix, most of this file will be ignored if it doesn't
108 On Plan 9 and Unix, most of this file will be ignored if it doesn't
109 belong to a trusted user or to a trusted group. See
109 belong to a trusted user or to a trusted group. See
110 :hg:`help config.trusted` for more details.
110 :hg:`help config.trusted` for more details.
111
111
112 Per-user configuration file(s) are for the user running Mercurial. Options
112 Per-user configuration file(s) are for the user running Mercurial. Options
113 in these files apply to all Mercurial commands executed by this user in any
113 in these files apply to all Mercurial commands executed by this user in any
114 directory. Options in these files override per-system and per-installation
114 directory. Options in these files override per-system and per-installation
115 options.
115 options.
116
116
117 Per-installation configuration files are searched for in the
117 Per-installation configuration files are searched for in the
118 directory where Mercurial is installed. ``<install-root>`` is the
118 directory where Mercurial is installed. ``<install-root>`` is the
119 parent directory of the **hg** executable (or symlink) being run.
119 parent directory of the **hg** executable (or symlink) being run.
120
120
121 .. container:: unix.plan9
121 .. container:: unix.plan9
122
122
123 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
123 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
124 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
124 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
125 files apply to all Mercurial commands executed by any user in any
125 files apply to all Mercurial commands executed by any user in any
126 directory.
126 directory.
127
127
128 Per-installation configuration files are for the system on
128 Per-installation configuration files are for the system on
129 which Mercurial is running. Options in these files apply to all
129 which Mercurial is running. Options in these files apply to all
130 Mercurial commands executed by any user in any directory. Registry
130 Mercurial commands executed by any user in any directory. Registry
131 keys contain PATH-like strings, every part of which must reference
131 keys contain PATH-like strings, every part of which must reference
132 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
132 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
133 be read. Mercurial checks each of these locations in the specified
133 be read. Mercurial checks each of these locations in the specified
134 order until one or more configuration files are detected.
134 order until one or more configuration files are detected.
135
135
136 Per-system configuration files are for the system on which Mercurial
136 Per-system configuration files are for the system on which Mercurial
137 is running. Options in these files apply to all Mercurial commands
137 is running. Options in these files apply to all Mercurial commands
138 executed by any user in any directory. Options in these files
138 executed by any user in any directory. Options in these files
139 override per-installation options.
139 override per-installation options.
140
140
141 Mercurial comes with some default configuration. The default configuration
141 Mercurial comes with some default configuration. The default configuration
142 files are installed with Mercurial and will be overwritten on upgrades. Default
142 files are installed with Mercurial and will be overwritten on upgrades. Default
143 configuration files should never be edited by users or administrators but can
143 configuration files should never be edited by users or administrators but can
144 be overridden in other configuration files. So far the directory only contains
144 be overridden in other configuration files. So far the directory only contains
145 merge tool configuration but packagers can also put other default configuration
145 merge tool configuration but packagers can also put other default configuration
146 there.
146 there.
147
147
148 Syntax
148 Syntax
149 ======
149 ======
150
150
151 A configuration file consists of sections, led by a ``[section]`` header
151 A configuration file consists of sections, led by a ``[section]`` header
152 and followed by ``name = value`` entries (sometimes called
152 and followed by ``name = value`` entries (sometimes called
153 ``configuration keys``)::
153 ``configuration keys``)::
154
154
155 [spam]
155 [spam]
156 eggs=ham
156 eggs=ham
157 green=
157 green=
158 eggs
158 eggs
159
159
160 Each line contains one entry. If the lines that follow are indented,
160 Each line contains one entry. If the lines that follow are indented,
161 they are treated as continuations of that entry. Leading whitespace is
161 they are treated as continuations of that entry. Leading whitespace is
162 removed from values. Empty lines are skipped. Lines beginning with
162 removed from values. Empty lines are skipped. Lines beginning with
163 ``#`` or ``;`` are ignored and may be used to provide comments.
163 ``#`` or ``;`` are ignored and may be used to provide comments.
164
164
165 Configuration keys can be set multiple times, in which case Mercurial
165 Configuration keys can be set multiple times, in which case Mercurial
166 will use the value that was configured last. As an example::
166 will use the value that was configured last. As an example::
167
167
168 [spam]
168 [spam]
169 eggs=large
169 eggs=large
170 ham=serrano
170 ham=serrano
171 eggs=small
171 eggs=small
172
172
173 This would set the configuration key named ``eggs`` to ``small``.
173 This would set the configuration key named ``eggs`` to ``small``.
174
174
175 It is also possible to define a section multiple times. A section can
175 It is also possible to define a section multiple times. A section can
176 be redefined on the same and/or on different configuration files. For
176 be redefined on the same and/or on different configuration files. For
177 example::
177 example::
178
178
179 [foo]
179 [foo]
180 eggs=large
180 eggs=large
181 ham=serrano
181 ham=serrano
182 eggs=small
182 eggs=small
183
183
184 [bar]
184 [bar]
185 eggs=ham
185 eggs=ham
186 green=
186 green=
187 eggs
187 eggs
188
188
189 [foo]
189 [foo]
190 ham=prosciutto
190 ham=prosciutto
191 eggs=medium
191 eggs=medium
192 bread=toasted
192 bread=toasted
193
193
194 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
194 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
195 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
195 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
196 respectively. As you can see there only thing that matters is the last
196 respectively. As you can see there only thing that matters is the last
197 value that was set for each of the configuration keys.
197 value that was set for each of the configuration keys.
198
198
199 If a configuration key is set multiple times in different
199 If a configuration key is set multiple times in different
200 configuration files the final value will depend on the order in which
200 configuration files the final value will depend on the order in which
201 the different configuration files are read, with settings from earlier
201 the different configuration files are read, with settings from earlier
202 paths overriding later ones as described on the ``Files`` section
202 paths overriding later ones as described on the ``Files`` section
203 above.
203 above.
204
204
205 A line of the form ``%include file`` will include ``file`` into the
205 A line of the form ``%include file`` will include ``file`` into the
206 current configuration file. The inclusion is recursive, which means
206 current configuration file. The inclusion is recursive, which means
207 that included files can include other files. Filenames are relative to
207 that included files can include other files. Filenames are relative to
208 the configuration file in which the ``%include`` directive is found.
208 the configuration file in which the ``%include`` directive is found.
209 Environment variables and ``~user`` constructs are expanded in
209 Environment variables and ``~user`` constructs are expanded in
210 ``file``. This lets you do something like::
210 ``file``. This lets you do something like::
211
211
212 %include ~/.hgrc.d/$HOST.rc
212 %include ~/.hgrc.d/$HOST.rc
213
213
214 to include a different configuration file on each computer you use.
214 to include a different configuration file on each computer you use.
215
215
216 A line with ``%unset name`` will remove ``name`` from the current
216 A line with ``%unset name`` will remove ``name`` from the current
217 section, if it has been set previously.
217 section, if it has been set previously.
218
218
219 The values are either free-form text strings, lists of text strings,
219 The values are either free-form text strings, lists of text strings,
220 or Boolean values. Boolean values can be set to true using any of "1",
220 or Boolean values. Boolean values can be set to true using any of "1",
221 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
221 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
222 (all case insensitive).
222 (all case insensitive).
223
223
224 List values are separated by whitespace or comma, except when values are
224 List values are separated by whitespace or comma, except when values are
225 placed in double quotation marks::
225 placed in double quotation marks::
226
226
227 allow_read = "John Doe, PhD", brian, betty
227 allow_read = "John Doe, PhD", brian, betty
228
228
229 Quotation marks can be escaped by prefixing them with a backslash. Only
229 Quotation marks can be escaped by prefixing them with a backslash. Only
230 quotation marks at the beginning of a word is counted as a quotation
230 quotation marks at the beginning of a word is counted as a quotation
231 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
231 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
232
232
233 Sections
233 Sections
234 ========
234 ========
235
235
236 This section describes the different sections that may appear in a
236 This section describes the different sections that may appear in a
237 Mercurial configuration file, the purpose of each section, its possible
237 Mercurial configuration file, the purpose of each section, its possible
238 keys, and their possible values.
238 keys, and their possible values.
239
239
240 ``alias``
240 ``alias``
241 ---------
241 ---------
242
242
243 Defines command aliases.
243 Defines command aliases.
244
244
245 Aliases allow you to define your own commands in terms of other
245 Aliases allow you to define your own commands in terms of other
246 commands (or aliases), optionally including arguments. Positional
246 commands (or aliases), optionally including arguments. Positional
247 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
247 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
248 are expanded by Mercurial before execution. Positional arguments not
248 are expanded by Mercurial before execution. Positional arguments not
249 already used by ``$N`` in the definition are put at the end of the
249 already used by ``$N`` in the definition are put at the end of the
250 command to be executed.
250 command to be executed.
251
251
252 Alias definitions consist of lines of the form::
252 Alias definitions consist of lines of the form::
253
253
254 <alias> = <command> [<argument>]...
254 <alias> = <command> [<argument>]...
255
255
256 For example, this definition::
256 For example, this definition::
257
257
258 latest = log --limit 5
258 latest = log --limit 5
259
259
260 creates a new command ``latest`` that shows only the five most recent
260 creates a new command ``latest`` that shows only the five most recent
261 changesets. You can define subsequent aliases using earlier ones::
261 changesets. You can define subsequent aliases using earlier ones::
262
262
263 stable5 = latest -b stable
263 stable5 = latest -b stable
264
264
265 .. note::
265 .. note::
266
266
267 It is possible to create aliases with the same names as
267 It is possible to create aliases with the same names as
268 existing commands, which will then override the original
268 existing commands, which will then override the original
269 definitions. This is almost always a bad idea!
269 definitions. This is almost always a bad idea!
270
270
271 An alias can start with an exclamation point (``!``) to make it a
271 An alias can start with an exclamation point (``!``) to make it a
272 shell alias. A shell alias is executed with the shell and will let you
272 shell alias. A shell alias is executed with the shell and will let you
273 run arbitrary commands. As an example, ::
273 run arbitrary commands. As an example, ::
274
274
275 echo = !echo $@
275 echo = !echo $@
276
276
277 will let you do ``hg echo foo`` to have ``foo`` printed in your
277 will let you do ``hg echo foo`` to have ``foo`` printed in your
278 terminal. A better example might be::
278 terminal. A better example might be::
279
279
280 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
280 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
281
281
282 which will make ``hg purge`` delete all unknown files in the
282 which will make ``hg purge`` delete all unknown files in the
283 repository in the same manner as the purge extension.
283 repository in the same manner as the purge extension.
284
284
285 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
285 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
286 expand to the command arguments. Unmatched arguments are
286 expand to the command arguments. Unmatched arguments are
287 removed. ``$0`` expands to the alias name and ``$@`` expands to all
287 removed. ``$0`` expands to the alias name and ``$@`` expands to all
288 arguments separated by a space. ``"$@"`` (with quotes) expands to all
288 arguments separated by a space. ``"$@"`` (with quotes) expands to all
289 arguments quoted individually and separated by a space. These expansions
289 arguments quoted individually and separated by a space. These expansions
290 happen before the command is passed to the shell.
290 happen before the command is passed to the shell.
291
291
292 Shell aliases are executed in an environment where ``$HG`` expands to
292 Shell aliases are executed in an environment where ``$HG`` expands to
293 the path of the Mercurial that was used to execute the alias. This is
293 the path of the Mercurial that was used to execute the alias. This is
294 useful when you want to call further Mercurial commands in a shell
294 useful when you want to call further Mercurial commands in a shell
295 alias, as was done above for the purge alias. In addition,
295 alias, as was done above for the purge alias. In addition,
296 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
296 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
297 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
297 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
298
298
299 .. note::
299 .. note::
300
300
301 Some global configuration options such as ``-R`` are
301 Some global configuration options such as ``-R`` are
302 processed before shell aliases and will thus not be passed to
302 processed before shell aliases and will thus not be passed to
303 aliases.
303 aliases.
304
304
305
305
306 ``annotate``
306 ``annotate``
307 ------------
307 ------------
308
308
309 Settings used when displaying file annotations. All values are
309 Settings used when displaying file annotations. All values are
310 Booleans and default to False. See :hg:`help config.diff` for
310 Booleans and default to False. See :hg:`help config.diff` for
311 related options for the diff command.
311 related options for the diff command.
312
312
313 ``ignorews``
313 ``ignorews``
314 Ignore white space when comparing lines.
314 Ignore white space when comparing lines.
315
315
316 ``ignorewseol``
316 ``ignorewseol``
317 Ignore white space at the end of a line when comparing lines.
317 Ignore white space at the end of a line when comparing lines.
318
318
319 ``ignorewsamount``
319 ``ignorewsamount``
320 Ignore changes in the amount of white space.
320 Ignore changes in the amount of white space.
321
321
322 ``ignoreblanklines``
322 ``ignoreblanklines``
323 Ignore changes whose lines are all blank.
323 Ignore changes whose lines are all blank.
324
324
325
325
326 ``auth``
326 ``auth``
327 --------
327 --------
328
328
329 Authentication credentials and other authentication-like configuration
329 Authentication credentials and other authentication-like configuration
330 for HTTP connections. This section allows you to store usernames and
330 for HTTP connections. This section allows you to store usernames and
331 passwords for use when logging *into* HTTP servers. See
331 passwords for use when logging *into* HTTP servers. See
332 :hg:`help config.web` if you want to configure *who* can login to
332 :hg:`help config.web` if you want to configure *who* can login to
333 your HTTP server.
333 your HTTP server.
334
334
335 The following options apply to all hosts.
335 The following options apply to all hosts.
336
336
337 ``cookiefile``
337 ``cookiefile``
338 Path to a file containing HTTP cookie lines. Cookies matching a
338 Path to a file containing HTTP cookie lines. Cookies matching a
339 host will be sent automatically.
339 host will be sent automatically.
340
340
341 The file format uses the Mozilla cookies.txt format, which defines cookies
341 The file format uses the Mozilla cookies.txt format, which defines cookies
342 on their own lines. Each line contains 7 fields delimited by the tab
342 on their own lines. Each line contains 7 fields delimited by the tab
343 character (domain, is_domain_cookie, path, is_secure, expires, name,
343 character (domain, is_domain_cookie, path, is_secure, expires, name,
344 value). For more info, do an Internet search for "Netscape cookies.txt
344 value). For more info, do an Internet search for "Netscape cookies.txt
345 format."
345 format."
346
346
347 Note: the cookies parser does not handle port numbers on domains. You
347 Note: the cookies parser does not handle port numbers on domains. You
348 will need to remove ports from the domain for the cookie to be recognized.
348 will need to remove ports from the domain for the cookie to be recognized.
349 This could result in a cookie being disclosed to an unwanted server.
349 This could result in a cookie being disclosed to an unwanted server.
350
350
351 The cookies file is read-only.
351 The cookies file is read-only.
352
352
353 Other options in this section are grouped by name and have the following
353 Other options in this section are grouped by name and have the following
354 format::
354 format::
355
355
356 <name>.<argument> = <value>
356 <name>.<argument> = <value>
357
357
358 where ``<name>`` is used to group arguments into authentication
358 where ``<name>`` is used to group arguments into authentication
359 entries. Example::
359 entries. Example::
360
360
361 foo.prefix = hg.intevation.de/mercurial
361 foo.prefix = hg.intevation.de/mercurial
362 foo.username = foo
362 foo.username = foo
363 foo.password = bar
363 foo.password = bar
364 foo.schemes = http https
364 foo.schemes = http https
365
365
366 bar.prefix = secure.example.org
366 bar.prefix = secure.example.org
367 bar.key = path/to/file.key
367 bar.key = path/to/file.key
368 bar.cert = path/to/file.cert
368 bar.cert = path/to/file.cert
369 bar.schemes = https
369 bar.schemes = https
370
370
371 Supported arguments:
371 Supported arguments:
372
372
373 ``prefix``
373 ``prefix``
374 Either ``*`` or a URI prefix with or without the scheme part.
374 Either ``*`` or a URI prefix with or without the scheme part.
375 The authentication entry with the longest matching prefix is used
375 The authentication entry with the longest matching prefix is used
376 (where ``*`` matches everything and counts as a match of length
376 (where ``*`` matches everything and counts as a match of length
377 1). If the prefix doesn't include a scheme, the match is performed
377 1). If the prefix doesn't include a scheme, the match is performed
378 against the URI with its scheme stripped as well, and the schemes
378 against the URI with its scheme stripped as well, and the schemes
379 argument, q.v., is then subsequently consulted.
379 argument, q.v., is then subsequently consulted.
380
380
381 ``username``
381 ``username``
382 Optional. Username to authenticate with. If not given, and the
382 Optional. Username to authenticate with. If not given, and the
383 remote site requires basic or digest authentication, the user will
383 remote site requires basic or digest authentication, the user will
384 be prompted for it. Environment variables are expanded in the
384 be prompted for it. Environment variables are expanded in the
385 username letting you do ``foo.username = $USER``. If the URI
385 username letting you do ``foo.username = $USER``. If the URI
386 includes a username, only ``[auth]`` entries with a matching
386 includes a username, only ``[auth]`` entries with a matching
387 username or without a username will be considered.
387 username or without a username will be considered.
388
388
389 ``password``
389 ``password``
390 Optional. Password to authenticate with. If not given, and the
390 Optional. Password to authenticate with. If not given, and the
391 remote site requires basic or digest authentication, the user
391 remote site requires basic or digest authentication, the user
392 will be prompted for it.
392 will be prompted for it.
393
393
394 ``key``
394 ``key``
395 Optional. PEM encoded client certificate key file. Environment
395 Optional. PEM encoded client certificate key file. Environment
396 variables are expanded in the filename.
396 variables are expanded in the filename.
397
397
398 ``cert``
398 ``cert``
399 Optional. PEM encoded client certificate chain file. Environment
399 Optional. PEM encoded client certificate chain file. Environment
400 variables are expanded in the filename.
400 variables are expanded in the filename.
401
401
402 ``schemes``
402 ``schemes``
403 Optional. Space separated list of URI schemes to use this
403 Optional. Space separated list of URI schemes to use this
404 authentication entry with. Only used if the prefix doesn't include
404 authentication entry with. Only used if the prefix doesn't include
405 a scheme. Supported schemes are http and https. They will match
405 a scheme. Supported schemes are http and https. They will match
406 static-http and static-https respectively, as well.
406 static-http and static-https respectively, as well.
407 (default: https)
407 (default: https)
408
408
409 If no suitable authentication entry is found, the user is prompted
409 If no suitable authentication entry is found, the user is prompted
410 for credentials as usual if required by the remote.
410 for credentials as usual if required by the remote.
411
411
412 ``color``
412 ``color``
413 ---------
413 ---------
414
414
415 Configure the Mercurial color mode. For details about how to define your custom
415 Configure the Mercurial color mode. For details about how to define your custom
416 effect and style see :hg:`help color`.
416 effect and style see :hg:`help color`.
417
417
418 ``mode``
418 ``mode``
419 String: control the method used to output color. One of ``auto``, ``ansi``,
419 String: control the method used to output color. One of ``auto``, ``ansi``,
420 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
420 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
421 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
421 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
422 terminal. Any invalid value will disable color.
422 terminal. Any invalid value will disable color.
423
423
424 ``pagermode``
424 ``pagermode``
425 String: optional override of ``color.mode`` used with pager.
425 String: optional override of ``color.mode`` used with pager.
426
426
427 On some systems, terminfo mode may cause problems when using
427 On some systems, terminfo mode may cause problems when using
428 color with ``less -R`` as a pager program. less with the -R option
428 color with ``less -R`` as a pager program. less with the -R option
429 will only display ECMA-48 color codes, and terminfo mode may sometimes
429 will only display ECMA-48 color codes, and terminfo mode may sometimes
430 emit codes that less doesn't understand. You can work around this by
430 emit codes that less doesn't understand. You can work around this by
431 either using ansi mode (or auto mode), or by using less -r (which will
431 either using ansi mode (or auto mode), or by using less -r (which will
432 pass through all terminal control codes, not just color control
432 pass through all terminal control codes, not just color control
433 codes).
433 codes).
434
434
435 On some systems (such as MSYS in Windows), the terminal may support
435 On some systems (such as MSYS in Windows), the terminal may support
436 a different color mode than the pager program.
436 a different color mode than the pager program.
437
437
438 ``commands``
438 ``commands``
439 ------------
439 ------------
440
440
441 ``status.relative``
441 ``status.relative``
442 Make paths in :hg:`status` output relative to the current directory.
442 Make paths in :hg:`status` output relative to the current directory.
443 (default: False)
443 (default: False)
444
444
445 ``status.terse``
445 ``status.terse``
446 Default value for the --terse flag, which condenes status output.
446 Default value for the --terse flag, which condenes status output.
447 (default: empty)
447 (default: empty)
448
448
449 ``update.check``
449 ``update.check``
450 Determines what level of checking :hg:`update` will perform before moving
450 Determines what level of checking :hg:`update` will perform before moving
451 to a destination revision. Valid values are ``abort``, ``none``,
451 to a destination revision. Valid values are ``abort``, ``none``,
452 ``linear``, and ``noconflict``. ``abort`` always fails if the working
452 ``linear``, and ``noconflict``. ``abort`` always fails if the working
453 directory has uncommitted changes. ``none`` performs no checking, and may
453 directory has uncommitted changes. ``none`` performs no checking, and may
454 result in a merge with uncommitted changes. ``linear`` allows any update
454 result in a merge with uncommitted changes. ``linear`` allows any update
455 as long as it follows a straight line in the revision history, and may
455 as long as it follows a straight line in the revision history, and may
456 trigger a merge with uncommitted changes. ``noconflict`` will allow any
456 trigger a merge with uncommitted changes. ``noconflict`` will allow any
457 update which would not trigger a merge with uncommitted changes, if any
457 update which would not trigger a merge with uncommitted changes, if any
458 are present.
458 are present.
459 (default: ``linear``)
459 (default: ``linear``)
460
460
461 ``update.requiredest``
461 ``update.requiredest``
462 Require that the user pass a destination when running :hg:`update`.
462 Require that the user pass a destination when running :hg:`update`.
463 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
463 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
464 will be disallowed.
464 will be disallowed.
465 (default: False)
465 (default: False)
466
466
467 ``committemplate``
467 ``committemplate``
468 ------------------
468 ------------------
469
469
470 ``changeset``
470 ``changeset``
471 String: configuration in this section is used as the template to
471 String: configuration in this section is used as the template to
472 customize the text shown in the editor when committing.
472 customize the text shown in the editor when committing.
473
473
474 In addition to pre-defined template keywords, commit log specific one
474 In addition to pre-defined template keywords, commit log specific one
475 below can be used for customization:
475 below can be used for customization:
476
476
477 ``extramsg``
477 ``extramsg``
478 String: Extra message (typically 'Leave message empty to abort
478 String: Extra message (typically 'Leave message empty to abort
479 commit.'). This may be changed by some commands or extensions.
479 commit.'). This may be changed by some commands or extensions.
480
480
481 For example, the template configuration below shows as same text as
481 For example, the template configuration below shows as same text as
482 one shown by default::
482 one shown by default::
483
483
484 [committemplate]
484 [committemplate]
485 changeset = {desc}\n\n
485 changeset = {desc}\n\n
486 HG: Enter commit message. Lines beginning with 'HG:' are removed.
486 HG: Enter commit message. Lines beginning with 'HG:' are removed.
487 HG: {extramsg}
487 HG: {extramsg}
488 HG: --
488 HG: --
489 HG: user: {author}\n{ifeq(p2rev, "-1", "",
489 HG: user: {author}\n{ifeq(p2rev, "-1", "",
490 "HG: branch merge\n")
490 "HG: branch merge\n")
491 }HG: branch '{branch}'\n{if(activebookmark,
491 }HG: branch '{branch}'\n{if(activebookmark,
492 "HG: bookmark '{activebookmark}'\n") }{subrepos %
492 "HG: bookmark '{activebookmark}'\n") }{subrepos %
493 "HG: subrepo {subrepo}\n" }{file_adds %
493 "HG: subrepo {subrepo}\n" }{file_adds %
494 "HG: added {file}\n" }{file_mods %
494 "HG: added {file}\n" }{file_mods %
495 "HG: changed {file}\n" }{file_dels %
495 "HG: changed {file}\n" }{file_dels %
496 "HG: removed {file}\n" }{if(files, "",
496 "HG: removed {file}\n" }{if(files, "",
497 "HG: no files changed\n")}
497 "HG: no files changed\n")}
498
498
499 ``diff()``
499 ``diff()``
500 String: show the diff (see :hg:`help templates` for detail)
500 String: show the diff (see :hg:`help templates` for detail)
501
501
502 Sometimes it is helpful to show the diff of the changeset in the editor without
502 Sometimes it is helpful to show the diff of the changeset in the editor without
503 having to prefix 'HG: ' to each line so that highlighting works correctly. For
503 having to prefix 'HG: ' to each line so that highlighting works correctly. For
504 this, Mercurial provides a special string which will ignore everything below
504 this, Mercurial provides a special string which will ignore everything below
505 it::
505 it::
506
506
507 HG: ------------------------ >8 ------------------------
507 HG: ------------------------ >8 ------------------------
508
508
509 For example, the template configuration below will show the diff below the
509 For example, the template configuration below will show the diff below the
510 extra message::
510 extra message::
511
511
512 [committemplate]
512 [committemplate]
513 changeset = {desc}\n\n
513 changeset = {desc}\n\n
514 HG: Enter commit message. Lines beginning with 'HG:' are removed.
514 HG: Enter commit message. Lines beginning with 'HG:' are removed.
515 HG: {extramsg}
515 HG: {extramsg}
516 HG: ------------------------ >8 ------------------------
516 HG: ------------------------ >8 ------------------------
517 HG: Do not touch the line above.
517 HG: Do not touch the line above.
518 HG: Everything below will be removed.
518 HG: Everything below will be removed.
519 {diff()}
519 {diff()}
520
520
521 .. note::
521 .. note::
522
522
523 For some problematic encodings (see :hg:`help win32mbcs` for
523 For some problematic encodings (see :hg:`help win32mbcs` for
524 detail), this customization should be configured carefully, to
524 detail), this customization should be configured carefully, to
525 avoid showing broken characters.
525 avoid showing broken characters.
526
526
527 For example, if a multibyte character ending with backslash (0x5c) is
527 For example, if a multibyte character ending with backslash (0x5c) is
528 followed by the ASCII character 'n' in the customized template,
528 followed by the ASCII character 'n' in the customized template,
529 the sequence of backslash and 'n' is treated as line-feed unexpectedly
529 the sequence of backslash and 'n' is treated as line-feed unexpectedly
530 (and the multibyte character is broken, too).
530 (and the multibyte character is broken, too).
531
531
532 Customized template is used for commands below (``--edit`` may be
532 Customized template is used for commands below (``--edit`` may be
533 required):
533 required):
534
534
535 - :hg:`backout`
535 - :hg:`backout`
536 - :hg:`commit`
536 - :hg:`commit`
537 - :hg:`fetch` (for merge commit only)
537 - :hg:`fetch` (for merge commit only)
538 - :hg:`graft`
538 - :hg:`graft`
539 - :hg:`histedit`
539 - :hg:`histedit`
540 - :hg:`import`
540 - :hg:`import`
541 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
541 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
542 - :hg:`rebase`
542 - :hg:`rebase`
543 - :hg:`shelve`
543 - :hg:`shelve`
544 - :hg:`sign`
544 - :hg:`sign`
545 - :hg:`tag`
545 - :hg:`tag`
546 - :hg:`transplant`
546 - :hg:`transplant`
547
547
548 Configuring items below instead of ``changeset`` allows showing
548 Configuring items below instead of ``changeset`` allows showing
549 customized message only for specific actions, or showing different
549 customized message only for specific actions, or showing different
550 messages for each action.
550 messages for each action.
551
551
552 - ``changeset.backout`` for :hg:`backout`
552 - ``changeset.backout`` for :hg:`backout`
553 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
553 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
554 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
554 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
555 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
555 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
556 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
556 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
557 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
557 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
558 - ``changeset.gpg.sign`` for :hg:`sign`
558 - ``changeset.gpg.sign`` for :hg:`sign`
559 - ``changeset.graft`` for :hg:`graft`
559 - ``changeset.graft`` for :hg:`graft`
560 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
560 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
561 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
561 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
562 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
562 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
563 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
563 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
564 - ``changeset.import.bypass`` for :hg:`import --bypass`
564 - ``changeset.import.bypass`` for :hg:`import --bypass`
565 - ``changeset.import.normal.merge`` for :hg:`import` on merges
565 - ``changeset.import.normal.merge`` for :hg:`import` on merges
566 - ``changeset.import.normal.normal`` for :hg:`import` on other
566 - ``changeset.import.normal.normal`` for :hg:`import` on other
567 - ``changeset.mq.qnew`` for :hg:`qnew`
567 - ``changeset.mq.qnew`` for :hg:`qnew`
568 - ``changeset.mq.qfold`` for :hg:`qfold`
568 - ``changeset.mq.qfold`` for :hg:`qfold`
569 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
569 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
570 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
570 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
571 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
571 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
572 - ``changeset.rebase.normal`` for :hg:`rebase` on other
572 - ``changeset.rebase.normal`` for :hg:`rebase` on other
573 - ``changeset.shelve.shelve`` for :hg:`shelve`
573 - ``changeset.shelve.shelve`` for :hg:`shelve`
574 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
574 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
575 - ``changeset.tag.remove`` for :hg:`tag --remove`
575 - ``changeset.tag.remove`` for :hg:`tag --remove`
576 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
576 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
577 - ``changeset.transplant.normal`` for :hg:`transplant` on other
577 - ``changeset.transplant.normal`` for :hg:`transplant` on other
578
578
579 These dot-separated lists of names are treated as hierarchical ones.
579 These dot-separated lists of names are treated as hierarchical ones.
580 For example, ``changeset.tag.remove`` customizes the commit message
580 For example, ``changeset.tag.remove`` customizes the commit message
581 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
581 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
582 commit message for :hg:`tag` regardless of ``--remove`` option.
582 commit message for :hg:`tag` regardless of ``--remove`` option.
583
583
584 When the external editor is invoked for a commit, the corresponding
584 When the external editor is invoked for a commit, the corresponding
585 dot-separated list of names without the ``changeset.`` prefix
585 dot-separated list of names without the ``changeset.`` prefix
586 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
586 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
587 variable.
587 variable.
588
588
589 In this section, items other than ``changeset`` can be referred from
589 In this section, items other than ``changeset`` can be referred from
590 others. For example, the configuration to list committed files up
590 others. For example, the configuration to list committed files up
591 below can be referred as ``{listupfiles}``::
591 below can be referred as ``{listupfiles}``::
592
592
593 [committemplate]
593 [committemplate]
594 listupfiles = {file_adds %
594 listupfiles = {file_adds %
595 "HG: added {file}\n" }{file_mods %
595 "HG: added {file}\n" }{file_mods %
596 "HG: changed {file}\n" }{file_dels %
596 "HG: changed {file}\n" }{file_dels %
597 "HG: removed {file}\n" }{if(files, "",
597 "HG: removed {file}\n" }{if(files, "",
598 "HG: no files changed\n")}
598 "HG: no files changed\n")}
599
599
600 ``decode/encode``
600 ``decode/encode``
601 -----------------
601 -----------------
602
602
603 Filters for transforming files on checkout/checkin. This would
603 Filters for transforming files on checkout/checkin. This would
604 typically be used for newline processing or other
604 typically be used for newline processing or other
605 localization/canonicalization of files.
605 localization/canonicalization of files.
606
606
607 Filters consist of a filter pattern followed by a filter command.
607 Filters consist of a filter pattern followed by a filter command.
608 Filter patterns are globs by default, rooted at the repository root.
608 Filter patterns are globs by default, rooted at the repository root.
609 For example, to match any file ending in ``.txt`` in the root
609 For example, to match any file ending in ``.txt`` in the root
610 directory only, use the pattern ``*.txt``. To match any file ending
610 directory only, use the pattern ``*.txt``. To match any file ending
611 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
611 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
612 For each file only the first matching filter applies.
612 For each file only the first matching filter applies.
613
613
614 The filter command can start with a specifier, either ``pipe:`` or
614 The filter command can start with a specifier, either ``pipe:`` or
615 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
615 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
616
616
617 A ``pipe:`` command must accept data on stdin and return the transformed
617 A ``pipe:`` command must accept data on stdin and return the transformed
618 data on stdout.
618 data on stdout.
619
619
620 Pipe example::
620 Pipe example::
621
621
622 [encode]
622 [encode]
623 # uncompress gzip files on checkin to improve delta compression
623 # uncompress gzip files on checkin to improve delta compression
624 # note: not necessarily a good idea, just an example
624 # note: not necessarily a good idea, just an example
625 *.gz = pipe: gunzip
625 *.gz = pipe: gunzip
626
626
627 [decode]
627 [decode]
628 # recompress gzip files when writing them to the working dir (we
628 # recompress gzip files when writing them to the working dir (we
629 # can safely omit "pipe:", because it's the default)
629 # can safely omit "pipe:", because it's the default)
630 *.gz = gzip
630 *.gz = gzip
631
631
632 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
632 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
633 with the name of a temporary file that contains the data to be
633 with the name of a temporary file that contains the data to be
634 filtered by the command. The string ``OUTFILE`` is replaced with the name
634 filtered by the command. The string ``OUTFILE`` is replaced with the name
635 of an empty temporary file, where the filtered data must be written by
635 of an empty temporary file, where the filtered data must be written by
636 the command.
636 the command.
637
637
638 .. container:: windows
638 .. container:: windows
639
639
640 .. note::
640 .. note::
641
641
642 The tempfile mechanism is recommended for Windows systems,
642 The tempfile mechanism is recommended for Windows systems,
643 where the standard shell I/O redirection operators often have
643 where the standard shell I/O redirection operators often have
644 strange effects and may corrupt the contents of your files.
644 strange effects and may corrupt the contents of your files.
645
645
646 This filter mechanism is used internally by the ``eol`` extension to
646 This filter mechanism is used internally by the ``eol`` extension to
647 translate line ending characters between Windows (CRLF) and Unix (LF)
647 translate line ending characters between Windows (CRLF) and Unix (LF)
648 format. We suggest you use the ``eol`` extension for convenience.
648 format. We suggest you use the ``eol`` extension for convenience.
649
649
650
650
651 ``defaults``
651 ``defaults``
652 ------------
652 ------------
653
653
654 (defaults are deprecated. Don't use them. Use aliases instead.)
654 (defaults are deprecated. Don't use them. Use aliases instead.)
655
655
656 Use the ``[defaults]`` section to define command defaults, i.e. the
656 Use the ``[defaults]`` section to define command defaults, i.e. the
657 default options/arguments to pass to the specified commands.
657 default options/arguments to pass to the specified commands.
658
658
659 The following example makes :hg:`log` run in verbose mode, and
659 The following example makes :hg:`log` run in verbose mode, and
660 :hg:`status` show only the modified files, by default::
660 :hg:`status` show only the modified files, by default::
661
661
662 [defaults]
662 [defaults]
663 log = -v
663 log = -v
664 status = -m
664 status = -m
665
665
666 The actual commands, instead of their aliases, must be used when
666 The actual commands, instead of their aliases, must be used when
667 defining command defaults. The command defaults will also be applied
667 defining command defaults. The command defaults will also be applied
668 to the aliases of the commands defined.
668 to the aliases of the commands defined.
669
669
670
670
671 ``diff``
671 ``diff``
672 --------
672 --------
673
673
674 Settings used when displaying diffs. Everything except for ``unified``
674 Settings used when displaying diffs. Everything except for ``unified``
675 is a Boolean and defaults to False. See :hg:`help config.annotate`
675 is a Boolean and defaults to False. See :hg:`help config.annotate`
676 for related options for the annotate command.
676 for related options for the annotate command.
677
677
678 ``git``
678 ``git``
679 Use git extended diff format.
679 Use git extended diff format.
680
680
681 ``nobinary``
681 ``nobinary``
682 Omit git binary patches.
682 Omit git binary patches.
683
683
684 ``nodates``
684 ``nodates``
685 Don't include dates in diff headers.
685 Don't include dates in diff headers.
686
686
687 ``noprefix``
687 ``noprefix``
688 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
688 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
689
689
690 ``showfunc``
690 ``showfunc``
691 Show which function each change is in.
691 Show which function each change is in.
692
692
693 ``ignorews``
693 ``ignorews``
694 Ignore white space when comparing lines.
694 Ignore white space when comparing lines.
695
695
696 ``ignorewsamount``
696 ``ignorewsamount``
697 Ignore changes in the amount of white space.
697 Ignore changes in the amount of white space.
698
698
699 ``ignoreblanklines``
699 ``ignoreblanklines``
700 Ignore changes whose lines are all blank.
700 Ignore changes whose lines are all blank.
701
701
702 ``unified``
702 ``unified``
703 Number of lines of context to show.
703 Number of lines of context to show.
704
704
705 ``word-diff``
705 ``word-diff``
706 Highlight changed words.
706 Highlight changed words.
707
707
708 ``email``
708 ``email``
709 ---------
709 ---------
710
710
711 Settings for extensions that send email messages.
711 Settings for extensions that send email messages.
712
712
713 ``from``
713 ``from``
714 Optional. Email address to use in "From" header and SMTP envelope
714 Optional. Email address to use in "From" header and SMTP envelope
715 of outgoing messages.
715 of outgoing messages.
716
716
717 ``to``
717 ``to``
718 Optional. Comma-separated list of recipients' email addresses.
718 Optional. Comma-separated list of recipients' email addresses.
719
719
720 ``cc``
720 ``cc``
721 Optional. Comma-separated list of carbon copy recipients'
721 Optional. Comma-separated list of carbon copy recipients'
722 email addresses.
722 email addresses.
723
723
724 ``bcc``
724 ``bcc``
725 Optional. Comma-separated list of blind carbon copy recipients'
725 Optional. Comma-separated list of blind carbon copy recipients'
726 email addresses.
726 email addresses.
727
727
728 ``method``
728 ``method``
729 Optional. Method to use to send email messages. If value is ``smtp``
729 Optional. Method to use to send email messages. If value is ``smtp``
730 (default), use SMTP (see the ``[smtp]`` section for configuration).
730 (default), use SMTP (see the ``[smtp]`` section for configuration).
731 Otherwise, use as name of program to run that acts like sendmail
731 Otherwise, use as name of program to run that acts like sendmail
732 (takes ``-f`` option for sender, list of recipients on command line,
732 (takes ``-f`` option for sender, list of recipients on command line,
733 message on stdin). Normally, setting this to ``sendmail`` or
733 message on stdin). Normally, setting this to ``sendmail`` or
734 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
734 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
735
735
736 ``charsets``
736 ``charsets``
737 Optional. Comma-separated list of character sets considered
737 Optional. Comma-separated list of character sets considered
738 convenient for recipients. Addresses, headers, and parts not
738 convenient for recipients. Addresses, headers, and parts not
739 containing patches of outgoing messages will be encoded in the
739 containing patches of outgoing messages will be encoded in the
740 first character set to which conversion from local encoding
740 first character set to which conversion from local encoding
741 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
741 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
742 conversion fails, the text in question is sent as is.
742 conversion fails, the text in question is sent as is.
743 (default: '')
743 (default: '')
744
744
745 Order of outgoing email character sets:
745 Order of outgoing email character sets:
746
746
747 1. ``us-ascii``: always first, regardless of settings
747 1. ``us-ascii``: always first, regardless of settings
748 2. ``email.charsets``: in order given by user
748 2. ``email.charsets``: in order given by user
749 3. ``ui.fallbackencoding``: if not in email.charsets
749 3. ``ui.fallbackencoding``: if not in email.charsets
750 4. ``$HGENCODING``: if not in email.charsets
750 4. ``$HGENCODING``: if not in email.charsets
751 5. ``utf-8``: always last, regardless of settings
751 5. ``utf-8``: always last, regardless of settings
752
752
753 Email example::
753 Email example::
754
754
755 [email]
755 [email]
756 from = Joseph User <joe.user@example.com>
756 from = Joseph User <joe.user@example.com>
757 method = /usr/sbin/sendmail
757 method = /usr/sbin/sendmail
758 # charsets for western Europeans
758 # charsets for western Europeans
759 # us-ascii, utf-8 omitted, as they are tried first and last
759 # us-ascii, utf-8 omitted, as they are tried first and last
760 charsets = iso-8859-1, iso-8859-15, windows-1252
760 charsets = iso-8859-1, iso-8859-15, windows-1252
761
761
762
762
763 ``extensions``
763 ``extensions``
764 --------------
764 --------------
765
765
766 Mercurial has an extension mechanism for adding new features. To
766 Mercurial has an extension mechanism for adding new features. To
767 enable an extension, create an entry for it in this section.
767 enable an extension, create an entry for it in this section.
768
768
769 If you know that the extension is already in Python's search path,
769 If you know that the extension is already in Python's search path,
770 you can give the name of the module, followed by ``=``, with nothing
770 you can give the name of the module, followed by ``=``, with nothing
771 after the ``=``.
771 after the ``=``.
772
772
773 Otherwise, give a name that you choose, followed by ``=``, followed by
773 Otherwise, give a name that you choose, followed by ``=``, followed by
774 the path to the ``.py`` file (including the file name extension) that
774 the path to the ``.py`` file (including the file name extension) that
775 defines the extension.
775 defines the extension.
776
776
777 To explicitly disable an extension that is enabled in an hgrc of
777 To explicitly disable an extension that is enabled in an hgrc of
778 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
778 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
779 or ``foo = !`` when path is not supplied.
779 or ``foo = !`` when path is not supplied.
780
780
781 Example for ``~/.hgrc``::
781 Example for ``~/.hgrc``::
782
782
783 [extensions]
783 [extensions]
784 # (the churn extension will get loaded from Mercurial's path)
784 # (the churn extension will get loaded from Mercurial's path)
785 churn =
785 churn =
786 # (this extension will get loaded from the file specified)
786 # (this extension will get loaded from the file specified)
787 myfeature = ~/.hgext/myfeature.py
787 myfeature = ~/.hgext/myfeature.py
788
788
789
789
790 ``format``
790 ``format``
791 ----------
791 ----------
792
792
793 Configuration that controls the repository format. Newer format options are more
793 Configuration that controls the repository format. Newer format options are more
794 powerful but incompatible with some older versions of Mercurial. Format options
794 powerful but incompatible with some older versions of Mercurial. Format options
795 are considered at repository initialization only. You need to make a new clone
795 are considered at repository initialization only. You need to make a new clone
796 for config change to be taken into account.
796 for config change to be taken into account.
797
797
798 For more details about repository format and version compatibility, see
798 For more details about repository format and version compatibility, see
799 https://www.mercurial-scm.org/wiki/MissingRequirement
799 https://www.mercurial-scm.org/wiki/MissingRequirement
800
800
801 ``usegeneraldelta``
801 ``usegeneraldelta``
802 Enable or disable the "generaldelta" repository format which improves
802 Enable or disable the "generaldelta" repository format which improves
803 repository compression by allowing "revlog" to store delta against arbitrary
803 repository compression by allowing "revlog" to store delta against arbitrary
804 revision instead of the previous stored one. This provides significant
804 revision instead of the previous stored one. This provides significant
805 improvement for repositories with branches.
805 improvement for repositories with branches.
806
806
807 Repositories with this on-disk format require Mercurial version 1.9.
807 Repositories with this on-disk format require Mercurial version 1.9.
808
808
809 Enabled by default.
809 Enabled by default.
810
810
811 ``dotencode``
811 ``dotencode``
812 Enable or disable the "dotencode" repository format which enhances
812 Enable or disable the "dotencode" repository format which enhances
813 the "fncache" repository format (which has to be enabled to use
813 the "fncache" repository format (which has to be enabled to use
814 dotencode) to avoid issues with filenames starting with ._ on
814 dotencode) to avoid issues with filenames starting with ._ on
815 Mac OS X and spaces on Windows.
815 Mac OS X and spaces on Windows.
816
816
817 Repositories with this on-disk format require Mercurial version 1.7.
817 Repositories with this on-disk format require Mercurial version 1.7.
818
818
819 Enabled by default.
819 Enabled by default.
820
820
821 ``usefncache``
821 ``usefncache``
822 Enable or disable the "fncache" repository format which enhances
822 Enable or disable the "fncache" repository format which enhances
823 the "store" repository format (which has to be enabled to use
823 the "store" repository format (which has to be enabled to use
824 fncache) to allow longer filenames and avoids using Windows
824 fncache) to allow longer filenames and avoids using Windows
825 reserved names, e.g. "nul".
825 reserved names, e.g. "nul".
826
826
827 Repositories with this on-disk format require Mercurial version 1.1.
827 Repositories with this on-disk format require Mercurial version 1.1.
828
828
829 Enabled by default.
829 Enabled by default.
830
830
831 ``usestore``
831 ``usestore``
832 Enable or disable the "store" repository format which improves
832 Enable or disable the "store" repository format which improves
833 compatibility with systems that fold case or otherwise mangle
833 compatibility with systems that fold case or otherwise mangle
834 filenames. Disabling this option will allow you to store longer filenames
834 filenames. Disabling this option will allow you to store longer filenames
835 in some situations at the expense of compatibility.
835 in some situations at the expense of compatibility.
836
836
837 Repositories with this on-disk format require Mercurial version 0.9.4.
837 Repositories with this on-disk format require Mercurial version 0.9.4.
838
838
839 Enabled by default.
839 Enabled by default.
840
840
841 ``graph``
841 ``graph``
842 ---------
842 ---------
843
843
844 Web graph view configuration. This section let you change graph
844 Web graph view configuration. This section let you change graph
845 elements display properties by branches, for instance to make the
845 elements display properties by branches, for instance to make the
846 ``default`` branch stand out.
846 ``default`` branch stand out.
847
847
848 Each line has the following format::
848 Each line has the following format::
849
849
850 <branch>.<argument> = <value>
850 <branch>.<argument> = <value>
851
851
852 where ``<branch>`` is the name of the branch being
852 where ``<branch>`` is the name of the branch being
853 customized. Example::
853 customized. Example::
854
854
855 [graph]
855 [graph]
856 # 2px width
856 # 2px width
857 default.width = 2
857 default.width = 2
858 # red color
858 # red color
859 default.color = FF0000
859 default.color = FF0000
860
860
861 Supported arguments:
861 Supported arguments:
862
862
863 ``width``
863 ``width``
864 Set branch edges width in pixels.
864 Set branch edges width in pixels.
865
865
866 ``color``
866 ``color``
867 Set branch edges color in hexadecimal RGB notation.
867 Set branch edges color in hexadecimal RGB notation.
868
868
869 ``hooks``
869 ``hooks``
870 ---------
870 ---------
871
871
872 Commands or Python functions that get automatically executed by
872 Commands or Python functions that get automatically executed by
873 various actions such as starting or finishing a commit. Multiple
873 various actions such as starting or finishing a commit. Multiple
874 hooks can be run for the same action by appending a suffix to the
874 hooks can be run for the same action by appending a suffix to the
875 action. Overriding a site-wide hook can be done by changing its
875 action. Overriding a site-wide hook can be done by changing its
876 value or setting it to an empty string. Hooks can be prioritized
876 value or setting it to an empty string. Hooks can be prioritized
877 by adding a prefix of ``priority.`` to the hook name on a new line
877 by adding a prefix of ``priority.`` to the hook name on a new line
878 and setting the priority. The default priority is 0.
878 and setting the priority. The default priority is 0.
879
879
880 Example ``.hg/hgrc``::
880 Example ``.hg/hgrc``::
881
881
882 [hooks]
882 [hooks]
883 # update working directory after adding changesets
883 # update working directory after adding changesets
884 changegroup.update = hg update
884 changegroup.update = hg update
885 # do not use the site-wide hook
885 # do not use the site-wide hook
886 incoming =
886 incoming =
887 incoming.email = /my/email/hook
887 incoming.email = /my/email/hook
888 incoming.autobuild = /my/build/hook
888 incoming.autobuild = /my/build/hook
889 # force autobuild hook to run before other incoming hooks
889 # force autobuild hook to run before other incoming hooks
890 priority.incoming.autobuild = 1
890 priority.incoming.autobuild = 1
891
891
892 Most hooks are run with environment variables set that give useful
892 Most hooks are run with environment variables set that give useful
893 additional information. For each hook below, the environment variables
893 additional information. For each hook below, the environment variables
894 it is passed are listed with names in the form ``$HG_foo``. The
894 it is passed are listed with names in the form ``$HG_foo``. The
895 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
895 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
896 They contain the type of hook which triggered the run and the full name
896 They contain the type of hook which triggered the run and the full name
897 of the hook in the config, respectively. In the example above, this will
897 of the hook in the config, respectively. In the example above, this will
898 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
898 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
899
899
900 .. container:: windows
900 .. container:: windows
901
901
902 Some basic Unix syntax can be enabled for portability, including ``$VAR``
902 Some basic Unix syntax can be enabled for portability, including ``$VAR``
903 and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will
903 and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will
904 be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion
904 be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion
905 on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back
905 on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back
906 slash or inside of a strong quote. Strong quotes will be replaced by
906 slash or inside of a strong quote. Strong quotes will be replaced by
907 double quotes after processing.
907 double quotes after processing.
908
908
909 This feature is enabled by adding a prefix of ``tonative.`` to the hook
909 This feature is enabled by adding a prefix of ``tonative.`` to the hook
910 name on a new line, and setting it to ``True``. For example::
910 name on a new line, and setting it to ``True``. For example::
911
911
912 [hooks]
912 [hooks]
913 incoming.autobuild = /my/build/hook
913 incoming.autobuild = /my/build/hook
914 # enable translation to cmd.exe syntax for autobuild hook
914 # enable translation to cmd.exe syntax for autobuild hook
915 tonative.incoming.autobuild = True
915 tonative.incoming.autobuild = True
916
916
917 ``changegroup``
917 ``changegroup``
918 Run after a changegroup has been added via push, pull or unbundle. The ID of
918 Run after a changegroup has been added via push, pull or unbundle. The ID of
919 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
919 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
920 The URL from which changes came is in ``$HG_URL``.
920 The URL from which changes came is in ``$HG_URL``.
921
921
922 ``commit``
922 ``commit``
923 Run after a changeset has been created in the local repository. The ID
923 Run after a changeset has been created in the local repository. The ID
924 of the newly created changeset is in ``$HG_NODE``. Parent changeset
924 of the newly created changeset is in ``$HG_NODE``. Parent changeset
925 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
925 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
926
926
927 ``incoming``
927 ``incoming``
928 Run after a changeset has been pulled, pushed, or unbundled into
928 Run after a changeset has been pulled, pushed, or unbundled into
929 the local repository. The ID of the newly arrived changeset is in
929 the local repository. The ID of the newly arrived changeset is in
930 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
930 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
931
931
932 ``outgoing``
932 ``outgoing``
933 Run after sending changes from the local repository to another. The ID of
933 Run after sending changes from the local repository to another. The ID of
934 first changeset sent is in ``$HG_NODE``. The source of operation is in
934 first changeset sent is in ``$HG_NODE``. The source of operation is in
935 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
935 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
936
936
937 ``post-<command>``
937 ``post-<command>``
938 Run after successful invocations of the associated command. The
938 Run after successful invocations of the associated command. The
939 contents of the command line are passed as ``$HG_ARGS`` and the result
939 contents of the command line are passed as ``$HG_ARGS`` and the result
940 code in ``$HG_RESULT``. Parsed command line arguments are passed as
940 code in ``$HG_RESULT``. Parsed command line arguments are passed as
941 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
941 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
942 the python data internally passed to <command>. ``$HG_OPTS`` is a
942 the python data internally passed to <command>. ``$HG_OPTS`` is a
943 dictionary of options (with unspecified options set to their defaults).
943 dictionary of options (with unspecified options set to their defaults).
944 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
944 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
945
945
946 ``fail-<command>``
946 ``fail-<command>``
947 Run after a failed invocation of an associated command. The contents
947 Run after a failed invocation of an associated command. The contents
948 of the command line are passed as ``$HG_ARGS``. Parsed command line
948 of the command line are passed as ``$HG_ARGS``. Parsed command line
949 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
949 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
950 string representations of the python data internally passed to
950 string representations of the python data internally passed to
951 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
951 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
952 options set to their defaults). ``$HG_PATS`` is a list of arguments.
952 options set to their defaults). ``$HG_PATS`` is a list of arguments.
953 Hook failure is ignored.
953 Hook failure is ignored.
954
954
955 ``pre-<command>``
955 ``pre-<command>``
956 Run before executing the associated command. The contents of the
956 Run before executing the associated command. The contents of the
957 command line are passed as ``$HG_ARGS``. Parsed command line arguments
957 command line are passed as ``$HG_ARGS``. Parsed command line arguments
958 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
958 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
959 representations of the data internally passed to <command>. ``$HG_OPTS``
959 representations of the data internally passed to <command>. ``$HG_OPTS``
960 is a dictionary of options (with unspecified options set to their
960 is a dictionary of options (with unspecified options set to their
961 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
961 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
962 failure, the command doesn't execute and Mercurial returns the failure
962 failure, the command doesn't execute and Mercurial returns the failure
963 code.
963 code.
964
964
965 ``prechangegroup``
965 ``prechangegroup``
966 Run before a changegroup is added via push, pull or unbundle. Exit
966 Run before a changegroup is added via push, pull or unbundle. Exit
967 status 0 allows the changegroup to proceed. A non-zero status will
967 status 0 allows the changegroup to proceed. A non-zero status will
968 cause the push, pull or unbundle to fail. The URL from which changes
968 cause the push, pull or unbundle to fail. The URL from which changes
969 will come is in ``$HG_URL``.
969 will come is in ``$HG_URL``.
970
970
971 ``precommit``
971 ``precommit``
972 Run before starting a local commit. Exit status 0 allows the
972 Run before starting a local commit. Exit status 0 allows the
973 commit to proceed. A non-zero status will cause the commit to fail.
973 commit to proceed. A non-zero status will cause the commit to fail.
974 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
974 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
975
975
976 ``prelistkeys``
976 ``prelistkeys``
977 Run before listing pushkeys (like bookmarks) in the
977 Run before listing pushkeys (like bookmarks) in the
978 repository. A non-zero status will cause failure. The key namespace is
978 repository. A non-zero status will cause failure. The key namespace is
979 in ``$HG_NAMESPACE``.
979 in ``$HG_NAMESPACE``.
980
980
981 ``preoutgoing``
981 ``preoutgoing``
982 Run before collecting changes to send from the local repository to
982 Run before collecting changes to send from the local repository to
983 another. A non-zero status will cause failure. This lets you prevent
983 another. A non-zero status will cause failure. This lets you prevent
984 pull over HTTP or SSH. It can also prevent propagating commits (via
984 pull over HTTP or SSH. It can also prevent propagating commits (via
985 local pull, push (outbound) or bundle commands), but not completely,
985 local pull, push (outbound) or bundle commands), but not completely,
986 since you can just copy files instead. The source of operation is in
986 since you can just copy files instead. The source of operation is in
987 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
987 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
988 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
988 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
989 is happening on behalf of a repository on same system.
989 is happening on behalf of a repository on same system.
990
990
991 ``prepushkey``
991 ``prepushkey``
992 Run before a pushkey (like a bookmark) is added to the
992 Run before a pushkey (like a bookmark) is added to the
993 repository. A non-zero status will cause the key to be rejected. The
993 repository. A non-zero status will cause the key to be rejected. The
994 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
994 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
995 the old value (if any) is in ``$HG_OLD``, and the new value is in
995 the old value (if any) is in ``$HG_OLD``, and the new value is in
996 ``$HG_NEW``.
996 ``$HG_NEW``.
997
997
998 ``pretag``
998 ``pretag``
999 Run before creating a tag. Exit status 0 allows the tag to be
999 Run before creating a tag. Exit status 0 allows the tag to be
1000 created. A non-zero status will cause the tag to fail. The ID of the
1000 created. A non-zero status will cause the tag to fail. The ID of the
1001 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
1001 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
1002 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
1002 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
1003
1003
1004 ``pretxnopen``
1004 ``pretxnopen``
1005 Run before any new repository transaction is open. The reason for the
1005 Run before any new repository transaction is open. The reason for the
1006 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
1006 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
1007 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
1007 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
1008 transaction from being opened.
1008 transaction from being opened.
1009
1009
1010 ``pretxnclose``
1010 ``pretxnclose``
1011 Run right before the transaction is actually finalized. Any repository change
1011 Run right before the transaction is actually finalized. Any repository change
1012 will be visible to the hook program. This lets you validate the transaction
1012 will be visible to the hook program. This lets you validate the transaction
1013 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1013 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1014 status will cause the transaction to be rolled back. The reason for the
1014 status will cause the transaction to be rolled back. The reason for the
1015 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1015 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1016 the transaction will be in ``HG_TXNID``. The rest of the available data will
1016 the transaction will be in ``HG_TXNID``. The rest of the available data will
1017 vary according the transaction type. New changesets will add ``$HG_NODE``
1017 vary according the transaction type. New changesets will add ``$HG_NODE``
1018 (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
1018 (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
1019 added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
1019 added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
1020 phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
1020 phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
1021 respectively, etc.
1021 respectively, etc.
1022
1022
1023 ``pretxnclose-bookmark``
1023 ``pretxnclose-bookmark``
1024 Run right before a bookmark change is actually finalized. Any repository
1024 Run right before a bookmark change is actually finalized. Any repository
1025 change will be visible to the hook program. This lets you validate the
1025 change will be visible to the hook program. This lets you validate the
1026 transaction content or change it. Exit status 0 allows the commit to
1026 transaction content or change it. Exit status 0 allows the commit to
1027 proceed. A non-zero status will cause the transaction to be rolled back.
1027 proceed. A non-zero status will cause the transaction to be rolled back.
1028 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1028 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1029 bookmark location will be available in ``$HG_NODE`` while the previous
1029 bookmark location will be available in ``$HG_NODE`` while the previous
1030 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1030 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1031 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1031 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1032 will be empty.
1032 will be empty.
1033 In addition, the reason for the transaction opening will be in
1033 In addition, the reason for the transaction opening will be in
1034 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1034 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1035 ``HG_TXNID``.
1035 ``HG_TXNID``.
1036
1036
1037 ``pretxnclose-phase``
1037 ``pretxnclose-phase``
1038 Run right before a phase change is actually finalized. Any repository change
1038 Run right before a phase change is actually finalized. Any repository change
1039 will be visible to the hook program. This lets you validate the transaction
1039 will be visible to the hook program. This lets you validate the transaction
1040 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1040 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1041 status will cause the transaction to be rolled back. The hook is called
1041 status will cause the transaction to be rolled back. The hook is called
1042 multiple times, once for each revision affected by a phase change.
1042 multiple times, once for each revision affected by a phase change.
1043 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1043 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1044 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1044 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1045 will be empty. In addition, the reason for the transaction opening will be in
1045 will be empty. In addition, the reason for the transaction opening will be in
1046 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1046 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1047 ``HG_TXNID``. The hook is also run for newly added revisions. In this case
1047 ``HG_TXNID``. The hook is also run for newly added revisions. In this case
1048 the ``$HG_OLDPHASE`` entry will be empty.
1048 the ``$HG_OLDPHASE`` entry will be empty.
1049
1049
1050 ``txnclose``
1050 ``txnclose``
1051 Run after any repository transaction has been committed. At this
1051 Run after any repository transaction has been committed. At this
1052 point, the transaction can no longer be rolled back. The hook will run
1052 point, the transaction can no longer be rolled back. The hook will run
1053 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1053 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1054 details about available variables.
1054 details about available variables.
1055
1055
1056 ``txnclose-bookmark``
1056 ``txnclose-bookmark``
1057 Run after any bookmark change has been committed. At this point, the
1057 Run after any bookmark change has been committed. At this point, the
1058 transaction can no longer be rolled back. The hook will run after the lock
1058 transaction can no longer be rolled back. The hook will run after the lock
1059 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1059 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1060 about available variables.
1060 about available variables.
1061
1061
1062 ``txnclose-phase``
1062 ``txnclose-phase``
1063 Run after any phase change has been committed. At this point, the
1063 Run after any phase change has been committed. At this point, the
1064 transaction can no longer be rolled back. The hook will run after the lock
1064 transaction can no longer be rolled back. The hook will run after the lock
1065 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1065 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1066 available variables.
1066 available variables.
1067
1067
1068 ``txnabort``
1068 ``txnabort``
1069 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1069 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1070 for details about available variables.
1070 for details about available variables.
1071
1071
1072 ``pretxnchangegroup``
1072 ``pretxnchangegroup``
1073 Run after a changegroup has been added via push, pull or unbundle, but before
1073 Run after a changegroup has been added via push, pull or unbundle, but before
1074 the transaction has been committed. The changegroup is visible to the hook
1074 the transaction has been committed. The changegroup is visible to the hook
1075 program. This allows validation of incoming changes before accepting them.
1075 program. This allows validation of incoming changes before accepting them.
1076 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1076 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1077 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1077 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1078 status will cause the transaction to be rolled back, and the push, pull or
1078 status will cause the transaction to be rolled back, and the push, pull or
1079 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1079 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1080
1080
1081 ``pretxncommit``
1081 ``pretxncommit``
1082 Run after a changeset has been created, but before the transaction is
1082 Run after a changeset has been created, but before the transaction is
1083 committed. The changeset is visible to the hook program. This allows
1083 committed. The changeset is visible to the hook program. This allows
1084 validation of the commit message and changes. Exit status 0 allows the
1084 validation of the commit message and changes. Exit status 0 allows the
1085 commit to proceed. A non-zero status will cause the transaction to
1085 commit to proceed. A non-zero status will cause the transaction to
1086 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1086 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1087 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1087 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1088
1088
1089 ``preupdate``
1089 ``preupdate``
1090 Run before updating the working directory. Exit status 0 allows
1090 Run before updating the working directory. Exit status 0 allows
1091 the update to proceed. A non-zero status will prevent the update.
1091 the update to proceed. A non-zero status will prevent the update.
1092 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1092 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1093 merge, the ID of second new parent is in ``$HG_PARENT2``.
1093 merge, the ID of second new parent is in ``$HG_PARENT2``.
1094
1094
1095 ``listkeys``
1095 ``listkeys``
1096 Run after listing pushkeys (like bookmarks) in the repository. The
1096 Run after listing pushkeys (like bookmarks) in the repository. The
1097 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1097 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1098 dictionary containing the keys and values.
1098 dictionary containing the keys and values.
1099
1099
1100 ``pushkey``
1100 ``pushkey``
1101 Run after a pushkey (like a bookmark) is added to the
1101 Run after a pushkey (like a bookmark) is added to the
1102 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1102 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1103 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1103 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1104 value is in ``$HG_NEW``.
1104 value is in ``$HG_NEW``.
1105
1105
1106 ``tag``
1106 ``tag``
1107 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1107 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1108 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1108 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1109 the repository if ``$HG_LOCAL=0``.
1109 the repository if ``$HG_LOCAL=0``.
1110
1110
1111 ``update``
1111 ``update``
1112 Run after updating the working directory. The changeset ID of first
1112 Run after updating the working directory. The changeset ID of first
1113 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1113 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1114 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1114 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1115 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1115 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1116
1116
1117 .. note::
1117 .. note::
1118
1118
1119 It is generally better to use standard hooks rather than the
1119 It is generally better to use standard hooks rather than the
1120 generic pre- and post- command hooks, as they are guaranteed to be
1120 generic pre- and post- command hooks, as they are guaranteed to be
1121 called in the appropriate contexts for influencing transactions.
1121 called in the appropriate contexts for influencing transactions.
1122 Also, hooks like "commit" will be called in all contexts that
1122 Also, hooks like "commit" will be called in all contexts that
1123 generate a commit (e.g. tag) and not just the commit command.
1123 generate a commit (e.g. tag) and not just the commit command.
1124
1124
1125 .. note::
1125 .. note::
1126
1126
1127 Environment variables with empty values may not be passed to
1127 Environment variables with empty values may not be passed to
1128 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1128 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1129 will have an empty value under Unix-like platforms for non-merge
1129 will have an empty value under Unix-like platforms for non-merge
1130 changesets, while it will not be available at all under Windows.
1130 changesets, while it will not be available at all under Windows.
1131
1131
1132 The syntax for Python hooks is as follows::
1132 The syntax for Python hooks is as follows::
1133
1133
1134 hookname = python:modulename.submodule.callable
1134 hookname = python:modulename.submodule.callable
1135 hookname = python:/path/to/python/module.py:callable
1135 hookname = python:/path/to/python/module.py:callable
1136
1136
1137 Python hooks are run within the Mercurial process. Each hook is
1137 Python hooks are run within the Mercurial process. Each hook is
1138 called with at least three keyword arguments: a ui object (keyword
1138 called with at least three keyword arguments: a ui object (keyword
1139 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1139 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1140 keyword that tells what kind of hook is used. Arguments listed as
1140 keyword that tells what kind of hook is used. Arguments listed as
1141 environment variables above are passed as keyword arguments, with no
1141 environment variables above are passed as keyword arguments, with no
1142 ``HG_`` prefix, and names in lower case.
1142 ``HG_`` prefix, and names in lower case.
1143
1143
1144 If a Python hook returns a "true" value or raises an exception, this
1144 If a Python hook returns a "true" value or raises an exception, this
1145 is treated as a failure.
1145 is treated as a failure.
1146
1146
1147
1147
1148 ``hostfingerprints``
1148 ``hostfingerprints``
1149 --------------------
1149 --------------------
1150
1150
1151 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1151 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1152
1152
1153 Fingerprints of the certificates of known HTTPS servers.
1153 Fingerprints of the certificates of known HTTPS servers.
1154
1154
1155 A HTTPS connection to a server with a fingerprint configured here will
1155 A HTTPS connection to a server with a fingerprint configured here will
1156 only succeed if the servers certificate matches the fingerprint.
1156 only succeed if the servers certificate matches the fingerprint.
1157 This is very similar to how ssh known hosts works.
1157 This is very similar to how ssh known hosts works.
1158
1158
1159 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1159 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1160 Multiple values can be specified (separated by spaces or commas). This can
1160 Multiple values can be specified (separated by spaces or commas). This can
1161 be used to define both old and new fingerprints while a host transitions
1161 be used to define both old and new fingerprints while a host transitions
1162 to a new certificate.
1162 to a new certificate.
1163
1163
1164 The CA chain and web.cacerts is not used for servers with a fingerprint.
1164 The CA chain and web.cacerts is not used for servers with a fingerprint.
1165
1165
1166 For example::
1166 For example::
1167
1167
1168 [hostfingerprints]
1168 [hostfingerprints]
1169 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1169 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1170 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1170 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1171
1171
1172 ``hostsecurity``
1172 ``hostsecurity``
1173 ----------------
1173 ----------------
1174
1174
1175 Used to specify global and per-host security settings for connecting to
1175 Used to specify global and per-host security settings for connecting to
1176 other machines.
1176 other machines.
1177
1177
1178 The following options control default behavior for all hosts.
1178 The following options control default behavior for all hosts.
1179
1179
1180 ``ciphers``
1180 ``ciphers``
1181 Defines the cryptographic ciphers to use for connections.
1181 Defines the cryptographic ciphers to use for connections.
1182
1182
1183 Value must be a valid OpenSSL Cipher List Format as documented at
1183 Value must be a valid OpenSSL Cipher List Format as documented at
1184 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1184 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1185
1185
1186 This setting is for advanced users only. Setting to incorrect values
1186 This setting is for advanced users only. Setting to incorrect values
1187 can significantly lower connection security or decrease performance.
1187 can significantly lower connection security or decrease performance.
1188 You have been warned.
1188 You have been warned.
1189
1189
1190 This option requires Python 2.7.
1190 This option requires Python 2.7.
1191
1191
1192 ``minimumprotocol``
1192 ``minimumprotocol``
1193 Defines the minimum channel encryption protocol to use.
1193 Defines the minimum channel encryption protocol to use.
1194
1194
1195 By default, the highest version of TLS supported by both client and server
1195 By default, the highest version of TLS supported by both client and server
1196 is used.
1196 is used.
1197
1197
1198 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1198 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1199
1199
1200 When running on an old Python version, only ``tls1.0`` is allowed since
1200 When running on an old Python version, only ``tls1.0`` is allowed since
1201 old versions of Python only support up to TLS 1.0.
1201 old versions of Python only support up to TLS 1.0.
1202
1202
1203 When running a Python that supports modern TLS versions, the default is
1203 When running a Python that supports modern TLS versions, the default is
1204 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1204 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1205 weakens security and should only be used as a feature of last resort if
1205 weakens security and should only be used as a feature of last resort if
1206 a server does not support TLS 1.1+.
1206 a server does not support TLS 1.1+.
1207
1207
1208 Options in the ``[hostsecurity]`` section can have the form
1208 Options in the ``[hostsecurity]`` section can have the form
1209 ``hostname``:``setting``. This allows multiple settings to be defined on a
1209 ``hostname``:``setting``. This allows multiple settings to be defined on a
1210 per-host basis.
1210 per-host basis.
1211
1211
1212 The following per-host settings can be defined.
1212 The following per-host settings can be defined.
1213
1213
1214 ``ciphers``
1214 ``ciphers``
1215 This behaves like ``ciphers`` as described above except it only applies
1215 This behaves like ``ciphers`` as described above except it only applies
1216 to the host on which it is defined.
1216 to the host on which it is defined.
1217
1217
1218 ``fingerprints``
1218 ``fingerprints``
1219 A list of hashes of the DER encoded peer/remote certificate. Values have
1219 A list of hashes of the DER encoded peer/remote certificate. Values have
1220 the form ``algorithm``:``fingerprint``. e.g.
1220 the form ``algorithm``:``fingerprint``. e.g.
1221 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1221 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1222 In addition, colons (``:``) can appear in the fingerprint part.
1222 In addition, colons (``:``) can appear in the fingerprint part.
1223
1223
1224 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1224 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1225 ``sha512``.
1225 ``sha512``.
1226
1226
1227 Use of ``sha256`` or ``sha512`` is preferred.
1227 Use of ``sha256`` or ``sha512`` is preferred.
1228
1228
1229 If a fingerprint is specified, the CA chain is not validated for this
1229 If a fingerprint is specified, the CA chain is not validated for this
1230 host and Mercurial will require the remote certificate to match one
1230 host and Mercurial will require the remote certificate to match one
1231 of the fingerprints specified. This means if the server updates its
1231 of the fingerprints specified. This means if the server updates its
1232 certificate, Mercurial will abort until a new fingerprint is defined.
1232 certificate, Mercurial will abort until a new fingerprint is defined.
1233 This can provide stronger security than traditional CA-based validation
1233 This can provide stronger security than traditional CA-based validation
1234 at the expense of convenience.
1234 at the expense of convenience.
1235
1235
1236 This option takes precedence over ``verifycertsfile``.
1236 This option takes precedence over ``verifycertsfile``.
1237
1237
1238 ``minimumprotocol``
1238 ``minimumprotocol``
1239 This behaves like ``minimumprotocol`` as described above except it
1239 This behaves like ``minimumprotocol`` as described above except it
1240 only applies to the host on which it is defined.
1240 only applies to the host on which it is defined.
1241
1241
1242 ``verifycertsfile``
1242 ``verifycertsfile``
1243 Path to file a containing a list of PEM encoded certificates used to
1243 Path to file a containing a list of PEM encoded certificates used to
1244 verify the server certificate. Environment variables and ``~user``
1244 verify the server certificate. Environment variables and ``~user``
1245 constructs are expanded in the filename.
1245 constructs are expanded in the filename.
1246
1246
1247 The server certificate or the certificate's certificate authority (CA)
1247 The server certificate or the certificate's certificate authority (CA)
1248 must match a certificate from this file or certificate verification
1248 must match a certificate from this file or certificate verification
1249 will fail and connections to the server will be refused.
1249 will fail and connections to the server will be refused.
1250
1250
1251 If defined, only certificates provided by this file will be used:
1251 If defined, only certificates provided by this file will be used:
1252 ``web.cacerts`` and any system/default certificates will not be
1252 ``web.cacerts`` and any system/default certificates will not be
1253 used.
1253 used.
1254
1254
1255 This option has no effect if the per-host ``fingerprints`` option
1255 This option has no effect if the per-host ``fingerprints`` option
1256 is set.
1256 is set.
1257
1257
1258 The format of the file is as follows::
1258 The format of the file is as follows::
1259
1259
1260 -----BEGIN CERTIFICATE-----
1260 -----BEGIN CERTIFICATE-----
1261 ... (certificate in base64 PEM encoding) ...
1261 ... (certificate in base64 PEM encoding) ...
1262 -----END CERTIFICATE-----
1262 -----END CERTIFICATE-----
1263 -----BEGIN CERTIFICATE-----
1263 -----BEGIN CERTIFICATE-----
1264 ... (certificate in base64 PEM encoding) ...
1264 ... (certificate in base64 PEM encoding) ...
1265 -----END CERTIFICATE-----
1265 -----END CERTIFICATE-----
1266
1266
1267 For example::
1267 For example::
1268
1268
1269 [hostsecurity]
1269 [hostsecurity]
1270 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1270 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1271 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
1271 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
1272 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
1272 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
1273 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1273 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1274
1274
1275 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1275 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1276 when connecting to ``hg.example.com``::
1276 when connecting to ``hg.example.com``::
1277
1277
1278 [hostsecurity]
1278 [hostsecurity]
1279 minimumprotocol = tls1.2
1279 minimumprotocol = tls1.2
1280 hg.example.com:minimumprotocol = tls1.1
1280 hg.example.com:minimumprotocol = tls1.1
1281
1281
1282 ``http_proxy``
1282 ``http_proxy``
1283 --------------
1283 --------------
1284
1284
1285 Used to access web-based Mercurial repositories through a HTTP
1285 Used to access web-based Mercurial repositories through a HTTP
1286 proxy.
1286 proxy.
1287
1287
1288 ``host``
1288 ``host``
1289 Host name and (optional) port of the proxy server, for example
1289 Host name and (optional) port of the proxy server, for example
1290 "myproxy:8000".
1290 "myproxy:8000".
1291
1291
1292 ``no``
1292 ``no``
1293 Optional. Comma-separated list of host names that should bypass
1293 Optional. Comma-separated list of host names that should bypass
1294 the proxy.
1294 the proxy.
1295
1295
1296 ``passwd``
1296 ``passwd``
1297 Optional. Password to authenticate with at the proxy server.
1297 Optional. Password to authenticate with at the proxy server.
1298
1298
1299 ``user``
1299 ``user``
1300 Optional. User name to authenticate with at the proxy server.
1300 Optional. User name to authenticate with at the proxy server.
1301
1301
1302 ``always``
1302 ``always``
1303 Optional. Always use the proxy, even for localhost and any entries
1303 Optional. Always use the proxy, even for localhost and any entries
1304 in ``http_proxy.no``. (default: False)
1304 in ``http_proxy.no``. (default: False)
1305
1305
1306 ``merge``
1306 ``merge``
1307 ---------
1307 ---------
1308
1308
1309 This section specifies behavior during merges and updates.
1309 This section specifies behavior during merges and updates.
1310
1310
1311 ``checkignored``
1311 ``checkignored``
1312 Controls behavior when an ignored file on disk has the same name as a tracked
1312 Controls behavior when an ignored file on disk has the same name as a tracked
1313 file in the changeset being merged or updated to, and has different
1313 file in the changeset being merged or updated to, and has different
1314 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1314 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1315 abort on such files. With ``warn``, warn on such files and back them up as
1315 abort on such files. With ``warn``, warn on such files and back them up as
1316 ``.orig``. With ``ignore``, don't print a warning and back them up as
1316 ``.orig``. With ``ignore``, don't print a warning and back them up as
1317 ``.orig``. (default: ``abort``)
1317 ``.orig``. (default: ``abort``)
1318
1318
1319 ``checkunknown``
1319 ``checkunknown``
1320 Controls behavior when an unknown file that isn't ignored has the same name
1320 Controls behavior when an unknown file that isn't ignored has the same name
1321 as a tracked file in the changeset being merged or updated to, and has
1321 as a tracked file in the changeset being merged or updated to, and has
1322 different contents. Similar to ``merge.checkignored``, except for files that
1322 different contents. Similar to ``merge.checkignored``, except for files that
1323 are not ignored. (default: ``abort``)
1323 are not ignored. (default: ``abort``)
1324
1324
1325 ``on-failure``
1325 ``on-failure``
1326 When set to ``continue`` (the default), the merge process attempts to
1326 When set to ``continue`` (the default), the merge process attempts to
1327 merge all unresolved files using the merge chosen tool, regardless of
1327 merge all unresolved files using the merge chosen tool, regardless of
1328 whether previous file merge attempts during the process succeeded or not.
1328 whether previous file merge attempts during the process succeeded or not.
1329 Setting this to ``prompt`` will prompt after any merge failure continue
1329 Setting this to ``prompt`` will prompt after any merge failure continue
1330 or halt the merge process. Setting this to ``halt`` will automatically
1330 or halt the merge process. Setting this to ``halt`` will automatically
1331 halt the merge process on any merge tool failure. The merge process
1331 halt the merge process on any merge tool failure. The merge process
1332 can be restarted by using the ``resolve`` command. When a merge is
1332 can be restarted by using the ``resolve`` command. When a merge is
1333 halted, the repository is left in a normal ``unresolved`` merge state.
1333 halted, the repository is left in a normal ``unresolved`` merge state.
1334 (default: ``continue``)
1334 (default: ``continue``)
1335
1335
1336 ``merge-patterns``
1336 ``merge-patterns``
1337 ------------------
1337 ------------------
1338
1338
1339 This section specifies merge tools to associate with particular file
1339 This section specifies merge tools to associate with particular file
1340 patterns. Tools matched here will take precedence over the default
1340 patterns. Tools matched here will take precedence over the default
1341 merge tool. Patterns are globs by default, rooted at the repository
1341 merge tool. Patterns are globs by default, rooted at the repository
1342 root.
1342 root.
1343
1343
1344 Example::
1344 Example::
1345
1345
1346 [merge-patterns]
1346 [merge-patterns]
1347 **.c = kdiff3
1347 **.c = kdiff3
1348 **.jpg = myimgmerge
1348 **.jpg = myimgmerge
1349
1349
1350 ``merge-tools``
1350 ``merge-tools``
1351 ---------------
1351 ---------------
1352
1352
1353 This section configures external merge tools to use for file-level
1353 This section configures external merge tools to use for file-level
1354 merges. This section has likely been preconfigured at install time.
1354 merges. This section has likely been preconfigured at install time.
1355 Use :hg:`config merge-tools` to check the existing configuration.
1355 Use :hg:`config merge-tools` to check the existing configuration.
1356 Also see :hg:`help merge-tools` for more details.
1356 Also see :hg:`help merge-tools` for more details.
1357
1357
1358 Example ``~/.hgrc``::
1358 Example ``~/.hgrc``::
1359
1359
1360 [merge-tools]
1360 [merge-tools]
1361 # Override stock tool location
1361 # Override stock tool location
1362 kdiff3.executable = ~/bin/kdiff3
1362 kdiff3.executable = ~/bin/kdiff3
1363 # Specify command line
1363 # Specify command line
1364 kdiff3.args = $base $local $other -o $output
1364 kdiff3.args = $base $local $other -o $output
1365 # Give higher priority
1365 # Give higher priority
1366 kdiff3.priority = 1
1366 kdiff3.priority = 1
1367
1367
1368 # Changing the priority of preconfigured tool
1368 # Changing the priority of preconfigured tool
1369 meld.priority = 0
1369 meld.priority = 0
1370
1370
1371 # Disable a preconfigured tool
1371 # Disable a preconfigured tool
1372 vimdiff.disabled = yes
1372 vimdiff.disabled = yes
1373
1373
1374 # Define new tool
1374 # Define new tool
1375 myHtmlTool.args = -m $local $other $base $output
1375 myHtmlTool.args = -m $local $other $base $output
1376 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1376 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1377 myHtmlTool.priority = 1
1377 myHtmlTool.priority = 1
1378
1378
1379 Supported arguments:
1379 Supported arguments:
1380
1380
1381 ``priority``
1381 ``priority``
1382 The priority in which to evaluate this tool.
1382 The priority in which to evaluate this tool.
1383 (default: 0)
1383 (default: 0)
1384
1384
1385 ``executable``
1385 ``executable``
1386 Either just the name of the executable or its pathname.
1386 Either just the name of the executable or its pathname.
1387
1387
1388 .. container:: windows
1388 .. container:: windows
1389
1389
1390 On Windows, the path can use environment variables with ${ProgramFiles}
1390 On Windows, the path can use environment variables with ${ProgramFiles}
1391 syntax.
1391 syntax.
1392
1392
1393 (default: the tool name)
1393 (default: the tool name)
1394
1394
1395 ``args``
1395 ``args``
1396 The arguments to pass to the tool executable. You can refer to the
1396 The arguments to pass to the tool executable. You can refer to the
1397 files being merged as well as the output file through these
1397 files being merged as well as the output file through these
1398 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1398 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1399
1399
1400 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1400 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1401 being performed. During an update or merge, ``$local`` represents the original
1401 being performed. During an update or merge, ``$local`` represents the original
1402 state of the file, while ``$other`` represents the commit you are updating to or
1402 state of the file, while ``$other`` represents the commit you are updating to or
1403 the commit you are merging with. During a rebase, ``$local`` represents the
1403 the commit you are merging with. During a rebase, ``$local`` represents the
1404 destination of the rebase, and ``$other`` represents the commit being rebased.
1404 destination of the rebase, and ``$other`` represents the commit being rebased.
1405
1405
1406 Some operations define custom labels to assist with identifying the revisions,
1406 Some operations define custom labels to assist with identifying the revisions,
1407 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1407 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1408 labels are not available, these will be ``local``, ``other``, and ``base``,
1408 labels are not available, these will be ``local``, ``other``, and ``base``,
1409 respectively.
1409 respectively.
1410 (default: ``$local $base $other``)
1410 (default: ``$local $base $other``)
1411
1411
1412 ``premerge``
1412 ``premerge``
1413 Attempt to run internal non-interactive 3-way merge tool before
1413 Attempt to run internal non-interactive 3-way merge tool before
1414 launching external tool. Options are ``true``, ``false``, ``keep`` or
1414 launching external tool. Options are ``true``, ``false``, ``keep`` or
1415 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1415 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1416 premerge fails. The ``keep-merge3`` will do the same but include information
1416 premerge fails. The ``keep-merge3`` will do the same but include information
1417 about the base of the merge in the marker (see internal :merge3 in
1417 about the base of the merge in the marker (see internal :merge3 in
1418 :hg:`help merge-tools`).
1418 :hg:`help merge-tools`).
1419 (default: True)
1419 (default: True)
1420
1420
1421 ``binary``
1421 ``binary``
1422 This tool can merge binary files. (default: False, unless tool
1422 This tool can merge binary files. (default: False, unless tool
1423 was selected by file pattern match)
1423 was selected by file pattern match)
1424
1424
1425 ``symlink``
1425 ``symlink``
1426 This tool can merge symlinks. (default: False)
1426 This tool can merge symlinks. (default: False)
1427
1427
1428 ``check``
1428 ``check``
1429 A list of merge success-checking options:
1429 A list of merge success-checking options:
1430
1430
1431 ``changed``
1431 ``changed``
1432 Ask whether merge was successful when the merged file shows no changes.
1432 Ask whether merge was successful when the merged file shows no changes.
1433 ``conflicts``
1433 ``conflicts``
1434 Check whether there are conflicts even though the tool reported success.
1434 Check whether there are conflicts even though the tool reported success.
1435 ``prompt``
1435 ``prompt``
1436 Always prompt for merge success, regardless of success reported by tool.
1436 Always prompt for merge success, regardless of success reported by tool.
1437
1437
1438 ``fixeol``
1438 ``fixeol``
1439 Attempt to fix up EOL changes caused by the merge tool.
1439 Attempt to fix up EOL changes caused by the merge tool.
1440 (default: False)
1440 (default: False)
1441
1441
1442 ``gui``
1442 ``gui``
1443 This tool requires a graphical interface to run. (default: False)
1443 This tool requires a graphical interface to run. (default: False)
1444
1444
1445 ``mergemarkers``
1445 ``mergemarkers``
1446 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1446 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1447 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1447 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1448 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1448 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1449 markers generated during premerge will be ``detailed`` if either this option or
1449 markers generated during premerge will be ``detailed`` if either this option or
1450 the corresponding option in the ``[ui]`` section is ``detailed``.
1450 the corresponding option in the ``[ui]`` section is ``detailed``.
1451 (default: ``basic``)
1451 (default: ``basic``)
1452
1452
1453 ``mergemarkertemplate``
1453 ``mergemarkertemplate``
1454 This setting can be used to override ``mergemarkertemplate`` from the ``[ui]``
1454 This setting can be used to override ``mergemarkertemplate`` from the ``[ui]``
1455 section on a per-tool basis; this applies to the ``$label``-prefixed variables
1455 section on a per-tool basis; this applies to the ``$label``-prefixed variables
1456 and to the conflict markers that are generated if ``premerge`` is ``keep` or
1456 and to the conflict markers that are generated if ``premerge`` is ``keep` or
1457 ``keep-merge3``. See the corresponding variable in ``[ui]`` for more
1457 ``keep-merge3``. See the corresponding variable in ``[ui]`` for more
1458 information.
1458 information.
1459
1459
1460 .. container:: windows
1460 .. container:: windows
1461
1461
1462 ``regkey``
1462 ``regkey``
1463 Windows registry key which describes install location of this
1463 Windows registry key which describes install location of this
1464 tool. Mercurial will search for this key first under
1464 tool. Mercurial will search for this key first under
1465 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1465 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1466 (default: None)
1466 (default: None)
1467
1467
1468 ``regkeyalt``
1468 ``regkeyalt``
1469 An alternate Windows registry key to try if the first key is not
1469 An alternate Windows registry key to try if the first key is not
1470 found. The alternate key uses the same ``regname`` and ``regappend``
1470 found. The alternate key uses the same ``regname`` and ``regappend``
1471 semantics of the primary key. The most common use for this key
1471 semantics of the primary key. The most common use for this key
1472 is to search for 32bit applications on 64bit operating systems.
1472 is to search for 32bit applications on 64bit operating systems.
1473 (default: None)
1473 (default: None)
1474
1474
1475 ``regname``
1475 ``regname``
1476 Name of value to read from specified registry key.
1476 Name of value to read from specified registry key.
1477 (default: the unnamed (default) value)
1477 (default: the unnamed (default) value)
1478
1478
1479 ``regappend``
1479 ``regappend``
1480 String to append to the value read from the registry, typically
1480 String to append to the value read from the registry, typically
1481 the executable name of the tool.
1481 the executable name of the tool.
1482 (default: None)
1482 (default: None)
1483
1483
1484 ``pager``
1484 ``pager``
1485 ---------
1485 ---------
1486
1486
1487 Setting used to control when to paginate and with what external tool. See
1487 Setting used to control when to paginate and with what external tool. See
1488 :hg:`help pager` for details.
1488 :hg:`help pager` for details.
1489
1489
1490 ``pager``
1490 ``pager``
1491 Define the external tool used as pager.
1491 Define the external tool used as pager.
1492
1492
1493 If no pager is set, Mercurial uses the environment variable $PAGER.
1493 If no pager is set, Mercurial uses the environment variable $PAGER.
1494 If neither pager.pager, nor $PAGER is set, a default pager will be
1494 If neither pager.pager, nor $PAGER is set, a default pager will be
1495 used, typically `less` on Unix and `more` on Windows. Example::
1495 used, typically `less` on Unix and `more` on Windows. Example::
1496
1496
1497 [pager]
1497 [pager]
1498 pager = less -FRX
1498 pager = less -FRX
1499
1499
1500 ``ignore``
1500 ``ignore``
1501 List of commands to disable the pager for. Example::
1501 List of commands to disable the pager for. Example::
1502
1502
1503 [pager]
1503 [pager]
1504 ignore = version, help, update
1504 ignore = version, help, update
1505
1505
1506 ``patch``
1506 ``patch``
1507 ---------
1507 ---------
1508
1508
1509 Settings used when applying patches, for instance through the 'import'
1509 Settings used when applying patches, for instance through the 'import'
1510 command or with Mercurial Queues extension.
1510 command or with Mercurial Queues extension.
1511
1511
1512 ``eol``
1512 ``eol``
1513 When set to 'strict' patch content and patched files end of lines
1513 When set to 'strict' patch content and patched files end of lines
1514 are preserved. When set to ``lf`` or ``crlf``, both files end of
1514 are preserved. When set to ``lf`` or ``crlf``, both files end of
1515 lines are ignored when patching and the result line endings are
1515 lines are ignored when patching and the result line endings are
1516 normalized to either LF (Unix) or CRLF (Windows). When set to
1516 normalized to either LF (Unix) or CRLF (Windows). When set to
1517 ``auto``, end of lines are again ignored while patching but line
1517 ``auto``, end of lines are again ignored while patching but line
1518 endings in patched files are normalized to their original setting
1518 endings in patched files are normalized to their original setting
1519 on a per-file basis. If target file does not exist or has no end
1519 on a per-file basis. If target file does not exist or has no end
1520 of line, patch line endings are preserved.
1520 of line, patch line endings are preserved.
1521 (default: strict)
1521 (default: strict)
1522
1522
1523 ``fuzz``
1523 ``fuzz``
1524 The number of lines of 'fuzz' to allow when applying patches. This
1524 The number of lines of 'fuzz' to allow when applying patches. This
1525 controls how much context the patcher is allowed to ignore when
1525 controls how much context the patcher is allowed to ignore when
1526 trying to apply a patch.
1526 trying to apply a patch.
1527 (default: 2)
1527 (default: 2)
1528
1528
1529 ``paths``
1529 ``paths``
1530 ---------
1530 ---------
1531
1531
1532 Assigns symbolic names and behavior to repositories.
1532 Assigns symbolic names and behavior to repositories.
1533
1533
1534 Options are symbolic names defining the URL or directory that is the
1534 Options are symbolic names defining the URL or directory that is the
1535 location of the repository. Example::
1535 location of the repository. Example::
1536
1536
1537 [paths]
1537 [paths]
1538 my_server = https://example.com/my_repo
1538 my_server = https://example.com/my_repo
1539 local_path = /home/me/repo
1539 local_path = /home/me/repo
1540
1540
1541 These symbolic names can be used from the command line. To pull
1541 These symbolic names can be used from the command line. To pull
1542 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1542 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1543 :hg:`push local_path`.
1543 :hg:`push local_path`.
1544
1544
1545 Options containing colons (``:``) denote sub-options that can influence
1545 Options containing colons (``:``) denote sub-options that can influence
1546 behavior for that specific path. Example::
1546 behavior for that specific path. Example::
1547
1547
1548 [paths]
1548 [paths]
1549 my_server = https://example.com/my_path
1549 my_server = https://example.com/my_path
1550 my_server:pushurl = ssh://example.com/my_path
1550 my_server:pushurl = ssh://example.com/my_path
1551
1551
1552 The following sub-options can be defined:
1552 The following sub-options can be defined:
1553
1553
1554 ``pushurl``
1554 ``pushurl``
1555 The URL to use for push operations. If not defined, the location
1555 The URL to use for push operations. If not defined, the location
1556 defined by the path's main entry is used.
1556 defined by the path's main entry is used.
1557
1557
1558 ``pushrev``
1558 ``pushrev``
1559 A revset defining which revisions to push by default.
1559 A revset defining which revisions to push by default.
1560
1560
1561 When :hg:`push` is executed without a ``-r`` argument, the revset
1561 When :hg:`push` is executed without a ``-r`` argument, the revset
1562 defined by this sub-option is evaluated to determine what to push.
1562 defined by this sub-option is evaluated to determine what to push.
1563
1563
1564 For example, a value of ``.`` will push the working directory's
1564 For example, a value of ``.`` will push the working directory's
1565 revision by default.
1565 revision by default.
1566
1566
1567 Revsets specifying bookmarks will not result in the bookmark being
1567 Revsets specifying bookmarks will not result in the bookmark being
1568 pushed.
1568 pushed.
1569
1569
1570 The following special named paths exist:
1570 The following special named paths exist:
1571
1571
1572 ``default``
1572 ``default``
1573 The URL or directory to use when no source or remote is specified.
1573 The URL or directory to use when no source or remote is specified.
1574
1574
1575 :hg:`clone` will automatically define this path to the location the
1575 :hg:`clone` will automatically define this path to the location the
1576 repository was cloned from.
1576 repository was cloned from.
1577
1577
1578 ``default-push``
1578 ``default-push``
1579 (deprecated) The URL or directory for the default :hg:`push` location.
1579 (deprecated) The URL or directory for the default :hg:`push` location.
1580 ``default:pushurl`` should be used instead.
1580 ``default:pushurl`` should be used instead.
1581
1581
1582 ``phases``
1582 ``phases``
1583 ----------
1583 ----------
1584
1584
1585 Specifies default handling of phases. See :hg:`help phases` for more
1585 Specifies default handling of phases. See :hg:`help phases` for more
1586 information about working with phases.
1586 information about working with phases.
1587
1587
1588 ``publish``
1588 ``publish``
1589 Controls draft phase behavior when working as a server. When true,
1589 Controls draft phase behavior when working as a server. When true,
1590 pushed changesets are set to public in both client and server and
1590 pushed changesets are set to public in both client and server and
1591 pulled or cloned changesets are set to public in the client.
1591 pulled or cloned changesets are set to public in the client.
1592 (default: True)
1592 (default: True)
1593
1593
1594 ``new-commit``
1594 ``new-commit``
1595 Phase of newly-created commits.
1595 Phase of newly-created commits.
1596 (default: draft)
1596 (default: draft)
1597
1597
1598 ``checksubrepos``
1598 ``checksubrepos``
1599 Check the phase of the current revision of each subrepository. Allowed
1599 Check the phase of the current revision of each subrepository. Allowed
1600 values are "ignore", "follow" and "abort". For settings other than
1600 values are "ignore", "follow" and "abort". For settings other than
1601 "ignore", the phase of the current revision of each subrepository is
1601 "ignore", the phase of the current revision of each subrepository is
1602 checked before committing the parent repository. If any of those phases is
1602 checked before committing the parent repository. If any of those phases is
1603 greater than the phase of the parent repository (e.g. if a subrepo is in a
1603 greater than the phase of the parent repository (e.g. if a subrepo is in a
1604 "secret" phase while the parent repo is in "draft" phase), the commit is
1604 "secret" phase while the parent repo is in "draft" phase), the commit is
1605 either aborted (if checksubrepos is set to "abort") or the higher phase is
1605 either aborted (if checksubrepos is set to "abort") or the higher phase is
1606 used for the parent repository commit (if set to "follow").
1606 used for the parent repository commit (if set to "follow").
1607 (default: follow)
1607 (default: follow)
1608
1608
1609
1609
1610 ``profiling``
1610 ``profiling``
1611 -------------
1611 -------------
1612
1612
1613 Specifies profiling type, format, and file output. Two profilers are
1613 Specifies profiling type, format, and file output. Two profilers are
1614 supported: an instrumenting profiler (named ``ls``), and a sampling
1614 supported: an instrumenting profiler (named ``ls``), and a sampling
1615 profiler (named ``stat``).
1615 profiler (named ``stat``).
1616
1616
1617 In this section description, 'profiling data' stands for the raw data
1617 In this section description, 'profiling data' stands for the raw data
1618 collected during profiling, while 'profiling report' stands for a
1618 collected during profiling, while 'profiling report' stands for a
1619 statistical text report generated from the profiling data.
1619 statistical text report generated from the profiling data.
1620
1620
1621 ``enabled``
1621 ``enabled``
1622 Enable the profiler.
1622 Enable the profiler.
1623 (default: false)
1623 (default: false)
1624
1624
1625 This is equivalent to passing ``--profile`` on the command line.
1625 This is equivalent to passing ``--profile`` on the command line.
1626
1626
1627 ``type``
1627 ``type``
1628 The type of profiler to use.
1628 The type of profiler to use.
1629 (default: stat)
1629 (default: stat)
1630
1630
1631 ``ls``
1631 ``ls``
1632 Use Python's built-in instrumenting profiler. This profiler
1632 Use Python's built-in instrumenting profiler. This profiler
1633 works on all platforms, but each line number it reports is the
1633 works on all platforms, but each line number it reports is the
1634 first line of a function. This restriction makes it difficult to
1634 first line of a function. This restriction makes it difficult to
1635 identify the expensive parts of a non-trivial function.
1635 identify the expensive parts of a non-trivial function.
1636 ``stat``
1636 ``stat``
1637 Use a statistical profiler, statprof. This profiler is most
1637 Use a statistical profiler, statprof. This profiler is most
1638 useful for profiling commands that run for longer than about 0.1
1638 useful for profiling commands that run for longer than about 0.1
1639 seconds.
1639 seconds.
1640
1640
1641 ``format``
1641 ``format``
1642 Profiling format. Specific to the ``ls`` instrumenting profiler.
1642 Profiling format. Specific to the ``ls`` instrumenting profiler.
1643 (default: text)
1643 (default: text)
1644
1644
1645 ``text``
1645 ``text``
1646 Generate a profiling report. When saving to a file, it should be
1646 Generate a profiling report. When saving to a file, it should be
1647 noted that only the report is saved, and the profiling data is
1647 noted that only the report is saved, and the profiling data is
1648 not kept.
1648 not kept.
1649 ``kcachegrind``
1649 ``kcachegrind``
1650 Format profiling data for kcachegrind use: when saving to a
1650 Format profiling data for kcachegrind use: when saving to a
1651 file, the generated file can directly be loaded into
1651 file, the generated file can directly be loaded into
1652 kcachegrind.
1652 kcachegrind.
1653
1653
1654 ``statformat``
1654 ``statformat``
1655 Profiling format for the ``stat`` profiler.
1655 Profiling format for the ``stat`` profiler.
1656 (default: hotpath)
1656 (default: hotpath)
1657
1657
1658 ``hotpath``
1658 ``hotpath``
1659 Show a tree-based display containing the hot path of execution (where
1659 Show a tree-based display containing the hot path of execution (where
1660 most time was spent).
1660 most time was spent).
1661 ``bymethod``
1661 ``bymethod``
1662 Show a table of methods ordered by how frequently they are active.
1662 Show a table of methods ordered by how frequently they are active.
1663 ``byline``
1663 ``byline``
1664 Show a table of lines in files ordered by how frequently they are active.
1664 Show a table of lines in files ordered by how frequently they are active.
1665 ``json``
1665 ``json``
1666 Render profiling data as JSON.
1666 Render profiling data as JSON.
1667
1667
1668 ``frequency``
1668 ``frequency``
1669 Sampling frequency. Specific to the ``stat`` sampling profiler.
1669 Sampling frequency. Specific to the ``stat`` sampling profiler.
1670 (default: 1000)
1670 (default: 1000)
1671
1671
1672 ``output``
1672 ``output``
1673 File path where profiling data or report should be saved. If the
1673 File path where profiling data or report should be saved. If the
1674 file exists, it is replaced. (default: None, data is printed on
1674 file exists, it is replaced. (default: None, data is printed on
1675 stderr)
1675 stderr)
1676
1676
1677 ``sort``
1677 ``sort``
1678 Sort field. Specific to the ``ls`` instrumenting profiler.
1678 Sort field. Specific to the ``ls`` instrumenting profiler.
1679 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1679 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1680 ``inlinetime``.
1680 ``inlinetime``.
1681 (default: inlinetime)
1681 (default: inlinetime)
1682
1682
1683 ``time-track``
1683 ``time-track``
1684 Control if the stat profiler track ``cpu`` or ``real`` time.
1684 Control if the stat profiler track ``cpu`` or ``real`` time.
1685 (default: ``cpu``)
1685 (default: ``cpu``)
1686
1686
1687 ``limit``
1687 ``limit``
1688 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1688 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1689 (default: 30)
1689 (default: 30)
1690
1690
1691 ``nested``
1691 ``nested``
1692 Show at most this number of lines of drill-down info after each main entry.
1692 Show at most this number of lines of drill-down info after each main entry.
1693 This can help explain the difference between Total and Inline.
1693 This can help explain the difference between Total and Inline.
1694 Specific to the ``ls`` instrumenting profiler.
1694 Specific to the ``ls`` instrumenting profiler.
1695 (default: 0)
1695 (default: 0)
1696
1696
1697 ``showmin``
1697 ``showmin``
1698 Minimum fraction of samples an entry must have for it to be displayed.
1698 Minimum fraction of samples an entry must have for it to be displayed.
1699 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1699 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1700 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1700 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1701
1701
1702 Only used by the ``stat`` profiler.
1702 Only used by the ``stat`` profiler.
1703
1703
1704 For the ``hotpath`` format, default is ``0.05``.
1704 For the ``hotpath`` format, default is ``0.05``.
1705 For the ``chrome`` format, default is ``0.005``.
1705 For the ``chrome`` format, default is ``0.005``.
1706
1706
1707 The option is unused on other formats.
1707 The option is unused on other formats.
1708
1708
1709 ``showmax``
1709 ``showmax``
1710 Maximum fraction of samples an entry can have before it is ignored in
1710 Maximum fraction of samples an entry can have before it is ignored in
1711 display. Values format is the same as ``showmin``.
1711 display. Values format is the same as ``showmin``.
1712
1712
1713 Only used by the ``stat`` profiler.
1713 Only used by the ``stat`` profiler.
1714
1714
1715 For the ``chrome`` format, default is ``0.999``.
1715 For the ``chrome`` format, default is ``0.999``.
1716
1716
1717 The option is unused on other formats.
1717 The option is unused on other formats.
1718
1718
1719 ``progress``
1719 ``progress``
1720 ------------
1720 ------------
1721
1721
1722 Mercurial commands can draw progress bars that are as informative as
1722 Mercurial commands can draw progress bars that are as informative as
1723 possible. Some progress bars only offer indeterminate information, while others
1723 possible. Some progress bars only offer indeterminate information, while others
1724 have a definite end point.
1724 have a definite end point.
1725
1725
1726 ``delay``
1726 ``delay``
1727 Number of seconds (float) before showing the progress bar. (default: 3)
1727 Number of seconds (float) before showing the progress bar. (default: 3)
1728
1728
1729 ``changedelay``
1729 ``changedelay``
1730 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1730 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1731 that value will be used instead. (default: 1)
1731 that value will be used instead. (default: 1)
1732
1732
1733 ``estimateinterval``
1733 ``estimateinterval``
1734 Maximum sampling interval in seconds for speed and estimated time
1734 Maximum sampling interval in seconds for speed and estimated time
1735 calculation. (default: 60)
1735 calculation. (default: 60)
1736
1736
1737 ``refresh``
1737 ``refresh``
1738 Time in seconds between refreshes of the progress bar. (default: 0.1)
1738 Time in seconds between refreshes of the progress bar. (default: 0.1)
1739
1739
1740 ``format``
1740 ``format``
1741 Format of the progress bar.
1741 Format of the progress bar.
1742
1742
1743 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1743 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1744 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1744 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1745 last 20 characters of the item, but this can be changed by adding either
1745 last 20 characters of the item, but this can be changed by adding either
1746 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1746 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1747 first num characters.
1747 first num characters.
1748
1748
1749 (default: topic bar number estimate)
1749 (default: topic bar number estimate)
1750
1750
1751 ``width``
1751 ``width``
1752 If set, the maximum width of the progress information (that is, min(width,
1752 If set, the maximum width of the progress information (that is, min(width,
1753 term width) will be used).
1753 term width) will be used).
1754
1754
1755 ``clear-complete``
1755 ``clear-complete``
1756 Clear the progress bar after it's done. (default: True)
1756 Clear the progress bar after it's done. (default: True)
1757
1757
1758 ``disable``
1758 ``disable``
1759 If true, don't show a progress bar.
1759 If true, don't show a progress bar.
1760
1760
1761 ``assume-tty``
1761 ``assume-tty``
1762 If true, ALWAYS show a progress bar, unless disable is given.
1762 If true, ALWAYS show a progress bar, unless disable is given.
1763
1763
1764 ``rebase``
1764 ``rebase``
1765 ----------
1765 ----------
1766
1766
1767 ``evolution.allowdivergence``
1767 ``evolution.allowdivergence``
1768 Default to False, when True allow creating divergence when performing
1768 Default to False, when True allow creating divergence when performing
1769 rebase of obsolete changesets.
1769 rebase of obsolete changesets.
1770
1770
1771 ``revsetalias``
1771 ``revsetalias``
1772 ---------------
1772 ---------------
1773
1773
1774 Alias definitions for revsets. See :hg:`help revsets` for details.
1774 Alias definitions for revsets. See :hg:`help revsets` for details.
1775
1775
1776 ``revlog``
1777 ----------
1778
1779 Control the strategy Mercurial uses internally to store history. Options in this
1780 category impact performance and repository size.
1781
1782 ``optimize-delta-parent-choice``
1783 When storing a merge revision, both parents will be equally considered as
1784 a possible delta base. This results in better delta selection and improved
1785 revlog compression. This option is enabled by default.
1786
1787 Turning this option off can result in large increase of repository size for
1788 repository with many merges.
1789
1776 ``server``
1790 ``server``
1777 ----------
1791 ----------
1778
1792
1779 Controls generic server settings.
1793 Controls generic server settings.
1780
1794
1781 ``bookmarks-pushkey-compat``
1795 ``bookmarks-pushkey-compat``
1782 Trigger pushkey hook when being pushed bookmark updates. This config exist
1796 Trigger pushkey hook when being pushed bookmark updates. This config exist
1783 for compatibility purpose (default to True)
1797 for compatibility purpose (default to True)
1784
1798
1785 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
1799 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
1786 movement we recommend you migrate them to ``txnclose-bookmark`` and
1800 movement we recommend you migrate them to ``txnclose-bookmark`` and
1787 ``pretxnclose-bookmark``.
1801 ``pretxnclose-bookmark``.
1788
1802
1789 ``compressionengines``
1803 ``compressionengines``
1790 List of compression engines and their relative priority to advertise
1804 List of compression engines and their relative priority to advertise
1791 to clients.
1805 to clients.
1792
1806
1793 The order of compression engines determines their priority, the first
1807 The order of compression engines determines their priority, the first
1794 having the highest priority. If a compression engine is not listed
1808 having the highest priority. If a compression engine is not listed
1795 here, it won't be advertised to clients.
1809 here, it won't be advertised to clients.
1796
1810
1797 If not set (the default), built-in defaults are used. Run
1811 If not set (the default), built-in defaults are used. Run
1798 :hg:`debuginstall` to list available compression engines and their
1812 :hg:`debuginstall` to list available compression engines and their
1799 default wire protocol priority.
1813 default wire protocol priority.
1800
1814
1801 Older Mercurial clients only support zlib compression and this setting
1815 Older Mercurial clients only support zlib compression and this setting
1802 has no effect for legacy clients.
1816 has no effect for legacy clients.
1803
1817
1804 ``uncompressed``
1818 ``uncompressed``
1805 Whether to allow clients to clone a repository using the
1819 Whether to allow clients to clone a repository using the
1806 uncompressed streaming protocol. This transfers about 40% more
1820 uncompressed streaming protocol. This transfers about 40% more
1807 data than a regular clone, but uses less memory and CPU on both
1821 data than a regular clone, but uses less memory and CPU on both
1808 server and client. Over a LAN (100 Mbps or better) or a very fast
1822 server and client. Over a LAN (100 Mbps or better) or a very fast
1809 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1823 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1810 regular clone. Over most WAN connections (anything slower than
1824 regular clone. Over most WAN connections (anything slower than
1811 about 6 Mbps), uncompressed streaming is slower, because of the
1825 about 6 Mbps), uncompressed streaming is slower, because of the
1812 extra data transfer overhead. This mode will also temporarily hold
1826 extra data transfer overhead. This mode will also temporarily hold
1813 the write lock while determining what data to transfer.
1827 the write lock while determining what data to transfer.
1814 (default: True)
1828 (default: True)
1815
1829
1816 ``uncompressedallowsecret``
1830 ``uncompressedallowsecret``
1817 Whether to allow stream clones when the repository contains secret
1831 Whether to allow stream clones when the repository contains secret
1818 changesets. (default: False)
1832 changesets. (default: False)
1819
1833
1820 ``preferuncompressed``
1834 ``preferuncompressed``
1821 When set, clients will try to use the uncompressed streaming
1835 When set, clients will try to use the uncompressed streaming
1822 protocol. (default: False)
1836 protocol. (default: False)
1823
1837
1824 ``disablefullbundle``
1838 ``disablefullbundle``
1825 When set, servers will refuse attempts to do pull-based clones.
1839 When set, servers will refuse attempts to do pull-based clones.
1826 If this option is set, ``preferuncompressed`` and/or clone bundles
1840 If this option is set, ``preferuncompressed`` and/or clone bundles
1827 are highly recommended. Partial clones will still be allowed.
1841 are highly recommended. Partial clones will still be allowed.
1828 (default: False)
1842 (default: False)
1829
1843
1830 ``streamunbundle``
1844 ``streamunbundle``
1831 When set, servers will apply data sent from the client directly,
1845 When set, servers will apply data sent from the client directly,
1832 otherwise it will be written to a temporary file first. This option
1846 otherwise it will be written to a temporary file first. This option
1833 effectively prevents concurrent pushes.
1847 effectively prevents concurrent pushes.
1834
1848
1835 ``pullbundle``
1849 ``pullbundle``
1836 When set, the server will check pullbundle.manifest for bundles
1850 When set, the server will check pullbundle.manifest for bundles
1837 covering the requested heads and common nodes. The first matching
1851 covering the requested heads and common nodes. The first matching
1838 entry will be streamed to the client.
1852 entry will be streamed to the client.
1839
1853
1840 For HTTP transport, the stream will still use zlib compression
1854 For HTTP transport, the stream will still use zlib compression
1841 for older clients.
1855 for older clients.
1842
1856
1843 ``concurrent-push-mode``
1857 ``concurrent-push-mode``
1844 Level of allowed race condition between two pushing clients.
1858 Level of allowed race condition between two pushing clients.
1845
1859
1846 - 'strict': push is abort if another client touched the repository
1860 - 'strict': push is abort if another client touched the repository
1847 while the push was preparing. (default)
1861 while the push was preparing. (default)
1848 - 'check-related': push is only aborted if it affects head that got also
1862 - 'check-related': push is only aborted if it affects head that got also
1849 affected while the push was preparing.
1863 affected while the push was preparing.
1850
1864
1851 This requires compatible client (version 4.3 and later). Old client will
1865 This requires compatible client (version 4.3 and later). Old client will
1852 use 'strict'.
1866 use 'strict'.
1853
1867
1854 ``validate``
1868 ``validate``
1855 Whether to validate the completeness of pushed changesets by
1869 Whether to validate the completeness of pushed changesets by
1856 checking that all new file revisions specified in manifests are
1870 checking that all new file revisions specified in manifests are
1857 present. (default: False)
1871 present. (default: False)
1858
1872
1859 ``maxhttpheaderlen``
1873 ``maxhttpheaderlen``
1860 Instruct HTTP clients not to send request headers longer than this
1874 Instruct HTTP clients not to send request headers longer than this
1861 many bytes. (default: 1024)
1875 many bytes. (default: 1024)
1862
1876
1863 ``bundle1``
1877 ``bundle1``
1864 Whether to allow clients to push and pull using the legacy bundle1
1878 Whether to allow clients to push and pull using the legacy bundle1
1865 exchange format. (default: True)
1879 exchange format. (default: True)
1866
1880
1867 ``bundle1gd``
1881 ``bundle1gd``
1868 Like ``bundle1`` but only used if the repository is using the
1882 Like ``bundle1`` but only used if the repository is using the
1869 *generaldelta* storage format. (default: True)
1883 *generaldelta* storage format. (default: True)
1870
1884
1871 ``bundle1.push``
1885 ``bundle1.push``
1872 Whether to allow clients to push using the legacy bundle1 exchange
1886 Whether to allow clients to push using the legacy bundle1 exchange
1873 format. (default: True)
1887 format. (default: True)
1874
1888
1875 ``bundle1gd.push``
1889 ``bundle1gd.push``
1876 Like ``bundle1.push`` but only used if the repository is using the
1890 Like ``bundle1.push`` but only used if the repository is using the
1877 *generaldelta* storage format. (default: True)
1891 *generaldelta* storage format. (default: True)
1878
1892
1879 ``bundle1.pull``
1893 ``bundle1.pull``
1880 Whether to allow clients to pull using the legacy bundle1 exchange
1894 Whether to allow clients to pull using the legacy bundle1 exchange
1881 format. (default: True)
1895 format. (default: True)
1882
1896
1883 ``bundle1gd.pull``
1897 ``bundle1gd.pull``
1884 Like ``bundle1.pull`` but only used if the repository is using the
1898 Like ``bundle1.pull`` but only used if the repository is using the
1885 *generaldelta* storage format. (default: True)
1899 *generaldelta* storage format. (default: True)
1886
1900
1887 Large repositories using the *generaldelta* storage format should
1901 Large repositories using the *generaldelta* storage format should
1888 consider setting this option because converting *generaldelta*
1902 consider setting this option because converting *generaldelta*
1889 repositories to the exchange format required by the bundle1 data
1903 repositories to the exchange format required by the bundle1 data
1890 format can consume a lot of CPU.
1904 format can consume a lot of CPU.
1891
1905
1892 ``zliblevel``
1906 ``zliblevel``
1893 Integer between ``-1`` and ``9`` that controls the zlib compression level
1907 Integer between ``-1`` and ``9`` that controls the zlib compression level
1894 for wire protocol commands that send zlib compressed output (notably the
1908 for wire protocol commands that send zlib compressed output (notably the
1895 commands that send repository history data).
1909 commands that send repository history data).
1896
1910
1897 The default (``-1``) uses the default zlib compression level, which is
1911 The default (``-1``) uses the default zlib compression level, which is
1898 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1912 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1899 maximum compression.
1913 maximum compression.
1900
1914
1901 Setting this option allows server operators to make trade-offs between
1915 Setting this option allows server operators to make trade-offs between
1902 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1916 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1903 but sends more bytes to clients.
1917 but sends more bytes to clients.
1904
1918
1905 This option only impacts the HTTP server.
1919 This option only impacts the HTTP server.
1906
1920
1907 ``zstdlevel``
1921 ``zstdlevel``
1908 Integer between ``1`` and ``22`` that controls the zstd compression level
1922 Integer between ``1`` and ``22`` that controls the zstd compression level
1909 for wire protocol commands. ``1`` is the minimal amount of compression and
1923 for wire protocol commands. ``1`` is the minimal amount of compression and
1910 ``22`` is the highest amount of compression.
1924 ``22`` is the highest amount of compression.
1911
1925
1912 The default (``3``) should be significantly faster than zlib while likely
1926 The default (``3``) should be significantly faster than zlib while likely
1913 delivering better compression ratios.
1927 delivering better compression ratios.
1914
1928
1915 This option only impacts the HTTP server.
1929 This option only impacts the HTTP server.
1916
1930
1917 See also ``server.zliblevel``.
1931 See also ``server.zliblevel``.
1918
1932
1919 ``smtp``
1933 ``smtp``
1920 --------
1934 --------
1921
1935
1922 Configuration for extensions that need to send email messages.
1936 Configuration for extensions that need to send email messages.
1923
1937
1924 ``host``
1938 ``host``
1925 Host name of mail server, e.g. "mail.example.com".
1939 Host name of mail server, e.g. "mail.example.com".
1926
1940
1927 ``port``
1941 ``port``
1928 Optional. Port to connect to on mail server. (default: 465 if
1942 Optional. Port to connect to on mail server. (default: 465 if
1929 ``tls`` is smtps; 25 otherwise)
1943 ``tls`` is smtps; 25 otherwise)
1930
1944
1931 ``tls``
1945 ``tls``
1932 Optional. Method to enable TLS when connecting to mail server: starttls,
1946 Optional. Method to enable TLS when connecting to mail server: starttls,
1933 smtps or none. (default: none)
1947 smtps or none. (default: none)
1934
1948
1935 ``username``
1949 ``username``
1936 Optional. User name for authenticating with the SMTP server.
1950 Optional. User name for authenticating with the SMTP server.
1937 (default: None)
1951 (default: None)
1938
1952
1939 ``password``
1953 ``password``
1940 Optional. Password for authenticating with the SMTP server. If not
1954 Optional. Password for authenticating with the SMTP server. If not
1941 specified, interactive sessions will prompt the user for a
1955 specified, interactive sessions will prompt the user for a
1942 password; non-interactive sessions will fail. (default: None)
1956 password; non-interactive sessions will fail. (default: None)
1943
1957
1944 ``local_hostname``
1958 ``local_hostname``
1945 Optional. The hostname that the sender can use to identify
1959 Optional. The hostname that the sender can use to identify
1946 itself to the MTA.
1960 itself to the MTA.
1947
1961
1948
1962
1949 ``subpaths``
1963 ``subpaths``
1950 ------------
1964 ------------
1951
1965
1952 Subrepository source URLs can go stale if a remote server changes name
1966 Subrepository source URLs can go stale if a remote server changes name
1953 or becomes temporarily unavailable. This section lets you define
1967 or becomes temporarily unavailable. This section lets you define
1954 rewrite rules of the form::
1968 rewrite rules of the form::
1955
1969
1956 <pattern> = <replacement>
1970 <pattern> = <replacement>
1957
1971
1958 where ``pattern`` is a regular expression matching a subrepository
1972 where ``pattern`` is a regular expression matching a subrepository
1959 source URL and ``replacement`` is the replacement string used to
1973 source URL and ``replacement`` is the replacement string used to
1960 rewrite it. Groups can be matched in ``pattern`` and referenced in
1974 rewrite it. Groups can be matched in ``pattern`` and referenced in
1961 ``replacements``. For instance::
1975 ``replacements``. For instance::
1962
1976
1963 http://server/(.*)-hg/ = http://hg.server/\1/
1977 http://server/(.*)-hg/ = http://hg.server/\1/
1964
1978
1965 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1979 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1966
1980
1967 Relative subrepository paths are first made absolute, and the
1981 Relative subrepository paths are first made absolute, and the
1968 rewrite rules are then applied on the full (absolute) path. If ``pattern``
1982 rewrite rules are then applied on the full (absolute) path. If ``pattern``
1969 doesn't match the full path, an attempt is made to apply it on the
1983 doesn't match the full path, an attempt is made to apply it on the
1970 relative path alone. The rules are applied in definition order.
1984 relative path alone. The rules are applied in definition order.
1971
1985
1972 ``subrepos``
1986 ``subrepos``
1973 ------------
1987 ------------
1974
1988
1975 This section contains options that control the behavior of the
1989 This section contains options that control the behavior of the
1976 subrepositories feature. See also :hg:`help subrepos`.
1990 subrepositories feature. See also :hg:`help subrepos`.
1977
1991
1978 Security note: auditing in Mercurial is known to be insufficient to
1992 Security note: auditing in Mercurial is known to be insufficient to
1979 prevent clone-time code execution with carefully constructed Git
1993 prevent clone-time code execution with carefully constructed Git
1980 subrepos. It is unknown if a similar detect is present in Subversion
1994 subrepos. It is unknown if a similar detect is present in Subversion
1981 subrepos. Both Git and Subversion subrepos are disabled by default
1995 subrepos. Both Git and Subversion subrepos are disabled by default
1982 out of security concerns. These subrepo types can be enabled using
1996 out of security concerns. These subrepo types can be enabled using
1983 the respective options below.
1997 the respective options below.
1984
1998
1985 ``allowed``
1999 ``allowed``
1986 Whether subrepositories are allowed in the working directory.
2000 Whether subrepositories are allowed in the working directory.
1987
2001
1988 When false, commands involving subrepositories (like :hg:`update`)
2002 When false, commands involving subrepositories (like :hg:`update`)
1989 will fail for all subrepository types.
2003 will fail for all subrepository types.
1990 (default: true)
2004 (default: true)
1991
2005
1992 ``hg:allowed``
2006 ``hg:allowed``
1993 Whether Mercurial subrepositories are allowed in the working
2007 Whether Mercurial subrepositories are allowed in the working
1994 directory. This option only has an effect if ``subrepos.allowed``
2008 directory. This option only has an effect if ``subrepos.allowed``
1995 is true.
2009 is true.
1996 (default: true)
2010 (default: true)
1997
2011
1998 ``git:allowed``
2012 ``git:allowed``
1999 Whether Git subrepositories are allowed in the working directory.
2013 Whether Git subrepositories are allowed in the working directory.
2000 This option only has an effect if ``subrepos.allowed`` is true.
2014 This option only has an effect if ``subrepos.allowed`` is true.
2001
2015
2002 See the security note above before enabling Git subrepos.
2016 See the security note above before enabling Git subrepos.
2003 (default: false)
2017 (default: false)
2004
2018
2005 ``svn:allowed``
2019 ``svn:allowed``
2006 Whether Subversion subrepositories are allowed in the working
2020 Whether Subversion subrepositories are allowed in the working
2007 directory. This option only has an effect if ``subrepos.allowed``
2021 directory. This option only has an effect if ``subrepos.allowed``
2008 is true.
2022 is true.
2009
2023
2010 See the security note above before enabling Subversion subrepos.
2024 See the security note above before enabling Subversion subrepos.
2011 (default: false)
2025 (default: false)
2012
2026
2013 ``templatealias``
2027 ``templatealias``
2014 -----------------
2028 -----------------
2015
2029
2016 Alias definitions for templates. See :hg:`help templates` for details.
2030 Alias definitions for templates. See :hg:`help templates` for details.
2017
2031
2018 ``templates``
2032 ``templates``
2019 -------------
2033 -------------
2020
2034
2021 Use the ``[templates]`` section to define template strings.
2035 Use the ``[templates]`` section to define template strings.
2022 See :hg:`help templates` for details.
2036 See :hg:`help templates` for details.
2023
2037
2024 ``trusted``
2038 ``trusted``
2025 -----------
2039 -----------
2026
2040
2027 Mercurial will not use the settings in the
2041 Mercurial will not use the settings in the
2028 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2042 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2029 user or to a trusted group, as various hgrc features allow arbitrary
2043 user or to a trusted group, as various hgrc features allow arbitrary
2030 commands to be run. This issue is often encountered when configuring
2044 commands to be run. This issue is often encountered when configuring
2031 hooks or extensions for shared repositories or servers. However,
2045 hooks or extensions for shared repositories or servers. However,
2032 the web interface will use some safe settings from the ``[web]``
2046 the web interface will use some safe settings from the ``[web]``
2033 section.
2047 section.
2034
2048
2035 This section specifies what users and groups are trusted. The
2049 This section specifies what users and groups are trusted. The
2036 current user is always trusted. To trust everybody, list a user or a
2050 current user is always trusted. To trust everybody, list a user or a
2037 group with name ``*``. These settings must be placed in an
2051 group with name ``*``. These settings must be placed in an
2038 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2052 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2039 user or service running Mercurial.
2053 user or service running Mercurial.
2040
2054
2041 ``users``
2055 ``users``
2042 Comma-separated list of trusted users.
2056 Comma-separated list of trusted users.
2043
2057
2044 ``groups``
2058 ``groups``
2045 Comma-separated list of trusted groups.
2059 Comma-separated list of trusted groups.
2046
2060
2047
2061
2048 ``ui``
2062 ``ui``
2049 ------
2063 ------
2050
2064
2051 User interface controls.
2065 User interface controls.
2052
2066
2053 ``archivemeta``
2067 ``archivemeta``
2054 Whether to include the .hg_archival.txt file containing meta data
2068 Whether to include the .hg_archival.txt file containing meta data
2055 (hashes for the repository base and for tip) in archives created
2069 (hashes for the repository base and for tip) in archives created
2056 by the :hg:`archive` command or downloaded via hgweb.
2070 by the :hg:`archive` command or downloaded via hgweb.
2057 (default: True)
2071 (default: True)
2058
2072
2059 ``askusername``
2073 ``askusername``
2060 Whether to prompt for a username when committing. If True, and
2074 Whether to prompt for a username when committing. If True, and
2061 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2075 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2062 be prompted to enter a username. If no username is entered, the
2076 be prompted to enter a username. If no username is entered, the
2063 default ``USER@HOST`` is used instead.
2077 default ``USER@HOST`` is used instead.
2064 (default: False)
2078 (default: False)
2065
2079
2066 ``clonebundles``
2080 ``clonebundles``
2067 Whether the "clone bundles" feature is enabled.
2081 Whether the "clone bundles" feature is enabled.
2068
2082
2069 When enabled, :hg:`clone` may download and apply a server-advertised
2083 When enabled, :hg:`clone` may download and apply a server-advertised
2070 bundle file from a URL instead of using the normal exchange mechanism.
2084 bundle file from a URL instead of using the normal exchange mechanism.
2071
2085
2072 This can likely result in faster and more reliable clones.
2086 This can likely result in faster and more reliable clones.
2073
2087
2074 (default: True)
2088 (default: True)
2075
2089
2076 ``clonebundlefallback``
2090 ``clonebundlefallback``
2077 Whether failure to apply an advertised "clone bundle" from a server
2091 Whether failure to apply an advertised "clone bundle" from a server
2078 should result in fallback to a regular clone.
2092 should result in fallback to a regular clone.
2079
2093
2080 This is disabled by default because servers advertising "clone
2094 This is disabled by default because servers advertising "clone
2081 bundles" often do so to reduce server load. If advertised bundles
2095 bundles" often do so to reduce server load. If advertised bundles
2082 start mass failing and clients automatically fall back to a regular
2096 start mass failing and clients automatically fall back to a regular
2083 clone, this would add significant and unexpected load to the server
2097 clone, this would add significant and unexpected load to the server
2084 since the server is expecting clone operations to be offloaded to
2098 since the server is expecting clone operations to be offloaded to
2085 pre-generated bundles. Failing fast (the default behavior) ensures
2099 pre-generated bundles. Failing fast (the default behavior) ensures
2086 clients don't overwhelm the server when "clone bundle" application
2100 clients don't overwhelm the server when "clone bundle" application
2087 fails.
2101 fails.
2088
2102
2089 (default: False)
2103 (default: False)
2090
2104
2091 ``clonebundleprefers``
2105 ``clonebundleprefers``
2092 Defines preferences for which "clone bundles" to use.
2106 Defines preferences for which "clone bundles" to use.
2093
2107
2094 Servers advertising "clone bundles" may advertise multiple available
2108 Servers advertising "clone bundles" may advertise multiple available
2095 bundles. Each bundle may have different attributes, such as the bundle
2109 bundles. Each bundle may have different attributes, such as the bundle
2096 type and compression format. This option is used to prefer a particular
2110 type and compression format. This option is used to prefer a particular
2097 bundle over another.
2111 bundle over another.
2098
2112
2099 The following keys are defined by Mercurial:
2113 The following keys are defined by Mercurial:
2100
2114
2101 BUNDLESPEC
2115 BUNDLESPEC
2102 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2116 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2103 e.g. ``gzip-v2`` or ``bzip2-v1``.
2117 e.g. ``gzip-v2`` or ``bzip2-v1``.
2104
2118
2105 COMPRESSION
2119 COMPRESSION
2106 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2120 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2107
2121
2108 Server operators may define custom keys.
2122 Server operators may define custom keys.
2109
2123
2110 Example values: ``COMPRESSION=bzip2``,
2124 Example values: ``COMPRESSION=bzip2``,
2111 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2125 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2112
2126
2113 By default, the first bundle advertised by the server is used.
2127 By default, the first bundle advertised by the server is used.
2114
2128
2115 ``color``
2129 ``color``
2116 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2130 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2117 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2131 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2118 seems possible. See :hg:`help color` for details.
2132 seems possible. See :hg:`help color` for details.
2119
2133
2120 ``commitsubrepos``
2134 ``commitsubrepos``
2121 Whether to commit modified subrepositories when committing the
2135 Whether to commit modified subrepositories when committing the
2122 parent repository. If False and one subrepository has uncommitted
2136 parent repository. If False and one subrepository has uncommitted
2123 changes, abort the commit.
2137 changes, abort the commit.
2124 (default: False)
2138 (default: False)
2125
2139
2126 ``debug``
2140 ``debug``
2127 Print debugging information. (default: False)
2141 Print debugging information. (default: False)
2128
2142
2129 ``editor``
2143 ``editor``
2130 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2144 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2131
2145
2132 ``fallbackencoding``
2146 ``fallbackencoding``
2133 Encoding to try if it's not possible to decode the changelog using
2147 Encoding to try if it's not possible to decode the changelog using
2134 UTF-8. (default: ISO-8859-1)
2148 UTF-8. (default: ISO-8859-1)
2135
2149
2136 ``graphnodetemplate``
2150 ``graphnodetemplate``
2137 The template used to print changeset nodes in an ASCII revision graph.
2151 The template used to print changeset nodes in an ASCII revision graph.
2138 (default: ``{graphnode}``)
2152 (default: ``{graphnode}``)
2139
2153
2140 ``ignore``
2154 ``ignore``
2141 A file to read per-user ignore patterns from. This file should be
2155 A file to read per-user ignore patterns from. This file should be
2142 in the same format as a repository-wide .hgignore file. Filenames
2156 in the same format as a repository-wide .hgignore file. Filenames
2143 are relative to the repository root. This option supports hook syntax,
2157 are relative to the repository root. This option supports hook syntax,
2144 so if you want to specify multiple ignore files, you can do so by
2158 so if you want to specify multiple ignore files, you can do so by
2145 setting something like ``ignore.other = ~/.hgignore2``. For details
2159 setting something like ``ignore.other = ~/.hgignore2``. For details
2146 of the ignore file format, see the ``hgignore(5)`` man page.
2160 of the ignore file format, see the ``hgignore(5)`` man page.
2147
2161
2148 ``interactive``
2162 ``interactive``
2149 Allow to prompt the user. (default: True)
2163 Allow to prompt the user. (default: True)
2150
2164
2151 ``interface``
2165 ``interface``
2152 Select the default interface for interactive features (default: text).
2166 Select the default interface for interactive features (default: text).
2153 Possible values are 'text' and 'curses'.
2167 Possible values are 'text' and 'curses'.
2154
2168
2155 ``interface.chunkselector``
2169 ``interface.chunkselector``
2156 Select the interface for change recording (e.g. :hg:`commit -i`).
2170 Select the interface for change recording (e.g. :hg:`commit -i`).
2157 Possible values are 'text' and 'curses'.
2171 Possible values are 'text' and 'curses'.
2158 This config overrides the interface specified by ui.interface.
2172 This config overrides the interface specified by ui.interface.
2159
2173
2160 ``large-file-limit``
2174 ``large-file-limit``
2161 Largest file size that gives no memory use warning.
2175 Largest file size that gives no memory use warning.
2162 Possible values are integers or 0 to disable the check.
2176 Possible values are integers or 0 to disable the check.
2163 (default: 10000000)
2177 (default: 10000000)
2164
2178
2165 ``logtemplate``
2179 ``logtemplate``
2166 Template string for commands that print changesets.
2180 Template string for commands that print changesets.
2167
2181
2168 ``merge``
2182 ``merge``
2169 The conflict resolution program to use during a manual merge.
2183 The conflict resolution program to use during a manual merge.
2170 For more information on merge tools see :hg:`help merge-tools`.
2184 For more information on merge tools see :hg:`help merge-tools`.
2171 For configuring merge tools see the ``[merge-tools]`` section.
2185 For configuring merge tools see the ``[merge-tools]`` section.
2172
2186
2173 ``mergemarkers``
2187 ``mergemarkers``
2174 Sets the merge conflict marker label styling. The ``detailed``
2188 Sets the merge conflict marker label styling. The ``detailed``
2175 style uses the ``mergemarkertemplate`` setting to style the labels.
2189 style uses the ``mergemarkertemplate`` setting to style the labels.
2176 The ``basic`` style just uses 'local' and 'other' as the marker label.
2190 The ``basic`` style just uses 'local' and 'other' as the marker label.
2177 One of ``basic`` or ``detailed``.
2191 One of ``basic`` or ``detailed``.
2178 (default: ``basic``)
2192 (default: ``basic``)
2179
2193
2180 ``mergemarkertemplate``
2194 ``mergemarkertemplate``
2181 The template used to print the commit description next to each conflict
2195 The template used to print the commit description next to each conflict
2182 marker during merge conflicts. See :hg:`help templates` for the template
2196 marker during merge conflicts. See :hg:`help templates` for the template
2183 format.
2197 format.
2184
2198
2185 Defaults to showing the hash, tags, branches, bookmarks, author, and
2199 Defaults to showing the hash, tags, branches, bookmarks, author, and
2186 the first line of the commit description.
2200 the first line of the commit description.
2187
2201
2188 If you use non-ASCII characters in names for tags, branches, bookmarks,
2202 If you use non-ASCII characters in names for tags, branches, bookmarks,
2189 authors, and/or commit descriptions, you must pay attention to encodings of
2203 authors, and/or commit descriptions, you must pay attention to encodings of
2190 managed files. At template expansion, non-ASCII characters use the encoding
2204 managed files. At template expansion, non-ASCII characters use the encoding
2191 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2205 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2192 environment variables that govern your locale. If the encoding of the merge
2206 environment variables that govern your locale. If the encoding of the merge
2193 markers is different from the encoding of the merged files,
2207 markers is different from the encoding of the merged files,
2194 serious problems may occur.
2208 serious problems may occur.
2195
2209
2196 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2210 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2197
2211
2198 ``origbackuppath``
2212 ``origbackuppath``
2199 The path to a directory used to store generated .orig files. If the path is
2213 The path to a directory used to store generated .orig files. If the path is
2200 not a directory, one will be created. If set, files stored in this
2214 not a directory, one will be created. If set, files stored in this
2201 directory have the same name as the original file and do not have a .orig
2215 directory have the same name as the original file and do not have a .orig
2202 suffix.
2216 suffix.
2203
2217
2204 ``paginate``
2218 ``paginate``
2205 Control the pagination of command output (default: True). See :hg:`help pager`
2219 Control the pagination of command output (default: True). See :hg:`help pager`
2206 for details.
2220 for details.
2207
2221
2208 ``patch``
2222 ``patch``
2209 An optional external tool that ``hg import`` and some extensions
2223 An optional external tool that ``hg import`` and some extensions
2210 will use for applying patches. By default Mercurial uses an
2224 will use for applying patches. By default Mercurial uses an
2211 internal patch utility. The external tool must work as the common
2225 internal patch utility. The external tool must work as the common
2212 Unix ``patch`` program. In particular, it must accept a ``-p``
2226 Unix ``patch`` program. In particular, it must accept a ``-p``
2213 argument to strip patch headers, a ``-d`` argument to specify the
2227 argument to strip patch headers, a ``-d`` argument to specify the
2214 current directory, a file name to patch, and a patch file to take
2228 current directory, a file name to patch, and a patch file to take
2215 from stdin.
2229 from stdin.
2216
2230
2217 It is possible to specify a patch tool together with extra
2231 It is possible to specify a patch tool together with extra
2218 arguments. For example, setting this option to ``patch --merge``
2232 arguments. For example, setting this option to ``patch --merge``
2219 will use the ``patch`` program with its 2-way merge option.
2233 will use the ``patch`` program with its 2-way merge option.
2220
2234
2221 ``portablefilenames``
2235 ``portablefilenames``
2222 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2236 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2223 (default: ``warn``)
2237 (default: ``warn``)
2224
2238
2225 ``warn``
2239 ``warn``
2226 Print a warning message on POSIX platforms, if a file with a non-portable
2240 Print a warning message on POSIX platforms, if a file with a non-portable
2227 filename is added (e.g. a file with a name that can't be created on
2241 filename is added (e.g. a file with a name that can't be created on
2228 Windows because it contains reserved parts like ``AUX``, reserved
2242 Windows because it contains reserved parts like ``AUX``, reserved
2229 characters like ``:``, or would cause a case collision with an existing
2243 characters like ``:``, or would cause a case collision with an existing
2230 file).
2244 file).
2231
2245
2232 ``ignore``
2246 ``ignore``
2233 Don't print a warning.
2247 Don't print a warning.
2234
2248
2235 ``abort``
2249 ``abort``
2236 The command is aborted.
2250 The command is aborted.
2237
2251
2238 ``true``
2252 ``true``
2239 Alias for ``warn``.
2253 Alias for ``warn``.
2240
2254
2241 ``false``
2255 ``false``
2242 Alias for ``ignore``.
2256 Alias for ``ignore``.
2243
2257
2244 .. container:: windows
2258 .. container:: windows
2245
2259
2246 On Windows, this configuration option is ignored and the command aborted.
2260 On Windows, this configuration option is ignored and the command aborted.
2247
2261
2248 ``quiet``
2262 ``quiet``
2249 Reduce the amount of output printed.
2263 Reduce the amount of output printed.
2250 (default: False)
2264 (default: False)
2251
2265
2252 ``remotecmd``
2266 ``remotecmd``
2253 Remote command to use for clone/push/pull operations.
2267 Remote command to use for clone/push/pull operations.
2254 (default: ``hg``)
2268 (default: ``hg``)
2255
2269
2256 ``report_untrusted``
2270 ``report_untrusted``
2257 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2271 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2258 trusted user or group.
2272 trusted user or group.
2259 (default: True)
2273 (default: True)
2260
2274
2261 ``slash``
2275 ``slash``
2262 (Deprecated. Use ``slashpath`` template filter instead.)
2276 (Deprecated. Use ``slashpath`` template filter instead.)
2263
2277
2264 Display paths using a slash (``/``) as the path separator. This
2278 Display paths using a slash (``/``) as the path separator. This
2265 only makes a difference on systems where the default path
2279 only makes a difference on systems where the default path
2266 separator is not the slash character (e.g. Windows uses the
2280 separator is not the slash character (e.g. Windows uses the
2267 backslash character (``\``)).
2281 backslash character (``\``)).
2268 (default: False)
2282 (default: False)
2269
2283
2270 ``statuscopies``
2284 ``statuscopies``
2271 Display copies in the status command.
2285 Display copies in the status command.
2272
2286
2273 ``ssh``
2287 ``ssh``
2274 Command to use for SSH connections. (default: ``ssh``)
2288 Command to use for SSH connections. (default: ``ssh``)
2275
2289
2276 ``ssherrorhint``
2290 ``ssherrorhint``
2277 A hint shown to the user in the case of SSH error (e.g.
2291 A hint shown to the user in the case of SSH error (e.g.
2278 ``Please see http://company/internalwiki/ssh.html``)
2292 ``Please see http://company/internalwiki/ssh.html``)
2279
2293
2280 ``strict``
2294 ``strict``
2281 Require exact command names, instead of allowing unambiguous
2295 Require exact command names, instead of allowing unambiguous
2282 abbreviations. (default: False)
2296 abbreviations. (default: False)
2283
2297
2284 ``style``
2298 ``style``
2285 Name of style to use for command output.
2299 Name of style to use for command output.
2286
2300
2287 ``supportcontact``
2301 ``supportcontact``
2288 A URL where users should report a Mercurial traceback. Use this if you are a
2302 A URL where users should report a Mercurial traceback. Use this if you are a
2289 large organisation with its own Mercurial deployment process and crash
2303 large organisation with its own Mercurial deployment process and crash
2290 reports should be addressed to your internal support.
2304 reports should be addressed to your internal support.
2291
2305
2292 ``textwidth``
2306 ``textwidth``
2293 Maximum width of help text. A longer line generated by ``hg help`` or
2307 Maximum width of help text. A longer line generated by ``hg help`` or
2294 ``hg subcommand --help`` will be broken after white space to get this
2308 ``hg subcommand --help`` will be broken after white space to get this
2295 width or the terminal width, whichever comes first.
2309 width or the terminal width, whichever comes first.
2296 A non-positive value will disable this and the terminal width will be
2310 A non-positive value will disable this and the terminal width will be
2297 used. (default: 78)
2311 used. (default: 78)
2298
2312
2299 ``timeout``
2313 ``timeout``
2300 The timeout used when a lock is held (in seconds), a negative value
2314 The timeout used when a lock is held (in seconds), a negative value
2301 means no timeout. (default: 600)
2315 means no timeout. (default: 600)
2302
2316
2303 ``timeout.warn``
2317 ``timeout.warn``
2304 Time (in seconds) before a warning is printed about held lock. A negative
2318 Time (in seconds) before a warning is printed about held lock. A negative
2305 value means no warning. (default: 0)
2319 value means no warning. (default: 0)
2306
2320
2307 ``traceback``
2321 ``traceback``
2308 Mercurial always prints a traceback when an unknown exception
2322 Mercurial always prints a traceback when an unknown exception
2309 occurs. Setting this to True will make Mercurial print a traceback
2323 occurs. Setting this to True will make Mercurial print a traceback
2310 on all exceptions, even those recognized by Mercurial (such as
2324 on all exceptions, even those recognized by Mercurial (such as
2311 IOError or MemoryError). (default: False)
2325 IOError or MemoryError). (default: False)
2312
2326
2313 ``tweakdefaults``
2327 ``tweakdefaults``
2314
2328
2315 By default Mercurial's behavior changes very little from release
2329 By default Mercurial's behavior changes very little from release
2316 to release, but over time the recommended config settings
2330 to release, but over time the recommended config settings
2317 shift. Enable this config to opt in to get automatic tweaks to
2331 shift. Enable this config to opt in to get automatic tweaks to
2318 Mercurial's behavior over time. This config setting will have no
2332 Mercurial's behavior over time. This config setting will have no
2319 effet if ``HGPLAIN` is set or ``HGPLAINEXCEPT`` is set and does
2333 effet if ``HGPLAIN` is set or ``HGPLAINEXCEPT`` is set and does
2320 not include ``tweakdefaults``. (default: False)
2334 not include ``tweakdefaults``. (default: False)
2321
2335
2322 ``username``
2336 ``username``
2323 The committer of a changeset created when running "commit".
2337 The committer of a changeset created when running "commit".
2324 Typically a person's name and email address, e.g. ``Fred Widget
2338 Typically a person's name and email address, e.g. ``Fred Widget
2325 <fred@example.com>``. Environment variables in the
2339 <fred@example.com>``. Environment variables in the
2326 username are expanded.
2340 username are expanded.
2327
2341
2328 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2342 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2329 hgrc is empty, e.g. if the system admin set ``username =`` in the
2343 hgrc is empty, e.g. if the system admin set ``username =`` in the
2330 system hgrc, it has to be specified manually or in a different
2344 system hgrc, it has to be specified manually or in a different
2331 hgrc file)
2345 hgrc file)
2332
2346
2333 ``verbose``
2347 ``verbose``
2334 Increase the amount of output printed. (default: False)
2348 Increase the amount of output printed. (default: False)
2335
2349
2336
2350
2337 ``web``
2351 ``web``
2338 -------
2352 -------
2339
2353
2340 Web interface configuration. The settings in this section apply to
2354 Web interface configuration. The settings in this section apply to
2341 both the builtin webserver (started by :hg:`serve`) and the script you
2355 both the builtin webserver (started by :hg:`serve`) and the script you
2342 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2356 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2343 and WSGI).
2357 and WSGI).
2344
2358
2345 The Mercurial webserver does no authentication (it does not prompt for
2359 The Mercurial webserver does no authentication (it does not prompt for
2346 usernames and passwords to validate *who* users are), but it does do
2360 usernames and passwords to validate *who* users are), but it does do
2347 authorization (it grants or denies access for *authenticated users*
2361 authorization (it grants or denies access for *authenticated users*
2348 based on settings in this section). You must either configure your
2362 based on settings in this section). You must either configure your
2349 webserver to do authentication for you, or disable the authorization
2363 webserver to do authentication for you, or disable the authorization
2350 checks.
2364 checks.
2351
2365
2352 For a quick setup in a trusted environment, e.g., a private LAN, where
2366 For a quick setup in a trusted environment, e.g., a private LAN, where
2353 you want it to accept pushes from anybody, you can use the following
2367 you want it to accept pushes from anybody, you can use the following
2354 command line::
2368 command line::
2355
2369
2356 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2370 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2357
2371
2358 Note that this will allow anybody to push anything to the server and
2372 Note that this will allow anybody to push anything to the server and
2359 that this should not be used for public servers.
2373 that this should not be used for public servers.
2360
2374
2361 The full set of options is:
2375 The full set of options is:
2362
2376
2363 ``accesslog``
2377 ``accesslog``
2364 Where to output the access log. (default: stdout)
2378 Where to output the access log. (default: stdout)
2365
2379
2366 ``address``
2380 ``address``
2367 Interface address to bind to. (default: all)
2381 Interface address to bind to. (default: all)
2368
2382
2369 ``allow-archive``
2383 ``allow-archive``
2370 List of archive format (bz2, gz, zip) allowed for downloading.
2384 List of archive format (bz2, gz, zip) allowed for downloading.
2371 (default: empty)
2385 (default: empty)
2372
2386
2373 ``allowbz2``
2387 ``allowbz2``
2374 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2388 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2375 revisions.
2389 revisions.
2376 (default: False)
2390 (default: False)
2377
2391
2378 ``allowgz``
2392 ``allowgz``
2379 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2393 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2380 revisions.
2394 revisions.
2381 (default: False)
2395 (default: False)
2382
2396
2383 ``allow-pull``
2397 ``allow-pull``
2384 Whether to allow pulling from the repository. (default: True)
2398 Whether to allow pulling from the repository. (default: True)
2385
2399
2386 ``allow-push``
2400 ``allow-push``
2387 Whether to allow pushing to the repository. If empty or not set,
2401 Whether to allow pushing to the repository. If empty or not set,
2388 pushing is not allowed. If the special value ``*``, any remote
2402 pushing is not allowed. If the special value ``*``, any remote
2389 user can push, including unauthenticated users. Otherwise, the
2403 user can push, including unauthenticated users. Otherwise, the
2390 remote user must have been authenticated, and the authenticated
2404 remote user must have been authenticated, and the authenticated
2391 user name must be present in this list. The contents of the
2405 user name must be present in this list. The contents of the
2392 allow-push list are examined after the deny_push list.
2406 allow-push list are examined after the deny_push list.
2393
2407
2394 ``allow_read``
2408 ``allow_read``
2395 If the user has not already been denied repository access due to
2409 If the user has not already been denied repository access due to
2396 the contents of deny_read, this list determines whether to grant
2410 the contents of deny_read, this list determines whether to grant
2397 repository access to the user. If this list is not empty, and the
2411 repository access to the user. If this list is not empty, and the
2398 user is unauthenticated or not present in the list, then access is
2412 user is unauthenticated or not present in the list, then access is
2399 denied for the user. If the list is empty or not set, then access
2413 denied for the user. If the list is empty or not set, then access
2400 is permitted to all users by default. Setting allow_read to the
2414 is permitted to all users by default. Setting allow_read to the
2401 special value ``*`` is equivalent to it not being set (i.e. access
2415 special value ``*`` is equivalent to it not being set (i.e. access
2402 is permitted to all users). The contents of the allow_read list are
2416 is permitted to all users). The contents of the allow_read list are
2403 examined after the deny_read list.
2417 examined after the deny_read list.
2404
2418
2405 ``allowzip``
2419 ``allowzip``
2406 (DEPRECATED) Whether to allow .zip downloading of repository
2420 (DEPRECATED) Whether to allow .zip downloading of repository
2407 revisions. This feature creates temporary files.
2421 revisions. This feature creates temporary files.
2408 (default: False)
2422 (default: False)
2409
2423
2410 ``archivesubrepos``
2424 ``archivesubrepos``
2411 Whether to recurse into subrepositories when archiving.
2425 Whether to recurse into subrepositories when archiving.
2412 (default: False)
2426 (default: False)
2413
2427
2414 ``baseurl``
2428 ``baseurl``
2415 Base URL to use when publishing URLs in other locations, so
2429 Base URL to use when publishing URLs in other locations, so
2416 third-party tools like email notification hooks can construct
2430 third-party tools like email notification hooks can construct
2417 URLs. Example: ``http://hgserver/repos/``.
2431 URLs. Example: ``http://hgserver/repos/``.
2418
2432
2419 ``cacerts``
2433 ``cacerts``
2420 Path to file containing a list of PEM encoded certificate
2434 Path to file containing a list of PEM encoded certificate
2421 authority certificates. Environment variables and ``~user``
2435 authority certificates. Environment variables and ``~user``
2422 constructs are expanded in the filename. If specified on the
2436 constructs are expanded in the filename. If specified on the
2423 client, then it will verify the identity of remote HTTPS servers
2437 client, then it will verify the identity of remote HTTPS servers
2424 with these certificates.
2438 with these certificates.
2425
2439
2426 To disable SSL verification temporarily, specify ``--insecure`` from
2440 To disable SSL verification temporarily, specify ``--insecure`` from
2427 command line.
2441 command line.
2428
2442
2429 You can use OpenSSL's CA certificate file if your platform has
2443 You can use OpenSSL's CA certificate file if your platform has
2430 one. On most Linux systems this will be
2444 one. On most Linux systems this will be
2431 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2445 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2432 generate this file manually. The form must be as follows::
2446 generate this file manually. The form must be as follows::
2433
2447
2434 -----BEGIN CERTIFICATE-----
2448 -----BEGIN CERTIFICATE-----
2435 ... (certificate in base64 PEM encoding) ...
2449 ... (certificate in base64 PEM encoding) ...
2436 -----END CERTIFICATE-----
2450 -----END CERTIFICATE-----
2437 -----BEGIN CERTIFICATE-----
2451 -----BEGIN CERTIFICATE-----
2438 ... (certificate in base64 PEM encoding) ...
2452 ... (certificate in base64 PEM encoding) ...
2439 -----END CERTIFICATE-----
2453 -----END CERTIFICATE-----
2440
2454
2441 ``cache``
2455 ``cache``
2442 Whether to support caching in hgweb. (default: True)
2456 Whether to support caching in hgweb. (default: True)
2443
2457
2444 ``certificate``
2458 ``certificate``
2445 Certificate to use when running :hg:`serve`.
2459 Certificate to use when running :hg:`serve`.
2446
2460
2447 ``collapse``
2461 ``collapse``
2448 With ``descend`` enabled, repositories in subdirectories are shown at
2462 With ``descend`` enabled, repositories in subdirectories are shown at
2449 a single level alongside repositories in the current path. With
2463 a single level alongside repositories in the current path. With
2450 ``collapse`` also enabled, repositories residing at a deeper level than
2464 ``collapse`` also enabled, repositories residing at a deeper level than
2451 the current path are grouped behind navigable directory entries that
2465 the current path are grouped behind navigable directory entries that
2452 lead to the locations of these repositories. In effect, this setting
2466 lead to the locations of these repositories. In effect, this setting
2453 collapses each collection of repositories found within a subdirectory
2467 collapses each collection of repositories found within a subdirectory
2454 into a single entry for that subdirectory. (default: False)
2468 into a single entry for that subdirectory. (default: False)
2455
2469
2456 ``comparisoncontext``
2470 ``comparisoncontext``
2457 Number of lines of context to show in side-by-side file comparison. If
2471 Number of lines of context to show in side-by-side file comparison. If
2458 negative or the value ``full``, whole files are shown. (default: 5)
2472 negative or the value ``full``, whole files are shown. (default: 5)
2459
2473
2460 This setting can be overridden by a ``context`` request parameter to the
2474 This setting can be overridden by a ``context`` request parameter to the
2461 ``comparison`` command, taking the same values.
2475 ``comparison`` command, taking the same values.
2462
2476
2463 ``contact``
2477 ``contact``
2464 Name or email address of the person in charge of the repository.
2478 Name or email address of the person in charge of the repository.
2465 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2479 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2466
2480
2467 ``csp``
2481 ``csp``
2468 Send a ``Content-Security-Policy`` HTTP header with this value.
2482 Send a ``Content-Security-Policy`` HTTP header with this value.
2469
2483
2470 The value may contain a special string ``%nonce%``, which will be replaced
2484 The value may contain a special string ``%nonce%``, which will be replaced
2471 by a randomly-generated one-time use value. If the value contains
2485 by a randomly-generated one-time use value. If the value contains
2472 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2486 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2473 one-time property of the nonce. This nonce will also be inserted into
2487 one-time property of the nonce. This nonce will also be inserted into
2474 ``<script>`` elements containing inline JavaScript.
2488 ``<script>`` elements containing inline JavaScript.
2475
2489
2476 Note: lots of HTML content sent by the server is derived from repository
2490 Note: lots of HTML content sent by the server is derived from repository
2477 data. Please consider the potential for malicious repository data to
2491 data. Please consider the potential for malicious repository data to
2478 "inject" itself into generated HTML content as part of your security
2492 "inject" itself into generated HTML content as part of your security
2479 threat model.
2493 threat model.
2480
2494
2481 ``deny_push``
2495 ``deny_push``
2482 Whether to deny pushing to the repository. If empty or not set,
2496 Whether to deny pushing to the repository. If empty or not set,
2483 push is not denied. If the special value ``*``, all remote users are
2497 push is not denied. If the special value ``*``, all remote users are
2484 denied push. Otherwise, unauthenticated users are all denied, and
2498 denied push. Otherwise, unauthenticated users are all denied, and
2485 any authenticated user name present in this list is also denied. The
2499 any authenticated user name present in this list is also denied. The
2486 contents of the deny_push list are examined before the allow-push list.
2500 contents of the deny_push list are examined before the allow-push list.
2487
2501
2488 ``deny_read``
2502 ``deny_read``
2489 Whether to deny reading/viewing of the repository. If this list is
2503 Whether to deny reading/viewing of the repository. If this list is
2490 not empty, unauthenticated users are all denied, and any
2504 not empty, unauthenticated users are all denied, and any
2491 authenticated user name present in this list is also denied access to
2505 authenticated user name present in this list is also denied access to
2492 the repository. If set to the special value ``*``, all remote users
2506 the repository. If set to the special value ``*``, all remote users
2493 are denied access (rarely needed ;). If deny_read is empty or not set,
2507 are denied access (rarely needed ;). If deny_read is empty or not set,
2494 the determination of repository access depends on the presence and
2508 the determination of repository access depends on the presence and
2495 content of the allow_read list (see description). If both
2509 content of the allow_read list (see description). If both
2496 deny_read and allow_read are empty or not set, then access is
2510 deny_read and allow_read are empty or not set, then access is
2497 permitted to all users by default. If the repository is being
2511 permitted to all users by default. If the repository is being
2498 served via hgwebdir, denied users will not be able to see it in
2512 served via hgwebdir, denied users will not be able to see it in
2499 the list of repositories. The contents of the deny_read list have
2513 the list of repositories. The contents of the deny_read list have
2500 priority over (are examined before) the contents of the allow_read
2514 priority over (are examined before) the contents of the allow_read
2501 list.
2515 list.
2502
2516
2503 ``descend``
2517 ``descend``
2504 hgwebdir indexes will not descend into subdirectories. Only repositories
2518 hgwebdir indexes will not descend into subdirectories. Only repositories
2505 directly in the current path will be shown (other repositories are still
2519 directly in the current path will be shown (other repositories are still
2506 available from the index corresponding to their containing path).
2520 available from the index corresponding to their containing path).
2507
2521
2508 ``description``
2522 ``description``
2509 Textual description of the repository's purpose or contents.
2523 Textual description of the repository's purpose or contents.
2510 (default: "unknown")
2524 (default: "unknown")
2511
2525
2512 ``encoding``
2526 ``encoding``
2513 Character encoding name. (default: the current locale charset)
2527 Character encoding name. (default: the current locale charset)
2514 Example: "UTF-8".
2528 Example: "UTF-8".
2515
2529
2516 ``errorlog``
2530 ``errorlog``
2517 Where to output the error log. (default: stderr)
2531 Where to output the error log. (default: stderr)
2518
2532
2519 ``guessmime``
2533 ``guessmime``
2520 Control MIME types for raw download of file content.
2534 Control MIME types for raw download of file content.
2521 Set to True to let hgweb guess the content type from the file
2535 Set to True to let hgweb guess the content type from the file
2522 extension. This will serve HTML files as ``text/html`` and might
2536 extension. This will serve HTML files as ``text/html`` and might
2523 allow cross-site scripting attacks when serving untrusted
2537 allow cross-site scripting attacks when serving untrusted
2524 repositories. (default: False)
2538 repositories. (default: False)
2525
2539
2526 ``hidden``
2540 ``hidden``
2527 Whether to hide the repository in the hgwebdir index.
2541 Whether to hide the repository in the hgwebdir index.
2528 (default: False)
2542 (default: False)
2529
2543
2530 ``ipv6``
2544 ``ipv6``
2531 Whether to use IPv6. (default: False)
2545 Whether to use IPv6. (default: False)
2532
2546
2533 ``labels``
2547 ``labels``
2534 List of string *labels* associated with the repository.
2548 List of string *labels* associated with the repository.
2535
2549
2536 Labels are exposed as a template keyword and can be used to customize
2550 Labels are exposed as a template keyword and can be used to customize
2537 output. e.g. the ``index`` template can group or filter repositories
2551 output. e.g. the ``index`` template can group or filter repositories
2538 by labels and the ``summary`` template can display additional content
2552 by labels and the ``summary`` template can display additional content
2539 if a specific label is present.
2553 if a specific label is present.
2540
2554
2541 ``logoimg``
2555 ``logoimg``
2542 File name of the logo image that some templates display on each page.
2556 File name of the logo image that some templates display on each page.
2543 The file name is relative to ``staticurl``. That is, the full path to
2557 The file name is relative to ``staticurl``. That is, the full path to
2544 the logo image is "staticurl/logoimg".
2558 the logo image is "staticurl/logoimg".
2545 If unset, ``hglogo.png`` will be used.
2559 If unset, ``hglogo.png`` will be used.
2546
2560
2547 ``logourl``
2561 ``logourl``
2548 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2562 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2549 will be used.
2563 will be used.
2550
2564
2551 ``maxchanges``
2565 ``maxchanges``
2552 Maximum number of changes to list on the changelog. (default: 10)
2566 Maximum number of changes to list on the changelog. (default: 10)
2553
2567
2554 ``maxfiles``
2568 ``maxfiles``
2555 Maximum number of files to list per changeset. (default: 10)
2569 Maximum number of files to list per changeset. (default: 10)
2556
2570
2557 ``maxshortchanges``
2571 ``maxshortchanges``
2558 Maximum number of changes to list on the shortlog, graph or filelog
2572 Maximum number of changes to list on the shortlog, graph or filelog
2559 pages. (default: 60)
2573 pages. (default: 60)
2560
2574
2561 ``name``
2575 ``name``
2562 Repository name to use in the web interface.
2576 Repository name to use in the web interface.
2563 (default: current working directory)
2577 (default: current working directory)
2564
2578
2565 ``port``
2579 ``port``
2566 Port to listen on. (default: 8000)
2580 Port to listen on. (default: 8000)
2567
2581
2568 ``prefix``
2582 ``prefix``
2569 Prefix path to serve from. (default: '' (server root))
2583 Prefix path to serve from. (default: '' (server root))
2570
2584
2571 ``push_ssl``
2585 ``push_ssl``
2572 Whether to require that inbound pushes be transported over SSL to
2586 Whether to require that inbound pushes be transported over SSL to
2573 prevent password sniffing. (default: True)
2587 prevent password sniffing. (default: True)
2574
2588
2575 ``refreshinterval``
2589 ``refreshinterval``
2576 How frequently directory listings re-scan the filesystem for new
2590 How frequently directory listings re-scan the filesystem for new
2577 repositories, in seconds. This is relevant when wildcards are used
2591 repositories, in seconds. This is relevant when wildcards are used
2578 to define paths. Depending on how much filesystem traversal is
2592 to define paths. Depending on how much filesystem traversal is
2579 required, refreshing may negatively impact performance.
2593 required, refreshing may negatively impact performance.
2580
2594
2581 Values less than or equal to 0 always refresh.
2595 Values less than or equal to 0 always refresh.
2582 (default: 20)
2596 (default: 20)
2583
2597
2584 ``server-header``
2598 ``server-header``
2585 Value for HTTP ``Server`` response header.
2599 Value for HTTP ``Server`` response header.
2586
2600
2587 ``staticurl``
2601 ``staticurl``
2588 Base URL to use for static files. If unset, static files (e.g. the
2602 Base URL to use for static files. If unset, static files (e.g. the
2589 hgicon.png favicon) will be served by the CGI script itself. Use
2603 hgicon.png favicon) will be served by the CGI script itself. Use
2590 this setting to serve them directly with the HTTP server.
2604 this setting to serve them directly with the HTTP server.
2591 Example: ``http://hgserver/static/``.
2605 Example: ``http://hgserver/static/``.
2592
2606
2593 ``stripes``
2607 ``stripes``
2594 How many lines a "zebra stripe" should span in multi-line output.
2608 How many lines a "zebra stripe" should span in multi-line output.
2595 Set to 0 to disable. (default: 1)
2609 Set to 0 to disable. (default: 1)
2596
2610
2597 ``style``
2611 ``style``
2598 Which template map style to use. The available options are the names of
2612 Which template map style to use. The available options are the names of
2599 subdirectories in the HTML templates path. (default: ``paper``)
2613 subdirectories in the HTML templates path. (default: ``paper``)
2600 Example: ``monoblue``.
2614 Example: ``monoblue``.
2601
2615
2602 ``templates``
2616 ``templates``
2603 Where to find the HTML templates. The default path to the HTML templates
2617 Where to find the HTML templates. The default path to the HTML templates
2604 can be obtained from ``hg debuginstall``.
2618 can be obtained from ``hg debuginstall``.
2605
2619
2606 ``websub``
2620 ``websub``
2607 ----------
2621 ----------
2608
2622
2609 Web substitution filter definition. You can use this section to
2623 Web substitution filter definition. You can use this section to
2610 define a set of regular expression substitution patterns which
2624 define a set of regular expression substitution patterns which
2611 let you automatically modify the hgweb server output.
2625 let you automatically modify the hgweb server output.
2612
2626
2613 The default hgweb templates only apply these substitution patterns
2627 The default hgweb templates only apply these substitution patterns
2614 on the revision description fields. You can apply them anywhere
2628 on the revision description fields. You can apply them anywhere
2615 you want when you create your own templates by adding calls to the
2629 you want when you create your own templates by adding calls to the
2616 "websub" filter (usually after calling the "escape" filter).
2630 "websub" filter (usually after calling the "escape" filter).
2617
2631
2618 This can be used, for example, to convert issue references to links
2632 This can be used, for example, to convert issue references to links
2619 to your issue tracker, or to convert "markdown-like" syntax into
2633 to your issue tracker, or to convert "markdown-like" syntax into
2620 HTML (see the examples below).
2634 HTML (see the examples below).
2621
2635
2622 Each entry in this section names a substitution filter.
2636 Each entry in this section names a substitution filter.
2623 The value of each entry defines the substitution expression itself.
2637 The value of each entry defines the substitution expression itself.
2624 The websub expressions follow the old interhg extension syntax,
2638 The websub expressions follow the old interhg extension syntax,
2625 which in turn imitates the Unix sed replacement syntax::
2639 which in turn imitates the Unix sed replacement syntax::
2626
2640
2627 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2641 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2628
2642
2629 You can use any separator other than "/". The final "i" is optional
2643 You can use any separator other than "/". The final "i" is optional
2630 and indicates that the search must be case insensitive.
2644 and indicates that the search must be case insensitive.
2631
2645
2632 Examples::
2646 Examples::
2633
2647
2634 [websub]
2648 [websub]
2635 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2649 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2636 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2650 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2637 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2651 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2638
2652
2639 ``worker``
2653 ``worker``
2640 ----------
2654 ----------
2641
2655
2642 Parallel master/worker configuration. We currently perform working
2656 Parallel master/worker configuration. We currently perform working
2643 directory updates in parallel on Unix-like systems, which greatly
2657 directory updates in parallel on Unix-like systems, which greatly
2644 helps performance.
2658 helps performance.
2645
2659
2646 ``enabled``
2660 ``enabled``
2647 Whether to enable workers code to be used.
2661 Whether to enable workers code to be used.
2648 (default: true)
2662 (default: true)
2649
2663
2650 ``numcpus``
2664 ``numcpus``
2651 Number of CPUs to use for parallel operations. A zero or
2665 Number of CPUs to use for parallel operations. A zero or
2652 negative value is treated as ``use the default``.
2666 negative value is treated as ``use the default``.
2653 (default: 4 or the number of CPUs on the system, whichever is larger)
2667 (default: 4 or the number of CPUs on the system, whichever is larger)
2654
2668
2655 ``backgroundclose``
2669 ``backgroundclose``
2656 Whether to enable closing file handles on background threads during certain
2670 Whether to enable closing file handles on background threads during certain
2657 operations. Some platforms aren't very efficient at closing file
2671 operations. Some platforms aren't very efficient at closing file
2658 handles that have been written or appended to. By performing file closing
2672 handles that have been written or appended to. By performing file closing
2659 on background threads, file write rate can increase substantially.
2673 on background threads, file write rate can increase substantially.
2660 (default: true on Windows, false elsewhere)
2674 (default: true on Windows, false elsewhere)
2661
2675
2662 ``backgroundcloseminfilecount``
2676 ``backgroundcloseminfilecount``
2663 Minimum number of files required to trigger background file closing.
2677 Minimum number of files required to trigger background file closing.
2664 Operations not writing this many files won't start background close
2678 Operations not writing this many files won't start background close
2665 threads.
2679 threads.
2666 (default: 2048)
2680 (default: 2048)
2667
2681
2668 ``backgroundclosemaxqueue``
2682 ``backgroundclosemaxqueue``
2669 The maximum number of opened file handles waiting to be closed in the
2683 The maximum number of opened file handles waiting to be closed in the
2670 background. This option only has an effect if ``backgroundclose`` is
2684 background. This option only has an effect if ``backgroundclose`` is
2671 enabled.
2685 enabled.
2672 (default: 384)
2686 (default: 384)
2673
2687
2674 ``backgroundclosethreadcount``
2688 ``backgroundclosethreadcount``
2675 Number of threads to process background file closes. Only relevant if
2689 Number of threads to process background file closes. Only relevant if
2676 ``backgroundclose`` is enabled.
2690 ``backgroundclose`` is enabled.
2677 (default: 4)
2691 (default: 4)
@@ -1,2396 +1,2395 b''
1 # localrepo.py - read/write repository class for mercurial
1 # localrepo.py - read/write repository class for mercurial
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import errno
10 import errno
11 import hashlib
11 import hashlib
12 import os
12 import os
13 import random
13 import random
14 import sys
14 import sys
15 import time
15 import time
16 import weakref
16 import weakref
17
17
18 from .i18n import _
18 from .i18n import _
19 from .node import (
19 from .node import (
20 hex,
20 hex,
21 nullid,
21 nullid,
22 short,
22 short,
23 )
23 )
24 from . import (
24 from . import (
25 bookmarks,
25 bookmarks,
26 branchmap,
26 branchmap,
27 bundle2,
27 bundle2,
28 changegroup,
28 changegroup,
29 changelog,
29 changelog,
30 color,
30 color,
31 context,
31 context,
32 dirstate,
32 dirstate,
33 dirstateguard,
33 dirstateguard,
34 discovery,
34 discovery,
35 encoding,
35 encoding,
36 error,
36 error,
37 exchange,
37 exchange,
38 extensions,
38 extensions,
39 filelog,
39 filelog,
40 hook,
40 hook,
41 lock as lockmod,
41 lock as lockmod,
42 manifest,
42 manifest,
43 match as matchmod,
43 match as matchmod,
44 merge as mergemod,
44 merge as mergemod,
45 mergeutil,
45 mergeutil,
46 namespaces,
46 namespaces,
47 narrowspec,
47 narrowspec,
48 obsolete,
48 obsolete,
49 pathutil,
49 pathutil,
50 phases,
50 phases,
51 pushkey,
51 pushkey,
52 pycompat,
52 pycompat,
53 repository,
53 repository,
54 repoview,
54 repoview,
55 revset,
55 revset,
56 revsetlang,
56 revsetlang,
57 scmutil,
57 scmutil,
58 sparse,
58 sparse,
59 store,
59 store,
60 subrepoutil,
60 subrepoutil,
61 tags as tagsmod,
61 tags as tagsmod,
62 transaction,
62 transaction,
63 txnutil,
63 txnutil,
64 util,
64 util,
65 vfs as vfsmod,
65 vfs as vfsmod,
66 )
66 )
67 from .utils import (
67 from .utils import (
68 interfaceutil,
68 interfaceutil,
69 procutil,
69 procutil,
70 stringutil,
70 stringutil,
71 )
71 )
72
72
73 release = lockmod.release
73 release = lockmod.release
74 urlerr = util.urlerr
74 urlerr = util.urlerr
75 urlreq = util.urlreq
75 urlreq = util.urlreq
76
76
77 # set of (path, vfs-location) tuples. vfs-location is:
77 # set of (path, vfs-location) tuples. vfs-location is:
78 # - 'plain for vfs relative paths
78 # - 'plain for vfs relative paths
79 # - '' for svfs relative paths
79 # - '' for svfs relative paths
80 _cachedfiles = set()
80 _cachedfiles = set()
81
81
82 class _basefilecache(scmutil.filecache):
82 class _basefilecache(scmutil.filecache):
83 """All filecache usage on repo are done for logic that should be unfiltered
83 """All filecache usage on repo are done for logic that should be unfiltered
84 """
84 """
85 def __get__(self, repo, type=None):
85 def __get__(self, repo, type=None):
86 if repo is None:
86 if repo is None:
87 return self
87 return self
88 return super(_basefilecache, self).__get__(repo.unfiltered(), type)
88 return super(_basefilecache, self).__get__(repo.unfiltered(), type)
89 def __set__(self, repo, value):
89 def __set__(self, repo, value):
90 return super(_basefilecache, self).__set__(repo.unfiltered(), value)
90 return super(_basefilecache, self).__set__(repo.unfiltered(), value)
91 def __delete__(self, repo):
91 def __delete__(self, repo):
92 return super(_basefilecache, self).__delete__(repo.unfiltered())
92 return super(_basefilecache, self).__delete__(repo.unfiltered())
93
93
94 class repofilecache(_basefilecache):
94 class repofilecache(_basefilecache):
95 """filecache for files in .hg but outside of .hg/store"""
95 """filecache for files in .hg but outside of .hg/store"""
96 def __init__(self, *paths):
96 def __init__(self, *paths):
97 super(repofilecache, self).__init__(*paths)
97 super(repofilecache, self).__init__(*paths)
98 for path in paths:
98 for path in paths:
99 _cachedfiles.add((path, 'plain'))
99 _cachedfiles.add((path, 'plain'))
100
100
101 def join(self, obj, fname):
101 def join(self, obj, fname):
102 return obj.vfs.join(fname)
102 return obj.vfs.join(fname)
103
103
104 class storecache(_basefilecache):
104 class storecache(_basefilecache):
105 """filecache for files in the store"""
105 """filecache for files in the store"""
106 def __init__(self, *paths):
106 def __init__(self, *paths):
107 super(storecache, self).__init__(*paths)
107 super(storecache, self).__init__(*paths)
108 for path in paths:
108 for path in paths:
109 _cachedfiles.add((path, ''))
109 _cachedfiles.add((path, ''))
110
110
111 def join(self, obj, fname):
111 def join(self, obj, fname):
112 return obj.sjoin(fname)
112 return obj.sjoin(fname)
113
113
114 def isfilecached(repo, name):
114 def isfilecached(repo, name):
115 """check if a repo has already cached "name" filecache-ed property
115 """check if a repo has already cached "name" filecache-ed property
116
116
117 This returns (cachedobj-or-None, iscached) tuple.
117 This returns (cachedobj-or-None, iscached) tuple.
118 """
118 """
119 cacheentry = repo.unfiltered()._filecache.get(name, None)
119 cacheentry = repo.unfiltered()._filecache.get(name, None)
120 if not cacheentry:
120 if not cacheentry:
121 return None, False
121 return None, False
122 return cacheentry.obj, True
122 return cacheentry.obj, True
123
123
124 class unfilteredpropertycache(util.propertycache):
124 class unfilteredpropertycache(util.propertycache):
125 """propertycache that apply to unfiltered repo only"""
125 """propertycache that apply to unfiltered repo only"""
126
126
127 def __get__(self, repo, type=None):
127 def __get__(self, repo, type=None):
128 unfi = repo.unfiltered()
128 unfi = repo.unfiltered()
129 if unfi is repo:
129 if unfi is repo:
130 return super(unfilteredpropertycache, self).__get__(unfi)
130 return super(unfilteredpropertycache, self).__get__(unfi)
131 return getattr(unfi, self.name)
131 return getattr(unfi, self.name)
132
132
133 class filteredpropertycache(util.propertycache):
133 class filteredpropertycache(util.propertycache):
134 """propertycache that must take filtering in account"""
134 """propertycache that must take filtering in account"""
135
135
136 def cachevalue(self, obj, value):
136 def cachevalue(self, obj, value):
137 object.__setattr__(obj, self.name, value)
137 object.__setattr__(obj, self.name, value)
138
138
139
139
140 def hasunfilteredcache(repo, name):
140 def hasunfilteredcache(repo, name):
141 """check if a repo has an unfilteredpropertycache value for <name>"""
141 """check if a repo has an unfilteredpropertycache value for <name>"""
142 return name in vars(repo.unfiltered())
142 return name in vars(repo.unfiltered())
143
143
144 def unfilteredmethod(orig):
144 def unfilteredmethod(orig):
145 """decorate method that always need to be run on unfiltered version"""
145 """decorate method that always need to be run on unfiltered version"""
146 def wrapper(repo, *args, **kwargs):
146 def wrapper(repo, *args, **kwargs):
147 return orig(repo.unfiltered(), *args, **kwargs)
147 return orig(repo.unfiltered(), *args, **kwargs)
148 return wrapper
148 return wrapper
149
149
150 moderncaps = {'lookup', 'branchmap', 'pushkey', 'known', 'getbundle',
150 moderncaps = {'lookup', 'branchmap', 'pushkey', 'known', 'getbundle',
151 'unbundle'}
151 'unbundle'}
152 legacycaps = moderncaps.union({'changegroupsubset'})
152 legacycaps = moderncaps.union({'changegroupsubset'})
153
153
154 @interfaceutil.implementer(repository.ipeercommandexecutor)
154 @interfaceutil.implementer(repository.ipeercommandexecutor)
155 class localcommandexecutor(object):
155 class localcommandexecutor(object):
156 def __init__(self, peer):
156 def __init__(self, peer):
157 self._peer = peer
157 self._peer = peer
158 self._sent = False
158 self._sent = False
159 self._closed = False
159 self._closed = False
160
160
161 def __enter__(self):
161 def __enter__(self):
162 return self
162 return self
163
163
164 def __exit__(self, exctype, excvalue, exctb):
164 def __exit__(self, exctype, excvalue, exctb):
165 self.close()
165 self.close()
166
166
167 def callcommand(self, command, args):
167 def callcommand(self, command, args):
168 if self._sent:
168 if self._sent:
169 raise error.ProgrammingError('callcommand() cannot be used after '
169 raise error.ProgrammingError('callcommand() cannot be used after '
170 'sendcommands()')
170 'sendcommands()')
171
171
172 if self._closed:
172 if self._closed:
173 raise error.ProgrammingError('callcommand() cannot be used after '
173 raise error.ProgrammingError('callcommand() cannot be used after '
174 'close()')
174 'close()')
175
175
176 # We don't need to support anything fancy. Just call the named
176 # We don't need to support anything fancy. Just call the named
177 # method on the peer and return a resolved future.
177 # method on the peer and return a resolved future.
178 fn = getattr(self._peer, pycompat.sysstr(command))
178 fn = getattr(self._peer, pycompat.sysstr(command))
179
179
180 f = pycompat.futures.Future()
180 f = pycompat.futures.Future()
181
181
182 try:
182 try:
183 result = fn(**pycompat.strkwargs(args))
183 result = fn(**pycompat.strkwargs(args))
184 except Exception:
184 except Exception:
185 pycompat.future_set_exception_info(f, sys.exc_info()[1:])
185 pycompat.future_set_exception_info(f, sys.exc_info()[1:])
186 else:
186 else:
187 f.set_result(result)
187 f.set_result(result)
188
188
189 return f
189 return f
190
190
191 def sendcommands(self):
191 def sendcommands(self):
192 self._sent = True
192 self._sent = True
193
193
194 def close(self):
194 def close(self):
195 self._closed = True
195 self._closed = True
196
196
197 @interfaceutil.implementer(repository.ipeercommands)
197 @interfaceutil.implementer(repository.ipeercommands)
198 class localpeer(repository.peer):
198 class localpeer(repository.peer):
199 '''peer for a local repo; reflects only the most recent API'''
199 '''peer for a local repo; reflects only the most recent API'''
200
200
201 def __init__(self, repo, caps=None):
201 def __init__(self, repo, caps=None):
202 super(localpeer, self).__init__()
202 super(localpeer, self).__init__()
203
203
204 if caps is None:
204 if caps is None:
205 caps = moderncaps.copy()
205 caps = moderncaps.copy()
206 self._repo = repo.filtered('served')
206 self._repo = repo.filtered('served')
207 self.ui = repo.ui
207 self.ui = repo.ui
208 self._caps = repo._restrictcapabilities(caps)
208 self._caps = repo._restrictcapabilities(caps)
209
209
210 # Begin of _basepeer interface.
210 # Begin of _basepeer interface.
211
211
212 def url(self):
212 def url(self):
213 return self._repo.url()
213 return self._repo.url()
214
214
215 def local(self):
215 def local(self):
216 return self._repo
216 return self._repo
217
217
218 def peer(self):
218 def peer(self):
219 return self
219 return self
220
220
221 def canpush(self):
221 def canpush(self):
222 return True
222 return True
223
223
224 def close(self):
224 def close(self):
225 self._repo.close()
225 self._repo.close()
226
226
227 # End of _basepeer interface.
227 # End of _basepeer interface.
228
228
229 # Begin of _basewirecommands interface.
229 # Begin of _basewirecommands interface.
230
230
231 def branchmap(self):
231 def branchmap(self):
232 return self._repo.branchmap()
232 return self._repo.branchmap()
233
233
234 def capabilities(self):
234 def capabilities(self):
235 return self._caps
235 return self._caps
236
236
237 def clonebundles(self):
237 def clonebundles(self):
238 return self._repo.tryread('clonebundles.manifest')
238 return self._repo.tryread('clonebundles.manifest')
239
239
240 def debugwireargs(self, one, two, three=None, four=None, five=None):
240 def debugwireargs(self, one, two, three=None, four=None, five=None):
241 """Used to test argument passing over the wire"""
241 """Used to test argument passing over the wire"""
242 return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three),
242 return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three),
243 pycompat.bytestr(four),
243 pycompat.bytestr(four),
244 pycompat.bytestr(five))
244 pycompat.bytestr(five))
245
245
246 def getbundle(self, source, heads=None, common=None, bundlecaps=None,
246 def getbundle(self, source, heads=None, common=None, bundlecaps=None,
247 **kwargs):
247 **kwargs):
248 chunks = exchange.getbundlechunks(self._repo, source, heads=heads,
248 chunks = exchange.getbundlechunks(self._repo, source, heads=heads,
249 common=common, bundlecaps=bundlecaps,
249 common=common, bundlecaps=bundlecaps,
250 **kwargs)[1]
250 **kwargs)[1]
251 cb = util.chunkbuffer(chunks)
251 cb = util.chunkbuffer(chunks)
252
252
253 if exchange.bundle2requested(bundlecaps):
253 if exchange.bundle2requested(bundlecaps):
254 # When requesting a bundle2, getbundle returns a stream to make the
254 # When requesting a bundle2, getbundle returns a stream to make the
255 # wire level function happier. We need to build a proper object
255 # wire level function happier. We need to build a proper object
256 # from it in local peer.
256 # from it in local peer.
257 return bundle2.getunbundler(self.ui, cb)
257 return bundle2.getunbundler(self.ui, cb)
258 else:
258 else:
259 return changegroup.getunbundler('01', cb, None)
259 return changegroup.getunbundler('01', cb, None)
260
260
261 def heads(self):
261 def heads(self):
262 return self._repo.heads()
262 return self._repo.heads()
263
263
264 def known(self, nodes):
264 def known(self, nodes):
265 return self._repo.known(nodes)
265 return self._repo.known(nodes)
266
266
267 def listkeys(self, namespace):
267 def listkeys(self, namespace):
268 return self._repo.listkeys(namespace)
268 return self._repo.listkeys(namespace)
269
269
270 def lookup(self, key):
270 def lookup(self, key):
271 return self._repo.lookup(key)
271 return self._repo.lookup(key)
272
272
273 def pushkey(self, namespace, key, old, new):
273 def pushkey(self, namespace, key, old, new):
274 return self._repo.pushkey(namespace, key, old, new)
274 return self._repo.pushkey(namespace, key, old, new)
275
275
276 def stream_out(self):
276 def stream_out(self):
277 raise error.Abort(_('cannot perform stream clone against local '
277 raise error.Abort(_('cannot perform stream clone against local '
278 'peer'))
278 'peer'))
279
279
280 def unbundle(self, bundle, heads, url):
280 def unbundle(self, bundle, heads, url):
281 """apply a bundle on a repo
281 """apply a bundle on a repo
282
282
283 This function handles the repo locking itself."""
283 This function handles the repo locking itself."""
284 try:
284 try:
285 try:
285 try:
286 bundle = exchange.readbundle(self.ui, bundle, None)
286 bundle = exchange.readbundle(self.ui, bundle, None)
287 ret = exchange.unbundle(self._repo, bundle, heads, 'push', url)
287 ret = exchange.unbundle(self._repo, bundle, heads, 'push', url)
288 if util.safehasattr(ret, 'getchunks'):
288 if util.safehasattr(ret, 'getchunks'):
289 # This is a bundle20 object, turn it into an unbundler.
289 # This is a bundle20 object, turn it into an unbundler.
290 # This little dance should be dropped eventually when the
290 # This little dance should be dropped eventually when the
291 # API is finally improved.
291 # API is finally improved.
292 stream = util.chunkbuffer(ret.getchunks())
292 stream = util.chunkbuffer(ret.getchunks())
293 ret = bundle2.getunbundler(self.ui, stream)
293 ret = bundle2.getunbundler(self.ui, stream)
294 return ret
294 return ret
295 except Exception as exc:
295 except Exception as exc:
296 # If the exception contains output salvaged from a bundle2
296 # If the exception contains output salvaged from a bundle2
297 # reply, we need to make sure it is printed before continuing
297 # reply, we need to make sure it is printed before continuing
298 # to fail. So we build a bundle2 with such output and consume
298 # to fail. So we build a bundle2 with such output and consume
299 # it directly.
299 # it directly.
300 #
300 #
301 # This is not very elegant but allows a "simple" solution for
301 # This is not very elegant but allows a "simple" solution for
302 # issue4594
302 # issue4594
303 output = getattr(exc, '_bundle2salvagedoutput', ())
303 output = getattr(exc, '_bundle2salvagedoutput', ())
304 if output:
304 if output:
305 bundler = bundle2.bundle20(self._repo.ui)
305 bundler = bundle2.bundle20(self._repo.ui)
306 for out in output:
306 for out in output:
307 bundler.addpart(out)
307 bundler.addpart(out)
308 stream = util.chunkbuffer(bundler.getchunks())
308 stream = util.chunkbuffer(bundler.getchunks())
309 b = bundle2.getunbundler(self.ui, stream)
309 b = bundle2.getunbundler(self.ui, stream)
310 bundle2.processbundle(self._repo, b)
310 bundle2.processbundle(self._repo, b)
311 raise
311 raise
312 except error.PushRaced as exc:
312 except error.PushRaced as exc:
313 raise error.ResponseError(_('push failed:'),
313 raise error.ResponseError(_('push failed:'),
314 stringutil.forcebytestr(exc))
314 stringutil.forcebytestr(exc))
315
315
316 # End of _basewirecommands interface.
316 # End of _basewirecommands interface.
317
317
318 # Begin of peer interface.
318 # Begin of peer interface.
319
319
320 def commandexecutor(self):
320 def commandexecutor(self):
321 return localcommandexecutor(self)
321 return localcommandexecutor(self)
322
322
323 # End of peer interface.
323 # End of peer interface.
324
324
325 @interfaceutil.implementer(repository.ipeerlegacycommands)
325 @interfaceutil.implementer(repository.ipeerlegacycommands)
326 class locallegacypeer(localpeer):
326 class locallegacypeer(localpeer):
327 '''peer extension which implements legacy methods too; used for tests with
327 '''peer extension which implements legacy methods too; used for tests with
328 restricted capabilities'''
328 restricted capabilities'''
329
329
330 def __init__(self, repo):
330 def __init__(self, repo):
331 super(locallegacypeer, self).__init__(repo, caps=legacycaps)
331 super(locallegacypeer, self).__init__(repo, caps=legacycaps)
332
332
333 # Begin of baselegacywirecommands interface.
333 # Begin of baselegacywirecommands interface.
334
334
335 def between(self, pairs):
335 def between(self, pairs):
336 return self._repo.between(pairs)
336 return self._repo.between(pairs)
337
337
338 def branches(self, nodes):
338 def branches(self, nodes):
339 return self._repo.branches(nodes)
339 return self._repo.branches(nodes)
340
340
341 def changegroup(self, nodes, source):
341 def changegroup(self, nodes, source):
342 outgoing = discovery.outgoing(self._repo, missingroots=nodes,
342 outgoing = discovery.outgoing(self._repo, missingroots=nodes,
343 missingheads=self._repo.heads())
343 missingheads=self._repo.heads())
344 return changegroup.makechangegroup(self._repo, outgoing, '01', source)
344 return changegroup.makechangegroup(self._repo, outgoing, '01', source)
345
345
346 def changegroupsubset(self, bases, heads, source):
346 def changegroupsubset(self, bases, heads, source):
347 outgoing = discovery.outgoing(self._repo, missingroots=bases,
347 outgoing = discovery.outgoing(self._repo, missingroots=bases,
348 missingheads=heads)
348 missingheads=heads)
349 return changegroup.makechangegroup(self._repo, outgoing, '01', source)
349 return changegroup.makechangegroup(self._repo, outgoing, '01', source)
350
350
351 # End of baselegacywirecommands interface.
351 # End of baselegacywirecommands interface.
352
352
353 # Increment the sub-version when the revlog v2 format changes to lock out old
353 # Increment the sub-version when the revlog v2 format changes to lock out old
354 # clients.
354 # clients.
355 REVLOGV2_REQUIREMENT = 'exp-revlogv2.0'
355 REVLOGV2_REQUIREMENT = 'exp-revlogv2.0'
356
356
357 # A repository with the sparserevlog feature will have delta chains that
357 # A repository with the sparserevlog feature will have delta chains that
358 # can spread over a larger span. Sparse reading cuts these large spans into
358 # can spread over a larger span. Sparse reading cuts these large spans into
359 # pieces, so that each piece isn't too big.
359 # pieces, so that each piece isn't too big.
360 # Without the sparserevlog capability, reading from the repository could use
360 # Without the sparserevlog capability, reading from the repository could use
361 # huge amounts of memory, because the whole span would be read at once,
361 # huge amounts of memory, because the whole span would be read at once,
362 # including all the intermediate revisions that aren't pertinent for the chain.
362 # including all the intermediate revisions that aren't pertinent for the chain.
363 # This is why once a repository has enabled sparse-read, it becomes required.
363 # This is why once a repository has enabled sparse-read, it becomes required.
364 SPARSEREVLOG_REQUIREMENT = 'sparserevlog'
364 SPARSEREVLOG_REQUIREMENT = 'sparserevlog'
365
365
366 # Functions receiving (ui, features) that extensions can register to impact
366 # Functions receiving (ui, features) that extensions can register to impact
367 # the ability to load repositories with custom requirements. Only
367 # the ability to load repositories with custom requirements. Only
368 # functions defined in loaded extensions are called.
368 # functions defined in loaded extensions are called.
369 #
369 #
370 # The function receives a set of requirement strings that the repository
370 # The function receives a set of requirement strings that the repository
371 # is capable of opening. Functions will typically add elements to the
371 # is capable of opening. Functions will typically add elements to the
372 # set to reflect that the extension knows how to handle that requirements.
372 # set to reflect that the extension knows how to handle that requirements.
373 featuresetupfuncs = set()
373 featuresetupfuncs = set()
374
374
375 @interfaceutil.implementer(repository.completelocalrepository)
375 @interfaceutil.implementer(repository.completelocalrepository)
376 class localrepository(object):
376 class localrepository(object):
377
377
378 # obsolete experimental requirements:
378 # obsolete experimental requirements:
379 # - manifestv2: An experimental new manifest format that allowed
379 # - manifestv2: An experimental new manifest format that allowed
380 # for stem compression of long paths. Experiment ended up not
380 # for stem compression of long paths. Experiment ended up not
381 # being successful (repository sizes went up due to worse delta
381 # being successful (repository sizes went up due to worse delta
382 # chains), and the code was deleted in 4.6.
382 # chains), and the code was deleted in 4.6.
383 supportedformats = {
383 supportedformats = {
384 'revlogv1',
384 'revlogv1',
385 'generaldelta',
385 'generaldelta',
386 'treemanifest',
386 'treemanifest',
387 REVLOGV2_REQUIREMENT,
387 REVLOGV2_REQUIREMENT,
388 SPARSEREVLOG_REQUIREMENT,
388 SPARSEREVLOG_REQUIREMENT,
389 }
389 }
390 _basesupported = supportedformats | {
390 _basesupported = supportedformats | {
391 'store',
391 'store',
392 'fncache',
392 'fncache',
393 'shared',
393 'shared',
394 'relshared',
394 'relshared',
395 'dotencode',
395 'dotencode',
396 'exp-sparse',
396 'exp-sparse',
397 }
397 }
398 openerreqs = {
398 openerreqs = {
399 'revlogv1',
399 'revlogv1',
400 'generaldelta',
400 'generaldelta',
401 'treemanifest',
401 'treemanifest',
402 }
402 }
403
403
404 # list of prefix for file which can be written without 'wlock'
404 # list of prefix for file which can be written without 'wlock'
405 # Extensions should extend this list when needed
405 # Extensions should extend this list when needed
406 _wlockfreeprefix = {
406 _wlockfreeprefix = {
407 # We migh consider requiring 'wlock' for the next
407 # We migh consider requiring 'wlock' for the next
408 # two, but pretty much all the existing code assume
408 # two, but pretty much all the existing code assume
409 # wlock is not needed so we keep them excluded for
409 # wlock is not needed so we keep them excluded for
410 # now.
410 # now.
411 'hgrc',
411 'hgrc',
412 'requires',
412 'requires',
413 # XXX cache is a complicatged business someone
413 # XXX cache is a complicatged business someone
414 # should investigate this in depth at some point
414 # should investigate this in depth at some point
415 'cache/',
415 'cache/',
416 # XXX shouldn't be dirstate covered by the wlock?
416 # XXX shouldn't be dirstate covered by the wlock?
417 'dirstate',
417 'dirstate',
418 # XXX bisect was still a bit too messy at the time
418 # XXX bisect was still a bit too messy at the time
419 # this changeset was introduced. Someone should fix
419 # this changeset was introduced. Someone should fix
420 # the remainig bit and drop this line
420 # the remainig bit and drop this line
421 'bisect.state',
421 'bisect.state',
422 }
422 }
423
423
424 def __init__(self, baseui, path, create=False, intents=None):
424 def __init__(self, baseui, path, create=False, intents=None):
425 self.requirements = set()
425 self.requirements = set()
426 self.filtername = None
426 self.filtername = None
427 # wvfs: rooted at the repository root, used to access the working copy
427 # wvfs: rooted at the repository root, used to access the working copy
428 self.wvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
428 self.wvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
429 # vfs: rooted at .hg, used to access repo files outside of .hg/store
429 # vfs: rooted at .hg, used to access repo files outside of .hg/store
430 self.vfs = None
430 self.vfs = None
431 # svfs: usually rooted at .hg/store, used to access repository history
431 # svfs: usually rooted at .hg/store, used to access repository history
432 # If this is a shared repository, this vfs may point to another
432 # If this is a shared repository, this vfs may point to another
433 # repository's .hg/store directory.
433 # repository's .hg/store directory.
434 self.svfs = None
434 self.svfs = None
435 self.root = self.wvfs.base
435 self.root = self.wvfs.base
436 self.path = self.wvfs.join(".hg")
436 self.path = self.wvfs.join(".hg")
437 self.origroot = path
437 self.origroot = path
438 # This is only used by context.workingctx.match in order to
438 # This is only used by context.workingctx.match in order to
439 # detect files in subrepos.
439 # detect files in subrepos.
440 self.auditor = pathutil.pathauditor(
440 self.auditor = pathutil.pathauditor(
441 self.root, callback=self._checknested)
441 self.root, callback=self._checknested)
442 # This is only used by context.basectx.match in order to detect
442 # This is only used by context.basectx.match in order to detect
443 # files in subrepos.
443 # files in subrepos.
444 self.nofsauditor = pathutil.pathauditor(
444 self.nofsauditor = pathutil.pathauditor(
445 self.root, callback=self._checknested, realfs=False, cached=True)
445 self.root, callback=self._checknested, realfs=False, cached=True)
446 self.baseui = baseui
446 self.baseui = baseui
447 self.ui = baseui.copy()
447 self.ui = baseui.copy()
448 self.ui.copy = baseui.copy # prevent copying repo configuration
448 self.ui.copy = baseui.copy # prevent copying repo configuration
449 self.vfs = vfsmod.vfs(self.path, cacheaudited=True)
449 self.vfs = vfsmod.vfs(self.path, cacheaudited=True)
450 if (self.ui.configbool('devel', 'all-warnings') or
450 if (self.ui.configbool('devel', 'all-warnings') or
451 self.ui.configbool('devel', 'check-locks')):
451 self.ui.configbool('devel', 'check-locks')):
452 self.vfs.audit = self._getvfsward(self.vfs.audit)
452 self.vfs.audit = self._getvfsward(self.vfs.audit)
453 # A list of callback to shape the phase if no data were found.
453 # A list of callback to shape the phase if no data were found.
454 # Callback are in the form: func(repo, roots) --> processed root.
454 # Callback are in the form: func(repo, roots) --> processed root.
455 # This list it to be filled by extension during repo setup
455 # This list it to be filled by extension during repo setup
456 self._phasedefaults = []
456 self._phasedefaults = []
457 try:
457 try:
458 self.ui.readconfig(self.vfs.join("hgrc"), self.root)
458 self.ui.readconfig(self.vfs.join("hgrc"), self.root)
459 self._loadextensions()
459 self._loadextensions()
460 except IOError:
460 except IOError:
461 pass
461 pass
462
462
463 if featuresetupfuncs:
463 if featuresetupfuncs:
464 self.supported = set(self._basesupported) # use private copy
464 self.supported = set(self._basesupported) # use private copy
465 extmods = set(m.__name__ for n, m
465 extmods = set(m.__name__ for n, m
466 in extensions.extensions(self.ui))
466 in extensions.extensions(self.ui))
467 for setupfunc in featuresetupfuncs:
467 for setupfunc in featuresetupfuncs:
468 if setupfunc.__module__ in extmods:
468 if setupfunc.__module__ in extmods:
469 setupfunc(self.ui, self.supported)
469 setupfunc(self.ui, self.supported)
470 else:
470 else:
471 self.supported = self._basesupported
471 self.supported = self._basesupported
472 color.setup(self.ui)
472 color.setup(self.ui)
473
473
474 # Add compression engines.
474 # Add compression engines.
475 for name in util.compengines:
475 for name in util.compengines:
476 engine = util.compengines[name]
476 engine = util.compengines[name]
477 if engine.revlogheader():
477 if engine.revlogheader():
478 self.supported.add('exp-compression-%s' % name)
478 self.supported.add('exp-compression-%s' % name)
479
479
480 if not self.vfs.isdir():
480 if not self.vfs.isdir():
481 if create:
481 if create:
482 self.requirements = newreporequirements(self)
482 self.requirements = newreporequirements(self)
483
483
484 if not self.wvfs.exists():
484 if not self.wvfs.exists():
485 self.wvfs.makedirs()
485 self.wvfs.makedirs()
486 self.vfs.makedir(notindexed=True)
486 self.vfs.makedir(notindexed=True)
487
487
488 if 'store' in self.requirements:
488 if 'store' in self.requirements:
489 self.vfs.mkdir("store")
489 self.vfs.mkdir("store")
490
490
491 # create an invalid changelog
491 # create an invalid changelog
492 self.vfs.append(
492 self.vfs.append(
493 "00changelog.i",
493 "00changelog.i",
494 '\0\0\0\2' # represents revlogv2
494 '\0\0\0\2' # represents revlogv2
495 ' dummy changelog to prevent using the old repo layout'
495 ' dummy changelog to prevent using the old repo layout'
496 )
496 )
497 else:
497 else:
498 raise error.RepoError(_("repository %s not found") % path)
498 raise error.RepoError(_("repository %s not found") % path)
499 elif create:
499 elif create:
500 raise error.RepoError(_("repository %s already exists") % path)
500 raise error.RepoError(_("repository %s already exists") % path)
501 else:
501 else:
502 try:
502 try:
503 self.requirements = scmutil.readrequires(
503 self.requirements = scmutil.readrequires(
504 self.vfs, self.supported)
504 self.vfs, self.supported)
505 except IOError as inst:
505 except IOError as inst:
506 if inst.errno != errno.ENOENT:
506 if inst.errno != errno.ENOENT:
507 raise
507 raise
508
508
509 cachepath = self.vfs.join('cache')
509 cachepath = self.vfs.join('cache')
510 self.sharedpath = self.path
510 self.sharedpath = self.path
511 try:
511 try:
512 sharedpath = self.vfs.read("sharedpath").rstrip('\n')
512 sharedpath = self.vfs.read("sharedpath").rstrip('\n')
513 if 'relshared' in self.requirements:
513 if 'relshared' in self.requirements:
514 sharedpath = self.vfs.join(sharedpath)
514 sharedpath = self.vfs.join(sharedpath)
515 vfs = vfsmod.vfs(sharedpath, realpath=True)
515 vfs = vfsmod.vfs(sharedpath, realpath=True)
516 cachepath = vfs.join('cache')
516 cachepath = vfs.join('cache')
517 s = vfs.base
517 s = vfs.base
518 if not vfs.exists():
518 if not vfs.exists():
519 raise error.RepoError(
519 raise error.RepoError(
520 _('.hg/sharedpath points to nonexistent directory %s') % s)
520 _('.hg/sharedpath points to nonexistent directory %s') % s)
521 self.sharedpath = s
521 self.sharedpath = s
522 except IOError as inst:
522 except IOError as inst:
523 if inst.errno != errno.ENOENT:
523 if inst.errno != errno.ENOENT:
524 raise
524 raise
525
525
526 if 'exp-sparse' in self.requirements and not sparse.enabled:
526 if 'exp-sparse' in self.requirements and not sparse.enabled:
527 raise error.RepoError(_('repository is using sparse feature but '
527 raise error.RepoError(_('repository is using sparse feature but '
528 'sparse is not enabled; enable the '
528 'sparse is not enabled; enable the '
529 '"sparse" extensions to access'))
529 '"sparse" extensions to access'))
530
530
531 self.store = store.store(
531 self.store = store.store(
532 self.requirements, self.sharedpath,
532 self.requirements, self.sharedpath,
533 lambda base: vfsmod.vfs(base, cacheaudited=True))
533 lambda base: vfsmod.vfs(base, cacheaudited=True))
534 self.spath = self.store.path
534 self.spath = self.store.path
535 self.svfs = self.store.vfs
535 self.svfs = self.store.vfs
536 self.sjoin = self.store.join
536 self.sjoin = self.store.join
537 self.vfs.createmode = self.store.createmode
537 self.vfs.createmode = self.store.createmode
538 self.cachevfs = vfsmod.vfs(cachepath, cacheaudited=True)
538 self.cachevfs = vfsmod.vfs(cachepath, cacheaudited=True)
539 self.cachevfs.createmode = self.store.createmode
539 self.cachevfs.createmode = self.store.createmode
540 if (self.ui.configbool('devel', 'all-warnings') or
540 if (self.ui.configbool('devel', 'all-warnings') or
541 self.ui.configbool('devel', 'check-locks')):
541 self.ui.configbool('devel', 'check-locks')):
542 if util.safehasattr(self.svfs, 'vfs'): # this is filtervfs
542 if util.safehasattr(self.svfs, 'vfs'): # this is filtervfs
543 self.svfs.vfs.audit = self._getsvfsward(self.svfs.vfs.audit)
543 self.svfs.vfs.audit = self._getsvfsward(self.svfs.vfs.audit)
544 else: # standard vfs
544 else: # standard vfs
545 self.svfs.audit = self._getsvfsward(self.svfs.audit)
545 self.svfs.audit = self._getsvfsward(self.svfs.audit)
546 self._applyopenerreqs()
546 self._applyopenerreqs()
547 if create:
547 if create:
548 self._writerequirements()
548 self._writerequirements()
549
549
550 self._dirstatevalidatewarned = False
550 self._dirstatevalidatewarned = False
551
551
552 self._branchcaches = {}
552 self._branchcaches = {}
553 self._revbranchcache = None
553 self._revbranchcache = None
554 self._filterpats = {}
554 self._filterpats = {}
555 self._datafilters = {}
555 self._datafilters = {}
556 self._transref = self._lockref = self._wlockref = None
556 self._transref = self._lockref = self._wlockref = None
557
557
558 # A cache for various files under .hg/ that tracks file changes,
558 # A cache for various files under .hg/ that tracks file changes,
559 # (used by the filecache decorator)
559 # (used by the filecache decorator)
560 #
560 #
561 # Maps a property name to its util.filecacheentry
561 # Maps a property name to its util.filecacheentry
562 self._filecache = {}
562 self._filecache = {}
563
563
564 # hold sets of revision to be filtered
564 # hold sets of revision to be filtered
565 # should be cleared when something might have changed the filter value:
565 # should be cleared when something might have changed the filter value:
566 # - new changesets,
566 # - new changesets,
567 # - phase change,
567 # - phase change,
568 # - new obsolescence marker,
568 # - new obsolescence marker,
569 # - working directory parent change,
569 # - working directory parent change,
570 # - bookmark changes
570 # - bookmark changes
571 self.filteredrevcache = {}
571 self.filteredrevcache = {}
572
572
573 # post-dirstate-status hooks
573 # post-dirstate-status hooks
574 self._postdsstatus = []
574 self._postdsstatus = []
575
575
576 # generic mapping between names and nodes
576 # generic mapping between names and nodes
577 self.names = namespaces.namespaces()
577 self.names = namespaces.namespaces()
578
578
579 # Key to signature value.
579 # Key to signature value.
580 self._sparsesignaturecache = {}
580 self._sparsesignaturecache = {}
581 # Signature to cached matcher instance.
581 # Signature to cached matcher instance.
582 self._sparsematchercache = {}
582 self._sparsematchercache = {}
583
583
584 def _getvfsward(self, origfunc):
584 def _getvfsward(self, origfunc):
585 """build a ward for self.vfs"""
585 """build a ward for self.vfs"""
586 rref = weakref.ref(self)
586 rref = weakref.ref(self)
587 def checkvfs(path, mode=None):
587 def checkvfs(path, mode=None):
588 ret = origfunc(path, mode=mode)
588 ret = origfunc(path, mode=mode)
589 repo = rref()
589 repo = rref()
590 if (repo is None
590 if (repo is None
591 or not util.safehasattr(repo, '_wlockref')
591 or not util.safehasattr(repo, '_wlockref')
592 or not util.safehasattr(repo, '_lockref')):
592 or not util.safehasattr(repo, '_lockref')):
593 return
593 return
594 if mode in (None, 'r', 'rb'):
594 if mode in (None, 'r', 'rb'):
595 return
595 return
596 if path.startswith(repo.path):
596 if path.startswith(repo.path):
597 # truncate name relative to the repository (.hg)
597 # truncate name relative to the repository (.hg)
598 path = path[len(repo.path) + 1:]
598 path = path[len(repo.path) + 1:]
599 if path.startswith('cache/'):
599 if path.startswith('cache/'):
600 msg = 'accessing cache with vfs instead of cachevfs: "%s"'
600 msg = 'accessing cache with vfs instead of cachevfs: "%s"'
601 repo.ui.develwarn(msg % path, stacklevel=2, config="cache-vfs")
601 repo.ui.develwarn(msg % path, stacklevel=2, config="cache-vfs")
602 if path.startswith('journal.'):
602 if path.startswith('journal.'):
603 # journal is covered by 'lock'
603 # journal is covered by 'lock'
604 if repo._currentlock(repo._lockref) is None:
604 if repo._currentlock(repo._lockref) is None:
605 repo.ui.develwarn('write with no lock: "%s"' % path,
605 repo.ui.develwarn('write with no lock: "%s"' % path,
606 stacklevel=2, config='check-locks')
606 stacklevel=2, config='check-locks')
607 elif repo._currentlock(repo._wlockref) is None:
607 elif repo._currentlock(repo._wlockref) is None:
608 # rest of vfs files are covered by 'wlock'
608 # rest of vfs files are covered by 'wlock'
609 #
609 #
610 # exclude special files
610 # exclude special files
611 for prefix in self._wlockfreeprefix:
611 for prefix in self._wlockfreeprefix:
612 if path.startswith(prefix):
612 if path.startswith(prefix):
613 return
613 return
614 repo.ui.develwarn('write with no wlock: "%s"' % path,
614 repo.ui.develwarn('write with no wlock: "%s"' % path,
615 stacklevel=2, config='check-locks')
615 stacklevel=2, config='check-locks')
616 return ret
616 return ret
617 return checkvfs
617 return checkvfs
618
618
619 def _getsvfsward(self, origfunc):
619 def _getsvfsward(self, origfunc):
620 """build a ward for self.svfs"""
620 """build a ward for self.svfs"""
621 rref = weakref.ref(self)
621 rref = weakref.ref(self)
622 def checksvfs(path, mode=None):
622 def checksvfs(path, mode=None):
623 ret = origfunc(path, mode=mode)
623 ret = origfunc(path, mode=mode)
624 repo = rref()
624 repo = rref()
625 if repo is None or not util.safehasattr(repo, '_lockref'):
625 if repo is None or not util.safehasattr(repo, '_lockref'):
626 return
626 return
627 if mode in (None, 'r', 'rb'):
627 if mode in (None, 'r', 'rb'):
628 return
628 return
629 if path.startswith(repo.sharedpath):
629 if path.startswith(repo.sharedpath):
630 # truncate name relative to the repository (.hg)
630 # truncate name relative to the repository (.hg)
631 path = path[len(repo.sharedpath) + 1:]
631 path = path[len(repo.sharedpath) + 1:]
632 if repo._currentlock(repo._lockref) is None:
632 if repo._currentlock(repo._lockref) is None:
633 repo.ui.develwarn('write with no lock: "%s"' % path,
633 repo.ui.develwarn('write with no lock: "%s"' % path,
634 stacklevel=3)
634 stacklevel=3)
635 return ret
635 return ret
636 return checksvfs
636 return checksvfs
637
637
638 def close(self):
638 def close(self):
639 self._writecaches()
639 self._writecaches()
640
640
641 def _loadextensions(self):
641 def _loadextensions(self):
642 extensions.loadall(self.ui)
642 extensions.loadall(self.ui)
643
643
644 def _writecaches(self):
644 def _writecaches(self):
645 if self._revbranchcache:
645 if self._revbranchcache:
646 self._revbranchcache.write()
646 self._revbranchcache.write()
647
647
648 def _restrictcapabilities(self, caps):
648 def _restrictcapabilities(self, caps):
649 if self.ui.configbool('experimental', 'bundle2-advertise'):
649 if self.ui.configbool('experimental', 'bundle2-advertise'):
650 caps = set(caps)
650 caps = set(caps)
651 capsblob = bundle2.encodecaps(bundle2.getrepocaps(self,
651 capsblob = bundle2.encodecaps(bundle2.getrepocaps(self,
652 role='client'))
652 role='client'))
653 caps.add('bundle2=' + urlreq.quote(capsblob))
653 caps.add('bundle2=' + urlreq.quote(capsblob))
654 return caps
654 return caps
655
655
656 def _applyopenerreqs(self):
656 def _applyopenerreqs(self):
657 self.svfs.options = dict((r, 1) for r in self.requirements
657 self.svfs.options = dict((r, 1) for r in self.requirements
658 if r in self.openerreqs)
658 if r in self.openerreqs)
659 # experimental config: format.chunkcachesize
659 # experimental config: format.chunkcachesize
660 chunkcachesize = self.ui.configint('format', 'chunkcachesize')
660 chunkcachesize = self.ui.configint('format', 'chunkcachesize')
661 if chunkcachesize is not None:
661 if chunkcachesize is not None:
662 self.svfs.options['chunkcachesize'] = chunkcachesize
662 self.svfs.options['chunkcachesize'] = chunkcachesize
663 # experimental config: format.maxchainlen
663 # experimental config: format.maxchainlen
664 maxchainlen = self.ui.configint('format', 'maxchainlen')
664 maxchainlen = self.ui.configint('format', 'maxchainlen')
665 if maxchainlen is not None:
665 if maxchainlen is not None:
666 self.svfs.options['maxchainlen'] = maxchainlen
666 self.svfs.options['maxchainlen'] = maxchainlen
667 # experimental config: format.manifestcachesize
667 # experimental config: format.manifestcachesize
668 manifestcachesize = self.ui.configint('format', 'manifestcachesize')
668 manifestcachesize = self.ui.configint('format', 'manifestcachesize')
669 if manifestcachesize is not None:
669 if manifestcachesize is not None:
670 self.svfs.options['manifestcachesize'] = manifestcachesize
670 self.svfs.options['manifestcachesize'] = manifestcachesize
671 # experimental config: format.aggressivemergedeltas
671 deltabothparents = self.ui.configbool('revlog',
672 deltabothparents = self.ui.configbool('format',
672 'optimize-delta-parent-choice')
673 'aggressivemergedeltas')
674 self.svfs.options['deltabothparents'] = deltabothparents
673 self.svfs.options['deltabothparents'] = deltabothparents
675 self.svfs.options['lazydeltabase'] = not scmutil.gddeltaconfig(self.ui)
674 self.svfs.options['lazydeltabase'] = not scmutil.gddeltaconfig(self.ui)
676 chainspan = self.ui.configbytes('experimental', 'maxdeltachainspan')
675 chainspan = self.ui.configbytes('experimental', 'maxdeltachainspan')
677 if 0 <= chainspan:
676 if 0 <= chainspan:
678 self.svfs.options['maxdeltachainspan'] = chainspan
677 self.svfs.options['maxdeltachainspan'] = chainspan
679 mmapindexthreshold = self.ui.configbytes('experimental',
678 mmapindexthreshold = self.ui.configbytes('experimental',
680 'mmapindexthreshold')
679 'mmapindexthreshold')
681 if mmapindexthreshold is not None:
680 if mmapindexthreshold is not None:
682 self.svfs.options['mmapindexthreshold'] = mmapindexthreshold
681 self.svfs.options['mmapindexthreshold'] = mmapindexthreshold
683 withsparseread = self.ui.configbool('experimental', 'sparse-read')
682 withsparseread = self.ui.configbool('experimental', 'sparse-read')
684 srdensitythres = float(self.ui.config('experimental',
683 srdensitythres = float(self.ui.config('experimental',
685 'sparse-read.density-threshold'))
684 'sparse-read.density-threshold'))
686 srmingapsize = self.ui.configbytes('experimental',
685 srmingapsize = self.ui.configbytes('experimental',
687 'sparse-read.min-gap-size')
686 'sparse-read.min-gap-size')
688 self.svfs.options['with-sparse-read'] = withsparseread
687 self.svfs.options['with-sparse-read'] = withsparseread
689 self.svfs.options['sparse-read-density-threshold'] = srdensitythres
688 self.svfs.options['sparse-read-density-threshold'] = srdensitythres
690 self.svfs.options['sparse-read-min-gap-size'] = srmingapsize
689 self.svfs.options['sparse-read-min-gap-size'] = srmingapsize
691 sparserevlog = SPARSEREVLOG_REQUIREMENT in self.requirements
690 sparserevlog = SPARSEREVLOG_REQUIREMENT in self.requirements
692 self.svfs.options['sparse-revlog'] = sparserevlog
691 self.svfs.options['sparse-revlog'] = sparserevlog
693
692
694 for r in self.requirements:
693 for r in self.requirements:
695 if r.startswith('exp-compression-'):
694 if r.startswith('exp-compression-'):
696 self.svfs.options['compengine'] = r[len('exp-compression-'):]
695 self.svfs.options['compengine'] = r[len('exp-compression-'):]
697
696
698 # TODO move "revlogv2" to openerreqs once finalized.
697 # TODO move "revlogv2" to openerreqs once finalized.
699 if REVLOGV2_REQUIREMENT in self.requirements:
698 if REVLOGV2_REQUIREMENT in self.requirements:
700 self.svfs.options['revlogv2'] = True
699 self.svfs.options['revlogv2'] = True
701
700
702 def _writerequirements(self):
701 def _writerequirements(self):
703 scmutil.writerequires(self.vfs, self.requirements)
702 scmutil.writerequires(self.vfs, self.requirements)
704
703
705 def _checknested(self, path):
704 def _checknested(self, path):
706 """Determine if path is a legal nested repository."""
705 """Determine if path is a legal nested repository."""
707 if not path.startswith(self.root):
706 if not path.startswith(self.root):
708 return False
707 return False
709 subpath = path[len(self.root) + 1:]
708 subpath = path[len(self.root) + 1:]
710 normsubpath = util.pconvert(subpath)
709 normsubpath = util.pconvert(subpath)
711
710
712 # XXX: Checking against the current working copy is wrong in
711 # XXX: Checking against the current working copy is wrong in
713 # the sense that it can reject things like
712 # the sense that it can reject things like
714 #
713 #
715 # $ hg cat -r 10 sub/x.txt
714 # $ hg cat -r 10 sub/x.txt
716 #
715 #
717 # if sub/ is no longer a subrepository in the working copy
716 # if sub/ is no longer a subrepository in the working copy
718 # parent revision.
717 # parent revision.
719 #
718 #
720 # However, it can of course also allow things that would have
719 # However, it can of course also allow things that would have
721 # been rejected before, such as the above cat command if sub/
720 # been rejected before, such as the above cat command if sub/
722 # is a subrepository now, but was a normal directory before.
721 # is a subrepository now, but was a normal directory before.
723 # The old path auditor would have rejected by mistake since it
722 # The old path auditor would have rejected by mistake since it
724 # panics when it sees sub/.hg/.
723 # panics when it sees sub/.hg/.
725 #
724 #
726 # All in all, checking against the working copy seems sensible
725 # All in all, checking against the working copy seems sensible
727 # since we want to prevent access to nested repositories on
726 # since we want to prevent access to nested repositories on
728 # the filesystem *now*.
727 # the filesystem *now*.
729 ctx = self[None]
728 ctx = self[None]
730 parts = util.splitpath(subpath)
729 parts = util.splitpath(subpath)
731 while parts:
730 while parts:
732 prefix = '/'.join(parts)
731 prefix = '/'.join(parts)
733 if prefix in ctx.substate:
732 if prefix in ctx.substate:
734 if prefix == normsubpath:
733 if prefix == normsubpath:
735 return True
734 return True
736 else:
735 else:
737 sub = ctx.sub(prefix)
736 sub = ctx.sub(prefix)
738 return sub.checknested(subpath[len(prefix) + 1:])
737 return sub.checknested(subpath[len(prefix) + 1:])
739 else:
738 else:
740 parts.pop()
739 parts.pop()
741 return False
740 return False
742
741
743 def peer(self):
742 def peer(self):
744 return localpeer(self) # not cached to avoid reference cycle
743 return localpeer(self) # not cached to avoid reference cycle
745
744
746 def unfiltered(self):
745 def unfiltered(self):
747 """Return unfiltered version of the repository
746 """Return unfiltered version of the repository
748
747
749 Intended to be overwritten by filtered repo."""
748 Intended to be overwritten by filtered repo."""
750 return self
749 return self
751
750
752 def filtered(self, name, visibilityexceptions=None):
751 def filtered(self, name, visibilityexceptions=None):
753 """Return a filtered version of a repository"""
752 """Return a filtered version of a repository"""
754 cls = repoview.newtype(self.unfiltered().__class__)
753 cls = repoview.newtype(self.unfiltered().__class__)
755 return cls(self, name, visibilityexceptions)
754 return cls(self, name, visibilityexceptions)
756
755
757 @repofilecache('bookmarks', 'bookmarks.current')
756 @repofilecache('bookmarks', 'bookmarks.current')
758 def _bookmarks(self):
757 def _bookmarks(self):
759 return bookmarks.bmstore(self)
758 return bookmarks.bmstore(self)
760
759
761 @property
760 @property
762 def _activebookmark(self):
761 def _activebookmark(self):
763 return self._bookmarks.active
762 return self._bookmarks.active
764
763
765 # _phasesets depend on changelog. what we need is to call
764 # _phasesets depend on changelog. what we need is to call
766 # _phasecache.invalidate() if '00changelog.i' was changed, but it
765 # _phasecache.invalidate() if '00changelog.i' was changed, but it
767 # can't be easily expressed in filecache mechanism.
766 # can't be easily expressed in filecache mechanism.
768 @storecache('phaseroots', '00changelog.i')
767 @storecache('phaseroots', '00changelog.i')
769 def _phasecache(self):
768 def _phasecache(self):
770 return phases.phasecache(self, self._phasedefaults)
769 return phases.phasecache(self, self._phasedefaults)
771
770
772 @storecache('obsstore')
771 @storecache('obsstore')
773 def obsstore(self):
772 def obsstore(self):
774 return obsolete.makestore(self.ui, self)
773 return obsolete.makestore(self.ui, self)
775
774
776 @storecache('00changelog.i')
775 @storecache('00changelog.i')
777 def changelog(self):
776 def changelog(self):
778 return changelog.changelog(self.svfs,
777 return changelog.changelog(self.svfs,
779 trypending=txnutil.mayhavepending(self.root))
778 trypending=txnutil.mayhavepending(self.root))
780
779
781 def _constructmanifest(self):
780 def _constructmanifest(self):
782 # This is a temporary function while we migrate from manifest to
781 # This is a temporary function while we migrate from manifest to
783 # manifestlog. It allows bundlerepo and unionrepo to intercept the
782 # manifestlog. It allows bundlerepo and unionrepo to intercept the
784 # manifest creation.
783 # manifest creation.
785 return manifest.manifestrevlog(self.svfs)
784 return manifest.manifestrevlog(self.svfs)
786
785
787 @storecache('00manifest.i')
786 @storecache('00manifest.i')
788 def manifestlog(self):
787 def manifestlog(self):
789 return manifest.manifestlog(self.svfs, self)
788 return manifest.manifestlog(self.svfs, self)
790
789
791 @repofilecache('dirstate')
790 @repofilecache('dirstate')
792 def dirstate(self):
791 def dirstate(self):
793 return self._makedirstate()
792 return self._makedirstate()
794
793
795 def _makedirstate(self):
794 def _makedirstate(self):
796 """Extension point for wrapping the dirstate per-repo."""
795 """Extension point for wrapping the dirstate per-repo."""
797 sparsematchfn = lambda: sparse.matcher(self)
796 sparsematchfn = lambda: sparse.matcher(self)
798
797
799 return dirstate.dirstate(self.vfs, self.ui, self.root,
798 return dirstate.dirstate(self.vfs, self.ui, self.root,
800 self._dirstatevalidate, sparsematchfn)
799 self._dirstatevalidate, sparsematchfn)
801
800
802 def _dirstatevalidate(self, node):
801 def _dirstatevalidate(self, node):
803 try:
802 try:
804 self.changelog.rev(node)
803 self.changelog.rev(node)
805 return node
804 return node
806 except error.LookupError:
805 except error.LookupError:
807 if not self._dirstatevalidatewarned:
806 if not self._dirstatevalidatewarned:
808 self._dirstatevalidatewarned = True
807 self._dirstatevalidatewarned = True
809 self.ui.warn(_("warning: ignoring unknown"
808 self.ui.warn(_("warning: ignoring unknown"
810 " working parent %s!\n") % short(node))
809 " working parent %s!\n") % short(node))
811 return nullid
810 return nullid
812
811
813 @repofilecache(narrowspec.FILENAME)
812 @repofilecache(narrowspec.FILENAME)
814 def narrowpats(self):
813 def narrowpats(self):
815 """matcher patterns for this repository's narrowspec
814 """matcher patterns for this repository's narrowspec
816
815
817 A tuple of (includes, excludes).
816 A tuple of (includes, excludes).
818 """
817 """
819 source = self
818 source = self
820 if self.shared():
819 if self.shared():
821 from . import hg
820 from . import hg
822 source = hg.sharedreposource(self)
821 source = hg.sharedreposource(self)
823 return narrowspec.load(source)
822 return narrowspec.load(source)
824
823
825 @repofilecache(narrowspec.FILENAME)
824 @repofilecache(narrowspec.FILENAME)
826 def _narrowmatch(self):
825 def _narrowmatch(self):
827 if changegroup.NARROW_REQUIREMENT not in self.requirements:
826 if changegroup.NARROW_REQUIREMENT not in self.requirements:
828 return matchmod.always(self.root, '')
827 return matchmod.always(self.root, '')
829 include, exclude = self.narrowpats
828 include, exclude = self.narrowpats
830 return narrowspec.match(self.root, include=include, exclude=exclude)
829 return narrowspec.match(self.root, include=include, exclude=exclude)
831
830
832 # TODO(martinvonz): make this property-like instead?
831 # TODO(martinvonz): make this property-like instead?
833 def narrowmatch(self):
832 def narrowmatch(self):
834 return self._narrowmatch
833 return self._narrowmatch
835
834
836 def setnarrowpats(self, newincludes, newexcludes):
835 def setnarrowpats(self, newincludes, newexcludes):
837 target = self
836 target = self
838 if self.shared():
837 if self.shared():
839 from . import hg
838 from . import hg
840 target = hg.sharedreposource(self)
839 target = hg.sharedreposource(self)
841 narrowspec.save(target, newincludes, newexcludes)
840 narrowspec.save(target, newincludes, newexcludes)
842 self.invalidate(clearfilecache=True)
841 self.invalidate(clearfilecache=True)
843
842
844 def __getitem__(self, changeid):
843 def __getitem__(self, changeid):
845 if changeid is None:
844 if changeid is None:
846 return context.workingctx(self)
845 return context.workingctx(self)
847 if isinstance(changeid, context.basectx):
846 if isinstance(changeid, context.basectx):
848 return changeid
847 return changeid
849 if isinstance(changeid, slice):
848 if isinstance(changeid, slice):
850 # wdirrev isn't contiguous so the slice shouldn't include it
849 # wdirrev isn't contiguous so the slice shouldn't include it
851 return [context.changectx(self, i)
850 return [context.changectx(self, i)
852 for i in xrange(*changeid.indices(len(self)))
851 for i in xrange(*changeid.indices(len(self)))
853 if i not in self.changelog.filteredrevs]
852 if i not in self.changelog.filteredrevs]
854 try:
853 try:
855 return context.changectx(self, changeid)
854 return context.changectx(self, changeid)
856 except error.WdirUnsupported:
855 except error.WdirUnsupported:
857 return context.workingctx(self)
856 return context.workingctx(self)
858
857
859 def __contains__(self, changeid):
858 def __contains__(self, changeid):
860 """True if the given changeid exists
859 """True if the given changeid exists
861
860
862 error.LookupError is raised if an ambiguous node specified.
861 error.LookupError is raised if an ambiguous node specified.
863 """
862 """
864 try:
863 try:
865 self[changeid]
864 self[changeid]
866 return True
865 return True
867 except error.RepoLookupError:
866 except error.RepoLookupError:
868 return False
867 return False
869
868
870 def __nonzero__(self):
869 def __nonzero__(self):
871 return True
870 return True
872
871
873 __bool__ = __nonzero__
872 __bool__ = __nonzero__
874
873
875 def __len__(self):
874 def __len__(self):
876 # no need to pay the cost of repoview.changelog
875 # no need to pay the cost of repoview.changelog
877 unfi = self.unfiltered()
876 unfi = self.unfiltered()
878 return len(unfi.changelog)
877 return len(unfi.changelog)
879
878
880 def __iter__(self):
879 def __iter__(self):
881 return iter(self.changelog)
880 return iter(self.changelog)
882
881
883 def revs(self, expr, *args):
882 def revs(self, expr, *args):
884 '''Find revisions matching a revset.
883 '''Find revisions matching a revset.
885
884
886 The revset is specified as a string ``expr`` that may contain
885 The revset is specified as a string ``expr`` that may contain
887 %-formatting to escape certain types. See ``revsetlang.formatspec``.
886 %-formatting to escape certain types. See ``revsetlang.formatspec``.
888
887
889 Revset aliases from the configuration are not expanded. To expand
888 Revset aliases from the configuration are not expanded. To expand
890 user aliases, consider calling ``scmutil.revrange()`` or
889 user aliases, consider calling ``scmutil.revrange()`` or
891 ``repo.anyrevs([expr], user=True)``.
890 ``repo.anyrevs([expr], user=True)``.
892
891
893 Returns a revset.abstractsmartset, which is a list-like interface
892 Returns a revset.abstractsmartset, which is a list-like interface
894 that contains integer revisions.
893 that contains integer revisions.
895 '''
894 '''
896 expr = revsetlang.formatspec(expr, *args)
895 expr = revsetlang.formatspec(expr, *args)
897 m = revset.match(None, expr)
896 m = revset.match(None, expr)
898 return m(self)
897 return m(self)
899
898
900 def set(self, expr, *args):
899 def set(self, expr, *args):
901 '''Find revisions matching a revset and emit changectx instances.
900 '''Find revisions matching a revset and emit changectx instances.
902
901
903 This is a convenience wrapper around ``revs()`` that iterates the
902 This is a convenience wrapper around ``revs()`` that iterates the
904 result and is a generator of changectx instances.
903 result and is a generator of changectx instances.
905
904
906 Revset aliases from the configuration are not expanded. To expand
905 Revset aliases from the configuration are not expanded. To expand
907 user aliases, consider calling ``scmutil.revrange()``.
906 user aliases, consider calling ``scmutil.revrange()``.
908 '''
907 '''
909 for r in self.revs(expr, *args):
908 for r in self.revs(expr, *args):
910 yield self[r]
909 yield self[r]
911
910
912 def anyrevs(self, specs, user=False, localalias=None):
911 def anyrevs(self, specs, user=False, localalias=None):
913 '''Find revisions matching one of the given revsets.
912 '''Find revisions matching one of the given revsets.
914
913
915 Revset aliases from the configuration are not expanded by default. To
914 Revset aliases from the configuration are not expanded by default. To
916 expand user aliases, specify ``user=True``. To provide some local
915 expand user aliases, specify ``user=True``. To provide some local
917 definitions overriding user aliases, set ``localalias`` to
916 definitions overriding user aliases, set ``localalias`` to
918 ``{name: definitionstring}``.
917 ``{name: definitionstring}``.
919 '''
918 '''
920 if user:
919 if user:
921 m = revset.matchany(self.ui, specs,
920 m = revset.matchany(self.ui, specs,
922 lookup=revset.lookupfn(self),
921 lookup=revset.lookupfn(self),
923 localalias=localalias)
922 localalias=localalias)
924 else:
923 else:
925 m = revset.matchany(None, specs, localalias=localalias)
924 m = revset.matchany(None, specs, localalias=localalias)
926 return m(self)
925 return m(self)
927
926
928 def url(self):
927 def url(self):
929 return 'file:' + self.root
928 return 'file:' + self.root
930
929
931 def hook(self, name, throw=False, **args):
930 def hook(self, name, throw=False, **args):
932 """Call a hook, passing this repo instance.
931 """Call a hook, passing this repo instance.
933
932
934 This a convenience method to aid invoking hooks. Extensions likely
933 This a convenience method to aid invoking hooks. Extensions likely
935 won't call this unless they have registered a custom hook or are
934 won't call this unless they have registered a custom hook or are
936 replacing code that is expected to call a hook.
935 replacing code that is expected to call a hook.
937 """
936 """
938 return hook.hook(self.ui, self, name, throw, **args)
937 return hook.hook(self.ui, self, name, throw, **args)
939
938
940 @filteredpropertycache
939 @filteredpropertycache
941 def _tagscache(self):
940 def _tagscache(self):
942 '''Returns a tagscache object that contains various tags related
941 '''Returns a tagscache object that contains various tags related
943 caches.'''
942 caches.'''
944
943
945 # This simplifies its cache management by having one decorated
944 # This simplifies its cache management by having one decorated
946 # function (this one) and the rest simply fetch things from it.
945 # function (this one) and the rest simply fetch things from it.
947 class tagscache(object):
946 class tagscache(object):
948 def __init__(self):
947 def __init__(self):
949 # These two define the set of tags for this repository. tags
948 # These two define the set of tags for this repository. tags
950 # maps tag name to node; tagtypes maps tag name to 'global' or
949 # maps tag name to node; tagtypes maps tag name to 'global' or
951 # 'local'. (Global tags are defined by .hgtags across all
950 # 'local'. (Global tags are defined by .hgtags across all
952 # heads, and local tags are defined in .hg/localtags.)
951 # heads, and local tags are defined in .hg/localtags.)
953 # They constitute the in-memory cache of tags.
952 # They constitute the in-memory cache of tags.
954 self.tags = self.tagtypes = None
953 self.tags = self.tagtypes = None
955
954
956 self.nodetagscache = self.tagslist = None
955 self.nodetagscache = self.tagslist = None
957
956
958 cache = tagscache()
957 cache = tagscache()
959 cache.tags, cache.tagtypes = self._findtags()
958 cache.tags, cache.tagtypes = self._findtags()
960
959
961 return cache
960 return cache
962
961
963 def tags(self):
962 def tags(self):
964 '''return a mapping of tag to node'''
963 '''return a mapping of tag to node'''
965 t = {}
964 t = {}
966 if self.changelog.filteredrevs:
965 if self.changelog.filteredrevs:
967 tags, tt = self._findtags()
966 tags, tt = self._findtags()
968 else:
967 else:
969 tags = self._tagscache.tags
968 tags = self._tagscache.tags
970 for k, v in tags.iteritems():
969 for k, v in tags.iteritems():
971 try:
970 try:
972 # ignore tags to unknown nodes
971 # ignore tags to unknown nodes
973 self.changelog.rev(v)
972 self.changelog.rev(v)
974 t[k] = v
973 t[k] = v
975 except (error.LookupError, ValueError):
974 except (error.LookupError, ValueError):
976 pass
975 pass
977 return t
976 return t
978
977
979 def _findtags(self):
978 def _findtags(self):
980 '''Do the hard work of finding tags. Return a pair of dicts
979 '''Do the hard work of finding tags. Return a pair of dicts
981 (tags, tagtypes) where tags maps tag name to node, and tagtypes
980 (tags, tagtypes) where tags maps tag name to node, and tagtypes
982 maps tag name to a string like \'global\' or \'local\'.
981 maps tag name to a string like \'global\' or \'local\'.
983 Subclasses or extensions are free to add their own tags, but
982 Subclasses or extensions are free to add their own tags, but
984 should be aware that the returned dicts will be retained for the
983 should be aware that the returned dicts will be retained for the
985 duration of the localrepo object.'''
984 duration of the localrepo object.'''
986
985
987 # XXX what tagtype should subclasses/extensions use? Currently
986 # XXX what tagtype should subclasses/extensions use? Currently
988 # mq and bookmarks add tags, but do not set the tagtype at all.
987 # mq and bookmarks add tags, but do not set the tagtype at all.
989 # Should each extension invent its own tag type? Should there
988 # Should each extension invent its own tag type? Should there
990 # be one tagtype for all such "virtual" tags? Or is the status
989 # be one tagtype for all such "virtual" tags? Or is the status
991 # quo fine?
990 # quo fine?
992
991
993
992
994 # map tag name to (node, hist)
993 # map tag name to (node, hist)
995 alltags = tagsmod.findglobaltags(self.ui, self)
994 alltags = tagsmod.findglobaltags(self.ui, self)
996 # map tag name to tag type
995 # map tag name to tag type
997 tagtypes = dict((tag, 'global') for tag in alltags)
996 tagtypes = dict((tag, 'global') for tag in alltags)
998
997
999 tagsmod.readlocaltags(self.ui, self, alltags, tagtypes)
998 tagsmod.readlocaltags(self.ui, self, alltags, tagtypes)
1000
999
1001 # Build the return dicts. Have to re-encode tag names because
1000 # Build the return dicts. Have to re-encode tag names because
1002 # the tags module always uses UTF-8 (in order not to lose info
1001 # the tags module always uses UTF-8 (in order not to lose info
1003 # writing to the cache), but the rest of Mercurial wants them in
1002 # writing to the cache), but the rest of Mercurial wants them in
1004 # local encoding.
1003 # local encoding.
1005 tags = {}
1004 tags = {}
1006 for (name, (node, hist)) in alltags.iteritems():
1005 for (name, (node, hist)) in alltags.iteritems():
1007 if node != nullid:
1006 if node != nullid:
1008 tags[encoding.tolocal(name)] = node
1007 tags[encoding.tolocal(name)] = node
1009 tags['tip'] = self.changelog.tip()
1008 tags['tip'] = self.changelog.tip()
1010 tagtypes = dict([(encoding.tolocal(name), value)
1009 tagtypes = dict([(encoding.tolocal(name), value)
1011 for (name, value) in tagtypes.iteritems()])
1010 for (name, value) in tagtypes.iteritems()])
1012 return (tags, tagtypes)
1011 return (tags, tagtypes)
1013
1012
1014 def tagtype(self, tagname):
1013 def tagtype(self, tagname):
1015 '''
1014 '''
1016 return the type of the given tag. result can be:
1015 return the type of the given tag. result can be:
1017
1016
1018 'local' : a local tag
1017 'local' : a local tag
1019 'global' : a global tag
1018 'global' : a global tag
1020 None : tag does not exist
1019 None : tag does not exist
1021 '''
1020 '''
1022
1021
1023 return self._tagscache.tagtypes.get(tagname)
1022 return self._tagscache.tagtypes.get(tagname)
1024
1023
1025 def tagslist(self):
1024 def tagslist(self):
1026 '''return a list of tags ordered by revision'''
1025 '''return a list of tags ordered by revision'''
1027 if not self._tagscache.tagslist:
1026 if not self._tagscache.tagslist:
1028 l = []
1027 l = []
1029 for t, n in self.tags().iteritems():
1028 for t, n in self.tags().iteritems():
1030 l.append((self.changelog.rev(n), t, n))
1029 l.append((self.changelog.rev(n), t, n))
1031 self._tagscache.tagslist = [(t, n) for r, t, n in sorted(l)]
1030 self._tagscache.tagslist = [(t, n) for r, t, n in sorted(l)]
1032
1031
1033 return self._tagscache.tagslist
1032 return self._tagscache.tagslist
1034
1033
1035 def nodetags(self, node):
1034 def nodetags(self, node):
1036 '''return the tags associated with a node'''
1035 '''return the tags associated with a node'''
1037 if not self._tagscache.nodetagscache:
1036 if not self._tagscache.nodetagscache:
1038 nodetagscache = {}
1037 nodetagscache = {}
1039 for t, n in self._tagscache.tags.iteritems():
1038 for t, n in self._tagscache.tags.iteritems():
1040 nodetagscache.setdefault(n, []).append(t)
1039 nodetagscache.setdefault(n, []).append(t)
1041 for tags in nodetagscache.itervalues():
1040 for tags in nodetagscache.itervalues():
1042 tags.sort()
1041 tags.sort()
1043 self._tagscache.nodetagscache = nodetagscache
1042 self._tagscache.nodetagscache = nodetagscache
1044 return self._tagscache.nodetagscache.get(node, [])
1043 return self._tagscache.nodetagscache.get(node, [])
1045
1044
1046 def nodebookmarks(self, node):
1045 def nodebookmarks(self, node):
1047 """return the list of bookmarks pointing to the specified node"""
1046 """return the list of bookmarks pointing to the specified node"""
1048 return self._bookmarks.names(node)
1047 return self._bookmarks.names(node)
1049
1048
1050 def branchmap(self):
1049 def branchmap(self):
1051 '''returns a dictionary {branch: [branchheads]} with branchheads
1050 '''returns a dictionary {branch: [branchheads]} with branchheads
1052 ordered by increasing revision number'''
1051 ordered by increasing revision number'''
1053 branchmap.updatecache(self)
1052 branchmap.updatecache(self)
1054 return self._branchcaches[self.filtername]
1053 return self._branchcaches[self.filtername]
1055
1054
1056 @unfilteredmethod
1055 @unfilteredmethod
1057 def revbranchcache(self):
1056 def revbranchcache(self):
1058 if not self._revbranchcache:
1057 if not self._revbranchcache:
1059 self._revbranchcache = branchmap.revbranchcache(self.unfiltered())
1058 self._revbranchcache = branchmap.revbranchcache(self.unfiltered())
1060 return self._revbranchcache
1059 return self._revbranchcache
1061
1060
1062 def branchtip(self, branch, ignoremissing=False):
1061 def branchtip(self, branch, ignoremissing=False):
1063 '''return the tip node for a given branch
1062 '''return the tip node for a given branch
1064
1063
1065 If ignoremissing is True, then this method will not raise an error.
1064 If ignoremissing is True, then this method will not raise an error.
1066 This is helpful for callers that only expect None for a missing branch
1065 This is helpful for callers that only expect None for a missing branch
1067 (e.g. namespace).
1066 (e.g. namespace).
1068
1067
1069 '''
1068 '''
1070 try:
1069 try:
1071 return self.branchmap().branchtip(branch)
1070 return self.branchmap().branchtip(branch)
1072 except KeyError:
1071 except KeyError:
1073 if not ignoremissing:
1072 if not ignoremissing:
1074 raise error.RepoLookupError(_("unknown branch '%s'") % branch)
1073 raise error.RepoLookupError(_("unknown branch '%s'") % branch)
1075 else:
1074 else:
1076 pass
1075 pass
1077
1076
1078 def lookup(self, key):
1077 def lookup(self, key):
1079 return scmutil.revsymbol(self, key).node()
1078 return scmutil.revsymbol(self, key).node()
1080
1079
1081 def lookupbranch(self, key):
1080 def lookupbranch(self, key):
1082 if key in self.branchmap():
1081 if key in self.branchmap():
1083 return key
1082 return key
1084
1083
1085 return scmutil.revsymbol(self, key).branch()
1084 return scmutil.revsymbol(self, key).branch()
1086
1085
1087 def known(self, nodes):
1086 def known(self, nodes):
1088 cl = self.changelog
1087 cl = self.changelog
1089 nm = cl.nodemap
1088 nm = cl.nodemap
1090 filtered = cl.filteredrevs
1089 filtered = cl.filteredrevs
1091 result = []
1090 result = []
1092 for n in nodes:
1091 for n in nodes:
1093 r = nm.get(n)
1092 r = nm.get(n)
1094 resp = not (r is None or r in filtered)
1093 resp = not (r is None or r in filtered)
1095 result.append(resp)
1094 result.append(resp)
1096 return result
1095 return result
1097
1096
1098 def local(self):
1097 def local(self):
1099 return self
1098 return self
1100
1099
1101 def publishing(self):
1100 def publishing(self):
1102 # it's safe (and desirable) to trust the publish flag unconditionally
1101 # it's safe (and desirable) to trust the publish flag unconditionally
1103 # so that we don't finalize changes shared between users via ssh or nfs
1102 # so that we don't finalize changes shared between users via ssh or nfs
1104 return self.ui.configbool('phases', 'publish', untrusted=True)
1103 return self.ui.configbool('phases', 'publish', untrusted=True)
1105
1104
1106 def cancopy(self):
1105 def cancopy(self):
1107 # so statichttprepo's override of local() works
1106 # so statichttprepo's override of local() works
1108 if not self.local():
1107 if not self.local():
1109 return False
1108 return False
1110 if not self.publishing():
1109 if not self.publishing():
1111 return True
1110 return True
1112 # if publishing we can't copy if there is filtered content
1111 # if publishing we can't copy if there is filtered content
1113 return not self.filtered('visible').changelog.filteredrevs
1112 return not self.filtered('visible').changelog.filteredrevs
1114
1113
1115 def shared(self):
1114 def shared(self):
1116 '''the type of shared repository (None if not shared)'''
1115 '''the type of shared repository (None if not shared)'''
1117 if self.sharedpath != self.path:
1116 if self.sharedpath != self.path:
1118 return 'store'
1117 return 'store'
1119 return None
1118 return None
1120
1119
1121 def wjoin(self, f, *insidef):
1120 def wjoin(self, f, *insidef):
1122 return self.vfs.reljoin(self.root, f, *insidef)
1121 return self.vfs.reljoin(self.root, f, *insidef)
1123
1122
1124 def file(self, f):
1123 def file(self, f):
1125 if f[0] == '/':
1124 if f[0] == '/':
1126 f = f[1:]
1125 f = f[1:]
1127 return filelog.filelog(self.svfs, f)
1126 return filelog.filelog(self.svfs, f)
1128
1127
1129 def setparents(self, p1, p2=nullid):
1128 def setparents(self, p1, p2=nullid):
1130 with self.dirstate.parentchange():
1129 with self.dirstate.parentchange():
1131 copies = self.dirstate.setparents(p1, p2)
1130 copies = self.dirstate.setparents(p1, p2)
1132 pctx = self[p1]
1131 pctx = self[p1]
1133 if copies:
1132 if copies:
1134 # Adjust copy records, the dirstate cannot do it, it
1133 # Adjust copy records, the dirstate cannot do it, it
1135 # requires access to parents manifests. Preserve them
1134 # requires access to parents manifests. Preserve them
1136 # only for entries added to first parent.
1135 # only for entries added to first parent.
1137 for f in copies:
1136 for f in copies:
1138 if f not in pctx and copies[f] in pctx:
1137 if f not in pctx and copies[f] in pctx:
1139 self.dirstate.copy(copies[f], f)
1138 self.dirstate.copy(copies[f], f)
1140 if p2 == nullid:
1139 if p2 == nullid:
1141 for f, s in sorted(self.dirstate.copies().items()):
1140 for f, s in sorted(self.dirstate.copies().items()):
1142 if f not in pctx and s not in pctx:
1141 if f not in pctx and s not in pctx:
1143 self.dirstate.copy(None, f)
1142 self.dirstate.copy(None, f)
1144
1143
1145 def filectx(self, path, changeid=None, fileid=None, changectx=None):
1144 def filectx(self, path, changeid=None, fileid=None, changectx=None):
1146 """changeid can be a changeset revision, node, or tag.
1145 """changeid can be a changeset revision, node, or tag.
1147 fileid can be a file revision or node."""
1146 fileid can be a file revision or node."""
1148 return context.filectx(self, path, changeid, fileid,
1147 return context.filectx(self, path, changeid, fileid,
1149 changectx=changectx)
1148 changectx=changectx)
1150
1149
1151 def getcwd(self):
1150 def getcwd(self):
1152 return self.dirstate.getcwd()
1151 return self.dirstate.getcwd()
1153
1152
1154 def pathto(self, f, cwd=None):
1153 def pathto(self, f, cwd=None):
1155 return self.dirstate.pathto(f, cwd)
1154 return self.dirstate.pathto(f, cwd)
1156
1155
1157 def _loadfilter(self, filter):
1156 def _loadfilter(self, filter):
1158 if filter not in self._filterpats:
1157 if filter not in self._filterpats:
1159 l = []
1158 l = []
1160 for pat, cmd in self.ui.configitems(filter):
1159 for pat, cmd in self.ui.configitems(filter):
1161 if cmd == '!':
1160 if cmd == '!':
1162 continue
1161 continue
1163 mf = matchmod.match(self.root, '', [pat])
1162 mf = matchmod.match(self.root, '', [pat])
1164 fn = None
1163 fn = None
1165 params = cmd
1164 params = cmd
1166 for name, filterfn in self._datafilters.iteritems():
1165 for name, filterfn in self._datafilters.iteritems():
1167 if cmd.startswith(name):
1166 if cmd.startswith(name):
1168 fn = filterfn
1167 fn = filterfn
1169 params = cmd[len(name):].lstrip()
1168 params = cmd[len(name):].lstrip()
1170 break
1169 break
1171 if not fn:
1170 if not fn:
1172 fn = lambda s, c, **kwargs: procutil.filter(s, c)
1171 fn = lambda s, c, **kwargs: procutil.filter(s, c)
1173 # Wrap old filters not supporting keyword arguments
1172 # Wrap old filters not supporting keyword arguments
1174 if not pycompat.getargspec(fn)[2]:
1173 if not pycompat.getargspec(fn)[2]:
1175 oldfn = fn
1174 oldfn = fn
1176 fn = lambda s, c, **kwargs: oldfn(s, c)
1175 fn = lambda s, c, **kwargs: oldfn(s, c)
1177 l.append((mf, fn, params))
1176 l.append((mf, fn, params))
1178 self._filterpats[filter] = l
1177 self._filterpats[filter] = l
1179 return self._filterpats[filter]
1178 return self._filterpats[filter]
1180
1179
1181 def _filter(self, filterpats, filename, data):
1180 def _filter(self, filterpats, filename, data):
1182 for mf, fn, cmd in filterpats:
1181 for mf, fn, cmd in filterpats:
1183 if mf(filename):
1182 if mf(filename):
1184 self.ui.debug("filtering %s through %s\n" % (filename, cmd))
1183 self.ui.debug("filtering %s through %s\n" % (filename, cmd))
1185 data = fn(data, cmd, ui=self.ui, repo=self, filename=filename)
1184 data = fn(data, cmd, ui=self.ui, repo=self, filename=filename)
1186 break
1185 break
1187
1186
1188 return data
1187 return data
1189
1188
1190 @unfilteredpropertycache
1189 @unfilteredpropertycache
1191 def _encodefilterpats(self):
1190 def _encodefilterpats(self):
1192 return self._loadfilter('encode')
1191 return self._loadfilter('encode')
1193
1192
1194 @unfilteredpropertycache
1193 @unfilteredpropertycache
1195 def _decodefilterpats(self):
1194 def _decodefilterpats(self):
1196 return self._loadfilter('decode')
1195 return self._loadfilter('decode')
1197
1196
1198 def adddatafilter(self, name, filter):
1197 def adddatafilter(self, name, filter):
1199 self._datafilters[name] = filter
1198 self._datafilters[name] = filter
1200
1199
1201 def wread(self, filename):
1200 def wread(self, filename):
1202 if self.wvfs.islink(filename):
1201 if self.wvfs.islink(filename):
1203 data = self.wvfs.readlink(filename)
1202 data = self.wvfs.readlink(filename)
1204 else:
1203 else:
1205 data = self.wvfs.read(filename)
1204 data = self.wvfs.read(filename)
1206 return self._filter(self._encodefilterpats, filename, data)
1205 return self._filter(self._encodefilterpats, filename, data)
1207
1206
1208 def wwrite(self, filename, data, flags, backgroundclose=False, **kwargs):
1207 def wwrite(self, filename, data, flags, backgroundclose=False, **kwargs):
1209 """write ``data`` into ``filename`` in the working directory
1208 """write ``data`` into ``filename`` in the working directory
1210
1209
1211 This returns length of written (maybe decoded) data.
1210 This returns length of written (maybe decoded) data.
1212 """
1211 """
1213 data = self._filter(self._decodefilterpats, filename, data)
1212 data = self._filter(self._decodefilterpats, filename, data)
1214 if 'l' in flags:
1213 if 'l' in flags:
1215 self.wvfs.symlink(data, filename)
1214 self.wvfs.symlink(data, filename)
1216 else:
1215 else:
1217 self.wvfs.write(filename, data, backgroundclose=backgroundclose,
1216 self.wvfs.write(filename, data, backgroundclose=backgroundclose,
1218 **kwargs)
1217 **kwargs)
1219 if 'x' in flags:
1218 if 'x' in flags:
1220 self.wvfs.setflags(filename, False, True)
1219 self.wvfs.setflags(filename, False, True)
1221 else:
1220 else:
1222 self.wvfs.setflags(filename, False, False)
1221 self.wvfs.setflags(filename, False, False)
1223 return len(data)
1222 return len(data)
1224
1223
1225 def wwritedata(self, filename, data):
1224 def wwritedata(self, filename, data):
1226 return self._filter(self._decodefilterpats, filename, data)
1225 return self._filter(self._decodefilterpats, filename, data)
1227
1226
1228 def currenttransaction(self):
1227 def currenttransaction(self):
1229 """return the current transaction or None if non exists"""
1228 """return the current transaction or None if non exists"""
1230 if self._transref:
1229 if self._transref:
1231 tr = self._transref()
1230 tr = self._transref()
1232 else:
1231 else:
1233 tr = None
1232 tr = None
1234
1233
1235 if tr and tr.running():
1234 if tr and tr.running():
1236 return tr
1235 return tr
1237 return None
1236 return None
1238
1237
1239 def transaction(self, desc, report=None):
1238 def transaction(self, desc, report=None):
1240 if (self.ui.configbool('devel', 'all-warnings')
1239 if (self.ui.configbool('devel', 'all-warnings')
1241 or self.ui.configbool('devel', 'check-locks')):
1240 or self.ui.configbool('devel', 'check-locks')):
1242 if self._currentlock(self._lockref) is None:
1241 if self._currentlock(self._lockref) is None:
1243 raise error.ProgrammingError('transaction requires locking')
1242 raise error.ProgrammingError('transaction requires locking')
1244 tr = self.currenttransaction()
1243 tr = self.currenttransaction()
1245 if tr is not None:
1244 if tr is not None:
1246 return tr.nest(name=desc)
1245 return tr.nest(name=desc)
1247
1246
1248 # abort here if the journal already exists
1247 # abort here if the journal already exists
1249 if self.svfs.exists("journal"):
1248 if self.svfs.exists("journal"):
1250 raise error.RepoError(
1249 raise error.RepoError(
1251 _("abandoned transaction found"),
1250 _("abandoned transaction found"),
1252 hint=_("run 'hg recover' to clean up transaction"))
1251 hint=_("run 'hg recover' to clean up transaction"))
1253
1252
1254 idbase = "%.40f#%f" % (random.random(), time.time())
1253 idbase = "%.40f#%f" % (random.random(), time.time())
1255 ha = hex(hashlib.sha1(idbase).digest())
1254 ha = hex(hashlib.sha1(idbase).digest())
1256 txnid = 'TXN:' + ha
1255 txnid = 'TXN:' + ha
1257 self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid)
1256 self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid)
1258
1257
1259 self._writejournal(desc)
1258 self._writejournal(desc)
1260 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
1259 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
1261 if report:
1260 if report:
1262 rp = report
1261 rp = report
1263 else:
1262 else:
1264 rp = self.ui.warn
1263 rp = self.ui.warn
1265 vfsmap = {'plain': self.vfs} # root of .hg/
1264 vfsmap = {'plain': self.vfs} # root of .hg/
1266 # we must avoid cyclic reference between repo and transaction.
1265 # we must avoid cyclic reference between repo and transaction.
1267 reporef = weakref.ref(self)
1266 reporef = weakref.ref(self)
1268 # Code to track tag movement
1267 # Code to track tag movement
1269 #
1268 #
1270 # Since tags are all handled as file content, it is actually quite hard
1269 # Since tags are all handled as file content, it is actually quite hard
1271 # to track these movement from a code perspective. So we fallback to a
1270 # to track these movement from a code perspective. So we fallback to a
1272 # tracking at the repository level. One could envision to track changes
1271 # tracking at the repository level. One could envision to track changes
1273 # to the '.hgtags' file through changegroup apply but that fails to
1272 # to the '.hgtags' file through changegroup apply but that fails to
1274 # cope with case where transaction expose new heads without changegroup
1273 # cope with case where transaction expose new heads without changegroup
1275 # being involved (eg: phase movement).
1274 # being involved (eg: phase movement).
1276 #
1275 #
1277 # For now, We gate the feature behind a flag since this likely comes
1276 # For now, We gate the feature behind a flag since this likely comes
1278 # with performance impacts. The current code run more often than needed
1277 # with performance impacts. The current code run more often than needed
1279 # and do not use caches as much as it could. The current focus is on
1278 # and do not use caches as much as it could. The current focus is on
1280 # the behavior of the feature so we disable it by default. The flag
1279 # the behavior of the feature so we disable it by default. The flag
1281 # will be removed when we are happy with the performance impact.
1280 # will be removed when we are happy with the performance impact.
1282 #
1281 #
1283 # Once this feature is no longer experimental move the following
1282 # Once this feature is no longer experimental move the following
1284 # documentation to the appropriate help section:
1283 # documentation to the appropriate help section:
1285 #
1284 #
1286 # The ``HG_TAG_MOVED`` variable will be set if the transaction touched
1285 # The ``HG_TAG_MOVED`` variable will be set if the transaction touched
1287 # tags (new or changed or deleted tags). In addition the details of
1286 # tags (new or changed or deleted tags). In addition the details of
1288 # these changes are made available in a file at:
1287 # these changes are made available in a file at:
1289 # ``REPOROOT/.hg/changes/tags.changes``.
1288 # ``REPOROOT/.hg/changes/tags.changes``.
1290 # Make sure you check for HG_TAG_MOVED before reading that file as it
1289 # Make sure you check for HG_TAG_MOVED before reading that file as it
1291 # might exist from a previous transaction even if no tag were touched
1290 # might exist from a previous transaction even if no tag were touched
1292 # in this one. Changes are recorded in a line base format::
1291 # in this one. Changes are recorded in a line base format::
1293 #
1292 #
1294 # <action> <hex-node> <tag-name>\n
1293 # <action> <hex-node> <tag-name>\n
1295 #
1294 #
1296 # Actions are defined as follow:
1295 # Actions are defined as follow:
1297 # "-R": tag is removed,
1296 # "-R": tag is removed,
1298 # "+A": tag is added,
1297 # "+A": tag is added,
1299 # "-M": tag is moved (old value),
1298 # "-M": tag is moved (old value),
1300 # "+M": tag is moved (new value),
1299 # "+M": tag is moved (new value),
1301 tracktags = lambda x: None
1300 tracktags = lambda x: None
1302 # experimental config: experimental.hook-track-tags
1301 # experimental config: experimental.hook-track-tags
1303 shouldtracktags = self.ui.configbool('experimental', 'hook-track-tags')
1302 shouldtracktags = self.ui.configbool('experimental', 'hook-track-tags')
1304 if desc != 'strip' and shouldtracktags:
1303 if desc != 'strip' and shouldtracktags:
1305 oldheads = self.changelog.headrevs()
1304 oldheads = self.changelog.headrevs()
1306 def tracktags(tr2):
1305 def tracktags(tr2):
1307 repo = reporef()
1306 repo = reporef()
1308 oldfnodes = tagsmod.fnoderevs(repo.ui, repo, oldheads)
1307 oldfnodes = tagsmod.fnoderevs(repo.ui, repo, oldheads)
1309 newheads = repo.changelog.headrevs()
1308 newheads = repo.changelog.headrevs()
1310 newfnodes = tagsmod.fnoderevs(repo.ui, repo, newheads)
1309 newfnodes = tagsmod.fnoderevs(repo.ui, repo, newheads)
1311 # notes: we compare lists here.
1310 # notes: we compare lists here.
1312 # As we do it only once buiding set would not be cheaper
1311 # As we do it only once buiding set would not be cheaper
1313 changes = tagsmod.difftags(repo.ui, repo, oldfnodes, newfnodes)
1312 changes = tagsmod.difftags(repo.ui, repo, oldfnodes, newfnodes)
1314 if changes:
1313 if changes:
1315 tr2.hookargs['tag_moved'] = '1'
1314 tr2.hookargs['tag_moved'] = '1'
1316 with repo.vfs('changes/tags.changes', 'w',
1315 with repo.vfs('changes/tags.changes', 'w',
1317 atomictemp=True) as changesfile:
1316 atomictemp=True) as changesfile:
1318 # note: we do not register the file to the transaction
1317 # note: we do not register the file to the transaction
1319 # because we needs it to still exist on the transaction
1318 # because we needs it to still exist on the transaction
1320 # is close (for txnclose hooks)
1319 # is close (for txnclose hooks)
1321 tagsmod.writediff(changesfile, changes)
1320 tagsmod.writediff(changesfile, changes)
1322 def validate(tr2):
1321 def validate(tr2):
1323 """will run pre-closing hooks"""
1322 """will run pre-closing hooks"""
1324 # XXX the transaction API is a bit lacking here so we take a hacky
1323 # XXX the transaction API is a bit lacking here so we take a hacky
1325 # path for now
1324 # path for now
1326 #
1325 #
1327 # We cannot add this as a "pending" hooks since the 'tr.hookargs'
1326 # We cannot add this as a "pending" hooks since the 'tr.hookargs'
1328 # dict is copied before these run. In addition we needs the data
1327 # dict is copied before these run. In addition we needs the data
1329 # available to in memory hooks too.
1328 # available to in memory hooks too.
1330 #
1329 #
1331 # Moreover, we also need to make sure this runs before txnclose
1330 # Moreover, we also need to make sure this runs before txnclose
1332 # hooks and there is no "pending" mechanism that would execute
1331 # hooks and there is no "pending" mechanism that would execute
1333 # logic only if hooks are about to run.
1332 # logic only if hooks are about to run.
1334 #
1333 #
1335 # Fixing this limitation of the transaction is also needed to track
1334 # Fixing this limitation of the transaction is also needed to track
1336 # other families of changes (bookmarks, phases, obsolescence).
1335 # other families of changes (bookmarks, phases, obsolescence).
1337 #
1336 #
1338 # This will have to be fixed before we remove the experimental
1337 # This will have to be fixed before we remove the experimental
1339 # gating.
1338 # gating.
1340 tracktags(tr2)
1339 tracktags(tr2)
1341 repo = reporef()
1340 repo = reporef()
1342 if repo.ui.configbool('experimental', 'single-head-per-branch'):
1341 if repo.ui.configbool('experimental', 'single-head-per-branch'):
1343 scmutil.enforcesinglehead(repo, tr2, desc)
1342 scmutil.enforcesinglehead(repo, tr2, desc)
1344 if hook.hashook(repo.ui, 'pretxnclose-bookmark'):
1343 if hook.hashook(repo.ui, 'pretxnclose-bookmark'):
1345 for name, (old, new) in sorted(tr.changes['bookmarks'].items()):
1344 for name, (old, new) in sorted(tr.changes['bookmarks'].items()):
1346 args = tr.hookargs.copy()
1345 args = tr.hookargs.copy()
1347 args.update(bookmarks.preparehookargs(name, old, new))
1346 args.update(bookmarks.preparehookargs(name, old, new))
1348 repo.hook('pretxnclose-bookmark', throw=True,
1347 repo.hook('pretxnclose-bookmark', throw=True,
1349 txnname=desc,
1348 txnname=desc,
1350 **pycompat.strkwargs(args))
1349 **pycompat.strkwargs(args))
1351 if hook.hashook(repo.ui, 'pretxnclose-phase'):
1350 if hook.hashook(repo.ui, 'pretxnclose-phase'):
1352 cl = repo.unfiltered().changelog
1351 cl = repo.unfiltered().changelog
1353 for rev, (old, new) in tr.changes['phases'].items():
1352 for rev, (old, new) in tr.changes['phases'].items():
1354 args = tr.hookargs.copy()
1353 args = tr.hookargs.copy()
1355 node = hex(cl.node(rev))
1354 node = hex(cl.node(rev))
1356 args.update(phases.preparehookargs(node, old, new))
1355 args.update(phases.preparehookargs(node, old, new))
1357 repo.hook('pretxnclose-phase', throw=True, txnname=desc,
1356 repo.hook('pretxnclose-phase', throw=True, txnname=desc,
1358 **pycompat.strkwargs(args))
1357 **pycompat.strkwargs(args))
1359
1358
1360 repo.hook('pretxnclose', throw=True,
1359 repo.hook('pretxnclose', throw=True,
1361 txnname=desc, **pycompat.strkwargs(tr.hookargs))
1360 txnname=desc, **pycompat.strkwargs(tr.hookargs))
1362 def releasefn(tr, success):
1361 def releasefn(tr, success):
1363 repo = reporef()
1362 repo = reporef()
1364 if success:
1363 if success:
1365 # this should be explicitly invoked here, because
1364 # this should be explicitly invoked here, because
1366 # in-memory changes aren't written out at closing
1365 # in-memory changes aren't written out at closing
1367 # transaction, if tr.addfilegenerator (via
1366 # transaction, if tr.addfilegenerator (via
1368 # dirstate.write or so) isn't invoked while
1367 # dirstate.write or so) isn't invoked while
1369 # transaction running
1368 # transaction running
1370 repo.dirstate.write(None)
1369 repo.dirstate.write(None)
1371 else:
1370 else:
1372 # discard all changes (including ones already written
1371 # discard all changes (including ones already written
1373 # out) in this transaction
1372 # out) in this transaction
1374 repo.dirstate.restorebackup(None, 'journal.dirstate')
1373 repo.dirstate.restorebackup(None, 'journal.dirstate')
1375
1374
1376 repo.invalidate(clearfilecache=True)
1375 repo.invalidate(clearfilecache=True)
1377
1376
1378 tr = transaction.transaction(rp, self.svfs, vfsmap,
1377 tr = transaction.transaction(rp, self.svfs, vfsmap,
1379 "journal",
1378 "journal",
1380 "undo",
1379 "undo",
1381 aftertrans(renames),
1380 aftertrans(renames),
1382 self.store.createmode,
1381 self.store.createmode,
1383 validator=validate,
1382 validator=validate,
1384 releasefn=releasefn,
1383 releasefn=releasefn,
1385 checkambigfiles=_cachedfiles,
1384 checkambigfiles=_cachedfiles,
1386 name=desc)
1385 name=desc)
1387 tr.changes['revs'] = xrange(0, 0)
1386 tr.changes['revs'] = xrange(0, 0)
1388 tr.changes['obsmarkers'] = set()
1387 tr.changes['obsmarkers'] = set()
1389 tr.changes['phases'] = {}
1388 tr.changes['phases'] = {}
1390 tr.changes['bookmarks'] = {}
1389 tr.changes['bookmarks'] = {}
1391
1390
1392 tr.hookargs['txnid'] = txnid
1391 tr.hookargs['txnid'] = txnid
1393 # note: writing the fncache only during finalize mean that the file is
1392 # note: writing the fncache only during finalize mean that the file is
1394 # outdated when running hooks. As fncache is used for streaming clone,
1393 # outdated when running hooks. As fncache is used for streaming clone,
1395 # this is not expected to break anything that happen during the hooks.
1394 # this is not expected to break anything that happen during the hooks.
1396 tr.addfinalize('flush-fncache', self.store.write)
1395 tr.addfinalize('flush-fncache', self.store.write)
1397 def txnclosehook(tr2):
1396 def txnclosehook(tr2):
1398 """To be run if transaction is successful, will schedule a hook run
1397 """To be run if transaction is successful, will schedule a hook run
1399 """
1398 """
1400 # Don't reference tr2 in hook() so we don't hold a reference.
1399 # Don't reference tr2 in hook() so we don't hold a reference.
1401 # This reduces memory consumption when there are multiple
1400 # This reduces memory consumption when there are multiple
1402 # transactions per lock. This can likely go away if issue5045
1401 # transactions per lock. This can likely go away if issue5045
1403 # fixes the function accumulation.
1402 # fixes the function accumulation.
1404 hookargs = tr2.hookargs
1403 hookargs = tr2.hookargs
1405
1404
1406 def hookfunc():
1405 def hookfunc():
1407 repo = reporef()
1406 repo = reporef()
1408 if hook.hashook(repo.ui, 'txnclose-bookmark'):
1407 if hook.hashook(repo.ui, 'txnclose-bookmark'):
1409 bmchanges = sorted(tr.changes['bookmarks'].items())
1408 bmchanges = sorted(tr.changes['bookmarks'].items())
1410 for name, (old, new) in bmchanges:
1409 for name, (old, new) in bmchanges:
1411 args = tr.hookargs.copy()
1410 args = tr.hookargs.copy()
1412 args.update(bookmarks.preparehookargs(name, old, new))
1411 args.update(bookmarks.preparehookargs(name, old, new))
1413 repo.hook('txnclose-bookmark', throw=False,
1412 repo.hook('txnclose-bookmark', throw=False,
1414 txnname=desc, **pycompat.strkwargs(args))
1413 txnname=desc, **pycompat.strkwargs(args))
1415
1414
1416 if hook.hashook(repo.ui, 'txnclose-phase'):
1415 if hook.hashook(repo.ui, 'txnclose-phase'):
1417 cl = repo.unfiltered().changelog
1416 cl = repo.unfiltered().changelog
1418 phasemv = sorted(tr.changes['phases'].items())
1417 phasemv = sorted(tr.changes['phases'].items())
1419 for rev, (old, new) in phasemv:
1418 for rev, (old, new) in phasemv:
1420 args = tr.hookargs.copy()
1419 args = tr.hookargs.copy()
1421 node = hex(cl.node(rev))
1420 node = hex(cl.node(rev))
1422 args.update(phases.preparehookargs(node, old, new))
1421 args.update(phases.preparehookargs(node, old, new))
1423 repo.hook('txnclose-phase', throw=False, txnname=desc,
1422 repo.hook('txnclose-phase', throw=False, txnname=desc,
1424 **pycompat.strkwargs(args))
1423 **pycompat.strkwargs(args))
1425
1424
1426 repo.hook('txnclose', throw=False, txnname=desc,
1425 repo.hook('txnclose', throw=False, txnname=desc,
1427 **pycompat.strkwargs(hookargs))
1426 **pycompat.strkwargs(hookargs))
1428 reporef()._afterlock(hookfunc)
1427 reporef()._afterlock(hookfunc)
1429 tr.addfinalize('txnclose-hook', txnclosehook)
1428 tr.addfinalize('txnclose-hook', txnclosehook)
1430 # Include a leading "-" to make it happen before the transaction summary
1429 # Include a leading "-" to make it happen before the transaction summary
1431 # reports registered via scmutil.registersummarycallback() whose names
1430 # reports registered via scmutil.registersummarycallback() whose names
1432 # are 00-txnreport etc. That way, the caches will be warm when the
1431 # are 00-txnreport etc. That way, the caches will be warm when the
1433 # callbacks run.
1432 # callbacks run.
1434 tr.addpostclose('-warm-cache', self._buildcacheupdater(tr))
1433 tr.addpostclose('-warm-cache', self._buildcacheupdater(tr))
1435 def txnaborthook(tr2):
1434 def txnaborthook(tr2):
1436 """To be run if transaction is aborted
1435 """To be run if transaction is aborted
1437 """
1436 """
1438 reporef().hook('txnabort', throw=False, txnname=desc,
1437 reporef().hook('txnabort', throw=False, txnname=desc,
1439 **pycompat.strkwargs(tr2.hookargs))
1438 **pycompat.strkwargs(tr2.hookargs))
1440 tr.addabort('txnabort-hook', txnaborthook)
1439 tr.addabort('txnabort-hook', txnaborthook)
1441 # avoid eager cache invalidation. in-memory data should be identical
1440 # avoid eager cache invalidation. in-memory data should be identical
1442 # to stored data if transaction has no error.
1441 # to stored data if transaction has no error.
1443 tr.addpostclose('refresh-filecachestats', self._refreshfilecachestats)
1442 tr.addpostclose('refresh-filecachestats', self._refreshfilecachestats)
1444 self._transref = weakref.ref(tr)
1443 self._transref = weakref.ref(tr)
1445 scmutil.registersummarycallback(self, tr, desc)
1444 scmutil.registersummarycallback(self, tr, desc)
1446 return tr
1445 return tr
1447
1446
1448 def _journalfiles(self):
1447 def _journalfiles(self):
1449 return ((self.svfs, 'journal'),
1448 return ((self.svfs, 'journal'),
1450 (self.vfs, 'journal.dirstate'),
1449 (self.vfs, 'journal.dirstate'),
1451 (self.vfs, 'journal.branch'),
1450 (self.vfs, 'journal.branch'),
1452 (self.vfs, 'journal.desc'),
1451 (self.vfs, 'journal.desc'),
1453 (self.vfs, 'journal.bookmarks'),
1452 (self.vfs, 'journal.bookmarks'),
1454 (self.svfs, 'journal.phaseroots'))
1453 (self.svfs, 'journal.phaseroots'))
1455
1454
1456 def undofiles(self):
1455 def undofiles(self):
1457 return [(vfs, undoname(x)) for vfs, x in self._journalfiles()]
1456 return [(vfs, undoname(x)) for vfs, x in self._journalfiles()]
1458
1457
1459 @unfilteredmethod
1458 @unfilteredmethod
1460 def _writejournal(self, desc):
1459 def _writejournal(self, desc):
1461 self.dirstate.savebackup(None, 'journal.dirstate')
1460 self.dirstate.savebackup(None, 'journal.dirstate')
1462 self.vfs.write("journal.branch",
1461 self.vfs.write("journal.branch",
1463 encoding.fromlocal(self.dirstate.branch()))
1462 encoding.fromlocal(self.dirstate.branch()))
1464 self.vfs.write("journal.desc",
1463 self.vfs.write("journal.desc",
1465 "%d\n%s\n" % (len(self), desc))
1464 "%d\n%s\n" % (len(self), desc))
1466 self.vfs.write("journal.bookmarks",
1465 self.vfs.write("journal.bookmarks",
1467 self.vfs.tryread("bookmarks"))
1466 self.vfs.tryread("bookmarks"))
1468 self.svfs.write("journal.phaseroots",
1467 self.svfs.write("journal.phaseroots",
1469 self.svfs.tryread("phaseroots"))
1468 self.svfs.tryread("phaseroots"))
1470
1469
1471 def recover(self):
1470 def recover(self):
1472 with self.lock():
1471 with self.lock():
1473 if self.svfs.exists("journal"):
1472 if self.svfs.exists("journal"):
1474 self.ui.status(_("rolling back interrupted transaction\n"))
1473 self.ui.status(_("rolling back interrupted transaction\n"))
1475 vfsmap = {'': self.svfs,
1474 vfsmap = {'': self.svfs,
1476 'plain': self.vfs,}
1475 'plain': self.vfs,}
1477 transaction.rollback(self.svfs, vfsmap, "journal",
1476 transaction.rollback(self.svfs, vfsmap, "journal",
1478 self.ui.warn,
1477 self.ui.warn,
1479 checkambigfiles=_cachedfiles)
1478 checkambigfiles=_cachedfiles)
1480 self.invalidate()
1479 self.invalidate()
1481 return True
1480 return True
1482 else:
1481 else:
1483 self.ui.warn(_("no interrupted transaction available\n"))
1482 self.ui.warn(_("no interrupted transaction available\n"))
1484 return False
1483 return False
1485
1484
1486 def rollback(self, dryrun=False, force=False):
1485 def rollback(self, dryrun=False, force=False):
1487 wlock = lock = dsguard = None
1486 wlock = lock = dsguard = None
1488 try:
1487 try:
1489 wlock = self.wlock()
1488 wlock = self.wlock()
1490 lock = self.lock()
1489 lock = self.lock()
1491 if self.svfs.exists("undo"):
1490 if self.svfs.exists("undo"):
1492 dsguard = dirstateguard.dirstateguard(self, 'rollback')
1491 dsguard = dirstateguard.dirstateguard(self, 'rollback')
1493
1492
1494 return self._rollback(dryrun, force, dsguard)
1493 return self._rollback(dryrun, force, dsguard)
1495 else:
1494 else:
1496 self.ui.warn(_("no rollback information available\n"))
1495 self.ui.warn(_("no rollback information available\n"))
1497 return 1
1496 return 1
1498 finally:
1497 finally:
1499 release(dsguard, lock, wlock)
1498 release(dsguard, lock, wlock)
1500
1499
1501 @unfilteredmethod # Until we get smarter cache management
1500 @unfilteredmethod # Until we get smarter cache management
1502 def _rollback(self, dryrun, force, dsguard):
1501 def _rollback(self, dryrun, force, dsguard):
1503 ui = self.ui
1502 ui = self.ui
1504 try:
1503 try:
1505 args = self.vfs.read('undo.desc').splitlines()
1504 args = self.vfs.read('undo.desc').splitlines()
1506 (oldlen, desc, detail) = (int(args[0]), args[1], None)
1505 (oldlen, desc, detail) = (int(args[0]), args[1], None)
1507 if len(args) >= 3:
1506 if len(args) >= 3:
1508 detail = args[2]
1507 detail = args[2]
1509 oldtip = oldlen - 1
1508 oldtip = oldlen - 1
1510
1509
1511 if detail and ui.verbose:
1510 if detail and ui.verbose:
1512 msg = (_('repository tip rolled back to revision %d'
1511 msg = (_('repository tip rolled back to revision %d'
1513 ' (undo %s: %s)\n')
1512 ' (undo %s: %s)\n')
1514 % (oldtip, desc, detail))
1513 % (oldtip, desc, detail))
1515 else:
1514 else:
1516 msg = (_('repository tip rolled back to revision %d'
1515 msg = (_('repository tip rolled back to revision %d'
1517 ' (undo %s)\n')
1516 ' (undo %s)\n')
1518 % (oldtip, desc))
1517 % (oldtip, desc))
1519 except IOError:
1518 except IOError:
1520 msg = _('rolling back unknown transaction\n')
1519 msg = _('rolling back unknown transaction\n')
1521 desc = None
1520 desc = None
1522
1521
1523 if not force and self['.'] != self['tip'] and desc == 'commit':
1522 if not force and self['.'] != self['tip'] and desc == 'commit':
1524 raise error.Abort(
1523 raise error.Abort(
1525 _('rollback of last commit while not checked out '
1524 _('rollback of last commit while not checked out '
1526 'may lose data'), hint=_('use -f to force'))
1525 'may lose data'), hint=_('use -f to force'))
1527
1526
1528 ui.status(msg)
1527 ui.status(msg)
1529 if dryrun:
1528 if dryrun:
1530 return 0
1529 return 0
1531
1530
1532 parents = self.dirstate.parents()
1531 parents = self.dirstate.parents()
1533 self.destroying()
1532 self.destroying()
1534 vfsmap = {'plain': self.vfs, '': self.svfs}
1533 vfsmap = {'plain': self.vfs, '': self.svfs}
1535 transaction.rollback(self.svfs, vfsmap, 'undo', ui.warn,
1534 transaction.rollback(self.svfs, vfsmap, 'undo', ui.warn,
1536 checkambigfiles=_cachedfiles)
1535 checkambigfiles=_cachedfiles)
1537 if self.vfs.exists('undo.bookmarks'):
1536 if self.vfs.exists('undo.bookmarks'):
1538 self.vfs.rename('undo.bookmarks', 'bookmarks', checkambig=True)
1537 self.vfs.rename('undo.bookmarks', 'bookmarks', checkambig=True)
1539 if self.svfs.exists('undo.phaseroots'):
1538 if self.svfs.exists('undo.phaseroots'):
1540 self.svfs.rename('undo.phaseroots', 'phaseroots', checkambig=True)
1539 self.svfs.rename('undo.phaseroots', 'phaseroots', checkambig=True)
1541 self.invalidate()
1540 self.invalidate()
1542
1541
1543 parentgone = (parents[0] not in self.changelog.nodemap or
1542 parentgone = (parents[0] not in self.changelog.nodemap or
1544 parents[1] not in self.changelog.nodemap)
1543 parents[1] not in self.changelog.nodemap)
1545 if parentgone:
1544 if parentgone:
1546 # prevent dirstateguard from overwriting already restored one
1545 # prevent dirstateguard from overwriting already restored one
1547 dsguard.close()
1546 dsguard.close()
1548
1547
1549 self.dirstate.restorebackup(None, 'undo.dirstate')
1548 self.dirstate.restorebackup(None, 'undo.dirstate')
1550 try:
1549 try:
1551 branch = self.vfs.read('undo.branch')
1550 branch = self.vfs.read('undo.branch')
1552 self.dirstate.setbranch(encoding.tolocal(branch))
1551 self.dirstate.setbranch(encoding.tolocal(branch))
1553 except IOError:
1552 except IOError:
1554 ui.warn(_('named branch could not be reset: '
1553 ui.warn(_('named branch could not be reset: '
1555 'current branch is still \'%s\'\n')
1554 'current branch is still \'%s\'\n')
1556 % self.dirstate.branch())
1555 % self.dirstate.branch())
1557
1556
1558 parents = tuple([p.rev() for p in self[None].parents()])
1557 parents = tuple([p.rev() for p in self[None].parents()])
1559 if len(parents) > 1:
1558 if len(parents) > 1:
1560 ui.status(_('working directory now based on '
1559 ui.status(_('working directory now based on '
1561 'revisions %d and %d\n') % parents)
1560 'revisions %d and %d\n') % parents)
1562 else:
1561 else:
1563 ui.status(_('working directory now based on '
1562 ui.status(_('working directory now based on '
1564 'revision %d\n') % parents)
1563 'revision %d\n') % parents)
1565 mergemod.mergestate.clean(self, self['.'].node())
1564 mergemod.mergestate.clean(self, self['.'].node())
1566
1565
1567 # TODO: if we know which new heads may result from this rollback, pass
1566 # TODO: if we know which new heads may result from this rollback, pass
1568 # them to destroy(), which will prevent the branchhead cache from being
1567 # them to destroy(), which will prevent the branchhead cache from being
1569 # invalidated.
1568 # invalidated.
1570 self.destroyed()
1569 self.destroyed()
1571 return 0
1570 return 0
1572
1571
1573 def _buildcacheupdater(self, newtransaction):
1572 def _buildcacheupdater(self, newtransaction):
1574 """called during transaction to build the callback updating cache
1573 """called during transaction to build the callback updating cache
1575
1574
1576 Lives on the repository to help extension who might want to augment
1575 Lives on the repository to help extension who might want to augment
1577 this logic. For this purpose, the created transaction is passed to the
1576 this logic. For this purpose, the created transaction is passed to the
1578 method.
1577 method.
1579 """
1578 """
1580 # we must avoid cyclic reference between repo and transaction.
1579 # we must avoid cyclic reference between repo and transaction.
1581 reporef = weakref.ref(self)
1580 reporef = weakref.ref(self)
1582 def updater(tr):
1581 def updater(tr):
1583 repo = reporef()
1582 repo = reporef()
1584 repo.updatecaches(tr)
1583 repo.updatecaches(tr)
1585 return updater
1584 return updater
1586
1585
1587 @unfilteredmethod
1586 @unfilteredmethod
1588 def updatecaches(self, tr=None, full=False):
1587 def updatecaches(self, tr=None, full=False):
1589 """warm appropriate caches
1588 """warm appropriate caches
1590
1589
1591 If this function is called after a transaction closed. The transaction
1590 If this function is called after a transaction closed. The transaction
1592 will be available in the 'tr' argument. This can be used to selectively
1591 will be available in the 'tr' argument. This can be used to selectively
1593 update caches relevant to the changes in that transaction.
1592 update caches relevant to the changes in that transaction.
1594
1593
1595 If 'full' is set, make sure all caches the function knows about have
1594 If 'full' is set, make sure all caches the function knows about have
1596 up-to-date data. Even the ones usually loaded more lazily.
1595 up-to-date data. Even the ones usually loaded more lazily.
1597 """
1596 """
1598 if tr is not None and tr.hookargs.get('source') == 'strip':
1597 if tr is not None and tr.hookargs.get('source') == 'strip':
1599 # During strip, many caches are invalid but
1598 # During strip, many caches are invalid but
1600 # later call to `destroyed` will refresh them.
1599 # later call to `destroyed` will refresh them.
1601 return
1600 return
1602
1601
1603 if tr is None or tr.changes['revs']:
1602 if tr is None or tr.changes['revs']:
1604 # updating the unfiltered branchmap should refresh all the others,
1603 # updating the unfiltered branchmap should refresh all the others,
1605 self.ui.debug('updating the branch cache\n')
1604 self.ui.debug('updating the branch cache\n')
1606 branchmap.updatecache(self.filtered('served'))
1605 branchmap.updatecache(self.filtered('served'))
1607
1606
1608 if full:
1607 if full:
1609 rbc = self.revbranchcache()
1608 rbc = self.revbranchcache()
1610 for r in self.changelog:
1609 for r in self.changelog:
1611 rbc.branchinfo(r)
1610 rbc.branchinfo(r)
1612 rbc.write()
1611 rbc.write()
1613
1612
1614 def invalidatecaches(self):
1613 def invalidatecaches(self):
1615
1614
1616 if '_tagscache' in vars(self):
1615 if '_tagscache' in vars(self):
1617 # can't use delattr on proxy
1616 # can't use delattr on proxy
1618 del self.__dict__['_tagscache']
1617 del self.__dict__['_tagscache']
1619
1618
1620 self.unfiltered()._branchcaches.clear()
1619 self.unfiltered()._branchcaches.clear()
1621 self.invalidatevolatilesets()
1620 self.invalidatevolatilesets()
1622 self._sparsesignaturecache.clear()
1621 self._sparsesignaturecache.clear()
1623
1622
1624 def invalidatevolatilesets(self):
1623 def invalidatevolatilesets(self):
1625 self.filteredrevcache.clear()
1624 self.filteredrevcache.clear()
1626 obsolete.clearobscaches(self)
1625 obsolete.clearobscaches(self)
1627
1626
1628 def invalidatedirstate(self):
1627 def invalidatedirstate(self):
1629 '''Invalidates the dirstate, causing the next call to dirstate
1628 '''Invalidates the dirstate, causing the next call to dirstate
1630 to check if it was modified since the last time it was read,
1629 to check if it was modified since the last time it was read,
1631 rereading it if it has.
1630 rereading it if it has.
1632
1631
1633 This is different to dirstate.invalidate() that it doesn't always
1632 This is different to dirstate.invalidate() that it doesn't always
1634 rereads the dirstate. Use dirstate.invalidate() if you want to
1633 rereads the dirstate. Use dirstate.invalidate() if you want to
1635 explicitly read the dirstate again (i.e. restoring it to a previous
1634 explicitly read the dirstate again (i.e. restoring it to a previous
1636 known good state).'''
1635 known good state).'''
1637 if hasunfilteredcache(self, 'dirstate'):
1636 if hasunfilteredcache(self, 'dirstate'):
1638 for k in self.dirstate._filecache:
1637 for k in self.dirstate._filecache:
1639 try:
1638 try:
1640 delattr(self.dirstate, k)
1639 delattr(self.dirstate, k)
1641 except AttributeError:
1640 except AttributeError:
1642 pass
1641 pass
1643 delattr(self.unfiltered(), 'dirstate')
1642 delattr(self.unfiltered(), 'dirstate')
1644
1643
1645 def invalidate(self, clearfilecache=False):
1644 def invalidate(self, clearfilecache=False):
1646 '''Invalidates both store and non-store parts other than dirstate
1645 '''Invalidates both store and non-store parts other than dirstate
1647
1646
1648 If a transaction is running, invalidation of store is omitted,
1647 If a transaction is running, invalidation of store is omitted,
1649 because discarding in-memory changes might cause inconsistency
1648 because discarding in-memory changes might cause inconsistency
1650 (e.g. incomplete fncache causes unintentional failure, but
1649 (e.g. incomplete fncache causes unintentional failure, but
1651 redundant one doesn't).
1650 redundant one doesn't).
1652 '''
1651 '''
1653 unfiltered = self.unfiltered() # all file caches are stored unfiltered
1652 unfiltered = self.unfiltered() # all file caches are stored unfiltered
1654 for k in list(self._filecache.keys()):
1653 for k in list(self._filecache.keys()):
1655 # dirstate is invalidated separately in invalidatedirstate()
1654 # dirstate is invalidated separately in invalidatedirstate()
1656 if k == 'dirstate':
1655 if k == 'dirstate':
1657 continue
1656 continue
1658 if (k == 'changelog' and
1657 if (k == 'changelog' and
1659 self.currenttransaction() and
1658 self.currenttransaction() and
1660 self.changelog._delayed):
1659 self.changelog._delayed):
1661 # The changelog object may store unwritten revisions. We don't
1660 # The changelog object may store unwritten revisions. We don't
1662 # want to lose them.
1661 # want to lose them.
1663 # TODO: Solve the problem instead of working around it.
1662 # TODO: Solve the problem instead of working around it.
1664 continue
1663 continue
1665
1664
1666 if clearfilecache:
1665 if clearfilecache:
1667 del self._filecache[k]
1666 del self._filecache[k]
1668 try:
1667 try:
1669 delattr(unfiltered, k)
1668 delattr(unfiltered, k)
1670 except AttributeError:
1669 except AttributeError:
1671 pass
1670 pass
1672 self.invalidatecaches()
1671 self.invalidatecaches()
1673 if not self.currenttransaction():
1672 if not self.currenttransaction():
1674 # TODO: Changing contents of store outside transaction
1673 # TODO: Changing contents of store outside transaction
1675 # causes inconsistency. We should make in-memory store
1674 # causes inconsistency. We should make in-memory store
1676 # changes detectable, and abort if changed.
1675 # changes detectable, and abort if changed.
1677 self.store.invalidatecaches()
1676 self.store.invalidatecaches()
1678
1677
1679 def invalidateall(self):
1678 def invalidateall(self):
1680 '''Fully invalidates both store and non-store parts, causing the
1679 '''Fully invalidates both store and non-store parts, causing the
1681 subsequent operation to reread any outside changes.'''
1680 subsequent operation to reread any outside changes.'''
1682 # extension should hook this to invalidate its caches
1681 # extension should hook this to invalidate its caches
1683 self.invalidate()
1682 self.invalidate()
1684 self.invalidatedirstate()
1683 self.invalidatedirstate()
1685
1684
1686 @unfilteredmethod
1685 @unfilteredmethod
1687 def _refreshfilecachestats(self, tr):
1686 def _refreshfilecachestats(self, tr):
1688 """Reload stats of cached files so that they are flagged as valid"""
1687 """Reload stats of cached files so that they are flagged as valid"""
1689 for k, ce in self._filecache.items():
1688 for k, ce in self._filecache.items():
1690 k = pycompat.sysstr(k)
1689 k = pycompat.sysstr(k)
1691 if k == r'dirstate' or k not in self.__dict__:
1690 if k == r'dirstate' or k not in self.__dict__:
1692 continue
1691 continue
1693 ce.refresh()
1692 ce.refresh()
1694
1693
1695 def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc,
1694 def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc,
1696 inheritchecker=None, parentenvvar=None):
1695 inheritchecker=None, parentenvvar=None):
1697 parentlock = None
1696 parentlock = None
1698 # the contents of parentenvvar are used by the underlying lock to
1697 # the contents of parentenvvar are used by the underlying lock to
1699 # determine whether it can be inherited
1698 # determine whether it can be inherited
1700 if parentenvvar is not None:
1699 if parentenvvar is not None:
1701 parentlock = encoding.environ.get(parentenvvar)
1700 parentlock = encoding.environ.get(parentenvvar)
1702
1701
1703 timeout = 0
1702 timeout = 0
1704 warntimeout = 0
1703 warntimeout = 0
1705 if wait:
1704 if wait:
1706 timeout = self.ui.configint("ui", "timeout")
1705 timeout = self.ui.configint("ui", "timeout")
1707 warntimeout = self.ui.configint("ui", "timeout.warn")
1706 warntimeout = self.ui.configint("ui", "timeout.warn")
1708 # internal config: ui.signal-safe-lock
1707 # internal config: ui.signal-safe-lock
1709 signalsafe = self.ui.configbool('ui', 'signal-safe-lock')
1708 signalsafe = self.ui.configbool('ui', 'signal-safe-lock')
1710
1709
1711 l = lockmod.trylock(self.ui, vfs, lockname, timeout, warntimeout,
1710 l = lockmod.trylock(self.ui, vfs, lockname, timeout, warntimeout,
1712 releasefn=releasefn,
1711 releasefn=releasefn,
1713 acquirefn=acquirefn, desc=desc,
1712 acquirefn=acquirefn, desc=desc,
1714 inheritchecker=inheritchecker,
1713 inheritchecker=inheritchecker,
1715 parentlock=parentlock,
1714 parentlock=parentlock,
1716 signalsafe=signalsafe)
1715 signalsafe=signalsafe)
1717 return l
1716 return l
1718
1717
1719 def _afterlock(self, callback):
1718 def _afterlock(self, callback):
1720 """add a callback to be run when the repository is fully unlocked
1719 """add a callback to be run when the repository is fully unlocked
1721
1720
1722 The callback will be executed when the outermost lock is released
1721 The callback will be executed when the outermost lock is released
1723 (with wlock being higher level than 'lock')."""
1722 (with wlock being higher level than 'lock')."""
1724 for ref in (self._wlockref, self._lockref):
1723 for ref in (self._wlockref, self._lockref):
1725 l = ref and ref()
1724 l = ref and ref()
1726 if l and l.held:
1725 if l and l.held:
1727 l.postrelease.append(callback)
1726 l.postrelease.append(callback)
1728 break
1727 break
1729 else: # no lock have been found.
1728 else: # no lock have been found.
1730 callback()
1729 callback()
1731
1730
1732 def lock(self, wait=True):
1731 def lock(self, wait=True):
1733 '''Lock the repository store (.hg/store) and return a weak reference
1732 '''Lock the repository store (.hg/store) and return a weak reference
1734 to the lock. Use this before modifying the store (e.g. committing or
1733 to the lock. Use this before modifying the store (e.g. committing or
1735 stripping). If you are opening a transaction, get a lock as well.)
1734 stripping). If you are opening a transaction, get a lock as well.)
1736
1735
1737 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
1736 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
1738 'wlock' first to avoid a dead-lock hazard.'''
1737 'wlock' first to avoid a dead-lock hazard.'''
1739 l = self._currentlock(self._lockref)
1738 l = self._currentlock(self._lockref)
1740 if l is not None:
1739 if l is not None:
1741 l.lock()
1740 l.lock()
1742 return l
1741 return l
1743
1742
1744 l = self._lock(self.svfs, "lock", wait, None,
1743 l = self._lock(self.svfs, "lock", wait, None,
1745 self.invalidate, _('repository %s') % self.origroot)
1744 self.invalidate, _('repository %s') % self.origroot)
1746 self._lockref = weakref.ref(l)
1745 self._lockref = weakref.ref(l)
1747 return l
1746 return l
1748
1747
1749 def _wlockchecktransaction(self):
1748 def _wlockchecktransaction(self):
1750 if self.currenttransaction() is not None:
1749 if self.currenttransaction() is not None:
1751 raise error.LockInheritanceContractViolation(
1750 raise error.LockInheritanceContractViolation(
1752 'wlock cannot be inherited in the middle of a transaction')
1751 'wlock cannot be inherited in the middle of a transaction')
1753
1752
1754 def wlock(self, wait=True):
1753 def wlock(self, wait=True):
1755 '''Lock the non-store parts of the repository (everything under
1754 '''Lock the non-store parts of the repository (everything under
1756 .hg except .hg/store) and return a weak reference to the lock.
1755 .hg except .hg/store) and return a weak reference to the lock.
1757
1756
1758 Use this before modifying files in .hg.
1757 Use this before modifying files in .hg.
1759
1758
1760 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
1759 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
1761 'wlock' first to avoid a dead-lock hazard.'''
1760 'wlock' first to avoid a dead-lock hazard.'''
1762 l = self._wlockref and self._wlockref()
1761 l = self._wlockref and self._wlockref()
1763 if l is not None and l.held:
1762 if l is not None and l.held:
1764 l.lock()
1763 l.lock()
1765 return l
1764 return l
1766
1765
1767 # We do not need to check for non-waiting lock acquisition. Such
1766 # We do not need to check for non-waiting lock acquisition. Such
1768 # acquisition would not cause dead-lock as they would just fail.
1767 # acquisition would not cause dead-lock as they would just fail.
1769 if wait and (self.ui.configbool('devel', 'all-warnings')
1768 if wait and (self.ui.configbool('devel', 'all-warnings')
1770 or self.ui.configbool('devel', 'check-locks')):
1769 or self.ui.configbool('devel', 'check-locks')):
1771 if self._currentlock(self._lockref) is not None:
1770 if self._currentlock(self._lockref) is not None:
1772 self.ui.develwarn('"wlock" acquired after "lock"')
1771 self.ui.develwarn('"wlock" acquired after "lock"')
1773
1772
1774 def unlock():
1773 def unlock():
1775 if self.dirstate.pendingparentchange():
1774 if self.dirstate.pendingparentchange():
1776 self.dirstate.invalidate()
1775 self.dirstate.invalidate()
1777 else:
1776 else:
1778 self.dirstate.write(None)
1777 self.dirstate.write(None)
1779
1778
1780 self._filecache['dirstate'].refresh()
1779 self._filecache['dirstate'].refresh()
1781
1780
1782 l = self._lock(self.vfs, "wlock", wait, unlock,
1781 l = self._lock(self.vfs, "wlock", wait, unlock,
1783 self.invalidatedirstate, _('working directory of %s') %
1782 self.invalidatedirstate, _('working directory of %s') %
1784 self.origroot,
1783 self.origroot,
1785 inheritchecker=self._wlockchecktransaction,
1784 inheritchecker=self._wlockchecktransaction,
1786 parentenvvar='HG_WLOCK_LOCKER')
1785 parentenvvar='HG_WLOCK_LOCKER')
1787 self._wlockref = weakref.ref(l)
1786 self._wlockref = weakref.ref(l)
1788 return l
1787 return l
1789
1788
1790 def _currentlock(self, lockref):
1789 def _currentlock(self, lockref):
1791 """Returns the lock if it's held, or None if it's not."""
1790 """Returns the lock if it's held, or None if it's not."""
1792 if lockref is None:
1791 if lockref is None:
1793 return None
1792 return None
1794 l = lockref()
1793 l = lockref()
1795 if l is None or not l.held:
1794 if l is None or not l.held:
1796 return None
1795 return None
1797 return l
1796 return l
1798
1797
1799 def currentwlock(self):
1798 def currentwlock(self):
1800 """Returns the wlock if it's held, or None if it's not."""
1799 """Returns the wlock if it's held, or None if it's not."""
1801 return self._currentlock(self._wlockref)
1800 return self._currentlock(self._wlockref)
1802
1801
1803 def _filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist):
1802 def _filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist):
1804 """
1803 """
1805 commit an individual file as part of a larger transaction
1804 commit an individual file as part of a larger transaction
1806 """
1805 """
1807
1806
1808 fname = fctx.path()
1807 fname = fctx.path()
1809 fparent1 = manifest1.get(fname, nullid)
1808 fparent1 = manifest1.get(fname, nullid)
1810 fparent2 = manifest2.get(fname, nullid)
1809 fparent2 = manifest2.get(fname, nullid)
1811 if isinstance(fctx, context.filectx):
1810 if isinstance(fctx, context.filectx):
1812 node = fctx.filenode()
1811 node = fctx.filenode()
1813 if node in [fparent1, fparent2]:
1812 if node in [fparent1, fparent2]:
1814 self.ui.debug('reusing %s filelog entry\n' % fname)
1813 self.ui.debug('reusing %s filelog entry\n' % fname)
1815 if manifest1.flags(fname) != fctx.flags():
1814 if manifest1.flags(fname) != fctx.flags():
1816 changelist.append(fname)
1815 changelist.append(fname)
1817 return node
1816 return node
1818
1817
1819 flog = self.file(fname)
1818 flog = self.file(fname)
1820 meta = {}
1819 meta = {}
1821 copy = fctx.renamed()
1820 copy = fctx.renamed()
1822 if copy and copy[0] != fname:
1821 if copy and copy[0] != fname:
1823 # Mark the new revision of this file as a copy of another
1822 # Mark the new revision of this file as a copy of another
1824 # file. This copy data will effectively act as a parent
1823 # file. This copy data will effectively act as a parent
1825 # of this new revision. If this is a merge, the first
1824 # of this new revision. If this is a merge, the first
1826 # parent will be the nullid (meaning "look up the copy data")
1825 # parent will be the nullid (meaning "look up the copy data")
1827 # and the second one will be the other parent. For example:
1826 # and the second one will be the other parent. For example:
1828 #
1827 #
1829 # 0 --- 1 --- 3 rev1 changes file foo
1828 # 0 --- 1 --- 3 rev1 changes file foo
1830 # \ / rev2 renames foo to bar and changes it
1829 # \ / rev2 renames foo to bar and changes it
1831 # \- 2 -/ rev3 should have bar with all changes and
1830 # \- 2 -/ rev3 should have bar with all changes and
1832 # should record that bar descends from
1831 # should record that bar descends from
1833 # bar in rev2 and foo in rev1
1832 # bar in rev2 and foo in rev1
1834 #
1833 #
1835 # this allows this merge to succeed:
1834 # this allows this merge to succeed:
1836 #
1835 #
1837 # 0 --- 1 --- 3 rev4 reverts the content change from rev2
1836 # 0 --- 1 --- 3 rev4 reverts the content change from rev2
1838 # \ / merging rev3 and rev4 should use bar@rev2
1837 # \ / merging rev3 and rev4 should use bar@rev2
1839 # \- 2 --- 4 as the merge base
1838 # \- 2 --- 4 as the merge base
1840 #
1839 #
1841
1840
1842 cfname = copy[0]
1841 cfname = copy[0]
1843 crev = manifest1.get(cfname)
1842 crev = manifest1.get(cfname)
1844 newfparent = fparent2
1843 newfparent = fparent2
1845
1844
1846 if manifest2: # branch merge
1845 if manifest2: # branch merge
1847 if fparent2 == nullid or crev is None: # copied on remote side
1846 if fparent2 == nullid or crev is None: # copied on remote side
1848 if cfname in manifest2:
1847 if cfname in manifest2:
1849 crev = manifest2[cfname]
1848 crev = manifest2[cfname]
1850 newfparent = fparent1
1849 newfparent = fparent1
1851
1850
1852 # Here, we used to search backwards through history to try to find
1851 # Here, we used to search backwards through history to try to find
1853 # where the file copy came from if the source of a copy was not in
1852 # where the file copy came from if the source of a copy was not in
1854 # the parent directory. However, this doesn't actually make sense to
1853 # the parent directory. However, this doesn't actually make sense to
1855 # do (what does a copy from something not in your working copy even
1854 # do (what does a copy from something not in your working copy even
1856 # mean?) and it causes bugs (eg, issue4476). Instead, we will warn
1855 # mean?) and it causes bugs (eg, issue4476). Instead, we will warn
1857 # the user that copy information was dropped, so if they didn't
1856 # the user that copy information was dropped, so if they didn't
1858 # expect this outcome it can be fixed, but this is the correct
1857 # expect this outcome it can be fixed, but this is the correct
1859 # behavior in this circumstance.
1858 # behavior in this circumstance.
1860
1859
1861 if crev:
1860 if crev:
1862 self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev)))
1861 self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev)))
1863 meta["copy"] = cfname
1862 meta["copy"] = cfname
1864 meta["copyrev"] = hex(crev)
1863 meta["copyrev"] = hex(crev)
1865 fparent1, fparent2 = nullid, newfparent
1864 fparent1, fparent2 = nullid, newfparent
1866 else:
1865 else:
1867 self.ui.warn(_("warning: can't find ancestor for '%s' "
1866 self.ui.warn(_("warning: can't find ancestor for '%s' "
1868 "copied from '%s'!\n") % (fname, cfname))
1867 "copied from '%s'!\n") % (fname, cfname))
1869
1868
1870 elif fparent1 == nullid:
1869 elif fparent1 == nullid:
1871 fparent1, fparent2 = fparent2, nullid
1870 fparent1, fparent2 = fparent2, nullid
1872 elif fparent2 != nullid:
1871 elif fparent2 != nullid:
1873 # is one parent an ancestor of the other?
1872 # is one parent an ancestor of the other?
1874 fparentancestors = flog.commonancestorsheads(fparent1, fparent2)
1873 fparentancestors = flog.commonancestorsheads(fparent1, fparent2)
1875 if fparent1 in fparentancestors:
1874 if fparent1 in fparentancestors:
1876 fparent1, fparent2 = fparent2, nullid
1875 fparent1, fparent2 = fparent2, nullid
1877 elif fparent2 in fparentancestors:
1876 elif fparent2 in fparentancestors:
1878 fparent2 = nullid
1877 fparent2 = nullid
1879
1878
1880 # is the file changed?
1879 # is the file changed?
1881 text = fctx.data()
1880 text = fctx.data()
1882 if fparent2 != nullid or flog.cmp(fparent1, text) or meta:
1881 if fparent2 != nullid or flog.cmp(fparent1, text) or meta:
1883 changelist.append(fname)
1882 changelist.append(fname)
1884 return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
1883 return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
1885 # are just the flags changed during merge?
1884 # are just the flags changed during merge?
1886 elif fname in manifest1 and manifest1.flags(fname) != fctx.flags():
1885 elif fname in manifest1 and manifest1.flags(fname) != fctx.flags():
1887 changelist.append(fname)
1886 changelist.append(fname)
1888
1887
1889 return fparent1
1888 return fparent1
1890
1889
1891 def checkcommitpatterns(self, wctx, vdirs, match, status, fail):
1890 def checkcommitpatterns(self, wctx, vdirs, match, status, fail):
1892 """check for commit arguments that aren't committable"""
1891 """check for commit arguments that aren't committable"""
1893 if match.isexact() or match.prefix():
1892 if match.isexact() or match.prefix():
1894 matched = set(status.modified + status.added + status.removed)
1893 matched = set(status.modified + status.added + status.removed)
1895
1894
1896 for f in match.files():
1895 for f in match.files():
1897 f = self.dirstate.normalize(f)
1896 f = self.dirstate.normalize(f)
1898 if f == '.' or f in matched or f in wctx.substate:
1897 if f == '.' or f in matched or f in wctx.substate:
1899 continue
1898 continue
1900 if f in status.deleted:
1899 if f in status.deleted:
1901 fail(f, _('file not found!'))
1900 fail(f, _('file not found!'))
1902 if f in vdirs: # visited directory
1901 if f in vdirs: # visited directory
1903 d = f + '/'
1902 d = f + '/'
1904 for mf in matched:
1903 for mf in matched:
1905 if mf.startswith(d):
1904 if mf.startswith(d):
1906 break
1905 break
1907 else:
1906 else:
1908 fail(f, _("no match under directory!"))
1907 fail(f, _("no match under directory!"))
1909 elif f not in self.dirstate:
1908 elif f not in self.dirstate:
1910 fail(f, _("file not tracked!"))
1909 fail(f, _("file not tracked!"))
1911
1910
1912 @unfilteredmethod
1911 @unfilteredmethod
1913 def commit(self, text="", user=None, date=None, match=None, force=False,
1912 def commit(self, text="", user=None, date=None, match=None, force=False,
1914 editor=False, extra=None):
1913 editor=False, extra=None):
1915 """Add a new revision to current repository.
1914 """Add a new revision to current repository.
1916
1915
1917 Revision information is gathered from the working directory,
1916 Revision information is gathered from the working directory,
1918 match can be used to filter the committed files. If editor is
1917 match can be used to filter the committed files. If editor is
1919 supplied, it is called to get a commit message.
1918 supplied, it is called to get a commit message.
1920 """
1919 """
1921 if extra is None:
1920 if extra is None:
1922 extra = {}
1921 extra = {}
1923
1922
1924 def fail(f, msg):
1923 def fail(f, msg):
1925 raise error.Abort('%s: %s' % (f, msg))
1924 raise error.Abort('%s: %s' % (f, msg))
1926
1925
1927 if not match:
1926 if not match:
1928 match = matchmod.always(self.root, '')
1927 match = matchmod.always(self.root, '')
1929
1928
1930 if not force:
1929 if not force:
1931 vdirs = []
1930 vdirs = []
1932 match.explicitdir = vdirs.append
1931 match.explicitdir = vdirs.append
1933 match.bad = fail
1932 match.bad = fail
1934
1933
1935 wlock = lock = tr = None
1934 wlock = lock = tr = None
1936 try:
1935 try:
1937 wlock = self.wlock()
1936 wlock = self.wlock()
1938 lock = self.lock() # for recent changelog (see issue4368)
1937 lock = self.lock() # for recent changelog (see issue4368)
1939
1938
1940 wctx = self[None]
1939 wctx = self[None]
1941 merge = len(wctx.parents()) > 1
1940 merge = len(wctx.parents()) > 1
1942
1941
1943 if not force and merge and not match.always():
1942 if not force and merge and not match.always():
1944 raise error.Abort(_('cannot partially commit a merge '
1943 raise error.Abort(_('cannot partially commit a merge '
1945 '(do not specify files or patterns)'))
1944 '(do not specify files or patterns)'))
1946
1945
1947 status = self.status(match=match, clean=force)
1946 status = self.status(match=match, clean=force)
1948 if force:
1947 if force:
1949 status.modified.extend(status.clean) # mq may commit clean files
1948 status.modified.extend(status.clean) # mq may commit clean files
1950
1949
1951 # check subrepos
1950 # check subrepos
1952 subs, commitsubs, newstate = subrepoutil.precommit(
1951 subs, commitsubs, newstate = subrepoutil.precommit(
1953 self.ui, wctx, status, match, force=force)
1952 self.ui, wctx, status, match, force=force)
1954
1953
1955 # make sure all explicit patterns are matched
1954 # make sure all explicit patterns are matched
1956 if not force:
1955 if not force:
1957 self.checkcommitpatterns(wctx, vdirs, match, status, fail)
1956 self.checkcommitpatterns(wctx, vdirs, match, status, fail)
1958
1957
1959 cctx = context.workingcommitctx(self, status,
1958 cctx = context.workingcommitctx(self, status,
1960 text, user, date, extra)
1959 text, user, date, extra)
1961
1960
1962 # internal config: ui.allowemptycommit
1961 # internal config: ui.allowemptycommit
1963 allowemptycommit = (wctx.branch() != wctx.p1().branch()
1962 allowemptycommit = (wctx.branch() != wctx.p1().branch()
1964 or extra.get('close') or merge or cctx.files()
1963 or extra.get('close') or merge or cctx.files()
1965 or self.ui.configbool('ui', 'allowemptycommit'))
1964 or self.ui.configbool('ui', 'allowemptycommit'))
1966 if not allowemptycommit:
1965 if not allowemptycommit:
1967 return None
1966 return None
1968
1967
1969 if merge and cctx.deleted():
1968 if merge and cctx.deleted():
1970 raise error.Abort(_("cannot commit merge with missing files"))
1969 raise error.Abort(_("cannot commit merge with missing files"))
1971
1970
1972 ms = mergemod.mergestate.read(self)
1971 ms = mergemod.mergestate.read(self)
1973 mergeutil.checkunresolved(ms)
1972 mergeutil.checkunresolved(ms)
1974
1973
1975 if editor:
1974 if editor:
1976 cctx._text = editor(self, cctx, subs)
1975 cctx._text = editor(self, cctx, subs)
1977 edited = (text != cctx._text)
1976 edited = (text != cctx._text)
1978
1977
1979 # Save commit message in case this transaction gets rolled back
1978 # Save commit message in case this transaction gets rolled back
1980 # (e.g. by a pretxncommit hook). Leave the content alone on
1979 # (e.g. by a pretxncommit hook). Leave the content alone on
1981 # the assumption that the user will use the same editor again.
1980 # the assumption that the user will use the same editor again.
1982 msgfn = self.savecommitmessage(cctx._text)
1981 msgfn = self.savecommitmessage(cctx._text)
1983
1982
1984 # commit subs and write new state
1983 # commit subs and write new state
1985 if subs:
1984 if subs:
1986 for s in sorted(commitsubs):
1985 for s in sorted(commitsubs):
1987 sub = wctx.sub(s)
1986 sub = wctx.sub(s)
1988 self.ui.status(_('committing subrepository %s\n') %
1987 self.ui.status(_('committing subrepository %s\n') %
1989 subrepoutil.subrelpath(sub))
1988 subrepoutil.subrelpath(sub))
1990 sr = sub.commit(cctx._text, user, date)
1989 sr = sub.commit(cctx._text, user, date)
1991 newstate[s] = (newstate[s][0], sr)
1990 newstate[s] = (newstate[s][0], sr)
1992 subrepoutil.writestate(self, newstate)
1991 subrepoutil.writestate(self, newstate)
1993
1992
1994 p1, p2 = self.dirstate.parents()
1993 p1, p2 = self.dirstate.parents()
1995 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
1994 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
1996 try:
1995 try:
1997 self.hook("precommit", throw=True, parent1=hookp1,
1996 self.hook("precommit", throw=True, parent1=hookp1,
1998 parent2=hookp2)
1997 parent2=hookp2)
1999 tr = self.transaction('commit')
1998 tr = self.transaction('commit')
2000 ret = self.commitctx(cctx, True)
1999 ret = self.commitctx(cctx, True)
2001 except: # re-raises
2000 except: # re-raises
2002 if edited:
2001 if edited:
2003 self.ui.write(
2002 self.ui.write(
2004 _('note: commit message saved in %s\n') % msgfn)
2003 _('note: commit message saved in %s\n') % msgfn)
2005 raise
2004 raise
2006 # update bookmarks, dirstate and mergestate
2005 # update bookmarks, dirstate and mergestate
2007 bookmarks.update(self, [p1, p2], ret)
2006 bookmarks.update(self, [p1, p2], ret)
2008 cctx.markcommitted(ret)
2007 cctx.markcommitted(ret)
2009 ms.reset()
2008 ms.reset()
2010 tr.close()
2009 tr.close()
2011
2010
2012 finally:
2011 finally:
2013 lockmod.release(tr, lock, wlock)
2012 lockmod.release(tr, lock, wlock)
2014
2013
2015 def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2):
2014 def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2):
2016 # hack for command that use a temporary commit (eg: histedit)
2015 # hack for command that use a temporary commit (eg: histedit)
2017 # temporary commit got stripped before hook release
2016 # temporary commit got stripped before hook release
2018 if self.changelog.hasnode(ret):
2017 if self.changelog.hasnode(ret):
2019 self.hook("commit", node=node, parent1=parent1,
2018 self.hook("commit", node=node, parent1=parent1,
2020 parent2=parent2)
2019 parent2=parent2)
2021 self._afterlock(commithook)
2020 self._afterlock(commithook)
2022 return ret
2021 return ret
2023
2022
2024 @unfilteredmethod
2023 @unfilteredmethod
2025 def commitctx(self, ctx, error=False):
2024 def commitctx(self, ctx, error=False):
2026 """Add a new revision to current repository.
2025 """Add a new revision to current repository.
2027 Revision information is passed via the context argument.
2026 Revision information is passed via the context argument.
2028 """
2027 """
2029
2028
2030 tr = None
2029 tr = None
2031 p1, p2 = ctx.p1(), ctx.p2()
2030 p1, p2 = ctx.p1(), ctx.p2()
2032 user = ctx.user()
2031 user = ctx.user()
2033
2032
2034 lock = self.lock()
2033 lock = self.lock()
2035 try:
2034 try:
2036 tr = self.transaction("commit")
2035 tr = self.transaction("commit")
2037 trp = weakref.proxy(tr)
2036 trp = weakref.proxy(tr)
2038
2037
2039 if ctx.manifestnode():
2038 if ctx.manifestnode():
2040 # reuse an existing manifest revision
2039 # reuse an existing manifest revision
2041 mn = ctx.manifestnode()
2040 mn = ctx.manifestnode()
2042 files = ctx.files()
2041 files = ctx.files()
2043 elif ctx.files():
2042 elif ctx.files():
2044 m1ctx = p1.manifestctx()
2043 m1ctx = p1.manifestctx()
2045 m2ctx = p2.manifestctx()
2044 m2ctx = p2.manifestctx()
2046 mctx = m1ctx.copy()
2045 mctx = m1ctx.copy()
2047
2046
2048 m = mctx.read()
2047 m = mctx.read()
2049 m1 = m1ctx.read()
2048 m1 = m1ctx.read()
2050 m2 = m2ctx.read()
2049 m2 = m2ctx.read()
2051
2050
2052 # check in files
2051 # check in files
2053 added = []
2052 added = []
2054 changed = []
2053 changed = []
2055 removed = list(ctx.removed())
2054 removed = list(ctx.removed())
2056 linkrev = len(self)
2055 linkrev = len(self)
2057 self.ui.note(_("committing files:\n"))
2056 self.ui.note(_("committing files:\n"))
2058 for f in sorted(ctx.modified() + ctx.added()):
2057 for f in sorted(ctx.modified() + ctx.added()):
2059 self.ui.note(f + "\n")
2058 self.ui.note(f + "\n")
2060 try:
2059 try:
2061 fctx = ctx[f]
2060 fctx = ctx[f]
2062 if fctx is None:
2061 if fctx is None:
2063 removed.append(f)
2062 removed.append(f)
2064 else:
2063 else:
2065 added.append(f)
2064 added.append(f)
2066 m[f] = self._filecommit(fctx, m1, m2, linkrev,
2065 m[f] = self._filecommit(fctx, m1, m2, linkrev,
2067 trp, changed)
2066 trp, changed)
2068 m.setflag(f, fctx.flags())
2067 m.setflag(f, fctx.flags())
2069 except OSError as inst:
2068 except OSError as inst:
2070 self.ui.warn(_("trouble committing %s!\n") % f)
2069 self.ui.warn(_("trouble committing %s!\n") % f)
2071 raise
2070 raise
2072 except IOError as inst:
2071 except IOError as inst:
2073 errcode = getattr(inst, 'errno', errno.ENOENT)
2072 errcode = getattr(inst, 'errno', errno.ENOENT)
2074 if error or errcode and errcode != errno.ENOENT:
2073 if error or errcode and errcode != errno.ENOENT:
2075 self.ui.warn(_("trouble committing %s!\n") % f)
2074 self.ui.warn(_("trouble committing %s!\n") % f)
2076 raise
2075 raise
2077
2076
2078 # update manifest
2077 # update manifest
2079 self.ui.note(_("committing manifest\n"))
2078 self.ui.note(_("committing manifest\n"))
2080 removed = [f for f in sorted(removed) if f in m1 or f in m2]
2079 removed = [f for f in sorted(removed) if f in m1 or f in m2]
2081 drop = [f for f in removed if f in m]
2080 drop = [f for f in removed if f in m]
2082 for f in drop:
2081 for f in drop:
2083 del m[f]
2082 del m[f]
2084 mn = mctx.write(trp, linkrev,
2083 mn = mctx.write(trp, linkrev,
2085 p1.manifestnode(), p2.manifestnode(),
2084 p1.manifestnode(), p2.manifestnode(),
2086 added, drop)
2085 added, drop)
2087 files = changed + removed
2086 files = changed + removed
2088 else:
2087 else:
2089 mn = p1.manifestnode()
2088 mn = p1.manifestnode()
2090 files = []
2089 files = []
2091
2090
2092 # update changelog
2091 # update changelog
2093 self.ui.note(_("committing changelog\n"))
2092 self.ui.note(_("committing changelog\n"))
2094 self.changelog.delayupdate(tr)
2093 self.changelog.delayupdate(tr)
2095 n = self.changelog.add(mn, files, ctx.description(),
2094 n = self.changelog.add(mn, files, ctx.description(),
2096 trp, p1.node(), p2.node(),
2095 trp, p1.node(), p2.node(),
2097 user, ctx.date(), ctx.extra().copy())
2096 user, ctx.date(), ctx.extra().copy())
2098 xp1, xp2 = p1.hex(), p2 and p2.hex() or ''
2097 xp1, xp2 = p1.hex(), p2 and p2.hex() or ''
2099 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
2098 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
2100 parent2=xp2)
2099 parent2=xp2)
2101 # set the new commit is proper phase
2100 # set the new commit is proper phase
2102 targetphase = subrepoutil.newcommitphase(self.ui, ctx)
2101 targetphase = subrepoutil.newcommitphase(self.ui, ctx)
2103 if targetphase:
2102 if targetphase:
2104 # retract boundary do not alter parent changeset.
2103 # retract boundary do not alter parent changeset.
2105 # if a parent have higher the resulting phase will
2104 # if a parent have higher the resulting phase will
2106 # be compliant anyway
2105 # be compliant anyway
2107 #
2106 #
2108 # if minimal phase was 0 we don't need to retract anything
2107 # if minimal phase was 0 we don't need to retract anything
2109 phases.registernew(self, tr, targetphase, [n])
2108 phases.registernew(self, tr, targetphase, [n])
2110 tr.close()
2109 tr.close()
2111 return n
2110 return n
2112 finally:
2111 finally:
2113 if tr:
2112 if tr:
2114 tr.release()
2113 tr.release()
2115 lock.release()
2114 lock.release()
2116
2115
2117 @unfilteredmethod
2116 @unfilteredmethod
2118 def destroying(self):
2117 def destroying(self):
2119 '''Inform the repository that nodes are about to be destroyed.
2118 '''Inform the repository that nodes are about to be destroyed.
2120 Intended for use by strip and rollback, so there's a common
2119 Intended for use by strip and rollback, so there's a common
2121 place for anything that has to be done before destroying history.
2120 place for anything that has to be done before destroying history.
2122
2121
2123 This is mostly useful for saving state that is in memory and waiting
2122 This is mostly useful for saving state that is in memory and waiting
2124 to be flushed when the current lock is released. Because a call to
2123 to be flushed when the current lock is released. Because a call to
2125 destroyed is imminent, the repo will be invalidated causing those
2124 destroyed is imminent, the repo will be invalidated causing those
2126 changes to stay in memory (waiting for the next unlock), or vanish
2125 changes to stay in memory (waiting for the next unlock), or vanish
2127 completely.
2126 completely.
2128 '''
2127 '''
2129 # When using the same lock to commit and strip, the phasecache is left
2128 # When using the same lock to commit and strip, the phasecache is left
2130 # dirty after committing. Then when we strip, the repo is invalidated,
2129 # dirty after committing. Then when we strip, the repo is invalidated,
2131 # causing those changes to disappear.
2130 # causing those changes to disappear.
2132 if '_phasecache' in vars(self):
2131 if '_phasecache' in vars(self):
2133 self._phasecache.write()
2132 self._phasecache.write()
2134
2133
2135 @unfilteredmethod
2134 @unfilteredmethod
2136 def destroyed(self):
2135 def destroyed(self):
2137 '''Inform the repository that nodes have been destroyed.
2136 '''Inform the repository that nodes have been destroyed.
2138 Intended for use by strip and rollback, so there's a common
2137 Intended for use by strip and rollback, so there's a common
2139 place for anything that has to be done after destroying history.
2138 place for anything that has to be done after destroying history.
2140 '''
2139 '''
2141 # When one tries to:
2140 # When one tries to:
2142 # 1) destroy nodes thus calling this method (e.g. strip)
2141 # 1) destroy nodes thus calling this method (e.g. strip)
2143 # 2) use phasecache somewhere (e.g. commit)
2142 # 2) use phasecache somewhere (e.g. commit)
2144 #
2143 #
2145 # then 2) will fail because the phasecache contains nodes that were
2144 # then 2) will fail because the phasecache contains nodes that were
2146 # removed. We can either remove phasecache from the filecache,
2145 # removed. We can either remove phasecache from the filecache,
2147 # causing it to reload next time it is accessed, or simply filter
2146 # causing it to reload next time it is accessed, or simply filter
2148 # the removed nodes now and write the updated cache.
2147 # the removed nodes now and write the updated cache.
2149 self._phasecache.filterunknown(self)
2148 self._phasecache.filterunknown(self)
2150 self._phasecache.write()
2149 self._phasecache.write()
2151
2150
2152 # refresh all repository caches
2151 # refresh all repository caches
2153 self.updatecaches()
2152 self.updatecaches()
2154
2153
2155 # Ensure the persistent tag cache is updated. Doing it now
2154 # Ensure the persistent tag cache is updated. Doing it now
2156 # means that the tag cache only has to worry about destroyed
2155 # means that the tag cache only has to worry about destroyed
2157 # heads immediately after a strip/rollback. That in turn
2156 # heads immediately after a strip/rollback. That in turn
2158 # guarantees that "cachetip == currenttip" (comparing both rev
2157 # guarantees that "cachetip == currenttip" (comparing both rev
2159 # and node) always means no nodes have been added or destroyed.
2158 # and node) always means no nodes have been added or destroyed.
2160
2159
2161 # XXX this is suboptimal when qrefresh'ing: we strip the current
2160 # XXX this is suboptimal when qrefresh'ing: we strip the current
2162 # head, refresh the tag cache, then immediately add a new head.
2161 # head, refresh the tag cache, then immediately add a new head.
2163 # But I think doing it this way is necessary for the "instant
2162 # But I think doing it this way is necessary for the "instant
2164 # tag cache retrieval" case to work.
2163 # tag cache retrieval" case to work.
2165 self.invalidate()
2164 self.invalidate()
2166
2165
2167 def status(self, node1='.', node2=None, match=None,
2166 def status(self, node1='.', node2=None, match=None,
2168 ignored=False, clean=False, unknown=False,
2167 ignored=False, clean=False, unknown=False,
2169 listsubrepos=False):
2168 listsubrepos=False):
2170 '''a convenience method that calls node1.status(node2)'''
2169 '''a convenience method that calls node1.status(node2)'''
2171 return self[node1].status(node2, match, ignored, clean, unknown,
2170 return self[node1].status(node2, match, ignored, clean, unknown,
2172 listsubrepos)
2171 listsubrepos)
2173
2172
2174 def addpostdsstatus(self, ps):
2173 def addpostdsstatus(self, ps):
2175 """Add a callback to run within the wlock, at the point at which status
2174 """Add a callback to run within the wlock, at the point at which status
2176 fixups happen.
2175 fixups happen.
2177
2176
2178 On status completion, callback(wctx, status) will be called with the
2177 On status completion, callback(wctx, status) will be called with the
2179 wlock held, unless the dirstate has changed from underneath or the wlock
2178 wlock held, unless the dirstate has changed from underneath or the wlock
2180 couldn't be grabbed.
2179 couldn't be grabbed.
2181
2180
2182 Callbacks should not capture and use a cached copy of the dirstate --
2181 Callbacks should not capture and use a cached copy of the dirstate --
2183 it might change in the meanwhile. Instead, they should access the
2182 it might change in the meanwhile. Instead, they should access the
2184 dirstate via wctx.repo().dirstate.
2183 dirstate via wctx.repo().dirstate.
2185
2184
2186 This list is emptied out after each status run -- extensions should
2185 This list is emptied out after each status run -- extensions should
2187 make sure it adds to this list each time dirstate.status is called.
2186 make sure it adds to this list each time dirstate.status is called.
2188 Extensions should also make sure they don't call this for statuses
2187 Extensions should also make sure they don't call this for statuses
2189 that don't involve the dirstate.
2188 that don't involve the dirstate.
2190 """
2189 """
2191
2190
2192 # The list is located here for uniqueness reasons -- it is actually
2191 # The list is located here for uniqueness reasons -- it is actually
2193 # managed by the workingctx, but that isn't unique per-repo.
2192 # managed by the workingctx, but that isn't unique per-repo.
2194 self._postdsstatus.append(ps)
2193 self._postdsstatus.append(ps)
2195
2194
2196 def postdsstatus(self):
2195 def postdsstatus(self):
2197 """Used by workingctx to get the list of post-dirstate-status hooks."""
2196 """Used by workingctx to get the list of post-dirstate-status hooks."""
2198 return self._postdsstatus
2197 return self._postdsstatus
2199
2198
2200 def clearpostdsstatus(self):
2199 def clearpostdsstatus(self):
2201 """Used by workingctx to clear post-dirstate-status hooks."""
2200 """Used by workingctx to clear post-dirstate-status hooks."""
2202 del self._postdsstatus[:]
2201 del self._postdsstatus[:]
2203
2202
2204 def heads(self, start=None):
2203 def heads(self, start=None):
2205 if start is None:
2204 if start is None:
2206 cl = self.changelog
2205 cl = self.changelog
2207 headrevs = reversed(cl.headrevs())
2206 headrevs = reversed(cl.headrevs())
2208 return [cl.node(rev) for rev in headrevs]
2207 return [cl.node(rev) for rev in headrevs]
2209
2208
2210 heads = self.changelog.heads(start)
2209 heads = self.changelog.heads(start)
2211 # sort the output in rev descending order
2210 # sort the output in rev descending order
2212 return sorted(heads, key=self.changelog.rev, reverse=True)
2211 return sorted(heads, key=self.changelog.rev, reverse=True)
2213
2212
2214 def branchheads(self, branch=None, start=None, closed=False):
2213 def branchheads(self, branch=None, start=None, closed=False):
2215 '''return a (possibly filtered) list of heads for the given branch
2214 '''return a (possibly filtered) list of heads for the given branch
2216
2215
2217 Heads are returned in topological order, from newest to oldest.
2216 Heads are returned in topological order, from newest to oldest.
2218 If branch is None, use the dirstate branch.
2217 If branch is None, use the dirstate branch.
2219 If start is not None, return only heads reachable from start.
2218 If start is not None, return only heads reachable from start.
2220 If closed is True, return heads that are marked as closed as well.
2219 If closed is True, return heads that are marked as closed as well.
2221 '''
2220 '''
2222 if branch is None:
2221 if branch is None:
2223 branch = self[None].branch()
2222 branch = self[None].branch()
2224 branches = self.branchmap()
2223 branches = self.branchmap()
2225 if branch not in branches:
2224 if branch not in branches:
2226 return []
2225 return []
2227 # the cache returns heads ordered lowest to highest
2226 # the cache returns heads ordered lowest to highest
2228 bheads = list(reversed(branches.branchheads(branch, closed=closed)))
2227 bheads = list(reversed(branches.branchheads(branch, closed=closed)))
2229 if start is not None:
2228 if start is not None:
2230 # filter out the heads that cannot be reached from startrev
2229 # filter out the heads that cannot be reached from startrev
2231 fbheads = set(self.changelog.nodesbetween([start], bheads)[2])
2230 fbheads = set(self.changelog.nodesbetween([start], bheads)[2])
2232 bheads = [h for h in bheads if h in fbheads]
2231 bheads = [h for h in bheads if h in fbheads]
2233 return bheads
2232 return bheads
2234
2233
2235 def branches(self, nodes):
2234 def branches(self, nodes):
2236 if not nodes:
2235 if not nodes:
2237 nodes = [self.changelog.tip()]
2236 nodes = [self.changelog.tip()]
2238 b = []
2237 b = []
2239 for n in nodes:
2238 for n in nodes:
2240 t = n
2239 t = n
2241 while True:
2240 while True:
2242 p = self.changelog.parents(n)
2241 p = self.changelog.parents(n)
2243 if p[1] != nullid or p[0] == nullid:
2242 if p[1] != nullid or p[0] == nullid:
2244 b.append((t, n, p[0], p[1]))
2243 b.append((t, n, p[0], p[1]))
2245 break
2244 break
2246 n = p[0]
2245 n = p[0]
2247 return b
2246 return b
2248
2247
2249 def between(self, pairs):
2248 def between(self, pairs):
2250 r = []
2249 r = []
2251
2250
2252 for top, bottom in pairs:
2251 for top, bottom in pairs:
2253 n, l, i = top, [], 0
2252 n, l, i = top, [], 0
2254 f = 1
2253 f = 1
2255
2254
2256 while n != bottom and n != nullid:
2255 while n != bottom and n != nullid:
2257 p = self.changelog.parents(n)[0]
2256 p = self.changelog.parents(n)[0]
2258 if i == f:
2257 if i == f:
2259 l.append(n)
2258 l.append(n)
2260 f = f * 2
2259 f = f * 2
2261 n = p
2260 n = p
2262 i += 1
2261 i += 1
2263
2262
2264 r.append(l)
2263 r.append(l)
2265
2264
2266 return r
2265 return r
2267
2266
2268 def checkpush(self, pushop):
2267 def checkpush(self, pushop):
2269 """Extensions can override this function if additional checks have
2268 """Extensions can override this function if additional checks have
2270 to be performed before pushing, or call it if they override push
2269 to be performed before pushing, or call it if they override push
2271 command.
2270 command.
2272 """
2271 """
2273
2272
2274 @unfilteredpropertycache
2273 @unfilteredpropertycache
2275 def prepushoutgoinghooks(self):
2274 def prepushoutgoinghooks(self):
2276 """Return util.hooks consists of a pushop with repo, remote, outgoing
2275 """Return util.hooks consists of a pushop with repo, remote, outgoing
2277 methods, which are called before pushing changesets.
2276 methods, which are called before pushing changesets.
2278 """
2277 """
2279 return util.hooks()
2278 return util.hooks()
2280
2279
2281 def pushkey(self, namespace, key, old, new):
2280 def pushkey(self, namespace, key, old, new):
2282 try:
2281 try:
2283 tr = self.currenttransaction()
2282 tr = self.currenttransaction()
2284 hookargs = {}
2283 hookargs = {}
2285 if tr is not None:
2284 if tr is not None:
2286 hookargs.update(tr.hookargs)
2285 hookargs.update(tr.hookargs)
2287 hookargs = pycompat.strkwargs(hookargs)
2286 hookargs = pycompat.strkwargs(hookargs)
2288 hookargs[r'namespace'] = namespace
2287 hookargs[r'namespace'] = namespace
2289 hookargs[r'key'] = key
2288 hookargs[r'key'] = key
2290 hookargs[r'old'] = old
2289 hookargs[r'old'] = old
2291 hookargs[r'new'] = new
2290 hookargs[r'new'] = new
2292 self.hook('prepushkey', throw=True, **hookargs)
2291 self.hook('prepushkey', throw=True, **hookargs)
2293 except error.HookAbort as exc:
2292 except error.HookAbort as exc:
2294 self.ui.write_err(_("pushkey-abort: %s\n") % exc)
2293 self.ui.write_err(_("pushkey-abort: %s\n") % exc)
2295 if exc.hint:
2294 if exc.hint:
2296 self.ui.write_err(_("(%s)\n") % exc.hint)
2295 self.ui.write_err(_("(%s)\n") % exc.hint)
2297 return False
2296 return False
2298 self.ui.debug('pushing key for "%s:%s"\n' % (namespace, key))
2297 self.ui.debug('pushing key for "%s:%s"\n' % (namespace, key))
2299 ret = pushkey.push(self, namespace, key, old, new)
2298 ret = pushkey.push(self, namespace, key, old, new)
2300 def runhook():
2299 def runhook():
2301 self.hook('pushkey', namespace=namespace, key=key, old=old, new=new,
2300 self.hook('pushkey', namespace=namespace, key=key, old=old, new=new,
2302 ret=ret)
2301 ret=ret)
2303 self._afterlock(runhook)
2302 self._afterlock(runhook)
2304 return ret
2303 return ret
2305
2304
2306 def listkeys(self, namespace):
2305 def listkeys(self, namespace):
2307 self.hook('prelistkeys', throw=True, namespace=namespace)
2306 self.hook('prelistkeys', throw=True, namespace=namespace)
2308 self.ui.debug('listing keys for "%s"\n' % namespace)
2307 self.ui.debug('listing keys for "%s"\n' % namespace)
2309 values = pushkey.list(self, namespace)
2308 values = pushkey.list(self, namespace)
2310 self.hook('listkeys', namespace=namespace, values=values)
2309 self.hook('listkeys', namespace=namespace, values=values)
2311 return values
2310 return values
2312
2311
2313 def debugwireargs(self, one, two, three=None, four=None, five=None):
2312 def debugwireargs(self, one, two, three=None, four=None, five=None):
2314 '''used to test argument passing over the wire'''
2313 '''used to test argument passing over the wire'''
2315 return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three),
2314 return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three),
2316 pycompat.bytestr(four),
2315 pycompat.bytestr(four),
2317 pycompat.bytestr(five))
2316 pycompat.bytestr(five))
2318
2317
2319 def savecommitmessage(self, text):
2318 def savecommitmessage(self, text):
2320 fp = self.vfs('last-message.txt', 'wb')
2319 fp = self.vfs('last-message.txt', 'wb')
2321 try:
2320 try:
2322 fp.write(text)
2321 fp.write(text)
2323 finally:
2322 finally:
2324 fp.close()
2323 fp.close()
2325 return self.pathto(fp.name[len(self.root) + 1:])
2324 return self.pathto(fp.name[len(self.root) + 1:])
2326
2325
2327 # used to avoid circular references so destructors work
2326 # used to avoid circular references so destructors work
2328 def aftertrans(files):
2327 def aftertrans(files):
2329 renamefiles = [tuple(t) for t in files]
2328 renamefiles = [tuple(t) for t in files]
2330 def a():
2329 def a():
2331 for vfs, src, dest in renamefiles:
2330 for vfs, src, dest in renamefiles:
2332 # if src and dest refer to a same file, vfs.rename is a no-op,
2331 # if src and dest refer to a same file, vfs.rename is a no-op,
2333 # leaving both src and dest on disk. delete dest to make sure
2332 # leaving both src and dest on disk. delete dest to make sure
2334 # the rename couldn't be such a no-op.
2333 # the rename couldn't be such a no-op.
2335 vfs.tryunlink(dest)
2334 vfs.tryunlink(dest)
2336 try:
2335 try:
2337 vfs.rename(src, dest)
2336 vfs.rename(src, dest)
2338 except OSError: # journal file does not yet exist
2337 except OSError: # journal file does not yet exist
2339 pass
2338 pass
2340 return a
2339 return a
2341
2340
2342 def undoname(fn):
2341 def undoname(fn):
2343 base, name = os.path.split(fn)
2342 base, name = os.path.split(fn)
2344 assert name.startswith('journal')
2343 assert name.startswith('journal')
2345 return os.path.join(base, name.replace('journal', 'undo', 1))
2344 return os.path.join(base, name.replace('journal', 'undo', 1))
2346
2345
2347 def instance(ui, path, create, intents=None):
2346 def instance(ui, path, create, intents=None):
2348 return localrepository(ui, util.urllocalpath(path), create,
2347 return localrepository(ui, util.urllocalpath(path), create,
2349 intents=intents)
2348 intents=intents)
2350
2349
2351 def islocal(path):
2350 def islocal(path):
2352 return True
2351 return True
2353
2352
2354 def newreporequirements(repo):
2353 def newreporequirements(repo):
2355 """Determine the set of requirements for a new local repository.
2354 """Determine the set of requirements for a new local repository.
2356
2355
2357 Extensions can wrap this function to specify custom requirements for
2356 Extensions can wrap this function to specify custom requirements for
2358 new repositories.
2357 new repositories.
2359 """
2358 """
2360 ui = repo.ui
2359 ui = repo.ui
2361 requirements = {'revlogv1'}
2360 requirements = {'revlogv1'}
2362 if ui.configbool('format', 'usestore'):
2361 if ui.configbool('format', 'usestore'):
2363 requirements.add('store')
2362 requirements.add('store')
2364 if ui.configbool('format', 'usefncache'):
2363 if ui.configbool('format', 'usefncache'):
2365 requirements.add('fncache')
2364 requirements.add('fncache')
2366 if ui.configbool('format', 'dotencode'):
2365 if ui.configbool('format', 'dotencode'):
2367 requirements.add('dotencode')
2366 requirements.add('dotencode')
2368
2367
2369 compengine = ui.config('experimental', 'format.compression')
2368 compengine = ui.config('experimental', 'format.compression')
2370 if compengine not in util.compengines:
2369 if compengine not in util.compengines:
2371 raise error.Abort(_('compression engine %s defined by '
2370 raise error.Abort(_('compression engine %s defined by '
2372 'experimental.format.compression not available') %
2371 'experimental.format.compression not available') %
2373 compengine,
2372 compengine,
2374 hint=_('run "hg debuginstall" to list available '
2373 hint=_('run "hg debuginstall" to list available '
2375 'compression engines'))
2374 'compression engines'))
2376
2375
2377 # zlib is the historical default and doesn't need an explicit requirement.
2376 # zlib is the historical default and doesn't need an explicit requirement.
2378 if compengine != 'zlib':
2377 if compengine != 'zlib':
2379 requirements.add('exp-compression-%s' % compengine)
2378 requirements.add('exp-compression-%s' % compengine)
2380
2379
2381 if scmutil.gdinitconfig(ui):
2380 if scmutil.gdinitconfig(ui):
2382 requirements.add('generaldelta')
2381 requirements.add('generaldelta')
2383 if ui.configbool('experimental', 'treemanifest'):
2382 if ui.configbool('experimental', 'treemanifest'):
2384 requirements.add('treemanifest')
2383 requirements.add('treemanifest')
2385 # experimental config: format.sparse-revlog
2384 # experimental config: format.sparse-revlog
2386 if ui.configbool('format', 'sparse-revlog'):
2385 if ui.configbool('format', 'sparse-revlog'):
2387 requirements.add(SPARSEREVLOG_REQUIREMENT)
2386 requirements.add(SPARSEREVLOG_REQUIREMENT)
2388
2387
2389 revlogv2 = ui.config('experimental', 'revlogv2')
2388 revlogv2 = ui.config('experimental', 'revlogv2')
2390 if revlogv2 == 'enable-unstable-format-and-corrupt-my-data':
2389 if revlogv2 == 'enable-unstable-format-and-corrupt-my-data':
2391 requirements.remove('revlogv1')
2390 requirements.remove('revlogv1')
2392 # generaldelta is implied by revlogv2.
2391 # generaldelta is implied by revlogv2.
2393 requirements.discard('generaldelta')
2392 requirements.discard('generaldelta')
2394 requirements.add(REVLOGV2_REQUIREMENT)
2393 requirements.add(REVLOGV2_REQUIREMENT)
2395
2394
2396 return requirements
2395 return requirements
@@ -1,402 +1,402 b''
1 #require no-reposimplestore
1 #require no-reposimplestore
2
2
3 Check whether size of generaldelta revlog is not bigger than its
3 Check whether size of generaldelta revlog is not bigger than its
4 regular equivalent. Test would fail if generaldelta was naive
4 regular equivalent. Test would fail if generaldelta was naive
5 implementation of parentdelta: third manifest revision would be fully
5 implementation of parentdelta: third manifest revision would be fully
6 inserted due to big distance from its paren revision (zero).
6 inserted due to big distance from its paren revision (zero).
7
7
8 $ hg init repo --config format.generaldelta=no --config format.usegeneraldelta=no
8 $ hg init repo --config format.generaldelta=no --config format.usegeneraldelta=no
9 $ cd repo
9 $ cd repo
10 $ echo foo > foo
10 $ echo foo > foo
11 $ echo bar > bar
11 $ echo bar > bar
12 $ echo baz > baz
12 $ echo baz > baz
13 $ hg commit -q -Am boo
13 $ hg commit -q -Am boo
14 $ hg clone --pull . ../gdrepo -q --config format.generaldelta=yes
14 $ hg clone --pull . ../gdrepo -q --config format.generaldelta=yes
15 $ for r in 1 2 3; do
15 $ for r in 1 2 3; do
16 > echo $r > foo
16 > echo $r > foo
17 > hg commit -q -m $r
17 > hg commit -q -m $r
18 > hg up -q -r 0
18 > hg up -q -r 0
19 > hg pull . -q -r $r -R ../gdrepo
19 > hg pull . -q -r $r -R ../gdrepo
20 > done
20 > done
21
21
22 $ cd ..
22 $ cd ..
23 >>> from __future__ import print_function
23 >>> from __future__ import print_function
24 >>> import os
24 >>> import os
25 >>> regsize = os.stat("repo/.hg/store/00manifest.i").st_size
25 >>> regsize = os.stat("repo/.hg/store/00manifest.i").st_size
26 >>> gdsize = os.stat("gdrepo/.hg/store/00manifest.i").st_size
26 >>> gdsize = os.stat("gdrepo/.hg/store/00manifest.i").st_size
27 >>> if regsize < gdsize:
27 >>> if regsize < gdsize:
28 ... print('generaldata increased size of manifest')
28 ... print('generaldata increased size of manifest')
29
29
30 Verify rev reordering doesnt create invalid bundles (issue4462)
30 Verify rev reordering doesnt create invalid bundles (issue4462)
31 This requires a commit tree that when pulled will reorder manifest revs such
31 This requires a commit tree that when pulled will reorder manifest revs such
32 that the second manifest to create a file rev will be ordered before the first
32 that the second manifest to create a file rev will be ordered before the first
33 manifest to create that file rev. We also need to do a partial pull to ensure
33 manifest to create that file rev. We also need to do a partial pull to ensure
34 reordering happens. At the end we verify the linkrev points at the earliest
34 reordering happens. At the end we verify the linkrev points at the earliest
35 commit.
35 commit.
36
36
37 $ hg init server --config format.generaldelta=True
37 $ hg init server --config format.generaldelta=True
38 $ cd server
38 $ cd server
39 $ touch a
39 $ touch a
40 $ hg commit -Aqm a
40 $ hg commit -Aqm a
41 $ echo x > x
41 $ echo x > x
42 $ echo y > y
42 $ echo y > y
43 $ hg commit -Aqm xy
43 $ hg commit -Aqm xy
44 $ hg up -q '.^'
44 $ hg up -q '.^'
45 $ echo x > x
45 $ echo x > x
46 $ echo z > z
46 $ echo z > z
47 $ hg commit -Aqm xz
47 $ hg commit -Aqm xz
48 $ hg up -q 1
48 $ hg up -q 1
49 $ echo b > b
49 $ echo b > b
50 $ hg commit -Aqm b
50 $ hg commit -Aqm b
51 $ hg merge -q 2
51 $ hg merge -q 2
52 $ hg commit -Aqm merge
52 $ hg commit -Aqm merge
53 $ echo c > c
53 $ echo c > c
54 $ hg commit -Aqm c
54 $ hg commit -Aqm c
55 $ hg log -G -T '{rev} {shortest(node)} {desc}'
55 $ hg log -G -T '{rev} {shortest(node)} {desc}'
56 @ 5 ebb8 c
56 @ 5 ebb8 c
57 |
57 |
58 o 4 baf7 merge
58 o 4 baf7 merge
59 |\
59 |\
60 | o 3 a129 b
60 | o 3 a129 b
61 | |
61 | |
62 o | 2 958c xz
62 o | 2 958c xz
63 | |
63 | |
64 | o 1 f00c xy
64 | o 1 f00c xy
65 |/
65 |/
66 o 0 3903 a
66 o 0 3903 a
67
67
68 $ cd ..
68 $ cd ..
69 $ hg init client --config format.generaldelta=false --config format.usegeneraldelta=false
69 $ hg init client --config format.generaldelta=false --config format.usegeneraldelta=false
70 $ cd client
70 $ cd client
71 $ hg pull -q ../server -r 4
71 $ hg pull -q ../server -r 4
72 $ hg debugdeltachain x
72 $ hg debugdeltachain x
73 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
73 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
74 0 1 1 -1 base 3 2 3 1.50000 3 0 0.00000
74 0 1 1 -1 base 3 2 3 1.50000 3 0 0.00000
75
75
76 $ cd ..
76 $ cd ..
77
77
78 Test "usegeneraldelta" config
78 Test "usegeneraldelta" config
79 (repo are general delta, but incoming bundle are not re-deltafied)
79 (repo are general delta, but incoming bundle are not re-deltafied)
80
80
81 delta coming from the server base delta server are not recompressed.
81 delta coming from the server base delta server are not recompressed.
82 (also include the aggressive version for comparison)
82 (also include the aggressive version for comparison)
83
83
84 $ hg clone repo --pull --config format.usegeneraldelta=1 usegd
84 $ hg clone repo --pull --config format.usegeneraldelta=1 usegd
85 requesting all changes
85 requesting all changes
86 adding changesets
86 adding changesets
87 adding manifests
87 adding manifests
88 adding file changes
88 adding file changes
89 added 4 changesets with 6 changes to 3 files (+2 heads)
89 added 4 changesets with 6 changes to 3 files (+2 heads)
90 new changesets 0ea3fcf9d01d:bba78d330d9c
90 new changesets 0ea3fcf9d01d:bba78d330d9c
91 updating to branch default
91 updating to branch default
92 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
93 $ hg clone repo --pull --config format.generaldelta=1 full
93 $ hg clone repo --pull --config format.generaldelta=1 full
94 requesting all changes
94 requesting all changes
95 adding changesets
95 adding changesets
96 adding manifests
96 adding manifests
97 adding file changes
97 adding file changes
98 added 4 changesets with 6 changes to 3 files (+2 heads)
98 added 4 changesets with 6 changes to 3 files (+2 heads)
99 new changesets 0ea3fcf9d01d:bba78d330d9c
99 new changesets 0ea3fcf9d01d:bba78d330d9c
100 updating to branch default
100 updating to branch default
101 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
102 $ hg -R repo debugdeltachain -m
102 $ hg -R repo debugdeltachain -m
103 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
103 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
104 0 1 1 -1 base 104 135 104 0.77037 104 0 0.00000
104 0 1 1 -1 base 104 135 104 0.77037 104 0 0.00000
105 1 1 2 0 prev 57 135 161 1.19259 161 0 0.00000
105 1 1 2 0 prev 57 135 161 1.19259 161 0 0.00000
106 2 1 3 1 prev 57 135 218 1.61481 218 0 0.00000
106 2 1 3 1 prev 57 135 218 1.61481 218 0 0.00000
107 3 2 1 -1 base 104 135 104 0.77037 104 0 0.00000
107 3 2 1 -1 base 104 135 104 0.77037 104 0 0.00000
108 $ hg -R usegd debugdeltachain -m
108 $ hg -R usegd debugdeltachain -m
109 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
109 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
110 0 1 1 -1 base 104 135 104 0.77037 104 0 0.00000
110 0 1 1 -1 base 104 135 104 0.77037 104 0 0.00000
111 1 1 2 0 p1 57 135 161 1.19259 161 0 0.00000
111 1 1 2 0 p1 57 135 161 1.19259 161 0 0.00000
112 2 1 3 1 prev 57 135 218 1.61481 218 0 0.00000
112 2 1 3 1 prev 57 135 218 1.61481 218 0 0.00000
113 3 1 2 0 p1 57 135 161 1.19259 275 114 0.70807
113 3 1 2 0 p1 57 135 161 1.19259 275 114 0.70807
114 $ hg -R full debugdeltachain -m
114 $ hg -R full debugdeltachain -m
115 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
115 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
116 0 1 1 -1 base 104 135 104 0.77037 104 0 0.00000
116 0 1 1 -1 base 104 135 104 0.77037 104 0 0.00000
117 1 1 2 0 p1 57 135 161 1.19259 161 0 0.00000
117 1 1 2 0 p1 57 135 161 1.19259 161 0 0.00000
118 2 1 2 0 p1 57 135 161 1.19259 218 57 0.35404
118 2 1 2 0 p1 57 135 161 1.19259 218 57 0.35404
119 3 1 2 0 p1 57 135 161 1.19259 275 114 0.70807
119 3 1 2 0 p1 57 135 161 1.19259 275 114 0.70807
120
120
121 Test format.aggressivemergedeltas
121 Test revlog.optimize-delta-parent-choice
122
122
123 $ hg init --config format.generaldelta=1 aggressive
123 $ hg init --config format.generaldelta=1 aggressive
124 $ cd aggressive
124 $ cd aggressive
125 $ cat << EOF >> .hg/hgrc
125 $ cat << EOF >> .hg/hgrc
126 > [format]
126 > [format]
127 > generaldelta = 1
127 > generaldelta = 1
128 > EOF
128 > EOF
129 $ touch a b c d e
129 $ touch a b c d e
130 $ hg commit -Aqm side1
130 $ hg commit -Aqm side1
131 $ hg up -q null
131 $ hg up -q null
132 $ touch x y
132 $ touch x y
133 $ hg commit -Aqm side2
133 $ hg commit -Aqm side2
134
134
135 - Verify non-aggressive merge uses p1 (commit 1) as delta parent
135 - Verify non-aggressive merge uses p1 (commit 1) as delta parent
136 $ hg merge -q 0
136 $ hg merge -q 0
137 $ hg commit -q -m merge
137 $ hg commit -q -m merge
138 $ hg debugdeltachain -m
138 $ hg debugdeltachain -m
139 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
139 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
140 0 1 1 -1 base 59 215 59 0.27442 59 0 0.00000
140 0 1 1 -1 base 59 215 59 0.27442 59 0 0.00000
141 1 1 2 0 prev 61 86 120 1.39535 120 0 0.00000
141 1 1 2 0 prev 61 86 120 1.39535 120 0 0.00000
142 2 1 2 0 p2 62 301 121 0.40199 182 61 0.50413
142 2 1 2 0 p2 62 301 121 0.40199 182 61 0.50413
143
143
144 $ hg strip -q -r . --config extensions.strip=
144 $ hg strip -q -r . --config extensions.strip=
145
145
146 - Verify aggressive merge uses p2 (commit 0) as delta parent
146 - Verify aggressive merge uses p2 (commit 0) as delta parent
147 $ hg up -q -C 1
147 $ hg up -q -C 1
148 $ hg merge -q 0
148 $ hg merge -q 0
149 $ hg commit -q -m merge --config format.aggressivemergedeltas=True
149 $ hg commit -q -m merge --config revlog.optimize-delta-parent-choice=yes
150 $ hg debugdeltachain -m
150 $ hg debugdeltachain -m
151 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
151 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
152 0 1 1 -1 base 59 215 59 0.27442 59 0 0.00000
152 0 1 1 -1 base 59 215 59 0.27442 59 0 0.00000
153 1 1 2 0 prev 61 86 120 1.39535 120 0 0.00000
153 1 1 2 0 prev 61 86 120 1.39535 120 0 0.00000
154 2 1 2 0 p2 62 301 121 0.40199 182 61 0.50413
154 2 1 2 0 p2 62 301 121 0.40199 182 61 0.50413
155
155
156 Test that strip bundle use bundle2
156 Test that strip bundle use bundle2
157 $ hg --config extensions.strip= strip .
157 $ hg --config extensions.strip= strip .
158 0 files updated, 0 files merged, 5 files removed, 0 files unresolved
158 0 files updated, 0 files merged, 5 files removed, 0 files unresolved
159 saved backup bundle to $TESTTMP/aggressive/.hg/strip-backup/1c5d4dc9a8b8-6c68e60c-backup.hg
159 saved backup bundle to $TESTTMP/aggressive/.hg/strip-backup/1c5d4dc9a8b8-6c68e60c-backup.hg
160 $ hg debugbundle .hg/strip-backup/*
160 $ hg debugbundle .hg/strip-backup/*
161 Stream params: {Compression: BZ}
161 Stream params: {Compression: BZ}
162 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
162 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
163 1c5d4dc9a8b8d6e1750966d343e94db665e7a1e9
163 1c5d4dc9a8b8d6e1750966d343e94db665e7a1e9
164 cache:rev-branch-cache -- {} (mandatory: False)
164 cache:rev-branch-cache -- {} (mandatory: False)
165 phase-heads -- {} (mandatory: True)
165 phase-heads -- {} (mandatory: True)
166 1c5d4dc9a8b8d6e1750966d343e94db665e7a1e9 draft
166 1c5d4dc9a8b8d6e1750966d343e94db665e7a1e9 draft
167
167
168 $ cd ..
168 $ cd ..
169
169
170 test maxdeltachainspan
170 test maxdeltachainspan
171
171
172 $ hg init source-repo
172 $ hg init source-repo
173 $ cd source-repo
173 $ cd source-repo
174 $ hg debugbuilddag --new-file '.+5:brancha$.+11:branchb$.+30:branchc<brancha+2<branchb+2'
174 $ hg debugbuilddag --new-file '.+5:brancha$.+11:branchb$.+30:branchc<brancha+2<branchb+2'
175 # add an empty revision somewhere
175 # add an empty revision somewhere
176 $ hg up tip
176 $ hg up tip
177 14 files updated, 0 files merged, 0 files removed, 0 files unresolved
177 14 files updated, 0 files merged, 0 files removed, 0 files unresolved
178 $ hg rm .
178 $ hg rm .
179 removing nf10
179 removing nf10
180 removing nf11
180 removing nf11
181 removing nf12
181 removing nf12
182 removing nf13
182 removing nf13
183 removing nf14
183 removing nf14
184 removing nf15
184 removing nf15
185 removing nf16
185 removing nf16
186 removing nf17
186 removing nf17
187 removing nf51
187 removing nf51
188 removing nf52
188 removing nf52
189 removing nf6
189 removing nf6
190 removing nf7
190 removing nf7
191 removing nf8
191 removing nf8
192 removing nf9
192 removing nf9
193 $ hg commit -m 'empty all'
193 $ hg commit -m 'empty all'
194 $ hg revert --all --rev 'p1(.)'
194 $ hg revert --all --rev 'p1(.)'
195 adding nf10
195 adding nf10
196 adding nf11
196 adding nf11
197 adding nf12
197 adding nf12
198 adding nf13
198 adding nf13
199 adding nf14
199 adding nf14
200 adding nf15
200 adding nf15
201 adding nf16
201 adding nf16
202 adding nf17
202 adding nf17
203 adding nf51
203 adding nf51
204 adding nf52
204 adding nf52
205 adding nf6
205 adding nf6
206 adding nf7
206 adding nf7
207 adding nf8
207 adding nf8
208 adding nf9
208 adding nf9
209 $ hg commit -m 'restore all'
209 $ hg commit -m 'restore all'
210 $ hg up null
210 $ hg up null
211 0 files updated, 0 files merged, 14 files removed, 0 files unresolved
211 0 files updated, 0 files merged, 14 files removed, 0 files unresolved
212 $
212 $
213 $ cd ..
213 $ cd ..
214 $ hg -R source-repo debugdeltachain -m
214 $ hg -R source-repo debugdeltachain -m
215 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
215 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
216 0 1 1 -1 base 46 45 46 1.02222 46 0 0.00000
216 0 1 1 -1 base 46 45 46 1.02222 46 0 0.00000
217 1 1 2 0 p1 57 90 103 1.14444 103 0 0.00000
217 1 1 2 0 p1 57 90 103 1.14444 103 0 0.00000
218 2 1 3 1 p1 57 135 160 1.18519 160 0 0.00000
218 2 1 3 1 p1 57 135 160 1.18519 160 0 0.00000
219 3 1 4 2 p1 57 180 217 1.20556 217 0 0.00000
219 3 1 4 2 p1 57 180 217 1.20556 217 0 0.00000
220 4 1 5 3 p1 57 225 274 1.21778 274 0 0.00000
220 4 1 5 3 p1 57 225 274 1.21778 274 0 0.00000
221 5 1 6 4 p1 57 270 331 1.22593 331 0 0.00000
221 5 1 6 4 p1 57 270 331 1.22593 331 0 0.00000
222 6 2 1 -1 base 46 45 46 1.02222 46 0 0.00000
222 6 2 1 -1 base 46 45 46 1.02222 46 0 0.00000
223 7 2 2 6 p1 57 90 103 1.14444 103 0 0.00000
223 7 2 2 6 p1 57 90 103 1.14444 103 0 0.00000
224 8 2 3 7 p1 57 135 160 1.18519 160 0 0.00000
224 8 2 3 7 p1 57 135 160 1.18519 160 0 0.00000
225 9 2 4 8 p1 57 180 217 1.20556 217 0 0.00000
225 9 2 4 8 p1 57 180 217 1.20556 217 0 0.00000
226 10 2 5 9 p1 58 226 275 1.21681 275 0 0.00000
226 10 2 5 9 p1 58 226 275 1.21681 275 0 0.00000
227 11 2 6 10 p1 58 272 333 1.22426 333 0 0.00000
227 11 2 6 10 p1 58 272 333 1.22426 333 0 0.00000
228 12 2 7 11 p1 58 318 391 1.22956 391 0 0.00000
228 12 2 7 11 p1 58 318 391 1.22956 391 0 0.00000
229 13 2 8 12 p1 58 364 449 1.23352 449 0 0.00000
229 13 2 8 12 p1 58 364 449 1.23352 449 0 0.00000
230 14 2 9 13 p1 58 410 507 1.23659 507 0 0.00000
230 14 2 9 13 p1 58 410 507 1.23659 507 0 0.00000
231 15 2 10 14 p1 58 456 565 1.23904 565 0 0.00000
231 15 2 10 14 p1 58 456 565 1.23904 565 0 0.00000
232 16 2 11 15 p1 58 502 623 1.24104 623 0 0.00000
232 16 2 11 15 p1 58 502 623 1.24104 623 0 0.00000
233 17 2 12 16 p1 58 548 681 1.24270 681 0 0.00000
233 17 2 12 16 p1 58 548 681 1.24270 681 0 0.00000
234 18 3 1 -1 base 47 46 47 1.02174 47 0 0.00000
234 18 3 1 -1 base 47 46 47 1.02174 47 0 0.00000
235 19 3 2 18 p1 58 92 105 1.14130 105 0 0.00000
235 19 3 2 18 p1 58 92 105 1.14130 105 0 0.00000
236 20 3 3 19 p1 58 138 163 1.18116 163 0 0.00000
236 20 3 3 19 p1 58 138 163 1.18116 163 0 0.00000
237 21 3 4 20 p1 58 184 221 1.20109 221 0 0.00000
237 21 3 4 20 p1 58 184 221 1.20109 221 0 0.00000
238 22 3 5 21 p1 58 230 279 1.21304 279 0 0.00000
238 22 3 5 21 p1 58 230 279 1.21304 279 0 0.00000
239 23 3 6 22 p1 58 276 337 1.22101 337 0 0.00000
239 23 3 6 22 p1 58 276 337 1.22101 337 0 0.00000
240 24 3 7 23 p1 58 322 395 1.22671 395 0 0.00000
240 24 3 7 23 p1 58 322 395 1.22671 395 0 0.00000
241 25 3 8 24 p1 58 368 453 1.23098 453 0 0.00000
241 25 3 8 24 p1 58 368 453 1.23098 453 0 0.00000
242 26 3 9 25 p1 58 414 511 1.23430 511 0 0.00000
242 26 3 9 25 p1 58 414 511 1.23430 511 0 0.00000
243 27 3 10 26 p1 58 460 569 1.23696 569 0 0.00000
243 27 3 10 26 p1 58 460 569 1.23696 569 0 0.00000
244 28 3 11 27 p1 58 506 627 1.23913 627 0 0.00000
244 28 3 11 27 p1 58 506 627 1.23913 627 0 0.00000
245 29 3 12 28 p1 58 552 685 1.24094 685 0 0.00000
245 29 3 12 28 p1 58 552 685 1.24094 685 0 0.00000
246 30 3 13 29 p1 58 598 743 1.24247 743 0 0.00000
246 30 3 13 29 p1 58 598 743 1.24247 743 0 0.00000
247 31 3 14 30 p1 58 644 801 1.24379 801 0 0.00000
247 31 3 14 30 p1 58 644 801 1.24379 801 0 0.00000
248 32 3 15 31 p1 58 690 859 1.24493 859 0 0.00000
248 32 3 15 31 p1 58 690 859 1.24493 859 0 0.00000
249 33 3 16 32 p1 58 736 917 1.24592 917 0 0.00000
249 33 3 16 32 p1 58 736 917 1.24592 917 0 0.00000
250 34 3 17 33 p1 58 782 975 1.24680 975 0 0.00000
250 34 3 17 33 p1 58 782 975 1.24680 975 0 0.00000
251 35 3 18 34 p1 58 828 1033 1.24758 1033 0 0.00000
251 35 3 18 34 p1 58 828 1033 1.24758 1033 0 0.00000
252 36 3 19 35 p1 58 874 1091 1.24828 1091 0 0.00000
252 36 3 19 35 p1 58 874 1091 1.24828 1091 0 0.00000
253 37 3 20 36 p1 58 920 1149 1.24891 1149 0 0.00000
253 37 3 20 36 p1 58 920 1149 1.24891 1149 0 0.00000
254 38 3 21 37 p1 58 966 1207 1.24948 1207 0 0.00000
254 38 3 21 37 p1 58 966 1207 1.24948 1207 0 0.00000
255 39 3 22 38 p1 58 1012 1265 1.25000 1265 0 0.00000
255 39 3 22 38 p1 58 1012 1265 1.25000 1265 0 0.00000
256 40 3 23 39 p1 58 1058 1323 1.25047 1323 0 0.00000
256 40 3 23 39 p1 58 1058 1323 1.25047 1323 0 0.00000
257 41 3 24 40 p1 58 1104 1381 1.25091 1381 0 0.00000
257 41 3 24 40 p1 58 1104 1381 1.25091 1381 0 0.00000
258 42 3 25 41 p1 58 1150 1439 1.25130 1439 0 0.00000
258 42 3 25 41 p1 58 1150 1439 1.25130 1439 0 0.00000
259 43 3 26 42 p1 58 1196 1497 1.25167 1497 0 0.00000
259 43 3 26 42 p1 58 1196 1497 1.25167 1497 0 0.00000
260 44 3 27 43 p1 58 1242 1555 1.25201 1555 0 0.00000
260 44 3 27 43 p1 58 1242 1555 1.25201 1555 0 0.00000
261 45 3 28 44 p1 58 1288 1613 1.25233 1613 0 0.00000
261 45 3 28 44 p1 58 1288 1613 1.25233 1613 0 0.00000
262 46 3 29 45 p1 58 1334 1671 1.25262 1671 0 0.00000
262 46 3 29 45 p1 58 1334 1671 1.25262 1671 0 0.00000
263 47 3 30 46 p1 58 1380 1729 1.25290 1729 0 0.00000
263 47 3 30 46 p1 58 1380 1729 1.25290 1729 0 0.00000
264 48 3 31 47 p1 58 1426 1787 1.25316 1787 0 0.00000
264 48 3 31 47 p1 58 1426 1787 1.25316 1787 0 0.00000
265 49 4 1 -1 base 197 316 197 0.62342 197 0 0.00000
265 49 4 1 -1 base 197 316 197 0.62342 197 0 0.00000
266 50 4 2 49 p1 58 362 255 0.70442 255 0 0.00000
266 50 4 2 49 p1 58 362 255 0.70442 255 0 0.00000
267 51 4 3 50 prev 356 594 611 1.02862 611 0 0.00000
267 51 4 3 50 prev 356 594 611 1.02862 611 0 0.00000
268 52 4 4 51 p1 58 640 669 1.04531 669 0 0.00000
268 52 4 4 51 p1 58 640 669 1.04531 669 0 0.00000
269 53 5 1 -1 base 0 0 0 0.00000 0 0 0.00000
269 53 5 1 -1 base 0 0 0 0.00000 0 0 0.00000
270 54 5 2 53 p1 376 640 376 0.58750 376 0 0.00000
270 54 5 2 53 p1 376 640 376 0.58750 376 0 0.00000
271 $ hg clone --pull source-repo --config experimental.maxdeltachainspan=2800 relax-chain --config format.generaldelta=yes
271 $ hg clone --pull source-repo --config experimental.maxdeltachainspan=2800 relax-chain --config format.generaldelta=yes
272 requesting all changes
272 requesting all changes
273 adding changesets
273 adding changesets
274 adding manifests
274 adding manifests
275 adding file changes
275 adding file changes
276 added 55 changesets with 53 changes to 53 files (+2 heads)
276 added 55 changesets with 53 changes to 53 files (+2 heads)
277 new changesets 61246295ee1e:c930ac4a5b32
277 new changesets 61246295ee1e:c930ac4a5b32
278 updating to branch default
278 updating to branch default
279 14 files updated, 0 files merged, 0 files removed, 0 files unresolved
279 14 files updated, 0 files merged, 0 files removed, 0 files unresolved
280 $ hg -R relax-chain debugdeltachain -m
280 $ hg -R relax-chain debugdeltachain -m
281 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
281 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
282 0 1 1 -1 base 46 45 46 1.02222 46 0 0.00000
282 0 1 1 -1 base 46 45 46 1.02222 46 0 0.00000
283 1 1 2 0 p1 57 90 103 1.14444 103 0 0.00000
283 1 1 2 0 p1 57 90 103 1.14444 103 0 0.00000
284 2 1 3 1 p1 57 135 160 1.18519 160 0 0.00000
284 2 1 3 1 p1 57 135 160 1.18519 160 0 0.00000
285 3 1 4 2 p1 57 180 217 1.20556 217 0 0.00000
285 3 1 4 2 p1 57 180 217 1.20556 217 0 0.00000
286 4 1 5 3 p1 57 225 274 1.21778 274 0 0.00000
286 4 1 5 3 p1 57 225 274 1.21778 274 0 0.00000
287 5 1 6 4 p1 57 270 331 1.22593 331 0 0.00000
287 5 1 6 4 p1 57 270 331 1.22593 331 0 0.00000
288 6 2 1 -1 base 46 45 46 1.02222 46 0 0.00000
288 6 2 1 -1 base 46 45 46 1.02222 46 0 0.00000
289 7 2 2 6 p1 57 90 103 1.14444 103 0 0.00000
289 7 2 2 6 p1 57 90 103 1.14444 103 0 0.00000
290 8 2 3 7 p1 57 135 160 1.18519 160 0 0.00000
290 8 2 3 7 p1 57 135 160 1.18519 160 0 0.00000
291 9 2 4 8 p1 57 180 217 1.20556 217 0 0.00000
291 9 2 4 8 p1 57 180 217 1.20556 217 0 0.00000
292 10 2 5 9 p1 58 226 275 1.21681 275 0 0.00000
292 10 2 5 9 p1 58 226 275 1.21681 275 0 0.00000
293 11 2 6 10 p1 58 272 333 1.22426 333 0 0.00000
293 11 2 6 10 p1 58 272 333 1.22426 333 0 0.00000
294 12 2 7 11 p1 58 318 391 1.22956 391 0 0.00000
294 12 2 7 11 p1 58 318 391 1.22956 391 0 0.00000
295 13 2 8 12 p1 58 364 449 1.23352 449 0 0.00000
295 13 2 8 12 p1 58 364 449 1.23352 449 0 0.00000
296 14 2 9 13 p1 58 410 507 1.23659 507 0 0.00000
296 14 2 9 13 p1 58 410 507 1.23659 507 0 0.00000
297 15 2 10 14 p1 58 456 565 1.23904 565 0 0.00000
297 15 2 10 14 p1 58 456 565 1.23904 565 0 0.00000
298 16 2 11 15 p1 58 502 623 1.24104 623 0 0.00000
298 16 2 11 15 p1 58 502 623 1.24104 623 0 0.00000
299 17 2 12 16 p1 58 548 681 1.24270 681 0 0.00000
299 17 2 12 16 p1 58 548 681 1.24270 681 0 0.00000
300 18 3 1 -1 base 47 46 47 1.02174 47 0 0.00000
300 18 3 1 -1 base 47 46 47 1.02174 47 0 0.00000
301 19 3 2 18 p1 58 92 105 1.14130 105 0 0.00000
301 19 3 2 18 p1 58 92 105 1.14130 105 0 0.00000
302 20 3 3 19 p1 58 138 163 1.18116 163 0 0.00000
302 20 3 3 19 p1 58 138 163 1.18116 163 0 0.00000
303 21 3 4 20 p1 58 184 221 1.20109 221 0 0.00000
303 21 3 4 20 p1 58 184 221 1.20109 221 0 0.00000
304 22 3 5 21 p1 58 230 279 1.21304 279 0 0.00000
304 22 3 5 21 p1 58 230 279 1.21304 279 0 0.00000
305 23 3 6 22 p1 58 276 337 1.22101 337 0 0.00000
305 23 3 6 22 p1 58 276 337 1.22101 337 0 0.00000
306 24 3 7 23 p1 58 322 395 1.22671 395 0 0.00000
306 24 3 7 23 p1 58 322 395 1.22671 395 0 0.00000
307 25 3 8 24 p1 58 368 453 1.23098 453 0 0.00000
307 25 3 8 24 p1 58 368 453 1.23098 453 0 0.00000
308 26 3 9 25 p1 58 414 511 1.23430 511 0 0.00000
308 26 3 9 25 p1 58 414 511 1.23430 511 0 0.00000
309 27 3 10 26 p1 58 460 569 1.23696 569 0 0.00000
309 27 3 10 26 p1 58 460 569 1.23696 569 0 0.00000
310 28 3 11 27 p1 58 506 627 1.23913 627 0 0.00000
310 28 3 11 27 p1 58 506 627 1.23913 627 0 0.00000
311 29 3 12 28 p1 58 552 685 1.24094 685 0 0.00000
311 29 3 12 28 p1 58 552 685 1.24094 685 0 0.00000
312 30 3 13 29 p1 58 598 743 1.24247 743 0 0.00000
312 30 3 13 29 p1 58 598 743 1.24247 743 0 0.00000
313 31 3 14 30 p1 58 644 801 1.24379 801 0 0.00000
313 31 3 14 30 p1 58 644 801 1.24379 801 0 0.00000
314 32 3 15 31 p1 58 690 859 1.24493 859 0 0.00000
314 32 3 15 31 p1 58 690 859 1.24493 859 0 0.00000
315 33 3 16 32 p1 58 736 917 1.24592 917 0 0.00000
315 33 3 16 32 p1 58 736 917 1.24592 917 0 0.00000
316 34 3 17 33 p1 58 782 975 1.24680 975 0 0.00000
316 34 3 17 33 p1 58 782 975 1.24680 975 0 0.00000
317 35 3 18 34 p1 58 828 1033 1.24758 1033 0 0.00000
317 35 3 18 34 p1 58 828 1033 1.24758 1033 0 0.00000
318 36 3 19 35 p1 58 874 1091 1.24828 1091 0 0.00000
318 36 3 19 35 p1 58 874 1091 1.24828 1091 0 0.00000
319 37 3 20 36 p1 58 920 1149 1.24891 1149 0 0.00000
319 37 3 20 36 p1 58 920 1149 1.24891 1149 0 0.00000
320 38 3 21 37 p1 58 966 1207 1.24948 1207 0 0.00000
320 38 3 21 37 p1 58 966 1207 1.24948 1207 0 0.00000
321 39 3 22 38 p1 58 1012 1265 1.25000 1265 0 0.00000
321 39 3 22 38 p1 58 1012 1265 1.25000 1265 0 0.00000
322 40 3 23 39 p1 58 1058 1323 1.25047 1323 0 0.00000
322 40 3 23 39 p1 58 1058 1323 1.25047 1323 0 0.00000
323 41 3 24 40 p1 58 1104 1381 1.25091 1381 0 0.00000
323 41 3 24 40 p1 58 1104 1381 1.25091 1381 0 0.00000
324 42 3 25 41 p1 58 1150 1439 1.25130 1439 0 0.00000
324 42 3 25 41 p1 58 1150 1439 1.25130 1439 0 0.00000
325 43 3 26 42 p1 58 1196 1497 1.25167 1497 0 0.00000
325 43 3 26 42 p1 58 1196 1497 1.25167 1497 0 0.00000
326 44 3 27 43 p1 58 1242 1555 1.25201 1555 0 0.00000
326 44 3 27 43 p1 58 1242 1555 1.25201 1555 0 0.00000
327 45 3 28 44 p1 58 1288 1613 1.25233 1613 0 0.00000
327 45 3 28 44 p1 58 1288 1613 1.25233 1613 0 0.00000
328 46 3 29 45 p1 58 1334 1671 1.25262 1671 0 0.00000
328 46 3 29 45 p1 58 1334 1671 1.25262 1671 0 0.00000
329 47 3 30 46 p1 58 1380 1729 1.25290 1729 0 0.00000
329 47 3 30 46 p1 58 1380 1729 1.25290 1729 0 0.00000
330 48 3 31 47 p1 58 1426 1787 1.25316 1787 0 0.00000
330 48 3 31 47 p1 58 1426 1787 1.25316 1787 0 0.00000
331 49 4 1 -1 base 197 316 197 0.62342 197 0 0.00000
331 49 4 1 -1 base 197 316 197 0.62342 197 0 0.00000
332 50 4 2 49 p1 58 362 255 0.70442 255 0 0.00000
332 50 4 2 49 p1 58 362 255 0.70442 255 0 0.00000
333 51 2 13 17 p1 58 594 739 1.24411 2781 2042 2.76319
333 51 2 13 17 p1 58 594 739 1.24411 2781 2042 2.76319
334 52 5 1 -1 base 369 640 369 0.57656 369 0 0.00000
334 52 5 1 -1 base 369 640 369 0.57656 369 0 0.00000
335 53 6 1 -1 base 0 0 0 0.00000 0 0 0.00000
335 53 6 1 -1 base 0 0 0 0.00000 0 0 0.00000
336 54 6 2 53 p1 376 640 376 0.58750 376 0 0.00000
336 54 6 2 53 p1 376 640 376 0.58750 376 0 0.00000
337 $ hg clone --pull source-repo --config experimental.maxdeltachainspan=0 noconst-chain --config format.generaldelta=yes
337 $ hg clone --pull source-repo --config experimental.maxdeltachainspan=0 noconst-chain --config format.generaldelta=yes
338 requesting all changes
338 requesting all changes
339 adding changesets
339 adding changesets
340 adding manifests
340 adding manifests
341 adding file changes
341 adding file changes
342 added 55 changesets with 53 changes to 53 files (+2 heads)
342 added 55 changesets with 53 changes to 53 files (+2 heads)
343 new changesets 61246295ee1e:c930ac4a5b32
343 new changesets 61246295ee1e:c930ac4a5b32
344 updating to branch default
344 updating to branch default
345 14 files updated, 0 files merged, 0 files removed, 0 files unresolved
345 14 files updated, 0 files merged, 0 files removed, 0 files unresolved
346 $ hg -R noconst-chain debugdeltachain -m
346 $ hg -R noconst-chain debugdeltachain -m
347 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
347 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio
348 0 1 1 -1 base 46 45 46 1.02222 46 0 0.00000
348 0 1 1 -1 base 46 45 46 1.02222 46 0 0.00000
349 1 1 2 0 p1 57 90 103 1.14444 103 0 0.00000
349 1 1 2 0 p1 57 90 103 1.14444 103 0 0.00000
350 2 1 3 1 p1 57 135 160 1.18519 160 0 0.00000
350 2 1 3 1 p1 57 135 160 1.18519 160 0 0.00000
351 3 1 4 2 p1 57 180 217 1.20556 217 0 0.00000
351 3 1 4 2 p1 57 180 217 1.20556 217 0 0.00000
352 4 1 5 3 p1 57 225 274 1.21778 274 0 0.00000
352 4 1 5 3 p1 57 225 274 1.21778 274 0 0.00000
353 5 1 6 4 p1 57 270 331 1.22593 331 0 0.00000
353 5 1 6 4 p1 57 270 331 1.22593 331 0 0.00000
354 6 2 1 -1 base 46 45 46 1.02222 46 0 0.00000
354 6 2 1 -1 base 46 45 46 1.02222 46 0 0.00000
355 7 2 2 6 p1 57 90 103 1.14444 103 0 0.00000
355 7 2 2 6 p1 57 90 103 1.14444 103 0 0.00000
356 8 2 3 7 p1 57 135 160 1.18519 160 0 0.00000
356 8 2 3 7 p1 57 135 160 1.18519 160 0 0.00000
357 9 2 4 8 p1 57 180 217 1.20556 217 0 0.00000
357 9 2 4 8 p1 57 180 217 1.20556 217 0 0.00000
358 10 2 5 9 p1 58 226 275 1.21681 275 0 0.00000
358 10 2 5 9 p1 58 226 275 1.21681 275 0 0.00000
359 11 2 6 10 p1 58 272 333 1.22426 333 0 0.00000
359 11 2 6 10 p1 58 272 333 1.22426 333 0 0.00000
360 12 2 7 11 p1 58 318 391 1.22956 391 0 0.00000
360 12 2 7 11 p1 58 318 391 1.22956 391 0 0.00000
361 13 2 8 12 p1 58 364 449 1.23352 449 0 0.00000
361 13 2 8 12 p1 58 364 449 1.23352 449 0 0.00000
362 14 2 9 13 p1 58 410 507 1.23659 507 0 0.00000
362 14 2 9 13 p1 58 410 507 1.23659 507 0 0.00000
363 15 2 10 14 p1 58 456 565 1.23904 565 0 0.00000
363 15 2 10 14 p1 58 456 565 1.23904 565 0 0.00000
364 16 2 11 15 p1 58 502 623 1.24104 623 0 0.00000
364 16 2 11 15 p1 58 502 623 1.24104 623 0 0.00000
365 17 2 12 16 p1 58 548 681 1.24270 681 0 0.00000
365 17 2 12 16 p1 58 548 681 1.24270 681 0 0.00000
366 18 3 1 -1 base 47 46 47 1.02174 47 0 0.00000
366 18 3 1 -1 base 47 46 47 1.02174 47 0 0.00000
367 19 3 2 18 p1 58 92 105 1.14130 105 0 0.00000
367 19 3 2 18 p1 58 92 105 1.14130 105 0 0.00000
368 20 3 3 19 p1 58 138 163 1.18116 163 0 0.00000
368 20 3 3 19 p1 58 138 163 1.18116 163 0 0.00000
369 21 3 4 20 p1 58 184 221 1.20109 221 0 0.00000
369 21 3 4 20 p1 58 184 221 1.20109 221 0 0.00000
370 22 3 5 21 p1 58 230 279 1.21304 279 0 0.00000
370 22 3 5 21 p1 58 230 279 1.21304 279 0 0.00000
371 23 3 6 22 p1 58 276 337 1.22101 337 0 0.00000
371 23 3 6 22 p1 58 276 337 1.22101 337 0 0.00000
372 24 3 7 23 p1 58 322 395 1.22671 395 0 0.00000
372 24 3 7 23 p1 58 322 395 1.22671 395 0 0.00000
373 25 3 8 24 p1 58 368 453 1.23098 453 0 0.00000
373 25 3 8 24 p1 58 368 453 1.23098 453 0 0.00000
374 26 3 9 25 p1 58 414 511 1.23430 511 0 0.00000
374 26 3 9 25 p1 58 414 511 1.23430 511 0 0.00000
375 27 3 10 26 p1 58 460 569 1.23696 569 0 0.00000
375 27 3 10 26 p1 58 460 569 1.23696 569 0 0.00000
376 28 3 11 27 p1 58 506 627 1.23913 627 0 0.00000
376 28 3 11 27 p1 58 506 627 1.23913 627 0 0.00000
377 29 3 12 28 p1 58 552 685 1.24094 685 0 0.00000
377 29 3 12 28 p1 58 552 685 1.24094 685 0 0.00000
378 30 3 13 29 p1 58 598 743 1.24247 743 0 0.00000
378 30 3 13 29 p1 58 598 743 1.24247 743 0 0.00000
379 31 3 14 30 p1 58 644 801 1.24379 801 0 0.00000
379 31 3 14 30 p1 58 644 801 1.24379 801 0 0.00000
380 32 3 15 31 p1 58 690 859 1.24493 859 0 0.00000
380 32 3 15 31 p1 58 690 859 1.24493 859 0 0.00000
381 33 3 16 32 p1 58 736 917 1.24592 917 0 0.00000
381 33 3 16 32 p1 58 736 917 1.24592 917 0 0.00000
382 34 3 17 33 p1 58 782 975 1.24680 975 0 0.00000
382 34 3 17 33 p1 58 782 975 1.24680 975 0 0.00000
383 35 3 18 34 p1 58 828 1033 1.24758 1033 0 0.00000
383 35 3 18 34 p1 58 828 1033 1.24758 1033 0 0.00000
384 36 3 19 35 p1 58 874 1091 1.24828 1091 0 0.00000
384 36 3 19 35 p1 58 874 1091 1.24828 1091 0 0.00000
385 37 3 20 36 p1 58 920 1149 1.24891 1149 0 0.00000
385 37 3 20 36 p1 58 920 1149 1.24891 1149 0 0.00000
386 38 3 21 37 p1 58 966 1207 1.24948 1207 0 0.00000
386 38 3 21 37 p1 58 966 1207 1.24948 1207 0 0.00000
387 39 3 22 38 p1 58 1012 1265 1.25000 1265 0 0.00000
387 39 3 22 38 p1 58 1012 1265 1.25000 1265 0 0.00000
388 40 3 23 39 p1 58 1058 1323 1.25047 1323 0 0.00000
388 40 3 23 39 p1 58 1058 1323 1.25047 1323 0 0.00000
389 41 3 24 40 p1 58 1104 1381 1.25091 1381 0 0.00000
389 41 3 24 40 p1 58 1104 1381 1.25091 1381 0 0.00000
390 42 3 25 41 p1 58 1150 1439 1.25130 1439 0 0.00000
390 42 3 25 41 p1 58 1150 1439 1.25130 1439 0 0.00000
391 43 3 26 42 p1 58 1196 1497 1.25167 1497 0 0.00000
391 43 3 26 42 p1 58 1196 1497 1.25167 1497 0 0.00000
392 44 3 27 43 p1 58 1242 1555 1.25201 1555 0 0.00000
392 44 3 27 43 p1 58 1242 1555 1.25201 1555 0 0.00000
393 45 3 28 44 p1 58 1288 1613 1.25233 1613 0 0.00000
393 45 3 28 44 p1 58 1288 1613 1.25233 1613 0 0.00000
394 46 3 29 45 p1 58 1334 1671 1.25262 1671 0 0.00000
394 46 3 29 45 p1 58 1334 1671 1.25262 1671 0 0.00000
395 47 3 30 46 p1 58 1380 1729 1.25290 1729 0 0.00000
395 47 3 30 46 p1 58 1380 1729 1.25290 1729 0 0.00000
396 48 3 31 47 p1 58 1426 1787 1.25316 1787 0 0.00000
396 48 3 31 47 p1 58 1426 1787 1.25316 1787 0 0.00000
397 49 1 7 5 p1 58 316 389 1.23101 2857 2468 6.34447
397 49 1 7 5 p1 58 316 389 1.23101 2857 2468 6.34447
398 50 1 8 49 p1 58 362 447 1.23481 2915 2468 5.52125
398 50 1 8 49 p1 58 362 447 1.23481 2915 2468 5.52125
399 51 2 13 17 p1 58 594 739 1.24411 2642 1903 2.57510
399 51 2 13 17 p1 58 594 739 1.24411 2642 1903 2.57510
400 52 2 14 51 p1 58 640 797 1.24531 2700 1903 2.38770
400 52 2 14 51 p1 58 640 797 1.24531 2700 1903 2.38770
401 53 4 1 -1 base 0 0 0 0.00000 0 0 0.00000
401 53 4 1 -1 base 0 0 0 0.00000 0 0 0.00000
402 54 4 2 53 p1 376 640 376 0.58750 376 0 0.00000
402 54 4 2 53 p1 376 640 376 0.58750 376 0 0.00000
General Comments 0
You need to be logged in to leave comments. Login now