##// END OF EJS Templates
configitems: add a default value for "merge-tools.xxx.regappend"...
Matt Harbison -
r50539:5744ceeb default
parent child Browse files
Show More
@@ -1,2889 +1,2896 b''
1 # configitems.py - centralized declaration of configuration option
1 # configitems.py - centralized declaration of configuration option
2 #
2 #
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8
8
9 import functools
9 import functools
10 import re
10 import re
11
11
12 from . import (
12 from . import (
13 encoding,
13 encoding,
14 error,
14 error,
15 )
15 )
16
16
17
17
18 def loadconfigtable(ui, extname, configtable):
18 def loadconfigtable(ui, extname, configtable):
19 """update config item known to the ui with the extension ones"""
19 """update config item known to the ui with the extension ones"""
20 for section, items in sorted(configtable.items()):
20 for section, items in sorted(configtable.items()):
21 knownitems = ui._knownconfig.setdefault(section, itemregister())
21 knownitems = ui._knownconfig.setdefault(section, itemregister())
22 knownkeys = set(knownitems)
22 knownkeys = set(knownitems)
23 newkeys = set(items)
23 newkeys = set(items)
24 for key in sorted(knownkeys & newkeys):
24 for key in sorted(knownkeys & newkeys):
25 msg = b"extension '%s' overwrite config item '%s.%s'"
25 msg = b"extension '%s' overwrite config item '%s.%s'"
26 msg %= (extname, section, key)
26 msg %= (extname, section, key)
27 ui.develwarn(msg, config=b'warn-config')
27 ui.develwarn(msg, config=b'warn-config')
28
28
29 knownitems.update(items)
29 knownitems.update(items)
30
30
31
31
32 class configitem:
32 class configitem:
33 """represent a known config item
33 """represent a known config item
34
34
35 :section: the official config section where to find this item,
35 :section: the official config section where to find this item,
36 :name: the official name within the section,
36 :name: the official name within the section,
37 :default: default value for this item,
37 :default: default value for this item,
38 :alias: optional list of tuples as alternatives,
38 :alias: optional list of tuples as alternatives,
39 :generic: this is a generic definition, match name using regular expression.
39 :generic: this is a generic definition, match name using regular expression.
40 """
40 """
41
41
42 def __init__(
42 def __init__(
43 self,
43 self,
44 section,
44 section,
45 name,
45 name,
46 default=None,
46 default=None,
47 alias=(),
47 alias=(),
48 generic=False,
48 generic=False,
49 priority=0,
49 priority=0,
50 experimental=False,
50 experimental=False,
51 ):
51 ):
52 self.section = section
52 self.section = section
53 self.name = name
53 self.name = name
54 self.default = default
54 self.default = default
55 self.alias = list(alias)
55 self.alias = list(alias)
56 self.generic = generic
56 self.generic = generic
57 self.priority = priority
57 self.priority = priority
58 self.experimental = experimental
58 self.experimental = experimental
59 self._re = None
59 self._re = None
60 if generic:
60 if generic:
61 self._re = re.compile(self.name)
61 self._re = re.compile(self.name)
62
62
63
63
64 class itemregister(dict):
64 class itemregister(dict):
65 """A specialized dictionary that can handle wild-card selection"""
65 """A specialized dictionary that can handle wild-card selection"""
66
66
67 def __init__(self):
67 def __init__(self):
68 super(itemregister, self).__init__()
68 super(itemregister, self).__init__()
69 self._generics = set()
69 self._generics = set()
70
70
71 def update(self, other):
71 def update(self, other):
72 super(itemregister, self).update(other)
72 super(itemregister, self).update(other)
73 self._generics.update(other._generics)
73 self._generics.update(other._generics)
74
74
75 def __setitem__(self, key, item):
75 def __setitem__(self, key, item):
76 super(itemregister, self).__setitem__(key, item)
76 super(itemregister, self).__setitem__(key, item)
77 if item.generic:
77 if item.generic:
78 self._generics.add(item)
78 self._generics.add(item)
79
79
80 def get(self, key):
80 def get(self, key):
81 baseitem = super(itemregister, self).get(key)
81 baseitem = super(itemregister, self).get(key)
82 if baseitem is not None and not baseitem.generic:
82 if baseitem is not None and not baseitem.generic:
83 return baseitem
83 return baseitem
84
84
85 # search for a matching generic item
85 # search for a matching generic item
86 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
86 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
87 for item in generics:
87 for item in generics:
88 # we use 'match' instead of 'search' to make the matching simpler
88 # we use 'match' instead of 'search' to make the matching simpler
89 # for people unfamiliar with regular expression. Having the match
89 # for people unfamiliar with regular expression. Having the match
90 # rooted to the start of the string will produce less surprising
90 # rooted to the start of the string will produce less surprising
91 # result for user writing simple regex for sub-attribute.
91 # result for user writing simple regex for sub-attribute.
92 #
92 #
93 # For example using "color\..*" match produces an unsurprising
93 # For example using "color\..*" match produces an unsurprising
94 # result, while using search could suddenly match apparently
94 # result, while using search could suddenly match apparently
95 # unrelated configuration that happens to contains "color."
95 # unrelated configuration that happens to contains "color."
96 # anywhere. This is a tradeoff where we favor requiring ".*" on
96 # anywhere. This is a tradeoff where we favor requiring ".*" on
97 # some match to avoid the need to prefix most pattern with "^".
97 # some match to avoid the need to prefix most pattern with "^".
98 # The "^" seems more error prone.
98 # The "^" seems more error prone.
99 if item._re.match(key):
99 if item._re.match(key):
100 return item
100 return item
101
101
102 return None
102 return None
103
103
104
104
105 coreitems = {}
105 coreitems = {}
106
106
107
107
108 def _register(configtable, *args, **kwargs):
108 def _register(configtable, *args, **kwargs):
109 item = configitem(*args, **kwargs)
109 item = configitem(*args, **kwargs)
110 section = configtable.setdefault(item.section, itemregister())
110 section = configtable.setdefault(item.section, itemregister())
111 if item.name in section:
111 if item.name in section:
112 msg = b"duplicated config item registration for '%s.%s'"
112 msg = b"duplicated config item registration for '%s.%s'"
113 raise error.ProgrammingError(msg % (item.section, item.name))
113 raise error.ProgrammingError(msg % (item.section, item.name))
114 section[item.name] = item
114 section[item.name] = item
115
115
116
116
117 # special value for case where the default is derived from other values
117 # special value for case where the default is derived from other values
118 dynamicdefault = object()
118 dynamicdefault = object()
119
119
120 # Registering actual config items
120 # Registering actual config items
121
121
122
122
123 def getitemregister(configtable):
123 def getitemregister(configtable):
124 f = functools.partial(_register, configtable)
124 f = functools.partial(_register, configtable)
125 # export pseudo enum as configitem.*
125 # export pseudo enum as configitem.*
126 f.dynamicdefault = dynamicdefault
126 f.dynamicdefault = dynamicdefault
127 return f
127 return f
128
128
129
129
130 coreconfigitem = getitemregister(coreitems)
130 coreconfigitem = getitemregister(coreitems)
131
131
132
132
133 def _registerdiffopts(section, configprefix=b''):
133 def _registerdiffopts(section, configprefix=b''):
134 coreconfigitem(
134 coreconfigitem(
135 section,
135 section,
136 configprefix + b'nodates',
136 configprefix + b'nodates',
137 default=False,
137 default=False,
138 )
138 )
139 coreconfigitem(
139 coreconfigitem(
140 section,
140 section,
141 configprefix + b'showfunc',
141 configprefix + b'showfunc',
142 default=False,
142 default=False,
143 )
143 )
144 coreconfigitem(
144 coreconfigitem(
145 section,
145 section,
146 configprefix + b'unified',
146 configprefix + b'unified',
147 default=None,
147 default=None,
148 )
148 )
149 coreconfigitem(
149 coreconfigitem(
150 section,
150 section,
151 configprefix + b'git',
151 configprefix + b'git',
152 default=False,
152 default=False,
153 )
153 )
154 coreconfigitem(
154 coreconfigitem(
155 section,
155 section,
156 configprefix + b'ignorews',
156 configprefix + b'ignorews',
157 default=False,
157 default=False,
158 )
158 )
159 coreconfigitem(
159 coreconfigitem(
160 section,
160 section,
161 configprefix + b'ignorewsamount',
161 configprefix + b'ignorewsamount',
162 default=False,
162 default=False,
163 )
163 )
164 coreconfigitem(
164 coreconfigitem(
165 section,
165 section,
166 configprefix + b'ignoreblanklines',
166 configprefix + b'ignoreblanklines',
167 default=False,
167 default=False,
168 )
168 )
169 coreconfigitem(
169 coreconfigitem(
170 section,
170 section,
171 configprefix + b'ignorewseol',
171 configprefix + b'ignorewseol',
172 default=False,
172 default=False,
173 )
173 )
174 coreconfigitem(
174 coreconfigitem(
175 section,
175 section,
176 configprefix + b'nobinary',
176 configprefix + b'nobinary',
177 default=False,
177 default=False,
178 )
178 )
179 coreconfigitem(
179 coreconfigitem(
180 section,
180 section,
181 configprefix + b'noprefix',
181 configprefix + b'noprefix',
182 default=False,
182 default=False,
183 )
183 )
184 coreconfigitem(
184 coreconfigitem(
185 section,
185 section,
186 configprefix + b'word-diff',
186 configprefix + b'word-diff',
187 default=False,
187 default=False,
188 )
188 )
189
189
190
190
191 coreconfigitem(
191 coreconfigitem(
192 b'alias',
192 b'alias',
193 b'.*',
193 b'.*',
194 default=dynamicdefault,
194 default=dynamicdefault,
195 generic=True,
195 generic=True,
196 )
196 )
197 coreconfigitem(
197 coreconfigitem(
198 b'auth',
198 b'auth',
199 b'cookiefile',
199 b'cookiefile',
200 default=None,
200 default=None,
201 )
201 )
202 _registerdiffopts(section=b'annotate')
202 _registerdiffopts(section=b'annotate')
203 # bookmarks.pushing: internal hack for discovery
203 # bookmarks.pushing: internal hack for discovery
204 coreconfigitem(
204 coreconfigitem(
205 b'bookmarks',
205 b'bookmarks',
206 b'pushing',
206 b'pushing',
207 default=list,
207 default=list,
208 )
208 )
209 # bundle.mainreporoot: internal hack for bundlerepo
209 # bundle.mainreporoot: internal hack for bundlerepo
210 coreconfigitem(
210 coreconfigitem(
211 b'bundle',
211 b'bundle',
212 b'mainreporoot',
212 b'mainreporoot',
213 default=b'',
213 default=b'',
214 )
214 )
215 coreconfigitem(
215 coreconfigitem(
216 b'censor',
216 b'censor',
217 b'policy',
217 b'policy',
218 default=b'abort',
218 default=b'abort',
219 experimental=True,
219 experimental=True,
220 )
220 )
221 coreconfigitem(
221 coreconfigitem(
222 b'chgserver',
222 b'chgserver',
223 b'idletimeout',
223 b'idletimeout',
224 default=3600,
224 default=3600,
225 )
225 )
226 coreconfigitem(
226 coreconfigitem(
227 b'chgserver',
227 b'chgserver',
228 b'skiphash',
228 b'skiphash',
229 default=False,
229 default=False,
230 )
230 )
231 coreconfigitem(
231 coreconfigitem(
232 b'cmdserver',
232 b'cmdserver',
233 b'log',
233 b'log',
234 default=None,
234 default=None,
235 )
235 )
236 coreconfigitem(
236 coreconfigitem(
237 b'cmdserver',
237 b'cmdserver',
238 b'max-log-files',
238 b'max-log-files',
239 default=7,
239 default=7,
240 )
240 )
241 coreconfigitem(
241 coreconfigitem(
242 b'cmdserver',
242 b'cmdserver',
243 b'max-log-size',
243 b'max-log-size',
244 default=b'1 MB',
244 default=b'1 MB',
245 )
245 )
246 coreconfigitem(
246 coreconfigitem(
247 b'cmdserver',
247 b'cmdserver',
248 b'max-repo-cache',
248 b'max-repo-cache',
249 default=0,
249 default=0,
250 experimental=True,
250 experimental=True,
251 )
251 )
252 coreconfigitem(
252 coreconfigitem(
253 b'cmdserver',
253 b'cmdserver',
254 b'message-encodings',
254 b'message-encodings',
255 default=list,
255 default=list,
256 )
256 )
257 coreconfigitem(
257 coreconfigitem(
258 b'cmdserver',
258 b'cmdserver',
259 b'track-log',
259 b'track-log',
260 default=lambda: [b'chgserver', b'cmdserver', b'repocache'],
260 default=lambda: [b'chgserver', b'cmdserver', b'repocache'],
261 )
261 )
262 coreconfigitem(
262 coreconfigitem(
263 b'cmdserver',
263 b'cmdserver',
264 b'shutdown-on-interrupt',
264 b'shutdown-on-interrupt',
265 default=True,
265 default=True,
266 )
266 )
267 coreconfigitem(
267 coreconfigitem(
268 b'color',
268 b'color',
269 b'.*',
269 b'.*',
270 default=None,
270 default=None,
271 generic=True,
271 generic=True,
272 )
272 )
273 coreconfigitem(
273 coreconfigitem(
274 b'color',
274 b'color',
275 b'mode',
275 b'mode',
276 default=b'auto',
276 default=b'auto',
277 )
277 )
278 coreconfigitem(
278 coreconfigitem(
279 b'color',
279 b'color',
280 b'pagermode',
280 b'pagermode',
281 default=dynamicdefault,
281 default=dynamicdefault,
282 )
282 )
283 coreconfigitem(
283 coreconfigitem(
284 b'command-templates',
284 b'command-templates',
285 b'graphnode',
285 b'graphnode',
286 default=None,
286 default=None,
287 alias=[(b'ui', b'graphnodetemplate')],
287 alias=[(b'ui', b'graphnodetemplate')],
288 )
288 )
289 coreconfigitem(
289 coreconfigitem(
290 b'command-templates',
290 b'command-templates',
291 b'log',
291 b'log',
292 default=None,
292 default=None,
293 alias=[(b'ui', b'logtemplate')],
293 alias=[(b'ui', b'logtemplate')],
294 )
294 )
295 coreconfigitem(
295 coreconfigitem(
296 b'command-templates',
296 b'command-templates',
297 b'mergemarker',
297 b'mergemarker',
298 default=(
298 default=(
299 b'{node|short} '
299 b'{node|short} '
300 b'{ifeq(tags, "tip", "", '
300 b'{ifeq(tags, "tip", "", '
301 b'ifeq(tags, "", "", "{tags} "))}'
301 b'ifeq(tags, "", "", "{tags} "))}'
302 b'{if(bookmarks, "{bookmarks} ")}'
302 b'{if(bookmarks, "{bookmarks} ")}'
303 b'{ifeq(branch, "default", "", "{branch} ")}'
303 b'{ifeq(branch, "default", "", "{branch} ")}'
304 b'- {author|user}: {desc|firstline}'
304 b'- {author|user}: {desc|firstline}'
305 ),
305 ),
306 alias=[(b'ui', b'mergemarkertemplate')],
306 alias=[(b'ui', b'mergemarkertemplate')],
307 )
307 )
308 coreconfigitem(
308 coreconfigitem(
309 b'command-templates',
309 b'command-templates',
310 b'pre-merge-tool-output',
310 b'pre-merge-tool-output',
311 default=None,
311 default=None,
312 alias=[(b'ui', b'pre-merge-tool-output-template')],
312 alias=[(b'ui', b'pre-merge-tool-output-template')],
313 )
313 )
314 coreconfigitem(
314 coreconfigitem(
315 b'command-templates',
315 b'command-templates',
316 b'oneline-summary',
316 b'oneline-summary',
317 default=None,
317 default=None,
318 )
318 )
319 coreconfigitem(
319 coreconfigitem(
320 b'command-templates',
320 b'command-templates',
321 b'oneline-summary.*',
321 b'oneline-summary.*',
322 default=dynamicdefault,
322 default=dynamicdefault,
323 generic=True,
323 generic=True,
324 )
324 )
325 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
325 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
326 coreconfigitem(
326 coreconfigitem(
327 b'commands',
327 b'commands',
328 b'commit.post-status',
328 b'commit.post-status',
329 default=False,
329 default=False,
330 )
330 )
331 coreconfigitem(
331 coreconfigitem(
332 b'commands',
332 b'commands',
333 b'grep.all-files',
333 b'grep.all-files',
334 default=False,
334 default=False,
335 experimental=True,
335 experimental=True,
336 )
336 )
337 coreconfigitem(
337 coreconfigitem(
338 b'commands',
338 b'commands',
339 b'merge.require-rev',
339 b'merge.require-rev',
340 default=False,
340 default=False,
341 )
341 )
342 coreconfigitem(
342 coreconfigitem(
343 b'commands',
343 b'commands',
344 b'push.require-revs',
344 b'push.require-revs',
345 default=False,
345 default=False,
346 )
346 )
347 coreconfigitem(
347 coreconfigitem(
348 b'commands',
348 b'commands',
349 b'resolve.confirm',
349 b'resolve.confirm',
350 default=False,
350 default=False,
351 )
351 )
352 coreconfigitem(
352 coreconfigitem(
353 b'commands',
353 b'commands',
354 b'resolve.explicit-re-merge',
354 b'resolve.explicit-re-merge',
355 default=False,
355 default=False,
356 )
356 )
357 coreconfigitem(
357 coreconfigitem(
358 b'commands',
358 b'commands',
359 b'resolve.mark-check',
359 b'resolve.mark-check',
360 default=b'none',
360 default=b'none',
361 )
361 )
362 _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.')
362 _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.')
363 coreconfigitem(
363 coreconfigitem(
364 b'commands',
364 b'commands',
365 b'show.aliasprefix',
365 b'show.aliasprefix',
366 default=list,
366 default=list,
367 )
367 )
368 coreconfigitem(
368 coreconfigitem(
369 b'commands',
369 b'commands',
370 b'status.relative',
370 b'status.relative',
371 default=False,
371 default=False,
372 )
372 )
373 coreconfigitem(
373 coreconfigitem(
374 b'commands',
374 b'commands',
375 b'status.skipstates',
375 b'status.skipstates',
376 default=[],
376 default=[],
377 experimental=True,
377 experimental=True,
378 )
378 )
379 coreconfigitem(
379 coreconfigitem(
380 b'commands',
380 b'commands',
381 b'status.terse',
381 b'status.terse',
382 default=b'',
382 default=b'',
383 )
383 )
384 coreconfigitem(
384 coreconfigitem(
385 b'commands',
385 b'commands',
386 b'status.verbose',
386 b'status.verbose',
387 default=False,
387 default=False,
388 )
388 )
389 coreconfigitem(
389 coreconfigitem(
390 b'commands',
390 b'commands',
391 b'update.check',
391 b'update.check',
392 default=None,
392 default=None,
393 )
393 )
394 coreconfigitem(
394 coreconfigitem(
395 b'commands',
395 b'commands',
396 b'update.requiredest',
396 b'update.requiredest',
397 default=False,
397 default=False,
398 )
398 )
399 coreconfigitem(
399 coreconfigitem(
400 b'committemplate',
400 b'committemplate',
401 b'.*',
401 b'.*',
402 default=None,
402 default=None,
403 generic=True,
403 generic=True,
404 )
404 )
405 coreconfigitem(
405 coreconfigitem(
406 b'convert',
406 b'convert',
407 b'bzr.saverev',
407 b'bzr.saverev',
408 default=True,
408 default=True,
409 )
409 )
410 coreconfigitem(
410 coreconfigitem(
411 b'convert',
411 b'convert',
412 b'cvsps.cache',
412 b'cvsps.cache',
413 default=True,
413 default=True,
414 )
414 )
415 coreconfigitem(
415 coreconfigitem(
416 b'convert',
416 b'convert',
417 b'cvsps.fuzz',
417 b'cvsps.fuzz',
418 default=60,
418 default=60,
419 )
419 )
420 coreconfigitem(
420 coreconfigitem(
421 b'convert',
421 b'convert',
422 b'cvsps.logencoding',
422 b'cvsps.logencoding',
423 default=None,
423 default=None,
424 )
424 )
425 coreconfigitem(
425 coreconfigitem(
426 b'convert',
426 b'convert',
427 b'cvsps.mergefrom',
427 b'cvsps.mergefrom',
428 default=None,
428 default=None,
429 )
429 )
430 coreconfigitem(
430 coreconfigitem(
431 b'convert',
431 b'convert',
432 b'cvsps.mergeto',
432 b'cvsps.mergeto',
433 default=None,
433 default=None,
434 )
434 )
435 coreconfigitem(
435 coreconfigitem(
436 b'convert',
436 b'convert',
437 b'git.committeractions',
437 b'git.committeractions',
438 default=lambda: [b'messagedifferent'],
438 default=lambda: [b'messagedifferent'],
439 )
439 )
440 coreconfigitem(
440 coreconfigitem(
441 b'convert',
441 b'convert',
442 b'git.extrakeys',
442 b'git.extrakeys',
443 default=list,
443 default=list,
444 )
444 )
445 coreconfigitem(
445 coreconfigitem(
446 b'convert',
446 b'convert',
447 b'git.findcopiesharder',
447 b'git.findcopiesharder',
448 default=False,
448 default=False,
449 )
449 )
450 coreconfigitem(
450 coreconfigitem(
451 b'convert',
451 b'convert',
452 b'git.remoteprefix',
452 b'git.remoteprefix',
453 default=b'remote',
453 default=b'remote',
454 )
454 )
455 coreconfigitem(
455 coreconfigitem(
456 b'convert',
456 b'convert',
457 b'git.renamelimit',
457 b'git.renamelimit',
458 default=400,
458 default=400,
459 )
459 )
460 coreconfigitem(
460 coreconfigitem(
461 b'convert',
461 b'convert',
462 b'git.saverev',
462 b'git.saverev',
463 default=True,
463 default=True,
464 )
464 )
465 coreconfigitem(
465 coreconfigitem(
466 b'convert',
466 b'convert',
467 b'git.similarity',
467 b'git.similarity',
468 default=50,
468 default=50,
469 )
469 )
470 coreconfigitem(
470 coreconfigitem(
471 b'convert',
471 b'convert',
472 b'git.skipsubmodules',
472 b'git.skipsubmodules',
473 default=False,
473 default=False,
474 )
474 )
475 coreconfigitem(
475 coreconfigitem(
476 b'convert',
476 b'convert',
477 b'hg.clonebranches',
477 b'hg.clonebranches',
478 default=False,
478 default=False,
479 )
479 )
480 coreconfigitem(
480 coreconfigitem(
481 b'convert',
481 b'convert',
482 b'hg.ignoreerrors',
482 b'hg.ignoreerrors',
483 default=False,
483 default=False,
484 )
484 )
485 coreconfigitem(
485 coreconfigitem(
486 b'convert',
486 b'convert',
487 b'hg.preserve-hash',
487 b'hg.preserve-hash',
488 default=False,
488 default=False,
489 )
489 )
490 coreconfigitem(
490 coreconfigitem(
491 b'convert',
491 b'convert',
492 b'hg.revs',
492 b'hg.revs',
493 default=None,
493 default=None,
494 )
494 )
495 coreconfigitem(
495 coreconfigitem(
496 b'convert',
496 b'convert',
497 b'hg.saverev',
497 b'hg.saverev',
498 default=False,
498 default=False,
499 )
499 )
500 coreconfigitem(
500 coreconfigitem(
501 b'convert',
501 b'convert',
502 b'hg.sourcename',
502 b'hg.sourcename',
503 default=None,
503 default=None,
504 )
504 )
505 coreconfigitem(
505 coreconfigitem(
506 b'convert',
506 b'convert',
507 b'hg.startrev',
507 b'hg.startrev',
508 default=None,
508 default=None,
509 )
509 )
510 coreconfigitem(
510 coreconfigitem(
511 b'convert',
511 b'convert',
512 b'hg.tagsbranch',
512 b'hg.tagsbranch',
513 default=b'default',
513 default=b'default',
514 )
514 )
515 coreconfigitem(
515 coreconfigitem(
516 b'convert',
516 b'convert',
517 b'hg.usebranchnames',
517 b'hg.usebranchnames',
518 default=True,
518 default=True,
519 )
519 )
520 coreconfigitem(
520 coreconfigitem(
521 b'convert',
521 b'convert',
522 b'ignoreancestorcheck',
522 b'ignoreancestorcheck',
523 default=False,
523 default=False,
524 experimental=True,
524 experimental=True,
525 )
525 )
526 coreconfigitem(
526 coreconfigitem(
527 b'convert',
527 b'convert',
528 b'localtimezone',
528 b'localtimezone',
529 default=False,
529 default=False,
530 )
530 )
531 coreconfigitem(
531 coreconfigitem(
532 b'convert',
532 b'convert',
533 b'p4.encoding',
533 b'p4.encoding',
534 default=dynamicdefault,
534 default=dynamicdefault,
535 )
535 )
536 coreconfigitem(
536 coreconfigitem(
537 b'convert',
537 b'convert',
538 b'p4.startrev',
538 b'p4.startrev',
539 default=0,
539 default=0,
540 )
540 )
541 coreconfigitem(
541 coreconfigitem(
542 b'convert',
542 b'convert',
543 b'skiptags',
543 b'skiptags',
544 default=False,
544 default=False,
545 )
545 )
546 coreconfigitem(
546 coreconfigitem(
547 b'convert',
547 b'convert',
548 b'svn.debugsvnlog',
548 b'svn.debugsvnlog',
549 default=True,
549 default=True,
550 )
550 )
551 coreconfigitem(
551 coreconfigitem(
552 b'convert',
552 b'convert',
553 b'svn.trunk',
553 b'svn.trunk',
554 default=None,
554 default=None,
555 )
555 )
556 coreconfigitem(
556 coreconfigitem(
557 b'convert',
557 b'convert',
558 b'svn.tags',
558 b'svn.tags',
559 default=None,
559 default=None,
560 )
560 )
561 coreconfigitem(
561 coreconfigitem(
562 b'convert',
562 b'convert',
563 b'svn.branches',
563 b'svn.branches',
564 default=None,
564 default=None,
565 )
565 )
566 coreconfigitem(
566 coreconfigitem(
567 b'convert',
567 b'convert',
568 b'svn.startrev',
568 b'svn.startrev',
569 default=0,
569 default=0,
570 )
570 )
571 coreconfigitem(
571 coreconfigitem(
572 b'convert',
572 b'convert',
573 b'svn.dangerous-set-commit-dates',
573 b'svn.dangerous-set-commit-dates',
574 default=False,
574 default=False,
575 )
575 )
576 coreconfigitem(
576 coreconfigitem(
577 b'debug',
577 b'debug',
578 b'dirstate.delaywrite',
578 b'dirstate.delaywrite',
579 default=0,
579 default=0,
580 )
580 )
581 coreconfigitem(
581 coreconfigitem(
582 b'debug',
582 b'debug',
583 b'revlog.verifyposition.changelog',
583 b'revlog.verifyposition.changelog',
584 default=b'',
584 default=b'',
585 )
585 )
586 coreconfigitem(
586 coreconfigitem(
587 b'debug',
587 b'debug',
588 b'revlog.debug-delta',
588 b'revlog.debug-delta',
589 default=False,
589 default=False,
590 )
590 )
591 # display extra information about the bundling process
591 # display extra information about the bundling process
592 coreconfigitem(
592 coreconfigitem(
593 b'debug',
593 b'debug',
594 b'bundling-stats',
594 b'bundling-stats',
595 default=False,
595 default=False,
596 )
596 )
597 # display extra information about the unbundling process
597 # display extra information about the unbundling process
598 coreconfigitem(
598 coreconfigitem(
599 b'debug',
599 b'debug',
600 b'unbundling-stats',
600 b'unbundling-stats',
601 default=False,
601 default=False,
602 )
602 )
603 coreconfigitem(
603 coreconfigitem(
604 b'defaults',
604 b'defaults',
605 b'.*',
605 b'.*',
606 default=None,
606 default=None,
607 generic=True,
607 generic=True,
608 )
608 )
609 coreconfigitem(
609 coreconfigitem(
610 b'devel',
610 b'devel',
611 b'all-warnings',
611 b'all-warnings',
612 default=False,
612 default=False,
613 )
613 )
614 coreconfigitem(
614 coreconfigitem(
615 b'devel',
615 b'devel',
616 b'bundle2.debug',
616 b'bundle2.debug',
617 default=False,
617 default=False,
618 )
618 )
619 coreconfigitem(
619 coreconfigitem(
620 b'devel',
620 b'devel',
621 b'bundle.delta',
621 b'bundle.delta',
622 default=b'',
622 default=b'',
623 )
623 )
624 coreconfigitem(
624 coreconfigitem(
625 b'devel',
625 b'devel',
626 b'cache-vfs',
626 b'cache-vfs',
627 default=None,
627 default=None,
628 )
628 )
629 coreconfigitem(
629 coreconfigitem(
630 b'devel',
630 b'devel',
631 b'check-locks',
631 b'check-locks',
632 default=False,
632 default=False,
633 )
633 )
634 coreconfigitem(
634 coreconfigitem(
635 b'devel',
635 b'devel',
636 b'check-relroot',
636 b'check-relroot',
637 default=False,
637 default=False,
638 )
638 )
639 # Track copy information for all file, not just "added" one (very slow)
639 # Track copy information for all file, not just "added" one (very slow)
640 coreconfigitem(
640 coreconfigitem(
641 b'devel',
641 b'devel',
642 b'copy-tracing.trace-all-files',
642 b'copy-tracing.trace-all-files',
643 default=False,
643 default=False,
644 )
644 )
645 coreconfigitem(
645 coreconfigitem(
646 b'devel',
646 b'devel',
647 b'default-date',
647 b'default-date',
648 default=None,
648 default=None,
649 )
649 )
650 coreconfigitem(
650 coreconfigitem(
651 b'devel',
651 b'devel',
652 b'deprec-warn',
652 b'deprec-warn',
653 default=False,
653 default=False,
654 )
654 )
655 coreconfigitem(
655 coreconfigitem(
656 b'devel',
656 b'devel',
657 b'disableloaddefaultcerts',
657 b'disableloaddefaultcerts',
658 default=False,
658 default=False,
659 )
659 )
660 coreconfigitem(
660 coreconfigitem(
661 b'devel',
661 b'devel',
662 b'warn-empty-changegroup',
662 b'warn-empty-changegroup',
663 default=False,
663 default=False,
664 )
664 )
665 coreconfigitem(
665 coreconfigitem(
666 b'devel',
666 b'devel',
667 b'legacy.exchange',
667 b'legacy.exchange',
668 default=list,
668 default=list,
669 )
669 )
670 # When True, revlogs use a special reference version of the nodemap, that is not
670 # When True, revlogs use a special reference version of the nodemap, that is not
671 # performant but is "known" to behave properly.
671 # performant but is "known" to behave properly.
672 coreconfigitem(
672 coreconfigitem(
673 b'devel',
673 b'devel',
674 b'persistent-nodemap',
674 b'persistent-nodemap',
675 default=False,
675 default=False,
676 )
676 )
677 coreconfigitem(
677 coreconfigitem(
678 b'devel',
678 b'devel',
679 b'servercafile',
679 b'servercafile',
680 default=b'',
680 default=b'',
681 )
681 )
682 coreconfigitem(
682 coreconfigitem(
683 b'devel',
683 b'devel',
684 b'serverexactprotocol',
684 b'serverexactprotocol',
685 default=b'',
685 default=b'',
686 )
686 )
687 coreconfigitem(
687 coreconfigitem(
688 b'devel',
688 b'devel',
689 b'serverrequirecert',
689 b'serverrequirecert',
690 default=False,
690 default=False,
691 )
691 )
692 coreconfigitem(
692 coreconfigitem(
693 b'devel',
693 b'devel',
694 b'strip-obsmarkers',
694 b'strip-obsmarkers',
695 default=True,
695 default=True,
696 )
696 )
697 coreconfigitem(
697 coreconfigitem(
698 b'devel',
698 b'devel',
699 b'warn-config',
699 b'warn-config',
700 default=None,
700 default=None,
701 )
701 )
702 coreconfigitem(
702 coreconfigitem(
703 b'devel',
703 b'devel',
704 b'warn-config-default',
704 b'warn-config-default',
705 default=None,
705 default=None,
706 )
706 )
707 coreconfigitem(
707 coreconfigitem(
708 b'devel',
708 b'devel',
709 b'user.obsmarker',
709 b'user.obsmarker',
710 default=None,
710 default=None,
711 )
711 )
712 coreconfigitem(
712 coreconfigitem(
713 b'devel',
713 b'devel',
714 b'warn-config-unknown',
714 b'warn-config-unknown',
715 default=None,
715 default=None,
716 )
716 )
717 coreconfigitem(
717 coreconfigitem(
718 b'devel',
718 b'devel',
719 b'debug.copies',
719 b'debug.copies',
720 default=False,
720 default=False,
721 )
721 )
722 coreconfigitem(
722 coreconfigitem(
723 b'devel',
723 b'devel',
724 b'copy-tracing.multi-thread',
724 b'copy-tracing.multi-thread',
725 default=True,
725 default=True,
726 )
726 )
727 coreconfigitem(
727 coreconfigitem(
728 b'devel',
728 b'devel',
729 b'debug.extensions',
729 b'debug.extensions',
730 default=False,
730 default=False,
731 )
731 )
732 coreconfigitem(
732 coreconfigitem(
733 b'devel',
733 b'devel',
734 b'debug.repo-filters',
734 b'debug.repo-filters',
735 default=False,
735 default=False,
736 )
736 )
737 coreconfigitem(
737 coreconfigitem(
738 b'devel',
738 b'devel',
739 b'debug.peer-request',
739 b'debug.peer-request',
740 default=False,
740 default=False,
741 )
741 )
742 # If discovery.exchange-heads is False, the discovery will not start with
742 # If discovery.exchange-heads is False, the discovery will not start with
743 # remote head fetching and local head querying.
743 # remote head fetching and local head querying.
744 coreconfigitem(
744 coreconfigitem(
745 b'devel',
745 b'devel',
746 b'discovery.exchange-heads',
746 b'discovery.exchange-heads',
747 default=True,
747 default=True,
748 )
748 )
749 # If discovery.grow-sample is False, the sample size used in set discovery will
749 # If discovery.grow-sample is False, the sample size used in set discovery will
750 # not be increased through the process
750 # not be increased through the process
751 coreconfigitem(
751 coreconfigitem(
752 b'devel',
752 b'devel',
753 b'discovery.grow-sample',
753 b'discovery.grow-sample',
754 default=True,
754 default=True,
755 )
755 )
756 # When discovery.grow-sample.dynamic is True, the default, the sample size is
756 # When discovery.grow-sample.dynamic is True, the default, the sample size is
757 # adapted to the shape of the undecided set (it is set to the max of:
757 # adapted to the shape of the undecided set (it is set to the max of:
758 # <target-size>, len(roots(undecided)), len(heads(undecided)
758 # <target-size>, len(roots(undecided)), len(heads(undecided)
759 coreconfigitem(
759 coreconfigitem(
760 b'devel',
760 b'devel',
761 b'discovery.grow-sample.dynamic',
761 b'discovery.grow-sample.dynamic',
762 default=True,
762 default=True,
763 )
763 )
764 # discovery.grow-sample.rate control the rate at which the sample grow
764 # discovery.grow-sample.rate control the rate at which the sample grow
765 coreconfigitem(
765 coreconfigitem(
766 b'devel',
766 b'devel',
767 b'discovery.grow-sample.rate',
767 b'discovery.grow-sample.rate',
768 default=1.05,
768 default=1.05,
769 )
769 )
770 # If discovery.randomize is False, random sampling during discovery are
770 # If discovery.randomize is False, random sampling during discovery are
771 # deterministic. It is meant for integration tests.
771 # deterministic. It is meant for integration tests.
772 coreconfigitem(
772 coreconfigitem(
773 b'devel',
773 b'devel',
774 b'discovery.randomize',
774 b'discovery.randomize',
775 default=True,
775 default=True,
776 )
776 )
777 # Control the initial size of the discovery sample
777 # Control the initial size of the discovery sample
778 coreconfigitem(
778 coreconfigitem(
779 b'devel',
779 b'devel',
780 b'discovery.sample-size',
780 b'discovery.sample-size',
781 default=200,
781 default=200,
782 )
782 )
783 # Control the initial size of the discovery for initial change
783 # Control the initial size of the discovery for initial change
784 coreconfigitem(
784 coreconfigitem(
785 b'devel',
785 b'devel',
786 b'discovery.sample-size.initial',
786 b'discovery.sample-size.initial',
787 default=100,
787 default=100,
788 )
788 )
789 _registerdiffopts(section=b'diff')
789 _registerdiffopts(section=b'diff')
790 coreconfigitem(
790 coreconfigitem(
791 b'diff',
791 b'diff',
792 b'merge',
792 b'merge',
793 default=False,
793 default=False,
794 experimental=True,
794 experimental=True,
795 )
795 )
796 coreconfigitem(
796 coreconfigitem(
797 b'email',
797 b'email',
798 b'bcc',
798 b'bcc',
799 default=None,
799 default=None,
800 )
800 )
801 coreconfigitem(
801 coreconfigitem(
802 b'email',
802 b'email',
803 b'cc',
803 b'cc',
804 default=None,
804 default=None,
805 )
805 )
806 coreconfigitem(
806 coreconfigitem(
807 b'email',
807 b'email',
808 b'charsets',
808 b'charsets',
809 default=list,
809 default=list,
810 )
810 )
811 coreconfigitem(
811 coreconfigitem(
812 b'email',
812 b'email',
813 b'from',
813 b'from',
814 default=None,
814 default=None,
815 )
815 )
816 coreconfigitem(
816 coreconfigitem(
817 b'email',
817 b'email',
818 b'method',
818 b'method',
819 default=b'smtp',
819 default=b'smtp',
820 )
820 )
821 coreconfigitem(
821 coreconfigitem(
822 b'email',
822 b'email',
823 b'reply-to',
823 b'reply-to',
824 default=None,
824 default=None,
825 )
825 )
826 coreconfigitem(
826 coreconfigitem(
827 b'email',
827 b'email',
828 b'to',
828 b'to',
829 default=None,
829 default=None,
830 )
830 )
831 coreconfigitem(
831 coreconfigitem(
832 b'experimental',
832 b'experimental',
833 b'archivemetatemplate',
833 b'archivemetatemplate',
834 default=dynamicdefault,
834 default=dynamicdefault,
835 )
835 )
836 coreconfigitem(
836 coreconfigitem(
837 b'experimental',
837 b'experimental',
838 b'auto-publish',
838 b'auto-publish',
839 default=b'publish',
839 default=b'publish',
840 )
840 )
841 coreconfigitem(
841 coreconfigitem(
842 b'experimental',
842 b'experimental',
843 b'bundle-phases',
843 b'bundle-phases',
844 default=False,
844 default=False,
845 )
845 )
846 coreconfigitem(
846 coreconfigitem(
847 b'experimental',
847 b'experimental',
848 b'bundle2-advertise',
848 b'bundle2-advertise',
849 default=True,
849 default=True,
850 )
850 )
851 coreconfigitem(
851 coreconfigitem(
852 b'experimental',
852 b'experimental',
853 b'bundle2-output-capture',
853 b'bundle2-output-capture',
854 default=False,
854 default=False,
855 )
855 )
856 coreconfigitem(
856 coreconfigitem(
857 b'experimental',
857 b'experimental',
858 b'bundle2.pushback',
858 b'bundle2.pushback',
859 default=False,
859 default=False,
860 )
860 )
861 coreconfigitem(
861 coreconfigitem(
862 b'experimental',
862 b'experimental',
863 b'bundle2lazylocking',
863 b'bundle2lazylocking',
864 default=False,
864 default=False,
865 )
865 )
866 coreconfigitem(
866 coreconfigitem(
867 b'experimental',
867 b'experimental',
868 b'bundlecomplevel',
868 b'bundlecomplevel',
869 default=None,
869 default=None,
870 )
870 )
871 coreconfigitem(
871 coreconfigitem(
872 b'experimental',
872 b'experimental',
873 b'bundlecomplevel.bzip2',
873 b'bundlecomplevel.bzip2',
874 default=None,
874 default=None,
875 )
875 )
876 coreconfigitem(
876 coreconfigitem(
877 b'experimental',
877 b'experimental',
878 b'bundlecomplevel.gzip',
878 b'bundlecomplevel.gzip',
879 default=None,
879 default=None,
880 )
880 )
881 coreconfigitem(
881 coreconfigitem(
882 b'experimental',
882 b'experimental',
883 b'bundlecomplevel.none',
883 b'bundlecomplevel.none',
884 default=None,
884 default=None,
885 )
885 )
886 coreconfigitem(
886 coreconfigitem(
887 b'experimental',
887 b'experimental',
888 b'bundlecomplevel.zstd',
888 b'bundlecomplevel.zstd',
889 default=None,
889 default=None,
890 )
890 )
891 coreconfigitem(
891 coreconfigitem(
892 b'experimental',
892 b'experimental',
893 b'bundlecompthreads',
893 b'bundlecompthreads',
894 default=None,
894 default=None,
895 )
895 )
896 coreconfigitem(
896 coreconfigitem(
897 b'experimental',
897 b'experimental',
898 b'bundlecompthreads.bzip2',
898 b'bundlecompthreads.bzip2',
899 default=None,
899 default=None,
900 )
900 )
901 coreconfigitem(
901 coreconfigitem(
902 b'experimental',
902 b'experimental',
903 b'bundlecompthreads.gzip',
903 b'bundlecompthreads.gzip',
904 default=None,
904 default=None,
905 )
905 )
906 coreconfigitem(
906 coreconfigitem(
907 b'experimental',
907 b'experimental',
908 b'bundlecompthreads.none',
908 b'bundlecompthreads.none',
909 default=None,
909 default=None,
910 )
910 )
911 coreconfigitem(
911 coreconfigitem(
912 b'experimental',
912 b'experimental',
913 b'bundlecompthreads.zstd',
913 b'bundlecompthreads.zstd',
914 default=None,
914 default=None,
915 )
915 )
916 coreconfigitem(
916 coreconfigitem(
917 b'experimental',
917 b'experimental',
918 b'changegroup3',
918 b'changegroup3',
919 default=False,
919 default=False,
920 )
920 )
921 coreconfigitem(
921 coreconfigitem(
922 b'experimental',
922 b'experimental',
923 b'changegroup4',
923 b'changegroup4',
924 default=False,
924 default=False,
925 )
925 )
926 coreconfigitem(
926 coreconfigitem(
927 b'experimental',
927 b'experimental',
928 b'cleanup-as-archived',
928 b'cleanup-as-archived',
929 default=False,
929 default=False,
930 )
930 )
931 coreconfigitem(
931 coreconfigitem(
932 b'experimental',
932 b'experimental',
933 b'clientcompressionengines',
933 b'clientcompressionengines',
934 default=list,
934 default=list,
935 )
935 )
936 coreconfigitem(
936 coreconfigitem(
937 b'experimental',
937 b'experimental',
938 b'copytrace',
938 b'copytrace',
939 default=b'on',
939 default=b'on',
940 )
940 )
941 coreconfigitem(
941 coreconfigitem(
942 b'experimental',
942 b'experimental',
943 b'copytrace.movecandidateslimit',
943 b'copytrace.movecandidateslimit',
944 default=100,
944 default=100,
945 )
945 )
946 coreconfigitem(
946 coreconfigitem(
947 b'experimental',
947 b'experimental',
948 b'copytrace.sourcecommitlimit',
948 b'copytrace.sourcecommitlimit',
949 default=100,
949 default=100,
950 )
950 )
951 coreconfigitem(
951 coreconfigitem(
952 b'experimental',
952 b'experimental',
953 b'copies.read-from',
953 b'copies.read-from',
954 default=b"filelog-only",
954 default=b"filelog-only",
955 )
955 )
956 coreconfigitem(
956 coreconfigitem(
957 b'experimental',
957 b'experimental',
958 b'copies.write-to',
958 b'copies.write-to',
959 default=b'filelog-only',
959 default=b'filelog-only',
960 )
960 )
961 coreconfigitem(
961 coreconfigitem(
962 b'experimental',
962 b'experimental',
963 b'crecordtest',
963 b'crecordtest',
964 default=None,
964 default=None,
965 )
965 )
966 coreconfigitem(
966 coreconfigitem(
967 b'experimental',
967 b'experimental',
968 b'directaccess',
968 b'directaccess',
969 default=False,
969 default=False,
970 )
970 )
971 coreconfigitem(
971 coreconfigitem(
972 b'experimental',
972 b'experimental',
973 b'directaccess.revnums',
973 b'directaccess.revnums',
974 default=False,
974 default=False,
975 )
975 )
976 coreconfigitem(
976 coreconfigitem(
977 b'experimental',
977 b'experimental',
978 b'editortmpinhg',
978 b'editortmpinhg',
979 default=False,
979 default=False,
980 )
980 )
981 coreconfigitem(
981 coreconfigitem(
982 b'experimental',
982 b'experimental',
983 b'evolution',
983 b'evolution',
984 default=list,
984 default=list,
985 )
985 )
986 coreconfigitem(
986 coreconfigitem(
987 b'experimental',
987 b'experimental',
988 b'evolution.allowdivergence',
988 b'evolution.allowdivergence',
989 default=False,
989 default=False,
990 alias=[(b'experimental', b'allowdivergence')],
990 alias=[(b'experimental', b'allowdivergence')],
991 )
991 )
992 coreconfigitem(
992 coreconfigitem(
993 b'experimental',
993 b'experimental',
994 b'evolution.allowunstable',
994 b'evolution.allowunstable',
995 default=None,
995 default=None,
996 )
996 )
997 coreconfigitem(
997 coreconfigitem(
998 b'experimental',
998 b'experimental',
999 b'evolution.createmarkers',
999 b'evolution.createmarkers',
1000 default=None,
1000 default=None,
1001 )
1001 )
1002 coreconfigitem(
1002 coreconfigitem(
1003 b'experimental',
1003 b'experimental',
1004 b'evolution.effect-flags',
1004 b'evolution.effect-flags',
1005 default=True,
1005 default=True,
1006 alias=[(b'experimental', b'effect-flags')],
1006 alias=[(b'experimental', b'effect-flags')],
1007 )
1007 )
1008 coreconfigitem(
1008 coreconfigitem(
1009 b'experimental',
1009 b'experimental',
1010 b'evolution.exchange',
1010 b'evolution.exchange',
1011 default=None,
1011 default=None,
1012 )
1012 )
1013 coreconfigitem(
1013 coreconfigitem(
1014 b'experimental',
1014 b'experimental',
1015 b'evolution.bundle-obsmarker',
1015 b'evolution.bundle-obsmarker',
1016 default=False,
1016 default=False,
1017 )
1017 )
1018 coreconfigitem(
1018 coreconfigitem(
1019 b'experimental',
1019 b'experimental',
1020 b'evolution.bundle-obsmarker:mandatory',
1020 b'evolution.bundle-obsmarker:mandatory',
1021 default=True,
1021 default=True,
1022 )
1022 )
1023 coreconfigitem(
1023 coreconfigitem(
1024 b'experimental',
1024 b'experimental',
1025 b'log.topo',
1025 b'log.topo',
1026 default=False,
1026 default=False,
1027 )
1027 )
1028 coreconfigitem(
1028 coreconfigitem(
1029 b'experimental',
1029 b'experimental',
1030 b'evolution.report-instabilities',
1030 b'evolution.report-instabilities',
1031 default=True,
1031 default=True,
1032 )
1032 )
1033 coreconfigitem(
1033 coreconfigitem(
1034 b'experimental',
1034 b'experimental',
1035 b'evolution.track-operation',
1035 b'evolution.track-operation',
1036 default=True,
1036 default=True,
1037 )
1037 )
1038 # repo-level config to exclude a revset visibility
1038 # repo-level config to exclude a revset visibility
1039 #
1039 #
1040 # The target use case is to use `share` to expose different subset of the same
1040 # The target use case is to use `share` to expose different subset of the same
1041 # repository, especially server side. See also `server.view`.
1041 # repository, especially server side. See also `server.view`.
1042 coreconfigitem(
1042 coreconfigitem(
1043 b'experimental',
1043 b'experimental',
1044 b'extra-filter-revs',
1044 b'extra-filter-revs',
1045 default=None,
1045 default=None,
1046 )
1046 )
1047 coreconfigitem(
1047 coreconfigitem(
1048 b'experimental',
1048 b'experimental',
1049 b'maxdeltachainspan',
1049 b'maxdeltachainspan',
1050 default=-1,
1050 default=-1,
1051 )
1051 )
1052 # tracks files which were undeleted (merge might delete them but we explicitly
1052 # tracks files which were undeleted (merge might delete them but we explicitly
1053 # kept/undeleted them) and creates new filenodes for them
1053 # kept/undeleted them) and creates new filenodes for them
1054 coreconfigitem(
1054 coreconfigitem(
1055 b'experimental',
1055 b'experimental',
1056 b'merge-track-salvaged',
1056 b'merge-track-salvaged',
1057 default=False,
1057 default=False,
1058 )
1058 )
1059 coreconfigitem(
1059 coreconfigitem(
1060 b'experimental',
1060 b'experimental',
1061 b'mmapindexthreshold',
1061 b'mmapindexthreshold',
1062 default=None,
1062 default=None,
1063 )
1063 )
1064 coreconfigitem(
1064 coreconfigitem(
1065 b'experimental',
1065 b'experimental',
1066 b'narrow',
1066 b'narrow',
1067 default=False,
1067 default=False,
1068 )
1068 )
1069 coreconfigitem(
1069 coreconfigitem(
1070 b'experimental',
1070 b'experimental',
1071 b'nonnormalparanoidcheck',
1071 b'nonnormalparanoidcheck',
1072 default=False,
1072 default=False,
1073 )
1073 )
1074 coreconfigitem(
1074 coreconfigitem(
1075 b'experimental',
1075 b'experimental',
1076 b'exportableenviron',
1076 b'exportableenviron',
1077 default=list,
1077 default=list,
1078 )
1078 )
1079 coreconfigitem(
1079 coreconfigitem(
1080 b'experimental',
1080 b'experimental',
1081 b'extendedheader.index',
1081 b'extendedheader.index',
1082 default=None,
1082 default=None,
1083 )
1083 )
1084 coreconfigitem(
1084 coreconfigitem(
1085 b'experimental',
1085 b'experimental',
1086 b'extendedheader.similarity',
1086 b'extendedheader.similarity',
1087 default=False,
1087 default=False,
1088 )
1088 )
1089 coreconfigitem(
1089 coreconfigitem(
1090 b'experimental',
1090 b'experimental',
1091 b'graphshorten',
1091 b'graphshorten',
1092 default=False,
1092 default=False,
1093 )
1093 )
1094 coreconfigitem(
1094 coreconfigitem(
1095 b'experimental',
1095 b'experimental',
1096 b'graphstyle.parent',
1096 b'graphstyle.parent',
1097 default=dynamicdefault,
1097 default=dynamicdefault,
1098 )
1098 )
1099 coreconfigitem(
1099 coreconfigitem(
1100 b'experimental',
1100 b'experimental',
1101 b'graphstyle.missing',
1101 b'graphstyle.missing',
1102 default=dynamicdefault,
1102 default=dynamicdefault,
1103 )
1103 )
1104 coreconfigitem(
1104 coreconfigitem(
1105 b'experimental',
1105 b'experimental',
1106 b'graphstyle.grandparent',
1106 b'graphstyle.grandparent',
1107 default=dynamicdefault,
1107 default=dynamicdefault,
1108 )
1108 )
1109 coreconfigitem(
1109 coreconfigitem(
1110 b'experimental',
1110 b'experimental',
1111 b'hook-track-tags',
1111 b'hook-track-tags',
1112 default=False,
1112 default=False,
1113 )
1113 )
1114 coreconfigitem(
1114 coreconfigitem(
1115 b'experimental',
1115 b'experimental',
1116 b'httppostargs',
1116 b'httppostargs',
1117 default=False,
1117 default=False,
1118 )
1118 )
1119 coreconfigitem(b'experimental', b'nointerrupt', default=False)
1119 coreconfigitem(b'experimental', b'nointerrupt', default=False)
1120 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
1120 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
1121
1121
1122 coreconfigitem(
1122 coreconfigitem(
1123 b'experimental',
1123 b'experimental',
1124 b'obsmarkers-exchange-debug',
1124 b'obsmarkers-exchange-debug',
1125 default=False,
1125 default=False,
1126 )
1126 )
1127 coreconfigitem(
1127 coreconfigitem(
1128 b'experimental',
1128 b'experimental',
1129 b'remotenames',
1129 b'remotenames',
1130 default=False,
1130 default=False,
1131 )
1131 )
1132 coreconfigitem(
1132 coreconfigitem(
1133 b'experimental',
1133 b'experimental',
1134 b'removeemptydirs',
1134 b'removeemptydirs',
1135 default=True,
1135 default=True,
1136 )
1136 )
1137 coreconfigitem(
1137 coreconfigitem(
1138 b'experimental',
1138 b'experimental',
1139 b'revert.interactive.select-to-keep',
1139 b'revert.interactive.select-to-keep',
1140 default=False,
1140 default=False,
1141 )
1141 )
1142 coreconfigitem(
1142 coreconfigitem(
1143 b'experimental',
1143 b'experimental',
1144 b'revisions.prefixhexnode',
1144 b'revisions.prefixhexnode',
1145 default=False,
1145 default=False,
1146 )
1146 )
1147 # "out of experimental" todo list.
1147 # "out of experimental" todo list.
1148 #
1148 #
1149 # * include management of a persistent nodemap in the main docket
1149 # * include management of a persistent nodemap in the main docket
1150 # * enforce a "no-truncate" policy for mmap safety
1150 # * enforce a "no-truncate" policy for mmap safety
1151 # - for censoring operation
1151 # - for censoring operation
1152 # - for stripping operation
1152 # - for stripping operation
1153 # - for rollback operation
1153 # - for rollback operation
1154 # * proper streaming (race free) of the docket file
1154 # * proper streaming (race free) of the docket file
1155 # * track garbage data to evemtually allow rewriting -existing- sidedata.
1155 # * track garbage data to evemtually allow rewriting -existing- sidedata.
1156 # * Exchange-wise, we will also need to do something more efficient than
1156 # * Exchange-wise, we will also need to do something more efficient than
1157 # keeping references to the affected revlogs, especially memory-wise when
1157 # keeping references to the affected revlogs, especially memory-wise when
1158 # rewriting sidedata.
1158 # rewriting sidedata.
1159 # * introduce a proper solution to reduce the number of filelog related files.
1159 # * introduce a proper solution to reduce the number of filelog related files.
1160 # * use caching for reading sidedata (similar to what we do for data).
1160 # * use caching for reading sidedata (similar to what we do for data).
1161 # * no longer set offset=0 if sidedata_size=0 (simplify cutoff computation).
1161 # * no longer set offset=0 if sidedata_size=0 (simplify cutoff computation).
1162 # * Improvement to consider
1162 # * Improvement to consider
1163 # - avoid compression header in chunk using the default compression?
1163 # - avoid compression header in chunk using the default compression?
1164 # - forbid "inline" compression mode entirely?
1164 # - forbid "inline" compression mode entirely?
1165 # - split the data offset and flag field (the 2 bytes save are mostly trouble)
1165 # - split the data offset and flag field (the 2 bytes save are mostly trouble)
1166 # - keep track of uncompressed -chunk- size (to preallocate memory better)
1166 # - keep track of uncompressed -chunk- size (to preallocate memory better)
1167 # - keep track of chain base or size (probably not that useful anymore)
1167 # - keep track of chain base or size (probably not that useful anymore)
1168 coreconfigitem(
1168 coreconfigitem(
1169 b'experimental',
1169 b'experimental',
1170 b'revlogv2',
1170 b'revlogv2',
1171 default=None,
1171 default=None,
1172 )
1172 )
1173 coreconfigitem(
1173 coreconfigitem(
1174 b'experimental',
1174 b'experimental',
1175 b'revisions.disambiguatewithin',
1175 b'revisions.disambiguatewithin',
1176 default=None,
1176 default=None,
1177 )
1177 )
1178 coreconfigitem(
1178 coreconfigitem(
1179 b'experimental',
1179 b'experimental',
1180 b'rust.index',
1180 b'rust.index',
1181 default=False,
1181 default=False,
1182 )
1182 )
1183 coreconfigitem(
1183 coreconfigitem(
1184 b'experimental',
1184 b'experimental',
1185 b'server.filesdata.recommended-batch-size',
1185 b'server.filesdata.recommended-batch-size',
1186 default=50000,
1186 default=50000,
1187 )
1187 )
1188 coreconfigitem(
1188 coreconfigitem(
1189 b'experimental',
1189 b'experimental',
1190 b'server.manifestdata.recommended-batch-size',
1190 b'server.manifestdata.recommended-batch-size',
1191 default=100000,
1191 default=100000,
1192 )
1192 )
1193 coreconfigitem(
1193 coreconfigitem(
1194 b'experimental',
1194 b'experimental',
1195 b'server.stream-narrow-clones',
1195 b'server.stream-narrow-clones',
1196 default=False,
1196 default=False,
1197 )
1197 )
1198 coreconfigitem(
1198 coreconfigitem(
1199 b'experimental',
1199 b'experimental',
1200 b'single-head-per-branch',
1200 b'single-head-per-branch',
1201 default=False,
1201 default=False,
1202 )
1202 )
1203 coreconfigitem(
1203 coreconfigitem(
1204 b'experimental',
1204 b'experimental',
1205 b'single-head-per-branch:account-closed-heads',
1205 b'single-head-per-branch:account-closed-heads',
1206 default=False,
1206 default=False,
1207 )
1207 )
1208 coreconfigitem(
1208 coreconfigitem(
1209 b'experimental',
1209 b'experimental',
1210 b'single-head-per-branch:public-changes-only',
1210 b'single-head-per-branch:public-changes-only',
1211 default=False,
1211 default=False,
1212 )
1212 )
1213 coreconfigitem(
1213 coreconfigitem(
1214 b'experimental',
1214 b'experimental',
1215 b'sparse-read',
1215 b'sparse-read',
1216 default=False,
1216 default=False,
1217 )
1217 )
1218 coreconfigitem(
1218 coreconfigitem(
1219 b'experimental',
1219 b'experimental',
1220 b'sparse-read.density-threshold',
1220 b'sparse-read.density-threshold',
1221 default=0.50,
1221 default=0.50,
1222 )
1222 )
1223 coreconfigitem(
1223 coreconfigitem(
1224 b'experimental',
1224 b'experimental',
1225 b'sparse-read.min-gap-size',
1225 b'sparse-read.min-gap-size',
1226 default=b'65K',
1226 default=b'65K',
1227 )
1227 )
1228 coreconfigitem(
1228 coreconfigitem(
1229 b'experimental',
1229 b'experimental',
1230 b'treemanifest',
1230 b'treemanifest',
1231 default=False,
1231 default=False,
1232 )
1232 )
1233 coreconfigitem(
1233 coreconfigitem(
1234 b'experimental',
1234 b'experimental',
1235 b'update.atomic-file',
1235 b'update.atomic-file',
1236 default=False,
1236 default=False,
1237 )
1237 )
1238 coreconfigitem(
1238 coreconfigitem(
1239 b'experimental',
1239 b'experimental',
1240 b'web.full-garbage-collection-rate',
1240 b'web.full-garbage-collection-rate',
1241 default=1, # still forcing a full collection on each request
1241 default=1, # still forcing a full collection on each request
1242 )
1242 )
1243 coreconfigitem(
1243 coreconfigitem(
1244 b'experimental',
1244 b'experimental',
1245 b'worker.wdir-get-thread-safe',
1245 b'worker.wdir-get-thread-safe',
1246 default=False,
1246 default=False,
1247 )
1247 )
1248 coreconfigitem(
1248 coreconfigitem(
1249 b'experimental',
1249 b'experimental',
1250 b'worker.repository-upgrade',
1250 b'worker.repository-upgrade',
1251 default=False,
1251 default=False,
1252 )
1252 )
1253 coreconfigitem(
1253 coreconfigitem(
1254 b'experimental',
1254 b'experimental',
1255 b'xdiff',
1255 b'xdiff',
1256 default=False,
1256 default=False,
1257 )
1257 )
1258 coreconfigitem(
1258 coreconfigitem(
1259 b'extensions',
1259 b'extensions',
1260 b'[^:]*',
1260 b'[^:]*',
1261 default=None,
1261 default=None,
1262 generic=True,
1262 generic=True,
1263 )
1263 )
1264 coreconfigitem(
1264 coreconfigitem(
1265 b'extensions',
1265 b'extensions',
1266 b'[^:]*:required',
1266 b'[^:]*:required',
1267 default=False,
1267 default=False,
1268 generic=True,
1268 generic=True,
1269 )
1269 )
1270 coreconfigitem(
1270 coreconfigitem(
1271 b'extdata',
1271 b'extdata',
1272 b'.*',
1272 b'.*',
1273 default=None,
1273 default=None,
1274 generic=True,
1274 generic=True,
1275 )
1275 )
1276 coreconfigitem(
1276 coreconfigitem(
1277 b'format',
1277 b'format',
1278 b'bookmarks-in-store',
1278 b'bookmarks-in-store',
1279 default=False,
1279 default=False,
1280 )
1280 )
1281 coreconfigitem(
1281 coreconfigitem(
1282 b'format',
1282 b'format',
1283 b'chunkcachesize',
1283 b'chunkcachesize',
1284 default=None,
1284 default=None,
1285 experimental=True,
1285 experimental=True,
1286 )
1286 )
1287 coreconfigitem(
1287 coreconfigitem(
1288 # Enable this dirstate format *when creating a new repository*.
1288 # Enable this dirstate format *when creating a new repository*.
1289 # Which format to use for existing repos is controlled by .hg/requires
1289 # Which format to use for existing repos is controlled by .hg/requires
1290 b'format',
1290 b'format',
1291 b'use-dirstate-v2',
1291 b'use-dirstate-v2',
1292 default=False,
1292 default=False,
1293 experimental=True,
1293 experimental=True,
1294 alias=[(b'format', b'exp-rc-dirstate-v2')],
1294 alias=[(b'format', b'exp-rc-dirstate-v2')],
1295 )
1295 )
1296 coreconfigitem(
1296 coreconfigitem(
1297 b'format',
1297 b'format',
1298 b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories',
1298 b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories',
1299 default=False,
1299 default=False,
1300 experimental=True,
1300 experimental=True,
1301 )
1301 )
1302 coreconfigitem(
1302 coreconfigitem(
1303 b'format',
1303 b'format',
1304 b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories:quiet',
1304 b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories:quiet',
1305 default=False,
1305 default=False,
1306 experimental=True,
1306 experimental=True,
1307 )
1307 )
1308 coreconfigitem(
1308 coreconfigitem(
1309 b'format',
1309 b'format',
1310 b'use-dirstate-tracked-hint',
1310 b'use-dirstate-tracked-hint',
1311 default=False,
1311 default=False,
1312 experimental=True,
1312 experimental=True,
1313 )
1313 )
1314 coreconfigitem(
1314 coreconfigitem(
1315 b'format',
1315 b'format',
1316 b'use-dirstate-tracked-hint.version',
1316 b'use-dirstate-tracked-hint.version',
1317 default=1,
1317 default=1,
1318 experimental=True,
1318 experimental=True,
1319 )
1319 )
1320 coreconfigitem(
1320 coreconfigitem(
1321 b'format',
1321 b'format',
1322 b'use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories',
1322 b'use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories',
1323 default=False,
1323 default=False,
1324 experimental=True,
1324 experimental=True,
1325 )
1325 )
1326 coreconfigitem(
1326 coreconfigitem(
1327 b'format',
1327 b'format',
1328 b'use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories:quiet',
1328 b'use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories:quiet',
1329 default=False,
1329 default=False,
1330 experimental=True,
1330 experimental=True,
1331 )
1331 )
1332 coreconfigitem(
1332 coreconfigitem(
1333 b'format',
1333 b'format',
1334 b'dotencode',
1334 b'dotencode',
1335 default=True,
1335 default=True,
1336 )
1336 )
1337 coreconfigitem(
1337 coreconfigitem(
1338 b'format',
1338 b'format',
1339 b'generaldelta',
1339 b'generaldelta',
1340 default=False,
1340 default=False,
1341 experimental=True,
1341 experimental=True,
1342 )
1342 )
1343 coreconfigitem(
1343 coreconfigitem(
1344 b'format',
1344 b'format',
1345 b'manifestcachesize',
1345 b'manifestcachesize',
1346 default=None,
1346 default=None,
1347 experimental=True,
1347 experimental=True,
1348 )
1348 )
1349 coreconfigitem(
1349 coreconfigitem(
1350 b'format',
1350 b'format',
1351 b'maxchainlen',
1351 b'maxchainlen',
1352 default=dynamicdefault,
1352 default=dynamicdefault,
1353 experimental=True,
1353 experimental=True,
1354 )
1354 )
1355 coreconfigitem(
1355 coreconfigitem(
1356 b'format',
1356 b'format',
1357 b'obsstore-version',
1357 b'obsstore-version',
1358 default=None,
1358 default=None,
1359 )
1359 )
1360 coreconfigitem(
1360 coreconfigitem(
1361 b'format',
1361 b'format',
1362 b'sparse-revlog',
1362 b'sparse-revlog',
1363 default=True,
1363 default=True,
1364 )
1364 )
1365 coreconfigitem(
1365 coreconfigitem(
1366 b'format',
1366 b'format',
1367 b'revlog-compression',
1367 b'revlog-compression',
1368 default=lambda: [b'zstd', b'zlib'],
1368 default=lambda: [b'zstd', b'zlib'],
1369 alias=[(b'experimental', b'format.compression')],
1369 alias=[(b'experimental', b'format.compression')],
1370 )
1370 )
1371 # Experimental TODOs:
1371 # Experimental TODOs:
1372 #
1372 #
1373 # * Same as for revlogv2 (but for the reduction of the number of files)
1373 # * Same as for revlogv2 (but for the reduction of the number of files)
1374 # * Actually computing the rank of changesets
1374 # * Actually computing the rank of changesets
1375 # * Improvement to investigate
1375 # * Improvement to investigate
1376 # - storing .hgtags fnode
1376 # - storing .hgtags fnode
1377 # - storing branch related identifier
1377 # - storing branch related identifier
1378
1378
1379 coreconfigitem(
1379 coreconfigitem(
1380 b'format',
1380 b'format',
1381 b'exp-use-changelog-v2',
1381 b'exp-use-changelog-v2',
1382 default=None,
1382 default=None,
1383 experimental=True,
1383 experimental=True,
1384 )
1384 )
1385 coreconfigitem(
1385 coreconfigitem(
1386 b'format',
1386 b'format',
1387 b'usefncache',
1387 b'usefncache',
1388 default=True,
1388 default=True,
1389 )
1389 )
1390 coreconfigitem(
1390 coreconfigitem(
1391 b'format',
1391 b'format',
1392 b'usegeneraldelta',
1392 b'usegeneraldelta',
1393 default=True,
1393 default=True,
1394 )
1394 )
1395 coreconfigitem(
1395 coreconfigitem(
1396 b'format',
1396 b'format',
1397 b'usestore',
1397 b'usestore',
1398 default=True,
1398 default=True,
1399 )
1399 )
1400
1400
1401
1401
1402 def _persistent_nodemap_default():
1402 def _persistent_nodemap_default():
1403 """compute `use-persistent-nodemap` default value
1403 """compute `use-persistent-nodemap` default value
1404
1404
1405 The feature is disabled unless a fast implementation is available.
1405 The feature is disabled unless a fast implementation is available.
1406 """
1406 """
1407 from . import policy
1407 from . import policy
1408
1408
1409 return policy.importrust('revlog') is not None
1409 return policy.importrust('revlog') is not None
1410
1410
1411
1411
1412 coreconfigitem(
1412 coreconfigitem(
1413 b'format',
1413 b'format',
1414 b'use-persistent-nodemap',
1414 b'use-persistent-nodemap',
1415 default=_persistent_nodemap_default,
1415 default=_persistent_nodemap_default,
1416 )
1416 )
1417 coreconfigitem(
1417 coreconfigitem(
1418 b'format',
1418 b'format',
1419 b'exp-use-copies-side-data-changeset',
1419 b'exp-use-copies-side-data-changeset',
1420 default=False,
1420 default=False,
1421 experimental=True,
1421 experimental=True,
1422 )
1422 )
1423 coreconfigitem(
1423 coreconfigitem(
1424 b'format',
1424 b'format',
1425 b'use-share-safe',
1425 b'use-share-safe',
1426 default=True,
1426 default=True,
1427 )
1427 )
1428 coreconfigitem(
1428 coreconfigitem(
1429 b'format',
1429 b'format',
1430 b'use-share-safe.automatic-upgrade-of-mismatching-repositories',
1430 b'use-share-safe.automatic-upgrade-of-mismatching-repositories',
1431 default=False,
1431 default=False,
1432 experimental=True,
1432 experimental=True,
1433 )
1433 )
1434 coreconfigitem(
1434 coreconfigitem(
1435 b'format',
1435 b'format',
1436 b'use-share-safe.automatic-upgrade-of-mismatching-repositories:quiet',
1436 b'use-share-safe.automatic-upgrade-of-mismatching-repositories:quiet',
1437 default=False,
1437 default=False,
1438 experimental=True,
1438 experimental=True,
1439 )
1439 )
1440
1440
1441 # Moving this on by default means we are confident about the scaling of phases.
1441 # Moving this on by default means we are confident about the scaling of phases.
1442 # This is not garanteed to be the case at the time this message is written.
1442 # This is not garanteed to be the case at the time this message is written.
1443 coreconfigitem(
1443 coreconfigitem(
1444 b'format',
1444 b'format',
1445 b'use-internal-phase',
1445 b'use-internal-phase',
1446 default=False,
1446 default=False,
1447 experimental=True,
1447 experimental=True,
1448 )
1448 )
1449 # The interaction between the archived phase and obsolescence markers needs to
1449 # The interaction between the archived phase and obsolescence markers needs to
1450 # be sorted out before wider usage of this are to be considered.
1450 # be sorted out before wider usage of this are to be considered.
1451 #
1451 #
1452 # At the time this message is written, behavior when archiving obsolete
1452 # At the time this message is written, behavior when archiving obsolete
1453 # changeset differ significantly from stripping. As part of stripping, we also
1453 # changeset differ significantly from stripping. As part of stripping, we also
1454 # remove the obsolescence marker associated to the stripped changesets,
1454 # remove the obsolescence marker associated to the stripped changesets,
1455 # revealing the precedecessors changesets when applicable. When archiving, we
1455 # revealing the precedecessors changesets when applicable. When archiving, we
1456 # don't touch the obsolescence markers, keeping everything hidden. This can
1456 # don't touch the obsolescence markers, keeping everything hidden. This can
1457 # result in quite confusing situation for people combining exchanging draft
1457 # result in quite confusing situation for people combining exchanging draft
1458 # with the archived phases. As some markers needed by others may be skipped
1458 # with the archived phases. As some markers needed by others may be skipped
1459 # during exchange.
1459 # during exchange.
1460 coreconfigitem(
1460 coreconfigitem(
1461 b'format',
1461 b'format',
1462 b'exp-archived-phase',
1462 b'exp-archived-phase',
1463 default=False,
1463 default=False,
1464 experimental=True,
1464 experimental=True,
1465 )
1465 )
1466 coreconfigitem(
1466 coreconfigitem(
1467 b'shelve',
1467 b'shelve',
1468 b'store',
1468 b'store',
1469 default=b'internal',
1469 default=b'internal',
1470 experimental=True,
1470 experimental=True,
1471 )
1471 )
1472 coreconfigitem(
1472 coreconfigitem(
1473 b'fsmonitor',
1473 b'fsmonitor',
1474 b'warn_when_unused',
1474 b'warn_when_unused',
1475 default=True,
1475 default=True,
1476 )
1476 )
1477 coreconfigitem(
1477 coreconfigitem(
1478 b'fsmonitor',
1478 b'fsmonitor',
1479 b'warn_update_file_count',
1479 b'warn_update_file_count',
1480 default=50000,
1480 default=50000,
1481 )
1481 )
1482 coreconfigitem(
1482 coreconfigitem(
1483 b'fsmonitor',
1483 b'fsmonitor',
1484 b'warn_update_file_count_rust',
1484 b'warn_update_file_count_rust',
1485 default=400000,
1485 default=400000,
1486 )
1486 )
1487 coreconfigitem(
1487 coreconfigitem(
1488 b'help',
1488 b'help',
1489 br'hidden-command\..*',
1489 br'hidden-command\..*',
1490 default=False,
1490 default=False,
1491 generic=True,
1491 generic=True,
1492 )
1492 )
1493 coreconfigitem(
1493 coreconfigitem(
1494 b'help',
1494 b'help',
1495 br'hidden-topic\..*',
1495 br'hidden-topic\..*',
1496 default=False,
1496 default=False,
1497 generic=True,
1497 generic=True,
1498 )
1498 )
1499 coreconfigitem(
1499 coreconfigitem(
1500 b'hooks',
1500 b'hooks',
1501 b'[^:]*',
1501 b'[^:]*',
1502 default=dynamicdefault,
1502 default=dynamicdefault,
1503 generic=True,
1503 generic=True,
1504 )
1504 )
1505 coreconfigitem(
1505 coreconfigitem(
1506 b'hooks',
1506 b'hooks',
1507 b'.*:run-with-plain',
1507 b'.*:run-with-plain',
1508 default=True,
1508 default=True,
1509 generic=True,
1509 generic=True,
1510 )
1510 )
1511 coreconfigitem(
1511 coreconfigitem(
1512 b'hgweb-paths',
1512 b'hgweb-paths',
1513 b'.*',
1513 b'.*',
1514 default=list,
1514 default=list,
1515 generic=True,
1515 generic=True,
1516 )
1516 )
1517 coreconfigitem(
1517 coreconfigitem(
1518 b'hostfingerprints',
1518 b'hostfingerprints',
1519 b'.*',
1519 b'.*',
1520 default=list,
1520 default=list,
1521 generic=True,
1521 generic=True,
1522 )
1522 )
1523 coreconfigitem(
1523 coreconfigitem(
1524 b'hostsecurity',
1524 b'hostsecurity',
1525 b'ciphers',
1525 b'ciphers',
1526 default=None,
1526 default=None,
1527 )
1527 )
1528 coreconfigitem(
1528 coreconfigitem(
1529 b'hostsecurity',
1529 b'hostsecurity',
1530 b'minimumprotocol',
1530 b'minimumprotocol',
1531 default=dynamicdefault,
1531 default=dynamicdefault,
1532 )
1532 )
1533 coreconfigitem(
1533 coreconfigitem(
1534 b'hostsecurity',
1534 b'hostsecurity',
1535 b'.*:minimumprotocol$',
1535 b'.*:minimumprotocol$',
1536 default=dynamicdefault,
1536 default=dynamicdefault,
1537 generic=True,
1537 generic=True,
1538 )
1538 )
1539 coreconfigitem(
1539 coreconfigitem(
1540 b'hostsecurity',
1540 b'hostsecurity',
1541 b'.*:ciphers$',
1541 b'.*:ciphers$',
1542 default=dynamicdefault,
1542 default=dynamicdefault,
1543 generic=True,
1543 generic=True,
1544 )
1544 )
1545 coreconfigitem(
1545 coreconfigitem(
1546 b'hostsecurity',
1546 b'hostsecurity',
1547 b'.*:fingerprints$',
1547 b'.*:fingerprints$',
1548 default=list,
1548 default=list,
1549 generic=True,
1549 generic=True,
1550 )
1550 )
1551 coreconfigitem(
1551 coreconfigitem(
1552 b'hostsecurity',
1552 b'hostsecurity',
1553 b'.*:verifycertsfile$',
1553 b'.*:verifycertsfile$',
1554 default=None,
1554 default=None,
1555 generic=True,
1555 generic=True,
1556 )
1556 )
1557
1557
1558 coreconfigitem(
1558 coreconfigitem(
1559 b'http_proxy',
1559 b'http_proxy',
1560 b'always',
1560 b'always',
1561 default=False,
1561 default=False,
1562 )
1562 )
1563 coreconfigitem(
1563 coreconfigitem(
1564 b'http_proxy',
1564 b'http_proxy',
1565 b'host',
1565 b'host',
1566 default=None,
1566 default=None,
1567 )
1567 )
1568 coreconfigitem(
1568 coreconfigitem(
1569 b'http_proxy',
1569 b'http_proxy',
1570 b'no',
1570 b'no',
1571 default=list,
1571 default=list,
1572 )
1572 )
1573 coreconfigitem(
1573 coreconfigitem(
1574 b'http_proxy',
1574 b'http_proxy',
1575 b'passwd',
1575 b'passwd',
1576 default=None,
1576 default=None,
1577 )
1577 )
1578 coreconfigitem(
1578 coreconfigitem(
1579 b'http_proxy',
1579 b'http_proxy',
1580 b'user',
1580 b'user',
1581 default=None,
1581 default=None,
1582 )
1582 )
1583
1583
1584 coreconfigitem(
1584 coreconfigitem(
1585 b'http',
1585 b'http',
1586 b'timeout',
1586 b'timeout',
1587 default=None,
1587 default=None,
1588 )
1588 )
1589
1589
1590 coreconfigitem(
1590 coreconfigitem(
1591 b'logtoprocess',
1591 b'logtoprocess',
1592 b'commandexception',
1592 b'commandexception',
1593 default=None,
1593 default=None,
1594 )
1594 )
1595 coreconfigitem(
1595 coreconfigitem(
1596 b'logtoprocess',
1596 b'logtoprocess',
1597 b'commandfinish',
1597 b'commandfinish',
1598 default=None,
1598 default=None,
1599 )
1599 )
1600 coreconfigitem(
1600 coreconfigitem(
1601 b'logtoprocess',
1601 b'logtoprocess',
1602 b'command',
1602 b'command',
1603 default=None,
1603 default=None,
1604 )
1604 )
1605 coreconfigitem(
1605 coreconfigitem(
1606 b'logtoprocess',
1606 b'logtoprocess',
1607 b'develwarn',
1607 b'develwarn',
1608 default=None,
1608 default=None,
1609 )
1609 )
1610 coreconfigitem(
1610 coreconfigitem(
1611 b'logtoprocess',
1611 b'logtoprocess',
1612 b'uiblocked',
1612 b'uiblocked',
1613 default=None,
1613 default=None,
1614 )
1614 )
1615 coreconfigitem(
1615 coreconfigitem(
1616 b'merge',
1616 b'merge',
1617 b'checkunknown',
1617 b'checkunknown',
1618 default=b'abort',
1618 default=b'abort',
1619 )
1619 )
1620 coreconfigitem(
1620 coreconfigitem(
1621 b'merge',
1621 b'merge',
1622 b'checkignored',
1622 b'checkignored',
1623 default=b'abort',
1623 default=b'abort',
1624 )
1624 )
1625 coreconfigitem(
1625 coreconfigitem(
1626 b'experimental',
1626 b'experimental',
1627 b'merge.checkpathconflicts',
1627 b'merge.checkpathconflicts',
1628 default=False,
1628 default=False,
1629 )
1629 )
1630 coreconfigitem(
1630 coreconfigitem(
1631 b'merge',
1631 b'merge',
1632 b'followcopies',
1632 b'followcopies',
1633 default=True,
1633 default=True,
1634 )
1634 )
1635 coreconfigitem(
1635 coreconfigitem(
1636 b'merge',
1636 b'merge',
1637 b'on-failure',
1637 b'on-failure',
1638 default=b'continue',
1638 default=b'continue',
1639 )
1639 )
1640 coreconfigitem(
1640 coreconfigitem(
1641 b'merge',
1641 b'merge',
1642 b'preferancestor',
1642 b'preferancestor',
1643 default=lambda: [b'*'],
1643 default=lambda: [b'*'],
1644 experimental=True,
1644 experimental=True,
1645 )
1645 )
1646 coreconfigitem(
1646 coreconfigitem(
1647 b'merge',
1647 b'merge',
1648 b'strict-capability-check',
1648 b'strict-capability-check',
1649 default=False,
1649 default=False,
1650 )
1650 )
1651 coreconfigitem(
1651 coreconfigitem(
1652 b'merge',
1652 b'merge',
1653 b'disable-partial-tools',
1653 b'disable-partial-tools',
1654 default=False,
1654 default=False,
1655 experimental=True,
1655 experimental=True,
1656 )
1656 )
1657 coreconfigitem(
1657 coreconfigitem(
1658 b'partial-merge-tools',
1658 b'partial-merge-tools',
1659 b'.*',
1659 b'.*',
1660 default=None,
1660 default=None,
1661 generic=True,
1661 generic=True,
1662 experimental=True,
1662 experimental=True,
1663 )
1663 )
1664 coreconfigitem(
1664 coreconfigitem(
1665 b'partial-merge-tools',
1665 b'partial-merge-tools',
1666 br'.*\.patterns',
1666 br'.*\.patterns',
1667 default=dynamicdefault,
1667 default=dynamicdefault,
1668 generic=True,
1668 generic=True,
1669 priority=-1,
1669 priority=-1,
1670 experimental=True,
1670 experimental=True,
1671 )
1671 )
1672 coreconfigitem(
1672 coreconfigitem(
1673 b'partial-merge-tools',
1673 b'partial-merge-tools',
1674 br'.*\.executable$',
1674 br'.*\.executable$',
1675 default=dynamicdefault,
1675 default=dynamicdefault,
1676 generic=True,
1676 generic=True,
1677 priority=-1,
1677 priority=-1,
1678 experimental=True,
1678 experimental=True,
1679 )
1679 )
1680 coreconfigitem(
1680 coreconfigitem(
1681 b'partial-merge-tools',
1681 b'partial-merge-tools',
1682 br'.*\.order',
1682 br'.*\.order',
1683 default=0,
1683 default=0,
1684 generic=True,
1684 generic=True,
1685 priority=-1,
1685 priority=-1,
1686 experimental=True,
1686 experimental=True,
1687 )
1687 )
1688 coreconfigitem(
1688 coreconfigitem(
1689 b'partial-merge-tools',
1689 b'partial-merge-tools',
1690 br'.*\.args',
1690 br'.*\.args',
1691 default=b"$local $base $other",
1691 default=b"$local $base $other",
1692 generic=True,
1692 generic=True,
1693 priority=-1,
1693 priority=-1,
1694 experimental=True,
1694 experimental=True,
1695 )
1695 )
1696 coreconfigitem(
1696 coreconfigitem(
1697 b'partial-merge-tools',
1697 b'partial-merge-tools',
1698 br'.*\.disable',
1698 br'.*\.disable',
1699 default=False,
1699 default=False,
1700 generic=True,
1700 generic=True,
1701 priority=-1,
1701 priority=-1,
1702 experimental=True,
1702 experimental=True,
1703 )
1703 )
1704 coreconfigitem(
1704 coreconfigitem(
1705 b'merge-tools',
1705 b'merge-tools',
1706 b'.*',
1706 b'.*',
1707 default=None,
1707 default=None,
1708 generic=True,
1708 generic=True,
1709 )
1709 )
1710 coreconfigitem(
1710 coreconfigitem(
1711 b'merge-tools',
1711 b'merge-tools',
1712 br'.*\.args$',
1712 br'.*\.args$',
1713 default=b"$local $base $other",
1713 default=b"$local $base $other",
1714 generic=True,
1714 generic=True,
1715 priority=-1,
1715 priority=-1,
1716 )
1716 )
1717 coreconfigitem(
1717 coreconfigitem(
1718 b'merge-tools',
1718 b'merge-tools',
1719 br'.*\.binary$',
1719 br'.*\.binary$',
1720 default=False,
1720 default=False,
1721 generic=True,
1721 generic=True,
1722 priority=-1,
1722 priority=-1,
1723 )
1723 )
1724 coreconfigitem(
1724 coreconfigitem(
1725 b'merge-tools',
1725 b'merge-tools',
1726 br'.*\.check$',
1726 br'.*\.check$',
1727 default=list,
1727 default=list,
1728 generic=True,
1728 generic=True,
1729 priority=-1,
1729 priority=-1,
1730 )
1730 )
1731 coreconfigitem(
1731 coreconfigitem(
1732 b'merge-tools',
1732 b'merge-tools',
1733 br'.*\.checkchanged$',
1733 br'.*\.checkchanged$',
1734 default=False,
1734 default=False,
1735 generic=True,
1735 generic=True,
1736 priority=-1,
1736 priority=-1,
1737 )
1737 )
1738 coreconfigitem(
1738 coreconfigitem(
1739 b'merge-tools',
1739 b'merge-tools',
1740 br'.*\.executable$',
1740 br'.*\.executable$',
1741 default=dynamicdefault,
1741 default=dynamicdefault,
1742 generic=True,
1742 generic=True,
1743 priority=-1,
1743 priority=-1,
1744 )
1744 )
1745 coreconfigitem(
1745 coreconfigitem(
1746 b'merge-tools',
1746 b'merge-tools',
1747 br'.*\.fixeol$',
1747 br'.*\.fixeol$',
1748 default=False,
1748 default=False,
1749 generic=True,
1749 generic=True,
1750 priority=-1,
1750 priority=-1,
1751 )
1751 )
1752 coreconfigitem(
1752 coreconfigitem(
1753 b'merge-tools',
1753 b'merge-tools',
1754 br'.*\.gui$',
1754 br'.*\.gui$',
1755 default=False,
1755 default=False,
1756 generic=True,
1756 generic=True,
1757 priority=-1,
1757 priority=-1,
1758 )
1758 )
1759 coreconfigitem(
1759 coreconfigitem(
1760 b'merge-tools',
1760 b'merge-tools',
1761 br'.*\.mergemarkers$',
1761 br'.*\.mergemarkers$',
1762 default=b'basic',
1762 default=b'basic',
1763 generic=True,
1763 generic=True,
1764 priority=-1,
1764 priority=-1,
1765 )
1765 )
1766 coreconfigitem(
1766 coreconfigitem(
1767 b'merge-tools',
1767 b'merge-tools',
1768 br'.*\.mergemarkertemplate$',
1768 br'.*\.mergemarkertemplate$',
1769 default=dynamicdefault, # take from command-templates.mergemarker
1769 default=dynamicdefault, # take from command-templates.mergemarker
1770 generic=True,
1770 generic=True,
1771 priority=-1,
1771 priority=-1,
1772 )
1772 )
1773 coreconfigitem(
1773 coreconfigitem(
1774 b'merge-tools',
1774 b'merge-tools',
1775 br'.*\.priority$',
1775 br'.*\.priority$',
1776 default=0,
1776 default=0,
1777 generic=True,
1777 generic=True,
1778 priority=-1,
1778 priority=-1,
1779 )
1779 )
1780 coreconfigitem(
1780 coreconfigitem(
1781 b'merge-tools',
1781 b'merge-tools',
1782 br'.*\.premerge$',
1782 br'.*\.premerge$',
1783 default=dynamicdefault,
1783 default=dynamicdefault,
1784 generic=True,
1784 generic=True,
1785 priority=-1,
1785 priority=-1,
1786 )
1786 )
1787 coreconfigitem(
1787 coreconfigitem(
1788 b'merge-tools',
1788 b'merge-tools',
1789 br'.*\.regappend$',
1790 default=b"",
1791 generic=True,
1792 priority=-1,
1793 )
1794 coreconfigitem(
1795 b'merge-tools',
1789 br'.*\.symlink$',
1796 br'.*\.symlink$',
1790 default=False,
1797 default=False,
1791 generic=True,
1798 generic=True,
1792 priority=-1,
1799 priority=-1,
1793 )
1800 )
1794 coreconfigitem(
1801 coreconfigitem(
1795 b'pager',
1802 b'pager',
1796 b'attend-.*',
1803 b'attend-.*',
1797 default=dynamicdefault,
1804 default=dynamicdefault,
1798 generic=True,
1805 generic=True,
1799 )
1806 )
1800 coreconfigitem(
1807 coreconfigitem(
1801 b'pager',
1808 b'pager',
1802 b'ignore',
1809 b'ignore',
1803 default=list,
1810 default=list,
1804 )
1811 )
1805 coreconfigitem(
1812 coreconfigitem(
1806 b'pager',
1813 b'pager',
1807 b'pager',
1814 b'pager',
1808 default=dynamicdefault,
1815 default=dynamicdefault,
1809 )
1816 )
1810 coreconfigitem(
1817 coreconfigitem(
1811 b'patch',
1818 b'patch',
1812 b'eol',
1819 b'eol',
1813 default=b'strict',
1820 default=b'strict',
1814 )
1821 )
1815 coreconfigitem(
1822 coreconfigitem(
1816 b'patch',
1823 b'patch',
1817 b'fuzz',
1824 b'fuzz',
1818 default=2,
1825 default=2,
1819 )
1826 )
1820 coreconfigitem(
1827 coreconfigitem(
1821 b'paths',
1828 b'paths',
1822 b'default',
1829 b'default',
1823 default=None,
1830 default=None,
1824 )
1831 )
1825 coreconfigitem(
1832 coreconfigitem(
1826 b'paths',
1833 b'paths',
1827 b'default-push',
1834 b'default-push',
1828 default=None,
1835 default=None,
1829 )
1836 )
1830 coreconfigitem(
1837 coreconfigitem(
1831 b'paths',
1838 b'paths',
1832 b'.*',
1839 b'.*',
1833 default=None,
1840 default=None,
1834 generic=True,
1841 generic=True,
1835 )
1842 )
1836 coreconfigitem(
1843 coreconfigitem(
1837 b'paths',
1844 b'paths',
1838 b'.*:bookmarks.mode',
1845 b'.*:bookmarks.mode',
1839 default='default',
1846 default='default',
1840 generic=True,
1847 generic=True,
1841 )
1848 )
1842 coreconfigitem(
1849 coreconfigitem(
1843 b'paths',
1850 b'paths',
1844 b'.*:multi-urls',
1851 b'.*:multi-urls',
1845 default=False,
1852 default=False,
1846 generic=True,
1853 generic=True,
1847 )
1854 )
1848 coreconfigitem(
1855 coreconfigitem(
1849 b'paths',
1856 b'paths',
1850 b'.*:pushrev',
1857 b'.*:pushrev',
1851 default=None,
1858 default=None,
1852 generic=True,
1859 generic=True,
1853 )
1860 )
1854 coreconfigitem(
1861 coreconfigitem(
1855 b'paths',
1862 b'paths',
1856 b'.*:pushurl',
1863 b'.*:pushurl',
1857 default=None,
1864 default=None,
1858 generic=True,
1865 generic=True,
1859 )
1866 )
1860 coreconfigitem(
1867 coreconfigitem(
1861 b'phases',
1868 b'phases',
1862 b'checksubrepos',
1869 b'checksubrepos',
1863 default=b'follow',
1870 default=b'follow',
1864 )
1871 )
1865 coreconfigitem(
1872 coreconfigitem(
1866 b'phases',
1873 b'phases',
1867 b'new-commit',
1874 b'new-commit',
1868 default=b'draft',
1875 default=b'draft',
1869 )
1876 )
1870 coreconfigitem(
1877 coreconfigitem(
1871 b'phases',
1878 b'phases',
1872 b'publish',
1879 b'publish',
1873 default=True,
1880 default=True,
1874 )
1881 )
1875 coreconfigitem(
1882 coreconfigitem(
1876 b'profiling',
1883 b'profiling',
1877 b'enabled',
1884 b'enabled',
1878 default=False,
1885 default=False,
1879 )
1886 )
1880 coreconfigitem(
1887 coreconfigitem(
1881 b'profiling',
1888 b'profiling',
1882 b'format',
1889 b'format',
1883 default=b'text',
1890 default=b'text',
1884 )
1891 )
1885 coreconfigitem(
1892 coreconfigitem(
1886 b'profiling',
1893 b'profiling',
1887 b'freq',
1894 b'freq',
1888 default=1000,
1895 default=1000,
1889 )
1896 )
1890 coreconfigitem(
1897 coreconfigitem(
1891 b'profiling',
1898 b'profiling',
1892 b'limit',
1899 b'limit',
1893 default=30,
1900 default=30,
1894 )
1901 )
1895 coreconfigitem(
1902 coreconfigitem(
1896 b'profiling',
1903 b'profiling',
1897 b'nested',
1904 b'nested',
1898 default=0,
1905 default=0,
1899 )
1906 )
1900 coreconfigitem(
1907 coreconfigitem(
1901 b'profiling',
1908 b'profiling',
1902 b'output',
1909 b'output',
1903 default=None,
1910 default=None,
1904 )
1911 )
1905 coreconfigitem(
1912 coreconfigitem(
1906 b'profiling',
1913 b'profiling',
1907 b'showmax',
1914 b'showmax',
1908 default=0.999,
1915 default=0.999,
1909 )
1916 )
1910 coreconfigitem(
1917 coreconfigitem(
1911 b'profiling',
1918 b'profiling',
1912 b'showmin',
1919 b'showmin',
1913 default=dynamicdefault,
1920 default=dynamicdefault,
1914 )
1921 )
1915 coreconfigitem(
1922 coreconfigitem(
1916 b'profiling',
1923 b'profiling',
1917 b'showtime',
1924 b'showtime',
1918 default=True,
1925 default=True,
1919 )
1926 )
1920 coreconfigitem(
1927 coreconfigitem(
1921 b'profiling',
1928 b'profiling',
1922 b'sort',
1929 b'sort',
1923 default=b'inlinetime',
1930 default=b'inlinetime',
1924 )
1931 )
1925 coreconfigitem(
1932 coreconfigitem(
1926 b'profiling',
1933 b'profiling',
1927 b'statformat',
1934 b'statformat',
1928 default=b'hotpath',
1935 default=b'hotpath',
1929 )
1936 )
1930 coreconfigitem(
1937 coreconfigitem(
1931 b'profiling',
1938 b'profiling',
1932 b'time-track',
1939 b'time-track',
1933 default=dynamicdefault,
1940 default=dynamicdefault,
1934 )
1941 )
1935 coreconfigitem(
1942 coreconfigitem(
1936 b'profiling',
1943 b'profiling',
1937 b'type',
1944 b'type',
1938 default=b'stat',
1945 default=b'stat',
1939 )
1946 )
1940 coreconfigitem(
1947 coreconfigitem(
1941 b'progress',
1948 b'progress',
1942 b'assume-tty',
1949 b'assume-tty',
1943 default=False,
1950 default=False,
1944 )
1951 )
1945 coreconfigitem(
1952 coreconfigitem(
1946 b'progress',
1953 b'progress',
1947 b'changedelay',
1954 b'changedelay',
1948 default=1,
1955 default=1,
1949 )
1956 )
1950 coreconfigitem(
1957 coreconfigitem(
1951 b'progress',
1958 b'progress',
1952 b'clear-complete',
1959 b'clear-complete',
1953 default=True,
1960 default=True,
1954 )
1961 )
1955 coreconfigitem(
1962 coreconfigitem(
1956 b'progress',
1963 b'progress',
1957 b'debug',
1964 b'debug',
1958 default=False,
1965 default=False,
1959 )
1966 )
1960 coreconfigitem(
1967 coreconfigitem(
1961 b'progress',
1968 b'progress',
1962 b'delay',
1969 b'delay',
1963 default=3,
1970 default=3,
1964 )
1971 )
1965 coreconfigitem(
1972 coreconfigitem(
1966 b'progress',
1973 b'progress',
1967 b'disable',
1974 b'disable',
1968 default=False,
1975 default=False,
1969 )
1976 )
1970 coreconfigitem(
1977 coreconfigitem(
1971 b'progress',
1978 b'progress',
1972 b'estimateinterval',
1979 b'estimateinterval',
1973 default=60.0,
1980 default=60.0,
1974 )
1981 )
1975 coreconfigitem(
1982 coreconfigitem(
1976 b'progress',
1983 b'progress',
1977 b'format',
1984 b'format',
1978 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1985 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1979 )
1986 )
1980 coreconfigitem(
1987 coreconfigitem(
1981 b'progress',
1988 b'progress',
1982 b'refresh',
1989 b'refresh',
1983 default=0.1,
1990 default=0.1,
1984 )
1991 )
1985 coreconfigitem(
1992 coreconfigitem(
1986 b'progress',
1993 b'progress',
1987 b'width',
1994 b'width',
1988 default=dynamicdefault,
1995 default=dynamicdefault,
1989 )
1996 )
1990 coreconfigitem(
1997 coreconfigitem(
1991 b'pull',
1998 b'pull',
1992 b'confirm',
1999 b'confirm',
1993 default=False,
2000 default=False,
1994 )
2001 )
1995 coreconfigitem(
2002 coreconfigitem(
1996 b'push',
2003 b'push',
1997 b'pushvars.server',
2004 b'pushvars.server',
1998 default=False,
2005 default=False,
1999 )
2006 )
2000 coreconfigitem(
2007 coreconfigitem(
2001 b'rewrite',
2008 b'rewrite',
2002 b'backup-bundle',
2009 b'backup-bundle',
2003 default=True,
2010 default=True,
2004 alias=[(b'ui', b'history-editing-backup')],
2011 alias=[(b'ui', b'history-editing-backup')],
2005 )
2012 )
2006 coreconfigitem(
2013 coreconfigitem(
2007 b'rewrite',
2014 b'rewrite',
2008 b'update-timestamp',
2015 b'update-timestamp',
2009 default=False,
2016 default=False,
2010 )
2017 )
2011 coreconfigitem(
2018 coreconfigitem(
2012 b'rewrite',
2019 b'rewrite',
2013 b'empty-successor',
2020 b'empty-successor',
2014 default=b'skip',
2021 default=b'skip',
2015 experimental=True,
2022 experimental=True,
2016 )
2023 )
2017 # experimental as long as format.use-dirstate-v2 is.
2024 # experimental as long as format.use-dirstate-v2 is.
2018 coreconfigitem(
2025 coreconfigitem(
2019 b'storage',
2026 b'storage',
2020 b'dirstate-v2.slow-path',
2027 b'dirstate-v2.slow-path',
2021 default=b"abort",
2028 default=b"abort",
2022 experimental=True,
2029 experimental=True,
2023 )
2030 )
2024 coreconfigitem(
2031 coreconfigitem(
2025 b'storage',
2032 b'storage',
2026 b'new-repo-backend',
2033 b'new-repo-backend',
2027 default=b'revlogv1',
2034 default=b'revlogv1',
2028 experimental=True,
2035 experimental=True,
2029 )
2036 )
2030 coreconfigitem(
2037 coreconfigitem(
2031 b'storage',
2038 b'storage',
2032 b'revlog.optimize-delta-parent-choice',
2039 b'revlog.optimize-delta-parent-choice',
2033 default=True,
2040 default=True,
2034 alias=[(b'format', b'aggressivemergedeltas')],
2041 alias=[(b'format', b'aggressivemergedeltas')],
2035 )
2042 )
2036 coreconfigitem(
2043 coreconfigitem(
2037 b'storage',
2044 b'storage',
2038 b'revlog.issue6528.fix-incoming',
2045 b'revlog.issue6528.fix-incoming',
2039 default=True,
2046 default=True,
2040 )
2047 )
2041 # experimental as long as rust is experimental (or a C version is implemented)
2048 # experimental as long as rust is experimental (or a C version is implemented)
2042 coreconfigitem(
2049 coreconfigitem(
2043 b'storage',
2050 b'storage',
2044 b'revlog.persistent-nodemap.mmap',
2051 b'revlog.persistent-nodemap.mmap',
2045 default=True,
2052 default=True,
2046 )
2053 )
2047 # experimental as long as format.use-persistent-nodemap is.
2054 # experimental as long as format.use-persistent-nodemap is.
2048 coreconfigitem(
2055 coreconfigitem(
2049 b'storage',
2056 b'storage',
2050 b'revlog.persistent-nodemap.slow-path',
2057 b'revlog.persistent-nodemap.slow-path',
2051 default=b"abort",
2058 default=b"abort",
2052 )
2059 )
2053
2060
2054 coreconfigitem(
2061 coreconfigitem(
2055 b'storage',
2062 b'storage',
2056 b'revlog.reuse-external-delta',
2063 b'revlog.reuse-external-delta',
2057 default=True,
2064 default=True,
2058 )
2065 )
2059 coreconfigitem(
2066 coreconfigitem(
2060 b'storage',
2067 b'storage',
2061 b'revlog.reuse-external-delta-parent',
2068 b'revlog.reuse-external-delta-parent',
2062 default=None,
2069 default=None,
2063 )
2070 )
2064 coreconfigitem(
2071 coreconfigitem(
2065 b'storage',
2072 b'storage',
2066 b'revlog.zlib.level',
2073 b'revlog.zlib.level',
2067 default=None,
2074 default=None,
2068 )
2075 )
2069 coreconfigitem(
2076 coreconfigitem(
2070 b'storage',
2077 b'storage',
2071 b'revlog.zstd.level',
2078 b'revlog.zstd.level',
2072 default=None,
2079 default=None,
2073 )
2080 )
2074 coreconfigitem(
2081 coreconfigitem(
2075 b'server',
2082 b'server',
2076 b'bookmarks-pushkey-compat',
2083 b'bookmarks-pushkey-compat',
2077 default=True,
2084 default=True,
2078 )
2085 )
2079 coreconfigitem(
2086 coreconfigitem(
2080 b'server',
2087 b'server',
2081 b'bundle1',
2088 b'bundle1',
2082 default=True,
2089 default=True,
2083 )
2090 )
2084 coreconfigitem(
2091 coreconfigitem(
2085 b'server',
2092 b'server',
2086 b'bundle1gd',
2093 b'bundle1gd',
2087 default=None,
2094 default=None,
2088 )
2095 )
2089 coreconfigitem(
2096 coreconfigitem(
2090 b'server',
2097 b'server',
2091 b'bundle1.pull',
2098 b'bundle1.pull',
2092 default=None,
2099 default=None,
2093 )
2100 )
2094 coreconfigitem(
2101 coreconfigitem(
2095 b'server',
2102 b'server',
2096 b'bundle1gd.pull',
2103 b'bundle1gd.pull',
2097 default=None,
2104 default=None,
2098 )
2105 )
2099 coreconfigitem(
2106 coreconfigitem(
2100 b'server',
2107 b'server',
2101 b'bundle1.push',
2108 b'bundle1.push',
2102 default=None,
2109 default=None,
2103 )
2110 )
2104 coreconfigitem(
2111 coreconfigitem(
2105 b'server',
2112 b'server',
2106 b'bundle1gd.push',
2113 b'bundle1gd.push',
2107 default=None,
2114 default=None,
2108 )
2115 )
2109 coreconfigitem(
2116 coreconfigitem(
2110 b'server',
2117 b'server',
2111 b'bundle2.stream',
2118 b'bundle2.stream',
2112 default=True,
2119 default=True,
2113 alias=[(b'experimental', b'bundle2.stream')],
2120 alias=[(b'experimental', b'bundle2.stream')],
2114 )
2121 )
2115 coreconfigitem(
2122 coreconfigitem(
2116 b'server',
2123 b'server',
2117 b'compressionengines',
2124 b'compressionengines',
2118 default=list,
2125 default=list,
2119 )
2126 )
2120 coreconfigitem(
2127 coreconfigitem(
2121 b'server',
2128 b'server',
2122 b'concurrent-push-mode',
2129 b'concurrent-push-mode',
2123 default=b'check-related',
2130 default=b'check-related',
2124 )
2131 )
2125 coreconfigitem(
2132 coreconfigitem(
2126 b'server',
2133 b'server',
2127 b'disablefullbundle',
2134 b'disablefullbundle',
2128 default=False,
2135 default=False,
2129 )
2136 )
2130 coreconfigitem(
2137 coreconfigitem(
2131 b'server',
2138 b'server',
2132 b'maxhttpheaderlen',
2139 b'maxhttpheaderlen',
2133 default=1024,
2140 default=1024,
2134 )
2141 )
2135 coreconfigitem(
2142 coreconfigitem(
2136 b'server',
2143 b'server',
2137 b'pullbundle',
2144 b'pullbundle',
2138 default=True,
2145 default=True,
2139 )
2146 )
2140 coreconfigitem(
2147 coreconfigitem(
2141 b'server',
2148 b'server',
2142 b'preferuncompressed',
2149 b'preferuncompressed',
2143 default=False,
2150 default=False,
2144 )
2151 )
2145 coreconfigitem(
2152 coreconfigitem(
2146 b'server',
2153 b'server',
2147 b'streamunbundle',
2154 b'streamunbundle',
2148 default=False,
2155 default=False,
2149 )
2156 )
2150 coreconfigitem(
2157 coreconfigitem(
2151 b'server',
2158 b'server',
2152 b'uncompressed',
2159 b'uncompressed',
2153 default=True,
2160 default=True,
2154 )
2161 )
2155 coreconfigitem(
2162 coreconfigitem(
2156 b'server',
2163 b'server',
2157 b'uncompressedallowsecret',
2164 b'uncompressedallowsecret',
2158 default=False,
2165 default=False,
2159 )
2166 )
2160 coreconfigitem(
2167 coreconfigitem(
2161 b'server',
2168 b'server',
2162 b'view',
2169 b'view',
2163 default=b'served',
2170 default=b'served',
2164 )
2171 )
2165 coreconfigitem(
2172 coreconfigitem(
2166 b'server',
2173 b'server',
2167 b'validate',
2174 b'validate',
2168 default=False,
2175 default=False,
2169 )
2176 )
2170 coreconfigitem(
2177 coreconfigitem(
2171 b'server',
2178 b'server',
2172 b'zliblevel',
2179 b'zliblevel',
2173 default=-1,
2180 default=-1,
2174 )
2181 )
2175 coreconfigitem(
2182 coreconfigitem(
2176 b'server',
2183 b'server',
2177 b'zstdlevel',
2184 b'zstdlevel',
2178 default=3,
2185 default=3,
2179 )
2186 )
2180 coreconfigitem(
2187 coreconfigitem(
2181 b'share',
2188 b'share',
2182 b'pool',
2189 b'pool',
2183 default=None,
2190 default=None,
2184 )
2191 )
2185 coreconfigitem(
2192 coreconfigitem(
2186 b'share',
2193 b'share',
2187 b'poolnaming',
2194 b'poolnaming',
2188 default=b'identity',
2195 default=b'identity',
2189 )
2196 )
2190 coreconfigitem(
2197 coreconfigitem(
2191 b'share',
2198 b'share',
2192 b'safe-mismatch.source-not-safe',
2199 b'safe-mismatch.source-not-safe',
2193 default=b'abort',
2200 default=b'abort',
2194 )
2201 )
2195 coreconfigitem(
2202 coreconfigitem(
2196 b'share',
2203 b'share',
2197 b'safe-mismatch.source-safe',
2204 b'safe-mismatch.source-safe',
2198 default=b'abort',
2205 default=b'abort',
2199 )
2206 )
2200 coreconfigitem(
2207 coreconfigitem(
2201 b'share',
2208 b'share',
2202 b'safe-mismatch.source-not-safe.warn',
2209 b'safe-mismatch.source-not-safe.warn',
2203 default=True,
2210 default=True,
2204 )
2211 )
2205 coreconfigitem(
2212 coreconfigitem(
2206 b'share',
2213 b'share',
2207 b'safe-mismatch.source-safe.warn',
2214 b'safe-mismatch.source-safe.warn',
2208 default=True,
2215 default=True,
2209 )
2216 )
2210 coreconfigitem(
2217 coreconfigitem(
2211 b'share',
2218 b'share',
2212 b'safe-mismatch.source-not-safe:verbose-upgrade',
2219 b'safe-mismatch.source-not-safe:verbose-upgrade',
2213 default=True,
2220 default=True,
2214 )
2221 )
2215 coreconfigitem(
2222 coreconfigitem(
2216 b'share',
2223 b'share',
2217 b'safe-mismatch.source-safe:verbose-upgrade',
2224 b'safe-mismatch.source-safe:verbose-upgrade',
2218 default=True,
2225 default=True,
2219 )
2226 )
2220 coreconfigitem(
2227 coreconfigitem(
2221 b'shelve',
2228 b'shelve',
2222 b'maxbackups',
2229 b'maxbackups',
2223 default=10,
2230 default=10,
2224 )
2231 )
2225 coreconfigitem(
2232 coreconfigitem(
2226 b'smtp',
2233 b'smtp',
2227 b'host',
2234 b'host',
2228 default=None,
2235 default=None,
2229 )
2236 )
2230 coreconfigitem(
2237 coreconfigitem(
2231 b'smtp',
2238 b'smtp',
2232 b'local_hostname',
2239 b'local_hostname',
2233 default=None,
2240 default=None,
2234 )
2241 )
2235 coreconfigitem(
2242 coreconfigitem(
2236 b'smtp',
2243 b'smtp',
2237 b'password',
2244 b'password',
2238 default=None,
2245 default=None,
2239 )
2246 )
2240 coreconfigitem(
2247 coreconfigitem(
2241 b'smtp',
2248 b'smtp',
2242 b'port',
2249 b'port',
2243 default=dynamicdefault,
2250 default=dynamicdefault,
2244 )
2251 )
2245 coreconfigitem(
2252 coreconfigitem(
2246 b'smtp',
2253 b'smtp',
2247 b'tls',
2254 b'tls',
2248 default=b'none',
2255 default=b'none',
2249 )
2256 )
2250 coreconfigitem(
2257 coreconfigitem(
2251 b'smtp',
2258 b'smtp',
2252 b'username',
2259 b'username',
2253 default=None,
2260 default=None,
2254 )
2261 )
2255 coreconfigitem(
2262 coreconfigitem(
2256 b'sparse',
2263 b'sparse',
2257 b'missingwarning',
2264 b'missingwarning',
2258 default=True,
2265 default=True,
2259 experimental=True,
2266 experimental=True,
2260 )
2267 )
2261 coreconfigitem(
2268 coreconfigitem(
2262 b'subrepos',
2269 b'subrepos',
2263 b'allowed',
2270 b'allowed',
2264 default=dynamicdefault, # to make backporting simpler
2271 default=dynamicdefault, # to make backporting simpler
2265 )
2272 )
2266 coreconfigitem(
2273 coreconfigitem(
2267 b'subrepos',
2274 b'subrepos',
2268 b'hg:allowed',
2275 b'hg:allowed',
2269 default=dynamicdefault,
2276 default=dynamicdefault,
2270 )
2277 )
2271 coreconfigitem(
2278 coreconfigitem(
2272 b'subrepos',
2279 b'subrepos',
2273 b'git:allowed',
2280 b'git:allowed',
2274 default=dynamicdefault,
2281 default=dynamicdefault,
2275 )
2282 )
2276 coreconfigitem(
2283 coreconfigitem(
2277 b'subrepos',
2284 b'subrepos',
2278 b'svn:allowed',
2285 b'svn:allowed',
2279 default=dynamicdefault,
2286 default=dynamicdefault,
2280 )
2287 )
2281 coreconfigitem(
2288 coreconfigitem(
2282 b'templates',
2289 b'templates',
2283 b'.*',
2290 b'.*',
2284 default=None,
2291 default=None,
2285 generic=True,
2292 generic=True,
2286 )
2293 )
2287 coreconfigitem(
2294 coreconfigitem(
2288 b'templateconfig',
2295 b'templateconfig',
2289 b'.*',
2296 b'.*',
2290 default=dynamicdefault,
2297 default=dynamicdefault,
2291 generic=True,
2298 generic=True,
2292 )
2299 )
2293 coreconfigitem(
2300 coreconfigitem(
2294 b'trusted',
2301 b'trusted',
2295 b'groups',
2302 b'groups',
2296 default=list,
2303 default=list,
2297 )
2304 )
2298 coreconfigitem(
2305 coreconfigitem(
2299 b'trusted',
2306 b'trusted',
2300 b'users',
2307 b'users',
2301 default=list,
2308 default=list,
2302 )
2309 )
2303 coreconfigitem(
2310 coreconfigitem(
2304 b'ui',
2311 b'ui',
2305 b'_usedassubrepo',
2312 b'_usedassubrepo',
2306 default=False,
2313 default=False,
2307 )
2314 )
2308 coreconfigitem(
2315 coreconfigitem(
2309 b'ui',
2316 b'ui',
2310 b'allowemptycommit',
2317 b'allowemptycommit',
2311 default=False,
2318 default=False,
2312 )
2319 )
2313 coreconfigitem(
2320 coreconfigitem(
2314 b'ui',
2321 b'ui',
2315 b'archivemeta',
2322 b'archivemeta',
2316 default=True,
2323 default=True,
2317 )
2324 )
2318 coreconfigitem(
2325 coreconfigitem(
2319 b'ui',
2326 b'ui',
2320 b'askusername',
2327 b'askusername',
2321 default=False,
2328 default=False,
2322 )
2329 )
2323 coreconfigitem(
2330 coreconfigitem(
2324 b'ui',
2331 b'ui',
2325 b'available-memory',
2332 b'available-memory',
2326 default=None,
2333 default=None,
2327 )
2334 )
2328
2335
2329 coreconfigitem(
2336 coreconfigitem(
2330 b'ui',
2337 b'ui',
2331 b'clonebundlefallback',
2338 b'clonebundlefallback',
2332 default=False,
2339 default=False,
2333 )
2340 )
2334 coreconfigitem(
2341 coreconfigitem(
2335 b'ui',
2342 b'ui',
2336 b'clonebundleprefers',
2343 b'clonebundleprefers',
2337 default=list,
2344 default=list,
2338 )
2345 )
2339 coreconfigitem(
2346 coreconfigitem(
2340 b'ui',
2347 b'ui',
2341 b'clonebundles',
2348 b'clonebundles',
2342 default=True,
2349 default=True,
2343 )
2350 )
2344 coreconfigitem(
2351 coreconfigitem(
2345 b'ui',
2352 b'ui',
2346 b'color',
2353 b'color',
2347 default=b'auto',
2354 default=b'auto',
2348 )
2355 )
2349 coreconfigitem(
2356 coreconfigitem(
2350 b'ui',
2357 b'ui',
2351 b'commitsubrepos',
2358 b'commitsubrepos',
2352 default=False,
2359 default=False,
2353 )
2360 )
2354 coreconfigitem(
2361 coreconfigitem(
2355 b'ui',
2362 b'ui',
2356 b'debug',
2363 b'debug',
2357 default=False,
2364 default=False,
2358 )
2365 )
2359 coreconfigitem(
2366 coreconfigitem(
2360 b'ui',
2367 b'ui',
2361 b'debugger',
2368 b'debugger',
2362 default=None,
2369 default=None,
2363 )
2370 )
2364 coreconfigitem(
2371 coreconfigitem(
2365 b'ui',
2372 b'ui',
2366 b'editor',
2373 b'editor',
2367 default=dynamicdefault,
2374 default=dynamicdefault,
2368 )
2375 )
2369 coreconfigitem(
2376 coreconfigitem(
2370 b'ui',
2377 b'ui',
2371 b'detailed-exit-code',
2378 b'detailed-exit-code',
2372 default=False,
2379 default=False,
2373 experimental=True,
2380 experimental=True,
2374 )
2381 )
2375 coreconfigitem(
2382 coreconfigitem(
2376 b'ui',
2383 b'ui',
2377 b'fallbackencoding',
2384 b'fallbackencoding',
2378 default=None,
2385 default=None,
2379 )
2386 )
2380 coreconfigitem(
2387 coreconfigitem(
2381 b'ui',
2388 b'ui',
2382 b'forcecwd',
2389 b'forcecwd',
2383 default=None,
2390 default=None,
2384 )
2391 )
2385 coreconfigitem(
2392 coreconfigitem(
2386 b'ui',
2393 b'ui',
2387 b'forcemerge',
2394 b'forcemerge',
2388 default=None,
2395 default=None,
2389 )
2396 )
2390 coreconfigitem(
2397 coreconfigitem(
2391 b'ui',
2398 b'ui',
2392 b'formatdebug',
2399 b'formatdebug',
2393 default=False,
2400 default=False,
2394 )
2401 )
2395 coreconfigitem(
2402 coreconfigitem(
2396 b'ui',
2403 b'ui',
2397 b'formatjson',
2404 b'formatjson',
2398 default=False,
2405 default=False,
2399 )
2406 )
2400 coreconfigitem(
2407 coreconfigitem(
2401 b'ui',
2408 b'ui',
2402 b'formatted',
2409 b'formatted',
2403 default=None,
2410 default=None,
2404 )
2411 )
2405 coreconfigitem(
2412 coreconfigitem(
2406 b'ui',
2413 b'ui',
2407 b'interactive',
2414 b'interactive',
2408 default=None,
2415 default=None,
2409 )
2416 )
2410 coreconfigitem(
2417 coreconfigitem(
2411 b'ui',
2418 b'ui',
2412 b'interface',
2419 b'interface',
2413 default=None,
2420 default=None,
2414 )
2421 )
2415 coreconfigitem(
2422 coreconfigitem(
2416 b'ui',
2423 b'ui',
2417 b'interface.chunkselector',
2424 b'interface.chunkselector',
2418 default=None,
2425 default=None,
2419 )
2426 )
2420 coreconfigitem(
2427 coreconfigitem(
2421 b'ui',
2428 b'ui',
2422 b'large-file-limit',
2429 b'large-file-limit',
2423 default=10 * (2 ** 20),
2430 default=10 * (2 ** 20),
2424 )
2431 )
2425 coreconfigitem(
2432 coreconfigitem(
2426 b'ui',
2433 b'ui',
2427 b'logblockedtimes',
2434 b'logblockedtimes',
2428 default=False,
2435 default=False,
2429 )
2436 )
2430 coreconfigitem(
2437 coreconfigitem(
2431 b'ui',
2438 b'ui',
2432 b'merge',
2439 b'merge',
2433 default=None,
2440 default=None,
2434 )
2441 )
2435 coreconfigitem(
2442 coreconfigitem(
2436 b'ui',
2443 b'ui',
2437 b'mergemarkers',
2444 b'mergemarkers',
2438 default=b'basic',
2445 default=b'basic',
2439 )
2446 )
2440 coreconfigitem(
2447 coreconfigitem(
2441 b'ui',
2448 b'ui',
2442 b'message-output',
2449 b'message-output',
2443 default=b'stdio',
2450 default=b'stdio',
2444 )
2451 )
2445 coreconfigitem(
2452 coreconfigitem(
2446 b'ui',
2453 b'ui',
2447 b'nontty',
2454 b'nontty',
2448 default=False,
2455 default=False,
2449 )
2456 )
2450 coreconfigitem(
2457 coreconfigitem(
2451 b'ui',
2458 b'ui',
2452 b'origbackuppath',
2459 b'origbackuppath',
2453 default=None,
2460 default=None,
2454 )
2461 )
2455 coreconfigitem(
2462 coreconfigitem(
2456 b'ui',
2463 b'ui',
2457 b'paginate',
2464 b'paginate',
2458 default=True,
2465 default=True,
2459 )
2466 )
2460 coreconfigitem(
2467 coreconfigitem(
2461 b'ui',
2468 b'ui',
2462 b'patch',
2469 b'patch',
2463 default=None,
2470 default=None,
2464 )
2471 )
2465 coreconfigitem(
2472 coreconfigitem(
2466 b'ui',
2473 b'ui',
2467 b'portablefilenames',
2474 b'portablefilenames',
2468 default=b'warn',
2475 default=b'warn',
2469 )
2476 )
2470 coreconfigitem(
2477 coreconfigitem(
2471 b'ui',
2478 b'ui',
2472 b'promptecho',
2479 b'promptecho',
2473 default=False,
2480 default=False,
2474 )
2481 )
2475 coreconfigitem(
2482 coreconfigitem(
2476 b'ui',
2483 b'ui',
2477 b'quiet',
2484 b'quiet',
2478 default=False,
2485 default=False,
2479 )
2486 )
2480 coreconfigitem(
2487 coreconfigitem(
2481 b'ui',
2488 b'ui',
2482 b'quietbookmarkmove',
2489 b'quietbookmarkmove',
2483 default=False,
2490 default=False,
2484 )
2491 )
2485 coreconfigitem(
2492 coreconfigitem(
2486 b'ui',
2493 b'ui',
2487 b'relative-paths',
2494 b'relative-paths',
2488 default=b'legacy',
2495 default=b'legacy',
2489 )
2496 )
2490 coreconfigitem(
2497 coreconfigitem(
2491 b'ui',
2498 b'ui',
2492 b'remotecmd',
2499 b'remotecmd',
2493 default=b'hg',
2500 default=b'hg',
2494 )
2501 )
2495 coreconfigitem(
2502 coreconfigitem(
2496 b'ui',
2503 b'ui',
2497 b'report_untrusted',
2504 b'report_untrusted',
2498 default=True,
2505 default=True,
2499 )
2506 )
2500 coreconfigitem(
2507 coreconfigitem(
2501 b'ui',
2508 b'ui',
2502 b'rollback',
2509 b'rollback',
2503 default=True,
2510 default=True,
2504 )
2511 )
2505 coreconfigitem(
2512 coreconfigitem(
2506 b'ui',
2513 b'ui',
2507 b'signal-safe-lock',
2514 b'signal-safe-lock',
2508 default=True,
2515 default=True,
2509 )
2516 )
2510 coreconfigitem(
2517 coreconfigitem(
2511 b'ui',
2518 b'ui',
2512 b'slash',
2519 b'slash',
2513 default=False,
2520 default=False,
2514 )
2521 )
2515 coreconfigitem(
2522 coreconfigitem(
2516 b'ui',
2523 b'ui',
2517 b'ssh',
2524 b'ssh',
2518 default=b'ssh',
2525 default=b'ssh',
2519 )
2526 )
2520 coreconfigitem(
2527 coreconfigitem(
2521 b'ui',
2528 b'ui',
2522 b'ssherrorhint',
2529 b'ssherrorhint',
2523 default=None,
2530 default=None,
2524 )
2531 )
2525 coreconfigitem(
2532 coreconfigitem(
2526 b'ui',
2533 b'ui',
2527 b'statuscopies',
2534 b'statuscopies',
2528 default=False,
2535 default=False,
2529 )
2536 )
2530 coreconfigitem(
2537 coreconfigitem(
2531 b'ui',
2538 b'ui',
2532 b'strict',
2539 b'strict',
2533 default=False,
2540 default=False,
2534 )
2541 )
2535 coreconfigitem(
2542 coreconfigitem(
2536 b'ui',
2543 b'ui',
2537 b'style',
2544 b'style',
2538 default=b'',
2545 default=b'',
2539 )
2546 )
2540 coreconfigitem(
2547 coreconfigitem(
2541 b'ui',
2548 b'ui',
2542 b'supportcontact',
2549 b'supportcontact',
2543 default=None,
2550 default=None,
2544 )
2551 )
2545 coreconfigitem(
2552 coreconfigitem(
2546 b'ui',
2553 b'ui',
2547 b'textwidth',
2554 b'textwidth',
2548 default=78,
2555 default=78,
2549 )
2556 )
2550 coreconfigitem(
2557 coreconfigitem(
2551 b'ui',
2558 b'ui',
2552 b'timeout',
2559 b'timeout',
2553 default=b'600',
2560 default=b'600',
2554 )
2561 )
2555 coreconfigitem(
2562 coreconfigitem(
2556 b'ui',
2563 b'ui',
2557 b'timeout.warn',
2564 b'timeout.warn',
2558 default=0,
2565 default=0,
2559 )
2566 )
2560 coreconfigitem(
2567 coreconfigitem(
2561 b'ui',
2568 b'ui',
2562 b'timestamp-output',
2569 b'timestamp-output',
2563 default=False,
2570 default=False,
2564 )
2571 )
2565 coreconfigitem(
2572 coreconfigitem(
2566 b'ui',
2573 b'ui',
2567 b'traceback',
2574 b'traceback',
2568 default=False,
2575 default=False,
2569 )
2576 )
2570 coreconfigitem(
2577 coreconfigitem(
2571 b'ui',
2578 b'ui',
2572 b'tweakdefaults',
2579 b'tweakdefaults',
2573 default=False,
2580 default=False,
2574 )
2581 )
2575 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
2582 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
2576 coreconfigitem(
2583 coreconfigitem(
2577 b'ui',
2584 b'ui',
2578 b'verbose',
2585 b'verbose',
2579 default=False,
2586 default=False,
2580 )
2587 )
2581 coreconfigitem(
2588 coreconfigitem(
2582 b'verify',
2589 b'verify',
2583 b'skipflags',
2590 b'skipflags',
2584 default=0,
2591 default=0,
2585 )
2592 )
2586 coreconfigitem(
2593 coreconfigitem(
2587 b'web',
2594 b'web',
2588 b'allowbz2',
2595 b'allowbz2',
2589 default=False,
2596 default=False,
2590 )
2597 )
2591 coreconfigitem(
2598 coreconfigitem(
2592 b'web',
2599 b'web',
2593 b'allowgz',
2600 b'allowgz',
2594 default=False,
2601 default=False,
2595 )
2602 )
2596 coreconfigitem(
2603 coreconfigitem(
2597 b'web',
2604 b'web',
2598 b'allow-pull',
2605 b'allow-pull',
2599 alias=[(b'web', b'allowpull')],
2606 alias=[(b'web', b'allowpull')],
2600 default=True,
2607 default=True,
2601 )
2608 )
2602 coreconfigitem(
2609 coreconfigitem(
2603 b'web',
2610 b'web',
2604 b'allow-push',
2611 b'allow-push',
2605 alias=[(b'web', b'allow_push')],
2612 alias=[(b'web', b'allow_push')],
2606 default=list,
2613 default=list,
2607 )
2614 )
2608 coreconfigitem(
2615 coreconfigitem(
2609 b'web',
2616 b'web',
2610 b'allowzip',
2617 b'allowzip',
2611 default=False,
2618 default=False,
2612 )
2619 )
2613 coreconfigitem(
2620 coreconfigitem(
2614 b'web',
2621 b'web',
2615 b'archivesubrepos',
2622 b'archivesubrepos',
2616 default=False,
2623 default=False,
2617 )
2624 )
2618 coreconfigitem(
2625 coreconfigitem(
2619 b'web',
2626 b'web',
2620 b'cache',
2627 b'cache',
2621 default=True,
2628 default=True,
2622 )
2629 )
2623 coreconfigitem(
2630 coreconfigitem(
2624 b'web',
2631 b'web',
2625 b'comparisoncontext',
2632 b'comparisoncontext',
2626 default=5,
2633 default=5,
2627 )
2634 )
2628 coreconfigitem(
2635 coreconfigitem(
2629 b'web',
2636 b'web',
2630 b'contact',
2637 b'contact',
2631 default=None,
2638 default=None,
2632 )
2639 )
2633 coreconfigitem(
2640 coreconfigitem(
2634 b'web',
2641 b'web',
2635 b'deny_push',
2642 b'deny_push',
2636 default=list,
2643 default=list,
2637 )
2644 )
2638 coreconfigitem(
2645 coreconfigitem(
2639 b'web',
2646 b'web',
2640 b'guessmime',
2647 b'guessmime',
2641 default=False,
2648 default=False,
2642 )
2649 )
2643 coreconfigitem(
2650 coreconfigitem(
2644 b'web',
2651 b'web',
2645 b'hidden',
2652 b'hidden',
2646 default=False,
2653 default=False,
2647 )
2654 )
2648 coreconfigitem(
2655 coreconfigitem(
2649 b'web',
2656 b'web',
2650 b'labels',
2657 b'labels',
2651 default=list,
2658 default=list,
2652 )
2659 )
2653 coreconfigitem(
2660 coreconfigitem(
2654 b'web',
2661 b'web',
2655 b'logoimg',
2662 b'logoimg',
2656 default=b'hglogo.png',
2663 default=b'hglogo.png',
2657 )
2664 )
2658 coreconfigitem(
2665 coreconfigitem(
2659 b'web',
2666 b'web',
2660 b'logourl',
2667 b'logourl',
2661 default=b'https://mercurial-scm.org/',
2668 default=b'https://mercurial-scm.org/',
2662 )
2669 )
2663 coreconfigitem(
2670 coreconfigitem(
2664 b'web',
2671 b'web',
2665 b'accesslog',
2672 b'accesslog',
2666 default=b'-',
2673 default=b'-',
2667 )
2674 )
2668 coreconfigitem(
2675 coreconfigitem(
2669 b'web',
2676 b'web',
2670 b'address',
2677 b'address',
2671 default=b'',
2678 default=b'',
2672 )
2679 )
2673 coreconfigitem(
2680 coreconfigitem(
2674 b'web',
2681 b'web',
2675 b'allow-archive',
2682 b'allow-archive',
2676 alias=[(b'web', b'allow_archive')],
2683 alias=[(b'web', b'allow_archive')],
2677 default=list,
2684 default=list,
2678 )
2685 )
2679 coreconfigitem(
2686 coreconfigitem(
2680 b'web',
2687 b'web',
2681 b'allow_read',
2688 b'allow_read',
2682 default=list,
2689 default=list,
2683 )
2690 )
2684 coreconfigitem(
2691 coreconfigitem(
2685 b'web',
2692 b'web',
2686 b'baseurl',
2693 b'baseurl',
2687 default=None,
2694 default=None,
2688 )
2695 )
2689 coreconfigitem(
2696 coreconfigitem(
2690 b'web',
2697 b'web',
2691 b'cacerts',
2698 b'cacerts',
2692 default=None,
2699 default=None,
2693 )
2700 )
2694 coreconfigitem(
2701 coreconfigitem(
2695 b'web',
2702 b'web',
2696 b'certificate',
2703 b'certificate',
2697 default=None,
2704 default=None,
2698 )
2705 )
2699 coreconfigitem(
2706 coreconfigitem(
2700 b'web',
2707 b'web',
2701 b'collapse',
2708 b'collapse',
2702 default=False,
2709 default=False,
2703 )
2710 )
2704 coreconfigitem(
2711 coreconfigitem(
2705 b'web',
2712 b'web',
2706 b'csp',
2713 b'csp',
2707 default=None,
2714 default=None,
2708 )
2715 )
2709 coreconfigitem(
2716 coreconfigitem(
2710 b'web',
2717 b'web',
2711 b'deny_read',
2718 b'deny_read',
2712 default=list,
2719 default=list,
2713 )
2720 )
2714 coreconfigitem(
2721 coreconfigitem(
2715 b'web',
2722 b'web',
2716 b'descend',
2723 b'descend',
2717 default=True,
2724 default=True,
2718 )
2725 )
2719 coreconfigitem(
2726 coreconfigitem(
2720 b'web',
2727 b'web',
2721 b'description',
2728 b'description',
2722 default=b"",
2729 default=b"",
2723 )
2730 )
2724 coreconfigitem(
2731 coreconfigitem(
2725 b'web',
2732 b'web',
2726 b'encoding',
2733 b'encoding',
2727 default=lambda: encoding.encoding,
2734 default=lambda: encoding.encoding,
2728 )
2735 )
2729 coreconfigitem(
2736 coreconfigitem(
2730 b'web',
2737 b'web',
2731 b'errorlog',
2738 b'errorlog',
2732 default=b'-',
2739 default=b'-',
2733 )
2740 )
2734 coreconfigitem(
2741 coreconfigitem(
2735 b'web',
2742 b'web',
2736 b'ipv6',
2743 b'ipv6',
2737 default=False,
2744 default=False,
2738 )
2745 )
2739 coreconfigitem(
2746 coreconfigitem(
2740 b'web',
2747 b'web',
2741 b'maxchanges',
2748 b'maxchanges',
2742 default=10,
2749 default=10,
2743 )
2750 )
2744 coreconfigitem(
2751 coreconfigitem(
2745 b'web',
2752 b'web',
2746 b'maxfiles',
2753 b'maxfiles',
2747 default=10,
2754 default=10,
2748 )
2755 )
2749 coreconfigitem(
2756 coreconfigitem(
2750 b'web',
2757 b'web',
2751 b'maxshortchanges',
2758 b'maxshortchanges',
2752 default=60,
2759 default=60,
2753 )
2760 )
2754 coreconfigitem(
2761 coreconfigitem(
2755 b'web',
2762 b'web',
2756 b'motd',
2763 b'motd',
2757 default=b'',
2764 default=b'',
2758 )
2765 )
2759 coreconfigitem(
2766 coreconfigitem(
2760 b'web',
2767 b'web',
2761 b'name',
2768 b'name',
2762 default=dynamicdefault,
2769 default=dynamicdefault,
2763 )
2770 )
2764 coreconfigitem(
2771 coreconfigitem(
2765 b'web',
2772 b'web',
2766 b'port',
2773 b'port',
2767 default=8000,
2774 default=8000,
2768 )
2775 )
2769 coreconfigitem(
2776 coreconfigitem(
2770 b'web',
2777 b'web',
2771 b'prefix',
2778 b'prefix',
2772 default=b'',
2779 default=b'',
2773 )
2780 )
2774 coreconfigitem(
2781 coreconfigitem(
2775 b'web',
2782 b'web',
2776 b'push_ssl',
2783 b'push_ssl',
2777 default=True,
2784 default=True,
2778 )
2785 )
2779 coreconfigitem(
2786 coreconfigitem(
2780 b'web',
2787 b'web',
2781 b'refreshinterval',
2788 b'refreshinterval',
2782 default=20,
2789 default=20,
2783 )
2790 )
2784 coreconfigitem(
2791 coreconfigitem(
2785 b'web',
2792 b'web',
2786 b'server-header',
2793 b'server-header',
2787 default=None,
2794 default=None,
2788 )
2795 )
2789 coreconfigitem(
2796 coreconfigitem(
2790 b'web',
2797 b'web',
2791 b'static',
2798 b'static',
2792 default=None,
2799 default=None,
2793 )
2800 )
2794 coreconfigitem(
2801 coreconfigitem(
2795 b'web',
2802 b'web',
2796 b'staticurl',
2803 b'staticurl',
2797 default=None,
2804 default=None,
2798 )
2805 )
2799 coreconfigitem(
2806 coreconfigitem(
2800 b'web',
2807 b'web',
2801 b'stripes',
2808 b'stripes',
2802 default=1,
2809 default=1,
2803 )
2810 )
2804 coreconfigitem(
2811 coreconfigitem(
2805 b'web',
2812 b'web',
2806 b'style',
2813 b'style',
2807 default=b'paper',
2814 default=b'paper',
2808 )
2815 )
2809 coreconfigitem(
2816 coreconfigitem(
2810 b'web',
2817 b'web',
2811 b'templates',
2818 b'templates',
2812 default=None,
2819 default=None,
2813 )
2820 )
2814 coreconfigitem(
2821 coreconfigitem(
2815 b'web',
2822 b'web',
2816 b'view',
2823 b'view',
2817 default=b'served',
2824 default=b'served',
2818 experimental=True,
2825 experimental=True,
2819 )
2826 )
2820 coreconfigitem(
2827 coreconfigitem(
2821 b'worker',
2828 b'worker',
2822 b'backgroundclose',
2829 b'backgroundclose',
2823 default=dynamicdefault,
2830 default=dynamicdefault,
2824 )
2831 )
2825 # Windows defaults to a limit of 512 open files. A buffer of 128
2832 # Windows defaults to a limit of 512 open files. A buffer of 128
2826 # should give us enough headway.
2833 # should give us enough headway.
2827 coreconfigitem(
2834 coreconfigitem(
2828 b'worker',
2835 b'worker',
2829 b'backgroundclosemaxqueue',
2836 b'backgroundclosemaxqueue',
2830 default=384,
2837 default=384,
2831 )
2838 )
2832 coreconfigitem(
2839 coreconfigitem(
2833 b'worker',
2840 b'worker',
2834 b'backgroundcloseminfilecount',
2841 b'backgroundcloseminfilecount',
2835 default=2048,
2842 default=2048,
2836 )
2843 )
2837 coreconfigitem(
2844 coreconfigitem(
2838 b'worker',
2845 b'worker',
2839 b'backgroundclosethreadcount',
2846 b'backgroundclosethreadcount',
2840 default=4,
2847 default=4,
2841 )
2848 )
2842 coreconfigitem(
2849 coreconfigitem(
2843 b'worker',
2850 b'worker',
2844 b'enabled',
2851 b'enabled',
2845 default=True,
2852 default=True,
2846 )
2853 )
2847 coreconfigitem(
2854 coreconfigitem(
2848 b'worker',
2855 b'worker',
2849 b'numcpus',
2856 b'numcpus',
2850 default=None,
2857 default=None,
2851 )
2858 )
2852
2859
2853 # Rebase related configuration moved to core because other extension are doing
2860 # Rebase related configuration moved to core because other extension are doing
2854 # strange things. For example, shelve import the extensions to reuse some bit
2861 # strange things. For example, shelve import the extensions to reuse some bit
2855 # without formally loading it.
2862 # without formally loading it.
2856 coreconfigitem(
2863 coreconfigitem(
2857 b'commands',
2864 b'commands',
2858 b'rebase.requiredest',
2865 b'rebase.requiredest',
2859 default=False,
2866 default=False,
2860 )
2867 )
2861 coreconfigitem(
2868 coreconfigitem(
2862 b'experimental',
2869 b'experimental',
2863 b'rebaseskipobsolete',
2870 b'rebaseskipobsolete',
2864 default=True,
2871 default=True,
2865 )
2872 )
2866 coreconfigitem(
2873 coreconfigitem(
2867 b'rebase',
2874 b'rebase',
2868 b'singletransaction',
2875 b'singletransaction',
2869 default=False,
2876 default=False,
2870 )
2877 )
2871 coreconfigitem(
2878 coreconfigitem(
2872 b'rebase',
2879 b'rebase',
2873 b'experimental.inmemory',
2880 b'experimental.inmemory',
2874 default=False,
2881 default=False,
2875 )
2882 )
2876
2883
2877 # This setting controls creation of a rebase_source extra field
2884 # This setting controls creation of a rebase_source extra field
2878 # during rebase. When False, no such field is created. This is
2885 # during rebase. When False, no such field is created. This is
2879 # useful eg for incrementally converting changesets and then
2886 # useful eg for incrementally converting changesets and then
2880 # rebasing them onto an existing repo.
2887 # rebasing them onto an existing repo.
2881 # WARNING: this is an advanced setting reserved for people who know
2888 # WARNING: this is an advanced setting reserved for people who know
2882 # exactly what they are doing. Misuse of this setting can easily
2889 # exactly what they are doing. Misuse of this setting can easily
2883 # result in obsmarker cycles and a vivid headache.
2890 # result in obsmarker cycles and a vivid headache.
2884 coreconfigitem(
2891 coreconfigitem(
2885 b'rebase',
2892 b'rebase',
2886 b'store-source',
2893 b'store-source',
2887 default=True,
2894 default=True,
2888 experimental=True,
2895 experimental=True,
2889 )
2896 )
@@ -1,1303 +1,1303 b''
1 # filemerge.py - file-level merge handling for Mercurial
1 # filemerge.py - file-level merge handling for Mercurial
2 #
2 #
3 # Copyright 2006, 2007, 2008 Olivia Mackall <olivia@selenic.com>
3 # Copyright 2006, 2007, 2008 Olivia Mackall <olivia@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8
8
9 import contextlib
9 import contextlib
10 import os
10 import os
11 import re
11 import re
12 import shutil
12 import shutil
13
13
14 from .i18n import _
14 from .i18n import _
15 from .node import (
15 from .node import (
16 hex,
16 hex,
17 short,
17 short,
18 )
18 )
19 from .pycompat import (
19 from .pycompat import (
20 getattr,
20 getattr,
21 )
21 )
22
22
23 from . import (
23 from . import (
24 encoding,
24 encoding,
25 error,
25 error,
26 formatter,
26 formatter,
27 match,
27 match,
28 pycompat,
28 pycompat,
29 registrar,
29 registrar,
30 scmutil,
30 scmutil,
31 simplemerge,
31 simplemerge,
32 tagmerge,
32 tagmerge,
33 templatekw,
33 templatekw,
34 templater,
34 templater,
35 templateutil,
35 templateutil,
36 util,
36 util,
37 )
37 )
38
38
39 from .utils import (
39 from .utils import (
40 procutil,
40 procutil,
41 stringutil,
41 stringutil,
42 )
42 )
43
43
44
44
45 def _toolstr(ui, tool, part, *args):
45 def _toolstr(ui, tool, part, *args):
46 return ui.config(b"merge-tools", tool + b"." + part, *args)
46 return ui.config(b"merge-tools", tool + b"." + part, *args)
47
47
48
48
49 def _toolbool(ui, tool, part, *args):
49 def _toolbool(ui, tool, part, *args):
50 return ui.configbool(b"merge-tools", tool + b"." + part, *args)
50 return ui.configbool(b"merge-tools", tool + b"." + part, *args)
51
51
52
52
53 def _toollist(ui, tool, part):
53 def _toollist(ui, tool, part):
54 return ui.configlist(b"merge-tools", tool + b"." + part)
54 return ui.configlist(b"merge-tools", tool + b"." + part)
55
55
56
56
57 internals = {}
57 internals = {}
58 # Merge tools to document.
58 # Merge tools to document.
59 internalsdoc = {}
59 internalsdoc = {}
60
60
61 internaltool = registrar.internalmerge()
61 internaltool = registrar.internalmerge()
62
62
63 # internal tool merge types
63 # internal tool merge types
64 nomerge = internaltool.nomerge
64 nomerge = internaltool.nomerge
65 mergeonly = internaltool.mergeonly # just the full merge, no premerge
65 mergeonly = internaltool.mergeonly # just the full merge, no premerge
66 fullmerge = internaltool.fullmerge # both premerge and merge
66 fullmerge = internaltool.fullmerge # both premerge and merge
67
67
68 # IMPORTANT: keep the last line of this prompt very short ("What do you want to
68 # IMPORTANT: keep the last line of this prompt very short ("What do you want to
69 # do?") because of issue6158, ideally to <40 English characters (to allow other
69 # do?") because of issue6158, ideally to <40 English characters (to allow other
70 # languages that may take more columns to still have a chance to fit in an
70 # languages that may take more columns to still have a chance to fit in an
71 # 80-column screen).
71 # 80-column screen).
72 _localchangedotherdeletedmsg = _(
72 _localchangedotherdeletedmsg = _(
73 b"file '%(fd)s' was deleted in other%(o)s but was modified in local%(l)s.\n"
73 b"file '%(fd)s' was deleted in other%(o)s but was modified in local%(l)s.\n"
74 b"You can use (c)hanged version, (d)elete, or leave (u)nresolved.\n"
74 b"You can use (c)hanged version, (d)elete, or leave (u)nresolved.\n"
75 b"What do you want to do?"
75 b"What do you want to do?"
76 b"$$ &Changed $$ &Delete $$ &Unresolved"
76 b"$$ &Changed $$ &Delete $$ &Unresolved"
77 )
77 )
78
78
79 _otherchangedlocaldeletedmsg = _(
79 _otherchangedlocaldeletedmsg = _(
80 b"file '%(fd)s' was deleted in local%(l)s but was modified in other%(o)s.\n"
80 b"file '%(fd)s' was deleted in local%(l)s but was modified in other%(o)s.\n"
81 b"You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.\n"
81 b"You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.\n"
82 b"What do you want to do?"
82 b"What do you want to do?"
83 b"$$ &Changed $$ &Deleted $$ &Unresolved"
83 b"$$ &Changed $$ &Deleted $$ &Unresolved"
84 )
84 )
85
85
86
86
87 class absentfilectx:
87 class absentfilectx:
88 """Represents a file that's ostensibly in a context but is actually not
88 """Represents a file that's ostensibly in a context but is actually not
89 present in it.
89 present in it.
90
90
91 This is here because it's very specific to the filemerge code for now --
91 This is here because it's very specific to the filemerge code for now --
92 other code is likely going to break with the values this returns."""
92 other code is likely going to break with the values this returns."""
93
93
94 def __init__(self, ctx, f):
94 def __init__(self, ctx, f):
95 self._ctx = ctx
95 self._ctx = ctx
96 self._f = f
96 self._f = f
97
97
98 def __bytes__(self):
98 def __bytes__(self):
99 return b'absent file %s@%s' % (self._f, self._ctx)
99 return b'absent file %s@%s' % (self._f, self._ctx)
100
100
101 def path(self):
101 def path(self):
102 return self._f
102 return self._f
103
103
104 def size(self):
104 def size(self):
105 return None
105 return None
106
106
107 def data(self):
107 def data(self):
108 return None
108 return None
109
109
110 def filenode(self):
110 def filenode(self):
111 return self._ctx.repo().nullid
111 return self._ctx.repo().nullid
112
112
113 _customcmp = True
113 _customcmp = True
114
114
115 def cmp(self, fctx):
115 def cmp(self, fctx):
116 """compare with other file context
116 """compare with other file context
117
117
118 returns True if different from fctx.
118 returns True if different from fctx.
119 """
119 """
120 return not (
120 return not (
121 fctx.isabsent()
121 fctx.isabsent()
122 and fctx.changectx() == self.changectx()
122 and fctx.changectx() == self.changectx()
123 and fctx.path() == self.path()
123 and fctx.path() == self.path()
124 )
124 )
125
125
126 def flags(self):
126 def flags(self):
127 return b''
127 return b''
128
128
129 def changectx(self):
129 def changectx(self):
130 return self._ctx
130 return self._ctx
131
131
132 def isbinary(self):
132 def isbinary(self):
133 return False
133 return False
134
134
135 def isabsent(self):
135 def isabsent(self):
136 return True
136 return True
137
137
138
138
139 def _findtool(ui, tool):
139 def _findtool(ui, tool):
140 if tool in internals:
140 if tool in internals:
141 return tool
141 return tool
142 cmd = _toolstr(ui, tool, b"executable", tool)
142 cmd = _toolstr(ui, tool, b"executable", tool)
143 if cmd.startswith(b'python:'):
143 if cmd.startswith(b'python:'):
144 return cmd
144 return cmd
145 return findexternaltool(ui, tool)
145 return findexternaltool(ui, tool)
146
146
147
147
148 def _quotetoolpath(cmd):
148 def _quotetoolpath(cmd):
149 if cmd.startswith(b'python:'):
149 if cmd.startswith(b'python:'):
150 return cmd
150 return cmd
151 return procutil.shellquote(cmd)
151 return procutil.shellquote(cmd)
152
152
153
153
154 def findexternaltool(ui, tool):
154 def findexternaltool(ui, tool):
155 for kn in (b"regkey", b"regkeyalt"):
155 for kn in (b"regkey", b"regkeyalt"):
156 k = _toolstr(ui, tool, kn)
156 k = _toolstr(ui, tool, kn)
157 if not k:
157 if not k:
158 continue
158 continue
159 p = util.lookupreg(k, _toolstr(ui, tool, b"regname"))
159 p = util.lookupreg(k, _toolstr(ui, tool, b"regname"))
160 if p:
160 if p:
161 p = procutil.findexe(p + _toolstr(ui, tool, b"regappend", b""))
161 p = procutil.findexe(p + _toolstr(ui, tool, b"regappend"))
162 if p:
162 if p:
163 return p
163 return p
164 exe = _toolstr(ui, tool, b"executable", tool)
164 exe = _toolstr(ui, tool, b"executable", tool)
165 return procutil.findexe(util.expandpath(exe))
165 return procutil.findexe(util.expandpath(exe))
166
166
167
167
168 def _picktool(repo, ui, path, binary, symlink, changedelete):
168 def _picktool(repo, ui, path, binary, symlink, changedelete):
169 strictcheck = ui.configbool(b'merge', b'strict-capability-check')
169 strictcheck = ui.configbool(b'merge', b'strict-capability-check')
170
170
171 def hascapability(tool, capability, strict=False):
171 def hascapability(tool, capability, strict=False):
172 if tool in internals:
172 if tool in internals:
173 return strict and internals[tool].capabilities.get(capability)
173 return strict and internals[tool].capabilities.get(capability)
174 return _toolbool(ui, tool, capability)
174 return _toolbool(ui, tool, capability)
175
175
176 def supportscd(tool):
176 def supportscd(tool):
177 return tool in internals and internals[tool].mergetype == nomerge
177 return tool in internals and internals[tool].mergetype == nomerge
178
178
179 def check(tool, pat, symlink, binary, changedelete):
179 def check(tool, pat, symlink, binary, changedelete):
180 tmsg = tool
180 tmsg = tool
181 if pat:
181 if pat:
182 tmsg = _(b"%s (for pattern %s)") % (tool, pat)
182 tmsg = _(b"%s (for pattern %s)") % (tool, pat)
183 if not _findtool(ui, tool):
183 if not _findtool(ui, tool):
184 if pat: # explicitly requested tool deserves a warning
184 if pat: # explicitly requested tool deserves a warning
185 ui.warn(_(b"couldn't find merge tool %s\n") % tmsg)
185 ui.warn(_(b"couldn't find merge tool %s\n") % tmsg)
186 else: # configured but non-existing tools are more silent
186 else: # configured but non-existing tools are more silent
187 ui.note(_(b"couldn't find merge tool %s\n") % tmsg)
187 ui.note(_(b"couldn't find merge tool %s\n") % tmsg)
188 elif symlink and not hascapability(tool, b"symlink", strictcheck):
188 elif symlink and not hascapability(tool, b"symlink", strictcheck):
189 ui.warn(_(b"tool %s can't handle symlinks\n") % tmsg)
189 ui.warn(_(b"tool %s can't handle symlinks\n") % tmsg)
190 elif binary and not hascapability(tool, b"binary", strictcheck):
190 elif binary and not hascapability(tool, b"binary", strictcheck):
191 ui.warn(_(b"tool %s can't handle binary\n") % tmsg)
191 ui.warn(_(b"tool %s can't handle binary\n") % tmsg)
192 elif changedelete and not supportscd(tool):
192 elif changedelete and not supportscd(tool):
193 # the nomerge tools are the only tools that support change/delete
193 # the nomerge tools are the only tools that support change/delete
194 # conflicts
194 # conflicts
195 pass
195 pass
196 elif not procutil.gui() and _toolbool(ui, tool, b"gui"):
196 elif not procutil.gui() and _toolbool(ui, tool, b"gui"):
197 ui.warn(_(b"tool %s requires a GUI\n") % tmsg)
197 ui.warn(_(b"tool %s requires a GUI\n") % tmsg)
198 else:
198 else:
199 return True
199 return True
200 return False
200 return False
201
201
202 # internal config: ui.forcemerge
202 # internal config: ui.forcemerge
203 # forcemerge comes from command line arguments, highest priority
203 # forcemerge comes from command line arguments, highest priority
204 force = ui.config(b'ui', b'forcemerge')
204 force = ui.config(b'ui', b'forcemerge')
205 if force:
205 if force:
206 toolpath = _findtool(ui, force)
206 toolpath = _findtool(ui, force)
207 if changedelete and not supportscd(toolpath):
207 if changedelete and not supportscd(toolpath):
208 return b":prompt", None
208 return b":prompt", None
209 else:
209 else:
210 if toolpath:
210 if toolpath:
211 return (force, _quotetoolpath(toolpath))
211 return (force, _quotetoolpath(toolpath))
212 else:
212 else:
213 # mimic HGMERGE if given tool not found
213 # mimic HGMERGE if given tool not found
214 return (force, force)
214 return (force, force)
215
215
216 # HGMERGE takes next precedence
216 # HGMERGE takes next precedence
217 hgmerge = encoding.environ.get(b"HGMERGE")
217 hgmerge = encoding.environ.get(b"HGMERGE")
218 if hgmerge:
218 if hgmerge:
219 if changedelete and not supportscd(hgmerge):
219 if changedelete and not supportscd(hgmerge):
220 return b":prompt", None
220 return b":prompt", None
221 else:
221 else:
222 return (hgmerge, hgmerge)
222 return (hgmerge, hgmerge)
223
223
224 # then patterns
224 # then patterns
225
225
226 # whether binary capability should be checked strictly
226 # whether binary capability should be checked strictly
227 binarycap = binary and strictcheck
227 binarycap = binary and strictcheck
228
228
229 for pat, tool in ui.configitems(b"merge-patterns"):
229 for pat, tool in ui.configitems(b"merge-patterns"):
230 mf = match.match(repo.root, b'', [pat])
230 mf = match.match(repo.root, b'', [pat])
231 if mf(path) and check(tool, pat, symlink, binarycap, changedelete):
231 if mf(path) and check(tool, pat, symlink, binarycap, changedelete):
232 if binary and not hascapability(tool, b"binary", strict=True):
232 if binary and not hascapability(tool, b"binary", strict=True):
233 ui.warn(
233 ui.warn(
234 _(
234 _(
235 b"warning: check merge-patterns configurations,"
235 b"warning: check merge-patterns configurations,"
236 b" if %r for binary file %r is unintentional\n"
236 b" if %r for binary file %r is unintentional\n"
237 b"(see 'hg help merge-tools'"
237 b"(see 'hg help merge-tools'"
238 b" for binary files capability)\n"
238 b" for binary files capability)\n"
239 )
239 )
240 % (pycompat.bytestr(tool), pycompat.bytestr(path))
240 % (pycompat.bytestr(tool), pycompat.bytestr(path))
241 )
241 )
242 toolpath = _findtool(ui, tool)
242 toolpath = _findtool(ui, tool)
243 return (tool, _quotetoolpath(toolpath))
243 return (tool, _quotetoolpath(toolpath))
244
244
245 # then merge tools
245 # then merge tools
246 tools = {}
246 tools = {}
247 disabled = set()
247 disabled = set()
248 for k, v in ui.configitems(b"merge-tools"):
248 for k, v in ui.configitems(b"merge-tools"):
249 t = k.split(b'.')[0]
249 t = k.split(b'.')[0]
250 if t not in tools:
250 if t not in tools:
251 tools[t] = int(_toolstr(ui, t, b"priority"))
251 tools[t] = int(_toolstr(ui, t, b"priority"))
252 if _toolbool(ui, t, b"disabled"):
252 if _toolbool(ui, t, b"disabled"):
253 disabled.add(t)
253 disabled.add(t)
254 names = tools.keys()
254 names = tools.keys()
255 tools = sorted(
255 tools = sorted(
256 [(-p, tool) for tool, p in tools.items() if tool not in disabled]
256 [(-p, tool) for tool, p in tools.items() if tool not in disabled]
257 )
257 )
258 uimerge = ui.config(b"ui", b"merge")
258 uimerge = ui.config(b"ui", b"merge")
259 if uimerge:
259 if uimerge:
260 # external tools defined in uimerge won't be able to handle
260 # external tools defined in uimerge won't be able to handle
261 # change/delete conflicts
261 # change/delete conflicts
262 if check(uimerge, path, symlink, binary, changedelete):
262 if check(uimerge, path, symlink, binary, changedelete):
263 if uimerge not in names and not changedelete:
263 if uimerge not in names and not changedelete:
264 return (uimerge, uimerge)
264 return (uimerge, uimerge)
265 tools.insert(0, (None, uimerge)) # highest priority
265 tools.insert(0, (None, uimerge)) # highest priority
266 tools.append((None, b"hgmerge")) # the old default, if found
266 tools.append((None, b"hgmerge")) # the old default, if found
267 for p, t in tools:
267 for p, t in tools:
268 if check(t, None, symlink, binary, changedelete):
268 if check(t, None, symlink, binary, changedelete):
269 toolpath = _findtool(ui, t)
269 toolpath = _findtool(ui, t)
270 return (t, _quotetoolpath(toolpath))
270 return (t, _quotetoolpath(toolpath))
271
271
272 # internal merge or prompt as last resort
272 # internal merge or prompt as last resort
273 if symlink or binary or changedelete:
273 if symlink or binary or changedelete:
274 if not changedelete and len(tools):
274 if not changedelete and len(tools):
275 # any tool is rejected by capability for symlink or binary
275 # any tool is rejected by capability for symlink or binary
276 ui.warn(_(b"no tool found to merge %s\n") % path)
276 ui.warn(_(b"no tool found to merge %s\n") % path)
277 return b":prompt", None
277 return b":prompt", None
278 return b":merge", None
278 return b":merge", None
279
279
280
280
281 def _eoltype(data):
281 def _eoltype(data):
282 """Guess the EOL type of a file"""
282 """Guess the EOL type of a file"""
283 if b'\0' in data: # binary
283 if b'\0' in data: # binary
284 return None
284 return None
285 if b'\r\n' in data: # Windows
285 if b'\r\n' in data: # Windows
286 return b'\r\n'
286 return b'\r\n'
287 if b'\r' in data: # Old Mac
287 if b'\r' in data: # Old Mac
288 return b'\r'
288 return b'\r'
289 if b'\n' in data: # UNIX
289 if b'\n' in data: # UNIX
290 return b'\n'
290 return b'\n'
291 return None # unknown
291 return None # unknown
292
292
293
293
294 def _matcheol(file, backup):
294 def _matcheol(file, backup):
295 """Convert EOL markers in a file to match origfile"""
295 """Convert EOL markers in a file to match origfile"""
296 tostyle = _eoltype(backup.data()) # No repo.wread filters?
296 tostyle = _eoltype(backup.data()) # No repo.wread filters?
297 if tostyle:
297 if tostyle:
298 data = util.readfile(file)
298 data = util.readfile(file)
299 style = _eoltype(data)
299 style = _eoltype(data)
300 if style:
300 if style:
301 newdata = data.replace(style, tostyle)
301 newdata = data.replace(style, tostyle)
302 if newdata != data:
302 if newdata != data:
303 util.writefile(file, newdata)
303 util.writefile(file, newdata)
304
304
305
305
306 @internaltool(b'prompt', nomerge)
306 @internaltool(b'prompt', nomerge)
307 def _iprompt(repo, mynode, local, other, base, toolconf):
307 def _iprompt(repo, mynode, local, other, base, toolconf):
308 """Asks the user which of the local `p1()` or the other `p2()` version to
308 """Asks the user which of the local `p1()` or the other `p2()` version to
309 keep as the merged version."""
309 keep as the merged version."""
310 ui = repo.ui
310 ui = repo.ui
311 fd = local.fctx.path()
311 fd = local.fctx.path()
312 uipathfn = scmutil.getuipathfn(repo)
312 uipathfn = scmutil.getuipathfn(repo)
313
313
314 # Avoid prompting during an in-memory merge since it doesn't support merge
314 # Avoid prompting during an in-memory merge since it doesn't support merge
315 # conflicts.
315 # conflicts.
316 if local.fctx.changectx().isinmemory():
316 if local.fctx.changectx().isinmemory():
317 raise error.InMemoryMergeConflictsError(
317 raise error.InMemoryMergeConflictsError(
318 b'in-memory merge does not support file conflicts'
318 b'in-memory merge does not support file conflicts'
319 )
319 )
320
320
321 prompts = partextras([local.label, other.label])
321 prompts = partextras([local.label, other.label])
322 prompts[b'fd'] = uipathfn(fd)
322 prompts[b'fd'] = uipathfn(fd)
323 try:
323 try:
324 if other.fctx.isabsent():
324 if other.fctx.isabsent():
325 index = ui.promptchoice(_localchangedotherdeletedmsg % prompts, 2)
325 index = ui.promptchoice(_localchangedotherdeletedmsg % prompts, 2)
326 choice = [b'local', b'other', b'unresolved'][index]
326 choice = [b'local', b'other', b'unresolved'][index]
327 elif local.fctx.isabsent():
327 elif local.fctx.isabsent():
328 index = ui.promptchoice(_otherchangedlocaldeletedmsg % prompts, 2)
328 index = ui.promptchoice(_otherchangedlocaldeletedmsg % prompts, 2)
329 choice = [b'other', b'local', b'unresolved'][index]
329 choice = [b'other', b'local', b'unresolved'][index]
330 else:
330 else:
331 # IMPORTANT: keep the last line of this prompt ("What do you want to
331 # IMPORTANT: keep the last line of this prompt ("What do you want to
332 # do?") very short, see comment next to _localchangedotherdeletedmsg
332 # do?") very short, see comment next to _localchangedotherdeletedmsg
333 # at the top of the file for details.
333 # at the top of the file for details.
334 index = ui.promptchoice(
334 index = ui.promptchoice(
335 _(
335 _(
336 b"file '%(fd)s' needs to be resolved.\n"
336 b"file '%(fd)s' needs to be resolved.\n"
337 b"You can keep (l)ocal%(l)s, take (o)ther%(o)s, or leave "
337 b"You can keep (l)ocal%(l)s, take (o)ther%(o)s, or leave "
338 b"(u)nresolved.\n"
338 b"(u)nresolved.\n"
339 b"What do you want to do?"
339 b"What do you want to do?"
340 b"$$ &Local $$ &Other $$ &Unresolved"
340 b"$$ &Local $$ &Other $$ &Unresolved"
341 )
341 )
342 % prompts,
342 % prompts,
343 2,
343 2,
344 )
344 )
345 choice = [b'local', b'other', b'unresolved'][index]
345 choice = [b'local', b'other', b'unresolved'][index]
346
346
347 if choice == b'other':
347 if choice == b'other':
348 return _iother(repo, mynode, local, other, base, toolconf)
348 return _iother(repo, mynode, local, other, base, toolconf)
349 elif choice == b'local':
349 elif choice == b'local':
350 return _ilocal(repo, mynode, local, other, base, toolconf)
350 return _ilocal(repo, mynode, local, other, base, toolconf)
351 elif choice == b'unresolved':
351 elif choice == b'unresolved':
352 return _ifail(repo, mynode, local, other, base, toolconf)
352 return _ifail(repo, mynode, local, other, base, toolconf)
353 except error.ResponseExpected:
353 except error.ResponseExpected:
354 ui.write(b"\n")
354 ui.write(b"\n")
355 return _ifail(repo, mynode, local, other, base, toolconf)
355 return _ifail(repo, mynode, local, other, base, toolconf)
356
356
357
357
358 @internaltool(b'local', nomerge)
358 @internaltool(b'local', nomerge)
359 def _ilocal(repo, mynode, local, other, base, toolconf):
359 def _ilocal(repo, mynode, local, other, base, toolconf):
360 """Uses the local `p1()` version of files as the merged version."""
360 """Uses the local `p1()` version of files as the merged version."""
361 return 0, local.fctx.isabsent()
361 return 0, local.fctx.isabsent()
362
362
363
363
364 @internaltool(b'other', nomerge)
364 @internaltool(b'other', nomerge)
365 def _iother(repo, mynode, local, other, base, toolconf):
365 def _iother(repo, mynode, local, other, base, toolconf):
366 """Uses the other `p2()` version of files as the merged version."""
366 """Uses the other `p2()` version of files as the merged version."""
367 if other.fctx.isabsent():
367 if other.fctx.isabsent():
368 # local changed, remote deleted -- 'deleted' picked
368 # local changed, remote deleted -- 'deleted' picked
369 _underlyingfctxifabsent(local.fctx).remove()
369 _underlyingfctxifabsent(local.fctx).remove()
370 deleted = True
370 deleted = True
371 else:
371 else:
372 _underlyingfctxifabsent(local.fctx).write(
372 _underlyingfctxifabsent(local.fctx).write(
373 other.fctx.data(), other.fctx.flags()
373 other.fctx.data(), other.fctx.flags()
374 )
374 )
375 deleted = False
375 deleted = False
376 return 0, deleted
376 return 0, deleted
377
377
378
378
379 @internaltool(b'fail', nomerge)
379 @internaltool(b'fail', nomerge)
380 def _ifail(repo, mynode, local, other, base, toolconf):
380 def _ifail(repo, mynode, local, other, base, toolconf):
381 """
381 """
382 Rather than attempting to merge files that were modified on both
382 Rather than attempting to merge files that were modified on both
383 branches, it marks them as unresolved. The resolve command must be
383 branches, it marks them as unresolved. The resolve command must be
384 used to resolve these conflicts."""
384 used to resolve these conflicts."""
385 # for change/delete conflicts write out the changed version, then fail
385 # for change/delete conflicts write out the changed version, then fail
386 if local.fctx.isabsent():
386 if local.fctx.isabsent():
387 _underlyingfctxifabsent(local.fctx).write(
387 _underlyingfctxifabsent(local.fctx).write(
388 other.fctx.data(), other.fctx.flags()
388 other.fctx.data(), other.fctx.flags()
389 )
389 )
390 return 1, False
390 return 1, False
391
391
392
392
393 def _underlyingfctxifabsent(filectx):
393 def _underlyingfctxifabsent(filectx):
394 """Sometimes when resolving, our fcd is actually an absentfilectx, but
394 """Sometimes when resolving, our fcd is actually an absentfilectx, but
395 we want to write to it (to do the resolve). This helper returns the
395 we want to write to it (to do the resolve). This helper returns the
396 underyling workingfilectx in that case.
396 underyling workingfilectx in that case.
397 """
397 """
398 if filectx.isabsent():
398 if filectx.isabsent():
399 return filectx.changectx()[filectx.path()]
399 return filectx.changectx()[filectx.path()]
400 else:
400 else:
401 return filectx
401 return filectx
402
402
403
403
404 def _verifytext(input, ui):
404 def _verifytext(input, ui):
405 """verifies that text is non-binary"""
405 """verifies that text is non-binary"""
406 if stringutil.binary(input.text()):
406 if stringutil.binary(input.text()):
407 msg = _(b"%s looks like a binary file.") % input.fctx.path()
407 msg = _(b"%s looks like a binary file.") % input.fctx.path()
408 ui.warn(_(b'warning: %s\n') % msg)
408 ui.warn(_(b'warning: %s\n') % msg)
409 raise error.Abort(msg)
409 raise error.Abort(msg)
410
410
411
411
412 def _premerge(repo, local, other, base, toolconf):
412 def _premerge(repo, local, other, base, toolconf):
413 tool, toolpath, binary, symlink, scriptfn = toolconf
413 tool, toolpath, binary, symlink, scriptfn = toolconf
414 if symlink or local.fctx.isabsent() or other.fctx.isabsent():
414 if symlink or local.fctx.isabsent() or other.fctx.isabsent():
415 return 1
415 return 1
416
416
417 ui = repo.ui
417 ui = repo.ui
418
418
419 validkeep = [b'keep', b'keep-merge3', b'keep-mergediff']
419 validkeep = [b'keep', b'keep-merge3', b'keep-mergediff']
420
420
421 # do we attempt to simplemerge first?
421 # do we attempt to simplemerge first?
422 try:
422 try:
423 premerge = _toolbool(ui, tool, b"premerge", not binary)
423 premerge = _toolbool(ui, tool, b"premerge", not binary)
424 except error.ConfigError:
424 except error.ConfigError:
425 premerge = _toolstr(ui, tool, b"premerge", b"").lower()
425 premerge = _toolstr(ui, tool, b"premerge", b"").lower()
426 if premerge not in validkeep:
426 if premerge not in validkeep:
427 _valid = b', '.join([b"'" + v + b"'" for v in validkeep])
427 _valid = b', '.join([b"'" + v + b"'" for v in validkeep])
428 raise error.ConfigError(
428 raise error.ConfigError(
429 _(b"%s.premerge not valid ('%s' is neither boolean nor %s)")
429 _(b"%s.premerge not valid ('%s' is neither boolean nor %s)")
430 % (tool, premerge, _valid)
430 % (tool, premerge, _valid)
431 )
431 )
432
432
433 if premerge:
433 if premerge:
434 mode = b'merge'
434 mode = b'merge'
435 if premerge == b'keep-mergediff':
435 if premerge == b'keep-mergediff':
436 mode = b'mergediff'
436 mode = b'mergediff'
437 elif premerge == b'keep-merge3':
437 elif premerge == b'keep-merge3':
438 mode = b'merge3'
438 mode = b'merge3'
439 if any(
439 if any(
440 stringutil.binary(input.text()) for input in (local, base, other)
440 stringutil.binary(input.text()) for input in (local, base, other)
441 ):
441 ):
442 return 1 # continue merging
442 return 1 # continue merging
443 merged_text, conflicts = simplemerge.simplemerge(
443 merged_text, conflicts = simplemerge.simplemerge(
444 local, base, other, mode=mode
444 local, base, other, mode=mode
445 )
445 )
446 if not conflicts or premerge in validkeep:
446 if not conflicts or premerge in validkeep:
447 # fcd.flags() already has the merged flags (done in
447 # fcd.flags() already has the merged flags (done in
448 # mergestate.resolve())
448 # mergestate.resolve())
449 local.fctx.write(merged_text, local.fctx.flags())
449 local.fctx.write(merged_text, local.fctx.flags())
450 if not conflicts:
450 if not conflicts:
451 ui.debug(b" premerge successful\n")
451 ui.debug(b" premerge successful\n")
452 return 0
452 return 0
453 return 1 # continue merging
453 return 1 # continue merging
454
454
455
455
456 def _mergecheck(repo, mynode, fcd, fco, fca, toolconf):
456 def _mergecheck(repo, mynode, fcd, fco, fca, toolconf):
457 tool, toolpath, binary, symlink, scriptfn = toolconf
457 tool, toolpath, binary, symlink, scriptfn = toolconf
458 uipathfn = scmutil.getuipathfn(repo)
458 uipathfn = scmutil.getuipathfn(repo)
459 if symlink:
459 if symlink:
460 repo.ui.warn(
460 repo.ui.warn(
461 _(b'warning: internal %s cannot merge symlinks for %s\n')
461 _(b'warning: internal %s cannot merge symlinks for %s\n')
462 % (tool, uipathfn(fcd.path()))
462 % (tool, uipathfn(fcd.path()))
463 )
463 )
464 return False
464 return False
465 if fcd.isabsent() or fco.isabsent():
465 if fcd.isabsent() or fco.isabsent():
466 repo.ui.warn(
466 repo.ui.warn(
467 _(
467 _(
468 b'warning: internal %s cannot merge change/delete '
468 b'warning: internal %s cannot merge change/delete '
469 b'conflict for %s\n'
469 b'conflict for %s\n'
470 )
470 )
471 % (tool, uipathfn(fcd.path()))
471 % (tool, uipathfn(fcd.path()))
472 )
472 )
473 return False
473 return False
474 return True
474 return True
475
475
476
476
477 def _merge(repo, local, other, base, mode):
477 def _merge(repo, local, other, base, mode):
478 """
478 """
479 Uses the internal non-interactive simple merge algorithm for merging
479 Uses the internal non-interactive simple merge algorithm for merging
480 files. It will fail if there are any conflicts and leave markers in
480 files. It will fail if there are any conflicts and leave markers in
481 the partially merged file. Markers will have two sections, one for each side
481 the partially merged file. Markers will have two sections, one for each side
482 of merge, unless mode equals 'union' which suppresses the markers."""
482 of merge, unless mode equals 'union' which suppresses the markers."""
483 ui = repo.ui
483 ui = repo.ui
484
484
485 try:
485 try:
486 _verifytext(local, ui)
486 _verifytext(local, ui)
487 _verifytext(base, ui)
487 _verifytext(base, ui)
488 _verifytext(other, ui)
488 _verifytext(other, ui)
489 except error.Abort:
489 except error.Abort:
490 return True, True, False
490 return True, True, False
491 else:
491 else:
492 merged_text, conflicts = simplemerge.simplemerge(
492 merged_text, conflicts = simplemerge.simplemerge(
493 local, base, other, mode=mode
493 local, base, other, mode=mode
494 )
494 )
495 # fcd.flags() already has the merged flags (done in
495 # fcd.flags() already has the merged flags (done in
496 # mergestate.resolve())
496 # mergestate.resolve())
497 local.fctx.write(merged_text, local.fctx.flags())
497 local.fctx.write(merged_text, local.fctx.flags())
498 return True, conflicts, False
498 return True, conflicts, False
499
499
500
500
501 @internaltool(
501 @internaltool(
502 b'union',
502 b'union',
503 fullmerge,
503 fullmerge,
504 _(
504 _(
505 b"warning: conflicts while merging %s! "
505 b"warning: conflicts while merging %s! "
506 b"(edit, then use 'hg resolve --mark')\n"
506 b"(edit, then use 'hg resolve --mark')\n"
507 ),
507 ),
508 precheck=_mergecheck,
508 precheck=_mergecheck,
509 )
509 )
510 def _iunion(repo, mynode, local, other, base, toolconf, backup):
510 def _iunion(repo, mynode, local, other, base, toolconf, backup):
511 """
511 """
512 Uses the internal non-interactive simple merge algorithm for merging
512 Uses the internal non-interactive simple merge algorithm for merging
513 files. It will use both left and right sides for conflict regions.
513 files. It will use both left and right sides for conflict regions.
514 No markers are inserted."""
514 No markers are inserted."""
515 return _merge(repo, local, other, base, b'union')
515 return _merge(repo, local, other, base, b'union')
516
516
517
517
518 @internaltool(
518 @internaltool(
519 b'merge',
519 b'merge',
520 fullmerge,
520 fullmerge,
521 _(
521 _(
522 b"warning: conflicts while merging %s! "
522 b"warning: conflicts while merging %s! "
523 b"(edit, then use 'hg resolve --mark')\n"
523 b"(edit, then use 'hg resolve --mark')\n"
524 ),
524 ),
525 precheck=_mergecheck,
525 precheck=_mergecheck,
526 )
526 )
527 def _imerge(repo, mynode, local, other, base, toolconf, backup):
527 def _imerge(repo, mynode, local, other, base, toolconf, backup):
528 """
528 """
529 Uses the internal non-interactive simple merge algorithm for merging
529 Uses the internal non-interactive simple merge algorithm for merging
530 files. It will fail if there are any conflicts and leave markers in
530 files. It will fail if there are any conflicts and leave markers in
531 the partially merged file. Markers will have two sections, one for each side
531 the partially merged file. Markers will have two sections, one for each side
532 of merge."""
532 of merge."""
533 return _merge(repo, local, other, base, b'merge')
533 return _merge(repo, local, other, base, b'merge')
534
534
535
535
536 @internaltool(
536 @internaltool(
537 b'merge3',
537 b'merge3',
538 fullmerge,
538 fullmerge,
539 _(
539 _(
540 b"warning: conflicts while merging %s! "
540 b"warning: conflicts while merging %s! "
541 b"(edit, then use 'hg resolve --mark')\n"
541 b"(edit, then use 'hg resolve --mark')\n"
542 ),
542 ),
543 precheck=_mergecheck,
543 precheck=_mergecheck,
544 )
544 )
545 def _imerge3(repo, mynode, local, other, base, toolconf, backup):
545 def _imerge3(repo, mynode, local, other, base, toolconf, backup):
546 """
546 """
547 Uses the internal non-interactive simple merge algorithm for merging
547 Uses the internal non-interactive simple merge algorithm for merging
548 files. It will fail if there are any conflicts and leave markers in
548 files. It will fail if there are any conflicts and leave markers in
549 the partially merged file. Marker will have three sections, one from each
549 the partially merged file. Marker will have three sections, one from each
550 side of the merge and one for the base content."""
550 side of the merge and one for the base content."""
551 return _merge(repo, local, other, base, b'merge3')
551 return _merge(repo, local, other, base, b'merge3')
552
552
553
553
554 @internaltool(
554 @internaltool(
555 b'merge3-lie-about-conflicts',
555 b'merge3-lie-about-conflicts',
556 fullmerge,
556 fullmerge,
557 b'',
557 b'',
558 precheck=_mergecheck,
558 precheck=_mergecheck,
559 )
559 )
560 def _imerge3alwaysgood(*args, **kwargs):
560 def _imerge3alwaysgood(*args, **kwargs):
561 # Like merge3, but record conflicts as resolved with markers in place.
561 # Like merge3, but record conflicts as resolved with markers in place.
562 #
562 #
563 # This is used for `diff.merge` to show the differences between
563 # This is used for `diff.merge` to show the differences between
564 # the auto-merge state and the committed merge state. It may be
564 # the auto-merge state and the committed merge state. It may be
565 # useful for other things.
565 # useful for other things.
566 b1, junk, b2 = _imerge3(*args, **kwargs)
566 b1, junk, b2 = _imerge3(*args, **kwargs)
567 # TODO is this right? I'm not sure what these return values mean,
567 # TODO is this right? I'm not sure what these return values mean,
568 # but as far as I can tell this will indicate to callers tha the
568 # but as far as I can tell this will indicate to callers tha the
569 # merge succeeded.
569 # merge succeeded.
570 return b1, False, b2
570 return b1, False, b2
571
571
572
572
573 @internaltool(
573 @internaltool(
574 b'mergediff',
574 b'mergediff',
575 fullmerge,
575 fullmerge,
576 _(
576 _(
577 b"warning: conflicts while merging %s! "
577 b"warning: conflicts while merging %s! "
578 b"(edit, then use 'hg resolve --mark')\n"
578 b"(edit, then use 'hg resolve --mark')\n"
579 ),
579 ),
580 precheck=_mergecheck,
580 precheck=_mergecheck,
581 )
581 )
582 def _imerge_diff(repo, mynode, local, other, base, toolconf, backup):
582 def _imerge_diff(repo, mynode, local, other, base, toolconf, backup):
583 """
583 """
584 Uses the internal non-interactive simple merge algorithm for merging
584 Uses the internal non-interactive simple merge algorithm for merging
585 files. It will fail if there are any conflicts and leave markers in
585 files. It will fail if there are any conflicts and leave markers in
586 the partially merged file. The marker will have two sections, one with the
586 the partially merged file. The marker will have two sections, one with the
587 content from one side of the merge, and one with a diff from the base
587 content from one side of the merge, and one with a diff from the base
588 content to the content on the other side. (experimental)"""
588 content to the content on the other side. (experimental)"""
589 return _merge(repo, local, other, base, b'mergediff')
589 return _merge(repo, local, other, base, b'mergediff')
590
590
591
591
592 @internaltool(b'merge-local', mergeonly, precheck=_mergecheck)
592 @internaltool(b'merge-local', mergeonly, precheck=_mergecheck)
593 def _imergelocal(repo, mynode, local, other, base, toolconf, backup):
593 def _imergelocal(repo, mynode, local, other, base, toolconf, backup):
594 """
594 """
595 Like :merge, but resolve all conflicts non-interactively in favor
595 Like :merge, but resolve all conflicts non-interactively in favor
596 of the local `p1()` changes."""
596 of the local `p1()` changes."""
597 return _merge(repo, local, other, base, b'local')
597 return _merge(repo, local, other, base, b'local')
598
598
599
599
600 @internaltool(b'merge-other', mergeonly, precheck=_mergecheck)
600 @internaltool(b'merge-other', mergeonly, precheck=_mergecheck)
601 def _imergeother(repo, mynode, local, other, base, toolconf, backup):
601 def _imergeother(repo, mynode, local, other, base, toolconf, backup):
602 """
602 """
603 Like :merge, but resolve all conflicts non-interactively in favor
603 Like :merge, but resolve all conflicts non-interactively in favor
604 of the other `p2()` changes."""
604 of the other `p2()` changes."""
605 return _merge(repo, local, other, base, b'other')
605 return _merge(repo, local, other, base, b'other')
606
606
607
607
608 @internaltool(
608 @internaltool(
609 b'tagmerge',
609 b'tagmerge',
610 mergeonly,
610 mergeonly,
611 _(
611 _(
612 b"automatic tag merging of %s failed! "
612 b"automatic tag merging of %s failed! "
613 b"(use 'hg resolve --tool :merge' or another merge "
613 b"(use 'hg resolve --tool :merge' or another merge "
614 b"tool of your choice)\n"
614 b"tool of your choice)\n"
615 ),
615 ),
616 )
616 )
617 def _itagmerge(repo, mynode, local, other, base, toolconf, backup):
617 def _itagmerge(repo, mynode, local, other, base, toolconf, backup):
618 """
618 """
619 Uses the internal tag merge algorithm (experimental).
619 Uses the internal tag merge algorithm (experimental).
620 """
620 """
621 success, status = tagmerge.merge(repo, local.fctx, other.fctx, base.fctx)
621 success, status = tagmerge.merge(repo, local.fctx, other.fctx, base.fctx)
622 return success, status, False
622 return success, status, False
623
623
624
624
625 @internaltool(b'dump', fullmerge, binary=True, symlink=True)
625 @internaltool(b'dump', fullmerge, binary=True, symlink=True)
626 def _idump(repo, mynode, local, other, base, toolconf, backup):
626 def _idump(repo, mynode, local, other, base, toolconf, backup):
627 """
627 """
628 Creates three versions of the files to merge, containing the
628 Creates three versions of the files to merge, containing the
629 contents of local, other and base. These files can then be used to
629 contents of local, other and base. These files can then be used to
630 perform a merge manually. If the file to be merged is named
630 perform a merge manually. If the file to be merged is named
631 ``a.txt``, these files will accordingly be named ``a.txt.local``,
631 ``a.txt``, these files will accordingly be named ``a.txt.local``,
632 ``a.txt.other`` and ``a.txt.base`` and they will be placed in the
632 ``a.txt.other`` and ``a.txt.base`` and they will be placed in the
633 same directory as ``a.txt``.
633 same directory as ``a.txt``.
634
634
635 This implies premerge. Therefore, files aren't dumped, if premerge
635 This implies premerge. Therefore, files aren't dumped, if premerge
636 runs successfully. Use :forcedump to forcibly write files out.
636 runs successfully. Use :forcedump to forcibly write files out.
637 """
637 """
638 a = _workingpath(repo, local.fctx)
638 a = _workingpath(repo, local.fctx)
639 fd = local.fctx.path()
639 fd = local.fctx.path()
640
640
641 from . import context
641 from . import context
642
642
643 if isinstance(local.fctx, context.overlayworkingfilectx):
643 if isinstance(local.fctx, context.overlayworkingfilectx):
644 raise error.InMemoryMergeConflictsError(
644 raise error.InMemoryMergeConflictsError(
645 b'in-memory merge does not support the :dump tool.'
645 b'in-memory merge does not support the :dump tool.'
646 )
646 )
647
647
648 util.writefile(a + b".local", local.fctx.decodeddata())
648 util.writefile(a + b".local", local.fctx.decodeddata())
649 repo.wwrite(fd + b".other", other.fctx.data(), other.fctx.flags())
649 repo.wwrite(fd + b".other", other.fctx.data(), other.fctx.flags())
650 repo.wwrite(fd + b".base", base.fctx.data(), base.fctx.flags())
650 repo.wwrite(fd + b".base", base.fctx.data(), base.fctx.flags())
651 return False, 1, False
651 return False, 1, False
652
652
653
653
654 @internaltool(b'forcedump', mergeonly, binary=True, symlink=True)
654 @internaltool(b'forcedump', mergeonly, binary=True, symlink=True)
655 def _forcedump(repo, mynode, local, other, base, toolconf, backup):
655 def _forcedump(repo, mynode, local, other, base, toolconf, backup):
656 """
656 """
657 Creates three versions of the files as same as :dump, but omits premerge.
657 Creates three versions of the files as same as :dump, but omits premerge.
658 """
658 """
659 return _idump(repo, mynode, local, other, base, toolconf, backup)
659 return _idump(repo, mynode, local, other, base, toolconf, backup)
660
660
661
661
662 def _xmergeimm(repo, mynode, local, other, base, toolconf, backup):
662 def _xmergeimm(repo, mynode, local, other, base, toolconf, backup):
663 # In-memory merge simply raises an exception on all external merge tools,
663 # In-memory merge simply raises an exception on all external merge tools,
664 # for now.
664 # for now.
665 #
665 #
666 # It would be possible to run most tools with temporary files, but this
666 # It would be possible to run most tools with temporary files, but this
667 # raises the question of what to do if the user only partially resolves the
667 # raises the question of what to do if the user only partially resolves the
668 # file -- we can't leave a merge state. (Copy to somewhere in the .hg/
668 # file -- we can't leave a merge state. (Copy to somewhere in the .hg/
669 # directory and tell the user how to get it is my best idea, but it's
669 # directory and tell the user how to get it is my best idea, but it's
670 # clunky.)
670 # clunky.)
671 raise error.InMemoryMergeConflictsError(
671 raise error.InMemoryMergeConflictsError(
672 b'in-memory merge does not support external merge tools'
672 b'in-memory merge does not support external merge tools'
673 )
673 )
674
674
675
675
676 def _describemerge(ui, repo, mynode, fcl, fcb, fco, env, toolpath, args):
676 def _describemerge(ui, repo, mynode, fcl, fcb, fco, env, toolpath, args):
677 tmpl = ui.config(b'command-templates', b'pre-merge-tool-output')
677 tmpl = ui.config(b'command-templates', b'pre-merge-tool-output')
678 if not tmpl:
678 if not tmpl:
679 return
679 return
680
680
681 mappingdict = templateutil.mappingdict
681 mappingdict = templateutil.mappingdict
682 props = {
682 props = {
683 b'ctx': fcl.changectx(),
683 b'ctx': fcl.changectx(),
684 b'node': hex(mynode),
684 b'node': hex(mynode),
685 b'path': fcl.path(),
685 b'path': fcl.path(),
686 b'local': mappingdict(
686 b'local': mappingdict(
687 {
687 {
688 b'ctx': fcl.changectx(),
688 b'ctx': fcl.changectx(),
689 b'fctx': fcl,
689 b'fctx': fcl,
690 b'node': hex(mynode),
690 b'node': hex(mynode),
691 b'name': _(b'local'),
691 b'name': _(b'local'),
692 b'islink': b'l' in fcl.flags(),
692 b'islink': b'l' in fcl.flags(),
693 b'label': env[b'HG_MY_LABEL'],
693 b'label': env[b'HG_MY_LABEL'],
694 }
694 }
695 ),
695 ),
696 b'base': mappingdict(
696 b'base': mappingdict(
697 {
697 {
698 b'ctx': fcb.changectx(),
698 b'ctx': fcb.changectx(),
699 b'fctx': fcb,
699 b'fctx': fcb,
700 b'name': _(b'base'),
700 b'name': _(b'base'),
701 b'islink': b'l' in fcb.flags(),
701 b'islink': b'l' in fcb.flags(),
702 b'label': env[b'HG_BASE_LABEL'],
702 b'label': env[b'HG_BASE_LABEL'],
703 }
703 }
704 ),
704 ),
705 b'other': mappingdict(
705 b'other': mappingdict(
706 {
706 {
707 b'ctx': fco.changectx(),
707 b'ctx': fco.changectx(),
708 b'fctx': fco,
708 b'fctx': fco,
709 b'name': _(b'other'),
709 b'name': _(b'other'),
710 b'islink': b'l' in fco.flags(),
710 b'islink': b'l' in fco.flags(),
711 b'label': env[b'HG_OTHER_LABEL'],
711 b'label': env[b'HG_OTHER_LABEL'],
712 }
712 }
713 ),
713 ),
714 b'toolpath': toolpath,
714 b'toolpath': toolpath,
715 b'toolargs': args,
715 b'toolargs': args,
716 }
716 }
717
717
718 # TODO: make all of this something that can be specified on a per-tool basis
718 # TODO: make all of this something that can be specified on a per-tool basis
719 tmpl = templater.unquotestring(tmpl)
719 tmpl = templater.unquotestring(tmpl)
720
720
721 # Not using cmdutil.rendertemplate here since it causes errors importing
721 # Not using cmdutil.rendertemplate here since it causes errors importing
722 # things for us to import cmdutil.
722 # things for us to import cmdutil.
723 tres = formatter.templateresources(ui, repo)
723 tres = formatter.templateresources(ui, repo)
724 t = formatter.maketemplater(
724 t = formatter.maketemplater(
725 ui, tmpl, defaults=templatekw.keywords, resources=tres
725 ui, tmpl, defaults=templatekw.keywords, resources=tres
726 )
726 )
727 ui.status(t.renderdefault(props))
727 ui.status(t.renderdefault(props))
728
728
729
729
730 def _xmerge(repo, mynode, local, other, base, toolconf, backup):
730 def _xmerge(repo, mynode, local, other, base, toolconf, backup):
731 fcd = local.fctx
731 fcd = local.fctx
732 fco = other.fctx
732 fco = other.fctx
733 fca = base.fctx
733 fca = base.fctx
734 tool, toolpath, binary, symlink, scriptfn = toolconf
734 tool, toolpath, binary, symlink, scriptfn = toolconf
735 uipathfn = scmutil.getuipathfn(repo)
735 uipathfn = scmutil.getuipathfn(repo)
736 if fcd.isabsent() or fco.isabsent():
736 if fcd.isabsent() or fco.isabsent():
737 repo.ui.warn(
737 repo.ui.warn(
738 _(b'warning: %s cannot merge change/delete conflict for %s\n')
738 _(b'warning: %s cannot merge change/delete conflict for %s\n')
739 % (tool, uipathfn(fcd.path()))
739 % (tool, uipathfn(fcd.path()))
740 )
740 )
741 return False, 1, None
741 return False, 1, None
742 localpath = _workingpath(repo, fcd)
742 localpath = _workingpath(repo, fcd)
743 args = _toolstr(repo.ui, tool, b"args")
743 args = _toolstr(repo.ui, tool, b"args")
744
744
745 files = [
745 files = [
746 (b"base", fca.path(), fca.decodeddata()),
746 (b"base", fca.path(), fca.decodeddata()),
747 (b"other", fco.path(), fco.decodeddata()),
747 (b"other", fco.path(), fco.decodeddata()),
748 ]
748 ]
749 outpath = b""
749 outpath = b""
750 if b"$output" in args:
750 if b"$output" in args:
751 # read input from backup, write to original
751 # read input from backup, write to original
752 outpath = localpath
752 outpath = localpath
753 localoutputpath = backup.path()
753 localoutputpath = backup.path()
754 # Remove the .orig to make syntax-highlighting more likely.
754 # Remove the .orig to make syntax-highlighting more likely.
755 if localoutputpath.endswith(b'.orig'):
755 if localoutputpath.endswith(b'.orig'):
756 localoutputpath, ext = os.path.splitext(localoutputpath)
756 localoutputpath, ext = os.path.splitext(localoutputpath)
757 files.append((b"local", localoutputpath, backup.data()))
757 files.append((b"local", localoutputpath, backup.data()))
758
758
759 with _maketempfiles(files) as temppaths:
759 with _maketempfiles(files) as temppaths:
760 basepath, otherpath = temppaths[:2]
760 basepath, otherpath = temppaths[:2]
761 if len(temppaths) == 3:
761 if len(temppaths) == 3:
762 localpath = temppaths[2]
762 localpath = temppaths[2]
763
763
764 def format_label(input):
764 def format_label(input):
765 if input.label_detail:
765 if input.label_detail:
766 return b'%s: %s' % (input.label, input.label_detail)
766 return b'%s: %s' % (input.label, input.label_detail)
767 else:
767 else:
768 return input.label
768 return input.label
769
769
770 env = {
770 env = {
771 b'HG_FILE': fcd.path(),
771 b'HG_FILE': fcd.path(),
772 b'HG_MY_NODE': short(mynode),
772 b'HG_MY_NODE': short(mynode),
773 b'HG_OTHER_NODE': short(fco.changectx().node()),
773 b'HG_OTHER_NODE': short(fco.changectx().node()),
774 b'HG_BASE_NODE': short(fca.changectx().node()),
774 b'HG_BASE_NODE': short(fca.changectx().node()),
775 b'HG_MY_ISLINK': b'l' in fcd.flags(),
775 b'HG_MY_ISLINK': b'l' in fcd.flags(),
776 b'HG_OTHER_ISLINK': b'l' in fco.flags(),
776 b'HG_OTHER_ISLINK': b'l' in fco.flags(),
777 b'HG_BASE_ISLINK': b'l' in fca.flags(),
777 b'HG_BASE_ISLINK': b'l' in fca.flags(),
778 b'HG_MY_LABEL': format_label(local),
778 b'HG_MY_LABEL': format_label(local),
779 b'HG_OTHER_LABEL': format_label(other),
779 b'HG_OTHER_LABEL': format_label(other),
780 b'HG_BASE_LABEL': format_label(base),
780 b'HG_BASE_LABEL': format_label(base),
781 }
781 }
782 ui = repo.ui
782 ui = repo.ui
783
783
784 replace = {
784 replace = {
785 b'local': localpath,
785 b'local': localpath,
786 b'base': basepath,
786 b'base': basepath,
787 b'other': otherpath,
787 b'other': otherpath,
788 b'output': outpath,
788 b'output': outpath,
789 b'labellocal': format_label(local),
789 b'labellocal': format_label(local),
790 b'labelother': format_label(other),
790 b'labelother': format_label(other),
791 b'labelbase': format_label(base),
791 b'labelbase': format_label(base),
792 }
792 }
793 args = util.interpolate(
793 args = util.interpolate(
794 br'\$',
794 br'\$',
795 replace,
795 replace,
796 args,
796 args,
797 lambda s: procutil.shellquote(util.localpath(s)),
797 lambda s: procutil.shellquote(util.localpath(s)),
798 )
798 )
799 if _toolbool(ui, tool, b"gui"):
799 if _toolbool(ui, tool, b"gui"):
800 repo.ui.status(
800 repo.ui.status(
801 _(b'running merge tool %s for file %s\n')
801 _(b'running merge tool %s for file %s\n')
802 % (tool, uipathfn(fcd.path()))
802 % (tool, uipathfn(fcd.path()))
803 )
803 )
804 if scriptfn is None:
804 if scriptfn is None:
805 cmd = toolpath + b' ' + args
805 cmd = toolpath + b' ' + args
806 repo.ui.debug(b'launching merge tool: %s\n' % cmd)
806 repo.ui.debug(b'launching merge tool: %s\n' % cmd)
807 _describemerge(ui, repo, mynode, fcd, fca, fco, env, toolpath, args)
807 _describemerge(ui, repo, mynode, fcd, fca, fco, env, toolpath, args)
808 r = ui.system(
808 r = ui.system(
809 cmd, cwd=repo.root, environ=env, blockedtag=b'mergetool'
809 cmd, cwd=repo.root, environ=env, blockedtag=b'mergetool'
810 )
810 )
811 else:
811 else:
812 repo.ui.debug(
812 repo.ui.debug(
813 b'launching python merge script: %s:%s\n' % (toolpath, scriptfn)
813 b'launching python merge script: %s:%s\n' % (toolpath, scriptfn)
814 )
814 )
815 r = 0
815 r = 0
816 try:
816 try:
817 # avoid cycle cmdutil->merge->filemerge->extensions->cmdutil
817 # avoid cycle cmdutil->merge->filemerge->extensions->cmdutil
818 from . import extensions
818 from . import extensions
819
819
820 mod = extensions.loadpath(toolpath, b'hgmerge.%s' % tool)
820 mod = extensions.loadpath(toolpath, b'hgmerge.%s' % tool)
821 except Exception:
821 except Exception:
822 raise error.Abort(
822 raise error.Abort(
823 _(b"loading python merge script failed: %s") % toolpath
823 _(b"loading python merge script failed: %s") % toolpath
824 )
824 )
825 mergefn = getattr(mod, scriptfn, None)
825 mergefn = getattr(mod, scriptfn, None)
826 if mergefn is None:
826 if mergefn is None:
827 raise error.Abort(
827 raise error.Abort(
828 _(b"%s does not have function: %s") % (toolpath, scriptfn)
828 _(b"%s does not have function: %s") % (toolpath, scriptfn)
829 )
829 )
830 argslist = procutil.shellsplit(args)
830 argslist = procutil.shellsplit(args)
831 # avoid cycle cmdutil->merge->filemerge->hook->extensions->cmdutil
831 # avoid cycle cmdutil->merge->filemerge->hook->extensions->cmdutil
832 from . import hook
832 from . import hook
833
833
834 ret, raised = hook.pythonhook(
834 ret, raised = hook.pythonhook(
835 ui, repo, b"merge", toolpath, mergefn, {b'args': argslist}, True
835 ui, repo, b"merge", toolpath, mergefn, {b'args': argslist}, True
836 )
836 )
837 if raised:
837 if raised:
838 r = 1
838 r = 1
839 repo.ui.debug(b'merge tool returned: %d\n' % r)
839 repo.ui.debug(b'merge tool returned: %d\n' % r)
840 return True, r, False
840 return True, r, False
841
841
842
842
843 def _populate_label_detail(input, template):
843 def _populate_label_detail(input, template):
844 """Applies the given template to the ctx and stores it in the input."""
844 """Applies the given template to the ctx and stores it in the input."""
845 ctx = input.fctx.changectx()
845 ctx = input.fctx.changectx()
846 if ctx.node() is None:
846 if ctx.node() is None:
847 ctx = ctx.p1()
847 ctx = ctx.p1()
848
848
849 props = {b'ctx': ctx}
849 props = {b'ctx': ctx}
850 templateresult = template.renderdefault(props)
850 templateresult = template.renderdefault(props)
851 input.label_detail = stringutil.firstline(templateresult) # avoid '\n'
851 input.label_detail = stringutil.firstline(templateresult) # avoid '\n'
852
852
853
853
854 def _populate_label_details(repo, inputs, tool=None):
854 def _populate_label_details(repo, inputs, tool=None):
855 """Populates the label details using the conflict marker template."""
855 """Populates the label details using the conflict marker template."""
856 ui = repo.ui
856 ui = repo.ui
857 template = ui.config(b'command-templates', b'mergemarker')
857 template = ui.config(b'command-templates', b'mergemarker')
858 if tool is not None:
858 if tool is not None:
859 template = _toolstr(ui, tool, b'mergemarkertemplate', template)
859 template = _toolstr(ui, tool, b'mergemarkertemplate', template)
860 template = templater.unquotestring(template)
860 template = templater.unquotestring(template)
861 tres = formatter.templateresources(ui, repo)
861 tres = formatter.templateresources(ui, repo)
862 tmpl = formatter.maketemplater(
862 tmpl = formatter.maketemplater(
863 ui, template, defaults=templatekw.keywords, resources=tres
863 ui, template, defaults=templatekw.keywords, resources=tres
864 )
864 )
865
865
866 for input in inputs:
866 for input in inputs:
867 _populate_label_detail(input, tmpl)
867 _populate_label_detail(input, tmpl)
868
868
869
869
870 def partextras(labels):
870 def partextras(labels):
871 """Return a dictionary of extra labels for use in prompts to the user
871 """Return a dictionary of extra labels for use in prompts to the user
872
872
873 Intended use is in strings of the form "(l)ocal%(l)s".
873 Intended use is in strings of the form "(l)ocal%(l)s".
874 """
874 """
875 if labels is None:
875 if labels is None:
876 return {
876 return {
877 b"l": b"",
877 b"l": b"",
878 b"o": b"",
878 b"o": b"",
879 }
879 }
880
880
881 return {
881 return {
882 b"l": b" [%s]" % labels[0],
882 b"l": b" [%s]" % labels[0],
883 b"o": b" [%s]" % labels[1],
883 b"o": b" [%s]" % labels[1],
884 }
884 }
885
885
886
886
887 def _makebackup(repo, ui, fcd):
887 def _makebackup(repo, ui, fcd):
888 """Makes and returns a filectx-like object for ``fcd``'s backup file.
888 """Makes and returns a filectx-like object for ``fcd``'s backup file.
889
889
890 In addition to preserving the user's pre-existing modifications to `fcd`
890 In addition to preserving the user's pre-existing modifications to `fcd`
891 (if any), the backup is used to undo certain premerges, confirm whether a
891 (if any), the backup is used to undo certain premerges, confirm whether a
892 merge changed anything, and determine what line endings the new file should
892 merge changed anything, and determine what line endings the new file should
893 have.
893 have.
894
894
895 Backups only need to be written once since their content doesn't change
895 Backups only need to be written once since their content doesn't change
896 afterwards.
896 afterwards.
897 """
897 """
898 if fcd.isabsent():
898 if fcd.isabsent():
899 return None
899 return None
900 # TODO: Break this import cycle somehow. (filectx -> ctx -> fileset ->
900 # TODO: Break this import cycle somehow. (filectx -> ctx -> fileset ->
901 # merge -> filemerge). (I suspect the fileset import is the weakest link)
901 # merge -> filemerge). (I suspect the fileset import is the weakest link)
902 from . import context
902 from . import context
903
903
904 if isinstance(fcd, context.overlayworkingfilectx):
904 if isinstance(fcd, context.overlayworkingfilectx):
905 # If we're merging in-memory, we're free to put the backup anywhere.
905 # If we're merging in-memory, we're free to put the backup anywhere.
906 fd, backup = pycompat.mkstemp(b'hg-merge-backup')
906 fd, backup = pycompat.mkstemp(b'hg-merge-backup')
907 with os.fdopen(fd, 'wb') as f:
907 with os.fdopen(fd, 'wb') as f:
908 f.write(fcd.data())
908 f.write(fcd.data())
909 else:
909 else:
910 backup = scmutil.backuppath(ui, repo, fcd.path())
910 backup = scmutil.backuppath(ui, repo, fcd.path())
911 a = _workingpath(repo, fcd)
911 a = _workingpath(repo, fcd)
912 util.copyfile(a, backup)
912 util.copyfile(a, backup)
913
913
914 return context.arbitraryfilectx(backup, repo=repo)
914 return context.arbitraryfilectx(backup, repo=repo)
915
915
916
916
917 @contextlib.contextmanager
917 @contextlib.contextmanager
918 def _maketempfiles(files):
918 def _maketempfiles(files):
919 """Creates a temporary file for each (prefix, path, data) tuple in `files`,
919 """Creates a temporary file for each (prefix, path, data) tuple in `files`,
920 so an external merge tool may use them.
920 so an external merge tool may use them.
921 """
921 """
922 tmproot = pycompat.mkdtemp(prefix=b'hgmerge-')
922 tmproot = pycompat.mkdtemp(prefix=b'hgmerge-')
923
923
924 def maketempfrompath(prefix, path, data):
924 def maketempfrompath(prefix, path, data):
925 fullbase, ext = os.path.splitext(path)
925 fullbase, ext = os.path.splitext(path)
926 pre = b"%s~%s" % (os.path.basename(fullbase), prefix)
926 pre = b"%s~%s" % (os.path.basename(fullbase), prefix)
927 name = os.path.join(tmproot, pre)
927 name = os.path.join(tmproot, pre)
928 if ext:
928 if ext:
929 name += ext
929 name += ext
930 util.writefile(name, data)
930 util.writefile(name, data)
931 return name
931 return name
932
932
933 temp_files = []
933 temp_files = []
934 for prefix, path, data in files:
934 for prefix, path, data in files:
935 temp_files.append(maketempfrompath(prefix, path, data))
935 temp_files.append(maketempfrompath(prefix, path, data))
936 try:
936 try:
937 yield temp_files
937 yield temp_files
938 finally:
938 finally:
939 shutil.rmtree(tmproot)
939 shutil.rmtree(tmproot)
940
940
941
941
942 def filemerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
942 def filemerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
943 """perform a 3-way merge in the working directory
943 """perform a 3-way merge in the working directory
944
944
945 mynode = parent node before merge
945 mynode = parent node before merge
946 orig = original local filename before merge
946 orig = original local filename before merge
947 fco = other file context
947 fco = other file context
948 fca = ancestor file context
948 fca = ancestor file context
949 fcd = local file context for current/destination file
949 fcd = local file context for current/destination file
950
950
951 Returns whether the merge is complete, the return value of the merge, and
951 Returns whether the merge is complete, the return value of the merge, and
952 a boolean indicating whether the file was deleted from disk."""
952 a boolean indicating whether the file was deleted from disk."""
953 ui = repo.ui
953 ui = repo.ui
954 fd = fcd.path()
954 fd = fcd.path()
955 uipathfn = scmutil.getuipathfn(repo)
955 uipathfn = scmutil.getuipathfn(repo)
956 fduipath = uipathfn(fd)
956 fduipath = uipathfn(fd)
957 binary = fcd.isbinary() or fco.isbinary() or fca.isbinary()
957 binary = fcd.isbinary() or fco.isbinary() or fca.isbinary()
958 symlink = b'l' in fcd.flags() + fco.flags()
958 symlink = b'l' in fcd.flags() + fco.flags()
959 changedelete = fcd.isabsent() or fco.isabsent()
959 changedelete = fcd.isabsent() or fco.isabsent()
960 tool, toolpath = _picktool(repo, ui, fd, binary, symlink, changedelete)
960 tool, toolpath = _picktool(repo, ui, fd, binary, symlink, changedelete)
961 scriptfn = None
961 scriptfn = None
962 if tool in internals and tool.startswith(b'internal:'):
962 if tool in internals and tool.startswith(b'internal:'):
963 # normalize to new-style names (':merge' etc)
963 # normalize to new-style names (':merge' etc)
964 tool = tool[len(b'internal') :]
964 tool = tool[len(b'internal') :]
965 if toolpath and toolpath.startswith(b'python:'):
965 if toolpath and toolpath.startswith(b'python:'):
966 invalidsyntax = False
966 invalidsyntax = False
967 if toolpath.count(b':') >= 2:
967 if toolpath.count(b':') >= 2:
968 script, scriptfn = toolpath[7:].rsplit(b':', 1)
968 script, scriptfn = toolpath[7:].rsplit(b':', 1)
969 if not scriptfn:
969 if not scriptfn:
970 invalidsyntax = True
970 invalidsyntax = True
971 # missing :callable can lead to spliting on windows drive letter
971 # missing :callable can lead to spliting on windows drive letter
972 if b'\\' in scriptfn or b'/' in scriptfn:
972 if b'\\' in scriptfn or b'/' in scriptfn:
973 invalidsyntax = True
973 invalidsyntax = True
974 else:
974 else:
975 invalidsyntax = True
975 invalidsyntax = True
976 if invalidsyntax:
976 if invalidsyntax:
977 raise error.Abort(_(b"invalid 'python:' syntax: %s") % toolpath)
977 raise error.Abort(_(b"invalid 'python:' syntax: %s") % toolpath)
978 toolpath = script
978 toolpath = script
979 ui.debug(
979 ui.debug(
980 b"picked tool '%s' for %s (binary %s symlink %s changedelete %s)\n"
980 b"picked tool '%s' for %s (binary %s symlink %s changedelete %s)\n"
981 % (
981 % (
982 tool,
982 tool,
983 fduipath,
983 fduipath,
984 pycompat.bytestr(binary),
984 pycompat.bytestr(binary),
985 pycompat.bytestr(symlink),
985 pycompat.bytestr(symlink),
986 pycompat.bytestr(changedelete),
986 pycompat.bytestr(changedelete),
987 )
987 )
988 )
988 )
989
989
990 if tool in internals:
990 if tool in internals:
991 func = internals[tool]
991 func = internals[tool]
992 mergetype = func.mergetype
992 mergetype = func.mergetype
993 onfailure = func.onfailure
993 onfailure = func.onfailure
994 precheck = func.precheck
994 precheck = func.precheck
995 isexternal = False
995 isexternal = False
996 else:
996 else:
997 if wctx.isinmemory():
997 if wctx.isinmemory():
998 func = _xmergeimm
998 func = _xmergeimm
999 else:
999 else:
1000 func = _xmerge
1000 func = _xmerge
1001 mergetype = fullmerge
1001 mergetype = fullmerge
1002 onfailure = _(b"merging %s failed!\n")
1002 onfailure = _(b"merging %s failed!\n")
1003 precheck = None
1003 precheck = None
1004 isexternal = True
1004 isexternal = True
1005
1005
1006 toolconf = tool, toolpath, binary, symlink, scriptfn
1006 toolconf = tool, toolpath, binary, symlink, scriptfn
1007
1007
1008 if not labels:
1008 if not labels:
1009 labels = [b'local', b'other']
1009 labels = [b'local', b'other']
1010 if len(labels) < 3:
1010 if len(labels) < 3:
1011 labels.append(b'base')
1011 labels.append(b'base')
1012 local = simplemerge.MergeInput(fcd, labels[0])
1012 local = simplemerge.MergeInput(fcd, labels[0])
1013 other = simplemerge.MergeInput(fco, labels[1])
1013 other = simplemerge.MergeInput(fco, labels[1])
1014 base = simplemerge.MergeInput(fca, labels[2])
1014 base = simplemerge.MergeInput(fca, labels[2])
1015 if mergetype == nomerge:
1015 if mergetype == nomerge:
1016 return func(
1016 return func(
1017 repo,
1017 repo,
1018 mynode,
1018 mynode,
1019 local,
1019 local,
1020 other,
1020 other,
1021 base,
1021 base,
1022 toolconf,
1022 toolconf,
1023 )
1023 )
1024
1024
1025 if orig != fco.path():
1025 if orig != fco.path():
1026 ui.status(
1026 ui.status(
1027 _(b"merging %s and %s to %s\n")
1027 _(b"merging %s and %s to %s\n")
1028 % (uipathfn(orig), uipathfn(fco.path()), fduipath)
1028 % (uipathfn(orig), uipathfn(fco.path()), fduipath)
1029 )
1029 )
1030 else:
1030 else:
1031 ui.status(_(b"merging %s\n") % fduipath)
1031 ui.status(_(b"merging %s\n") % fduipath)
1032
1032
1033 ui.debug(b"my %s other %s ancestor %s\n" % (fcd, fco, fca))
1033 ui.debug(b"my %s other %s ancestor %s\n" % (fcd, fco, fca))
1034
1034
1035 if precheck and not precheck(repo, mynode, fcd, fco, fca, toolconf):
1035 if precheck and not precheck(repo, mynode, fcd, fco, fca, toolconf):
1036 if onfailure:
1036 if onfailure:
1037 if wctx.isinmemory():
1037 if wctx.isinmemory():
1038 raise error.InMemoryMergeConflictsError(
1038 raise error.InMemoryMergeConflictsError(
1039 b'in-memory merge does not support merge conflicts'
1039 b'in-memory merge does not support merge conflicts'
1040 )
1040 )
1041 ui.warn(onfailure % fduipath)
1041 ui.warn(onfailure % fduipath)
1042 return 1, False
1042 return 1, False
1043
1043
1044 backup = _makebackup(repo, ui, fcd)
1044 backup = _makebackup(repo, ui, fcd)
1045 r = 1
1045 r = 1
1046 try:
1046 try:
1047 internalmarkerstyle = ui.config(b'ui', b'mergemarkers')
1047 internalmarkerstyle = ui.config(b'ui', b'mergemarkers')
1048 if isexternal:
1048 if isexternal:
1049 markerstyle = _toolstr(ui, tool, b'mergemarkers')
1049 markerstyle = _toolstr(ui, tool, b'mergemarkers')
1050 else:
1050 else:
1051 markerstyle = internalmarkerstyle
1051 markerstyle = internalmarkerstyle
1052
1052
1053 if mergetype == fullmerge:
1053 if mergetype == fullmerge:
1054 _run_partial_resolution_tools(repo, local, other, base)
1054 _run_partial_resolution_tools(repo, local, other, base)
1055 # conflict markers generated by premerge will use 'detailed'
1055 # conflict markers generated by premerge will use 'detailed'
1056 # settings if either ui.mergemarkers or the tool's mergemarkers
1056 # settings if either ui.mergemarkers or the tool's mergemarkers
1057 # setting is 'detailed'. This way tools can have basic labels in
1057 # setting is 'detailed'. This way tools can have basic labels in
1058 # space-constrained areas of the UI, but still get full information
1058 # space-constrained areas of the UI, but still get full information
1059 # in conflict markers if premerge is 'keep' or 'keep-merge3'.
1059 # in conflict markers if premerge is 'keep' or 'keep-merge3'.
1060 labeltool = None
1060 labeltool = None
1061 if markerstyle != b'basic':
1061 if markerstyle != b'basic':
1062 # respect 'tool's mergemarkertemplate (which defaults to
1062 # respect 'tool's mergemarkertemplate (which defaults to
1063 # command-templates.mergemarker)
1063 # command-templates.mergemarker)
1064 labeltool = tool
1064 labeltool = tool
1065 if internalmarkerstyle != b'basic' or markerstyle != b'basic':
1065 if internalmarkerstyle != b'basic' or markerstyle != b'basic':
1066 _populate_label_details(
1066 _populate_label_details(
1067 repo, [local, other, base], tool=labeltool
1067 repo, [local, other, base], tool=labeltool
1068 )
1068 )
1069
1069
1070 r = _premerge(
1070 r = _premerge(
1071 repo,
1071 repo,
1072 local,
1072 local,
1073 other,
1073 other,
1074 base,
1074 base,
1075 toolconf,
1075 toolconf,
1076 )
1076 )
1077 # we're done if premerge was successful (r is 0)
1077 # we're done if premerge was successful (r is 0)
1078 if not r:
1078 if not r:
1079 return r, False
1079 return r, False
1080
1080
1081 # Reset to basic labels
1081 # Reset to basic labels
1082 local.label_detail = None
1082 local.label_detail = None
1083 other.label_detail = None
1083 other.label_detail = None
1084 base.label_detail = None
1084 base.label_detail = None
1085
1085
1086 if markerstyle != b'basic':
1086 if markerstyle != b'basic':
1087 _populate_label_details(repo, [local, other, base], tool=tool)
1087 _populate_label_details(repo, [local, other, base], tool=tool)
1088
1088
1089 needcheck, r, deleted = func(
1089 needcheck, r, deleted = func(
1090 repo,
1090 repo,
1091 mynode,
1091 mynode,
1092 local,
1092 local,
1093 other,
1093 other,
1094 base,
1094 base,
1095 toolconf,
1095 toolconf,
1096 backup,
1096 backup,
1097 )
1097 )
1098
1098
1099 if needcheck:
1099 if needcheck:
1100 r = _check(repo, r, ui, tool, fcd, backup)
1100 r = _check(repo, r, ui, tool, fcd, backup)
1101
1101
1102 if r:
1102 if r:
1103 if onfailure:
1103 if onfailure:
1104 if wctx.isinmemory():
1104 if wctx.isinmemory():
1105 raise error.InMemoryMergeConflictsError(
1105 raise error.InMemoryMergeConflictsError(
1106 b'in-memory merge '
1106 b'in-memory merge '
1107 b'does not support '
1107 b'does not support '
1108 b'merge conflicts'
1108 b'merge conflicts'
1109 )
1109 )
1110 ui.warn(onfailure % fduipath)
1110 ui.warn(onfailure % fduipath)
1111 _onfilemergefailure(ui)
1111 _onfilemergefailure(ui)
1112
1112
1113 return r, deleted
1113 return r, deleted
1114 finally:
1114 finally:
1115 if not r and backup is not None:
1115 if not r and backup is not None:
1116 backup.remove()
1116 backup.remove()
1117
1117
1118
1118
1119 def _run_partial_resolution_tools(repo, local, other, base):
1119 def _run_partial_resolution_tools(repo, local, other, base):
1120 """Runs partial-resolution tools on the three inputs and updates them."""
1120 """Runs partial-resolution tools on the three inputs and updates them."""
1121 ui = repo.ui
1121 ui = repo.ui
1122 if ui.configbool(b'merge', b'disable-partial-tools'):
1122 if ui.configbool(b'merge', b'disable-partial-tools'):
1123 return
1123 return
1124 # Tuples of (order, name, executable path, args)
1124 # Tuples of (order, name, executable path, args)
1125 tools = []
1125 tools = []
1126 seen = set()
1126 seen = set()
1127 section = b"partial-merge-tools"
1127 section = b"partial-merge-tools"
1128 for k, v in ui.configitems(section):
1128 for k, v in ui.configitems(section):
1129 name = k.split(b'.')[0]
1129 name = k.split(b'.')[0]
1130 if name in seen:
1130 if name in seen:
1131 continue
1131 continue
1132 patterns = ui.configlist(section, b'%s.patterns' % name, [])
1132 patterns = ui.configlist(section, b'%s.patterns' % name, [])
1133 is_match = True
1133 is_match = True
1134 if patterns:
1134 if patterns:
1135 m = match.match(repo.root, b'', patterns)
1135 m = match.match(repo.root, b'', patterns)
1136 is_match = m(local.fctx.path())
1136 is_match = m(local.fctx.path())
1137 if is_match:
1137 if is_match:
1138 if ui.configbool(section, b'%s.disable' % name):
1138 if ui.configbool(section, b'%s.disable' % name):
1139 continue
1139 continue
1140 order = ui.configint(section, b'%s.order' % name, 0)
1140 order = ui.configint(section, b'%s.order' % name, 0)
1141 executable = ui.config(section, b'%s.executable' % name, name)
1141 executable = ui.config(section, b'%s.executable' % name, name)
1142 args = ui.config(section, b'%s.args' % name)
1142 args = ui.config(section, b'%s.args' % name)
1143 tools.append((order, name, executable, args))
1143 tools.append((order, name, executable, args))
1144
1144
1145 if not tools:
1145 if not tools:
1146 return
1146 return
1147 # Sort in configured order (first in tuple)
1147 # Sort in configured order (first in tuple)
1148 tools.sort()
1148 tools.sort()
1149
1149
1150 files = [
1150 files = [
1151 (b"local", local.fctx.path(), local.text()),
1151 (b"local", local.fctx.path(), local.text()),
1152 (b"base", base.fctx.path(), base.text()),
1152 (b"base", base.fctx.path(), base.text()),
1153 (b"other", other.fctx.path(), other.text()),
1153 (b"other", other.fctx.path(), other.text()),
1154 ]
1154 ]
1155
1155
1156 with _maketempfiles(files) as temppaths:
1156 with _maketempfiles(files) as temppaths:
1157 localpath, basepath, otherpath = temppaths
1157 localpath, basepath, otherpath = temppaths
1158
1158
1159 for order, name, executable, args in tools:
1159 for order, name, executable, args in tools:
1160 cmd = procutil.shellquote(executable)
1160 cmd = procutil.shellquote(executable)
1161 replace = {
1161 replace = {
1162 b'local': localpath,
1162 b'local': localpath,
1163 b'base': basepath,
1163 b'base': basepath,
1164 b'other': otherpath,
1164 b'other': otherpath,
1165 }
1165 }
1166 args = util.interpolate(
1166 args = util.interpolate(
1167 br'\$',
1167 br'\$',
1168 replace,
1168 replace,
1169 args,
1169 args,
1170 lambda s: procutil.shellquote(util.localpath(s)),
1170 lambda s: procutil.shellquote(util.localpath(s)),
1171 )
1171 )
1172
1172
1173 cmd = b'%s %s' % (cmd, args)
1173 cmd = b'%s %s' % (cmd, args)
1174 r = ui.system(cmd, cwd=repo.root, blockedtag=b'partial-mergetool')
1174 r = ui.system(cmd, cwd=repo.root, blockedtag=b'partial-mergetool')
1175 if r:
1175 if r:
1176 raise error.StateError(
1176 raise error.StateError(
1177 b'partial merge tool %s exited with code %d' % (name, r)
1177 b'partial merge tool %s exited with code %d' % (name, r)
1178 )
1178 )
1179 local_text = util.readfile(localpath)
1179 local_text = util.readfile(localpath)
1180 other_text = util.readfile(otherpath)
1180 other_text = util.readfile(otherpath)
1181 if local_text == other_text:
1181 if local_text == other_text:
1182 # No need to run other tools if all conflicts have been resolved
1182 # No need to run other tools if all conflicts have been resolved
1183 break
1183 break
1184
1184
1185 local.set_text(local_text)
1185 local.set_text(local_text)
1186 base.set_text(util.readfile(basepath))
1186 base.set_text(util.readfile(basepath))
1187 other.set_text(other_text)
1187 other.set_text(other_text)
1188
1188
1189
1189
1190 def _haltmerge():
1190 def _haltmerge():
1191 msg = _(b'merge halted after failed merge (see hg resolve)')
1191 msg = _(b'merge halted after failed merge (see hg resolve)')
1192 raise error.InterventionRequired(msg)
1192 raise error.InterventionRequired(msg)
1193
1193
1194
1194
1195 def _onfilemergefailure(ui):
1195 def _onfilemergefailure(ui):
1196 action = ui.config(b'merge', b'on-failure')
1196 action = ui.config(b'merge', b'on-failure')
1197 if action == b'prompt':
1197 if action == b'prompt':
1198 msg = _(b'continue merge operation (yn)?$$ &Yes $$ &No')
1198 msg = _(b'continue merge operation (yn)?$$ &Yes $$ &No')
1199 if ui.promptchoice(msg, 0) == 1:
1199 if ui.promptchoice(msg, 0) == 1:
1200 _haltmerge()
1200 _haltmerge()
1201 if action == b'halt':
1201 if action == b'halt':
1202 _haltmerge()
1202 _haltmerge()
1203 # default action is 'continue', in which case we neither prompt nor halt
1203 # default action is 'continue', in which case we neither prompt nor halt
1204
1204
1205
1205
1206 def hasconflictmarkers(data):
1206 def hasconflictmarkers(data):
1207 # Detect lines starting with a string of 7 identical characters from the
1207 # Detect lines starting with a string of 7 identical characters from the
1208 # subset Mercurial uses for conflict markers, followed by either the end of
1208 # subset Mercurial uses for conflict markers, followed by either the end of
1209 # line or a space and some text. Note that using [<>=+|-]{7} would detect
1209 # line or a space and some text. Note that using [<>=+|-]{7} would detect
1210 # `<><><><><` as a conflict marker, which we don't want.
1210 # `<><><><><` as a conflict marker, which we don't want.
1211 return bool(
1211 return bool(
1212 re.search(
1212 re.search(
1213 br"^([<>=+|-])\1{6}( .*)$",
1213 br"^([<>=+|-])\1{6}( .*)$",
1214 data,
1214 data,
1215 re.MULTILINE,
1215 re.MULTILINE,
1216 )
1216 )
1217 )
1217 )
1218
1218
1219
1219
1220 def _check(repo, r, ui, tool, fcd, backup):
1220 def _check(repo, r, ui, tool, fcd, backup):
1221 fd = fcd.path()
1221 fd = fcd.path()
1222 uipathfn = scmutil.getuipathfn(repo)
1222 uipathfn = scmutil.getuipathfn(repo)
1223
1223
1224 if not r and (
1224 if not r and (
1225 _toolbool(ui, tool, b"checkconflicts")
1225 _toolbool(ui, tool, b"checkconflicts")
1226 or b'conflicts' in _toollist(ui, tool, b"check")
1226 or b'conflicts' in _toollist(ui, tool, b"check")
1227 ):
1227 ):
1228 if hasconflictmarkers(fcd.data()):
1228 if hasconflictmarkers(fcd.data()):
1229 r = 1
1229 r = 1
1230
1230
1231 checked = False
1231 checked = False
1232 if b'prompt' in _toollist(ui, tool, b"check"):
1232 if b'prompt' in _toollist(ui, tool, b"check"):
1233 checked = True
1233 checked = True
1234 if ui.promptchoice(
1234 if ui.promptchoice(
1235 _(b"was merge of '%s' successful (yn)?$$ &Yes $$ &No")
1235 _(b"was merge of '%s' successful (yn)?$$ &Yes $$ &No")
1236 % uipathfn(fd),
1236 % uipathfn(fd),
1237 1,
1237 1,
1238 ):
1238 ):
1239 r = 1
1239 r = 1
1240
1240
1241 if (
1241 if (
1242 not r
1242 not r
1243 and not checked
1243 and not checked
1244 and (
1244 and (
1245 _toolbool(ui, tool, b"checkchanged")
1245 _toolbool(ui, tool, b"checkchanged")
1246 or b'changed' in _toollist(ui, tool, b"check")
1246 or b'changed' in _toollist(ui, tool, b"check")
1247 )
1247 )
1248 ):
1248 ):
1249 if backup is not None and not fcd.cmp(backup):
1249 if backup is not None and not fcd.cmp(backup):
1250 if ui.promptchoice(
1250 if ui.promptchoice(
1251 _(
1251 _(
1252 b" output file %s appears unchanged\n"
1252 b" output file %s appears unchanged\n"
1253 b"was merge successful (yn)?"
1253 b"was merge successful (yn)?"
1254 b"$$ &Yes $$ &No"
1254 b"$$ &Yes $$ &No"
1255 )
1255 )
1256 % uipathfn(fd),
1256 % uipathfn(fd),
1257 1,
1257 1,
1258 ):
1258 ):
1259 r = 1
1259 r = 1
1260
1260
1261 if backup is not None and _toolbool(ui, tool, b"fixeol"):
1261 if backup is not None and _toolbool(ui, tool, b"fixeol"):
1262 _matcheol(_workingpath(repo, fcd), backup)
1262 _matcheol(_workingpath(repo, fcd), backup)
1263
1263
1264 return r
1264 return r
1265
1265
1266
1266
1267 def _workingpath(repo, ctx):
1267 def _workingpath(repo, ctx):
1268 return repo.wjoin(ctx.path())
1268 return repo.wjoin(ctx.path())
1269
1269
1270
1270
1271 def loadinternalmerge(ui, extname, registrarobj):
1271 def loadinternalmerge(ui, extname, registrarobj):
1272 """Load internal merge tool from specified registrarobj"""
1272 """Load internal merge tool from specified registrarobj"""
1273 for name, func in registrarobj._table.items():
1273 for name, func in registrarobj._table.items():
1274 fullname = b':' + name
1274 fullname = b':' + name
1275 internals[fullname] = func
1275 internals[fullname] = func
1276 internals[b'internal:' + name] = func
1276 internals[b'internal:' + name] = func
1277 internalsdoc[fullname] = func
1277 internalsdoc[fullname] = func
1278
1278
1279 capabilities = sorted([k for k, v in func.capabilities.items() if v])
1279 capabilities = sorted([k for k, v in func.capabilities.items() if v])
1280 if capabilities:
1280 if capabilities:
1281 capdesc = b" (actual capabilities: %s)" % b', '.join(
1281 capdesc = b" (actual capabilities: %s)" % b', '.join(
1282 capabilities
1282 capabilities
1283 )
1283 )
1284 func.__doc__ = func.__doc__ + pycompat.sysstr(b"\n\n%s" % capdesc)
1284 func.__doc__ = func.__doc__ + pycompat.sysstr(b"\n\n%s" % capdesc)
1285
1285
1286 # to put i18n comments into hg.pot for automatically generated texts
1286 # to put i18n comments into hg.pot for automatically generated texts
1287
1287
1288 # i18n: "binary" and "symlink" are keywords
1288 # i18n: "binary" and "symlink" are keywords
1289 # i18n: this text is added automatically
1289 # i18n: this text is added automatically
1290 _(b" (actual capabilities: binary, symlink)")
1290 _(b" (actual capabilities: binary, symlink)")
1291 # i18n: "binary" is keyword
1291 # i18n: "binary" is keyword
1292 # i18n: this text is added automatically
1292 # i18n: this text is added automatically
1293 _(b" (actual capabilities: binary)")
1293 _(b" (actual capabilities: binary)")
1294 # i18n: "symlink" is keyword
1294 # i18n: "symlink" is keyword
1295 # i18n: this text is added automatically
1295 # i18n: this text is added automatically
1296 _(b" (actual capabilities: symlink)")
1296 _(b" (actual capabilities: symlink)")
1297
1297
1298
1298
1299 # load built-in merge tools explicitly to setup internalsdoc
1299 # load built-in merge tools explicitly to setup internalsdoc
1300 loadinternalmerge(None, None, internaltool)
1300 loadinternalmerge(None, None, internaltool)
1301
1301
1302 # tell hggettext to extract docstrings from these functions:
1302 # tell hggettext to extract docstrings from these functions:
1303 i18nfunctions = internals.values()
1303 i18nfunctions = internals.values()
General Comments 0
You need to be logged in to leave comments. Login now