##// END OF EJS Templates
dirstate-tracked-key: update the config value to match latest discussion...
marmoute -
r49620:fd9f2205 default draft
parent child Browse files
Show More
@@ -1,2709 +1,2715
1 # configitems.py - centralized declaration of configuration option
1 # configitems.py - centralized declaration of configuration option
2 #
2 #
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import functools
10 import functools
11 import re
11 import re
12
12
13 from . import (
13 from . import (
14 encoding,
14 encoding,
15 error,
15 error,
16 )
16 )
17
17
18
18
19 def loadconfigtable(ui, extname, configtable):
19 def loadconfigtable(ui, extname, configtable):
20 """update config item known to the ui with the extension ones"""
20 """update config item known to the ui with the extension ones"""
21 for section, items in sorted(configtable.items()):
21 for section, items in sorted(configtable.items()):
22 knownitems = ui._knownconfig.setdefault(section, itemregister())
22 knownitems = ui._knownconfig.setdefault(section, itemregister())
23 knownkeys = set(knownitems)
23 knownkeys = set(knownitems)
24 newkeys = set(items)
24 newkeys = set(items)
25 for key in sorted(knownkeys & newkeys):
25 for key in sorted(knownkeys & newkeys):
26 msg = b"extension '%s' overwrite config item '%s.%s'"
26 msg = b"extension '%s' overwrite config item '%s.%s'"
27 msg %= (extname, section, key)
27 msg %= (extname, section, key)
28 ui.develwarn(msg, config=b'warn-config')
28 ui.develwarn(msg, config=b'warn-config')
29
29
30 knownitems.update(items)
30 knownitems.update(items)
31
31
32
32
33 class configitem(object):
33 class configitem(object):
34 """represent a known config item
34 """represent a known config item
35
35
36 :section: the official config section where to find this item,
36 :section: the official config section where to find this item,
37 :name: the official name within the section,
37 :name: the official name within the section,
38 :default: default value for this item,
38 :default: default value for this item,
39 :alias: optional list of tuples as alternatives,
39 :alias: optional list of tuples as alternatives,
40 :generic: this is a generic definition, match name using regular expression.
40 :generic: this is a generic definition, match name using regular expression.
41 """
41 """
42
42
43 def __init__(
43 def __init__(
44 self,
44 self,
45 section,
45 section,
46 name,
46 name,
47 default=None,
47 default=None,
48 alias=(),
48 alias=(),
49 generic=False,
49 generic=False,
50 priority=0,
50 priority=0,
51 experimental=False,
51 experimental=False,
52 ):
52 ):
53 self.section = section
53 self.section = section
54 self.name = name
54 self.name = name
55 self.default = default
55 self.default = default
56 self.alias = list(alias)
56 self.alias = list(alias)
57 self.generic = generic
57 self.generic = generic
58 self.priority = priority
58 self.priority = priority
59 self.experimental = experimental
59 self.experimental = experimental
60 self._re = None
60 self._re = None
61 if generic:
61 if generic:
62 self._re = re.compile(self.name)
62 self._re = re.compile(self.name)
63
63
64
64
65 class itemregister(dict):
65 class itemregister(dict):
66 """A specialized dictionary that can handle wild-card selection"""
66 """A specialized dictionary that can handle wild-card selection"""
67
67
68 def __init__(self):
68 def __init__(self):
69 super(itemregister, self).__init__()
69 super(itemregister, self).__init__()
70 self._generics = set()
70 self._generics = set()
71
71
72 def update(self, other):
72 def update(self, other):
73 super(itemregister, self).update(other)
73 super(itemregister, self).update(other)
74 self._generics.update(other._generics)
74 self._generics.update(other._generics)
75
75
76 def __setitem__(self, key, item):
76 def __setitem__(self, key, item):
77 super(itemregister, self).__setitem__(key, item)
77 super(itemregister, self).__setitem__(key, item)
78 if item.generic:
78 if item.generic:
79 self._generics.add(item)
79 self._generics.add(item)
80
80
81 def get(self, key):
81 def get(self, key):
82 baseitem = super(itemregister, self).get(key)
82 baseitem = super(itemregister, self).get(key)
83 if baseitem is not None and not baseitem.generic:
83 if baseitem is not None and not baseitem.generic:
84 return baseitem
84 return baseitem
85
85
86 # search for a matching generic item
86 # search for a matching generic item
87 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
87 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
88 for item in generics:
88 for item in generics:
89 # we use 'match' instead of 'search' to make the matching simpler
89 # we use 'match' instead of 'search' to make the matching simpler
90 # for people unfamiliar with regular expression. Having the match
90 # for people unfamiliar with regular expression. Having the match
91 # rooted to the start of the string will produce less surprising
91 # rooted to the start of the string will produce less surprising
92 # result for user writing simple regex for sub-attribute.
92 # result for user writing simple regex for sub-attribute.
93 #
93 #
94 # For example using "color\..*" match produces an unsurprising
94 # For example using "color\..*" match produces an unsurprising
95 # result, while using search could suddenly match apparently
95 # result, while using search could suddenly match apparently
96 # unrelated configuration that happens to contains "color."
96 # unrelated configuration that happens to contains "color."
97 # anywhere. This is a tradeoff where we favor requiring ".*" on
97 # anywhere. This is a tradeoff where we favor requiring ".*" on
98 # some match to avoid the need to prefix most pattern with "^".
98 # some match to avoid the need to prefix most pattern with "^".
99 # The "^" seems more error prone.
99 # The "^" seems more error prone.
100 if item._re.match(key):
100 if item._re.match(key):
101 return item
101 return item
102
102
103 return None
103 return None
104
104
105
105
106 coreitems = {}
106 coreitems = {}
107
107
108
108
109 def _register(configtable, *args, **kwargs):
109 def _register(configtable, *args, **kwargs):
110 item = configitem(*args, **kwargs)
110 item = configitem(*args, **kwargs)
111 section = configtable.setdefault(item.section, itemregister())
111 section = configtable.setdefault(item.section, itemregister())
112 if item.name in section:
112 if item.name in section:
113 msg = b"duplicated config item registration for '%s.%s'"
113 msg = b"duplicated config item registration for '%s.%s'"
114 raise error.ProgrammingError(msg % (item.section, item.name))
114 raise error.ProgrammingError(msg % (item.section, item.name))
115 section[item.name] = item
115 section[item.name] = item
116
116
117
117
118 # special value for case where the default is derived from other values
118 # special value for case where the default is derived from other values
119 dynamicdefault = object()
119 dynamicdefault = object()
120
120
121 # Registering actual config items
121 # Registering actual config items
122
122
123
123
124 def getitemregister(configtable):
124 def getitemregister(configtable):
125 f = functools.partial(_register, configtable)
125 f = functools.partial(_register, configtable)
126 # export pseudo enum as configitem.*
126 # export pseudo enum as configitem.*
127 f.dynamicdefault = dynamicdefault
127 f.dynamicdefault = dynamicdefault
128 return f
128 return f
129
129
130
130
131 coreconfigitem = getitemregister(coreitems)
131 coreconfigitem = getitemregister(coreitems)
132
132
133
133
134 def _registerdiffopts(section, configprefix=b''):
134 def _registerdiffopts(section, configprefix=b''):
135 coreconfigitem(
135 coreconfigitem(
136 section,
136 section,
137 configprefix + b'nodates',
137 configprefix + b'nodates',
138 default=False,
138 default=False,
139 )
139 )
140 coreconfigitem(
140 coreconfigitem(
141 section,
141 section,
142 configprefix + b'showfunc',
142 configprefix + b'showfunc',
143 default=False,
143 default=False,
144 )
144 )
145 coreconfigitem(
145 coreconfigitem(
146 section,
146 section,
147 configprefix + b'unified',
147 configprefix + b'unified',
148 default=None,
148 default=None,
149 )
149 )
150 coreconfigitem(
150 coreconfigitem(
151 section,
151 section,
152 configprefix + b'git',
152 configprefix + b'git',
153 default=False,
153 default=False,
154 )
154 )
155 coreconfigitem(
155 coreconfigitem(
156 section,
156 section,
157 configprefix + b'ignorews',
157 configprefix + b'ignorews',
158 default=False,
158 default=False,
159 )
159 )
160 coreconfigitem(
160 coreconfigitem(
161 section,
161 section,
162 configprefix + b'ignorewsamount',
162 configprefix + b'ignorewsamount',
163 default=False,
163 default=False,
164 )
164 )
165 coreconfigitem(
165 coreconfigitem(
166 section,
166 section,
167 configprefix + b'ignoreblanklines',
167 configprefix + b'ignoreblanklines',
168 default=False,
168 default=False,
169 )
169 )
170 coreconfigitem(
170 coreconfigitem(
171 section,
171 section,
172 configprefix + b'ignorewseol',
172 configprefix + b'ignorewseol',
173 default=False,
173 default=False,
174 )
174 )
175 coreconfigitem(
175 coreconfigitem(
176 section,
176 section,
177 configprefix + b'nobinary',
177 configprefix + b'nobinary',
178 default=False,
178 default=False,
179 )
179 )
180 coreconfigitem(
180 coreconfigitem(
181 section,
181 section,
182 configprefix + b'noprefix',
182 configprefix + b'noprefix',
183 default=False,
183 default=False,
184 )
184 )
185 coreconfigitem(
185 coreconfigitem(
186 section,
186 section,
187 configprefix + b'word-diff',
187 configprefix + b'word-diff',
188 default=False,
188 default=False,
189 )
189 )
190
190
191
191
192 coreconfigitem(
192 coreconfigitem(
193 b'alias',
193 b'alias',
194 b'.*',
194 b'.*',
195 default=dynamicdefault,
195 default=dynamicdefault,
196 generic=True,
196 generic=True,
197 )
197 )
198 coreconfigitem(
198 coreconfigitem(
199 b'auth',
199 b'auth',
200 b'cookiefile',
200 b'cookiefile',
201 default=None,
201 default=None,
202 )
202 )
203 _registerdiffopts(section=b'annotate')
203 _registerdiffopts(section=b'annotate')
204 # bookmarks.pushing: internal hack for discovery
204 # bookmarks.pushing: internal hack for discovery
205 coreconfigitem(
205 coreconfigitem(
206 b'bookmarks',
206 b'bookmarks',
207 b'pushing',
207 b'pushing',
208 default=list,
208 default=list,
209 )
209 )
210 # bundle.mainreporoot: internal hack for bundlerepo
210 # bundle.mainreporoot: internal hack for bundlerepo
211 coreconfigitem(
211 coreconfigitem(
212 b'bundle',
212 b'bundle',
213 b'mainreporoot',
213 b'mainreporoot',
214 default=b'',
214 default=b'',
215 )
215 )
216 coreconfigitem(
216 coreconfigitem(
217 b'censor',
217 b'censor',
218 b'policy',
218 b'policy',
219 default=b'abort',
219 default=b'abort',
220 experimental=True,
220 experimental=True,
221 )
221 )
222 coreconfigitem(
222 coreconfigitem(
223 b'chgserver',
223 b'chgserver',
224 b'idletimeout',
224 b'idletimeout',
225 default=3600,
225 default=3600,
226 )
226 )
227 coreconfigitem(
227 coreconfigitem(
228 b'chgserver',
228 b'chgserver',
229 b'skiphash',
229 b'skiphash',
230 default=False,
230 default=False,
231 )
231 )
232 coreconfigitem(
232 coreconfigitem(
233 b'cmdserver',
233 b'cmdserver',
234 b'log',
234 b'log',
235 default=None,
235 default=None,
236 )
236 )
237 coreconfigitem(
237 coreconfigitem(
238 b'cmdserver',
238 b'cmdserver',
239 b'max-log-files',
239 b'max-log-files',
240 default=7,
240 default=7,
241 )
241 )
242 coreconfigitem(
242 coreconfigitem(
243 b'cmdserver',
243 b'cmdserver',
244 b'max-log-size',
244 b'max-log-size',
245 default=b'1 MB',
245 default=b'1 MB',
246 )
246 )
247 coreconfigitem(
247 coreconfigitem(
248 b'cmdserver',
248 b'cmdserver',
249 b'max-repo-cache',
249 b'max-repo-cache',
250 default=0,
250 default=0,
251 experimental=True,
251 experimental=True,
252 )
252 )
253 coreconfigitem(
253 coreconfigitem(
254 b'cmdserver',
254 b'cmdserver',
255 b'message-encodings',
255 b'message-encodings',
256 default=list,
256 default=list,
257 )
257 )
258 coreconfigitem(
258 coreconfigitem(
259 b'cmdserver',
259 b'cmdserver',
260 b'track-log',
260 b'track-log',
261 default=lambda: [b'chgserver', b'cmdserver', b'repocache'],
261 default=lambda: [b'chgserver', b'cmdserver', b'repocache'],
262 )
262 )
263 coreconfigitem(
263 coreconfigitem(
264 b'cmdserver',
264 b'cmdserver',
265 b'shutdown-on-interrupt',
265 b'shutdown-on-interrupt',
266 default=True,
266 default=True,
267 )
267 )
268 coreconfigitem(
268 coreconfigitem(
269 b'color',
269 b'color',
270 b'.*',
270 b'.*',
271 default=None,
271 default=None,
272 generic=True,
272 generic=True,
273 )
273 )
274 coreconfigitem(
274 coreconfigitem(
275 b'color',
275 b'color',
276 b'mode',
276 b'mode',
277 default=b'auto',
277 default=b'auto',
278 )
278 )
279 coreconfigitem(
279 coreconfigitem(
280 b'color',
280 b'color',
281 b'pagermode',
281 b'pagermode',
282 default=dynamicdefault,
282 default=dynamicdefault,
283 )
283 )
284 coreconfigitem(
284 coreconfigitem(
285 b'command-templates',
285 b'command-templates',
286 b'graphnode',
286 b'graphnode',
287 default=None,
287 default=None,
288 alias=[(b'ui', b'graphnodetemplate')],
288 alias=[(b'ui', b'graphnodetemplate')],
289 )
289 )
290 coreconfigitem(
290 coreconfigitem(
291 b'command-templates',
291 b'command-templates',
292 b'log',
292 b'log',
293 default=None,
293 default=None,
294 alias=[(b'ui', b'logtemplate')],
294 alias=[(b'ui', b'logtemplate')],
295 )
295 )
296 coreconfigitem(
296 coreconfigitem(
297 b'command-templates',
297 b'command-templates',
298 b'mergemarker',
298 b'mergemarker',
299 default=(
299 default=(
300 b'{node|short} '
300 b'{node|short} '
301 b'{ifeq(tags, "tip", "", '
301 b'{ifeq(tags, "tip", "", '
302 b'ifeq(tags, "", "", "{tags} "))}'
302 b'ifeq(tags, "", "", "{tags} "))}'
303 b'{if(bookmarks, "{bookmarks} ")}'
303 b'{if(bookmarks, "{bookmarks} ")}'
304 b'{ifeq(branch, "default", "", "{branch} ")}'
304 b'{ifeq(branch, "default", "", "{branch} ")}'
305 b'- {author|user}: {desc|firstline}'
305 b'- {author|user}: {desc|firstline}'
306 ),
306 ),
307 alias=[(b'ui', b'mergemarkertemplate')],
307 alias=[(b'ui', b'mergemarkertemplate')],
308 )
308 )
309 coreconfigitem(
309 coreconfigitem(
310 b'command-templates',
310 b'command-templates',
311 b'pre-merge-tool-output',
311 b'pre-merge-tool-output',
312 default=None,
312 default=None,
313 alias=[(b'ui', b'pre-merge-tool-output-template')],
313 alias=[(b'ui', b'pre-merge-tool-output-template')],
314 )
314 )
315 coreconfigitem(
315 coreconfigitem(
316 b'command-templates',
316 b'command-templates',
317 b'oneline-summary',
317 b'oneline-summary',
318 default=None,
318 default=None,
319 )
319 )
320 coreconfigitem(
320 coreconfigitem(
321 b'command-templates',
321 b'command-templates',
322 b'oneline-summary.*',
322 b'oneline-summary.*',
323 default=dynamicdefault,
323 default=dynamicdefault,
324 generic=True,
324 generic=True,
325 )
325 )
326 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
326 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
327 coreconfigitem(
327 coreconfigitem(
328 b'commands',
328 b'commands',
329 b'commit.post-status',
329 b'commit.post-status',
330 default=False,
330 default=False,
331 )
331 )
332 coreconfigitem(
332 coreconfigitem(
333 b'commands',
333 b'commands',
334 b'grep.all-files',
334 b'grep.all-files',
335 default=False,
335 default=False,
336 experimental=True,
336 experimental=True,
337 )
337 )
338 coreconfigitem(
338 coreconfigitem(
339 b'commands',
339 b'commands',
340 b'merge.require-rev',
340 b'merge.require-rev',
341 default=False,
341 default=False,
342 )
342 )
343 coreconfigitem(
343 coreconfigitem(
344 b'commands',
344 b'commands',
345 b'push.require-revs',
345 b'push.require-revs',
346 default=False,
346 default=False,
347 )
347 )
348 coreconfigitem(
348 coreconfigitem(
349 b'commands',
349 b'commands',
350 b'resolve.confirm',
350 b'resolve.confirm',
351 default=False,
351 default=False,
352 )
352 )
353 coreconfigitem(
353 coreconfigitem(
354 b'commands',
354 b'commands',
355 b'resolve.explicit-re-merge',
355 b'resolve.explicit-re-merge',
356 default=False,
356 default=False,
357 )
357 )
358 coreconfigitem(
358 coreconfigitem(
359 b'commands',
359 b'commands',
360 b'resolve.mark-check',
360 b'resolve.mark-check',
361 default=b'none',
361 default=b'none',
362 )
362 )
363 _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.')
363 _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.')
364 coreconfigitem(
364 coreconfigitem(
365 b'commands',
365 b'commands',
366 b'show.aliasprefix',
366 b'show.aliasprefix',
367 default=list,
367 default=list,
368 )
368 )
369 coreconfigitem(
369 coreconfigitem(
370 b'commands',
370 b'commands',
371 b'status.relative',
371 b'status.relative',
372 default=False,
372 default=False,
373 )
373 )
374 coreconfigitem(
374 coreconfigitem(
375 b'commands',
375 b'commands',
376 b'status.skipstates',
376 b'status.skipstates',
377 default=[],
377 default=[],
378 experimental=True,
378 experimental=True,
379 )
379 )
380 coreconfigitem(
380 coreconfigitem(
381 b'commands',
381 b'commands',
382 b'status.terse',
382 b'status.terse',
383 default=b'',
383 default=b'',
384 )
384 )
385 coreconfigitem(
385 coreconfigitem(
386 b'commands',
386 b'commands',
387 b'status.verbose',
387 b'status.verbose',
388 default=False,
388 default=False,
389 )
389 )
390 coreconfigitem(
390 coreconfigitem(
391 b'commands',
391 b'commands',
392 b'update.check',
392 b'update.check',
393 default=None,
393 default=None,
394 )
394 )
395 coreconfigitem(
395 coreconfigitem(
396 b'commands',
396 b'commands',
397 b'update.requiredest',
397 b'update.requiredest',
398 default=False,
398 default=False,
399 )
399 )
400 coreconfigitem(
400 coreconfigitem(
401 b'committemplate',
401 b'committemplate',
402 b'.*',
402 b'.*',
403 default=None,
403 default=None,
404 generic=True,
404 generic=True,
405 )
405 )
406 coreconfigitem(
406 coreconfigitem(
407 b'convert',
407 b'convert',
408 b'bzr.saverev',
408 b'bzr.saverev',
409 default=True,
409 default=True,
410 )
410 )
411 coreconfigitem(
411 coreconfigitem(
412 b'convert',
412 b'convert',
413 b'cvsps.cache',
413 b'cvsps.cache',
414 default=True,
414 default=True,
415 )
415 )
416 coreconfigitem(
416 coreconfigitem(
417 b'convert',
417 b'convert',
418 b'cvsps.fuzz',
418 b'cvsps.fuzz',
419 default=60,
419 default=60,
420 )
420 )
421 coreconfigitem(
421 coreconfigitem(
422 b'convert',
422 b'convert',
423 b'cvsps.logencoding',
423 b'cvsps.logencoding',
424 default=None,
424 default=None,
425 )
425 )
426 coreconfigitem(
426 coreconfigitem(
427 b'convert',
427 b'convert',
428 b'cvsps.mergefrom',
428 b'cvsps.mergefrom',
429 default=None,
429 default=None,
430 )
430 )
431 coreconfigitem(
431 coreconfigitem(
432 b'convert',
432 b'convert',
433 b'cvsps.mergeto',
433 b'cvsps.mergeto',
434 default=None,
434 default=None,
435 )
435 )
436 coreconfigitem(
436 coreconfigitem(
437 b'convert',
437 b'convert',
438 b'git.committeractions',
438 b'git.committeractions',
439 default=lambda: [b'messagedifferent'],
439 default=lambda: [b'messagedifferent'],
440 )
440 )
441 coreconfigitem(
441 coreconfigitem(
442 b'convert',
442 b'convert',
443 b'git.extrakeys',
443 b'git.extrakeys',
444 default=list,
444 default=list,
445 )
445 )
446 coreconfigitem(
446 coreconfigitem(
447 b'convert',
447 b'convert',
448 b'git.findcopiesharder',
448 b'git.findcopiesharder',
449 default=False,
449 default=False,
450 )
450 )
451 coreconfigitem(
451 coreconfigitem(
452 b'convert',
452 b'convert',
453 b'git.remoteprefix',
453 b'git.remoteprefix',
454 default=b'remote',
454 default=b'remote',
455 )
455 )
456 coreconfigitem(
456 coreconfigitem(
457 b'convert',
457 b'convert',
458 b'git.renamelimit',
458 b'git.renamelimit',
459 default=400,
459 default=400,
460 )
460 )
461 coreconfigitem(
461 coreconfigitem(
462 b'convert',
462 b'convert',
463 b'git.saverev',
463 b'git.saverev',
464 default=True,
464 default=True,
465 )
465 )
466 coreconfigitem(
466 coreconfigitem(
467 b'convert',
467 b'convert',
468 b'git.similarity',
468 b'git.similarity',
469 default=50,
469 default=50,
470 )
470 )
471 coreconfigitem(
471 coreconfigitem(
472 b'convert',
472 b'convert',
473 b'git.skipsubmodules',
473 b'git.skipsubmodules',
474 default=False,
474 default=False,
475 )
475 )
476 coreconfigitem(
476 coreconfigitem(
477 b'convert',
477 b'convert',
478 b'hg.clonebranches',
478 b'hg.clonebranches',
479 default=False,
479 default=False,
480 )
480 )
481 coreconfigitem(
481 coreconfigitem(
482 b'convert',
482 b'convert',
483 b'hg.ignoreerrors',
483 b'hg.ignoreerrors',
484 default=False,
484 default=False,
485 )
485 )
486 coreconfigitem(
486 coreconfigitem(
487 b'convert',
487 b'convert',
488 b'hg.preserve-hash',
488 b'hg.preserve-hash',
489 default=False,
489 default=False,
490 )
490 )
491 coreconfigitem(
491 coreconfigitem(
492 b'convert',
492 b'convert',
493 b'hg.revs',
493 b'hg.revs',
494 default=None,
494 default=None,
495 )
495 )
496 coreconfigitem(
496 coreconfigitem(
497 b'convert',
497 b'convert',
498 b'hg.saverev',
498 b'hg.saverev',
499 default=False,
499 default=False,
500 )
500 )
501 coreconfigitem(
501 coreconfigitem(
502 b'convert',
502 b'convert',
503 b'hg.sourcename',
503 b'hg.sourcename',
504 default=None,
504 default=None,
505 )
505 )
506 coreconfigitem(
506 coreconfigitem(
507 b'convert',
507 b'convert',
508 b'hg.startrev',
508 b'hg.startrev',
509 default=None,
509 default=None,
510 )
510 )
511 coreconfigitem(
511 coreconfigitem(
512 b'convert',
512 b'convert',
513 b'hg.tagsbranch',
513 b'hg.tagsbranch',
514 default=b'default',
514 default=b'default',
515 )
515 )
516 coreconfigitem(
516 coreconfigitem(
517 b'convert',
517 b'convert',
518 b'hg.usebranchnames',
518 b'hg.usebranchnames',
519 default=True,
519 default=True,
520 )
520 )
521 coreconfigitem(
521 coreconfigitem(
522 b'convert',
522 b'convert',
523 b'ignoreancestorcheck',
523 b'ignoreancestorcheck',
524 default=False,
524 default=False,
525 experimental=True,
525 experimental=True,
526 )
526 )
527 coreconfigitem(
527 coreconfigitem(
528 b'convert',
528 b'convert',
529 b'localtimezone',
529 b'localtimezone',
530 default=False,
530 default=False,
531 )
531 )
532 coreconfigitem(
532 coreconfigitem(
533 b'convert',
533 b'convert',
534 b'p4.encoding',
534 b'p4.encoding',
535 default=dynamicdefault,
535 default=dynamicdefault,
536 )
536 )
537 coreconfigitem(
537 coreconfigitem(
538 b'convert',
538 b'convert',
539 b'p4.startrev',
539 b'p4.startrev',
540 default=0,
540 default=0,
541 )
541 )
542 coreconfigitem(
542 coreconfigitem(
543 b'convert',
543 b'convert',
544 b'skiptags',
544 b'skiptags',
545 default=False,
545 default=False,
546 )
546 )
547 coreconfigitem(
547 coreconfigitem(
548 b'convert',
548 b'convert',
549 b'svn.debugsvnlog',
549 b'svn.debugsvnlog',
550 default=True,
550 default=True,
551 )
551 )
552 coreconfigitem(
552 coreconfigitem(
553 b'convert',
553 b'convert',
554 b'svn.trunk',
554 b'svn.trunk',
555 default=None,
555 default=None,
556 )
556 )
557 coreconfigitem(
557 coreconfigitem(
558 b'convert',
558 b'convert',
559 b'svn.tags',
559 b'svn.tags',
560 default=None,
560 default=None,
561 )
561 )
562 coreconfigitem(
562 coreconfigitem(
563 b'convert',
563 b'convert',
564 b'svn.branches',
564 b'svn.branches',
565 default=None,
565 default=None,
566 )
566 )
567 coreconfigitem(
567 coreconfigitem(
568 b'convert',
568 b'convert',
569 b'svn.startrev',
569 b'svn.startrev',
570 default=0,
570 default=0,
571 )
571 )
572 coreconfigitem(
572 coreconfigitem(
573 b'convert',
573 b'convert',
574 b'svn.dangerous-set-commit-dates',
574 b'svn.dangerous-set-commit-dates',
575 default=False,
575 default=False,
576 )
576 )
577 coreconfigitem(
577 coreconfigitem(
578 b'debug',
578 b'debug',
579 b'dirstate.delaywrite',
579 b'dirstate.delaywrite',
580 default=0,
580 default=0,
581 )
581 )
582 coreconfigitem(
582 coreconfigitem(
583 b'debug',
583 b'debug',
584 b'revlog.verifyposition.changelog',
584 b'revlog.verifyposition.changelog',
585 default=b'',
585 default=b'',
586 )
586 )
587 coreconfigitem(
587 coreconfigitem(
588 b'defaults',
588 b'defaults',
589 b'.*',
589 b'.*',
590 default=None,
590 default=None,
591 generic=True,
591 generic=True,
592 )
592 )
593 coreconfigitem(
593 coreconfigitem(
594 b'devel',
594 b'devel',
595 b'all-warnings',
595 b'all-warnings',
596 default=False,
596 default=False,
597 )
597 )
598 coreconfigitem(
598 coreconfigitem(
599 b'devel',
599 b'devel',
600 b'bundle2.debug',
600 b'bundle2.debug',
601 default=False,
601 default=False,
602 )
602 )
603 coreconfigitem(
603 coreconfigitem(
604 b'devel',
604 b'devel',
605 b'bundle.delta',
605 b'bundle.delta',
606 default=b'',
606 default=b'',
607 )
607 )
608 coreconfigitem(
608 coreconfigitem(
609 b'devel',
609 b'devel',
610 b'cache-vfs',
610 b'cache-vfs',
611 default=None,
611 default=None,
612 )
612 )
613 coreconfigitem(
613 coreconfigitem(
614 b'devel',
614 b'devel',
615 b'check-locks',
615 b'check-locks',
616 default=False,
616 default=False,
617 )
617 )
618 coreconfigitem(
618 coreconfigitem(
619 b'devel',
619 b'devel',
620 b'check-relroot',
620 b'check-relroot',
621 default=False,
621 default=False,
622 )
622 )
623 # Track copy information for all file, not just "added" one (very slow)
623 # Track copy information for all file, not just "added" one (very slow)
624 coreconfigitem(
624 coreconfigitem(
625 b'devel',
625 b'devel',
626 b'copy-tracing.trace-all-files',
626 b'copy-tracing.trace-all-files',
627 default=False,
627 default=False,
628 )
628 )
629 coreconfigitem(
629 coreconfigitem(
630 b'devel',
630 b'devel',
631 b'default-date',
631 b'default-date',
632 default=None,
632 default=None,
633 )
633 )
634 coreconfigitem(
634 coreconfigitem(
635 b'devel',
635 b'devel',
636 b'deprec-warn',
636 b'deprec-warn',
637 default=False,
637 default=False,
638 )
638 )
639 coreconfigitem(
639 coreconfigitem(
640 b'devel',
640 b'devel',
641 b'disableloaddefaultcerts',
641 b'disableloaddefaultcerts',
642 default=False,
642 default=False,
643 )
643 )
644 coreconfigitem(
644 coreconfigitem(
645 b'devel',
645 b'devel',
646 b'warn-empty-changegroup',
646 b'warn-empty-changegroup',
647 default=False,
647 default=False,
648 )
648 )
649 coreconfigitem(
649 coreconfigitem(
650 b'devel',
650 b'devel',
651 b'legacy.exchange',
651 b'legacy.exchange',
652 default=list,
652 default=list,
653 )
653 )
654 # When True, revlogs use a special reference version of the nodemap, that is not
654 # When True, revlogs use a special reference version of the nodemap, that is not
655 # performant but is "known" to behave properly.
655 # performant but is "known" to behave properly.
656 coreconfigitem(
656 coreconfigitem(
657 b'devel',
657 b'devel',
658 b'persistent-nodemap',
658 b'persistent-nodemap',
659 default=False,
659 default=False,
660 )
660 )
661 coreconfigitem(
661 coreconfigitem(
662 b'devel',
662 b'devel',
663 b'servercafile',
663 b'servercafile',
664 default=b'',
664 default=b'',
665 )
665 )
666 coreconfigitem(
666 coreconfigitem(
667 b'devel',
667 b'devel',
668 b'serverexactprotocol',
668 b'serverexactprotocol',
669 default=b'',
669 default=b'',
670 )
670 )
671 coreconfigitem(
671 coreconfigitem(
672 b'devel',
672 b'devel',
673 b'serverrequirecert',
673 b'serverrequirecert',
674 default=False,
674 default=False,
675 )
675 )
676 coreconfigitem(
676 coreconfigitem(
677 b'devel',
677 b'devel',
678 b'strip-obsmarkers',
678 b'strip-obsmarkers',
679 default=True,
679 default=True,
680 )
680 )
681 coreconfigitem(
681 coreconfigitem(
682 b'devel',
682 b'devel',
683 b'warn-config',
683 b'warn-config',
684 default=None,
684 default=None,
685 )
685 )
686 coreconfigitem(
686 coreconfigitem(
687 b'devel',
687 b'devel',
688 b'warn-config-default',
688 b'warn-config-default',
689 default=None,
689 default=None,
690 )
690 )
691 coreconfigitem(
691 coreconfigitem(
692 b'devel',
692 b'devel',
693 b'user.obsmarker',
693 b'user.obsmarker',
694 default=None,
694 default=None,
695 )
695 )
696 coreconfigitem(
696 coreconfigitem(
697 b'devel',
697 b'devel',
698 b'warn-config-unknown',
698 b'warn-config-unknown',
699 default=None,
699 default=None,
700 )
700 )
701 coreconfigitem(
701 coreconfigitem(
702 b'devel',
702 b'devel',
703 b'debug.copies',
703 b'debug.copies',
704 default=False,
704 default=False,
705 )
705 )
706 coreconfigitem(
706 coreconfigitem(
707 b'devel',
707 b'devel',
708 b'copy-tracing.multi-thread',
708 b'copy-tracing.multi-thread',
709 default=True,
709 default=True,
710 )
710 )
711 coreconfigitem(
711 coreconfigitem(
712 b'devel',
712 b'devel',
713 b'debug.extensions',
713 b'debug.extensions',
714 default=False,
714 default=False,
715 )
715 )
716 coreconfigitem(
716 coreconfigitem(
717 b'devel',
717 b'devel',
718 b'debug.repo-filters',
718 b'debug.repo-filters',
719 default=False,
719 default=False,
720 )
720 )
721 coreconfigitem(
721 coreconfigitem(
722 b'devel',
722 b'devel',
723 b'debug.peer-request',
723 b'debug.peer-request',
724 default=False,
724 default=False,
725 )
725 )
726 # If discovery.exchange-heads is False, the discovery will not start with
726 # If discovery.exchange-heads is False, the discovery will not start with
727 # remote head fetching and local head querying.
727 # remote head fetching and local head querying.
728 coreconfigitem(
728 coreconfigitem(
729 b'devel',
729 b'devel',
730 b'discovery.exchange-heads',
730 b'discovery.exchange-heads',
731 default=True,
731 default=True,
732 )
732 )
733 # If discovery.grow-sample is False, the sample size used in set discovery will
733 # If discovery.grow-sample is False, the sample size used in set discovery will
734 # not be increased through the process
734 # not be increased through the process
735 coreconfigitem(
735 coreconfigitem(
736 b'devel',
736 b'devel',
737 b'discovery.grow-sample',
737 b'discovery.grow-sample',
738 default=True,
738 default=True,
739 )
739 )
740 # When discovery.grow-sample.dynamic is True, the default, the sample size is
740 # When discovery.grow-sample.dynamic is True, the default, the sample size is
741 # adapted to the shape of the undecided set (it is set to the max of:
741 # adapted to the shape of the undecided set (it is set to the max of:
742 # <target-size>, len(roots(undecided)), len(heads(undecided)
742 # <target-size>, len(roots(undecided)), len(heads(undecided)
743 coreconfigitem(
743 coreconfigitem(
744 b'devel',
744 b'devel',
745 b'discovery.grow-sample.dynamic',
745 b'discovery.grow-sample.dynamic',
746 default=True,
746 default=True,
747 )
747 )
748 # discovery.grow-sample.rate control the rate at which the sample grow
748 # discovery.grow-sample.rate control the rate at which the sample grow
749 coreconfigitem(
749 coreconfigitem(
750 b'devel',
750 b'devel',
751 b'discovery.grow-sample.rate',
751 b'discovery.grow-sample.rate',
752 default=1.05,
752 default=1.05,
753 )
753 )
754 # If discovery.randomize is False, random sampling during discovery are
754 # If discovery.randomize is False, random sampling during discovery are
755 # deterministic. It is meant for integration tests.
755 # deterministic. It is meant for integration tests.
756 coreconfigitem(
756 coreconfigitem(
757 b'devel',
757 b'devel',
758 b'discovery.randomize',
758 b'discovery.randomize',
759 default=True,
759 default=True,
760 )
760 )
761 # Control the initial size of the discovery sample
761 # Control the initial size of the discovery sample
762 coreconfigitem(
762 coreconfigitem(
763 b'devel',
763 b'devel',
764 b'discovery.sample-size',
764 b'discovery.sample-size',
765 default=200,
765 default=200,
766 )
766 )
767 # Control the initial size of the discovery for initial change
767 # Control the initial size of the discovery for initial change
768 coreconfigitem(
768 coreconfigitem(
769 b'devel',
769 b'devel',
770 b'discovery.sample-size.initial',
770 b'discovery.sample-size.initial',
771 default=100,
771 default=100,
772 )
772 )
773 _registerdiffopts(section=b'diff')
773 _registerdiffopts(section=b'diff')
774 coreconfigitem(
774 coreconfigitem(
775 b'diff',
775 b'diff',
776 b'merge',
776 b'merge',
777 default=False,
777 default=False,
778 experimental=True,
778 experimental=True,
779 )
779 )
780 coreconfigitem(
780 coreconfigitem(
781 b'email',
781 b'email',
782 b'bcc',
782 b'bcc',
783 default=None,
783 default=None,
784 )
784 )
785 coreconfigitem(
785 coreconfigitem(
786 b'email',
786 b'email',
787 b'cc',
787 b'cc',
788 default=None,
788 default=None,
789 )
789 )
790 coreconfigitem(
790 coreconfigitem(
791 b'email',
791 b'email',
792 b'charsets',
792 b'charsets',
793 default=list,
793 default=list,
794 )
794 )
795 coreconfigitem(
795 coreconfigitem(
796 b'email',
796 b'email',
797 b'from',
797 b'from',
798 default=None,
798 default=None,
799 )
799 )
800 coreconfigitem(
800 coreconfigitem(
801 b'email',
801 b'email',
802 b'method',
802 b'method',
803 default=b'smtp',
803 default=b'smtp',
804 )
804 )
805 coreconfigitem(
805 coreconfigitem(
806 b'email',
806 b'email',
807 b'reply-to',
807 b'reply-to',
808 default=None,
808 default=None,
809 )
809 )
810 coreconfigitem(
810 coreconfigitem(
811 b'email',
811 b'email',
812 b'to',
812 b'to',
813 default=None,
813 default=None,
814 )
814 )
815 coreconfigitem(
815 coreconfigitem(
816 b'experimental',
816 b'experimental',
817 b'archivemetatemplate',
817 b'archivemetatemplate',
818 default=dynamicdefault,
818 default=dynamicdefault,
819 )
819 )
820 coreconfigitem(
820 coreconfigitem(
821 b'experimental',
821 b'experimental',
822 b'auto-publish',
822 b'auto-publish',
823 default=b'publish',
823 default=b'publish',
824 )
824 )
825 coreconfigitem(
825 coreconfigitem(
826 b'experimental',
826 b'experimental',
827 b'bundle-phases',
827 b'bundle-phases',
828 default=False,
828 default=False,
829 )
829 )
830 coreconfigitem(
830 coreconfigitem(
831 b'experimental',
831 b'experimental',
832 b'bundle2-advertise',
832 b'bundle2-advertise',
833 default=True,
833 default=True,
834 )
834 )
835 coreconfigitem(
835 coreconfigitem(
836 b'experimental',
836 b'experimental',
837 b'bundle2-output-capture',
837 b'bundle2-output-capture',
838 default=False,
838 default=False,
839 )
839 )
840 coreconfigitem(
840 coreconfigitem(
841 b'experimental',
841 b'experimental',
842 b'bundle2.pushback',
842 b'bundle2.pushback',
843 default=False,
843 default=False,
844 )
844 )
845 coreconfigitem(
845 coreconfigitem(
846 b'experimental',
846 b'experimental',
847 b'bundle2lazylocking',
847 b'bundle2lazylocking',
848 default=False,
848 default=False,
849 )
849 )
850 coreconfigitem(
850 coreconfigitem(
851 b'experimental',
851 b'experimental',
852 b'bundlecomplevel',
852 b'bundlecomplevel',
853 default=None,
853 default=None,
854 )
854 )
855 coreconfigitem(
855 coreconfigitem(
856 b'experimental',
856 b'experimental',
857 b'bundlecomplevel.bzip2',
857 b'bundlecomplevel.bzip2',
858 default=None,
858 default=None,
859 )
859 )
860 coreconfigitem(
860 coreconfigitem(
861 b'experimental',
861 b'experimental',
862 b'bundlecomplevel.gzip',
862 b'bundlecomplevel.gzip',
863 default=None,
863 default=None,
864 )
864 )
865 coreconfigitem(
865 coreconfigitem(
866 b'experimental',
866 b'experimental',
867 b'bundlecomplevel.none',
867 b'bundlecomplevel.none',
868 default=None,
868 default=None,
869 )
869 )
870 coreconfigitem(
870 coreconfigitem(
871 b'experimental',
871 b'experimental',
872 b'bundlecomplevel.zstd',
872 b'bundlecomplevel.zstd',
873 default=None,
873 default=None,
874 )
874 )
875 coreconfigitem(
875 coreconfigitem(
876 b'experimental',
876 b'experimental',
877 b'bundlecompthreads',
877 b'bundlecompthreads',
878 default=None,
878 default=None,
879 )
879 )
880 coreconfigitem(
880 coreconfigitem(
881 b'experimental',
881 b'experimental',
882 b'bundlecompthreads.bzip2',
882 b'bundlecompthreads.bzip2',
883 default=None,
883 default=None,
884 )
884 )
885 coreconfigitem(
885 coreconfigitem(
886 b'experimental',
886 b'experimental',
887 b'bundlecompthreads.gzip',
887 b'bundlecompthreads.gzip',
888 default=None,
888 default=None,
889 )
889 )
890 coreconfigitem(
890 coreconfigitem(
891 b'experimental',
891 b'experimental',
892 b'bundlecompthreads.none',
892 b'bundlecompthreads.none',
893 default=None,
893 default=None,
894 )
894 )
895 coreconfigitem(
895 coreconfigitem(
896 b'experimental',
896 b'experimental',
897 b'bundlecompthreads.zstd',
897 b'bundlecompthreads.zstd',
898 default=None,
898 default=None,
899 )
899 )
900 coreconfigitem(
900 coreconfigitem(
901 b'experimental',
901 b'experimental',
902 b'changegroup3',
902 b'changegroup3',
903 default=False,
903 default=False,
904 )
904 )
905 coreconfigitem(
905 coreconfigitem(
906 b'experimental',
906 b'experimental',
907 b'changegroup4',
907 b'changegroup4',
908 default=False,
908 default=False,
909 )
909 )
910 coreconfigitem(
910 coreconfigitem(
911 b'experimental',
911 b'experimental',
912 b'cleanup-as-archived',
912 b'cleanup-as-archived',
913 default=False,
913 default=False,
914 )
914 )
915 coreconfigitem(
915 coreconfigitem(
916 b'experimental',
916 b'experimental',
917 b'clientcompressionengines',
917 b'clientcompressionengines',
918 default=list,
918 default=list,
919 )
919 )
920 coreconfigitem(
920 coreconfigitem(
921 b'experimental',
921 b'experimental',
922 b'copytrace',
922 b'copytrace',
923 default=b'on',
923 default=b'on',
924 )
924 )
925 coreconfigitem(
925 coreconfigitem(
926 b'experimental',
926 b'experimental',
927 b'copytrace.movecandidateslimit',
927 b'copytrace.movecandidateslimit',
928 default=100,
928 default=100,
929 )
929 )
930 coreconfigitem(
930 coreconfigitem(
931 b'experimental',
931 b'experimental',
932 b'copytrace.sourcecommitlimit',
932 b'copytrace.sourcecommitlimit',
933 default=100,
933 default=100,
934 )
934 )
935 coreconfigitem(
935 coreconfigitem(
936 b'experimental',
936 b'experimental',
937 b'copies.read-from',
937 b'copies.read-from',
938 default=b"filelog-only",
938 default=b"filelog-only",
939 )
939 )
940 coreconfigitem(
940 coreconfigitem(
941 b'experimental',
941 b'experimental',
942 b'copies.write-to',
942 b'copies.write-to',
943 default=b'filelog-only',
943 default=b'filelog-only',
944 )
944 )
945 coreconfigitem(
945 coreconfigitem(
946 b'experimental',
946 b'experimental',
947 b'crecordtest',
947 b'crecordtest',
948 default=None,
948 default=None,
949 )
949 )
950 coreconfigitem(
950 coreconfigitem(
951 b'experimental',
951 b'experimental',
952 b'directaccess',
952 b'directaccess',
953 default=False,
953 default=False,
954 )
954 )
955 coreconfigitem(
955 coreconfigitem(
956 b'experimental',
956 b'experimental',
957 b'directaccess.revnums',
957 b'directaccess.revnums',
958 default=False,
958 default=False,
959 )
959 )
960 coreconfigitem(
960 coreconfigitem(
961 b'experimental',
961 b'experimental',
962 b'editortmpinhg',
962 b'editortmpinhg',
963 default=False,
963 default=False,
964 )
964 )
965 coreconfigitem(
965 coreconfigitem(
966 b'experimental',
966 b'experimental',
967 b'evolution',
967 b'evolution',
968 default=list,
968 default=list,
969 )
969 )
970 coreconfigitem(
970 coreconfigitem(
971 b'experimental',
971 b'experimental',
972 b'evolution.allowdivergence',
972 b'evolution.allowdivergence',
973 default=False,
973 default=False,
974 alias=[(b'experimental', b'allowdivergence')],
974 alias=[(b'experimental', b'allowdivergence')],
975 )
975 )
976 coreconfigitem(
976 coreconfigitem(
977 b'experimental',
977 b'experimental',
978 b'evolution.allowunstable',
978 b'evolution.allowunstable',
979 default=None,
979 default=None,
980 )
980 )
981 coreconfigitem(
981 coreconfigitem(
982 b'experimental',
982 b'experimental',
983 b'evolution.createmarkers',
983 b'evolution.createmarkers',
984 default=None,
984 default=None,
985 )
985 )
986 coreconfigitem(
986 coreconfigitem(
987 b'experimental',
987 b'experimental',
988 b'evolution.effect-flags',
988 b'evolution.effect-flags',
989 default=True,
989 default=True,
990 alias=[(b'experimental', b'effect-flags')],
990 alias=[(b'experimental', b'effect-flags')],
991 )
991 )
992 coreconfigitem(
992 coreconfigitem(
993 b'experimental',
993 b'experimental',
994 b'evolution.exchange',
994 b'evolution.exchange',
995 default=None,
995 default=None,
996 )
996 )
997 coreconfigitem(
997 coreconfigitem(
998 b'experimental',
998 b'experimental',
999 b'evolution.bundle-obsmarker',
999 b'evolution.bundle-obsmarker',
1000 default=False,
1000 default=False,
1001 )
1001 )
1002 coreconfigitem(
1002 coreconfigitem(
1003 b'experimental',
1003 b'experimental',
1004 b'evolution.bundle-obsmarker:mandatory',
1004 b'evolution.bundle-obsmarker:mandatory',
1005 default=True,
1005 default=True,
1006 )
1006 )
1007 coreconfigitem(
1007 coreconfigitem(
1008 b'experimental',
1008 b'experimental',
1009 b'log.topo',
1009 b'log.topo',
1010 default=False,
1010 default=False,
1011 )
1011 )
1012 coreconfigitem(
1012 coreconfigitem(
1013 b'experimental',
1013 b'experimental',
1014 b'evolution.report-instabilities',
1014 b'evolution.report-instabilities',
1015 default=True,
1015 default=True,
1016 )
1016 )
1017 coreconfigitem(
1017 coreconfigitem(
1018 b'experimental',
1018 b'experimental',
1019 b'evolution.track-operation',
1019 b'evolution.track-operation',
1020 default=True,
1020 default=True,
1021 )
1021 )
1022 # repo-level config to exclude a revset visibility
1022 # repo-level config to exclude a revset visibility
1023 #
1023 #
1024 # The target use case is to use `share` to expose different subset of the same
1024 # The target use case is to use `share` to expose different subset of the same
1025 # repository, especially server side. See also `server.view`.
1025 # repository, especially server side. See also `server.view`.
1026 coreconfigitem(
1026 coreconfigitem(
1027 b'experimental',
1027 b'experimental',
1028 b'extra-filter-revs',
1028 b'extra-filter-revs',
1029 default=None,
1029 default=None,
1030 )
1030 )
1031 coreconfigitem(
1031 coreconfigitem(
1032 b'experimental',
1032 b'experimental',
1033 b'maxdeltachainspan',
1033 b'maxdeltachainspan',
1034 default=-1,
1034 default=-1,
1035 )
1035 )
1036 # tracks files which were undeleted (merge might delete them but we explicitly
1036 # tracks files which were undeleted (merge might delete them but we explicitly
1037 # kept/undeleted them) and creates new filenodes for them
1037 # kept/undeleted them) and creates new filenodes for them
1038 coreconfigitem(
1038 coreconfigitem(
1039 b'experimental',
1039 b'experimental',
1040 b'merge-track-salvaged',
1040 b'merge-track-salvaged',
1041 default=False,
1041 default=False,
1042 )
1042 )
1043 coreconfigitem(
1043 coreconfigitem(
1044 b'experimental',
1044 b'experimental',
1045 b'mergetempdirprefix',
1045 b'mergetempdirprefix',
1046 default=None,
1046 default=None,
1047 )
1047 )
1048 coreconfigitem(
1048 coreconfigitem(
1049 b'experimental',
1049 b'experimental',
1050 b'mmapindexthreshold',
1050 b'mmapindexthreshold',
1051 default=None,
1051 default=None,
1052 )
1052 )
1053 coreconfigitem(
1053 coreconfigitem(
1054 b'experimental',
1054 b'experimental',
1055 b'narrow',
1055 b'narrow',
1056 default=False,
1056 default=False,
1057 )
1057 )
1058 coreconfigitem(
1058 coreconfigitem(
1059 b'experimental',
1059 b'experimental',
1060 b'nonnormalparanoidcheck',
1060 b'nonnormalparanoidcheck',
1061 default=False,
1061 default=False,
1062 )
1062 )
1063 coreconfigitem(
1063 coreconfigitem(
1064 b'experimental',
1064 b'experimental',
1065 b'exportableenviron',
1065 b'exportableenviron',
1066 default=list,
1066 default=list,
1067 )
1067 )
1068 coreconfigitem(
1068 coreconfigitem(
1069 b'experimental',
1069 b'experimental',
1070 b'extendedheader.index',
1070 b'extendedheader.index',
1071 default=None,
1071 default=None,
1072 )
1072 )
1073 coreconfigitem(
1073 coreconfigitem(
1074 b'experimental',
1074 b'experimental',
1075 b'extendedheader.similarity',
1075 b'extendedheader.similarity',
1076 default=False,
1076 default=False,
1077 )
1077 )
1078 coreconfigitem(
1078 coreconfigitem(
1079 b'experimental',
1079 b'experimental',
1080 b'graphshorten',
1080 b'graphshorten',
1081 default=False,
1081 default=False,
1082 )
1082 )
1083 coreconfigitem(
1083 coreconfigitem(
1084 b'experimental',
1084 b'experimental',
1085 b'graphstyle.parent',
1085 b'graphstyle.parent',
1086 default=dynamicdefault,
1086 default=dynamicdefault,
1087 )
1087 )
1088 coreconfigitem(
1088 coreconfigitem(
1089 b'experimental',
1089 b'experimental',
1090 b'graphstyle.missing',
1090 b'graphstyle.missing',
1091 default=dynamicdefault,
1091 default=dynamicdefault,
1092 )
1092 )
1093 coreconfigitem(
1093 coreconfigitem(
1094 b'experimental',
1094 b'experimental',
1095 b'graphstyle.grandparent',
1095 b'graphstyle.grandparent',
1096 default=dynamicdefault,
1096 default=dynamicdefault,
1097 )
1097 )
1098 coreconfigitem(
1098 coreconfigitem(
1099 b'experimental',
1099 b'experimental',
1100 b'hook-track-tags',
1100 b'hook-track-tags',
1101 default=False,
1101 default=False,
1102 )
1102 )
1103 coreconfigitem(
1103 coreconfigitem(
1104 b'experimental',
1104 b'experimental',
1105 b'httppostargs',
1105 b'httppostargs',
1106 default=False,
1106 default=False,
1107 )
1107 )
1108 coreconfigitem(b'experimental', b'nointerrupt', default=False)
1108 coreconfigitem(b'experimental', b'nointerrupt', default=False)
1109 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
1109 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
1110
1110
1111 coreconfigitem(
1111 coreconfigitem(
1112 b'experimental',
1112 b'experimental',
1113 b'obsmarkers-exchange-debug',
1113 b'obsmarkers-exchange-debug',
1114 default=False,
1114 default=False,
1115 )
1115 )
1116 coreconfigitem(
1116 coreconfigitem(
1117 b'experimental',
1117 b'experimental',
1118 b'remotenames',
1118 b'remotenames',
1119 default=False,
1119 default=False,
1120 )
1120 )
1121 coreconfigitem(
1121 coreconfigitem(
1122 b'experimental',
1122 b'experimental',
1123 b'removeemptydirs',
1123 b'removeemptydirs',
1124 default=True,
1124 default=True,
1125 )
1125 )
1126 coreconfigitem(
1126 coreconfigitem(
1127 b'experimental',
1127 b'experimental',
1128 b'revert.interactive.select-to-keep',
1128 b'revert.interactive.select-to-keep',
1129 default=False,
1129 default=False,
1130 )
1130 )
1131 coreconfigitem(
1131 coreconfigitem(
1132 b'experimental',
1132 b'experimental',
1133 b'revisions.prefixhexnode',
1133 b'revisions.prefixhexnode',
1134 default=False,
1134 default=False,
1135 )
1135 )
1136 # "out of experimental" todo list.
1136 # "out of experimental" todo list.
1137 #
1137 #
1138 # * include management of a persistent nodemap in the main docket
1138 # * include management of a persistent nodemap in the main docket
1139 # * enforce a "no-truncate" policy for mmap safety
1139 # * enforce a "no-truncate" policy for mmap safety
1140 # - for censoring operation
1140 # - for censoring operation
1141 # - for stripping operation
1141 # - for stripping operation
1142 # - for rollback operation
1142 # - for rollback operation
1143 # * proper streaming (race free) of the docket file
1143 # * proper streaming (race free) of the docket file
1144 # * track garbage data to evemtually allow rewriting -existing- sidedata.
1144 # * track garbage data to evemtually allow rewriting -existing- sidedata.
1145 # * Exchange-wise, we will also need to do something more efficient than
1145 # * Exchange-wise, we will also need to do something more efficient than
1146 # keeping references to the affected revlogs, especially memory-wise when
1146 # keeping references to the affected revlogs, especially memory-wise when
1147 # rewriting sidedata.
1147 # rewriting sidedata.
1148 # * introduce a proper solution to reduce the number of filelog related files.
1148 # * introduce a proper solution to reduce the number of filelog related files.
1149 # * use caching for reading sidedata (similar to what we do for data).
1149 # * use caching for reading sidedata (similar to what we do for data).
1150 # * no longer set offset=0 if sidedata_size=0 (simplify cutoff computation).
1150 # * no longer set offset=0 if sidedata_size=0 (simplify cutoff computation).
1151 # * Improvement to consider
1151 # * Improvement to consider
1152 # - avoid compression header in chunk using the default compression?
1152 # - avoid compression header in chunk using the default compression?
1153 # - forbid "inline" compression mode entirely?
1153 # - forbid "inline" compression mode entirely?
1154 # - split the data offset and flag field (the 2 bytes save are mostly trouble)
1154 # - split the data offset and flag field (the 2 bytes save are mostly trouble)
1155 # - keep track of uncompressed -chunk- size (to preallocate memory better)
1155 # - keep track of uncompressed -chunk- size (to preallocate memory better)
1156 # - keep track of chain base or size (probably not that useful anymore)
1156 # - keep track of chain base or size (probably not that useful anymore)
1157 coreconfigitem(
1157 coreconfigitem(
1158 b'experimental',
1158 b'experimental',
1159 b'revlogv2',
1159 b'revlogv2',
1160 default=None,
1160 default=None,
1161 )
1161 )
1162 coreconfigitem(
1162 coreconfigitem(
1163 b'experimental',
1163 b'experimental',
1164 b'revisions.disambiguatewithin',
1164 b'revisions.disambiguatewithin',
1165 default=None,
1165 default=None,
1166 )
1166 )
1167 coreconfigitem(
1167 coreconfigitem(
1168 b'experimental',
1168 b'experimental',
1169 b'rust.index',
1169 b'rust.index',
1170 default=False,
1170 default=False,
1171 )
1171 )
1172 coreconfigitem(
1172 coreconfigitem(
1173 b'experimental',
1173 b'experimental',
1174 b'server.filesdata.recommended-batch-size',
1174 b'server.filesdata.recommended-batch-size',
1175 default=50000,
1175 default=50000,
1176 )
1176 )
1177 coreconfigitem(
1177 coreconfigitem(
1178 b'experimental',
1178 b'experimental',
1179 b'server.manifestdata.recommended-batch-size',
1179 b'server.manifestdata.recommended-batch-size',
1180 default=100000,
1180 default=100000,
1181 )
1181 )
1182 coreconfigitem(
1182 coreconfigitem(
1183 b'experimental',
1183 b'experimental',
1184 b'server.stream-narrow-clones',
1184 b'server.stream-narrow-clones',
1185 default=False,
1185 default=False,
1186 )
1186 )
1187 coreconfigitem(
1187 coreconfigitem(
1188 b'experimental',
1188 b'experimental',
1189 b'single-head-per-branch',
1189 b'single-head-per-branch',
1190 default=False,
1190 default=False,
1191 )
1191 )
1192 coreconfigitem(
1192 coreconfigitem(
1193 b'experimental',
1193 b'experimental',
1194 b'single-head-per-branch:account-closed-heads',
1194 b'single-head-per-branch:account-closed-heads',
1195 default=False,
1195 default=False,
1196 )
1196 )
1197 coreconfigitem(
1197 coreconfigitem(
1198 b'experimental',
1198 b'experimental',
1199 b'single-head-per-branch:public-changes-only',
1199 b'single-head-per-branch:public-changes-only',
1200 default=False,
1200 default=False,
1201 )
1201 )
1202 coreconfigitem(
1202 coreconfigitem(
1203 b'experimental',
1203 b'experimental',
1204 b'sparse-read',
1204 b'sparse-read',
1205 default=False,
1205 default=False,
1206 )
1206 )
1207 coreconfigitem(
1207 coreconfigitem(
1208 b'experimental',
1208 b'experimental',
1209 b'sparse-read.density-threshold',
1209 b'sparse-read.density-threshold',
1210 default=0.50,
1210 default=0.50,
1211 )
1211 )
1212 coreconfigitem(
1212 coreconfigitem(
1213 b'experimental',
1213 b'experimental',
1214 b'sparse-read.min-gap-size',
1214 b'sparse-read.min-gap-size',
1215 default=b'65K',
1215 default=b'65K',
1216 )
1216 )
1217 coreconfigitem(
1217 coreconfigitem(
1218 b'experimental',
1218 b'experimental',
1219 b'treemanifest',
1219 b'treemanifest',
1220 default=False,
1220 default=False,
1221 )
1221 )
1222 coreconfigitem(
1222 coreconfigitem(
1223 b'experimental',
1223 b'experimental',
1224 b'update.atomic-file',
1224 b'update.atomic-file',
1225 default=False,
1225 default=False,
1226 )
1226 )
1227 coreconfigitem(
1227 coreconfigitem(
1228 b'experimental',
1228 b'experimental',
1229 b'web.full-garbage-collection-rate',
1229 b'web.full-garbage-collection-rate',
1230 default=1, # still forcing a full collection on each request
1230 default=1, # still forcing a full collection on each request
1231 )
1231 )
1232 coreconfigitem(
1232 coreconfigitem(
1233 b'experimental',
1233 b'experimental',
1234 b'worker.wdir-get-thread-safe',
1234 b'worker.wdir-get-thread-safe',
1235 default=False,
1235 default=False,
1236 )
1236 )
1237 coreconfigitem(
1237 coreconfigitem(
1238 b'experimental',
1238 b'experimental',
1239 b'worker.repository-upgrade',
1239 b'worker.repository-upgrade',
1240 default=False,
1240 default=False,
1241 )
1241 )
1242 coreconfigitem(
1242 coreconfigitem(
1243 b'experimental',
1243 b'experimental',
1244 b'xdiff',
1244 b'xdiff',
1245 default=False,
1245 default=False,
1246 )
1246 )
1247 coreconfigitem(
1247 coreconfigitem(
1248 b'extensions',
1248 b'extensions',
1249 b'[^:]*',
1249 b'[^:]*',
1250 default=None,
1250 default=None,
1251 generic=True,
1251 generic=True,
1252 )
1252 )
1253 coreconfigitem(
1253 coreconfigitem(
1254 b'extensions',
1254 b'extensions',
1255 b'[^:]*:required',
1255 b'[^:]*:required',
1256 default=False,
1256 default=False,
1257 generic=True,
1257 generic=True,
1258 )
1258 )
1259 coreconfigitem(
1259 coreconfigitem(
1260 b'extdata',
1260 b'extdata',
1261 b'.*',
1261 b'.*',
1262 default=None,
1262 default=None,
1263 generic=True,
1263 generic=True,
1264 )
1264 )
1265 coreconfigitem(
1265 coreconfigitem(
1266 b'format',
1266 b'format',
1267 b'bookmarks-in-store',
1267 b'bookmarks-in-store',
1268 default=False,
1268 default=False,
1269 )
1269 )
1270 coreconfigitem(
1270 coreconfigitem(
1271 b'format',
1271 b'format',
1272 b'chunkcachesize',
1272 b'chunkcachesize',
1273 default=None,
1273 default=None,
1274 experimental=True,
1274 experimental=True,
1275 )
1275 )
1276 coreconfigitem(
1276 coreconfigitem(
1277 # Enable this dirstate format *when creating a new repository*.
1277 # Enable this dirstate format *when creating a new repository*.
1278 # Which format to use for existing repos is controlled by .hg/requires
1278 # Which format to use for existing repos is controlled by .hg/requires
1279 b'format',
1279 b'format',
1280 b'use-dirstate-v2',
1280 b'use-dirstate-v2',
1281 default=False,
1281 default=False,
1282 experimental=True,
1282 experimental=True,
1283 alias=[(b'format', b'exp-rc-dirstate-v2')],
1283 alias=[(b'format', b'exp-rc-dirstate-v2')],
1284 )
1284 )
1285 coreconfigitem(
1285 coreconfigitem(
1286 b'format',
1286 b'format',
1287 b'exp-dirstate-tracked-key-version',
1287 b'dirstate-tracked-key',
1288 default=0,
1288 default=False,
1289 experimental=True,
1290 )
1291 coreconfigitem(
1292 b'format',
1293 b'dirstate-tracked-key.version',
1294 default=1,
1289 experimental=True,
1295 experimental=True,
1290 )
1296 )
1291 coreconfigitem(
1297 coreconfigitem(
1292 b'format',
1298 b'format',
1293 b'dotencode',
1299 b'dotencode',
1294 default=True,
1300 default=True,
1295 )
1301 )
1296 coreconfigitem(
1302 coreconfigitem(
1297 b'format',
1303 b'format',
1298 b'generaldelta',
1304 b'generaldelta',
1299 default=False,
1305 default=False,
1300 experimental=True,
1306 experimental=True,
1301 )
1307 )
1302 coreconfigitem(
1308 coreconfigitem(
1303 b'format',
1309 b'format',
1304 b'manifestcachesize',
1310 b'manifestcachesize',
1305 default=None,
1311 default=None,
1306 experimental=True,
1312 experimental=True,
1307 )
1313 )
1308 coreconfigitem(
1314 coreconfigitem(
1309 b'format',
1315 b'format',
1310 b'maxchainlen',
1316 b'maxchainlen',
1311 default=dynamicdefault,
1317 default=dynamicdefault,
1312 experimental=True,
1318 experimental=True,
1313 )
1319 )
1314 coreconfigitem(
1320 coreconfigitem(
1315 b'format',
1321 b'format',
1316 b'obsstore-version',
1322 b'obsstore-version',
1317 default=None,
1323 default=None,
1318 )
1324 )
1319 coreconfigitem(
1325 coreconfigitem(
1320 b'format',
1326 b'format',
1321 b'sparse-revlog',
1327 b'sparse-revlog',
1322 default=True,
1328 default=True,
1323 )
1329 )
1324 coreconfigitem(
1330 coreconfigitem(
1325 b'format',
1331 b'format',
1326 b'revlog-compression',
1332 b'revlog-compression',
1327 default=lambda: [b'zstd', b'zlib'],
1333 default=lambda: [b'zstd', b'zlib'],
1328 alias=[(b'experimental', b'format.compression')],
1334 alias=[(b'experimental', b'format.compression')],
1329 )
1335 )
1330 # Experimental TODOs:
1336 # Experimental TODOs:
1331 #
1337 #
1332 # * Same as for revlogv2 (but for the reduction of the number of files)
1338 # * Same as for revlogv2 (but for the reduction of the number of files)
1333 # * Actually computing the rank of changesets
1339 # * Actually computing the rank of changesets
1334 # * Improvement to investigate
1340 # * Improvement to investigate
1335 # - storing .hgtags fnode
1341 # - storing .hgtags fnode
1336 # - storing branch related identifier
1342 # - storing branch related identifier
1337
1343
1338 coreconfigitem(
1344 coreconfigitem(
1339 b'format',
1345 b'format',
1340 b'exp-use-changelog-v2',
1346 b'exp-use-changelog-v2',
1341 default=None,
1347 default=None,
1342 experimental=True,
1348 experimental=True,
1343 )
1349 )
1344 coreconfigitem(
1350 coreconfigitem(
1345 b'format',
1351 b'format',
1346 b'usefncache',
1352 b'usefncache',
1347 default=True,
1353 default=True,
1348 )
1354 )
1349 coreconfigitem(
1355 coreconfigitem(
1350 b'format',
1356 b'format',
1351 b'usegeneraldelta',
1357 b'usegeneraldelta',
1352 default=True,
1358 default=True,
1353 )
1359 )
1354 coreconfigitem(
1360 coreconfigitem(
1355 b'format',
1361 b'format',
1356 b'usestore',
1362 b'usestore',
1357 default=True,
1363 default=True,
1358 )
1364 )
1359
1365
1360
1366
1361 def _persistent_nodemap_default():
1367 def _persistent_nodemap_default():
1362 """compute `use-persistent-nodemap` default value
1368 """compute `use-persistent-nodemap` default value
1363
1369
1364 The feature is disabled unless a fast implementation is available.
1370 The feature is disabled unless a fast implementation is available.
1365 """
1371 """
1366 from . import policy
1372 from . import policy
1367
1373
1368 return policy.importrust('revlog') is not None
1374 return policy.importrust('revlog') is not None
1369
1375
1370
1376
1371 coreconfigitem(
1377 coreconfigitem(
1372 b'format',
1378 b'format',
1373 b'use-persistent-nodemap',
1379 b'use-persistent-nodemap',
1374 default=_persistent_nodemap_default,
1380 default=_persistent_nodemap_default,
1375 )
1381 )
1376 coreconfigitem(
1382 coreconfigitem(
1377 b'format',
1383 b'format',
1378 b'exp-use-copies-side-data-changeset',
1384 b'exp-use-copies-side-data-changeset',
1379 default=False,
1385 default=False,
1380 experimental=True,
1386 experimental=True,
1381 )
1387 )
1382 coreconfigitem(
1388 coreconfigitem(
1383 b'format',
1389 b'format',
1384 b'use-share-safe',
1390 b'use-share-safe',
1385 default=True,
1391 default=True,
1386 )
1392 )
1387 coreconfigitem(
1393 coreconfigitem(
1388 b'format',
1394 b'format',
1389 b'internal-phase',
1395 b'internal-phase',
1390 default=False,
1396 default=False,
1391 experimental=True,
1397 experimental=True,
1392 )
1398 )
1393 coreconfigitem(
1399 coreconfigitem(
1394 b'fsmonitor',
1400 b'fsmonitor',
1395 b'warn_when_unused',
1401 b'warn_when_unused',
1396 default=True,
1402 default=True,
1397 )
1403 )
1398 coreconfigitem(
1404 coreconfigitem(
1399 b'fsmonitor',
1405 b'fsmonitor',
1400 b'warn_update_file_count',
1406 b'warn_update_file_count',
1401 default=50000,
1407 default=50000,
1402 )
1408 )
1403 coreconfigitem(
1409 coreconfigitem(
1404 b'fsmonitor',
1410 b'fsmonitor',
1405 b'warn_update_file_count_rust',
1411 b'warn_update_file_count_rust',
1406 default=400000,
1412 default=400000,
1407 )
1413 )
1408 coreconfigitem(
1414 coreconfigitem(
1409 b'help',
1415 b'help',
1410 br'hidden-command\..*',
1416 br'hidden-command\..*',
1411 default=False,
1417 default=False,
1412 generic=True,
1418 generic=True,
1413 )
1419 )
1414 coreconfigitem(
1420 coreconfigitem(
1415 b'help',
1421 b'help',
1416 br'hidden-topic\..*',
1422 br'hidden-topic\..*',
1417 default=False,
1423 default=False,
1418 generic=True,
1424 generic=True,
1419 )
1425 )
1420 coreconfigitem(
1426 coreconfigitem(
1421 b'hooks',
1427 b'hooks',
1422 b'[^:]*',
1428 b'[^:]*',
1423 default=dynamicdefault,
1429 default=dynamicdefault,
1424 generic=True,
1430 generic=True,
1425 )
1431 )
1426 coreconfigitem(
1432 coreconfigitem(
1427 b'hooks',
1433 b'hooks',
1428 b'.*:run-with-plain',
1434 b'.*:run-with-plain',
1429 default=True,
1435 default=True,
1430 generic=True,
1436 generic=True,
1431 )
1437 )
1432 coreconfigitem(
1438 coreconfigitem(
1433 b'hgweb-paths',
1439 b'hgweb-paths',
1434 b'.*',
1440 b'.*',
1435 default=list,
1441 default=list,
1436 generic=True,
1442 generic=True,
1437 )
1443 )
1438 coreconfigitem(
1444 coreconfigitem(
1439 b'hostfingerprints',
1445 b'hostfingerprints',
1440 b'.*',
1446 b'.*',
1441 default=list,
1447 default=list,
1442 generic=True,
1448 generic=True,
1443 )
1449 )
1444 coreconfigitem(
1450 coreconfigitem(
1445 b'hostsecurity',
1451 b'hostsecurity',
1446 b'ciphers',
1452 b'ciphers',
1447 default=None,
1453 default=None,
1448 )
1454 )
1449 coreconfigitem(
1455 coreconfigitem(
1450 b'hostsecurity',
1456 b'hostsecurity',
1451 b'minimumprotocol',
1457 b'minimumprotocol',
1452 default=dynamicdefault,
1458 default=dynamicdefault,
1453 )
1459 )
1454 coreconfigitem(
1460 coreconfigitem(
1455 b'hostsecurity',
1461 b'hostsecurity',
1456 b'.*:minimumprotocol$',
1462 b'.*:minimumprotocol$',
1457 default=dynamicdefault,
1463 default=dynamicdefault,
1458 generic=True,
1464 generic=True,
1459 )
1465 )
1460 coreconfigitem(
1466 coreconfigitem(
1461 b'hostsecurity',
1467 b'hostsecurity',
1462 b'.*:ciphers$',
1468 b'.*:ciphers$',
1463 default=dynamicdefault,
1469 default=dynamicdefault,
1464 generic=True,
1470 generic=True,
1465 )
1471 )
1466 coreconfigitem(
1472 coreconfigitem(
1467 b'hostsecurity',
1473 b'hostsecurity',
1468 b'.*:fingerprints$',
1474 b'.*:fingerprints$',
1469 default=list,
1475 default=list,
1470 generic=True,
1476 generic=True,
1471 )
1477 )
1472 coreconfigitem(
1478 coreconfigitem(
1473 b'hostsecurity',
1479 b'hostsecurity',
1474 b'.*:verifycertsfile$',
1480 b'.*:verifycertsfile$',
1475 default=None,
1481 default=None,
1476 generic=True,
1482 generic=True,
1477 )
1483 )
1478
1484
1479 coreconfigitem(
1485 coreconfigitem(
1480 b'http_proxy',
1486 b'http_proxy',
1481 b'always',
1487 b'always',
1482 default=False,
1488 default=False,
1483 )
1489 )
1484 coreconfigitem(
1490 coreconfigitem(
1485 b'http_proxy',
1491 b'http_proxy',
1486 b'host',
1492 b'host',
1487 default=None,
1493 default=None,
1488 )
1494 )
1489 coreconfigitem(
1495 coreconfigitem(
1490 b'http_proxy',
1496 b'http_proxy',
1491 b'no',
1497 b'no',
1492 default=list,
1498 default=list,
1493 )
1499 )
1494 coreconfigitem(
1500 coreconfigitem(
1495 b'http_proxy',
1501 b'http_proxy',
1496 b'passwd',
1502 b'passwd',
1497 default=None,
1503 default=None,
1498 )
1504 )
1499 coreconfigitem(
1505 coreconfigitem(
1500 b'http_proxy',
1506 b'http_proxy',
1501 b'user',
1507 b'user',
1502 default=None,
1508 default=None,
1503 )
1509 )
1504
1510
1505 coreconfigitem(
1511 coreconfigitem(
1506 b'http',
1512 b'http',
1507 b'timeout',
1513 b'timeout',
1508 default=None,
1514 default=None,
1509 )
1515 )
1510
1516
1511 coreconfigitem(
1517 coreconfigitem(
1512 b'logtoprocess',
1518 b'logtoprocess',
1513 b'commandexception',
1519 b'commandexception',
1514 default=None,
1520 default=None,
1515 )
1521 )
1516 coreconfigitem(
1522 coreconfigitem(
1517 b'logtoprocess',
1523 b'logtoprocess',
1518 b'commandfinish',
1524 b'commandfinish',
1519 default=None,
1525 default=None,
1520 )
1526 )
1521 coreconfigitem(
1527 coreconfigitem(
1522 b'logtoprocess',
1528 b'logtoprocess',
1523 b'command',
1529 b'command',
1524 default=None,
1530 default=None,
1525 )
1531 )
1526 coreconfigitem(
1532 coreconfigitem(
1527 b'logtoprocess',
1533 b'logtoprocess',
1528 b'develwarn',
1534 b'develwarn',
1529 default=None,
1535 default=None,
1530 )
1536 )
1531 coreconfigitem(
1537 coreconfigitem(
1532 b'logtoprocess',
1538 b'logtoprocess',
1533 b'uiblocked',
1539 b'uiblocked',
1534 default=None,
1540 default=None,
1535 )
1541 )
1536 coreconfigitem(
1542 coreconfigitem(
1537 b'merge',
1543 b'merge',
1538 b'checkunknown',
1544 b'checkunknown',
1539 default=b'abort',
1545 default=b'abort',
1540 )
1546 )
1541 coreconfigitem(
1547 coreconfigitem(
1542 b'merge',
1548 b'merge',
1543 b'checkignored',
1549 b'checkignored',
1544 default=b'abort',
1550 default=b'abort',
1545 )
1551 )
1546 coreconfigitem(
1552 coreconfigitem(
1547 b'experimental',
1553 b'experimental',
1548 b'merge.checkpathconflicts',
1554 b'merge.checkpathconflicts',
1549 default=False,
1555 default=False,
1550 )
1556 )
1551 coreconfigitem(
1557 coreconfigitem(
1552 b'merge',
1558 b'merge',
1553 b'followcopies',
1559 b'followcopies',
1554 default=True,
1560 default=True,
1555 )
1561 )
1556 coreconfigitem(
1562 coreconfigitem(
1557 b'merge',
1563 b'merge',
1558 b'on-failure',
1564 b'on-failure',
1559 default=b'continue',
1565 default=b'continue',
1560 )
1566 )
1561 coreconfigitem(
1567 coreconfigitem(
1562 b'merge',
1568 b'merge',
1563 b'preferancestor',
1569 b'preferancestor',
1564 default=lambda: [b'*'],
1570 default=lambda: [b'*'],
1565 experimental=True,
1571 experimental=True,
1566 )
1572 )
1567 coreconfigitem(
1573 coreconfigitem(
1568 b'merge',
1574 b'merge',
1569 b'strict-capability-check',
1575 b'strict-capability-check',
1570 default=False,
1576 default=False,
1571 )
1577 )
1572 coreconfigitem(
1578 coreconfigitem(
1573 b'merge-tools',
1579 b'merge-tools',
1574 b'.*',
1580 b'.*',
1575 default=None,
1581 default=None,
1576 generic=True,
1582 generic=True,
1577 )
1583 )
1578 coreconfigitem(
1584 coreconfigitem(
1579 b'merge-tools',
1585 b'merge-tools',
1580 br'.*\.args$',
1586 br'.*\.args$',
1581 default=b"$local $base $other",
1587 default=b"$local $base $other",
1582 generic=True,
1588 generic=True,
1583 priority=-1,
1589 priority=-1,
1584 )
1590 )
1585 coreconfigitem(
1591 coreconfigitem(
1586 b'merge-tools',
1592 b'merge-tools',
1587 br'.*\.binary$',
1593 br'.*\.binary$',
1588 default=False,
1594 default=False,
1589 generic=True,
1595 generic=True,
1590 priority=-1,
1596 priority=-1,
1591 )
1597 )
1592 coreconfigitem(
1598 coreconfigitem(
1593 b'merge-tools',
1599 b'merge-tools',
1594 br'.*\.check$',
1600 br'.*\.check$',
1595 default=list,
1601 default=list,
1596 generic=True,
1602 generic=True,
1597 priority=-1,
1603 priority=-1,
1598 )
1604 )
1599 coreconfigitem(
1605 coreconfigitem(
1600 b'merge-tools',
1606 b'merge-tools',
1601 br'.*\.checkchanged$',
1607 br'.*\.checkchanged$',
1602 default=False,
1608 default=False,
1603 generic=True,
1609 generic=True,
1604 priority=-1,
1610 priority=-1,
1605 )
1611 )
1606 coreconfigitem(
1612 coreconfigitem(
1607 b'merge-tools',
1613 b'merge-tools',
1608 br'.*\.executable$',
1614 br'.*\.executable$',
1609 default=dynamicdefault,
1615 default=dynamicdefault,
1610 generic=True,
1616 generic=True,
1611 priority=-1,
1617 priority=-1,
1612 )
1618 )
1613 coreconfigitem(
1619 coreconfigitem(
1614 b'merge-tools',
1620 b'merge-tools',
1615 br'.*\.fixeol$',
1621 br'.*\.fixeol$',
1616 default=False,
1622 default=False,
1617 generic=True,
1623 generic=True,
1618 priority=-1,
1624 priority=-1,
1619 )
1625 )
1620 coreconfigitem(
1626 coreconfigitem(
1621 b'merge-tools',
1627 b'merge-tools',
1622 br'.*\.gui$',
1628 br'.*\.gui$',
1623 default=False,
1629 default=False,
1624 generic=True,
1630 generic=True,
1625 priority=-1,
1631 priority=-1,
1626 )
1632 )
1627 coreconfigitem(
1633 coreconfigitem(
1628 b'merge-tools',
1634 b'merge-tools',
1629 br'.*\.mergemarkers$',
1635 br'.*\.mergemarkers$',
1630 default=b'basic',
1636 default=b'basic',
1631 generic=True,
1637 generic=True,
1632 priority=-1,
1638 priority=-1,
1633 )
1639 )
1634 coreconfigitem(
1640 coreconfigitem(
1635 b'merge-tools',
1641 b'merge-tools',
1636 br'.*\.mergemarkertemplate$',
1642 br'.*\.mergemarkertemplate$',
1637 default=dynamicdefault, # take from command-templates.mergemarker
1643 default=dynamicdefault, # take from command-templates.mergemarker
1638 generic=True,
1644 generic=True,
1639 priority=-1,
1645 priority=-1,
1640 )
1646 )
1641 coreconfigitem(
1647 coreconfigitem(
1642 b'merge-tools',
1648 b'merge-tools',
1643 br'.*\.priority$',
1649 br'.*\.priority$',
1644 default=0,
1650 default=0,
1645 generic=True,
1651 generic=True,
1646 priority=-1,
1652 priority=-1,
1647 )
1653 )
1648 coreconfigitem(
1654 coreconfigitem(
1649 b'merge-tools',
1655 b'merge-tools',
1650 br'.*\.premerge$',
1656 br'.*\.premerge$',
1651 default=dynamicdefault,
1657 default=dynamicdefault,
1652 generic=True,
1658 generic=True,
1653 priority=-1,
1659 priority=-1,
1654 )
1660 )
1655 coreconfigitem(
1661 coreconfigitem(
1656 b'merge-tools',
1662 b'merge-tools',
1657 br'.*\.symlink$',
1663 br'.*\.symlink$',
1658 default=False,
1664 default=False,
1659 generic=True,
1665 generic=True,
1660 priority=-1,
1666 priority=-1,
1661 )
1667 )
1662 coreconfigitem(
1668 coreconfigitem(
1663 b'pager',
1669 b'pager',
1664 b'attend-.*',
1670 b'attend-.*',
1665 default=dynamicdefault,
1671 default=dynamicdefault,
1666 generic=True,
1672 generic=True,
1667 )
1673 )
1668 coreconfigitem(
1674 coreconfigitem(
1669 b'pager',
1675 b'pager',
1670 b'ignore',
1676 b'ignore',
1671 default=list,
1677 default=list,
1672 )
1678 )
1673 coreconfigitem(
1679 coreconfigitem(
1674 b'pager',
1680 b'pager',
1675 b'pager',
1681 b'pager',
1676 default=dynamicdefault,
1682 default=dynamicdefault,
1677 )
1683 )
1678 coreconfigitem(
1684 coreconfigitem(
1679 b'patch',
1685 b'patch',
1680 b'eol',
1686 b'eol',
1681 default=b'strict',
1687 default=b'strict',
1682 )
1688 )
1683 coreconfigitem(
1689 coreconfigitem(
1684 b'patch',
1690 b'patch',
1685 b'fuzz',
1691 b'fuzz',
1686 default=2,
1692 default=2,
1687 )
1693 )
1688 coreconfigitem(
1694 coreconfigitem(
1689 b'paths',
1695 b'paths',
1690 b'default',
1696 b'default',
1691 default=None,
1697 default=None,
1692 )
1698 )
1693 coreconfigitem(
1699 coreconfigitem(
1694 b'paths',
1700 b'paths',
1695 b'default-push',
1701 b'default-push',
1696 default=None,
1702 default=None,
1697 )
1703 )
1698 coreconfigitem(
1704 coreconfigitem(
1699 b'paths',
1705 b'paths',
1700 b'.*',
1706 b'.*',
1701 default=None,
1707 default=None,
1702 generic=True,
1708 generic=True,
1703 )
1709 )
1704 coreconfigitem(
1710 coreconfigitem(
1705 b'phases',
1711 b'phases',
1706 b'checksubrepos',
1712 b'checksubrepos',
1707 default=b'follow',
1713 default=b'follow',
1708 )
1714 )
1709 coreconfigitem(
1715 coreconfigitem(
1710 b'phases',
1716 b'phases',
1711 b'new-commit',
1717 b'new-commit',
1712 default=b'draft',
1718 default=b'draft',
1713 )
1719 )
1714 coreconfigitem(
1720 coreconfigitem(
1715 b'phases',
1721 b'phases',
1716 b'publish',
1722 b'publish',
1717 default=True,
1723 default=True,
1718 )
1724 )
1719 coreconfigitem(
1725 coreconfigitem(
1720 b'profiling',
1726 b'profiling',
1721 b'enabled',
1727 b'enabled',
1722 default=False,
1728 default=False,
1723 )
1729 )
1724 coreconfigitem(
1730 coreconfigitem(
1725 b'profiling',
1731 b'profiling',
1726 b'format',
1732 b'format',
1727 default=b'text',
1733 default=b'text',
1728 )
1734 )
1729 coreconfigitem(
1735 coreconfigitem(
1730 b'profiling',
1736 b'profiling',
1731 b'freq',
1737 b'freq',
1732 default=1000,
1738 default=1000,
1733 )
1739 )
1734 coreconfigitem(
1740 coreconfigitem(
1735 b'profiling',
1741 b'profiling',
1736 b'limit',
1742 b'limit',
1737 default=30,
1743 default=30,
1738 )
1744 )
1739 coreconfigitem(
1745 coreconfigitem(
1740 b'profiling',
1746 b'profiling',
1741 b'nested',
1747 b'nested',
1742 default=0,
1748 default=0,
1743 )
1749 )
1744 coreconfigitem(
1750 coreconfigitem(
1745 b'profiling',
1751 b'profiling',
1746 b'output',
1752 b'output',
1747 default=None,
1753 default=None,
1748 )
1754 )
1749 coreconfigitem(
1755 coreconfigitem(
1750 b'profiling',
1756 b'profiling',
1751 b'showmax',
1757 b'showmax',
1752 default=0.999,
1758 default=0.999,
1753 )
1759 )
1754 coreconfigitem(
1760 coreconfigitem(
1755 b'profiling',
1761 b'profiling',
1756 b'showmin',
1762 b'showmin',
1757 default=dynamicdefault,
1763 default=dynamicdefault,
1758 )
1764 )
1759 coreconfigitem(
1765 coreconfigitem(
1760 b'profiling',
1766 b'profiling',
1761 b'showtime',
1767 b'showtime',
1762 default=True,
1768 default=True,
1763 )
1769 )
1764 coreconfigitem(
1770 coreconfigitem(
1765 b'profiling',
1771 b'profiling',
1766 b'sort',
1772 b'sort',
1767 default=b'inlinetime',
1773 default=b'inlinetime',
1768 )
1774 )
1769 coreconfigitem(
1775 coreconfigitem(
1770 b'profiling',
1776 b'profiling',
1771 b'statformat',
1777 b'statformat',
1772 default=b'hotpath',
1778 default=b'hotpath',
1773 )
1779 )
1774 coreconfigitem(
1780 coreconfigitem(
1775 b'profiling',
1781 b'profiling',
1776 b'time-track',
1782 b'time-track',
1777 default=dynamicdefault,
1783 default=dynamicdefault,
1778 )
1784 )
1779 coreconfigitem(
1785 coreconfigitem(
1780 b'profiling',
1786 b'profiling',
1781 b'type',
1787 b'type',
1782 default=b'stat',
1788 default=b'stat',
1783 )
1789 )
1784 coreconfigitem(
1790 coreconfigitem(
1785 b'progress',
1791 b'progress',
1786 b'assume-tty',
1792 b'assume-tty',
1787 default=False,
1793 default=False,
1788 )
1794 )
1789 coreconfigitem(
1795 coreconfigitem(
1790 b'progress',
1796 b'progress',
1791 b'changedelay',
1797 b'changedelay',
1792 default=1,
1798 default=1,
1793 )
1799 )
1794 coreconfigitem(
1800 coreconfigitem(
1795 b'progress',
1801 b'progress',
1796 b'clear-complete',
1802 b'clear-complete',
1797 default=True,
1803 default=True,
1798 )
1804 )
1799 coreconfigitem(
1805 coreconfigitem(
1800 b'progress',
1806 b'progress',
1801 b'debug',
1807 b'debug',
1802 default=False,
1808 default=False,
1803 )
1809 )
1804 coreconfigitem(
1810 coreconfigitem(
1805 b'progress',
1811 b'progress',
1806 b'delay',
1812 b'delay',
1807 default=3,
1813 default=3,
1808 )
1814 )
1809 coreconfigitem(
1815 coreconfigitem(
1810 b'progress',
1816 b'progress',
1811 b'disable',
1817 b'disable',
1812 default=False,
1818 default=False,
1813 )
1819 )
1814 coreconfigitem(
1820 coreconfigitem(
1815 b'progress',
1821 b'progress',
1816 b'estimateinterval',
1822 b'estimateinterval',
1817 default=60.0,
1823 default=60.0,
1818 )
1824 )
1819 coreconfigitem(
1825 coreconfigitem(
1820 b'progress',
1826 b'progress',
1821 b'format',
1827 b'format',
1822 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1828 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1823 )
1829 )
1824 coreconfigitem(
1830 coreconfigitem(
1825 b'progress',
1831 b'progress',
1826 b'refresh',
1832 b'refresh',
1827 default=0.1,
1833 default=0.1,
1828 )
1834 )
1829 coreconfigitem(
1835 coreconfigitem(
1830 b'progress',
1836 b'progress',
1831 b'width',
1837 b'width',
1832 default=dynamicdefault,
1838 default=dynamicdefault,
1833 )
1839 )
1834 coreconfigitem(
1840 coreconfigitem(
1835 b'pull',
1841 b'pull',
1836 b'confirm',
1842 b'confirm',
1837 default=False,
1843 default=False,
1838 )
1844 )
1839 coreconfigitem(
1845 coreconfigitem(
1840 b'push',
1846 b'push',
1841 b'pushvars.server',
1847 b'pushvars.server',
1842 default=False,
1848 default=False,
1843 )
1849 )
1844 coreconfigitem(
1850 coreconfigitem(
1845 b'rewrite',
1851 b'rewrite',
1846 b'backup-bundle',
1852 b'backup-bundle',
1847 default=True,
1853 default=True,
1848 alias=[(b'ui', b'history-editing-backup')],
1854 alias=[(b'ui', b'history-editing-backup')],
1849 )
1855 )
1850 coreconfigitem(
1856 coreconfigitem(
1851 b'rewrite',
1857 b'rewrite',
1852 b'update-timestamp',
1858 b'update-timestamp',
1853 default=False,
1859 default=False,
1854 )
1860 )
1855 coreconfigitem(
1861 coreconfigitem(
1856 b'rewrite',
1862 b'rewrite',
1857 b'empty-successor',
1863 b'empty-successor',
1858 default=b'skip',
1864 default=b'skip',
1859 experimental=True,
1865 experimental=True,
1860 )
1866 )
1861 # experimental as long as format.use-dirstate-v2 is.
1867 # experimental as long as format.use-dirstate-v2 is.
1862 coreconfigitem(
1868 coreconfigitem(
1863 b'storage',
1869 b'storage',
1864 b'dirstate-v2.slow-path',
1870 b'dirstate-v2.slow-path',
1865 default=b"abort",
1871 default=b"abort",
1866 experimental=True,
1872 experimental=True,
1867 )
1873 )
1868 coreconfigitem(
1874 coreconfigitem(
1869 b'storage',
1875 b'storage',
1870 b'new-repo-backend',
1876 b'new-repo-backend',
1871 default=b'revlogv1',
1877 default=b'revlogv1',
1872 experimental=True,
1878 experimental=True,
1873 )
1879 )
1874 coreconfigitem(
1880 coreconfigitem(
1875 b'storage',
1881 b'storage',
1876 b'revlog.optimize-delta-parent-choice',
1882 b'revlog.optimize-delta-parent-choice',
1877 default=True,
1883 default=True,
1878 alias=[(b'format', b'aggressivemergedeltas')],
1884 alias=[(b'format', b'aggressivemergedeltas')],
1879 )
1885 )
1880 coreconfigitem(
1886 coreconfigitem(
1881 b'storage',
1887 b'storage',
1882 b'revlog.issue6528.fix-incoming',
1888 b'revlog.issue6528.fix-incoming',
1883 default=True,
1889 default=True,
1884 )
1890 )
1885 # experimental as long as rust is experimental (or a C version is implemented)
1891 # experimental as long as rust is experimental (or a C version is implemented)
1886 coreconfigitem(
1892 coreconfigitem(
1887 b'storage',
1893 b'storage',
1888 b'revlog.persistent-nodemap.mmap',
1894 b'revlog.persistent-nodemap.mmap',
1889 default=True,
1895 default=True,
1890 )
1896 )
1891 # experimental as long as format.use-persistent-nodemap is.
1897 # experimental as long as format.use-persistent-nodemap is.
1892 coreconfigitem(
1898 coreconfigitem(
1893 b'storage',
1899 b'storage',
1894 b'revlog.persistent-nodemap.slow-path',
1900 b'revlog.persistent-nodemap.slow-path',
1895 default=b"abort",
1901 default=b"abort",
1896 )
1902 )
1897
1903
1898 coreconfigitem(
1904 coreconfigitem(
1899 b'storage',
1905 b'storage',
1900 b'revlog.reuse-external-delta',
1906 b'revlog.reuse-external-delta',
1901 default=True,
1907 default=True,
1902 )
1908 )
1903 coreconfigitem(
1909 coreconfigitem(
1904 b'storage',
1910 b'storage',
1905 b'revlog.reuse-external-delta-parent',
1911 b'revlog.reuse-external-delta-parent',
1906 default=None,
1912 default=None,
1907 )
1913 )
1908 coreconfigitem(
1914 coreconfigitem(
1909 b'storage',
1915 b'storage',
1910 b'revlog.zlib.level',
1916 b'revlog.zlib.level',
1911 default=None,
1917 default=None,
1912 )
1918 )
1913 coreconfigitem(
1919 coreconfigitem(
1914 b'storage',
1920 b'storage',
1915 b'revlog.zstd.level',
1921 b'revlog.zstd.level',
1916 default=None,
1922 default=None,
1917 )
1923 )
1918 coreconfigitem(
1924 coreconfigitem(
1919 b'server',
1925 b'server',
1920 b'bookmarks-pushkey-compat',
1926 b'bookmarks-pushkey-compat',
1921 default=True,
1927 default=True,
1922 )
1928 )
1923 coreconfigitem(
1929 coreconfigitem(
1924 b'server',
1930 b'server',
1925 b'bundle1',
1931 b'bundle1',
1926 default=True,
1932 default=True,
1927 )
1933 )
1928 coreconfigitem(
1934 coreconfigitem(
1929 b'server',
1935 b'server',
1930 b'bundle1gd',
1936 b'bundle1gd',
1931 default=None,
1937 default=None,
1932 )
1938 )
1933 coreconfigitem(
1939 coreconfigitem(
1934 b'server',
1940 b'server',
1935 b'bundle1.pull',
1941 b'bundle1.pull',
1936 default=None,
1942 default=None,
1937 )
1943 )
1938 coreconfigitem(
1944 coreconfigitem(
1939 b'server',
1945 b'server',
1940 b'bundle1gd.pull',
1946 b'bundle1gd.pull',
1941 default=None,
1947 default=None,
1942 )
1948 )
1943 coreconfigitem(
1949 coreconfigitem(
1944 b'server',
1950 b'server',
1945 b'bundle1.push',
1951 b'bundle1.push',
1946 default=None,
1952 default=None,
1947 )
1953 )
1948 coreconfigitem(
1954 coreconfigitem(
1949 b'server',
1955 b'server',
1950 b'bundle1gd.push',
1956 b'bundle1gd.push',
1951 default=None,
1957 default=None,
1952 )
1958 )
1953 coreconfigitem(
1959 coreconfigitem(
1954 b'server',
1960 b'server',
1955 b'bundle2.stream',
1961 b'bundle2.stream',
1956 default=True,
1962 default=True,
1957 alias=[(b'experimental', b'bundle2.stream')],
1963 alias=[(b'experimental', b'bundle2.stream')],
1958 )
1964 )
1959 coreconfigitem(
1965 coreconfigitem(
1960 b'server',
1966 b'server',
1961 b'compressionengines',
1967 b'compressionengines',
1962 default=list,
1968 default=list,
1963 )
1969 )
1964 coreconfigitem(
1970 coreconfigitem(
1965 b'server',
1971 b'server',
1966 b'concurrent-push-mode',
1972 b'concurrent-push-mode',
1967 default=b'check-related',
1973 default=b'check-related',
1968 )
1974 )
1969 coreconfigitem(
1975 coreconfigitem(
1970 b'server',
1976 b'server',
1971 b'disablefullbundle',
1977 b'disablefullbundle',
1972 default=False,
1978 default=False,
1973 )
1979 )
1974 coreconfigitem(
1980 coreconfigitem(
1975 b'server',
1981 b'server',
1976 b'maxhttpheaderlen',
1982 b'maxhttpheaderlen',
1977 default=1024,
1983 default=1024,
1978 )
1984 )
1979 coreconfigitem(
1985 coreconfigitem(
1980 b'server',
1986 b'server',
1981 b'pullbundle',
1987 b'pullbundle',
1982 default=False,
1988 default=False,
1983 )
1989 )
1984 coreconfigitem(
1990 coreconfigitem(
1985 b'server',
1991 b'server',
1986 b'preferuncompressed',
1992 b'preferuncompressed',
1987 default=False,
1993 default=False,
1988 )
1994 )
1989 coreconfigitem(
1995 coreconfigitem(
1990 b'server',
1996 b'server',
1991 b'streamunbundle',
1997 b'streamunbundle',
1992 default=False,
1998 default=False,
1993 )
1999 )
1994 coreconfigitem(
2000 coreconfigitem(
1995 b'server',
2001 b'server',
1996 b'uncompressed',
2002 b'uncompressed',
1997 default=True,
2003 default=True,
1998 )
2004 )
1999 coreconfigitem(
2005 coreconfigitem(
2000 b'server',
2006 b'server',
2001 b'uncompressedallowsecret',
2007 b'uncompressedallowsecret',
2002 default=False,
2008 default=False,
2003 )
2009 )
2004 coreconfigitem(
2010 coreconfigitem(
2005 b'server',
2011 b'server',
2006 b'view',
2012 b'view',
2007 default=b'served',
2013 default=b'served',
2008 )
2014 )
2009 coreconfigitem(
2015 coreconfigitem(
2010 b'server',
2016 b'server',
2011 b'validate',
2017 b'validate',
2012 default=False,
2018 default=False,
2013 )
2019 )
2014 coreconfigitem(
2020 coreconfigitem(
2015 b'server',
2021 b'server',
2016 b'zliblevel',
2022 b'zliblevel',
2017 default=-1,
2023 default=-1,
2018 )
2024 )
2019 coreconfigitem(
2025 coreconfigitem(
2020 b'server',
2026 b'server',
2021 b'zstdlevel',
2027 b'zstdlevel',
2022 default=3,
2028 default=3,
2023 )
2029 )
2024 coreconfigitem(
2030 coreconfigitem(
2025 b'share',
2031 b'share',
2026 b'pool',
2032 b'pool',
2027 default=None,
2033 default=None,
2028 )
2034 )
2029 coreconfigitem(
2035 coreconfigitem(
2030 b'share',
2036 b'share',
2031 b'poolnaming',
2037 b'poolnaming',
2032 default=b'identity',
2038 default=b'identity',
2033 )
2039 )
2034 coreconfigitem(
2040 coreconfigitem(
2035 b'share',
2041 b'share',
2036 b'safe-mismatch.source-not-safe',
2042 b'safe-mismatch.source-not-safe',
2037 default=b'abort',
2043 default=b'abort',
2038 )
2044 )
2039 coreconfigitem(
2045 coreconfigitem(
2040 b'share',
2046 b'share',
2041 b'safe-mismatch.source-safe',
2047 b'safe-mismatch.source-safe',
2042 default=b'abort',
2048 default=b'abort',
2043 )
2049 )
2044 coreconfigitem(
2050 coreconfigitem(
2045 b'share',
2051 b'share',
2046 b'safe-mismatch.source-not-safe.warn',
2052 b'safe-mismatch.source-not-safe.warn',
2047 default=True,
2053 default=True,
2048 )
2054 )
2049 coreconfigitem(
2055 coreconfigitem(
2050 b'share',
2056 b'share',
2051 b'safe-mismatch.source-safe.warn',
2057 b'safe-mismatch.source-safe.warn',
2052 default=True,
2058 default=True,
2053 )
2059 )
2054 coreconfigitem(
2060 coreconfigitem(
2055 b'shelve',
2061 b'shelve',
2056 b'maxbackups',
2062 b'maxbackups',
2057 default=10,
2063 default=10,
2058 )
2064 )
2059 coreconfigitem(
2065 coreconfigitem(
2060 b'smtp',
2066 b'smtp',
2061 b'host',
2067 b'host',
2062 default=None,
2068 default=None,
2063 )
2069 )
2064 coreconfigitem(
2070 coreconfigitem(
2065 b'smtp',
2071 b'smtp',
2066 b'local_hostname',
2072 b'local_hostname',
2067 default=None,
2073 default=None,
2068 )
2074 )
2069 coreconfigitem(
2075 coreconfigitem(
2070 b'smtp',
2076 b'smtp',
2071 b'password',
2077 b'password',
2072 default=None,
2078 default=None,
2073 )
2079 )
2074 coreconfigitem(
2080 coreconfigitem(
2075 b'smtp',
2081 b'smtp',
2076 b'port',
2082 b'port',
2077 default=dynamicdefault,
2083 default=dynamicdefault,
2078 )
2084 )
2079 coreconfigitem(
2085 coreconfigitem(
2080 b'smtp',
2086 b'smtp',
2081 b'tls',
2087 b'tls',
2082 default=b'none',
2088 default=b'none',
2083 )
2089 )
2084 coreconfigitem(
2090 coreconfigitem(
2085 b'smtp',
2091 b'smtp',
2086 b'username',
2092 b'username',
2087 default=None,
2093 default=None,
2088 )
2094 )
2089 coreconfigitem(
2095 coreconfigitem(
2090 b'sparse',
2096 b'sparse',
2091 b'missingwarning',
2097 b'missingwarning',
2092 default=True,
2098 default=True,
2093 experimental=True,
2099 experimental=True,
2094 )
2100 )
2095 coreconfigitem(
2101 coreconfigitem(
2096 b'subrepos',
2102 b'subrepos',
2097 b'allowed',
2103 b'allowed',
2098 default=dynamicdefault, # to make backporting simpler
2104 default=dynamicdefault, # to make backporting simpler
2099 )
2105 )
2100 coreconfigitem(
2106 coreconfigitem(
2101 b'subrepos',
2107 b'subrepos',
2102 b'hg:allowed',
2108 b'hg:allowed',
2103 default=dynamicdefault,
2109 default=dynamicdefault,
2104 )
2110 )
2105 coreconfigitem(
2111 coreconfigitem(
2106 b'subrepos',
2112 b'subrepos',
2107 b'git:allowed',
2113 b'git:allowed',
2108 default=dynamicdefault,
2114 default=dynamicdefault,
2109 )
2115 )
2110 coreconfigitem(
2116 coreconfigitem(
2111 b'subrepos',
2117 b'subrepos',
2112 b'svn:allowed',
2118 b'svn:allowed',
2113 default=dynamicdefault,
2119 default=dynamicdefault,
2114 )
2120 )
2115 coreconfigitem(
2121 coreconfigitem(
2116 b'templates',
2122 b'templates',
2117 b'.*',
2123 b'.*',
2118 default=None,
2124 default=None,
2119 generic=True,
2125 generic=True,
2120 )
2126 )
2121 coreconfigitem(
2127 coreconfigitem(
2122 b'templateconfig',
2128 b'templateconfig',
2123 b'.*',
2129 b'.*',
2124 default=dynamicdefault,
2130 default=dynamicdefault,
2125 generic=True,
2131 generic=True,
2126 )
2132 )
2127 coreconfigitem(
2133 coreconfigitem(
2128 b'trusted',
2134 b'trusted',
2129 b'groups',
2135 b'groups',
2130 default=list,
2136 default=list,
2131 )
2137 )
2132 coreconfigitem(
2138 coreconfigitem(
2133 b'trusted',
2139 b'trusted',
2134 b'users',
2140 b'users',
2135 default=list,
2141 default=list,
2136 )
2142 )
2137 coreconfigitem(
2143 coreconfigitem(
2138 b'ui',
2144 b'ui',
2139 b'_usedassubrepo',
2145 b'_usedassubrepo',
2140 default=False,
2146 default=False,
2141 )
2147 )
2142 coreconfigitem(
2148 coreconfigitem(
2143 b'ui',
2149 b'ui',
2144 b'allowemptycommit',
2150 b'allowemptycommit',
2145 default=False,
2151 default=False,
2146 )
2152 )
2147 coreconfigitem(
2153 coreconfigitem(
2148 b'ui',
2154 b'ui',
2149 b'archivemeta',
2155 b'archivemeta',
2150 default=True,
2156 default=True,
2151 )
2157 )
2152 coreconfigitem(
2158 coreconfigitem(
2153 b'ui',
2159 b'ui',
2154 b'askusername',
2160 b'askusername',
2155 default=False,
2161 default=False,
2156 )
2162 )
2157 coreconfigitem(
2163 coreconfigitem(
2158 b'ui',
2164 b'ui',
2159 b'available-memory',
2165 b'available-memory',
2160 default=None,
2166 default=None,
2161 )
2167 )
2162
2168
2163 coreconfigitem(
2169 coreconfigitem(
2164 b'ui',
2170 b'ui',
2165 b'clonebundlefallback',
2171 b'clonebundlefallback',
2166 default=False,
2172 default=False,
2167 )
2173 )
2168 coreconfigitem(
2174 coreconfigitem(
2169 b'ui',
2175 b'ui',
2170 b'clonebundleprefers',
2176 b'clonebundleprefers',
2171 default=list,
2177 default=list,
2172 )
2178 )
2173 coreconfigitem(
2179 coreconfigitem(
2174 b'ui',
2180 b'ui',
2175 b'clonebundles',
2181 b'clonebundles',
2176 default=True,
2182 default=True,
2177 )
2183 )
2178 coreconfigitem(
2184 coreconfigitem(
2179 b'ui',
2185 b'ui',
2180 b'color',
2186 b'color',
2181 default=b'auto',
2187 default=b'auto',
2182 )
2188 )
2183 coreconfigitem(
2189 coreconfigitem(
2184 b'ui',
2190 b'ui',
2185 b'commitsubrepos',
2191 b'commitsubrepos',
2186 default=False,
2192 default=False,
2187 )
2193 )
2188 coreconfigitem(
2194 coreconfigitem(
2189 b'ui',
2195 b'ui',
2190 b'debug',
2196 b'debug',
2191 default=False,
2197 default=False,
2192 )
2198 )
2193 coreconfigitem(
2199 coreconfigitem(
2194 b'ui',
2200 b'ui',
2195 b'debugger',
2201 b'debugger',
2196 default=None,
2202 default=None,
2197 )
2203 )
2198 coreconfigitem(
2204 coreconfigitem(
2199 b'ui',
2205 b'ui',
2200 b'editor',
2206 b'editor',
2201 default=dynamicdefault,
2207 default=dynamicdefault,
2202 )
2208 )
2203 coreconfigitem(
2209 coreconfigitem(
2204 b'ui',
2210 b'ui',
2205 b'detailed-exit-code',
2211 b'detailed-exit-code',
2206 default=False,
2212 default=False,
2207 experimental=True,
2213 experimental=True,
2208 )
2214 )
2209 coreconfigitem(
2215 coreconfigitem(
2210 b'ui',
2216 b'ui',
2211 b'fallbackencoding',
2217 b'fallbackencoding',
2212 default=None,
2218 default=None,
2213 )
2219 )
2214 coreconfigitem(
2220 coreconfigitem(
2215 b'ui',
2221 b'ui',
2216 b'forcecwd',
2222 b'forcecwd',
2217 default=None,
2223 default=None,
2218 )
2224 )
2219 coreconfigitem(
2225 coreconfigitem(
2220 b'ui',
2226 b'ui',
2221 b'forcemerge',
2227 b'forcemerge',
2222 default=None,
2228 default=None,
2223 )
2229 )
2224 coreconfigitem(
2230 coreconfigitem(
2225 b'ui',
2231 b'ui',
2226 b'formatdebug',
2232 b'formatdebug',
2227 default=False,
2233 default=False,
2228 )
2234 )
2229 coreconfigitem(
2235 coreconfigitem(
2230 b'ui',
2236 b'ui',
2231 b'formatjson',
2237 b'formatjson',
2232 default=False,
2238 default=False,
2233 )
2239 )
2234 coreconfigitem(
2240 coreconfigitem(
2235 b'ui',
2241 b'ui',
2236 b'formatted',
2242 b'formatted',
2237 default=None,
2243 default=None,
2238 )
2244 )
2239 coreconfigitem(
2245 coreconfigitem(
2240 b'ui',
2246 b'ui',
2241 b'interactive',
2247 b'interactive',
2242 default=None,
2248 default=None,
2243 )
2249 )
2244 coreconfigitem(
2250 coreconfigitem(
2245 b'ui',
2251 b'ui',
2246 b'interface',
2252 b'interface',
2247 default=None,
2253 default=None,
2248 )
2254 )
2249 coreconfigitem(
2255 coreconfigitem(
2250 b'ui',
2256 b'ui',
2251 b'interface.chunkselector',
2257 b'interface.chunkselector',
2252 default=None,
2258 default=None,
2253 )
2259 )
2254 coreconfigitem(
2260 coreconfigitem(
2255 b'ui',
2261 b'ui',
2256 b'large-file-limit',
2262 b'large-file-limit',
2257 default=10000000,
2263 default=10000000,
2258 )
2264 )
2259 coreconfigitem(
2265 coreconfigitem(
2260 b'ui',
2266 b'ui',
2261 b'logblockedtimes',
2267 b'logblockedtimes',
2262 default=False,
2268 default=False,
2263 )
2269 )
2264 coreconfigitem(
2270 coreconfigitem(
2265 b'ui',
2271 b'ui',
2266 b'merge',
2272 b'merge',
2267 default=None,
2273 default=None,
2268 )
2274 )
2269 coreconfigitem(
2275 coreconfigitem(
2270 b'ui',
2276 b'ui',
2271 b'mergemarkers',
2277 b'mergemarkers',
2272 default=b'basic',
2278 default=b'basic',
2273 )
2279 )
2274 coreconfigitem(
2280 coreconfigitem(
2275 b'ui',
2281 b'ui',
2276 b'message-output',
2282 b'message-output',
2277 default=b'stdio',
2283 default=b'stdio',
2278 )
2284 )
2279 coreconfigitem(
2285 coreconfigitem(
2280 b'ui',
2286 b'ui',
2281 b'nontty',
2287 b'nontty',
2282 default=False,
2288 default=False,
2283 )
2289 )
2284 coreconfigitem(
2290 coreconfigitem(
2285 b'ui',
2291 b'ui',
2286 b'origbackuppath',
2292 b'origbackuppath',
2287 default=None,
2293 default=None,
2288 )
2294 )
2289 coreconfigitem(
2295 coreconfigitem(
2290 b'ui',
2296 b'ui',
2291 b'paginate',
2297 b'paginate',
2292 default=True,
2298 default=True,
2293 )
2299 )
2294 coreconfigitem(
2300 coreconfigitem(
2295 b'ui',
2301 b'ui',
2296 b'patch',
2302 b'patch',
2297 default=None,
2303 default=None,
2298 )
2304 )
2299 coreconfigitem(
2305 coreconfigitem(
2300 b'ui',
2306 b'ui',
2301 b'portablefilenames',
2307 b'portablefilenames',
2302 default=b'warn',
2308 default=b'warn',
2303 )
2309 )
2304 coreconfigitem(
2310 coreconfigitem(
2305 b'ui',
2311 b'ui',
2306 b'promptecho',
2312 b'promptecho',
2307 default=False,
2313 default=False,
2308 )
2314 )
2309 coreconfigitem(
2315 coreconfigitem(
2310 b'ui',
2316 b'ui',
2311 b'quiet',
2317 b'quiet',
2312 default=False,
2318 default=False,
2313 )
2319 )
2314 coreconfigitem(
2320 coreconfigitem(
2315 b'ui',
2321 b'ui',
2316 b'quietbookmarkmove',
2322 b'quietbookmarkmove',
2317 default=False,
2323 default=False,
2318 )
2324 )
2319 coreconfigitem(
2325 coreconfigitem(
2320 b'ui',
2326 b'ui',
2321 b'relative-paths',
2327 b'relative-paths',
2322 default=b'legacy',
2328 default=b'legacy',
2323 )
2329 )
2324 coreconfigitem(
2330 coreconfigitem(
2325 b'ui',
2331 b'ui',
2326 b'remotecmd',
2332 b'remotecmd',
2327 default=b'hg',
2333 default=b'hg',
2328 )
2334 )
2329 coreconfigitem(
2335 coreconfigitem(
2330 b'ui',
2336 b'ui',
2331 b'report_untrusted',
2337 b'report_untrusted',
2332 default=True,
2338 default=True,
2333 )
2339 )
2334 coreconfigitem(
2340 coreconfigitem(
2335 b'ui',
2341 b'ui',
2336 b'rollback',
2342 b'rollback',
2337 default=True,
2343 default=True,
2338 )
2344 )
2339 coreconfigitem(
2345 coreconfigitem(
2340 b'ui',
2346 b'ui',
2341 b'signal-safe-lock',
2347 b'signal-safe-lock',
2342 default=True,
2348 default=True,
2343 )
2349 )
2344 coreconfigitem(
2350 coreconfigitem(
2345 b'ui',
2351 b'ui',
2346 b'slash',
2352 b'slash',
2347 default=False,
2353 default=False,
2348 )
2354 )
2349 coreconfigitem(
2355 coreconfigitem(
2350 b'ui',
2356 b'ui',
2351 b'ssh',
2357 b'ssh',
2352 default=b'ssh',
2358 default=b'ssh',
2353 )
2359 )
2354 coreconfigitem(
2360 coreconfigitem(
2355 b'ui',
2361 b'ui',
2356 b'ssherrorhint',
2362 b'ssherrorhint',
2357 default=None,
2363 default=None,
2358 )
2364 )
2359 coreconfigitem(
2365 coreconfigitem(
2360 b'ui',
2366 b'ui',
2361 b'statuscopies',
2367 b'statuscopies',
2362 default=False,
2368 default=False,
2363 )
2369 )
2364 coreconfigitem(
2370 coreconfigitem(
2365 b'ui',
2371 b'ui',
2366 b'strict',
2372 b'strict',
2367 default=False,
2373 default=False,
2368 )
2374 )
2369 coreconfigitem(
2375 coreconfigitem(
2370 b'ui',
2376 b'ui',
2371 b'style',
2377 b'style',
2372 default=b'',
2378 default=b'',
2373 )
2379 )
2374 coreconfigitem(
2380 coreconfigitem(
2375 b'ui',
2381 b'ui',
2376 b'supportcontact',
2382 b'supportcontact',
2377 default=None,
2383 default=None,
2378 )
2384 )
2379 coreconfigitem(
2385 coreconfigitem(
2380 b'ui',
2386 b'ui',
2381 b'textwidth',
2387 b'textwidth',
2382 default=78,
2388 default=78,
2383 )
2389 )
2384 coreconfigitem(
2390 coreconfigitem(
2385 b'ui',
2391 b'ui',
2386 b'timeout',
2392 b'timeout',
2387 default=b'600',
2393 default=b'600',
2388 )
2394 )
2389 coreconfigitem(
2395 coreconfigitem(
2390 b'ui',
2396 b'ui',
2391 b'timeout.warn',
2397 b'timeout.warn',
2392 default=0,
2398 default=0,
2393 )
2399 )
2394 coreconfigitem(
2400 coreconfigitem(
2395 b'ui',
2401 b'ui',
2396 b'timestamp-output',
2402 b'timestamp-output',
2397 default=False,
2403 default=False,
2398 )
2404 )
2399 coreconfigitem(
2405 coreconfigitem(
2400 b'ui',
2406 b'ui',
2401 b'traceback',
2407 b'traceback',
2402 default=False,
2408 default=False,
2403 )
2409 )
2404 coreconfigitem(
2410 coreconfigitem(
2405 b'ui',
2411 b'ui',
2406 b'tweakdefaults',
2412 b'tweakdefaults',
2407 default=False,
2413 default=False,
2408 )
2414 )
2409 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
2415 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
2410 coreconfigitem(
2416 coreconfigitem(
2411 b'ui',
2417 b'ui',
2412 b'verbose',
2418 b'verbose',
2413 default=False,
2419 default=False,
2414 )
2420 )
2415 coreconfigitem(
2421 coreconfigitem(
2416 b'verify',
2422 b'verify',
2417 b'skipflags',
2423 b'skipflags',
2418 default=None,
2424 default=None,
2419 )
2425 )
2420 coreconfigitem(
2426 coreconfigitem(
2421 b'web',
2427 b'web',
2422 b'allowbz2',
2428 b'allowbz2',
2423 default=False,
2429 default=False,
2424 )
2430 )
2425 coreconfigitem(
2431 coreconfigitem(
2426 b'web',
2432 b'web',
2427 b'allowgz',
2433 b'allowgz',
2428 default=False,
2434 default=False,
2429 )
2435 )
2430 coreconfigitem(
2436 coreconfigitem(
2431 b'web',
2437 b'web',
2432 b'allow-pull',
2438 b'allow-pull',
2433 alias=[(b'web', b'allowpull')],
2439 alias=[(b'web', b'allowpull')],
2434 default=True,
2440 default=True,
2435 )
2441 )
2436 coreconfigitem(
2442 coreconfigitem(
2437 b'web',
2443 b'web',
2438 b'allow-push',
2444 b'allow-push',
2439 alias=[(b'web', b'allow_push')],
2445 alias=[(b'web', b'allow_push')],
2440 default=list,
2446 default=list,
2441 )
2447 )
2442 coreconfigitem(
2448 coreconfigitem(
2443 b'web',
2449 b'web',
2444 b'allowzip',
2450 b'allowzip',
2445 default=False,
2451 default=False,
2446 )
2452 )
2447 coreconfigitem(
2453 coreconfigitem(
2448 b'web',
2454 b'web',
2449 b'archivesubrepos',
2455 b'archivesubrepos',
2450 default=False,
2456 default=False,
2451 )
2457 )
2452 coreconfigitem(
2458 coreconfigitem(
2453 b'web',
2459 b'web',
2454 b'cache',
2460 b'cache',
2455 default=True,
2461 default=True,
2456 )
2462 )
2457 coreconfigitem(
2463 coreconfigitem(
2458 b'web',
2464 b'web',
2459 b'comparisoncontext',
2465 b'comparisoncontext',
2460 default=5,
2466 default=5,
2461 )
2467 )
2462 coreconfigitem(
2468 coreconfigitem(
2463 b'web',
2469 b'web',
2464 b'contact',
2470 b'contact',
2465 default=None,
2471 default=None,
2466 )
2472 )
2467 coreconfigitem(
2473 coreconfigitem(
2468 b'web',
2474 b'web',
2469 b'deny_push',
2475 b'deny_push',
2470 default=list,
2476 default=list,
2471 )
2477 )
2472 coreconfigitem(
2478 coreconfigitem(
2473 b'web',
2479 b'web',
2474 b'guessmime',
2480 b'guessmime',
2475 default=False,
2481 default=False,
2476 )
2482 )
2477 coreconfigitem(
2483 coreconfigitem(
2478 b'web',
2484 b'web',
2479 b'hidden',
2485 b'hidden',
2480 default=False,
2486 default=False,
2481 )
2487 )
2482 coreconfigitem(
2488 coreconfigitem(
2483 b'web',
2489 b'web',
2484 b'labels',
2490 b'labels',
2485 default=list,
2491 default=list,
2486 )
2492 )
2487 coreconfigitem(
2493 coreconfigitem(
2488 b'web',
2494 b'web',
2489 b'logoimg',
2495 b'logoimg',
2490 default=b'hglogo.png',
2496 default=b'hglogo.png',
2491 )
2497 )
2492 coreconfigitem(
2498 coreconfigitem(
2493 b'web',
2499 b'web',
2494 b'logourl',
2500 b'logourl',
2495 default=b'https://mercurial-scm.org/',
2501 default=b'https://mercurial-scm.org/',
2496 )
2502 )
2497 coreconfigitem(
2503 coreconfigitem(
2498 b'web',
2504 b'web',
2499 b'accesslog',
2505 b'accesslog',
2500 default=b'-',
2506 default=b'-',
2501 )
2507 )
2502 coreconfigitem(
2508 coreconfigitem(
2503 b'web',
2509 b'web',
2504 b'address',
2510 b'address',
2505 default=b'',
2511 default=b'',
2506 )
2512 )
2507 coreconfigitem(
2513 coreconfigitem(
2508 b'web',
2514 b'web',
2509 b'allow-archive',
2515 b'allow-archive',
2510 alias=[(b'web', b'allow_archive')],
2516 alias=[(b'web', b'allow_archive')],
2511 default=list,
2517 default=list,
2512 )
2518 )
2513 coreconfigitem(
2519 coreconfigitem(
2514 b'web',
2520 b'web',
2515 b'allow_read',
2521 b'allow_read',
2516 default=list,
2522 default=list,
2517 )
2523 )
2518 coreconfigitem(
2524 coreconfigitem(
2519 b'web',
2525 b'web',
2520 b'baseurl',
2526 b'baseurl',
2521 default=None,
2527 default=None,
2522 )
2528 )
2523 coreconfigitem(
2529 coreconfigitem(
2524 b'web',
2530 b'web',
2525 b'cacerts',
2531 b'cacerts',
2526 default=None,
2532 default=None,
2527 )
2533 )
2528 coreconfigitem(
2534 coreconfigitem(
2529 b'web',
2535 b'web',
2530 b'certificate',
2536 b'certificate',
2531 default=None,
2537 default=None,
2532 )
2538 )
2533 coreconfigitem(
2539 coreconfigitem(
2534 b'web',
2540 b'web',
2535 b'collapse',
2541 b'collapse',
2536 default=False,
2542 default=False,
2537 )
2543 )
2538 coreconfigitem(
2544 coreconfigitem(
2539 b'web',
2545 b'web',
2540 b'csp',
2546 b'csp',
2541 default=None,
2547 default=None,
2542 )
2548 )
2543 coreconfigitem(
2549 coreconfigitem(
2544 b'web',
2550 b'web',
2545 b'deny_read',
2551 b'deny_read',
2546 default=list,
2552 default=list,
2547 )
2553 )
2548 coreconfigitem(
2554 coreconfigitem(
2549 b'web',
2555 b'web',
2550 b'descend',
2556 b'descend',
2551 default=True,
2557 default=True,
2552 )
2558 )
2553 coreconfigitem(
2559 coreconfigitem(
2554 b'web',
2560 b'web',
2555 b'description',
2561 b'description',
2556 default=b"",
2562 default=b"",
2557 )
2563 )
2558 coreconfigitem(
2564 coreconfigitem(
2559 b'web',
2565 b'web',
2560 b'encoding',
2566 b'encoding',
2561 default=lambda: encoding.encoding,
2567 default=lambda: encoding.encoding,
2562 )
2568 )
2563 coreconfigitem(
2569 coreconfigitem(
2564 b'web',
2570 b'web',
2565 b'errorlog',
2571 b'errorlog',
2566 default=b'-',
2572 default=b'-',
2567 )
2573 )
2568 coreconfigitem(
2574 coreconfigitem(
2569 b'web',
2575 b'web',
2570 b'ipv6',
2576 b'ipv6',
2571 default=False,
2577 default=False,
2572 )
2578 )
2573 coreconfigitem(
2579 coreconfigitem(
2574 b'web',
2580 b'web',
2575 b'maxchanges',
2581 b'maxchanges',
2576 default=10,
2582 default=10,
2577 )
2583 )
2578 coreconfigitem(
2584 coreconfigitem(
2579 b'web',
2585 b'web',
2580 b'maxfiles',
2586 b'maxfiles',
2581 default=10,
2587 default=10,
2582 )
2588 )
2583 coreconfigitem(
2589 coreconfigitem(
2584 b'web',
2590 b'web',
2585 b'maxshortchanges',
2591 b'maxshortchanges',
2586 default=60,
2592 default=60,
2587 )
2593 )
2588 coreconfigitem(
2594 coreconfigitem(
2589 b'web',
2595 b'web',
2590 b'motd',
2596 b'motd',
2591 default=b'',
2597 default=b'',
2592 )
2598 )
2593 coreconfigitem(
2599 coreconfigitem(
2594 b'web',
2600 b'web',
2595 b'name',
2601 b'name',
2596 default=dynamicdefault,
2602 default=dynamicdefault,
2597 )
2603 )
2598 coreconfigitem(
2604 coreconfigitem(
2599 b'web',
2605 b'web',
2600 b'port',
2606 b'port',
2601 default=8000,
2607 default=8000,
2602 )
2608 )
2603 coreconfigitem(
2609 coreconfigitem(
2604 b'web',
2610 b'web',
2605 b'prefix',
2611 b'prefix',
2606 default=b'',
2612 default=b'',
2607 )
2613 )
2608 coreconfigitem(
2614 coreconfigitem(
2609 b'web',
2615 b'web',
2610 b'push_ssl',
2616 b'push_ssl',
2611 default=True,
2617 default=True,
2612 )
2618 )
2613 coreconfigitem(
2619 coreconfigitem(
2614 b'web',
2620 b'web',
2615 b'refreshinterval',
2621 b'refreshinterval',
2616 default=20,
2622 default=20,
2617 )
2623 )
2618 coreconfigitem(
2624 coreconfigitem(
2619 b'web',
2625 b'web',
2620 b'server-header',
2626 b'server-header',
2621 default=None,
2627 default=None,
2622 )
2628 )
2623 coreconfigitem(
2629 coreconfigitem(
2624 b'web',
2630 b'web',
2625 b'static',
2631 b'static',
2626 default=None,
2632 default=None,
2627 )
2633 )
2628 coreconfigitem(
2634 coreconfigitem(
2629 b'web',
2635 b'web',
2630 b'staticurl',
2636 b'staticurl',
2631 default=None,
2637 default=None,
2632 )
2638 )
2633 coreconfigitem(
2639 coreconfigitem(
2634 b'web',
2640 b'web',
2635 b'stripes',
2641 b'stripes',
2636 default=1,
2642 default=1,
2637 )
2643 )
2638 coreconfigitem(
2644 coreconfigitem(
2639 b'web',
2645 b'web',
2640 b'style',
2646 b'style',
2641 default=b'paper',
2647 default=b'paper',
2642 )
2648 )
2643 coreconfigitem(
2649 coreconfigitem(
2644 b'web',
2650 b'web',
2645 b'templates',
2651 b'templates',
2646 default=None,
2652 default=None,
2647 )
2653 )
2648 coreconfigitem(
2654 coreconfigitem(
2649 b'web',
2655 b'web',
2650 b'view',
2656 b'view',
2651 default=b'served',
2657 default=b'served',
2652 experimental=True,
2658 experimental=True,
2653 )
2659 )
2654 coreconfigitem(
2660 coreconfigitem(
2655 b'worker',
2661 b'worker',
2656 b'backgroundclose',
2662 b'backgroundclose',
2657 default=dynamicdefault,
2663 default=dynamicdefault,
2658 )
2664 )
2659 # Windows defaults to a limit of 512 open files. A buffer of 128
2665 # Windows defaults to a limit of 512 open files. A buffer of 128
2660 # should give us enough headway.
2666 # should give us enough headway.
2661 coreconfigitem(
2667 coreconfigitem(
2662 b'worker',
2668 b'worker',
2663 b'backgroundclosemaxqueue',
2669 b'backgroundclosemaxqueue',
2664 default=384,
2670 default=384,
2665 )
2671 )
2666 coreconfigitem(
2672 coreconfigitem(
2667 b'worker',
2673 b'worker',
2668 b'backgroundcloseminfilecount',
2674 b'backgroundcloseminfilecount',
2669 default=2048,
2675 default=2048,
2670 )
2676 )
2671 coreconfigitem(
2677 coreconfigitem(
2672 b'worker',
2678 b'worker',
2673 b'backgroundclosethreadcount',
2679 b'backgroundclosethreadcount',
2674 default=4,
2680 default=4,
2675 )
2681 )
2676 coreconfigitem(
2682 coreconfigitem(
2677 b'worker',
2683 b'worker',
2678 b'enabled',
2684 b'enabled',
2679 default=True,
2685 default=True,
2680 )
2686 )
2681 coreconfigitem(
2687 coreconfigitem(
2682 b'worker',
2688 b'worker',
2683 b'numcpus',
2689 b'numcpus',
2684 default=None,
2690 default=None,
2685 )
2691 )
2686
2692
2687 # Rebase related configuration moved to core because other extension are doing
2693 # Rebase related configuration moved to core because other extension are doing
2688 # strange things. For example, shelve import the extensions to reuse some bit
2694 # strange things. For example, shelve import the extensions to reuse some bit
2689 # without formally loading it.
2695 # without formally loading it.
2690 coreconfigitem(
2696 coreconfigitem(
2691 b'commands',
2697 b'commands',
2692 b'rebase.requiredest',
2698 b'rebase.requiredest',
2693 default=False,
2699 default=False,
2694 )
2700 )
2695 coreconfigitem(
2701 coreconfigitem(
2696 b'experimental',
2702 b'experimental',
2697 b'rebaseskipobsolete',
2703 b'rebaseskipobsolete',
2698 default=True,
2704 default=True,
2699 )
2705 )
2700 coreconfigitem(
2706 coreconfigitem(
2701 b'rebase',
2707 b'rebase',
2702 b'singletransaction',
2708 b'singletransaction',
2703 default=False,
2709 default=False,
2704 )
2710 )
2705 coreconfigitem(
2711 coreconfigitem(
2706 b'rebase',
2712 b'rebase',
2707 b'experimental.inmemory',
2713 b'experimental.inmemory',
2708 default=False,
2714 default=False,
2709 )
2715 )
@@ -1,3208 +1,3205
1 The Mercurial system uses a set of configuration files to control
1 The Mercurial system uses a set of configuration files to control
2 aspects of its behavior.
2 aspects of its behavior.
3
3
4 Troubleshooting
4 Troubleshooting
5 ===============
5 ===============
6
6
7 If you're having problems with your configuration,
7 If you're having problems with your configuration,
8 :hg:`config --source` can help you understand what is introducing
8 :hg:`config --source` can help you understand what is introducing
9 a setting into your environment.
9 a setting into your environment.
10
10
11 See :hg:`help config.syntax` and :hg:`help config.files`
11 See :hg:`help config.syntax` and :hg:`help config.files`
12 for information about how and where to override things.
12 for information about how and where to override things.
13
13
14 Structure
14 Structure
15 =========
15 =========
16
16
17 The configuration files use a simple ini-file format. A configuration
17 The configuration files use a simple ini-file format. A configuration
18 file consists of sections, led by a ``[section]`` header and followed
18 file consists of sections, led by a ``[section]`` header and followed
19 by ``name = value`` entries::
19 by ``name = value`` entries::
20
20
21 [ui]
21 [ui]
22 username = Firstname Lastname <firstname.lastname@example.net>
22 username = Firstname Lastname <firstname.lastname@example.net>
23 verbose = True
23 verbose = True
24
24
25 The above entries will be referred to as ``ui.username`` and
25 The above entries will be referred to as ``ui.username`` and
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
27
27
28 Files
28 Files
29 =====
29 =====
30
30
31 Mercurial reads configuration data from several files, if they exist.
31 Mercurial reads configuration data from several files, if they exist.
32 These files do not exist by default and you will have to create the
32 These files do not exist by default and you will have to create the
33 appropriate configuration files yourself:
33 appropriate configuration files yourself:
34
34
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
36
36
37 Global configuration like the username setting is typically put into:
37 Global configuration like the username setting is typically put into:
38
38
39 .. container:: windows
39 .. container:: windows
40
40
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
42
42
43 .. container:: unix.plan9
43 .. container:: unix.plan9
44
44
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
46
46
47 The names of these files depend on the system on which Mercurial is
47 The names of these files depend on the system on which Mercurial is
48 installed. ``*.rc`` files from a single directory are read in
48 installed. ``*.rc`` files from a single directory are read in
49 alphabetical order, later ones overriding earlier ones. Where multiple
49 alphabetical order, later ones overriding earlier ones. Where multiple
50 paths are given below, settings from earlier paths override later
50 paths are given below, settings from earlier paths override later
51 ones.
51 ones.
52
52
53 .. container:: verbose.unix
53 .. container:: verbose.unix
54
54
55 On Unix, the following files are consulted:
55 On Unix, the following files are consulted:
56
56
57 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
57 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
58 - ``<repo>/.hg/hgrc`` (per-repository)
58 - ``<repo>/.hg/hgrc`` (per-repository)
59 - ``$HOME/.hgrc`` (per-user)
59 - ``$HOME/.hgrc`` (per-user)
60 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
60 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
61 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
62 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
62 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
63 - ``/etc/mercurial/hgrc`` (per-system)
63 - ``/etc/mercurial/hgrc`` (per-system)
64 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
64 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
65 - ``<internal>/*.rc`` (defaults)
65 - ``<internal>/*.rc`` (defaults)
66
66
67 .. container:: verbose.windows
67 .. container:: verbose.windows
68
68
69 On Windows, the following files are consulted:
69 On Windows, the following files are consulted:
70
70
71 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
71 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
72 - ``<repo>/.hg/hgrc`` (per-repository)
72 - ``<repo>/.hg/hgrc`` (per-repository)
73 - ``%USERPROFILE%\.hgrc`` (per-user)
73 - ``%USERPROFILE%\.hgrc`` (per-user)
74 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
74 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
75 - ``%HOME%\.hgrc`` (per-user)
75 - ``%HOME%\.hgrc`` (per-user)
76 - ``%HOME%\Mercurial.ini`` (per-user)
76 - ``%HOME%\Mercurial.ini`` (per-user)
77 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-system)
77 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-system)
78 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
78 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
79 - ``<install-dir>\Mercurial.ini`` (per-installation)
79 - ``<install-dir>\Mercurial.ini`` (per-installation)
80 - ``%PROGRAMDATA%\Mercurial\hgrc`` (per-system)
80 - ``%PROGRAMDATA%\Mercurial\hgrc`` (per-system)
81 - ``%PROGRAMDATA%\Mercurial\Mercurial.ini`` (per-system)
81 - ``%PROGRAMDATA%\Mercurial\Mercurial.ini`` (per-system)
82 - ``%PROGRAMDATA%\Mercurial\hgrc.d\*.rc`` (per-system)
82 - ``%PROGRAMDATA%\Mercurial\hgrc.d\*.rc`` (per-system)
83 - ``<internal>/*.rc`` (defaults)
83 - ``<internal>/*.rc`` (defaults)
84
84
85 .. note::
85 .. note::
86
86
87 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
87 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
88 is used when running 32-bit Python on 64-bit Windows.
88 is used when running 32-bit Python on 64-bit Windows.
89
89
90 .. container:: verbose.plan9
90 .. container:: verbose.plan9
91
91
92 On Plan9, the following files are consulted:
92 On Plan9, the following files are consulted:
93
93
94 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
94 - ``<repo>/.hg/hgrc-not-shared`` (per-repository)
95 - ``<repo>/.hg/hgrc`` (per-repository)
95 - ``<repo>/.hg/hgrc`` (per-repository)
96 - ``$home/lib/hgrc`` (per-user)
96 - ``$home/lib/hgrc`` (per-user)
97 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
97 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
98 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
98 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
99 - ``/lib/mercurial/hgrc`` (per-system)
99 - ``/lib/mercurial/hgrc`` (per-system)
100 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
100 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
101 - ``<internal>/*.rc`` (defaults)
101 - ``<internal>/*.rc`` (defaults)
102
102
103 Per-repository configuration options only apply in a
103 Per-repository configuration options only apply in a
104 particular repository. This file is not version-controlled, and
104 particular repository. This file is not version-controlled, and
105 will not get transferred during a "clone" operation. Options in
105 will not get transferred during a "clone" operation. Options in
106 this file override options in all other configuration files.
106 this file override options in all other configuration files.
107
107
108 .. container:: unix.plan9
108 .. container:: unix.plan9
109
109
110 On Plan 9 and Unix, most of this file will be ignored if it doesn't
110 On Plan 9 and Unix, most of this file will be ignored if it doesn't
111 belong to a trusted user or to a trusted group. See
111 belong to a trusted user or to a trusted group. See
112 :hg:`help config.trusted` for more details.
112 :hg:`help config.trusted` for more details.
113
113
114 Per-user configuration file(s) are for the user running Mercurial. Options
114 Per-user configuration file(s) are for the user running Mercurial. Options
115 in these files apply to all Mercurial commands executed by this user in any
115 in these files apply to all Mercurial commands executed by this user in any
116 directory. Options in these files override per-system and per-installation
116 directory. Options in these files override per-system and per-installation
117 options.
117 options.
118
118
119 Per-installation configuration files are searched for in the
119 Per-installation configuration files are searched for in the
120 directory where Mercurial is installed. ``<install-root>`` is the
120 directory where Mercurial is installed. ``<install-root>`` is the
121 parent directory of the **hg** executable (or symlink) being run.
121 parent directory of the **hg** executable (or symlink) being run.
122
122
123 .. container:: unix.plan9
123 .. container:: unix.plan9
124
124
125 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
125 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
126 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
126 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
127 files apply to all Mercurial commands executed by any user in any
127 files apply to all Mercurial commands executed by any user in any
128 directory.
128 directory.
129
129
130 Per-installation configuration files are for the system on
130 Per-installation configuration files are for the system on
131 which Mercurial is running. Options in these files apply to all
131 which Mercurial is running. Options in these files apply to all
132 Mercurial commands executed by any user in any directory. Registry
132 Mercurial commands executed by any user in any directory. Registry
133 keys contain PATH-like strings, every part of which must reference
133 keys contain PATH-like strings, every part of which must reference
134 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
134 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
135 be read. Mercurial checks each of these locations in the specified
135 be read. Mercurial checks each of these locations in the specified
136 order until one or more configuration files are detected.
136 order until one or more configuration files are detected.
137
137
138 Per-system configuration files are for the system on which Mercurial
138 Per-system configuration files are for the system on which Mercurial
139 is running. Options in these files apply to all Mercurial commands
139 is running. Options in these files apply to all Mercurial commands
140 executed by any user in any directory. Options in these files
140 executed by any user in any directory. Options in these files
141 override per-installation options.
141 override per-installation options.
142
142
143 Mercurial comes with some default configuration. The default configuration
143 Mercurial comes with some default configuration. The default configuration
144 files are installed with Mercurial and will be overwritten on upgrades. Default
144 files are installed with Mercurial and will be overwritten on upgrades. Default
145 configuration files should never be edited by users or administrators but can
145 configuration files should never be edited by users or administrators but can
146 be overridden in other configuration files. So far the directory only contains
146 be overridden in other configuration files. So far the directory only contains
147 merge tool configuration but packagers can also put other default configuration
147 merge tool configuration but packagers can also put other default configuration
148 there.
148 there.
149
149
150 On versions 5.7 and later, if share-safe functionality is enabled,
150 On versions 5.7 and later, if share-safe functionality is enabled,
151 shares will read config file of share source too.
151 shares will read config file of share source too.
152 `<share-source/.hg/hgrc>` is read before reading `<repo/.hg/hgrc>`.
152 `<share-source/.hg/hgrc>` is read before reading `<repo/.hg/hgrc>`.
153
153
154 For configs which should not be shared, `<repo/.hg/hgrc-not-shared>`
154 For configs which should not be shared, `<repo/.hg/hgrc-not-shared>`
155 should be used.
155 should be used.
156
156
157 Syntax
157 Syntax
158 ======
158 ======
159
159
160 A configuration file consists of sections, led by a ``[section]`` header
160 A configuration file consists of sections, led by a ``[section]`` header
161 and followed by ``name = value`` entries (sometimes called
161 and followed by ``name = value`` entries (sometimes called
162 ``configuration keys``)::
162 ``configuration keys``)::
163
163
164 [spam]
164 [spam]
165 eggs=ham
165 eggs=ham
166 green=
166 green=
167 eggs
167 eggs
168
168
169 Each line contains one entry. If the lines that follow are indented,
169 Each line contains one entry. If the lines that follow are indented,
170 they are treated as continuations of that entry. Leading whitespace is
170 they are treated as continuations of that entry. Leading whitespace is
171 removed from values. Empty lines are skipped. Lines beginning with
171 removed from values. Empty lines are skipped. Lines beginning with
172 ``#`` or ``;`` are ignored and may be used to provide comments.
172 ``#`` or ``;`` are ignored and may be used to provide comments.
173
173
174 Configuration keys can be set multiple times, in which case Mercurial
174 Configuration keys can be set multiple times, in which case Mercurial
175 will use the value that was configured last. As an example::
175 will use the value that was configured last. As an example::
176
176
177 [spam]
177 [spam]
178 eggs=large
178 eggs=large
179 ham=serrano
179 ham=serrano
180 eggs=small
180 eggs=small
181
181
182 This would set the configuration key named ``eggs`` to ``small``.
182 This would set the configuration key named ``eggs`` to ``small``.
183
183
184 It is also possible to define a section multiple times. A section can
184 It is also possible to define a section multiple times. A section can
185 be redefined on the same and/or on different configuration files. For
185 be redefined on the same and/or on different configuration files. For
186 example::
186 example::
187
187
188 [foo]
188 [foo]
189 eggs=large
189 eggs=large
190 ham=serrano
190 ham=serrano
191 eggs=small
191 eggs=small
192
192
193 [bar]
193 [bar]
194 eggs=ham
194 eggs=ham
195 green=
195 green=
196 eggs
196 eggs
197
197
198 [foo]
198 [foo]
199 ham=prosciutto
199 ham=prosciutto
200 eggs=medium
200 eggs=medium
201 bread=toasted
201 bread=toasted
202
202
203 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
203 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
204 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
204 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
205 respectively. As you can see there only thing that matters is the last
205 respectively. As you can see there only thing that matters is the last
206 value that was set for each of the configuration keys.
206 value that was set for each of the configuration keys.
207
207
208 If a configuration key is set multiple times in different
208 If a configuration key is set multiple times in different
209 configuration files the final value will depend on the order in which
209 configuration files the final value will depend on the order in which
210 the different configuration files are read, with settings from earlier
210 the different configuration files are read, with settings from earlier
211 paths overriding later ones as described on the ``Files`` section
211 paths overriding later ones as described on the ``Files`` section
212 above.
212 above.
213
213
214 A line of the form ``%include file`` will include ``file`` into the
214 A line of the form ``%include file`` will include ``file`` into the
215 current configuration file. The inclusion is recursive, which means
215 current configuration file. The inclusion is recursive, which means
216 that included files can include other files. Filenames are relative to
216 that included files can include other files. Filenames are relative to
217 the configuration file in which the ``%include`` directive is found.
217 the configuration file in which the ``%include`` directive is found.
218 Environment variables and ``~user`` constructs are expanded in
218 Environment variables and ``~user`` constructs are expanded in
219 ``file``. This lets you do something like::
219 ``file``. This lets you do something like::
220
220
221 %include ~/.hgrc.d/$HOST.rc
221 %include ~/.hgrc.d/$HOST.rc
222
222
223 to include a different configuration file on each computer you use.
223 to include a different configuration file on each computer you use.
224
224
225 A line with ``%unset name`` will remove ``name`` from the current
225 A line with ``%unset name`` will remove ``name`` from the current
226 section, if it has been set previously.
226 section, if it has been set previously.
227
227
228 The values are either free-form text strings, lists of text strings,
228 The values are either free-form text strings, lists of text strings,
229 or Boolean values. Boolean values can be set to true using any of "1",
229 or Boolean values. Boolean values can be set to true using any of "1",
230 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
230 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
231 (all case insensitive).
231 (all case insensitive).
232
232
233 List values are separated by whitespace or comma, except when values are
233 List values are separated by whitespace or comma, except when values are
234 placed in double quotation marks::
234 placed in double quotation marks::
235
235
236 allow_read = "John Doe, PhD", brian, betty
236 allow_read = "John Doe, PhD", brian, betty
237
237
238 Quotation marks can be escaped by prefixing them with a backslash. Only
238 Quotation marks can be escaped by prefixing them with a backslash. Only
239 quotation marks at the beginning of a word is counted as a quotation
239 quotation marks at the beginning of a word is counted as a quotation
240 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
240 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
241
241
242 Sections
242 Sections
243 ========
243 ========
244
244
245 This section describes the different sections that may appear in a
245 This section describes the different sections that may appear in a
246 Mercurial configuration file, the purpose of each section, its possible
246 Mercurial configuration file, the purpose of each section, its possible
247 keys, and their possible values.
247 keys, and their possible values.
248
248
249 ``alias``
249 ``alias``
250 ---------
250 ---------
251
251
252 Defines command aliases.
252 Defines command aliases.
253
253
254 Aliases allow you to define your own commands in terms of other
254 Aliases allow you to define your own commands in terms of other
255 commands (or aliases), optionally including arguments. Positional
255 commands (or aliases), optionally including arguments. Positional
256 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
256 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
257 are expanded by Mercurial before execution. Positional arguments not
257 are expanded by Mercurial before execution. Positional arguments not
258 already used by ``$N`` in the definition are put at the end of the
258 already used by ``$N`` in the definition are put at the end of the
259 command to be executed.
259 command to be executed.
260
260
261 Alias definitions consist of lines of the form::
261 Alias definitions consist of lines of the form::
262
262
263 <alias> = <command> [<argument>]...
263 <alias> = <command> [<argument>]...
264
264
265 For example, this definition::
265 For example, this definition::
266
266
267 latest = log --limit 5
267 latest = log --limit 5
268
268
269 creates a new command ``latest`` that shows only the five most recent
269 creates a new command ``latest`` that shows only the five most recent
270 changesets. You can define subsequent aliases using earlier ones::
270 changesets. You can define subsequent aliases using earlier ones::
271
271
272 stable5 = latest -b stable
272 stable5 = latest -b stable
273
273
274 .. note::
274 .. note::
275
275
276 It is possible to create aliases with the same names as
276 It is possible to create aliases with the same names as
277 existing commands, which will then override the original
277 existing commands, which will then override the original
278 definitions. This is almost always a bad idea!
278 definitions. This is almost always a bad idea!
279
279
280 An alias can start with an exclamation point (``!``) to make it a
280 An alias can start with an exclamation point (``!``) to make it a
281 shell alias. A shell alias is executed with the shell and will let you
281 shell alias. A shell alias is executed with the shell and will let you
282 run arbitrary commands. As an example, ::
282 run arbitrary commands. As an example, ::
283
283
284 echo = !echo $@
284 echo = !echo $@
285
285
286 will let you do ``hg echo foo`` to have ``foo`` printed in your
286 will let you do ``hg echo foo`` to have ``foo`` printed in your
287 terminal. A better example might be::
287 terminal. A better example might be::
288
288
289 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
289 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
290
290
291 which will make ``hg purge`` delete all unknown files in the
291 which will make ``hg purge`` delete all unknown files in the
292 repository in the same manner as the purge extension.
292 repository in the same manner as the purge extension.
293
293
294 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
294 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
295 expand to the command arguments. Unmatched arguments are
295 expand to the command arguments. Unmatched arguments are
296 removed. ``$0`` expands to the alias name and ``$@`` expands to all
296 removed. ``$0`` expands to the alias name and ``$@`` expands to all
297 arguments separated by a space. ``"$@"`` (with quotes) expands to all
297 arguments separated by a space. ``"$@"`` (with quotes) expands to all
298 arguments quoted individually and separated by a space. These expansions
298 arguments quoted individually and separated by a space. These expansions
299 happen before the command is passed to the shell.
299 happen before the command is passed to the shell.
300
300
301 Shell aliases are executed in an environment where ``$HG`` expands to
301 Shell aliases are executed in an environment where ``$HG`` expands to
302 the path of the Mercurial that was used to execute the alias. This is
302 the path of the Mercurial that was used to execute the alias. This is
303 useful when you want to call further Mercurial commands in a shell
303 useful when you want to call further Mercurial commands in a shell
304 alias, as was done above for the purge alias. In addition,
304 alias, as was done above for the purge alias. In addition,
305 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
305 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
306 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
306 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
307
307
308 .. note::
308 .. note::
309
309
310 Some global configuration options such as ``-R`` are
310 Some global configuration options such as ``-R`` are
311 processed before shell aliases and will thus not be passed to
311 processed before shell aliases and will thus not be passed to
312 aliases.
312 aliases.
313
313
314
314
315 ``annotate``
315 ``annotate``
316 ------------
316 ------------
317
317
318 Settings used when displaying file annotations. All values are
318 Settings used when displaying file annotations. All values are
319 Booleans and default to False. See :hg:`help config.diff` for
319 Booleans and default to False. See :hg:`help config.diff` for
320 related options for the diff command.
320 related options for the diff command.
321
321
322 ``ignorews``
322 ``ignorews``
323 Ignore white space when comparing lines.
323 Ignore white space when comparing lines.
324
324
325 ``ignorewseol``
325 ``ignorewseol``
326 Ignore white space at the end of a line when comparing lines.
326 Ignore white space at the end of a line when comparing lines.
327
327
328 ``ignorewsamount``
328 ``ignorewsamount``
329 Ignore changes in the amount of white space.
329 Ignore changes in the amount of white space.
330
330
331 ``ignoreblanklines``
331 ``ignoreblanklines``
332 Ignore changes whose lines are all blank.
332 Ignore changes whose lines are all blank.
333
333
334
334
335 ``auth``
335 ``auth``
336 --------
336 --------
337
337
338 Authentication credentials and other authentication-like configuration
338 Authentication credentials and other authentication-like configuration
339 for HTTP connections. This section allows you to store usernames and
339 for HTTP connections. This section allows you to store usernames and
340 passwords for use when logging *into* HTTP servers. See
340 passwords for use when logging *into* HTTP servers. See
341 :hg:`help config.web` if you want to configure *who* can login to
341 :hg:`help config.web` if you want to configure *who* can login to
342 your HTTP server.
342 your HTTP server.
343
343
344 The following options apply to all hosts.
344 The following options apply to all hosts.
345
345
346 ``cookiefile``
346 ``cookiefile``
347 Path to a file containing HTTP cookie lines. Cookies matching a
347 Path to a file containing HTTP cookie lines. Cookies matching a
348 host will be sent automatically.
348 host will be sent automatically.
349
349
350 The file format uses the Mozilla cookies.txt format, which defines cookies
350 The file format uses the Mozilla cookies.txt format, which defines cookies
351 on their own lines. Each line contains 7 fields delimited by the tab
351 on their own lines. Each line contains 7 fields delimited by the tab
352 character (domain, is_domain_cookie, path, is_secure, expires, name,
352 character (domain, is_domain_cookie, path, is_secure, expires, name,
353 value). For more info, do an Internet search for "Netscape cookies.txt
353 value). For more info, do an Internet search for "Netscape cookies.txt
354 format."
354 format."
355
355
356 Note: the cookies parser does not handle port numbers on domains. You
356 Note: the cookies parser does not handle port numbers on domains. You
357 will need to remove ports from the domain for the cookie to be recognized.
357 will need to remove ports from the domain for the cookie to be recognized.
358 This could result in a cookie being disclosed to an unwanted server.
358 This could result in a cookie being disclosed to an unwanted server.
359
359
360 The cookies file is read-only.
360 The cookies file is read-only.
361
361
362 Other options in this section are grouped by name and have the following
362 Other options in this section are grouped by name and have the following
363 format::
363 format::
364
364
365 <name>.<argument> = <value>
365 <name>.<argument> = <value>
366
366
367 where ``<name>`` is used to group arguments into authentication
367 where ``<name>`` is used to group arguments into authentication
368 entries. Example::
368 entries. Example::
369
369
370 foo.prefix = hg.intevation.de/mercurial
370 foo.prefix = hg.intevation.de/mercurial
371 foo.username = foo
371 foo.username = foo
372 foo.password = bar
372 foo.password = bar
373 foo.schemes = http https
373 foo.schemes = http https
374
374
375 bar.prefix = secure.example.org
375 bar.prefix = secure.example.org
376 bar.key = path/to/file.key
376 bar.key = path/to/file.key
377 bar.cert = path/to/file.cert
377 bar.cert = path/to/file.cert
378 bar.schemes = https
378 bar.schemes = https
379
379
380 Supported arguments:
380 Supported arguments:
381
381
382 ``prefix``
382 ``prefix``
383 Either ``*`` or a URI prefix with or without the scheme part.
383 Either ``*`` or a URI prefix with or without the scheme part.
384 The authentication entry with the longest matching prefix is used
384 The authentication entry with the longest matching prefix is used
385 (where ``*`` matches everything and counts as a match of length
385 (where ``*`` matches everything and counts as a match of length
386 1). If the prefix doesn't include a scheme, the match is performed
386 1). If the prefix doesn't include a scheme, the match is performed
387 against the URI with its scheme stripped as well, and the schemes
387 against the URI with its scheme stripped as well, and the schemes
388 argument, q.v., is then subsequently consulted.
388 argument, q.v., is then subsequently consulted.
389
389
390 ``username``
390 ``username``
391 Optional. Username to authenticate with. If not given, and the
391 Optional. Username to authenticate with. If not given, and the
392 remote site requires basic or digest authentication, the user will
392 remote site requires basic or digest authentication, the user will
393 be prompted for it. Environment variables are expanded in the
393 be prompted for it. Environment variables are expanded in the
394 username letting you do ``foo.username = $USER``. If the URI
394 username letting you do ``foo.username = $USER``. If the URI
395 includes a username, only ``[auth]`` entries with a matching
395 includes a username, only ``[auth]`` entries with a matching
396 username or without a username will be considered.
396 username or without a username will be considered.
397
397
398 ``password``
398 ``password``
399 Optional. Password to authenticate with. If not given, and the
399 Optional. Password to authenticate with. If not given, and the
400 remote site requires basic or digest authentication, the user
400 remote site requires basic or digest authentication, the user
401 will be prompted for it.
401 will be prompted for it.
402
402
403 ``key``
403 ``key``
404 Optional. PEM encoded client certificate key file. Environment
404 Optional. PEM encoded client certificate key file. Environment
405 variables are expanded in the filename.
405 variables are expanded in the filename.
406
406
407 ``cert``
407 ``cert``
408 Optional. PEM encoded client certificate chain file. Environment
408 Optional. PEM encoded client certificate chain file. Environment
409 variables are expanded in the filename.
409 variables are expanded in the filename.
410
410
411 ``schemes``
411 ``schemes``
412 Optional. Space separated list of URI schemes to use this
412 Optional. Space separated list of URI schemes to use this
413 authentication entry with. Only used if the prefix doesn't include
413 authentication entry with. Only used if the prefix doesn't include
414 a scheme. Supported schemes are http and https. They will match
414 a scheme. Supported schemes are http and https. They will match
415 static-http and static-https respectively, as well.
415 static-http and static-https respectively, as well.
416 (default: https)
416 (default: https)
417
417
418 If no suitable authentication entry is found, the user is prompted
418 If no suitable authentication entry is found, the user is prompted
419 for credentials as usual if required by the remote.
419 for credentials as usual if required by the remote.
420
420
421 ``cmdserver``
421 ``cmdserver``
422 -------------
422 -------------
423
423
424 Controls command server settings. (ADVANCED)
424 Controls command server settings. (ADVANCED)
425
425
426 ``message-encodings``
426 ``message-encodings``
427 List of encodings for the ``m`` (message) channel. The first encoding
427 List of encodings for the ``m`` (message) channel. The first encoding
428 supported by the server will be selected and advertised in the hello
428 supported by the server will be selected and advertised in the hello
429 message. This is useful only when ``ui.message-output`` is set to
429 message. This is useful only when ``ui.message-output`` is set to
430 ``channel``. Supported encodings are ``cbor``.
430 ``channel``. Supported encodings are ``cbor``.
431
431
432 ``shutdown-on-interrupt``
432 ``shutdown-on-interrupt``
433 If set to false, the server's main loop will continue running after
433 If set to false, the server's main loop will continue running after
434 SIGINT received. ``runcommand`` requests can still be interrupted by
434 SIGINT received. ``runcommand`` requests can still be interrupted by
435 SIGINT. Close the write end of the pipe to shut down the server
435 SIGINT. Close the write end of the pipe to shut down the server
436 process gracefully.
436 process gracefully.
437 (default: True)
437 (default: True)
438
438
439 ``color``
439 ``color``
440 ---------
440 ---------
441
441
442 Configure the Mercurial color mode. For details about how to define your custom
442 Configure the Mercurial color mode. For details about how to define your custom
443 effect and style see :hg:`help color`.
443 effect and style see :hg:`help color`.
444
444
445 ``mode``
445 ``mode``
446 String: control the method used to output color. One of ``auto``, ``ansi``,
446 String: control the method used to output color. One of ``auto``, ``ansi``,
447 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
447 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
448 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
448 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
449 terminal. Any invalid value will disable color.
449 terminal. Any invalid value will disable color.
450
450
451 ``pagermode``
451 ``pagermode``
452 String: optional override of ``color.mode`` used with pager.
452 String: optional override of ``color.mode`` used with pager.
453
453
454 On some systems, terminfo mode may cause problems when using
454 On some systems, terminfo mode may cause problems when using
455 color with ``less -R`` as a pager program. less with the -R option
455 color with ``less -R`` as a pager program. less with the -R option
456 will only display ECMA-48 color codes, and terminfo mode may sometimes
456 will only display ECMA-48 color codes, and terminfo mode may sometimes
457 emit codes that less doesn't understand. You can work around this by
457 emit codes that less doesn't understand. You can work around this by
458 either using ansi mode (or auto mode), or by using less -r (which will
458 either using ansi mode (or auto mode), or by using less -r (which will
459 pass through all terminal control codes, not just color control
459 pass through all terminal control codes, not just color control
460 codes).
460 codes).
461
461
462 On some systems (such as MSYS in Windows), the terminal may support
462 On some systems (such as MSYS in Windows), the terminal may support
463 a different color mode than the pager program.
463 a different color mode than the pager program.
464
464
465 ``commands``
465 ``commands``
466 ------------
466 ------------
467
467
468 ``commit.post-status``
468 ``commit.post-status``
469 Show status of files in the working directory after successful commit.
469 Show status of files in the working directory after successful commit.
470 (default: False)
470 (default: False)
471
471
472 ``merge.require-rev``
472 ``merge.require-rev``
473 Require that the revision to merge the current commit with be specified on
473 Require that the revision to merge the current commit with be specified on
474 the command line. If this is enabled and a revision is not specified, the
474 the command line. If this is enabled and a revision is not specified, the
475 command aborts.
475 command aborts.
476 (default: False)
476 (default: False)
477
477
478 ``push.require-revs``
478 ``push.require-revs``
479 Require revisions to push be specified using one or more mechanisms such as
479 Require revisions to push be specified using one or more mechanisms such as
480 specifying them positionally on the command line, using ``-r``, ``-b``,
480 specifying them positionally on the command line, using ``-r``, ``-b``,
481 and/or ``-B`` on the command line, or using ``paths.<path>:pushrev`` in the
481 and/or ``-B`` on the command line, or using ``paths.<path>:pushrev`` in the
482 configuration. If this is enabled and revisions are not specified, the
482 configuration. If this is enabled and revisions are not specified, the
483 command aborts.
483 command aborts.
484 (default: False)
484 (default: False)
485
485
486 ``resolve.confirm``
486 ``resolve.confirm``
487 Confirm before performing action if no filename is passed.
487 Confirm before performing action if no filename is passed.
488 (default: False)
488 (default: False)
489
489
490 ``resolve.explicit-re-merge``
490 ``resolve.explicit-re-merge``
491 Require uses of ``hg resolve`` to specify which action it should perform,
491 Require uses of ``hg resolve`` to specify which action it should perform,
492 instead of re-merging files by default.
492 instead of re-merging files by default.
493 (default: False)
493 (default: False)
494
494
495 ``resolve.mark-check``
495 ``resolve.mark-check``
496 Determines what level of checking :hg:`resolve --mark` will perform before
496 Determines what level of checking :hg:`resolve --mark` will perform before
497 marking files as resolved. Valid values are ``none`, ``warn``, and
497 marking files as resolved. Valid values are ``none`, ``warn``, and
498 ``abort``. ``warn`` will output a warning listing the file(s) that still
498 ``abort``. ``warn`` will output a warning listing the file(s) that still
499 have conflict markers in them, but will still mark everything resolved.
499 have conflict markers in them, but will still mark everything resolved.
500 ``abort`` will output the same warning but will not mark things as resolved.
500 ``abort`` will output the same warning but will not mark things as resolved.
501 If --all is passed and this is set to ``abort``, only a warning will be
501 If --all is passed and this is set to ``abort``, only a warning will be
502 shown (an error will not be raised).
502 shown (an error will not be raised).
503 (default: ``none``)
503 (default: ``none``)
504
504
505 ``status.relative``
505 ``status.relative``
506 Make paths in :hg:`status` output relative to the current directory.
506 Make paths in :hg:`status` output relative to the current directory.
507 (default: False)
507 (default: False)
508
508
509 ``status.terse``
509 ``status.terse``
510 Default value for the --terse flag, which condenses status output.
510 Default value for the --terse flag, which condenses status output.
511 (default: empty)
511 (default: empty)
512
512
513 ``update.check``
513 ``update.check``
514 Determines what level of checking :hg:`update` will perform before moving
514 Determines what level of checking :hg:`update` will perform before moving
515 to a destination revision. Valid values are ``abort``, ``none``,
515 to a destination revision. Valid values are ``abort``, ``none``,
516 ``linear``, and ``noconflict``.
516 ``linear``, and ``noconflict``.
517
517
518 - ``abort`` always fails if the working directory has uncommitted changes.
518 - ``abort`` always fails if the working directory has uncommitted changes.
519
519
520 - ``none`` performs no checking, and may result in a merge with uncommitted changes.
520 - ``none`` performs no checking, and may result in a merge with uncommitted changes.
521
521
522 - ``linear`` allows any update as long as it follows a straight line in the
522 - ``linear`` allows any update as long as it follows a straight line in the
523 revision history, and may trigger a merge with uncommitted changes.
523 revision history, and may trigger a merge with uncommitted changes.
524
524
525 - ``noconflict`` will allow any update which would not trigger a merge with
525 - ``noconflict`` will allow any update which would not trigger a merge with
526 uncommitted changes, if any are present.
526 uncommitted changes, if any are present.
527
527
528 (default: ``linear``)
528 (default: ``linear``)
529
529
530 ``update.requiredest``
530 ``update.requiredest``
531 Require that the user pass a destination when running :hg:`update`.
531 Require that the user pass a destination when running :hg:`update`.
532 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
532 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
533 will be disallowed.
533 will be disallowed.
534 (default: False)
534 (default: False)
535
535
536 ``committemplate``
536 ``committemplate``
537 ------------------
537 ------------------
538
538
539 ``changeset``
539 ``changeset``
540 String: configuration in this section is used as the template to
540 String: configuration in this section is used as the template to
541 customize the text shown in the editor when committing.
541 customize the text shown in the editor when committing.
542
542
543 In addition to pre-defined template keywords, commit log specific one
543 In addition to pre-defined template keywords, commit log specific one
544 below can be used for customization:
544 below can be used for customization:
545
545
546 ``extramsg``
546 ``extramsg``
547 String: Extra message (typically 'Leave message empty to abort
547 String: Extra message (typically 'Leave message empty to abort
548 commit.'). This may be changed by some commands or extensions.
548 commit.'). This may be changed by some commands or extensions.
549
549
550 For example, the template configuration below shows as same text as
550 For example, the template configuration below shows as same text as
551 one shown by default::
551 one shown by default::
552
552
553 [committemplate]
553 [committemplate]
554 changeset = {desc}\n\n
554 changeset = {desc}\n\n
555 HG: Enter commit message. Lines beginning with 'HG:' are removed.
555 HG: Enter commit message. Lines beginning with 'HG:' are removed.
556 HG: {extramsg}
556 HG: {extramsg}
557 HG: --
557 HG: --
558 HG: user: {author}\n{ifeq(p2rev, "-1", "",
558 HG: user: {author}\n{ifeq(p2rev, "-1", "",
559 "HG: branch merge\n")
559 "HG: branch merge\n")
560 }HG: branch '{branch}'\n{if(activebookmark,
560 }HG: branch '{branch}'\n{if(activebookmark,
561 "HG: bookmark '{activebookmark}'\n") }{subrepos %
561 "HG: bookmark '{activebookmark}'\n") }{subrepos %
562 "HG: subrepo {subrepo}\n" }{file_adds %
562 "HG: subrepo {subrepo}\n" }{file_adds %
563 "HG: added {file}\n" }{file_mods %
563 "HG: added {file}\n" }{file_mods %
564 "HG: changed {file}\n" }{file_dels %
564 "HG: changed {file}\n" }{file_dels %
565 "HG: removed {file}\n" }{if(files, "",
565 "HG: removed {file}\n" }{if(files, "",
566 "HG: no files changed\n")}
566 "HG: no files changed\n")}
567
567
568 ``diff()``
568 ``diff()``
569 String: show the diff (see :hg:`help templates` for detail)
569 String: show the diff (see :hg:`help templates` for detail)
570
570
571 Sometimes it is helpful to show the diff of the changeset in the editor without
571 Sometimes it is helpful to show the diff of the changeset in the editor without
572 having to prefix 'HG: ' to each line so that highlighting works correctly. For
572 having to prefix 'HG: ' to each line so that highlighting works correctly. For
573 this, Mercurial provides a special string which will ignore everything below
573 this, Mercurial provides a special string which will ignore everything below
574 it::
574 it::
575
575
576 HG: ------------------------ >8 ------------------------
576 HG: ------------------------ >8 ------------------------
577
577
578 For example, the template configuration below will show the diff below the
578 For example, the template configuration below will show the diff below the
579 extra message::
579 extra message::
580
580
581 [committemplate]
581 [committemplate]
582 changeset = {desc}\n\n
582 changeset = {desc}\n\n
583 HG: Enter commit message. Lines beginning with 'HG:' are removed.
583 HG: Enter commit message. Lines beginning with 'HG:' are removed.
584 HG: {extramsg}
584 HG: {extramsg}
585 HG: ------------------------ >8 ------------------------
585 HG: ------------------------ >8 ------------------------
586 HG: Do not touch the line above.
586 HG: Do not touch the line above.
587 HG: Everything below will be removed.
587 HG: Everything below will be removed.
588 {diff()}
588 {diff()}
589
589
590 .. note::
590 .. note::
591
591
592 For some problematic encodings (see :hg:`help win32mbcs` for
592 For some problematic encodings (see :hg:`help win32mbcs` for
593 detail), this customization should be configured carefully, to
593 detail), this customization should be configured carefully, to
594 avoid showing broken characters.
594 avoid showing broken characters.
595
595
596 For example, if a multibyte character ending with backslash (0x5c) is
596 For example, if a multibyte character ending with backslash (0x5c) is
597 followed by the ASCII character 'n' in the customized template,
597 followed by the ASCII character 'n' in the customized template,
598 the sequence of backslash and 'n' is treated as line-feed unexpectedly
598 the sequence of backslash and 'n' is treated as line-feed unexpectedly
599 (and the multibyte character is broken, too).
599 (and the multibyte character is broken, too).
600
600
601 Customized template is used for commands below (``--edit`` may be
601 Customized template is used for commands below (``--edit`` may be
602 required):
602 required):
603
603
604 - :hg:`backout`
604 - :hg:`backout`
605 - :hg:`commit`
605 - :hg:`commit`
606 - :hg:`fetch` (for merge commit only)
606 - :hg:`fetch` (for merge commit only)
607 - :hg:`graft`
607 - :hg:`graft`
608 - :hg:`histedit`
608 - :hg:`histedit`
609 - :hg:`import`
609 - :hg:`import`
610 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
610 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
611 - :hg:`rebase`
611 - :hg:`rebase`
612 - :hg:`shelve`
612 - :hg:`shelve`
613 - :hg:`sign`
613 - :hg:`sign`
614 - :hg:`tag`
614 - :hg:`tag`
615 - :hg:`transplant`
615 - :hg:`transplant`
616
616
617 Configuring items below instead of ``changeset`` allows showing
617 Configuring items below instead of ``changeset`` allows showing
618 customized message only for specific actions, or showing different
618 customized message only for specific actions, or showing different
619 messages for each action.
619 messages for each action.
620
620
621 - ``changeset.backout`` for :hg:`backout`
621 - ``changeset.backout`` for :hg:`backout`
622 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
622 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
623 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
623 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
624 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
624 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
625 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
625 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
626 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
626 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
627 - ``changeset.gpg.sign`` for :hg:`sign`
627 - ``changeset.gpg.sign`` for :hg:`sign`
628 - ``changeset.graft`` for :hg:`graft`
628 - ``changeset.graft`` for :hg:`graft`
629 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
629 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
630 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
630 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
631 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
631 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
632 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
632 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
633 - ``changeset.import.bypass`` for :hg:`import --bypass`
633 - ``changeset.import.bypass`` for :hg:`import --bypass`
634 - ``changeset.import.normal.merge`` for :hg:`import` on merges
634 - ``changeset.import.normal.merge`` for :hg:`import` on merges
635 - ``changeset.import.normal.normal`` for :hg:`import` on other
635 - ``changeset.import.normal.normal`` for :hg:`import` on other
636 - ``changeset.mq.qnew`` for :hg:`qnew`
636 - ``changeset.mq.qnew`` for :hg:`qnew`
637 - ``changeset.mq.qfold`` for :hg:`qfold`
637 - ``changeset.mq.qfold`` for :hg:`qfold`
638 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
638 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
639 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
639 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
640 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
640 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
641 - ``changeset.rebase.normal`` for :hg:`rebase` on other
641 - ``changeset.rebase.normal`` for :hg:`rebase` on other
642 - ``changeset.shelve.shelve`` for :hg:`shelve`
642 - ``changeset.shelve.shelve`` for :hg:`shelve`
643 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
643 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
644 - ``changeset.tag.remove`` for :hg:`tag --remove`
644 - ``changeset.tag.remove`` for :hg:`tag --remove`
645 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
645 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
646 - ``changeset.transplant.normal`` for :hg:`transplant` on other
646 - ``changeset.transplant.normal`` for :hg:`transplant` on other
647
647
648 These dot-separated lists of names are treated as hierarchical ones.
648 These dot-separated lists of names are treated as hierarchical ones.
649 For example, ``changeset.tag.remove`` customizes the commit message
649 For example, ``changeset.tag.remove`` customizes the commit message
650 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
650 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
651 commit message for :hg:`tag` regardless of ``--remove`` option.
651 commit message for :hg:`tag` regardless of ``--remove`` option.
652
652
653 When the external editor is invoked for a commit, the corresponding
653 When the external editor is invoked for a commit, the corresponding
654 dot-separated list of names without the ``changeset.`` prefix
654 dot-separated list of names without the ``changeset.`` prefix
655 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
655 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
656 variable.
656 variable.
657
657
658 In this section, items other than ``changeset`` can be referred from
658 In this section, items other than ``changeset`` can be referred from
659 others. For example, the configuration to list committed files up
659 others. For example, the configuration to list committed files up
660 below can be referred as ``{listupfiles}``::
660 below can be referred as ``{listupfiles}``::
661
661
662 [committemplate]
662 [committemplate]
663 listupfiles = {file_adds %
663 listupfiles = {file_adds %
664 "HG: added {file}\n" }{file_mods %
664 "HG: added {file}\n" }{file_mods %
665 "HG: changed {file}\n" }{file_dels %
665 "HG: changed {file}\n" }{file_dels %
666 "HG: removed {file}\n" }{if(files, "",
666 "HG: removed {file}\n" }{if(files, "",
667 "HG: no files changed\n")}
667 "HG: no files changed\n")}
668
668
669 ``decode/encode``
669 ``decode/encode``
670 -----------------
670 -----------------
671
671
672 Filters for transforming files on checkout/checkin. This would
672 Filters for transforming files on checkout/checkin. This would
673 typically be used for newline processing or other
673 typically be used for newline processing or other
674 localization/canonicalization of files.
674 localization/canonicalization of files.
675
675
676 Filters consist of a filter pattern followed by a filter command.
676 Filters consist of a filter pattern followed by a filter command.
677 Filter patterns are globs by default, rooted at the repository root.
677 Filter patterns are globs by default, rooted at the repository root.
678 For example, to match any file ending in ``.txt`` in the root
678 For example, to match any file ending in ``.txt`` in the root
679 directory only, use the pattern ``*.txt``. To match any file ending
679 directory only, use the pattern ``*.txt``. To match any file ending
680 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
680 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
681 For each file only the first matching filter applies.
681 For each file only the first matching filter applies.
682
682
683 The filter command can start with a specifier, either ``pipe:`` or
683 The filter command can start with a specifier, either ``pipe:`` or
684 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
684 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
685
685
686 A ``pipe:`` command must accept data on stdin and return the transformed
686 A ``pipe:`` command must accept data on stdin and return the transformed
687 data on stdout.
687 data on stdout.
688
688
689 Pipe example::
689 Pipe example::
690
690
691 [encode]
691 [encode]
692 # uncompress gzip files on checkin to improve delta compression
692 # uncompress gzip files on checkin to improve delta compression
693 # note: not necessarily a good idea, just an example
693 # note: not necessarily a good idea, just an example
694 *.gz = pipe: gunzip
694 *.gz = pipe: gunzip
695
695
696 [decode]
696 [decode]
697 # recompress gzip files when writing them to the working dir (we
697 # recompress gzip files when writing them to the working dir (we
698 # can safely omit "pipe:", because it's the default)
698 # can safely omit "pipe:", because it's the default)
699 *.gz = gzip
699 *.gz = gzip
700
700
701 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
701 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
702 with the name of a temporary file that contains the data to be
702 with the name of a temporary file that contains the data to be
703 filtered by the command. The string ``OUTFILE`` is replaced with the name
703 filtered by the command. The string ``OUTFILE`` is replaced with the name
704 of an empty temporary file, where the filtered data must be written by
704 of an empty temporary file, where the filtered data must be written by
705 the command.
705 the command.
706
706
707 .. container:: windows
707 .. container:: windows
708
708
709 .. note::
709 .. note::
710
710
711 The tempfile mechanism is recommended for Windows systems,
711 The tempfile mechanism is recommended for Windows systems,
712 where the standard shell I/O redirection operators often have
712 where the standard shell I/O redirection operators often have
713 strange effects and may corrupt the contents of your files.
713 strange effects and may corrupt the contents of your files.
714
714
715 This filter mechanism is used internally by the ``eol`` extension to
715 This filter mechanism is used internally by the ``eol`` extension to
716 translate line ending characters between Windows (CRLF) and Unix (LF)
716 translate line ending characters between Windows (CRLF) and Unix (LF)
717 format. We suggest you use the ``eol`` extension for convenience.
717 format. We suggest you use the ``eol`` extension for convenience.
718
718
719
719
720 ``defaults``
720 ``defaults``
721 ------------
721 ------------
722
722
723 (defaults are deprecated. Don't use them. Use aliases instead.)
723 (defaults are deprecated. Don't use them. Use aliases instead.)
724
724
725 Use the ``[defaults]`` section to define command defaults, i.e. the
725 Use the ``[defaults]`` section to define command defaults, i.e. the
726 default options/arguments to pass to the specified commands.
726 default options/arguments to pass to the specified commands.
727
727
728 The following example makes :hg:`log` run in verbose mode, and
728 The following example makes :hg:`log` run in verbose mode, and
729 :hg:`status` show only the modified files, by default::
729 :hg:`status` show only the modified files, by default::
730
730
731 [defaults]
731 [defaults]
732 log = -v
732 log = -v
733 status = -m
733 status = -m
734
734
735 The actual commands, instead of their aliases, must be used when
735 The actual commands, instead of their aliases, must be used when
736 defining command defaults. The command defaults will also be applied
736 defining command defaults. The command defaults will also be applied
737 to the aliases of the commands defined.
737 to the aliases of the commands defined.
738
738
739
739
740 ``diff``
740 ``diff``
741 --------
741 --------
742
742
743 Settings used when displaying diffs. Everything except for ``unified``
743 Settings used when displaying diffs. Everything except for ``unified``
744 is a Boolean and defaults to False. See :hg:`help config.annotate`
744 is a Boolean and defaults to False. See :hg:`help config.annotate`
745 for related options for the annotate command.
745 for related options for the annotate command.
746
746
747 ``git``
747 ``git``
748 Use git extended diff format.
748 Use git extended diff format.
749
749
750 ``nobinary``
750 ``nobinary``
751 Omit git binary patches.
751 Omit git binary patches.
752
752
753 ``nodates``
753 ``nodates``
754 Don't include dates in diff headers.
754 Don't include dates in diff headers.
755
755
756 ``noprefix``
756 ``noprefix``
757 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
757 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
758
758
759 ``showfunc``
759 ``showfunc``
760 Show which function each change is in.
760 Show which function each change is in.
761
761
762 ``ignorews``
762 ``ignorews``
763 Ignore white space when comparing lines.
763 Ignore white space when comparing lines.
764
764
765 ``ignorewsamount``
765 ``ignorewsamount``
766 Ignore changes in the amount of white space.
766 Ignore changes in the amount of white space.
767
767
768 ``ignoreblanklines``
768 ``ignoreblanklines``
769 Ignore changes whose lines are all blank.
769 Ignore changes whose lines are all blank.
770
770
771 ``unified``
771 ``unified``
772 Number of lines of context to show.
772 Number of lines of context to show.
773
773
774 ``word-diff``
774 ``word-diff``
775 Highlight changed words.
775 Highlight changed words.
776
776
777 ``email``
777 ``email``
778 ---------
778 ---------
779
779
780 Settings for extensions that send email messages.
780 Settings for extensions that send email messages.
781
781
782 ``from``
782 ``from``
783 Optional. Email address to use in "From" header and SMTP envelope
783 Optional. Email address to use in "From" header and SMTP envelope
784 of outgoing messages.
784 of outgoing messages.
785
785
786 ``to``
786 ``to``
787 Optional. Comma-separated list of recipients' email addresses.
787 Optional. Comma-separated list of recipients' email addresses.
788
788
789 ``cc``
789 ``cc``
790 Optional. Comma-separated list of carbon copy recipients'
790 Optional. Comma-separated list of carbon copy recipients'
791 email addresses.
791 email addresses.
792
792
793 ``bcc``
793 ``bcc``
794 Optional. Comma-separated list of blind carbon copy recipients'
794 Optional. Comma-separated list of blind carbon copy recipients'
795 email addresses.
795 email addresses.
796
796
797 ``method``
797 ``method``
798 Optional. Method to use to send email messages. If value is ``smtp``
798 Optional. Method to use to send email messages. If value is ``smtp``
799 (default), use SMTP (see the ``[smtp]`` section for configuration).
799 (default), use SMTP (see the ``[smtp]`` section for configuration).
800 Otherwise, use as name of program to run that acts like sendmail
800 Otherwise, use as name of program to run that acts like sendmail
801 (takes ``-f`` option for sender, list of recipients on command line,
801 (takes ``-f`` option for sender, list of recipients on command line,
802 message on stdin). Normally, setting this to ``sendmail`` or
802 message on stdin). Normally, setting this to ``sendmail`` or
803 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
803 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
804
804
805 ``charsets``
805 ``charsets``
806 Optional. Comma-separated list of character sets considered
806 Optional. Comma-separated list of character sets considered
807 convenient for recipients. Addresses, headers, and parts not
807 convenient for recipients. Addresses, headers, and parts not
808 containing patches of outgoing messages will be encoded in the
808 containing patches of outgoing messages will be encoded in the
809 first character set to which conversion from local encoding
809 first character set to which conversion from local encoding
810 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
810 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
811 conversion fails, the text in question is sent as is.
811 conversion fails, the text in question is sent as is.
812 (default: '')
812 (default: '')
813
813
814 Order of outgoing email character sets:
814 Order of outgoing email character sets:
815
815
816 1. ``us-ascii``: always first, regardless of settings
816 1. ``us-ascii``: always first, regardless of settings
817 2. ``email.charsets``: in order given by user
817 2. ``email.charsets``: in order given by user
818 3. ``ui.fallbackencoding``: if not in email.charsets
818 3. ``ui.fallbackencoding``: if not in email.charsets
819 4. ``$HGENCODING``: if not in email.charsets
819 4. ``$HGENCODING``: if not in email.charsets
820 5. ``utf-8``: always last, regardless of settings
820 5. ``utf-8``: always last, regardless of settings
821
821
822 Email example::
822 Email example::
823
823
824 [email]
824 [email]
825 from = Joseph User <joe.user@example.com>
825 from = Joseph User <joe.user@example.com>
826 method = /usr/sbin/sendmail
826 method = /usr/sbin/sendmail
827 # charsets for western Europeans
827 # charsets for western Europeans
828 # us-ascii, utf-8 omitted, as they are tried first and last
828 # us-ascii, utf-8 omitted, as they are tried first and last
829 charsets = iso-8859-1, iso-8859-15, windows-1252
829 charsets = iso-8859-1, iso-8859-15, windows-1252
830
830
831
831
832 ``extensions``
832 ``extensions``
833 --------------
833 --------------
834
834
835 Mercurial has an extension mechanism for adding new features. To
835 Mercurial has an extension mechanism for adding new features. To
836 enable an extension, create an entry for it in this section.
836 enable an extension, create an entry for it in this section.
837
837
838 If you know that the extension is already in Python's search path,
838 If you know that the extension is already in Python's search path,
839 you can give the name of the module, followed by ``=``, with nothing
839 you can give the name of the module, followed by ``=``, with nothing
840 after the ``=``.
840 after the ``=``.
841
841
842 Otherwise, give a name that you choose, followed by ``=``, followed by
842 Otherwise, give a name that you choose, followed by ``=``, followed by
843 the path to the ``.py`` file (including the file name extension) that
843 the path to the ``.py`` file (including the file name extension) that
844 defines the extension.
844 defines the extension.
845
845
846 To explicitly disable an extension that is enabled in an hgrc of
846 To explicitly disable an extension that is enabled in an hgrc of
847 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
847 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
848 or ``foo = !`` when path is not supplied.
848 or ``foo = !`` when path is not supplied.
849
849
850 Example for ``~/.hgrc``::
850 Example for ``~/.hgrc``::
851
851
852 [extensions]
852 [extensions]
853 # (the churn extension will get loaded from Mercurial's path)
853 # (the churn extension will get loaded from Mercurial's path)
854 churn =
854 churn =
855 # (this extension will get loaded from the file specified)
855 # (this extension will get loaded from the file specified)
856 myfeature = ~/.hgext/myfeature.py
856 myfeature = ~/.hgext/myfeature.py
857
857
858 If an extension fails to load, a warning will be issued, and Mercurial will
858 If an extension fails to load, a warning will be issued, and Mercurial will
859 proceed. To enforce that an extension must be loaded, one can set the `required`
859 proceed. To enforce that an extension must be loaded, one can set the `required`
860 suboption in the config::
860 suboption in the config::
861
861
862 [extensions]
862 [extensions]
863 myfeature = ~/.hgext/myfeature.py
863 myfeature = ~/.hgext/myfeature.py
864 myfeature:required = yes
864 myfeature:required = yes
865
865
866 To debug extension loading issue, one can add `--traceback` to their mercurial
866 To debug extension loading issue, one can add `--traceback` to their mercurial
867 invocation.
867 invocation.
868
868
869 A default setting can we set using the special `*` extension key::
869 A default setting can we set using the special `*` extension key::
870
870
871 [extensions]
871 [extensions]
872 *:required = yes
872 *:required = yes
873 myfeature = ~/.hgext/myfeature.py
873 myfeature = ~/.hgext/myfeature.py
874 rebase=
874 rebase=
875
875
876
876
877 ``format``
877 ``format``
878 ----------
878 ----------
879
879
880 Configuration that controls the repository format. Newer format options are more
880 Configuration that controls the repository format. Newer format options are more
881 powerful, but incompatible with some older versions of Mercurial. Format options
881 powerful, but incompatible with some older versions of Mercurial. Format options
882 are considered at repository initialization only. You need to make a new clone
882 are considered at repository initialization only. You need to make a new clone
883 for config changes to be taken into account.
883 for config changes to be taken into account.
884
884
885 For more details about repository format and version compatibility, see
885 For more details about repository format and version compatibility, see
886 https://www.mercurial-scm.org/wiki/MissingRequirement
886 https://www.mercurial-scm.org/wiki/MissingRequirement
887
887
888 ``usegeneraldelta``
888 ``usegeneraldelta``
889 Enable or disable the "generaldelta" repository format which improves
889 Enable or disable the "generaldelta" repository format which improves
890 repository compression by allowing "revlog" to store deltas against
890 repository compression by allowing "revlog" to store deltas against
891 arbitrary revisions instead of the previously stored one. This provides
891 arbitrary revisions instead of the previously stored one. This provides
892 significant improvement for repositories with branches.
892 significant improvement for repositories with branches.
893
893
894 Repositories with this on-disk format require Mercurial version 1.9.
894 Repositories with this on-disk format require Mercurial version 1.9.
895
895
896 Enabled by default.
896 Enabled by default.
897
897
898 ``dotencode``
898 ``dotencode``
899 Enable or disable the "dotencode" repository format which enhances
899 Enable or disable the "dotencode" repository format which enhances
900 the "fncache" repository format (which has to be enabled to use
900 the "fncache" repository format (which has to be enabled to use
901 dotencode) to avoid issues with filenames starting with "._" on
901 dotencode) to avoid issues with filenames starting with "._" on
902 Mac OS X and spaces on Windows.
902 Mac OS X and spaces on Windows.
903
903
904 Repositories with this on-disk format require Mercurial version 1.7.
904 Repositories with this on-disk format require Mercurial version 1.7.
905
905
906 Enabled by default.
906 Enabled by default.
907
907
908 ``usefncache``
908 ``usefncache``
909 Enable or disable the "fncache" repository format which enhances
909 Enable or disable the "fncache" repository format which enhances
910 the "store" repository format (which has to be enabled to use
910 the "store" repository format (which has to be enabled to use
911 fncache) to allow longer filenames and avoids using Windows
911 fncache) to allow longer filenames and avoids using Windows
912 reserved names, e.g. "nul".
912 reserved names, e.g. "nul".
913
913
914 Repositories with this on-disk format require Mercurial version 1.1.
914 Repositories with this on-disk format require Mercurial version 1.1.
915
915
916 Enabled by default.
916 Enabled by default.
917
917
918 ``use-dirstate-v2``
918 ``use-dirstate-v2``
919 Enable or disable the experimental "dirstate-v2" feature. The dirstate
919 Enable or disable the experimental "dirstate-v2" feature. The dirstate
920 functionality is shared by all commands interacting with the working copy.
920 functionality is shared by all commands interacting with the working copy.
921 The new version is more robust, faster and stores more information.
921 The new version is more robust, faster and stores more information.
922
922
923 The performance-improving version of this feature is currently only
923 The performance-improving version of this feature is currently only
924 implemented in Rust (see :hg:`help rust`), so people not using a version of
924 implemented in Rust (see :hg:`help rust`), so people not using a version of
925 Mercurial compiled with the Rust parts might actually suffer some slowdown.
925 Mercurial compiled with the Rust parts might actually suffer some slowdown.
926 For this reason, such versions will by default refuse to access repositories
926 For this reason, such versions will by default refuse to access repositories
927 with "dirstate-v2" enabled.
927 with "dirstate-v2" enabled.
928
928
929 This behavior can be adjusted via configuration: check
929 This behavior can be adjusted via configuration: check
930 :hg:`help config.storage.dirstate-v2.slow-path` for details.
930 :hg:`help config.storage.dirstate-v2.slow-path` for details.
931
931
932 Repositories with this on-disk format require Mercurial 6.0 or above.
932 Repositories with this on-disk format require Mercurial 6.0 or above.
933
933
934 By default this format variant is disabled if the fast implementation is not
934 By default this format variant is disabled if the fast implementation is not
935 available, and enabled by default if the fast implementation is available.
935 available, and enabled by default if the fast implementation is available.
936
936
937 To accomodate installations of Mercurial without the fast implementation,
937 To accomodate installations of Mercurial without the fast implementation,
938 you can downgrade your repository. To do so run the following command:
938 you can downgrade your repository. To do so run the following command:
939
939
940 $ hg debugupgraderepo \
940 $ hg debugupgraderepo \
941 --run \
941 --run \
942 --config format.use-dirstate-v2=False \
942 --config format.use-dirstate-v2=False \
943 --config storage.dirstate-v2.slow-path=allow
943 --config storage.dirstate-v2.slow-path=allow
944
944
945 For a more comprehensive guide, see :hg:`help internals.dirstate-v2`.
945 For a more comprehensive guide, see :hg:`help internals.dirstate-v2`.
946
946
947 ``exp-dirstate-tracked-key-version``
947 ``dirstate-tracked-key``
948 Enable or disable the writing of "tracked key" file alongside the dirstate.
948 Enable or disable the writing of "tracked key" file alongside the dirstate.
949 (default to disabled)
949
950
950 That "tracked-key" can help external automations to detect changes to the
951 That "tracked-key" can help external automations to detect changes to the
951 set of tracked files.
952 set of tracked files.
952
953
953 Two values are currently supported:
954 - 0: no file is written (the default),
955 - 1: a file in version "1" is written.
956
957 The tracked-key is written in a new `.hg/dirstate-tracked-key`. That file
954 The tracked-key is written in a new `.hg/dirstate-tracked-key`. That file
958 contains two lines:
955 contains two lines:
959 - the first line is the file version (currently: 1),
956 - the first line is the file version (currently: 1),
960 - the second line contains the "tracked-key".
957 - the second line contains the "tracked-key".
961
958
962 The tracked-key changes whenever the set of file tracked in the dirstate
959 The tracked-key changes whenever the set of file tracked in the dirstate
963 changes. The general guarantees are:
960 changes. The general guarantees are:
964 - if the tracked key is identical, the set of tracked file MUST not have changed,
961 - if the tracked key is identical, the set of tracked file MUST not have changed,
965 - if the tracked key is different, the set of tracked file MIGHT differ.
962 - if the tracked key is different, the set of tracked file MIGHT differ.
966
963
967 They are two "ways" to use this feature:
964 They are two "ways" to use this feature:
968
965
969 1) monitoring changes to the `.hg/dirstate-tracked-key`, if the file changes
966 1) monitoring changes to the `.hg/dirstate-tracked-key`, if the file changes
970 the tracked set might have changed.
967 the tracked set might have changed.
971
968
972 2) storing the value and comparing it to a later value. Beware that it is
969 2) storing the value and comparing it to a later value. Beware that it is
973 impossible to achieve atomic writing or reading of the two files involved
970 impossible to achieve atomic writing or reading of the two files involved
974 files (`.hg/dirstate` and `.hg/dirstate-tracked-key`). So it is needed to
971 files (`.hg/dirstate` and `.hg/dirstate-tracked-key`). So it is needed to
975 read the `tracked-key` files twice: before and after reading the tracked
972 read the `tracked-key` files twice: before and after reading the tracked
976 set. The `tracked-key` is only usable as a cache key if it had the same
973 set. The `tracked-key` is only usable as a cache key if it had the same
977 value in both cases and must be discarded otherwise.
974 value in both cases and must be discarded otherwise.
978
975
979 To enforce that the `tracked-key` value can be used race-free (with double
976 To enforce that the `tracked-key` value can be used race-free (with double
980 reading as explained in (2)), the `.hg/dirstate-tracked-key` is written
977 reading as explained in (2)), the `.hg/dirstate-tracked-key` is written
981 twice: before and after we change the associated `.hg/dirstate` file.
978 twice: before and after we change the associated `.hg/dirstate` file.
982
979
983 ``use-persistent-nodemap``
980 ``use-persistent-nodemap``
984 Enable or disable the "persistent-nodemap" feature which improves
981 Enable or disable the "persistent-nodemap" feature which improves
985 performance if the Rust extensions are available.
982 performance if the Rust extensions are available.
986
983
987 The "persistent-nodemap" persist the "node -> rev" on disk removing the
984 The "persistent-nodemap" persist the "node -> rev" on disk removing the
988 need to dynamically build that mapping for each Mercurial invocation. This
985 need to dynamically build that mapping for each Mercurial invocation. This
989 significantly reduces the startup cost of various local and server-side
986 significantly reduces the startup cost of various local and server-side
990 operation for larger repositories.
987 operation for larger repositories.
991
988
992 The performance-improving version of this feature is currently only
989 The performance-improving version of this feature is currently only
993 implemented in Rust (see :hg:`help rust`), so people not using a version of
990 implemented in Rust (see :hg:`help rust`), so people not using a version of
994 Mercurial compiled with the Rust parts might actually suffer some slowdown.
991 Mercurial compiled with the Rust parts might actually suffer some slowdown.
995 For this reason, such versions will by default refuse to access repositories
992 For this reason, such versions will by default refuse to access repositories
996 with "persistent-nodemap".
993 with "persistent-nodemap".
997
994
998 This behavior can be adjusted via configuration: check
995 This behavior can be adjusted via configuration: check
999 :hg:`help config.storage.revlog.persistent-nodemap.slow-path` for details.
996 :hg:`help config.storage.revlog.persistent-nodemap.slow-path` for details.
1000
997
1001 Repositories with this on-disk format require Mercurial 5.4 or above.
998 Repositories with this on-disk format require Mercurial 5.4 or above.
1002
999
1003 By default this format variant is disabled if the fast implementation is not
1000 By default this format variant is disabled if the fast implementation is not
1004 available, and enabled by default if the fast implementation is available.
1001 available, and enabled by default if the fast implementation is available.
1005
1002
1006 To accomodate installations of Mercurial without the fast implementation,
1003 To accomodate installations of Mercurial without the fast implementation,
1007 you can downgrade your repository. To do so run the following command:
1004 you can downgrade your repository. To do so run the following command:
1008
1005
1009 $ hg debugupgraderepo \
1006 $ hg debugupgraderepo \
1010 --run \
1007 --run \
1011 --config format.use-persistent-nodemap=False \
1008 --config format.use-persistent-nodemap=False \
1012 --config storage.revlog.persistent-nodemap.slow-path=allow
1009 --config storage.revlog.persistent-nodemap.slow-path=allow
1013
1010
1014 ``use-share-safe``
1011 ``use-share-safe``
1015 Enforce "safe" behaviors for all "shares" that access this repository.
1012 Enforce "safe" behaviors for all "shares" that access this repository.
1016
1013
1017 With this feature, "shares" using this repository as a source will:
1014 With this feature, "shares" using this repository as a source will:
1018
1015
1019 * read the source repository's configuration (`<source>/.hg/hgrc`).
1016 * read the source repository's configuration (`<source>/.hg/hgrc`).
1020 * read and use the source repository's "requirements"
1017 * read and use the source repository's "requirements"
1021 (except the working copy specific one).
1018 (except the working copy specific one).
1022
1019
1023 Without this feature, "shares" using this repository as a source will:
1020 Without this feature, "shares" using this repository as a source will:
1024
1021
1025 * keep tracking the repository "requirements" in the share only, ignoring
1022 * keep tracking the repository "requirements" in the share only, ignoring
1026 the source "requirements", possibly diverging from them.
1023 the source "requirements", possibly diverging from them.
1027 * ignore source repository config. This can create problems, like silently
1024 * ignore source repository config. This can create problems, like silently
1028 ignoring important hooks.
1025 ignoring important hooks.
1029
1026
1030 Beware that existing shares will not be upgraded/downgraded, and by
1027 Beware that existing shares will not be upgraded/downgraded, and by
1031 default, Mercurial will refuse to interact with them until the mismatch
1028 default, Mercurial will refuse to interact with them until the mismatch
1032 is resolved. See :hg:`help config.share.safe-mismatch.source-safe` and
1029 is resolved. See :hg:`help config.share.safe-mismatch.source-safe` and
1033 :hg:`help config.share.safe-mismatch.source-not-safe` for details.
1030 :hg:`help config.share.safe-mismatch.source-not-safe` for details.
1034
1031
1035 Introduced in Mercurial 5.7.
1032 Introduced in Mercurial 5.7.
1036
1033
1037 Enabled by default in Mercurial 6.1.
1034 Enabled by default in Mercurial 6.1.
1038
1035
1039 ``usestore``
1036 ``usestore``
1040 Enable or disable the "store" repository format which improves
1037 Enable or disable the "store" repository format which improves
1041 compatibility with systems that fold case or otherwise mangle
1038 compatibility with systems that fold case or otherwise mangle
1042 filenames. Disabling this option will allow you to store longer filenames
1039 filenames. Disabling this option will allow you to store longer filenames
1043 in some situations at the expense of compatibility.
1040 in some situations at the expense of compatibility.
1044
1041
1045 Repositories with this on-disk format require Mercurial version 0.9.4.
1042 Repositories with this on-disk format require Mercurial version 0.9.4.
1046
1043
1047 Enabled by default.
1044 Enabled by default.
1048
1045
1049 ``sparse-revlog``
1046 ``sparse-revlog``
1050 Enable or disable the ``sparse-revlog`` delta strategy. This format improves
1047 Enable or disable the ``sparse-revlog`` delta strategy. This format improves
1051 delta re-use inside revlog. For very branchy repositories, it results in a
1048 delta re-use inside revlog. For very branchy repositories, it results in a
1052 smaller store. For repositories with many revisions, it also helps
1049 smaller store. For repositories with many revisions, it also helps
1053 performance (by using shortened delta chains.)
1050 performance (by using shortened delta chains.)
1054
1051
1055 Repositories with this on-disk format require Mercurial version 4.7
1052 Repositories with this on-disk format require Mercurial version 4.7
1056
1053
1057 Enabled by default.
1054 Enabled by default.
1058
1055
1059 ``revlog-compression``
1056 ``revlog-compression``
1060 Compression algorithm used by revlog. Supported values are `zlib` and
1057 Compression algorithm used by revlog. Supported values are `zlib` and
1061 `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is
1058 `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is
1062 a newer format that is usually a net win over `zlib`, operating faster at
1059 a newer format that is usually a net win over `zlib`, operating faster at
1063 better compression rates. Use `zstd` to reduce CPU usage. Multiple values
1060 better compression rates. Use `zstd` to reduce CPU usage. Multiple values
1064 can be specified, the first available one will be used.
1061 can be specified, the first available one will be used.
1065
1062
1066 On some systems, the Mercurial installation may lack `zstd` support.
1063 On some systems, the Mercurial installation may lack `zstd` support.
1067
1064
1068 Default is `zstd` if available, `zlib` otherwise.
1065 Default is `zstd` if available, `zlib` otherwise.
1069
1066
1070 ``bookmarks-in-store``
1067 ``bookmarks-in-store``
1071 Store bookmarks in .hg/store/. This means that bookmarks are shared when
1068 Store bookmarks in .hg/store/. This means that bookmarks are shared when
1072 using `hg share` regardless of the `-B` option.
1069 using `hg share` regardless of the `-B` option.
1073
1070
1074 Repositories with this on-disk format require Mercurial version 5.1.
1071 Repositories with this on-disk format require Mercurial version 5.1.
1075
1072
1076 Disabled by default.
1073 Disabled by default.
1077
1074
1078
1075
1079 ``graph``
1076 ``graph``
1080 ---------
1077 ---------
1081
1078
1082 Web graph view configuration. This section let you change graph
1079 Web graph view configuration. This section let you change graph
1083 elements display properties by branches, for instance to make the
1080 elements display properties by branches, for instance to make the
1084 ``default`` branch stand out.
1081 ``default`` branch stand out.
1085
1082
1086 Each line has the following format::
1083 Each line has the following format::
1087
1084
1088 <branch>.<argument> = <value>
1085 <branch>.<argument> = <value>
1089
1086
1090 where ``<branch>`` is the name of the branch being
1087 where ``<branch>`` is the name of the branch being
1091 customized. Example::
1088 customized. Example::
1092
1089
1093 [graph]
1090 [graph]
1094 # 2px width
1091 # 2px width
1095 default.width = 2
1092 default.width = 2
1096 # red color
1093 # red color
1097 default.color = FF0000
1094 default.color = FF0000
1098
1095
1099 Supported arguments:
1096 Supported arguments:
1100
1097
1101 ``width``
1098 ``width``
1102 Set branch edges width in pixels.
1099 Set branch edges width in pixels.
1103
1100
1104 ``color``
1101 ``color``
1105 Set branch edges color in hexadecimal RGB notation.
1102 Set branch edges color in hexadecimal RGB notation.
1106
1103
1107 ``hooks``
1104 ``hooks``
1108 ---------
1105 ---------
1109
1106
1110 Commands or Python functions that get automatically executed by
1107 Commands or Python functions that get automatically executed by
1111 various actions such as starting or finishing a commit. Multiple
1108 various actions such as starting or finishing a commit. Multiple
1112 hooks can be run for the same action by appending a suffix to the
1109 hooks can be run for the same action by appending a suffix to the
1113 action. Overriding a site-wide hook can be done by changing its
1110 action. Overriding a site-wide hook can be done by changing its
1114 value or setting it to an empty string. Hooks can be prioritized
1111 value or setting it to an empty string. Hooks can be prioritized
1115 by adding a prefix of ``priority.`` to the hook name on a new line
1112 by adding a prefix of ``priority.`` to the hook name on a new line
1116 and setting the priority. The default priority is 0.
1113 and setting the priority. The default priority is 0.
1117
1114
1118 Example ``.hg/hgrc``::
1115 Example ``.hg/hgrc``::
1119
1116
1120 [hooks]
1117 [hooks]
1121 # update working directory after adding changesets
1118 # update working directory after adding changesets
1122 changegroup.update = hg update
1119 changegroup.update = hg update
1123 # do not use the site-wide hook
1120 # do not use the site-wide hook
1124 incoming =
1121 incoming =
1125 incoming.email = /my/email/hook
1122 incoming.email = /my/email/hook
1126 incoming.autobuild = /my/build/hook
1123 incoming.autobuild = /my/build/hook
1127 # force autobuild hook to run before other incoming hooks
1124 # force autobuild hook to run before other incoming hooks
1128 priority.incoming.autobuild = 1
1125 priority.incoming.autobuild = 1
1129 ### control HGPLAIN setting when running autobuild hook
1126 ### control HGPLAIN setting when running autobuild hook
1130 # HGPLAIN always set (default from Mercurial 5.7)
1127 # HGPLAIN always set (default from Mercurial 5.7)
1131 incoming.autobuild:run-with-plain = yes
1128 incoming.autobuild:run-with-plain = yes
1132 # HGPLAIN never set
1129 # HGPLAIN never set
1133 incoming.autobuild:run-with-plain = no
1130 incoming.autobuild:run-with-plain = no
1134 # HGPLAIN inherited from environment (default before Mercurial 5.7)
1131 # HGPLAIN inherited from environment (default before Mercurial 5.7)
1135 incoming.autobuild:run-with-plain = auto
1132 incoming.autobuild:run-with-plain = auto
1136
1133
1137 Most hooks are run with environment variables set that give useful
1134 Most hooks are run with environment variables set that give useful
1138 additional information. For each hook below, the environment variables
1135 additional information. For each hook below, the environment variables
1139 it is passed are listed with names in the form ``$HG_foo``. The
1136 it is passed are listed with names in the form ``$HG_foo``. The
1140 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
1137 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
1141 They contain the type of hook which triggered the run and the full name
1138 They contain the type of hook which triggered the run and the full name
1142 of the hook in the config, respectively. In the example above, this will
1139 of the hook in the config, respectively. In the example above, this will
1143 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
1140 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
1144
1141
1145 .. container:: windows
1142 .. container:: windows
1146
1143
1147 Some basic Unix syntax can be enabled for portability, including ``$VAR``
1144 Some basic Unix syntax can be enabled for portability, including ``$VAR``
1148 and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will
1145 and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will
1149 be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion
1146 be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion
1150 on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back
1147 on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back
1151 slash or inside of a strong quote. Strong quotes will be replaced by
1148 slash or inside of a strong quote. Strong quotes will be replaced by
1152 double quotes after processing.
1149 double quotes after processing.
1153
1150
1154 This feature is enabled by adding a prefix of ``tonative.`` to the hook
1151 This feature is enabled by adding a prefix of ``tonative.`` to the hook
1155 name on a new line, and setting it to ``True``. For example::
1152 name on a new line, and setting it to ``True``. For example::
1156
1153
1157 [hooks]
1154 [hooks]
1158 incoming.autobuild = /my/build/hook
1155 incoming.autobuild = /my/build/hook
1159 # enable translation to cmd.exe syntax for autobuild hook
1156 # enable translation to cmd.exe syntax for autobuild hook
1160 tonative.incoming.autobuild = True
1157 tonative.incoming.autobuild = True
1161
1158
1162 ``changegroup``
1159 ``changegroup``
1163 Run after a changegroup has been added via push, pull or unbundle. The ID of
1160 Run after a changegroup has been added via push, pull or unbundle. The ID of
1164 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
1161 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
1165 The URL from which changes came is in ``$HG_URL``.
1162 The URL from which changes came is in ``$HG_URL``.
1166
1163
1167 ``commit``
1164 ``commit``
1168 Run after a changeset has been created in the local repository. The ID
1165 Run after a changeset has been created in the local repository. The ID
1169 of the newly created changeset is in ``$HG_NODE``. Parent changeset
1166 of the newly created changeset is in ``$HG_NODE``. Parent changeset
1170 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1167 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1171
1168
1172 ``incoming``
1169 ``incoming``
1173 Run after a changeset has been pulled, pushed, or unbundled into
1170 Run after a changeset has been pulled, pushed, or unbundled into
1174 the local repository. The ID of the newly arrived changeset is in
1171 the local repository. The ID of the newly arrived changeset is in
1175 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
1172 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
1176
1173
1177 ``outgoing``
1174 ``outgoing``
1178 Run after sending changes from the local repository to another. The ID of
1175 Run after sending changes from the local repository to another. The ID of
1179 first changeset sent is in ``$HG_NODE``. The source of operation is in
1176 first changeset sent is in ``$HG_NODE``. The source of operation is in
1180 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
1177 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
1181
1178
1182 ``post-<command>``
1179 ``post-<command>``
1183 Run after successful invocations of the associated command. The
1180 Run after successful invocations of the associated command. The
1184 contents of the command line are passed as ``$HG_ARGS`` and the result
1181 contents of the command line are passed as ``$HG_ARGS`` and the result
1185 code in ``$HG_RESULT``. Parsed command line arguments are passed as
1182 code in ``$HG_RESULT``. Parsed command line arguments are passed as
1186 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
1183 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
1187 the python data internally passed to <command>. ``$HG_OPTS`` is a
1184 the python data internally passed to <command>. ``$HG_OPTS`` is a
1188 dictionary of options (with unspecified options set to their defaults).
1185 dictionary of options (with unspecified options set to their defaults).
1189 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
1186 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
1190
1187
1191 ``fail-<command>``
1188 ``fail-<command>``
1192 Run after a failed invocation of an associated command. The contents
1189 Run after a failed invocation of an associated command. The contents
1193 of the command line are passed as ``$HG_ARGS``. Parsed command line
1190 of the command line are passed as ``$HG_ARGS``. Parsed command line
1194 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
1191 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
1195 string representations of the python data internally passed to
1192 string representations of the python data internally passed to
1196 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
1193 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
1197 options set to their defaults). ``$HG_PATS`` is a list of arguments.
1194 options set to their defaults). ``$HG_PATS`` is a list of arguments.
1198 Hook failure is ignored.
1195 Hook failure is ignored.
1199
1196
1200 ``pre-<command>``
1197 ``pre-<command>``
1201 Run before executing the associated command. The contents of the
1198 Run before executing the associated command. The contents of the
1202 command line are passed as ``$HG_ARGS``. Parsed command line arguments
1199 command line are passed as ``$HG_ARGS``. Parsed command line arguments
1203 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
1200 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
1204 representations of the data internally passed to <command>. ``$HG_OPTS``
1201 representations of the data internally passed to <command>. ``$HG_OPTS``
1205 is a dictionary of options (with unspecified options set to their
1202 is a dictionary of options (with unspecified options set to their
1206 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
1203 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
1207 failure, the command doesn't execute and Mercurial returns the failure
1204 failure, the command doesn't execute and Mercurial returns the failure
1208 code.
1205 code.
1209
1206
1210 ``prechangegroup``
1207 ``prechangegroup``
1211 Run before a changegroup is added via push, pull or unbundle. Exit
1208 Run before a changegroup is added via push, pull or unbundle. Exit
1212 status 0 allows the changegroup to proceed. A non-zero status will
1209 status 0 allows the changegroup to proceed. A non-zero status will
1213 cause the push, pull or unbundle to fail. The URL from which changes
1210 cause the push, pull or unbundle to fail. The URL from which changes
1214 will come is in ``$HG_URL``.
1211 will come is in ``$HG_URL``.
1215
1212
1216 ``precommit``
1213 ``precommit``
1217 Run before starting a local commit. Exit status 0 allows the
1214 Run before starting a local commit. Exit status 0 allows the
1218 commit to proceed. A non-zero status will cause the commit to fail.
1215 commit to proceed. A non-zero status will cause the commit to fail.
1219 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1216 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1220
1217
1221 ``prelistkeys``
1218 ``prelistkeys``
1222 Run before listing pushkeys (like bookmarks) in the
1219 Run before listing pushkeys (like bookmarks) in the
1223 repository. A non-zero status will cause failure. The key namespace is
1220 repository. A non-zero status will cause failure. The key namespace is
1224 in ``$HG_NAMESPACE``.
1221 in ``$HG_NAMESPACE``.
1225
1222
1226 ``preoutgoing``
1223 ``preoutgoing``
1227 Run before collecting changes to send from the local repository to
1224 Run before collecting changes to send from the local repository to
1228 another. A non-zero status will cause failure. This lets you prevent
1225 another. A non-zero status will cause failure. This lets you prevent
1229 pull over HTTP or SSH. It can also prevent propagating commits (via
1226 pull over HTTP or SSH. It can also prevent propagating commits (via
1230 local pull, push (outbound) or bundle commands), but not completely,
1227 local pull, push (outbound) or bundle commands), but not completely,
1231 since you can just copy files instead. The source of operation is in
1228 since you can just copy files instead. The source of operation is in
1232 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
1229 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
1233 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
1230 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
1234 is happening on behalf of a repository on same system.
1231 is happening on behalf of a repository on same system.
1235
1232
1236 ``prepushkey``
1233 ``prepushkey``
1237 Run before a pushkey (like a bookmark) is added to the
1234 Run before a pushkey (like a bookmark) is added to the
1238 repository. A non-zero status will cause the key to be rejected. The
1235 repository. A non-zero status will cause the key to be rejected. The
1239 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
1236 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
1240 the old value (if any) is in ``$HG_OLD``, and the new value is in
1237 the old value (if any) is in ``$HG_OLD``, and the new value is in
1241 ``$HG_NEW``.
1238 ``$HG_NEW``.
1242
1239
1243 ``pretag``
1240 ``pretag``
1244 Run before creating a tag. Exit status 0 allows the tag to be
1241 Run before creating a tag. Exit status 0 allows the tag to be
1245 created. A non-zero status will cause the tag to fail. The ID of the
1242 created. A non-zero status will cause the tag to fail. The ID of the
1246 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
1243 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
1247 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
1244 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
1248
1245
1249 ``pretxnopen``
1246 ``pretxnopen``
1250 Run before any new repository transaction is open. The reason for the
1247 Run before any new repository transaction is open. The reason for the
1251 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
1248 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
1252 transaction will be in ``$HG_TXNID``. A non-zero status will prevent the
1249 transaction will be in ``$HG_TXNID``. A non-zero status will prevent the
1253 transaction from being opened.
1250 transaction from being opened.
1254
1251
1255 ``pretxnclose``
1252 ``pretxnclose``
1256 Run right before the transaction is actually finalized. Any repository change
1253 Run right before the transaction is actually finalized. Any repository change
1257 will be visible to the hook program. This lets you validate the transaction
1254 will be visible to the hook program. This lets you validate the transaction
1258 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1255 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1259 status will cause the transaction to be rolled back. The reason for the
1256 status will cause the transaction to be rolled back. The reason for the
1260 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1257 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1261 the transaction will be in ``$HG_TXNID``. The rest of the available data will
1258 the transaction will be in ``$HG_TXNID``. The rest of the available data will
1262 vary according the transaction type. Changes unbundled to the repository will
1259 vary according the transaction type. Changes unbundled to the repository will
1263 add ``$HG_URL`` and ``$HG_SOURCE``. New changesets will add ``$HG_NODE`` (the
1260 add ``$HG_URL`` and ``$HG_SOURCE``. New changesets will add ``$HG_NODE`` (the
1264 ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last added
1261 ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last added
1265 changeset). Bookmark and phase changes will set ``$HG_BOOKMARK_MOVED`` and
1262 changeset). Bookmark and phase changes will set ``$HG_BOOKMARK_MOVED`` and
1266 ``$HG_PHASES_MOVED`` to ``1`` respectively. The number of new obsmarkers, if
1263 ``$HG_PHASES_MOVED`` to ``1`` respectively. The number of new obsmarkers, if
1267 any, will be in ``$HG_NEW_OBSMARKERS``, etc.
1264 any, will be in ``$HG_NEW_OBSMARKERS``, etc.
1268
1265
1269 ``pretxnclose-bookmark``
1266 ``pretxnclose-bookmark``
1270 Run right before a bookmark change is actually finalized. Any repository
1267 Run right before a bookmark change is actually finalized. Any repository
1271 change will be visible to the hook program. This lets you validate the
1268 change will be visible to the hook program. This lets you validate the
1272 transaction content or change it. Exit status 0 allows the commit to
1269 transaction content or change it. Exit status 0 allows the commit to
1273 proceed. A non-zero status will cause the transaction to be rolled back.
1270 proceed. A non-zero status will cause the transaction to be rolled back.
1274 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1271 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1275 bookmark location will be available in ``$HG_NODE`` while the previous
1272 bookmark location will be available in ``$HG_NODE`` while the previous
1276 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1273 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1277 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1274 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1278 will be empty.
1275 will be empty.
1279 In addition, the reason for the transaction opening will be in
1276 In addition, the reason for the transaction opening will be in
1280 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1277 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1281 ``$HG_TXNID``.
1278 ``$HG_TXNID``.
1282
1279
1283 ``pretxnclose-phase``
1280 ``pretxnclose-phase``
1284 Run right before a phase change is actually finalized. Any repository change
1281 Run right before a phase change is actually finalized. Any repository change
1285 will be visible to the hook program. This lets you validate the transaction
1282 will be visible to the hook program. This lets you validate the transaction
1286 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1283 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1287 status will cause the transaction to be rolled back. The hook is called
1284 status will cause the transaction to be rolled back. The hook is called
1288 multiple times, once for each revision affected by a phase change.
1285 multiple times, once for each revision affected by a phase change.
1289 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1286 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1290 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1287 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1291 will be empty. In addition, the reason for the transaction opening will be in
1288 will be empty. In addition, the reason for the transaction opening will be in
1292 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1289 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1293 ``$HG_TXNID``. The hook is also run for newly added revisions. In this case
1290 ``$HG_TXNID``. The hook is also run for newly added revisions. In this case
1294 the ``$HG_OLDPHASE`` entry will be empty.
1291 the ``$HG_OLDPHASE`` entry will be empty.
1295
1292
1296 ``txnclose``
1293 ``txnclose``
1297 Run after any repository transaction has been committed. At this
1294 Run after any repository transaction has been committed. At this
1298 point, the transaction can no longer be rolled back. The hook will run
1295 point, the transaction can no longer be rolled back. The hook will run
1299 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1296 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1300 details about available variables.
1297 details about available variables.
1301
1298
1302 ``txnclose-bookmark``
1299 ``txnclose-bookmark``
1303 Run after any bookmark change has been committed. At this point, the
1300 Run after any bookmark change has been committed. At this point, the
1304 transaction can no longer be rolled back. The hook will run after the lock
1301 transaction can no longer be rolled back. The hook will run after the lock
1305 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1302 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1306 about available variables.
1303 about available variables.
1307
1304
1308 ``txnclose-phase``
1305 ``txnclose-phase``
1309 Run after any phase change has been committed. At this point, the
1306 Run after any phase change has been committed. At this point, the
1310 transaction can no longer be rolled back. The hook will run after the lock
1307 transaction can no longer be rolled back. The hook will run after the lock
1311 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1308 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1312 available variables.
1309 available variables.
1313
1310
1314 ``txnabort``
1311 ``txnabort``
1315 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1312 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1316 for details about available variables.
1313 for details about available variables.
1317
1314
1318 ``pretxnchangegroup``
1315 ``pretxnchangegroup``
1319 Run after a changegroup has been added via push, pull or unbundle, but before
1316 Run after a changegroup has been added via push, pull or unbundle, but before
1320 the transaction has been committed. The changegroup is visible to the hook
1317 the transaction has been committed. The changegroup is visible to the hook
1321 program. This allows validation of incoming changes before accepting them.
1318 program. This allows validation of incoming changes before accepting them.
1322 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1319 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1323 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1320 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1324 status will cause the transaction to be rolled back, and the push, pull or
1321 status will cause the transaction to be rolled back, and the push, pull or
1325 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1322 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1326
1323
1327 ``pretxncommit``
1324 ``pretxncommit``
1328 Run after a changeset has been created, but before the transaction is
1325 Run after a changeset has been created, but before the transaction is
1329 committed. The changeset is visible to the hook program. This allows
1326 committed. The changeset is visible to the hook program. This allows
1330 validation of the commit message and changes. Exit status 0 allows the
1327 validation of the commit message and changes. Exit status 0 allows the
1331 commit to proceed. A non-zero status will cause the transaction to
1328 commit to proceed. A non-zero status will cause the transaction to
1332 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1329 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1333 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1330 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1334
1331
1335 ``preupdate``
1332 ``preupdate``
1336 Run before updating the working directory. Exit status 0 allows
1333 Run before updating the working directory. Exit status 0 allows
1337 the update to proceed. A non-zero status will prevent the update.
1334 the update to proceed. A non-zero status will prevent the update.
1338 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1335 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1339 merge, the ID of second new parent is in ``$HG_PARENT2``.
1336 merge, the ID of second new parent is in ``$HG_PARENT2``.
1340
1337
1341 ``listkeys``
1338 ``listkeys``
1342 Run after listing pushkeys (like bookmarks) in the repository. The
1339 Run after listing pushkeys (like bookmarks) in the repository. The
1343 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1340 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1344 dictionary containing the keys and values.
1341 dictionary containing the keys and values.
1345
1342
1346 ``pushkey``
1343 ``pushkey``
1347 Run after a pushkey (like a bookmark) is added to the
1344 Run after a pushkey (like a bookmark) is added to the
1348 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1345 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1349 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1346 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1350 value is in ``$HG_NEW``.
1347 value is in ``$HG_NEW``.
1351
1348
1352 ``tag``
1349 ``tag``
1353 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1350 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1354 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1351 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1355 the repository if ``$HG_LOCAL=0``.
1352 the repository if ``$HG_LOCAL=0``.
1356
1353
1357 ``update``
1354 ``update``
1358 Run after updating the working directory. The changeset ID of first
1355 Run after updating the working directory. The changeset ID of first
1359 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1356 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1360 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1357 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1361 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1358 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1362
1359
1363 .. note::
1360 .. note::
1364
1361
1365 It is generally better to use standard hooks rather than the
1362 It is generally better to use standard hooks rather than the
1366 generic pre- and post- command hooks, as they are guaranteed to be
1363 generic pre- and post- command hooks, as they are guaranteed to be
1367 called in the appropriate contexts for influencing transactions.
1364 called in the appropriate contexts for influencing transactions.
1368 Also, hooks like "commit" will be called in all contexts that
1365 Also, hooks like "commit" will be called in all contexts that
1369 generate a commit (e.g. tag) and not just the commit command.
1366 generate a commit (e.g. tag) and not just the commit command.
1370
1367
1371 .. note::
1368 .. note::
1372
1369
1373 Environment variables with empty values may not be passed to
1370 Environment variables with empty values may not be passed to
1374 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1371 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1375 will have an empty value under Unix-like platforms for non-merge
1372 will have an empty value under Unix-like platforms for non-merge
1376 changesets, while it will not be available at all under Windows.
1373 changesets, while it will not be available at all under Windows.
1377
1374
1378 The syntax for Python hooks is as follows::
1375 The syntax for Python hooks is as follows::
1379
1376
1380 hookname = python:modulename.submodule.callable
1377 hookname = python:modulename.submodule.callable
1381 hookname = python:/path/to/python/module.py:callable
1378 hookname = python:/path/to/python/module.py:callable
1382
1379
1383 Python hooks are run within the Mercurial process. Each hook is
1380 Python hooks are run within the Mercurial process. Each hook is
1384 called with at least three keyword arguments: a ui object (keyword
1381 called with at least three keyword arguments: a ui object (keyword
1385 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1382 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1386 keyword that tells what kind of hook is used. Arguments listed as
1383 keyword that tells what kind of hook is used. Arguments listed as
1387 environment variables above are passed as keyword arguments, with no
1384 environment variables above are passed as keyword arguments, with no
1388 ``HG_`` prefix, and names in lower case.
1385 ``HG_`` prefix, and names in lower case.
1389
1386
1390 If a Python hook returns a "true" value or raises an exception, this
1387 If a Python hook returns a "true" value or raises an exception, this
1391 is treated as a failure.
1388 is treated as a failure.
1392
1389
1393
1390
1394 ``hostfingerprints``
1391 ``hostfingerprints``
1395 --------------------
1392 --------------------
1396
1393
1397 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1394 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1398
1395
1399 Fingerprints of the certificates of known HTTPS servers.
1396 Fingerprints of the certificates of known HTTPS servers.
1400
1397
1401 A HTTPS connection to a server with a fingerprint configured here will
1398 A HTTPS connection to a server with a fingerprint configured here will
1402 only succeed if the servers certificate matches the fingerprint.
1399 only succeed if the servers certificate matches the fingerprint.
1403 This is very similar to how ssh known hosts works.
1400 This is very similar to how ssh known hosts works.
1404
1401
1405 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1402 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1406 Multiple values can be specified (separated by spaces or commas). This can
1403 Multiple values can be specified (separated by spaces or commas). This can
1407 be used to define both old and new fingerprints while a host transitions
1404 be used to define both old and new fingerprints while a host transitions
1408 to a new certificate.
1405 to a new certificate.
1409
1406
1410 The CA chain and web.cacerts is not used for servers with a fingerprint.
1407 The CA chain and web.cacerts is not used for servers with a fingerprint.
1411
1408
1412 For example::
1409 For example::
1413
1410
1414 [hostfingerprints]
1411 [hostfingerprints]
1415 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1412 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1416 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1413 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1417
1414
1418 ``hostsecurity``
1415 ``hostsecurity``
1419 ----------------
1416 ----------------
1420
1417
1421 Used to specify global and per-host security settings for connecting to
1418 Used to specify global and per-host security settings for connecting to
1422 other machines.
1419 other machines.
1423
1420
1424 The following options control default behavior for all hosts.
1421 The following options control default behavior for all hosts.
1425
1422
1426 ``ciphers``
1423 ``ciphers``
1427 Defines the cryptographic ciphers to use for connections.
1424 Defines the cryptographic ciphers to use for connections.
1428
1425
1429 Value must be a valid OpenSSL Cipher List Format as documented at
1426 Value must be a valid OpenSSL Cipher List Format as documented at
1430 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1427 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1431
1428
1432 This setting is for advanced users only. Setting to incorrect values
1429 This setting is for advanced users only. Setting to incorrect values
1433 can significantly lower connection security or decrease performance.
1430 can significantly lower connection security or decrease performance.
1434 You have been warned.
1431 You have been warned.
1435
1432
1436 This option requires Python 2.7.
1433 This option requires Python 2.7.
1437
1434
1438 ``minimumprotocol``
1435 ``minimumprotocol``
1439 Defines the minimum channel encryption protocol to use.
1436 Defines the minimum channel encryption protocol to use.
1440
1437
1441 By default, the highest version of TLS supported by both client and server
1438 By default, the highest version of TLS supported by both client and server
1442 is used.
1439 is used.
1443
1440
1444 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1441 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1445
1442
1446 When running on an old Python version, only ``tls1.0`` is allowed since
1443 When running on an old Python version, only ``tls1.0`` is allowed since
1447 old versions of Python only support up to TLS 1.0.
1444 old versions of Python only support up to TLS 1.0.
1448
1445
1449 When running a Python that supports modern TLS versions, the default is
1446 When running a Python that supports modern TLS versions, the default is
1450 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1447 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1451 weakens security and should only be used as a feature of last resort if
1448 weakens security and should only be used as a feature of last resort if
1452 a server does not support TLS 1.1+.
1449 a server does not support TLS 1.1+.
1453
1450
1454 Options in the ``[hostsecurity]`` section can have the form
1451 Options in the ``[hostsecurity]`` section can have the form
1455 ``hostname``:``setting``. This allows multiple settings to be defined on a
1452 ``hostname``:``setting``. This allows multiple settings to be defined on a
1456 per-host basis.
1453 per-host basis.
1457
1454
1458 The following per-host settings can be defined.
1455 The following per-host settings can be defined.
1459
1456
1460 ``ciphers``
1457 ``ciphers``
1461 This behaves like ``ciphers`` as described above except it only applies
1458 This behaves like ``ciphers`` as described above except it only applies
1462 to the host on which it is defined.
1459 to the host on which it is defined.
1463
1460
1464 ``fingerprints``
1461 ``fingerprints``
1465 A list of hashes of the DER encoded peer/remote certificate. Values have
1462 A list of hashes of the DER encoded peer/remote certificate. Values have
1466 the form ``algorithm``:``fingerprint``. e.g.
1463 the form ``algorithm``:``fingerprint``. e.g.
1467 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1464 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1468 In addition, colons (``:``) can appear in the fingerprint part.
1465 In addition, colons (``:``) can appear in the fingerprint part.
1469
1466
1470 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1467 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1471 ``sha512``.
1468 ``sha512``.
1472
1469
1473 Use of ``sha256`` or ``sha512`` is preferred.
1470 Use of ``sha256`` or ``sha512`` is preferred.
1474
1471
1475 If a fingerprint is specified, the CA chain is not validated for this
1472 If a fingerprint is specified, the CA chain is not validated for this
1476 host and Mercurial will require the remote certificate to match one
1473 host and Mercurial will require the remote certificate to match one
1477 of the fingerprints specified. This means if the server updates its
1474 of the fingerprints specified. This means if the server updates its
1478 certificate, Mercurial will abort until a new fingerprint is defined.
1475 certificate, Mercurial will abort until a new fingerprint is defined.
1479 This can provide stronger security than traditional CA-based validation
1476 This can provide stronger security than traditional CA-based validation
1480 at the expense of convenience.
1477 at the expense of convenience.
1481
1478
1482 This option takes precedence over ``verifycertsfile``.
1479 This option takes precedence over ``verifycertsfile``.
1483
1480
1484 ``minimumprotocol``
1481 ``minimumprotocol``
1485 This behaves like ``minimumprotocol`` as described above except it
1482 This behaves like ``minimumprotocol`` as described above except it
1486 only applies to the host on which it is defined.
1483 only applies to the host on which it is defined.
1487
1484
1488 ``verifycertsfile``
1485 ``verifycertsfile``
1489 Path to file a containing a list of PEM encoded certificates used to
1486 Path to file a containing a list of PEM encoded certificates used to
1490 verify the server certificate. Environment variables and ``~user``
1487 verify the server certificate. Environment variables and ``~user``
1491 constructs are expanded in the filename.
1488 constructs are expanded in the filename.
1492
1489
1493 The server certificate or the certificate's certificate authority (CA)
1490 The server certificate or the certificate's certificate authority (CA)
1494 must match a certificate from this file or certificate verification
1491 must match a certificate from this file or certificate verification
1495 will fail and connections to the server will be refused.
1492 will fail and connections to the server will be refused.
1496
1493
1497 If defined, only certificates provided by this file will be used:
1494 If defined, only certificates provided by this file will be used:
1498 ``web.cacerts`` and any system/default certificates will not be
1495 ``web.cacerts`` and any system/default certificates will not be
1499 used.
1496 used.
1500
1497
1501 This option has no effect if the per-host ``fingerprints`` option
1498 This option has no effect if the per-host ``fingerprints`` option
1502 is set.
1499 is set.
1503
1500
1504 The format of the file is as follows::
1501 The format of the file is as follows::
1505
1502
1506 -----BEGIN CERTIFICATE-----
1503 -----BEGIN CERTIFICATE-----
1507 ... (certificate in base64 PEM encoding) ...
1504 ... (certificate in base64 PEM encoding) ...
1508 -----END CERTIFICATE-----
1505 -----END CERTIFICATE-----
1509 -----BEGIN CERTIFICATE-----
1506 -----BEGIN CERTIFICATE-----
1510 ... (certificate in base64 PEM encoding) ...
1507 ... (certificate in base64 PEM encoding) ...
1511 -----END CERTIFICATE-----
1508 -----END CERTIFICATE-----
1512
1509
1513 For example::
1510 For example::
1514
1511
1515 [hostsecurity]
1512 [hostsecurity]
1516 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1513 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1517 hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1514 hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1518 hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2
1515 hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2
1519 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1516 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1520
1517
1521 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1518 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1522 when connecting to ``hg.example.com``::
1519 when connecting to ``hg.example.com``::
1523
1520
1524 [hostsecurity]
1521 [hostsecurity]
1525 minimumprotocol = tls1.2
1522 minimumprotocol = tls1.2
1526 hg.example.com:minimumprotocol = tls1.1
1523 hg.example.com:minimumprotocol = tls1.1
1527
1524
1528 ``http_proxy``
1525 ``http_proxy``
1529 --------------
1526 --------------
1530
1527
1531 Used to access web-based Mercurial repositories through a HTTP
1528 Used to access web-based Mercurial repositories through a HTTP
1532 proxy.
1529 proxy.
1533
1530
1534 ``host``
1531 ``host``
1535 Host name and (optional) port of the proxy server, for example
1532 Host name and (optional) port of the proxy server, for example
1536 "myproxy:8000".
1533 "myproxy:8000".
1537
1534
1538 ``no``
1535 ``no``
1539 Optional. Comma-separated list of host names that should bypass
1536 Optional. Comma-separated list of host names that should bypass
1540 the proxy.
1537 the proxy.
1541
1538
1542 ``passwd``
1539 ``passwd``
1543 Optional. Password to authenticate with at the proxy server.
1540 Optional. Password to authenticate with at the proxy server.
1544
1541
1545 ``user``
1542 ``user``
1546 Optional. User name to authenticate with at the proxy server.
1543 Optional. User name to authenticate with at the proxy server.
1547
1544
1548 ``always``
1545 ``always``
1549 Optional. Always use the proxy, even for localhost and any entries
1546 Optional. Always use the proxy, even for localhost and any entries
1550 in ``http_proxy.no``. (default: False)
1547 in ``http_proxy.no``. (default: False)
1551
1548
1552 ``http``
1549 ``http``
1553 ----------
1550 ----------
1554
1551
1555 Used to configure access to Mercurial repositories via HTTP.
1552 Used to configure access to Mercurial repositories via HTTP.
1556
1553
1557 ``timeout``
1554 ``timeout``
1558 If set, blocking operations will timeout after that many seconds.
1555 If set, blocking operations will timeout after that many seconds.
1559 (default: None)
1556 (default: None)
1560
1557
1561 ``merge``
1558 ``merge``
1562 ---------
1559 ---------
1563
1560
1564 This section specifies behavior during merges and updates.
1561 This section specifies behavior during merges and updates.
1565
1562
1566 ``checkignored``
1563 ``checkignored``
1567 Controls behavior when an ignored file on disk has the same name as a tracked
1564 Controls behavior when an ignored file on disk has the same name as a tracked
1568 file in the changeset being merged or updated to, and has different
1565 file in the changeset being merged or updated to, and has different
1569 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1566 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1570 abort on such files. With ``warn``, warn on such files and back them up as
1567 abort on such files. With ``warn``, warn on such files and back them up as
1571 ``.orig``. With ``ignore``, don't print a warning and back them up as
1568 ``.orig``. With ``ignore``, don't print a warning and back them up as
1572 ``.orig``. (default: ``abort``)
1569 ``.orig``. (default: ``abort``)
1573
1570
1574 ``checkunknown``
1571 ``checkunknown``
1575 Controls behavior when an unknown file that isn't ignored has the same name
1572 Controls behavior when an unknown file that isn't ignored has the same name
1576 as a tracked file in the changeset being merged or updated to, and has
1573 as a tracked file in the changeset being merged or updated to, and has
1577 different contents. Similar to ``merge.checkignored``, except for files that
1574 different contents. Similar to ``merge.checkignored``, except for files that
1578 are not ignored. (default: ``abort``)
1575 are not ignored. (default: ``abort``)
1579
1576
1580 ``on-failure``
1577 ``on-failure``
1581 When set to ``continue`` (the default), the merge process attempts to
1578 When set to ``continue`` (the default), the merge process attempts to
1582 merge all unresolved files using the merge chosen tool, regardless of
1579 merge all unresolved files using the merge chosen tool, regardless of
1583 whether previous file merge attempts during the process succeeded or not.
1580 whether previous file merge attempts during the process succeeded or not.
1584 Setting this to ``prompt`` will prompt after any merge failure continue
1581 Setting this to ``prompt`` will prompt after any merge failure continue
1585 or halt the merge process. Setting this to ``halt`` will automatically
1582 or halt the merge process. Setting this to ``halt`` will automatically
1586 halt the merge process on any merge tool failure. The merge process
1583 halt the merge process on any merge tool failure. The merge process
1587 can be restarted by using the ``resolve`` command. When a merge is
1584 can be restarted by using the ``resolve`` command. When a merge is
1588 halted, the repository is left in a normal ``unresolved`` merge state.
1585 halted, the repository is left in a normal ``unresolved`` merge state.
1589 (default: ``continue``)
1586 (default: ``continue``)
1590
1587
1591 ``strict-capability-check``
1588 ``strict-capability-check``
1592 Whether capabilities of internal merge tools are checked strictly
1589 Whether capabilities of internal merge tools are checked strictly
1593 or not, while examining rules to decide merge tool to be used.
1590 or not, while examining rules to decide merge tool to be used.
1594 (default: False)
1591 (default: False)
1595
1592
1596 ``merge-patterns``
1593 ``merge-patterns``
1597 ------------------
1594 ------------------
1598
1595
1599 This section specifies merge tools to associate with particular file
1596 This section specifies merge tools to associate with particular file
1600 patterns. Tools matched here will take precedence over the default
1597 patterns. Tools matched here will take precedence over the default
1601 merge tool. Patterns are globs by default, rooted at the repository
1598 merge tool. Patterns are globs by default, rooted at the repository
1602 root.
1599 root.
1603
1600
1604 Example::
1601 Example::
1605
1602
1606 [merge-patterns]
1603 [merge-patterns]
1607 **.c = kdiff3
1604 **.c = kdiff3
1608 **.jpg = myimgmerge
1605 **.jpg = myimgmerge
1609
1606
1610 ``merge-tools``
1607 ``merge-tools``
1611 ---------------
1608 ---------------
1612
1609
1613 This section configures external merge tools to use for file-level
1610 This section configures external merge tools to use for file-level
1614 merges. This section has likely been preconfigured at install time.
1611 merges. This section has likely been preconfigured at install time.
1615 Use :hg:`config merge-tools` to check the existing configuration.
1612 Use :hg:`config merge-tools` to check the existing configuration.
1616 Also see :hg:`help merge-tools` for more details.
1613 Also see :hg:`help merge-tools` for more details.
1617
1614
1618 Example ``~/.hgrc``::
1615 Example ``~/.hgrc``::
1619
1616
1620 [merge-tools]
1617 [merge-tools]
1621 # Override stock tool location
1618 # Override stock tool location
1622 kdiff3.executable = ~/bin/kdiff3
1619 kdiff3.executable = ~/bin/kdiff3
1623 # Specify command line
1620 # Specify command line
1624 kdiff3.args = $base $local $other -o $output
1621 kdiff3.args = $base $local $other -o $output
1625 # Give higher priority
1622 # Give higher priority
1626 kdiff3.priority = 1
1623 kdiff3.priority = 1
1627
1624
1628 # Changing the priority of preconfigured tool
1625 # Changing the priority of preconfigured tool
1629 meld.priority = 0
1626 meld.priority = 0
1630
1627
1631 # Disable a preconfigured tool
1628 # Disable a preconfigured tool
1632 vimdiff.disabled = yes
1629 vimdiff.disabled = yes
1633
1630
1634 # Define new tool
1631 # Define new tool
1635 myHtmlTool.args = -m $local $other $base $output
1632 myHtmlTool.args = -m $local $other $base $output
1636 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1633 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1637 myHtmlTool.priority = 1
1634 myHtmlTool.priority = 1
1638
1635
1639 Supported arguments:
1636 Supported arguments:
1640
1637
1641 ``priority``
1638 ``priority``
1642 The priority in which to evaluate this tool.
1639 The priority in which to evaluate this tool.
1643 (default: 0)
1640 (default: 0)
1644
1641
1645 ``executable``
1642 ``executable``
1646 Either just the name of the executable or its pathname.
1643 Either just the name of the executable or its pathname.
1647
1644
1648 .. container:: windows
1645 .. container:: windows
1649
1646
1650 On Windows, the path can use environment variables with ${ProgramFiles}
1647 On Windows, the path can use environment variables with ${ProgramFiles}
1651 syntax.
1648 syntax.
1652
1649
1653 (default: the tool name)
1650 (default: the tool name)
1654
1651
1655 ``args``
1652 ``args``
1656 The arguments to pass to the tool executable. You can refer to the
1653 The arguments to pass to the tool executable. You can refer to the
1657 files being merged as well as the output file through these
1654 files being merged as well as the output file through these
1658 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1655 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1659
1656
1660 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1657 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1661 being performed. During an update or merge, ``$local`` represents the original
1658 being performed. During an update or merge, ``$local`` represents the original
1662 state of the file, while ``$other`` represents the commit you are updating to or
1659 state of the file, while ``$other`` represents the commit you are updating to or
1663 the commit you are merging with. During a rebase, ``$local`` represents the
1660 the commit you are merging with. During a rebase, ``$local`` represents the
1664 destination of the rebase, and ``$other`` represents the commit being rebased.
1661 destination of the rebase, and ``$other`` represents the commit being rebased.
1665
1662
1666 Some operations define custom labels to assist with identifying the revisions,
1663 Some operations define custom labels to assist with identifying the revisions,
1667 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1664 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1668 labels are not available, these will be ``local``, ``other``, and ``base``,
1665 labels are not available, these will be ``local``, ``other``, and ``base``,
1669 respectively.
1666 respectively.
1670 (default: ``$local $base $other``)
1667 (default: ``$local $base $other``)
1671
1668
1672 ``premerge``
1669 ``premerge``
1673 Attempt to run internal non-interactive 3-way merge tool before
1670 Attempt to run internal non-interactive 3-way merge tool before
1674 launching external tool. Options are ``true``, ``false``, ``keep``,
1671 launching external tool. Options are ``true``, ``false``, ``keep``,
1675 ``keep-merge3``, or ``keep-mergediff`` (experimental). The ``keep`` option
1672 ``keep-merge3``, or ``keep-mergediff`` (experimental). The ``keep`` option
1676 will leave markers in the file if the premerge fails. The ``keep-merge3``
1673 will leave markers in the file if the premerge fails. The ``keep-merge3``
1677 will do the same but include information about the base of the merge in the
1674 will do the same but include information about the base of the merge in the
1678 marker (see internal :merge3 in :hg:`help merge-tools`). The
1675 marker (see internal :merge3 in :hg:`help merge-tools`). The
1679 ``keep-mergediff`` option is similar but uses a different marker style
1676 ``keep-mergediff`` option is similar but uses a different marker style
1680 (see internal :merge3 in :hg:`help merge-tools`). (default: True)
1677 (see internal :merge3 in :hg:`help merge-tools`). (default: True)
1681
1678
1682 ``binary``
1679 ``binary``
1683 This tool can merge binary files. (default: False, unless tool
1680 This tool can merge binary files. (default: False, unless tool
1684 was selected by file pattern match)
1681 was selected by file pattern match)
1685
1682
1686 ``symlink``
1683 ``symlink``
1687 This tool can merge symlinks. (default: False)
1684 This tool can merge symlinks. (default: False)
1688
1685
1689 ``check``
1686 ``check``
1690 A list of merge success-checking options:
1687 A list of merge success-checking options:
1691
1688
1692 ``changed``
1689 ``changed``
1693 Ask whether merge was successful when the merged file shows no changes.
1690 Ask whether merge was successful when the merged file shows no changes.
1694 ``conflicts``
1691 ``conflicts``
1695 Check whether there are conflicts even though the tool reported success.
1692 Check whether there are conflicts even though the tool reported success.
1696 ``prompt``
1693 ``prompt``
1697 Always prompt for merge success, regardless of success reported by tool.
1694 Always prompt for merge success, regardless of success reported by tool.
1698
1695
1699 ``fixeol``
1696 ``fixeol``
1700 Attempt to fix up EOL changes caused by the merge tool.
1697 Attempt to fix up EOL changes caused by the merge tool.
1701 (default: False)
1698 (default: False)
1702
1699
1703 ``gui``
1700 ``gui``
1704 This tool requires a graphical interface to run. (default: False)
1701 This tool requires a graphical interface to run. (default: False)
1705
1702
1706 ``mergemarkers``
1703 ``mergemarkers``
1707 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1704 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1708 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1705 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1709 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1706 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1710 markers generated during premerge will be ``detailed`` if either this option or
1707 markers generated during premerge will be ``detailed`` if either this option or
1711 the corresponding option in the ``[ui]`` section is ``detailed``.
1708 the corresponding option in the ``[ui]`` section is ``detailed``.
1712 (default: ``basic``)
1709 (default: ``basic``)
1713
1710
1714 ``mergemarkertemplate``
1711 ``mergemarkertemplate``
1715 This setting can be used to override ``mergemarker`` from the
1712 This setting can be used to override ``mergemarker`` from the
1716 ``[command-templates]`` section on a per-tool basis; this applies to the
1713 ``[command-templates]`` section on a per-tool basis; this applies to the
1717 ``$label``-prefixed variables and to the conflict markers that are generated
1714 ``$label``-prefixed variables and to the conflict markers that are generated
1718 if ``premerge`` is ``keep` or ``keep-merge3``. See the corresponding variable
1715 if ``premerge`` is ``keep` or ``keep-merge3``. See the corresponding variable
1719 in ``[ui]`` for more information.
1716 in ``[ui]`` for more information.
1720
1717
1721 .. container:: windows
1718 .. container:: windows
1722
1719
1723 ``regkey``
1720 ``regkey``
1724 Windows registry key which describes install location of this
1721 Windows registry key which describes install location of this
1725 tool. Mercurial will search for this key first under
1722 tool. Mercurial will search for this key first under
1726 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1723 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1727 (default: None)
1724 (default: None)
1728
1725
1729 ``regkeyalt``
1726 ``regkeyalt``
1730 An alternate Windows registry key to try if the first key is not
1727 An alternate Windows registry key to try if the first key is not
1731 found. The alternate key uses the same ``regname`` and ``regappend``
1728 found. The alternate key uses the same ``regname`` and ``regappend``
1732 semantics of the primary key. The most common use for this key
1729 semantics of the primary key. The most common use for this key
1733 is to search for 32bit applications on 64bit operating systems.
1730 is to search for 32bit applications on 64bit operating systems.
1734 (default: None)
1731 (default: None)
1735
1732
1736 ``regname``
1733 ``regname``
1737 Name of value to read from specified registry key.
1734 Name of value to read from specified registry key.
1738 (default: the unnamed (default) value)
1735 (default: the unnamed (default) value)
1739
1736
1740 ``regappend``
1737 ``regappend``
1741 String to append to the value read from the registry, typically
1738 String to append to the value read from the registry, typically
1742 the executable name of the tool.
1739 the executable name of the tool.
1743 (default: None)
1740 (default: None)
1744
1741
1745 ``pager``
1742 ``pager``
1746 ---------
1743 ---------
1747
1744
1748 Setting used to control when to paginate and with what external tool. See
1745 Setting used to control when to paginate and with what external tool. See
1749 :hg:`help pager` for details.
1746 :hg:`help pager` for details.
1750
1747
1751 ``pager``
1748 ``pager``
1752 Define the external tool used as pager.
1749 Define the external tool used as pager.
1753
1750
1754 If no pager is set, Mercurial uses the environment variable $PAGER.
1751 If no pager is set, Mercurial uses the environment variable $PAGER.
1755 If neither pager.pager, nor $PAGER is set, a default pager will be
1752 If neither pager.pager, nor $PAGER is set, a default pager will be
1756 used, typically `less` on Unix and `more` on Windows. Example::
1753 used, typically `less` on Unix and `more` on Windows. Example::
1757
1754
1758 [pager]
1755 [pager]
1759 pager = less -FRX
1756 pager = less -FRX
1760
1757
1761 ``ignore``
1758 ``ignore``
1762 List of commands to disable the pager for. Example::
1759 List of commands to disable the pager for. Example::
1763
1760
1764 [pager]
1761 [pager]
1765 ignore = version, help, update
1762 ignore = version, help, update
1766
1763
1767 ``patch``
1764 ``patch``
1768 ---------
1765 ---------
1769
1766
1770 Settings used when applying patches, for instance through the 'import'
1767 Settings used when applying patches, for instance through the 'import'
1771 command or with Mercurial Queues extension.
1768 command or with Mercurial Queues extension.
1772
1769
1773 ``eol``
1770 ``eol``
1774 When set to 'strict' patch content and patched files end of lines
1771 When set to 'strict' patch content and patched files end of lines
1775 are preserved. When set to ``lf`` or ``crlf``, both files end of
1772 are preserved. When set to ``lf`` or ``crlf``, both files end of
1776 lines are ignored when patching and the result line endings are
1773 lines are ignored when patching and the result line endings are
1777 normalized to either LF (Unix) or CRLF (Windows). When set to
1774 normalized to either LF (Unix) or CRLF (Windows). When set to
1778 ``auto``, end of lines are again ignored while patching but line
1775 ``auto``, end of lines are again ignored while patching but line
1779 endings in patched files are normalized to their original setting
1776 endings in patched files are normalized to their original setting
1780 on a per-file basis. If target file does not exist or has no end
1777 on a per-file basis. If target file does not exist or has no end
1781 of line, patch line endings are preserved.
1778 of line, patch line endings are preserved.
1782 (default: strict)
1779 (default: strict)
1783
1780
1784 ``fuzz``
1781 ``fuzz``
1785 The number of lines of 'fuzz' to allow when applying patches. This
1782 The number of lines of 'fuzz' to allow when applying patches. This
1786 controls how much context the patcher is allowed to ignore when
1783 controls how much context the patcher is allowed to ignore when
1787 trying to apply a patch.
1784 trying to apply a patch.
1788 (default: 2)
1785 (default: 2)
1789
1786
1790 ``paths``
1787 ``paths``
1791 ---------
1788 ---------
1792
1789
1793 Assigns symbolic names and behavior to repositories.
1790 Assigns symbolic names and behavior to repositories.
1794
1791
1795 Options are symbolic names defining the URL or directory that is the
1792 Options are symbolic names defining the URL or directory that is the
1796 location of the repository. Example::
1793 location of the repository. Example::
1797
1794
1798 [paths]
1795 [paths]
1799 my_server = https://example.com/my_repo
1796 my_server = https://example.com/my_repo
1800 local_path = /home/me/repo
1797 local_path = /home/me/repo
1801
1798
1802 These symbolic names can be used from the command line. To pull
1799 These symbolic names can be used from the command line. To pull
1803 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1800 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1804 :hg:`push local_path`. You can check :hg:`help urls` for details about
1801 :hg:`push local_path`. You can check :hg:`help urls` for details about
1805 valid URLs.
1802 valid URLs.
1806
1803
1807 Options containing colons (``:``) denote sub-options that can influence
1804 Options containing colons (``:``) denote sub-options that can influence
1808 behavior for that specific path. Example::
1805 behavior for that specific path. Example::
1809
1806
1810 [paths]
1807 [paths]
1811 my_server = https://example.com/my_path
1808 my_server = https://example.com/my_path
1812 my_server:pushurl = ssh://example.com/my_path
1809 my_server:pushurl = ssh://example.com/my_path
1813
1810
1814 Paths using the `path://otherpath` scheme will inherit the sub-options value from
1811 Paths using the `path://otherpath` scheme will inherit the sub-options value from
1815 the path they point to.
1812 the path they point to.
1816
1813
1817 The following sub-options can be defined:
1814 The following sub-options can be defined:
1818
1815
1819 ``multi-urls``
1816 ``multi-urls``
1820 A boolean option. When enabled the value of the `[paths]` entry will be
1817 A boolean option. When enabled the value of the `[paths]` entry will be
1821 parsed as a list and the alias will resolve to multiple destination. If some
1818 parsed as a list and the alias will resolve to multiple destination. If some
1822 of the list entry use the `path://` syntax, the suboption will be inherited
1819 of the list entry use the `path://` syntax, the suboption will be inherited
1823 individually.
1820 individually.
1824
1821
1825 ``pushurl``
1822 ``pushurl``
1826 The URL to use for push operations. If not defined, the location
1823 The URL to use for push operations. If not defined, the location
1827 defined by the path's main entry is used.
1824 defined by the path's main entry is used.
1828
1825
1829 ``pushrev``
1826 ``pushrev``
1830 A revset defining which revisions to push by default.
1827 A revset defining which revisions to push by default.
1831
1828
1832 When :hg:`push` is executed without a ``-r`` argument, the revset
1829 When :hg:`push` is executed without a ``-r`` argument, the revset
1833 defined by this sub-option is evaluated to determine what to push.
1830 defined by this sub-option is evaluated to determine what to push.
1834
1831
1835 For example, a value of ``.`` will push the working directory's
1832 For example, a value of ``.`` will push the working directory's
1836 revision by default.
1833 revision by default.
1837
1834
1838 Revsets specifying bookmarks will not result in the bookmark being
1835 Revsets specifying bookmarks will not result in the bookmark being
1839 pushed.
1836 pushed.
1840
1837
1841 ``bookmarks.mode``
1838 ``bookmarks.mode``
1842 How bookmark will be dealt during the exchange. It support the following value
1839 How bookmark will be dealt during the exchange. It support the following value
1843
1840
1844 - ``default``: the default behavior, local and remote bookmarks are "merged"
1841 - ``default``: the default behavior, local and remote bookmarks are "merged"
1845 on push/pull.
1842 on push/pull.
1846
1843
1847 - ``mirror``: when pulling, replace local bookmarks by remote bookmarks. This
1844 - ``mirror``: when pulling, replace local bookmarks by remote bookmarks. This
1848 is useful to replicate a repository, or as an optimization.
1845 is useful to replicate a repository, or as an optimization.
1849
1846
1850 - ``ignore``: ignore bookmarks during exchange.
1847 - ``ignore``: ignore bookmarks during exchange.
1851 (This currently only affect pulling)
1848 (This currently only affect pulling)
1852
1849
1853 The following special named paths exist:
1850 The following special named paths exist:
1854
1851
1855 ``default``
1852 ``default``
1856 The URL or directory to use when no source or remote is specified.
1853 The URL or directory to use when no source or remote is specified.
1857
1854
1858 :hg:`clone` will automatically define this path to the location the
1855 :hg:`clone` will automatically define this path to the location the
1859 repository was cloned from.
1856 repository was cloned from.
1860
1857
1861 ``default-push``
1858 ``default-push``
1862 (deprecated) The URL or directory for the default :hg:`push` location.
1859 (deprecated) The URL or directory for the default :hg:`push` location.
1863 ``default:pushurl`` should be used instead.
1860 ``default:pushurl`` should be used instead.
1864
1861
1865 ``phases``
1862 ``phases``
1866 ----------
1863 ----------
1867
1864
1868 Specifies default handling of phases. See :hg:`help phases` for more
1865 Specifies default handling of phases. See :hg:`help phases` for more
1869 information about working with phases.
1866 information about working with phases.
1870
1867
1871 ``publish``
1868 ``publish``
1872 Controls draft phase behavior when working as a server. When true,
1869 Controls draft phase behavior when working as a server. When true,
1873 pushed changesets are set to public in both client and server and
1870 pushed changesets are set to public in both client and server and
1874 pulled or cloned changesets are set to public in the client.
1871 pulled or cloned changesets are set to public in the client.
1875 (default: True)
1872 (default: True)
1876
1873
1877 ``new-commit``
1874 ``new-commit``
1878 Phase of newly-created commits.
1875 Phase of newly-created commits.
1879 (default: draft)
1876 (default: draft)
1880
1877
1881 ``checksubrepos``
1878 ``checksubrepos``
1882 Check the phase of the current revision of each subrepository. Allowed
1879 Check the phase of the current revision of each subrepository. Allowed
1883 values are "ignore", "follow" and "abort". For settings other than
1880 values are "ignore", "follow" and "abort". For settings other than
1884 "ignore", the phase of the current revision of each subrepository is
1881 "ignore", the phase of the current revision of each subrepository is
1885 checked before committing the parent repository. If any of those phases is
1882 checked before committing the parent repository. If any of those phases is
1886 greater than the phase of the parent repository (e.g. if a subrepo is in a
1883 greater than the phase of the parent repository (e.g. if a subrepo is in a
1887 "secret" phase while the parent repo is in "draft" phase), the commit is
1884 "secret" phase while the parent repo is in "draft" phase), the commit is
1888 either aborted (if checksubrepos is set to "abort") or the higher phase is
1885 either aborted (if checksubrepos is set to "abort") or the higher phase is
1889 used for the parent repository commit (if set to "follow").
1886 used for the parent repository commit (if set to "follow").
1890 (default: follow)
1887 (default: follow)
1891
1888
1892
1889
1893 ``profiling``
1890 ``profiling``
1894 -------------
1891 -------------
1895
1892
1896 Specifies profiling type, format, and file output. Two profilers are
1893 Specifies profiling type, format, and file output. Two profilers are
1897 supported: an instrumenting profiler (named ``ls``), and a sampling
1894 supported: an instrumenting profiler (named ``ls``), and a sampling
1898 profiler (named ``stat``).
1895 profiler (named ``stat``).
1899
1896
1900 In this section description, 'profiling data' stands for the raw data
1897 In this section description, 'profiling data' stands for the raw data
1901 collected during profiling, while 'profiling report' stands for a
1898 collected during profiling, while 'profiling report' stands for a
1902 statistical text report generated from the profiling data.
1899 statistical text report generated from the profiling data.
1903
1900
1904 ``enabled``
1901 ``enabled``
1905 Enable the profiler.
1902 Enable the profiler.
1906 (default: false)
1903 (default: false)
1907
1904
1908 This is equivalent to passing ``--profile`` on the command line.
1905 This is equivalent to passing ``--profile`` on the command line.
1909
1906
1910 ``type``
1907 ``type``
1911 The type of profiler to use.
1908 The type of profiler to use.
1912 (default: stat)
1909 (default: stat)
1913
1910
1914 ``ls``
1911 ``ls``
1915 Use Python's built-in instrumenting profiler. This profiler
1912 Use Python's built-in instrumenting profiler. This profiler
1916 works on all platforms, but each line number it reports is the
1913 works on all platforms, but each line number it reports is the
1917 first line of a function. This restriction makes it difficult to
1914 first line of a function. This restriction makes it difficult to
1918 identify the expensive parts of a non-trivial function.
1915 identify the expensive parts of a non-trivial function.
1919 ``stat``
1916 ``stat``
1920 Use a statistical profiler, statprof. This profiler is most
1917 Use a statistical profiler, statprof. This profiler is most
1921 useful for profiling commands that run for longer than about 0.1
1918 useful for profiling commands that run for longer than about 0.1
1922 seconds.
1919 seconds.
1923
1920
1924 ``format``
1921 ``format``
1925 Profiling format. Specific to the ``ls`` instrumenting profiler.
1922 Profiling format. Specific to the ``ls`` instrumenting profiler.
1926 (default: text)
1923 (default: text)
1927
1924
1928 ``text``
1925 ``text``
1929 Generate a profiling report. When saving to a file, it should be
1926 Generate a profiling report. When saving to a file, it should be
1930 noted that only the report is saved, and the profiling data is
1927 noted that only the report is saved, and the profiling data is
1931 not kept.
1928 not kept.
1932 ``kcachegrind``
1929 ``kcachegrind``
1933 Format profiling data for kcachegrind use: when saving to a
1930 Format profiling data for kcachegrind use: when saving to a
1934 file, the generated file can directly be loaded into
1931 file, the generated file can directly be loaded into
1935 kcachegrind.
1932 kcachegrind.
1936
1933
1937 ``statformat``
1934 ``statformat``
1938 Profiling format for the ``stat`` profiler.
1935 Profiling format for the ``stat`` profiler.
1939 (default: hotpath)
1936 (default: hotpath)
1940
1937
1941 ``hotpath``
1938 ``hotpath``
1942 Show a tree-based display containing the hot path of execution (where
1939 Show a tree-based display containing the hot path of execution (where
1943 most time was spent).
1940 most time was spent).
1944 ``bymethod``
1941 ``bymethod``
1945 Show a table of methods ordered by how frequently they are active.
1942 Show a table of methods ordered by how frequently they are active.
1946 ``byline``
1943 ``byline``
1947 Show a table of lines in files ordered by how frequently they are active.
1944 Show a table of lines in files ordered by how frequently they are active.
1948 ``json``
1945 ``json``
1949 Render profiling data as JSON.
1946 Render profiling data as JSON.
1950
1947
1951 ``freq``
1948 ``freq``
1952 Sampling frequency. Specific to the ``stat`` sampling profiler.
1949 Sampling frequency. Specific to the ``stat`` sampling profiler.
1953 (default: 1000)
1950 (default: 1000)
1954
1951
1955 ``output``
1952 ``output``
1956 File path where profiling data or report should be saved. If the
1953 File path where profiling data or report should be saved. If the
1957 file exists, it is replaced. (default: None, data is printed on
1954 file exists, it is replaced. (default: None, data is printed on
1958 stderr)
1955 stderr)
1959
1956
1960 ``sort``
1957 ``sort``
1961 Sort field. Specific to the ``ls`` instrumenting profiler.
1958 Sort field. Specific to the ``ls`` instrumenting profiler.
1962 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1959 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1963 ``inlinetime``.
1960 ``inlinetime``.
1964 (default: inlinetime)
1961 (default: inlinetime)
1965
1962
1966 ``time-track``
1963 ``time-track``
1967 Control if the stat profiler track ``cpu`` or ``real`` time.
1964 Control if the stat profiler track ``cpu`` or ``real`` time.
1968 (default: ``cpu`` on Windows, otherwise ``real``)
1965 (default: ``cpu`` on Windows, otherwise ``real``)
1969
1966
1970 ``limit``
1967 ``limit``
1971 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1968 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1972 (default: 30)
1969 (default: 30)
1973
1970
1974 ``nested``
1971 ``nested``
1975 Show at most this number of lines of drill-down info after each main entry.
1972 Show at most this number of lines of drill-down info after each main entry.
1976 This can help explain the difference between Total and Inline.
1973 This can help explain the difference between Total and Inline.
1977 Specific to the ``ls`` instrumenting profiler.
1974 Specific to the ``ls`` instrumenting profiler.
1978 (default: 0)
1975 (default: 0)
1979
1976
1980 ``showmin``
1977 ``showmin``
1981 Minimum fraction of samples an entry must have for it to be displayed.
1978 Minimum fraction of samples an entry must have for it to be displayed.
1982 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1979 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1983 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1980 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1984
1981
1985 Only used by the ``stat`` profiler.
1982 Only used by the ``stat`` profiler.
1986
1983
1987 For the ``hotpath`` format, default is ``0.05``.
1984 For the ``hotpath`` format, default is ``0.05``.
1988 For the ``chrome`` format, default is ``0.005``.
1985 For the ``chrome`` format, default is ``0.005``.
1989
1986
1990 The option is unused on other formats.
1987 The option is unused on other formats.
1991
1988
1992 ``showmax``
1989 ``showmax``
1993 Maximum fraction of samples an entry can have before it is ignored in
1990 Maximum fraction of samples an entry can have before it is ignored in
1994 display. Values format is the same as ``showmin``.
1991 display. Values format is the same as ``showmin``.
1995
1992
1996 Only used by the ``stat`` profiler.
1993 Only used by the ``stat`` profiler.
1997
1994
1998 For the ``chrome`` format, default is ``0.999``.
1995 For the ``chrome`` format, default is ``0.999``.
1999
1996
2000 The option is unused on other formats.
1997 The option is unused on other formats.
2001
1998
2002 ``showtime``
1999 ``showtime``
2003 Show time taken as absolute durations, in addition to percentages.
2000 Show time taken as absolute durations, in addition to percentages.
2004 Only used by the ``hotpath`` format.
2001 Only used by the ``hotpath`` format.
2005 (default: true)
2002 (default: true)
2006
2003
2007 ``progress``
2004 ``progress``
2008 ------------
2005 ------------
2009
2006
2010 Mercurial commands can draw progress bars that are as informative as
2007 Mercurial commands can draw progress bars that are as informative as
2011 possible. Some progress bars only offer indeterminate information, while others
2008 possible. Some progress bars only offer indeterminate information, while others
2012 have a definite end point.
2009 have a definite end point.
2013
2010
2014 ``debug``
2011 ``debug``
2015 Whether to print debug info when updating the progress bar. (default: False)
2012 Whether to print debug info when updating the progress bar. (default: False)
2016
2013
2017 ``delay``
2014 ``delay``
2018 Number of seconds (float) before showing the progress bar. (default: 3)
2015 Number of seconds (float) before showing the progress bar. (default: 3)
2019
2016
2020 ``changedelay``
2017 ``changedelay``
2021 Minimum delay before showing a new topic. When set to less than 3 * refresh,
2018 Minimum delay before showing a new topic. When set to less than 3 * refresh,
2022 that value will be used instead. (default: 1)
2019 that value will be used instead. (default: 1)
2023
2020
2024 ``estimateinterval``
2021 ``estimateinterval``
2025 Maximum sampling interval in seconds for speed and estimated time
2022 Maximum sampling interval in seconds for speed and estimated time
2026 calculation. (default: 60)
2023 calculation. (default: 60)
2027
2024
2028 ``refresh``
2025 ``refresh``
2029 Time in seconds between refreshes of the progress bar. (default: 0.1)
2026 Time in seconds between refreshes of the progress bar. (default: 0.1)
2030
2027
2031 ``format``
2028 ``format``
2032 Format of the progress bar.
2029 Format of the progress bar.
2033
2030
2034 Valid entries for the format field are ``topic``, ``bar``, ``number``,
2031 Valid entries for the format field are ``topic``, ``bar``, ``number``,
2035 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
2032 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
2036 last 20 characters of the item, but this can be changed by adding either
2033 last 20 characters of the item, but this can be changed by adding either
2037 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
2034 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
2038 first num characters.
2035 first num characters.
2039
2036
2040 (default: topic bar number estimate)
2037 (default: topic bar number estimate)
2041
2038
2042 ``width``
2039 ``width``
2043 If set, the maximum width of the progress information (that is, min(width,
2040 If set, the maximum width of the progress information (that is, min(width,
2044 term width) will be used).
2041 term width) will be used).
2045
2042
2046 ``clear-complete``
2043 ``clear-complete``
2047 Clear the progress bar after it's done. (default: True)
2044 Clear the progress bar after it's done. (default: True)
2048
2045
2049 ``disable``
2046 ``disable``
2050 If true, don't show a progress bar.
2047 If true, don't show a progress bar.
2051
2048
2052 ``assume-tty``
2049 ``assume-tty``
2053 If true, ALWAYS show a progress bar, unless disable is given.
2050 If true, ALWAYS show a progress bar, unless disable is given.
2054
2051
2055 ``rebase``
2052 ``rebase``
2056 ----------
2053 ----------
2057
2054
2058 ``evolution.allowdivergence``
2055 ``evolution.allowdivergence``
2059 Default to False, when True allow creating divergence when performing
2056 Default to False, when True allow creating divergence when performing
2060 rebase of obsolete changesets.
2057 rebase of obsolete changesets.
2061
2058
2062 ``revsetalias``
2059 ``revsetalias``
2063 ---------------
2060 ---------------
2064
2061
2065 Alias definitions for revsets. See :hg:`help revsets` for details.
2062 Alias definitions for revsets. See :hg:`help revsets` for details.
2066
2063
2067 ``rewrite``
2064 ``rewrite``
2068 -----------
2065 -----------
2069
2066
2070 ``backup-bundle``
2067 ``backup-bundle``
2071 Whether to save stripped changesets to a bundle file. (default: True)
2068 Whether to save stripped changesets to a bundle file. (default: True)
2072
2069
2073 ``update-timestamp``
2070 ``update-timestamp``
2074 If true, updates the date and time of the changeset to current. It is only
2071 If true, updates the date and time of the changeset to current. It is only
2075 applicable for `hg amend`, `hg commit --amend` and `hg uncommit` in the
2072 applicable for `hg amend`, `hg commit --amend` and `hg uncommit` in the
2076 current version.
2073 current version.
2077
2074
2078 ``empty-successor``
2075 ``empty-successor``
2079
2076
2080 Control what happens with empty successors that are the result of rewrite
2077 Control what happens with empty successors that are the result of rewrite
2081 operations. If set to ``skip``, the successor is not created. If set to
2078 operations. If set to ``skip``, the successor is not created. If set to
2082 ``keep``, the empty successor is created and kept.
2079 ``keep``, the empty successor is created and kept.
2083
2080
2084 Currently, only the rebase and absorb commands consider this configuration.
2081 Currently, only the rebase and absorb commands consider this configuration.
2085 (EXPERIMENTAL)
2082 (EXPERIMENTAL)
2086
2083
2087 ``share``
2084 ``share``
2088 ---------
2085 ---------
2089
2086
2090 ``safe-mismatch.source-safe``
2087 ``safe-mismatch.source-safe``
2091 Controls what happens when the shared repository does not use the
2088 Controls what happens when the shared repository does not use the
2092 share-safe mechanism but its source repository does.
2089 share-safe mechanism but its source repository does.
2093
2090
2094 Possible values are `abort` (default), `allow`, `upgrade-abort` and
2091 Possible values are `abort` (default), `allow`, `upgrade-abort` and
2095 `upgrade-allow`.
2092 `upgrade-allow`.
2096
2093
2097 ``abort``
2094 ``abort``
2098 Disallows running any command and aborts
2095 Disallows running any command and aborts
2099 ``allow``
2096 ``allow``
2100 Respects the feature presence in the share source
2097 Respects the feature presence in the share source
2101 ``upgrade-abort``
2098 ``upgrade-abort``
2102 tries to upgrade the share to use share-safe; if it fails, aborts
2099 tries to upgrade the share to use share-safe; if it fails, aborts
2103 ``upgrade-allow``
2100 ``upgrade-allow``
2104 tries to upgrade the share; if it fails, continue by
2101 tries to upgrade the share; if it fails, continue by
2105 respecting the share source setting
2102 respecting the share source setting
2106
2103
2107 Check :hg:`help config.format.use-share-safe` for details about the
2104 Check :hg:`help config.format.use-share-safe` for details about the
2108 share-safe feature.
2105 share-safe feature.
2109
2106
2110 ``safe-mismatch.source-safe.warn``
2107 ``safe-mismatch.source-safe.warn``
2111 Shows a warning on operations if the shared repository does not use
2108 Shows a warning on operations if the shared repository does not use
2112 share-safe, but the source repository does.
2109 share-safe, but the source repository does.
2113 (default: True)
2110 (default: True)
2114
2111
2115 ``safe-mismatch.source-not-safe``
2112 ``safe-mismatch.source-not-safe``
2116 Controls what happens when the shared repository uses the share-safe
2113 Controls what happens when the shared repository uses the share-safe
2117 mechanism but its source does not.
2114 mechanism but its source does not.
2118
2115
2119 Possible values are `abort` (default), `allow`, `downgrade-abort` and
2116 Possible values are `abort` (default), `allow`, `downgrade-abort` and
2120 `downgrade-allow`.
2117 `downgrade-allow`.
2121
2118
2122 ``abort``
2119 ``abort``
2123 Disallows running any command and aborts
2120 Disallows running any command and aborts
2124 ``allow``
2121 ``allow``
2125 Respects the feature presence in the share source
2122 Respects the feature presence in the share source
2126 ``downgrade-abort``
2123 ``downgrade-abort``
2127 tries to downgrade the share to not use share-safe; if it fails, aborts
2124 tries to downgrade the share to not use share-safe; if it fails, aborts
2128 ``downgrade-allow``
2125 ``downgrade-allow``
2129 tries to downgrade the share to not use share-safe;
2126 tries to downgrade the share to not use share-safe;
2130 if it fails, continue by respecting the shared source setting
2127 if it fails, continue by respecting the shared source setting
2131
2128
2132 Check :hg:`help config.format.use-share-safe` for details about the
2129 Check :hg:`help config.format.use-share-safe` for details about the
2133 share-safe feature.
2130 share-safe feature.
2134
2131
2135 ``safe-mismatch.source-not-safe.warn``
2132 ``safe-mismatch.source-not-safe.warn``
2136 Shows a warning on operations if the shared repository uses share-safe,
2133 Shows a warning on operations if the shared repository uses share-safe,
2137 but the source repository does not.
2134 but the source repository does not.
2138 (default: True)
2135 (default: True)
2139
2136
2140 ``storage``
2137 ``storage``
2141 -----------
2138 -----------
2142
2139
2143 Control the strategy Mercurial uses internally to store history. Options in this
2140 Control the strategy Mercurial uses internally to store history. Options in this
2144 category impact performance and repository size.
2141 category impact performance and repository size.
2145
2142
2146 ``revlog.issue6528.fix-incoming``
2143 ``revlog.issue6528.fix-incoming``
2147 Version 5.8 of Mercurial had a bug leading to altering the parent of file
2144 Version 5.8 of Mercurial had a bug leading to altering the parent of file
2148 revision with copy information (or any other metadata) on exchange. This
2145 revision with copy information (or any other metadata) on exchange. This
2149 leads to the copy metadata to be overlooked by various internal logic. The
2146 leads to the copy metadata to be overlooked by various internal logic. The
2150 issue was fixed in Mercurial 5.8.1.
2147 issue was fixed in Mercurial 5.8.1.
2151 (See https://bz.mercurial-scm.org/show_bug.cgi?id=6528 for details)
2148 (See https://bz.mercurial-scm.org/show_bug.cgi?id=6528 for details)
2152
2149
2153 As a result Mercurial is now checking and fixing incoming file revisions to
2150 As a result Mercurial is now checking and fixing incoming file revisions to
2154 make sure there parents are in the right order. This behavior can be
2151 make sure there parents are in the right order. This behavior can be
2155 disabled by setting this option to `no`. This apply to revisions added
2152 disabled by setting this option to `no`. This apply to revisions added
2156 through push, pull, clone and unbundle.
2153 through push, pull, clone and unbundle.
2157
2154
2158 To fix affected revisions that already exist within the repository, one can
2155 To fix affected revisions that already exist within the repository, one can
2159 use :hg:`debug-repair-issue-6528`.
2156 use :hg:`debug-repair-issue-6528`.
2160
2157
2161 ``revlog.optimize-delta-parent-choice``
2158 ``revlog.optimize-delta-parent-choice``
2162 When storing a merge revision, both parents will be equally considered as
2159 When storing a merge revision, both parents will be equally considered as
2163 a possible delta base. This results in better delta selection and improved
2160 a possible delta base. This results in better delta selection and improved
2164 revlog compression. This option is enabled by default.
2161 revlog compression. This option is enabled by default.
2165
2162
2166 Turning this option off can result in large increase of repository size for
2163 Turning this option off can result in large increase of repository size for
2167 repository with many merges.
2164 repository with many merges.
2168
2165
2169 ``revlog.persistent-nodemap.mmap``
2166 ``revlog.persistent-nodemap.mmap``
2170 Whether to use the Operating System "memory mapping" feature (when
2167 Whether to use the Operating System "memory mapping" feature (when
2171 possible) to access the persistent nodemap data. This improve performance
2168 possible) to access the persistent nodemap data. This improve performance
2172 and reduce memory pressure.
2169 and reduce memory pressure.
2173
2170
2174 Default to True.
2171 Default to True.
2175
2172
2176 For details on the "persistent-nodemap" feature, see:
2173 For details on the "persistent-nodemap" feature, see:
2177 :hg:`help config.format.use-persistent-nodemap`.
2174 :hg:`help config.format.use-persistent-nodemap`.
2178
2175
2179 ``revlog.persistent-nodemap.slow-path``
2176 ``revlog.persistent-nodemap.slow-path``
2180 Control the behavior of Merucrial when using a repository with "persistent"
2177 Control the behavior of Merucrial when using a repository with "persistent"
2181 nodemap with an installation of Mercurial without a fast implementation for
2178 nodemap with an installation of Mercurial without a fast implementation for
2182 the feature:
2179 the feature:
2183
2180
2184 ``allow``: Silently use the slower implementation to access the repository.
2181 ``allow``: Silently use the slower implementation to access the repository.
2185 ``warn``: Warn, but use the slower implementation to access the repository.
2182 ``warn``: Warn, but use the slower implementation to access the repository.
2186 ``abort``: Prevent access to such repositories. (This is the default)
2183 ``abort``: Prevent access to such repositories. (This is the default)
2187
2184
2188 For details on the "persistent-nodemap" feature, see:
2185 For details on the "persistent-nodemap" feature, see:
2189 :hg:`help config.format.use-persistent-nodemap`.
2186 :hg:`help config.format.use-persistent-nodemap`.
2190
2187
2191 ``revlog.reuse-external-delta-parent``
2188 ``revlog.reuse-external-delta-parent``
2192 Control the order in which delta parents are considered when adding new
2189 Control the order in which delta parents are considered when adding new
2193 revisions from an external source.
2190 revisions from an external source.
2194 (typically: apply bundle from `hg pull` or `hg push`).
2191 (typically: apply bundle from `hg pull` or `hg push`).
2195
2192
2196 New revisions are usually provided as a delta against other revisions. By
2193 New revisions are usually provided as a delta against other revisions. By
2197 default, Mercurial will try to reuse this delta first, therefore using the
2194 default, Mercurial will try to reuse this delta first, therefore using the
2198 same "delta parent" as the source. Directly using delta's from the source
2195 same "delta parent" as the source. Directly using delta's from the source
2199 reduces CPU usage and usually speeds up operation. However, in some case,
2196 reduces CPU usage and usually speeds up operation. However, in some case,
2200 the source might have sub-optimal delta bases and forcing their reevaluation
2197 the source might have sub-optimal delta bases and forcing their reevaluation
2201 is useful. For example, pushes from an old client could have sub-optimal
2198 is useful. For example, pushes from an old client could have sub-optimal
2202 delta's parent that the server want to optimize. (lack of general delta, bad
2199 delta's parent that the server want to optimize. (lack of general delta, bad
2203 parents, choice, lack of sparse-revlog, etc).
2200 parents, choice, lack of sparse-revlog, etc).
2204
2201
2205 This option is enabled by default. Turning it off will ensure bad delta
2202 This option is enabled by default. Turning it off will ensure bad delta
2206 parent choices from older client do not propagate to this repository, at
2203 parent choices from older client do not propagate to this repository, at
2207 the cost of a small increase in CPU consumption.
2204 the cost of a small increase in CPU consumption.
2208
2205
2209 Note: this option only control the order in which delta parents are
2206 Note: this option only control the order in which delta parents are
2210 considered. Even when disabled, the existing delta from the source will be
2207 considered. Even when disabled, the existing delta from the source will be
2211 reused if the same delta parent is selected.
2208 reused if the same delta parent is selected.
2212
2209
2213 ``revlog.reuse-external-delta``
2210 ``revlog.reuse-external-delta``
2214 Control the reuse of delta from external source.
2211 Control the reuse of delta from external source.
2215 (typically: apply bundle from `hg pull` or `hg push`).
2212 (typically: apply bundle from `hg pull` or `hg push`).
2216
2213
2217 New revisions are usually provided as a delta against another revision. By
2214 New revisions are usually provided as a delta against another revision. By
2218 default, Mercurial will not recompute the same delta again, trusting
2215 default, Mercurial will not recompute the same delta again, trusting
2219 externally provided deltas. There have been rare cases of small adjustment
2216 externally provided deltas. There have been rare cases of small adjustment
2220 to the diffing algorithm in the past. So in some rare case, recomputing
2217 to the diffing algorithm in the past. So in some rare case, recomputing
2221 delta provided by ancient clients can provides better results. Disabling
2218 delta provided by ancient clients can provides better results. Disabling
2222 this option means going through a full delta recomputation for all incoming
2219 this option means going through a full delta recomputation for all incoming
2223 revisions. It means a large increase in CPU usage and will slow operations
2220 revisions. It means a large increase in CPU usage and will slow operations
2224 down.
2221 down.
2225
2222
2226 This option is enabled by default. When disabled, it also disables the
2223 This option is enabled by default. When disabled, it also disables the
2227 related ``storage.revlog.reuse-external-delta-parent`` option.
2224 related ``storage.revlog.reuse-external-delta-parent`` option.
2228
2225
2229 ``revlog.zlib.level``
2226 ``revlog.zlib.level``
2230 Zlib compression level used when storing data into the repository. Accepted
2227 Zlib compression level used when storing data into the repository. Accepted
2231 Value range from 1 (lowest compression) to 9 (highest compression). Zlib
2228 Value range from 1 (lowest compression) to 9 (highest compression). Zlib
2232 default value is 6.
2229 default value is 6.
2233
2230
2234
2231
2235 ``revlog.zstd.level``
2232 ``revlog.zstd.level``
2236 zstd compression level used when storing data into the repository. Accepted
2233 zstd compression level used when storing data into the repository. Accepted
2237 Value range from 1 (lowest compression) to 22 (highest compression).
2234 Value range from 1 (lowest compression) to 22 (highest compression).
2238 (default 3)
2235 (default 3)
2239
2236
2240 ``server``
2237 ``server``
2241 ----------
2238 ----------
2242
2239
2243 Controls generic server settings.
2240 Controls generic server settings.
2244
2241
2245 ``bookmarks-pushkey-compat``
2242 ``bookmarks-pushkey-compat``
2246 Trigger pushkey hook when being pushed bookmark updates. This config exist
2243 Trigger pushkey hook when being pushed bookmark updates. This config exist
2247 for compatibility purpose (default to True)
2244 for compatibility purpose (default to True)
2248
2245
2249 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
2246 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
2250 movement we recommend you migrate them to ``txnclose-bookmark`` and
2247 movement we recommend you migrate them to ``txnclose-bookmark`` and
2251 ``pretxnclose-bookmark``.
2248 ``pretxnclose-bookmark``.
2252
2249
2253 ``compressionengines``
2250 ``compressionengines``
2254 List of compression engines and their relative priority to advertise
2251 List of compression engines and their relative priority to advertise
2255 to clients.
2252 to clients.
2256
2253
2257 The order of compression engines determines their priority, the first
2254 The order of compression engines determines their priority, the first
2258 having the highest priority. If a compression engine is not listed
2255 having the highest priority. If a compression engine is not listed
2259 here, it won't be advertised to clients.
2256 here, it won't be advertised to clients.
2260
2257
2261 If not set (the default), built-in defaults are used. Run
2258 If not set (the default), built-in defaults are used. Run
2262 :hg:`debuginstall` to list available compression engines and their
2259 :hg:`debuginstall` to list available compression engines and their
2263 default wire protocol priority.
2260 default wire protocol priority.
2264
2261
2265 Older Mercurial clients only support zlib compression and this setting
2262 Older Mercurial clients only support zlib compression and this setting
2266 has no effect for legacy clients.
2263 has no effect for legacy clients.
2267
2264
2268 ``uncompressed``
2265 ``uncompressed``
2269 Whether to allow clients to clone a repository using the
2266 Whether to allow clients to clone a repository using the
2270 uncompressed streaming protocol. This transfers about 40% more
2267 uncompressed streaming protocol. This transfers about 40% more
2271 data than a regular clone, but uses less memory and CPU on both
2268 data than a regular clone, but uses less memory and CPU on both
2272 server and client. Over a LAN (100 Mbps or better) or a very fast
2269 server and client. Over a LAN (100 Mbps or better) or a very fast
2273 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
2270 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
2274 regular clone. Over most WAN connections (anything slower than
2271 regular clone. Over most WAN connections (anything slower than
2275 about 6 Mbps), uncompressed streaming is slower, because of the
2272 about 6 Mbps), uncompressed streaming is slower, because of the
2276 extra data transfer overhead. This mode will also temporarily hold
2273 extra data transfer overhead. This mode will also temporarily hold
2277 the write lock while determining what data to transfer.
2274 the write lock while determining what data to transfer.
2278 (default: True)
2275 (default: True)
2279
2276
2280 ``uncompressedallowsecret``
2277 ``uncompressedallowsecret``
2281 Whether to allow stream clones when the repository contains secret
2278 Whether to allow stream clones when the repository contains secret
2282 changesets. (default: False)
2279 changesets. (default: False)
2283
2280
2284 ``preferuncompressed``
2281 ``preferuncompressed``
2285 When set, clients will try to use the uncompressed streaming
2282 When set, clients will try to use the uncompressed streaming
2286 protocol. (default: False)
2283 protocol. (default: False)
2287
2284
2288 ``disablefullbundle``
2285 ``disablefullbundle``
2289 When set, servers will refuse attempts to do pull-based clones.
2286 When set, servers will refuse attempts to do pull-based clones.
2290 If this option is set, ``preferuncompressed`` and/or clone bundles
2287 If this option is set, ``preferuncompressed`` and/or clone bundles
2291 are highly recommended. Partial clones will still be allowed.
2288 are highly recommended. Partial clones will still be allowed.
2292 (default: False)
2289 (default: False)
2293
2290
2294 ``streamunbundle``
2291 ``streamunbundle``
2295 When set, servers will apply data sent from the client directly,
2292 When set, servers will apply data sent from the client directly,
2296 otherwise it will be written to a temporary file first. This option
2293 otherwise it will be written to a temporary file first. This option
2297 effectively prevents concurrent pushes.
2294 effectively prevents concurrent pushes.
2298
2295
2299 ``pullbundle``
2296 ``pullbundle``
2300 When set, the server will check pullbundle.manifest for bundles
2297 When set, the server will check pullbundle.manifest for bundles
2301 covering the requested heads and common nodes. The first matching
2298 covering the requested heads and common nodes. The first matching
2302 entry will be streamed to the client.
2299 entry will be streamed to the client.
2303
2300
2304 For HTTP transport, the stream will still use zlib compression
2301 For HTTP transport, the stream will still use zlib compression
2305 for older clients.
2302 for older clients.
2306
2303
2307 ``concurrent-push-mode``
2304 ``concurrent-push-mode``
2308 Level of allowed race condition between two pushing clients.
2305 Level of allowed race condition between two pushing clients.
2309
2306
2310 - 'strict': push is abort if another client touched the repository
2307 - 'strict': push is abort if another client touched the repository
2311 while the push was preparing.
2308 while the push was preparing.
2312 - 'check-related': push is only aborted if it affects head that got also
2309 - 'check-related': push is only aborted if it affects head that got also
2313 affected while the push was preparing. (default since 5.4)
2310 affected while the push was preparing. (default since 5.4)
2314
2311
2315 'check-related' only takes effect for compatible clients (version
2312 'check-related' only takes effect for compatible clients (version
2316 4.3 and later). Older clients will use 'strict'.
2313 4.3 and later). Older clients will use 'strict'.
2317
2314
2318 ``validate``
2315 ``validate``
2319 Whether to validate the completeness of pushed changesets by
2316 Whether to validate the completeness of pushed changesets by
2320 checking that all new file revisions specified in manifests are
2317 checking that all new file revisions specified in manifests are
2321 present. (default: False)
2318 present. (default: False)
2322
2319
2323 ``maxhttpheaderlen``
2320 ``maxhttpheaderlen``
2324 Instruct HTTP clients not to send request headers longer than this
2321 Instruct HTTP clients not to send request headers longer than this
2325 many bytes. (default: 1024)
2322 many bytes. (default: 1024)
2326
2323
2327 ``bundle1``
2324 ``bundle1``
2328 Whether to allow clients to push and pull using the legacy bundle1
2325 Whether to allow clients to push and pull using the legacy bundle1
2329 exchange format. (default: True)
2326 exchange format. (default: True)
2330
2327
2331 ``bundle1gd``
2328 ``bundle1gd``
2332 Like ``bundle1`` but only used if the repository is using the
2329 Like ``bundle1`` but only used if the repository is using the
2333 *generaldelta* storage format. (default: True)
2330 *generaldelta* storage format. (default: True)
2334
2331
2335 ``bundle1.push``
2332 ``bundle1.push``
2336 Whether to allow clients to push using the legacy bundle1 exchange
2333 Whether to allow clients to push using the legacy bundle1 exchange
2337 format. (default: True)
2334 format. (default: True)
2338
2335
2339 ``bundle1gd.push``
2336 ``bundle1gd.push``
2340 Like ``bundle1.push`` but only used if the repository is using the
2337 Like ``bundle1.push`` but only used if the repository is using the
2341 *generaldelta* storage format. (default: True)
2338 *generaldelta* storage format. (default: True)
2342
2339
2343 ``bundle1.pull``
2340 ``bundle1.pull``
2344 Whether to allow clients to pull using the legacy bundle1 exchange
2341 Whether to allow clients to pull using the legacy bundle1 exchange
2345 format. (default: True)
2342 format. (default: True)
2346
2343
2347 ``bundle1gd.pull``
2344 ``bundle1gd.pull``
2348 Like ``bundle1.pull`` but only used if the repository is using the
2345 Like ``bundle1.pull`` but only used if the repository is using the
2349 *generaldelta* storage format. (default: True)
2346 *generaldelta* storage format. (default: True)
2350
2347
2351 Large repositories using the *generaldelta* storage format should
2348 Large repositories using the *generaldelta* storage format should
2352 consider setting this option because converting *generaldelta*
2349 consider setting this option because converting *generaldelta*
2353 repositories to the exchange format required by the bundle1 data
2350 repositories to the exchange format required by the bundle1 data
2354 format can consume a lot of CPU.
2351 format can consume a lot of CPU.
2355
2352
2356 ``bundle2.stream``
2353 ``bundle2.stream``
2357 Whether to allow clients to pull using the bundle2 streaming protocol.
2354 Whether to allow clients to pull using the bundle2 streaming protocol.
2358 (default: True)
2355 (default: True)
2359
2356
2360 ``zliblevel``
2357 ``zliblevel``
2361 Integer between ``-1`` and ``9`` that controls the zlib compression level
2358 Integer between ``-1`` and ``9`` that controls the zlib compression level
2362 for wire protocol commands that send zlib compressed output (notably the
2359 for wire protocol commands that send zlib compressed output (notably the
2363 commands that send repository history data).
2360 commands that send repository history data).
2364
2361
2365 The default (``-1``) uses the default zlib compression level, which is
2362 The default (``-1``) uses the default zlib compression level, which is
2366 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
2363 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
2367 maximum compression.
2364 maximum compression.
2368
2365
2369 Setting this option allows server operators to make trade-offs between
2366 Setting this option allows server operators to make trade-offs between
2370 bandwidth and CPU used. Lowering the compression lowers CPU utilization
2367 bandwidth and CPU used. Lowering the compression lowers CPU utilization
2371 but sends more bytes to clients.
2368 but sends more bytes to clients.
2372
2369
2373 This option only impacts the HTTP server.
2370 This option only impacts the HTTP server.
2374
2371
2375 ``zstdlevel``
2372 ``zstdlevel``
2376 Integer between ``1`` and ``22`` that controls the zstd compression level
2373 Integer between ``1`` and ``22`` that controls the zstd compression level
2377 for wire protocol commands. ``1`` is the minimal amount of compression and
2374 for wire protocol commands. ``1`` is the minimal amount of compression and
2378 ``22`` is the highest amount of compression.
2375 ``22`` is the highest amount of compression.
2379
2376
2380 The default (``3``) should be significantly faster than zlib while likely
2377 The default (``3``) should be significantly faster than zlib while likely
2381 delivering better compression ratios.
2378 delivering better compression ratios.
2382
2379
2383 This option only impacts the HTTP server.
2380 This option only impacts the HTTP server.
2384
2381
2385 See also ``server.zliblevel``.
2382 See also ``server.zliblevel``.
2386
2383
2387 ``view``
2384 ``view``
2388 Repository filter used when exchanging revisions with the peer.
2385 Repository filter used when exchanging revisions with the peer.
2389
2386
2390 The default view (``served``) excludes secret and hidden changesets.
2387 The default view (``served``) excludes secret and hidden changesets.
2391 Another useful value is ``immutable`` (no draft, secret or hidden
2388 Another useful value is ``immutable`` (no draft, secret or hidden
2392 changesets). (EXPERIMENTAL)
2389 changesets). (EXPERIMENTAL)
2393
2390
2394 ``smtp``
2391 ``smtp``
2395 --------
2392 --------
2396
2393
2397 Configuration for extensions that need to send email messages.
2394 Configuration for extensions that need to send email messages.
2398
2395
2399 ``host``
2396 ``host``
2400 Host name of mail server, e.g. "mail.example.com".
2397 Host name of mail server, e.g. "mail.example.com".
2401
2398
2402 ``port``
2399 ``port``
2403 Optional. Port to connect to on mail server. (default: 465 if
2400 Optional. Port to connect to on mail server. (default: 465 if
2404 ``tls`` is smtps; 25 otherwise)
2401 ``tls`` is smtps; 25 otherwise)
2405
2402
2406 ``tls``
2403 ``tls``
2407 Optional. Method to enable TLS when connecting to mail server: starttls,
2404 Optional. Method to enable TLS when connecting to mail server: starttls,
2408 smtps or none. (default: none)
2405 smtps or none. (default: none)
2409
2406
2410 ``username``
2407 ``username``
2411 Optional. User name for authenticating with the SMTP server.
2408 Optional. User name for authenticating with the SMTP server.
2412 (default: None)
2409 (default: None)
2413
2410
2414 ``password``
2411 ``password``
2415 Optional. Password for authenticating with the SMTP server. If not
2412 Optional. Password for authenticating with the SMTP server. If not
2416 specified, interactive sessions will prompt the user for a
2413 specified, interactive sessions will prompt the user for a
2417 password; non-interactive sessions will fail. (default: None)
2414 password; non-interactive sessions will fail. (default: None)
2418
2415
2419 ``local_hostname``
2416 ``local_hostname``
2420 Optional. The hostname that the sender can use to identify
2417 Optional. The hostname that the sender can use to identify
2421 itself to the MTA.
2418 itself to the MTA.
2422
2419
2423
2420
2424 ``subpaths``
2421 ``subpaths``
2425 ------------
2422 ------------
2426
2423
2427 Subrepository source URLs can go stale if a remote server changes name
2424 Subrepository source URLs can go stale if a remote server changes name
2428 or becomes temporarily unavailable. This section lets you define
2425 or becomes temporarily unavailable. This section lets you define
2429 rewrite rules of the form::
2426 rewrite rules of the form::
2430
2427
2431 <pattern> = <replacement>
2428 <pattern> = <replacement>
2432
2429
2433 where ``pattern`` is a regular expression matching a subrepository
2430 where ``pattern`` is a regular expression matching a subrepository
2434 source URL and ``replacement`` is the replacement string used to
2431 source URL and ``replacement`` is the replacement string used to
2435 rewrite it. Groups can be matched in ``pattern`` and referenced in
2432 rewrite it. Groups can be matched in ``pattern`` and referenced in
2436 ``replacements``. For instance::
2433 ``replacements``. For instance::
2437
2434
2438 http://server/(.*)-hg/ = http://hg.server/\1/
2435 http://server/(.*)-hg/ = http://hg.server/\1/
2439
2436
2440 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
2437 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
2441
2438
2442 Relative subrepository paths are first made absolute, and the
2439 Relative subrepository paths are first made absolute, and the
2443 rewrite rules are then applied on the full (absolute) path. If ``pattern``
2440 rewrite rules are then applied on the full (absolute) path. If ``pattern``
2444 doesn't match the full path, an attempt is made to apply it on the
2441 doesn't match the full path, an attempt is made to apply it on the
2445 relative path alone. The rules are applied in definition order.
2442 relative path alone. The rules are applied in definition order.
2446
2443
2447 ``subrepos``
2444 ``subrepos``
2448 ------------
2445 ------------
2449
2446
2450 This section contains options that control the behavior of the
2447 This section contains options that control the behavior of the
2451 subrepositories feature. See also :hg:`help subrepos`.
2448 subrepositories feature. See also :hg:`help subrepos`.
2452
2449
2453 Security note: auditing in Mercurial is known to be insufficient to
2450 Security note: auditing in Mercurial is known to be insufficient to
2454 prevent clone-time code execution with carefully constructed Git
2451 prevent clone-time code execution with carefully constructed Git
2455 subrepos. It is unknown if a similar detect is present in Subversion
2452 subrepos. It is unknown if a similar detect is present in Subversion
2456 subrepos. Both Git and Subversion subrepos are disabled by default
2453 subrepos. Both Git and Subversion subrepos are disabled by default
2457 out of security concerns. These subrepo types can be enabled using
2454 out of security concerns. These subrepo types can be enabled using
2458 the respective options below.
2455 the respective options below.
2459
2456
2460 ``allowed``
2457 ``allowed``
2461 Whether subrepositories are allowed in the working directory.
2458 Whether subrepositories are allowed in the working directory.
2462
2459
2463 When false, commands involving subrepositories (like :hg:`update`)
2460 When false, commands involving subrepositories (like :hg:`update`)
2464 will fail for all subrepository types.
2461 will fail for all subrepository types.
2465 (default: true)
2462 (default: true)
2466
2463
2467 ``hg:allowed``
2464 ``hg:allowed``
2468 Whether Mercurial subrepositories are allowed in the working
2465 Whether Mercurial subrepositories are allowed in the working
2469 directory. This option only has an effect if ``subrepos.allowed``
2466 directory. This option only has an effect if ``subrepos.allowed``
2470 is true.
2467 is true.
2471 (default: true)
2468 (default: true)
2472
2469
2473 ``git:allowed``
2470 ``git:allowed``
2474 Whether Git subrepositories are allowed in the working directory.
2471 Whether Git subrepositories are allowed in the working directory.
2475 This option only has an effect if ``subrepos.allowed`` is true.
2472 This option only has an effect if ``subrepos.allowed`` is true.
2476
2473
2477 See the security note above before enabling Git subrepos.
2474 See the security note above before enabling Git subrepos.
2478 (default: false)
2475 (default: false)
2479
2476
2480 ``svn:allowed``
2477 ``svn:allowed``
2481 Whether Subversion subrepositories are allowed in the working
2478 Whether Subversion subrepositories are allowed in the working
2482 directory. This option only has an effect if ``subrepos.allowed``
2479 directory. This option only has an effect if ``subrepos.allowed``
2483 is true.
2480 is true.
2484
2481
2485 See the security note above before enabling Subversion subrepos.
2482 See the security note above before enabling Subversion subrepos.
2486 (default: false)
2483 (default: false)
2487
2484
2488 ``templatealias``
2485 ``templatealias``
2489 -----------------
2486 -----------------
2490
2487
2491 Alias definitions for templates. See :hg:`help templates` for details.
2488 Alias definitions for templates. See :hg:`help templates` for details.
2492
2489
2493 ``templates``
2490 ``templates``
2494 -------------
2491 -------------
2495
2492
2496 Use the ``[templates]`` section to define template strings.
2493 Use the ``[templates]`` section to define template strings.
2497 See :hg:`help templates` for details.
2494 See :hg:`help templates` for details.
2498
2495
2499 ``trusted``
2496 ``trusted``
2500 -----------
2497 -----------
2501
2498
2502 Mercurial will not use the settings in the
2499 Mercurial will not use the settings in the
2503 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2500 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2504 user or to a trusted group, as various hgrc features allow arbitrary
2501 user or to a trusted group, as various hgrc features allow arbitrary
2505 commands to be run. This issue is often encountered when configuring
2502 commands to be run. This issue is often encountered when configuring
2506 hooks or extensions for shared repositories or servers. However,
2503 hooks or extensions for shared repositories or servers. However,
2507 the web interface will use some safe settings from the ``[web]``
2504 the web interface will use some safe settings from the ``[web]``
2508 section.
2505 section.
2509
2506
2510 This section specifies what users and groups are trusted. The
2507 This section specifies what users and groups are trusted. The
2511 current user is always trusted. To trust everybody, list a user or a
2508 current user is always trusted. To trust everybody, list a user or a
2512 group with name ``*``. These settings must be placed in an
2509 group with name ``*``. These settings must be placed in an
2513 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2510 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2514 user or service running Mercurial.
2511 user or service running Mercurial.
2515
2512
2516 ``users``
2513 ``users``
2517 Comma-separated list of trusted users.
2514 Comma-separated list of trusted users.
2518
2515
2519 ``groups``
2516 ``groups``
2520 Comma-separated list of trusted groups.
2517 Comma-separated list of trusted groups.
2521
2518
2522
2519
2523 ``ui``
2520 ``ui``
2524 ------
2521 ------
2525
2522
2526 User interface controls.
2523 User interface controls.
2527
2524
2528 ``archivemeta``
2525 ``archivemeta``
2529 Whether to include the .hg_archival.txt file containing meta data
2526 Whether to include the .hg_archival.txt file containing meta data
2530 (hashes for the repository base and for tip) in archives created
2527 (hashes for the repository base and for tip) in archives created
2531 by the :hg:`archive` command or downloaded via hgweb.
2528 by the :hg:`archive` command or downloaded via hgweb.
2532 (default: True)
2529 (default: True)
2533
2530
2534 ``askusername``
2531 ``askusername``
2535 Whether to prompt for a username when committing. If True, and
2532 Whether to prompt for a username when committing. If True, and
2536 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2533 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2537 be prompted to enter a username. If no username is entered, the
2534 be prompted to enter a username. If no username is entered, the
2538 default ``USER@HOST`` is used instead.
2535 default ``USER@HOST`` is used instead.
2539 (default: False)
2536 (default: False)
2540
2537
2541 ``clonebundles``
2538 ``clonebundles``
2542 Whether the "clone bundles" feature is enabled.
2539 Whether the "clone bundles" feature is enabled.
2543
2540
2544 When enabled, :hg:`clone` may download and apply a server-advertised
2541 When enabled, :hg:`clone` may download and apply a server-advertised
2545 bundle file from a URL instead of using the normal exchange mechanism.
2542 bundle file from a URL instead of using the normal exchange mechanism.
2546
2543
2547 This can likely result in faster and more reliable clones.
2544 This can likely result in faster and more reliable clones.
2548
2545
2549 (default: True)
2546 (default: True)
2550
2547
2551 ``clonebundlefallback``
2548 ``clonebundlefallback``
2552 Whether failure to apply an advertised "clone bundle" from a server
2549 Whether failure to apply an advertised "clone bundle" from a server
2553 should result in fallback to a regular clone.
2550 should result in fallback to a regular clone.
2554
2551
2555 This is disabled by default because servers advertising "clone
2552 This is disabled by default because servers advertising "clone
2556 bundles" often do so to reduce server load. If advertised bundles
2553 bundles" often do so to reduce server load. If advertised bundles
2557 start mass failing and clients automatically fall back to a regular
2554 start mass failing and clients automatically fall back to a regular
2558 clone, this would add significant and unexpected load to the server
2555 clone, this would add significant and unexpected load to the server
2559 since the server is expecting clone operations to be offloaded to
2556 since the server is expecting clone operations to be offloaded to
2560 pre-generated bundles. Failing fast (the default behavior) ensures
2557 pre-generated bundles. Failing fast (the default behavior) ensures
2561 clients don't overwhelm the server when "clone bundle" application
2558 clients don't overwhelm the server when "clone bundle" application
2562 fails.
2559 fails.
2563
2560
2564 (default: False)
2561 (default: False)
2565
2562
2566 ``clonebundleprefers``
2563 ``clonebundleprefers``
2567 Defines preferences for which "clone bundles" to use.
2564 Defines preferences for which "clone bundles" to use.
2568
2565
2569 Servers advertising "clone bundles" may advertise multiple available
2566 Servers advertising "clone bundles" may advertise multiple available
2570 bundles. Each bundle may have different attributes, such as the bundle
2567 bundles. Each bundle may have different attributes, such as the bundle
2571 type and compression format. This option is used to prefer a particular
2568 type and compression format. This option is used to prefer a particular
2572 bundle over another.
2569 bundle over another.
2573
2570
2574 The following keys are defined by Mercurial:
2571 The following keys are defined by Mercurial:
2575
2572
2576 BUNDLESPEC
2573 BUNDLESPEC
2577 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2574 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2578 e.g. ``gzip-v2`` or ``bzip2-v1``.
2575 e.g. ``gzip-v2`` or ``bzip2-v1``.
2579
2576
2580 COMPRESSION
2577 COMPRESSION
2581 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2578 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2582
2579
2583 Server operators may define custom keys.
2580 Server operators may define custom keys.
2584
2581
2585 Example values: ``COMPRESSION=bzip2``,
2582 Example values: ``COMPRESSION=bzip2``,
2586 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2583 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2587
2584
2588 By default, the first bundle advertised by the server is used.
2585 By default, the first bundle advertised by the server is used.
2589
2586
2590 ``color``
2587 ``color``
2591 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2588 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2592 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2589 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2593 seems possible. See :hg:`help color` for details.
2590 seems possible. See :hg:`help color` for details.
2594
2591
2595 ``commitsubrepos``
2592 ``commitsubrepos``
2596 Whether to commit modified subrepositories when committing the
2593 Whether to commit modified subrepositories when committing the
2597 parent repository. If False and one subrepository has uncommitted
2594 parent repository. If False and one subrepository has uncommitted
2598 changes, abort the commit.
2595 changes, abort the commit.
2599 (default: False)
2596 (default: False)
2600
2597
2601 ``debug``
2598 ``debug``
2602 Print debugging information. (default: False)
2599 Print debugging information. (default: False)
2603
2600
2604 ``editor``
2601 ``editor``
2605 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2602 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2606
2603
2607 ``fallbackencoding``
2604 ``fallbackencoding``
2608 Encoding to try if it's not possible to decode the changelog using
2605 Encoding to try if it's not possible to decode the changelog using
2609 UTF-8. (default: ISO-8859-1)
2606 UTF-8. (default: ISO-8859-1)
2610
2607
2611 ``graphnodetemplate``
2608 ``graphnodetemplate``
2612 (DEPRECATED) Use ``command-templates.graphnode`` instead.
2609 (DEPRECATED) Use ``command-templates.graphnode`` instead.
2613
2610
2614 ``ignore``
2611 ``ignore``
2615 A file to read per-user ignore patterns from. This file should be
2612 A file to read per-user ignore patterns from. This file should be
2616 in the same format as a repository-wide .hgignore file. Filenames
2613 in the same format as a repository-wide .hgignore file. Filenames
2617 are relative to the repository root. This option supports hook syntax,
2614 are relative to the repository root. This option supports hook syntax,
2618 so if you want to specify multiple ignore files, you can do so by
2615 so if you want to specify multiple ignore files, you can do so by
2619 setting something like ``ignore.other = ~/.hgignore2``. For details
2616 setting something like ``ignore.other = ~/.hgignore2``. For details
2620 of the ignore file format, see the ``hgignore(5)`` man page.
2617 of the ignore file format, see the ``hgignore(5)`` man page.
2621
2618
2622 ``interactive``
2619 ``interactive``
2623 Allow to prompt the user. (default: True)
2620 Allow to prompt the user. (default: True)
2624
2621
2625 ``interface``
2622 ``interface``
2626 Select the default interface for interactive features (default: text).
2623 Select the default interface for interactive features (default: text).
2627 Possible values are 'text' and 'curses'.
2624 Possible values are 'text' and 'curses'.
2628
2625
2629 ``interface.chunkselector``
2626 ``interface.chunkselector``
2630 Select the interface for change recording (e.g. :hg:`commit -i`).
2627 Select the interface for change recording (e.g. :hg:`commit -i`).
2631 Possible values are 'text' and 'curses'.
2628 Possible values are 'text' and 'curses'.
2632 This config overrides the interface specified by ui.interface.
2629 This config overrides the interface specified by ui.interface.
2633
2630
2634 ``large-file-limit``
2631 ``large-file-limit``
2635 Largest file size that gives no memory use warning.
2632 Largest file size that gives no memory use warning.
2636 Possible values are integers or 0 to disable the check.
2633 Possible values are integers or 0 to disable the check.
2637 (default: 10000000)
2634 (default: 10000000)
2638
2635
2639 ``logtemplate``
2636 ``logtemplate``
2640 (DEPRECATED) Use ``command-templates.log`` instead.
2637 (DEPRECATED) Use ``command-templates.log`` instead.
2641
2638
2642 ``merge``
2639 ``merge``
2643 The conflict resolution program to use during a manual merge.
2640 The conflict resolution program to use during a manual merge.
2644 For more information on merge tools see :hg:`help merge-tools`.
2641 For more information on merge tools see :hg:`help merge-tools`.
2645 For configuring merge tools see the ``[merge-tools]`` section.
2642 For configuring merge tools see the ``[merge-tools]`` section.
2646
2643
2647 ``mergemarkers``
2644 ``mergemarkers``
2648 Sets the merge conflict marker label styling. The ``detailed`` style
2645 Sets the merge conflict marker label styling. The ``detailed`` style
2649 uses the ``command-templates.mergemarker`` setting to style the labels.
2646 uses the ``command-templates.mergemarker`` setting to style the labels.
2650 The ``basic`` style just uses 'local' and 'other' as the marker label.
2647 The ``basic`` style just uses 'local' and 'other' as the marker label.
2651 One of ``basic`` or ``detailed``.
2648 One of ``basic`` or ``detailed``.
2652 (default: ``basic``)
2649 (default: ``basic``)
2653
2650
2654 ``mergemarkertemplate``
2651 ``mergemarkertemplate``
2655 (DEPRECATED) Use ``command-templates.mergemarker`` instead.
2652 (DEPRECATED) Use ``command-templates.mergemarker`` instead.
2656
2653
2657 ``message-output``
2654 ``message-output``
2658 Where to write status and error messages. (default: ``stdio``)
2655 Where to write status and error messages. (default: ``stdio``)
2659
2656
2660 ``channel``
2657 ``channel``
2661 Use separate channel for structured output. (Command-server only)
2658 Use separate channel for structured output. (Command-server only)
2662 ``stderr``
2659 ``stderr``
2663 Everything to stderr.
2660 Everything to stderr.
2664 ``stdio``
2661 ``stdio``
2665 Status to stdout, and error to stderr.
2662 Status to stdout, and error to stderr.
2666
2663
2667 ``origbackuppath``
2664 ``origbackuppath``
2668 The path to a directory used to store generated .orig files. If the path is
2665 The path to a directory used to store generated .orig files. If the path is
2669 not a directory, one will be created. If set, files stored in this
2666 not a directory, one will be created. If set, files stored in this
2670 directory have the same name as the original file and do not have a .orig
2667 directory have the same name as the original file and do not have a .orig
2671 suffix.
2668 suffix.
2672
2669
2673 ``paginate``
2670 ``paginate``
2674 Control the pagination of command output (default: True). See :hg:`help pager`
2671 Control the pagination of command output (default: True). See :hg:`help pager`
2675 for details.
2672 for details.
2676
2673
2677 ``patch``
2674 ``patch``
2678 An optional external tool that ``hg import`` and some extensions
2675 An optional external tool that ``hg import`` and some extensions
2679 will use for applying patches. By default Mercurial uses an
2676 will use for applying patches. By default Mercurial uses an
2680 internal patch utility. The external tool must work as the common
2677 internal patch utility. The external tool must work as the common
2681 Unix ``patch`` program. In particular, it must accept a ``-p``
2678 Unix ``patch`` program. In particular, it must accept a ``-p``
2682 argument to strip patch headers, a ``-d`` argument to specify the
2679 argument to strip patch headers, a ``-d`` argument to specify the
2683 current directory, a file name to patch, and a patch file to take
2680 current directory, a file name to patch, and a patch file to take
2684 from stdin.
2681 from stdin.
2685
2682
2686 It is possible to specify a patch tool together with extra
2683 It is possible to specify a patch tool together with extra
2687 arguments. For example, setting this option to ``patch --merge``
2684 arguments. For example, setting this option to ``patch --merge``
2688 will use the ``patch`` program with its 2-way merge option.
2685 will use the ``patch`` program with its 2-way merge option.
2689
2686
2690 ``portablefilenames``
2687 ``portablefilenames``
2691 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2688 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2692 (default: ``warn``)
2689 (default: ``warn``)
2693
2690
2694 ``warn``
2691 ``warn``
2695 Print a warning message on POSIX platforms, if a file with a non-portable
2692 Print a warning message on POSIX platforms, if a file with a non-portable
2696 filename is added (e.g. a file with a name that can't be created on
2693 filename is added (e.g. a file with a name that can't be created on
2697 Windows because it contains reserved parts like ``AUX``, reserved
2694 Windows because it contains reserved parts like ``AUX``, reserved
2698 characters like ``:``, or would cause a case collision with an existing
2695 characters like ``:``, or would cause a case collision with an existing
2699 file).
2696 file).
2700
2697
2701 ``ignore``
2698 ``ignore``
2702 Don't print a warning.
2699 Don't print a warning.
2703
2700
2704 ``abort``
2701 ``abort``
2705 The command is aborted.
2702 The command is aborted.
2706
2703
2707 ``true``
2704 ``true``
2708 Alias for ``warn``.
2705 Alias for ``warn``.
2709
2706
2710 ``false``
2707 ``false``
2711 Alias for ``ignore``.
2708 Alias for ``ignore``.
2712
2709
2713 .. container:: windows
2710 .. container:: windows
2714
2711
2715 On Windows, this configuration option is ignored and the command aborted.
2712 On Windows, this configuration option is ignored and the command aborted.
2716
2713
2717 ``pre-merge-tool-output-template``
2714 ``pre-merge-tool-output-template``
2718 (DEPRECATED) Use ``command-template.pre-merge-tool-output`` instead.
2715 (DEPRECATED) Use ``command-template.pre-merge-tool-output`` instead.
2719
2716
2720 ``quiet``
2717 ``quiet``
2721 Reduce the amount of output printed.
2718 Reduce the amount of output printed.
2722 (default: False)
2719 (default: False)
2723
2720
2724 ``relative-paths``
2721 ``relative-paths``
2725 Prefer relative paths in the UI.
2722 Prefer relative paths in the UI.
2726
2723
2727 ``remotecmd``
2724 ``remotecmd``
2728 Remote command to use for clone/push/pull operations.
2725 Remote command to use for clone/push/pull operations.
2729 (default: ``hg``)
2726 (default: ``hg``)
2730
2727
2731 ``report_untrusted``
2728 ``report_untrusted``
2732 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2729 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2733 trusted user or group.
2730 trusted user or group.
2734 (default: True)
2731 (default: True)
2735
2732
2736 ``slash``
2733 ``slash``
2737 (Deprecated. Use ``slashpath`` template filter instead.)
2734 (Deprecated. Use ``slashpath`` template filter instead.)
2738
2735
2739 Display paths using a slash (``/``) as the path separator. This
2736 Display paths using a slash (``/``) as the path separator. This
2740 only makes a difference on systems where the default path
2737 only makes a difference on systems where the default path
2741 separator is not the slash character (e.g. Windows uses the
2738 separator is not the slash character (e.g. Windows uses the
2742 backslash character (``\``)).
2739 backslash character (``\``)).
2743 (default: False)
2740 (default: False)
2744
2741
2745 ``statuscopies``
2742 ``statuscopies``
2746 Display copies in the status command.
2743 Display copies in the status command.
2747
2744
2748 ``ssh``
2745 ``ssh``
2749 Command to use for SSH connections. (default: ``ssh``)
2746 Command to use for SSH connections. (default: ``ssh``)
2750
2747
2751 ``ssherrorhint``
2748 ``ssherrorhint``
2752 A hint shown to the user in the case of SSH error (e.g.
2749 A hint shown to the user in the case of SSH error (e.g.
2753 ``Please see http://company/internalwiki/ssh.html``)
2750 ``Please see http://company/internalwiki/ssh.html``)
2754
2751
2755 ``strict``
2752 ``strict``
2756 Require exact command names, instead of allowing unambiguous
2753 Require exact command names, instead of allowing unambiguous
2757 abbreviations. (default: False)
2754 abbreviations. (default: False)
2758
2755
2759 ``style``
2756 ``style``
2760 Name of style to use for command output.
2757 Name of style to use for command output.
2761
2758
2762 ``supportcontact``
2759 ``supportcontact``
2763 A URL where users should report a Mercurial traceback. Use this if you are a
2760 A URL where users should report a Mercurial traceback. Use this if you are a
2764 large organisation with its own Mercurial deployment process and crash
2761 large organisation with its own Mercurial deployment process and crash
2765 reports should be addressed to your internal support.
2762 reports should be addressed to your internal support.
2766
2763
2767 ``textwidth``
2764 ``textwidth``
2768 Maximum width of help text. A longer line generated by ``hg help`` or
2765 Maximum width of help text. A longer line generated by ``hg help`` or
2769 ``hg subcommand --help`` will be broken after white space to get this
2766 ``hg subcommand --help`` will be broken after white space to get this
2770 width or the terminal width, whichever comes first.
2767 width or the terminal width, whichever comes first.
2771 A non-positive value will disable this and the terminal width will be
2768 A non-positive value will disable this and the terminal width will be
2772 used. (default: 78)
2769 used. (default: 78)
2773
2770
2774 ``timeout``
2771 ``timeout``
2775 The timeout used when a lock is held (in seconds), a negative value
2772 The timeout used when a lock is held (in seconds), a negative value
2776 means no timeout. (default: 600)
2773 means no timeout. (default: 600)
2777
2774
2778 ``timeout.warn``
2775 ``timeout.warn``
2779 Time (in seconds) before a warning is printed about held lock. A negative
2776 Time (in seconds) before a warning is printed about held lock. A negative
2780 value means no warning. (default: 0)
2777 value means no warning. (default: 0)
2781
2778
2782 ``traceback``
2779 ``traceback``
2783 Mercurial always prints a traceback when an unknown exception
2780 Mercurial always prints a traceback when an unknown exception
2784 occurs. Setting this to True will make Mercurial print a traceback
2781 occurs. Setting this to True will make Mercurial print a traceback
2785 on all exceptions, even those recognized by Mercurial (such as
2782 on all exceptions, even those recognized by Mercurial (such as
2786 IOError or MemoryError). (default: False)
2783 IOError or MemoryError). (default: False)
2787
2784
2788 ``tweakdefaults``
2785 ``tweakdefaults``
2789
2786
2790 By default Mercurial's behavior changes very little from release
2787 By default Mercurial's behavior changes very little from release
2791 to release, but over time the recommended config settings
2788 to release, but over time the recommended config settings
2792 shift. Enable this config to opt in to get automatic tweaks to
2789 shift. Enable this config to opt in to get automatic tweaks to
2793 Mercurial's behavior over time. This config setting will have no
2790 Mercurial's behavior over time. This config setting will have no
2794 effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
2791 effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
2795 not include ``tweakdefaults``. (default: False)
2792 not include ``tweakdefaults``. (default: False)
2796
2793
2797 It currently means::
2794 It currently means::
2798
2795
2799 .. tweakdefaultsmarker
2796 .. tweakdefaultsmarker
2800
2797
2801 ``username``
2798 ``username``
2802 The committer of a changeset created when running "commit".
2799 The committer of a changeset created when running "commit".
2803 Typically a person's name and email address, e.g. ``Fred Widget
2800 Typically a person's name and email address, e.g. ``Fred Widget
2804 <fred@example.com>``. Environment variables in the
2801 <fred@example.com>``. Environment variables in the
2805 username are expanded.
2802 username are expanded.
2806
2803
2807 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2804 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2808 hgrc is empty, e.g. if the system admin set ``username =`` in the
2805 hgrc is empty, e.g. if the system admin set ``username =`` in the
2809 system hgrc, it has to be specified manually or in a different
2806 system hgrc, it has to be specified manually or in a different
2810 hgrc file)
2807 hgrc file)
2811
2808
2812 ``verbose``
2809 ``verbose``
2813 Increase the amount of output printed. (default: False)
2810 Increase the amount of output printed. (default: False)
2814
2811
2815
2812
2816 ``command-templates``
2813 ``command-templates``
2817 ---------------------
2814 ---------------------
2818
2815
2819 Templates used for customizing the output of commands.
2816 Templates used for customizing the output of commands.
2820
2817
2821 ``graphnode``
2818 ``graphnode``
2822 The template used to print changeset nodes in an ASCII revision graph.
2819 The template used to print changeset nodes in an ASCII revision graph.
2823 (default: ``{graphnode}``)
2820 (default: ``{graphnode}``)
2824
2821
2825 ``log``
2822 ``log``
2826 Template string for commands that print changesets.
2823 Template string for commands that print changesets.
2827
2824
2828 ``mergemarker``
2825 ``mergemarker``
2829 The template used to print the commit description next to each conflict
2826 The template used to print the commit description next to each conflict
2830 marker during merge conflicts. See :hg:`help templates` for the template
2827 marker during merge conflicts. See :hg:`help templates` for the template
2831 format.
2828 format.
2832
2829
2833 Defaults to showing the hash, tags, branches, bookmarks, author, and
2830 Defaults to showing the hash, tags, branches, bookmarks, author, and
2834 the first line of the commit description.
2831 the first line of the commit description.
2835
2832
2836 If you use non-ASCII characters in names for tags, branches, bookmarks,
2833 If you use non-ASCII characters in names for tags, branches, bookmarks,
2837 authors, and/or commit descriptions, you must pay attention to encodings of
2834 authors, and/or commit descriptions, you must pay attention to encodings of
2838 managed files. At template expansion, non-ASCII characters use the encoding
2835 managed files. At template expansion, non-ASCII characters use the encoding
2839 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2836 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2840 environment variables that govern your locale. If the encoding of the merge
2837 environment variables that govern your locale. If the encoding of the merge
2841 markers is different from the encoding of the merged files,
2838 markers is different from the encoding of the merged files,
2842 serious problems may occur.
2839 serious problems may occur.
2843
2840
2844 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2841 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2845
2842
2846 ``oneline-summary``
2843 ``oneline-summary``
2847 A template used by `hg rebase` and other commands for showing a one-line
2844 A template used by `hg rebase` and other commands for showing a one-line
2848 summary of a commit. If the template configured here is longer than one
2845 summary of a commit. If the template configured here is longer than one
2849 line, then only the first line is used.
2846 line, then only the first line is used.
2850
2847
2851 The template can be overridden per command by defining a template in
2848 The template can be overridden per command by defining a template in
2852 `oneline-summary.<command>`, where `<command>` can be e.g. "rebase".
2849 `oneline-summary.<command>`, where `<command>` can be e.g. "rebase".
2853
2850
2854 ``pre-merge-tool-output``
2851 ``pre-merge-tool-output``
2855 A template that is printed before executing an external merge tool. This can
2852 A template that is printed before executing an external merge tool. This can
2856 be used to print out additional context that might be useful to have during
2853 be used to print out additional context that might be useful to have during
2857 the conflict resolution, such as the description of the various commits
2854 the conflict resolution, such as the description of the various commits
2858 involved or bookmarks/tags.
2855 involved or bookmarks/tags.
2859
2856
2860 Additional information is available in the ``local`, ``base``, and ``other``
2857 Additional information is available in the ``local`, ``base``, and ``other``
2861 dicts. For example: ``{local.label}``, ``{base.name}``, or
2858 dicts. For example: ``{local.label}``, ``{base.name}``, or
2862 ``{other.islink}``.
2859 ``{other.islink}``.
2863
2860
2864
2861
2865 ``web``
2862 ``web``
2866 -------
2863 -------
2867
2864
2868 Web interface configuration. The settings in this section apply to
2865 Web interface configuration. The settings in this section apply to
2869 both the builtin webserver (started by :hg:`serve`) and the script you
2866 both the builtin webserver (started by :hg:`serve`) and the script you
2870 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2867 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2871 and WSGI).
2868 and WSGI).
2872
2869
2873 The Mercurial webserver does no authentication (it does not prompt for
2870 The Mercurial webserver does no authentication (it does not prompt for
2874 usernames and passwords to validate *who* users are), but it does do
2871 usernames and passwords to validate *who* users are), but it does do
2875 authorization (it grants or denies access for *authenticated users*
2872 authorization (it grants or denies access for *authenticated users*
2876 based on settings in this section). You must either configure your
2873 based on settings in this section). You must either configure your
2877 webserver to do authentication for you, or disable the authorization
2874 webserver to do authentication for you, or disable the authorization
2878 checks.
2875 checks.
2879
2876
2880 For a quick setup in a trusted environment, e.g., a private LAN, where
2877 For a quick setup in a trusted environment, e.g., a private LAN, where
2881 you want it to accept pushes from anybody, you can use the following
2878 you want it to accept pushes from anybody, you can use the following
2882 command line::
2879 command line::
2883
2880
2884 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2881 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2885
2882
2886 Note that this will allow anybody to push anything to the server and
2883 Note that this will allow anybody to push anything to the server and
2887 that this should not be used for public servers.
2884 that this should not be used for public servers.
2888
2885
2889 The full set of options is:
2886 The full set of options is:
2890
2887
2891 ``accesslog``
2888 ``accesslog``
2892 Where to output the access log. (default: stdout)
2889 Where to output the access log. (default: stdout)
2893
2890
2894 ``address``
2891 ``address``
2895 Interface address to bind to. (default: all)
2892 Interface address to bind to. (default: all)
2896
2893
2897 ``allow-archive``
2894 ``allow-archive``
2898 List of archive format (bz2, gz, zip) allowed for downloading.
2895 List of archive format (bz2, gz, zip) allowed for downloading.
2899 (default: empty)
2896 (default: empty)
2900
2897
2901 ``allowbz2``
2898 ``allowbz2``
2902 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2899 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2903 revisions.
2900 revisions.
2904 (default: False)
2901 (default: False)
2905
2902
2906 ``allowgz``
2903 ``allowgz``
2907 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2904 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2908 revisions.
2905 revisions.
2909 (default: False)
2906 (default: False)
2910
2907
2911 ``allow-pull``
2908 ``allow-pull``
2912 Whether to allow pulling from the repository. (default: True)
2909 Whether to allow pulling from the repository. (default: True)
2913
2910
2914 ``allow-push``
2911 ``allow-push``
2915 Whether to allow pushing to the repository. If empty or not set,
2912 Whether to allow pushing to the repository. If empty or not set,
2916 pushing is not allowed. If the special value ``*``, any remote
2913 pushing is not allowed. If the special value ``*``, any remote
2917 user can push, including unauthenticated users. Otherwise, the
2914 user can push, including unauthenticated users. Otherwise, the
2918 remote user must have been authenticated, and the authenticated
2915 remote user must have been authenticated, and the authenticated
2919 user name must be present in this list. The contents of the
2916 user name must be present in this list. The contents of the
2920 allow-push list are examined after the deny_push list.
2917 allow-push list are examined after the deny_push list.
2921
2918
2922 ``allow_read``
2919 ``allow_read``
2923 If the user has not already been denied repository access due to
2920 If the user has not already been denied repository access due to
2924 the contents of deny_read, this list determines whether to grant
2921 the contents of deny_read, this list determines whether to grant
2925 repository access to the user. If this list is not empty, and the
2922 repository access to the user. If this list is not empty, and the
2926 user is unauthenticated or not present in the list, then access is
2923 user is unauthenticated or not present in the list, then access is
2927 denied for the user. If the list is empty or not set, then access
2924 denied for the user. If the list is empty or not set, then access
2928 is permitted to all users by default. Setting allow_read to the
2925 is permitted to all users by default. Setting allow_read to the
2929 special value ``*`` is equivalent to it not being set (i.e. access
2926 special value ``*`` is equivalent to it not being set (i.e. access
2930 is permitted to all users). The contents of the allow_read list are
2927 is permitted to all users). The contents of the allow_read list are
2931 examined after the deny_read list.
2928 examined after the deny_read list.
2932
2929
2933 ``allowzip``
2930 ``allowzip``
2934 (DEPRECATED) Whether to allow .zip downloading of repository
2931 (DEPRECATED) Whether to allow .zip downloading of repository
2935 revisions. This feature creates temporary files.
2932 revisions. This feature creates temporary files.
2936 (default: False)
2933 (default: False)
2937
2934
2938 ``archivesubrepos``
2935 ``archivesubrepos``
2939 Whether to recurse into subrepositories when archiving.
2936 Whether to recurse into subrepositories when archiving.
2940 (default: False)
2937 (default: False)
2941
2938
2942 ``baseurl``
2939 ``baseurl``
2943 Base URL to use when publishing URLs in other locations, so
2940 Base URL to use when publishing URLs in other locations, so
2944 third-party tools like email notification hooks can construct
2941 third-party tools like email notification hooks can construct
2945 URLs. Example: ``http://hgserver/repos/``.
2942 URLs. Example: ``http://hgserver/repos/``.
2946
2943
2947 ``cacerts``
2944 ``cacerts``
2948 Path to file containing a list of PEM encoded certificate
2945 Path to file containing a list of PEM encoded certificate
2949 authority certificates. Environment variables and ``~user``
2946 authority certificates. Environment variables and ``~user``
2950 constructs are expanded in the filename. If specified on the
2947 constructs are expanded in the filename. If specified on the
2951 client, then it will verify the identity of remote HTTPS servers
2948 client, then it will verify the identity of remote HTTPS servers
2952 with these certificates.
2949 with these certificates.
2953
2950
2954 To disable SSL verification temporarily, specify ``--insecure`` from
2951 To disable SSL verification temporarily, specify ``--insecure`` from
2955 command line.
2952 command line.
2956
2953
2957 You can use OpenSSL's CA certificate file if your platform has
2954 You can use OpenSSL's CA certificate file if your platform has
2958 one. On most Linux systems this will be
2955 one. On most Linux systems this will be
2959 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2956 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2960 generate this file manually. The form must be as follows::
2957 generate this file manually. The form must be as follows::
2961
2958
2962 -----BEGIN CERTIFICATE-----
2959 -----BEGIN CERTIFICATE-----
2963 ... (certificate in base64 PEM encoding) ...
2960 ... (certificate in base64 PEM encoding) ...
2964 -----END CERTIFICATE-----
2961 -----END CERTIFICATE-----
2965 -----BEGIN CERTIFICATE-----
2962 -----BEGIN CERTIFICATE-----
2966 ... (certificate in base64 PEM encoding) ...
2963 ... (certificate in base64 PEM encoding) ...
2967 -----END CERTIFICATE-----
2964 -----END CERTIFICATE-----
2968
2965
2969 ``cache``
2966 ``cache``
2970 Whether to support caching in hgweb. (default: True)
2967 Whether to support caching in hgweb. (default: True)
2971
2968
2972 ``certificate``
2969 ``certificate``
2973 Certificate to use when running :hg:`serve`.
2970 Certificate to use when running :hg:`serve`.
2974
2971
2975 ``collapse``
2972 ``collapse``
2976 With ``descend`` enabled, repositories in subdirectories are shown at
2973 With ``descend`` enabled, repositories in subdirectories are shown at
2977 a single level alongside repositories in the current path. With
2974 a single level alongside repositories in the current path. With
2978 ``collapse`` also enabled, repositories residing at a deeper level than
2975 ``collapse`` also enabled, repositories residing at a deeper level than
2979 the current path are grouped behind navigable directory entries that
2976 the current path are grouped behind navigable directory entries that
2980 lead to the locations of these repositories. In effect, this setting
2977 lead to the locations of these repositories. In effect, this setting
2981 collapses each collection of repositories found within a subdirectory
2978 collapses each collection of repositories found within a subdirectory
2982 into a single entry for that subdirectory. (default: False)
2979 into a single entry for that subdirectory. (default: False)
2983
2980
2984 ``comparisoncontext``
2981 ``comparisoncontext``
2985 Number of lines of context to show in side-by-side file comparison. If
2982 Number of lines of context to show in side-by-side file comparison. If
2986 negative or the value ``full``, whole files are shown. (default: 5)
2983 negative or the value ``full``, whole files are shown. (default: 5)
2987
2984
2988 This setting can be overridden by a ``context`` request parameter to the
2985 This setting can be overridden by a ``context`` request parameter to the
2989 ``comparison`` command, taking the same values.
2986 ``comparison`` command, taking the same values.
2990
2987
2991 ``contact``
2988 ``contact``
2992 Name or email address of the person in charge of the repository.
2989 Name or email address of the person in charge of the repository.
2993 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2990 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2994
2991
2995 ``csp``
2992 ``csp``
2996 Send a ``Content-Security-Policy`` HTTP header with this value.
2993 Send a ``Content-Security-Policy`` HTTP header with this value.
2997
2994
2998 The value may contain a special string ``%nonce%``, which will be replaced
2995 The value may contain a special string ``%nonce%``, which will be replaced
2999 by a randomly-generated one-time use value. If the value contains
2996 by a randomly-generated one-time use value. If the value contains
3000 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2997 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
3001 one-time property of the nonce. This nonce will also be inserted into
2998 one-time property of the nonce. This nonce will also be inserted into
3002 ``<script>`` elements containing inline JavaScript.
2999 ``<script>`` elements containing inline JavaScript.
3003
3000
3004 Note: lots of HTML content sent by the server is derived from repository
3001 Note: lots of HTML content sent by the server is derived from repository
3005 data. Please consider the potential for malicious repository data to
3002 data. Please consider the potential for malicious repository data to
3006 "inject" itself into generated HTML content as part of your security
3003 "inject" itself into generated HTML content as part of your security
3007 threat model.
3004 threat model.
3008
3005
3009 ``deny_push``
3006 ``deny_push``
3010 Whether to deny pushing to the repository. If empty or not set,
3007 Whether to deny pushing to the repository. If empty or not set,
3011 push is not denied. If the special value ``*``, all remote users are
3008 push is not denied. If the special value ``*``, all remote users are
3012 denied push. Otherwise, unauthenticated users are all denied, and
3009 denied push. Otherwise, unauthenticated users are all denied, and
3013 any authenticated user name present in this list is also denied. The
3010 any authenticated user name present in this list is also denied. The
3014 contents of the deny_push list are examined before the allow-push list.
3011 contents of the deny_push list are examined before the allow-push list.
3015
3012
3016 ``deny_read``
3013 ``deny_read``
3017 Whether to deny reading/viewing of the repository. If this list is
3014 Whether to deny reading/viewing of the repository. If this list is
3018 not empty, unauthenticated users are all denied, and any
3015 not empty, unauthenticated users are all denied, and any
3019 authenticated user name present in this list is also denied access to
3016 authenticated user name present in this list is also denied access to
3020 the repository. If set to the special value ``*``, all remote users
3017 the repository. If set to the special value ``*``, all remote users
3021 are denied access (rarely needed ;). If deny_read is empty or not set,
3018 are denied access (rarely needed ;). If deny_read is empty or not set,
3022 the determination of repository access depends on the presence and
3019 the determination of repository access depends on the presence and
3023 content of the allow_read list (see description). If both
3020 content of the allow_read list (see description). If both
3024 deny_read and allow_read are empty or not set, then access is
3021 deny_read and allow_read are empty or not set, then access is
3025 permitted to all users by default. If the repository is being
3022 permitted to all users by default. If the repository is being
3026 served via hgwebdir, denied users will not be able to see it in
3023 served via hgwebdir, denied users will not be able to see it in
3027 the list of repositories. The contents of the deny_read list have
3024 the list of repositories. The contents of the deny_read list have
3028 priority over (are examined before) the contents of the allow_read
3025 priority over (are examined before) the contents of the allow_read
3029 list.
3026 list.
3030
3027
3031 ``descend``
3028 ``descend``
3032 hgwebdir indexes will not descend into subdirectories. Only repositories
3029 hgwebdir indexes will not descend into subdirectories. Only repositories
3033 directly in the current path will be shown (other repositories are still
3030 directly in the current path will be shown (other repositories are still
3034 available from the index corresponding to their containing path).
3031 available from the index corresponding to their containing path).
3035
3032
3036 ``description``
3033 ``description``
3037 Textual description of the repository's purpose or contents.
3034 Textual description of the repository's purpose or contents.
3038 (default: "unknown")
3035 (default: "unknown")
3039
3036
3040 ``encoding``
3037 ``encoding``
3041 Character encoding name. (default: the current locale charset)
3038 Character encoding name. (default: the current locale charset)
3042 Example: "UTF-8".
3039 Example: "UTF-8".
3043
3040
3044 ``errorlog``
3041 ``errorlog``
3045 Where to output the error log. (default: stderr)
3042 Where to output the error log. (default: stderr)
3046
3043
3047 ``guessmime``
3044 ``guessmime``
3048 Control MIME types for raw download of file content.
3045 Control MIME types for raw download of file content.
3049 Set to True to let hgweb guess the content type from the file
3046 Set to True to let hgweb guess the content type from the file
3050 extension. This will serve HTML files as ``text/html`` and might
3047 extension. This will serve HTML files as ``text/html`` and might
3051 allow cross-site scripting attacks when serving untrusted
3048 allow cross-site scripting attacks when serving untrusted
3052 repositories. (default: False)
3049 repositories. (default: False)
3053
3050
3054 ``hidden``
3051 ``hidden``
3055 Whether to hide the repository in the hgwebdir index.
3052 Whether to hide the repository in the hgwebdir index.
3056 (default: False)
3053 (default: False)
3057
3054
3058 ``ipv6``
3055 ``ipv6``
3059 Whether to use IPv6. (default: False)
3056 Whether to use IPv6. (default: False)
3060
3057
3061 ``labels``
3058 ``labels``
3062 List of string *labels* associated with the repository.
3059 List of string *labels* associated with the repository.
3063
3060
3064 Labels are exposed as a template keyword and can be used to customize
3061 Labels are exposed as a template keyword and can be used to customize
3065 output. e.g. the ``index`` template can group or filter repositories
3062 output. e.g. the ``index`` template can group or filter repositories
3066 by labels and the ``summary`` template can display additional content
3063 by labels and the ``summary`` template can display additional content
3067 if a specific label is present.
3064 if a specific label is present.
3068
3065
3069 ``logoimg``
3066 ``logoimg``
3070 File name of the logo image that some templates display on each page.
3067 File name of the logo image that some templates display on each page.
3071 The file name is relative to ``staticurl``. That is, the full path to
3068 The file name is relative to ``staticurl``. That is, the full path to
3072 the logo image is "staticurl/logoimg".
3069 the logo image is "staticurl/logoimg".
3073 If unset, ``hglogo.png`` will be used.
3070 If unset, ``hglogo.png`` will be used.
3074
3071
3075 ``logourl``
3072 ``logourl``
3076 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
3073 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
3077 will be used.
3074 will be used.
3078
3075
3079 ``maxchanges``
3076 ``maxchanges``
3080 Maximum number of changes to list on the changelog. (default: 10)
3077 Maximum number of changes to list on the changelog. (default: 10)
3081
3078
3082 ``maxfiles``
3079 ``maxfiles``
3083 Maximum number of files to list per changeset. (default: 10)
3080 Maximum number of files to list per changeset. (default: 10)
3084
3081
3085 ``maxshortchanges``
3082 ``maxshortchanges``
3086 Maximum number of changes to list on the shortlog, graph or filelog
3083 Maximum number of changes to list on the shortlog, graph or filelog
3087 pages. (default: 60)
3084 pages. (default: 60)
3088
3085
3089 ``name``
3086 ``name``
3090 Repository name to use in the web interface.
3087 Repository name to use in the web interface.
3091 (default: current working directory)
3088 (default: current working directory)
3092
3089
3093 ``port``
3090 ``port``
3094 Port to listen on. (default: 8000)
3091 Port to listen on. (default: 8000)
3095
3092
3096 ``prefix``
3093 ``prefix``
3097 Prefix path to serve from. (default: '' (server root))
3094 Prefix path to serve from. (default: '' (server root))
3098
3095
3099 ``push_ssl``
3096 ``push_ssl``
3100 Whether to require that inbound pushes be transported over SSL to
3097 Whether to require that inbound pushes be transported over SSL to
3101 prevent password sniffing. (default: True)
3098 prevent password sniffing. (default: True)
3102
3099
3103 ``refreshinterval``
3100 ``refreshinterval``
3104 How frequently directory listings re-scan the filesystem for new
3101 How frequently directory listings re-scan the filesystem for new
3105 repositories, in seconds. This is relevant when wildcards are used
3102 repositories, in seconds. This is relevant when wildcards are used
3106 to define paths. Depending on how much filesystem traversal is
3103 to define paths. Depending on how much filesystem traversal is
3107 required, refreshing may negatively impact performance.
3104 required, refreshing may negatively impact performance.
3108
3105
3109 Values less than or equal to 0 always refresh.
3106 Values less than or equal to 0 always refresh.
3110 (default: 20)
3107 (default: 20)
3111
3108
3112 ``server-header``
3109 ``server-header``
3113 Value for HTTP ``Server`` response header.
3110 Value for HTTP ``Server`` response header.
3114
3111
3115 ``static``
3112 ``static``
3116 Directory where static files are served from.
3113 Directory where static files are served from.
3117
3114
3118 ``staticurl``
3115 ``staticurl``
3119 Base URL to use for static files. If unset, static files (e.g. the
3116 Base URL to use for static files. If unset, static files (e.g. the
3120 hgicon.png favicon) will be served by the CGI script itself. Use
3117 hgicon.png favicon) will be served by the CGI script itself. Use
3121 this setting to serve them directly with the HTTP server.
3118 this setting to serve them directly with the HTTP server.
3122 Example: ``http://hgserver/static/``.
3119 Example: ``http://hgserver/static/``.
3123
3120
3124 ``stripes``
3121 ``stripes``
3125 How many lines a "zebra stripe" should span in multi-line output.
3122 How many lines a "zebra stripe" should span in multi-line output.
3126 Set to 0 to disable. (default: 1)
3123 Set to 0 to disable. (default: 1)
3127
3124
3128 ``style``
3125 ``style``
3129 Which template map style to use. The available options are the names of
3126 Which template map style to use. The available options are the names of
3130 subdirectories in the HTML templates path. (default: ``paper``)
3127 subdirectories in the HTML templates path. (default: ``paper``)
3131 Example: ``monoblue``.
3128 Example: ``monoblue``.
3132
3129
3133 ``templates``
3130 ``templates``
3134 Where to find the HTML templates. The default path to the HTML templates
3131 Where to find the HTML templates. The default path to the HTML templates
3135 can be obtained from ``hg debuginstall``.
3132 can be obtained from ``hg debuginstall``.
3136
3133
3137 ``websub``
3134 ``websub``
3138 ----------
3135 ----------
3139
3136
3140 Web substitution filter definition. You can use this section to
3137 Web substitution filter definition. You can use this section to
3141 define a set of regular expression substitution patterns which
3138 define a set of regular expression substitution patterns which
3142 let you automatically modify the hgweb server output.
3139 let you automatically modify the hgweb server output.
3143
3140
3144 The default hgweb templates only apply these substitution patterns
3141 The default hgweb templates only apply these substitution patterns
3145 on the revision description fields. You can apply them anywhere
3142 on the revision description fields. You can apply them anywhere
3146 you want when you create your own templates by adding calls to the
3143 you want when you create your own templates by adding calls to the
3147 "websub" filter (usually after calling the "escape" filter).
3144 "websub" filter (usually after calling the "escape" filter).
3148
3145
3149 This can be used, for example, to convert issue references to links
3146 This can be used, for example, to convert issue references to links
3150 to your issue tracker, or to convert "markdown-like" syntax into
3147 to your issue tracker, or to convert "markdown-like" syntax into
3151 HTML (see the examples below).
3148 HTML (see the examples below).
3152
3149
3153 Each entry in this section names a substitution filter.
3150 Each entry in this section names a substitution filter.
3154 The value of each entry defines the substitution expression itself.
3151 The value of each entry defines the substitution expression itself.
3155 The websub expressions follow the old interhg extension syntax,
3152 The websub expressions follow the old interhg extension syntax,
3156 which in turn imitates the Unix sed replacement syntax::
3153 which in turn imitates the Unix sed replacement syntax::
3157
3154
3158 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
3155 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
3159
3156
3160 You can use any separator other than "/". The final "i" is optional
3157 You can use any separator other than "/". The final "i" is optional
3161 and indicates that the search must be case insensitive.
3158 and indicates that the search must be case insensitive.
3162
3159
3163 Examples::
3160 Examples::
3164
3161
3165 [websub]
3162 [websub]
3166 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
3163 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
3167 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
3164 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
3168 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
3165 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
3169
3166
3170 ``worker``
3167 ``worker``
3171 ----------
3168 ----------
3172
3169
3173 Parallel master/worker configuration. We currently perform working
3170 Parallel master/worker configuration. We currently perform working
3174 directory updates in parallel on Unix-like systems, which greatly
3171 directory updates in parallel on Unix-like systems, which greatly
3175 helps performance.
3172 helps performance.
3176
3173
3177 ``enabled``
3174 ``enabled``
3178 Whether to enable workers code to be used.
3175 Whether to enable workers code to be used.
3179 (default: true)
3176 (default: true)
3180
3177
3181 ``numcpus``
3178 ``numcpus``
3182 Number of CPUs to use for parallel operations. A zero or
3179 Number of CPUs to use for parallel operations. A zero or
3183 negative value is treated as ``use the default``.
3180 negative value is treated as ``use the default``.
3184 (default: 4 or the number of CPUs on the system, whichever is larger)
3181 (default: 4 or the number of CPUs on the system, whichever is larger)
3185
3182
3186 ``backgroundclose``
3183 ``backgroundclose``
3187 Whether to enable closing file handles on background threads during certain
3184 Whether to enable closing file handles on background threads during certain
3188 operations. Some platforms aren't very efficient at closing file
3185 operations. Some platforms aren't very efficient at closing file
3189 handles that have been written or appended to. By performing file closing
3186 handles that have been written or appended to. By performing file closing
3190 on background threads, file write rate can increase substantially.
3187 on background threads, file write rate can increase substantially.
3191 (default: true on Windows, false elsewhere)
3188 (default: true on Windows, false elsewhere)
3192
3189
3193 ``backgroundcloseminfilecount``
3190 ``backgroundcloseminfilecount``
3194 Minimum number of files required to trigger background file closing.
3191 Minimum number of files required to trigger background file closing.
3195 Operations not writing this many files won't start background close
3192 Operations not writing this many files won't start background close
3196 threads.
3193 threads.
3197 (default: 2048)
3194 (default: 2048)
3198
3195
3199 ``backgroundclosemaxqueue``
3196 ``backgroundclosemaxqueue``
3200 The maximum number of opened file handles waiting to be closed in the
3197 The maximum number of opened file handles waiting to be closed in the
3201 background. This option only has an effect if ``backgroundclose`` is
3198 background. This option only has an effect if ``backgroundclose`` is
3202 enabled.
3199 enabled.
3203 (default: 384)
3200 (default: 384)
3204
3201
3205 ``backgroundclosethreadcount``
3202 ``backgroundclosethreadcount``
3206 Number of threads to process background file closes. Only relevant if
3203 Number of threads to process background file closes. Only relevant if
3207 ``backgroundclose`` is enabled.
3204 ``backgroundclose`` is enabled.
3208 (default: 4)
3205 (default: 4)
@@ -1,3932 +1,3930
1 # localrepo.py - read/write repository class for mercurial
1 # localrepo.py - read/write repository class for mercurial
2 # coding: utf-8
2 # coding: utf-8
3 #
3 #
4 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
4 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
5 #
5 #
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
9 from __future__ import absolute_import
9 from __future__ import absolute_import
10
10
11 import errno
11 import errno
12 import functools
12 import functools
13 import os
13 import os
14 import random
14 import random
15 import sys
15 import sys
16 import time
16 import time
17 import weakref
17 import weakref
18
18
19 from .i18n import _
19 from .i18n import _
20 from .node import (
20 from .node import (
21 bin,
21 bin,
22 hex,
22 hex,
23 nullrev,
23 nullrev,
24 sha1nodeconstants,
24 sha1nodeconstants,
25 short,
25 short,
26 )
26 )
27 from .pycompat import (
27 from .pycompat import (
28 delattr,
28 delattr,
29 getattr,
29 getattr,
30 )
30 )
31 from . import (
31 from . import (
32 bookmarks,
32 bookmarks,
33 branchmap,
33 branchmap,
34 bundle2,
34 bundle2,
35 bundlecaches,
35 bundlecaches,
36 changegroup,
36 changegroup,
37 color,
37 color,
38 commit,
38 commit,
39 context,
39 context,
40 dirstate,
40 dirstate,
41 dirstateguard,
41 dirstateguard,
42 discovery,
42 discovery,
43 encoding,
43 encoding,
44 error,
44 error,
45 exchange,
45 exchange,
46 extensions,
46 extensions,
47 filelog,
47 filelog,
48 hook,
48 hook,
49 lock as lockmod,
49 lock as lockmod,
50 match as matchmod,
50 match as matchmod,
51 mergestate as mergestatemod,
51 mergestate as mergestatemod,
52 mergeutil,
52 mergeutil,
53 namespaces,
53 namespaces,
54 narrowspec,
54 narrowspec,
55 obsolete,
55 obsolete,
56 pathutil,
56 pathutil,
57 phases,
57 phases,
58 pushkey,
58 pushkey,
59 pycompat,
59 pycompat,
60 rcutil,
60 rcutil,
61 repoview,
61 repoview,
62 requirements as requirementsmod,
62 requirements as requirementsmod,
63 revlog,
63 revlog,
64 revset,
64 revset,
65 revsetlang,
65 revsetlang,
66 scmutil,
66 scmutil,
67 sparse,
67 sparse,
68 store as storemod,
68 store as storemod,
69 subrepoutil,
69 subrepoutil,
70 tags as tagsmod,
70 tags as tagsmod,
71 transaction,
71 transaction,
72 txnutil,
72 txnutil,
73 util,
73 util,
74 vfs as vfsmod,
74 vfs as vfsmod,
75 wireprototypes,
75 wireprototypes,
76 )
76 )
77
77
78 from .interfaces import (
78 from .interfaces import (
79 repository,
79 repository,
80 util as interfaceutil,
80 util as interfaceutil,
81 )
81 )
82
82
83 from .utils import (
83 from .utils import (
84 hashutil,
84 hashutil,
85 procutil,
85 procutil,
86 stringutil,
86 stringutil,
87 urlutil,
87 urlutil,
88 )
88 )
89
89
90 from .revlogutils import (
90 from .revlogutils import (
91 concurrency_checker as revlogchecker,
91 concurrency_checker as revlogchecker,
92 constants as revlogconst,
92 constants as revlogconst,
93 sidedata as sidedatamod,
93 sidedata as sidedatamod,
94 )
94 )
95
95
96 release = lockmod.release
96 release = lockmod.release
97 urlerr = util.urlerr
97 urlerr = util.urlerr
98 urlreq = util.urlreq
98 urlreq = util.urlreq
99
99
100 # set of (path, vfs-location) tuples. vfs-location is:
100 # set of (path, vfs-location) tuples. vfs-location is:
101 # - 'plain for vfs relative paths
101 # - 'plain for vfs relative paths
102 # - '' for svfs relative paths
102 # - '' for svfs relative paths
103 _cachedfiles = set()
103 _cachedfiles = set()
104
104
105
105
106 class _basefilecache(scmutil.filecache):
106 class _basefilecache(scmutil.filecache):
107 """All filecache usage on repo are done for logic that should be unfiltered"""
107 """All filecache usage on repo are done for logic that should be unfiltered"""
108
108
109 def __get__(self, repo, type=None):
109 def __get__(self, repo, type=None):
110 if repo is None:
110 if repo is None:
111 return self
111 return self
112 # proxy to unfiltered __dict__ since filtered repo has no entry
112 # proxy to unfiltered __dict__ since filtered repo has no entry
113 unfi = repo.unfiltered()
113 unfi = repo.unfiltered()
114 try:
114 try:
115 return unfi.__dict__[self.sname]
115 return unfi.__dict__[self.sname]
116 except KeyError:
116 except KeyError:
117 pass
117 pass
118 return super(_basefilecache, self).__get__(unfi, type)
118 return super(_basefilecache, self).__get__(unfi, type)
119
119
120 def set(self, repo, value):
120 def set(self, repo, value):
121 return super(_basefilecache, self).set(repo.unfiltered(), value)
121 return super(_basefilecache, self).set(repo.unfiltered(), value)
122
122
123
123
124 class repofilecache(_basefilecache):
124 class repofilecache(_basefilecache):
125 """filecache for files in .hg but outside of .hg/store"""
125 """filecache for files in .hg but outside of .hg/store"""
126
126
127 def __init__(self, *paths):
127 def __init__(self, *paths):
128 super(repofilecache, self).__init__(*paths)
128 super(repofilecache, self).__init__(*paths)
129 for path in paths:
129 for path in paths:
130 _cachedfiles.add((path, b'plain'))
130 _cachedfiles.add((path, b'plain'))
131
131
132 def join(self, obj, fname):
132 def join(self, obj, fname):
133 return obj.vfs.join(fname)
133 return obj.vfs.join(fname)
134
134
135
135
136 class storecache(_basefilecache):
136 class storecache(_basefilecache):
137 """filecache for files in the store"""
137 """filecache for files in the store"""
138
138
139 def __init__(self, *paths):
139 def __init__(self, *paths):
140 super(storecache, self).__init__(*paths)
140 super(storecache, self).__init__(*paths)
141 for path in paths:
141 for path in paths:
142 _cachedfiles.add((path, b''))
142 _cachedfiles.add((path, b''))
143
143
144 def join(self, obj, fname):
144 def join(self, obj, fname):
145 return obj.sjoin(fname)
145 return obj.sjoin(fname)
146
146
147
147
148 class changelogcache(storecache):
148 class changelogcache(storecache):
149 """filecache for the changelog"""
149 """filecache for the changelog"""
150
150
151 def __init__(self):
151 def __init__(self):
152 super(changelogcache, self).__init__()
152 super(changelogcache, self).__init__()
153 _cachedfiles.add((b'00changelog.i', b''))
153 _cachedfiles.add((b'00changelog.i', b''))
154 _cachedfiles.add((b'00changelog.n', b''))
154 _cachedfiles.add((b'00changelog.n', b''))
155
155
156 def tracked_paths(self, obj):
156 def tracked_paths(self, obj):
157 paths = [self.join(obj, b'00changelog.i')]
157 paths = [self.join(obj, b'00changelog.i')]
158 if obj.store.opener.options.get(b'persistent-nodemap', False):
158 if obj.store.opener.options.get(b'persistent-nodemap', False):
159 paths.append(self.join(obj, b'00changelog.n'))
159 paths.append(self.join(obj, b'00changelog.n'))
160 return paths
160 return paths
161
161
162
162
163 class manifestlogcache(storecache):
163 class manifestlogcache(storecache):
164 """filecache for the manifestlog"""
164 """filecache for the manifestlog"""
165
165
166 def __init__(self):
166 def __init__(self):
167 super(manifestlogcache, self).__init__()
167 super(manifestlogcache, self).__init__()
168 _cachedfiles.add((b'00manifest.i', b''))
168 _cachedfiles.add((b'00manifest.i', b''))
169 _cachedfiles.add((b'00manifest.n', b''))
169 _cachedfiles.add((b'00manifest.n', b''))
170
170
171 def tracked_paths(self, obj):
171 def tracked_paths(self, obj):
172 paths = [self.join(obj, b'00manifest.i')]
172 paths = [self.join(obj, b'00manifest.i')]
173 if obj.store.opener.options.get(b'persistent-nodemap', False):
173 if obj.store.opener.options.get(b'persistent-nodemap', False):
174 paths.append(self.join(obj, b'00manifest.n'))
174 paths.append(self.join(obj, b'00manifest.n'))
175 return paths
175 return paths
176
176
177
177
178 class mixedrepostorecache(_basefilecache):
178 class mixedrepostorecache(_basefilecache):
179 """filecache for a mix files in .hg/store and outside"""
179 """filecache for a mix files in .hg/store and outside"""
180
180
181 def __init__(self, *pathsandlocations):
181 def __init__(self, *pathsandlocations):
182 # scmutil.filecache only uses the path for passing back into our
182 # scmutil.filecache only uses the path for passing back into our
183 # join(), so we can safely pass a list of paths and locations
183 # join(), so we can safely pass a list of paths and locations
184 super(mixedrepostorecache, self).__init__(*pathsandlocations)
184 super(mixedrepostorecache, self).__init__(*pathsandlocations)
185 _cachedfiles.update(pathsandlocations)
185 _cachedfiles.update(pathsandlocations)
186
186
187 def join(self, obj, fnameandlocation):
187 def join(self, obj, fnameandlocation):
188 fname, location = fnameandlocation
188 fname, location = fnameandlocation
189 if location == b'plain':
189 if location == b'plain':
190 return obj.vfs.join(fname)
190 return obj.vfs.join(fname)
191 else:
191 else:
192 if location != b'':
192 if location != b'':
193 raise error.ProgrammingError(
193 raise error.ProgrammingError(
194 b'unexpected location: %s' % location
194 b'unexpected location: %s' % location
195 )
195 )
196 return obj.sjoin(fname)
196 return obj.sjoin(fname)
197
197
198
198
199 def isfilecached(repo, name):
199 def isfilecached(repo, name):
200 """check if a repo has already cached "name" filecache-ed property
200 """check if a repo has already cached "name" filecache-ed property
201
201
202 This returns (cachedobj-or-None, iscached) tuple.
202 This returns (cachedobj-or-None, iscached) tuple.
203 """
203 """
204 cacheentry = repo.unfiltered()._filecache.get(name, None)
204 cacheentry = repo.unfiltered()._filecache.get(name, None)
205 if not cacheentry:
205 if not cacheentry:
206 return None, False
206 return None, False
207 return cacheentry.obj, True
207 return cacheentry.obj, True
208
208
209
209
210 class unfilteredpropertycache(util.propertycache):
210 class unfilteredpropertycache(util.propertycache):
211 """propertycache that apply to unfiltered repo only"""
211 """propertycache that apply to unfiltered repo only"""
212
212
213 def __get__(self, repo, type=None):
213 def __get__(self, repo, type=None):
214 unfi = repo.unfiltered()
214 unfi = repo.unfiltered()
215 if unfi is repo:
215 if unfi is repo:
216 return super(unfilteredpropertycache, self).__get__(unfi)
216 return super(unfilteredpropertycache, self).__get__(unfi)
217 return getattr(unfi, self.name)
217 return getattr(unfi, self.name)
218
218
219
219
220 class filteredpropertycache(util.propertycache):
220 class filteredpropertycache(util.propertycache):
221 """propertycache that must take filtering in account"""
221 """propertycache that must take filtering in account"""
222
222
223 def cachevalue(self, obj, value):
223 def cachevalue(self, obj, value):
224 object.__setattr__(obj, self.name, value)
224 object.__setattr__(obj, self.name, value)
225
225
226
226
227 def hasunfilteredcache(repo, name):
227 def hasunfilteredcache(repo, name):
228 """check if a repo has an unfilteredpropertycache value for <name>"""
228 """check if a repo has an unfilteredpropertycache value for <name>"""
229 return name in vars(repo.unfiltered())
229 return name in vars(repo.unfiltered())
230
230
231
231
232 def unfilteredmethod(orig):
232 def unfilteredmethod(orig):
233 """decorate method that always need to be run on unfiltered version"""
233 """decorate method that always need to be run on unfiltered version"""
234
234
235 @functools.wraps(orig)
235 @functools.wraps(orig)
236 def wrapper(repo, *args, **kwargs):
236 def wrapper(repo, *args, **kwargs):
237 return orig(repo.unfiltered(), *args, **kwargs)
237 return orig(repo.unfiltered(), *args, **kwargs)
238
238
239 return wrapper
239 return wrapper
240
240
241
241
242 moderncaps = {
242 moderncaps = {
243 b'lookup',
243 b'lookup',
244 b'branchmap',
244 b'branchmap',
245 b'pushkey',
245 b'pushkey',
246 b'known',
246 b'known',
247 b'getbundle',
247 b'getbundle',
248 b'unbundle',
248 b'unbundle',
249 }
249 }
250 legacycaps = moderncaps.union({b'changegroupsubset'})
250 legacycaps = moderncaps.union({b'changegroupsubset'})
251
251
252
252
253 @interfaceutil.implementer(repository.ipeercommandexecutor)
253 @interfaceutil.implementer(repository.ipeercommandexecutor)
254 class localcommandexecutor(object):
254 class localcommandexecutor(object):
255 def __init__(self, peer):
255 def __init__(self, peer):
256 self._peer = peer
256 self._peer = peer
257 self._sent = False
257 self._sent = False
258 self._closed = False
258 self._closed = False
259
259
260 def __enter__(self):
260 def __enter__(self):
261 return self
261 return self
262
262
263 def __exit__(self, exctype, excvalue, exctb):
263 def __exit__(self, exctype, excvalue, exctb):
264 self.close()
264 self.close()
265
265
266 def callcommand(self, command, args):
266 def callcommand(self, command, args):
267 if self._sent:
267 if self._sent:
268 raise error.ProgrammingError(
268 raise error.ProgrammingError(
269 b'callcommand() cannot be used after sendcommands()'
269 b'callcommand() cannot be used after sendcommands()'
270 )
270 )
271
271
272 if self._closed:
272 if self._closed:
273 raise error.ProgrammingError(
273 raise error.ProgrammingError(
274 b'callcommand() cannot be used after close()'
274 b'callcommand() cannot be used after close()'
275 )
275 )
276
276
277 # We don't need to support anything fancy. Just call the named
277 # We don't need to support anything fancy. Just call the named
278 # method on the peer and return a resolved future.
278 # method on the peer and return a resolved future.
279 fn = getattr(self._peer, pycompat.sysstr(command))
279 fn = getattr(self._peer, pycompat.sysstr(command))
280
280
281 f = pycompat.futures.Future()
281 f = pycompat.futures.Future()
282
282
283 try:
283 try:
284 result = fn(**pycompat.strkwargs(args))
284 result = fn(**pycompat.strkwargs(args))
285 except Exception:
285 except Exception:
286 pycompat.future_set_exception_info(f, sys.exc_info()[1:])
286 pycompat.future_set_exception_info(f, sys.exc_info()[1:])
287 else:
287 else:
288 f.set_result(result)
288 f.set_result(result)
289
289
290 return f
290 return f
291
291
292 def sendcommands(self):
292 def sendcommands(self):
293 self._sent = True
293 self._sent = True
294
294
295 def close(self):
295 def close(self):
296 self._closed = True
296 self._closed = True
297
297
298
298
299 @interfaceutil.implementer(repository.ipeercommands)
299 @interfaceutil.implementer(repository.ipeercommands)
300 class localpeer(repository.peer):
300 class localpeer(repository.peer):
301 '''peer for a local repo; reflects only the most recent API'''
301 '''peer for a local repo; reflects only the most recent API'''
302
302
303 def __init__(self, repo, caps=None):
303 def __init__(self, repo, caps=None):
304 super(localpeer, self).__init__()
304 super(localpeer, self).__init__()
305
305
306 if caps is None:
306 if caps is None:
307 caps = moderncaps.copy()
307 caps = moderncaps.copy()
308 self._repo = repo.filtered(b'served')
308 self._repo = repo.filtered(b'served')
309 self.ui = repo.ui
309 self.ui = repo.ui
310
310
311 if repo._wanted_sidedata:
311 if repo._wanted_sidedata:
312 formatted = bundle2.format_remote_wanted_sidedata(repo)
312 formatted = bundle2.format_remote_wanted_sidedata(repo)
313 caps.add(b'exp-wanted-sidedata=' + formatted)
313 caps.add(b'exp-wanted-sidedata=' + formatted)
314
314
315 self._caps = repo._restrictcapabilities(caps)
315 self._caps = repo._restrictcapabilities(caps)
316
316
317 # Begin of _basepeer interface.
317 # Begin of _basepeer interface.
318
318
319 def url(self):
319 def url(self):
320 return self._repo.url()
320 return self._repo.url()
321
321
322 def local(self):
322 def local(self):
323 return self._repo
323 return self._repo
324
324
325 def peer(self):
325 def peer(self):
326 return self
326 return self
327
327
328 def canpush(self):
328 def canpush(self):
329 return True
329 return True
330
330
331 def close(self):
331 def close(self):
332 self._repo.close()
332 self._repo.close()
333
333
334 # End of _basepeer interface.
334 # End of _basepeer interface.
335
335
336 # Begin of _basewirecommands interface.
336 # Begin of _basewirecommands interface.
337
337
338 def branchmap(self):
338 def branchmap(self):
339 return self._repo.branchmap()
339 return self._repo.branchmap()
340
340
341 def capabilities(self):
341 def capabilities(self):
342 return self._caps
342 return self._caps
343
343
344 def clonebundles(self):
344 def clonebundles(self):
345 return self._repo.tryread(bundlecaches.CB_MANIFEST_FILE)
345 return self._repo.tryread(bundlecaches.CB_MANIFEST_FILE)
346
346
347 def debugwireargs(self, one, two, three=None, four=None, five=None):
347 def debugwireargs(self, one, two, three=None, four=None, five=None):
348 """Used to test argument passing over the wire"""
348 """Used to test argument passing over the wire"""
349 return b"%s %s %s %s %s" % (
349 return b"%s %s %s %s %s" % (
350 one,
350 one,
351 two,
351 two,
352 pycompat.bytestr(three),
352 pycompat.bytestr(three),
353 pycompat.bytestr(four),
353 pycompat.bytestr(four),
354 pycompat.bytestr(five),
354 pycompat.bytestr(five),
355 )
355 )
356
356
357 def getbundle(
357 def getbundle(
358 self,
358 self,
359 source,
359 source,
360 heads=None,
360 heads=None,
361 common=None,
361 common=None,
362 bundlecaps=None,
362 bundlecaps=None,
363 remote_sidedata=None,
363 remote_sidedata=None,
364 **kwargs
364 **kwargs
365 ):
365 ):
366 chunks = exchange.getbundlechunks(
366 chunks = exchange.getbundlechunks(
367 self._repo,
367 self._repo,
368 source,
368 source,
369 heads=heads,
369 heads=heads,
370 common=common,
370 common=common,
371 bundlecaps=bundlecaps,
371 bundlecaps=bundlecaps,
372 remote_sidedata=remote_sidedata,
372 remote_sidedata=remote_sidedata,
373 **kwargs
373 **kwargs
374 )[1]
374 )[1]
375 cb = util.chunkbuffer(chunks)
375 cb = util.chunkbuffer(chunks)
376
376
377 if exchange.bundle2requested(bundlecaps):
377 if exchange.bundle2requested(bundlecaps):
378 # When requesting a bundle2, getbundle returns a stream to make the
378 # When requesting a bundle2, getbundle returns a stream to make the
379 # wire level function happier. We need to build a proper object
379 # wire level function happier. We need to build a proper object
380 # from it in local peer.
380 # from it in local peer.
381 return bundle2.getunbundler(self.ui, cb)
381 return bundle2.getunbundler(self.ui, cb)
382 else:
382 else:
383 return changegroup.getunbundler(b'01', cb, None)
383 return changegroup.getunbundler(b'01', cb, None)
384
384
385 def heads(self):
385 def heads(self):
386 return self._repo.heads()
386 return self._repo.heads()
387
387
388 def known(self, nodes):
388 def known(self, nodes):
389 return self._repo.known(nodes)
389 return self._repo.known(nodes)
390
390
391 def listkeys(self, namespace):
391 def listkeys(self, namespace):
392 return self._repo.listkeys(namespace)
392 return self._repo.listkeys(namespace)
393
393
394 def lookup(self, key):
394 def lookup(self, key):
395 return self._repo.lookup(key)
395 return self._repo.lookup(key)
396
396
397 def pushkey(self, namespace, key, old, new):
397 def pushkey(self, namespace, key, old, new):
398 return self._repo.pushkey(namespace, key, old, new)
398 return self._repo.pushkey(namespace, key, old, new)
399
399
400 def stream_out(self):
400 def stream_out(self):
401 raise error.Abort(_(b'cannot perform stream clone against local peer'))
401 raise error.Abort(_(b'cannot perform stream clone against local peer'))
402
402
403 def unbundle(self, bundle, heads, url):
403 def unbundle(self, bundle, heads, url):
404 """apply a bundle on a repo
404 """apply a bundle on a repo
405
405
406 This function handles the repo locking itself."""
406 This function handles the repo locking itself."""
407 try:
407 try:
408 try:
408 try:
409 bundle = exchange.readbundle(self.ui, bundle, None)
409 bundle = exchange.readbundle(self.ui, bundle, None)
410 ret = exchange.unbundle(self._repo, bundle, heads, b'push', url)
410 ret = exchange.unbundle(self._repo, bundle, heads, b'push', url)
411 if util.safehasattr(ret, b'getchunks'):
411 if util.safehasattr(ret, b'getchunks'):
412 # This is a bundle20 object, turn it into an unbundler.
412 # This is a bundle20 object, turn it into an unbundler.
413 # This little dance should be dropped eventually when the
413 # This little dance should be dropped eventually when the
414 # API is finally improved.
414 # API is finally improved.
415 stream = util.chunkbuffer(ret.getchunks())
415 stream = util.chunkbuffer(ret.getchunks())
416 ret = bundle2.getunbundler(self.ui, stream)
416 ret = bundle2.getunbundler(self.ui, stream)
417 return ret
417 return ret
418 except Exception as exc:
418 except Exception as exc:
419 # If the exception contains output salvaged from a bundle2
419 # If the exception contains output salvaged from a bundle2
420 # reply, we need to make sure it is printed before continuing
420 # reply, we need to make sure it is printed before continuing
421 # to fail. So we build a bundle2 with such output and consume
421 # to fail. So we build a bundle2 with such output and consume
422 # it directly.
422 # it directly.
423 #
423 #
424 # This is not very elegant but allows a "simple" solution for
424 # This is not very elegant but allows a "simple" solution for
425 # issue4594
425 # issue4594
426 output = getattr(exc, '_bundle2salvagedoutput', ())
426 output = getattr(exc, '_bundle2salvagedoutput', ())
427 if output:
427 if output:
428 bundler = bundle2.bundle20(self._repo.ui)
428 bundler = bundle2.bundle20(self._repo.ui)
429 for out in output:
429 for out in output:
430 bundler.addpart(out)
430 bundler.addpart(out)
431 stream = util.chunkbuffer(bundler.getchunks())
431 stream = util.chunkbuffer(bundler.getchunks())
432 b = bundle2.getunbundler(self.ui, stream)
432 b = bundle2.getunbundler(self.ui, stream)
433 bundle2.processbundle(self._repo, b)
433 bundle2.processbundle(self._repo, b)
434 raise
434 raise
435 except error.PushRaced as exc:
435 except error.PushRaced as exc:
436 raise error.ResponseError(
436 raise error.ResponseError(
437 _(b'push failed:'), stringutil.forcebytestr(exc)
437 _(b'push failed:'), stringutil.forcebytestr(exc)
438 )
438 )
439
439
440 # End of _basewirecommands interface.
440 # End of _basewirecommands interface.
441
441
442 # Begin of peer interface.
442 # Begin of peer interface.
443
443
444 def commandexecutor(self):
444 def commandexecutor(self):
445 return localcommandexecutor(self)
445 return localcommandexecutor(self)
446
446
447 # End of peer interface.
447 # End of peer interface.
448
448
449
449
450 @interfaceutil.implementer(repository.ipeerlegacycommands)
450 @interfaceutil.implementer(repository.ipeerlegacycommands)
451 class locallegacypeer(localpeer):
451 class locallegacypeer(localpeer):
452 """peer extension which implements legacy methods too; used for tests with
452 """peer extension which implements legacy methods too; used for tests with
453 restricted capabilities"""
453 restricted capabilities"""
454
454
455 def __init__(self, repo):
455 def __init__(self, repo):
456 super(locallegacypeer, self).__init__(repo, caps=legacycaps)
456 super(locallegacypeer, self).__init__(repo, caps=legacycaps)
457
457
458 # Begin of baselegacywirecommands interface.
458 # Begin of baselegacywirecommands interface.
459
459
460 def between(self, pairs):
460 def between(self, pairs):
461 return self._repo.between(pairs)
461 return self._repo.between(pairs)
462
462
463 def branches(self, nodes):
463 def branches(self, nodes):
464 return self._repo.branches(nodes)
464 return self._repo.branches(nodes)
465
465
466 def changegroup(self, nodes, source):
466 def changegroup(self, nodes, source):
467 outgoing = discovery.outgoing(
467 outgoing = discovery.outgoing(
468 self._repo, missingroots=nodes, ancestorsof=self._repo.heads()
468 self._repo, missingroots=nodes, ancestorsof=self._repo.heads()
469 )
469 )
470 return changegroup.makechangegroup(self._repo, outgoing, b'01', source)
470 return changegroup.makechangegroup(self._repo, outgoing, b'01', source)
471
471
472 def changegroupsubset(self, bases, heads, source):
472 def changegroupsubset(self, bases, heads, source):
473 outgoing = discovery.outgoing(
473 outgoing = discovery.outgoing(
474 self._repo, missingroots=bases, ancestorsof=heads
474 self._repo, missingroots=bases, ancestorsof=heads
475 )
475 )
476 return changegroup.makechangegroup(self._repo, outgoing, b'01', source)
476 return changegroup.makechangegroup(self._repo, outgoing, b'01', source)
477
477
478 # End of baselegacywirecommands interface.
478 # End of baselegacywirecommands interface.
479
479
480
480
481 # Functions receiving (ui, features) that extensions can register to impact
481 # Functions receiving (ui, features) that extensions can register to impact
482 # the ability to load repositories with custom requirements. Only
482 # the ability to load repositories with custom requirements. Only
483 # functions defined in loaded extensions are called.
483 # functions defined in loaded extensions are called.
484 #
484 #
485 # The function receives a set of requirement strings that the repository
485 # The function receives a set of requirement strings that the repository
486 # is capable of opening. Functions will typically add elements to the
486 # is capable of opening. Functions will typically add elements to the
487 # set to reflect that the extension knows how to handle that requirements.
487 # set to reflect that the extension knows how to handle that requirements.
488 featuresetupfuncs = set()
488 featuresetupfuncs = set()
489
489
490
490
491 def _getsharedvfs(hgvfs, requirements):
491 def _getsharedvfs(hgvfs, requirements):
492 """returns the vfs object pointing to root of shared source
492 """returns the vfs object pointing to root of shared source
493 repo for a shared repository
493 repo for a shared repository
494
494
495 hgvfs is vfs pointing at .hg/ of current repo (shared one)
495 hgvfs is vfs pointing at .hg/ of current repo (shared one)
496 requirements is a set of requirements of current repo (shared one)
496 requirements is a set of requirements of current repo (shared one)
497 """
497 """
498 # The ``shared`` or ``relshared`` requirements indicate the
498 # The ``shared`` or ``relshared`` requirements indicate the
499 # store lives in the path contained in the ``.hg/sharedpath`` file.
499 # store lives in the path contained in the ``.hg/sharedpath`` file.
500 # This is an absolute path for ``shared`` and relative to
500 # This is an absolute path for ``shared`` and relative to
501 # ``.hg/`` for ``relshared``.
501 # ``.hg/`` for ``relshared``.
502 sharedpath = hgvfs.read(b'sharedpath').rstrip(b'\n')
502 sharedpath = hgvfs.read(b'sharedpath').rstrip(b'\n')
503 if requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements:
503 if requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements:
504 sharedpath = util.normpath(hgvfs.join(sharedpath))
504 sharedpath = util.normpath(hgvfs.join(sharedpath))
505
505
506 sharedvfs = vfsmod.vfs(sharedpath, realpath=True)
506 sharedvfs = vfsmod.vfs(sharedpath, realpath=True)
507
507
508 if not sharedvfs.exists():
508 if not sharedvfs.exists():
509 raise error.RepoError(
509 raise error.RepoError(
510 _(b'.hg/sharedpath points to nonexistent directory %s')
510 _(b'.hg/sharedpath points to nonexistent directory %s')
511 % sharedvfs.base
511 % sharedvfs.base
512 )
512 )
513 return sharedvfs
513 return sharedvfs
514
514
515
515
516 def _readrequires(vfs, allowmissing):
516 def _readrequires(vfs, allowmissing):
517 """reads the require file present at root of this vfs
517 """reads the require file present at root of this vfs
518 and return a set of requirements
518 and return a set of requirements
519
519
520 If allowmissing is True, we suppress ENOENT if raised"""
520 If allowmissing is True, we suppress ENOENT if raised"""
521 # requires file contains a newline-delimited list of
521 # requires file contains a newline-delimited list of
522 # features/capabilities the opener (us) must have in order to use
522 # features/capabilities the opener (us) must have in order to use
523 # the repository. This file was introduced in Mercurial 0.9.2,
523 # the repository. This file was introduced in Mercurial 0.9.2,
524 # which means very old repositories may not have one. We assume
524 # which means very old repositories may not have one. We assume
525 # a missing file translates to no requirements.
525 # a missing file translates to no requirements.
526 try:
526 try:
527 requirements = set(vfs.read(b'requires').splitlines())
527 requirements = set(vfs.read(b'requires').splitlines())
528 except IOError as e:
528 except IOError as e:
529 if not (allowmissing and e.errno == errno.ENOENT):
529 if not (allowmissing and e.errno == errno.ENOENT):
530 raise
530 raise
531 requirements = set()
531 requirements = set()
532 return requirements
532 return requirements
533
533
534
534
535 def makelocalrepository(baseui, path, intents=None):
535 def makelocalrepository(baseui, path, intents=None):
536 """Create a local repository object.
536 """Create a local repository object.
537
537
538 Given arguments needed to construct a local repository, this function
538 Given arguments needed to construct a local repository, this function
539 performs various early repository loading functionality (such as
539 performs various early repository loading functionality (such as
540 reading the ``.hg/requires`` and ``.hg/hgrc`` files), validates that
540 reading the ``.hg/requires`` and ``.hg/hgrc`` files), validates that
541 the repository can be opened, derives a type suitable for representing
541 the repository can be opened, derives a type suitable for representing
542 that repository, and returns an instance of it.
542 that repository, and returns an instance of it.
543
543
544 The returned object conforms to the ``repository.completelocalrepository``
544 The returned object conforms to the ``repository.completelocalrepository``
545 interface.
545 interface.
546
546
547 The repository type is derived by calling a series of factory functions
547 The repository type is derived by calling a series of factory functions
548 for each aspect/interface of the final repository. These are defined by
548 for each aspect/interface of the final repository. These are defined by
549 ``REPO_INTERFACES``.
549 ``REPO_INTERFACES``.
550
550
551 Each factory function is called to produce a type implementing a specific
551 Each factory function is called to produce a type implementing a specific
552 interface. The cumulative list of returned types will be combined into a
552 interface. The cumulative list of returned types will be combined into a
553 new type and that type will be instantiated to represent the local
553 new type and that type will be instantiated to represent the local
554 repository.
554 repository.
555
555
556 The factory functions each receive various state that may be consulted
556 The factory functions each receive various state that may be consulted
557 as part of deriving a type.
557 as part of deriving a type.
558
558
559 Extensions should wrap these factory functions to customize repository type
559 Extensions should wrap these factory functions to customize repository type
560 creation. Note that an extension's wrapped function may be called even if
560 creation. Note that an extension's wrapped function may be called even if
561 that extension is not loaded for the repo being constructed. Extensions
561 that extension is not loaded for the repo being constructed. Extensions
562 should check if their ``__name__`` appears in the
562 should check if their ``__name__`` appears in the
563 ``extensionmodulenames`` set passed to the factory function and no-op if
563 ``extensionmodulenames`` set passed to the factory function and no-op if
564 not.
564 not.
565 """
565 """
566 ui = baseui.copy()
566 ui = baseui.copy()
567 # Prevent copying repo configuration.
567 # Prevent copying repo configuration.
568 ui.copy = baseui.copy
568 ui.copy = baseui.copy
569
569
570 # Working directory VFS rooted at repository root.
570 # Working directory VFS rooted at repository root.
571 wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
571 wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
572
572
573 # Main VFS for .hg/ directory.
573 # Main VFS for .hg/ directory.
574 hgpath = wdirvfs.join(b'.hg')
574 hgpath = wdirvfs.join(b'.hg')
575 hgvfs = vfsmod.vfs(hgpath, cacheaudited=True)
575 hgvfs = vfsmod.vfs(hgpath, cacheaudited=True)
576 # Whether this repository is shared one or not
576 # Whether this repository is shared one or not
577 shared = False
577 shared = False
578 # If this repository is shared, vfs pointing to shared repo
578 # If this repository is shared, vfs pointing to shared repo
579 sharedvfs = None
579 sharedvfs = None
580
580
581 # The .hg/ path should exist and should be a directory. All other
581 # The .hg/ path should exist and should be a directory. All other
582 # cases are errors.
582 # cases are errors.
583 if not hgvfs.isdir():
583 if not hgvfs.isdir():
584 try:
584 try:
585 hgvfs.stat()
585 hgvfs.stat()
586 except OSError as e:
586 except OSError as e:
587 if e.errno != errno.ENOENT:
587 if e.errno != errno.ENOENT:
588 raise
588 raise
589 except ValueError as e:
589 except ValueError as e:
590 # Can be raised on Python 3.8 when path is invalid.
590 # Can be raised on Python 3.8 when path is invalid.
591 raise error.Abort(
591 raise error.Abort(
592 _(b'invalid path %s: %s') % (path, stringutil.forcebytestr(e))
592 _(b'invalid path %s: %s') % (path, stringutil.forcebytestr(e))
593 )
593 )
594
594
595 raise error.RepoError(_(b'repository %s not found') % path)
595 raise error.RepoError(_(b'repository %s not found') % path)
596
596
597 requirements = _readrequires(hgvfs, True)
597 requirements = _readrequires(hgvfs, True)
598 shared = (
598 shared = (
599 requirementsmod.SHARED_REQUIREMENT in requirements
599 requirementsmod.SHARED_REQUIREMENT in requirements
600 or requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements
600 or requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements
601 )
601 )
602 storevfs = None
602 storevfs = None
603 if shared:
603 if shared:
604 # This is a shared repo
604 # This is a shared repo
605 sharedvfs = _getsharedvfs(hgvfs, requirements)
605 sharedvfs = _getsharedvfs(hgvfs, requirements)
606 storevfs = vfsmod.vfs(sharedvfs.join(b'store'))
606 storevfs = vfsmod.vfs(sharedvfs.join(b'store'))
607 else:
607 else:
608 storevfs = vfsmod.vfs(hgvfs.join(b'store'))
608 storevfs = vfsmod.vfs(hgvfs.join(b'store'))
609
609
610 # if .hg/requires contains the sharesafe requirement, it means
610 # if .hg/requires contains the sharesafe requirement, it means
611 # there exists a `.hg/store/requires` too and we should read it
611 # there exists a `.hg/store/requires` too and we should read it
612 # NOTE: presence of SHARESAFE_REQUIREMENT imply that store requirement
612 # NOTE: presence of SHARESAFE_REQUIREMENT imply that store requirement
613 # is present. We never write SHARESAFE_REQUIREMENT for a repo if store
613 # is present. We never write SHARESAFE_REQUIREMENT for a repo if store
614 # is not present, refer checkrequirementscompat() for that
614 # is not present, refer checkrequirementscompat() for that
615 #
615 #
616 # However, if SHARESAFE_REQUIREMENT is not present, it means that the
616 # However, if SHARESAFE_REQUIREMENT is not present, it means that the
617 # repository was shared the old way. We check the share source .hg/requires
617 # repository was shared the old way. We check the share source .hg/requires
618 # for SHARESAFE_REQUIREMENT to detect whether the current repository needs
618 # for SHARESAFE_REQUIREMENT to detect whether the current repository needs
619 # to be reshared
619 # to be reshared
620 hint = _(b"see `hg help config.format.use-share-safe` for more information")
620 hint = _(b"see `hg help config.format.use-share-safe` for more information")
621 if requirementsmod.SHARESAFE_REQUIREMENT in requirements:
621 if requirementsmod.SHARESAFE_REQUIREMENT in requirements:
622
622
623 if (
623 if (
624 shared
624 shared
625 and requirementsmod.SHARESAFE_REQUIREMENT
625 and requirementsmod.SHARESAFE_REQUIREMENT
626 not in _readrequires(sharedvfs, True)
626 not in _readrequires(sharedvfs, True)
627 ):
627 ):
628 mismatch_warn = ui.configbool(
628 mismatch_warn = ui.configbool(
629 b'share', b'safe-mismatch.source-not-safe.warn'
629 b'share', b'safe-mismatch.source-not-safe.warn'
630 )
630 )
631 mismatch_config = ui.config(
631 mismatch_config = ui.config(
632 b'share', b'safe-mismatch.source-not-safe'
632 b'share', b'safe-mismatch.source-not-safe'
633 )
633 )
634 if mismatch_config in (
634 if mismatch_config in (
635 b'downgrade-allow',
635 b'downgrade-allow',
636 b'allow',
636 b'allow',
637 b'downgrade-abort',
637 b'downgrade-abort',
638 ):
638 ):
639 # prevent cyclic import localrepo -> upgrade -> localrepo
639 # prevent cyclic import localrepo -> upgrade -> localrepo
640 from . import upgrade
640 from . import upgrade
641
641
642 upgrade.downgrade_share_to_non_safe(
642 upgrade.downgrade_share_to_non_safe(
643 ui,
643 ui,
644 hgvfs,
644 hgvfs,
645 sharedvfs,
645 sharedvfs,
646 requirements,
646 requirements,
647 mismatch_config,
647 mismatch_config,
648 mismatch_warn,
648 mismatch_warn,
649 )
649 )
650 elif mismatch_config == b'abort':
650 elif mismatch_config == b'abort':
651 raise error.Abort(
651 raise error.Abort(
652 _(b"share source does not support share-safe requirement"),
652 _(b"share source does not support share-safe requirement"),
653 hint=hint,
653 hint=hint,
654 )
654 )
655 else:
655 else:
656 raise error.Abort(
656 raise error.Abort(
657 _(
657 _(
658 b"share-safe mismatch with source.\nUnrecognized"
658 b"share-safe mismatch with source.\nUnrecognized"
659 b" value '%s' of `share.safe-mismatch.source-not-safe`"
659 b" value '%s' of `share.safe-mismatch.source-not-safe`"
660 b" set."
660 b" set."
661 )
661 )
662 % mismatch_config,
662 % mismatch_config,
663 hint=hint,
663 hint=hint,
664 )
664 )
665 else:
665 else:
666 requirements |= _readrequires(storevfs, False)
666 requirements |= _readrequires(storevfs, False)
667 elif shared:
667 elif shared:
668 sourcerequires = _readrequires(sharedvfs, False)
668 sourcerequires = _readrequires(sharedvfs, False)
669 if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires:
669 if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires:
670 mismatch_config = ui.config(b'share', b'safe-mismatch.source-safe')
670 mismatch_config = ui.config(b'share', b'safe-mismatch.source-safe')
671 mismatch_warn = ui.configbool(
671 mismatch_warn = ui.configbool(
672 b'share', b'safe-mismatch.source-safe.warn'
672 b'share', b'safe-mismatch.source-safe.warn'
673 )
673 )
674 if mismatch_config in (
674 if mismatch_config in (
675 b'upgrade-allow',
675 b'upgrade-allow',
676 b'allow',
676 b'allow',
677 b'upgrade-abort',
677 b'upgrade-abort',
678 ):
678 ):
679 # prevent cyclic import localrepo -> upgrade -> localrepo
679 # prevent cyclic import localrepo -> upgrade -> localrepo
680 from . import upgrade
680 from . import upgrade
681
681
682 upgrade.upgrade_share_to_safe(
682 upgrade.upgrade_share_to_safe(
683 ui,
683 ui,
684 hgvfs,
684 hgvfs,
685 storevfs,
685 storevfs,
686 requirements,
686 requirements,
687 mismatch_config,
687 mismatch_config,
688 mismatch_warn,
688 mismatch_warn,
689 )
689 )
690 elif mismatch_config == b'abort':
690 elif mismatch_config == b'abort':
691 raise error.Abort(
691 raise error.Abort(
692 _(
692 _(
693 b'version mismatch: source uses share-safe'
693 b'version mismatch: source uses share-safe'
694 b' functionality while the current share does not'
694 b' functionality while the current share does not'
695 ),
695 ),
696 hint=hint,
696 hint=hint,
697 )
697 )
698 else:
698 else:
699 raise error.Abort(
699 raise error.Abort(
700 _(
700 _(
701 b"share-safe mismatch with source.\nUnrecognized"
701 b"share-safe mismatch with source.\nUnrecognized"
702 b" value '%s' of `share.safe-mismatch.source-safe` set."
702 b" value '%s' of `share.safe-mismatch.source-safe` set."
703 )
703 )
704 % mismatch_config,
704 % mismatch_config,
705 hint=hint,
705 hint=hint,
706 )
706 )
707
707
708 # The .hg/hgrc file may load extensions or contain config options
708 # The .hg/hgrc file may load extensions or contain config options
709 # that influence repository construction. Attempt to load it and
709 # that influence repository construction. Attempt to load it and
710 # process any new extensions that it may have pulled in.
710 # process any new extensions that it may have pulled in.
711 if loadhgrc(ui, wdirvfs, hgvfs, requirements, sharedvfs):
711 if loadhgrc(ui, wdirvfs, hgvfs, requirements, sharedvfs):
712 afterhgrcload(ui, wdirvfs, hgvfs, requirements)
712 afterhgrcload(ui, wdirvfs, hgvfs, requirements)
713 extensions.loadall(ui)
713 extensions.loadall(ui)
714 extensions.populateui(ui)
714 extensions.populateui(ui)
715
715
716 # Set of module names of extensions loaded for this repository.
716 # Set of module names of extensions loaded for this repository.
717 extensionmodulenames = {m.__name__ for n, m in extensions.extensions(ui)}
717 extensionmodulenames = {m.__name__ for n, m in extensions.extensions(ui)}
718
718
719 supportedrequirements = gathersupportedrequirements(ui)
719 supportedrequirements = gathersupportedrequirements(ui)
720
720
721 # We first validate the requirements are known.
721 # We first validate the requirements are known.
722 ensurerequirementsrecognized(requirements, supportedrequirements)
722 ensurerequirementsrecognized(requirements, supportedrequirements)
723
723
724 # Then we validate that the known set is reasonable to use together.
724 # Then we validate that the known set is reasonable to use together.
725 ensurerequirementscompatible(ui, requirements)
725 ensurerequirementscompatible(ui, requirements)
726
726
727 # TODO there are unhandled edge cases related to opening repositories with
727 # TODO there are unhandled edge cases related to opening repositories with
728 # shared storage. If storage is shared, we should also test for requirements
728 # shared storage. If storage is shared, we should also test for requirements
729 # compatibility in the pointed-to repo. This entails loading the .hg/hgrc in
729 # compatibility in the pointed-to repo. This entails loading the .hg/hgrc in
730 # that repo, as that repo may load extensions needed to open it. This is a
730 # that repo, as that repo may load extensions needed to open it. This is a
731 # bit complicated because we don't want the other hgrc to overwrite settings
731 # bit complicated because we don't want the other hgrc to overwrite settings
732 # in this hgrc.
732 # in this hgrc.
733 #
733 #
734 # This bug is somewhat mitigated by the fact that we copy the .hg/requires
734 # This bug is somewhat mitigated by the fact that we copy the .hg/requires
735 # file when sharing repos. But if a requirement is added after the share is
735 # file when sharing repos. But if a requirement is added after the share is
736 # performed, thereby introducing a new requirement for the opener, we may
736 # performed, thereby introducing a new requirement for the opener, we may
737 # will not see that and could encounter a run-time error interacting with
737 # will not see that and could encounter a run-time error interacting with
738 # that shared store since it has an unknown-to-us requirement.
738 # that shared store since it has an unknown-to-us requirement.
739
739
740 # At this point, we know we should be capable of opening the repository.
740 # At this point, we know we should be capable of opening the repository.
741 # Now get on with doing that.
741 # Now get on with doing that.
742
742
743 features = set()
743 features = set()
744
744
745 # The "store" part of the repository holds versioned data. How it is
745 # The "store" part of the repository holds versioned data. How it is
746 # accessed is determined by various requirements. If `shared` or
746 # accessed is determined by various requirements. If `shared` or
747 # `relshared` requirements are present, this indicates current repository
747 # `relshared` requirements are present, this indicates current repository
748 # is a share and store exists in path mentioned in `.hg/sharedpath`
748 # is a share and store exists in path mentioned in `.hg/sharedpath`
749 if shared:
749 if shared:
750 storebasepath = sharedvfs.base
750 storebasepath = sharedvfs.base
751 cachepath = sharedvfs.join(b'cache')
751 cachepath = sharedvfs.join(b'cache')
752 features.add(repository.REPO_FEATURE_SHARED_STORAGE)
752 features.add(repository.REPO_FEATURE_SHARED_STORAGE)
753 else:
753 else:
754 storebasepath = hgvfs.base
754 storebasepath = hgvfs.base
755 cachepath = hgvfs.join(b'cache')
755 cachepath = hgvfs.join(b'cache')
756 wcachepath = hgvfs.join(b'wcache')
756 wcachepath = hgvfs.join(b'wcache')
757
757
758 # The store has changed over time and the exact layout is dictated by
758 # The store has changed over time and the exact layout is dictated by
759 # requirements. The store interface abstracts differences across all
759 # requirements. The store interface abstracts differences across all
760 # of them.
760 # of them.
761 store = makestore(
761 store = makestore(
762 requirements,
762 requirements,
763 storebasepath,
763 storebasepath,
764 lambda base: vfsmod.vfs(base, cacheaudited=True),
764 lambda base: vfsmod.vfs(base, cacheaudited=True),
765 )
765 )
766 hgvfs.createmode = store.createmode
766 hgvfs.createmode = store.createmode
767
767
768 storevfs = store.vfs
768 storevfs = store.vfs
769 storevfs.options = resolvestorevfsoptions(ui, requirements, features)
769 storevfs.options = resolvestorevfsoptions(ui, requirements, features)
770
770
771 if (
771 if (
772 requirementsmod.REVLOGV2_REQUIREMENT in requirements
772 requirementsmod.REVLOGV2_REQUIREMENT in requirements
773 or requirementsmod.CHANGELOGV2_REQUIREMENT in requirements
773 or requirementsmod.CHANGELOGV2_REQUIREMENT in requirements
774 ):
774 ):
775 features.add(repository.REPO_FEATURE_SIDE_DATA)
775 features.add(repository.REPO_FEATURE_SIDE_DATA)
776 # the revlogv2 docket introduced race condition that we need to fix
776 # the revlogv2 docket introduced race condition that we need to fix
777 features.discard(repository.REPO_FEATURE_STREAM_CLONE)
777 features.discard(repository.REPO_FEATURE_STREAM_CLONE)
778
778
779 # The cache vfs is used to manage cache files.
779 # The cache vfs is used to manage cache files.
780 cachevfs = vfsmod.vfs(cachepath, cacheaudited=True)
780 cachevfs = vfsmod.vfs(cachepath, cacheaudited=True)
781 cachevfs.createmode = store.createmode
781 cachevfs.createmode = store.createmode
782 # The cache vfs is used to manage cache files related to the working copy
782 # The cache vfs is used to manage cache files related to the working copy
783 wcachevfs = vfsmod.vfs(wcachepath, cacheaudited=True)
783 wcachevfs = vfsmod.vfs(wcachepath, cacheaudited=True)
784 wcachevfs.createmode = store.createmode
784 wcachevfs.createmode = store.createmode
785
785
786 # Now resolve the type for the repository object. We do this by repeatedly
786 # Now resolve the type for the repository object. We do this by repeatedly
787 # calling a factory function to produces types for specific aspects of the
787 # calling a factory function to produces types for specific aspects of the
788 # repo's operation. The aggregate returned types are used as base classes
788 # repo's operation. The aggregate returned types are used as base classes
789 # for a dynamically-derived type, which will represent our new repository.
789 # for a dynamically-derived type, which will represent our new repository.
790
790
791 bases = []
791 bases = []
792 extrastate = {}
792 extrastate = {}
793
793
794 for iface, fn in REPO_INTERFACES:
794 for iface, fn in REPO_INTERFACES:
795 # We pass all potentially useful state to give extensions tons of
795 # We pass all potentially useful state to give extensions tons of
796 # flexibility.
796 # flexibility.
797 typ = fn()(
797 typ = fn()(
798 ui=ui,
798 ui=ui,
799 intents=intents,
799 intents=intents,
800 requirements=requirements,
800 requirements=requirements,
801 features=features,
801 features=features,
802 wdirvfs=wdirvfs,
802 wdirvfs=wdirvfs,
803 hgvfs=hgvfs,
803 hgvfs=hgvfs,
804 store=store,
804 store=store,
805 storevfs=storevfs,
805 storevfs=storevfs,
806 storeoptions=storevfs.options,
806 storeoptions=storevfs.options,
807 cachevfs=cachevfs,
807 cachevfs=cachevfs,
808 wcachevfs=wcachevfs,
808 wcachevfs=wcachevfs,
809 extensionmodulenames=extensionmodulenames,
809 extensionmodulenames=extensionmodulenames,
810 extrastate=extrastate,
810 extrastate=extrastate,
811 baseclasses=bases,
811 baseclasses=bases,
812 )
812 )
813
813
814 if not isinstance(typ, type):
814 if not isinstance(typ, type):
815 raise error.ProgrammingError(
815 raise error.ProgrammingError(
816 b'unable to construct type for %s' % iface
816 b'unable to construct type for %s' % iface
817 )
817 )
818
818
819 bases.append(typ)
819 bases.append(typ)
820
820
821 # type() allows you to use characters in type names that wouldn't be
821 # type() allows you to use characters in type names that wouldn't be
822 # recognized as Python symbols in source code. We abuse that to add
822 # recognized as Python symbols in source code. We abuse that to add
823 # rich information about our constructed repo.
823 # rich information about our constructed repo.
824 name = pycompat.sysstr(
824 name = pycompat.sysstr(
825 b'derivedrepo:%s<%s>' % (wdirvfs.base, b','.join(sorted(requirements)))
825 b'derivedrepo:%s<%s>' % (wdirvfs.base, b','.join(sorted(requirements)))
826 )
826 )
827
827
828 cls = type(name, tuple(bases), {})
828 cls = type(name, tuple(bases), {})
829
829
830 return cls(
830 return cls(
831 baseui=baseui,
831 baseui=baseui,
832 ui=ui,
832 ui=ui,
833 origroot=path,
833 origroot=path,
834 wdirvfs=wdirvfs,
834 wdirvfs=wdirvfs,
835 hgvfs=hgvfs,
835 hgvfs=hgvfs,
836 requirements=requirements,
836 requirements=requirements,
837 supportedrequirements=supportedrequirements,
837 supportedrequirements=supportedrequirements,
838 sharedpath=storebasepath,
838 sharedpath=storebasepath,
839 store=store,
839 store=store,
840 cachevfs=cachevfs,
840 cachevfs=cachevfs,
841 wcachevfs=wcachevfs,
841 wcachevfs=wcachevfs,
842 features=features,
842 features=features,
843 intents=intents,
843 intents=intents,
844 )
844 )
845
845
846
846
847 def loadhgrc(ui, wdirvfs, hgvfs, requirements, sharedvfs=None):
847 def loadhgrc(ui, wdirvfs, hgvfs, requirements, sharedvfs=None):
848 """Load hgrc files/content into a ui instance.
848 """Load hgrc files/content into a ui instance.
849
849
850 This is called during repository opening to load any additional
850 This is called during repository opening to load any additional
851 config files or settings relevant to the current repository.
851 config files or settings relevant to the current repository.
852
852
853 Returns a bool indicating whether any additional configs were loaded.
853 Returns a bool indicating whether any additional configs were loaded.
854
854
855 Extensions should monkeypatch this function to modify how per-repo
855 Extensions should monkeypatch this function to modify how per-repo
856 configs are loaded. For example, an extension may wish to pull in
856 configs are loaded. For example, an extension may wish to pull in
857 configs from alternate files or sources.
857 configs from alternate files or sources.
858
858
859 sharedvfs is vfs object pointing to source repo if the current one is a
859 sharedvfs is vfs object pointing to source repo if the current one is a
860 shared one
860 shared one
861 """
861 """
862 if not rcutil.use_repo_hgrc():
862 if not rcutil.use_repo_hgrc():
863 return False
863 return False
864
864
865 ret = False
865 ret = False
866 # first load config from shared source if we has to
866 # first load config from shared source if we has to
867 if requirementsmod.SHARESAFE_REQUIREMENT in requirements and sharedvfs:
867 if requirementsmod.SHARESAFE_REQUIREMENT in requirements and sharedvfs:
868 try:
868 try:
869 ui.readconfig(sharedvfs.join(b'hgrc'), root=sharedvfs.base)
869 ui.readconfig(sharedvfs.join(b'hgrc'), root=sharedvfs.base)
870 ret = True
870 ret = True
871 except IOError:
871 except IOError:
872 pass
872 pass
873
873
874 try:
874 try:
875 ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base)
875 ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base)
876 ret = True
876 ret = True
877 except IOError:
877 except IOError:
878 pass
878 pass
879
879
880 try:
880 try:
881 ui.readconfig(hgvfs.join(b'hgrc-not-shared'), root=wdirvfs.base)
881 ui.readconfig(hgvfs.join(b'hgrc-not-shared'), root=wdirvfs.base)
882 ret = True
882 ret = True
883 except IOError:
883 except IOError:
884 pass
884 pass
885
885
886 return ret
886 return ret
887
887
888
888
889 def afterhgrcload(ui, wdirvfs, hgvfs, requirements):
889 def afterhgrcload(ui, wdirvfs, hgvfs, requirements):
890 """Perform additional actions after .hg/hgrc is loaded.
890 """Perform additional actions after .hg/hgrc is loaded.
891
891
892 This function is called during repository loading immediately after
892 This function is called during repository loading immediately after
893 the .hg/hgrc file is loaded and before per-repo extensions are loaded.
893 the .hg/hgrc file is loaded and before per-repo extensions are loaded.
894
894
895 The function can be used to validate configs, automatically add
895 The function can be used to validate configs, automatically add
896 options (including extensions) based on requirements, etc.
896 options (including extensions) based on requirements, etc.
897 """
897 """
898
898
899 # Map of requirements to list of extensions to load automatically when
899 # Map of requirements to list of extensions to load automatically when
900 # requirement is present.
900 # requirement is present.
901 autoextensions = {
901 autoextensions = {
902 b'git': [b'git'],
902 b'git': [b'git'],
903 b'largefiles': [b'largefiles'],
903 b'largefiles': [b'largefiles'],
904 b'lfs': [b'lfs'],
904 b'lfs': [b'lfs'],
905 }
905 }
906
906
907 for requirement, names in sorted(autoextensions.items()):
907 for requirement, names in sorted(autoextensions.items()):
908 if requirement not in requirements:
908 if requirement not in requirements:
909 continue
909 continue
910
910
911 for name in names:
911 for name in names:
912 if not ui.hasconfig(b'extensions', name):
912 if not ui.hasconfig(b'extensions', name):
913 ui.setconfig(b'extensions', name, b'', source=b'autoload')
913 ui.setconfig(b'extensions', name, b'', source=b'autoload')
914
914
915
915
916 def gathersupportedrequirements(ui):
916 def gathersupportedrequirements(ui):
917 """Determine the complete set of recognized requirements."""
917 """Determine the complete set of recognized requirements."""
918 # Start with all requirements supported by this file.
918 # Start with all requirements supported by this file.
919 supported = set(localrepository._basesupported)
919 supported = set(localrepository._basesupported)
920
920
921 # Execute ``featuresetupfuncs`` entries if they belong to an extension
921 # Execute ``featuresetupfuncs`` entries if they belong to an extension
922 # relevant to this ui instance.
922 # relevant to this ui instance.
923 modules = {m.__name__ for n, m in extensions.extensions(ui)}
923 modules = {m.__name__ for n, m in extensions.extensions(ui)}
924
924
925 for fn in featuresetupfuncs:
925 for fn in featuresetupfuncs:
926 if fn.__module__ in modules:
926 if fn.__module__ in modules:
927 fn(ui, supported)
927 fn(ui, supported)
928
928
929 # Add derived requirements from registered compression engines.
929 # Add derived requirements from registered compression engines.
930 for name in util.compengines:
930 for name in util.compengines:
931 engine = util.compengines[name]
931 engine = util.compengines[name]
932 if engine.available() and engine.revlogheader():
932 if engine.available() and engine.revlogheader():
933 supported.add(b'exp-compression-%s' % name)
933 supported.add(b'exp-compression-%s' % name)
934 if engine.name() == b'zstd':
934 if engine.name() == b'zstd':
935 supported.add(requirementsmod.REVLOG_COMPRESSION_ZSTD)
935 supported.add(requirementsmod.REVLOG_COMPRESSION_ZSTD)
936
936
937 return supported
937 return supported
938
938
939
939
940 def ensurerequirementsrecognized(requirements, supported):
940 def ensurerequirementsrecognized(requirements, supported):
941 """Validate that a set of local requirements is recognized.
941 """Validate that a set of local requirements is recognized.
942
942
943 Receives a set of requirements. Raises an ``error.RepoError`` if there
943 Receives a set of requirements. Raises an ``error.RepoError`` if there
944 exists any requirement in that set that currently loaded code doesn't
944 exists any requirement in that set that currently loaded code doesn't
945 recognize.
945 recognize.
946
946
947 Returns a set of supported requirements.
947 Returns a set of supported requirements.
948 """
948 """
949 missing = set()
949 missing = set()
950
950
951 for requirement in requirements:
951 for requirement in requirements:
952 if requirement in supported:
952 if requirement in supported:
953 continue
953 continue
954
954
955 if not requirement or not requirement[0:1].isalnum():
955 if not requirement or not requirement[0:1].isalnum():
956 raise error.RequirementError(_(b'.hg/requires file is corrupt'))
956 raise error.RequirementError(_(b'.hg/requires file is corrupt'))
957
957
958 missing.add(requirement)
958 missing.add(requirement)
959
959
960 if missing:
960 if missing:
961 raise error.RequirementError(
961 raise error.RequirementError(
962 _(b'repository requires features unknown to this Mercurial: %s')
962 _(b'repository requires features unknown to this Mercurial: %s')
963 % b' '.join(sorted(missing)),
963 % b' '.join(sorted(missing)),
964 hint=_(
964 hint=_(
965 b'see https://mercurial-scm.org/wiki/MissingRequirement '
965 b'see https://mercurial-scm.org/wiki/MissingRequirement '
966 b'for more information'
966 b'for more information'
967 ),
967 ),
968 )
968 )
969
969
970
970
971 def ensurerequirementscompatible(ui, requirements):
971 def ensurerequirementscompatible(ui, requirements):
972 """Validates that a set of recognized requirements is mutually compatible.
972 """Validates that a set of recognized requirements is mutually compatible.
973
973
974 Some requirements may not be compatible with others or require
974 Some requirements may not be compatible with others or require
975 config options that aren't enabled. This function is called during
975 config options that aren't enabled. This function is called during
976 repository opening to ensure that the set of requirements needed
976 repository opening to ensure that the set of requirements needed
977 to open a repository is sane and compatible with config options.
977 to open a repository is sane and compatible with config options.
978
978
979 Extensions can monkeypatch this function to perform additional
979 Extensions can monkeypatch this function to perform additional
980 checking.
980 checking.
981
981
982 ``error.RepoError`` should be raised on failure.
982 ``error.RepoError`` should be raised on failure.
983 """
983 """
984 if (
984 if (
985 requirementsmod.SPARSE_REQUIREMENT in requirements
985 requirementsmod.SPARSE_REQUIREMENT in requirements
986 and not sparse.enabled
986 and not sparse.enabled
987 ):
987 ):
988 raise error.RepoError(
988 raise error.RepoError(
989 _(
989 _(
990 b'repository is using sparse feature but '
990 b'repository is using sparse feature but '
991 b'sparse is not enabled; enable the '
991 b'sparse is not enabled; enable the '
992 b'"sparse" extensions to access'
992 b'"sparse" extensions to access'
993 )
993 )
994 )
994 )
995
995
996
996
997 def makestore(requirements, path, vfstype):
997 def makestore(requirements, path, vfstype):
998 """Construct a storage object for a repository."""
998 """Construct a storage object for a repository."""
999 if requirementsmod.STORE_REQUIREMENT in requirements:
999 if requirementsmod.STORE_REQUIREMENT in requirements:
1000 if requirementsmod.FNCACHE_REQUIREMENT in requirements:
1000 if requirementsmod.FNCACHE_REQUIREMENT in requirements:
1001 dotencode = requirementsmod.DOTENCODE_REQUIREMENT in requirements
1001 dotencode = requirementsmod.DOTENCODE_REQUIREMENT in requirements
1002 return storemod.fncachestore(path, vfstype, dotencode)
1002 return storemod.fncachestore(path, vfstype, dotencode)
1003
1003
1004 return storemod.encodedstore(path, vfstype)
1004 return storemod.encodedstore(path, vfstype)
1005
1005
1006 return storemod.basicstore(path, vfstype)
1006 return storemod.basicstore(path, vfstype)
1007
1007
1008
1008
1009 def resolvestorevfsoptions(ui, requirements, features):
1009 def resolvestorevfsoptions(ui, requirements, features):
1010 """Resolve the options to pass to the store vfs opener.
1010 """Resolve the options to pass to the store vfs opener.
1011
1011
1012 The returned dict is used to influence behavior of the storage layer.
1012 The returned dict is used to influence behavior of the storage layer.
1013 """
1013 """
1014 options = {}
1014 options = {}
1015
1015
1016 if requirementsmod.TREEMANIFEST_REQUIREMENT in requirements:
1016 if requirementsmod.TREEMANIFEST_REQUIREMENT in requirements:
1017 options[b'treemanifest'] = True
1017 options[b'treemanifest'] = True
1018
1018
1019 # experimental config: format.manifestcachesize
1019 # experimental config: format.manifestcachesize
1020 manifestcachesize = ui.configint(b'format', b'manifestcachesize')
1020 manifestcachesize = ui.configint(b'format', b'manifestcachesize')
1021 if manifestcachesize is not None:
1021 if manifestcachesize is not None:
1022 options[b'manifestcachesize'] = manifestcachesize
1022 options[b'manifestcachesize'] = manifestcachesize
1023
1023
1024 # In the absence of another requirement superseding a revlog-related
1024 # In the absence of another requirement superseding a revlog-related
1025 # requirement, we have to assume the repo is using revlog version 0.
1025 # requirement, we have to assume the repo is using revlog version 0.
1026 # This revlog format is super old and we don't bother trying to parse
1026 # This revlog format is super old and we don't bother trying to parse
1027 # opener options for it because those options wouldn't do anything
1027 # opener options for it because those options wouldn't do anything
1028 # meaningful on such old repos.
1028 # meaningful on such old repos.
1029 if (
1029 if (
1030 requirementsmod.REVLOGV1_REQUIREMENT in requirements
1030 requirementsmod.REVLOGV1_REQUIREMENT in requirements
1031 or requirementsmod.REVLOGV2_REQUIREMENT in requirements
1031 or requirementsmod.REVLOGV2_REQUIREMENT in requirements
1032 ):
1032 ):
1033 options.update(resolverevlogstorevfsoptions(ui, requirements, features))
1033 options.update(resolverevlogstorevfsoptions(ui, requirements, features))
1034 else: # explicitly mark repo as using revlogv0
1034 else: # explicitly mark repo as using revlogv0
1035 options[b'revlogv0'] = True
1035 options[b'revlogv0'] = True
1036
1036
1037 if requirementsmod.COPIESSDC_REQUIREMENT in requirements:
1037 if requirementsmod.COPIESSDC_REQUIREMENT in requirements:
1038 options[b'copies-storage'] = b'changeset-sidedata'
1038 options[b'copies-storage'] = b'changeset-sidedata'
1039 else:
1039 else:
1040 writecopiesto = ui.config(b'experimental', b'copies.write-to')
1040 writecopiesto = ui.config(b'experimental', b'copies.write-to')
1041 copiesextramode = (b'changeset-only', b'compatibility')
1041 copiesextramode = (b'changeset-only', b'compatibility')
1042 if writecopiesto in copiesextramode:
1042 if writecopiesto in copiesextramode:
1043 options[b'copies-storage'] = b'extra'
1043 options[b'copies-storage'] = b'extra'
1044
1044
1045 return options
1045 return options
1046
1046
1047
1047
1048 def resolverevlogstorevfsoptions(ui, requirements, features):
1048 def resolverevlogstorevfsoptions(ui, requirements, features):
1049 """Resolve opener options specific to revlogs."""
1049 """Resolve opener options specific to revlogs."""
1050
1050
1051 options = {}
1051 options = {}
1052 options[b'flagprocessors'] = {}
1052 options[b'flagprocessors'] = {}
1053
1053
1054 if requirementsmod.REVLOGV1_REQUIREMENT in requirements:
1054 if requirementsmod.REVLOGV1_REQUIREMENT in requirements:
1055 options[b'revlogv1'] = True
1055 options[b'revlogv1'] = True
1056 if requirementsmod.REVLOGV2_REQUIREMENT in requirements:
1056 if requirementsmod.REVLOGV2_REQUIREMENT in requirements:
1057 options[b'revlogv2'] = True
1057 options[b'revlogv2'] = True
1058 if requirementsmod.CHANGELOGV2_REQUIREMENT in requirements:
1058 if requirementsmod.CHANGELOGV2_REQUIREMENT in requirements:
1059 options[b'changelogv2'] = True
1059 options[b'changelogv2'] = True
1060
1060
1061 if requirementsmod.GENERALDELTA_REQUIREMENT in requirements:
1061 if requirementsmod.GENERALDELTA_REQUIREMENT in requirements:
1062 options[b'generaldelta'] = True
1062 options[b'generaldelta'] = True
1063
1063
1064 # experimental config: format.chunkcachesize
1064 # experimental config: format.chunkcachesize
1065 chunkcachesize = ui.configint(b'format', b'chunkcachesize')
1065 chunkcachesize = ui.configint(b'format', b'chunkcachesize')
1066 if chunkcachesize is not None:
1066 if chunkcachesize is not None:
1067 options[b'chunkcachesize'] = chunkcachesize
1067 options[b'chunkcachesize'] = chunkcachesize
1068
1068
1069 deltabothparents = ui.configbool(
1069 deltabothparents = ui.configbool(
1070 b'storage', b'revlog.optimize-delta-parent-choice'
1070 b'storage', b'revlog.optimize-delta-parent-choice'
1071 )
1071 )
1072 options[b'deltabothparents'] = deltabothparents
1072 options[b'deltabothparents'] = deltabothparents
1073
1073
1074 issue6528 = ui.configbool(b'storage', b'revlog.issue6528.fix-incoming')
1074 issue6528 = ui.configbool(b'storage', b'revlog.issue6528.fix-incoming')
1075 options[b'issue6528.fix-incoming'] = issue6528
1075 options[b'issue6528.fix-incoming'] = issue6528
1076
1076
1077 lazydelta = ui.configbool(b'storage', b'revlog.reuse-external-delta')
1077 lazydelta = ui.configbool(b'storage', b'revlog.reuse-external-delta')
1078 lazydeltabase = False
1078 lazydeltabase = False
1079 if lazydelta:
1079 if lazydelta:
1080 lazydeltabase = ui.configbool(
1080 lazydeltabase = ui.configbool(
1081 b'storage', b'revlog.reuse-external-delta-parent'
1081 b'storage', b'revlog.reuse-external-delta-parent'
1082 )
1082 )
1083 if lazydeltabase is None:
1083 if lazydeltabase is None:
1084 lazydeltabase = not scmutil.gddeltaconfig(ui)
1084 lazydeltabase = not scmutil.gddeltaconfig(ui)
1085 options[b'lazydelta'] = lazydelta
1085 options[b'lazydelta'] = lazydelta
1086 options[b'lazydeltabase'] = lazydeltabase
1086 options[b'lazydeltabase'] = lazydeltabase
1087
1087
1088 chainspan = ui.configbytes(b'experimental', b'maxdeltachainspan')
1088 chainspan = ui.configbytes(b'experimental', b'maxdeltachainspan')
1089 if 0 <= chainspan:
1089 if 0 <= chainspan:
1090 options[b'maxdeltachainspan'] = chainspan
1090 options[b'maxdeltachainspan'] = chainspan
1091
1091
1092 mmapindexthreshold = ui.configbytes(b'experimental', b'mmapindexthreshold')
1092 mmapindexthreshold = ui.configbytes(b'experimental', b'mmapindexthreshold')
1093 if mmapindexthreshold is not None:
1093 if mmapindexthreshold is not None:
1094 options[b'mmapindexthreshold'] = mmapindexthreshold
1094 options[b'mmapindexthreshold'] = mmapindexthreshold
1095
1095
1096 withsparseread = ui.configbool(b'experimental', b'sparse-read')
1096 withsparseread = ui.configbool(b'experimental', b'sparse-read')
1097 srdensitythres = float(
1097 srdensitythres = float(
1098 ui.config(b'experimental', b'sparse-read.density-threshold')
1098 ui.config(b'experimental', b'sparse-read.density-threshold')
1099 )
1099 )
1100 srmingapsize = ui.configbytes(b'experimental', b'sparse-read.min-gap-size')
1100 srmingapsize = ui.configbytes(b'experimental', b'sparse-read.min-gap-size')
1101 options[b'with-sparse-read'] = withsparseread
1101 options[b'with-sparse-read'] = withsparseread
1102 options[b'sparse-read-density-threshold'] = srdensitythres
1102 options[b'sparse-read-density-threshold'] = srdensitythres
1103 options[b'sparse-read-min-gap-size'] = srmingapsize
1103 options[b'sparse-read-min-gap-size'] = srmingapsize
1104
1104
1105 sparserevlog = requirementsmod.SPARSEREVLOG_REQUIREMENT in requirements
1105 sparserevlog = requirementsmod.SPARSEREVLOG_REQUIREMENT in requirements
1106 options[b'sparse-revlog'] = sparserevlog
1106 options[b'sparse-revlog'] = sparserevlog
1107 if sparserevlog:
1107 if sparserevlog:
1108 options[b'generaldelta'] = True
1108 options[b'generaldelta'] = True
1109
1109
1110 maxchainlen = None
1110 maxchainlen = None
1111 if sparserevlog:
1111 if sparserevlog:
1112 maxchainlen = revlogconst.SPARSE_REVLOG_MAX_CHAIN_LENGTH
1112 maxchainlen = revlogconst.SPARSE_REVLOG_MAX_CHAIN_LENGTH
1113 # experimental config: format.maxchainlen
1113 # experimental config: format.maxchainlen
1114 maxchainlen = ui.configint(b'format', b'maxchainlen', maxchainlen)
1114 maxchainlen = ui.configint(b'format', b'maxchainlen', maxchainlen)
1115 if maxchainlen is not None:
1115 if maxchainlen is not None:
1116 options[b'maxchainlen'] = maxchainlen
1116 options[b'maxchainlen'] = maxchainlen
1117
1117
1118 for r in requirements:
1118 for r in requirements:
1119 # we allow multiple compression engine requirement to co-exist because
1119 # we allow multiple compression engine requirement to co-exist because
1120 # strickly speaking, revlog seems to support mixed compression style.
1120 # strickly speaking, revlog seems to support mixed compression style.
1121 #
1121 #
1122 # The compression used for new entries will be "the last one"
1122 # The compression used for new entries will be "the last one"
1123 prefix = r.startswith
1123 prefix = r.startswith
1124 if prefix(b'revlog-compression-') or prefix(b'exp-compression-'):
1124 if prefix(b'revlog-compression-') or prefix(b'exp-compression-'):
1125 options[b'compengine'] = r.split(b'-', 2)[2]
1125 options[b'compengine'] = r.split(b'-', 2)[2]
1126
1126
1127 options[b'zlib.level'] = ui.configint(b'storage', b'revlog.zlib.level')
1127 options[b'zlib.level'] = ui.configint(b'storage', b'revlog.zlib.level')
1128 if options[b'zlib.level'] is not None:
1128 if options[b'zlib.level'] is not None:
1129 if not (0 <= options[b'zlib.level'] <= 9):
1129 if not (0 <= options[b'zlib.level'] <= 9):
1130 msg = _(b'invalid value for `storage.revlog.zlib.level` config: %d')
1130 msg = _(b'invalid value for `storage.revlog.zlib.level` config: %d')
1131 raise error.Abort(msg % options[b'zlib.level'])
1131 raise error.Abort(msg % options[b'zlib.level'])
1132 options[b'zstd.level'] = ui.configint(b'storage', b'revlog.zstd.level')
1132 options[b'zstd.level'] = ui.configint(b'storage', b'revlog.zstd.level')
1133 if options[b'zstd.level'] is not None:
1133 if options[b'zstd.level'] is not None:
1134 if not (0 <= options[b'zstd.level'] <= 22):
1134 if not (0 <= options[b'zstd.level'] <= 22):
1135 msg = _(b'invalid value for `storage.revlog.zstd.level` config: %d')
1135 msg = _(b'invalid value for `storage.revlog.zstd.level` config: %d')
1136 raise error.Abort(msg % options[b'zstd.level'])
1136 raise error.Abort(msg % options[b'zstd.level'])
1137
1137
1138 if requirementsmod.NARROW_REQUIREMENT in requirements:
1138 if requirementsmod.NARROW_REQUIREMENT in requirements:
1139 options[b'enableellipsis'] = True
1139 options[b'enableellipsis'] = True
1140
1140
1141 if ui.configbool(b'experimental', b'rust.index'):
1141 if ui.configbool(b'experimental', b'rust.index'):
1142 options[b'rust.index'] = True
1142 options[b'rust.index'] = True
1143 if requirementsmod.NODEMAP_REQUIREMENT in requirements:
1143 if requirementsmod.NODEMAP_REQUIREMENT in requirements:
1144 slow_path = ui.config(
1144 slow_path = ui.config(
1145 b'storage', b'revlog.persistent-nodemap.slow-path'
1145 b'storage', b'revlog.persistent-nodemap.slow-path'
1146 )
1146 )
1147 if slow_path not in (b'allow', b'warn', b'abort'):
1147 if slow_path not in (b'allow', b'warn', b'abort'):
1148 default = ui.config_default(
1148 default = ui.config_default(
1149 b'storage', b'revlog.persistent-nodemap.slow-path'
1149 b'storage', b'revlog.persistent-nodemap.slow-path'
1150 )
1150 )
1151 msg = _(
1151 msg = _(
1152 b'unknown value for config '
1152 b'unknown value for config '
1153 b'"storage.revlog.persistent-nodemap.slow-path": "%s"\n'
1153 b'"storage.revlog.persistent-nodemap.slow-path": "%s"\n'
1154 )
1154 )
1155 ui.warn(msg % slow_path)
1155 ui.warn(msg % slow_path)
1156 if not ui.quiet:
1156 if not ui.quiet:
1157 ui.warn(_(b'falling back to default value: %s\n') % default)
1157 ui.warn(_(b'falling back to default value: %s\n') % default)
1158 slow_path = default
1158 slow_path = default
1159
1159
1160 msg = _(
1160 msg = _(
1161 b"accessing `persistent-nodemap` repository without associated "
1161 b"accessing `persistent-nodemap` repository without associated "
1162 b"fast implementation."
1162 b"fast implementation."
1163 )
1163 )
1164 hint = _(
1164 hint = _(
1165 b"check `hg help config.format.use-persistent-nodemap` "
1165 b"check `hg help config.format.use-persistent-nodemap` "
1166 b"for details"
1166 b"for details"
1167 )
1167 )
1168 if not revlog.HAS_FAST_PERSISTENT_NODEMAP:
1168 if not revlog.HAS_FAST_PERSISTENT_NODEMAP:
1169 if slow_path == b'warn':
1169 if slow_path == b'warn':
1170 msg = b"warning: " + msg + b'\n'
1170 msg = b"warning: " + msg + b'\n'
1171 ui.warn(msg)
1171 ui.warn(msg)
1172 if not ui.quiet:
1172 if not ui.quiet:
1173 hint = b'(' + hint + b')\n'
1173 hint = b'(' + hint + b')\n'
1174 ui.warn(hint)
1174 ui.warn(hint)
1175 if slow_path == b'abort':
1175 if slow_path == b'abort':
1176 raise error.Abort(msg, hint=hint)
1176 raise error.Abort(msg, hint=hint)
1177 options[b'persistent-nodemap'] = True
1177 options[b'persistent-nodemap'] = True
1178 if requirementsmod.DIRSTATE_V2_REQUIREMENT in requirements:
1178 if requirementsmod.DIRSTATE_V2_REQUIREMENT in requirements:
1179 slow_path = ui.config(b'storage', b'dirstate-v2.slow-path')
1179 slow_path = ui.config(b'storage', b'dirstate-v2.slow-path')
1180 if slow_path not in (b'allow', b'warn', b'abort'):
1180 if slow_path not in (b'allow', b'warn', b'abort'):
1181 default = ui.config_default(b'storage', b'dirstate-v2.slow-path')
1181 default = ui.config_default(b'storage', b'dirstate-v2.slow-path')
1182 msg = _(b'unknown value for config "dirstate-v2.slow-path": "%s"\n')
1182 msg = _(b'unknown value for config "dirstate-v2.slow-path": "%s"\n')
1183 ui.warn(msg % slow_path)
1183 ui.warn(msg % slow_path)
1184 if not ui.quiet:
1184 if not ui.quiet:
1185 ui.warn(_(b'falling back to default value: %s\n') % default)
1185 ui.warn(_(b'falling back to default value: %s\n') % default)
1186 slow_path = default
1186 slow_path = default
1187
1187
1188 msg = _(
1188 msg = _(
1189 b"accessing `dirstate-v2` repository without associated "
1189 b"accessing `dirstate-v2` repository without associated "
1190 b"fast implementation."
1190 b"fast implementation."
1191 )
1191 )
1192 hint = _(
1192 hint = _(
1193 b"check `hg help config.format.use-dirstate-v2` " b"for details"
1193 b"check `hg help config.format.use-dirstate-v2` " b"for details"
1194 )
1194 )
1195 if not dirstate.HAS_FAST_DIRSTATE_V2:
1195 if not dirstate.HAS_FAST_DIRSTATE_V2:
1196 if slow_path == b'warn':
1196 if slow_path == b'warn':
1197 msg = b"warning: " + msg + b'\n'
1197 msg = b"warning: " + msg + b'\n'
1198 ui.warn(msg)
1198 ui.warn(msg)
1199 if not ui.quiet:
1199 if not ui.quiet:
1200 hint = b'(' + hint + b')\n'
1200 hint = b'(' + hint + b')\n'
1201 ui.warn(hint)
1201 ui.warn(hint)
1202 if slow_path == b'abort':
1202 if slow_path == b'abort':
1203 raise error.Abort(msg, hint=hint)
1203 raise error.Abort(msg, hint=hint)
1204 if ui.configbool(b'storage', b'revlog.persistent-nodemap.mmap'):
1204 if ui.configbool(b'storage', b'revlog.persistent-nodemap.mmap'):
1205 options[b'persistent-nodemap.mmap'] = True
1205 options[b'persistent-nodemap.mmap'] = True
1206 if ui.configbool(b'devel', b'persistent-nodemap'):
1206 if ui.configbool(b'devel', b'persistent-nodemap'):
1207 options[b'devel-force-nodemap'] = True
1207 options[b'devel-force-nodemap'] = True
1208
1208
1209 return options
1209 return options
1210
1210
1211
1211
1212 def makemain(**kwargs):
1212 def makemain(**kwargs):
1213 """Produce a type conforming to ``ilocalrepositorymain``."""
1213 """Produce a type conforming to ``ilocalrepositorymain``."""
1214 return localrepository
1214 return localrepository
1215
1215
1216
1216
1217 @interfaceutil.implementer(repository.ilocalrepositoryfilestorage)
1217 @interfaceutil.implementer(repository.ilocalrepositoryfilestorage)
1218 class revlogfilestorage(object):
1218 class revlogfilestorage(object):
1219 """File storage when using revlogs."""
1219 """File storage when using revlogs."""
1220
1220
1221 def file(self, path):
1221 def file(self, path):
1222 if path.startswith(b'/'):
1222 if path.startswith(b'/'):
1223 path = path[1:]
1223 path = path[1:]
1224
1224
1225 return filelog.filelog(self.svfs, path)
1225 return filelog.filelog(self.svfs, path)
1226
1226
1227
1227
1228 @interfaceutil.implementer(repository.ilocalrepositoryfilestorage)
1228 @interfaceutil.implementer(repository.ilocalrepositoryfilestorage)
1229 class revlognarrowfilestorage(object):
1229 class revlognarrowfilestorage(object):
1230 """File storage when using revlogs and narrow files."""
1230 """File storage when using revlogs and narrow files."""
1231
1231
1232 def file(self, path):
1232 def file(self, path):
1233 if path.startswith(b'/'):
1233 if path.startswith(b'/'):
1234 path = path[1:]
1234 path = path[1:]
1235
1235
1236 return filelog.narrowfilelog(self.svfs, path, self._storenarrowmatch)
1236 return filelog.narrowfilelog(self.svfs, path, self._storenarrowmatch)
1237
1237
1238
1238
1239 def makefilestorage(requirements, features, **kwargs):
1239 def makefilestorage(requirements, features, **kwargs):
1240 """Produce a type conforming to ``ilocalrepositoryfilestorage``."""
1240 """Produce a type conforming to ``ilocalrepositoryfilestorage``."""
1241 features.add(repository.REPO_FEATURE_REVLOG_FILE_STORAGE)
1241 features.add(repository.REPO_FEATURE_REVLOG_FILE_STORAGE)
1242 features.add(repository.REPO_FEATURE_STREAM_CLONE)
1242 features.add(repository.REPO_FEATURE_STREAM_CLONE)
1243
1243
1244 if requirementsmod.NARROW_REQUIREMENT in requirements:
1244 if requirementsmod.NARROW_REQUIREMENT in requirements:
1245 return revlognarrowfilestorage
1245 return revlognarrowfilestorage
1246 else:
1246 else:
1247 return revlogfilestorage
1247 return revlogfilestorage
1248
1248
1249
1249
1250 # List of repository interfaces and factory functions for them. Each
1250 # List of repository interfaces and factory functions for them. Each
1251 # will be called in order during ``makelocalrepository()`` to iteratively
1251 # will be called in order during ``makelocalrepository()`` to iteratively
1252 # derive the final type for a local repository instance. We capture the
1252 # derive the final type for a local repository instance. We capture the
1253 # function as a lambda so we don't hold a reference and the module-level
1253 # function as a lambda so we don't hold a reference and the module-level
1254 # functions can be wrapped.
1254 # functions can be wrapped.
1255 REPO_INTERFACES = [
1255 REPO_INTERFACES = [
1256 (repository.ilocalrepositorymain, lambda: makemain),
1256 (repository.ilocalrepositorymain, lambda: makemain),
1257 (repository.ilocalrepositoryfilestorage, lambda: makefilestorage),
1257 (repository.ilocalrepositoryfilestorage, lambda: makefilestorage),
1258 ]
1258 ]
1259
1259
1260
1260
1261 @interfaceutil.implementer(repository.ilocalrepositorymain)
1261 @interfaceutil.implementer(repository.ilocalrepositorymain)
1262 class localrepository(object):
1262 class localrepository(object):
1263 """Main class for representing local repositories.
1263 """Main class for representing local repositories.
1264
1264
1265 All local repositories are instances of this class.
1265 All local repositories are instances of this class.
1266
1266
1267 Constructed on its own, instances of this class are not usable as
1267 Constructed on its own, instances of this class are not usable as
1268 repository objects. To obtain a usable repository object, call
1268 repository objects. To obtain a usable repository object, call
1269 ``hg.repository()``, ``localrepo.instance()``, or
1269 ``hg.repository()``, ``localrepo.instance()``, or
1270 ``localrepo.makelocalrepository()``. The latter is the lowest-level.
1270 ``localrepo.makelocalrepository()``. The latter is the lowest-level.
1271 ``instance()`` adds support for creating new repositories.
1271 ``instance()`` adds support for creating new repositories.
1272 ``hg.repository()`` adds more extension integration, including calling
1272 ``hg.repository()`` adds more extension integration, including calling
1273 ``reposetup()``. Generally speaking, ``hg.repository()`` should be
1273 ``reposetup()``. Generally speaking, ``hg.repository()`` should be
1274 used.
1274 used.
1275 """
1275 """
1276
1276
1277 _basesupported = {
1277 _basesupported = {
1278 requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT,
1278 requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT,
1279 requirementsmod.CHANGELOGV2_REQUIREMENT,
1279 requirementsmod.CHANGELOGV2_REQUIREMENT,
1280 requirementsmod.COPIESSDC_REQUIREMENT,
1280 requirementsmod.COPIESSDC_REQUIREMENT,
1281 requirementsmod.DIRSTATE_TRACKED_KEY_V1,
1281 requirementsmod.DIRSTATE_TRACKED_KEY_V1,
1282 requirementsmod.DIRSTATE_V2_REQUIREMENT,
1282 requirementsmod.DIRSTATE_V2_REQUIREMENT,
1283 requirementsmod.DOTENCODE_REQUIREMENT,
1283 requirementsmod.DOTENCODE_REQUIREMENT,
1284 requirementsmod.FNCACHE_REQUIREMENT,
1284 requirementsmod.FNCACHE_REQUIREMENT,
1285 requirementsmod.GENERALDELTA_REQUIREMENT,
1285 requirementsmod.GENERALDELTA_REQUIREMENT,
1286 requirementsmod.INTERNAL_PHASE_REQUIREMENT,
1286 requirementsmod.INTERNAL_PHASE_REQUIREMENT,
1287 requirementsmod.NODEMAP_REQUIREMENT,
1287 requirementsmod.NODEMAP_REQUIREMENT,
1288 requirementsmod.RELATIVE_SHARED_REQUIREMENT,
1288 requirementsmod.RELATIVE_SHARED_REQUIREMENT,
1289 requirementsmod.REVLOGV1_REQUIREMENT,
1289 requirementsmod.REVLOGV1_REQUIREMENT,
1290 requirementsmod.REVLOGV2_REQUIREMENT,
1290 requirementsmod.REVLOGV2_REQUIREMENT,
1291 requirementsmod.SHARED_REQUIREMENT,
1291 requirementsmod.SHARED_REQUIREMENT,
1292 requirementsmod.SHARESAFE_REQUIREMENT,
1292 requirementsmod.SHARESAFE_REQUIREMENT,
1293 requirementsmod.SPARSE_REQUIREMENT,
1293 requirementsmod.SPARSE_REQUIREMENT,
1294 requirementsmod.SPARSEREVLOG_REQUIREMENT,
1294 requirementsmod.SPARSEREVLOG_REQUIREMENT,
1295 requirementsmod.STORE_REQUIREMENT,
1295 requirementsmod.STORE_REQUIREMENT,
1296 requirementsmod.TREEMANIFEST_REQUIREMENT,
1296 requirementsmod.TREEMANIFEST_REQUIREMENT,
1297 }
1297 }
1298
1298
1299 # list of prefix for file which can be written without 'wlock'
1299 # list of prefix for file which can be written without 'wlock'
1300 # Extensions should extend this list when needed
1300 # Extensions should extend this list when needed
1301 _wlockfreeprefix = {
1301 _wlockfreeprefix = {
1302 # We migh consider requiring 'wlock' for the next
1302 # We migh consider requiring 'wlock' for the next
1303 # two, but pretty much all the existing code assume
1303 # two, but pretty much all the existing code assume
1304 # wlock is not needed so we keep them excluded for
1304 # wlock is not needed so we keep them excluded for
1305 # now.
1305 # now.
1306 b'hgrc',
1306 b'hgrc',
1307 b'requires',
1307 b'requires',
1308 # XXX cache is a complicatged business someone
1308 # XXX cache is a complicatged business someone
1309 # should investigate this in depth at some point
1309 # should investigate this in depth at some point
1310 b'cache/',
1310 b'cache/',
1311 # XXX shouldn't be dirstate covered by the wlock?
1311 # XXX shouldn't be dirstate covered by the wlock?
1312 b'dirstate',
1312 b'dirstate',
1313 # XXX bisect was still a bit too messy at the time
1313 # XXX bisect was still a bit too messy at the time
1314 # this changeset was introduced. Someone should fix
1314 # this changeset was introduced. Someone should fix
1315 # the remainig bit and drop this line
1315 # the remainig bit and drop this line
1316 b'bisect.state',
1316 b'bisect.state',
1317 }
1317 }
1318
1318
1319 def __init__(
1319 def __init__(
1320 self,
1320 self,
1321 baseui,
1321 baseui,
1322 ui,
1322 ui,
1323 origroot,
1323 origroot,
1324 wdirvfs,
1324 wdirvfs,
1325 hgvfs,
1325 hgvfs,
1326 requirements,
1326 requirements,
1327 supportedrequirements,
1327 supportedrequirements,
1328 sharedpath,
1328 sharedpath,
1329 store,
1329 store,
1330 cachevfs,
1330 cachevfs,
1331 wcachevfs,
1331 wcachevfs,
1332 features,
1332 features,
1333 intents=None,
1333 intents=None,
1334 ):
1334 ):
1335 """Create a new local repository instance.
1335 """Create a new local repository instance.
1336
1336
1337 Most callers should use ``hg.repository()``, ``localrepo.instance()``,
1337 Most callers should use ``hg.repository()``, ``localrepo.instance()``,
1338 or ``localrepo.makelocalrepository()`` for obtaining a new repository
1338 or ``localrepo.makelocalrepository()`` for obtaining a new repository
1339 object.
1339 object.
1340
1340
1341 Arguments:
1341 Arguments:
1342
1342
1343 baseui
1343 baseui
1344 ``ui.ui`` instance that ``ui`` argument was based off of.
1344 ``ui.ui`` instance that ``ui`` argument was based off of.
1345
1345
1346 ui
1346 ui
1347 ``ui.ui`` instance for use by the repository.
1347 ``ui.ui`` instance for use by the repository.
1348
1348
1349 origroot
1349 origroot
1350 ``bytes`` path to working directory root of this repository.
1350 ``bytes`` path to working directory root of this repository.
1351
1351
1352 wdirvfs
1352 wdirvfs
1353 ``vfs.vfs`` rooted at the working directory.
1353 ``vfs.vfs`` rooted at the working directory.
1354
1354
1355 hgvfs
1355 hgvfs
1356 ``vfs.vfs`` rooted at .hg/
1356 ``vfs.vfs`` rooted at .hg/
1357
1357
1358 requirements
1358 requirements
1359 ``set`` of bytestrings representing repository opening requirements.
1359 ``set`` of bytestrings representing repository opening requirements.
1360
1360
1361 supportedrequirements
1361 supportedrequirements
1362 ``set`` of bytestrings representing repository requirements that we
1362 ``set`` of bytestrings representing repository requirements that we
1363 know how to open. May be a supetset of ``requirements``.
1363 know how to open. May be a supetset of ``requirements``.
1364
1364
1365 sharedpath
1365 sharedpath
1366 ``bytes`` Defining path to storage base directory. Points to a
1366 ``bytes`` Defining path to storage base directory. Points to a
1367 ``.hg/`` directory somewhere.
1367 ``.hg/`` directory somewhere.
1368
1368
1369 store
1369 store
1370 ``store.basicstore`` (or derived) instance providing access to
1370 ``store.basicstore`` (or derived) instance providing access to
1371 versioned storage.
1371 versioned storage.
1372
1372
1373 cachevfs
1373 cachevfs
1374 ``vfs.vfs`` used for cache files.
1374 ``vfs.vfs`` used for cache files.
1375
1375
1376 wcachevfs
1376 wcachevfs
1377 ``vfs.vfs`` used for cache files related to the working copy.
1377 ``vfs.vfs`` used for cache files related to the working copy.
1378
1378
1379 features
1379 features
1380 ``set`` of bytestrings defining features/capabilities of this
1380 ``set`` of bytestrings defining features/capabilities of this
1381 instance.
1381 instance.
1382
1382
1383 intents
1383 intents
1384 ``set`` of system strings indicating what this repo will be used
1384 ``set`` of system strings indicating what this repo will be used
1385 for.
1385 for.
1386 """
1386 """
1387 self.baseui = baseui
1387 self.baseui = baseui
1388 self.ui = ui
1388 self.ui = ui
1389 self.origroot = origroot
1389 self.origroot = origroot
1390 # vfs rooted at working directory.
1390 # vfs rooted at working directory.
1391 self.wvfs = wdirvfs
1391 self.wvfs = wdirvfs
1392 self.root = wdirvfs.base
1392 self.root = wdirvfs.base
1393 # vfs rooted at .hg/. Used to access most non-store paths.
1393 # vfs rooted at .hg/. Used to access most non-store paths.
1394 self.vfs = hgvfs
1394 self.vfs = hgvfs
1395 self.path = hgvfs.base
1395 self.path = hgvfs.base
1396 self.requirements = requirements
1396 self.requirements = requirements
1397 self.nodeconstants = sha1nodeconstants
1397 self.nodeconstants = sha1nodeconstants
1398 self.nullid = self.nodeconstants.nullid
1398 self.nullid = self.nodeconstants.nullid
1399 self.supported = supportedrequirements
1399 self.supported = supportedrequirements
1400 self.sharedpath = sharedpath
1400 self.sharedpath = sharedpath
1401 self.store = store
1401 self.store = store
1402 self.cachevfs = cachevfs
1402 self.cachevfs = cachevfs
1403 self.wcachevfs = wcachevfs
1403 self.wcachevfs = wcachevfs
1404 self.features = features
1404 self.features = features
1405
1405
1406 self.filtername = None
1406 self.filtername = None
1407
1407
1408 if self.ui.configbool(b'devel', b'all-warnings') or self.ui.configbool(
1408 if self.ui.configbool(b'devel', b'all-warnings') or self.ui.configbool(
1409 b'devel', b'check-locks'
1409 b'devel', b'check-locks'
1410 ):
1410 ):
1411 self.vfs.audit = self._getvfsward(self.vfs.audit)
1411 self.vfs.audit = self._getvfsward(self.vfs.audit)
1412 # A list of callback to shape the phase if no data were found.
1412 # A list of callback to shape the phase if no data were found.
1413 # Callback are in the form: func(repo, roots) --> processed root.
1413 # Callback are in the form: func(repo, roots) --> processed root.
1414 # This list it to be filled by extension during repo setup
1414 # This list it to be filled by extension during repo setup
1415 self._phasedefaults = []
1415 self._phasedefaults = []
1416
1416
1417 color.setup(self.ui)
1417 color.setup(self.ui)
1418
1418
1419 self.spath = self.store.path
1419 self.spath = self.store.path
1420 self.svfs = self.store.vfs
1420 self.svfs = self.store.vfs
1421 self.sjoin = self.store.join
1421 self.sjoin = self.store.join
1422 if self.ui.configbool(b'devel', b'all-warnings') or self.ui.configbool(
1422 if self.ui.configbool(b'devel', b'all-warnings') or self.ui.configbool(
1423 b'devel', b'check-locks'
1423 b'devel', b'check-locks'
1424 ):
1424 ):
1425 if util.safehasattr(self.svfs, b'vfs'): # this is filtervfs
1425 if util.safehasattr(self.svfs, b'vfs'): # this is filtervfs
1426 self.svfs.vfs.audit = self._getsvfsward(self.svfs.vfs.audit)
1426 self.svfs.vfs.audit = self._getsvfsward(self.svfs.vfs.audit)
1427 else: # standard vfs
1427 else: # standard vfs
1428 self.svfs.audit = self._getsvfsward(self.svfs.audit)
1428 self.svfs.audit = self._getsvfsward(self.svfs.audit)
1429
1429
1430 self._dirstatevalidatewarned = False
1430 self._dirstatevalidatewarned = False
1431
1431
1432 self._branchcaches = branchmap.BranchMapCache()
1432 self._branchcaches = branchmap.BranchMapCache()
1433 self._revbranchcache = None
1433 self._revbranchcache = None
1434 self._filterpats = {}
1434 self._filterpats = {}
1435 self._datafilters = {}
1435 self._datafilters = {}
1436 self._transref = self._lockref = self._wlockref = None
1436 self._transref = self._lockref = self._wlockref = None
1437
1437
1438 # A cache for various files under .hg/ that tracks file changes,
1438 # A cache for various files under .hg/ that tracks file changes,
1439 # (used by the filecache decorator)
1439 # (used by the filecache decorator)
1440 #
1440 #
1441 # Maps a property name to its util.filecacheentry
1441 # Maps a property name to its util.filecacheentry
1442 self._filecache = {}
1442 self._filecache = {}
1443
1443
1444 # hold sets of revision to be filtered
1444 # hold sets of revision to be filtered
1445 # should be cleared when something might have changed the filter value:
1445 # should be cleared when something might have changed the filter value:
1446 # - new changesets,
1446 # - new changesets,
1447 # - phase change,
1447 # - phase change,
1448 # - new obsolescence marker,
1448 # - new obsolescence marker,
1449 # - working directory parent change,
1449 # - working directory parent change,
1450 # - bookmark changes
1450 # - bookmark changes
1451 self.filteredrevcache = {}
1451 self.filteredrevcache = {}
1452
1452
1453 # post-dirstate-status hooks
1453 # post-dirstate-status hooks
1454 self._postdsstatus = []
1454 self._postdsstatus = []
1455
1455
1456 # generic mapping between names and nodes
1456 # generic mapping between names and nodes
1457 self.names = namespaces.namespaces()
1457 self.names = namespaces.namespaces()
1458
1458
1459 # Key to signature value.
1459 # Key to signature value.
1460 self._sparsesignaturecache = {}
1460 self._sparsesignaturecache = {}
1461 # Signature to cached matcher instance.
1461 # Signature to cached matcher instance.
1462 self._sparsematchercache = {}
1462 self._sparsematchercache = {}
1463
1463
1464 self._extrafilterid = repoview.extrafilter(ui)
1464 self._extrafilterid = repoview.extrafilter(ui)
1465
1465
1466 self.filecopiesmode = None
1466 self.filecopiesmode = None
1467 if requirementsmod.COPIESSDC_REQUIREMENT in self.requirements:
1467 if requirementsmod.COPIESSDC_REQUIREMENT in self.requirements:
1468 self.filecopiesmode = b'changeset-sidedata'
1468 self.filecopiesmode = b'changeset-sidedata'
1469
1469
1470 self._wanted_sidedata = set()
1470 self._wanted_sidedata = set()
1471 self._sidedata_computers = {}
1471 self._sidedata_computers = {}
1472 sidedatamod.set_sidedata_spec_for_repo(self)
1472 sidedatamod.set_sidedata_spec_for_repo(self)
1473
1473
1474 def _getvfsward(self, origfunc):
1474 def _getvfsward(self, origfunc):
1475 """build a ward for self.vfs"""
1475 """build a ward for self.vfs"""
1476 rref = weakref.ref(self)
1476 rref = weakref.ref(self)
1477
1477
1478 def checkvfs(path, mode=None):
1478 def checkvfs(path, mode=None):
1479 ret = origfunc(path, mode=mode)
1479 ret = origfunc(path, mode=mode)
1480 repo = rref()
1480 repo = rref()
1481 if (
1481 if (
1482 repo is None
1482 repo is None
1483 or not util.safehasattr(repo, b'_wlockref')
1483 or not util.safehasattr(repo, b'_wlockref')
1484 or not util.safehasattr(repo, b'_lockref')
1484 or not util.safehasattr(repo, b'_lockref')
1485 ):
1485 ):
1486 return
1486 return
1487 if mode in (None, b'r', b'rb'):
1487 if mode in (None, b'r', b'rb'):
1488 return
1488 return
1489 if path.startswith(repo.path):
1489 if path.startswith(repo.path):
1490 # truncate name relative to the repository (.hg)
1490 # truncate name relative to the repository (.hg)
1491 path = path[len(repo.path) + 1 :]
1491 path = path[len(repo.path) + 1 :]
1492 if path.startswith(b'cache/'):
1492 if path.startswith(b'cache/'):
1493 msg = b'accessing cache with vfs instead of cachevfs: "%s"'
1493 msg = b'accessing cache with vfs instead of cachevfs: "%s"'
1494 repo.ui.develwarn(msg % path, stacklevel=3, config=b"cache-vfs")
1494 repo.ui.develwarn(msg % path, stacklevel=3, config=b"cache-vfs")
1495 # path prefixes covered by 'lock'
1495 # path prefixes covered by 'lock'
1496 vfs_path_prefixes = (
1496 vfs_path_prefixes = (
1497 b'journal.',
1497 b'journal.',
1498 b'undo.',
1498 b'undo.',
1499 b'strip-backup/',
1499 b'strip-backup/',
1500 b'cache/',
1500 b'cache/',
1501 )
1501 )
1502 if any(path.startswith(prefix) for prefix in vfs_path_prefixes):
1502 if any(path.startswith(prefix) for prefix in vfs_path_prefixes):
1503 if repo._currentlock(repo._lockref) is None:
1503 if repo._currentlock(repo._lockref) is None:
1504 repo.ui.develwarn(
1504 repo.ui.develwarn(
1505 b'write with no lock: "%s"' % path,
1505 b'write with no lock: "%s"' % path,
1506 stacklevel=3,
1506 stacklevel=3,
1507 config=b'check-locks',
1507 config=b'check-locks',
1508 )
1508 )
1509 elif repo._currentlock(repo._wlockref) is None:
1509 elif repo._currentlock(repo._wlockref) is None:
1510 # rest of vfs files are covered by 'wlock'
1510 # rest of vfs files are covered by 'wlock'
1511 #
1511 #
1512 # exclude special files
1512 # exclude special files
1513 for prefix in self._wlockfreeprefix:
1513 for prefix in self._wlockfreeprefix:
1514 if path.startswith(prefix):
1514 if path.startswith(prefix):
1515 return
1515 return
1516 repo.ui.develwarn(
1516 repo.ui.develwarn(
1517 b'write with no wlock: "%s"' % path,
1517 b'write with no wlock: "%s"' % path,
1518 stacklevel=3,
1518 stacklevel=3,
1519 config=b'check-locks',
1519 config=b'check-locks',
1520 )
1520 )
1521 return ret
1521 return ret
1522
1522
1523 return checkvfs
1523 return checkvfs
1524
1524
1525 def _getsvfsward(self, origfunc):
1525 def _getsvfsward(self, origfunc):
1526 """build a ward for self.svfs"""
1526 """build a ward for self.svfs"""
1527 rref = weakref.ref(self)
1527 rref = weakref.ref(self)
1528
1528
1529 def checksvfs(path, mode=None):
1529 def checksvfs(path, mode=None):
1530 ret = origfunc(path, mode=mode)
1530 ret = origfunc(path, mode=mode)
1531 repo = rref()
1531 repo = rref()
1532 if repo is None or not util.safehasattr(repo, b'_lockref'):
1532 if repo is None or not util.safehasattr(repo, b'_lockref'):
1533 return
1533 return
1534 if mode in (None, b'r', b'rb'):
1534 if mode in (None, b'r', b'rb'):
1535 return
1535 return
1536 if path.startswith(repo.sharedpath):
1536 if path.startswith(repo.sharedpath):
1537 # truncate name relative to the repository (.hg)
1537 # truncate name relative to the repository (.hg)
1538 path = path[len(repo.sharedpath) + 1 :]
1538 path = path[len(repo.sharedpath) + 1 :]
1539 if repo._currentlock(repo._lockref) is None:
1539 if repo._currentlock(repo._lockref) is None:
1540 repo.ui.develwarn(
1540 repo.ui.develwarn(
1541 b'write with no lock: "%s"' % path, stacklevel=4
1541 b'write with no lock: "%s"' % path, stacklevel=4
1542 )
1542 )
1543 return ret
1543 return ret
1544
1544
1545 return checksvfs
1545 return checksvfs
1546
1546
1547 def close(self):
1547 def close(self):
1548 self._writecaches()
1548 self._writecaches()
1549
1549
1550 def _writecaches(self):
1550 def _writecaches(self):
1551 if self._revbranchcache:
1551 if self._revbranchcache:
1552 self._revbranchcache.write()
1552 self._revbranchcache.write()
1553
1553
1554 def _restrictcapabilities(self, caps):
1554 def _restrictcapabilities(self, caps):
1555 if self.ui.configbool(b'experimental', b'bundle2-advertise'):
1555 if self.ui.configbool(b'experimental', b'bundle2-advertise'):
1556 caps = set(caps)
1556 caps = set(caps)
1557 capsblob = bundle2.encodecaps(
1557 capsblob = bundle2.encodecaps(
1558 bundle2.getrepocaps(self, role=b'client')
1558 bundle2.getrepocaps(self, role=b'client')
1559 )
1559 )
1560 caps.add(b'bundle2=' + urlreq.quote(capsblob))
1560 caps.add(b'bundle2=' + urlreq.quote(capsblob))
1561 if self.ui.configbool(b'experimental', b'narrow'):
1561 if self.ui.configbool(b'experimental', b'narrow'):
1562 caps.add(wireprototypes.NARROWCAP)
1562 caps.add(wireprototypes.NARROWCAP)
1563 return caps
1563 return caps
1564
1564
1565 # Don't cache auditor/nofsauditor, or you'll end up with reference cycle:
1565 # Don't cache auditor/nofsauditor, or you'll end up with reference cycle:
1566 # self -> auditor -> self._checknested -> self
1566 # self -> auditor -> self._checknested -> self
1567
1567
1568 @property
1568 @property
1569 def auditor(self):
1569 def auditor(self):
1570 # This is only used by context.workingctx.match in order to
1570 # This is only used by context.workingctx.match in order to
1571 # detect files in subrepos.
1571 # detect files in subrepos.
1572 return pathutil.pathauditor(self.root, callback=self._checknested)
1572 return pathutil.pathauditor(self.root, callback=self._checknested)
1573
1573
1574 @property
1574 @property
1575 def nofsauditor(self):
1575 def nofsauditor(self):
1576 # This is only used by context.basectx.match in order to detect
1576 # This is only used by context.basectx.match in order to detect
1577 # files in subrepos.
1577 # files in subrepos.
1578 return pathutil.pathauditor(
1578 return pathutil.pathauditor(
1579 self.root, callback=self._checknested, realfs=False, cached=True
1579 self.root, callback=self._checknested, realfs=False, cached=True
1580 )
1580 )
1581
1581
1582 def _checknested(self, path):
1582 def _checknested(self, path):
1583 """Determine if path is a legal nested repository."""
1583 """Determine if path is a legal nested repository."""
1584 if not path.startswith(self.root):
1584 if not path.startswith(self.root):
1585 return False
1585 return False
1586 subpath = path[len(self.root) + 1 :]
1586 subpath = path[len(self.root) + 1 :]
1587 normsubpath = util.pconvert(subpath)
1587 normsubpath = util.pconvert(subpath)
1588
1588
1589 # XXX: Checking against the current working copy is wrong in
1589 # XXX: Checking against the current working copy is wrong in
1590 # the sense that it can reject things like
1590 # the sense that it can reject things like
1591 #
1591 #
1592 # $ hg cat -r 10 sub/x.txt
1592 # $ hg cat -r 10 sub/x.txt
1593 #
1593 #
1594 # if sub/ is no longer a subrepository in the working copy
1594 # if sub/ is no longer a subrepository in the working copy
1595 # parent revision.
1595 # parent revision.
1596 #
1596 #
1597 # However, it can of course also allow things that would have
1597 # However, it can of course also allow things that would have
1598 # been rejected before, such as the above cat command if sub/
1598 # been rejected before, such as the above cat command if sub/
1599 # is a subrepository now, but was a normal directory before.
1599 # is a subrepository now, but was a normal directory before.
1600 # The old path auditor would have rejected by mistake since it
1600 # The old path auditor would have rejected by mistake since it
1601 # panics when it sees sub/.hg/.
1601 # panics when it sees sub/.hg/.
1602 #
1602 #
1603 # All in all, checking against the working copy seems sensible
1603 # All in all, checking against the working copy seems sensible
1604 # since we want to prevent access to nested repositories on
1604 # since we want to prevent access to nested repositories on
1605 # the filesystem *now*.
1605 # the filesystem *now*.
1606 ctx = self[None]
1606 ctx = self[None]
1607 parts = util.splitpath(subpath)
1607 parts = util.splitpath(subpath)
1608 while parts:
1608 while parts:
1609 prefix = b'/'.join(parts)
1609 prefix = b'/'.join(parts)
1610 if prefix in ctx.substate:
1610 if prefix in ctx.substate:
1611 if prefix == normsubpath:
1611 if prefix == normsubpath:
1612 return True
1612 return True
1613 else:
1613 else:
1614 sub = ctx.sub(prefix)
1614 sub = ctx.sub(prefix)
1615 return sub.checknested(subpath[len(prefix) + 1 :])
1615 return sub.checknested(subpath[len(prefix) + 1 :])
1616 else:
1616 else:
1617 parts.pop()
1617 parts.pop()
1618 return False
1618 return False
1619
1619
1620 def peer(self):
1620 def peer(self):
1621 return localpeer(self) # not cached to avoid reference cycle
1621 return localpeer(self) # not cached to avoid reference cycle
1622
1622
1623 def unfiltered(self):
1623 def unfiltered(self):
1624 """Return unfiltered version of the repository
1624 """Return unfiltered version of the repository
1625
1625
1626 Intended to be overwritten by filtered repo."""
1626 Intended to be overwritten by filtered repo."""
1627 return self
1627 return self
1628
1628
1629 def filtered(self, name, visibilityexceptions=None):
1629 def filtered(self, name, visibilityexceptions=None):
1630 """Return a filtered version of a repository
1630 """Return a filtered version of a repository
1631
1631
1632 The `name` parameter is the identifier of the requested view. This
1632 The `name` parameter is the identifier of the requested view. This
1633 will return a repoview object set "exactly" to the specified view.
1633 will return a repoview object set "exactly" to the specified view.
1634
1634
1635 This function does not apply recursive filtering to a repository. For
1635 This function does not apply recursive filtering to a repository. For
1636 example calling `repo.filtered("served")` will return a repoview using
1636 example calling `repo.filtered("served")` will return a repoview using
1637 the "served" view, regardless of the initial view used by `repo`.
1637 the "served" view, regardless of the initial view used by `repo`.
1638
1638
1639 In other word, there is always only one level of `repoview` "filtering".
1639 In other word, there is always only one level of `repoview` "filtering".
1640 """
1640 """
1641 if self._extrafilterid is not None and b'%' not in name:
1641 if self._extrafilterid is not None and b'%' not in name:
1642 name = name + b'%' + self._extrafilterid
1642 name = name + b'%' + self._extrafilterid
1643
1643
1644 cls = repoview.newtype(self.unfiltered().__class__)
1644 cls = repoview.newtype(self.unfiltered().__class__)
1645 return cls(self, name, visibilityexceptions)
1645 return cls(self, name, visibilityexceptions)
1646
1646
1647 @mixedrepostorecache(
1647 @mixedrepostorecache(
1648 (b'bookmarks', b'plain'),
1648 (b'bookmarks', b'plain'),
1649 (b'bookmarks.current', b'plain'),
1649 (b'bookmarks.current', b'plain'),
1650 (b'bookmarks', b''),
1650 (b'bookmarks', b''),
1651 (b'00changelog.i', b''),
1651 (b'00changelog.i', b''),
1652 )
1652 )
1653 def _bookmarks(self):
1653 def _bookmarks(self):
1654 # Since the multiple files involved in the transaction cannot be
1654 # Since the multiple files involved in the transaction cannot be
1655 # written atomically (with current repository format), there is a race
1655 # written atomically (with current repository format), there is a race
1656 # condition here.
1656 # condition here.
1657 #
1657 #
1658 # 1) changelog content A is read
1658 # 1) changelog content A is read
1659 # 2) outside transaction update changelog to content B
1659 # 2) outside transaction update changelog to content B
1660 # 3) outside transaction update bookmark file referring to content B
1660 # 3) outside transaction update bookmark file referring to content B
1661 # 4) bookmarks file content is read and filtered against changelog-A
1661 # 4) bookmarks file content is read and filtered against changelog-A
1662 #
1662 #
1663 # When this happens, bookmarks against nodes missing from A are dropped.
1663 # When this happens, bookmarks against nodes missing from A are dropped.
1664 #
1664 #
1665 # Having this happening during read is not great, but it become worse
1665 # Having this happening during read is not great, but it become worse
1666 # when this happen during write because the bookmarks to the "unknown"
1666 # when this happen during write because the bookmarks to the "unknown"
1667 # nodes will be dropped for good. However, writes happen within locks.
1667 # nodes will be dropped for good. However, writes happen within locks.
1668 # This locking makes it possible to have a race free consistent read.
1668 # This locking makes it possible to have a race free consistent read.
1669 # For this purpose data read from disc before locking are
1669 # For this purpose data read from disc before locking are
1670 # "invalidated" right after the locks are taken. This invalidations are
1670 # "invalidated" right after the locks are taken. This invalidations are
1671 # "light", the `filecache` mechanism keep the data in memory and will
1671 # "light", the `filecache` mechanism keep the data in memory and will
1672 # reuse them if the underlying files did not changed. Not parsing the
1672 # reuse them if the underlying files did not changed. Not parsing the
1673 # same data multiple times helps performances.
1673 # same data multiple times helps performances.
1674 #
1674 #
1675 # Unfortunately in the case describe above, the files tracked by the
1675 # Unfortunately in the case describe above, the files tracked by the
1676 # bookmarks file cache might not have changed, but the in-memory
1676 # bookmarks file cache might not have changed, but the in-memory
1677 # content is still "wrong" because we used an older changelog content
1677 # content is still "wrong" because we used an older changelog content
1678 # to process the on-disk data. So after locking, the changelog would be
1678 # to process the on-disk data. So after locking, the changelog would be
1679 # refreshed but `_bookmarks` would be preserved.
1679 # refreshed but `_bookmarks` would be preserved.
1680 # Adding `00changelog.i` to the list of tracked file is not
1680 # Adding `00changelog.i` to the list of tracked file is not
1681 # enough, because at the time we build the content for `_bookmarks` in
1681 # enough, because at the time we build the content for `_bookmarks` in
1682 # (4), the changelog file has already diverged from the content used
1682 # (4), the changelog file has already diverged from the content used
1683 # for loading `changelog` in (1)
1683 # for loading `changelog` in (1)
1684 #
1684 #
1685 # To prevent the issue, we force the changelog to be explicitly
1685 # To prevent the issue, we force the changelog to be explicitly
1686 # reloaded while computing `_bookmarks`. The data race can still happen
1686 # reloaded while computing `_bookmarks`. The data race can still happen
1687 # without the lock (with a narrower window), but it would no longer go
1687 # without the lock (with a narrower window), but it would no longer go
1688 # undetected during the lock time refresh.
1688 # undetected during the lock time refresh.
1689 #
1689 #
1690 # The new schedule is as follow
1690 # The new schedule is as follow
1691 #
1691 #
1692 # 1) filecache logic detect that `_bookmarks` needs to be computed
1692 # 1) filecache logic detect that `_bookmarks` needs to be computed
1693 # 2) cachestat for `bookmarks` and `changelog` are captured (for book)
1693 # 2) cachestat for `bookmarks` and `changelog` are captured (for book)
1694 # 3) We force `changelog` filecache to be tested
1694 # 3) We force `changelog` filecache to be tested
1695 # 4) cachestat for `changelog` are captured (for changelog)
1695 # 4) cachestat for `changelog` are captured (for changelog)
1696 # 5) `_bookmarks` is computed and cached
1696 # 5) `_bookmarks` is computed and cached
1697 #
1697 #
1698 # The step in (3) ensure we have a changelog at least as recent as the
1698 # The step in (3) ensure we have a changelog at least as recent as the
1699 # cache stat computed in (1). As a result at locking time:
1699 # cache stat computed in (1). As a result at locking time:
1700 # * if the changelog did not changed since (1) -> we can reuse the data
1700 # * if the changelog did not changed since (1) -> we can reuse the data
1701 # * otherwise -> the bookmarks get refreshed.
1701 # * otherwise -> the bookmarks get refreshed.
1702 self._refreshchangelog()
1702 self._refreshchangelog()
1703 return bookmarks.bmstore(self)
1703 return bookmarks.bmstore(self)
1704
1704
1705 def _refreshchangelog(self):
1705 def _refreshchangelog(self):
1706 """make sure the in memory changelog match the on-disk one"""
1706 """make sure the in memory changelog match the on-disk one"""
1707 if 'changelog' in vars(self) and self.currenttransaction() is None:
1707 if 'changelog' in vars(self) and self.currenttransaction() is None:
1708 del self.changelog
1708 del self.changelog
1709
1709
1710 @property
1710 @property
1711 def _activebookmark(self):
1711 def _activebookmark(self):
1712 return self._bookmarks.active
1712 return self._bookmarks.active
1713
1713
1714 # _phasesets depend on changelog. what we need is to call
1714 # _phasesets depend on changelog. what we need is to call
1715 # _phasecache.invalidate() if '00changelog.i' was changed, but it
1715 # _phasecache.invalidate() if '00changelog.i' was changed, but it
1716 # can't be easily expressed in filecache mechanism.
1716 # can't be easily expressed in filecache mechanism.
1717 @storecache(b'phaseroots', b'00changelog.i')
1717 @storecache(b'phaseroots', b'00changelog.i')
1718 def _phasecache(self):
1718 def _phasecache(self):
1719 return phases.phasecache(self, self._phasedefaults)
1719 return phases.phasecache(self, self._phasedefaults)
1720
1720
1721 @storecache(b'obsstore')
1721 @storecache(b'obsstore')
1722 def obsstore(self):
1722 def obsstore(self):
1723 return obsolete.makestore(self.ui, self)
1723 return obsolete.makestore(self.ui, self)
1724
1724
1725 @changelogcache()
1725 @changelogcache()
1726 def changelog(repo):
1726 def changelog(repo):
1727 # load dirstate before changelog to avoid race see issue6303
1727 # load dirstate before changelog to avoid race see issue6303
1728 repo.dirstate.prefetch_parents()
1728 repo.dirstate.prefetch_parents()
1729 return repo.store.changelog(
1729 return repo.store.changelog(
1730 txnutil.mayhavepending(repo.root),
1730 txnutil.mayhavepending(repo.root),
1731 concurrencychecker=revlogchecker.get_checker(repo.ui, b'changelog'),
1731 concurrencychecker=revlogchecker.get_checker(repo.ui, b'changelog'),
1732 )
1732 )
1733
1733
1734 @manifestlogcache()
1734 @manifestlogcache()
1735 def manifestlog(self):
1735 def manifestlog(self):
1736 return self.store.manifestlog(self, self._storenarrowmatch)
1736 return self.store.manifestlog(self, self._storenarrowmatch)
1737
1737
1738 @repofilecache(b'dirstate')
1738 @repofilecache(b'dirstate')
1739 def dirstate(self):
1739 def dirstate(self):
1740 return self._makedirstate()
1740 return self._makedirstate()
1741
1741
1742 def _makedirstate(self):
1742 def _makedirstate(self):
1743 """Extension point for wrapping the dirstate per-repo."""
1743 """Extension point for wrapping the dirstate per-repo."""
1744 sparsematchfn = lambda: sparse.matcher(self)
1744 sparsematchfn = lambda: sparse.matcher(self)
1745 v2_req = requirementsmod.DIRSTATE_V2_REQUIREMENT
1745 v2_req = requirementsmod.DIRSTATE_V2_REQUIREMENT
1746 tk = requirementsmod.DIRSTATE_TRACKED_KEY_V1
1746 tk = requirementsmod.DIRSTATE_TRACKED_KEY_V1
1747 use_dirstate_v2 = v2_req in self.requirements
1747 use_dirstate_v2 = v2_req in self.requirements
1748 use_tracked_key = tk in self.requirements
1748 use_tracked_key = tk in self.requirements
1749
1749
1750 return dirstate.dirstate(
1750 return dirstate.dirstate(
1751 self.vfs,
1751 self.vfs,
1752 self.ui,
1752 self.ui,
1753 self.root,
1753 self.root,
1754 self._dirstatevalidate,
1754 self._dirstatevalidate,
1755 sparsematchfn,
1755 sparsematchfn,
1756 self.nodeconstants,
1756 self.nodeconstants,
1757 use_dirstate_v2,
1757 use_dirstate_v2,
1758 use_tracked_key=use_tracked_key,
1758 use_tracked_key=use_tracked_key,
1759 )
1759 )
1760
1760
1761 def _dirstatevalidate(self, node):
1761 def _dirstatevalidate(self, node):
1762 try:
1762 try:
1763 self.changelog.rev(node)
1763 self.changelog.rev(node)
1764 return node
1764 return node
1765 except error.LookupError:
1765 except error.LookupError:
1766 if not self._dirstatevalidatewarned:
1766 if not self._dirstatevalidatewarned:
1767 self._dirstatevalidatewarned = True
1767 self._dirstatevalidatewarned = True
1768 self.ui.warn(
1768 self.ui.warn(
1769 _(b"warning: ignoring unknown working parent %s!\n")
1769 _(b"warning: ignoring unknown working parent %s!\n")
1770 % short(node)
1770 % short(node)
1771 )
1771 )
1772 return self.nullid
1772 return self.nullid
1773
1773
1774 @storecache(narrowspec.FILENAME)
1774 @storecache(narrowspec.FILENAME)
1775 def narrowpats(self):
1775 def narrowpats(self):
1776 """matcher patterns for this repository's narrowspec
1776 """matcher patterns for this repository's narrowspec
1777
1777
1778 A tuple of (includes, excludes).
1778 A tuple of (includes, excludes).
1779 """
1779 """
1780 return narrowspec.load(self)
1780 return narrowspec.load(self)
1781
1781
1782 @storecache(narrowspec.FILENAME)
1782 @storecache(narrowspec.FILENAME)
1783 def _storenarrowmatch(self):
1783 def _storenarrowmatch(self):
1784 if requirementsmod.NARROW_REQUIREMENT not in self.requirements:
1784 if requirementsmod.NARROW_REQUIREMENT not in self.requirements:
1785 return matchmod.always()
1785 return matchmod.always()
1786 include, exclude = self.narrowpats
1786 include, exclude = self.narrowpats
1787 return narrowspec.match(self.root, include=include, exclude=exclude)
1787 return narrowspec.match(self.root, include=include, exclude=exclude)
1788
1788
1789 @storecache(narrowspec.FILENAME)
1789 @storecache(narrowspec.FILENAME)
1790 def _narrowmatch(self):
1790 def _narrowmatch(self):
1791 if requirementsmod.NARROW_REQUIREMENT not in self.requirements:
1791 if requirementsmod.NARROW_REQUIREMENT not in self.requirements:
1792 return matchmod.always()
1792 return matchmod.always()
1793 narrowspec.checkworkingcopynarrowspec(self)
1793 narrowspec.checkworkingcopynarrowspec(self)
1794 include, exclude = self.narrowpats
1794 include, exclude = self.narrowpats
1795 return narrowspec.match(self.root, include=include, exclude=exclude)
1795 return narrowspec.match(self.root, include=include, exclude=exclude)
1796
1796
1797 def narrowmatch(self, match=None, includeexact=False):
1797 def narrowmatch(self, match=None, includeexact=False):
1798 """matcher corresponding the the repo's narrowspec
1798 """matcher corresponding the the repo's narrowspec
1799
1799
1800 If `match` is given, then that will be intersected with the narrow
1800 If `match` is given, then that will be intersected with the narrow
1801 matcher.
1801 matcher.
1802
1802
1803 If `includeexact` is True, then any exact matches from `match` will
1803 If `includeexact` is True, then any exact matches from `match` will
1804 be included even if they're outside the narrowspec.
1804 be included even if they're outside the narrowspec.
1805 """
1805 """
1806 if match:
1806 if match:
1807 if includeexact and not self._narrowmatch.always():
1807 if includeexact and not self._narrowmatch.always():
1808 # do not exclude explicitly-specified paths so that they can
1808 # do not exclude explicitly-specified paths so that they can
1809 # be warned later on
1809 # be warned later on
1810 em = matchmod.exact(match.files())
1810 em = matchmod.exact(match.files())
1811 nm = matchmod.unionmatcher([self._narrowmatch, em])
1811 nm = matchmod.unionmatcher([self._narrowmatch, em])
1812 return matchmod.intersectmatchers(match, nm)
1812 return matchmod.intersectmatchers(match, nm)
1813 return matchmod.intersectmatchers(match, self._narrowmatch)
1813 return matchmod.intersectmatchers(match, self._narrowmatch)
1814 return self._narrowmatch
1814 return self._narrowmatch
1815
1815
1816 def setnarrowpats(self, newincludes, newexcludes):
1816 def setnarrowpats(self, newincludes, newexcludes):
1817 narrowspec.save(self, newincludes, newexcludes)
1817 narrowspec.save(self, newincludes, newexcludes)
1818 self.invalidate(clearfilecache=True)
1818 self.invalidate(clearfilecache=True)
1819
1819
1820 @unfilteredpropertycache
1820 @unfilteredpropertycache
1821 def _quick_access_changeid_null(self):
1821 def _quick_access_changeid_null(self):
1822 return {
1822 return {
1823 b'null': (nullrev, self.nodeconstants.nullid),
1823 b'null': (nullrev, self.nodeconstants.nullid),
1824 nullrev: (nullrev, self.nodeconstants.nullid),
1824 nullrev: (nullrev, self.nodeconstants.nullid),
1825 self.nullid: (nullrev, self.nullid),
1825 self.nullid: (nullrev, self.nullid),
1826 }
1826 }
1827
1827
1828 @unfilteredpropertycache
1828 @unfilteredpropertycache
1829 def _quick_access_changeid_wc(self):
1829 def _quick_access_changeid_wc(self):
1830 # also fast path access to the working copy parents
1830 # also fast path access to the working copy parents
1831 # however, only do it for filter that ensure wc is visible.
1831 # however, only do it for filter that ensure wc is visible.
1832 quick = self._quick_access_changeid_null.copy()
1832 quick = self._quick_access_changeid_null.copy()
1833 cl = self.unfiltered().changelog
1833 cl = self.unfiltered().changelog
1834 for node in self.dirstate.parents():
1834 for node in self.dirstate.parents():
1835 if node == self.nullid:
1835 if node == self.nullid:
1836 continue
1836 continue
1837 rev = cl.index.get_rev(node)
1837 rev = cl.index.get_rev(node)
1838 if rev is None:
1838 if rev is None:
1839 # unknown working copy parent case:
1839 # unknown working copy parent case:
1840 #
1840 #
1841 # skip the fast path and let higher code deal with it
1841 # skip the fast path and let higher code deal with it
1842 continue
1842 continue
1843 pair = (rev, node)
1843 pair = (rev, node)
1844 quick[rev] = pair
1844 quick[rev] = pair
1845 quick[node] = pair
1845 quick[node] = pair
1846 # also add the parents of the parents
1846 # also add the parents of the parents
1847 for r in cl.parentrevs(rev):
1847 for r in cl.parentrevs(rev):
1848 if r == nullrev:
1848 if r == nullrev:
1849 continue
1849 continue
1850 n = cl.node(r)
1850 n = cl.node(r)
1851 pair = (r, n)
1851 pair = (r, n)
1852 quick[r] = pair
1852 quick[r] = pair
1853 quick[n] = pair
1853 quick[n] = pair
1854 p1node = self.dirstate.p1()
1854 p1node = self.dirstate.p1()
1855 if p1node != self.nullid:
1855 if p1node != self.nullid:
1856 quick[b'.'] = quick[p1node]
1856 quick[b'.'] = quick[p1node]
1857 return quick
1857 return quick
1858
1858
1859 @unfilteredmethod
1859 @unfilteredmethod
1860 def _quick_access_changeid_invalidate(self):
1860 def _quick_access_changeid_invalidate(self):
1861 if '_quick_access_changeid_wc' in vars(self):
1861 if '_quick_access_changeid_wc' in vars(self):
1862 del self.__dict__['_quick_access_changeid_wc']
1862 del self.__dict__['_quick_access_changeid_wc']
1863
1863
1864 @property
1864 @property
1865 def _quick_access_changeid(self):
1865 def _quick_access_changeid(self):
1866 """an helper dictionnary for __getitem__ calls
1866 """an helper dictionnary for __getitem__ calls
1867
1867
1868 This contains a list of symbol we can recognise right away without
1868 This contains a list of symbol we can recognise right away without
1869 further processing.
1869 further processing.
1870 """
1870 """
1871 if self.filtername in repoview.filter_has_wc:
1871 if self.filtername in repoview.filter_has_wc:
1872 return self._quick_access_changeid_wc
1872 return self._quick_access_changeid_wc
1873 return self._quick_access_changeid_null
1873 return self._quick_access_changeid_null
1874
1874
1875 def __getitem__(self, changeid):
1875 def __getitem__(self, changeid):
1876 # dealing with special cases
1876 # dealing with special cases
1877 if changeid is None:
1877 if changeid is None:
1878 return context.workingctx(self)
1878 return context.workingctx(self)
1879 if isinstance(changeid, context.basectx):
1879 if isinstance(changeid, context.basectx):
1880 return changeid
1880 return changeid
1881
1881
1882 # dealing with multiple revisions
1882 # dealing with multiple revisions
1883 if isinstance(changeid, slice):
1883 if isinstance(changeid, slice):
1884 # wdirrev isn't contiguous so the slice shouldn't include it
1884 # wdirrev isn't contiguous so the slice shouldn't include it
1885 return [
1885 return [
1886 self[i]
1886 self[i]
1887 for i in pycompat.xrange(*changeid.indices(len(self)))
1887 for i in pycompat.xrange(*changeid.indices(len(self)))
1888 if i not in self.changelog.filteredrevs
1888 if i not in self.changelog.filteredrevs
1889 ]
1889 ]
1890
1890
1891 # dealing with some special values
1891 # dealing with some special values
1892 quick_access = self._quick_access_changeid.get(changeid)
1892 quick_access = self._quick_access_changeid.get(changeid)
1893 if quick_access is not None:
1893 if quick_access is not None:
1894 rev, node = quick_access
1894 rev, node = quick_access
1895 return context.changectx(self, rev, node, maybe_filtered=False)
1895 return context.changectx(self, rev, node, maybe_filtered=False)
1896 if changeid == b'tip':
1896 if changeid == b'tip':
1897 node = self.changelog.tip()
1897 node = self.changelog.tip()
1898 rev = self.changelog.rev(node)
1898 rev = self.changelog.rev(node)
1899 return context.changectx(self, rev, node)
1899 return context.changectx(self, rev, node)
1900
1900
1901 # dealing with arbitrary values
1901 # dealing with arbitrary values
1902 try:
1902 try:
1903 if isinstance(changeid, int):
1903 if isinstance(changeid, int):
1904 node = self.changelog.node(changeid)
1904 node = self.changelog.node(changeid)
1905 rev = changeid
1905 rev = changeid
1906 elif changeid == b'.':
1906 elif changeid == b'.':
1907 # this is a hack to delay/avoid loading obsmarkers
1907 # this is a hack to delay/avoid loading obsmarkers
1908 # when we know that '.' won't be hidden
1908 # when we know that '.' won't be hidden
1909 node = self.dirstate.p1()
1909 node = self.dirstate.p1()
1910 rev = self.unfiltered().changelog.rev(node)
1910 rev = self.unfiltered().changelog.rev(node)
1911 elif len(changeid) == self.nodeconstants.nodelen:
1911 elif len(changeid) == self.nodeconstants.nodelen:
1912 try:
1912 try:
1913 node = changeid
1913 node = changeid
1914 rev = self.changelog.rev(changeid)
1914 rev = self.changelog.rev(changeid)
1915 except error.FilteredLookupError:
1915 except error.FilteredLookupError:
1916 changeid = hex(changeid) # for the error message
1916 changeid = hex(changeid) # for the error message
1917 raise
1917 raise
1918 except LookupError:
1918 except LookupError:
1919 # check if it might have come from damaged dirstate
1919 # check if it might have come from damaged dirstate
1920 #
1920 #
1921 # XXX we could avoid the unfiltered if we had a recognizable
1921 # XXX we could avoid the unfiltered if we had a recognizable
1922 # exception for filtered changeset access
1922 # exception for filtered changeset access
1923 if (
1923 if (
1924 self.local()
1924 self.local()
1925 and changeid in self.unfiltered().dirstate.parents()
1925 and changeid in self.unfiltered().dirstate.parents()
1926 ):
1926 ):
1927 msg = _(b"working directory has unknown parent '%s'!")
1927 msg = _(b"working directory has unknown parent '%s'!")
1928 raise error.Abort(msg % short(changeid))
1928 raise error.Abort(msg % short(changeid))
1929 changeid = hex(changeid) # for the error message
1929 changeid = hex(changeid) # for the error message
1930 raise
1930 raise
1931
1931
1932 elif len(changeid) == 2 * self.nodeconstants.nodelen:
1932 elif len(changeid) == 2 * self.nodeconstants.nodelen:
1933 node = bin(changeid)
1933 node = bin(changeid)
1934 rev = self.changelog.rev(node)
1934 rev = self.changelog.rev(node)
1935 else:
1935 else:
1936 raise error.ProgrammingError(
1936 raise error.ProgrammingError(
1937 b"unsupported changeid '%s' of type %s"
1937 b"unsupported changeid '%s' of type %s"
1938 % (changeid, pycompat.bytestr(type(changeid)))
1938 % (changeid, pycompat.bytestr(type(changeid)))
1939 )
1939 )
1940
1940
1941 return context.changectx(self, rev, node)
1941 return context.changectx(self, rev, node)
1942
1942
1943 except (error.FilteredIndexError, error.FilteredLookupError):
1943 except (error.FilteredIndexError, error.FilteredLookupError):
1944 raise error.FilteredRepoLookupError(
1944 raise error.FilteredRepoLookupError(
1945 _(b"filtered revision '%s'") % pycompat.bytestr(changeid)
1945 _(b"filtered revision '%s'") % pycompat.bytestr(changeid)
1946 )
1946 )
1947 except (IndexError, LookupError):
1947 except (IndexError, LookupError):
1948 raise error.RepoLookupError(
1948 raise error.RepoLookupError(
1949 _(b"unknown revision '%s'") % pycompat.bytestr(changeid)
1949 _(b"unknown revision '%s'") % pycompat.bytestr(changeid)
1950 )
1950 )
1951 except error.WdirUnsupported:
1951 except error.WdirUnsupported:
1952 return context.workingctx(self)
1952 return context.workingctx(self)
1953
1953
1954 def __contains__(self, changeid):
1954 def __contains__(self, changeid):
1955 """True if the given changeid exists"""
1955 """True if the given changeid exists"""
1956 try:
1956 try:
1957 self[changeid]
1957 self[changeid]
1958 return True
1958 return True
1959 except error.RepoLookupError:
1959 except error.RepoLookupError:
1960 return False
1960 return False
1961
1961
1962 def __nonzero__(self):
1962 def __nonzero__(self):
1963 return True
1963 return True
1964
1964
1965 __bool__ = __nonzero__
1965 __bool__ = __nonzero__
1966
1966
1967 def __len__(self):
1967 def __len__(self):
1968 # no need to pay the cost of repoview.changelog
1968 # no need to pay the cost of repoview.changelog
1969 unfi = self.unfiltered()
1969 unfi = self.unfiltered()
1970 return len(unfi.changelog)
1970 return len(unfi.changelog)
1971
1971
1972 def __iter__(self):
1972 def __iter__(self):
1973 return iter(self.changelog)
1973 return iter(self.changelog)
1974
1974
1975 def revs(self, expr, *args):
1975 def revs(self, expr, *args):
1976 """Find revisions matching a revset.
1976 """Find revisions matching a revset.
1977
1977
1978 The revset is specified as a string ``expr`` that may contain
1978 The revset is specified as a string ``expr`` that may contain
1979 %-formatting to escape certain types. See ``revsetlang.formatspec``.
1979 %-formatting to escape certain types. See ``revsetlang.formatspec``.
1980
1980
1981 Revset aliases from the configuration are not expanded. To expand
1981 Revset aliases from the configuration are not expanded. To expand
1982 user aliases, consider calling ``scmutil.revrange()`` or
1982 user aliases, consider calling ``scmutil.revrange()`` or
1983 ``repo.anyrevs([expr], user=True)``.
1983 ``repo.anyrevs([expr], user=True)``.
1984
1984
1985 Returns a smartset.abstractsmartset, which is a list-like interface
1985 Returns a smartset.abstractsmartset, which is a list-like interface
1986 that contains integer revisions.
1986 that contains integer revisions.
1987 """
1987 """
1988 tree = revsetlang.spectree(expr, *args)
1988 tree = revsetlang.spectree(expr, *args)
1989 return revset.makematcher(tree)(self)
1989 return revset.makematcher(tree)(self)
1990
1990
1991 def set(self, expr, *args):
1991 def set(self, expr, *args):
1992 """Find revisions matching a revset and emit changectx instances.
1992 """Find revisions matching a revset and emit changectx instances.
1993
1993
1994 This is a convenience wrapper around ``revs()`` that iterates the
1994 This is a convenience wrapper around ``revs()`` that iterates the
1995 result and is a generator of changectx instances.
1995 result and is a generator of changectx instances.
1996
1996
1997 Revset aliases from the configuration are not expanded. To expand
1997 Revset aliases from the configuration are not expanded. To expand
1998 user aliases, consider calling ``scmutil.revrange()``.
1998 user aliases, consider calling ``scmutil.revrange()``.
1999 """
1999 """
2000 for r in self.revs(expr, *args):
2000 for r in self.revs(expr, *args):
2001 yield self[r]
2001 yield self[r]
2002
2002
2003 def anyrevs(self, specs, user=False, localalias=None):
2003 def anyrevs(self, specs, user=False, localalias=None):
2004 """Find revisions matching one of the given revsets.
2004 """Find revisions matching one of the given revsets.
2005
2005
2006 Revset aliases from the configuration are not expanded by default. To
2006 Revset aliases from the configuration are not expanded by default. To
2007 expand user aliases, specify ``user=True``. To provide some local
2007 expand user aliases, specify ``user=True``. To provide some local
2008 definitions overriding user aliases, set ``localalias`` to
2008 definitions overriding user aliases, set ``localalias`` to
2009 ``{name: definitionstring}``.
2009 ``{name: definitionstring}``.
2010 """
2010 """
2011 if specs == [b'null']:
2011 if specs == [b'null']:
2012 return revset.baseset([nullrev])
2012 return revset.baseset([nullrev])
2013 if specs == [b'.']:
2013 if specs == [b'.']:
2014 quick_data = self._quick_access_changeid.get(b'.')
2014 quick_data = self._quick_access_changeid.get(b'.')
2015 if quick_data is not None:
2015 if quick_data is not None:
2016 return revset.baseset([quick_data[0]])
2016 return revset.baseset([quick_data[0]])
2017 if user:
2017 if user:
2018 m = revset.matchany(
2018 m = revset.matchany(
2019 self.ui,
2019 self.ui,
2020 specs,
2020 specs,
2021 lookup=revset.lookupfn(self),
2021 lookup=revset.lookupfn(self),
2022 localalias=localalias,
2022 localalias=localalias,
2023 )
2023 )
2024 else:
2024 else:
2025 m = revset.matchany(None, specs, localalias=localalias)
2025 m = revset.matchany(None, specs, localalias=localalias)
2026 return m(self)
2026 return m(self)
2027
2027
2028 def url(self):
2028 def url(self):
2029 return b'file:' + self.root
2029 return b'file:' + self.root
2030
2030
2031 def hook(self, name, throw=False, **args):
2031 def hook(self, name, throw=False, **args):
2032 """Call a hook, passing this repo instance.
2032 """Call a hook, passing this repo instance.
2033
2033
2034 This a convenience method to aid invoking hooks. Extensions likely
2034 This a convenience method to aid invoking hooks. Extensions likely
2035 won't call this unless they have registered a custom hook or are
2035 won't call this unless they have registered a custom hook or are
2036 replacing code that is expected to call a hook.
2036 replacing code that is expected to call a hook.
2037 """
2037 """
2038 return hook.hook(self.ui, self, name, throw, **args)
2038 return hook.hook(self.ui, self, name, throw, **args)
2039
2039
2040 @filteredpropertycache
2040 @filteredpropertycache
2041 def _tagscache(self):
2041 def _tagscache(self):
2042 """Returns a tagscache object that contains various tags related
2042 """Returns a tagscache object that contains various tags related
2043 caches."""
2043 caches."""
2044
2044
2045 # This simplifies its cache management by having one decorated
2045 # This simplifies its cache management by having one decorated
2046 # function (this one) and the rest simply fetch things from it.
2046 # function (this one) and the rest simply fetch things from it.
2047 class tagscache(object):
2047 class tagscache(object):
2048 def __init__(self):
2048 def __init__(self):
2049 # These two define the set of tags for this repository. tags
2049 # These two define the set of tags for this repository. tags
2050 # maps tag name to node; tagtypes maps tag name to 'global' or
2050 # maps tag name to node; tagtypes maps tag name to 'global' or
2051 # 'local'. (Global tags are defined by .hgtags across all
2051 # 'local'. (Global tags are defined by .hgtags across all
2052 # heads, and local tags are defined in .hg/localtags.)
2052 # heads, and local tags are defined in .hg/localtags.)
2053 # They constitute the in-memory cache of tags.
2053 # They constitute the in-memory cache of tags.
2054 self.tags = self.tagtypes = None
2054 self.tags = self.tagtypes = None
2055
2055
2056 self.nodetagscache = self.tagslist = None
2056 self.nodetagscache = self.tagslist = None
2057
2057
2058 cache = tagscache()
2058 cache = tagscache()
2059 cache.tags, cache.tagtypes = self._findtags()
2059 cache.tags, cache.tagtypes = self._findtags()
2060
2060
2061 return cache
2061 return cache
2062
2062
2063 def tags(self):
2063 def tags(self):
2064 '''return a mapping of tag to node'''
2064 '''return a mapping of tag to node'''
2065 t = {}
2065 t = {}
2066 if self.changelog.filteredrevs:
2066 if self.changelog.filteredrevs:
2067 tags, tt = self._findtags()
2067 tags, tt = self._findtags()
2068 else:
2068 else:
2069 tags = self._tagscache.tags
2069 tags = self._tagscache.tags
2070 rev = self.changelog.rev
2070 rev = self.changelog.rev
2071 for k, v in pycompat.iteritems(tags):
2071 for k, v in pycompat.iteritems(tags):
2072 try:
2072 try:
2073 # ignore tags to unknown nodes
2073 # ignore tags to unknown nodes
2074 rev(v)
2074 rev(v)
2075 t[k] = v
2075 t[k] = v
2076 except (error.LookupError, ValueError):
2076 except (error.LookupError, ValueError):
2077 pass
2077 pass
2078 return t
2078 return t
2079
2079
2080 def _findtags(self):
2080 def _findtags(self):
2081 """Do the hard work of finding tags. Return a pair of dicts
2081 """Do the hard work of finding tags. Return a pair of dicts
2082 (tags, tagtypes) where tags maps tag name to node, and tagtypes
2082 (tags, tagtypes) where tags maps tag name to node, and tagtypes
2083 maps tag name to a string like \'global\' or \'local\'.
2083 maps tag name to a string like \'global\' or \'local\'.
2084 Subclasses or extensions are free to add their own tags, but
2084 Subclasses or extensions are free to add their own tags, but
2085 should be aware that the returned dicts will be retained for the
2085 should be aware that the returned dicts will be retained for the
2086 duration of the localrepo object."""
2086 duration of the localrepo object."""
2087
2087
2088 # XXX what tagtype should subclasses/extensions use? Currently
2088 # XXX what tagtype should subclasses/extensions use? Currently
2089 # mq and bookmarks add tags, but do not set the tagtype at all.
2089 # mq and bookmarks add tags, but do not set the tagtype at all.
2090 # Should each extension invent its own tag type? Should there
2090 # Should each extension invent its own tag type? Should there
2091 # be one tagtype for all such "virtual" tags? Or is the status
2091 # be one tagtype for all such "virtual" tags? Or is the status
2092 # quo fine?
2092 # quo fine?
2093
2093
2094 # map tag name to (node, hist)
2094 # map tag name to (node, hist)
2095 alltags = tagsmod.findglobaltags(self.ui, self)
2095 alltags = tagsmod.findglobaltags(self.ui, self)
2096 # map tag name to tag type
2096 # map tag name to tag type
2097 tagtypes = {tag: b'global' for tag in alltags}
2097 tagtypes = {tag: b'global' for tag in alltags}
2098
2098
2099 tagsmod.readlocaltags(self.ui, self, alltags, tagtypes)
2099 tagsmod.readlocaltags(self.ui, self, alltags, tagtypes)
2100
2100
2101 # Build the return dicts. Have to re-encode tag names because
2101 # Build the return dicts. Have to re-encode tag names because
2102 # the tags module always uses UTF-8 (in order not to lose info
2102 # the tags module always uses UTF-8 (in order not to lose info
2103 # writing to the cache), but the rest of Mercurial wants them in
2103 # writing to the cache), but the rest of Mercurial wants them in
2104 # local encoding.
2104 # local encoding.
2105 tags = {}
2105 tags = {}
2106 for (name, (node, hist)) in pycompat.iteritems(alltags):
2106 for (name, (node, hist)) in pycompat.iteritems(alltags):
2107 if node != self.nullid:
2107 if node != self.nullid:
2108 tags[encoding.tolocal(name)] = node
2108 tags[encoding.tolocal(name)] = node
2109 tags[b'tip'] = self.changelog.tip()
2109 tags[b'tip'] = self.changelog.tip()
2110 tagtypes = {
2110 tagtypes = {
2111 encoding.tolocal(name): value
2111 encoding.tolocal(name): value
2112 for (name, value) in pycompat.iteritems(tagtypes)
2112 for (name, value) in pycompat.iteritems(tagtypes)
2113 }
2113 }
2114 return (tags, tagtypes)
2114 return (tags, tagtypes)
2115
2115
2116 def tagtype(self, tagname):
2116 def tagtype(self, tagname):
2117 """
2117 """
2118 return the type of the given tag. result can be:
2118 return the type of the given tag. result can be:
2119
2119
2120 'local' : a local tag
2120 'local' : a local tag
2121 'global' : a global tag
2121 'global' : a global tag
2122 None : tag does not exist
2122 None : tag does not exist
2123 """
2123 """
2124
2124
2125 return self._tagscache.tagtypes.get(tagname)
2125 return self._tagscache.tagtypes.get(tagname)
2126
2126
2127 def tagslist(self):
2127 def tagslist(self):
2128 '''return a list of tags ordered by revision'''
2128 '''return a list of tags ordered by revision'''
2129 if not self._tagscache.tagslist:
2129 if not self._tagscache.tagslist:
2130 l = []
2130 l = []
2131 for t, n in pycompat.iteritems(self.tags()):
2131 for t, n in pycompat.iteritems(self.tags()):
2132 l.append((self.changelog.rev(n), t, n))
2132 l.append((self.changelog.rev(n), t, n))
2133 self._tagscache.tagslist = [(t, n) for r, t, n in sorted(l)]
2133 self._tagscache.tagslist = [(t, n) for r, t, n in sorted(l)]
2134
2134
2135 return self._tagscache.tagslist
2135 return self._tagscache.tagslist
2136
2136
2137 def nodetags(self, node):
2137 def nodetags(self, node):
2138 '''return the tags associated with a node'''
2138 '''return the tags associated with a node'''
2139 if not self._tagscache.nodetagscache:
2139 if not self._tagscache.nodetagscache:
2140 nodetagscache = {}
2140 nodetagscache = {}
2141 for t, n in pycompat.iteritems(self._tagscache.tags):
2141 for t, n in pycompat.iteritems(self._tagscache.tags):
2142 nodetagscache.setdefault(n, []).append(t)
2142 nodetagscache.setdefault(n, []).append(t)
2143 for tags in pycompat.itervalues(nodetagscache):
2143 for tags in pycompat.itervalues(nodetagscache):
2144 tags.sort()
2144 tags.sort()
2145 self._tagscache.nodetagscache = nodetagscache
2145 self._tagscache.nodetagscache = nodetagscache
2146 return self._tagscache.nodetagscache.get(node, [])
2146 return self._tagscache.nodetagscache.get(node, [])
2147
2147
2148 def nodebookmarks(self, node):
2148 def nodebookmarks(self, node):
2149 """return the list of bookmarks pointing to the specified node"""
2149 """return the list of bookmarks pointing to the specified node"""
2150 return self._bookmarks.names(node)
2150 return self._bookmarks.names(node)
2151
2151
2152 def branchmap(self):
2152 def branchmap(self):
2153 """returns a dictionary {branch: [branchheads]} with branchheads
2153 """returns a dictionary {branch: [branchheads]} with branchheads
2154 ordered by increasing revision number"""
2154 ordered by increasing revision number"""
2155 return self._branchcaches[self]
2155 return self._branchcaches[self]
2156
2156
2157 @unfilteredmethod
2157 @unfilteredmethod
2158 def revbranchcache(self):
2158 def revbranchcache(self):
2159 if not self._revbranchcache:
2159 if not self._revbranchcache:
2160 self._revbranchcache = branchmap.revbranchcache(self.unfiltered())
2160 self._revbranchcache = branchmap.revbranchcache(self.unfiltered())
2161 return self._revbranchcache
2161 return self._revbranchcache
2162
2162
2163 def register_changeset(self, rev, changelogrevision):
2163 def register_changeset(self, rev, changelogrevision):
2164 self.revbranchcache().setdata(rev, changelogrevision)
2164 self.revbranchcache().setdata(rev, changelogrevision)
2165
2165
2166 def branchtip(self, branch, ignoremissing=False):
2166 def branchtip(self, branch, ignoremissing=False):
2167 """return the tip node for a given branch
2167 """return the tip node for a given branch
2168
2168
2169 If ignoremissing is True, then this method will not raise an error.
2169 If ignoremissing is True, then this method will not raise an error.
2170 This is helpful for callers that only expect None for a missing branch
2170 This is helpful for callers that only expect None for a missing branch
2171 (e.g. namespace).
2171 (e.g. namespace).
2172
2172
2173 """
2173 """
2174 try:
2174 try:
2175 return self.branchmap().branchtip(branch)
2175 return self.branchmap().branchtip(branch)
2176 except KeyError:
2176 except KeyError:
2177 if not ignoremissing:
2177 if not ignoremissing:
2178 raise error.RepoLookupError(_(b"unknown branch '%s'") % branch)
2178 raise error.RepoLookupError(_(b"unknown branch '%s'") % branch)
2179 else:
2179 else:
2180 pass
2180 pass
2181
2181
2182 def lookup(self, key):
2182 def lookup(self, key):
2183 node = scmutil.revsymbol(self, key).node()
2183 node = scmutil.revsymbol(self, key).node()
2184 if node is None:
2184 if node is None:
2185 raise error.RepoLookupError(_(b"unknown revision '%s'") % key)
2185 raise error.RepoLookupError(_(b"unknown revision '%s'") % key)
2186 return node
2186 return node
2187
2187
2188 def lookupbranch(self, key):
2188 def lookupbranch(self, key):
2189 if self.branchmap().hasbranch(key):
2189 if self.branchmap().hasbranch(key):
2190 return key
2190 return key
2191
2191
2192 return scmutil.revsymbol(self, key).branch()
2192 return scmutil.revsymbol(self, key).branch()
2193
2193
2194 def known(self, nodes):
2194 def known(self, nodes):
2195 cl = self.changelog
2195 cl = self.changelog
2196 get_rev = cl.index.get_rev
2196 get_rev = cl.index.get_rev
2197 filtered = cl.filteredrevs
2197 filtered = cl.filteredrevs
2198 result = []
2198 result = []
2199 for n in nodes:
2199 for n in nodes:
2200 r = get_rev(n)
2200 r = get_rev(n)
2201 resp = not (r is None or r in filtered)
2201 resp = not (r is None or r in filtered)
2202 result.append(resp)
2202 result.append(resp)
2203 return result
2203 return result
2204
2204
2205 def local(self):
2205 def local(self):
2206 return self
2206 return self
2207
2207
2208 def publishing(self):
2208 def publishing(self):
2209 # it's safe (and desirable) to trust the publish flag unconditionally
2209 # it's safe (and desirable) to trust the publish flag unconditionally
2210 # so that we don't finalize changes shared between users via ssh or nfs
2210 # so that we don't finalize changes shared between users via ssh or nfs
2211 return self.ui.configbool(b'phases', b'publish', untrusted=True)
2211 return self.ui.configbool(b'phases', b'publish', untrusted=True)
2212
2212
2213 def cancopy(self):
2213 def cancopy(self):
2214 # so statichttprepo's override of local() works
2214 # so statichttprepo's override of local() works
2215 if not self.local():
2215 if not self.local():
2216 return False
2216 return False
2217 if not self.publishing():
2217 if not self.publishing():
2218 return True
2218 return True
2219 # if publishing we can't copy if there is filtered content
2219 # if publishing we can't copy if there is filtered content
2220 return not self.filtered(b'visible').changelog.filteredrevs
2220 return not self.filtered(b'visible').changelog.filteredrevs
2221
2221
2222 def shared(self):
2222 def shared(self):
2223 '''the type of shared repository (None if not shared)'''
2223 '''the type of shared repository (None if not shared)'''
2224 if self.sharedpath != self.path:
2224 if self.sharedpath != self.path:
2225 return b'store'
2225 return b'store'
2226 return None
2226 return None
2227
2227
2228 def wjoin(self, f, *insidef):
2228 def wjoin(self, f, *insidef):
2229 return self.vfs.reljoin(self.root, f, *insidef)
2229 return self.vfs.reljoin(self.root, f, *insidef)
2230
2230
2231 def setparents(self, p1, p2=None):
2231 def setparents(self, p1, p2=None):
2232 if p2 is None:
2232 if p2 is None:
2233 p2 = self.nullid
2233 p2 = self.nullid
2234 self[None].setparents(p1, p2)
2234 self[None].setparents(p1, p2)
2235 self._quick_access_changeid_invalidate()
2235 self._quick_access_changeid_invalidate()
2236
2236
2237 def filectx(self, path, changeid=None, fileid=None, changectx=None):
2237 def filectx(self, path, changeid=None, fileid=None, changectx=None):
2238 """changeid must be a changeset revision, if specified.
2238 """changeid must be a changeset revision, if specified.
2239 fileid can be a file revision or node."""
2239 fileid can be a file revision or node."""
2240 return context.filectx(
2240 return context.filectx(
2241 self, path, changeid, fileid, changectx=changectx
2241 self, path, changeid, fileid, changectx=changectx
2242 )
2242 )
2243
2243
2244 def getcwd(self):
2244 def getcwd(self):
2245 return self.dirstate.getcwd()
2245 return self.dirstate.getcwd()
2246
2246
2247 def pathto(self, f, cwd=None):
2247 def pathto(self, f, cwd=None):
2248 return self.dirstate.pathto(f, cwd)
2248 return self.dirstate.pathto(f, cwd)
2249
2249
2250 def _loadfilter(self, filter):
2250 def _loadfilter(self, filter):
2251 if filter not in self._filterpats:
2251 if filter not in self._filterpats:
2252 l = []
2252 l = []
2253 for pat, cmd in self.ui.configitems(filter):
2253 for pat, cmd in self.ui.configitems(filter):
2254 if cmd == b'!':
2254 if cmd == b'!':
2255 continue
2255 continue
2256 mf = matchmod.match(self.root, b'', [pat])
2256 mf = matchmod.match(self.root, b'', [pat])
2257 fn = None
2257 fn = None
2258 params = cmd
2258 params = cmd
2259 for name, filterfn in pycompat.iteritems(self._datafilters):
2259 for name, filterfn in pycompat.iteritems(self._datafilters):
2260 if cmd.startswith(name):
2260 if cmd.startswith(name):
2261 fn = filterfn
2261 fn = filterfn
2262 params = cmd[len(name) :].lstrip()
2262 params = cmd[len(name) :].lstrip()
2263 break
2263 break
2264 if not fn:
2264 if not fn:
2265 fn = lambda s, c, **kwargs: procutil.filter(s, c)
2265 fn = lambda s, c, **kwargs: procutil.filter(s, c)
2266 fn.__name__ = 'commandfilter'
2266 fn.__name__ = 'commandfilter'
2267 # Wrap old filters not supporting keyword arguments
2267 # Wrap old filters not supporting keyword arguments
2268 if not pycompat.getargspec(fn)[2]:
2268 if not pycompat.getargspec(fn)[2]:
2269 oldfn = fn
2269 oldfn = fn
2270 fn = lambda s, c, oldfn=oldfn, **kwargs: oldfn(s, c)
2270 fn = lambda s, c, oldfn=oldfn, **kwargs: oldfn(s, c)
2271 fn.__name__ = 'compat-' + oldfn.__name__
2271 fn.__name__ = 'compat-' + oldfn.__name__
2272 l.append((mf, fn, params))
2272 l.append((mf, fn, params))
2273 self._filterpats[filter] = l
2273 self._filterpats[filter] = l
2274 return self._filterpats[filter]
2274 return self._filterpats[filter]
2275
2275
2276 def _filter(self, filterpats, filename, data):
2276 def _filter(self, filterpats, filename, data):
2277 for mf, fn, cmd in filterpats:
2277 for mf, fn, cmd in filterpats:
2278 if mf(filename):
2278 if mf(filename):
2279 self.ui.debug(
2279 self.ui.debug(
2280 b"filtering %s through %s\n"
2280 b"filtering %s through %s\n"
2281 % (filename, cmd or pycompat.sysbytes(fn.__name__))
2281 % (filename, cmd or pycompat.sysbytes(fn.__name__))
2282 )
2282 )
2283 data = fn(data, cmd, ui=self.ui, repo=self, filename=filename)
2283 data = fn(data, cmd, ui=self.ui, repo=self, filename=filename)
2284 break
2284 break
2285
2285
2286 return data
2286 return data
2287
2287
2288 @unfilteredpropertycache
2288 @unfilteredpropertycache
2289 def _encodefilterpats(self):
2289 def _encodefilterpats(self):
2290 return self._loadfilter(b'encode')
2290 return self._loadfilter(b'encode')
2291
2291
2292 @unfilteredpropertycache
2292 @unfilteredpropertycache
2293 def _decodefilterpats(self):
2293 def _decodefilterpats(self):
2294 return self._loadfilter(b'decode')
2294 return self._loadfilter(b'decode')
2295
2295
2296 def adddatafilter(self, name, filter):
2296 def adddatafilter(self, name, filter):
2297 self._datafilters[name] = filter
2297 self._datafilters[name] = filter
2298
2298
2299 def wread(self, filename):
2299 def wread(self, filename):
2300 if self.wvfs.islink(filename):
2300 if self.wvfs.islink(filename):
2301 data = self.wvfs.readlink(filename)
2301 data = self.wvfs.readlink(filename)
2302 else:
2302 else:
2303 data = self.wvfs.read(filename)
2303 data = self.wvfs.read(filename)
2304 return self._filter(self._encodefilterpats, filename, data)
2304 return self._filter(self._encodefilterpats, filename, data)
2305
2305
2306 def wwrite(self, filename, data, flags, backgroundclose=False, **kwargs):
2306 def wwrite(self, filename, data, flags, backgroundclose=False, **kwargs):
2307 """write ``data`` into ``filename`` in the working directory
2307 """write ``data`` into ``filename`` in the working directory
2308
2308
2309 This returns length of written (maybe decoded) data.
2309 This returns length of written (maybe decoded) data.
2310 """
2310 """
2311 data = self._filter(self._decodefilterpats, filename, data)
2311 data = self._filter(self._decodefilterpats, filename, data)
2312 if b'l' in flags:
2312 if b'l' in flags:
2313 self.wvfs.symlink(data, filename)
2313 self.wvfs.symlink(data, filename)
2314 else:
2314 else:
2315 self.wvfs.write(
2315 self.wvfs.write(
2316 filename, data, backgroundclose=backgroundclose, **kwargs
2316 filename, data, backgroundclose=backgroundclose, **kwargs
2317 )
2317 )
2318 if b'x' in flags:
2318 if b'x' in flags:
2319 self.wvfs.setflags(filename, False, True)
2319 self.wvfs.setflags(filename, False, True)
2320 else:
2320 else:
2321 self.wvfs.setflags(filename, False, False)
2321 self.wvfs.setflags(filename, False, False)
2322 return len(data)
2322 return len(data)
2323
2323
2324 def wwritedata(self, filename, data):
2324 def wwritedata(self, filename, data):
2325 return self._filter(self._decodefilterpats, filename, data)
2325 return self._filter(self._decodefilterpats, filename, data)
2326
2326
2327 def currenttransaction(self):
2327 def currenttransaction(self):
2328 """return the current transaction or None if non exists"""
2328 """return the current transaction or None if non exists"""
2329 if self._transref:
2329 if self._transref:
2330 tr = self._transref()
2330 tr = self._transref()
2331 else:
2331 else:
2332 tr = None
2332 tr = None
2333
2333
2334 if tr and tr.running():
2334 if tr and tr.running():
2335 return tr
2335 return tr
2336 return None
2336 return None
2337
2337
2338 def transaction(self, desc, report=None):
2338 def transaction(self, desc, report=None):
2339 if self.ui.configbool(b'devel', b'all-warnings') or self.ui.configbool(
2339 if self.ui.configbool(b'devel', b'all-warnings') or self.ui.configbool(
2340 b'devel', b'check-locks'
2340 b'devel', b'check-locks'
2341 ):
2341 ):
2342 if self._currentlock(self._lockref) is None:
2342 if self._currentlock(self._lockref) is None:
2343 raise error.ProgrammingError(b'transaction requires locking')
2343 raise error.ProgrammingError(b'transaction requires locking')
2344 tr = self.currenttransaction()
2344 tr = self.currenttransaction()
2345 if tr is not None:
2345 if tr is not None:
2346 return tr.nest(name=desc)
2346 return tr.nest(name=desc)
2347
2347
2348 # abort here if the journal already exists
2348 # abort here if the journal already exists
2349 if self.svfs.exists(b"journal"):
2349 if self.svfs.exists(b"journal"):
2350 raise error.RepoError(
2350 raise error.RepoError(
2351 _(b"abandoned transaction found"),
2351 _(b"abandoned transaction found"),
2352 hint=_(b"run 'hg recover' to clean up transaction"),
2352 hint=_(b"run 'hg recover' to clean up transaction"),
2353 )
2353 )
2354
2354
2355 idbase = b"%.40f#%f" % (random.random(), time.time())
2355 idbase = b"%.40f#%f" % (random.random(), time.time())
2356 ha = hex(hashutil.sha1(idbase).digest())
2356 ha = hex(hashutil.sha1(idbase).digest())
2357 txnid = b'TXN:' + ha
2357 txnid = b'TXN:' + ha
2358 self.hook(b'pretxnopen', throw=True, txnname=desc, txnid=txnid)
2358 self.hook(b'pretxnopen', throw=True, txnname=desc, txnid=txnid)
2359
2359
2360 self._writejournal(desc)
2360 self._writejournal(desc)
2361 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
2361 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
2362 if report:
2362 if report:
2363 rp = report
2363 rp = report
2364 else:
2364 else:
2365 rp = self.ui.warn
2365 rp = self.ui.warn
2366 vfsmap = {b'plain': self.vfs, b'store': self.svfs} # root of .hg/
2366 vfsmap = {b'plain': self.vfs, b'store': self.svfs} # root of .hg/
2367 # we must avoid cyclic reference between repo and transaction.
2367 # we must avoid cyclic reference between repo and transaction.
2368 reporef = weakref.ref(self)
2368 reporef = weakref.ref(self)
2369 # Code to track tag movement
2369 # Code to track tag movement
2370 #
2370 #
2371 # Since tags are all handled as file content, it is actually quite hard
2371 # Since tags are all handled as file content, it is actually quite hard
2372 # to track these movement from a code perspective. So we fallback to a
2372 # to track these movement from a code perspective. So we fallback to a
2373 # tracking at the repository level. One could envision to track changes
2373 # tracking at the repository level. One could envision to track changes
2374 # to the '.hgtags' file through changegroup apply but that fails to
2374 # to the '.hgtags' file through changegroup apply but that fails to
2375 # cope with case where transaction expose new heads without changegroup
2375 # cope with case where transaction expose new heads without changegroup
2376 # being involved (eg: phase movement).
2376 # being involved (eg: phase movement).
2377 #
2377 #
2378 # For now, We gate the feature behind a flag since this likely comes
2378 # For now, We gate the feature behind a flag since this likely comes
2379 # with performance impacts. The current code run more often than needed
2379 # with performance impacts. The current code run more often than needed
2380 # and do not use caches as much as it could. The current focus is on
2380 # and do not use caches as much as it could. The current focus is on
2381 # the behavior of the feature so we disable it by default. The flag
2381 # the behavior of the feature so we disable it by default. The flag
2382 # will be removed when we are happy with the performance impact.
2382 # will be removed when we are happy with the performance impact.
2383 #
2383 #
2384 # Once this feature is no longer experimental move the following
2384 # Once this feature is no longer experimental move the following
2385 # documentation to the appropriate help section:
2385 # documentation to the appropriate help section:
2386 #
2386 #
2387 # The ``HG_TAG_MOVED`` variable will be set if the transaction touched
2387 # The ``HG_TAG_MOVED`` variable will be set if the transaction touched
2388 # tags (new or changed or deleted tags). In addition the details of
2388 # tags (new or changed or deleted tags). In addition the details of
2389 # these changes are made available in a file at:
2389 # these changes are made available in a file at:
2390 # ``REPOROOT/.hg/changes/tags.changes``.
2390 # ``REPOROOT/.hg/changes/tags.changes``.
2391 # Make sure you check for HG_TAG_MOVED before reading that file as it
2391 # Make sure you check for HG_TAG_MOVED before reading that file as it
2392 # might exist from a previous transaction even if no tag were touched
2392 # might exist from a previous transaction even if no tag were touched
2393 # in this one. Changes are recorded in a line base format::
2393 # in this one. Changes are recorded in a line base format::
2394 #
2394 #
2395 # <action> <hex-node> <tag-name>\n
2395 # <action> <hex-node> <tag-name>\n
2396 #
2396 #
2397 # Actions are defined as follow:
2397 # Actions are defined as follow:
2398 # "-R": tag is removed,
2398 # "-R": tag is removed,
2399 # "+A": tag is added,
2399 # "+A": tag is added,
2400 # "-M": tag is moved (old value),
2400 # "-M": tag is moved (old value),
2401 # "+M": tag is moved (new value),
2401 # "+M": tag is moved (new value),
2402 tracktags = lambda x: None
2402 tracktags = lambda x: None
2403 # experimental config: experimental.hook-track-tags
2403 # experimental config: experimental.hook-track-tags
2404 shouldtracktags = self.ui.configbool(
2404 shouldtracktags = self.ui.configbool(
2405 b'experimental', b'hook-track-tags'
2405 b'experimental', b'hook-track-tags'
2406 )
2406 )
2407 if desc != b'strip' and shouldtracktags:
2407 if desc != b'strip' and shouldtracktags:
2408 oldheads = self.changelog.headrevs()
2408 oldheads = self.changelog.headrevs()
2409
2409
2410 def tracktags(tr2):
2410 def tracktags(tr2):
2411 repo = reporef()
2411 repo = reporef()
2412 assert repo is not None # help pytype
2412 assert repo is not None # help pytype
2413 oldfnodes = tagsmod.fnoderevs(repo.ui, repo, oldheads)
2413 oldfnodes = tagsmod.fnoderevs(repo.ui, repo, oldheads)
2414 newheads = repo.changelog.headrevs()
2414 newheads = repo.changelog.headrevs()
2415 newfnodes = tagsmod.fnoderevs(repo.ui, repo, newheads)
2415 newfnodes = tagsmod.fnoderevs(repo.ui, repo, newheads)
2416 # notes: we compare lists here.
2416 # notes: we compare lists here.
2417 # As we do it only once buiding set would not be cheaper
2417 # As we do it only once buiding set would not be cheaper
2418 changes = tagsmod.difftags(repo.ui, repo, oldfnodes, newfnodes)
2418 changes = tagsmod.difftags(repo.ui, repo, oldfnodes, newfnodes)
2419 if changes:
2419 if changes:
2420 tr2.hookargs[b'tag_moved'] = b'1'
2420 tr2.hookargs[b'tag_moved'] = b'1'
2421 with repo.vfs(
2421 with repo.vfs(
2422 b'changes/tags.changes', b'w', atomictemp=True
2422 b'changes/tags.changes', b'w', atomictemp=True
2423 ) as changesfile:
2423 ) as changesfile:
2424 # note: we do not register the file to the transaction
2424 # note: we do not register the file to the transaction
2425 # because we needs it to still exist on the transaction
2425 # because we needs it to still exist on the transaction
2426 # is close (for txnclose hooks)
2426 # is close (for txnclose hooks)
2427 tagsmod.writediff(changesfile, changes)
2427 tagsmod.writediff(changesfile, changes)
2428
2428
2429 def validate(tr2):
2429 def validate(tr2):
2430 """will run pre-closing hooks"""
2430 """will run pre-closing hooks"""
2431 # XXX the transaction API is a bit lacking here so we take a hacky
2431 # XXX the transaction API is a bit lacking here so we take a hacky
2432 # path for now
2432 # path for now
2433 #
2433 #
2434 # We cannot add this as a "pending" hooks since the 'tr.hookargs'
2434 # We cannot add this as a "pending" hooks since the 'tr.hookargs'
2435 # dict is copied before these run. In addition we needs the data
2435 # dict is copied before these run. In addition we needs the data
2436 # available to in memory hooks too.
2436 # available to in memory hooks too.
2437 #
2437 #
2438 # Moreover, we also need to make sure this runs before txnclose
2438 # Moreover, we also need to make sure this runs before txnclose
2439 # hooks and there is no "pending" mechanism that would execute
2439 # hooks and there is no "pending" mechanism that would execute
2440 # logic only if hooks are about to run.
2440 # logic only if hooks are about to run.
2441 #
2441 #
2442 # Fixing this limitation of the transaction is also needed to track
2442 # Fixing this limitation of the transaction is also needed to track
2443 # other families of changes (bookmarks, phases, obsolescence).
2443 # other families of changes (bookmarks, phases, obsolescence).
2444 #
2444 #
2445 # This will have to be fixed before we remove the experimental
2445 # This will have to be fixed before we remove the experimental
2446 # gating.
2446 # gating.
2447 tracktags(tr2)
2447 tracktags(tr2)
2448 repo = reporef()
2448 repo = reporef()
2449 assert repo is not None # help pytype
2449 assert repo is not None # help pytype
2450
2450
2451 singleheadopt = (b'experimental', b'single-head-per-branch')
2451 singleheadopt = (b'experimental', b'single-head-per-branch')
2452 singlehead = repo.ui.configbool(*singleheadopt)
2452 singlehead = repo.ui.configbool(*singleheadopt)
2453 if singlehead:
2453 if singlehead:
2454 singleheadsub = repo.ui.configsuboptions(*singleheadopt)[1]
2454 singleheadsub = repo.ui.configsuboptions(*singleheadopt)[1]
2455 accountclosed = singleheadsub.get(
2455 accountclosed = singleheadsub.get(
2456 b"account-closed-heads", False
2456 b"account-closed-heads", False
2457 )
2457 )
2458 if singleheadsub.get(b"public-changes-only", False):
2458 if singleheadsub.get(b"public-changes-only", False):
2459 filtername = b"immutable"
2459 filtername = b"immutable"
2460 else:
2460 else:
2461 filtername = b"visible"
2461 filtername = b"visible"
2462 scmutil.enforcesinglehead(
2462 scmutil.enforcesinglehead(
2463 repo, tr2, desc, accountclosed, filtername
2463 repo, tr2, desc, accountclosed, filtername
2464 )
2464 )
2465 if hook.hashook(repo.ui, b'pretxnclose-bookmark'):
2465 if hook.hashook(repo.ui, b'pretxnclose-bookmark'):
2466 for name, (old, new) in sorted(
2466 for name, (old, new) in sorted(
2467 tr.changes[b'bookmarks'].items()
2467 tr.changes[b'bookmarks'].items()
2468 ):
2468 ):
2469 args = tr.hookargs.copy()
2469 args = tr.hookargs.copy()
2470 args.update(bookmarks.preparehookargs(name, old, new))
2470 args.update(bookmarks.preparehookargs(name, old, new))
2471 repo.hook(
2471 repo.hook(
2472 b'pretxnclose-bookmark',
2472 b'pretxnclose-bookmark',
2473 throw=True,
2473 throw=True,
2474 **pycompat.strkwargs(args)
2474 **pycompat.strkwargs(args)
2475 )
2475 )
2476 if hook.hashook(repo.ui, b'pretxnclose-phase'):
2476 if hook.hashook(repo.ui, b'pretxnclose-phase'):
2477 cl = repo.unfiltered().changelog
2477 cl = repo.unfiltered().changelog
2478 for revs, (old, new) in tr.changes[b'phases']:
2478 for revs, (old, new) in tr.changes[b'phases']:
2479 for rev in revs:
2479 for rev in revs:
2480 args = tr.hookargs.copy()
2480 args = tr.hookargs.copy()
2481 node = hex(cl.node(rev))
2481 node = hex(cl.node(rev))
2482 args.update(phases.preparehookargs(node, old, new))
2482 args.update(phases.preparehookargs(node, old, new))
2483 repo.hook(
2483 repo.hook(
2484 b'pretxnclose-phase',
2484 b'pretxnclose-phase',
2485 throw=True,
2485 throw=True,
2486 **pycompat.strkwargs(args)
2486 **pycompat.strkwargs(args)
2487 )
2487 )
2488
2488
2489 repo.hook(
2489 repo.hook(
2490 b'pretxnclose', throw=True, **pycompat.strkwargs(tr.hookargs)
2490 b'pretxnclose', throw=True, **pycompat.strkwargs(tr.hookargs)
2491 )
2491 )
2492
2492
2493 def releasefn(tr, success):
2493 def releasefn(tr, success):
2494 repo = reporef()
2494 repo = reporef()
2495 if repo is None:
2495 if repo is None:
2496 # If the repo has been GC'd (and this release function is being
2496 # If the repo has been GC'd (and this release function is being
2497 # called from transaction.__del__), there's not much we can do,
2497 # called from transaction.__del__), there's not much we can do,
2498 # so just leave the unfinished transaction there and let the
2498 # so just leave the unfinished transaction there and let the
2499 # user run `hg recover`.
2499 # user run `hg recover`.
2500 return
2500 return
2501 if success:
2501 if success:
2502 # this should be explicitly invoked here, because
2502 # this should be explicitly invoked here, because
2503 # in-memory changes aren't written out at closing
2503 # in-memory changes aren't written out at closing
2504 # transaction, if tr.addfilegenerator (via
2504 # transaction, if tr.addfilegenerator (via
2505 # dirstate.write or so) isn't invoked while
2505 # dirstate.write or so) isn't invoked while
2506 # transaction running
2506 # transaction running
2507 repo.dirstate.write(None)
2507 repo.dirstate.write(None)
2508 else:
2508 else:
2509 # discard all changes (including ones already written
2509 # discard all changes (including ones already written
2510 # out) in this transaction
2510 # out) in this transaction
2511 narrowspec.restorebackup(self, b'journal.narrowspec')
2511 narrowspec.restorebackup(self, b'journal.narrowspec')
2512 narrowspec.restorewcbackup(self, b'journal.narrowspec.dirstate')
2512 narrowspec.restorewcbackup(self, b'journal.narrowspec.dirstate')
2513 repo.dirstate.restorebackup(None, b'journal.dirstate')
2513 repo.dirstate.restorebackup(None, b'journal.dirstate')
2514
2514
2515 repo.invalidate(clearfilecache=True)
2515 repo.invalidate(clearfilecache=True)
2516
2516
2517 tr = transaction.transaction(
2517 tr = transaction.transaction(
2518 rp,
2518 rp,
2519 self.svfs,
2519 self.svfs,
2520 vfsmap,
2520 vfsmap,
2521 b"journal",
2521 b"journal",
2522 b"undo",
2522 b"undo",
2523 aftertrans(renames),
2523 aftertrans(renames),
2524 self.store.createmode,
2524 self.store.createmode,
2525 validator=validate,
2525 validator=validate,
2526 releasefn=releasefn,
2526 releasefn=releasefn,
2527 checkambigfiles=_cachedfiles,
2527 checkambigfiles=_cachedfiles,
2528 name=desc,
2528 name=desc,
2529 )
2529 )
2530 tr.changes[b'origrepolen'] = len(self)
2530 tr.changes[b'origrepolen'] = len(self)
2531 tr.changes[b'obsmarkers'] = set()
2531 tr.changes[b'obsmarkers'] = set()
2532 tr.changes[b'phases'] = []
2532 tr.changes[b'phases'] = []
2533 tr.changes[b'bookmarks'] = {}
2533 tr.changes[b'bookmarks'] = {}
2534
2534
2535 tr.hookargs[b'txnid'] = txnid
2535 tr.hookargs[b'txnid'] = txnid
2536 tr.hookargs[b'txnname'] = desc
2536 tr.hookargs[b'txnname'] = desc
2537 tr.hookargs[b'changes'] = tr.changes
2537 tr.hookargs[b'changes'] = tr.changes
2538 # note: writing the fncache only during finalize mean that the file is
2538 # note: writing the fncache only during finalize mean that the file is
2539 # outdated when running hooks. As fncache is used for streaming clone,
2539 # outdated when running hooks. As fncache is used for streaming clone,
2540 # this is not expected to break anything that happen during the hooks.
2540 # this is not expected to break anything that happen during the hooks.
2541 tr.addfinalize(b'flush-fncache', self.store.write)
2541 tr.addfinalize(b'flush-fncache', self.store.write)
2542
2542
2543 def txnclosehook(tr2):
2543 def txnclosehook(tr2):
2544 """To be run if transaction is successful, will schedule a hook run"""
2544 """To be run if transaction is successful, will schedule a hook run"""
2545 # Don't reference tr2 in hook() so we don't hold a reference.
2545 # Don't reference tr2 in hook() so we don't hold a reference.
2546 # This reduces memory consumption when there are multiple
2546 # This reduces memory consumption when there are multiple
2547 # transactions per lock. This can likely go away if issue5045
2547 # transactions per lock. This can likely go away if issue5045
2548 # fixes the function accumulation.
2548 # fixes the function accumulation.
2549 hookargs = tr2.hookargs
2549 hookargs = tr2.hookargs
2550
2550
2551 def hookfunc(unused_success):
2551 def hookfunc(unused_success):
2552 repo = reporef()
2552 repo = reporef()
2553 assert repo is not None # help pytype
2553 assert repo is not None # help pytype
2554
2554
2555 if hook.hashook(repo.ui, b'txnclose-bookmark'):
2555 if hook.hashook(repo.ui, b'txnclose-bookmark'):
2556 bmchanges = sorted(tr.changes[b'bookmarks'].items())
2556 bmchanges = sorted(tr.changes[b'bookmarks'].items())
2557 for name, (old, new) in bmchanges:
2557 for name, (old, new) in bmchanges:
2558 args = tr.hookargs.copy()
2558 args = tr.hookargs.copy()
2559 args.update(bookmarks.preparehookargs(name, old, new))
2559 args.update(bookmarks.preparehookargs(name, old, new))
2560 repo.hook(
2560 repo.hook(
2561 b'txnclose-bookmark',
2561 b'txnclose-bookmark',
2562 throw=False,
2562 throw=False,
2563 **pycompat.strkwargs(args)
2563 **pycompat.strkwargs(args)
2564 )
2564 )
2565
2565
2566 if hook.hashook(repo.ui, b'txnclose-phase'):
2566 if hook.hashook(repo.ui, b'txnclose-phase'):
2567 cl = repo.unfiltered().changelog
2567 cl = repo.unfiltered().changelog
2568 phasemv = sorted(
2568 phasemv = sorted(
2569 tr.changes[b'phases'], key=lambda r: r[0][0]
2569 tr.changes[b'phases'], key=lambda r: r[0][0]
2570 )
2570 )
2571 for revs, (old, new) in phasemv:
2571 for revs, (old, new) in phasemv:
2572 for rev in revs:
2572 for rev in revs:
2573 args = tr.hookargs.copy()
2573 args = tr.hookargs.copy()
2574 node = hex(cl.node(rev))
2574 node = hex(cl.node(rev))
2575 args.update(phases.preparehookargs(node, old, new))
2575 args.update(phases.preparehookargs(node, old, new))
2576 repo.hook(
2576 repo.hook(
2577 b'txnclose-phase',
2577 b'txnclose-phase',
2578 throw=False,
2578 throw=False,
2579 **pycompat.strkwargs(args)
2579 **pycompat.strkwargs(args)
2580 )
2580 )
2581
2581
2582 repo.hook(
2582 repo.hook(
2583 b'txnclose', throw=False, **pycompat.strkwargs(hookargs)
2583 b'txnclose', throw=False, **pycompat.strkwargs(hookargs)
2584 )
2584 )
2585
2585
2586 repo = reporef()
2586 repo = reporef()
2587 assert repo is not None # help pytype
2587 assert repo is not None # help pytype
2588 repo._afterlock(hookfunc)
2588 repo._afterlock(hookfunc)
2589
2589
2590 tr.addfinalize(b'txnclose-hook', txnclosehook)
2590 tr.addfinalize(b'txnclose-hook', txnclosehook)
2591 # Include a leading "-" to make it happen before the transaction summary
2591 # Include a leading "-" to make it happen before the transaction summary
2592 # reports registered via scmutil.registersummarycallback() whose names
2592 # reports registered via scmutil.registersummarycallback() whose names
2593 # are 00-txnreport etc. That way, the caches will be warm when the
2593 # are 00-txnreport etc. That way, the caches will be warm when the
2594 # callbacks run.
2594 # callbacks run.
2595 tr.addpostclose(b'-warm-cache', self._buildcacheupdater(tr))
2595 tr.addpostclose(b'-warm-cache', self._buildcacheupdater(tr))
2596
2596
2597 def txnaborthook(tr2):
2597 def txnaborthook(tr2):
2598 """To be run if transaction is aborted"""
2598 """To be run if transaction is aborted"""
2599 repo = reporef()
2599 repo = reporef()
2600 assert repo is not None # help pytype
2600 assert repo is not None # help pytype
2601 repo.hook(
2601 repo.hook(
2602 b'txnabort', throw=False, **pycompat.strkwargs(tr2.hookargs)
2602 b'txnabort', throw=False, **pycompat.strkwargs(tr2.hookargs)
2603 )
2603 )
2604
2604
2605 tr.addabort(b'txnabort-hook', txnaborthook)
2605 tr.addabort(b'txnabort-hook', txnaborthook)
2606 # avoid eager cache invalidation. in-memory data should be identical
2606 # avoid eager cache invalidation. in-memory data should be identical
2607 # to stored data if transaction has no error.
2607 # to stored data if transaction has no error.
2608 tr.addpostclose(b'refresh-filecachestats', self._refreshfilecachestats)
2608 tr.addpostclose(b'refresh-filecachestats', self._refreshfilecachestats)
2609 self._transref = weakref.ref(tr)
2609 self._transref = weakref.ref(tr)
2610 scmutil.registersummarycallback(self, tr, desc)
2610 scmutil.registersummarycallback(self, tr, desc)
2611 return tr
2611 return tr
2612
2612
2613 def _journalfiles(self):
2613 def _journalfiles(self):
2614 return (
2614 return (
2615 (self.svfs, b'journal'),
2615 (self.svfs, b'journal'),
2616 (self.svfs, b'journal.narrowspec'),
2616 (self.svfs, b'journal.narrowspec'),
2617 (self.vfs, b'journal.narrowspec.dirstate'),
2617 (self.vfs, b'journal.narrowspec.dirstate'),
2618 (self.vfs, b'journal.dirstate'),
2618 (self.vfs, b'journal.dirstate'),
2619 (self.vfs, b'journal.branch'),
2619 (self.vfs, b'journal.branch'),
2620 (self.vfs, b'journal.desc'),
2620 (self.vfs, b'journal.desc'),
2621 (bookmarks.bookmarksvfs(self), b'journal.bookmarks'),
2621 (bookmarks.bookmarksvfs(self), b'journal.bookmarks'),
2622 (self.svfs, b'journal.phaseroots'),
2622 (self.svfs, b'journal.phaseroots'),
2623 )
2623 )
2624
2624
2625 def undofiles(self):
2625 def undofiles(self):
2626 return [(vfs, undoname(x)) for vfs, x in self._journalfiles()]
2626 return [(vfs, undoname(x)) for vfs, x in self._journalfiles()]
2627
2627
2628 @unfilteredmethod
2628 @unfilteredmethod
2629 def _writejournal(self, desc):
2629 def _writejournal(self, desc):
2630 self.dirstate.savebackup(None, b'journal.dirstate')
2630 self.dirstate.savebackup(None, b'journal.dirstate')
2631 narrowspec.savewcbackup(self, b'journal.narrowspec.dirstate')
2631 narrowspec.savewcbackup(self, b'journal.narrowspec.dirstate')
2632 narrowspec.savebackup(self, b'journal.narrowspec')
2632 narrowspec.savebackup(self, b'journal.narrowspec')
2633 self.vfs.write(
2633 self.vfs.write(
2634 b"journal.branch", encoding.fromlocal(self.dirstate.branch())
2634 b"journal.branch", encoding.fromlocal(self.dirstate.branch())
2635 )
2635 )
2636 self.vfs.write(b"journal.desc", b"%d\n%s\n" % (len(self), desc))
2636 self.vfs.write(b"journal.desc", b"%d\n%s\n" % (len(self), desc))
2637 bookmarksvfs = bookmarks.bookmarksvfs(self)
2637 bookmarksvfs = bookmarks.bookmarksvfs(self)
2638 bookmarksvfs.write(
2638 bookmarksvfs.write(
2639 b"journal.bookmarks", bookmarksvfs.tryread(b"bookmarks")
2639 b"journal.bookmarks", bookmarksvfs.tryread(b"bookmarks")
2640 )
2640 )
2641 self.svfs.write(b"journal.phaseroots", self.svfs.tryread(b"phaseroots"))
2641 self.svfs.write(b"journal.phaseroots", self.svfs.tryread(b"phaseroots"))
2642
2642
2643 def recover(self):
2643 def recover(self):
2644 with self.lock():
2644 with self.lock():
2645 if self.svfs.exists(b"journal"):
2645 if self.svfs.exists(b"journal"):
2646 self.ui.status(_(b"rolling back interrupted transaction\n"))
2646 self.ui.status(_(b"rolling back interrupted transaction\n"))
2647 vfsmap = {
2647 vfsmap = {
2648 b'': self.svfs,
2648 b'': self.svfs,
2649 b'plain': self.vfs,
2649 b'plain': self.vfs,
2650 }
2650 }
2651 transaction.rollback(
2651 transaction.rollback(
2652 self.svfs,
2652 self.svfs,
2653 vfsmap,
2653 vfsmap,
2654 b"journal",
2654 b"journal",
2655 self.ui.warn,
2655 self.ui.warn,
2656 checkambigfiles=_cachedfiles,
2656 checkambigfiles=_cachedfiles,
2657 )
2657 )
2658 self.invalidate()
2658 self.invalidate()
2659 return True
2659 return True
2660 else:
2660 else:
2661 self.ui.warn(_(b"no interrupted transaction available\n"))
2661 self.ui.warn(_(b"no interrupted transaction available\n"))
2662 return False
2662 return False
2663
2663
2664 def rollback(self, dryrun=False, force=False):
2664 def rollback(self, dryrun=False, force=False):
2665 wlock = lock = dsguard = None
2665 wlock = lock = dsguard = None
2666 try:
2666 try:
2667 wlock = self.wlock()
2667 wlock = self.wlock()
2668 lock = self.lock()
2668 lock = self.lock()
2669 if self.svfs.exists(b"undo"):
2669 if self.svfs.exists(b"undo"):
2670 dsguard = dirstateguard.dirstateguard(self, b'rollback')
2670 dsguard = dirstateguard.dirstateguard(self, b'rollback')
2671
2671
2672 return self._rollback(dryrun, force, dsguard)
2672 return self._rollback(dryrun, force, dsguard)
2673 else:
2673 else:
2674 self.ui.warn(_(b"no rollback information available\n"))
2674 self.ui.warn(_(b"no rollback information available\n"))
2675 return 1
2675 return 1
2676 finally:
2676 finally:
2677 release(dsguard, lock, wlock)
2677 release(dsguard, lock, wlock)
2678
2678
2679 @unfilteredmethod # Until we get smarter cache management
2679 @unfilteredmethod # Until we get smarter cache management
2680 def _rollback(self, dryrun, force, dsguard):
2680 def _rollback(self, dryrun, force, dsguard):
2681 ui = self.ui
2681 ui = self.ui
2682 try:
2682 try:
2683 args = self.vfs.read(b'undo.desc').splitlines()
2683 args = self.vfs.read(b'undo.desc').splitlines()
2684 (oldlen, desc, detail) = (int(args[0]), args[1], None)
2684 (oldlen, desc, detail) = (int(args[0]), args[1], None)
2685 if len(args) >= 3:
2685 if len(args) >= 3:
2686 detail = args[2]
2686 detail = args[2]
2687 oldtip = oldlen - 1
2687 oldtip = oldlen - 1
2688
2688
2689 if detail and ui.verbose:
2689 if detail and ui.verbose:
2690 msg = _(
2690 msg = _(
2691 b'repository tip rolled back to revision %d'
2691 b'repository tip rolled back to revision %d'
2692 b' (undo %s: %s)\n'
2692 b' (undo %s: %s)\n'
2693 ) % (oldtip, desc, detail)
2693 ) % (oldtip, desc, detail)
2694 else:
2694 else:
2695 msg = _(
2695 msg = _(
2696 b'repository tip rolled back to revision %d (undo %s)\n'
2696 b'repository tip rolled back to revision %d (undo %s)\n'
2697 ) % (oldtip, desc)
2697 ) % (oldtip, desc)
2698 except IOError:
2698 except IOError:
2699 msg = _(b'rolling back unknown transaction\n')
2699 msg = _(b'rolling back unknown transaction\n')
2700 desc = None
2700 desc = None
2701
2701
2702 if not force and self[b'.'] != self[b'tip'] and desc == b'commit':
2702 if not force and self[b'.'] != self[b'tip'] and desc == b'commit':
2703 raise error.Abort(
2703 raise error.Abort(
2704 _(
2704 _(
2705 b'rollback of last commit while not checked out '
2705 b'rollback of last commit while not checked out '
2706 b'may lose data'
2706 b'may lose data'
2707 ),
2707 ),
2708 hint=_(b'use -f to force'),
2708 hint=_(b'use -f to force'),
2709 )
2709 )
2710
2710
2711 ui.status(msg)
2711 ui.status(msg)
2712 if dryrun:
2712 if dryrun:
2713 return 0
2713 return 0
2714
2714
2715 parents = self.dirstate.parents()
2715 parents = self.dirstate.parents()
2716 self.destroying()
2716 self.destroying()
2717 vfsmap = {b'plain': self.vfs, b'': self.svfs}
2717 vfsmap = {b'plain': self.vfs, b'': self.svfs}
2718 transaction.rollback(
2718 transaction.rollback(
2719 self.svfs, vfsmap, b'undo', ui.warn, checkambigfiles=_cachedfiles
2719 self.svfs, vfsmap, b'undo', ui.warn, checkambigfiles=_cachedfiles
2720 )
2720 )
2721 bookmarksvfs = bookmarks.bookmarksvfs(self)
2721 bookmarksvfs = bookmarks.bookmarksvfs(self)
2722 if bookmarksvfs.exists(b'undo.bookmarks'):
2722 if bookmarksvfs.exists(b'undo.bookmarks'):
2723 bookmarksvfs.rename(
2723 bookmarksvfs.rename(
2724 b'undo.bookmarks', b'bookmarks', checkambig=True
2724 b'undo.bookmarks', b'bookmarks', checkambig=True
2725 )
2725 )
2726 if self.svfs.exists(b'undo.phaseroots'):
2726 if self.svfs.exists(b'undo.phaseroots'):
2727 self.svfs.rename(b'undo.phaseroots', b'phaseroots', checkambig=True)
2727 self.svfs.rename(b'undo.phaseroots', b'phaseroots', checkambig=True)
2728 self.invalidate()
2728 self.invalidate()
2729
2729
2730 has_node = self.changelog.index.has_node
2730 has_node = self.changelog.index.has_node
2731 parentgone = any(not has_node(p) for p in parents)
2731 parentgone = any(not has_node(p) for p in parents)
2732 if parentgone:
2732 if parentgone:
2733 # prevent dirstateguard from overwriting already restored one
2733 # prevent dirstateguard from overwriting already restored one
2734 dsguard.close()
2734 dsguard.close()
2735
2735
2736 narrowspec.restorebackup(self, b'undo.narrowspec')
2736 narrowspec.restorebackup(self, b'undo.narrowspec')
2737 narrowspec.restorewcbackup(self, b'undo.narrowspec.dirstate')
2737 narrowspec.restorewcbackup(self, b'undo.narrowspec.dirstate')
2738 self.dirstate.restorebackup(None, b'undo.dirstate')
2738 self.dirstate.restorebackup(None, b'undo.dirstate')
2739 try:
2739 try:
2740 branch = self.vfs.read(b'undo.branch')
2740 branch = self.vfs.read(b'undo.branch')
2741 self.dirstate.setbranch(encoding.tolocal(branch))
2741 self.dirstate.setbranch(encoding.tolocal(branch))
2742 except IOError:
2742 except IOError:
2743 ui.warn(
2743 ui.warn(
2744 _(
2744 _(
2745 b'named branch could not be reset: '
2745 b'named branch could not be reset: '
2746 b'current branch is still \'%s\'\n'
2746 b'current branch is still \'%s\'\n'
2747 )
2747 )
2748 % self.dirstate.branch()
2748 % self.dirstate.branch()
2749 )
2749 )
2750
2750
2751 parents = tuple([p.rev() for p in self[None].parents()])
2751 parents = tuple([p.rev() for p in self[None].parents()])
2752 if len(parents) > 1:
2752 if len(parents) > 1:
2753 ui.status(
2753 ui.status(
2754 _(
2754 _(
2755 b'working directory now based on '
2755 b'working directory now based on '
2756 b'revisions %d and %d\n'
2756 b'revisions %d and %d\n'
2757 )
2757 )
2758 % parents
2758 % parents
2759 )
2759 )
2760 else:
2760 else:
2761 ui.status(
2761 ui.status(
2762 _(b'working directory now based on revision %d\n') % parents
2762 _(b'working directory now based on revision %d\n') % parents
2763 )
2763 )
2764 mergestatemod.mergestate.clean(self)
2764 mergestatemod.mergestate.clean(self)
2765
2765
2766 # TODO: if we know which new heads may result from this rollback, pass
2766 # TODO: if we know which new heads may result from this rollback, pass
2767 # them to destroy(), which will prevent the branchhead cache from being
2767 # them to destroy(), which will prevent the branchhead cache from being
2768 # invalidated.
2768 # invalidated.
2769 self.destroyed()
2769 self.destroyed()
2770 return 0
2770 return 0
2771
2771
2772 def _buildcacheupdater(self, newtransaction):
2772 def _buildcacheupdater(self, newtransaction):
2773 """called during transaction to build the callback updating cache
2773 """called during transaction to build the callback updating cache
2774
2774
2775 Lives on the repository to help extension who might want to augment
2775 Lives on the repository to help extension who might want to augment
2776 this logic. For this purpose, the created transaction is passed to the
2776 this logic. For this purpose, the created transaction is passed to the
2777 method.
2777 method.
2778 """
2778 """
2779 # we must avoid cyclic reference between repo and transaction.
2779 # we must avoid cyclic reference between repo and transaction.
2780 reporef = weakref.ref(self)
2780 reporef = weakref.ref(self)
2781
2781
2782 def updater(tr):
2782 def updater(tr):
2783 repo = reporef()
2783 repo = reporef()
2784 assert repo is not None # help pytype
2784 assert repo is not None # help pytype
2785 repo.updatecaches(tr)
2785 repo.updatecaches(tr)
2786
2786
2787 return updater
2787 return updater
2788
2788
2789 @unfilteredmethod
2789 @unfilteredmethod
2790 def updatecaches(self, tr=None, full=False, caches=None):
2790 def updatecaches(self, tr=None, full=False, caches=None):
2791 """warm appropriate caches
2791 """warm appropriate caches
2792
2792
2793 If this function is called after a transaction closed. The transaction
2793 If this function is called after a transaction closed. The transaction
2794 will be available in the 'tr' argument. This can be used to selectively
2794 will be available in the 'tr' argument. This can be used to selectively
2795 update caches relevant to the changes in that transaction.
2795 update caches relevant to the changes in that transaction.
2796
2796
2797 If 'full' is set, make sure all caches the function knows about have
2797 If 'full' is set, make sure all caches the function knows about have
2798 up-to-date data. Even the ones usually loaded more lazily.
2798 up-to-date data. Even the ones usually loaded more lazily.
2799
2799
2800 The `full` argument can take a special "post-clone" value. In this case
2800 The `full` argument can take a special "post-clone" value. In this case
2801 the cache warming is made after a clone and of the slower cache might
2801 the cache warming is made after a clone and of the slower cache might
2802 be skipped, namely the `.fnodetags` one. This argument is 5.8 specific
2802 be skipped, namely the `.fnodetags` one. This argument is 5.8 specific
2803 as we plan for a cleaner way to deal with this for 5.9.
2803 as we plan for a cleaner way to deal with this for 5.9.
2804 """
2804 """
2805 if tr is not None and tr.hookargs.get(b'source') == b'strip':
2805 if tr is not None and tr.hookargs.get(b'source') == b'strip':
2806 # During strip, many caches are invalid but
2806 # During strip, many caches are invalid but
2807 # later call to `destroyed` will refresh them.
2807 # later call to `destroyed` will refresh them.
2808 return
2808 return
2809
2809
2810 unfi = self.unfiltered()
2810 unfi = self.unfiltered()
2811
2811
2812 if full:
2812 if full:
2813 msg = (
2813 msg = (
2814 "`full` argument for `repo.updatecaches` is deprecated\n"
2814 "`full` argument for `repo.updatecaches` is deprecated\n"
2815 "(use `caches=repository.CACHE_ALL` instead)"
2815 "(use `caches=repository.CACHE_ALL` instead)"
2816 )
2816 )
2817 self.ui.deprecwarn(msg, b"5.9")
2817 self.ui.deprecwarn(msg, b"5.9")
2818 caches = repository.CACHES_ALL
2818 caches = repository.CACHES_ALL
2819 if full == b"post-clone":
2819 if full == b"post-clone":
2820 caches = repository.CACHES_POST_CLONE
2820 caches = repository.CACHES_POST_CLONE
2821 caches = repository.CACHES_ALL
2821 caches = repository.CACHES_ALL
2822 elif caches is None:
2822 elif caches is None:
2823 caches = repository.CACHES_DEFAULT
2823 caches = repository.CACHES_DEFAULT
2824
2824
2825 if repository.CACHE_BRANCHMAP_SERVED in caches:
2825 if repository.CACHE_BRANCHMAP_SERVED in caches:
2826 if tr is None or tr.changes[b'origrepolen'] < len(self):
2826 if tr is None or tr.changes[b'origrepolen'] < len(self):
2827 # accessing the 'served' branchmap should refresh all the others,
2827 # accessing the 'served' branchmap should refresh all the others,
2828 self.ui.debug(b'updating the branch cache\n')
2828 self.ui.debug(b'updating the branch cache\n')
2829 self.filtered(b'served').branchmap()
2829 self.filtered(b'served').branchmap()
2830 self.filtered(b'served.hidden').branchmap()
2830 self.filtered(b'served.hidden').branchmap()
2831 # flush all possibly delayed write.
2831 # flush all possibly delayed write.
2832 self._branchcaches.write_delayed(self)
2832 self._branchcaches.write_delayed(self)
2833
2833
2834 if repository.CACHE_CHANGELOG_CACHE in caches:
2834 if repository.CACHE_CHANGELOG_CACHE in caches:
2835 self.changelog.update_caches(transaction=tr)
2835 self.changelog.update_caches(transaction=tr)
2836
2836
2837 if repository.CACHE_MANIFESTLOG_CACHE in caches:
2837 if repository.CACHE_MANIFESTLOG_CACHE in caches:
2838 self.manifestlog.update_caches(transaction=tr)
2838 self.manifestlog.update_caches(transaction=tr)
2839
2839
2840 if repository.CACHE_REV_BRANCH in caches:
2840 if repository.CACHE_REV_BRANCH in caches:
2841 rbc = unfi.revbranchcache()
2841 rbc = unfi.revbranchcache()
2842 for r in unfi.changelog:
2842 for r in unfi.changelog:
2843 rbc.branchinfo(r)
2843 rbc.branchinfo(r)
2844 rbc.write()
2844 rbc.write()
2845
2845
2846 if repository.CACHE_FULL_MANIFEST in caches:
2846 if repository.CACHE_FULL_MANIFEST in caches:
2847 # ensure the working copy parents are in the manifestfulltextcache
2847 # ensure the working copy parents are in the manifestfulltextcache
2848 for ctx in self[b'.'].parents():
2848 for ctx in self[b'.'].parents():
2849 ctx.manifest() # accessing the manifest is enough
2849 ctx.manifest() # accessing the manifest is enough
2850
2850
2851 if repository.CACHE_FILE_NODE_TAGS in caches:
2851 if repository.CACHE_FILE_NODE_TAGS in caches:
2852 # accessing fnode cache warms the cache
2852 # accessing fnode cache warms the cache
2853 tagsmod.fnoderevs(self.ui, unfi, unfi.changelog.revs())
2853 tagsmod.fnoderevs(self.ui, unfi, unfi.changelog.revs())
2854
2854
2855 if repository.CACHE_TAGS_DEFAULT in caches:
2855 if repository.CACHE_TAGS_DEFAULT in caches:
2856 # accessing tags warm the cache
2856 # accessing tags warm the cache
2857 self.tags()
2857 self.tags()
2858 if repository.CACHE_TAGS_SERVED in caches:
2858 if repository.CACHE_TAGS_SERVED in caches:
2859 self.filtered(b'served').tags()
2859 self.filtered(b'served').tags()
2860
2860
2861 if repository.CACHE_BRANCHMAP_ALL in caches:
2861 if repository.CACHE_BRANCHMAP_ALL in caches:
2862 # The CACHE_BRANCHMAP_ALL updates lazily-loaded caches immediately,
2862 # The CACHE_BRANCHMAP_ALL updates lazily-loaded caches immediately,
2863 # so we're forcing a write to cause these caches to be warmed up
2863 # so we're forcing a write to cause these caches to be warmed up
2864 # even if they haven't explicitly been requested yet (if they've
2864 # even if they haven't explicitly been requested yet (if they've
2865 # never been used by hg, they won't ever have been written, even if
2865 # never been used by hg, they won't ever have been written, even if
2866 # they're a subset of another kind of cache that *has* been used).
2866 # they're a subset of another kind of cache that *has* been used).
2867 for filt in repoview.filtertable.keys():
2867 for filt in repoview.filtertable.keys():
2868 filtered = self.filtered(filt)
2868 filtered = self.filtered(filt)
2869 filtered.branchmap().write(filtered)
2869 filtered.branchmap().write(filtered)
2870
2870
2871 def invalidatecaches(self):
2871 def invalidatecaches(self):
2872
2872
2873 if '_tagscache' in vars(self):
2873 if '_tagscache' in vars(self):
2874 # can't use delattr on proxy
2874 # can't use delattr on proxy
2875 del self.__dict__['_tagscache']
2875 del self.__dict__['_tagscache']
2876
2876
2877 self._branchcaches.clear()
2877 self._branchcaches.clear()
2878 self.invalidatevolatilesets()
2878 self.invalidatevolatilesets()
2879 self._sparsesignaturecache.clear()
2879 self._sparsesignaturecache.clear()
2880
2880
2881 def invalidatevolatilesets(self):
2881 def invalidatevolatilesets(self):
2882 self.filteredrevcache.clear()
2882 self.filteredrevcache.clear()
2883 obsolete.clearobscaches(self)
2883 obsolete.clearobscaches(self)
2884 self._quick_access_changeid_invalidate()
2884 self._quick_access_changeid_invalidate()
2885
2885
2886 def invalidatedirstate(self):
2886 def invalidatedirstate(self):
2887 """Invalidates the dirstate, causing the next call to dirstate
2887 """Invalidates the dirstate, causing the next call to dirstate
2888 to check if it was modified since the last time it was read,
2888 to check if it was modified since the last time it was read,
2889 rereading it if it has.
2889 rereading it if it has.
2890
2890
2891 This is different to dirstate.invalidate() that it doesn't always
2891 This is different to dirstate.invalidate() that it doesn't always
2892 rereads the dirstate. Use dirstate.invalidate() if you want to
2892 rereads the dirstate. Use dirstate.invalidate() if you want to
2893 explicitly read the dirstate again (i.e. restoring it to a previous
2893 explicitly read the dirstate again (i.e. restoring it to a previous
2894 known good state)."""
2894 known good state)."""
2895 if hasunfilteredcache(self, 'dirstate'):
2895 if hasunfilteredcache(self, 'dirstate'):
2896 for k in self.dirstate._filecache:
2896 for k in self.dirstate._filecache:
2897 try:
2897 try:
2898 delattr(self.dirstate, k)
2898 delattr(self.dirstate, k)
2899 except AttributeError:
2899 except AttributeError:
2900 pass
2900 pass
2901 delattr(self.unfiltered(), 'dirstate')
2901 delattr(self.unfiltered(), 'dirstate')
2902
2902
2903 def invalidate(self, clearfilecache=False):
2903 def invalidate(self, clearfilecache=False):
2904 """Invalidates both store and non-store parts other than dirstate
2904 """Invalidates both store and non-store parts other than dirstate
2905
2905
2906 If a transaction is running, invalidation of store is omitted,
2906 If a transaction is running, invalidation of store is omitted,
2907 because discarding in-memory changes might cause inconsistency
2907 because discarding in-memory changes might cause inconsistency
2908 (e.g. incomplete fncache causes unintentional failure, but
2908 (e.g. incomplete fncache causes unintentional failure, but
2909 redundant one doesn't).
2909 redundant one doesn't).
2910 """
2910 """
2911 unfiltered = self.unfiltered() # all file caches are stored unfiltered
2911 unfiltered = self.unfiltered() # all file caches are stored unfiltered
2912 for k in list(self._filecache.keys()):
2912 for k in list(self._filecache.keys()):
2913 # dirstate is invalidated separately in invalidatedirstate()
2913 # dirstate is invalidated separately in invalidatedirstate()
2914 if k == b'dirstate':
2914 if k == b'dirstate':
2915 continue
2915 continue
2916 if (
2916 if (
2917 k == b'changelog'
2917 k == b'changelog'
2918 and self.currenttransaction()
2918 and self.currenttransaction()
2919 and self.changelog._delayed
2919 and self.changelog._delayed
2920 ):
2920 ):
2921 # The changelog object may store unwritten revisions. We don't
2921 # The changelog object may store unwritten revisions. We don't
2922 # want to lose them.
2922 # want to lose them.
2923 # TODO: Solve the problem instead of working around it.
2923 # TODO: Solve the problem instead of working around it.
2924 continue
2924 continue
2925
2925
2926 if clearfilecache:
2926 if clearfilecache:
2927 del self._filecache[k]
2927 del self._filecache[k]
2928 try:
2928 try:
2929 delattr(unfiltered, k)
2929 delattr(unfiltered, k)
2930 except AttributeError:
2930 except AttributeError:
2931 pass
2931 pass
2932 self.invalidatecaches()
2932 self.invalidatecaches()
2933 if not self.currenttransaction():
2933 if not self.currenttransaction():
2934 # TODO: Changing contents of store outside transaction
2934 # TODO: Changing contents of store outside transaction
2935 # causes inconsistency. We should make in-memory store
2935 # causes inconsistency. We should make in-memory store
2936 # changes detectable, and abort if changed.
2936 # changes detectable, and abort if changed.
2937 self.store.invalidatecaches()
2937 self.store.invalidatecaches()
2938
2938
2939 def invalidateall(self):
2939 def invalidateall(self):
2940 """Fully invalidates both store and non-store parts, causing the
2940 """Fully invalidates both store and non-store parts, causing the
2941 subsequent operation to reread any outside changes."""
2941 subsequent operation to reread any outside changes."""
2942 # extension should hook this to invalidate its caches
2942 # extension should hook this to invalidate its caches
2943 self.invalidate()
2943 self.invalidate()
2944 self.invalidatedirstate()
2944 self.invalidatedirstate()
2945
2945
2946 @unfilteredmethod
2946 @unfilteredmethod
2947 def _refreshfilecachestats(self, tr):
2947 def _refreshfilecachestats(self, tr):
2948 """Reload stats of cached files so that they are flagged as valid"""
2948 """Reload stats of cached files so that they are flagged as valid"""
2949 for k, ce in self._filecache.items():
2949 for k, ce in self._filecache.items():
2950 k = pycompat.sysstr(k)
2950 k = pycompat.sysstr(k)
2951 if k == 'dirstate' or k not in self.__dict__:
2951 if k == 'dirstate' or k not in self.__dict__:
2952 continue
2952 continue
2953 ce.refresh()
2953 ce.refresh()
2954
2954
2955 def _lock(
2955 def _lock(
2956 self,
2956 self,
2957 vfs,
2957 vfs,
2958 lockname,
2958 lockname,
2959 wait,
2959 wait,
2960 releasefn,
2960 releasefn,
2961 acquirefn,
2961 acquirefn,
2962 desc,
2962 desc,
2963 ):
2963 ):
2964 timeout = 0
2964 timeout = 0
2965 warntimeout = 0
2965 warntimeout = 0
2966 if wait:
2966 if wait:
2967 timeout = self.ui.configint(b"ui", b"timeout")
2967 timeout = self.ui.configint(b"ui", b"timeout")
2968 warntimeout = self.ui.configint(b"ui", b"timeout.warn")
2968 warntimeout = self.ui.configint(b"ui", b"timeout.warn")
2969 # internal config: ui.signal-safe-lock
2969 # internal config: ui.signal-safe-lock
2970 signalsafe = self.ui.configbool(b'ui', b'signal-safe-lock')
2970 signalsafe = self.ui.configbool(b'ui', b'signal-safe-lock')
2971
2971
2972 l = lockmod.trylock(
2972 l = lockmod.trylock(
2973 self.ui,
2973 self.ui,
2974 vfs,
2974 vfs,
2975 lockname,
2975 lockname,
2976 timeout,
2976 timeout,
2977 warntimeout,
2977 warntimeout,
2978 releasefn=releasefn,
2978 releasefn=releasefn,
2979 acquirefn=acquirefn,
2979 acquirefn=acquirefn,
2980 desc=desc,
2980 desc=desc,
2981 signalsafe=signalsafe,
2981 signalsafe=signalsafe,
2982 )
2982 )
2983 return l
2983 return l
2984
2984
2985 def _afterlock(self, callback):
2985 def _afterlock(self, callback):
2986 """add a callback to be run when the repository is fully unlocked
2986 """add a callback to be run when the repository is fully unlocked
2987
2987
2988 The callback will be executed when the outermost lock is released
2988 The callback will be executed when the outermost lock is released
2989 (with wlock being higher level than 'lock')."""
2989 (with wlock being higher level than 'lock')."""
2990 for ref in (self._wlockref, self._lockref):
2990 for ref in (self._wlockref, self._lockref):
2991 l = ref and ref()
2991 l = ref and ref()
2992 if l and l.held:
2992 if l and l.held:
2993 l.postrelease.append(callback)
2993 l.postrelease.append(callback)
2994 break
2994 break
2995 else: # no lock have been found.
2995 else: # no lock have been found.
2996 callback(True)
2996 callback(True)
2997
2997
2998 def lock(self, wait=True):
2998 def lock(self, wait=True):
2999 """Lock the repository store (.hg/store) and return a weak reference
2999 """Lock the repository store (.hg/store) and return a weak reference
3000 to the lock. Use this before modifying the store (e.g. committing or
3000 to the lock. Use this before modifying the store (e.g. committing or
3001 stripping). If you are opening a transaction, get a lock as well.)
3001 stripping). If you are opening a transaction, get a lock as well.)
3002
3002
3003 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
3003 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
3004 'wlock' first to avoid a dead-lock hazard."""
3004 'wlock' first to avoid a dead-lock hazard."""
3005 l = self._currentlock(self._lockref)
3005 l = self._currentlock(self._lockref)
3006 if l is not None:
3006 if l is not None:
3007 l.lock()
3007 l.lock()
3008 return l
3008 return l
3009
3009
3010 l = self._lock(
3010 l = self._lock(
3011 vfs=self.svfs,
3011 vfs=self.svfs,
3012 lockname=b"lock",
3012 lockname=b"lock",
3013 wait=wait,
3013 wait=wait,
3014 releasefn=None,
3014 releasefn=None,
3015 acquirefn=self.invalidate,
3015 acquirefn=self.invalidate,
3016 desc=_(b'repository %s') % self.origroot,
3016 desc=_(b'repository %s') % self.origroot,
3017 )
3017 )
3018 self._lockref = weakref.ref(l)
3018 self._lockref = weakref.ref(l)
3019 return l
3019 return l
3020
3020
3021 def wlock(self, wait=True):
3021 def wlock(self, wait=True):
3022 """Lock the non-store parts of the repository (everything under
3022 """Lock the non-store parts of the repository (everything under
3023 .hg except .hg/store) and return a weak reference to the lock.
3023 .hg except .hg/store) and return a weak reference to the lock.
3024
3024
3025 Use this before modifying files in .hg.
3025 Use this before modifying files in .hg.
3026
3026
3027 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
3027 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
3028 'wlock' first to avoid a dead-lock hazard."""
3028 'wlock' first to avoid a dead-lock hazard."""
3029 l = self._wlockref() if self._wlockref else None
3029 l = self._wlockref() if self._wlockref else None
3030 if l is not None and l.held:
3030 if l is not None and l.held:
3031 l.lock()
3031 l.lock()
3032 return l
3032 return l
3033
3033
3034 # We do not need to check for non-waiting lock acquisition. Such
3034 # We do not need to check for non-waiting lock acquisition. Such
3035 # acquisition would not cause dead-lock as they would just fail.
3035 # acquisition would not cause dead-lock as they would just fail.
3036 if wait and (
3036 if wait and (
3037 self.ui.configbool(b'devel', b'all-warnings')
3037 self.ui.configbool(b'devel', b'all-warnings')
3038 or self.ui.configbool(b'devel', b'check-locks')
3038 or self.ui.configbool(b'devel', b'check-locks')
3039 ):
3039 ):
3040 if self._currentlock(self._lockref) is not None:
3040 if self._currentlock(self._lockref) is not None:
3041 self.ui.develwarn(b'"wlock" acquired after "lock"')
3041 self.ui.develwarn(b'"wlock" acquired after "lock"')
3042
3042
3043 def unlock():
3043 def unlock():
3044 if self.dirstate.pendingparentchange():
3044 if self.dirstate.pendingparentchange():
3045 self.dirstate.invalidate()
3045 self.dirstate.invalidate()
3046 else:
3046 else:
3047 self.dirstate.write(None)
3047 self.dirstate.write(None)
3048
3048
3049 self._filecache[b'dirstate'].refresh()
3049 self._filecache[b'dirstate'].refresh()
3050
3050
3051 l = self._lock(
3051 l = self._lock(
3052 self.vfs,
3052 self.vfs,
3053 b"wlock",
3053 b"wlock",
3054 wait,
3054 wait,
3055 unlock,
3055 unlock,
3056 self.invalidatedirstate,
3056 self.invalidatedirstate,
3057 _(b'working directory of %s') % self.origroot,
3057 _(b'working directory of %s') % self.origroot,
3058 )
3058 )
3059 self._wlockref = weakref.ref(l)
3059 self._wlockref = weakref.ref(l)
3060 return l
3060 return l
3061
3061
3062 def _currentlock(self, lockref):
3062 def _currentlock(self, lockref):
3063 """Returns the lock if it's held, or None if it's not."""
3063 """Returns the lock if it's held, or None if it's not."""
3064 if lockref is None:
3064 if lockref is None:
3065 return None
3065 return None
3066 l = lockref()
3066 l = lockref()
3067 if l is None or not l.held:
3067 if l is None or not l.held:
3068 return None
3068 return None
3069 return l
3069 return l
3070
3070
3071 def currentwlock(self):
3071 def currentwlock(self):
3072 """Returns the wlock if it's held, or None if it's not."""
3072 """Returns the wlock if it's held, or None if it's not."""
3073 return self._currentlock(self._wlockref)
3073 return self._currentlock(self._wlockref)
3074
3074
3075 def checkcommitpatterns(self, wctx, match, status, fail):
3075 def checkcommitpatterns(self, wctx, match, status, fail):
3076 """check for commit arguments that aren't committable"""
3076 """check for commit arguments that aren't committable"""
3077 if match.isexact() or match.prefix():
3077 if match.isexact() or match.prefix():
3078 matched = set(status.modified + status.added + status.removed)
3078 matched = set(status.modified + status.added + status.removed)
3079
3079
3080 for f in match.files():
3080 for f in match.files():
3081 f = self.dirstate.normalize(f)
3081 f = self.dirstate.normalize(f)
3082 if f == b'.' or f in matched or f in wctx.substate:
3082 if f == b'.' or f in matched or f in wctx.substate:
3083 continue
3083 continue
3084 if f in status.deleted:
3084 if f in status.deleted:
3085 fail(f, _(b'file not found!'))
3085 fail(f, _(b'file not found!'))
3086 # Is it a directory that exists or used to exist?
3086 # Is it a directory that exists or used to exist?
3087 if self.wvfs.isdir(f) or wctx.p1().hasdir(f):
3087 if self.wvfs.isdir(f) or wctx.p1().hasdir(f):
3088 d = f + b'/'
3088 d = f + b'/'
3089 for mf in matched:
3089 for mf in matched:
3090 if mf.startswith(d):
3090 if mf.startswith(d):
3091 break
3091 break
3092 else:
3092 else:
3093 fail(f, _(b"no match under directory!"))
3093 fail(f, _(b"no match under directory!"))
3094 elif f not in self.dirstate:
3094 elif f not in self.dirstate:
3095 fail(f, _(b"file not tracked!"))
3095 fail(f, _(b"file not tracked!"))
3096
3096
3097 @unfilteredmethod
3097 @unfilteredmethod
3098 def commit(
3098 def commit(
3099 self,
3099 self,
3100 text=b"",
3100 text=b"",
3101 user=None,
3101 user=None,
3102 date=None,
3102 date=None,
3103 match=None,
3103 match=None,
3104 force=False,
3104 force=False,
3105 editor=None,
3105 editor=None,
3106 extra=None,
3106 extra=None,
3107 ):
3107 ):
3108 """Add a new revision to current repository.
3108 """Add a new revision to current repository.
3109
3109
3110 Revision information is gathered from the working directory,
3110 Revision information is gathered from the working directory,
3111 match can be used to filter the committed files. If editor is
3111 match can be used to filter the committed files. If editor is
3112 supplied, it is called to get a commit message.
3112 supplied, it is called to get a commit message.
3113 """
3113 """
3114 if extra is None:
3114 if extra is None:
3115 extra = {}
3115 extra = {}
3116
3116
3117 def fail(f, msg):
3117 def fail(f, msg):
3118 raise error.InputError(b'%s: %s' % (f, msg))
3118 raise error.InputError(b'%s: %s' % (f, msg))
3119
3119
3120 if not match:
3120 if not match:
3121 match = matchmod.always()
3121 match = matchmod.always()
3122
3122
3123 if not force:
3123 if not force:
3124 match.bad = fail
3124 match.bad = fail
3125
3125
3126 # lock() for recent changelog (see issue4368)
3126 # lock() for recent changelog (see issue4368)
3127 with self.wlock(), self.lock():
3127 with self.wlock(), self.lock():
3128 wctx = self[None]
3128 wctx = self[None]
3129 merge = len(wctx.parents()) > 1
3129 merge = len(wctx.parents()) > 1
3130
3130
3131 if not force and merge and not match.always():
3131 if not force and merge and not match.always():
3132 raise error.Abort(
3132 raise error.Abort(
3133 _(
3133 _(
3134 b'cannot partially commit a merge '
3134 b'cannot partially commit a merge '
3135 b'(do not specify files or patterns)'
3135 b'(do not specify files or patterns)'
3136 )
3136 )
3137 )
3137 )
3138
3138
3139 status = self.status(match=match, clean=force)
3139 status = self.status(match=match, clean=force)
3140 if force:
3140 if force:
3141 status.modified.extend(
3141 status.modified.extend(
3142 status.clean
3142 status.clean
3143 ) # mq may commit clean files
3143 ) # mq may commit clean files
3144
3144
3145 # check subrepos
3145 # check subrepos
3146 subs, commitsubs, newstate = subrepoutil.precommit(
3146 subs, commitsubs, newstate = subrepoutil.precommit(
3147 self.ui, wctx, status, match, force=force
3147 self.ui, wctx, status, match, force=force
3148 )
3148 )
3149
3149
3150 # make sure all explicit patterns are matched
3150 # make sure all explicit patterns are matched
3151 if not force:
3151 if not force:
3152 self.checkcommitpatterns(wctx, match, status, fail)
3152 self.checkcommitpatterns(wctx, match, status, fail)
3153
3153
3154 cctx = context.workingcommitctx(
3154 cctx = context.workingcommitctx(
3155 self, status, text, user, date, extra
3155 self, status, text, user, date, extra
3156 )
3156 )
3157
3157
3158 ms = mergestatemod.mergestate.read(self)
3158 ms = mergestatemod.mergestate.read(self)
3159 mergeutil.checkunresolved(ms)
3159 mergeutil.checkunresolved(ms)
3160
3160
3161 # internal config: ui.allowemptycommit
3161 # internal config: ui.allowemptycommit
3162 if cctx.isempty() and not self.ui.configbool(
3162 if cctx.isempty() and not self.ui.configbool(
3163 b'ui', b'allowemptycommit'
3163 b'ui', b'allowemptycommit'
3164 ):
3164 ):
3165 self.ui.debug(b'nothing to commit, clearing merge state\n')
3165 self.ui.debug(b'nothing to commit, clearing merge state\n')
3166 ms.reset()
3166 ms.reset()
3167 return None
3167 return None
3168
3168
3169 if merge and cctx.deleted():
3169 if merge and cctx.deleted():
3170 raise error.Abort(_(b"cannot commit merge with missing files"))
3170 raise error.Abort(_(b"cannot commit merge with missing files"))
3171
3171
3172 if editor:
3172 if editor:
3173 cctx._text = editor(self, cctx, subs)
3173 cctx._text = editor(self, cctx, subs)
3174 edited = text != cctx._text
3174 edited = text != cctx._text
3175
3175
3176 # Save commit message in case this transaction gets rolled back
3176 # Save commit message in case this transaction gets rolled back
3177 # (e.g. by a pretxncommit hook). Leave the content alone on
3177 # (e.g. by a pretxncommit hook). Leave the content alone on
3178 # the assumption that the user will use the same editor again.
3178 # the assumption that the user will use the same editor again.
3179 msgfn = self.savecommitmessage(cctx._text)
3179 msgfn = self.savecommitmessage(cctx._text)
3180
3180
3181 # commit subs and write new state
3181 # commit subs and write new state
3182 if subs:
3182 if subs:
3183 uipathfn = scmutil.getuipathfn(self)
3183 uipathfn = scmutil.getuipathfn(self)
3184 for s in sorted(commitsubs):
3184 for s in sorted(commitsubs):
3185 sub = wctx.sub(s)
3185 sub = wctx.sub(s)
3186 self.ui.status(
3186 self.ui.status(
3187 _(b'committing subrepository %s\n')
3187 _(b'committing subrepository %s\n')
3188 % uipathfn(subrepoutil.subrelpath(sub))
3188 % uipathfn(subrepoutil.subrelpath(sub))
3189 )
3189 )
3190 sr = sub.commit(cctx._text, user, date)
3190 sr = sub.commit(cctx._text, user, date)
3191 newstate[s] = (newstate[s][0], sr)
3191 newstate[s] = (newstate[s][0], sr)
3192 subrepoutil.writestate(self, newstate)
3192 subrepoutil.writestate(self, newstate)
3193
3193
3194 p1, p2 = self.dirstate.parents()
3194 p1, p2 = self.dirstate.parents()
3195 hookp1, hookp2 = hex(p1), (p2 != self.nullid and hex(p2) or b'')
3195 hookp1, hookp2 = hex(p1), (p2 != self.nullid and hex(p2) or b'')
3196 try:
3196 try:
3197 self.hook(
3197 self.hook(
3198 b"precommit", throw=True, parent1=hookp1, parent2=hookp2
3198 b"precommit", throw=True, parent1=hookp1, parent2=hookp2
3199 )
3199 )
3200 with self.transaction(b'commit'):
3200 with self.transaction(b'commit'):
3201 ret = self.commitctx(cctx, True)
3201 ret = self.commitctx(cctx, True)
3202 # update bookmarks, dirstate and mergestate
3202 # update bookmarks, dirstate and mergestate
3203 bookmarks.update(self, [p1, p2], ret)
3203 bookmarks.update(self, [p1, p2], ret)
3204 cctx.markcommitted(ret)
3204 cctx.markcommitted(ret)
3205 ms.reset()
3205 ms.reset()
3206 except: # re-raises
3206 except: # re-raises
3207 if edited:
3207 if edited:
3208 self.ui.write(
3208 self.ui.write(
3209 _(b'note: commit message saved in %s\n') % msgfn
3209 _(b'note: commit message saved in %s\n') % msgfn
3210 )
3210 )
3211 self.ui.write(
3211 self.ui.write(
3212 _(
3212 _(
3213 b"note: use 'hg commit --logfile "
3213 b"note: use 'hg commit --logfile "
3214 b".hg/last-message.txt --edit' to reuse it\n"
3214 b".hg/last-message.txt --edit' to reuse it\n"
3215 )
3215 )
3216 )
3216 )
3217 raise
3217 raise
3218
3218
3219 def commithook(unused_success):
3219 def commithook(unused_success):
3220 # hack for command that use a temporary commit (eg: histedit)
3220 # hack for command that use a temporary commit (eg: histedit)
3221 # temporary commit got stripped before hook release
3221 # temporary commit got stripped before hook release
3222 if self.changelog.hasnode(ret):
3222 if self.changelog.hasnode(ret):
3223 self.hook(
3223 self.hook(
3224 b"commit", node=hex(ret), parent1=hookp1, parent2=hookp2
3224 b"commit", node=hex(ret), parent1=hookp1, parent2=hookp2
3225 )
3225 )
3226
3226
3227 self._afterlock(commithook)
3227 self._afterlock(commithook)
3228 return ret
3228 return ret
3229
3229
3230 @unfilteredmethod
3230 @unfilteredmethod
3231 def commitctx(self, ctx, error=False, origctx=None):
3231 def commitctx(self, ctx, error=False, origctx=None):
3232 return commit.commitctx(self, ctx, error=error, origctx=origctx)
3232 return commit.commitctx(self, ctx, error=error, origctx=origctx)
3233
3233
3234 @unfilteredmethod
3234 @unfilteredmethod
3235 def destroying(self):
3235 def destroying(self):
3236 """Inform the repository that nodes are about to be destroyed.
3236 """Inform the repository that nodes are about to be destroyed.
3237 Intended for use by strip and rollback, so there's a common
3237 Intended for use by strip and rollback, so there's a common
3238 place for anything that has to be done before destroying history.
3238 place for anything that has to be done before destroying history.
3239
3239
3240 This is mostly useful for saving state that is in memory and waiting
3240 This is mostly useful for saving state that is in memory and waiting
3241 to be flushed when the current lock is released. Because a call to
3241 to be flushed when the current lock is released. Because a call to
3242 destroyed is imminent, the repo will be invalidated causing those
3242 destroyed is imminent, the repo will be invalidated causing those
3243 changes to stay in memory (waiting for the next unlock), or vanish
3243 changes to stay in memory (waiting for the next unlock), or vanish
3244 completely.
3244 completely.
3245 """
3245 """
3246 # When using the same lock to commit and strip, the phasecache is left
3246 # When using the same lock to commit and strip, the phasecache is left
3247 # dirty after committing. Then when we strip, the repo is invalidated,
3247 # dirty after committing. Then when we strip, the repo is invalidated,
3248 # causing those changes to disappear.
3248 # causing those changes to disappear.
3249 if '_phasecache' in vars(self):
3249 if '_phasecache' in vars(self):
3250 self._phasecache.write()
3250 self._phasecache.write()
3251
3251
3252 @unfilteredmethod
3252 @unfilteredmethod
3253 def destroyed(self):
3253 def destroyed(self):
3254 """Inform the repository that nodes have been destroyed.
3254 """Inform the repository that nodes have been destroyed.
3255 Intended for use by strip and rollback, so there's a common
3255 Intended for use by strip and rollback, so there's a common
3256 place for anything that has to be done after destroying history.
3256 place for anything that has to be done after destroying history.
3257 """
3257 """
3258 # When one tries to:
3258 # When one tries to:
3259 # 1) destroy nodes thus calling this method (e.g. strip)
3259 # 1) destroy nodes thus calling this method (e.g. strip)
3260 # 2) use phasecache somewhere (e.g. commit)
3260 # 2) use phasecache somewhere (e.g. commit)
3261 #
3261 #
3262 # then 2) will fail because the phasecache contains nodes that were
3262 # then 2) will fail because the phasecache contains nodes that were
3263 # removed. We can either remove phasecache from the filecache,
3263 # removed. We can either remove phasecache from the filecache,
3264 # causing it to reload next time it is accessed, or simply filter
3264 # causing it to reload next time it is accessed, or simply filter
3265 # the removed nodes now and write the updated cache.
3265 # the removed nodes now and write the updated cache.
3266 self._phasecache.filterunknown(self)
3266 self._phasecache.filterunknown(self)
3267 self._phasecache.write()
3267 self._phasecache.write()
3268
3268
3269 # refresh all repository caches
3269 # refresh all repository caches
3270 self.updatecaches()
3270 self.updatecaches()
3271
3271
3272 # Ensure the persistent tag cache is updated. Doing it now
3272 # Ensure the persistent tag cache is updated. Doing it now
3273 # means that the tag cache only has to worry about destroyed
3273 # means that the tag cache only has to worry about destroyed
3274 # heads immediately after a strip/rollback. That in turn
3274 # heads immediately after a strip/rollback. That in turn
3275 # guarantees that "cachetip == currenttip" (comparing both rev
3275 # guarantees that "cachetip == currenttip" (comparing both rev
3276 # and node) always means no nodes have been added or destroyed.
3276 # and node) always means no nodes have been added or destroyed.
3277
3277
3278 # XXX this is suboptimal when qrefresh'ing: we strip the current
3278 # XXX this is suboptimal when qrefresh'ing: we strip the current
3279 # head, refresh the tag cache, then immediately add a new head.
3279 # head, refresh the tag cache, then immediately add a new head.
3280 # But I think doing it this way is necessary for the "instant
3280 # But I think doing it this way is necessary for the "instant
3281 # tag cache retrieval" case to work.
3281 # tag cache retrieval" case to work.
3282 self.invalidate()
3282 self.invalidate()
3283
3283
3284 def status(
3284 def status(
3285 self,
3285 self,
3286 node1=b'.',
3286 node1=b'.',
3287 node2=None,
3287 node2=None,
3288 match=None,
3288 match=None,
3289 ignored=False,
3289 ignored=False,
3290 clean=False,
3290 clean=False,
3291 unknown=False,
3291 unknown=False,
3292 listsubrepos=False,
3292 listsubrepos=False,
3293 ):
3293 ):
3294 '''a convenience method that calls node1.status(node2)'''
3294 '''a convenience method that calls node1.status(node2)'''
3295 return self[node1].status(
3295 return self[node1].status(
3296 node2, match, ignored, clean, unknown, listsubrepos
3296 node2, match, ignored, clean, unknown, listsubrepos
3297 )
3297 )
3298
3298
3299 def addpostdsstatus(self, ps):
3299 def addpostdsstatus(self, ps):
3300 """Add a callback to run within the wlock, at the point at which status
3300 """Add a callback to run within the wlock, at the point at which status
3301 fixups happen.
3301 fixups happen.
3302
3302
3303 On status completion, callback(wctx, status) will be called with the
3303 On status completion, callback(wctx, status) will be called with the
3304 wlock held, unless the dirstate has changed from underneath or the wlock
3304 wlock held, unless the dirstate has changed from underneath or the wlock
3305 couldn't be grabbed.
3305 couldn't be grabbed.
3306
3306
3307 Callbacks should not capture and use a cached copy of the dirstate --
3307 Callbacks should not capture and use a cached copy of the dirstate --
3308 it might change in the meanwhile. Instead, they should access the
3308 it might change in the meanwhile. Instead, they should access the
3309 dirstate via wctx.repo().dirstate.
3309 dirstate via wctx.repo().dirstate.
3310
3310
3311 This list is emptied out after each status run -- extensions should
3311 This list is emptied out after each status run -- extensions should
3312 make sure it adds to this list each time dirstate.status is called.
3312 make sure it adds to this list each time dirstate.status is called.
3313 Extensions should also make sure they don't call this for statuses
3313 Extensions should also make sure they don't call this for statuses
3314 that don't involve the dirstate.
3314 that don't involve the dirstate.
3315 """
3315 """
3316
3316
3317 # The list is located here for uniqueness reasons -- it is actually
3317 # The list is located here for uniqueness reasons -- it is actually
3318 # managed by the workingctx, but that isn't unique per-repo.
3318 # managed by the workingctx, but that isn't unique per-repo.
3319 self._postdsstatus.append(ps)
3319 self._postdsstatus.append(ps)
3320
3320
3321 def postdsstatus(self):
3321 def postdsstatus(self):
3322 """Used by workingctx to get the list of post-dirstate-status hooks."""
3322 """Used by workingctx to get the list of post-dirstate-status hooks."""
3323 return self._postdsstatus
3323 return self._postdsstatus
3324
3324
3325 def clearpostdsstatus(self):
3325 def clearpostdsstatus(self):
3326 """Used by workingctx to clear post-dirstate-status hooks."""
3326 """Used by workingctx to clear post-dirstate-status hooks."""
3327 del self._postdsstatus[:]
3327 del self._postdsstatus[:]
3328
3328
3329 def heads(self, start=None):
3329 def heads(self, start=None):
3330 if start is None:
3330 if start is None:
3331 cl = self.changelog
3331 cl = self.changelog
3332 headrevs = reversed(cl.headrevs())
3332 headrevs = reversed(cl.headrevs())
3333 return [cl.node(rev) for rev in headrevs]
3333 return [cl.node(rev) for rev in headrevs]
3334
3334
3335 heads = self.changelog.heads(start)
3335 heads = self.changelog.heads(start)
3336 # sort the output in rev descending order
3336 # sort the output in rev descending order
3337 return sorted(heads, key=self.changelog.rev, reverse=True)
3337 return sorted(heads, key=self.changelog.rev, reverse=True)
3338
3338
3339 def branchheads(self, branch=None, start=None, closed=False):
3339 def branchheads(self, branch=None, start=None, closed=False):
3340 """return a (possibly filtered) list of heads for the given branch
3340 """return a (possibly filtered) list of heads for the given branch
3341
3341
3342 Heads are returned in topological order, from newest to oldest.
3342 Heads are returned in topological order, from newest to oldest.
3343 If branch is None, use the dirstate branch.
3343 If branch is None, use the dirstate branch.
3344 If start is not None, return only heads reachable from start.
3344 If start is not None, return only heads reachable from start.
3345 If closed is True, return heads that are marked as closed as well.
3345 If closed is True, return heads that are marked as closed as well.
3346 """
3346 """
3347 if branch is None:
3347 if branch is None:
3348 branch = self[None].branch()
3348 branch = self[None].branch()
3349 branches = self.branchmap()
3349 branches = self.branchmap()
3350 if not branches.hasbranch(branch):
3350 if not branches.hasbranch(branch):
3351 return []
3351 return []
3352 # the cache returns heads ordered lowest to highest
3352 # the cache returns heads ordered lowest to highest
3353 bheads = list(reversed(branches.branchheads(branch, closed=closed)))
3353 bheads = list(reversed(branches.branchheads(branch, closed=closed)))
3354 if start is not None:
3354 if start is not None:
3355 # filter out the heads that cannot be reached from startrev
3355 # filter out the heads that cannot be reached from startrev
3356 fbheads = set(self.changelog.nodesbetween([start], bheads)[2])
3356 fbheads = set(self.changelog.nodesbetween([start], bheads)[2])
3357 bheads = [h for h in bheads if h in fbheads]
3357 bheads = [h for h in bheads if h in fbheads]
3358 return bheads
3358 return bheads
3359
3359
3360 def branches(self, nodes):
3360 def branches(self, nodes):
3361 if not nodes:
3361 if not nodes:
3362 nodes = [self.changelog.tip()]
3362 nodes = [self.changelog.tip()]
3363 b = []
3363 b = []
3364 for n in nodes:
3364 for n in nodes:
3365 t = n
3365 t = n
3366 while True:
3366 while True:
3367 p = self.changelog.parents(n)
3367 p = self.changelog.parents(n)
3368 if p[1] != self.nullid or p[0] == self.nullid:
3368 if p[1] != self.nullid or p[0] == self.nullid:
3369 b.append((t, n, p[0], p[1]))
3369 b.append((t, n, p[0], p[1]))
3370 break
3370 break
3371 n = p[0]
3371 n = p[0]
3372 return b
3372 return b
3373
3373
3374 def between(self, pairs):
3374 def between(self, pairs):
3375 r = []
3375 r = []
3376
3376
3377 for top, bottom in pairs:
3377 for top, bottom in pairs:
3378 n, l, i = top, [], 0
3378 n, l, i = top, [], 0
3379 f = 1
3379 f = 1
3380
3380
3381 while n != bottom and n != self.nullid:
3381 while n != bottom and n != self.nullid:
3382 p = self.changelog.parents(n)[0]
3382 p = self.changelog.parents(n)[0]
3383 if i == f:
3383 if i == f:
3384 l.append(n)
3384 l.append(n)
3385 f = f * 2
3385 f = f * 2
3386 n = p
3386 n = p
3387 i += 1
3387 i += 1
3388
3388
3389 r.append(l)
3389 r.append(l)
3390
3390
3391 return r
3391 return r
3392
3392
3393 def checkpush(self, pushop):
3393 def checkpush(self, pushop):
3394 """Extensions can override this function if additional checks have
3394 """Extensions can override this function if additional checks have
3395 to be performed before pushing, or call it if they override push
3395 to be performed before pushing, or call it if they override push
3396 command.
3396 command.
3397 """
3397 """
3398
3398
3399 @unfilteredpropertycache
3399 @unfilteredpropertycache
3400 def prepushoutgoinghooks(self):
3400 def prepushoutgoinghooks(self):
3401 """Return util.hooks consists of a pushop with repo, remote, outgoing
3401 """Return util.hooks consists of a pushop with repo, remote, outgoing
3402 methods, which are called before pushing changesets.
3402 methods, which are called before pushing changesets.
3403 """
3403 """
3404 return util.hooks()
3404 return util.hooks()
3405
3405
3406 def pushkey(self, namespace, key, old, new):
3406 def pushkey(self, namespace, key, old, new):
3407 try:
3407 try:
3408 tr = self.currenttransaction()
3408 tr = self.currenttransaction()
3409 hookargs = {}
3409 hookargs = {}
3410 if tr is not None:
3410 if tr is not None:
3411 hookargs.update(tr.hookargs)
3411 hookargs.update(tr.hookargs)
3412 hookargs = pycompat.strkwargs(hookargs)
3412 hookargs = pycompat.strkwargs(hookargs)
3413 hookargs['namespace'] = namespace
3413 hookargs['namespace'] = namespace
3414 hookargs['key'] = key
3414 hookargs['key'] = key
3415 hookargs['old'] = old
3415 hookargs['old'] = old
3416 hookargs['new'] = new
3416 hookargs['new'] = new
3417 self.hook(b'prepushkey', throw=True, **hookargs)
3417 self.hook(b'prepushkey', throw=True, **hookargs)
3418 except error.HookAbort as exc:
3418 except error.HookAbort as exc:
3419 self.ui.write_err(_(b"pushkey-abort: %s\n") % exc)
3419 self.ui.write_err(_(b"pushkey-abort: %s\n") % exc)
3420 if exc.hint:
3420 if exc.hint:
3421 self.ui.write_err(_(b"(%s)\n") % exc.hint)
3421 self.ui.write_err(_(b"(%s)\n") % exc.hint)
3422 return False
3422 return False
3423 self.ui.debug(b'pushing key for "%s:%s"\n' % (namespace, key))
3423 self.ui.debug(b'pushing key for "%s:%s"\n' % (namespace, key))
3424 ret = pushkey.push(self, namespace, key, old, new)
3424 ret = pushkey.push(self, namespace, key, old, new)
3425
3425
3426 def runhook(unused_success):
3426 def runhook(unused_success):
3427 self.hook(
3427 self.hook(
3428 b'pushkey',
3428 b'pushkey',
3429 namespace=namespace,
3429 namespace=namespace,
3430 key=key,
3430 key=key,
3431 old=old,
3431 old=old,
3432 new=new,
3432 new=new,
3433 ret=ret,
3433 ret=ret,
3434 )
3434 )
3435
3435
3436 self._afterlock(runhook)
3436 self._afterlock(runhook)
3437 return ret
3437 return ret
3438
3438
3439 def listkeys(self, namespace):
3439 def listkeys(self, namespace):
3440 self.hook(b'prelistkeys', throw=True, namespace=namespace)
3440 self.hook(b'prelistkeys', throw=True, namespace=namespace)
3441 self.ui.debug(b'listing keys for "%s"\n' % namespace)
3441 self.ui.debug(b'listing keys for "%s"\n' % namespace)
3442 values = pushkey.list(self, namespace)
3442 values = pushkey.list(self, namespace)
3443 self.hook(b'listkeys', namespace=namespace, values=values)
3443 self.hook(b'listkeys', namespace=namespace, values=values)
3444 return values
3444 return values
3445
3445
3446 def debugwireargs(self, one, two, three=None, four=None, five=None):
3446 def debugwireargs(self, one, two, three=None, four=None, five=None):
3447 '''used to test argument passing over the wire'''
3447 '''used to test argument passing over the wire'''
3448 return b"%s %s %s %s %s" % (
3448 return b"%s %s %s %s %s" % (
3449 one,
3449 one,
3450 two,
3450 two,
3451 pycompat.bytestr(three),
3451 pycompat.bytestr(three),
3452 pycompat.bytestr(four),
3452 pycompat.bytestr(four),
3453 pycompat.bytestr(five),
3453 pycompat.bytestr(five),
3454 )
3454 )
3455
3455
3456 def savecommitmessage(self, text):
3456 def savecommitmessage(self, text):
3457 fp = self.vfs(b'last-message.txt', b'wb')
3457 fp = self.vfs(b'last-message.txt', b'wb')
3458 try:
3458 try:
3459 fp.write(text)
3459 fp.write(text)
3460 finally:
3460 finally:
3461 fp.close()
3461 fp.close()
3462 return self.pathto(fp.name[len(self.root) + 1 :])
3462 return self.pathto(fp.name[len(self.root) + 1 :])
3463
3463
3464 def register_wanted_sidedata(self, category):
3464 def register_wanted_sidedata(self, category):
3465 if repository.REPO_FEATURE_SIDE_DATA not in self.features:
3465 if repository.REPO_FEATURE_SIDE_DATA not in self.features:
3466 # Only revlogv2 repos can want sidedata.
3466 # Only revlogv2 repos can want sidedata.
3467 return
3467 return
3468 self._wanted_sidedata.add(pycompat.bytestr(category))
3468 self._wanted_sidedata.add(pycompat.bytestr(category))
3469
3469
3470 def register_sidedata_computer(
3470 def register_sidedata_computer(
3471 self, kind, category, keys, computer, flags, replace=False
3471 self, kind, category, keys, computer, flags, replace=False
3472 ):
3472 ):
3473 if kind not in revlogconst.ALL_KINDS:
3473 if kind not in revlogconst.ALL_KINDS:
3474 msg = _(b"unexpected revlog kind '%s'.")
3474 msg = _(b"unexpected revlog kind '%s'.")
3475 raise error.ProgrammingError(msg % kind)
3475 raise error.ProgrammingError(msg % kind)
3476 category = pycompat.bytestr(category)
3476 category = pycompat.bytestr(category)
3477 already_registered = category in self._sidedata_computers.get(kind, [])
3477 already_registered = category in self._sidedata_computers.get(kind, [])
3478 if already_registered and not replace:
3478 if already_registered and not replace:
3479 msg = _(
3479 msg = _(
3480 b"cannot register a sidedata computer twice for category '%s'."
3480 b"cannot register a sidedata computer twice for category '%s'."
3481 )
3481 )
3482 raise error.ProgrammingError(msg % category)
3482 raise error.ProgrammingError(msg % category)
3483 if replace and not already_registered:
3483 if replace and not already_registered:
3484 msg = _(
3484 msg = _(
3485 b"cannot replace a sidedata computer that isn't registered "
3485 b"cannot replace a sidedata computer that isn't registered "
3486 b"for category '%s'."
3486 b"for category '%s'."
3487 )
3487 )
3488 raise error.ProgrammingError(msg % category)
3488 raise error.ProgrammingError(msg % category)
3489 self._sidedata_computers.setdefault(kind, {})
3489 self._sidedata_computers.setdefault(kind, {})
3490 self._sidedata_computers[kind][category] = (keys, computer, flags)
3490 self._sidedata_computers[kind][category] = (keys, computer, flags)
3491
3491
3492
3492
3493 # used to avoid circular references so destructors work
3493 # used to avoid circular references so destructors work
3494 def aftertrans(files):
3494 def aftertrans(files):
3495 renamefiles = [tuple(t) for t in files]
3495 renamefiles = [tuple(t) for t in files]
3496
3496
3497 def a():
3497 def a():
3498 for vfs, src, dest in renamefiles:
3498 for vfs, src, dest in renamefiles:
3499 # if src and dest refer to a same file, vfs.rename is a no-op,
3499 # if src and dest refer to a same file, vfs.rename is a no-op,
3500 # leaving both src and dest on disk. delete dest to make sure
3500 # leaving both src and dest on disk. delete dest to make sure
3501 # the rename couldn't be such a no-op.
3501 # the rename couldn't be such a no-op.
3502 vfs.tryunlink(dest)
3502 vfs.tryunlink(dest)
3503 try:
3503 try:
3504 vfs.rename(src, dest)
3504 vfs.rename(src, dest)
3505 except OSError as exc: # journal file does not yet exist
3505 except OSError as exc: # journal file does not yet exist
3506 if exc.errno != errno.ENOENT:
3506 if exc.errno != errno.ENOENT:
3507 raise
3507 raise
3508
3508
3509 return a
3509 return a
3510
3510
3511
3511
3512 def undoname(fn):
3512 def undoname(fn):
3513 base, name = os.path.split(fn)
3513 base, name = os.path.split(fn)
3514 assert name.startswith(b'journal')
3514 assert name.startswith(b'journal')
3515 return os.path.join(base, name.replace(b'journal', b'undo', 1))
3515 return os.path.join(base, name.replace(b'journal', b'undo', 1))
3516
3516
3517
3517
3518 def instance(ui, path, create, intents=None, createopts=None):
3518 def instance(ui, path, create, intents=None, createopts=None):
3519 localpath = urlutil.urllocalpath(path)
3519 localpath = urlutil.urllocalpath(path)
3520 if create:
3520 if create:
3521 createrepository(ui, localpath, createopts=createopts)
3521 createrepository(ui, localpath, createopts=createopts)
3522
3522
3523 return makelocalrepository(ui, localpath, intents=intents)
3523 return makelocalrepository(ui, localpath, intents=intents)
3524
3524
3525
3525
3526 def islocal(path):
3526 def islocal(path):
3527 return True
3527 return True
3528
3528
3529
3529
3530 def defaultcreateopts(ui, createopts=None):
3530 def defaultcreateopts(ui, createopts=None):
3531 """Populate the default creation options for a repository.
3531 """Populate the default creation options for a repository.
3532
3532
3533 A dictionary of explicitly requested creation options can be passed
3533 A dictionary of explicitly requested creation options can be passed
3534 in. Missing keys will be populated.
3534 in. Missing keys will be populated.
3535 """
3535 """
3536 createopts = dict(createopts or {})
3536 createopts = dict(createopts or {})
3537
3537
3538 if b'backend' not in createopts:
3538 if b'backend' not in createopts:
3539 # experimental config: storage.new-repo-backend
3539 # experimental config: storage.new-repo-backend
3540 createopts[b'backend'] = ui.config(b'storage', b'new-repo-backend')
3540 createopts[b'backend'] = ui.config(b'storage', b'new-repo-backend')
3541
3541
3542 return createopts
3542 return createopts
3543
3543
3544
3544
3545 def clone_requirements(ui, createopts, srcrepo):
3545 def clone_requirements(ui, createopts, srcrepo):
3546 """clone the requirements of a local repo for a local clone
3546 """clone the requirements of a local repo for a local clone
3547
3547
3548 The store requirements are unchanged while the working copy requirements
3548 The store requirements are unchanged while the working copy requirements
3549 depends on the configuration
3549 depends on the configuration
3550 """
3550 """
3551 target_requirements = set()
3551 target_requirements = set()
3552 if not srcrepo.requirements:
3552 if not srcrepo.requirements:
3553 # this is a legacy revlog "v0" repository, we cannot do anything fancy
3553 # this is a legacy revlog "v0" repository, we cannot do anything fancy
3554 # with it.
3554 # with it.
3555 return target_requirements
3555 return target_requirements
3556 createopts = defaultcreateopts(ui, createopts=createopts)
3556 createopts = defaultcreateopts(ui, createopts=createopts)
3557 for r in newreporequirements(ui, createopts):
3557 for r in newreporequirements(ui, createopts):
3558 if r in requirementsmod.WORKING_DIR_REQUIREMENTS:
3558 if r in requirementsmod.WORKING_DIR_REQUIREMENTS:
3559 target_requirements.add(r)
3559 target_requirements.add(r)
3560
3560
3561 for r in srcrepo.requirements:
3561 for r in srcrepo.requirements:
3562 if r not in requirementsmod.WORKING_DIR_REQUIREMENTS:
3562 if r not in requirementsmod.WORKING_DIR_REQUIREMENTS:
3563 target_requirements.add(r)
3563 target_requirements.add(r)
3564 return target_requirements
3564 return target_requirements
3565
3565
3566
3566
3567 def newreporequirements(ui, createopts):
3567 def newreporequirements(ui, createopts):
3568 """Determine the set of requirements for a new local repository.
3568 """Determine the set of requirements for a new local repository.
3569
3569
3570 Extensions can wrap this function to specify custom requirements for
3570 Extensions can wrap this function to specify custom requirements for
3571 new repositories.
3571 new repositories.
3572 """
3572 """
3573
3573
3574 if b'backend' not in createopts:
3574 if b'backend' not in createopts:
3575 raise error.ProgrammingError(
3575 raise error.ProgrammingError(
3576 b'backend key not present in createopts; '
3576 b'backend key not present in createopts; '
3577 b'was defaultcreateopts() called?'
3577 b'was defaultcreateopts() called?'
3578 )
3578 )
3579
3579
3580 if createopts[b'backend'] != b'revlogv1':
3580 if createopts[b'backend'] != b'revlogv1':
3581 raise error.Abort(
3581 raise error.Abort(
3582 _(
3582 _(
3583 b'unable to determine repository requirements for '
3583 b'unable to determine repository requirements for '
3584 b'storage backend: %s'
3584 b'storage backend: %s'
3585 )
3585 )
3586 % createopts[b'backend']
3586 % createopts[b'backend']
3587 )
3587 )
3588
3588
3589 requirements = {requirementsmod.REVLOGV1_REQUIREMENT}
3589 requirements = {requirementsmod.REVLOGV1_REQUIREMENT}
3590 if ui.configbool(b'format', b'usestore'):
3590 if ui.configbool(b'format', b'usestore'):
3591 requirements.add(requirementsmod.STORE_REQUIREMENT)
3591 requirements.add(requirementsmod.STORE_REQUIREMENT)
3592 if ui.configbool(b'format', b'usefncache'):
3592 if ui.configbool(b'format', b'usefncache'):
3593 requirements.add(requirementsmod.FNCACHE_REQUIREMENT)
3593 requirements.add(requirementsmod.FNCACHE_REQUIREMENT)
3594 if ui.configbool(b'format', b'dotencode'):
3594 if ui.configbool(b'format', b'dotencode'):
3595 requirements.add(requirementsmod.DOTENCODE_REQUIREMENT)
3595 requirements.add(requirementsmod.DOTENCODE_REQUIREMENT)
3596
3596
3597 compengines = ui.configlist(b'format', b'revlog-compression')
3597 compengines = ui.configlist(b'format', b'revlog-compression')
3598 for compengine in compengines:
3598 for compengine in compengines:
3599 if compengine in util.compengines:
3599 if compengine in util.compengines:
3600 engine = util.compengines[compengine]
3600 engine = util.compengines[compengine]
3601 if engine.available() and engine.revlogheader():
3601 if engine.available() and engine.revlogheader():
3602 break
3602 break
3603 else:
3603 else:
3604 raise error.Abort(
3604 raise error.Abort(
3605 _(
3605 _(
3606 b'compression engines %s defined by '
3606 b'compression engines %s defined by '
3607 b'format.revlog-compression not available'
3607 b'format.revlog-compression not available'
3608 )
3608 )
3609 % b', '.join(b'"%s"' % e for e in compengines),
3609 % b', '.join(b'"%s"' % e for e in compengines),
3610 hint=_(
3610 hint=_(
3611 b'run "hg debuginstall" to list available '
3611 b'run "hg debuginstall" to list available '
3612 b'compression engines'
3612 b'compression engines'
3613 ),
3613 ),
3614 )
3614 )
3615
3615
3616 # zlib is the historical default and doesn't need an explicit requirement.
3616 # zlib is the historical default and doesn't need an explicit requirement.
3617 if compengine == b'zstd':
3617 if compengine == b'zstd':
3618 requirements.add(b'revlog-compression-zstd')
3618 requirements.add(b'revlog-compression-zstd')
3619 elif compengine != b'zlib':
3619 elif compengine != b'zlib':
3620 requirements.add(b'exp-compression-%s' % compengine)
3620 requirements.add(b'exp-compression-%s' % compengine)
3621
3621
3622 if scmutil.gdinitconfig(ui):
3622 if scmutil.gdinitconfig(ui):
3623 requirements.add(requirementsmod.GENERALDELTA_REQUIREMENT)
3623 requirements.add(requirementsmod.GENERALDELTA_REQUIREMENT)
3624 if ui.configbool(b'format', b'sparse-revlog'):
3624 if ui.configbool(b'format', b'sparse-revlog'):
3625 requirements.add(requirementsmod.SPARSEREVLOG_REQUIREMENT)
3625 requirements.add(requirementsmod.SPARSEREVLOG_REQUIREMENT)
3626
3626
3627 # experimental config: format.use-dirstate-v2
3627 # experimental config: format.use-dirstate-v2
3628 # Keep this logic in sync with `has_dirstate_v2()` in `tests/hghave.py`
3628 # Keep this logic in sync with `has_dirstate_v2()` in `tests/hghave.py`
3629 if ui.configbool(b'format', b'use-dirstate-v2'):
3629 if ui.configbool(b'format', b'use-dirstate-v2'):
3630 requirements.add(requirementsmod.DIRSTATE_V2_REQUIREMENT)
3630 requirements.add(requirementsmod.DIRSTATE_V2_REQUIREMENT)
3631
3631
3632 # experimental config: format.exp-use-copies-side-data-changeset
3632 # experimental config: format.exp-use-copies-side-data-changeset
3633 if ui.configbool(b'format', b'exp-use-copies-side-data-changeset'):
3633 if ui.configbool(b'format', b'exp-use-copies-side-data-changeset'):
3634 requirements.add(requirementsmod.CHANGELOGV2_REQUIREMENT)
3634 requirements.add(requirementsmod.CHANGELOGV2_REQUIREMENT)
3635 requirements.add(requirementsmod.COPIESSDC_REQUIREMENT)
3635 requirements.add(requirementsmod.COPIESSDC_REQUIREMENT)
3636 if ui.configbool(b'experimental', b'treemanifest'):
3636 if ui.configbool(b'experimental', b'treemanifest'):
3637 requirements.add(requirementsmod.TREEMANIFEST_REQUIREMENT)
3637 requirements.add(requirementsmod.TREEMANIFEST_REQUIREMENT)
3638
3638
3639 changelogv2 = ui.config(b'format', b'exp-use-changelog-v2')
3639 changelogv2 = ui.config(b'format', b'exp-use-changelog-v2')
3640 if changelogv2 == b'enable-unstable-format-and-corrupt-my-data':
3640 if changelogv2 == b'enable-unstable-format-and-corrupt-my-data':
3641 requirements.add(requirementsmod.CHANGELOGV2_REQUIREMENT)
3641 requirements.add(requirementsmod.CHANGELOGV2_REQUIREMENT)
3642
3642
3643 revlogv2 = ui.config(b'experimental', b'revlogv2')
3643 revlogv2 = ui.config(b'experimental', b'revlogv2')
3644 if revlogv2 == b'enable-unstable-format-and-corrupt-my-data':
3644 if revlogv2 == b'enable-unstable-format-and-corrupt-my-data':
3645 requirements.discard(requirementsmod.REVLOGV1_REQUIREMENT)
3645 requirements.discard(requirementsmod.REVLOGV1_REQUIREMENT)
3646 requirements.add(requirementsmod.REVLOGV2_REQUIREMENT)
3646 requirements.add(requirementsmod.REVLOGV2_REQUIREMENT)
3647 # experimental config: format.internal-phase
3647 # experimental config: format.internal-phase
3648 if ui.configbool(b'format', b'internal-phase'):
3648 if ui.configbool(b'format', b'internal-phase'):
3649 requirements.add(requirementsmod.INTERNAL_PHASE_REQUIREMENT)
3649 requirements.add(requirementsmod.INTERNAL_PHASE_REQUIREMENT)
3650
3650
3651 if createopts.get(b'narrowfiles'):
3651 if createopts.get(b'narrowfiles'):
3652 requirements.add(requirementsmod.NARROW_REQUIREMENT)
3652 requirements.add(requirementsmod.NARROW_REQUIREMENT)
3653
3653
3654 if createopts.get(b'lfs'):
3654 if createopts.get(b'lfs'):
3655 requirements.add(b'lfs')
3655 requirements.add(b'lfs')
3656
3656
3657 if ui.configbool(b'format', b'bookmarks-in-store'):
3657 if ui.configbool(b'format', b'bookmarks-in-store'):
3658 requirements.add(requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT)
3658 requirements.add(requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT)
3659
3659
3660 if ui.configbool(b'format', b'use-persistent-nodemap'):
3660 if ui.configbool(b'format', b'use-persistent-nodemap'):
3661 requirements.add(requirementsmod.NODEMAP_REQUIREMENT)
3661 requirements.add(requirementsmod.NODEMAP_REQUIREMENT)
3662
3662
3663 # if share-safe is enabled, let's create the new repository with the new
3663 # if share-safe is enabled, let's create the new repository with the new
3664 # requirement
3664 # requirement
3665 if ui.configbool(b'format', b'use-share-safe'):
3665 if ui.configbool(b'format', b'use-share-safe'):
3666 requirements.add(requirementsmod.SHARESAFE_REQUIREMENT)
3666 requirements.add(requirementsmod.SHARESAFE_REQUIREMENT)
3667
3667
3668 # if we are creating a share-repoΒΉ we have to handle requirement
3668 # if we are creating a share-repoΒΉ we have to handle requirement
3669 # differently.
3669 # differently.
3670 #
3670 #
3671 # [1] (i.e. reusing the store from another repository, just having a
3671 # [1] (i.e. reusing the store from another repository, just having a
3672 # working copy)
3672 # working copy)
3673 if b'sharedrepo' in createopts:
3673 if b'sharedrepo' in createopts:
3674 source_requirements = set(createopts[b'sharedrepo'].requirements)
3674 source_requirements = set(createopts[b'sharedrepo'].requirements)
3675
3675
3676 if requirementsmod.SHARESAFE_REQUIREMENT not in source_requirements:
3676 if requirementsmod.SHARESAFE_REQUIREMENT not in source_requirements:
3677 # share to an old school repository, we have to copy the
3677 # share to an old school repository, we have to copy the
3678 # requirements and hope for the best.
3678 # requirements and hope for the best.
3679 requirements = source_requirements
3679 requirements = source_requirements
3680 else:
3680 else:
3681 # We have control on the working copy only, so "copy" the non
3681 # We have control on the working copy only, so "copy" the non
3682 # working copy part over, ignoring previous logic.
3682 # working copy part over, ignoring previous logic.
3683 to_drop = set()
3683 to_drop = set()
3684 for req in requirements:
3684 for req in requirements:
3685 if req in requirementsmod.WORKING_DIR_REQUIREMENTS:
3685 if req in requirementsmod.WORKING_DIR_REQUIREMENTS:
3686 continue
3686 continue
3687 if req in source_requirements:
3687 if req in source_requirements:
3688 continue
3688 continue
3689 to_drop.add(req)
3689 to_drop.add(req)
3690 requirements -= to_drop
3690 requirements -= to_drop
3691 requirements |= source_requirements
3691 requirements |= source_requirements
3692
3692
3693 if createopts.get(b'sharedrelative'):
3693 if createopts.get(b'sharedrelative'):
3694 requirements.add(requirementsmod.RELATIVE_SHARED_REQUIREMENT)
3694 requirements.add(requirementsmod.RELATIVE_SHARED_REQUIREMENT)
3695 else:
3695 else:
3696 requirements.add(requirementsmod.SHARED_REQUIREMENT)
3696 requirements.add(requirementsmod.SHARED_REQUIREMENT)
3697
3697
3698 tracked_key = ui.configint(b'format', b'exp-dirstate-tracked-key-version')
3698 if ui.configbool(b'format', b'dirstate-tracked-key'):
3699 if tracked_key:
3699 version = ui.configint(b'format', b'dirstate-tracked-key.version')
3700 if tracked_key != 1:
3700 msg = _("ignoring unknown tracked key version: %d\n")
3701 msg = _("ignoring unknown tracked key version: %d\n")
3701 hint = _("see `hg help config.format.exp-dirstate-tracked-key-version")
3702 hint = _(
3702 if version != 1:
3703 "see `hg help config.format.exp-dirstate-tracked-key-version"
3703 ui.warn(msg % version, hint=hint)
3704 )
3705 ui.warn(msg % tracked_key, hint=hint)
3706 else:
3704 else:
3707 requirements.add(requirementsmod.DIRSTATE_TRACKED_KEY_V1)
3705 requirements.add(requirementsmod.DIRSTATE_TRACKED_KEY_V1)
3708
3706
3709 return requirements
3707 return requirements
3710
3708
3711
3709
3712 def checkrequirementscompat(ui, requirements):
3710 def checkrequirementscompat(ui, requirements):
3713 """Checks compatibility of repository requirements enabled and disabled.
3711 """Checks compatibility of repository requirements enabled and disabled.
3714
3712
3715 Returns a set of requirements which needs to be dropped because dependend
3713 Returns a set of requirements which needs to be dropped because dependend
3716 requirements are not enabled. Also warns users about it"""
3714 requirements are not enabled. Also warns users about it"""
3717
3715
3718 dropped = set()
3716 dropped = set()
3719
3717
3720 if requirementsmod.STORE_REQUIREMENT not in requirements:
3718 if requirementsmod.STORE_REQUIREMENT not in requirements:
3721 if requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT in requirements:
3719 if requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT in requirements:
3722 ui.warn(
3720 ui.warn(
3723 _(
3721 _(
3724 b'ignoring enabled \'format.bookmarks-in-store\' config '
3722 b'ignoring enabled \'format.bookmarks-in-store\' config '
3725 b'beacuse it is incompatible with disabled '
3723 b'beacuse it is incompatible with disabled '
3726 b'\'format.usestore\' config\n'
3724 b'\'format.usestore\' config\n'
3727 )
3725 )
3728 )
3726 )
3729 dropped.add(requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT)
3727 dropped.add(requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT)
3730
3728
3731 if (
3729 if (
3732 requirementsmod.SHARED_REQUIREMENT in requirements
3730 requirementsmod.SHARED_REQUIREMENT in requirements
3733 or requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements
3731 or requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements
3734 ):
3732 ):
3735 raise error.Abort(
3733 raise error.Abort(
3736 _(
3734 _(
3737 b"cannot create shared repository as source was created"
3735 b"cannot create shared repository as source was created"
3738 b" with 'format.usestore' config disabled"
3736 b" with 'format.usestore' config disabled"
3739 )
3737 )
3740 )
3738 )
3741
3739
3742 if requirementsmod.SHARESAFE_REQUIREMENT in requirements:
3740 if requirementsmod.SHARESAFE_REQUIREMENT in requirements:
3743 if ui.hasconfig(b'format', b'use-share-safe'):
3741 if ui.hasconfig(b'format', b'use-share-safe'):
3744 msg = _(
3742 msg = _(
3745 b"ignoring enabled 'format.use-share-safe' config because "
3743 b"ignoring enabled 'format.use-share-safe' config because "
3746 b"it is incompatible with disabled 'format.usestore'"
3744 b"it is incompatible with disabled 'format.usestore'"
3747 b" config\n"
3745 b" config\n"
3748 )
3746 )
3749 ui.warn(msg)
3747 ui.warn(msg)
3750 dropped.add(requirementsmod.SHARESAFE_REQUIREMENT)
3748 dropped.add(requirementsmod.SHARESAFE_REQUIREMENT)
3751
3749
3752 return dropped
3750 return dropped
3753
3751
3754
3752
3755 def filterknowncreateopts(ui, createopts):
3753 def filterknowncreateopts(ui, createopts):
3756 """Filters a dict of repo creation options against options that are known.
3754 """Filters a dict of repo creation options against options that are known.
3757
3755
3758 Receives a dict of repo creation options and returns a dict of those
3756 Receives a dict of repo creation options and returns a dict of those
3759 options that we don't know how to handle.
3757 options that we don't know how to handle.
3760
3758
3761 This function is called as part of repository creation. If the
3759 This function is called as part of repository creation. If the
3762 returned dict contains any items, repository creation will not
3760 returned dict contains any items, repository creation will not
3763 be allowed, as it means there was a request to create a repository
3761 be allowed, as it means there was a request to create a repository
3764 with options not recognized by loaded code.
3762 with options not recognized by loaded code.
3765
3763
3766 Extensions can wrap this function to filter out creation options
3764 Extensions can wrap this function to filter out creation options
3767 they know how to handle.
3765 they know how to handle.
3768 """
3766 """
3769 known = {
3767 known = {
3770 b'backend',
3768 b'backend',
3771 b'lfs',
3769 b'lfs',
3772 b'narrowfiles',
3770 b'narrowfiles',
3773 b'sharedrepo',
3771 b'sharedrepo',
3774 b'sharedrelative',
3772 b'sharedrelative',
3775 b'shareditems',
3773 b'shareditems',
3776 b'shallowfilestore',
3774 b'shallowfilestore',
3777 }
3775 }
3778
3776
3779 return {k: v for k, v in createopts.items() if k not in known}
3777 return {k: v for k, v in createopts.items() if k not in known}
3780
3778
3781
3779
3782 def createrepository(ui, path, createopts=None, requirements=None):
3780 def createrepository(ui, path, createopts=None, requirements=None):
3783 """Create a new repository in a vfs.
3781 """Create a new repository in a vfs.
3784
3782
3785 ``path`` path to the new repo's working directory.
3783 ``path`` path to the new repo's working directory.
3786 ``createopts`` options for the new repository.
3784 ``createopts`` options for the new repository.
3787 ``requirement`` predefined set of requirements.
3785 ``requirement`` predefined set of requirements.
3788 (incompatible with ``createopts``)
3786 (incompatible with ``createopts``)
3789
3787
3790 The following keys for ``createopts`` are recognized:
3788 The following keys for ``createopts`` are recognized:
3791
3789
3792 backend
3790 backend
3793 The storage backend to use.
3791 The storage backend to use.
3794 lfs
3792 lfs
3795 Repository will be created with ``lfs`` requirement. The lfs extension
3793 Repository will be created with ``lfs`` requirement. The lfs extension
3796 will automatically be loaded when the repository is accessed.
3794 will automatically be loaded when the repository is accessed.
3797 narrowfiles
3795 narrowfiles
3798 Set up repository to support narrow file storage.
3796 Set up repository to support narrow file storage.
3799 sharedrepo
3797 sharedrepo
3800 Repository object from which storage should be shared.
3798 Repository object from which storage should be shared.
3801 sharedrelative
3799 sharedrelative
3802 Boolean indicating if the path to the shared repo should be
3800 Boolean indicating if the path to the shared repo should be
3803 stored as relative. By default, the pointer to the "parent" repo
3801 stored as relative. By default, the pointer to the "parent" repo
3804 is stored as an absolute path.
3802 is stored as an absolute path.
3805 shareditems
3803 shareditems
3806 Set of items to share to the new repository (in addition to storage).
3804 Set of items to share to the new repository (in addition to storage).
3807 shallowfilestore
3805 shallowfilestore
3808 Indicates that storage for files should be shallow (not all ancestor
3806 Indicates that storage for files should be shallow (not all ancestor
3809 revisions are known).
3807 revisions are known).
3810 """
3808 """
3811
3809
3812 if requirements is not None:
3810 if requirements is not None:
3813 if createopts is not None:
3811 if createopts is not None:
3814 msg = b'cannot specify both createopts and requirements'
3812 msg = b'cannot specify both createopts and requirements'
3815 raise error.ProgrammingError(msg)
3813 raise error.ProgrammingError(msg)
3816 createopts = {}
3814 createopts = {}
3817 else:
3815 else:
3818 createopts = defaultcreateopts(ui, createopts=createopts)
3816 createopts = defaultcreateopts(ui, createopts=createopts)
3819
3817
3820 unknownopts = filterknowncreateopts(ui, createopts)
3818 unknownopts = filterknowncreateopts(ui, createopts)
3821
3819
3822 if not isinstance(unknownopts, dict):
3820 if not isinstance(unknownopts, dict):
3823 raise error.ProgrammingError(
3821 raise error.ProgrammingError(
3824 b'filterknowncreateopts() did not return a dict'
3822 b'filterknowncreateopts() did not return a dict'
3825 )
3823 )
3826
3824
3827 if unknownopts:
3825 if unknownopts:
3828 raise error.Abort(
3826 raise error.Abort(
3829 _(
3827 _(
3830 b'unable to create repository because of unknown '
3828 b'unable to create repository because of unknown '
3831 b'creation option: %s'
3829 b'creation option: %s'
3832 )
3830 )
3833 % b', '.join(sorted(unknownopts)),
3831 % b', '.join(sorted(unknownopts)),
3834 hint=_(b'is a required extension not loaded?'),
3832 hint=_(b'is a required extension not loaded?'),
3835 )
3833 )
3836
3834
3837 requirements = newreporequirements(ui, createopts=createopts)
3835 requirements = newreporequirements(ui, createopts=createopts)
3838 requirements -= checkrequirementscompat(ui, requirements)
3836 requirements -= checkrequirementscompat(ui, requirements)
3839
3837
3840 wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
3838 wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
3841
3839
3842 hgvfs = vfsmod.vfs(wdirvfs.join(b'.hg'))
3840 hgvfs = vfsmod.vfs(wdirvfs.join(b'.hg'))
3843 if hgvfs.exists():
3841 if hgvfs.exists():
3844 raise error.RepoError(_(b'repository %s already exists') % path)
3842 raise error.RepoError(_(b'repository %s already exists') % path)
3845
3843
3846 if b'sharedrepo' in createopts:
3844 if b'sharedrepo' in createopts:
3847 sharedpath = createopts[b'sharedrepo'].sharedpath
3845 sharedpath = createopts[b'sharedrepo'].sharedpath
3848
3846
3849 if createopts.get(b'sharedrelative'):
3847 if createopts.get(b'sharedrelative'):
3850 try:
3848 try:
3851 sharedpath = os.path.relpath(sharedpath, hgvfs.base)
3849 sharedpath = os.path.relpath(sharedpath, hgvfs.base)
3852 sharedpath = util.pconvert(sharedpath)
3850 sharedpath = util.pconvert(sharedpath)
3853 except (IOError, ValueError) as e:
3851 except (IOError, ValueError) as e:
3854 # ValueError is raised on Windows if the drive letters differ
3852 # ValueError is raised on Windows if the drive letters differ
3855 # on each path.
3853 # on each path.
3856 raise error.Abort(
3854 raise error.Abort(
3857 _(b'cannot calculate relative path'),
3855 _(b'cannot calculate relative path'),
3858 hint=stringutil.forcebytestr(e),
3856 hint=stringutil.forcebytestr(e),
3859 )
3857 )
3860
3858
3861 if not wdirvfs.exists():
3859 if not wdirvfs.exists():
3862 wdirvfs.makedirs()
3860 wdirvfs.makedirs()
3863
3861
3864 hgvfs.makedir(notindexed=True)
3862 hgvfs.makedir(notindexed=True)
3865 if b'sharedrepo' not in createopts:
3863 if b'sharedrepo' not in createopts:
3866 hgvfs.mkdir(b'cache')
3864 hgvfs.mkdir(b'cache')
3867 hgvfs.mkdir(b'wcache')
3865 hgvfs.mkdir(b'wcache')
3868
3866
3869 has_store = requirementsmod.STORE_REQUIREMENT in requirements
3867 has_store = requirementsmod.STORE_REQUIREMENT in requirements
3870 if has_store and b'sharedrepo' not in createopts:
3868 if has_store and b'sharedrepo' not in createopts:
3871 hgvfs.mkdir(b'store')
3869 hgvfs.mkdir(b'store')
3872
3870
3873 # We create an invalid changelog outside the store so very old
3871 # We create an invalid changelog outside the store so very old
3874 # Mercurial versions (which didn't know about the requirements
3872 # Mercurial versions (which didn't know about the requirements
3875 # file) encounter an error on reading the changelog. This
3873 # file) encounter an error on reading the changelog. This
3876 # effectively locks out old clients and prevents them from
3874 # effectively locks out old clients and prevents them from
3877 # mucking with a repo in an unknown format.
3875 # mucking with a repo in an unknown format.
3878 #
3876 #
3879 # The revlog header has version 65535, which won't be recognized by
3877 # The revlog header has version 65535, which won't be recognized by
3880 # such old clients.
3878 # such old clients.
3881 hgvfs.append(
3879 hgvfs.append(
3882 b'00changelog.i',
3880 b'00changelog.i',
3883 b'\0\0\xFF\xFF dummy changelog to prevent using the old repo '
3881 b'\0\0\xFF\xFF dummy changelog to prevent using the old repo '
3884 b'layout',
3882 b'layout',
3885 )
3883 )
3886
3884
3887 # Filter the requirements into working copy and store ones
3885 # Filter the requirements into working copy and store ones
3888 wcreq, storereq = scmutil.filterrequirements(requirements)
3886 wcreq, storereq = scmutil.filterrequirements(requirements)
3889 # write working copy ones
3887 # write working copy ones
3890 scmutil.writerequires(hgvfs, wcreq)
3888 scmutil.writerequires(hgvfs, wcreq)
3891 # If there are store requirements and the current repository
3889 # If there are store requirements and the current repository
3892 # is not a shared one, write stored requirements
3890 # is not a shared one, write stored requirements
3893 # For new shared repository, we don't need to write the store
3891 # For new shared repository, we don't need to write the store
3894 # requirements as they are already present in store requires
3892 # requirements as they are already present in store requires
3895 if storereq and b'sharedrepo' not in createopts:
3893 if storereq and b'sharedrepo' not in createopts:
3896 storevfs = vfsmod.vfs(hgvfs.join(b'store'), cacheaudited=True)
3894 storevfs = vfsmod.vfs(hgvfs.join(b'store'), cacheaudited=True)
3897 scmutil.writerequires(storevfs, storereq)
3895 scmutil.writerequires(storevfs, storereq)
3898
3896
3899 # Write out file telling readers where to find the shared store.
3897 # Write out file telling readers where to find the shared store.
3900 if b'sharedrepo' in createopts:
3898 if b'sharedrepo' in createopts:
3901 hgvfs.write(b'sharedpath', sharedpath)
3899 hgvfs.write(b'sharedpath', sharedpath)
3902
3900
3903 if createopts.get(b'shareditems'):
3901 if createopts.get(b'shareditems'):
3904 shared = b'\n'.join(sorted(createopts[b'shareditems'])) + b'\n'
3902 shared = b'\n'.join(sorted(createopts[b'shareditems'])) + b'\n'
3905 hgvfs.write(b'shared', shared)
3903 hgvfs.write(b'shared', shared)
3906
3904
3907
3905
3908 def poisonrepository(repo):
3906 def poisonrepository(repo):
3909 """Poison a repository instance so it can no longer be used."""
3907 """Poison a repository instance so it can no longer be used."""
3910 # Perform any cleanup on the instance.
3908 # Perform any cleanup on the instance.
3911 repo.close()
3909 repo.close()
3912
3910
3913 # Our strategy is to replace the type of the object with one that
3911 # Our strategy is to replace the type of the object with one that
3914 # has all attribute lookups result in error.
3912 # has all attribute lookups result in error.
3915 #
3913 #
3916 # But we have to allow the close() method because some constructors
3914 # But we have to allow the close() method because some constructors
3917 # of repos call close() on repo references.
3915 # of repos call close() on repo references.
3918 class poisonedrepository(object):
3916 class poisonedrepository(object):
3919 def __getattribute__(self, item):
3917 def __getattribute__(self, item):
3920 if item == 'close':
3918 if item == 'close':
3921 return object.__getattribute__(self, item)
3919 return object.__getattribute__(self, item)
3922
3920
3923 raise error.ProgrammingError(
3921 raise error.ProgrammingError(
3924 b'repo instances should not be used after unshare'
3922 b'repo instances should not be used after unshare'
3925 )
3923 )
3926
3924
3927 def close(self):
3925 def close(self):
3928 pass
3926 pass
3929
3927
3930 # We may have a repoview, which intercepts __setattr__. So be sure
3928 # We may have a repoview, which intercepts __setattr__. So be sure
3931 # we operate at the lowest level possible.
3929 # we operate at the lowest level possible.
3932 object.__setattr__(repo, '__class__', poisonedrepository)
3930 object.__setattr__(repo, '__class__', poisonedrepository)
@@ -1,4057 +1,4057
1 Short help:
1 Short help:
2
2
3 $ hg
3 $ hg
4 Mercurial Distributed SCM
4 Mercurial Distributed SCM
5
5
6 basic commands:
6 basic commands:
7
7
8 add add the specified files on the next commit
8 add add the specified files on the next commit
9 annotate show changeset information by line for each file
9 annotate show changeset information by line for each file
10 clone make a copy of an existing repository
10 clone make a copy of an existing repository
11 commit commit the specified files or all outstanding changes
11 commit commit the specified files or all outstanding changes
12 diff diff repository (or selected files)
12 diff diff repository (or selected files)
13 export dump the header and diffs for one or more changesets
13 export dump the header and diffs for one or more changesets
14 forget forget the specified files on the next commit
14 forget forget the specified files on the next commit
15 init create a new repository in the given directory
15 init create a new repository in the given directory
16 log show revision history of entire repository or files
16 log show revision history of entire repository or files
17 merge merge another revision into working directory
17 merge merge another revision into working directory
18 pull pull changes from the specified source
18 pull pull changes from the specified source
19 push push changes to the specified destination
19 push push changes to the specified destination
20 remove remove the specified files on the next commit
20 remove remove the specified files on the next commit
21 serve start stand-alone webserver
21 serve start stand-alone webserver
22 status show changed files in the working directory
22 status show changed files in the working directory
23 summary summarize working directory state
23 summary summarize working directory state
24 update update working directory (or switch revisions)
24 update update working directory (or switch revisions)
25
25
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
27
27
28 $ hg -q
28 $ hg -q
29 add add the specified files on the next commit
29 add add the specified files on the next commit
30 annotate show changeset information by line for each file
30 annotate show changeset information by line for each file
31 clone make a copy of an existing repository
31 clone make a copy of an existing repository
32 commit commit the specified files or all outstanding changes
32 commit commit the specified files or all outstanding changes
33 diff diff repository (or selected files)
33 diff diff repository (or selected files)
34 export dump the header and diffs for one or more changesets
34 export dump the header and diffs for one or more changesets
35 forget forget the specified files on the next commit
35 forget forget the specified files on the next commit
36 init create a new repository in the given directory
36 init create a new repository in the given directory
37 log show revision history of entire repository or files
37 log show revision history of entire repository or files
38 merge merge another revision into working directory
38 merge merge another revision into working directory
39 pull pull changes from the specified source
39 pull pull changes from the specified source
40 push push changes to the specified destination
40 push push changes to the specified destination
41 remove remove the specified files on the next commit
41 remove remove the specified files on the next commit
42 serve start stand-alone webserver
42 serve start stand-alone webserver
43 status show changed files in the working directory
43 status show changed files in the working directory
44 summary summarize working directory state
44 summary summarize working directory state
45 update update working directory (or switch revisions)
45 update update working directory (or switch revisions)
46
46
47 Extra extensions will be printed in help output in a non-reliable order since
47 Extra extensions will be printed in help output in a non-reliable order since
48 the extension is unknown.
48 the extension is unknown.
49 #if no-extraextensions
49 #if no-extraextensions
50
50
51 $ hg help
51 $ hg help
52 Mercurial Distributed SCM
52 Mercurial Distributed SCM
53
53
54 list of commands:
54 list of commands:
55
55
56 Repository creation:
56 Repository creation:
57
57
58 clone make a copy of an existing repository
58 clone make a copy of an existing repository
59 init create a new repository in the given directory
59 init create a new repository in the given directory
60
60
61 Remote repository management:
61 Remote repository management:
62
62
63 incoming show new changesets found in source
63 incoming show new changesets found in source
64 outgoing show changesets not found in the destination
64 outgoing show changesets not found in the destination
65 paths show aliases for remote repositories
65 paths show aliases for remote repositories
66 pull pull changes from the specified source
66 pull pull changes from the specified source
67 push push changes to the specified destination
67 push push changes to the specified destination
68 serve start stand-alone webserver
68 serve start stand-alone webserver
69
69
70 Change creation:
70 Change creation:
71
71
72 commit commit the specified files or all outstanding changes
72 commit commit the specified files or all outstanding changes
73
73
74 Change manipulation:
74 Change manipulation:
75
75
76 backout reverse effect of earlier changeset
76 backout reverse effect of earlier changeset
77 graft copy changes from other branches onto the current branch
77 graft copy changes from other branches onto the current branch
78 merge merge another revision into working directory
78 merge merge another revision into working directory
79
79
80 Change organization:
80 Change organization:
81
81
82 bookmarks create a new bookmark or list existing bookmarks
82 bookmarks create a new bookmark or list existing bookmarks
83 branch set or show the current branch name
83 branch set or show the current branch name
84 branches list repository named branches
84 branches list repository named branches
85 phase set or show the current phase name
85 phase set or show the current phase name
86 tag add one or more tags for the current or given revision
86 tag add one or more tags for the current or given revision
87 tags list repository tags
87 tags list repository tags
88
88
89 File content management:
89 File content management:
90
90
91 annotate show changeset information by line for each file
91 annotate show changeset information by line for each file
92 cat output the current or given revision of files
92 cat output the current or given revision of files
93 copy mark files as copied for the next commit
93 copy mark files as copied for the next commit
94 diff diff repository (or selected files)
94 diff diff repository (or selected files)
95 grep search for a pattern in specified files
95 grep search for a pattern in specified files
96
96
97 Change navigation:
97 Change navigation:
98
98
99 bisect subdivision search of changesets
99 bisect subdivision search of changesets
100 heads show branch heads
100 heads show branch heads
101 identify identify the working directory or specified revision
101 identify identify the working directory or specified revision
102 log show revision history of entire repository or files
102 log show revision history of entire repository or files
103
103
104 Working directory management:
104 Working directory management:
105
105
106 add add the specified files on the next commit
106 add add the specified files on the next commit
107 addremove add all new files, delete all missing files
107 addremove add all new files, delete all missing files
108 files list tracked files
108 files list tracked files
109 forget forget the specified files on the next commit
109 forget forget the specified files on the next commit
110 purge removes files not tracked by Mercurial
110 purge removes files not tracked by Mercurial
111 remove remove the specified files on the next commit
111 remove remove the specified files on the next commit
112 rename rename files; equivalent of copy + remove
112 rename rename files; equivalent of copy + remove
113 resolve redo merges or set/view the merge status of files
113 resolve redo merges or set/view the merge status of files
114 revert restore files to their checkout state
114 revert restore files to their checkout state
115 root print the root (top) of the current working directory
115 root print the root (top) of the current working directory
116 shelve save and set aside changes from the working directory
116 shelve save and set aside changes from the working directory
117 status show changed files in the working directory
117 status show changed files in the working directory
118 summary summarize working directory state
118 summary summarize working directory state
119 unshelve restore a shelved change to the working directory
119 unshelve restore a shelved change to the working directory
120 update update working directory (or switch revisions)
120 update update working directory (or switch revisions)
121
121
122 Change import/export:
122 Change import/export:
123
123
124 archive create an unversioned archive of a repository revision
124 archive create an unversioned archive of a repository revision
125 bundle create a bundle file
125 bundle create a bundle file
126 export dump the header and diffs for one or more changesets
126 export dump the header and diffs for one or more changesets
127 import import an ordered set of patches
127 import import an ordered set of patches
128 unbundle apply one or more bundle files
128 unbundle apply one or more bundle files
129
129
130 Repository maintenance:
130 Repository maintenance:
131
131
132 manifest output the current or given revision of the project manifest
132 manifest output the current or given revision of the project manifest
133 recover roll back an interrupted transaction
133 recover roll back an interrupted transaction
134 verify verify the integrity of the repository
134 verify verify the integrity of the repository
135
135
136 Help:
136 Help:
137
137
138 config show combined config settings from all hgrc files
138 config show combined config settings from all hgrc files
139 help show help for a given topic or a help overview
139 help show help for a given topic or a help overview
140 version output version and copyright information
140 version output version and copyright information
141
141
142 additional help topics:
142 additional help topics:
143
143
144 Mercurial identifiers:
144 Mercurial identifiers:
145
145
146 filesets Specifying File Sets
146 filesets Specifying File Sets
147 hgignore Syntax for Mercurial Ignore Files
147 hgignore Syntax for Mercurial Ignore Files
148 patterns File Name Patterns
148 patterns File Name Patterns
149 revisions Specifying Revisions
149 revisions Specifying Revisions
150 urls URL Paths
150 urls URL Paths
151
151
152 Mercurial output:
152 Mercurial output:
153
153
154 color Colorizing Outputs
154 color Colorizing Outputs
155 dates Date Formats
155 dates Date Formats
156 diffs Diff Formats
156 diffs Diff Formats
157 templating Template Usage
157 templating Template Usage
158
158
159 Mercurial configuration:
159 Mercurial configuration:
160
160
161 config Configuration Files
161 config Configuration Files
162 environment Environment Variables
162 environment Environment Variables
163 extensions Using Additional Features
163 extensions Using Additional Features
164 flags Command-line flags
164 flags Command-line flags
165 hgweb Configuring hgweb
165 hgweb Configuring hgweb
166 merge-tools Merge Tools
166 merge-tools Merge Tools
167 pager Pager Support
167 pager Pager Support
168 rust Rust in Mercurial
168 rust Rust in Mercurial
169
169
170 Concepts:
170 Concepts:
171
171
172 bundlespec Bundle File Formats
172 bundlespec Bundle File Formats
173 evolution Safely rewriting history (EXPERIMENTAL)
173 evolution Safely rewriting history (EXPERIMENTAL)
174 glossary Glossary
174 glossary Glossary
175 phases Working with Phases
175 phases Working with Phases
176 subrepos Subrepositories
176 subrepos Subrepositories
177
177
178 Miscellaneous:
178 Miscellaneous:
179
179
180 deprecated Deprecated Features
180 deprecated Deprecated Features
181 internals Technical implementation topics
181 internals Technical implementation topics
182 scripting Using Mercurial from scripts and automation
182 scripting Using Mercurial from scripts and automation
183
183
184 (use 'hg help -v' to show built-in aliases and global options)
184 (use 'hg help -v' to show built-in aliases and global options)
185
185
186 $ hg -q help
186 $ hg -q help
187 Repository creation:
187 Repository creation:
188
188
189 clone make a copy of an existing repository
189 clone make a copy of an existing repository
190 init create a new repository in the given directory
190 init create a new repository in the given directory
191
191
192 Remote repository management:
192 Remote repository management:
193
193
194 incoming show new changesets found in source
194 incoming show new changesets found in source
195 outgoing show changesets not found in the destination
195 outgoing show changesets not found in the destination
196 paths show aliases for remote repositories
196 paths show aliases for remote repositories
197 pull pull changes from the specified source
197 pull pull changes from the specified source
198 push push changes to the specified destination
198 push push changes to the specified destination
199 serve start stand-alone webserver
199 serve start stand-alone webserver
200
200
201 Change creation:
201 Change creation:
202
202
203 commit commit the specified files or all outstanding changes
203 commit commit the specified files or all outstanding changes
204
204
205 Change manipulation:
205 Change manipulation:
206
206
207 backout reverse effect of earlier changeset
207 backout reverse effect of earlier changeset
208 graft copy changes from other branches onto the current branch
208 graft copy changes from other branches onto the current branch
209 merge merge another revision into working directory
209 merge merge another revision into working directory
210
210
211 Change organization:
211 Change organization:
212
212
213 bookmarks create a new bookmark or list existing bookmarks
213 bookmarks create a new bookmark or list existing bookmarks
214 branch set or show the current branch name
214 branch set or show the current branch name
215 branches list repository named branches
215 branches list repository named branches
216 phase set or show the current phase name
216 phase set or show the current phase name
217 tag add one or more tags for the current or given revision
217 tag add one or more tags for the current or given revision
218 tags list repository tags
218 tags list repository tags
219
219
220 File content management:
220 File content management:
221
221
222 annotate show changeset information by line for each file
222 annotate show changeset information by line for each file
223 cat output the current or given revision of files
223 cat output the current or given revision of files
224 copy mark files as copied for the next commit
224 copy mark files as copied for the next commit
225 diff diff repository (or selected files)
225 diff diff repository (or selected files)
226 grep search for a pattern in specified files
226 grep search for a pattern in specified files
227
227
228 Change navigation:
228 Change navigation:
229
229
230 bisect subdivision search of changesets
230 bisect subdivision search of changesets
231 heads show branch heads
231 heads show branch heads
232 identify identify the working directory or specified revision
232 identify identify the working directory or specified revision
233 log show revision history of entire repository or files
233 log show revision history of entire repository or files
234
234
235 Working directory management:
235 Working directory management:
236
236
237 add add the specified files on the next commit
237 add add the specified files on the next commit
238 addremove add all new files, delete all missing files
238 addremove add all new files, delete all missing files
239 files list tracked files
239 files list tracked files
240 forget forget the specified files on the next commit
240 forget forget the specified files on the next commit
241 purge removes files not tracked by Mercurial
241 purge removes files not tracked by Mercurial
242 remove remove the specified files on the next commit
242 remove remove the specified files on the next commit
243 rename rename files; equivalent of copy + remove
243 rename rename files; equivalent of copy + remove
244 resolve redo merges or set/view the merge status of files
244 resolve redo merges or set/view the merge status of files
245 revert restore files to their checkout state
245 revert restore files to their checkout state
246 root print the root (top) of the current working directory
246 root print the root (top) of the current working directory
247 shelve save and set aside changes from the working directory
247 shelve save and set aside changes from the working directory
248 status show changed files in the working directory
248 status show changed files in the working directory
249 summary summarize working directory state
249 summary summarize working directory state
250 unshelve restore a shelved change to the working directory
250 unshelve restore a shelved change to the working directory
251 update update working directory (or switch revisions)
251 update update working directory (or switch revisions)
252
252
253 Change import/export:
253 Change import/export:
254
254
255 archive create an unversioned archive of a repository revision
255 archive create an unversioned archive of a repository revision
256 bundle create a bundle file
256 bundle create a bundle file
257 export dump the header and diffs for one or more changesets
257 export dump the header and diffs for one or more changesets
258 import import an ordered set of patches
258 import import an ordered set of patches
259 unbundle apply one or more bundle files
259 unbundle apply one or more bundle files
260
260
261 Repository maintenance:
261 Repository maintenance:
262
262
263 manifest output the current or given revision of the project manifest
263 manifest output the current or given revision of the project manifest
264 recover roll back an interrupted transaction
264 recover roll back an interrupted transaction
265 verify verify the integrity of the repository
265 verify verify the integrity of the repository
266
266
267 Help:
267 Help:
268
268
269 config show combined config settings from all hgrc files
269 config show combined config settings from all hgrc files
270 help show help for a given topic or a help overview
270 help show help for a given topic or a help overview
271 version output version and copyright information
271 version output version and copyright information
272
272
273 additional help topics:
273 additional help topics:
274
274
275 Mercurial identifiers:
275 Mercurial identifiers:
276
276
277 filesets Specifying File Sets
277 filesets Specifying File Sets
278 hgignore Syntax for Mercurial Ignore Files
278 hgignore Syntax for Mercurial Ignore Files
279 patterns File Name Patterns
279 patterns File Name Patterns
280 revisions Specifying Revisions
280 revisions Specifying Revisions
281 urls URL Paths
281 urls URL Paths
282
282
283 Mercurial output:
283 Mercurial output:
284
284
285 color Colorizing Outputs
285 color Colorizing Outputs
286 dates Date Formats
286 dates Date Formats
287 diffs Diff Formats
287 diffs Diff Formats
288 templating Template Usage
288 templating Template Usage
289
289
290 Mercurial configuration:
290 Mercurial configuration:
291
291
292 config Configuration Files
292 config Configuration Files
293 environment Environment Variables
293 environment Environment Variables
294 extensions Using Additional Features
294 extensions Using Additional Features
295 flags Command-line flags
295 flags Command-line flags
296 hgweb Configuring hgweb
296 hgweb Configuring hgweb
297 merge-tools Merge Tools
297 merge-tools Merge Tools
298 pager Pager Support
298 pager Pager Support
299 rust Rust in Mercurial
299 rust Rust in Mercurial
300
300
301 Concepts:
301 Concepts:
302
302
303 bundlespec Bundle File Formats
303 bundlespec Bundle File Formats
304 evolution Safely rewriting history (EXPERIMENTAL)
304 evolution Safely rewriting history (EXPERIMENTAL)
305 glossary Glossary
305 glossary Glossary
306 phases Working with Phases
306 phases Working with Phases
307 subrepos Subrepositories
307 subrepos Subrepositories
308
308
309 Miscellaneous:
309 Miscellaneous:
310
310
311 deprecated Deprecated Features
311 deprecated Deprecated Features
312 internals Technical implementation topics
312 internals Technical implementation topics
313 scripting Using Mercurial from scripts and automation
313 scripting Using Mercurial from scripts and automation
314
314
315 Test extension help:
315 Test extension help:
316 $ hg help extensions --config extensions.rebase= --config extensions.children=
316 $ hg help extensions --config extensions.rebase= --config extensions.children=
317 Using Additional Features
317 Using Additional Features
318 """""""""""""""""""""""""
318 """""""""""""""""""""""""
319
319
320 Mercurial has the ability to add new features through the use of
320 Mercurial has the ability to add new features through the use of
321 extensions. Extensions may add new commands, add options to existing
321 extensions. Extensions may add new commands, add options to existing
322 commands, change the default behavior of commands, or implement hooks.
322 commands, change the default behavior of commands, or implement hooks.
323
323
324 To enable the "foo" extension, either shipped with Mercurial or in the
324 To enable the "foo" extension, either shipped with Mercurial or in the
325 Python search path, create an entry for it in your configuration file,
325 Python search path, create an entry for it in your configuration file,
326 like this:
326 like this:
327
327
328 [extensions]
328 [extensions]
329 foo =
329 foo =
330
330
331 You may also specify the full path to an extension:
331 You may also specify the full path to an extension:
332
332
333 [extensions]
333 [extensions]
334 myfeature = ~/.hgext/myfeature.py
334 myfeature = ~/.hgext/myfeature.py
335
335
336 See 'hg help config' for more information on configuration files.
336 See 'hg help config' for more information on configuration files.
337
337
338 Extensions are not loaded by default for a variety of reasons: they can
338 Extensions are not loaded by default for a variety of reasons: they can
339 increase startup overhead; they may be meant for advanced usage only; they
339 increase startup overhead; they may be meant for advanced usage only; they
340 may provide potentially dangerous abilities (such as letting you destroy
340 may provide potentially dangerous abilities (such as letting you destroy
341 or modify history); they might not be ready for prime time; or they may
341 or modify history); they might not be ready for prime time; or they may
342 alter some usual behaviors of stock Mercurial. It is thus up to the user
342 alter some usual behaviors of stock Mercurial. It is thus up to the user
343 to activate extensions as needed.
343 to activate extensions as needed.
344
344
345 To explicitly disable an extension enabled in a configuration file of
345 To explicitly disable an extension enabled in a configuration file of
346 broader scope, prepend its path with !:
346 broader scope, prepend its path with !:
347
347
348 [extensions]
348 [extensions]
349 # disabling extension bar residing in /path/to/extension/bar.py
349 # disabling extension bar residing in /path/to/extension/bar.py
350 bar = !/path/to/extension/bar.py
350 bar = !/path/to/extension/bar.py
351 # ditto, but no path was supplied for extension baz
351 # ditto, but no path was supplied for extension baz
352 baz = !
352 baz = !
353
353
354 enabled extensions:
354 enabled extensions:
355
355
356 children command to display child changesets (DEPRECATED)
356 children command to display child changesets (DEPRECATED)
357 rebase command to move sets of revisions to a different ancestor
357 rebase command to move sets of revisions to a different ancestor
358
358
359 disabled extensions:
359 disabled extensions:
360
360
361 acl hooks for controlling repository access
361 acl hooks for controlling repository access
362 blackbox log repository events to a blackbox for debugging
362 blackbox log repository events to a blackbox for debugging
363 bugzilla hooks for integrating with the Bugzilla bug tracker
363 bugzilla hooks for integrating with the Bugzilla bug tracker
364 censor erase file content at a given revision
364 censor erase file content at a given revision
365 churn command to display statistics about repository history
365 churn command to display statistics about repository history
366 clonebundles advertise pre-generated bundles to seed clones
366 clonebundles advertise pre-generated bundles to seed clones
367 closehead close arbitrary heads without checking them out first
367 closehead close arbitrary heads without checking them out first
368 convert import revisions from foreign VCS repositories into
368 convert import revisions from foreign VCS repositories into
369 Mercurial
369 Mercurial
370 eol automatically manage newlines in repository files
370 eol automatically manage newlines in repository files
371 extdiff command to allow external programs to compare revisions
371 extdiff command to allow external programs to compare revisions
372 factotum http authentication with factotum
372 factotum http authentication with factotum
373 fastexport export repositories as git fast-import stream
373 fastexport export repositories as git fast-import stream
374 githelp try mapping git commands to Mercurial commands
374 githelp try mapping git commands to Mercurial commands
375 gpg commands to sign and verify changesets
375 gpg commands to sign and verify changesets
376 hgk browse the repository in a graphical way
376 hgk browse the repository in a graphical way
377 highlight syntax highlighting for hgweb (requires Pygments)
377 highlight syntax highlighting for hgweb (requires Pygments)
378 histedit interactive history editing
378 histedit interactive history editing
379 keyword expand keywords in tracked files
379 keyword expand keywords in tracked files
380 largefiles track large binary files
380 largefiles track large binary files
381 mq manage a stack of patches
381 mq manage a stack of patches
382 notify hooks for sending email push notifications
382 notify hooks for sending email push notifications
383 patchbomb command to send changesets as (a series of) patch emails
383 patchbomb command to send changesets as (a series of) patch emails
384 relink recreates hardlinks between repository clones
384 relink recreates hardlinks between repository clones
385 schemes extend schemes with shortcuts to repository swarms
385 schemes extend schemes with shortcuts to repository swarms
386 share share a common history between several working directories
386 share share a common history between several working directories
387 transplant command to transplant changesets from another branch
387 transplant command to transplant changesets from another branch
388 win32mbcs allow the use of MBCS paths with problematic encodings
388 win32mbcs allow the use of MBCS paths with problematic encodings
389 zeroconf discover and advertise repositories on the local network
389 zeroconf discover and advertise repositories on the local network
390
390
391 #endif
391 #endif
392
392
393 Verify that deprecated extensions are included if --verbose:
393 Verify that deprecated extensions are included if --verbose:
394
394
395 $ hg -v help extensions | grep children
395 $ hg -v help extensions | grep children
396 children command to display child changesets (DEPRECATED)
396 children command to display child changesets (DEPRECATED)
397
397
398 Verify that extension keywords appear in help templates
398 Verify that extension keywords appear in help templates
399
399
400 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
400 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
401
401
402 Test short command list with verbose option
402 Test short command list with verbose option
403
403
404 $ hg -v help shortlist
404 $ hg -v help shortlist
405 Mercurial Distributed SCM
405 Mercurial Distributed SCM
406
406
407 basic commands:
407 basic commands:
408
408
409 abort abort an unfinished operation (EXPERIMENTAL)
409 abort abort an unfinished operation (EXPERIMENTAL)
410 add add the specified files on the next commit
410 add add the specified files on the next commit
411 annotate, blame
411 annotate, blame
412 show changeset information by line for each file
412 show changeset information by line for each file
413 clone make a copy of an existing repository
413 clone make a copy of an existing repository
414 commit, ci commit the specified files or all outstanding changes
414 commit, ci commit the specified files or all outstanding changes
415 continue resumes an interrupted operation (EXPERIMENTAL)
415 continue resumes an interrupted operation (EXPERIMENTAL)
416 diff diff repository (or selected files)
416 diff diff repository (or selected files)
417 export dump the header and diffs for one or more changesets
417 export dump the header and diffs for one or more changesets
418 forget forget the specified files on the next commit
418 forget forget the specified files on the next commit
419 init create a new repository in the given directory
419 init create a new repository in the given directory
420 log, history show revision history of entire repository or files
420 log, history show revision history of entire repository or files
421 merge merge another revision into working directory
421 merge merge another revision into working directory
422 pull pull changes from the specified source
422 pull pull changes from the specified source
423 push push changes to the specified destination
423 push push changes to the specified destination
424 remove, rm remove the specified files on the next commit
424 remove, rm remove the specified files on the next commit
425 serve start stand-alone webserver
425 serve start stand-alone webserver
426 status, st show changed files in the working directory
426 status, st show changed files in the working directory
427 summary, sum summarize working directory state
427 summary, sum summarize working directory state
428 update, up, checkout, co
428 update, up, checkout, co
429 update working directory (or switch revisions)
429 update working directory (or switch revisions)
430
430
431 global options ([+] can be repeated):
431 global options ([+] can be repeated):
432
432
433 -R --repository REPO repository root directory or name of overlay bundle
433 -R --repository REPO repository root directory or name of overlay bundle
434 file
434 file
435 --cwd DIR change working directory
435 --cwd DIR change working directory
436 -y --noninteractive do not prompt, automatically pick the first choice for
436 -y --noninteractive do not prompt, automatically pick the first choice for
437 all prompts
437 all prompts
438 -q --quiet suppress output
438 -q --quiet suppress output
439 -v --verbose enable additional output
439 -v --verbose enable additional output
440 --color TYPE when to colorize (boolean, always, auto, never, or
440 --color TYPE when to colorize (boolean, always, auto, never, or
441 debug)
441 debug)
442 --config CONFIG [+] set/override config option (use 'section.name=value')
442 --config CONFIG [+] set/override config option (use 'section.name=value')
443 --debug enable debugging output
443 --debug enable debugging output
444 --debugger start debugger
444 --debugger start debugger
445 --encoding ENCODE set the charset encoding (default: ascii)
445 --encoding ENCODE set the charset encoding (default: ascii)
446 --encodingmode MODE set the charset encoding mode (default: strict)
446 --encodingmode MODE set the charset encoding mode (default: strict)
447 --traceback always print a traceback on exception
447 --traceback always print a traceback on exception
448 --time time how long the command takes
448 --time time how long the command takes
449 --profile print command execution profile
449 --profile print command execution profile
450 --version output version information and exit
450 --version output version information and exit
451 -h --help display help and exit
451 -h --help display help and exit
452 --hidden consider hidden changesets
452 --hidden consider hidden changesets
453 --pager TYPE when to paginate (boolean, always, auto, or never)
453 --pager TYPE when to paginate (boolean, always, auto, or never)
454 (default: auto)
454 (default: auto)
455
455
456 (use 'hg help' for the full list of commands)
456 (use 'hg help' for the full list of commands)
457
457
458 $ hg add -h
458 $ hg add -h
459 hg add [OPTION]... [FILE]...
459 hg add [OPTION]... [FILE]...
460
460
461 add the specified files on the next commit
461 add the specified files on the next commit
462
462
463 Schedule files to be version controlled and added to the repository.
463 Schedule files to be version controlled and added to the repository.
464
464
465 The files will be added to the repository at the next commit. To undo an
465 The files will be added to the repository at the next commit. To undo an
466 add before that, see 'hg forget'.
466 add before that, see 'hg forget'.
467
467
468 If no names are given, add all files to the repository (except files
468 If no names are given, add all files to the repository (except files
469 matching ".hgignore").
469 matching ".hgignore").
470
470
471 Returns 0 if all files are successfully added.
471 Returns 0 if all files are successfully added.
472
472
473 options ([+] can be repeated):
473 options ([+] can be repeated):
474
474
475 -I --include PATTERN [+] include names matching the given patterns
475 -I --include PATTERN [+] include names matching the given patterns
476 -X --exclude PATTERN [+] exclude names matching the given patterns
476 -X --exclude PATTERN [+] exclude names matching the given patterns
477 -S --subrepos recurse into subrepositories
477 -S --subrepos recurse into subrepositories
478 -n --dry-run do not perform actions, just print output
478 -n --dry-run do not perform actions, just print output
479
479
480 (some details hidden, use --verbose to show complete help)
480 (some details hidden, use --verbose to show complete help)
481
481
482 Verbose help for add
482 Verbose help for add
483
483
484 $ hg add -hv
484 $ hg add -hv
485 hg add [OPTION]... [FILE]...
485 hg add [OPTION]... [FILE]...
486
486
487 add the specified files on the next commit
487 add the specified files on the next commit
488
488
489 Schedule files to be version controlled and added to the repository.
489 Schedule files to be version controlled and added to the repository.
490
490
491 The files will be added to the repository at the next commit. To undo an
491 The files will be added to the repository at the next commit. To undo an
492 add before that, see 'hg forget'.
492 add before that, see 'hg forget'.
493
493
494 If no names are given, add all files to the repository (except files
494 If no names are given, add all files to the repository (except files
495 matching ".hgignore").
495 matching ".hgignore").
496
496
497 Examples:
497 Examples:
498
498
499 - New (unknown) files are added automatically by 'hg add':
499 - New (unknown) files are added automatically by 'hg add':
500
500
501 $ ls
501 $ ls
502 foo.c
502 foo.c
503 $ hg status
503 $ hg status
504 ? foo.c
504 ? foo.c
505 $ hg add
505 $ hg add
506 adding foo.c
506 adding foo.c
507 $ hg status
507 $ hg status
508 A foo.c
508 A foo.c
509
509
510 - Specific files to be added can be specified:
510 - Specific files to be added can be specified:
511
511
512 $ ls
512 $ ls
513 bar.c foo.c
513 bar.c foo.c
514 $ hg status
514 $ hg status
515 ? bar.c
515 ? bar.c
516 ? foo.c
516 ? foo.c
517 $ hg add bar.c
517 $ hg add bar.c
518 $ hg status
518 $ hg status
519 A bar.c
519 A bar.c
520 ? foo.c
520 ? foo.c
521
521
522 Returns 0 if all files are successfully added.
522 Returns 0 if all files are successfully added.
523
523
524 options ([+] can be repeated):
524 options ([+] can be repeated):
525
525
526 -I --include PATTERN [+] include names matching the given patterns
526 -I --include PATTERN [+] include names matching the given patterns
527 -X --exclude PATTERN [+] exclude names matching the given patterns
527 -X --exclude PATTERN [+] exclude names matching the given patterns
528 -S --subrepos recurse into subrepositories
528 -S --subrepos recurse into subrepositories
529 -n --dry-run do not perform actions, just print output
529 -n --dry-run do not perform actions, just print output
530
530
531 global options ([+] can be repeated):
531 global options ([+] can be repeated):
532
532
533 -R --repository REPO repository root directory or name of overlay bundle
533 -R --repository REPO repository root directory or name of overlay bundle
534 file
534 file
535 --cwd DIR change working directory
535 --cwd DIR change working directory
536 -y --noninteractive do not prompt, automatically pick the first choice for
536 -y --noninteractive do not prompt, automatically pick the first choice for
537 all prompts
537 all prompts
538 -q --quiet suppress output
538 -q --quiet suppress output
539 -v --verbose enable additional output
539 -v --verbose enable additional output
540 --color TYPE when to colorize (boolean, always, auto, never, or
540 --color TYPE when to colorize (boolean, always, auto, never, or
541 debug)
541 debug)
542 --config CONFIG [+] set/override config option (use 'section.name=value')
542 --config CONFIG [+] set/override config option (use 'section.name=value')
543 --debug enable debugging output
543 --debug enable debugging output
544 --debugger start debugger
544 --debugger start debugger
545 --encoding ENCODE set the charset encoding (default: ascii)
545 --encoding ENCODE set the charset encoding (default: ascii)
546 --encodingmode MODE set the charset encoding mode (default: strict)
546 --encodingmode MODE set the charset encoding mode (default: strict)
547 --traceback always print a traceback on exception
547 --traceback always print a traceback on exception
548 --time time how long the command takes
548 --time time how long the command takes
549 --profile print command execution profile
549 --profile print command execution profile
550 --version output version information and exit
550 --version output version information and exit
551 -h --help display help and exit
551 -h --help display help and exit
552 --hidden consider hidden changesets
552 --hidden consider hidden changesets
553 --pager TYPE when to paginate (boolean, always, auto, or never)
553 --pager TYPE when to paginate (boolean, always, auto, or never)
554 (default: auto)
554 (default: auto)
555
555
556 Test the textwidth config option
556 Test the textwidth config option
557
557
558 $ hg root -h --config ui.textwidth=50
558 $ hg root -h --config ui.textwidth=50
559 hg root
559 hg root
560
560
561 print the root (top) of the current working
561 print the root (top) of the current working
562 directory
562 directory
563
563
564 Print the root directory of the current
564 Print the root directory of the current
565 repository.
565 repository.
566
566
567 Returns 0 on success.
567 Returns 0 on success.
568
568
569 options:
569 options:
570
570
571 -T --template TEMPLATE display with template
571 -T --template TEMPLATE display with template
572
572
573 (some details hidden, use --verbose to show
573 (some details hidden, use --verbose to show
574 complete help)
574 complete help)
575
575
576 Test help option with version option
576 Test help option with version option
577
577
578 $ hg add -h --version
578 $ hg add -h --version
579 Mercurial Distributed SCM (version *) (glob)
579 Mercurial Distributed SCM (version *) (glob)
580 (see https://mercurial-scm.org for more information)
580 (see https://mercurial-scm.org for more information)
581
581
582 Copyright (C) 2005-* Olivia Mackall and others (glob)
582 Copyright (C) 2005-* Olivia Mackall and others (glob)
583 This is free software; see the source for copying conditions. There is NO
583 This is free software; see the source for copying conditions. There is NO
584 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
584 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
585
585
586 $ hg add --skjdfks
586 $ hg add --skjdfks
587 hg add: option --skjdfks not recognized
587 hg add: option --skjdfks not recognized
588 hg add [OPTION]... [FILE]...
588 hg add [OPTION]... [FILE]...
589
589
590 add the specified files on the next commit
590 add the specified files on the next commit
591
591
592 options ([+] can be repeated):
592 options ([+] can be repeated):
593
593
594 -I --include PATTERN [+] include names matching the given patterns
594 -I --include PATTERN [+] include names matching the given patterns
595 -X --exclude PATTERN [+] exclude names matching the given patterns
595 -X --exclude PATTERN [+] exclude names matching the given patterns
596 -S --subrepos recurse into subrepositories
596 -S --subrepos recurse into subrepositories
597 -n --dry-run do not perform actions, just print output
597 -n --dry-run do not perform actions, just print output
598
598
599 (use 'hg add -h' to show more help)
599 (use 'hg add -h' to show more help)
600 [10]
600 [10]
601
601
602 Test ambiguous command help
602 Test ambiguous command help
603
603
604 $ hg help ad
604 $ hg help ad
605 list of commands:
605 list of commands:
606
606
607 add add the specified files on the next commit
607 add add the specified files on the next commit
608 addremove add all new files, delete all missing files
608 addremove add all new files, delete all missing files
609
609
610 (use 'hg help -v ad' to show built-in aliases and global options)
610 (use 'hg help -v ad' to show built-in aliases and global options)
611
611
612 Test command without options
612 Test command without options
613
613
614 $ hg help verify
614 $ hg help verify
615 hg verify
615 hg verify
616
616
617 verify the integrity of the repository
617 verify the integrity of the repository
618
618
619 Verify the integrity of the current repository.
619 Verify the integrity of the current repository.
620
620
621 This will perform an extensive check of the repository's integrity,
621 This will perform an extensive check of the repository's integrity,
622 validating the hashes and checksums of each entry in the changelog,
622 validating the hashes and checksums of each entry in the changelog,
623 manifest, and tracked files, as well as the integrity of their crosslinks
623 manifest, and tracked files, as well as the integrity of their crosslinks
624 and indices.
624 and indices.
625
625
626 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
626 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
627 information about recovery from corruption of the repository.
627 information about recovery from corruption of the repository.
628
628
629 Returns 0 on success, 1 if errors are encountered.
629 Returns 0 on success, 1 if errors are encountered.
630
630
631 options:
631 options:
632
632
633 (some details hidden, use --verbose to show complete help)
633 (some details hidden, use --verbose to show complete help)
634
634
635 $ hg help diff
635 $ hg help diff
636 hg diff [OPTION]... ([-c REV] | [--from REV1] [--to REV2]) [FILE]...
636 hg diff [OPTION]... ([-c REV] | [--from REV1] [--to REV2]) [FILE]...
637
637
638 diff repository (or selected files)
638 diff repository (or selected files)
639
639
640 Show differences between revisions for the specified files.
640 Show differences between revisions for the specified files.
641
641
642 Differences between files are shown using the unified diff format.
642 Differences between files are shown using the unified diff format.
643
643
644 Note:
644 Note:
645 'hg diff' may generate unexpected results for merges, as it will
645 'hg diff' may generate unexpected results for merges, as it will
646 default to comparing against the working directory's first parent
646 default to comparing against the working directory's first parent
647 changeset if no revisions are specified.
647 changeset if no revisions are specified.
648
648
649 By default, the working directory files are compared to its first parent.
649 By default, the working directory files are compared to its first parent.
650 To see the differences from another revision, use --from. To see the
650 To see the differences from another revision, use --from. To see the
651 difference to another revision, use --to. For example, 'hg diff --from .^'
651 difference to another revision, use --to. For example, 'hg diff --from .^'
652 will show the differences from the working copy's grandparent to the
652 will show the differences from the working copy's grandparent to the
653 working copy, 'hg diff --to .' will show the diff from the working copy to
653 working copy, 'hg diff --to .' will show the diff from the working copy to
654 its parent (i.e. the reverse of the default), and 'hg diff --from 1.0 --to
654 its parent (i.e. the reverse of the default), and 'hg diff --from 1.0 --to
655 1.2' will show the diff between those two revisions.
655 1.2' will show the diff between those two revisions.
656
656
657 Alternatively you can specify -c/--change with a revision to see the
657 Alternatively you can specify -c/--change with a revision to see the
658 changes in that changeset relative to its first parent (i.e. 'hg diff -c
658 changes in that changeset relative to its first parent (i.e. 'hg diff -c
659 42' is equivalent to 'hg diff --from 42^ --to 42')
659 42' is equivalent to 'hg diff --from 42^ --to 42')
660
660
661 Without the -a/--text option, diff will avoid generating diffs of files it
661 Without the -a/--text option, diff will avoid generating diffs of files it
662 detects as binary. With -a, diff will generate a diff anyway, probably
662 detects as binary. With -a, diff will generate a diff anyway, probably
663 with undesirable results.
663 with undesirable results.
664
664
665 Use the -g/--git option to generate diffs in the git extended diff format.
665 Use the -g/--git option to generate diffs in the git extended diff format.
666 For more information, read 'hg help diffs'.
666 For more information, read 'hg help diffs'.
667
667
668 Returns 0 on success.
668 Returns 0 on success.
669
669
670 options ([+] can be repeated):
670 options ([+] can be repeated):
671
671
672 --from REV1 revision to diff from
672 --from REV1 revision to diff from
673 --to REV2 revision to diff to
673 --to REV2 revision to diff to
674 -c --change REV change made by revision
674 -c --change REV change made by revision
675 -a --text treat all files as text
675 -a --text treat all files as text
676 -g --git use git extended diff format
676 -g --git use git extended diff format
677 --binary generate binary diffs in git mode (default)
677 --binary generate binary diffs in git mode (default)
678 --nodates omit dates from diff headers
678 --nodates omit dates from diff headers
679 --noprefix omit a/ and b/ prefixes from filenames
679 --noprefix omit a/ and b/ prefixes from filenames
680 -p --show-function show which function each change is in
680 -p --show-function show which function each change is in
681 --reverse produce a diff that undoes the changes
681 --reverse produce a diff that undoes the changes
682 -w --ignore-all-space ignore white space when comparing lines
682 -w --ignore-all-space ignore white space when comparing lines
683 -b --ignore-space-change ignore changes in the amount of white space
683 -b --ignore-space-change ignore changes in the amount of white space
684 -B --ignore-blank-lines ignore changes whose lines are all blank
684 -B --ignore-blank-lines ignore changes whose lines are all blank
685 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
685 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
686 -U --unified NUM number of lines of context to show
686 -U --unified NUM number of lines of context to show
687 --stat output diffstat-style summary of changes
687 --stat output diffstat-style summary of changes
688 --root DIR produce diffs relative to subdirectory
688 --root DIR produce diffs relative to subdirectory
689 -I --include PATTERN [+] include names matching the given patterns
689 -I --include PATTERN [+] include names matching the given patterns
690 -X --exclude PATTERN [+] exclude names matching the given patterns
690 -X --exclude PATTERN [+] exclude names matching the given patterns
691 -S --subrepos recurse into subrepositories
691 -S --subrepos recurse into subrepositories
692
692
693 (some details hidden, use --verbose to show complete help)
693 (some details hidden, use --verbose to show complete help)
694
694
695 $ hg help status
695 $ hg help status
696 hg status [OPTION]... [FILE]...
696 hg status [OPTION]... [FILE]...
697
697
698 aliases: st
698 aliases: st
699
699
700 show changed files in the working directory
700 show changed files in the working directory
701
701
702 Show status of files in the repository. If names are given, only files
702 Show status of files in the repository. If names are given, only files
703 that match are shown. Files that are clean or ignored or the source of a
703 that match are shown. Files that are clean or ignored or the source of a
704 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
704 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
705 -C/--copies or -A/--all are given. Unless options described with "show
705 -C/--copies or -A/--all are given. Unless options described with "show
706 only ..." are given, the options -mardu are used.
706 only ..." are given, the options -mardu are used.
707
707
708 Option -q/--quiet hides untracked (unknown and ignored) files unless
708 Option -q/--quiet hides untracked (unknown and ignored) files unless
709 explicitly requested with -u/--unknown or -i/--ignored.
709 explicitly requested with -u/--unknown or -i/--ignored.
710
710
711 Note:
711 Note:
712 'hg status' may appear to disagree with diff if permissions have
712 'hg status' may appear to disagree with diff if permissions have
713 changed or a merge has occurred. The standard diff format does not
713 changed or a merge has occurred. The standard diff format does not
714 report permission changes and diff only reports changes relative to one
714 report permission changes and diff only reports changes relative to one
715 merge parent.
715 merge parent.
716
716
717 If one revision is given, it is used as the base revision. If two
717 If one revision is given, it is used as the base revision. If two
718 revisions are given, the differences between them are shown. The --change
718 revisions are given, the differences between them are shown. The --change
719 option can also be used as a shortcut to list the changed files of a
719 option can also be used as a shortcut to list the changed files of a
720 revision from its first parent.
720 revision from its first parent.
721
721
722 The codes used to show the status of files are:
722 The codes used to show the status of files are:
723
723
724 M = modified
724 M = modified
725 A = added
725 A = added
726 R = removed
726 R = removed
727 C = clean
727 C = clean
728 ! = missing (deleted by non-hg command, but still tracked)
728 ! = missing (deleted by non-hg command, but still tracked)
729 ? = not tracked
729 ? = not tracked
730 I = ignored
730 I = ignored
731 = origin of the previous file (with --copies)
731 = origin of the previous file (with --copies)
732
732
733 Returns 0 on success.
733 Returns 0 on success.
734
734
735 options ([+] can be repeated):
735 options ([+] can be repeated):
736
736
737 -A --all show status of all files
737 -A --all show status of all files
738 -m --modified show only modified files
738 -m --modified show only modified files
739 -a --added show only added files
739 -a --added show only added files
740 -r --removed show only removed files
740 -r --removed show only removed files
741 -d --deleted show only missing files
741 -d --deleted show only missing files
742 -c --clean show only files without changes
742 -c --clean show only files without changes
743 -u --unknown show only unknown (not tracked) files
743 -u --unknown show only unknown (not tracked) files
744 -i --ignored show only ignored files
744 -i --ignored show only ignored files
745 -n --no-status hide status prefix
745 -n --no-status hide status prefix
746 -C --copies show source of copied files
746 -C --copies show source of copied files
747 -0 --print0 end filenames with NUL, for use with xargs
747 -0 --print0 end filenames with NUL, for use with xargs
748 --rev REV [+] show difference from revision
748 --rev REV [+] show difference from revision
749 --change REV list the changed files of a revision
749 --change REV list the changed files of a revision
750 -I --include PATTERN [+] include names matching the given patterns
750 -I --include PATTERN [+] include names matching the given patterns
751 -X --exclude PATTERN [+] exclude names matching the given patterns
751 -X --exclude PATTERN [+] exclude names matching the given patterns
752 -S --subrepos recurse into subrepositories
752 -S --subrepos recurse into subrepositories
753 -T --template TEMPLATE display with template
753 -T --template TEMPLATE display with template
754
754
755 (some details hidden, use --verbose to show complete help)
755 (some details hidden, use --verbose to show complete help)
756
756
757 $ hg -q help status
757 $ hg -q help status
758 hg status [OPTION]... [FILE]...
758 hg status [OPTION]... [FILE]...
759
759
760 show changed files in the working directory
760 show changed files in the working directory
761
761
762 $ hg help foo
762 $ hg help foo
763 abort: no such help topic: foo
763 abort: no such help topic: foo
764 (try 'hg help --keyword foo')
764 (try 'hg help --keyword foo')
765 [10]
765 [10]
766
766
767 $ hg skjdfks
767 $ hg skjdfks
768 hg: unknown command 'skjdfks'
768 hg: unknown command 'skjdfks'
769 (use 'hg help' for a list of commands)
769 (use 'hg help' for a list of commands)
770 [10]
770 [10]
771
771
772 Typoed command gives suggestion
772 Typoed command gives suggestion
773 $ hg puls
773 $ hg puls
774 hg: unknown command 'puls'
774 hg: unknown command 'puls'
775 (did you mean one of pull, push?)
775 (did you mean one of pull, push?)
776 [10]
776 [10]
777
777
778 Not enabled extension gets suggested
778 Not enabled extension gets suggested
779
779
780 $ hg rebase
780 $ hg rebase
781 hg: unknown command 'rebase'
781 hg: unknown command 'rebase'
782 'rebase' is provided by the following extension:
782 'rebase' is provided by the following extension:
783
783
784 rebase command to move sets of revisions to a different ancestor
784 rebase command to move sets of revisions to a different ancestor
785
785
786 (use 'hg help extensions' for information on enabling extensions)
786 (use 'hg help extensions' for information on enabling extensions)
787 [10]
787 [10]
788
788
789 Disabled extension gets suggested
789 Disabled extension gets suggested
790 $ hg --config extensions.rebase=! rebase
790 $ hg --config extensions.rebase=! rebase
791 hg: unknown command 'rebase'
791 hg: unknown command 'rebase'
792 'rebase' is provided by the following extension:
792 'rebase' is provided by the following extension:
793
793
794 rebase command to move sets of revisions to a different ancestor
794 rebase command to move sets of revisions to a different ancestor
795
795
796 (use 'hg help extensions' for information on enabling extensions)
796 (use 'hg help extensions' for information on enabling extensions)
797 [10]
797 [10]
798
798
799 Checking that help adapts based on the config:
799 Checking that help adapts based on the config:
800
800
801 $ hg help diff --config ui.tweakdefaults=true | egrep -e '^ *(-g|config)'
801 $ hg help diff --config ui.tweakdefaults=true | egrep -e '^ *(-g|config)'
802 -g --[no-]git use git extended diff format (default: on from
802 -g --[no-]git use git extended diff format (default: on from
803 config)
803 config)
804
804
805 Make sure that we don't run afoul of the help system thinking that
805 Make sure that we don't run afoul of the help system thinking that
806 this is a section and erroring out weirdly.
806 this is a section and erroring out weirdly.
807
807
808 $ hg .log
808 $ hg .log
809 hg: unknown command '.log'
809 hg: unknown command '.log'
810 (did you mean log?)
810 (did you mean log?)
811 [10]
811 [10]
812
812
813 $ hg log.
813 $ hg log.
814 hg: unknown command 'log.'
814 hg: unknown command 'log.'
815 (did you mean log?)
815 (did you mean log?)
816 [10]
816 [10]
817 $ hg pu.lh
817 $ hg pu.lh
818 hg: unknown command 'pu.lh'
818 hg: unknown command 'pu.lh'
819 (did you mean one of pull, push?)
819 (did you mean one of pull, push?)
820 [10]
820 [10]
821
821
822 $ cat > helpext.py <<EOF
822 $ cat > helpext.py <<EOF
823 > import os
823 > import os
824 > from mercurial import commands, fancyopts, registrar
824 > from mercurial import commands, fancyopts, registrar
825 >
825 >
826 > def func(arg):
826 > def func(arg):
827 > return '%sfoo' % arg
827 > return '%sfoo' % arg
828 > class customopt(fancyopts.customopt):
828 > class customopt(fancyopts.customopt):
829 > def newstate(self, oldstate, newparam, abort):
829 > def newstate(self, oldstate, newparam, abort):
830 > return '%sbar' % oldstate
830 > return '%sbar' % oldstate
831 > cmdtable = {}
831 > cmdtable = {}
832 > command = registrar.command(cmdtable)
832 > command = registrar.command(cmdtable)
833 >
833 >
834 > @command(b'nohelp',
834 > @command(b'nohelp',
835 > [(b'', b'longdesc', 3, b'x'*67),
835 > [(b'', b'longdesc', 3, b'x'*67),
836 > (b'n', b'', None, b'normal desc'),
836 > (b'n', b'', None, b'normal desc'),
837 > (b'', b'newline', b'', b'line1\nline2'),
837 > (b'', b'newline', b'', b'line1\nline2'),
838 > (b'', b'default-off', False, b'enable X'),
838 > (b'', b'default-off', False, b'enable X'),
839 > (b'', b'default-on', True, b'enable Y'),
839 > (b'', b'default-on', True, b'enable Y'),
840 > (b'', b'callableopt', func, b'adds foo'),
840 > (b'', b'callableopt', func, b'adds foo'),
841 > (b'', b'customopt', customopt(''), b'adds bar'),
841 > (b'', b'customopt', customopt(''), b'adds bar'),
842 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
842 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
843 > b'hg nohelp',
843 > b'hg nohelp',
844 > norepo=True)
844 > norepo=True)
845 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
845 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
846 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
846 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
847 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
847 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
848 > def nohelp(ui, *args, **kwargs):
848 > def nohelp(ui, *args, **kwargs):
849 > pass
849 > pass
850 >
850 >
851 > @command(b'hashelp', [], b'hg hashelp', norepo=True)
851 > @command(b'hashelp', [], b'hg hashelp', norepo=True)
852 > def hashelp(ui, *args, **kwargs):
852 > def hashelp(ui, *args, **kwargs):
853 > """Extension command's help"""
853 > """Extension command's help"""
854 >
854 >
855 > def uisetup(ui):
855 > def uisetup(ui):
856 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
856 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
857 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
857 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
858 > ui.setconfig(b'alias', b'hgalias:doc', b'My doc', b'helpext')
858 > ui.setconfig(b'alias', b'hgalias:doc', b'My doc', b'helpext')
859 > ui.setconfig(b'alias', b'hgalias:category', b'navigation', b'helpext')
859 > ui.setconfig(b'alias', b'hgalias:category', b'navigation', b'helpext')
860 > ui.setconfig(b'alias', b'hgaliasnodoc', b'summary', b'helpext')
860 > ui.setconfig(b'alias', b'hgaliasnodoc', b'summary', b'helpext')
861 >
861 >
862 > EOF
862 > EOF
863 $ echo '[extensions]' >> $HGRCPATH
863 $ echo '[extensions]' >> $HGRCPATH
864 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
864 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
865
865
866 Test for aliases
866 Test for aliases
867
867
868 $ hg help | grep hgalias
868 $ hg help | grep hgalias
869 hgalias My doc
869 hgalias My doc
870
870
871 $ hg help hgalias
871 $ hg help hgalias
872 hg hgalias [--remote]
872 hg hgalias [--remote]
873
873
874 alias for: hg summary
874 alias for: hg summary
875
875
876 My doc
876 My doc
877
877
878 defined by: helpext
878 defined by: helpext
879
879
880 options:
880 options:
881
881
882 --remote check for push and pull
882 --remote check for push and pull
883
883
884 (some details hidden, use --verbose to show complete help)
884 (some details hidden, use --verbose to show complete help)
885 $ hg help hgaliasnodoc
885 $ hg help hgaliasnodoc
886 hg hgaliasnodoc [--remote]
886 hg hgaliasnodoc [--remote]
887
887
888 alias for: hg summary
888 alias for: hg summary
889
889
890 summarize working directory state
890 summarize working directory state
891
891
892 This generates a brief summary of the working directory state, including
892 This generates a brief summary of the working directory state, including
893 parents, branch, commit status, phase and available updates.
893 parents, branch, commit status, phase and available updates.
894
894
895 With the --remote option, this will check the default paths for incoming
895 With the --remote option, this will check the default paths for incoming
896 and outgoing changes. This can be time-consuming.
896 and outgoing changes. This can be time-consuming.
897
897
898 Returns 0 on success.
898 Returns 0 on success.
899
899
900 defined by: helpext
900 defined by: helpext
901
901
902 options:
902 options:
903
903
904 --remote check for push and pull
904 --remote check for push and pull
905
905
906 (some details hidden, use --verbose to show complete help)
906 (some details hidden, use --verbose to show complete help)
907
907
908 $ hg help shellalias
908 $ hg help shellalias
909 hg shellalias
909 hg shellalias
910
910
911 shell alias for: echo hi
911 shell alias for: echo hi
912
912
913 (no help text available)
913 (no help text available)
914
914
915 defined by: helpext
915 defined by: helpext
916
916
917 (some details hidden, use --verbose to show complete help)
917 (some details hidden, use --verbose to show complete help)
918
918
919 Test command with no help text
919 Test command with no help text
920
920
921 $ hg help nohelp
921 $ hg help nohelp
922 hg nohelp
922 hg nohelp
923
923
924 (no help text available)
924 (no help text available)
925
925
926 options:
926 options:
927
927
928 --longdesc VALUE
928 --longdesc VALUE
929 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
929 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
930 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
930 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
931 -n -- normal desc
931 -n -- normal desc
932 --newline VALUE line1 line2
932 --newline VALUE line1 line2
933 --default-off enable X
933 --default-off enable X
934 --[no-]default-on enable Y (default: on)
934 --[no-]default-on enable Y (default: on)
935 --callableopt VALUE adds foo
935 --callableopt VALUE adds foo
936 --customopt VALUE adds bar
936 --customopt VALUE adds bar
937 --customopt-withdefault VALUE adds bar (default: foo)
937 --customopt-withdefault VALUE adds bar (default: foo)
938
938
939 (some details hidden, use --verbose to show complete help)
939 (some details hidden, use --verbose to show complete help)
940
940
941 Test that default list of commands includes extension commands that have help,
941 Test that default list of commands includes extension commands that have help,
942 but not those that don't, except in verbose mode, when a keyword is passed, or
942 but not those that don't, except in verbose mode, when a keyword is passed, or
943 when help about the extension is requested.
943 when help about the extension is requested.
944
944
945 #if no-extraextensions
945 #if no-extraextensions
946
946
947 $ hg help | grep hashelp
947 $ hg help | grep hashelp
948 hashelp Extension command's help
948 hashelp Extension command's help
949 $ hg help | grep nohelp
949 $ hg help | grep nohelp
950 [1]
950 [1]
951 $ hg help -v | grep nohelp
951 $ hg help -v | grep nohelp
952 nohelp (no help text available)
952 nohelp (no help text available)
953
953
954 $ hg help -k nohelp
954 $ hg help -k nohelp
955 Commands:
955 Commands:
956
956
957 nohelp hg nohelp
957 nohelp hg nohelp
958
958
959 Extension Commands:
959 Extension Commands:
960
960
961 nohelp (no help text available)
961 nohelp (no help text available)
962
962
963 $ hg help helpext
963 $ hg help helpext
964 helpext extension - no help text available
964 helpext extension - no help text available
965
965
966 list of commands:
966 list of commands:
967
967
968 hashelp Extension command's help
968 hashelp Extension command's help
969 nohelp (no help text available)
969 nohelp (no help text available)
970
970
971 (use 'hg help -v helpext' to show built-in aliases and global options)
971 (use 'hg help -v helpext' to show built-in aliases and global options)
972
972
973 #endif
973 #endif
974
974
975 Test list of internal help commands
975 Test list of internal help commands
976
976
977 $ hg help debug
977 $ hg help debug
978 debug commands (internal and unsupported):
978 debug commands (internal and unsupported):
979
979
980 debug-repair-issue6528
980 debug-repair-issue6528
981 find affected revisions and repair them. See issue6528 for more
981 find affected revisions and repair them. See issue6528 for more
982 details.
982 details.
983 debugancestor
983 debugancestor
984 find the ancestor revision of two revisions in a given index
984 find the ancestor revision of two revisions in a given index
985 debugantivirusrunning
985 debugantivirusrunning
986 attempt to trigger an antivirus scanner to see if one is active
986 attempt to trigger an antivirus scanner to see if one is active
987 debugapplystreamclonebundle
987 debugapplystreamclonebundle
988 apply a stream clone bundle file
988 apply a stream clone bundle file
989 debugbackupbundle
989 debugbackupbundle
990 lists the changesets available in backup bundles
990 lists the changesets available in backup bundles
991 debugbuilddag
991 debugbuilddag
992 builds a repo with a given DAG from scratch in the current
992 builds a repo with a given DAG from scratch in the current
993 empty repo
993 empty repo
994 debugbundle lists the contents of a bundle
994 debugbundle lists the contents of a bundle
995 debugcapabilities
995 debugcapabilities
996 lists the capabilities of a remote peer
996 lists the capabilities of a remote peer
997 debugchangedfiles
997 debugchangedfiles
998 list the stored files changes for a revision
998 list the stored files changes for a revision
999 debugcheckstate
999 debugcheckstate
1000 validate the correctness of the current dirstate
1000 validate the correctness of the current dirstate
1001 debugcolor show available color, effects or style
1001 debugcolor show available color, effects or style
1002 debugcommands
1002 debugcommands
1003 list all available commands and options
1003 list all available commands and options
1004 debugcomplete
1004 debugcomplete
1005 returns the completion list associated with the given command
1005 returns the completion list associated with the given command
1006 debugcreatestreamclonebundle
1006 debugcreatestreamclonebundle
1007 create a stream clone bundle file
1007 create a stream clone bundle file
1008 debugdag format the changelog or an index DAG as a concise textual
1008 debugdag format the changelog or an index DAG as a concise textual
1009 description
1009 description
1010 debugdata dump the contents of a data file revision
1010 debugdata dump the contents of a data file revision
1011 debugdate parse and display a date
1011 debugdate parse and display a date
1012 debugdeltachain
1012 debugdeltachain
1013 dump information about delta chains in a revlog
1013 dump information about delta chains in a revlog
1014 debugdirstate
1014 debugdirstate
1015 show the contents of the current dirstate
1015 show the contents of the current dirstate
1016 debugdirstateignorepatternshash
1016 debugdirstateignorepatternshash
1017 show the hash of ignore patterns stored in dirstate if v2,
1017 show the hash of ignore patterns stored in dirstate if v2,
1018 debugdiscovery
1018 debugdiscovery
1019 runs the changeset discovery protocol in isolation
1019 runs the changeset discovery protocol in isolation
1020 debugdownload
1020 debugdownload
1021 download a resource using Mercurial logic and config
1021 download a resource using Mercurial logic and config
1022 debugextensions
1022 debugextensions
1023 show information about active extensions
1023 show information about active extensions
1024 debugfileset parse and apply a fileset specification
1024 debugfileset parse and apply a fileset specification
1025 debugformat display format information about the current repository
1025 debugformat display format information about the current repository
1026 debugfsinfo show information detected about current filesystem
1026 debugfsinfo show information detected about current filesystem
1027 debuggetbundle
1027 debuggetbundle
1028 retrieves a bundle from a repo
1028 retrieves a bundle from a repo
1029 debugignore display the combined ignore pattern and information about
1029 debugignore display the combined ignore pattern and information about
1030 ignored files
1030 ignored files
1031 debugindex dump index data for a storage primitive
1031 debugindex dump index data for a storage primitive
1032 debugindexdot
1032 debugindexdot
1033 dump an index DAG as a graphviz dot file
1033 dump an index DAG as a graphviz dot file
1034 debugindexstats
1034 debugindexstats
1035 show stats related to the changelog index
1035 show stats related to the changelog index
1036 debuginstall test Mercurial installation
1036 debuginstall test Mercurial installation
1037 debugknown test whether node ids are known to a repo
1037 debugknown test whether node ids are known to a repo
1038 debuglocks show or modify state of locks
1038 debuglocks show or modify state of locks
1039 debugmanifestfulltextcache
1039 debugmanifestfulltextcache
1040 show, clear or amend the contents of the manifest fulltext
1040 show, clear or amend the contents of the manifest fulltext
1041 cache
1041 cache
1042 debugmergestate
1042 debugmergestate
1043 print merge state
1043 print merge state
1044 debugnamecomplete
1044 debugnamecomplete
1045 complete "names" - tags, open branch names, bookmark names
1045 complete "names" - tags, open branch names, bookmark names
1046 debugnodemap write and inspect on disk nodemap
1046 debugnodemap write and inspect on disk nodemap
1047 debugobsolete
1047 debugobsolete
1048 create arbitrary obsolete marker
1048 create arbitrary obsolete marker
1049 debugoptADV (no help text available)
1049 debugoptADV (no help text available)
1050 debugoptDEP (no help text available)
1050 debugoptDEP (no help text available)
1051 debugoptEXP (no help text available)
1051 debugoptEXP (no help text available)
1052 debugp1copies
1052 debugp1copies
1053 dump copy information compared to p1
1053 dump copy information compared to p1
1054 debugp2copies
1054 debugp2copies
1055 dump copy information compared to p2
1055 dump copy information compared to p2
1056 debugpathcomplete
1056 debugpathcomplete
1057 complete part or all of a tracked path
1057 complete part or all of a tracked path
1058 debugpathcopies
1058 debugpathcopies
1059 show copies between two revisions
1059 show copies between two revisions
1060 debugpeer establish a connection to a peer repository
1060 debugpeer establish a connection to a peer repository
1061 debugpickmergetool
1061 debugpickmergetool
1062 examine which merge tool is chosen for specified file
1062 examine which merge tool is chosen for specified file
1063 debugpushkey access the pushkey key/value protocol
1063 debugpushkey access the pushkey key/value protocol
1064 debugpvec (no help text available)
1064 debugpvec (no help text available)
1065 debugrebuilddirstate
1065 debugrebuilddirstate
1066 rebuild the dirstate as it would look like for the given
1066 rebuild the dirstate as it would look like for the given
1067 revision
1067 revision
1068 debugrebuildfncache
1068 debugrebuildfncache
1069 rebuild the fncache file
1069 rebuild the fncache file
1070 debugrename dump rename information
1070 debugrename dump rename information
1071 debugrequires
1071 debugrequires
1072 print the current repo requirements
1072 print the current repo requirements
1073 debugrevlog show data and statistics about a revlog
1073 debugrevlog show data and statistics about a revlog
1074 debugrevlogindex
1074 debugrevlogindex
1075 dump the contents of a revlog index
1075 dump the contents of a revlog index
1076 debugrevspec parse and apply a revision specification
1076 debugrevspec parse and apply a revision specification
1077 debugserve run a server with advanced settings
1077 debugserve run a server with advanced settings
1078 debugsetparents
1078 debugsetparents
1079 manually set the parents of the current working directory
1079 manually set the parents of the current working directory
1080 (DANGEROUS)
1080 (DANGEROUS)
1081 debugshell run an interactive Python interpreter
1081 debugshell run an interactive Python interpreter
1082 debugsidedata
1082 debugsidedata
1083 dump the side data for a cl/manifest/file revision
1083 dump the side data for a cl/manifest/file revision
1084 debugssl test a secure connection to a server
1084 debugssl test a secure connection to a server
1085 debugstrip strip changesets and all their descendants from the repository
1085 debugstrip strip changesets and all their descendants from the repository
1086 debugsub (no help text available)
1086 debugsub (no help text available)
1087 debugsuccessorssets
1087 debugsuccessorssets
1088 show set of successors for revision
1088 show set of successors for revision
1089 debugtagscache
1089 debugtagscache
1090 display the contents of .hg/cache/hgtagsfnodes1
1090 display the contents of .hg/cache/hgtagsfnodes1
1091 debugtemplate
1091 debugtemplate
1092 parse and apply a template
1092 parse and apply a template
1093 debuguigetpass
1093 debuguigetpass
1094 show prompt to type password
1094 show prompt to type password
1095 debuguiprompt
1095 debuguiprompt
1096 show plain prompt
1096 show plain prompt
1097 debugupdatecaches
1097 debugupdatecaches
1098 warm all known caches in the repository
1098 warm all known caches in the repository
1099 debugupgraderepo
1099 debugupgraderepo
1100 upgrade a repository to use different features
1100 upgrade a repository to use different features
1101 debugwalk show how files match on given patterns
1101 debugwalk show how files match on given patterns
1102 debugwhyunstable
1102 debugwhyunstable
1103 explain instabilities of a changeset
1103 explain instabilities of a changeset
1104 debugwireargs
1104 debugwireargs
1105 (no help text available)
1105 (no help text available)
1106 debugwireproto
1106 debugwireproto
1107 send wire protocol commands to a server
1107 send wire protocol commands to a server
1108
1108
1109 (use 'hg help -v debug' to show built-in aliases and global options)
1109 (use 'hg help -v debug' to show built-in aliases and global options)
1110
1110
1111 internals topic renders index of available sub-topics
1111 internals topic renders index of available sub-topics
1112
1112
1113 $ hg help internals
1113 $ hg help internals
1114 Technical implementation topics
1114 Technical implementation topics
1115 """""""""""""""""""""""""""""""
1115 """""""""""""""""""""""""""""""
1116
1116
1117 To access a subtopic, use "hg help internals.{subtopic-name}"
1117 To access a subtopic, use "hg help internals.{subtopic-name}"
1118
1118
1119 bid-merge Bid Merge Algorithm
1119 bid-merge Bid Merge Algorithm
1120 bundle2 Bundle2
1120 bundle2 Bundle2
1121 bundles Bundles
1121 bundles Bundles
1122 cbor CBOR
1122 cbor CBOR
1123 censor Censor
1123 censor Censor
1124 changegroups Changegroups
1124 changegroups Changegroups
1125 config Config Registrar
1125 config Config Registrar
1126 dirstate-v2 dirstate-v2 file format
1126 dirstate-v2 dirstate-v2 file format
1127 extensions Extension API
1127 extensions Extension API
1128 mergestate Mergestate
1128 mergestate Mergestate
1129 requirements Repository Requirements
1129 requirements Repository Requirements
1130 revlogs Revision Logs
1130 revlogs Revision Logs
1131 wireprotocol Wire Protocol
1131 wireprotocol Wire Protocol
1132 wireprotocolrpc
1132 wireprotocolrpc
1133 Wire Protocol RPC
1133 Wire Protocol RPC
1134 wireprotocolv2
1134 wireprotocolv2
1135 Wire Protocol Version 2
1135 Wire Protocol Version 2
1136
1136
1137 sub-topics can be accessed
1137 sub-topics can be accessed
1138
1138
1139 $ hg help internals.changegroups
1139 $ hg help internals.changegroups
1140 Changegroups
1140 Changegroups
1141 """"""""""""
1141 """"""""""""
1142
1142
1143 Changegroups are representations of repository revlog data, specifically
1143 Changegroups are representations of repository revlog data, specifically
1144 the changelog data, root/flat manifest data, treemanifest data, and
1144 the changelog data, root/flat manifest data, treemanifest data, and
1145 filelogs.
1145 filelogs.
1146
1146
1147 There are 4 versions of changegroups: "1", "2", "3" and "4". From a high-
1147 There are 4 versions of changegroups: "1", "2", "3" and "4". From a high-
1148 level, versions "1" and "2" are almost exactly the same, with the only
1148 level, versions "1" and "2" are almost exactly the same, with the only
1149 difference being an additional item in the *delta header*. Version "3"
1149 difference being an additional item in the *delta header*. Version "3"
1150 adds support for storage flags in the *delta header* and optionally
1150 adds support for storage flags in the *delta header* and optionally
1151 exchanging treemanifests (enabled by setting an option on the
1151 exchanging treemanifests (enabled by setting an option on the
1152 "changegroup" part in the bundle2). Version "4" adds support for
1152 "changegroup" part in the bundle2). Version "4" adds support for
1153 exchanging sidedata (additional revision metadata not part of the digest).
1153 exchanging sidedata (additional revision metadata not part of the digest).
1154
1154
1155 Changegroups when not exchanging treemanifests consist of 3 logical
1155 Changegroups when not exchanging treemanifests consist of 3 logical
1156 segments:
1156 segments:
1157
1157
1158 +---------------------------------+
1158 +---------------------------------+
1159 | | | |
1159 | | | |
1160 | changeset | manifest | filelogs |
1160 | changeset | manifest | filelogs |
1161 | | | |
1161 | | | |
1162 | | | |
1162 | | | |
1163 +---------------------------------+
1163 +---------------------------------+
1164
1164
1165 When exchanging treemanifests, there are 4 logical segments:
1165 When exchanging treemanifests, there are 4 logical segments:
1166
1166
1167 +-------------------------------------------------+
1167 +-------------------------------------------------+
1168 | | | | |
1168 | | | | |
1169 | changeset | root | treemanifests | filelogs |
1169 | changeset | root | treemanifests | filelogs |
1170 | | manifest | | |
1170 | | manifest | | |
1171 | | | | |
1171 | | | | |
1172 +-------------------------------------------------+
1172 +-------------------------------------------------+
1173
1173
1174 The principle building block of each segment is a *chunk*. A *chunk* is a
1174 The principle building block of each segment is a *chunk*. A *chunk* is a
1175 framed piece of data:
1175 framed piece of data:
1176
1176
1177 +---------------------------------------+
1177 +---------------------------------------+
1178 | | |
1178 | | |
1179 | length | data |
1179 | length | data |
1180 | (4 bytes) | (<length - 4> bytes) |
1180 | (4 bytes) | (<length - 4> bytes) |
1181 | | |
1181 | | |
1182 +---------------------------------------+
1182 +---------------------------------------+
1183
1183
1184 All integers are big-endian signed integers. Each chunk starts with a
1184 All integers are big-endian signed integers. Each chunk starts with a
1185 32-bit integer indicating the length of the entire chunk (including the
1185 32-bit integer indicating the length of the entire chunk (including the
1186 length field itself).
1186 length field itself).
1187
1187
1188 There is a special case chunk that has a value of 0 for the length
1188 There is a special case chunk that has a value of 0 for the length
1189 ("0x00000000"). We call this an *empty chunk*.
1189 ("0x00000000"). We call this an *empty chunk*.
1190
1190
1191 Delta Groups
1191 Delta Groups
1192 ============
1192 ============
1193
1193
1194 A *delta group* expresses the content of a revlog as a series of deltas,
1194 A *delta group* expresses the content of a revlog as a series of deltas,
1195 or patches against previous revisions.
1195 or patches against previous revisions.
1196
1196
1197 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1197 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1198 to signal the end of the delta group:
1198 to signal the end of the delta group:
1199
1199
1200 +------------------------------------------------------------------------+
1200 +------------------------------------------------------------------------+
1201 | | | | | |
1201 | | | | | |
1202 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1202 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1203 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1203 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1204 | | | | | |
1204 | | | | | |
1205 +------------------------------------------------------------------------+
1205 +------------------------------------------------------------------------+
1206
1206
1207 Each *chunk*'s data consists of the following:
1207 Each *chunk*'s data consists of the following:
1208
1208
1209 +---------------------------------------+
1209 +---------------------------------------+
1210 | | |
1210 | | |
1211 | delta header | delta data |
1211 | delta header | delta data |
1212 | (various by version) | (various) |
1212 | (various by version) | (various) |
1213 | | |
1213 | | |
1214 +---------------------------------------+
1214 +---------------------------------------+
1215
1215
1216 The *delta data* is a series of *delta*s that describe a diff from an
1216 The *delta data* is a series of *delta*s that describe a diff from an
1217 existing entry (either that the recipient already has, or previously
1217 existing entry (either that the recipient already has, or previously
1218 specified in the bundle/changegroup).
1218 specified in the bundle/changegroup).
1219
1219
1220 The *delta header* is different between versions "1", "2", "3" and "4" of
1220 The *delta header* is different between versions "1", "2", "3" and "4" of
1221 the changegroup format.
1221 the changegroup format.
1222
1222
1223 Version 1 (headerlen=80):
1223 Version 1 (headerlen=80):
1224
1224
1225 +------------------------------------------------------+
1225 +------------------------------------------------------+
1226 | | | | |
1226 | | | | |
1227 | node | p1 node | p2 node | link node |
1227 | node | p1 node | p2 node | link node |
1228 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1228 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1229 | | | | |
1229 | | | | |
1230 +------------------------------------------------------+
1230 +------------------------------------------------------+
1231
1231
1232 Version 2 (headerlen=100):
1232 Version 2 (headerlen=100):
1233
1233
1234 +------------------------------------------------------------------+
1234 +------------------------------------------------------------------+
1235 | | | | | |
1235 | | | | | |
1236 | node | p1 node | p2 node | base node | link node |
1236 | node | p1 node | p2 node | base node | link node |
1237 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1237 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1238 | | | | | |
1238 | | | | | |
1239 +------------------------------------------------------------------+
1239 +------------------------------------------------------------------+
1240
1240
1241 Version 3 (headerlen=102):
1241 Version 3 (headerlen=102):
1242
1242
1243 +------------------------------------------------------------------------------+
1243 +------------------------------------------------------------------------------+
1244 | | | | | | |
1244 | | | | | | |
1245 | node | p1 node | p2 node | base node | link node | flags |
1245 | node | p1 node | p2 node | base node | link node | flags |
1246 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1246 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1247 | | | | | | |
1247 | | | | | | |
1248 +------------------------------------------------------------------------------+
1248 +------------------------------------------------------------------------------+
1249
1249
1250 Version 4 (headerlen=103):
1250 Version 4 (headerlen=103):
1251
1251
1252 +------------------------------------------------------------------------------+----------+
1252 +------------------------------------------------------------------------------+----------+
1253 | | | | | | | |
1253 | | | | | | | |
1254 | node | p1 node | p2 node | base node | link node | flags | pflags |
1254 | node | p1 node | p2 node | base node | link node | flags | pflags |
1255 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | (1 byte) |
1255 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | (1 byte) |
1256 | | | | | | | |
1256 | | | | | | | |
1257 +------------------------------------------------------------------------------+----------+
1257 +------------------------------------------------------------------------------+----------+
1258
1258
1259 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1259 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1260 contain a series of *delta*s, densely packed (no separators). These deltas
1260 contain a series of *delta*s, densely packed (no separators). These deltas
1261 describe a diff from an existing entry (either that the recipient already
1261 describe a diff from an existing entry (either that the recipient already
1262 has, or previously specified in the bundle/changegroup). The format is
1262 has, or previously specified in the bundle/changegroup). The format is
1263 described more fully in "hg help internals.bdiff", but briefly:
1263 described more fully in "hg help internals.bdiff", but briefly:
1264
1264
1265 +---------------------------------------------------------------+
1265 +---------------------------------------------------------------+
1266 | | | | |
1266 | | | | |
1267 | start offset | end offset | new length | content |
1267 | start offset | end offset | new length | content |
1268 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1268 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1269 | | | | |
1269 | | | | |
1270 +---------------------------------------------------------------+
1270 +---------------------------------------------------------------+
1271
1271
1272 Please note that the length field in the delta data does *not* include
1272 Please note that the length field in the delta data does *not* include
1273 itself.
1273 itself.
1274
1274
1275 In version 1, the delta is always applied against the previous node from
1275 In version 1, the delta is always applied against the previous node from
1276 the changegroup or the first parent if this is the first entry in the
1276 the changegroup or the first parent if this is the first entry in the
1277 changegroup.
1277 changegroup.
1278
1278
1279 In version 2 and up, the delta base node is encoded in the entry in the
1279 In version 2 and up, the delta base node is encoded in the entry in the
1280 changegroup. This allows the delta to be expressed against any parent,
1280 changegroup. This allows the delta to be expressed against any parent,
1281 which can result in smaller deltas and more efficient encoding of data.
1281 which can result in smaller deltas and more efficient encoding of data.
1282
1282
1283 The *flags* field holds bitwise flags affecting the processing of revision
1283 The *flags* field holds bitwise flags affecting the processing of revision
1284 data. The following flags are defined:
1284 data. The following flags are defined:
1285
1285
1286 32768
1286 32768
1287 Censored revision. The revision's fulltext has been replaced by censor
1287 Censored revision. The revision's fulltext has been replaced by censor
1288 metadata. May only occur on file revisions.
1288 metadata. May only occur on file revisions.
1289
1289
1290 16384
1290 16384
1291 Ellipsis revision. Revision hash does not match data (likely due to
1291 Ellipsis revision. Revision hash does not match data (likely due to
1292 rewritten parents).
1292 rewritten parents).
1293
1293
1294 8192
1294 8192
1295 Externally stored. The revision fulltext contains "key:value" "\n"
1295 Externally stored. The revision fulltext contains "key:value" "\n"
1296 delimited metadata defining an object stored elsewhere. Used by the LFS
1296 delimited metadata defining an object stored elsewhere. Used by the LFS
1297 extension.
1297 extension.
1298
1298
1299 4096
1299 4096
1300 Contains copy information. This revision changes files in a way that
1300 Contains copy information. This revision changes files in a way that
1301 could affect copy tracing. This does *not* affect changegroup handling,
1301 could affect copy tracing. This does *not* affect changegroup handling,
1302 but is relevant for other parts of Mercurial.
1302 but is relevant for other parts of Mercurial.
1303
1303
1304 For historical reasons, the integer values are identical to revlog version
1304 For historical reasons, the integer values are identical to revlog version
1305 1 per-revision storage flags and correspond to bits being set in this
1305 1 per-revision storage flags and correspond to bits being set in this
1306 2-byte field. Bits were allocated starting from the most-significant bit,
1306 2-byte field. Bits were allocated starting from the most-significant bit,
1307 hence the reverse ordering and allocation of these flags.
1307 hence the reverse ordering and allocation of these flags.
1308
1308
1309 The *pflags* (protocol flags) field holds bitwise flags affecting the
1309 The *pflags* (protocol flags) field holds bitwise flags affecting the
1310 protocol itself. They are first in the header since they may affect the
1310 protocol itself. They are first in the header since they may affect the
1311 handling of the rest of the fields in a future version. They are defined
1311 handling of the rest of the fields in a future version. They are defined
1312 as such:
1312 as such:
1313
1313
1314 1 indicates whether to read a chunk of sidedata (of variable length) right
1314 1 indicates whether to read a chunk of sidedata (of variable length) right
1315 after the revision flags.
1315 after the revision flags.
1316
1316
1317 Changeset Segment
1317 Changeset Segment
1318 =================
1318 =================
1319
1319
1320 The *changeset segment* consists of a single *delta group* holding
1320 The *changeset segment* consists of a single *delta group* holding
1321 changelog data. The *empty chunk* at the end of the *delta group* denotes
1321 changelog data. The *empty chunk* at the end of the *delta group* denotes
1322 the boundary to the *manifest segment*.
1322 the boundary to the *manifest segment*.
1323
1323
1324 Manifest Segment
1324 Manifest Segment
1325 ================
1325 ================
1326
1326
1327 The *manifest segment* consists of a single *delta group* holding manifest
1327 The *manifest segment* consists of a single *delta group* holding manifest
1328 data. If treemanifests are in use, it contains only the manifest for the
1328 data. If treemanifests are in use, it contains only the manifest for the
1329 root directory of the repository. Otherwise, it contains the entire
1329 root directory of the repository. Otherwise, it contains the entire
1330 manifest data. The *empty chunk* at the end of the *delta group* denotes
1330 manifest data. The *empty chunk* at the end of the *delta group* denotes
1331 the boundary to the next segment (either the *treemanifests segment* or
1331 the boundary to the next segment (either the *treemanifests segment* or
1332 the *filelogs segment*, depending on version and the request options).
1332 the *filelogs segment*, depending on version and the request options).
1333
1333
1334 Treemanifests Segment
1334 Treemanifests Segment
1335 ---------------------
1335 ---------------------
1336
1336
1337 The *treemanifests segment* only exists in changegroup version "3" and
1337 The *treemanifests segment* only exists in changegroup version "3" and
1338 "4", and only if the 'treemanifest' param is part of the bundle2
1338 "4", and only if the 'treemanifest' param is part of the bundle2
1339 changegroup part (it is not possible to use changegroup version 3 or 4
1339 changegroup part (it is not possible to use changegroup version 3 or 4
1340 outside of bundle2). Aside from the filenames in the *treemanifests
1340 outside of bundle2). Aside from the filenames in the *treemanifests
1341 segment* containing a trailing "/" character, it behaves identically to
1341 segment* containing a trailing "/" character, it behaves identically to
1342 the *filelogs segment* (see below). The final sub-segment is followed by
1342 the *filelogs segment* (see below). The final sub-segment is followed by
1343 an *empty chunk* (logically, a sub-segment with filename size 0). This
1343 an *empty chunk* (logically, a sub-segment with filename size 0). This
1344 denotes the boundary to the *filelogs segment*.
1344 denotes the boundary to the *filelogs segment*.
1345
1345
1346 Filelogs Segment
1346 Filelogs Segment
1347 ================
1347 ================
1348
1348
1349 The *filelogs segment* consists of multiple sub-segments, each
1349 The *filelogs segment* consists of multiple sub-segments, each
1350 corresponding to an individual file whose data is being described:
1350 corresponding to an individual file whose data is being described:
1351
1351
1352 +--------------------------------------------------+
1352 +--------------------------------------------------+
1353 | | | | | |
1353 | | | | | |
1354 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1354 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1355 | | | | | (4 bytes) |
1355 | | | | | (4 bytes) |
1356 | | | | | |
1356 | | | | | |
1357 +--------------------------------------------------+
1357 +--------------------------------------------------+
1358
1358
1359 The final filelog sub-segment is followed by an *empty chunk* (logically,
1359 The final filelog sub-segment is followed by an *empty chunk* (logically,
1360 a sub-segment with filename size 0). This denotes the end of the segment
1360 a sub-segment with filename size 0). This denotes the end of the segment
1361 and of the overall changegroup.
1361 and of the overall changegroup.
1362
1362
1363 Each filelog sub-segment consists of the following:
1363 Each filelog sub-segment consists of the following:
1364
1364
1365 +------------------------------------------------------+
1365 +------------------------------------------------------+
1366 | | | |
1366 | | | |
1367 | filename length | filename | delta group |
1367 | filename length | filename | delta group |
1368 | (4 bytes) | (<length - 4> bytes) | (various) |
1368 | (4 bytes) | (<length - 4> bytes) | (various) |
1369 | | | |
1369 | | | |
1370 +------------------------------------------------------+
1370 +------------------------------------------------------+
1371
1371
1372 That is, a *chunk* consisting of the filename (not terminated or padded)
1372 That is, a *chunk* consisting of the filename (not terminated or padded)
1373 followed by N chunks constituting the *delta group* for this file. The
1373 followed by N chunks constituting the *delta group* for this file. The
1374 *empty chunk* at the end of each *delta group* denotes the boundary to the
1374 *empty chunk* at the end of each *delta group* denotes the boundary to the
1375 next filelog sub-segment.
1375 next filelog sub-segment.
1376
1376
1377 non-existent subtopics print an error
1377 non-existent subtopics print an error
1378
1378
1379 $ hg help internals.foo
1379 $ hg help internals.foo
1380 abort: no such help topic: internals.foo
1380 abort: no such help topic: internals.foo
1381 (try 'hg help --keyword foo')
1381 (try 'hg help --keyword foo')
1382 [10]
1382 [10]
1383
1383
1384 test advanced, deprecated and experimental options are hidden in command help
1384 test advanced, deprecated and experimental options are hidden in command help
1385 $ hg help debugoptADV
1385 $ hg help debugoptADV
1386 hg debugoptADV
1386 hg debugoptADV
1387
1387
1388 (no help text available)
1388 (no help text available)
1389
1389
1390 options:
1390 options:
1391
1391
1392 (some details hidden, use --verbose to show complete help)
1392 (some details hidden, use --verbose to show complete help)
1393 $ hg help debugoptDEP
1393 $ hg help debugoptDEP
1394 hg debugoptDEP
1394 hg debugoptDEP
1395
1395
1396 (no help text available)
1396 (no help text available)
1397
1397
1398 options:
1398 options:
1399
1399
1400 (some details hidden, use --verbose to show complete help)
1400 (some details hidden, use --verbose to show complete help)
1401
1401
1402 $ hg help debugoptEXP
1402 $ hg help debugoptEXP
1403 hg debugoptEXP
1403 hg debugoptEXP
1404
1404
1405 (no help text available)
1405 (no help text available)
1406
1406
1407 options:
1407 options:
1408
1408
1409 (some details hidden, use --verbose to show complete help)
1409 (some details hidden, use --verbose to show complete help)
1410
1410
1411 test advanced, deprecated and experimental options are shown with -v
1411 test advanced, deprecated and experimental options are shown with -v
1412 $ hg help -v debugoptADV | grep aopt
1412 $ hg help -v debugoptADV | grep aopt
1413 --aopt option is (ADVANCED)
1413 --aopt option is (ADVANCED)
1414 $ hg help -v debugoptDEP | grep dopt
1414 $ hg help -v debugoptDEP | grep dopt
1415 --dopt option is (DEPRECATED)
1415 --dopt option is (DEPRECATED)
1416 $ hg help -v debugoptEXP | grep eopt
1416 $ hg help -v debugoptEXP | grep eopt
1417 --eopt option is (EXPERIMENTAL)
1417 --eopt option is (EXPERIMENTAL)
1418
1418
1419 #if gettext
1419 #if gettext
1420 test deprecated option is hidden with translation with untranslated description
1420 test deprecated option is hidden with translation with untranslated description
1421 (use many globy for not failing on changed transaction)
1421 (use many globy for not failing on changed transaction)
1422 $ LANGUAGE=sv hg help debugoptDEP
1422 $ LANGUAGE=sv hg help debugoptDEP
1423 hg debugoptDEP
1423 hg debugoptDEP
1424
1424
1425 (*) (glob)
1425 (*) (glob)
1426
1426
1427 options:
1427 options:
1428
1428
1429 (some details hidden, use --verbose to show complete help)
1429 (some details hidden, use --verbose to show complete help)
1430 #endif
1430 #endif
1431
1431
1432 Test commands that collide with topics (issue4240)
1432 Test commands that collide with topics (issue4240)
1433
1433
1434 $ hg config -hq
1434 $ hg config -hq
1435 hg config [-u] [NAME]...
1435 hg config [-u] [NAME]...
1436
1436
1437 show combined config settings from all hgrc files
1437 show combined config settings from all hgrc files
1438 $ hg showconfig -hq
1438 $ hg showconfig -hq
1439 hg config [-u] [NAME]...
1439 hg config [-u] [NAME]...
1440
1440
1441 show combined config settings from all hgrc files
1441 show combined config settings from all hgrc files
1442
1442
1443 Test a help topic
1443 Test a help topic
1444
1444
1445 $ hg help dates
1445 $ hg help dates
1446 Date Formats
1446 Date Formats
1447 """"""""""""
1447 """"""""""""
1448
1448
1449 Some commands allow the user to specify a date, e.g.:
1449 Some commands allow the user to specify a date, e.g.:
1450
1450
1451 - backout, commit, import, tag: Specify the commit date.
1451 - backout, commit, import, tag: Specify the commit date.
1452 - log, revert, update: Select revision(s) by date.
1452 - log, revert, update: Select revision(s) by date.
1453
1453
1454 Many date formats are valid. Here are some examples:
1454 Many date formats are valid. Here are some examples:
1455
1455
1456 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1456 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1457 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1457 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1458 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1458 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1459 - "Dec 6" (midnight)
1459 - "Dec 6" (midnight)
1460 - "13:18" (today assumed)
1460 - "13:18" (today assumed)
1461 - "3:39" (3:39AM assumed)
1461 - "3:39" (3:39AM assumed)
1462 - "3:39pm" (15:39)
1462 - "3:39pm" (15:39)
1463 - "2006-12-06 13:18:29" (ISO 8601 format)
1463 - "2006-12-06 13:18:29" (ISO 8601 format)
1464 - "2006-12-6 13:18"
1464 - "2006-12-6 13:18"
1465 - "2006-12-6"
1465 - "2006-12-6"
1466 - "12-6"
1466 - "12-6"
1467 - "12/6"
1467 - "12/6"
1468 - "12/6/6" (Dec 6 2006)
1468 - "12/6/6" (Dec 6 2006)
1469 - "today" (midnight)
1469 - "today" (midnight)
1470 - "yesterday" (midnight)
1470 - "yesterday" (midnight)
1471 - "now" - right now
1471 - "now" - right now
1472
1472
1473 Lastly, there is Mercurial's internal format:
1473 Lastly, there is Mercurial's internal format:
1474
1474
1475 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1475 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1476
1476
1477 This is the internal representation format for dates. The first number is
1477 This is the internal representation format for dates. The first number is
1478 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1478 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1479 is the offset of the local timezone, in seconds west of UTC (negative if
1479 is the offset of the local timezone, in seconds west of UTC (negative if
1480 the timezone is east of UTC).
1480 the timezone is east of UTC).
1481
1481
1482 The log command also accepts date ranges:
1482 The log command also accepts date ranges:
1483
1483
1484 - "<DATE" - at or before a given date/time
1484 - "<DATE" - at or before a given date/time
1485 - ">DATE" - on or after a given date/time
1485 - ">DATE" - on or after a given date/time
1486 - "DATE to DATE" - a date range, inclusive
1486 - "DATE to DATE" - a date range, inclusive
1487 - "-DAYS" - within a given number of days from today
1487 - "-DAYS" - within a given number of days from today
1488
1488
1489 Test repeated config section name
1489 Test repeated config section name
1490
1490
1491 $ hg help config.host
1491 $ hg help config.host
1492 "http_proxy.host"
1492 "http_proxy.host"
1493 Host name and (optional) port of the proxy server, for example
1493 Host name and (optional) port of the proxy server, for example
1494 "myproxy:8000".
1494 "myproxy:8000".
1495
1495
1496 "smtp.host"
1496 "smtp.host"
1497 Host name of mail server, e.g. "mail.example.com".
1497 Host name of mail server, e.g. "mail.example.com".
1498
1498
1499
1499
1500 Test section name with dot
1500 Test section name with dot
1501
1501
1502 $ hg help config.ui.username
1502 $ hg help config.ui.username
1503 "ui.username"
1503 "ui.username"
1504 The committer of a changeset created when running "commit". Typically
1504 The committer of a changeset created when running "commit". Typically
1505 a person's name and email address, e.g. "Fred Widget
1505 a person's name and email address, e.g. "Fred Widget
1506 <fred@example.com>". Environment variables in the username are
1506 <fred@example.com>". Environment variables in the username are
1507 expanded.
1507 expanded.
1508
1508
1509 (default: "$EMAIL" or "username@hostname". If the username in hgrc is
1509 (default: "$EMAIL" or "username@hostname". If the username in hgrc is
1510 empty, e.g. if the system admin set "username =" in the system hgrc,
1510 empty, e.g. if the system admin set "username =" in the system hgrc,
1511 it has to be specified manually or in a different hgrc file)
1511 it has to be specified manually or in a different hgrc file)
1512
1512
1513
1513
1514 $ hg help config.annotate.git
1514 $ hg help config.annotate.git
1515 abort: help section not found: config.annotate.git
1515 abort: help section not found: config.annotate.git
1516 [10]
1516 [10]
1517
1517
1518 $ hg help config.update.check
1518 $ hg help config.update.check
1519 "commands.update.check"
1519 "commands.update.check"
1520 Determines what level of checking 'hg update' will perform before
1520 Determines what level of checking 'hg update' will perform before
1521 moving to a destination revision. Valid values are "abort", "none",
1521 moving to a destination revision. Valid values are "abort", "none",
1522 "linear", and "noconflict".
1522 "linear", and "noconflict".
1523
1523
1524 - "abort" always fails if the working directory has uncommitted
1524 - "abort" always fails if the working directory has uncommitted
1525 changes.
1525 changes.
1526 - "none" performs no checking, and may result in a merge with
1526 - "none" performs no checking, and may result in a merge with
1527 uncommitted changes.
1527 uncommitted changes.
1528 - "linear" allows any update as long as it follows a straight line in
1528 - "linear" allows any update as long as it follows a straight line in
1529 the revision history, and may trigger a merge with uncommitted
1529 the revision history, and may trigger a merge with uncommitted
1530 changes.
1530 changes.
1531 - "noconflict" will allow any update which would not trigger a merge
1531 - "noconflict" will allow any update which would not trigger a merge
1532 with uncommitted changes, if any are present.
1532 with uncommitted changes, if any are present.
1533
1533
1534 (default: "linear")
1534 (default: "linear")
1535
1535
1536
1536
1537 $ hg help config.commands.update.check
1537 $ hg help config.commands.update.check
1538 "commands.update.check"
1538 "commands.update.check"
1539 Determines what level of checking 'hg update' will perform before
1539 Determines what level of checking 'hg update' will perform before
1540 moving to a destination revision. Valid values are "abort", "none",
1540 moving to a destination revision. Valid values are "abort", "none",
1541 "linear", and "noconflict".
1541 "linear", and "noconflict".
1542
1542
1543 - "abort" always fails if the working directory has uncommitted
1543 - "abort" always fails if the working directory has uncommitted
1544 changes.
1544 changes.
1545 - "none" performs no checking, and may result in a merge with
1545 - "none" performs no checking, and may result in a merge with
1546 uncommitted changes.
1546 uncommitted changes.
1547 - "linear" allows any update as long as it follows a straight line in
1547 - "linear" allows any update as long as it follows a straight line in
1548 the revision history, and may trigger a merge with uncommitted
1548 the revision history, and may trigger a merge with uncommitted
1549 changes.
1549 changes.
1550 - "noconflict" will allow any update which would not trigger a merge
1550 - "noconflict" will allow any update which would not trigger a merge
1551 with uncommitted changes, if any are present.
1551 with uncommitted changes, if any are present.
1552
1552
1553 (default: "linear")
1553 (default: "linear")
1554
1554
1555
1555
1556 $ hg help config.ommands.update.check
1556 $ hg help config.ommands.update.check
1557 abort: help section not found: config.ommands.update.check
1557 abort: help section not found: config.ommands.update.check
1558 [10]
1558 [10]
1559
1559
1560 Unrelated trailing paragraphs shouldn't be included
1560 Unrelated trailing paragraphs shouldn't be included
1561
1561
1562 $ hg help config.extramsg | grep '^$'
1562 $ hg help config.extramsg | grep '^$'
1563
1563
1564
1564
1565 Test capitalized section name
1565 Test capitalized section name
1566
1566
1567 $ hg help scripting.HGPLAIN > /dev/null
1567 $ hg help scripting.HGPLAIN > /dev/null
1568
1568
1569 Help subsection:
1569 Help subsection:
1570
1570
1571 $ hg help config.charsets |grep "Email example:" > /dev/null
1571 $ hg help config.charsets |grep "Email example:" > /dev/null
1572 [1]
1572 [1]
1573
1573
1574 Show nested definitions
1574 Show nested definitions
1575 ("profiling.type"[break]"ls"[break]"stat"[break])
1575 ("profiling.type"[break]"ls"[break]"stat"[break])
1576
1576
1577 $ hg help config.type | egrep '^$'|wc -l
1577 $ hg help config.type | egrep '^$'|wc -l
1578 \s*3 (re)
1578 \s*3 (re)
1579
1579
1580 $ hg help config.profiling.type.ls
1580 $ hg help config.profiling.type.ls
1581 "profiling.type.ls"
1581 "profiling.type.ls"
1582 Use Python's built-in instrumenting profiler. This profiler works on
1582 Use Python's built-in instrumenting profiler. This profiler works on
1583 all platforms, but each line number it reports is the first line of
1583 all platforms, but each line number it reports is the first line of
1584 a function. This restriction makes it difficult to identify the
1584 a function. This restriction makes it difficult to identify the
1585 expensive parts of a non-trivial function.
1585 expensive parts of a non-trivial function.
1586
1586
1587
1587
1588 Separate sections from subsections
1588 Separate sections from subsections
1589
1589
1590 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1590 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1591 "format"
1591 "format"
1592 --------
1592 --------
1593
1593
1594 "usegeneraldelta"
1594 "usegeneraldelta"
1595
1595
1596 "dotencode"
1596 "dotencode"
1597
1597
1598 "usefncache"
1598 "usefncache"
1599
1599
1600 "use-dirstate-v2"
1600 "use-dirstate-v2"
1601
1601
1602 "exp-dirstate-tracked-key-version"
1602 "dirstate-tracked-key"
1603
1603
1604 "use-persistent-nodemap"
1604 "use-persistent-nodemap"
1605
1605
1606 "use-share-safe"
1606 "use-share-safe"
1607
1607
1608 "usestore"
1608 "usestore"
1609
1609
1610 "sparse-revlog"
1610 "sparse-revlog"
1611
1611
1612 "revlog-compression"
1612 "revlog-compression"
1613
1613
1614 "bookmarks-in-store"
1614 "bookmarks-in-store"
1615
1615
1616 "profiling"
1616 "profiling"
1617 -----------
1617 -----------
1618
1618
1619 "format"
1619 "format"
1620
1620
1621 "progress"
1621 "progress"
1622 ----------
1622 ----------
1623
1623
1624 "format"
1624 "format"
1625
1625
1626
1626
1627 Last item in help config.*:
1627 Last item in help config.*:
1628
1628
1629 $ hg help config.`hg help config|grep '^ "'| \
1629 $ hg help config.`hg help config|grep '^ "'| \
1630 > tail -1|sed 's![ "]*!!g'`| \
1630 > tail -1|sed 's![ "]*!!g'`| \
1631 > grep 'hg help -c config' > /dev/null
1631 > grep 'hg help -c config' > /dev/null
1632 [1]
1632 [1]
1633
1633
1634 note to use help -c for general hg help config:
1634 note to use help -c for general hg help config:
1635
1635
1636 $ hg help config |grep 'hg help -c config' > /dev/null
1636 $ hg help config |grep 'hg help -c config' > /dev/null
1637
1637
1638 Test templating help
1638 Test templating help
1639
1639
1640 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1640 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1641 desc String. The text of the changeset description.
1641 desc String. The text of the changeset description.
1642 diffstat String. Statistics of changes with the following format:
1642 diffstat String. Statistics of changes with the following format:
1643 firstline Any text. Returns the first line of text.
1643 firstline Any text. Returns the first line of text.
1644 nonempty Any text. Returns '(none)' if the string is empty.
1644 nonempty Any text. Returns '(none)' if the string is empty.
1645
1645
1646 Test deprecated items
1646 Test deprecated items
1647
1647
1648 $ hg help -v templating | grep currentbookmark
1648 $ hg help -v templating | grep currentbookmark
1649 currentbookmark
1649 currentbookmark
1650 $ hg help templating | (grep currentbookmark || true)
1650 $ hg help templating | (grep currentbookmark || true)
1651
1651
1652 Test help hooks
1652 Test help hooks
1653
1653
1654 $ cat > helphook1.py <<EOF
1654 $ cat > helphook1.py <<EOF
1655 > from mercurial import help
1655 > from mercurial import help
1656 >
1656 >
1657 > def rewrite(ui, topic, doc):
1657 > def rewrite(ui, topic, doc):
1658 > return doc + b'\nhelphook1\n'
1658 > return doc + b'\nhelphook1\n'
1659 >
1659 >
1660 > def extsetup(ui):
1660 > def extsetup(ui):
1661 > help.addtopichook(b'revisions', rewrite)
1661 > help.addtopichook(b'revisions', rewrite)
1662 > EOF
1662 > EOF
1663 $ cat > helphook2.py <<EOF
1663 $ cat > helphook2.py <<EOF
1664 > from mercurial import help
1664 > from mercurial import help
1665 >
1665 >
1666 > def rewrite(ui, topic, doc):
1666 > def rewrite(ui, topic, doc):
1667 > return doc + b'\nhelphook2\n'
1667 > return doc + b'\nhelphook2\n'
1668 >
1668 >
1669 > def extsetup(ui):
1669 > def extsetup(ui):
1670 > help.addtopichook(b'revisions', rewrite)
1670 > help.addtopichook(b'revisions', rewrite)
1671 > EOF
1671 > EOF
1672 $ echo '[extensions]' >> $HGRCPATH
1672 $ echo '[extensions]' >> $HGRCPATH
1673 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1673 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1674 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1674 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1675 $ hg help revsets | grep helphook
1675 $ hg help revsets | grep helphook
1676 helphook1
1676 helphook1
1677 helphook2
1677 helphook2
1678
1678
1679 help -c should only show debug --debug
1679 help -c should only show debug --debug
1680
1680
1681 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1681 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1682 [1]
1682 [1]
1683
1683
1684 help -c should only show deprecated for -v
1684 help -c should only show deprecated for -v
1685
1685
1686 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1686 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1687 [1]
1687 [1]
1688
1688
1689 Test -s / --system
1689 Test -s / --system
1690
1690
1691 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1691 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1692 > wc -l | sed -e 's/ //g'
1692 > wc -l | sed -e 's/ //g'
1693 0
1693 0
1694 $ hg help config.files --system unix | grep 'USER' | \
1694 $ hg help config.files --system unix | grep 'USER' | \
1695 > wc -l | sed -e 's/ //g'
1695 > wc -l | sed -e 's/ //g'
1696 0
1696 0
1697
1697
1698 Test -e / -c / -k combinations
1698 Test -e / -c / -k combinations
1699
1699
1700 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1700 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1701 Commands:
1701 Commands:
1702 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1702 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1703 Extensions:
1703 Extensions:
1704 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1704 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1705 Topics:
1705 Topics:
1706 Commands:
1706 Commands:
1707 Extensions:
1707 Extensions:
1708 Extension Commands:
1708 Extension Commands:
1709 $ hg help -c schemes
1709 $ hg help -c schemes
1710 abort: no such help topic: schemes
1710 abort: no such help topic: schemes
1711 (try 'hg help --keyword schemes')
1711 (try 'hg help --keyword schemes')
1712 [10]
1712 [10]
1713 $ hg help -e schemes |head -1
1713 $ hg help -e schemes |head -1
1714 schemes extension - extend schemes with shortcuts to repository swarms
1714 schemes extension - extend schemes with shortcuts to repository swarms
1715 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1715 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1716 Commands:
1716 Commands:
1717 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1717 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1718 Extensions:
1718 Extensions:
1719 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1719 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1720 Extensions:
1720 Extensions:
1721 Commands:
1721 Commands:
1722 $ hg help -c commit > /dev/null
1722 $ hg help -c commit > /dev/null
1723 $ hg help -e -c commit > /dev/null
1723 $ hg help -e -c commit > /dev/null
1724 $ hg help -e commit
1724 $ hg help -e commit
1725 abort: no such help topic: commit
1725 abort: no such help topic: commit
1726 (try 'hg help --keyword commit')
1726 (try 'hg help --keyword commit')
1727 [10]
1727 [10]
1728
1728
1729 Test keyword search help
1729 Test keyword search help
1730
1730
1731 $ cat > prefixedname.py <<EOF
1731 $ cat > prefixedname.py <<EOF
1732 > '''matched against word "clone"
1732 > '''matched against word "clone"
1733 > '''
1733 > '''
1734 > EOF
1734 > EOF
1735 $ echo '[extensions]' >> $HGRCPATH
1735 $ echo '[extensions]' >> $HGRCPATH
1736 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1736 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1737 $ hg help -k clone
1737 $ hg help -k clone
1738 Topics:
1738 Topics:
1739
1739
1740 config Configuration Files
1740 config Configuration Files
1741 extensions Using Additional Features
1741 extensions Using Additional Features
1742 glossary Glossary
1742 glossary Glossary
1743 phases Working with Phases
1743 phases Working with Phases
1744 subrepos Subrepositories
1744 subrepos Subrepositories
1745 urls URL Paths
1745 urls URL Paths
1746
1746
1747 Commands:
1747 Commands:
1748
1748
1749 bookmarks create a new bookmark or list existing bookmarks
1749 bookmarks create a new bookmark or list existing bookmarks
1750 clone make a copy of an existing repository
1750 clone make a copy of an existing repository
1751 paths show aliases for remote repositories
1751 paths show aliases for remote repositories
1752 pull pull changes from the specified source
1752 pull pull changes from the specified source
1753 update update working directory (or switch revisions)
1753 update update working directory (or switch revisions)
1754
1754
1755 Extensions:
1755 Extensions:
1756
1756
1757 clonebundles advertise pre-generated bundles to seed clones
1757 clonebundles advertise pre-generated bundles to seed clones
1758 narrow create clones which fetch history data for subset of files
1758 narrow create clones which fetch history data for subset of files
1759 (EXPERIMENTAL)
1759 (EXPERIMENTAL)
1760 prefixedname matched against word "clone"
1760 prefixedname matched against word "clone"
1761 relink recreates hardlinks between repository clones
1761 relink recreates hardlinks between repository clones
1762
1762
1763 Extension Commands:
1763 Extension Commands:
1764
1764
1765 qclone clone main and patch repository at same time
1765 qclone clone main and patch repository at same time
1766
1766
1767 Test unfound topic
1767 Test unfound topic
1768
1768
1769 $ hg help nonexistingtopicthatwillneverexisteverever
1769 $ hg help nonexistingtopicthatwillneverexisteverever
1770 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1770 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1771 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1771 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1772 [10]
1772 [10]
1773
1773
1774 Test unfound keyword
1774 Test unfound keyword
1775
1775
1776 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1776 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1777 abort: no matches
1777 abort: no matches
1778 (try 'hg help' for a list of topics)
1778 (try 'hg help' for a list of topics)
1779 [10]
1779 [10]
1780
1780
1781 Test omit indicating for help
1781 Test omit indicating for help
1782
1782
1783 $ cat > addverboseitems.py <<EOF
1783 $ cat > addverboseitems.py <<EOF
1784 > r'''extension to test omit indicating.
1784 > r'''extension to test omit indicating.
1785 >
1785 >
1786 > This paragraph is never omitted (for extension)
1786 > This paragraph is never omitted (for extension)
1787 >
1787 >
1788 > .. container:: verbose
1788 > .. container:: verbose
1789 >
1789 >
1790 > This paragraph is omitted,
1790 > This paragraph is omitted,
1791 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1791 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1792 >
1792 >
1793 > This paragraph is never omitted, too (for extension)
1793 > This paragraph is never omitted, too (for extension)
1794 > '''
1794 > '''
1795 > from __future__ import absolute_import
1795 > from __future__ import absolute_import
1796 > from mercurial import commands, help
1796 > from mercurial import commands, help
1797 > testtopic = br"""This paragraph is never omitted (for topic).
1797 > testtopic = br"""This paragraph is never omitted (for topic).
1798 >
1798 >
1799 > .. container:: verbose
1799 > .. container:: verbose
1800 >
1800 >
1801 > This paragraph is omitted,
1801 > This paragraph is omitted,
1802 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1802 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1803 >
1803 >
1804 > This paragraph is never omitted, too (for topic)
1804 > This paragraph is never omitted, too (for topic)
1805 > """
1805 > """
1806 > def extsetup(ui):
1806 > def extsetup(ui):
1807 > help.helptable.append(([b"topic-containing-verbose"],
1807 > help.helptable.append(([b"topic-containing-verbose"],
1808 > b"This is the topic to test omit indicating.",
1808 > b"This is the topic to test omit indicating.",
1809 > lambda ui: testtopic))
1809 > lambda ui: testtopic))
1810 > EOF
1810 > EOF
1811 $ echo '[extensions]' >> $HGRCPATH
1811 $ echo '[extensions]' >> $HGRCPATH
1812 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1812 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1813 $ hg help addverboseitems
1813 $ hg help addverboseitems
1814 addverboseitems extension - extension to test omit indicating.
1814 addverboseitems extension - extension to test omit indicating.
1815
1815
1816 This paragraph is never omitted (for extension)
1816 This paragraph is never omitted (for extension)
1817
1817
1818 This paragraph is never omitted, too (for extension)
1818 This paragraph is never omitted, too (for extension)
1819
1819
1820 (some details hidden, use --verbose to show complete help)
1820 (some details hidden, use --verbose to show complete help)
1821
1821
1822 no commands defined
1822 no commands defined
1823 $ hg help -v addverboseitems
1823 $ hg help -v addverboseitems
1824 addverboseitems extension - extension to test omit indicating.
1824 addverboseitems extension - extension to test omit indicating.
1825
1825
1826 This paragraph is never omitted (for extension)
1826 This paragraph is never omitted (for extension)
1827
1827
1828 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1828 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1829 extension)
1829 extension)
1830
1830
1831 This paragraph is never omitted, too (for extension)
1831 This paragraph is never omitted, too (for extension)
1832
1832
1833 no commands defined
1833 no commands defined
1834 $ hg help topic-containing-verbose
1834 $ hg help topic-containing-verbose
1835 This is the topic to test omit indicating.
1835 This is the topic to test omit indicating.
1836 """"""""""""""""""""""""""""""""""""""""""
1836 """"""""""""""""""""""""""""""""""""""""""
1837
1837
1838 This paragraph is never omitted (for topic).
1838 This paragraph is never omitted (for topic).
1839
1839
1840 This paragraph is never omitted, too (for topic)
1840 This paragraph is never omitted, too (for topic)
1841
1841
1842 (some details hidden, use --verbose to show complete help)
1842 (some details hidden, use --verbose to show complete help)
1843 $ hg help -v topic-containing-verbose
1843 $ hg help -v topic-containing-verbose
1844 This is the topic to test omit indicating.
1844 This is the topic to test omit indicating.
1845 """"""""""""""""""""""""""""""""""""""""""
1845 """"""""""""""""""""""""""""""""""""""""""
1846
1846
1847 This paragraph is never omitted (for topic).
1847 This paragraph is never omitted (for topic).
1848
1848
1849 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1849 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1850 topic)
1850 topic)
1851
1851
1852 This paragraph is never omitted, too (for topic)
1852 This paragraph is never omitted, too (for topic)
1853
1853
1854 Test section lookup
1854 Test section lookup
1855
1855
1856 $ hg help revset.merge
1856 $ hg help revset.merge
1857 "merge()"
1857 "merge()"
1858 Changeset is a merge changeset.
1858 Changeset is a merge changeset.
1859
1859
1860 $ hg help glossary.dag
1860 $ hg help glossary.dag
1861 DAG
1861 DAG
1862 The repository of changesets of a distributed version control system
1862 The repository of changesets of a distributed version control system
1863 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1863 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1864 of nodes and edges, where nodes correspond to changesets and edges
1864 of nodes and edges, where nodes correspond to changesets and edges
1865 imply a parent -> child relation. This graph can be visualized by
1865 imply a parent -> child relation. This graph can be visualized by
1866 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1866 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1867 limited by the requirement for children to have at most two parents.
1867 limited by the requirement for children to have at most two parents.
1868
1868
1869
1869
1870 $ hg help hgrc.paths
1870 $ hg help hgrc.paths
1871 "paths"
1871 "paths"
1872 -------
1872 -------
1873
1873
1874 Assigns symbolic names and behavior to repositories.
1874 Assigns symbolic names and behavior to repositories.
1875
1875
1876 Options are symbolic names defining the URL or directory that is the
1876 Options are symbolic names defining the URL or directory that is the
1877 location of the repository. Example:
1877 location of the repository. Example:
1878
1878
1879 [paths]
1879 [paths]
1880 my_server = https://example.com/my_repo
1880 my_server = https://example.com/my_repo
1881 local_path = /home/me/repo
1881 local_path = /home/me/repo
1882
1882
1883 These symbolic names can be used from the command line. To pull from
1883 These symbolic names can be used from the command line. To pull from
1884 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1884 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1885 local_path'. You can check 'hg help urls' for details about valid URLs.
1885 local_path'. You can check 'hg help urls' for details about valid URLs.
1886
1886
1887 Options containing colons (":") denote sub-options that can influence
1887 Options containing colons (":") denote sub-options that can influence
1888 behavior for that specific path. Example:
1888 behavior for that specific path. Example:
1889
1889
1890 [paths]
1890 [paths]
1891 my_server = https://example.com/my_path
1891 my_server = https://example.com/my_path
1892 my_server:pushurl = ssh://example.com/my_path
1892 my_server:pushurl = ssh://example.com/my_path
1893
1893
1894 Paths using the 'path://otherpath' scheme will inherit the sub-options
1894 Paths using the 'path://otherpath' scheme will inherit the sub-options
1895 value from the path they point to.
1895 value from the path they point to.
1896
1896
1897 The following sub-options can be defined:
1897 The following sub-options can be defined:
1898
1898
1899 "multi-urls"
1899 "multi-urls"
1900 A boolean option. When enabled the value of the '[paths]' entry will be
1900 A boolean option. When enabled the value of the '[paths]' entry will be
1901 parsed as a list and the alias will resolve to multiple destination. If
1901 parsed as a list and the alias will resolve to multiple destination. If
1902 some of the list entry use the 'path://' syntax, the suboption will be
1902 some of the list entry use the 'path://' syntax, the suboption will be
1903 inherited individually.
1903 inherited individually.
1904
1904
1905 "pushurl"
1905 "pushurl"
1906 The URL to use for push operations. If not defined, the location
1906 The URL to use for push operations. If not defined, the location
1907 defined by the path's main entry is used.
1907 defined by the path's main entry is used.
1908
1908
1909 "pushrev"
1909 "pushrev"
1910 A revset defining which revisions to push by default.
1910 A revset defining which revisions to push by default.
1911
1911
1912 When 'hg push' is executed without a "-r" argument, the revset defined
1912 When 'hg push' is executed without a "-r" argument, the revset defined
1913 by this sub-option is evaluated to determine what to push.
1913 by this sub-option is evaluated to determine what to push.
1914
1914
1915 For example, a value of "." will push the working directory's revision
1915 For example, a value of "." will push the working directory's revision
1916 by default.
1916 by default.
1917
1917
1918 Revsets specifying bookmarks will not result in the bookmark being
1918 Revsets specifying bookmarks will not result in the bookmark being
1919 pushed.
1919 pushed.
1920
1920
1921 "bookmarks.mode"
1921 "bookmarks.mode"
1922 How bookmark will be dealt during the exchange. It support the following
1922 How bookmark will be dealt during the exchange. It support the following
1923 value
1923 value
1924
1924
1925 - "default": the default behavior, local and remote bookmarks are
1925 - "default": the default behavior, local and remote bookmarks are
1926 "merged" on push/pull.
1926 "merged" on push/pull.
1927 - "mirror": when pulling, replace local bookmarks by remote bookmarks.
1927 - "mirror": when pulling, replace local bookmarks by remote bookmarks.
1928 This is useful to replicate a repository, or as an optimization.
1928 This is useful to replicate a repository, or as an optimization.
1929 - "ignore": ignore bookmarks during exchange. (This currently only
1929 - "ignore": ignore bookmarks during exchange. (This currently only
1930 affect pulling)
1930 affect pulling)
1931
1931
1932 The following special named paths exist:
1932 The following special named paths exist:
1933
1933
1934 "default"
1934 "default"
1935 The URL or directory to use when no source or remote is specified.
1935 The URL or directory to use when no source or remote is specified.
1936
1936
1937 'hg clone' will automatically define this path to the location the
1937 'hg clone' will automatically define this path to the location the
1938 repository was cloned from.
1938 repository was cloned from.
1939
1939
1940 "default-push"
1940 "default-push"
1941 (deprecated) The URL or directory for the default 'hg push' location.
1941 (deprecated) The URL or directory for the default 'hg push' location.
1942 "default:pushurl" should be used instead.
1942 "default:pushurl" should be used instead.
1943
1943
1944 $ hg help glossary.mcguffin
1944 $ hg help glossary.mcguffin
1945 abort: help section not found: glossary.mcguffin
1945 abort: help section not found: glossary.mcguffin
1946 [10]
1946 [10]
1947
1947
1948 $ hg help glossary.mc.guffin
1948 $ hg help glossary.mc.guffin
1949 abort: help section not found: glossary.mc.guffin
1949 abort: help section not found: glossary.mc.guffin
1950 [10]
1950 [10]
1951
1951
1952 $ hg help template.files
1952 $ hg help template.files
1953 files List of strings. All files modified, added, or removed by
1953 files List of strings. All files modified, added, or removed by
1954 this changeset.
1954 this changeset.
1955 files(pattern)
1955 files(pattern)
1956 All files of the current changeset matching the pattern. See
1956 All files of the current changeset matching the pattern. See
1957 'hg help patterns'.
1957 'hg help patterns'.
1958
1958
1959 Test section lookup by translated message
1959 Test section lookup by translated message
1960
1960
1961 str.lower() instead of encoding.lower(str) on translated message might
1961 str.lower() instead of encoding.lower(str) on translated message might
1962 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1962 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1963 as the second or later byte of multi-byte character.
1963 as the second or later byte of multi-byte character.
1964
1964
1965 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1965 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1966 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1966 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1967 replacement makes message meaningless.
1967 replacement makes message meaningless.
1968
1968
1969 This tests that section lookup by translated string isn't broken by
1969 This tests that section lookup by translated string isn't broken by
1970 such str.lower().
1970 such str.lower().
1971
1971
1972 $ "$PYTHON" <<EOF
1972 $ "$PYTHON" <<EOF
1973 > def escape(s):
1973 > def escape(s):
1974 > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932'))
1974 > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932'))
1975 > # translation of "record" in ja_JP.cp932
1975 > # translation of "record" in ja_JP.cp932
1976 > upper = b"\x8bL\x98^"
1976 > upper = b"\x8bL\x98^"
1977 > # str.lower()-ed section name should be treated as different one
1977 > # str.lower()-ed section name should be treated as different one
1978 > lower = b"\x8bl\x98^"
1978 > lower = b"\x8bl\x98^"
1979 > with open('ambiguous.py', 'wb') as fp:
1979 > with open('ambiguous.py', 'wb') as fp:
1980 > fp.write(b"""# ambiguous section names in ja_JP.cp932
1980 > fp.write(b"""# ambiguous section names in ja_JP.cp932
1981 > u'''summary of extension
1981 > u'''summary of extension
1982 >
1982 >
1983 > %s
1983 > %s
1984 > ----
1984 > ----
1985 >
1985 >
1986 > Upper name should show only this message
1986 > Upper name should show only this message
1987 >
1987 >
1988 > %s
1988 > %s
1989 > ----
1989 > ----
1990 >
1990 >
1991 > Lower name should show only this message
1991 > Lower name should show only this message
1992 >
1992 >
1993 > subsequent section
1993 > subsequent section
1994 > ------------------
1994 > ------------------
1995 >
1995 >
1996 > This should be hidden at 'hg help ambiguous' with section name.
1996 > This should be hidden at 'hg help ambiguous' with section name.
1997 > '''
1997 > '''
1998 > """ % (escape(upper), escape(lower)))
1998 > """ % (escape(upper), escape(lower)))
1999 > EOF
1999 > EOF
2000
2000
2001 $ cat >> $HGRCPATH <<EOF
2001 $ cat >> $HGRCPATH <<EOF
2002 > [extensions]
2002 > [extensions]
2003 > ambiguous = ./ambiguous.py
2003 > ambiguous = ./ambiguous.py
2004 > EOF
2004 > EOF
2005
2005
2006 $ "$PYTHON" <<EOF | sh
2006 $ "$PYTHON" <<EOF | sh
2007 > from mercurial.utils import procutil
2007 > from mercurial.utils import procutil
2008 > upper = b"\x8bL\x98^"
2008 > upper = b"\x8bL\x98^"
2009 > procutil.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % upper)
2009 > procutil.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % upper)
2010 > EOF
2010 > EOF
2011 \x8bL\x98^ (esc)
2011 \x8bL\x98^ (esc)
2012 ----
2012 ----
2013
2013
2014 Upper name should show only this message
2014 Upper name should show only this message
2015
2015
2016
2016
2017 $ "$PYTHON" <<EOF | sh
2017 $ "$PYTHON" <<EOF | sh
2018 > from mercurial.utils import procutil
2018 > from mercurial.utils import procutil
2019 > lower = b"\x8bl\x98^"
2019 > lower = b"\x8bl\x98^"
2020 > procutil.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % lower)
2020 > procutil.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % lower)
2021 > EOF
2021 > EOF
2022 \x8bl\x98^ (esc)
2022 \x8bl\x98^ (esc)
2023 ----
2023 ----
2024
2024
2025 Lower name should show only this message
2025 Lower name should show only this message
2026
2026
2027
2027
2028 $ cat >> $HGRCPATH <<EOF
2028 $ cat >> $HGRCPATH <<EOF
2029 > [extensions]
2029 > [extensions]
2030 > ambiguous = !
2030 > ambiguous = !
2031 > EOF
2031 > EOF
2032
2032
2033 Show help content of disabled extensions
2033 Show help content of disabled extensions
2034
2034
2035 $ cat >> $HGRCPATH <<EOF
2035 $ cat >> $HGRCPATH <<EOF
2036 > [extensions]
2036 > [extensions]
2037 > ambiguous = !./ambiguous.py
2037 > ambiguous = !./ambiguous.py
2038 > EOF
2038 > EOF
2039 $ hg help -e ambiguous
2039 $ hg help -e ambiguous
2040 ambiguous extension - (no help text available)
2040 ambiguous extension - (no help text available)
2041
2041
2042 (use 'hg help extensions' for information on enabling extensions)
2042 (use 'hg help extensions' for information on enabling extensions)
2043
2043
2044 Test dynamic list of merge tools only shows up once
2044 Test dynamic list of merge tools only shows up once
2045 $ hg help merge-tools
2045 $ hg help merge-tools
2046 Merge Tools
2046 Merge Tools
2047 """""""""""
2047 """""""""""
2048
2048
2049 To merge files Mercurial uses merge tools.
2049 To merge files Mercurial uses merge tools.
2050
2050
2051 A merge tool combines two different versions of a file into a merged file.
2051 A merge tool combines two different versions of a file into a merged file.
2052 Merge tools are given the two files and the greatest common ancestor of
2052 Merge tools are given the two files and the greatest common ancestor of
2053 the two file versions, so they can determine the changes made on both
2053 the two file versions, so they can determine the changes made on both
2054 branches.
2054 branches.
2055
2055
2056 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
2056 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
2057 backout' and in several extensions.
2057 backout' and in several extensions.
2058
2058
2059 Usually, the merge tool tries to automatically reconcile the files by
2059 Usually, the merge tool tries to automatically reconcile the files by
2060 combining all non-overlapping changes that occurred separately in the two
2060 combining all non-overlapping changes that occurred separately in the two
2061 different evolutions of the same initial base file. Furthermore, some
2061 different evolutions of the same initial base file. Furthermore, some
2062 interactive merge programs make it easier to manually resolve conflicting
2062 interactive merge programs make it easier to manually resolve conflicting
2063 merges, either in a graphical way, or by inserting some conflict markers.
2063 merges, either in a graphical way, or by inserting some conflict markers.
2064 Mercurial does not include any interactive merge programs but relies on
2064 Mercurial does not include any interactive merge programs but relies on
2065 external tools for that.
2065 external tools for that.
2066
2066
2067 Available merge tools
2067 Available merge tools
2068 =====================
2068 =====================
2069
2069
2070 External merge tools and their properties are configured in the merge-
2070 External merge tools and their properties are configured in the merge-
2071 tools configuration section - see hgrc(5) - but they can often just be
2071 tools configuration section - see hgrc(5) - but they can often just be
2072 named by their executable.
2072 named by their executable.
2073
2073
2074 A merge tool is generally usable if its executable can be found on the
2074 A merge tool is generally usable if its executable can be found on the
2075 system and if it can handle the merge. The executable is found if it is an
2075 system and if it can handle the merge. The executable is found if it is an
2076 absolute or relative executable path or the name of an application in the
2076 absolute or relative executable path or the name of an application in the
2077 executable search path. The tool is assumed to be able to handle the merge
2077 executable search path. The tool is assumed to be able to handle the merge
2078 if it can handle symlinks if the file is a symlink, if it can handle
2078 if it can handle symlinks if the file is a symlink, if it can handle
2079 binary files if the file is binary, and if a GUI is available if the tool
2079 binary files if the file is binary, and if a GUI is available if the tool
2080 requires a GUI.
2080 requires a GUI.
2081
2081
2082 There are some internal merge tools which can be used. The internal merge
2082 There are some internal merge tools which can be used. The internal merge
2083 tools are:
2083 tools are:
2084
2084
2085 ":dump"
2085 ":dump"
2086 Creates three versions of the files to merge, containing the contents of
2086 Creates three versions of the files to merge, containing the contents of
2087 local, other and base. These files can then be used to perform a merge
2087 local, other and base. These files can then be used to perform a merge
2088 manually. If the file to be merged is named "a.txt", these files will
2088 manually. If the file to be merged is named "a.txt", these files will
2089 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
2089 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
2090 they will be placed in the same directory as "a.txt".
2090 they will be placed in the same directory as "a.txt".
2091
2091
2092 This implies premerge. Therefore, files aren't dumped, if premerge runs
2092 This implies premerge. Therefore, files aren't dumped, if premerge runs
2093 successfully. Use :forcedump to forcibly write files out.
2093 successfully. Use :forcedump to forcibly write files out.
2094
2094
2095 (actual capabilities: binary, symlink)
2095 (actual capabilities: binary, symlink)
2096
2096
2097 ":fail"
2097 ":fail"
2098 Rather than attempting to merge files that were modified on both
2098 Rather than attempting to merge files that were modified on both
2099 branches, it marks them as unresolved. The resolve command must be used
2099 branches, it marks them as unresolved. The resolve command must be used
2100 to resolve these conflicts.
2100 to resolve these conflicts.
2101
2101
2102 (actual capabilities: binary, symlink)
2102 (actual capabilities: binary, symlink)
2103
2103
2104 ":forcedump"
2104 ":forcedump"
2105 Creates three versions of the files as same as :dump, but omits
2105 Creates three versions of the files as same as :dump, but omits
2106 premerge.
2106 premerge.
2107
2107
2108 (actual capabilities: binary, symlink)
2108 (actual capabilities: binary, symlink)
2109
2109
2110 ":local"
2110 ":local"
2111 Uses the local 'p1()' version of files as the merged version.
2111 Uses the local 'p1()' version of files as the merged version.
2112
2112
2113 (actual capabilities: binary, symlink)
2113 (actual capabilities: binary, symlink)
2114
2114
2115 ":merge"
2115 ":merge"
2116 Uses the internal non-interactive simple merge algorithm for merging
2116 Uses the internal non-interactive simple merge algorithm for merging
2117 files. It will fail if there are any conflicts and leave markers in the
2117 files. It will fail if there are any conflicts and leave markers in the
2118 partially merged file. Markers will have two sections, one for each side
2118 partially merged file. Markers will have two sections, one for each side
2119 of merge.
2119 of merge.
2120
2120
2121 ":merge-local"
2121 ":merge-local"
2122 Like :merge, but resolve all conflicts non-interactively in favor of the
2122 Like :merge, but resolve all conflicts non-interactively in favor of the
2123 local 'p1()' changes.
2123 local 'p1()' changes.
2124
2124
2125 ":merge-other"
2125 ":merge-other"
2126 Like :merge, but resolve all conflicts non-interactively in favor of the
2126 Like :merge, but resolve all conflicts non-interactively in favor of the
2127 other 'p2()' changes.
2127 other 'p2()' changes.
2128
2128
2129 ":merge3"
2129 ":merge3"
2130 Uses the internal non-interactive simple merge algorithm for merging
2130 Uses the internal non-interactive simple merge algorithm for merging
2131 files. It will fail if there are any conflicts and leave markers in the
2131 files. It will fail if there are any conflicts and leave markers in the
2132 partially merged file. Marker will have three sections, one from each
2132 partially merged file. Marker will have three sections, one from each
2133 side of the merge and one for the base content.
2133 side of the merge and one for the base content.
2134
2134
2135 ":mergediff"
2135 ":mergediff"
2136 Uses the internal non-interactive simple merge algorithm for merging
2136 Uses the internal non-interactive simple merge algorithm for merging
2137 files. It will fail if there are any conflicts and leave markers in the
2137 files. It will fail if there are any conflicts and leave markers in the
2138 partially merged file. The marker will have two sections, one with the
2138 partially merged file. The marker will have two sections, one with the
2139 content from one side of the merge, and one with a diff from the base
2139 content from one side of the merge, and one with a diff from the base
2140 content to the content on the other side. (experimental)
2140 content to the content on the other side. (experimental)
2141
2141
2142 ":other"
2142 ":other"
2143 Uses the other 'p2()' version of files as the merged version.
2143 Uses the other 'p2()' version of files as the merged version.
2144
2144
2145 (actual capabilities: binary, symlink)
2145 (actual capabilities: binary, symlink)
2146
2146
2147 ":prompt"
2147 ":prompt"
2148 Asks the user which of the local 'p1()' or the other 'p2()' version to
2148 Asks the user which of the local 'p1()' or the other 'p2()' version to
2149 keep as the merged version.
2149 keep as the merged version.
2150
2150
2151 (actual capabilities: binary, symlink)
2151 (actual capabilities: binary, symlink)
2152
2152
2153 ":tagmerge"
2153 ":tagmerge"
2154 Uses the internal tag merge algorithm (experimental).
2154 Uses the internal tag merge algorithm (experimental).
2155
2155
2156 ":union"
2156 ":union"
2157 Uses the internal non-interactive simple merge algorithm for merging
2157 Uses the internal non-interactive simple merge algorithm for merging
2158 files. It will use both left and right sides for conflict regions. No
2158 files. It will use both left and right sides for conflict regions. No
2159 markers are inserted.
2159 markers are inserted.
2160
2160
2161 Internal tools are always available and do not require a GUI but will by
2161 Internal tools are always available and do not require a GUI but will by
2162 default not handle symlinks or binary files. See next section for detail
2162 default not handle symlinks or binary files. See next section for detail
2163 about "actual capabilities" described above.
2163 about "actual capabilities" described above.
2164
2164
2165 Choosing a merge tool
2165 Choosing a merge tool
2166 =====================
2166 =====================
2167
2167
2168 Mercurial uses these rules when deciding which merge tool to use:
2168 Mercurial uses these rules when deciding which merge tool to use:
2169
2169
2170 1. If a tool has been specified with the --tool option to merge or
2170 1. If a tool has been specified with the --tool option to merge or
2171 resolve, it is used. If it is the name of a tool in the merge-tools
2171 resolve, it is used. If it is the name of a tool in the merge-tools
2172 configuration, its configuration is used. Otherwise the specified tool
2172 configuration, its configuration is used. Otherwise the specified tool
2173 must be executable by the shell.
2173 must be executable by the shell.
2174 2. If the "HGMERGE" environment variable is present, its value is used and
2174 2. If the "HGMERGE" environment variable is present, its value is used and
2175 must be executable by the shell.
2175 must be executable by the shell.
2176 3. If the filename of the file to be merged matches any of the patterns in
2176 3. If the filename of the file to be merged matches any of the patterns in
2177 the merge-patterns configuration section, the first usable merge tool
2177 the merge-patterns configuration section, the first usable merge tool
2178 corresponding to a matching pattern is used.
2178 corresponding to a matching pattern is used.
2179 4. If ui.merge is set it will be considered next. If the value is not the
2179 4. If ui.merge is set it will be considered next. If the value is not the
2180 name of a configured tool, the specified value is used and must be
2180 name of a configured tool, the specified value is used and must be
2181 executable by the shell. Otherwise the named tool is used if it is
2181 executable by the shell. Otherwise the named tool is used if it is
2182 usable.
2182 usable.
2183 5. If any usable merge tools are present in the merge-tools configuration
2183 5. If any usable merge tools are present in the merge-tools configuration
2184 section, the one with the highest priority is used.
2184 section, the one with the highest priority is used.
2185 6. If a program named "hgmerge" can be found on the system, it is used -
2185 6. If a program named "hgmerge" can be found on the system, it is used -
2186 but it will by default not be used for symlinks and binary files.
2186 but it will by default not be used for symlinks and binary files.
2187 7. If the file to be merged is not binary and is not a symlink, then
2187 7. If the file to be merged is not binary and is not a symlink, then
2188 internal ":merge" is used.
2188 internal ":merge" is used.
2189 8. Otherwise, ":prompt" is used.
2189 8. Otherwise, ":prompt" is used.
2190
2190
2191 For historical reason, Mercurial treats merge tools as below while
2191 For historical reason, Mercurial treats merge tools as below while
2192 examining rules above.
2192 examining rules above.
2193
2193
2194 step specified via binary symlink
2194 step specified via binary symlink
2195 ----------------------------------
2195 ----------------------------------
2196 1. --tool o/o o/o
2196 1. --tool o/o o/o
2197 2. HGMERGE o/o o/o
2197 2. HGMERGE o/o o/o
2198 3. merge-patterns o/o(*) x/?(*)
2198 3. merge-patterns o/o(*) x/?(*)
2199 4. ui.merge x/?(*) x/?(*)
2199 4. ui.merge x/?(*) x/?(*)
2200
2200
2201 Each capability column indicates Mercurial behavior for internal/external
2201 Each capability column indicates Mercurial behavior for internal/external
2202 merge tools at examining each rule.
2202 merge tools at examining each rule.
2203
2203
2204 - "o": "assume that a tool has capability"
2204 - "o": "assume that a tool has capability"
2205 - "x": "assume that a tool does not have capability"
2205 - "x": "assume that a tool does not have capability"
2206 - "?": "check actual capability of a tool"
2206 - "?": "check actual capability of a tool"
2207
2207
2208 If "merge.strict-capability-check" configuration is true, Mercurial checks
2208 If "merge.strict-capability-check" configuration is true, Mercurial checks
2209 capabilities of merge tools strictly in (*) cases above (= each capability
2209 capabilities of merge tools strictly in (*) cases above (= each capability
2210 column becomes "?/?"). It is false by default for backward compatibility.
2210 column becomes "?/?"). It is false by default for backward compatibility.
2211
2211
2212 Note:
2212 Note:
2213 After selecting a merge program, Mercurial will by default attempt to
2213 After selecting a merge program, Mercurial will by default attempt to
2214 merge the files using a simple merge algorithm first. Only if it
2214 merge the files using a simple merge algorithm first. Only if it
2215 doesn't succeed because of conflicting changes will Mercurial actually
2215 doesn't succeed because of conflicting changes will Mercurial actually
2216 execute the merge program. Whether to use the simple merge algorithm
2216 execute the merge program. Whether to use the simple merge algorithm
2217 first can be controlled by the premerge setting of the merge tool.
2217 first can be controlled by the premerge setting of the merge tool.
2218 Premerge is enabled by default unless the file is binary or a symlink.
2218 Premerge is enabled by default unless the file is binary or a symlink.
2219
2219
2220 See the merge-tools and ui sections of hgrc(5) for details on the
2220 See the merge-tools and ui sections of hgrc(5) for details on the
2221 configuration of merge tools.
2221 configuration of merge tools.
2222
2222
2223 Compression engines listed in `hg help bundlespec`
2223 Compression engines listed in `hg help bundlespec`
2224
2224
2225 $ hg help bundlespec | grep gzip
2225 $ hg help bundlespec | grep gzip
2226 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
2226 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
2227 An algorithm that produces smaller bundles than "gzip".
2227 An algorithm that produces smaller bundles than "gzip".
2228 This engine will likely produce smaller bundles than "gzip" but will be
2228 This engine will likely produce smaller bundles than "gzip" but will be
2229 "gzip"
2229 "gzip"
2230 better compression than "gzip". It also frequently yields better (?)
2230 better compression than "gzip". It also frequently yields better (?)
2231
2231
2232 Test usage of section marks in help documents
2232 Test usage of section marks in help documents
2233
2233
2234 $ cd "$TESTDIR"/../doc
2234 $ cd "$TESTDIR"/../doc
2235 $ "$PYTHON" check-seclevel.py
2235 $ "$PYTHON" check-seclevel.py
2236 $ cd $TESTTMP
2236 $ cd $TESTTMP
2237
2237
2238 #if serve
2238 #if serve
2239
2239
2240 Test the help pages in hgweb.
2240 Test the help pages in hgweb.
2241
2241
2242 Dish up an empty repo; serve it cold.
2242 Dish up an empty repo; serve it cold.
2243
2243
2244 $ hg init "$TESTTMP/test"
2244 $ hg init "$TESTTMP/test"
2245 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
2245 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
2246 $ cat hg.pid >> $DAEMON_PIDS
2246 $ cat hg.pid >> $DAEMON_PIDS
2247
2247
2248 $ get-with-headers.py $LOCALIP:$HGPORT "help"
2248 $ get-with-headers.py $LOCALIP:$HGPORT "help"
2249 200 Script output follows
2249 200 Script output follows
2250
2250
2251 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2251 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2252 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2252 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2253 <head>
2253 <head>
2254 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2254 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2255 <meta name="robots" content="index, nofollow" />
2255 <meta name="robots" content="index, nofollow" />
2256 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2256 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2257 <script type="text/javascript" src="/static/mercurial.js"></script>
2257 <script type="text/javascript" src="/static/mercurial.js"></script>
2258
2258
2259 <title>Help: Index</title>
2259 <title>Help: Index</title>
2260 </head>
2260 </head>
2261 <body>
2261 <body>
2262
2262
2263 <div class="container">
2263 <div class="container">
2264 <div class="menu">
2264 <div class="menu">
2265 <div class="logo">
2265 <div class="logo">
2266 <a href="https://mercurial-scm.org/">
2266 <a href="https://mercurial-scm.org/">
2267 <img src="/static/hglogo.png" alt="mercurial" /></a>
2267 <img src="/static/hglogo.png" alt="mercurial" /></a>
2268 </div>
2268 </div>
2269 <ul>
2269 <ul>
2270 <li><a href="/shortlog">log</a></li>
2270 <li><a href="/shortlog">log</a></li>
2271 <li><a href="/graph">graph</a></li>
2271 <li><a href="/graph">graph</a></li>
2272 <li><a href="/tags">tags</a></li>
2272 <li><a href="/tags">tags</a></li>
2273 <li><a href="/bookmarks">bookmarks</a></li>
2273 <li><a href="/bookmarks">bookmarks</a></li>
2274 <li><a href="/branches">branches</a></li>
2274 <li><a href="/branches">branches</a></li>
2275 </ul>
2275 </ul>
2276 <ul>
2276 <ul>
2277 <li class="active">help</li>
2277 <li class="active">help</li>
2278 </ul>
2278 </ul>
2279 </div>
2279 </div>
2280
2280
2281 <div class="main">
2281 <div class="main">
2282 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2282 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2283
2283
2284 <form class="search" action="/log">
2284 <form class="search" action="/log">
2285
2285
2286 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2286 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2287 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2287 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2288 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2288 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2289 </form>
2289 </form>
2290 <table class="bigtable">
2290 <table class="bigtable">
2291 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2291 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2292
2292
2293 <tr><td>
2293 <tr><td>
2294 <a href="/help/bundlespec">
2294 <a href="/help/bundlespec">
2295 bundlespec
2295 bundlespec
2296 </a>
2296 </a>
2297 </td><td>
2297 </td><td>
2298 Bundle File Formats
2298 Bundle File Formats
2299 </td></tr>
2299 </td></tr>
2300 <tr><td>
2300 <tr><td>
2301 <a href="/help/color">
2301 <a href="/help/color">
2302 color
2302 color
2303 </a>
2303 </a>
2304 </td><td>
2304 </td><td>
2305 Colorizing Outputs
2305 Colorizing Outputs
2306 </td></tr>
2306 </td></tr>
2307 <tr><td>
2307 <tr><td>
2308 <a href="/help/config">
2308 <a href="/help/config">
2309 config
2309 config
2310 </a>
2310 </a>
2311 </td><td>
2311 </td><td>
2312 Configuration Files
2312 Configuration Files
2313 </td></tr>
2313 </td></tr>
2314 <tr><td>
2314 <tr><td>
2315 <a href="/help/dates">
2315 <a href="/help/dates">
2316 dates
2316 dates
2317 </a>
2317 </a>
2318 </td><td>
2318 </td><td>
2319 Date Formats
2319 Date Formats
2320 </td></tr>
2320 </td></tr>
2321 <tr><td>
2321 <tr><td>
2322 <a href="/help/deprecated">
2322 <a href="/help/deprecated">
2323 deprecated
2323 deprecated
2324 </a>
2324 </a>
2325 </td><td>
2325 </td><td>
2326 Deprecated Features
2326 Deprecated Features
2327 </td></tr>
2327 </td></tr>
2328 <tr><td>
2328 <tr><td>
2329 <a href="/help/diffs">
2329 <a href="/help/diffs">
2330 diffs
2330 diffs
2331 </a>
2331 </a>
2332 </td><td>
2332 </td><td>
2333 Diff Formats
2333 Diff Formats
2334 </td></tr>
2334 </td></tr>
2335 <tr><td>
2335 <tr><td>
2336 <a href="/help/environment">
2336 <a href="/help/environment">
2337 environment
2337 environment
2338 </a>
2338 </a>
2339 </td><td>
2339 </td><td>
2340 Environment Variables
2340 Environment Variables
2341 </td></tr>
2341 </td></tr>
2342 <tr><td>
2342 <tr><td>
2343 <a href="/help/evolution">
2343 <a href="/help/evolution">
2344 evolution
2344 evolution
2345 </a>
2345 </a>
2346 </td><td>
2346 </td><td>
2347 Safely rewriting history (EXPERIMENTAL)
2347 Safely rewriting history (EXPERIMENTAL)
2348 </td></tr>
2348 </td></tr>
2349 <tr><td>
2349 <tr><td>
2350 <a href="/help/extensions">
2350 <a href="/help/extensions">
2351 extensions
2351 extensions
2352 </a>
2352 </a>
2353 </td><td>
2353 </td><td>
2354 Using Additional Features
2354 Using Additional Features
2355 </td></tr>
2355 </td></tr>
2356 <tr><td>
2356 <tr><td>
2357 <a href="/help/filesets">
2357 <a href="/help/filesets">
2358 filesets
2358 filesets
2359 </a>
2359 </a>
2360 </td><td>
2360 </td><td>
2361 Specifying File Sets
2361 Specifying File Sets
2362 </td></tr>
2362 </td></tr>
2363 <tr><td>
2363 <tr><td>
2364 <a href="/help/flags">
2364 <a href="/help/flags">
2365 flags
2365 flags
2366 </a>
2366 </a>
2367 </td><td>
2367 </td><td>
2368 Command-line flags
2368 Command-line flags
2369 </td></tr>
2369 </td></tr>
2370 <tr><td>
2370 <tr><td>
2371 <a href="/help/glossary">
2371 <a href="/help/glossary">
2372 glossary
2372 glossary
2373 </a>
2373 </a>
2374 </td><td>
2374 </td><td>
2375 Glossary
2375 Glossary
2376 </td></tr>
2376 </td></tr>
2377 <tr><td>
2377 <tr><td>
2378 <a href="/help/hgignore">
2378 <a href="/help/hgignore">
2379 hgignore
2379 hgignore
2380 </a>
2380 </a>
2381 </td><td>
2381 </td><td>
2382 Syntax for Mercurial Ignore Files
2382 Syntax for Mercurial Ignore Files
2383 </td></tr>
2383 </td></tr>
2384 <tr><td>
2384 <tr><td>
2385 <a href="/help/hgweb">
2385 <a href="/help/hgweb">
2386 hgweb
2386 hgweb
2387 </a>
2387 </a>
2388 </td><td>
2388 </td><td>
2389 Configuring hgweb
2389 Configuring hgweb
2390 </td></tr>
2390 </td></tr>
2391 <tr><td>
2391 <tr><td>
2392 <a href="/help/internals">
2392 <a href="/help/internals">
2393 internals
2393 internals
2394 </a>
2394 </a>
2395 </td><td>
2395 </td><td>
2396 Technical implementation topics
2396 Technical implementation topics
2397 </td></tr>
2397 </td></tr>
2398 <tr><td>
2398 <tr><td>
2399 <a href="/help/merge-tools">
2399 <a href="/help/merge-tools">
2400 merge-tools
2400 merge-tools
2401 </a>
2401 </a>
2402 </td><td>
2402 </td><td>
2403 Merge Tools
2403 Merge Tools
2404 </td></tr>
2404 </td></tr>
2405 <tr><td>
2405 <tr><td>
2406 <a href="/help/pager">
2406 <a href="/help/pager">
2407 pager
2407 pager
2408 </a>
2408 </a>
2409 </td><td>
2409 </td><td>
2410 Pager Support
2410 Pager Support
2411 </td></tr>
2411 </td></tr>
2412 <tr><td>
2412 <tr><td>
2413 <a href="/help/patterns">
2413 <a href="/help/patterns">
2414 patterns
2414 patterns
2415 </a>
2415 </a>
2416 </td><td>
2416 </td><td>
2417 File Name Patterns
2417 File Name Patterns
2418 </td></tr>
2418 </td></tr>
2419 <tr><td>
2419 <tr><td>
2420 <a href="/help/phases">
2420 <a href="/help/phases">
2421 phases
2421 phases
2422 </a>
2422 </a>
2423 </td><td>
2423 </td><td>
2424 Working with Phases
2424 Working with Phases
2425 </td></tr>
2425 </td></tr>
2426 <tr><td>
2426 <tr><td>
2427 <a href="/help/revisions">
2427 <a href="/help/revisions">
2428 revisions
2428 revisions
2429 </a>
2429 </a>
2430 </td><td>
2430 </td><td>
2431 Specifying Revisions
2431 Specifying Revisions
2432 </td></tr>
2432 </td></tr>
2433 <tr><td>
2433 <tr><td>
2434 <a href="/help/rust">
2434 <a href="/help/rust">
2435 rust
2435 rust
2436 </a>
2436 </a>
2437 </td><td>
2437 </td><td>
2438 Rust in Mercurial
2438 Rust in Mercurial
2439 </td></tr>
2439 </td></tr>
2440 <tr><td>
2440 <tr><td>
2441 <a href="/help/scripting">
2441 <a href="/help/scripting">
2442 scripting
2442 scripting
2443 </a>
2443 </a>
2444 </td><td>
2444 </td><td>
2445 Using Mercurial from scripts and automation
2445 Using Mercurial from scripts and automation
2446 </td></tr>
2446 </td></tr>
2447 <tr><td>
2447 <tr><td>
2448 <a href="/help/subrepos">
2448 <a href="/help/subrepos">
2449 subrepos
2449 subrepos
2450 </a>
2450 </a>
2451 </td><td>
2451 </td><td>
2452 Subrepositories
2452 Subrepositories
2453 </td></tr>
2453 </td></tr>
2454 <tr><td>
2454 <tr><td>
2455 <a href="/help/templating">
2455 <a href="/help/templating">
2456 templating
2456 templating
2457 </a>
2457 </a>
2458 </td><td>
2458 </td><td>
2459 Template Usage
2459 Template Usage
2460 </td></tr>
2460 </td></tr>
2461 <tr><td>
2461 <tr><td>
2462 <a href="/help/urls">
2462 <a href="/help/urls">
2463 urls
2463 urls
2464 </a>
2464 </a>
2465 </td><td>
2465 </td><td>
2466 URL Paths
2466 URL Paths
2467 </td></tr>
2467 </td></tr>
2468 <tr><td>
2468 <tr><td>
2469 <a href="/help/topic-containing-verbose">
2469 <a href="/help/topic-containing-verbose">
2470 topic-containing-verbose
2470 topic-containing-verbose
2471 </a>
2471 </a>
2472 </td><td>
2472 </td><td>
2473 This is the topic to test omit indicating.
2473 This is the topic to test omit indicating.
2474 </td></tr>
2474 </td></tr>
2475
2475
2476
2476
2477 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2477 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2478
2478
2479 <tr><td>
2479 <tr><td>
2480 <a href="/help/abort">
2480 <a href="/help/abort">
2481 abort
2481 abort
2482 </a>
2482 </a>
2483 </td><td>
2483 </td><td>
2484 abort an unfinished operation (EXPERIMENTAL)
2484 abort an unfinished operation (EXPERIMENTAL)
2485 </td></tr>
2485 </td></tr>
2486 <tr><td>
2486 <tr><td>
2487 <a href="/help/add">
2487 <a href="/help/add">
2488 add
2488 add
2489 </a>
2489 </a>
2490 </td><td>
2490 </td><td>
2491 add the specified files on the next commit
2491 add the specified files on the next commit
2492 </td></tr>
2492 </td></tr>
2493 <tr><td>
2493 <tr><td>
2494 <a href="/help/annotate">
2494 <a href="/help/annotate">
2495 annotate
2495 annotate
2496 </a>
2496 </a>
2497 </td><td>
2497 </td><td>
2498 show changeset information by line for each file
2498 show changeset information by line for each file
2499 </td></tr>
2499 </td></tr>
2500 <tr><td>
2500 <tr><td>
2501 <a href="/help/clone">
2501 <a href="/help/clone">
2502 clone
2502 clone
2503 </a>
2503 </a>
2504 </td><td>
2504 </td><td>
2505 make a copy of an existing repository
2505 make a copy of an existing repository
2506 </td></tr>
2506 </td></tr>
2507 <tr><td>
2507 <tr><td>
2508 <a href="/help/commit">
2508 <a href="/help/commit">
2509 commit
2509 commit
2510 </a>
2510 </a>
2511 </td><td>
2511 </td><td>
2512 commit the specified files or all outstanding changes
2512 commit the specified files or all outstanding changes
2513 </td></tr>
2513 </td></tr>
2514 <tr><td>
2514 <tr><td>
2515 <a href="/help/continue">
2515 <a href="/help/continue">
2516 continue
2516 continue
2517 </a>
2517 </a>
2518 </td><td>
2518 </td><td>
2519 resumes an interrupted operation (EXPERIMENTAL)
2519 resumes an interrupted operation (EXPERIMENTAL)
2520 </td></tr>
2520 </td></tr>
2521 <tr><td>
2521 <tr><td>
2522 <a href="/help/diff">
2522 <a href="/help/diff">
2523 diff
2523 diff
2524 </a>
2524 </a>
2525 </td><td>
2525 </td><td>
2526 diff repository (or selected files)
2526 diff repository (or selected files)
2527 </td></tr>
2527 </td></tr>
2528 <tr><td>
2528 <tr><td>
2529 <a href="/help/export">
2529 <a href="/help/export">
2530 export
2530 export
2531 </a>
2531 </a>
2532 </td><td>
2532 </td><td>
2533 dump the header and diffs for one or more changesets
2533 dump the header and diffs for one or more changesets
2534 </td></tr>
2534 </td></tr>
2535 <tr><td>
2535 <tr><td>
2536 <a href="/help/forget">
2536 <a href="/help/forget">
2537 forget
2537 forget
2538 </a>
2538 </a>
2539 </td><td>
2539 </td><td>
2540 forget the specified files on the next commit
2540 forget the specified files on the next commit
2541 </td></tr>
2541 </td></tr>
2542 <tr><td>
2542 <tr><td>
2543 <a href="/help/init">
2543 <a href="/help/init">
2544 init
2544 init
2545 </a>
2545 </a>
2546 </td><td>
2546 </td><td>
2547 create a new repository in the given directory
2547 create a new repository in the given directory
2548 </td></tr>
2548 </td></tr>
2549 <tr><td>
2549 <tr><td>
2550 <a href="/help/log">
2550 <a href="/help/log">
2551 log
2551 log
2552 </a>
2552 </a>
2553 </td><td>
2553 </td><td>
2554 show revision history of entire repository or files
2554 show revision history of entire repository or files
2555 </td></tr>
2555 </td></tr>
2556 <tr><td>
2556 <tr><td>
2557 <a href="/help/merge">
2557 <a href="/help/merge">
2558 merge
2558 merge
2559 </a>
2559 </a>
2560 </td><td>
2560 </td><td>
2561 merge another revision into working directory
2561 merge another revision into working directory
2562 </td></tr>
2562 </td></tr>
2563 <tr><td>
2563 <tr><td>
2564 <a href="/help/pull">
2564 <a href="/help/pull">
2565 pull
2565 pull
2566 </a>
2566 </a>
2567 </td><td>
2567 </td><td>
2568 pull changes from the specified source
2568 pull changes from the specified source
2569 </td></tr>
2569 </td></tr>
2570 <tr><td>
2570 <tr><td>
2571 <a href="/help/push">
2571 <a href="/help/push">
2572 push
2572 push
2573 </a>
2573 </a>
2574 </td><td>
2574 </td><td>
2575 push changes to the specified destination
2575 push changes to the specified destination
2576 </td></tr>
2576 </td></tr>
2577 <tr><td>
2577 <tr><td>
2578 <a href="/help/remove">
2578 <a href="/help/remove">
2579 remove
2579 remove
2580 </a>
2580 </a>
2581 </td><td>
2581 </td><td>
2582 remove the specified files on the next commit
2582 remove the specified files on the next commit
2583 </td></tr>
2583 </td></tr>
2584 <tr><td>
2584 <tr><td>
2585 <a href="/help/serve">
2585 <a href="/help/serve">
2586 serve
2586 serve
2587 </a>
2587 </a>
2588 </td><td>
2588 </td><td>
2589 start stand-alone webserver
2589 start stand-alone webserver
2590 </td></tr>
2590 </td></tr>
2591 <tr><td>
2591 <tr><td>
2592 <a href="/help/status">
2592 <a href="/help/status">
2593 status
2593 status
2594 </a>
2594 </a>
2595 </td><td>
2595 </td><td>
2596 show changed files in the working directory
2596 show changed files in the working directory
2597 </td></tr>
2597 </td></tr>
2598 <tr><td>
2598 <tr><td>
2599 <a href="/help/summary">
2599 <a href="/help/summary">
2600 summary
2600 summary
2601 </a>
2601 </a>
2602 </td><td>
2602 </td><td>
2603 summarize working directory state
2603 summarize working directory state
2604 </td></tr>
2604 </td></tr>
2605 <tr><td>
2605 <tr><td>
2606 <a href="/help/update">
2606 <a href="/help/update">
2607 update
2607 update
2608 </a>
2608 </a>
2609 </td><td>
2609 </td><td>
2610 update working directory (or switch revisions)
2610 update working directory (or switch revisions)
2611 </td></tr>
2611 </td></tr>
2612
2612
2613
2613
2614
2614
2615 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2615 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2616
2616
2617 <tr><td>
2617 <tr><td>
2618 <a href="/help/addremove">
2618 <a href="/help/addremove">
2619 addremove
2619 addremove
2620 </a>
2620 </a>
2621 </td><td>
2621 </td><td>
2622 add all new files, delete all missing files
2622 add all new files, delete all missing files
2623 </td></tr>
2623 </td></tr>
2624 <tr><td>
2624 <tr><td>
2625 <a href="/help/archive">
2625 <a href="/help/archive">
2626 archive
2626 archive
2627 </a>
2627 </a>
2628 </td><td>
2628 </td><td>
2629 create an unversioned archive of a repository revision
2629 create an unversioned archive of a repository revision
2630 </td></tr>
2630 </td></tr>
2631 <tr><td>
2631 <tr><td>
2632 <a href="/help/backout">
2632 <a href="/help/backout">
2633 backout
2633 backout
2634 </a>
2634 </a>
2635 </td><td>
2635 </td><td>
2636 reverse effect of earlier changeset
2636 reverse effect of earlier changeset
2637 </td></tr>
2637 </td></tr>
2638 <tr><td>
2638 <tr><td>
2639 <a href="/help/bisect">
2639 <a href="/help/bisect">
2640 bisect
2640 bisect
2641 </a>
2641 </a>
2642 </td><td>
2642 </td><td>
2643 subdivision search of changesets
2643 subdivision search of changesets
2644 </td></tr>
2644 </td></tr>
2645 <tr><td>
2645 <tr><td>
2646 <a href="/help/bookmarks">
2646 <a href="/help/bookmarks">
2647 bookmarks
2647 bookmarks
2648 </a>
2648 </a>
2649 </td><td>
2649 </td><td>
2650 create a new bookmark or list existing bookmarks
2650 create a new bookmark or list existing bookmarks
2651 </td></tr>
2651 </td></tr>
2652 <tr><td>
2652 <tr><td>
2653 <a href="/help/branch">
2653 <a href="/help/branch">
2654 branch
2654 branch
2655 </a>
2655 </a>
2656 </td><td>
2656 </td><td>
2657 set or show the current branch name
2657 set or show the current branch name
2658 </td></tr>
2658 </td></tr>
2659 <tr><td>
2659 <tr><td>
2660 <a href="/help/branches">
2660 <a href="/help/branches">
2661 branches
2661 branches
2662 </a>
2662 </a>
2663 </td><td>
2663 </td><td>
2664 list repository named branches
2664 list repository named branches
2665 </td></tr>
2665 </td></tr>
2666 <tr><td>
2666 <tr><td>
2667 <a href="/help/bundle">
2667 <a href="/help/bundle">
2668 bundle
2668 bundle
2669 </a>
2669 </a>
2670 </td><td>
2670 </td><td>
2671 create a bundle file
2671 create a bundle file
2672 </td></tr>
2672 </td></tr>
2673 <tr><td>
2673 <tr><td>
2674 <a href="/help/cat">
2674 <a href="/help/cat">
2675 cat
2675 cat
2676 </a>
2676 </a>
2677 </td><td>
2677 </td><td>
2678 output the current or given revision of files
2678 output the current or given revision of files
2679 </td></tr>
2679 </td></tr>
2680 <tr><td>
2680 <tr><td>
2681 <a href="/help/config">
2681 <a href="/help/config">
2682 config
2682 config
2683 </a>
2683 </a>
2684 </td><td>
2684 </td><td>
2685 show combined config settings from all hgrc files
2685 show combined config settings from all hgrc files
2686 </td></tr>
2686 </td></tr>
2687 <tr><td>
2687 <tr><td>
2688 <a href="/help/copy">
2688 <a href="/help/copy">
2689 copy
2689 copy
2690 </a>
2690 </a>
2691 </td><td>
2691 </td><td>
2692 mark files as copied for the next commit
2692 mark files as copied for the next commit
2693 </td></tr>
2693 </td></tr>
2694 <tr><td>
2694 <tr><td>
2695 <a href="/help/files">
2695 <a href="/help/files">
2696 files
2696 files
2697 </a>
2697 </a>
2698 </td><td>
2698 </td><td>
2699 list tracked files
2699 list tracked files
2700 </td></tr>
2700 </td></tr>
2701 <tr><td>
2701 <tr><td>
2702 <a href="/help/graft">
2702 <a href="/help/graft">
2703 graft
2703 graft
2704 </a>
2704 </a>
2705 </td><td>
2705 </td><td>
2706 copy changes from other branches onto the current branch
2706 copy changes from other branches onto the current branch
2707 </td></tr>
2707 </td></tr>
2708 <tr><td>
2708 <tr><td>
2709 <a href="/help/grep">
2709 <a href="/help/grep">
2710 grep
2710 grep
2711 </a>
2711 </a>
2712 </td><td>
2712 </td><td>
2713 search for a pattern in specified files
2713 search for a pattern in specified files
2714 </td></tr>
2714 </td></tr>
2715 <tr><td>
2715 <tr><td>
2716 <a href="/help/hashelp">
2716 <a href="/help/hashelp">
2717 hashelp
2717 hashelp
2718 </a>
2718 </a>
2719 </td><td>
2719 </td><td>
2720 Extension command's help
2720 Extension command's help
2721 </td></tr>
2721 </td></tr>
2722 <tr><td>
2722 <tr><td>
2723 <a href="/help/heads">
2723 <a href="/help/heads">
2724 heads
2724 heads
2725 </a>
2725 </a>
2726 </td><td>
2726 </td><td>
2727 show branch heads
2727 show branch heads
2728 </td></tr>
2728 </td></tr>
2729 <tr><td>
2729 <tr><td>
2730 <a href="/help/help">
2730 <a href="/help/help">
2731 help
2731 help
2732 </a>
2732 </a>
2733 </td><td>
2733 </td><td>
2734 show help for a given topic or a help overview
2734 show help for a given topic or a help overview
2735 </td></tr>
2735 </td></tr>
2736 <tr><td>
2736 <tr><td>
2737 <a href="/help/hgalias">
2737 <a href="/help/hgalias">
2738 hgalias
2738 hgalias
2739 </a>
2739 </a>
2740 </td><td>
2740 </td><td>
2741 My doc
2741 My doc
2742 </td></tr>
2742 </td></tr>
2743 <tr><td>
2743 <tr><td>
2744 <a href="/help/hgaliasnodoc">
2744 <a href="/help/hgaliasnodoc">
2745 hgaliasnodoc
2745 hgaliasnodoc
2746 </a>
2746 </a>
2747 </td><td>
2747 </td><td>
2748 summarize working directory state
2748 summarize working directory state
2749 </td></tr>
2749 </td></tr>
2750 <tr><td>
2750 <tr><td>
2751 <a href="/help/identify">
2751 <a href="/help/identify">
2752 identify
2752 identify
2753 </a>
2753 </a>
2754 </td><td>
2754 </td><td>
2755 identify the working directory or specified revision
2755 identify the working directory or specified revision
2756 </td></tr>
2756 </td></tr>
2757 <tr><td>
2757 <tr><td>
2758 <a href="/help/import">
2758 <a href="/help/import">
2759 import
2759 import
2760 </a>
2760 </a>
2761 </td><td>
2761 </td><td>
2762 import an ordered set of patches
2762 import an ordered set of patches
2763 </td></tr>
2763 </td></tr>
2764 <tr><td>
2764 <tr><td>
2765 <a href="/help/incoming">
2765 <a href="/help/incoming">
2766 incoming
2766 incoming
2767 </a>
2767 </a>
2768 </td><td>
2768 </td><td>
2769 show new changesets found in source
2769 show new changesets found in source
2770 </td></tr>
2770 </td></tr>
2771 <tr><td>
2771 <tr><td>
2772 <a href="/help/manifest">
2772 <a href="/help/manifest">
2773 manifest
2773 manifest
2774 </a>
2774 </a>
2775 </td><td>
2775 </td><td>
2776 output the current or given revision of the project manifest
2776 output the current or given revision of the project manifest
2777 </td></tr>
2777 </td></tr>
2778 <tr><td>
2778 <tr><td>
2779 <a href="/help/nohelp">
2779 <a href="/help/nohelp">
2780 nohelp
2780 nohelp
2781 </a>
2781 </a>
2782 </td><td>
2782 </td><td>
2783 (no help text available)
2783 (no help text available)
2784 </td></tr>
2784 </td></tr>
2785 <tr><td>
2785 <tr><td>
2786 <a href="/help/outgoing">
2786 <a href="/help/outgoing">
2787 outgoing
2787 outgoing
2788 </a>
2788 </a>
2789 </td><td>
2789 </td><td>
2790 show changesets not found in the destination
2790 show changesets not found in the destination
2791 </td></tr>
2791 </td></tr>
2792 <tr><td>
2792 <tr><td>
2793 <a href="/help/paths">
2793 <a href="/help/paths">
2794 paths
2794 paths
2795 </a>
2795 </a>
2796 </td><td>
2796 </td><td>
2797 show aliases for remote repositories
2797 show aliases for remote repositories
2798 </td></tr>
2798 </td></tr>
2799 <tr><td>
2799 <tr><td>
2800 <a href="/help/phase">
2800 <a href="/help/phase">
2801 phase
2801 phase
2802 </a>
2802 </a>
2803 </td><td>
2803 </td><td>
2804 set or show the current phase name
2804 set or show the current phase name
2805 </td></tr>
2805 </td></tr>
2806 <tr><td>
2806 <tr><td>
2807 <a href="/help/purge">
2807 <a href="/help/purge">
2808 purge
2808 purge
2809 </a>
2809 </a>
2810 </td><td>
2810 </td><td>
2811 removes files not tracked by Mercurial
2811 removes files not tracked by Mercurial
2812 </td></tr>
2812 </td></tr>
2813 <tr><td>
2813 <tr><td>
2814 <a href="/help/recover">
2814 <a href="/help/recover">
2815 recover
2815 recover
2816 </a>
2816 </a>
2817 </td><td>
2817 </td><td>
2818 roll back an interrupted transaction
2818 roll back an interrupted transaction
2819 </td></tr>
2819 </td></tr>
2820 <tr><td>
2820 <tr><td>
2821 <a href="/help/rename">
2821 <a href="/help/rename">
2822 rename
2822 rename
2823 </a>
2823 </a>
2824 </td><td>
2824 </td><td>
2825 rename files; equivalent of copy + remove
2825 rename files; equivalent of copy + remove
2826 </td></tr>
2826 </td></tr>
2827 <tr><td>
2827 <tr><td>
2828 <a href="/help/resolve">
2828 <a href="/help/resolve">
2829 resolve
2829 resolve
2830 </a>
2830 </a>
2831 </td><td>
2831 </td><td>
2832 redo merges or set/view the merge status of files
2832 redo merges or set/view the merge status of files
2833 </td></tr>
2833 </td></tr>
2834 <tr><td>
2834 <tr><td>
2835 <a href="/help/revert">
2835 <a href="/help/revert">
2836 revert
2836 revert
2837 </a>
2837 </a>
2838 </td><td>
2838 </td><td>
2839 restore files to their checkout state
2839 restore files to their checkout state
2840 </td></tr>
2840 </td></tr>
2841 <tr><td>
2841 <tr><td>
2842 <a href="/help/root">
2842 <a href="/help/root">
2843 root
2843 root
2844 </a>
2844 </a>
2845 </td><td>
2845 </td><td>
2846 print the root (top) of the current working directory
2846 print the root (top) of the current working directory
2847 </td></tr>
2847 </td></tr>
2848 <tr><td>
2848 <tr><td>
2849 <a href="/help/shellalias">
2849 <a href="/help/shellalias">
2850 shellalias
2850 shellalias
2851 </a>
2851 </a>
2852 </td><td>
2852 </td><td>
2853 (no help text available)
2853 (no help text available)
2854 </td></tr>
2854 </td></tr>
2855 <tr><td>
2855 <tr><td>
2856 <a href="/help/shelve">
2856 <a href="/help/shelve">
2857 shelve
2857 shelve
2858 </a>
2858 </a>
2859 </td><td>
2859 </td><td>
2860 save and set aside changes from the working directory
2860 save and set aside changes from the working directory
2861 </td></tr>
2861 </td></tr>
2862 <tr><td>
2862 <tr><td>
2863 <a href="/help/tag">
2863 <a href="/help/tag">
2864 tag
2864 tag
2865 </a>
2865 </a>
2866 </td><td>
2866 </td><td>
2867 add one or more tags for the current or given revision
2867 add one or more tags for the current or given revision
2868 </td></tr>
2868 </td></tr>
2869 <tr><td>
2869 <tr><td>
2870 <a href="/help/tags">
2870 <a href="/help/tags">
2871 tags
2871 tags
2872 </a>
2872 </a>
2873 </td><td>
2873 </td><td>
2874 list repository tags
2874 list repository tags
2875 </td></tr>
2875 </td></tr>
2876 <tr><td>
2876 <tr><td>
2877 <a href="/help/unbundle">
2877 <a href="/help/unbundle">
2878 unbundle
2878 unbundle
2879 </a>
2879 </a>
2880 </td><td>
2880 </td><td>
2881 apply one or more bundle files
2881 apply one or more bundle files
2882 </td></tr>
2882 </td></tr>
2883 <tr><td>
2883 <tr><td>
2884 <a href="/help/unshelve">
2884 <a href="/help/unshelve">
2885 unshelve
2885 unshelve
2886 </a>
2886 </a>
2887 </td><td>
2887 </td><td>
2888 restore a shelved change to the working directory
2888 restore a shelved change to the working directory
2889 </td></tr>
2889 </td></tr>
2890 <tr><td>
2890 <tr><td>
2891 <a href="/help/verify">
2891 <a href="/help/verify">
2892 verify
2892 verify
2893 </a>
2893 </a>
2894 </td><td>
2894 </td><td>
2895 verify the integrity of the repository
2895 verify the integrity of the repository
2896 </td></tr>
2896 </td></tr>
2897 <tr><td>
2897 <tr><td>
2898 <a href="/help/version">
2898 <a href="/help/version">
2899 version
2899 version
2900 </a>
2900 </a>
2901 </td><td>
2901 </td><td>
2902 output version and copyright information
2902 output version and copyright information
2903 </td></tr>
2903 </td></tr>
2904
2904
2905
2905
2906 </table>
2906 </table>
2907 </div>
2907 </div>
2908 </div>
2908 </div>
2909
2909
2910
2910
2911
2911
2912 </body>
2912 </body>
2913 </html>
2913 </html>
2914
2914
2915
2915
2916 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2916 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2917 200 Script output follows
2917 200 Script output follows
2918
2918
2919 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2919 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2920 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2920 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2921 <head>
2921 <head>
2922 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2922 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2923 <meta name="robots" content="index, nofollow" />
2923 <meta name="robots" content="index, nofollow" />
2924 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2924 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2925 <script type="text/javascript" src="/static/mercurial.js"></script>
2925 <script type="text/javascript" src="/static/mercurial.js"></script>
2926
2926
2927 <title>Help: add</title>
2927 <title>Help: add</title>
2928 </head>
2928 </head>
2929 <body>
2929 <body>
2930
2930
2931 <div class="container">
2931 <div class="container">
2932 <div class="menu">
2932 <div class="menu">
2933 <div class="logo">
2933 <div class="logo">
2934 <a href="https://mercurial-scm.org/">
2934 <a href="https://mercurial-scm.org/">
2935 <img src="/static/hglogo.png" alt="mercurial" /></a>
2935 <img src="/static/hglogo.png" alt="mercurial" /></a>
2936 </div>
2936 </div>
2937 <ul>
2937 <ul>
2938 <li><a href="/shortlog">log</a></li>
2938 <li><a href="/shortlog">log</a></li>
2939 <li><a href="/graph">graph</a></li>
2939 <li><a href="/graph">graph</a></li>
2940 <li><a href="/tags">tags</a></li>
2940 <li><a href="/tags">tags</a></li>
2941 <li><a href="/bookmarks">bookmarks</a></li>
2941 <li><a href="/bookmarks">bookmarks</a></li>
2942 <li><a href="/branches">branches</a></li>
2942 <li><a href="/branches">branches</a></li>
2943 </ul>
2943 </ul>
2944 <ul>
2944 <ul>
2945 <li class="active"><a href="/help">help</a></li>
2945 <li class="active"><a href="/help">help</a></li>
2946 </ul>
2946 </ul>
2947 </div>
2947 </div>
2948
2948
2949 <div class="main">
2949 <div class="main">
2950 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2950 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2951 <h3>Help: add</h3>
2951 <h3>Help: add</h3>
2952
2952
2953 <form class="search" action="/log">
2953 <form class="search" action="/log">
2954
2954
2955 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2955 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2956 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2956 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2957 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2957 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2958 </form>
2958 </form>
2959 <div id="doc">
2959 <div id="doc">
2960 <p>
2960 <p>
2961 hg add [OPTION]... [FILE]...
2961 hg add [OPTION]... [FILE]...
2962 </p>
2962 </p>
2963 <p>
2963 <p>
2964 add the specified files on the next commit
2964 add the specified files on the next commit
2965 </p>
2965 </p>
2966 <p>
2966 <p>
2967 Schedule files to be version controlled and added to the
2967 Schedule files to be version controlled and added to the
2968 repository.
2968 repository.
2969 </p>
2969 </p>
2970 <p>
2970 <p>
2971 The files will be added to the repository at the next commit. To
2971 The files will be added to the repository at the next commit. To
2972 undo an add before that, see 'hg forget'.
2972 undo an add before that, see 'hg forget'.
2973 </p>
2973 </p>
2974 <p>
2974 <p>
2975 If no names are given, add all files to the repository (except
2975 If no names are given, add all files to the repository (except
2976 files matching &quot;.hgignore&quot;).
2976 files matching &quot;.hgignore&quot;).
2977 </p>
2977 </p>
2978 <p>
2978 <p>
2979 Examples:
2979 Examples:
2980 </p>
2980 </p>
2981 <ul>
2981 <ul>
2982 <li> New (unknown) files are added automatically by 'hg add':
2982 <li> New (unknown) files are added automatically by 'hg add':
2983 <pre>
2983 <pre>
2984 \$ ls (re)
2984 \$ ls (re)
2985 foo.c
2985 foo.c
2986 \$ hg status (re)
2986 \$ hg status (re)
2987 ? foo.c
2987 ? foo.c
2988 \$ hg add (re)
2988 \$ hg add (re)
2989 adding foo.c
2989 adding foo.c
2990 \$ hg status (re)
2990 \$ hg status (re)
2991 A foo.c
2991 A foo.c
2992 </pre>
2992 </pre>
2993 <li> Specific files to be added can be specified:
2993 <li> Specific files to be added can be specified:
2994 <pre>
2994 <pre>
2995 \$ ls (re)
2995 \$ ls (re)
2996 bar.c foo.c
2996 bar.c foo.c
2997 \$ hg status (re)
2997 \$ hg status (re)
2998 ? bar.c
2998 ? bar.c
2999 ? foo.c
2999 ? foo.c
3000 \$ hg add bar.c (re)
3000 \$ hg add bar.c (re)
3001 \$ hg status (re)
3001 \$ hg status (re)
3002 A bar.c
3002 A bar.c
3003 ? foo.c
3003 ? foo.c
3004 </pre>
3004 </pre>
3005 </ul>
3005 </ul>
3006 <p>
3006 <p>
3007 Returns 0 if all files are successfully added.
3007 Returns 0 if all files are successfully added.
3008 </p>
3008 </p>
3009 <p>
3009 <p>
3010 options ([+] can be repeated):
3010 options ([+] can be repeated):
3011 </p>
3011 </p>
3012 <table>
3012 <table>
3013 <tr><td>-I</td>
3013 <tr><td>-I</td>
3014 <td>--include PATTERN [+]</td>
3014 <td>--include PATTERN [+]</td>
3015 <td>include names matching the given patterns</td></tr>
3015 <td>include names matching the given patterns</td></tr>
3016 <tr><td>-X</td>
3016 <tr><td>-X</td>
3017 <td>--exclude PATTERN [+]</td>
3017 <td>--exclude PATTERN [+]</td>
3018 <td>exclude names matching the given patterns</td></tr>
3018 <td>exclude names matching the given patterns</td></tr>
3019 <tr><td>-S</td>
3019 <tr><td>-S</td>
3020 <td>--subrepos</td>
3020 <td>--subrepos</td>
3021 <td>recurse into subrepositories</td></tr>
3021 <td>recurse into subrepositories</td></tr>
3022 <tr><td>-n</td>
3022 <tr><td>-n</td>
3023 <td>--dry-run</td>
3023 <td>--dry-run</td>
3024 <td>do not perform actions, just print output</td></tr>
3024 <td>do not perform actions, just print output</td></tr>
3025 </table>
3025 </table>
3026 <p>
3026 <p>
3027 global options ([+] can be repeated):
3027 global options ([+] can be repeated):
3028 </p>
3028 </p>
3029 <table>
3029 <table>
3030 <tr><td>-R</td>
3030 <tr><td>-R</td>
3031 <td>--repository REPO</td>
3031 <td>--repository REPO</td>
3032 <td>repository root directory or name of overlay bundle file</td></tr>
3032 <td>repository root directory or name of overlay bundle file</td></tr>
3033 <tr><td></td>
3033 <tr><td></td>
3034 <td>--cwd DIR</td>
3034 <td>--cwd DIR</td>
3035 <td>change working directory</td></tr>
3035 <td>change working directory</td></tr>
3036 <tr><td>-y</td>
3036 <tr><td>-y</td>
3037 <td>--noninteractive</td>
3037 <td>--noninteractive</td>
3038 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
3038 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
3039 <tr><td>-q</td>
3039 <tr><td>-q</td>
3040 <td>--quiet</td>
3040 <td>--quiet</td>
3041 <td>suppress output</td></tr>
3041 <td>suppress output</td></tr>
3042 <tr><td>-v</td>
3042 <tr><td>-v</td>
3043 <td>--verbose</td>
3043 <td>--verbose</td>
3044 <td>enable additional output</td></tr>
3044 <td>enable additional output</td></tr>
3045 <tr><td></td>
3045 <tr><td></td>
3046 <td>--color TYPE</td>
3046 <td>--color TYPE</td>
3047 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
3047 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
3048 <tr><td></td>
3048 <tr><td></td>
3049 <td>--config CONFIG [+]</td>
3049 <td>--config CONFIG [+]</td>
3050 <td>set/override config option (use 'section.name=value')</td></tr>
3050 <td>set/override config option (use 'section.name=value')</td></tr>
3051 <tr><td></td>
3051 <tr><td></td>
3052 <td>--debug</td>
3052 <td>--debug</td>
3053 <td>enable debugging output</td></tr>
3053 <td>enable debugging output</td></tr>
3054 <tr><td></td>
3054 <tr><td></td>
3055 <td>--debugger</td>
3055 <td>--debugger</td>
3056 <td>start debugger</td></tr>
3056 <td>start debugger</td></tr>
3057 <tr><td></td>
3057 <tr><td></td>
3058 <td>--encoding ENCODE</td>
3058 <td>--encoding ENCODE</td>
3059 <td>set the charset encoding (default: ascii)</td></tr>
3059 <td>set the charset encoding (default: ascii)</td></tr>
3060 <tr><td></td>
3060 <tr><td></td>
3061 <td>--encodingmode MODE</td>
3061 <td>--encodingmode MODE</td>
3062 <td>set the charset encoding mode (default: strict)</td></tr>
3062 <td>set the charset encoding mode (default: strict)</td></tr>
3063 <tr><td></td>
3063 <tr><td></td>
3064 <td>--traceback</td>
3064 <td>--traceback</td>
3065 <td>always print a traceback on exception</td></tr>
3065 <td>always print a traceback on exception</td></tr>
3066 <tr><td></td>
3066 <tr><td></td>
3067 <td>--time</td>
3067 <td>--time</td>
3068 <td>time how long the command takes</td></tr>
3068 <td>time how long the command takes</td></tr>
3069 <tr><td></td>
3069 <tr><td></td>
3070 <td>--profile</td>
3070 <td>--profile</td>
3071 <td>print command execution profile</td></tr>
3071 <td>print command execution profile</td></tr>
3072 <tr><td></td>
3072 <tr><td></td>
3073 <td>--version</td>
3073 <td>--version</td>
3074 <td>output version information and exit</td></tr>
3074 <td>output version information and exit</td></tr>
3075 <tr><td>-h</td>
3075 <tr><td>-h</td>
3076 <td>--help</td>
3076 <td>--help</td>
3077 <td>display help and exit</td></tr>
3077 <td>display help and exit</td></tr>
3078 <tr><td></td>
3078 <tr><td></td>
3079 <td>--hidden</td>
3079 <td>--hidden</td>
3080 <td>consider hidden changesets</td></tr>
3080 <td>consider hidden changesets</td></tr>
3081 <tr><td></td>
3081 <tr><td></td>
3082 <td>--pager TYPE</td>
3082 <td>--pager TYPE</td>
3083 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3083 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3084 </table>
3084 </table>
3085
3085
3086 </div>
3086 </div>
3087 </div>
3087 </div>
3088 </div>
3088 </div>
3089
3089
3090
3090
3091
3091
3092 </body>
3092 </body>
3093 </html>
3093 </html>
3094
3094
3095
3095
3096 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
3096 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
3097 200 Script output follows
3097 200 Script output follows
3098
3098
3099 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3099 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3100 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3100 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3101 <head>
3101 <head>
3102 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3102 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3103 <meta name="robots" content="index, nofollow" />
3103 <meta name="robots" content="index, nofollow" />
3104 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3104 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3105 <script type="text/javascript" src="/static/mercurial.js"></script>
3105 <script type="text/javascript" src="/static/mercurial.js"></script>
3106
3106
3107 <title>Help: remove</title>
3107 <title>Help: remove</title>
3108 </head>
3108 </head>
3109 <body>
3109 <body>
3110
3110
3111 <div class="container">
3111 <div class="container">
3112 <div class="menu">
3112 <div class="menu">
3113 <div class="logo">
3113 <div class="logo">
3114 <a href="https://mercurial-scm.org/">
3114 <a href="https://mercurial-scm.org/">
3115 <img src="/static/hglogo.png" alt="mercurial" /></a>
3115 <img src="/static/hglogo.png" alt="mercurial" /></a>
3116 </div>
3116 </div>
3117 <ul>
3117 <ul>
3118 <li><a href="/shortlog">log</a></li>
3118 <li><a href="/shortlog">log</a></li>
3119 <li><a href="/graph">graph</a></li>
3119 <li><a href="/graph">graph</a></li>
3120 <li><a href="/tags">tags</a></li>
3120 <li><a href="/tags">tags</a></li>
3121 <li><a href="/bookmarks">bookmarks</a></li>
3121 <li><a href="/bookmarks">bookmarks</a></li>
3122 <li><a href="/branches">branches</a></li>
3122 <li><a href="/branches">branches</a></li>
3123 </ul>
3123 </ul>
3124 <ul>
3124 <ul>
3125 <li class="active"><a href="/help">help</a></li>
3125 <li class="active"><a href="/help">help</a></li>
3126 </ul>
3126 </ul>
3127 </div>
3127 </div>
3128
3128
3129 <div class="main">
3129 <div class="main">
3130 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3130 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3131 <h3>Help: remove</h3>
3131 <h3>Help: remove</h3>
3132
3132
3133 <form class="search" action="/log">
3133 <form class="search" action="/log">
3134
3134
3135 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3135 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3136 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3136 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3137 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3137 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3138 </form>
3138 </form>
3139 <div id="doc">
3139 <div id="doc">
3140 <p>
3140 <p>
3141 hg remove [OPTION]... FILE...
3141 hg remove [OPTION]... FILE...
3142 </p>
3142 </p>
3143 <p>
3143 <p>
3144 aliases: rm
3144 aliases: rm
3145 </p>
3145 </p>
3146 <p>
3146 <p>
3147 remove the specified files on the next commit
3147 remove the specified files on the next commit
3148 </p>
3148 </p>
3149 <p>
3149 <p>
3150 Schedule the indicated files for removal from the current branch.
3150 Schedule the indicated files for removal from the current branch.
3151 </p>
3151 </p>
3152 <p>
3152 <p>
3153 This command schedules the files to be removed at the next commit.
3153 This command schedules the files to be removed at the next commit.
3154 To undo a remove before that, see 'hg revert'. To undo added
3154 To undo a remove before that, see 'hg revert'. To undo added
3155 files, see 'hg forget'.
3155 files, see 'hg forget'.
3156 </p>
3156 </p>
3157 <p>
3157 <p>
3158 -A/--after can be used to remove only files that have already
3158 -A/--after can be used to remove only files that have already
3159 been deleted, -f/--force can be used to force deletion, and -Af
3159 been deleted, -f/--force can be used to force deletion, and -Af
3160 can be used to remove files from the next revision without
3160 can be used to remove files from the next revision without
3161 deleting them from the working directory.
3161 deleting them from the working directory.
3162 </p>
3162 </p>
3163 <p>
3163 <p>
3164 The following table details the behavior of remove for different
3164 The following table details the behavior of remove for different
3165 file states (columns) and option combinations (rows). The file
3165 file states (columns) and option combinations (rows). The file
3166 states are Added [A], Clean [C], Modified [M] and Missing [!]
3166 states are Added [A], Clean [C], Modified [M] and Missing [!]
3167 (as reported by 'hg status'). The actions are Warn, Remove
3167 (as reported by 'hg status'). The actions are Warn, Remove
3168 (from branch) and Delete (from disk):
3168 (from branch) and Delete (from disk):
3169 </p>
3169 </p>
3170 <table>
3170 <table>
3171 <tr><td>opt/state</td>
3171 <tr><td>opt/state</td>
3172 <td>A</td>
3172 <td>A</td>
3173 <td>C</td>
3173 <td>C</td>
3174 <td>M</td>
3174 <td>M</td>
3175 <td>!</td></tr>
3175 <td>!</td></tr>
3176 <tr><td>none</td>
3176 <tr><td>none</td>
3177 <td>W</td>
3177 <td>W</td>
3178 <td>RD</td>
3178 <td>RD</td>
3179 <td>W</td>
3179 <td>W</td>
3180 <td>R</td></tr>
3180 <td>R</td></tr>
3181 <tr><td>-f</td>
3181 <tr><td>-f</td>
3182 <td>R</td>
3182 <td>R</td>
3183 <td>RD</td>
3183 <td>RD</td>
3184 <td>RD</td>
3184 <td>RD</td>
3185 <td>R</td></tr>
3185 <td>R</td></tr>
3186 <tr><td>-A</td>
3186 <tr><td>-A</td>
3187 <td>W</td>
3187 <td>W</td>
3188 <td>W</td>
3188 <td>W</td>
3189 <td>W</td>
3189 <td>W</td>
3190 <td>R</td></tr>
3190 <td>R</td></tr>
3191 <tr><td>-Af</td>
3191 <tr><td>-Af</td>
3192 <td>R</td>
3192 <td>R</td>
3193 <td>R</td>
3193 <td>R</td>
3194 <td>R</td>
3194 <td>R</td>
3195 <td>R</td></tr>
3195 <td>R</td></tr>
3196 </table>
3196 </table>
3197 <p>
3197 <p>
3198 <b>Note:</b>
3198 <b>Note:</b>
3199 </p>
3199 </p>
3200 <p>
3200 <p>
3201 'hg remove' never deletes files in Added [A] state from the
3201 'hg remove' never deletes files in Added [A] state from the
3202 working directory, not even if &quot;--force&quot; is specified.
3202 working directory, not even if &quot;--force&quot; is specified.
3203 </p>
3203 </p>
3204 <p>
3204 <p>
3205 Returns 0 on success, 1 if any warnings encountered.
3205 Returns 0 on success, 1 if any warnings encountered.
3206 </p>
3206 </p>
3207 <p>
3207 <p>
3208 options ([+] can be repeated):
3208 options ([+] can be repeated):
3209 </p>
3209 </p>
3210 <table>
3210 <table>
3211 <tr><td>-A</td>
3211 <tr><td>-A</td>
3212 <td>--after</td>
3212 <td>--after</td>
3213 <td>record delete for missing files</td></tr>
3213 <td>record delete for missing files</td></tr>
3214 <tr><td>-f</td>
3214 <tr><td>-f</td>
3215 <td>--force</td>
3215 <td>--force</td>
3216 <td>forget added files, delete modified files</td></tr>
3216 <td>forget added files, delete modified files</td></tr>
3217 <tr><td>-S</td>
3217 <tr><td>-S</td>
3218 <td>--subrepos</td>
3218 <td>--subrepos</td>
3219 <td>recurse into subrepositories</td></tr>
3219 <td>recurse into subrepositories</td></tr>
3220 <tr><td>-I</td>
3220 <tr><td>-I</td>
3221 <td>--include PATTERN [+]</td>
3221 <td>--include PATTERN [+]</td>
3222 <td>include names matching the given patterns</td></tr>
3222 <td>include names matching the given patterns</td></tr>
3223 <tr><td>-X</td>
3223 <tr><td>-X</td>
3224 <td>--exclude PATTERN [+]</td>
3224 <td>--exclude PATTERN [+]</td>
3225 <td>exclude names matching the given patterns</td></tr>
3225 <td>exclude names matching the given patterns</td></tr>
3226 <tr><td>-n</td>
3226 <tr><td>-n</td>
3227 <td>--dry-run</td>
3227 <td>--dry-run</td>
3228 <td>do not perform actions, just print output</td></tr>
3228 <td>do not perform actions, just print output</td></tr>
3229 </table>
3229 </table>
3230 <p>
3230 <p>
3231 global options ([+] can be repeated):
3231 global options ([+] can be repeated):
3232 </p>
3232 </p>
3233 <table>
3233 <table>
3234 <tr><td>-R</td>
3234 <tr><td>-R</td>
3235 <td>--repository REPO</td>
3235 <td>--repository REPO</td>
3236 <td>repository root directory or name of overlay bundle file</td></tr>
3236 <td>repository root directory or name of overlay bundle file</td></tr>
3237 <tr><td></td>
3237 <tr><td></td>
3238 <td>--cwd DIR</td>
3238 <td>--cwd DIR</td>
3239 <td>change working directory</td></tr>
3239 <td>change working directory</td></tr>
3240 <tr><td>-y</td>
3240 <tr><td>-y</td>
3241 <td>--noninteractive</td>
3241 <td>--noninteractive</td>
3242 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
3242 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
3243 <tr><td>-q</td>
3243 <tr><td>-q</td>
3244 <td>--quiet</td>
3244 <td>--quiet</td>
3245 <td>suppress output</td></tr>
3245 <td>suppress output</td></tr>
3246 <tr><td>-v</td>
3246 <tr><td>-v</td>
3247 <td>--verbose</td>
3247 <td>--verbose</td>
3248 <td>enable additional output</td></tr>
3248 <td>enable additional output</td></tr>
3249 <tr><td></td>
3249 <tr><td></td>
3250 <td>--color TYPE</td>
3250 <td>--color TYPE</td>
3251 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
3251 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
3252 <tr><td></td>
3252 <tr><td></td>
3253 <td>--config CONFIG [+]</td>
3253 <td>--config CONFIG [+]</td>
3254 <td>set/override config option (use 'section.name=value')</td></tr>
3254 <td>set/override config option (use 'section.name=value')</td></tr>
3255 <tr><td></td>
3255 <tr><td></td>
3256 <td>--debug</td>
3256 <td>--debug</td>
3257 <td>enable debugging output</td></tr>
3257 <td>enable debugging output</td></tr>
3258 <tr><td></td>
3258 <tr><td></td>
3259 <td>--debugger</td>
3259 <td>--debugger</td>
3260 <td>start debugger</td></tr>
3260 <td>start debugger</td></tr>
3261 <tr><td></td>
3261 <tr><td></td>
3262 <td>--encoding ENCODE</td>
3262 <td>--encoding ENCODE</td>
3263 <td>set the charset encoding (default: ascii)</td></tr>
3263 <td>set the charset encoding (default: ascii)</td></tr>
3264 <tr><td></td>
3264 <tr><td></td>
3265 <td>--encodingmode MODE</td>
3265 <td>--encodingmode MODE</td>
3266 <td>set the charset encoding mode (default: strict)</td></tr>
3266 <td>set the charset encoding mode (default: strict)</td></tr>
3267 <tr><td></td>
3267 <tr><td></td>
3268 <td>--traceback</td>
3268 <td>--traceback</td>
3269 <td>always print a traceback on exception</td></tr>
3269 <td>always print a traceback on exception</td></tr>
3270 <tr><td></td>
3270 <tr><td></td>
3271 <td>--time</td>
3271 <td>--time</td>
3272 <td>time how long the command takes</td></tr>
3272 <td>time how long the command takes</td></tr>
3273 <tr><td></td>
3273 <tr><td></td>
3274 <td>--profile</td>
3274 <td>--profile</td>
3275 <td>print command execution profile</td></tr>
3275 <td>print command execution profile</td></tr>
3276 <tr><td></td>
3276 <tr><td></td>
3277 <td>--version</td>
3277 <td>--version</td>
3278 <td>output version information and exit</td></tr>
3278 <td>output version information and exit</td></tr>
3279 <tr><td>-h</td>
3279 <tr><td>-h</td>
3280 <td>--help</td>
3280 <td>--help</td>
3281 <td>display help and exit</td></tr>
3281 <td>display help and exit</td></tr>
3282 <tr><td></td>
3282 <tr><td></td>
3283 <td>--hidden</td>
3283 <td>--hidden</td>
3284 <td>consider hidden changesets</td></tr>
3284 <td>consider hidden changesets</td></tr>
3285 <tr><td></td>
3285 <tr><td></td>
3286 <td>--pager TYPE</td>
3286 <td>--pager TYPE</td>
3287 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3287 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3288 </table>
3288 </table>
3289
3289
3290 </div>
3290 </div>
3291 </div>
3291 </div>
3292 </div>
3292 </div>
3293
3293
3294
3294
3295
3295
3296 </body>
3296 </body>
3297 </html>
3297 </html>
3298
3298
3299
3299
3300 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
3300 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
3301 200 Script output follows
3301 200 Script output follows
3302
3302
3303 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3303 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3304 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3304 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3305 <head>
3305 <head>
3306 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3306 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3307 <meta name="robots" content="index, nofollow" />
3307 <meta name="robots" content="index, nofollow" />
3308 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3308 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3309 <script type="text/javascript" src="/static/mercurial.js"></script>
3309 <script type="text/javascript" src="/static/mercurial.js"></script>
3310
3310
3311 <title>Help: dates</title>
3311 <title>Help: dates</title>
3312 </head>
3312 </head>
3313 <body>
3313 <body>
3314
3314
3315 <div class="container">
3315 <div class="container">
3316 <div class="menu">
3316 <div class="menu">
3317 <div class="logo">
3317 <div class="logo">
3318 <a href="https://mercurial-scm.org/">
3318 <a href="https://mercurial-scm.org/">
3319 <img src="/static/hglogo.png" alt="mercurial" /></a>
3319 <img src="/static/hglogo.png" alt="mercurial" /></a>
3320 </div>
3320 </div>
3321 <ul>
3321 <ul>
3322 <li><a href="/shortlog">log</a></li>
3322 <li><a href="/shortlog">log</a></li>
3323 <li><a href="/graph">graph</a></li>
3323 <li><a href="/graph">graph</a></li>
3324 <li><a href="/tags">tags</a></li>
3324 <li><a href="/tags">tags</a></li>
3325 <li><a href="/bookmarks">bookmarks</a></li>
3325 <li><a href="/bookmarks">bookmarks</a></li>
3326 <li><a href="/branches">branches</a></li>
3326 <li><a href="/branches">branches</a></li>
3327 </ul>
3327 </ul>
3328 <ul>
3328 <ul>
3329 <li class="active"><a href="/help">help</a></li>
3329 <li class="active"><a href="/help">help</a></li>
3330 </ul>
3330 </ul>
3331 </div>
3331 </div>
3332
3332
3333 <div class="main">
3333 <div class="main">
3334 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3334 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3335 <h3>Help: dates</h3>
3335 <h3>Help: dates</h3>
3336
3336
3337 <form class="search" action="/log">
3337 <form class="search" action="/log">
3338
3338
3339 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3339 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3340 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3340 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3341 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3341 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3342 </form>
3342 </form>
3343 <div id="doc">
3343 <div id="doc">
3344 <h1>Date Formats</h1>
3344 <h1>Date Formats</h1>
3345 <p>
3345 <p>
3346 Some commands allow the user to specify a date, e.g.:
3346 Some commands allow the user to specify a date, e.g.:
3347 </p>
3347 </p>
3348 <ul>
3348 <ul>
3349 <li> backout, commit, import, tag: Specify the commit date.
3349 <li> backout, commit, import, tag: Specify the commit date.
3350 <li> log, revert, update: Select revision(s) by date.
3350 <li> log, revert, update: Select revision(s) by date.
3351 </ul>
3351 </ul>
3352 <p>
3352 <p>
3353 Many date formats are valid. Here are some examples:
3353 Many date formats are valid. Here are some examples:
3354 </p>
3354 </p>
3355 <ul>
3355 <ul>
3356 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3356 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3357 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3357 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3358 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3358 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3359 <li> &quot;Dec 6&quot; (midnight)
3359 <li> &quot;Dec 6&quot; (midnight)
3360 <li> &quot;13:18&quot; (today assumed)
3360 <li> &quot;13:18&quot; (today assumed)
3361 <li> &quot;3:39&quot; (3:39AM assumed)
3361 <li> &quot;3:39&quot; (3:39AM assumed)
3362 <li> &quot;3:39pm&quot; (15:39)
3362 <li> &quot;3:39pm&quot; (15:39)
3363 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3363 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3364 <li> &quot;2006-12-6 13:18&quot;
3364 <li> &quot;2006-12-6 13:18&quot;
3365 <li> &quot;2006-12-6&quot;
3365 <li> &quot;2006-12-6&quot;
3366 <li> &quot;12-6&quot;
3366 <li> &quot;12-6&quot;
3367 <li> &quot;12/6&quot;
3367 <li> &quot;12/6&quot;
3368 <li> &quot;12/6/6&quot; (Dec 6 2006)
3368 <li> &quot;12/6/6&quot; (Dec 6 2006)
3369 <li> &quot;today&quot; (midnight)
3369 <li> &quot;today&quot; (midnight)
3370 <li> &quot;yesterday&quot; (midnight)
3370 <li> &quot;yesterday&quot; (midnight)
3371 <li> &quot;now&quot; - right now
3371 <li> &quot;now&quot; - right now
3372 </ul>
3372 </ul>
3373 <p>
3373 <p>
3374 Lastly, there is Mercurial's internal format:
3374 Lastly, there is Mercurial's internal format:
3375 </p>
3375 </p>
3376 <ul>
3376 <ul>
3377 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3377 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3378 </ul>
3378 </ul>
3379 <p>
3379 <p>
3380 This is the internal representation format for dates. The first number
3380 This is the internal representation format for dates. The first number
3381 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3381 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3382 second is the offset of the local timezone, in seconds west of UTC
3382 second is the offset of the local timezone, in seconds west of UTC
3383 (negative if the timezone is east of UTC).
3383 (negative if the timezone is east of UTC).
3384 </p>
3384 </p>
3385 <p>
3385 <p>
3386 The log command also accepts date ranges:
3386 The log command also accepts date ranges:
3387 </p>
3387 </p>
3388 <ul>
3388 <ul>
3389 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3389 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3390 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3390 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3391 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3391 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3392 <li> &quot;-DAYS&quot; - within a given number of days from today
3392 <li> &quot;-DAYS&quot; - within a given number of days from today
3393 </ul>
3393 </ul>
3394
3394
3395 </div>
3395 </div>
3396 </div>
3396 </div>
3397 </div>
3397 </div>
3398
3398
3399
3399
3400
3400
3401 </body>
3401 </body>
3402 </html>
3402 </html>
3403
3403
3404
3404
3405 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3405 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3406 200 Script output follows
3406 200 Script output follows
3407
3407
3408 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3408 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3409 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3409 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3410 <head>
3410 <head>
3411 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3411 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3412 <meta name="robots" content="index, nofollow" />
3412 <meta name="robots" content="index, nofollow" />
3413 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3413 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3414 <script type="text/javascript" src="/static/mercurial.js"></script>
3414 <script type="text/javascript" src="/static/mercurial.js"></script>
3415
3415
3416 <title>Help: pager</title>
3416 <title>Help: pager</title>
3417 </head>
3417 </head>
3418 <body>
3418 <body>
3419
3419
3420 <div class="container">
3420 <div class="container">
3421 <div class="menu">
3421 <div class="menu">
3422 <div class="logo">
3422 <div class="logo">
3423 <a href="https://mercurial-scm.org/">
3423 <a href="https://mercurial-scm.org/">
3424 <img src="/static/hglogo.png" alt="mercurial" /></a>
3424 <img src="/static/hglogo.png" alt="mercurial" /></a>
3425 </div>
3425 </div>
3426 <ul>
3426 <ul>
3427 <li><a href="/shortlog">log</a></li>
3427 <li><a href="/shortlog">log</a></li>
3428 <li><a href="/graph">graph</a></li>
3428 <li><a href="/graph">graph</a></li>
3429 <li><a href="/tags">tags</a></li>
3429 <li><a href="/tags">tags</a></li>
3430 <li><a href="/bookmarks">bookmarks</a></li>
3430 <li><a href="/bookmarks">bookmarks</a></li>
3431 <li><a href="/branches">branches</a></li>
3431 <li><a href="/branches">branches</a></li>
3432 </ul>
3432 </ul>
3433 <ul>
3433 <ul>
3434 <li class="active"><a href="/help">help</a></li>
3434 <li class="active"><a href="/help">help</a></li>
3435 </ul>
3435 </ul>
3436 </div>
3436 </div>
3437
3437
3438 <div class="main">
3438 <div class="main">
3439 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3439 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3440 <h3>Help: pager</h3>
3440 <h3>Help: pager</h3>
3441
3441
3442 <form class="search" action="/log">
3442 <form class="search" action="/log">
3443
3443
3444 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3444 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3445 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3445 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3446 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3446 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3447 </form>
3447 </form>
3448 <div id="doc">
3448 <div id="doc">
3449 <h1>Pager Support</h1>
3449 <h1>Pager Support</h1>
3450 <p>
3450 <p>
3451 Some Mercurial commands can produce a lot of output, and Mercurial will
3451 Some Mercurial commands can produce a lot of output, and Mercurial will
3452 attempt to use a pager to make those commands more pleasant.
3452 attempt to use a pager to make those commands more pleasant.
3453 </p>
3453 </p>
3454 <p>
3454 <p>
3455 To set the pager that should be used, set the application variable:
3455 To set the pager that should be used, set the application variable:
3456 </p>
3456 </p>
3457 <pre>
3457 <pre>
3458 [pager]
3458 [pager]
3459 pager = less -FRX
3459 pager = less -FRX
3460 </pre>
3460 </pre>
3461 <p>
3461 <p>
3462 If no pager is set in the user or repository configuration, Mercurial uses the
3462 If no pager is set in the user or repository configuration, Mercurial uses the
3463 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3463 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3464 or system configuration is used. If none of these are set, a default pager will
3464 or system configuration is used. If none of these are set, a default pager will
3465 be used, typically 'less' on Unix and 'more' on Windows.
3465 be used, typically 'less' on Unix and 'more' on Windows.
3466 </p>
3466 </p>
3467 <p>
3467 <p>
3468 You can disable the pager for certain commands by adding them to the
3468 You can disable the pager for certain commands by adding them to the
3469 pager.ignore list:
3469 pager.ignore list:
3470 </p>
3470 </p>
3471 <pre>
3471 <pre>
3472 [pager]
3472 [pager]
3473 ignore = version, help, update
3473 ignore = version, help, update
3474 </pre>
3474 </pre>
3475 <p>
3475 <p>
3476 To ignore global commands like 'hg version' or 'hg help', you have
3476 To ignore global commands like 'hg version' or 'hg help', you have
3477 to specify them in your user configuration file.
3477 to specify them in your user configuration file.
3478 </p>
3478 </p>
3479 <p>
3479 <p>
3480 To control whether the pager is used at all for an individual command,
3480 To control whether the pager is used at all for an individual command,
3481 you can use --pager=&lt;value&gt;:
3481 you can use --pager=&lt;value&gt;:
3482 </p>
3482 </p>
3483 <ul>
3483 <ul>
3484 <li> use as needed: 'auto'.
3484 <li> use as needed: 'auto'.
3485 <li> require the pager: 'yes' or 'on'.
3485 <li> require the pager: 'yes' or 'on'.
3486 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3486 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3487 </ul>
3487 </ul>
3488 <p>
3488 <p>
3489 To globally turn off all attempts to use a pager, set:
3489 To globally turn off all attempts to use a pager, set:
3490 </p>
3490 </p>
3491 <pre>
3491 <pre>
3492 [ui]
3492 [ui]
3493 paginate = never
3493 paginate = never
3494 </pre>
3494 </pre>
3495 <p>
3495 <p>
3496 which will prevent the pager from running.
3496 which will prevent the pager from running.
3497 </p>
3497 </p>
3498
3498
3499 </div>
3499 </div>
3500 </div>
3500 </div>
3501 </div>
3501 </div>
3502
3502
3503
3503
3504
3504
3505 </body>
3505 </body>
3506 </html>
3506 </html>
3507
3507
3508
3508
3509 Sub-topic indexes rendered properly
3509 Sub-topic indexes rendered properly
3510
3510
3511 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3511 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3512 200 Script output follows
3512 200 Script output follows
3513
3513
3514 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3514 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3515 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3515 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3516 <head>
3516 <head>
3517 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3517 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3518 <meta name="robots" content="index, nofollow" />
3518 <meta name="robots" content="index, nofollow" />
3519 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3519 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3520 <script type="text/javascript" src="/static/mercurial.js"></script>
3520 <script type="text/javascript" src="/static/mercurial.js"></script>
3521
3521
3522 <title>Help: internals</title>
3522 <title>Help: internals</title>
3523 </head>
3523 </head>
3524 <body>
3524 <body>
3525
3525
3526 <div class="container">
3526 <div class="container">
3527 <div class="menu">
3527 <div class="menu">
3528 <div class="logo">
3528 <div class="logo">
3529 <a href="https://mercurial-scm.org/">
3529 <a href="https://mercurial-scm.org/">
3530 <img src="/static/hglogo.png" alt="mercurial" /></a>
3530 <img src="/static/hglogo.png" alt="mercurial" /></a>
3531 </div>
3531 </div>
3532 <ul>
3532 <ul>
3533 <li><a href="/shortlog">log</a></li>
3533 <li><a href="/shortlog">log</a></li>
3534 <li><a href="/graph">graph</a></li>
3534 <li><a href="/graph">graph</a></li>
3535 <li><a href="/tags">tags</a></li>
3535 <li><a href="/tags">tags</a></li>
3536 <li><a href="/bookmarks">bookmarks</a></li>
3536 <li><a href="/bookmarks">bookmarks</a></li>
3537 <li><a href="/branches">branches</a></li>
3537 <li><a href="/branches">branches</a></li>
3538 </ul>
3538 </ul>
3539 <ul>
3539 <ul>
3540 <li><a href="/help">help</a></li>
3540 <li><a href="/help">help</a></li>
3541 </ul>
3541 </ul>
3542 </div>
3542 </div>
3543
3543
3544 <div class="main">
3544 <div class="main">
3545 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3545 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3546
3546
3547 <form class="search" action="/log">
3547 <form class="search" action="/log">
3548
3548
3549 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3549 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3550 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3550 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3551 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3551 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3552 </form>
3552 </form>
3553 <table class="bigtable">
3553 <table class="bigtable">
3554 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3554 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3555
3555
3556 <tr><td>
3556 <tr><td>
3557 <a href="/help/internals.bid-merge">
3557 <a href="/help/internals.bid-merge">
3558 bid-merge
3558 bid-merge
3559 </a>
3559 </a>
3560 </td><td>
3560 </td><td>
3561 Bid Merge Algorithm
3561 Bid Merge Algorithm
3562 </td></tr>
3562 </td></tr>
3563 <tr><td>
3563 <tr><td>
3564 <a href="/help/internals.bundle2">
3564 <a href="/help/internals.bundle2">
3565 bundle2
3565 bundle2
3566 </a>
3566 </a>
3567 </td><td>
3567 </td><td>
3568 Bundle2
3568 Bundle2
3569 </td></tr>
3569 </td></tr>
3570 <tr><td>
3570 <tr><td>
3571 <a href="/help/internals.bundles">
3571 <a href="/help/internals.bundles">
3572 bundles
3572 bundles
3573 </a>
3573 </a>
3574 </td><td>
3574 </td><td>
3575 Bundles
3575 Bundles
3576 </td></tr>
3576 </td></tr>
3577 <tr><td>
3577 <tr><td>
3578 <a href="/help/internals.cbor">
3578 <a href="/help/internals.cbor">
3579 cbor
3579 cbor
3580 </a>
3580 </a>
3581 </td><td>
3581 </td><td>
3582 CBOR
3582 CBOR
3583 </td></tr>
3583 </td></tr>
3584 <tr><td>
3584 <tr><td>
3585 <a href="/help/internals.censor">
3585 <a href="/help/internals.censor">
3586 censor
3586 censor
3587 </a>
3587 </a>
3588 </td><td>
3588 </td><td>
3589 Censor
3589 Censor
3590 </td></tr>
3590 </td></tr>
3591 <tr><td>
3591 <tr><td>
3592 <a href="/help/internals.changegroups">
3592 <a href="/help/internals.changegroups">
3593 changegroups
3593 changegroups
3594 </a>
3594 </a>
3595 </td><td>
3595 </td><td>
3596 Changegroups
3596 Changegroups
3597 </td></tr>
3597 </td></tr>
3598 <tr><td>
3598 <tr><td>
3599 <a href="/help/internals.config">
3599 <a href="/help/internals.config">
3600 config
3600 config
3601 </a>
3601 </a>
3602 </td><td>
3602 </td><td>
3603 Config Registrar
3603 Config Registrar
3604 </td></tr>
3604 </td></tr>
3605 <tr><td>
3605 <tr><td>
3606 <a href="/help/internals.dirstate-v2">
3606 <a href="/help/internals.dirstate-v2">
3607 dirstate-v2
3607 dirstate-v2
3608 </a>
3608 </a>
3609 </td><td>
3609 </td><td>
3610 dirstate-v2 file format
3610 dirstate-v2 file format
3611 </td></tr>
3611 </td></tr>
3612 <tr><td>
3612 <tr><td>
3613 <a href="/help/internals.extensions">
3613 <a href="/help/internals.extensions">
3614 extensions
3614 extensions
3615 </a>
3615 </a>
3616 </td><td>
3616 </td><td>
3617 Extension API
3617 Extension API
3618 </td></tr>
3618 </td></tr>
3619 <tr><td>
3619 <tr><td>
3620 <a href="/help/internals.mergestate">
3620 <a href="/help/internals.mergestate">
3621 mergestate
3621 mergestate
3622 </a>
3622 </a>
3623 </td><td>
3623 </td><td>
3624 Mergestate
3624 Mergestate
3625 </td></tr>
3625 </td></tr>
3626 <tr><td>
3626 <tr><td>
3627 <a href="/help/internals.requirements">
3627 <a href="/help/internals.requirements">
3628 requirements
3628 requirements
3629 </a>
3629 </a>
3630 </td><td>
3630 </td><td>
3631 Repository Requirements
3631 Repository Requirements
3632 </td></tr>
3632 </td></tr>
3633 <tr><td>
3633 <tr><td>
3634 <a href="/help/internals.revlogs">
3634 <a href="/help/internals.revlogs">
3635 revlogs
3635 revlogs
3636 </a>
3636 </a>
3637 </td><td>
3637 </td><td>
3638 Revision Logs
3638 Revision Logs
3639 </td></tr>
3639 </td></tr>
3640 <tr><td>
3640 <tr><td>
3641 <a href="/help/internals.wireprotocol">
3641 <a href="/help/internals.wireprotocol">
3642 wireprotocol
3642 wireprotocol
3643 </a>
3643 </a>
3644 </td><td>
3644 </td><td>
3645 Wire Protocol
3645 Wire Protocol
3646 </td></tr>
3646 </td></tr>
3647 <tr><td>
3647 <tr><td>
3648 <a href="/help/internals.wireprotocolrpc">
3648 <a href="/help/internals.wireprotocolrpc">
3649 wireprotocolrpc
3649 wireprotocolrpc
3650 </a>
3650 </a>
3651 </td><td>
3651 </td><td>
3652 Wire Protocol RPC
3652 Wire Protocol RPC
3653 </td></tr>
3653 </td></tr>
3654 <tr><td>
3654 <tr><td>
3655 <a href="/help/internals.wireprotocolv2">
3655 <a href="/help/internals.wireprotocolv2">
3656 wireprotocolv2
3656 wireprotocolv2
3657 </a>
3657 </a>
3658 </td><td>
3658 </td><td>
3659 Wire Protocol Version 2
3659 Wire Protocol Version 2
3660 </td></tr>
3660 </td></tr>
3661
3661
3662
3662
3663
3663
3664
3664
3665
3665
3666 </table>
3666 </table>
3667 </div>
3667 </div>
3668 </div>
3668 </div>
3669
3669
3670
3670
3671
3671
3672 </body>
3672 </body>
3673 </html>
3673 </html>
3674
3674
3675
3675
3676 Sub-topic topics rendered properly
3676 Sub-topic topics rendered properly
3677
3677
3678 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3678 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3679 200 Script output follows
3679 200 Script output follows
3680
3680
3681 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3681 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3682 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3682 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3683 <head>
3683 <head>
3684 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3684 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3685 <meta name="robots" content="index, nofollow" />
3685 <meta name="robots" content="index, nofollow" />
3686 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3686 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3687 <script type="text/javascript" src="/static/mercurial.js"></script>
3687 <script type="text/javascript" src="/static/mercurial.js"></script>
3688
3688
3689 <title>Help: internals.changegroups</title>
3689 <title>Help: internals.changegroups</title>
3690 </head>
3690 </head>
3691 <body>
3691 <body>
3692
3692
3693 <div class="container">
3693 <div class="container">
3694 <div class="menu">
3694 <div class="menu">
3695 <div class="logo">
3695 <div class="logo">
3696 <a href="https://mercurial-scm.org/">
3696 <a href="https://mercurial-scm.org/">
3697 <img src="/static/hglogo.png" alt="mercurial" /></a>
3697 <img src="/static/hglogo.png" alt="mercurial" /></a>
3698 </div>
3698 </div>
3699 <ul>
3699 <ul>
3700 <li><a href="/shortlog">log</a></li>
3700 <li><a href="/shortlog">log</a></li>
3701 <li><a href="/graph">graph</a></li>
3701 <li><a href="/graph">graph</a></li>
3702 <li><a href="/tags">tags</a></li>
3702 <li><a href="/tags">tags</a></li>
3703 <li><a href="/bookmarks">bookmarks</a></li>
3703 <li><a href="/bookmarks">bookmarks</a></li>
3704 <li><a href="/branches">branches</a></li>
3704 <li><a href="/branches">branches</a></li>
3705 </ul>
3705 </ul>
3706 <ul>
3706 <ul>
3707 <li class="active"><a href="/help">help</a></li>
3707 <li class="active"><a href="/help">help</a></li>
3708 </ul>
3708 </ul>
3709 </div>
3709 </div>
3710
3710
3711 <div class="main">
3711 <div class="main">
3712 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3712 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3713 <h3>Help: internals.changegroups</h3>
3713 <h3>Help: internals.changegroups</h3>
3714
3714
3715 <form class="search" action="/log">
3715 <form class="search" action="/log">
3716
3716
3717 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3717 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3718 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3718 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3719 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3719 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3720 </form>
3720 </form>
3721 <div id="doc">
3721 <div id="doc">
3722 <h1>Changegroups</h1>
3722 <h1>Changegroups</h1>
3723 <p>
3723 <p>
3724 Changegroups are representations of repository revlog data, specifically
3724 Changegroups are representations of repository revlog data, specifically
3725 the changelog data, root/flat manifest data, treemanifest data, and
3725 the changelog data, root/flat manifest data, treemanifest data, and
3726 filelogs.
3726 filelogs.
3727 </p>
3727 </p>
3728 <p>
3728 <p>
3729 There are 4 versions of changegroups: &quot;1&quot;, &quot;2&quot;, &quot;3&quot; and &quot;4&quot;. From a
3729 There are 4 versions of changegroups: &quot;1&quot;, &quot;2&quot;, &quot;3&quot; and &quot;4&quot;. From a
3730 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3730 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3731 only difference being an additional item in the *delta header*. Version
3731 only difference being an additional item in the *delta header*. Version
3732 &quot;3&quot; adds support for storage flags in the *delta header* and optionally
3732 &quot;3&quot; adds support for storage flags in the *delta header* and optionally
3733 exchanging treemanifests (enabled by setting an option on the
3733 exchanging treemanifests (enabled by setting an option on the
3734 &quot;changegroup&quot; part in the bundle2). Version &quot;4&quot; adds support for exchanging
3734 &quot;changegroup&quot; part in the bundle2). Version &quot;4&quot; adds support for exchanging
3735 sidedata (additional revision metadata not part of the digest).
3735 sidedata (additional revision metadata not part of the digest).
3736 </p>
3736 </p>
3737 <p>
3737 <p>
3738 Changegroups when not exchanging treemanifests consist of 3 logical
3738 Changegroups when not exchanging treemanifests consist of 3 logical
3739 segments:
3739 segments:
3740 </p>
3740 </p>
3741 <pre>
3741 <pre>
3742 +---------------------------------+
3742 +---------------------------------+
3743 | | | |
3743 | | | |
3744 | changeset | manifest | filelogs |
3744 | changeset | manifest | filelogs |
3745 | | | |
3745 | | | |
3746 | | | |
3746 | | | |
3747 +---------------------------------+
3747 +---------------------------------+
3748 </pre>
3748 </pre>
3749 <p>
3749 <p>
3750 When exchanging treemanifests, there are 4 logical segments:
3750 When exchanging treemanifests, there are 4 logical segments:
3751 </p>
3751 </p>
3752 <pre>
3752 <pre>
3753 +-------------------------------------------------+
3753 +-------------------------------------------------+
3754 | | | | |
3754 | | | | |
3755 | changeset | root | treemanifests | filelogs |
3755 | changeset | root | treemanifests | filelogs |
3756 | | manifest | | |
3756 | | manifest | | |
3757 | | | | |
3757 | | | | |
3758 +-------------------------------------------------+
3758 +-------------------------------------------------+
3759 </pre>
3759 </pre>
3760 <p>
3760 <p>
3761 The principle building block of each segment is a *chunk*. A *chunk*
3761 The principle building block of each segment is a *chunk*. A *chunk*
3762 is a framed piece of data:
3762 is a framed piece of data:
3763 </p>
3763 </p>
3764 <pre>
3764 <pre>
3765 +---------------------------------------+
3765 +---------------------------------------+
3766 | | |
3766 | | |
3767 | length | data |
3767 | length | data |
3768 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3768 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3769 | | |
3769 | | |
3770 +---------------------------------------+
3770 +---------------------------------------+
3771 </pre>
3771 </pre>
3772 <p>
3772 <p>
3773 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3773 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3774 integer indicating the length of the entire chunk (including the length field
3774 integer indicating the length of the entire chunk (including the length field
3775 itself).
3775 itself).
3776 </p>
3776 </p>
3777 <p>
3777 <p>
3778 There is a special case chunk that has a value of 0 for the length
3778 There is a special case chunk that has a value of 0 for the length
3779 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3779 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3780 </p>
3780 </p>
3781 <h2>Delta Groups</h2>
3781 <h2>Delta Groups</h2>
3782 <p>
3782 <p>
3783 A *delta group* expresses the content of a revlog as a series of deltas,
3783 A *delta group* expresses the content of a revlog as a series of deltas,
3784 or patches against previous revisions.
3784 or patches against previous revisions.
3785 </p>
3785 </p>
3786 <p>
3786 <p>
3787 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3787 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3788 to signal the end of the delta group:
3788 to signal the end of the delta group:
3789 </p>
3789 </p>
3790 <pre>
3790 <pre>
3791 +------------------------------------------------------------------------+
3791 +------------------------------------------------------------------------+
3792 | | | | | |
3792 | | | | | |
3793 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3793 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3794 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3794 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3795 | | | | | |
3795 | | | | | |
3796 +------------------------------------------------------------------------+
3796 +------------------------------------------------------------------------+
3797 </pre>
3797 </pre>
3798 <p>
3798 <p>
3799 Each *chunk*'s data consists of the following:
3799 Each *chunk*'s data consists of the following:
3800 </p>
3800 </p>
3801 <pre>
3801 <pre>
3802 +---------------------------------------+
3802 +---------------------------------------+
3803 | | |
3803 | | |
3804 | delta header | delta data |
3804 | delta header | delta data |
3805 | (various by version) | (various) |
3805 | (various by version) | (various) |
3806 | | |
3806 | | |
3807 +---------------------------------------+
3807 +---------------------------------------+
3808 </pre>
3808 </pre>
3809 <p>
3809 <p>
3810 The *delta data* is a series of *delta*s that describe a diff from an existing
3810 The *delta data* is a series of *delta*s that describe a diff from an existing
3811 entry (either that the recipient already has, or previously specified in the
3811 entry (either that the recipient already has, or previously specified in the
3812 bundle/changegroup).
3812 bundle/changegroup).
3813 </p>
3813 </p>
3814 <p>
3814 <p>
3815 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, &quot;3&quot; and &quot;4&quot;
3815 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, &quot;3&quot; and &quot;4&quot;
3816 of the changegroup format.
3816 of the changegroup format.
3817 </p>
3817 </p>
3818 <p>
3818 <p>
3819 Version 1 (headerlen=80):
3819 Version 1 (headerlen=80):
3820 </p>
3820 </p>
3821 <pre>
3821 <pre>
3822 +------------------------------------------------------+
3822 +------------------------------------------------------+
3823 | | | | |
3823 | | | | |
3824 | node | p1 node | p2 node | link node |
3824 | node | p1 node | p2 node | link node |
3825 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3825 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3826 | | | | |
3826 | | | | |
3827 +------------------------------------------------------+
3827 +------------------------------------------------------+
3828 </pre>
3828 </pre>
3829 <p>
3829 <p>
3830 Version 2 (headerlen=100):
3830 Version 2 (headerlen=100):
3831 </p>
3831 </p>
3832 <pre>
3832 <pre>
3833 +------------------------------------------------------------------+
3833 +------------------------------------------------------------------+
3834 | | | | | |
3834 | | | | | |
3835 | node | p1 node | p2 node | base node | link node |
3835 | node | p1 node | p2 node | base node | link node |
3836 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3836 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3837 | | | | | |
3837 | | | | | |
3838 +------------------------------------------------------------------+
3838 +------------------------------------------------------------------+
3839 </pre>
3839 </pre>
3840 <p>
3840 <p>
3841 Version 3 (headerlen=102):
3841 Version 3 (headerlen=102):
3842 </p>
3842 </p>
3843 <pre>
3843 <pre>
3844 +------------------------------------------------------------------------------+
3844 +------------------------------------------------------------------------------+
3845 | | | | | | |
3845 | | | | | | |
3846 | node | p1 node | p2 node | base node | link node | flags |
3846 | node | p1 node | p2 node | base node | link node | flags |
3847 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3847 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3848 | | | | | | |
3848 | | | | | | |
3849 +------------------------------------------------------------------------------+
3849 +------------------------------------------------------------------------------+
3850 </pre>
3850 </pre>
3851 <p>
3851 <p>
3852 Version 4 (headerlen=103):
3852 Version 4 (headerlen=103):
3853 </p>
3853 </p>
3854 <pre>
3854 <pre>
3855 +------------------------------------------------------------------------------+----------+
3855 +------------------------------------------------------------------------------+----------+
3856 | | | | | | | |
3856 | | | | | | | |
3857 | node | p1 node | p2 node | base node | link node | flags | pflags |
3857 | node | p1 node | p2 node | base node | link node | flags | pflags |
3858 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | (1 byte) |
3858 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | (1 byte) |
3859 | | | | | | | |
3859 | | | | | | | |
3860 +------------------------------------------------------------------------------+----------+
3860 +------------------------------------------------------------------------------+----------+
3861 </pre>
3861 </pre>
3862 <p>
3862 <p>
3863 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3863 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3864 series of *delta*s, densely packed (no separators). These deltas describe a diff
3864 series of *delta*s, densely packed (no separators). These deltas describe a diff
3865 from an existing entry (either that the recipient already has, or previously
3865 from an existing entry (either that the recipient already has, or previously
3866 specified in the bundle/changegroup). The format is described more fully in
3866 specified in the bundle/changegroup). The format is described more fully in
3867 &quot;hg help internals.bdiff&quot;, but briefly:
3867 &quot;hg help internals.bdiff&quot;, but briefly:
3868 </p>
3868 </p>
3869 <pre>
3869 <pre>
3870 +---------------------------------------------------------------+
3870 +---------------------------------------------------------------+
3871 | | | | |
3871 | | | | |
3872 | start offset | end offset | new length | content |
3872 | start offset | end offset | new length | content |
3873 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3873 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3874 | | | | |
3874 | | | | |
3875 +---------------------------------------------------------------+
3875 +---------------------------------------------------------------+
3876 </pre>
3876 </pre>
3877 <p>
3877 <p>
3878 Please note that the length field in the delta data does *not* include itself.
3878 Please note that the length field in the delta data does *not* include itself.
3879 </p>
3879 </p>
3880 <p>
3880 <p>
3881 In version 1, the delta is always applied against the previous node from
3881 In version 1, the delta is always applied against the previous node from
3882 the changegroup or the first parent if this is the first entry in the
3882 the changegroup or the first parent if this is the first entry in the
3883 changegroup.
3883 changegroup.
3884 </p>
3884 </p>
3885 <p>
3885 <p>
3886 In version 2 and up, the delta base node is encoded in the entry in the
3886 In version 2 and up, the delta base node is encoded in the entry in the
3887 changegroup. This allows the delta to be expressed against any parent,
3887 changegroup. This allows the delta to be expressed against any parent,
3888 which can result in smaller deltas and more efficient encoding of data.
3888 which can result in smaller deltas and more efficient encoding of data.
3889 </p>
3889 </p>
3890 <p>
3890 <p>
3891 The *flags* field holds bitwise flags affecting the processing of revision
3891 The *flags* field holds bitwise flags affecting the processing of revision
3892 data. The following flags are defined:
3892 data. The following flags are defined:
3893 </p>
3893 </p>
3894 <dl>
3894 <dl>
3895 <dt>32768
3895 <dt>32768
3896 <dd>Censored revision. The revision's fulltext has been replaced by censor metadata. May only occur on file revisions.
3896 <dd>Censored revision. The revision's fulltext has been replaced by censor metadata. May only occur on file revisions.
3897 <dt>16384
3897 <dt>16384
3898 <dd>Ellipsis revision. Revision hash does not match data (likely due to rewritten parents).
3898 <dd>Ellipsis revision. Revision hash does not match data (likely due to rewritten parents).
3899 <dt>8192
3899 <dt>8192
3900 <dd>Externally stored. The revision fulltext contains &quot;key:value&quot; &quot;\n&quot; delimited metadata defining an object stored elsewhere. Used by the LFS extension.
3900 <dd>Externally stored. The revision fulltext contains &quot;key:value&quot; &quot;\n&quot; delimited metadata defining an object stored elsewhere. Used by the LFS extension.
3901 <dt>4096
3901 <dt>4096
3902 <dd>Contains copy information. This revision changes files in a way that could affect copy tracing. This does *not* affect changegroup handling, but is relevant for other parts of Mercurial.
3902 <dd>Contains copy information. This revision changes files in a way that could affect copy tracing. This does *not* affect changegroup handling, but is relevant for other parts of Mercurial.
3903 </dl>
3903 </dl>
3904 <p>
3904 <p>
3905 For historical reasons, the integer values are identical to revlog version 1
3905 For historical reasons, the integer values are identical to revlog version 1
3906 per-revision storage flags and correspond to bits being set in this 2-byte
3906 per-revision storage flags and correspond to bits being set in this 2-byte
3907 field. Bits were allocated starting from the most-significant bit, hence the
3907 field. Bits were allocated starting from the most-significant bit, hence the
3908 reverse ordering and allocation of these flags.
3908 reverse ordering and allocation of these flags.
3909 </p>
3909 </p>
3910 <p>
3910 <p>
3911 The *pflags* (protocol flags) field holds bitwise flags affecting the protocol
3911 The *pflags* (protocol flags) field holds bitwise flags affecting the protocol
3912 itself. They are first in the header since they may affect the handling of the
3912 itself. They are first in the header since they may affect the handling of the
3913 rest of the fields in a future version. They are defined as such:
3913 rest of the fields in a future version. They are defined as such:
3914 </p>
3914 </p>
3915 <dl>
3915 <dl>
3916 <dt>1 indicates whether to read a chunk of sidedata (of variable length) right
3916 <dt>1 indicates whether to read a chunk of sidedata (of variable length) right
3917 <dd>after the revision flags.
3917 <dd>after the revision flags.
3918 </dl>
3918 </dl>
3919 <h2>Changeset Segment</h2>
3919 <h2>Changeset Segment</h2>
3920 <p>
3920 <p>
3921 The *changeset segment* consists of a single *delta group* holding
3921 The *changeset segment* consists of a single *delta group* holding
3922 changelog data. The *empty chunk* at the end of the *delta group* denotes
3922 changelog data. The *empty chunk* at the end of the *delta group* denotes
3923 the boundary to the *manifest segment*.
3923 the boundary to the *manifest segment*.
3924 </p>
3924 </p>
3925 <h2>Manifest Segment</h2>
3925 <h2>Manifest Segment</h2>
3926 <p>
3926 <p>
3927 The *manifest segment* consists of a single *delta group* holding manifest
3927 The *manifest segment* consists of a single *delta group* holding manifest
3928 data. If treemanifests are in use, it contains only the manifest for the
3928 data. If treemanifests are in use, it contains only the manifest for the
3929 root directory of the repository. Otherwise, it contains the entire
3929 root directory of the repository. Otherwise, it contains the entire
3930 manifest data. The *empty chunk* at the end of the *delta group* denotes
3930 manifest data. The *empty chunk* at the end of the *delta group* denotes
3931 the boundary to the next segment (either the *treemanifests segment* or the
3931 the boundary to the next segment (either the *treemanifests segment* or the
3932 *filelogs segment*, depending on version and the request options).
3932 *filelogs segment*, depending on version and the request options).
3933 </p>
3933 </p>
3934 <h3>Treemanifests Segment</h3>
3934 <h3>Treemanifests Segment</h3>
3935 <p>
3935 <p>
3936 The *treemanifests segment* only exists in changegroup version &quot;3&quot; and &quot;4&quot;,
3936 The *treemanifests segment* only exists in changegroup version &quot;3&quot; and &quot;4&quot;,
3937 and only if the 'treemanifest' param is part of the bundle2 changegroup part
3937 and only if the 'treemanifest' param is part of the bundle2 changegroup part
3938 (it is not possible to use changegroup version 3 or 4 outside of bundle2).
3938 (it is not possible to use changegroup version 3 or 4 outside of bundle2).
3939 Aside from the filenames in the *treemanifests segment* containing a
3939 Aside from the filenames in the *treemanifests segment* containing a
3940 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3940 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3941 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3941 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3942 a sub-segment with filename size 0). This denotes the boundary to the
3942 a sub-segment with filename size 0). This denotes the boundary to the
3943 *filelogs segment*.
3943 *filelogs segment*.
3944 </p>
3944 </p>
3945 <h2>Filelogs Segment</h2>
3945 <h2>Filelogs Segment</h2>
3946 <p>
3946 <p>
3947 The *filelogs segment* consists of multiple sub-segments, each
3947 The *filelogs segment* consists of multiple sub-segments, each
3948 corresponding to an individual file whose data is being described:
3948 corresponding to an individual file whose data is being described:
3949 </p>
3949 </p>
3950 <pre>
3950 <pre>
3951 +--------------------------------------------------+
3951 +--------------------------------------------------+
3952 | | | | | |
3952 | | | | | |
3953 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3953 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3954 | | | | | (4 bytes) |
3954 | | | | | (4 bytes) |
3955 | | | | | |
3955 | | | | | |
3956 +--------------------------------------------------+
3956 +--------------------------------------------------+
3957 </pre>
3957 </pre>
3958 <p>
3958 <p>
3959 The final filelog sub-segment is followed by an *empty chunk* (logically,
3959 The final filelog sub-segment is followed by an *empty chunk* (logically,
3960 a sub-segment with filename size 0). This denotes the end of the segment
3960 a sub-segment with filename size 0). This denotes the end of the segment
3961 and of the overall changegroup.
3961 and of the overall changegroup.
3962 </p>
3962 </p>
3963 <p>
3963 <p>
3964 Each filelog sub-segment consists of the following:
3964 Each filelog sub-segment consists of the following:
3965 </p>
3965 </p>
3966 <pre>
3966 <pre>
3967 +------------------------------------------------------+
3967 +------------------------------------------------------+
3968 | | | |
3968 | | | |
3969 | filename length | filename | delta group |
3969 | filename length | filename | delta group |
3970 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3970 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3971 | | | |
3971 | | | |
3972 +------------------------------------------------------+
3972 +------------------------------------------------------+
3973 </pre>
3973 </pre>
3974 <p>
3974 <p>
3975 That is, a *chunk* consisting of the filename (not terminated or padded)
3975 That is, a *chunk* consisting of the filename (not terminated or padded)
3976 followed by N chunks constituting the *delta group* for this file. The
3976 followed by N chunks constituting the *delta group* for this file. The
3977 *empty chunk* at the end of each *delta group* denotes the boundary to the
3977 *empty chunk* at the end of each *delta group* denotes the boundary to the
3978 next filelog sub-segment.
3978 next filelog sub-segment.
3979 </p>
3979 </p>
3980
3980
3981 </div>
3981 </div>
3982 </div>
3982 </div>
3983 </div>
3983 </div>
3984
3984
3985
3985
3986
3986
3987 </body>
3987 </body>
3988 </html>
3988 </html>
3989
3989
3990
3990
3991 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3991 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3992 404 Not Found
3992 404 Not Found
3993
3993
3994 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3994 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3995 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3995 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3996 <head>
3996 <head>
3997 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3997 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3998 <meta name="robots" content="index, nofollow" />
3998 <meta name="robots" content="index, nofollow" />
3999 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3999 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
4000 <script type="text/javascript" src="/static/mercurial.js"></script>
4000 <script type="text/javascript" src="/static/mercurial.js"></script>
4001
4001
4002 <title>test: error</title>
4002 <title>test: error</title>
4003 </head>
4003 </head>
4004 <body>
4004 <body>
4005
4005
4006 <div class="container">
4006 <div class="container">
4007 <div class="menu">
4007 <div class="menu">
4008 <div class="logo">
4008 <div class="logo">
4009 <a href="https://mercurial-scm.org/">
4009 <a href="https://mercurial-scm.org/">
4010 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
4010 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
4011 </div>
4011 </div>
4012 <ul>
4012 <ul>
4013 <li><a href="/shortlog">log</a></li>
4013 <li><a href="/shortlog">log</a></li>
4014 <li><a href="/graph">graph</a></li>
4014 <li><a href="/graph">graph</a></li>
4015 <li><a href="/tags">tags</a></li>
4015 <li><a href="/tags">tags</a></li>
4016 <li><a href="/bookmarks">bookmarks</a></li>
4016 <li><a href="/bookmarks">bookmarks</a></li>
4017 <li><a href="/branches">branches</a></li>
4017 <li><a href="/branches">branches</a></li>
4018 </ul>
4018 </ul>
4019 <ul>
4019 <ul>
4020 <li><a href="/help">help</a></li>
4020 <li><a href="/help">help</a></li>
4021 </ul>
4021 </ul>
4022 </div>
4022 </div>
4023
4023
4024 <div class="main">
4024 <div class="main">
4025
4025
4026 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
4026 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
4027 <h3>error</h3>
4027 <h3>error</h3>
4028
4028
4029
4029
4030 <form class="search" action="/log">
4030 <form class="search" action="/log">
4031
4031
4032 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
4032 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
4033 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
4033 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
4034 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
4034 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
4035 </form>
4035 </form>
4036
4036
4037 <div class="description">
4037 <div class="description">
4038 <p>
4038 <p>
4039 An error occurred while processing your request:
4039 An error occurred while processing your request:
4040 </p>
4040 </p>
4041 <p>
4041 <p>
4042 Not Found
4042 Not Found
4043 </p>
4043 </p>
4044 </div>
4044 </div>
4045 </div>
4045 </div>
4046 </div>
4046 </div>
4047
4047
4048
4048
4049
4049
4050 </body>
4050 </body>
4051 </html>
4051 </html>
4052
4052
4053 [1]
4053 [1]
4054
4054
4055 $ killdaemons.py
4055 $ killdaemons.py
4056
4056
4057 #endif
4057 #endif
@@ -1,163 +1,163
1 ==============================
1 ==============================
2 Test the "tracked key" feature
2 Test the "tracked key" feature
3 ==============================
3 ==============================
4
4
5 The tracked key feature provide a file that get updated when the set of tracked
5 The tracked key feature provide a file that get updated when the set of tracked
6 files get updated.
6 files get updated.
7
7
8 basic setup
8 basic setup
9
9
10 $ cat << EOF >> $HGRCPATH
10 $ cat << EOF >> $HGRCPATH
11 > [format]
11 > [format]
12 > exp-dirstate-tracked-key-version=1
12 > dirstate-tracked-key=yes
13 > EOF
13 > EOF
14
14
15 $ hg init tracked-key-test
15 $ hg init tracked-key-test
16 $ cd tracked-key-test
16 $ cd tracked-key-test
17 $ hg debugbuilddag '.+10' -n
17 $ hg debugbuilddag '.+10' -n
18 $ hg log -G -T '{rev} {desc} {files}\n'
18 $ hg log -G -T '{rev} {desc} {files}\n'
19 o 10 r10 nf10
19 o 10 r10 nf10
20 |
20 |
21 o 9 r9 nf9
21 o 9 r9 nf9
22 |
22 |
23 o 8 r8 nf8
23 o 8 r8 nf8
24 |
24 |
25 o 7 r7 nf7
25 o 7 r7 nf7
26 |
26 |
27 o 6 r6 nf6
27 o 6 r6 nf6
28 |
28 |
29 o 5 r5 nf5
29 o 5 r5 nf5
30 |
30 |
31 o 4 r4 nf4
31 o 4 r4 nf4
32 |
32 |
33 o 3 r3 nf3
33 o 3 r3 nf3
34 |
34 |
35 o 2 r2 nf2
35 o 2 r2 nf2
36 |
36 |
37 o 1 r1 nf1
37 o 1 r1 nf1
38 |
38 |
39 o 0 r0 nf0
39 o 0 r0 nf0
40
40
41 $ hg up tip
41 $ hg up tip
42 11 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 11 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 $ hg files
43 $ hg files
44 nf0
44 nf0
45 nf1
45 nf1
46 nf10
46 nf10
47 nf2
47 nf2
48 nf3
48 nf3
49 nf4
49 nf4
50 nf5
50 nf5
51 nf6
51 nf6
52 nf7
52 nf7
53 nf8
53 nf8
54 nf9
54 nf9
55
55
56 key-file exists
56 key-file exists
57 -----------
57 -----------
58
58
59 The tracked key file should exist
59 The tracked key file should exist
60
60
61 $ ls -1 .hg/dirstate*
61 $ ls -1 .hg/dirstate*
62 .hg/dirstate
62 .hg/dirstate
63 .hg/dirstate-tracked-key
63 .hg/dirstate-tracked-key
64
64
65 key-file stay the same if the tracked set is unchanged
65 key-file stay the same if the tracked set is unchanged
66 ------------------------------------------------------
66 ------------------------------------------------------
67
67
68 (copy its content for later comparison)
68 (copy its content for later comparison)
69
69
70 $ cp .hg/dirstate-tracked-key ../key-bck
70 $ cp .hg/dirstate-tracked-key ../key-bck
71 $ echo foo >> nf0
71 $ echo foo >> nf0
72 $ sleep 1
72 $ sleep 1
73 $ hg status
73 $ hg status
74 M nf0
74 M nf0
75 $ diff --brief .hg/dirstate-tracked-key ../key-bck
75 $ diff --brief .hg/dirstate-tracked-key ../key-bck
76 $ hg revert -C nf0
76 $ hg revert -C nf0
77 $ sleep 1
77 $ sleep 1
78 $ hg status
78 $ hg status
79 $ diff --brief .hg/dirstate-tracked-key ../key-bck
79 $ diff --brief .hg/dirstate-tracked-key ../key-bck
80
80
81 key-file change if the tracked set is changed manually
81 key-file change if the tracked set is changed manually
82 ------------------------------------------------------
82 ------------------------------------------------------
83
83
84 adding a file to tracking
84 adding a file to tracking
85
85
86 $ cp .hg/dirstate-tracked-key ../key-bck
86 $ cp .hg/dirstate-tracked-key ../key-bck
87 $ echo x > x
87 $ echo x > x
88 $ hg add x
88 $ hg add x
89 $ diff --brief .hg/dirstate-tracked-key ../key-bck
89 $ diff --brief .hg/dirstate-tracked-key ../key-bck
90 Files .hg/dirstate-tracked-key and ../key-bck differ
90 Files .hg/dirstate-tracked-key and ../key-bck differ
91 [1]
91 [1]
92
92
93 remove a file from tracking
93 remove a file from tracking
94 (forget)
94 (forget)
95
95
96 $ cp .hg/dirstate-tracked-key ../key-bck
96 $ cp .hg/dirstate-tracked-key ../key-bck
97 $ hg forget x
97 $ hg forget x
98 $ diff --brief .hg/dirstate-tracked-key ../key-bck
98 $ diff --brief .hg/dirstate-tracked-key ../key-bck
99 Files .hg/dirstate-tracked-key and ../key-bck differ
99 Files .hg/dirstate-tracked-key and ../key-bck differ
100 [1]
100 [1]
101
101
102 (remove)
102 (remove)
103
103
104 $ cp .hg/dirstate-tracked-key ../key-bck
104 $ cp .hg/dirstate-tracked-key ../key-bck
105 $ hg remove nf1
105 $ hg remove nf1
106 $ diff --brief .hg/dirstate-tracked-key ../key-bck
106 $ diff --brief .hg/dirstate-tracked-key ../key-bck
107 Files .hg/dirstate-tracked-key and ../key-bck differ
107 Files .hg/dirstate-tracked-key and ../key-bck differ
108 [1]
108 [1]
109
109
110 key-file changes on revert (when applicable)
110 key-file changes on revert (when applicable)
111 --------------------------------------------
111 --------------------------------------------
112
112
113 $ cp .hg/dirstate-tracked-key ../key-bck
113 $ cp .hg/dirstate-tracked-key ../key-bck
114 $ hg status
114 $ hg status
115 R nf1
115 R nf1
116 ? x
116 ? x
117 $ hg revert --all
117 $ hg revert --all
118 undeleting nf1
118 undeleting nf1
119 $ hg status
119 $ hg status
120 ? x
120 ? x
121 $ diff --brief .hg/dirstate-tracked-key ../key-bck
121 $ diff --brief .hg/dirstate-tracked-key ../key-bck
122 Files .hg/dirstate-tracked-key and ../key-bck differ
122 Files .hg/dirstate-tracked-key and ../key-bck differ
123 [1]
123 [1]
124
124
125
125
126 `hg update` does affect the key-file (when needed)
126 `hg update` does affect the key-file (when needed)
127 --------------------------------------------------
127 --------------------------------------------------
128
128
129 update changing the tracked set
129 update changing the tracked set
130
130
131 (removing)
131 (removing)
132
132
133 $ cp .hg/dirstate-tracked-key ../key-bck
133 $ cp .hg/dirstate-tracked-key ../key-bck
134 $ hg status --rev . --rev '.#generations[-1]'
134 $ hg status --rev . --rev '.#generations[-1]'
135 R nf10
135 R nf10
136 $ hg up '.#generations[-1]'
136 $ hg up '.#generations[-1]'
137 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
137 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
138 $ diff --brief .hg/dirstate-tracked-key ../key-bck
138 $ diff --brief .hg/dirstate-tracked-key ../key-bck
139 Files .hg/dirstate-tracked-key and ../key-bck differ
139 Files .hg/dirstate-tracked-key and ../key-bck differ
140 [1]
140 [1]
141
141
142 (adding)
142 (adding)
143
143
144 $ cp .hg/dirstate-tracked-key ../key-bck
144 $ cp .hg/dirstate-tracked-key ../key-bck
145 $ hg status --rev . --rev '.#generations[1]'
145 $ hg status --rev . --rev '.#generations[1]'
146 A nf10
146 A nf10
147 $ hg up '.#generations[1]'
147 $ hg up '.#generations[1]'
148 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
148 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 $ diff --brief .hg/dirstate-tracked-key ../key-bck
149 $ diff --brief .hg/dirstate-tracked-key ../key-bck
150 Files .hg/dirstate-tracked-key and ../key-bck differ
150 Files .hg/dirstate-tracked-key and ../key-bck differ
151 [1]
151 [1]
152
152
153 update not affecting the tracked set
153 update not affecting the tracked set
154
154
155 $ echo foo >> nf0
155 $ echo foo >> nf0
156 $ hg commit -m foo
156 $ hg commit -m foo
157
157
158 $ cp .hg/dirstate-tracked-key ../key-bck
158 $ cp .hg/dirstate-tracked-key ../key-bck
159 $ hg status --rev . --rev '.#generations[-1]'
159 $ hg status --rev . --rev '.#generations[-1]'
160 M nf0
160 M nf0
161 $ hg up '.#generations[-1]'
161 $ hg up '.#generations[-1]'
162 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
162 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
163 $ diff --brief .hg/dirstate-tracked-key ../key-bck
163 $ diff --brief .hg/dirstate-tracked-key ../key-bck
General Comments 0
You need to be logged in to leave comments. Login now