##// END OF EJS Templates
repoview: add a 'devel.debug.repo-filter' option...
marmoute -
r44141:0ddd97e4 default draft
parent child Browse files
Show More
@@ -1,1543 +1,1546 b''
1 # configitems.py - centralized declaration of configuration option
1 # configitems.py - centralized declaration of configuration option
2 #
2 #
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import functools
10 import functools
11 import re
11 import re
12
12
13 from . import (
13 from . import (
14 encoding,
14 encoding,
15 error,
15 error,
16 )
16 )
17
17
18
18
19 def loadconfigtable(ui, extname, configtable):
19 def loadconfigtable(ui, extname, configtable):
20 """update config item known to the ui with the extension ones"""
20 """update config item known to the ui with the extension ones"""
21 for section, items in sorted(configtable.items()):
21 for section, items in sorted(configtable.items()):
22 knownitems = ui._knownconfig.setdefault(section, itemregister())
22 knownitems = ui._knownconfig.setdefault(section, itemregister())
23 knownkeys = set(knownitems)
23 knownkeys = set(knownitems)
24 newkeys = set(items)
24 newkeys = set(items)
25 for key in sorted(knownkeys & newkeys):
25 for key in sorted(knownkeys & newkeys):
26 msg = b"extension '%s' overwrite config item '%s.%s'"
26 msg = b"extension '%s' overwrite config item '%s.%s'"
27 msg %= (extname, section, key)
27 msg %= (extname, section, key)
28 ui.develwarn(msg, config=b'warn-config')
28 ui.develwarn(msg, config=b'warn-config')
29
29
30 knownitems.update(items)
30 knownitems.update(items)
31
31
32
32
33 class configitem(object):
33 class configitem(object):
34 """represent a known config item
34 """represent a known config item
35
35
36 :section: the official config section where to find this item,
36 :section: the official config section where to find this item,
37 :name: the official name within the section,
37 :name: the official name within the section,
38 :default: default value for this item,
38 :default: default value for this item,
39 :alias: optional list of tuples as alternatives,
39 :alias: optional list of tuples as alternatives,
40 :generic: this is a generic definition, match name using regular expression.
40 :generic: this is a generic definition, match name using regular expression.
41 """
41 """
42
42
43 def __init__(
43 def __init__(
44 self,
44 self,
45 section,
45 section,
46 name,
46 name,
47 default=None,
47 default=None,
48 alias=(),
48 alias=(),
49 generic=False,
49 generic=False,
50 priority=0,
50 priority=0,
51 experimental=False,
51 experimental=False,
52 ):
52 ):
53 self.section = section
53 self.section = section
54 self.name = name
54 self.name = name
55 self.default = default
55 self.default = default
56 self.alias = list(alias)
56 self.alias = list(alias)
57 self.generic = generic
57 self.generic = generic
58 self.priority = priority
58 self.priority = priority
59 self.experimental = experimental
59 self.experimental = experimental
60 self._re = None
60 self._re = None
61 if generic:
61 if generic:
62 self._re = re.compile(self.name)
62 self._re = re.compile(self.name)
63
63
64
64
65 class itemregister(dict):
65 class itemregister(dict):
66 """A specialized dictionary that can handle wild-card selection"""
66 """A specialized dictionary that can handle wild-card selection"""
67
67
68 def __init__(self):
68 def __init__(self):
69 super(itemregister, self).__init__()
69 super(itemregister, self).__init__()
70 self._generics = set()
70 self._generics = set()
71
71
72 def update(self, other):
72 def update(self, other):
73 super(itemregister, self).update(other)
73 super(itemregister, self).update(other)
74 self._generics.update(other._generics)
74 self._generics.update(other._generics)
75
75
76 def __setitem__(self, key, item):
76 def __setitem__(self, key, item):
77 super(itemregister, self).__setitem__(key, item)
77 super(itemregister, self).__setitem__(key, item)
78 if item.generic:
78 if item.generic:
79 self._generics.add(item)
79 self._generics.add(item)
80
80
81 def get(self, key):
81 def get(self, key):
82 baseitem = super(itemregister, self).get(key)
82 baseitem = super(itemregister, self).get(key)
83 if baseitem is not None and not baseitem.generic:
83 if baseitem is not None and not baseitem.generic:
84 return baseitem
84 return baseitem
85
85
86 # search for a matching generic item
86 # search for a matching generic item
87 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
87 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
88 for item in generics:
88 for item in generics:
89 # we use 'match' instead of 'search' to make the matching simpler
89 # we use 'match' instead of 'search' to make the matching simpler
90 # for people unfamiliar with regular expression. Having the match
90 # for people unfamiliar with regular expression. Having the match
91 # rooted to the start of the string will produce less surprising
91 # rooted to the start of the string will produce less surprising
92 # result for user writing simple regex for sub-attribute.
92 # result for user writing simple regex for sub-attribute.
93 #
93 #
94 # For example using "color\..*" match produces an unsurprising
94 # For example using "color\..*" match produces an unsurprising
95 # result, while using search could suddenly match apparently
95 # result, while using search could suddenly match apparently
96 # unrelated configuration that happens to contains "color."
96 # unrelated configuration that happens to contains "color."
97 # anywhere. This is a tradeoff where we favor requiring ".*" on
97 # anywhere. This is a tradeoff where we favor requiring ".*" on
98 # some match to avoid the need to prefix most pattern with "^".
98 # some match to avoid the need to prefix most pattern with "^".
99 # The "^" seems more error prone.
99 # The "^" seems more error prone.
100 if item._re.match(key):
100 if item._re.match(key):
101 return item
101 return item
102
102
103 return None
103 return None
104
104
105
105
106 coreitems = {}
106 coreitems = {}
107
107
108
108
109 def _register(configtable, *args, **kwargs):
109 def _register(configtable, *args, **kwargs):
110 item = configitem(*args, **kwargs)
110 item = configitem(*args, **kwargs)
111 section = configtable.setdefault(item.section, itemregister())
111 section = configtable.setdefault(item.section, itemregister())
112 if item.name in section:
112 if item.name in section:
113 msg = b"duplicated config item registration for '%s.%s'"
113 msg = b"duplicated config item registration for '%s.%s'"
114 raise error.ProgrammingError(msg % (item.section, item.name))
114 raise error.ProgrammingError(msg % (item.section, item.name))
115 section[item.name] = item
115 section[item.name] = item
116
116
117
117
118 # special value for case where the default is derived from other values
118 # special value for case where the default is derived from other values
119 dynamicdefault = object()
119 dynamicdefault = object()
120
120
121 # Registering actual config items
121 # Registering actual config items
122
122
123
123
124 def getitemregister(configtable):
124 def getitemregister(configtable):
125 f = functools.partial(_register, configtable)
125 f = functools.partial(_register, configtable)
126 # export pseudo enum as configitem.*
126 # export pseudo enum as configitem.*
127 f.dynamicdefault = dynamicdefault
127 f.dynamicdefault = dynamicdefault
128 return f
128 return f
129
129
130
130
131 coreconfigitem = getitemregister(coreitems)
131 coreconfigitem = getitemregister(coreitems)
132
132
133
133
134 def _registerdiffopts(section, configprefix=b''):
134 def _registerdiffopts(section, configprefix=b''):
135 coreconfigitem(
135 coreconfigitem(
136 section, configprefix + b'nodates', default=False,
136 section, configprefix + b'nodates', default=False,
137 )
137 )
138 coreconfigitem(
138 coreconfigitem(
139 section, configprefix + b'showfunc', default=False,
139 section, configprefix + b'showfunc', default=False,
140 )
140 )
141 coreconfigitem(
141 coreconfigitem(
142 section, configprefix + b'unified', default=None,
142 section, configprefix + b'unified', default=None,
143 )
143 )
144 coreconfigitem(
144 coreconfigitem(
145 section, configprefix + b'git', default=False,
145 section, configprefix + b'git', default=False,
146 )
146 )
147 coreconfigitem(
147 coreconfigitem(
148 section, configprefix + b'ignorews', default=False,
148 section, configprefix + b'ignorews', default=False,
149 )
149 )
150 coreconfigitem(
150 coreconfigitem(
151 section, configprefix + b'ignorewsamount', default=False,
151 section, configprefix + b'ignorewsamount', default=False,
152 )
152 )
153 coreconfigitem(
153 coreconfigitem(
154 section, configprefix + b'ignoreblanklines', default=False,
154 section, configprefix + b'ignoreblanklines', default=False,
155 )
155 )
156 coreconfigitem(
156 coreconfigitem(
157 section, configprefix + b'ignorewseol', default=False,
157 section, configprefix + b'ignorewseol', default=False,
158 )
158 )
159 coreconfigitem(
159 coreconfigitem(
160 section, configprefix + b'nobinary', default=False,
160 section, configprefix + b'nobinary', default=False,
161 )
161 )
162 coreconfigitem(
162 coreconfigitem(
163 section, configprefix + b'noprefix', default=False,
163 section, configprefix + b'noprefix', default=False,
164 )
164 )
165 coreconfigitem(
165 coreconfigitem(
166 section, configprefix + b'word-diff', default=False,
166 section, configprefix + b'word-diff', default=False,
167 )
167 )
168
168
169
169
170 coreconfigitem(
170 coreconfigitem(
171 b'alias', b'.*', default=dynamicdefault, generic=True,
171 b'alias', b'.*', default=dynamicdefault, generic=True,
172 )
172 )
173 coreconfigitem(
173 coreconfigitem(
174 b'auth', b'cookiefile', default=None,
174 b'auth', b'cookiefile', default=None,
175 )
175 )
176 _registerdiffopts(section=b'annotate')
176 _registerdiffopts(section=b'annotate')
177 # bookmarks.pushing: internal hack for discovery
177 # bookmarks.pushing: internal hack for discovery
178 coreconfigitem(
178 coreconfigitem(
179 b'bookmarks', b'pushing', default=list,
179 b'bookmarks', b'pushing', default=list,
180 )
180 )
181 # bundle.mainreporoot: internal hack for bundlerepo
181 # bundle.mainreporoot: internal hack for bundlerepo
182 coreconfigitem(
182 coreconfigitem(
183 b'bundle', b'mainreporoot', default=b'',
183 b'bundle', b'mainreporoot', default=b'',
184 )
184 )
185 coreconfigitem(
185 coreconfigitem(
186 b'censor', b'policy', default=b'abort', experimental=True,
186 b'censor', b'policy', default=b'abort', experimental=True,
187 )
187 )
188 coreconfigitem(
188 coreconfigitem(
189 b'chgserver', b'idletimeout', default=3600,
189 b'chgserver', b'idletimeout', default=3600,
190 )
190 )
191 coreconfigitem(
191 coreconfigitem(
192 b'chgserver', b'skiphash', default=False,
192 b'chgserver', b'skiphash', default=False,
193 )
193 )
194 coreconfigitem(
194 coreconfigitem(
195 b'cmdserver', b'log', default=None,
195 b'cmdserver', b'log', default=None,
196 )
196 )
197 coreconfigitem(
197 coreconfigitem(
198 b'cmdserver', b'max-log-files', default=7,
198 b'cmdserver', b'max-log-files', default=7,
199 )
199 )
200 coreconfigitem(
200 coreconfigitem(
201 b'cmdserver', b'max-log-size', default=b'1 MB',
201 b'cmdserver', b'max-log-size', default=b'1 MB',
202 )
202 )
203 coreconfigitem(
203 coreconfigitem(
204 b'cmdserver', b'max-repo-cache', default=0, experimental=True,
204 b'cmdserver', b'max-repo-cache', default=0, experimental=True,
205 )
205 )
206 coreconfigitem(
206 coreconfigitem(
207 b'cmdserver', b'message-encodings', default=list, experimental=True,
207 b'cmdserver', b'message-encodings', default=list, experimental=True,
208 )
208 )
209 coreconfigitem(
209 coreconfigitem(
210 b'cmdserver',
210 b'cmdserver',
211 b'track-log',
211 b'track-log',
212 default=lambda: [b'chgserver', b'cmdserver', b'repocache'],
212 default=lambda: [b'chgserver', b'cmdserver', b'repocache'],
213 )
213 )
214 coreconfigitem(
214 coreconfigitem(
215 b'color', b'.*', default=None, generic=True,
215 b'color', b'.*', default=None, generic=True,
216 )
216 )
217 coreconfigitem(
217 coreconfigitem(
218 b'color', b'mode', default=b'auto',
218 b'color', b'mode', default=b'auto',
219 )
219 )
220 coreconfigitem(
220 coreconfigitem(
221 b'color', b'pagermode', default=dynamicdefault,
221 b'color', b'pagermode', default=dynamicdefault,
222 )
222 )
223 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
223 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
224 coreconfigitem(
224 coreconfigitem(
225 b'commands', b'commit.post-status', default=False,
225 b'commands', b'commit.post-status', default=False,
226 )
226 )
227 coreconfigitem(
227 coreconfigitem(
228 b'commands', b'grep.all-files', default=False, experimental=True,
228 b'commands', b'grep.all-files', default=False, experimental=True,
229 )
229 )
230 coreconfigitem(
230 coreconfigitem(
231 b'commands', b'push.require-revs', default=False,
231 b'commands', b'push.require-revs', default=False,
232 )
232 )
233 coreconfigitem(
233 coreconfigitem(
234 b'commands', b'resolve.confirm', default=False,
234 b'commands', b'resolve.confirm', default=False,
235 )
235 )
236 coreconfigitem(
236 coreconfigitem(
237 b'commands', b'resolve.explicit-re-merge', default=False,
237 b'commands', b'resolve.explicit-re-merge', default=False,
238 )
238 )
239 coreconfigitem(
239 coreconfigitem(
240 b'commands', b'resolve.mark-check', default=b'none',
240 b'commands', b'resolve.mark-check', default=b'none',
241 )
241 )
242 _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.')
242 _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.')
243 coreconfigitem(
243 coreconfigitem(
244 b'commands', b'show.aliasprefix', default=list,
244 b'commands', b'show.aliasprefix', default=list,
245 )
245 )
246 coreconfigitem(
246 coreconfigitem(
247 b'commands', b'status.relative', default=False,
247 b'commands', b'status.relative', default=False,
248 )
248 )
249 coreconfigitem(
249 coreconfigitem(
250 b'commands', b'status.skipstates', default=[], experimental=True,
250 b'commands', b'status.skipstates', default=[], experimental=True,
251 )
251 )
252 coreconfigitem(
252 coreconfigitem(
253 b'commands', b'status.terse', default=b'',
253 b'commands', b'status.terse', default=b'',
254 )
254 )
255 coreconfigitem(
255 coreconfigitem(
256 b'commands', b'status.verbose', default=False,
256 b'commands', b'status.verbose', default=False,
257 )
257 )
258 coreconfigitem(
258 coreconfigitem(
259 b'commands', b'update.check', default=None,
259 b'commands', b'update.check', default=None,
260 )
260 )
261 coreconfigitem(
261 coreconfigitem(
262 b'commands', b'update.requiredest', default=False,
262 b'commands', b'update.requiredest', default=False,
263 )
263 )
264 coreconfigitem(
264 coreconfigitem(
265 b'committemplate', b'.*', default=None, generic=True,
265 b'committemplate', b'.*', default=None, generic=True,
266 )
266 )
267 coreconfigitem(
267 coreconfigitem(
268 b'convert', b'bzr.saverev', default=True,
268 b'convert', b'bzr.saverev', default=True,
269 )
269 )
270 coreconfigitem(
270 coreconfigitem(
271 b'convert', b'cvsps.cache', default=True,
271 b'convert', b'cvsps.cache', default=True,
272 )
272 )
273 coreconfigitem(
273 coreconfigitem(
274 b'convert', b'cvsps.fuzz', default=60,
274 b'convert', b'cvsps.fuzz', default=60,
275 )
275 )
276 coreconfigitem(
276 coreconfigitem(
277 b'convert', b'cvsps.logencoding', default=None,
277 b'convert', b'cvsps.logencoding', default=None,
278 )
278 )
279 coreconfigitem(
279 coreconfigitem(
280 b'convert', b'cvsps.mergefrom', default=None,
280 b'convert', b'cvsps.mergefrom', default=None,
281 )
281 )
282 coreconfigitem(
282 coreconfigitem(
283 b'convert', b'cvsps.mergeto', default=None,
283 b'convert', b'cvsps.mergeto', default=None,
284 )
284 )
285 coreconfigitem(
285 coreconfigitem(
286 b'convert', b'git.committeractions', default=lambda: [b'messagedifferent'],
286 b'convert', b'git.committeractions', default=lambda: [b'messagedifferent'],
287 )
287 )
288 coreconfigitem(
288 coreconfigitem(
289 b'convert', b'git.extrakeys', default=list,
289 b'convert', b'git.extrakeys', default=list,
290 )
290 )
291 coreconfigitem(
291 coreconfigitem(
292 b'convert', b'git.findcopiesharder', default=False,
292 b'convert', b'git.findcopiesharder', default=False,
293 )
293 )
294 coreconfigitem(
294 coreconfigitem(
295 b'convert', b'git.remoteprefix', default=b'remote',
295 b'convert', b'git.remoteprefix', default=b'remote',
296 )
296 )
297 coreconfigitem(
297 coreconfigitem(
298 b'convert', b'git.renamelimit', default=400,
298 b'convert', b'git.renamelimit', default=400,
299 )
299 )
300 coreconfigitem(
300 coreconfigitem(
301 b'convert', b'git.saverev', default=True,
301 b'convert', b'git.saverev', default=True,
302 )
302 )
303 coreconfigitem(
303 coreconfigitem(
304 b'convert', b'git.similarity', default=50,
304 b'convert', b'git.similarity', default=50,
305 )
305 )
306 coreconfigitem(
306 coreconfigitem(
307 b'convert', b'git.skipsubmodules', default=False,
307 b'convert', b'git.skipsubmodules', default=False,
308 )
308 )
309 coreconfigitem(
309 coreconfigitem(
310 b'convert', b'hg.clonebranches', default=False,
310 b'convert', b'hg.clonebranches', default=False,
311 )
311 )
312 coreconfigitem(
312 coreconfigitem(
313 b'convert', b'hg.ignoreerrors', default=False,
313 b'convert', b'hg.ignoreerrors', default=False,
314 )
314 )
315 coreconfigitem(
315 coreconfigitem(
316 b'convert', b'hg.preserve-hash', default=False,
316 b'convert', b'hg.preserve-hash', default=False,
317 )
317 )
318 coreconfigitem(
318 coreconfigitem(
319 b'convert', b'hg.revs', default=None,
319 b'convert', b'hg.revs', default=None,
320 )
320 )
321 coreconfigitem(
321 coreconfigitem(
322 b'convert', b'hg.saverev', default=False,
322 b'convert', b'hg.saverev', default=False,
323 )
323 )
324 coreconfigitem(
324 coreconfigitem(
325 b'convert', b'hg.sourcename', default=None,
325 b'convert', b'hg.sourcename', default=None,
326 )
326 )
327 coreconfigitem(
327 coreconfigitem(
328 b'convert', b'hg.startrev', default=None,
328 b'convert', b'hg.startrev', default=None,
329 )
329 )
330 coreconfigitem(
330 coreconfigitem(
331 b'convert', b'hg.tagsbranch', default=b'default',
331 b'convert', b'hg.tagsbranch', default=b'default',
332 )
332 )
333 coreconfigitem(
333 coreconfigitem(
334 b'convert', b'hg.usebranchnames', default=True,
334 b'convert', b'hg.usebranchnames', default=True,
335 )
335 )
336 coreconfigitem(
336 coreconfigitem(
337 b'convert', b'ignoreancestorcheck', default=False, experimental=True,
337 b'convert', b'ignoreancestorcheck', default=False, experimental=True,
338 )
338 )
339 coreconfigitem(
339 coreconfigitem(
340 b'convert', b'localtimezone', default=False,
340 b'convert', b'localtimezone', default=False,
341 )
341 )
342 coreconfigitem(
342 coreconfigitem(
343 b'convert', b'p4.encoding', default=dynamicdefault,
343 b'convert', b'p4.encoding', default=dynamicdefault,
344 )
344 )
345 coreconfigitem(
345 coreconfigitem(
346 b'convert', b'p4.startrev', default=0,
346 b'convert', b'p4.startrev', default=0,
347 )
347 )
348 coreconfigitem(
348 coreconfigitem(
349 b'convert', b'skiptags', default=False,
349 b'convert', b'skiptags', default=False,
350 )
350 )
351 coreconfigitem(
351 coreconfigitem(
352 b'convert', b'svn.debugsvnlog', default=True,
352 b'convert', b'svn.debugsvnlog', default=True,
353 )
353 )
354 coreconfigitem(
354 coreconfigitem(
355 b'convert', b'svn.trunk', default=None,
355 b'convert', b'svn.trunk', default=None,
356 )
356 )
357 coreconfigitem(
357 coreconfigitem(
358 b'convert', b'svn.tags', default=None,
358 b'convert', b'svn.tags', default=None,
359 )
359 )
360 coreconfigitem(
360 coreconfigitem(
361 b'convert', b'svn.branches', default=None,
361 b'convert', b'svn.branches', default=None,
362 )
362 )
363 coreconfigitem(
363 coreconfigitem(
364 b'convert', b'svn.startrev', default=0,
364 b'convert', b'svn.startrev', default=0,
365 )
365 )
366 coreconfigitem(
366 coreconfigitem(
367 b'debug', b'dirstate.delaywrite', default=0,
367 b'debug', b'dirstate.delaywrite', default=0,
368 )
368 )
369 coreconfigitem(
369 coreconfigitem(
370 b'defaults', b'.*', default=None, generic=True,
370 b'defaults', b'.*', default=None, generic=True,
371 )
371 )
372 coreconfigitem(
372 coreconfigitem(
373 b'devel', b'all-warnings', default=False,
373 b'devel', b'all-warnings', default=False,
374 )
374 )
375 coreconfigitem(
375 coreconfigitem(
376 b'devel', b'bundle2.debug', default=False,
376 b'devel', b'bundle2.debug', default=False,
377 )
377 )
378 coreconfigitem(
378 coreconfigitem(
379 b'devel', b'bundle.delta', default=b'',
379 b'devel', b'bundle.delta', default=b'',
380 )
380 )
381 coreconfigitem(
381 coreconfigitem(
382 b'devel', b'cache-vfs', default=None,
382 b'devel', b'cache-vfs', default=None,
383 )
383 )
384 coreconfigitem(
384 coreconfigitem(
385 b'devel', b'check-locks', default=False,
385 b'devel', b'check-locks', default=False,
386 )
386 )
387 coreconfigitem(
387 coreconfigitem(
388 b'devel', b'check-relroot', default=False,
388 b'devel', b'check-relroot', default=False,
389 )
389 )
390 coreconfigitem(
390 coreconfigitem(
391 b'devel', b'default-date', default=None,
391 b'devel', b'default-date', default=None,
392 )
392 )
393 coreconfigitem(
393 coreconfigitem(
394 b'devel', b'deprec-warn', default=False,
394 b'devel', b'deprec-warn', default=False,
395 )
395 )
396 coreconfigitem(
396 coreconfigitem(
397 b'devel', b'disableloaddefaultcerts', default=False,
397 b'devel', b'disableloaddefaultcerts', default=False,
398 )
398 )
399 coreconfigitem(
399 coreconfigitem(
400 b'devel', b'warn-empty-changegroup', default=False,
400 b'devel', b'warn-empty-changegroup', default=False,
401 )
401 )
402 coreconfigitem(
402 coreconfigitem(
403 b'devel', b'legacy.exchange', default=list,
403 b'devel', b'legacy.exchange', default=list,
404 )
404 )
405 coreconfigitem(
405 coreconfigitem(
406 b'devel', b'servercafile', default=b'',
406 b'devel', b'servercafile', default=b'',
407 )
407 )
408 coreconfigitem(
408 coreconfigitem(
409 b'devel', b'serverexactprotocol', default=b'',
409 b'devel', b'serverexactprotocol', default=b'',
410 )
410 )
411 coreconfigitem(
411 coreconfigitem(
412 b'devel', b'serverrequirecert', default=False,
412 b'devel', b'serverrequirecert', default=False,
413 )
413 )
414 coreconfigitem(
414 coreconfigitem(
415 b'devel', b'strip-obsmarkers', default=True,
415 b'devel', b'strip-obsmarkers', default=True,
416 )
416 )
417 coreconfigitem(
417 coreconfigitem(
418 b'devel', b'warn-config', default=None,
418 b'devel', b'warn-config', default=None,
419 )
419 )
420 coreconfigitem(
420 coreconfigitem(
421 b'devel', b'warn-config-default', default=None,
421 b'devel', b'warn-config-default', default=None,
422 )
422 )
423 coreconfigitem(
423 coreconfigitem(
424 b'devel', b'user.obsmarker', default=None,
424 b'devel', b'user.obsmarker', default=None,
425 )
425 )
426 coreconfigitem(
426 coreconfigitem(
427 b'devel', b'warn-config-unknown', default=None,
427 b'devel', b'warn-config-unknown', default=None,
428 )
428 )
429 coreconfigitem(
429 coreconfigitem(
430 b'devel', b'debug.copies', default=False,
430 b'devel', b'debug.copies', default=False,
431 )
431 )
432 coreconfigitem(
432 coreconfigitem(
433 b'devel', b'debug.extensions', default=False,
433 b'devel', b'debug.extensions', default=False,
434 )
434 )
435 coreconfigitem(
435 coreconfigitem(
436 b'devel', b'debug.repo-filters', default=False,
437 )
438 coreconfigitem(
436 b'devel', b'debug.peer-request', default=False,
439 b'devel', b'debug.peer-request', default=False,
437 )
440 )
438 coreconfigitem(
441 coreconfigitem(
439 b'devel', b'discovery.randomize', default=True,
442 b'devel', b'discovery.randomize', default=True,
440 )
443 )
441 _registerdiffopts(section=b'diff')
444 _registerdiffopts(section=b'diff')
442 coreconfigitem(
445 coreconfigitem(
443 b'email', b'bcc', default=None,
446 b'email', b'bcc', default=None,
444 )
447 )
445 coreconfigitem(
448 coreconfigitem(
446 b'email', b'cc', default=None,
449 b'email', b'cc', default=None,
447 )
450 )
448 coreconfigitem(
451 coreconfigitem(
449 b'email', b'charsets', default=list,
452 b'email', b'charsets', default=list,
450 )
453 )
451 coreconfigitem(
454 coreconfigitem(
452 b'email', b'from', default=None,
455 b'email', b'from', default=None,
453 )
456 )
454 coreconfigitem(
457 coreconfigitem(
455 b'email', b'method', default=b'smtp',
458 b'email', b'method', default=b'smtp',
456 )
459 )
457 coreconfigitem(
460 coreconfigitem(
458 b'email', b'reply-to', default=None,
461 b'email', b'reply-to', default=None,
459 )
462 )
460 coreconfigitem(
463 coreconfigitem(
461 b'email', b'to', default=None,
464 b'email', b'to', default=None,
462 )
465 )
463 coreconfigitem(
466 coreconfigitem(
464 b'experimental', b'archivemetatemplate', default=dynamicdefault,
467 b'experimental', b'archivemetatemplate', default=dynamicdefault,
465 )
468 )
466 coreconfigitem(
469 coreconfigitem(
467 b'experimental', b'auto-publish', default=b'publish',
470 b'experimental', b'auto-publish', default=b'publish',
468 )
471 )
469 coreconfigitem(
472 coreconfigitem(
470 b'experimental', b'bundle-phases', default=False,
473 b'experimental', b'bundle-phases', default=False,
471 )
474 )
472 coreconfigitem(
475 coreconfigitem(
473 b'experimental', b'bundle2-advertise', default=True,
476 b'experimental', b'bundle2-advertise', default=True,
474 )
477 )
475 coreconfigitem(
478 coreconfigitem(
476 b'experimental', b'bundle2-output-capture', default=False,
479 b'experimental', b'bundle2-output-capture', default=False,
477 )
480 )
478 coreconfigitem(
481 coreconfigitem(
479 b'experimental', b'bundle2.pushback', default=False,
482 b'experimental', b'bundle2.pushback', default=False,
480 )
483 )
481 coreconfigitem(
484 coreconfigitem(
482 b'experimental', b'bundle2lazylocking', default=False,
485 b'experimental', b'bundle2lazylocking', default=False,
483 )
486 )
484 coreconfigitem(
487 coreconfigitem(
485 b'experimental', b'bundlecomplevel', default=None,
488 b'experimental', b'bundlecomplevel', default=None,
486 )
489 )
487 coreconfigitem(
490 coreconfigitem(
488 b'experimental', b'bundlecomplevel.bzip2', default=None,
491 b'experimental', b'bundlecomplevel.bzip2', default=None,
489 )
492 )
490 coreconfigitem(
493 coreconfigitem(
491 b'experimental', b'bundlecomplevel.gzip', default=None,
494 b'experimental', b'bundlecomplevel.gzip', default=None,
492 )
495 )
493 coreconfigitem(
496 coreconfigitem(
494 b'experimental', b'bundlecomplevel.none', default=None,
497 b'experimental', b'bundlecomplevel.none', default=None,
495 )
498 )
496 coreconfigitem(
499 coreconfigitem(
497 b'experimental', b'bundlecomplevel.zstd', default=None,
500 b'experimental', b'bundlecomplevel.zstd', default=None,
498 )
501 )
499 coreconfigitem(
502 coreconfigitem(
500 b'experimental', b'changegroup3', default=False,
503 b'experimental', b'changegroup3', default=False,
501 )
504 )
502 coreconfigitem(
505 coreconfigitem(
503 b'experimental', b'cleanup-as-archived', default=False,
506 b'experimental', b'cleanup-as-archived', default=False,
504 )
507 )
505 coreconfigitem(
508 coreconfigitem(
506 b'experimental', b'clientcompressionengines', default=list,
509 b'experimental', b'clientcompressionengines', default=list,
507 )
510 )
508 coreconfigitem(
511 coreconfigitem(
509 b'experimental', b'copytrace', default=b'on',
512 b'experimental', b'copytrace', default=b'on',
510 )
513 )
511 coreconfigitem(
514 coreconfigitem(
512 b'experimental', b'copytrace.movecandidateslimit', default=100,
515 b'experimental', b'copytrace.movecandidateslimit', default=100,
513 )
516 )
514 coreconfigitem(
517 coreconfigitem(
515 b'experimental', b'copytrace.sourcecommitlimit', default=100,
518 b'experimental', b'copytrace.sourcecommitlimit', default=100,
516 )
519 )
517 coreconfigitem(
520 coreconfigitem(
518 b'experimental', b'copies.read-from', default=b"filelog-only",
521 b'experimental', b'copies.read-from', default=b"filelog-only",
519 )
522 )
520 coreconfigitem(
523 coreconfigitem(
521 b'experimental', b'copies.write-to', default=b'filelog-only',
524 b'experimental', b'copies.write-to', default=b'filelog-only',
522 )
525 )
523 coreconfigitem(
526 coreconfigitem(
524 b'experimental', b'crecordtest', default=None,
527 b'experimental', b'crecordtest', default=None,
525 )
528 )
526 coreconfigitem(
529 coreconfigitem(
527 b'experimental', b'directaccess', default=False,
530 b'experimental', b'directaccess', default=False,
528 )
531 )
529 coreconfigitem(
532 coreconfigitem(
530 b'experimental', b'directaccess.revnums', default=False,
533 b'experimental', b'directaccess.revnums', default=False,
531 )
534 )
532 coreconfigitem(
535 coreconfigitem(
533 b'experimental', b'editortmpinhg', default=False,
536 b'experimental', b'editortmpinhg', default=False,
534 )
537 )
535 coreconfigitem(
538 coreconfigitem(
536 b'experimental', b'evolution', default=list,
539 b'experimental', b'evolution', default=list,
537 )
540 )
538 coreconfigitem(
541 coreconfigitem(
539 b'experimental',
542 b'experimental',
540 b'evolution.allowdivergence',
543 b'evolution.allowdivergence',
541 default=False,
544 default=False,
542 alias=[(b'experimental', b'allowdivergence')],
545 alias=[(b'experimental', b'allowdivergence')],
543 )
546 )
544 coreconfigitem(
547 coreconfigitem(
545 b'experimental', b'evolution.allowunstable', default=None,
548 b'experimental', b'evolution.allowunstable', default=None,
546 )
549 )
547 coreconfigitem(
550 coreconfigitem(
548 b'experimental', b'evolution.createmarkers', default=None,
551 b'experimental', b'evolution.createmarkers', default=None,
549 )
552 )
550 coreconfigitem(
553 coreconfigitem(
551 b'experimental',
554 b'experimental',
552 b'evolution.effect-flags',
555 b'evolution.effect-flags',
553 default=True,
556 default=True,
554 alias=[(b'experimental', b'effect-flags')],
557 alias=[(b'experimental', b'effect-flags')],
555 )
558 )
556 coreconfigitem(
559 coreconfigitem(
557 b'experimental', b'evolution.exchange', default=None,
560 b'experimental', b'evolution.exchange', default=None,
558 )
561 )
559 coreconfigitem(
562 coreconfigitem(
560 b'experimental', b'evolution.bundle-obsmarker', default=False,
563 b'experimental', b'evolution.bundle-obsmarker', default=False,
561 )
564 )
562 coreconfigitem(
565 coreconfigitem(
563 b'experimental', b'log.topo', default=False,
566 b'experimental', b'log.topo', default=False,
564 )
567 )
565 coreconfigitem(
568 coreconfigitem(
566 b'experimental', b'evolution.report-instabilities', default=True,
569 b'experimental', b'evolution.report-instabilities', default=True,
567 )
570 )
568 coreconfigitem(
571 coreconfigitem(
569 b'experimental', b'evolution.track-operation', default=True,
572 b'experimental', b'evolution.track-operation', default=True,
570 )
573 )
571 # repo-level config to exclude a revset visibility
574 # repo-level config to exclude a revset visibility
572 #
575 #
573 # The target use case is to use `share` to expose different subset of the same
576 # The target use case is to use `share` to expose different subset of the same
574 # repository, especially server side. See also `server.view`.
577 # repository, especially server side. See also `server.view`.
575 coreconfigitem(
578 coreconfigitem(
576 b'experimental', b'extra-filter-revs', default=None,
579 b'experimental', b'extra-filter-revs', default=None,
577 )
580 )
578 coreconfigitem(
581 coreconfigitem(
579 b'experimental', b'maxdeltachainspan', default=-1,
582 b'experimental', b'maxdeltachainspan', default=-1,
580 )
583 )
581 coreconfigitem(
584 coreconfigitem(
582 b'experimental', b'mergetempdirprefix', default=None,
585 b'experimental', b'mergetempdirprefix', default=None,
583 )
586 )
584 coreconfigitem(
587 coreconfigitem(
585 b'experimental', b'mmapindexthreshold', default=None,
588 b'experimental', b'mmapindexthreshold', default=None,
586 )
589 )
587 coreconfigitem(
590 coreconfigitem(
588 b'experimental', b'narrow', default=False,
591 b'experimental', b'narrow', default=False,
589 )
592 )
590 coreconfigitem(
593 coreconfigitem(
591 b'experimental', b'nonnormalparanoidcheck', default=False,
594 b'experimental', b'nonnormalparanoidcheck', default=False,
592 )
595 )
593 coreconfigitem(
596 coreconfigitem(
594 b'experimental', b'exportableenviron', default=list,
597 b'experimental', b'exportableenviron', default=list,
595 )
598 )
596 coreconfigitem(
599 coreconfigitem(
597 b'experimental', b'extendedheader.index', default=None,
600 b'experimental', b'extendedheader.index', default=None,
598 )
601 )
599 coreconfigitem(
602 coreconfigitem(
600 b'experimental', b'extendedheader.similarity', default=False,
603 b'experimental', b'extendedheader.similarity', default=False,
601 )
604 )
602 coreconfigitem(
605 coreconfigitem(
603 b'experimental', b'graphshorten', default=False,
606 b'experimental', b'graphshorten', default=False,
604 )
607 )
605 coreconfigitem(
608 coreconfigitem(
606 b'experimental', b'graphstyle.parent', default=dynamicdefault,
609 b'experimental', b'graphstyle.parent', default=dynamicdefault,
607 )
610 )
608 coreconfigitem(
611 coreconfigitem(
609 b'experimental', b'graphstyle.missing', default=dynamicdefault,
612 b'experimental', b'graphstyle.missing', default=dynamicdefault,
610 )
613 )
611 coreconfigitem(
614 coreconfigitem(
612 b'experimental', b'graphstyle.grandparent', default=dynamicdefault,
615 b'experimental', b'graphstyle.grandparent', default=dynamicdefault,
613 )
616 )
614 coreconfigitem(
617 coreconfigitem(
615 b'experimental', b'hook-track-tags', default=False,
618 b'experimental', b'hook-track-tags', default=False,
616 )
619 )
617 coreconfigitem(
620 coreconfigitem(
618 b'experimental', b'httppeer.advertise-v2', default=False,
621 b'experimental', b'httppeer.advertise-v2', default=False,
619 )
622 )
620 coreconfigitem(
623 coreconfigitem(
621 b'experimental', b'httppeer.v2-encoder-order', default=None,
624 b'experimental', b'httppeer.v2-encoder-order', default=None,
622 )
625 )
623 coreconfigitem(
626 coreconfigitem(
624 b'experimental', b'httppostargs', default=False,
627 b'experimental', b'httppostargs', default=False,
625 )
628 )
626 coreconfigitem(
629 coreconfigitem(
627 b'experimental', b'mergedriver', default=None,
630 b'experimental', b'mergedriver', default=None,
628 )
631 )
629 coreconfigitem(b'experimental', b'nointerrupt', default=False)
632 coreconfigitem(b'experimental', b'nointerrupt', default=False)
630 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
633 coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True)
631
634
632 coreconfigitem(
635 coreconfigitem(
633 b'experimental', b'obsmarkers-exchange-debug', default=False,
636 b'experimental', b'obsmarkers-exchange-debug', default=False,
634 )
637 )
635 coreconfigitem(
638 coreconfigitem(
636 b'experimental', b'remotenames', default=False,
639 b'experimental', b'remotenames', default=False,
637 )
640 )
638 coreconfigitem(
641 coreconfigitem(
639 b'experimental', b'removeemptydirs', default=True,
642 b'experimental', b'removeemptydirs', default=True,
640 )
643 )
641 coreconfigitem(
644 coreconfigitem(
642 b'experimental', b'revert.interactive.select-to-keep', default=False,
645 b'experimental', b'revert.interactive.select-to-keep', default=False,
643 )
646 )
644 coreconfigitem(
647 coreconfigitem(
645 b'experimental', b'revisions.prefixhexnode', default=False,
648 b'experimental', b'revisions.prefixhexnode', default=False,
646 )
649 )
647 coreconfigitem(
650 coreconfigitem(
648 b'experimental', b'revlogv2', default=None,
651 b'experimental', b'revlogv2', default=None,
649 )
652 )
650 coreconfigitem(
653 coreconfigitem(
651 b'experimental', b'revisions.disambiguatewithin', default=None,
654 b'experimental', b'revisions.disambiguatewithin', default=None,
652 )
655 )
653 coreconfigitem(
656 coreconfigitem(
654 b'experimental', b'server.filesdata.recommended-batch-size', default=50000,
657 b'experimental', b'server.filesdata.recommended-batch-size', default=50000,
655 )
658 )
656 coreconfigitem(
659 coreconfigitem(
657 b'experimental',
660 b'experimental',
658 b'server.manifestdata.recommended-batch-size',
661 b'server.manifestdata.recommended-batch-size',
659 default=100000,
662 default=100000,
660 )
663 )
661 coreconfigitem(
664 coreconfigitem(
662 b'experimental', b'server.stream-narrow-clones', default=False,
665 b'experimental', b'server.stream-narrow-clones', default=False,
663 )
666 )
664 coreconfigitem(
667 coreconfigitem(
665 b'experimental', b'single-head-per-branch', default=False,
668 b'experimental', b'single-head-per-branch', default=False,
666 )
669 )
667 coreconfigitem(
670 coreconfigitem(
668 b'experimental',
671 b'experimental',
669 b'single-head-per-branch:account-closed-heads',
672 b'single-head-per-branch:account-closed-heads',
670 default=False,
673 default=False,
671 )
674 )
672 coreconfigitem(
675 coreconfigitem(
673 b'experimental', b'sshserver.support-v2', default=False,
676 b'experimental', b'sshserver.support-v2', default=False,
674 )
677 )
675 coreconfigitem(
678 coreconfigitem(
676 b'experimental', b'sparse-read', default=False,
679 b'experimental', b'sparse-read', default=False,
677 )
680 )
678 coreconfigitem(
681 coreconfigitem(
679 b'experimental', b'sparse-read.density-threshold', default=0.50,
682 b'experimental', b'sparse-read.density-threshold', default=0.50,
680 )
683 )
681 coreconfigitem(
684 coreconfigitem(
682 b'experimental', b'sparse-read.min-gap-size', default=b'65K',
685 b'experimental', b'sparse-read.min-gap-size', default=b'65K',
683 )
686 )
684 coreconfigitem(
687 coreconfigitem(
685 b'experimental', b'treemanifest', default=False,
688 b'experimental', b'treemanifest', default=False,
686 )
689 )
687 coreconfigitem(
690 coreconfigitem(
688 b'experimental', b'update.atomic-file', default=False,
691 b'experimental', b'update.atomic-file', default=False,
689 )
692 )
690 coreconfigitem(
693 coreconfigitem(
691 b'experimental', b'sshpeer.advertise-v2', default=False,
694 b'experimental', b'sshpeer.advertise-v2', default=False,
692 )
695 )
693 coreconfigitem(
696 coreconfigitem(
694 b'experimental', b'web.apiserver', default=False,
697 b'experimental', b'web.apiserver', default=False,
695 )
698 )
696 coreconfigitem(
699 coreconfigitem(
697 b'experimental', b'web.api.http-v2', default=False,
700 b'experimental', b'web.api.http-v2', default=False,
698 )
701 )
699 coreconfigitem(
702 coreconfigitem(
700 b'experimental', b'web.api.debugreflect', default=False,
703 b'experimental', b'web.api.debugreflect', default=False,
701 )
704 )
702 coreconfigitem(
705 coreconfigitem(
703 b'experimental', b'worker.wdir-get-thread-safe', default=False,
706 b'experimental', b'worker.wdir-get-thread-safe', default=False,
704 )
707 )
705 coreconfigitem(
708 coreconfigitem(
706 b'experimental', b'xdiff', default=False,
709 b'experimental', b'xdiff', default=False,
707 )
710 )
708 coreconfigitem(
711 coreconfigitem(
709 b'extensions', b'.*', default=None, generic=True,
712 b'extensions', b'.*', default=None, generic=True,
710 )
713 )
711 coreconfigitem(
714 coreconfigitem(
712 b'extdata', b'.*', default=None, generic=True,
715 b'extdata', b'.*', default=None, generic=True,
713 )
716 )
714 coreconfigitem(
717 coreconfigitem(
715 b'format', b'bookmarks-in-store', default=False,
718 b'format', b'bookmarks-in-store', default=False,
716 )
719 )
717 coreconfigitem(
720 coreconfigitem(
718 b'format', b'chunkcachesize', default=None, experimental=True,
721 b'format', b'chunkcachesize', default=None, experimental=True,
719 )
722 )
720 coreconfigitem(
723 coreconfigitem(
721 b'format', b'dotencode', default=True,
724 b'format', b'dotencode', default=True,
722 )
725 )
723 coreconfigitem(
726 coreconfigitem(
724 b'format', b'generaldelta', default=False, experimental=True,
727 b'format', b'generaldelta', default=False, experimental=True,
725 )
728 )
726 coreconfigitem(
729 coreconfigitem(
727 b'format', b'manifestcachesize', default=None, experimental=True,
730 b'format', b'manifestcachesize', default=None, experimental=True,
728 )
731 )
729 coreconfigitem(
732 coreconfigitem(
730 b'format', b'maxchainlen', default=dynamicdefault, experimental=True,
733 b'format', b'maxchainlen', default=dynamicdefault, experimental=True,
731 )
734 )
732 coreconfigitem(
735 coreconfigitem(
733 b'format', b'obsstore-version', default=None,
736 b'format', b'obsstore-version', default=None,
734 )
737 )
735 coreconfigitem(
738 coreconfigitem(
736 b'format', b'sparse-revlog', default=True,
739 b'format', b'sparse-revlog', default=True,
737 )
740 )
738 coreconfigitem(
741 coreconfigitem(
739 b'format',
742 b'format',
740 b'revlog-compression',
743 b'revlog-compression',
741 default=b'zlib',
744 default=b'zlib',
742 alias=[(b'experimental', b'format.compression')],
745 alias=[(b'experimental', b'format.compression')],
743 )
746 )
744 coreconfigitem(
747 coreconfigitem(
745 b'format', b'usefncache', default=True,
748 b'format', b'usefncache', default=True,
746 )
749 )
747 coreconfigitem(
750 coreconfigitem(
748 b'format', b'usegeneraldelta', default=True,
751 b'format', b'usegeneraldelta', default=True,
749 )
752 )
750 coreconfigitem(
753 coreconfigitem(
751 b'format', b'usestore', default=True,
754 b'format', b'usestore', default=True,
752 )
755 )
753 coreconfigitem(
756 coreconfigitem(
754 b'format',
757 b'format',
755 b'exp-use-copies-side-data-changeset',
758 b'exp-use-copies-side-data-changeset',
756 default=False,
759 default=False,
757 experimental=True,
760 experimental=True,
758 )
761 )
759 coreconfigitem(
762 coreconfigitem(
760 b'format', b'exp-use-side-data', default=False, experimental=True,
763 b'format', b'exp-use-side-data', default=False, experimental=True,
761 )
764 )
762 coreconfigitem(
765 coreconfigitem(
763 b'format', b'internal-phase', default=False, experimental=True,
766 b'format', b'internal-phase', default=False, experimental=True,
764 )
767 )
765 coreconfigitem(
768 coreconfigitem(
766 b'fsmonitor', b'warn_when_unused', default=True,
769 b'fsmonitor', b'warn_when_unused', default=True,
767 )
770 )
768 coreconfigitem(
771 coreconfigitem(
769 b'fsmonitor', b'warn_update_file_count', default=50000,
772 b'fsmonitor', b'warn_update_file_count', default=50000,
770 )
773 )
771 coreconfigitem(
774 coreconfigitem(
772 b'help', br'hidden-command\..*', default=False, generic=True,
775 b'help', br'hidden-command\..*', default=False, generic=True,
773 )
776 )
774 coreconfigitem(
777 coreconfigitem(
775 b'help', br'hidden-topic\..*', default=False, generic=True,
778 b'help', br'hidden-topic\..*', default=False, generic=True,
776 )
779 )
777 coreconfigitem(
780 coreconfigitem(
778 b'hooks', b'.*', default=dynamicdefault, generic=True,
781 b'hooks', b'.*', default=dynamicdefault, generic=True,
779 )
782 )
780 coreconfigitem(
783 coreconfigitem(
781 b'hgweb-paths', b'.*', default=list, generic=True,
784 b'hgweb-paths', b'.*', default=list, generic=True,
782 )
785 )
783 coreconfigitem(
786 coreconfigitem(
784 b'hostfingerprints', b'.*', default=list, generic=True,
787 b'hostfingerprints', b'.*', default=list, generic=True,
785 )
788 )
786 coreconfigitem(
789 coreconfigitem(
787 b'hostsecurity', b'ciphers', default=None,
790 b'hostsecurity', b'ciphers', default=None,
788 )
791 )
789 coreconfigitem(
792 coreconfigitem(
790 b'hostsecurity', b'disabletls10warning', default=False,
793 b'hostsecurity', b'disabletls10warning', default=False,
791 )
794 )
792 coreconfigitem(
795 coreconfigitem(
793 b'hostsecurity', b'minimumprotocol', default=dynamicdefault,
796 b'hostsecurity', b'minimumprotocol', default=dynamicdefault,
794 )
797 )
795 coreconfigitem(
798 coreconfigitem(
796 b'hostsecurity',
799 b'hostsecurity',
797 b'.*:minimumprotocol$',
800 b'.*:minimumprotocol$',
798 default=dynamicdefault,
801 default=dynamicdefault,
799 generic=True,
802 generic=True,
800 )
803 )
801 coreconfigitem(
804 coreconfigitem(
802 b'hostsecurity', b'.*:ciphers$', default=dynamicdefault, generic=True,
805 b'hostsecurity', b'.*:ciphers$', default=dynamicdefault, generic=True,
803 )
806 )
804 coreconfigitem(
807 coreconfigitem(
805 b'hostsecurity', b'.*:fingerprints$', default=list, generic=True,
808 b'hostsecurity', b'.*:fingerprints$', default=list, generic=True,
806 )
809 )
807 coreconfigitem(
810 coreconfigitem(
808 b'hostsecurity', b'.*:verifycertsfile$', default=None, generic=True,
811 b'hostsecurity', b'.*:verifycertsfile$', default=None, generic=True,
809 )
812 )
810
813
811 coreconfigitem(
814 coreconfigitem(
812 b'http_proxy', b'always', default=False,
815 b'http_proxy', b'always', default=False,
813 )
816 )
814 coreconfigitem(
817 coreconfigitem(
815 b'http_proxy', b'host', default=None,
818 b'http_proxy', b'host', default=None,
816 )
819 )
817 coreconfigitem(
820 coreconfigitem(
818 b'http_proxy', b'no', default=list,
821 b'http_proxy', b'no', default=list,
819 )
822 )
820 coreconfigitem(
823 coreconfigitem(
821 b'http_proxy', b'passwd', default=None,
824 b'http_proxy', b'passwd', default=None,
822 )
825 )
823 coreconfigitem(
826 coreconfigitem(
824 b'http_proxy', b'user', default=None,
827 b'http_proxy', b'user', default=None,
825 )
828 )
826
829
827 coreconfigitem(
830 coreconfigitem(
828 b'http', b'timeout', default=None,
831 b'http', b'timeout', default=None,
829 )
832 )
830
833
831 coreconfigitem(
834 coreconfigitem(
832 b'logtoprocess', b'commandexception', default=None,
835 b'logtoprocess', b'commandexception', default=None,
833 )
836 )
834 coreconfigitem(
837 coreconfigitem(
835 b'logtoprocess', b'commandfinish', default=None,
838 b'logtoprocess', b'commandfinish', default=None,
836 )
839 )
837 coreconfigitem(
840 coreconfigitem(
838 b'logtoprocess', b'command', default=None,
841 b'logtoprocess', b'command', default=None,
839 )
842 )
840 coreconfigitem(
843 coreconfigitem(
841 b'logtoprocess', b'develwarn', default=None,
844 b'logtoprocess', b'develwarn', default=None,
842 )
845 )
843 coreconfigitem(
846 coreconfigitem(
844 b'logtoprocess', b'uiblocked', default=None,
847 b'logtoprocess', b'uiblocked', default=None,
845 )
848 )
846 coreconfigitem(
849 coreconfigitem(
847 b'merge', b'checkunknown', default=b'abort',
850 b'merge', b'checkunknown', default=b'abort',
848 )
851 )
849 coreconfigitem(
852 coreconfigitem(
850 b'merge', b'checkignored', default=b'abort',
853 b'merge', b'checkignored', default=b'abort',
851 )
854 )
852 coreconfigitem(
855 coreconfigitem(
853 b'experimental', b'merge.checkpathconflicts', default=False,
856 b'experimental', b'merge.checkpathconflicts', default=False,
854 )
857 )
855 coreconfigitem(
858 coreconfigitem(
856 b'merge', b'followcopies', default=True,
859 b'merge', b'followcopies', default=True,
857 )
860 )
858 coreconfigitem(
861 coreconfigitem(
859 b'merge', b'on-failure', default=b'continue',
862 b'merge', b'on-failure', default=b'continue',
860 )
863 )
861 coreconfigitem(
864 coreconfigitem(
862 b'merge', b'preferancestor', default=lambda: [b'*'], experimental=True,
865 b'merge', b'preferancestor', default=lambda: [b'*'], experimental=True,
863 )
866 )
864 coreconfigitem(
867 coreconfigitem(
865 b'merge', b'strict-capability-check', default=False,
868 b'merge', b'strict-capability-check', default=False,
866 )
869 )
867 coreconfigitem(
870 coreconfigitem(
868 b'merge-tools', b'.*', default=None, generic=True,
871 b'merge-tools', b'.*', default=None, generic=True,
869 )
872 )
870 coreconfigitem(
873 coreconfigitem(
871 b'merge-tools',
874 b'merge-tools',
872 br'.*\.args$',
875 br'.*\.args$',
873 default=b"$local $base $other",
876 default=b"$local $base $other",
874 generic=True,
877 generic=True,
875 priority=-1,
878 priority=-1,
876 )
879 )
877 coreconfigitem(
880 coreconfigitem(
878 b'merge-tools', br'.*\.binary$', default=False, generic=True, priority=-1,
881 b'merge-tools', br'.*\.binary$', default=False, generic=True, priority=-1,
879 )
882 )
880 coreconfigitem(
883 coreconfigitem(
881 b'merge-tools', br'.*\.check$', default=list, generic=True, priority=-1,
884 b'merge-tools', br'.*\.check$', default=list, generic=True, priority=-1,
882 )
885 )
883 coreconfigitem(
886 coreconfigitem(
884 b'merge-tools',
887 b'merge-tools',
885 br'.*\.checkchanged$',
888 br'.*\.checkchanged$',
886 default=False,
889 default=False,
887 generic=True,
890 generic=True,
888 priority=-1,
891 priority=-1,
889 )
892 )
890 coreconfigitem(
893 coreconfigitem(
891 b'merge-tools',
894 b'merge-tools',
892 br'.*\.executable$',
895 br'.*\.executable$',
893 default=dynamicdefault,
896 default=dynamicdefault,
894 generic=True,
897 generic=True,
895 priority=-1,
898 priority=-1,
896 )
899 )
897 coreconfigitem(
900 coreconfigitem(
898 b'merge-tools', br'.*\.fixeol$', default=False, generic=True, priority=-1,
901 b'merge-tools', br'.*\.fixeol$', default=False, generic=True, priority=-1,
899 )
902 )
900 coreconfigitem(
903 coreconfigitem(
901 b'merge-tools', br'.*\.gui$', default=False, generic=True, priority=-1,
904 b'merge-tools', br'.*\.gui$', default=False, generic=True, priority=-1,
902 )
905 )
903 coreconfigitem(
906 coreconfigitem(
904 b'merge-tools',
907 b'merge-tools',
905 br'.*\.mergemarkers$',
908 br'.*\.mergemarkers$',
906 default=b'basic',
909 default=b'basic',
907 generic=True,
910 generic=True,
908 priority=-1,
911 priority=-1,
909 )
912 )
910 coreconfigitem(
913 coreconfigitem(
911 b'merge-tools',
914 b'merge-tools',
912 br'.*\.mergemarkertemplate$',
915 br'.*\.mergemarkertemplate$',
913 default=dynamicdefault, # take from ui.mergemarkertemplate
916 default=dynamicdefault, # take from ui.mergemarkertemplate
914 generic=True,
917 generic=True,
915 priority=-1,
918 priority=-1,
916 )
919 )
917 coreconfigitem(
920 coreconfigitem(
918 b'merge-tools', br'.*\.priority$', default=0, generic=True, priority=-1,
921 b'merge-tools', br'.*\.priority$', default=0, generic=True, priority=-1,
919 )
922 )
920 coreconfigitem(
923 coreconfigitem(
921 b'merge-tools',
924 b'merge-tools',
922 br'.*\.premerge$',
925 br'.*\.premerge$',
923 default=dynamicdefault,
926 default=dynamicdefault,
924 generic=True,
927 generic=True,
925 priority=-1,
928 priority=-1,
926 )
929 )
927 coreconfigitem(
930 coreconfigitem(
928 b'merge-tools', br'.*\.symlink$', default=False, generic=True, priority=-1,
931 b'merge-tools', br'.*\.symlink$', default=False, generic=True, priority=-1,
929 )
932 )
930 coreconfigitem(
933 coreconfigitem(
931 b'pager', b'attend-.*', default=dynamicdefault, generic=True,
934 b'pager', b'attend-.*', default=dynamicdefault, generic=True,
932 )
935 )
933 coreconfigitem(
936 coreconfigitem(
934 b'pager', b'ignore', default=list,
937 b'pager', b'ignore', default=list,
935 )
938 )
936 coreconfigitem(
939 coreconfigitem(
937 b'pager', b'pager', default=dynamicdefault,
940 b'pager', b'pager', default=dynamicdefault,
938 )
941 )
939 coreconfigitem(
942 coreconfigitem(
940 b'patch', b'eol', default=b'strict',
943 b'patch', b'eol', default=b'strict',
941 )
944 )
942 coreconfigitem(
945 coreconfigitem(
943 b'patch', b'fuzz', default=2,
946 b'patch', b'fuzz', default=2,
944 )
947 )
945 coreconfigitem(
948 coreconfigitem(
946 b'paths', b'default', default=None,
949 b'paths', b'default', default=None,
947 )
950 )
948 coreconfigitem(
951 coreconfigitem(
949 b'paths', b'default-push', default=None,
952 b'paths', b'default-push', default=None,
950 )
953 )
951 coreconfigitem(
954 coreconfigitem(
952 b'paths', b'.*', default=None, generic=True,
955 b'paths', b'.*', default=None, generic=True,
953 )
956 )
954 coreconfigitem(
957 coreconfigitem(
955 b'phases', b'checksubrepos', default=b'follow',
958 b'phases', b'checksubrepos', default=b'follow',
956 )
959 )
957 coreconfigitem(
960 coreconfigitem(
958 b'phases', b'new-commit', default=b'draft',
961 b'phases', b'new-commit', default=b'draft',
959 )
962 )
960 coreconfigitem(
963 coreconfigitem(
961 b'phases', b'publish', default=True,
964 b'phases', b'publish', default=True,
962 )
965 )
963 coreconfigitem(
966 coreconfigitem(
964 b'profiling', b'enabled', default=False,
967 b'profiling', b'enabled', default=False,
965 )
968 )
966 coreconfigitem(
969 coreconfigitem(
967 b'profiling', b'format', default=b'text',
970 b'profiling', b'format', default=b'text',
968 )
971 )
969 coreconfigitem(
972 coreconfigitem(
970 b'profiling', b'freq', default=1000,
973 b'profiling', b'freq', default=1000,
971 )
974 )
972 coreconfigitem(
975 coreconfigitem(
973 b'profiling', b'limit', default=30,
976 b'profiling', b'limit', default=30,
974 )
977 )
975 coreconfigitem(
978 coreconfigitem(
976 b'profiling', b'nested', default=0,
979 b'profiling', b'nested', default=0,
977 )
980 )
978 coreconfigitem(
981 coreconfigitem(
979 b'profiling', b'output', default=None,
982 b'profiling', b'output', default=None,
980 )
983 )
981 coreconfigitem(
984 coreconfigitem(
982 b'profiling', b'showmax', default=0.999,
985 b'profiling', b'showmax', default=0.999,
983 )
986 )
984 coreconfigitem(
987 coreconfigitem(
985 b'profiling', b'showmin', default=dynamicdefault,
988 b'profiling', b'showmin', default=dynamicdefault,
986 )
989 )
987 coreconfigitem(
990 coreconfigitem(
988 b'profiling', b'showtime', default=True,
991 b'profiling', b'showtime', default=True,
989 )
992 )
990 coreconfigitem(
993 coreconfigitem(
991 b'profiling', b'sort', default=b'inlinetime',
994 b'profiling', b'sort', default=b'inlinetime',
992 )
995 )
993 coreconfigitem(
996 coreconfigitem(
994 b'profiling', b'statformat', default=b'hotpath',
997 b'profiling', b'statformat', default=b'hotpath',
995 )
998 )
996 coreconfigitem(
999 coreconfigitem(
997 b'profiling', b'time-track', default=dynamicdefault,
1000 b'profiling', b'time-track', default=dynamicdefault,
998 )
1001 )
999 coreconfigitem(
1002 coreconfigitem(
1000 b'profiling', b'type', default=b'stat',
1003 b'profiling', b'type', default=b'stat',
1001 )
1004 )
1002 coreconfigitem(
1005 coreconfigitem(
1003 b'progress', b'assume-tty', default=False,
1006 b'progress', b'assume-tty', default=False,
1004 )
1007 )
1005 coreconfigitem(
1008 coreconfigitem(
1006 b'progress', b'changedelay', default=1,
1009 b'progress', b'changedelay', default=1,
1007 )
1010 )
1008 coreconfigitem(
1011 coreconfigitem(
1009 b'progress', b'clear-complete', default=True,
1012 b'progress', b'clear-complete', default=True,
1010 )
1013 )
1011 coreconfigitem(
1014 coreconfigitem(
1012 b'progress', b'debug', default=False,
1015 b'progress', b'debug', default=False,
1013 )
1016 )
1014 coreconfigitem(
1017 coreconfigitem(
1015 b'progress', b'delay', default=3,
1018 b'progress', b'delay', default=3,
1016 )
1019 )
1017 coreconfigitem(
1020 coreconfigitem(
1018 b'progress', b'disable', default=False,
1021 b'progress', b'disable', default=False,
1019 )
1022 )
1020 coreconfigitem(
1023 coreconfigitem(
1021 b'progress', b'estimateinterval', default=60.0,
1024 b'progress', b'estimateinterval', default=60.0,
1022 )
1025 )
1023 coreconfigitem(
1026 coreconfigitem(
1024 b'progress',
1027 b'progress',
1025 b'format',
1028 b'format',
1026 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1029 default=lambda: [b'topic', b'bar', b'number', b'estimate'],
1027 )
1030 )
1028 coreconfigitem(
1031 coreconfigitem(
1029 b'progress', b'refresh', default=0.1,
1032 b'progress', b'refresh', default=0.1,
1030 )
1033 )
1031 coreconfigitem(
1034 coreconfigitem(
1032 b'progress', b'width', default=dynamicdefault,
1035 b'progress', b'width', default=dynamicdefault,
1033 )
1036 )
1034 coreconfigitem(
1037 coreconfigitem(
1035 b'push', b'pushvars.server', default=False,
1038 b'push', b'pushvars.server', default=False,
1036 )
1039 )
1037 coreconfigitem(
1040 coreconfigitem(
1038 b'rewrite',
1041 b'rewrite',
1039 b'backup-bundle',
1042 b'backup-bundle',
1040 default=True,
1043 default=True,
1041 alias=[(b'ui', b'history-editing-backup')],
1044 alias=[(b'ui', b'history-editing-backup')],
1042 )
1045 )
1043 coreconfigitem(
1046 coreconfigitem(
1044 b'rewrite', b'update-timestamp', default=False,
1047 b'rewrite', b'update-timestamp', default=False,
1045 )
1048 )
1046 coreconfigitem(
1049 coreconfigitem(
1047 b'storage', b'new-repo-backend', default=b'revlogv1', experimental=True,
1050 b'storage', b'new-repo-backend', default=b'revlogv1', experimental=True,
1048 )
1051 )
1049 coreconfigitem(
1052 coreconfigitem(
1050 b'storage',
1053 b'storage',
1051 b'revlog.optimize-delta-parent-choice',
1054 b'revlog.optimize-delta-parent-choice',
1052 default=True,
1055 default=True,
1053 alias=[(b'format', b'aggressivemergedeltas')],
1056 alias=[(b'format', b'aggressivemergedeltas')],
1054 )
1057 )
1055 coreconfigitem(
1058 coreconfigitem(
1056 b'storage', b'revlog.reuse-external-delta', default=True,
1059 b'storage', b'revlog.reuse-external-delta', default=True,
1057 )
1060 )
1058 coreconfigitem(
1061 coreconfigitem(
1059 b'storage', b'revlog.reuse-external-delta-parent', default=None,
1062 b'storage', b'revlog.reuse-external-delta-parent', default=None,
1060 )
1063 )
1061 coreconfigitem(
1064 coreconfigitem(
1062 b'storage', b'revlog.zlib.level', default=None,
1065 b'storage', b'revlog.zlib.level', default=None,
1063 )
1066 )
1064 coreconfigitem(
1067 coreconfigitem(
1065 b'storage', b'revlog.zstd.level', default=None,
1068 b'storage', b'revlog.zstd.level', default=None,
1066 )
1069 )
1067 coreconfigitem(
1070 coreconfigitem(
1068 b'server', b'bookmarks-pushkey-compat', default=True,
1071 b'server', b'bookmarks-pushkey-compat', default=True,
1069 )
1072 )
1070 coreconfigitem(
1073 coreconfigitem(
1071 b'server', b'bundle1', default=True,
1074 b'server', b'bundle1', default=True,
1072 )
1075 )
1073 coreconfigitem(
1076 coreconfigitem(
1074 b'server', b'bundle1gd', default=None,
1077 b'server', b'bundle1gd', default=None,
1075 )
1078 )
1076 coreconfigitem(
1079 coreconfigitem(
1077 b'server', b'bundle1.pull', default=None,
1080 b'server', b'bundle1.pull', default=None,
1078 )
1081 )
1079 coreconfigitem(
1082 coreconfigitem(
1080 b'server', b'bundle1gd.pull', default=None,
1083 b'server', b'bundle1gd.pull', default=None,
1081 )
1084 )
1082 coreconfigitem(
1085 coreconfigitem(
1083 b'server', b'bundle1.push', default=None,
1086 b'server', b'bundle1.push', default=None,
1084 )
1087 )
1085 coreconfigitem(
1088 coreconfigitem(
1086 b'server', b'bundle1gd.push', default=None,
1089 b'server', b'bundle1gd.push', default=None,
1087 )
1090 )
1088 coreconfigitem(
1091 coreconfigitem(
1089 b'server',
1092 b'server',
1090 b'bundle2.stream',
1093 b'bundle2.stream',
1091 default=True,
1094 default=True,
1092 alias=[(b'experimental', b'bundle2.stream')],
1095 alias=[(b'experimental', b'bundle2.stream')],
1093 )
1096 )
1094 coreconfigitem(
1097 coreconfigitem(
1095 b'server', b'compressionengines', default=list,
1098 b'server', b'compressionengines', default=list,
1096 )
1099 )
1097 coreconfigitem(
1100 coreconfigitem(
1098 b'server', b'concurrent-push-mode', default=b'strict',
1101 b'server', b'concurrent-push-mode', default=b'strict',
1099 )
1102 )
1100 coreconfigitem(
1103 coreconfigitem(
1101 b'server', b'disablefullbundle', default=False,
1104 b'server', b'disablefullbundle', default=False,
1102 )
1105 )
1103 coreconfigitem(
1106 coreconfigitem(
1104 b'server', b'maxhttpheaderlen', default=1024,
1107 b'server', b'maxhttpheaderlen', default=1024,
1105 )
1108 )
1106 coreconfigitem(
1109 coreconfigitem(
1107 b'server', b'pullbundle', default=False,
1110 b'server', b'pullbundle', default=False,
1108 )
1111 )
1109 coreconfigitem(
1112 coreconfigitem(
1110 b'server', b'preferuncompressed', default=False,
1113 b'server', b'preferuncompressed', default=False,
1111 )
1114 )
1112 coreconfigitem(
1115 coreconfigitem(
1113 b'server', b'streamunbundle', default=False,
1116 b'server', b'streamunbundle', default=False,
1114 )
1117 )
1115 coreconfigitem(
1118 coreconfigitem(
1116 b'server', b'uncompressed', default=True,
1119 b'server', b'uncompressed', default=True,
1117 )
1120 )
1118 coreconfigitem(
1121 coreconfigitem(
1119 b'server', b'uncompressedallowsecret', default=False,
1122 b'server', b'uncompressedallowsecret', default=False,
1120 )
1123 )
1121 coreconfigitem(
1124 coreconfigitem(
1122 b'server', b'view', default=b'served',
1125 b'server', b'view', default=b'served',
1123 )
1126 )
1124 coreconfigitem(
1127 coreconfigitem(
1125 b'server', b'validate', default=False,
1128 b'server', b'validate', default=False,
1126 )
1129 )
1127 coreconfigitem(
1130 coreconfigitem(
1128 b'server', b'zliblevel', default=-1,
1131 b'server', b'zliblevel', default=-1,
1129 )
1132 )
1130 coreconfigitem(
1133 coreconfigitem(
1131 b'server', b'zstdlevel', default=3,
1134 b'server', b'zstdlevel', default=3,
1132 )
1135 )
1133 coreconfigitem(
1136 coreconfigitem(
1134 b'share', b'pool', default=None,
1137 b'share', b'pool', default=None,
1135 )
1138 )
1136 coreconfigitem(
1139 coreconfigitem(
1137 b'share', b'poolnaming', default=b'identity',
1140 b'share', b'poolnaming', default=b'identity',
1138 )
1141 )
1139 coreconfigitem(
1142 coreconfigitem(
1140 b'shelve', b'maxbackups', default=10,
1143 b'shelve', b'maxbackups', default=10,
1141 )
1144 )
1142 coreconfigitem(
1145 coreconfigitem(
1143 b'smtp', b'host', default=None,
1146 b'smtp', b'host', default=None,
1144 )
1147 )
1145 coreconfigitem(
1148 coreconfigitem(
1146 b'smtp', b'local_hostname', default=None,
1149 b'smtp', b'local_hostname', default=None,
1147 )
1150 )
1148 coreconfigitem(
1151 coreconfigitem(
1149 b'smtp', b'password', default=None,
1152 b'smtp', b'password', default=None,
1150 )
1153 )
1151 coreconfigitem(
1154 coreconfigitem(
1152 b'smtp', b'port', default=dynamicdefault,
1155 b'smtp', b'port', default=dynamicdefault,
1153 )
1156 )
1154 coreconfigitem(
1157 coreconfigitem(
1155 b'smtp', b'tls', default=b'none',
1158 b'smtp', b'tls', default=b'none',
1156 )
1159 )
1157 coreconfigitem(
1160 coreconfigitem(
1158 b'smtp', b'username', default=None,
1161 b'smtp', b'username', default=None,
1159 )
1162 )
1160 coreconfigitem(
1163 coreconfigitem(
1161 b'sparse', b'missingwarning', default=True, experimental=True,
1164 b'sparse', b'missingwarning', default=True, experimental=True,
1162 )
1165 )
1163 coreconfigitem(
1166 coreconfigitem(
1164 b'subrepos',
1167 b'subrepos',
1165 b'allowed',
1168 b'allowed',
1166 default=dynamicdefault, # to make backporting simpler
1169 default=dynamicdefault, # to make backporting simpler
1167 )
1170 )
1168 coreconfigitem(
1171 coreconfigitem(
1169 b'subrepos', b'hg:allowed', default=dynamicdefault,
1172 b'subrepos', b'hg:allowed', default=dynamicdefault,
1170 )
1173 )
1171 coreconfigitem(
1174 coreconfigitem(
1172 b'subrepos', b'git:allowed', default=dynamicdefault,
1175 b'subrepos', b'git:allowed', default=dynamicdefault,
1173 )
1176 )
1174 coreconfigitem(
1177 coreconfigitem(
1175 b'subrepos', b'svn:allowed', default=dynamicdefault,
1178 b'subrepos', b'svn:allowed', default=dynamicdefault,
1176 )
1179 )
1177 coreconfigitem(
1180 coreconfigitem(
1178 b'templates', b'.*', default=None, generic=True,
1181 b'templates', b'.*', default=None, generic=True,
1179 )
1182 )
1180 coreconfigitem(
1183 coreconfigitem(
1181 b'templateconfig', b'.*', default=dynamicdefault, generic=True,
1184 b'templateconfig', b'.*', default=dynamicdefault, generic=True,
1182 )
1185 )
1183 coreconfigitem(
1186 coreconfigitem(
1184 b'trusted', b'groups', default=list,
1187 b'trusted', b'groups', default=list,
1185 )
1188 )
1186 coreconfigitem(
1189 coreconfigitem(
1187 b'trusted', b'users', default=list,
1190 b'trusted', b'users', default=list,
1188 )
1191 )
1189 coreconfigitem(
1192 coreconfigitem(
1190 b'ui', b'_usedassubrepo', default=False,
1193 b'ui', b'_usedassubrepo', default=False,
1191 )
1194 )
1192 coreconfigitem(
1195 coreconfigitem(
1193 b'ui', b'allowemptycommit', default=False,
1196 b'ui', b'allowemptycommit', default=False,
1194 )
1197 )
1195 coreconfigitem(
1198 coreconfigitem(
1196 b'ui', b'archivemeta', default=True,
1199 b'ui', b'archivemeta', default=True,
1197 )
1200 )
1198 coreconfigitem(
1201 coreconfigitem(
1199 b'ui', b'askusername', default=False,
1202 b'ui', b'askusername', default=False,
1200 )
1203 )
1201 coreconfigitem(
1204 coreconfigitem(
1202 b'ui', b'clonebundlefallback', default=False,
1205 b'ui', b'clonebundlefallback', default=False,
1203 )
1206 )
1204 coreconfigitem(
1207 coreconfigitem(
1205 b'ui', b'clonebundleprefers', default=list,
1208 b'ui', b'clonebundleprefers', default=list,
1206 )
1209 )
1207 coreconfigitem(
1210 coreconfigitem(
1208 b'ui', b'clonebundles', default=True,
1211 b'ui', b'clonebundles', default=True,
1209 )
1212 )
1210 coreconfigitem(
1213 coreconfigitem(
1211 b'ui', b'color', default=b'auto',
1214 b'ui', b'color', default=b'auto',
1212 )
1215 )
1213 coreconfigitem(
1216 coreconfigitem(
1214 b'ui', b'commitsubrepos', default=False,
1217 b'ui', b'commitsubrepos', default=False,
1215 )
1218 )
1216 coreconfigitem(
1219 coreconfigitem(
1217 b'ui', b'debug', default=False,
1220 b'ui', b'debug', default=False,
1218 )
1221 )
1219 coreconfigitem(
1222 coreconfigitem(
1220 b'ui', b'debugger', default=None,
1223 b'ui', b'debugger', default=None,
1221 )
1224 )
1222 coreconfigitem(
1225 coreconfigitem(
1223 b'ui', b'editor', default=dynamicdefault,
1226 b'ui', b'editor', default=dynamicdefault,
1224 )
1227 )
1225 coreconfigitem(
1228 coreconfigitem(
1226 b'ui', b'fallbackencoding', default=None,
1229 b'ui', b'fallbackencoding', default=None,
1227 )
1230 )
1228 coreconfigitem(
1231 coreconfigitem(
1229 b'ui', b'forcecwd', default=None,
1232 b'ui', b'forcecwd', default=None,
1230 )
1233 )
1231 coreconfigitem(
1234 coreconfigitem(
1232 b'ui', b'forcemerge', default=None,
1235 b'ui', b'forcemerge', default=None,
1233 )
1236 )
1234 coreconfigitem(
1237 coreconfigitem(
1235 b'ui', b'formatdebug', default=False,
1238 b'ui', b'formatdebug', default=False,
1236 )
1239 )
1237 coreconfigitem(
1240 coreconfigitem(
1238 b'ui', b'formatjson', default=False,
1241 b'ui', b'formatjson', default=False,
1239 )
1242 )
1240 coreconfigitem(
1243 coreconfigitem(
1241 b'ui', b'formatted', default=None,
1244 b'ui', b'formatted', default=None,
1242 )
1245 )
1243 coreconfigitem(
1246 coreconfigitem(
1244 b'ui', b'graphnodetemplate', default=None,
1247 b'ui', b'graphnodetemplate', default=None,
1245 )
1248 )
1246 coreconfigitem(
1249 coreconfigitem(
1247 b'ui', b'interactive', default=None,
1250 b'ui', b'interactive', default=None,
1248 )
1251 )
1249 coreconfigitem(
1252 coreconfigitem(
1250 b'ui', b'interface', default=None,
1253 b'ui', b'interface', default=None,
1251 )
1254 )
1252 coreconfigitem(
1255 coreconfigitem(
1253 b'ui', b'interface.chunkselector', default=None,
1256 b'ui', b'interface.chunkselector', default=None,
1254 )
1257 )
1255 coreconfigitem(
1258 coreconfigitem(
1256 b'ui', b'large-file-limit', default=10000000,
1259 b'ui', b'large-file-limit', default=10000000,
1257 )
1260 )
1258 coreconfigitem(
1261 coreconfigitem(
1259 b'ui', b'logblockedtimes', default=False,
1262 b'ui', b'logblockedtimes', default=False,
1260 )
1263 )
1261 coreconfigitem(
1264 coreconfigitem(
1262 b'ui', b'logtemplate', default=None,
1265 b'ui', b'logtemplate', default=None,
1263 )
1266 )
1264 coreconfigitem(
1267 coreconfigitem(
1265 b'ui', b'merge', default=None,
1268 b'ui', b'merge', default=None,
1266 )
1269 )
1267 coreconfigitem(
1270 coreconfigitem(
1268 b'ui', b'mergemarkers', default=b'basic',
1271 b'ui', b'mergemarkers', default=b'basic',
1269 )
1272 )
1270 coreconfigitem(
1273 coreconfigitem(
1271 b'ui',
1274 b'ui',
1272 b'mergemarkertemplate',
1275 b'mergemarkertemplate',
1273 default=(
1276 default=(
1274 b'{node|short} '
1277 b'{node|short} '
1275 b'{ifeq(tags, "tip", "", '
1278 b'{ifeq(tags, "tip", "", '
1276 b'ifeq(tags, "", "", "{tags} "))}'
1279 b'ifeq(tags, "", "", "{tags} "))}'
1277 b'{if(bookmarks, "{bookmarks} ")}'
1280 b'{if(bookmarks, "{bookmarks} ")}'
1278 b'{ifeq(branch, "default", "", "{branch} ")}'
1281 b'{ifeq(branch, "default", "", "{branch} ")}'
1279 b'- {author|user}: {desc|firstline}'
1282 b'- {author|user}: {desc|firstline}'
1280 ),
1283 ),
1281 )
1284 )
1282 coreconfigitem(
1285 coreconfigitem(
1283 b'ui', b'message-output', default=b'stdio',
1286 b'ui', b'message-output', default=b'stdio',
1284 )
1287 )
1285 coreconfigitem(
1288 coreconfigitem(
1286 b'ui', b'nontty', default=False,
1289 b'ui', b'nontty', default=False,
1287 )
1290 )
1288 coreconfigitem(
1291 coreconfigitem(
1289 b'ui', b'origbackuppath', default=None,
1292 b'ui', b'origbackuppath', default=None,
1290 )
1293 )
1291 coreconfigitem(
1294 coreconfigitem(
1292 b'ui', b'paginate', default=True,
1295 b'ui', b'paginate', default=True,
1293 )
1296 )
1294 coreconfigitem(
1297 coreconfigitem(
1295 b'ui', b'patch', default=None,
1298 b'ui', b'patch', default=None,
1296 )
1299 )
1297 coreconfigitem(
1300 coreconfigitem(
1298 b'ui', b'pre-merge-tool-output-template', default=None,
1301 b'ui', b'pre-merge-tool-output-template', default=None,
1299 )
1302 )
1300 coreconfigitem(
1303 coreconfigitem(
1301 b'ui', b'portablefilenames', default=b'warn',
1304 b'ui', b'portablefilenames', default=b'warn',
1302 )
1305 )
1303 coreconfigitem(
1306 coreconfigitem(
1304 b'ui', b'promptecho', default=False,
1307 b'ui', b'promptecho', default=False,
1305 )
1308 )
1306 coreconfigitem(
1309 coreconfigitem(
1307 b'ui', b'quiet', default=False,
1310 b'ui', b'quiet', default=False,
1308 )
1311 )
1309 coreconfigitem(
1312 coreconfigitem(
1310 b'ui', b'quietbookmarkmove', default=False,
1313 b'ui', b'quietbookmarkmove', default=False,
1311 )
1314 )
1312 coreconfigitem(
1315 coreconfigitem(
1313 b'ui', b'relative-paths', default=b'legacy',
1316 b'ui', b'relative-paths', default=b'legacy',
1314 )
1317 )
1315 coreconfigitem(
1318 coreconfigitem(
1316 b'ui', b'remotecmd', default=b'hg',
1319 b'ui', b'remotecmd', default=b'hg',
1317 )
1320 )
1318 coreconfigitem(
1321 coreconfigitem(
1319 b'ui', b'report_untrusted', default=True,
1322 b'ui', b'report_untrusted', default=True,
1320 )
1323 )
1321 coreconfigitem(
1324 coreconfigitem(
1322 b'ui', b'rollback', default=True,
1325 b'ui', b'rollback', default=True,
1323 )
1326 )
1324 coreconfigitem(
1327 coreconfigitem(
1325 b'ui', b'signal-safe-lock', default=True,
1328 b'ui', b'signal-safe-lock', default=True,
1326 )
1329 )
1327 coreconfigitem(
1330 coreconfigitem(
1328 b'ui', b'slash', default=False,
1331 b'ui', b'slash', default=False,
1329 )
1332 )
1330 coreconfigitem(
1333 coreconfigitem(
1331 b'ui', b'ssh', default=b'ssh',
1334 b'ui', b'ssh', default=b'ssh',
1332 )
1335 )
1333 coreconfigitem(
1336 coreconfigitem(
1334 b'ui', b'ssherrorhint', default=None,
1337 b'ui', b'ssherrorhint', default=None,
1335 )
1338 )
1336 coreconfigitem(
1339 coreconfigitem(
1337 b'ui', b'statuscopies', default=False,
1340 b'ui', b'statuscopies', default=False,
1338 )
1341 )
1339 coreconfigitem(
1342 coreconfigitem(
1340 b'ui', b'strict', default=False,
1343 b'ui', b'strict', default=False,
1341 )
1344 )
1342 coreconfigitem(
1345 coreconfigitem(
1343 b'ui', b'style', default=b'',
1346 b'ui', b'style', default=b'',
1344 )
1347 )
1345 coreconfigitem(
1348 coreconfigitem(
1346 b'ui', b'supportcontact', default=None,
1349 b'ui', b'supportcontact', default=None,
1347 )
1350 )
1348 coreconfigitem(
1351 coreconfigitem(
1349 b'ui', b'textwidth', default=78,
1352 b'ui', b'textwidth', default=78,
1350 )
1353 )
1351 coreconfigitem(
1354 coreconfigitem(
1352 b'ui', b'timeout', default=b'600',
1355 b'ui', b'timeout', default=b'600',
1353 )
1356 )
1354 coreconfigitem(
1357 coreconfigitem(
1355 b'ui', b'timeout.warn', default=0,
1358 b'ui', b'timeout.warn', default=0,
1356 )
1359 )
1357 coreconfigitem(
1360 coreconfigitem(
1358 b'ui', b'traceback', default=False,
1361 b'ui', b'traceback', default=False,
1359 )
1362 )
1360 coreconfigitem(
1363 coreconfigitem(
1361 b'ui', b'tweakdefaults', default=False,
1364 b'ui', b'tweakdefaults', default=False,
1362 )
1365 )
1363 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
1366 coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')])
1364 coreconfigitem(
1367 coreconfigitem(
1365 b'ui', b'verbose', default=False,
1368 b'ui', b'verbose', default=False,
1366 )
1369 )
1367 coreconfigitem(
1370 coreconfigitem(
1368 b'verify', b'skipflags', default=None,
1371 b'verify', b'skipflags', default=None,
1369 )
1372 )
1370 coreconfigitem(
1373 coreconfigitem(
1371 b'web', b'allowbz2', default=False,
1374 b'web', b'allowbz2', default=False,
1372 )
1375 )
1373 coreconfigitem(
1376 coreconfigitem(
1374 b'web', b'allowgz', default=False,
1377 b'web', b'allowgz', default=False,
1375 )
1378 )
1376 coreconfigitem(
1379 coreconfigitem(
1377 b'web', b'allow-pull', alias=[(b'web', b'allowpull')], default=True,
1380 b'web', b'allow-pull', alias=[(b'web', b'allowpull')], default=True,
1378 )
1381 )
1379 coreconfigitem(
1382 coreconfigitem(
1380 b'web', b'allow-push', alias=[(b'web', b'allow_push')], default=list,
1383 b'web', b'allow-push', alias=[(b'web', b'allow_push')], default=list,
1381 )
1384 )
1382 coreconfigitem(
1385 coreconfigitem(
1383 b'web', b'allowzip', default=False,
1386 b'web', b'allowzip', default=False,
1384 )
1387 )
1385 coreconfigitem(
1388 coreconfigitem(
1386 b'web', b'archivesubrepos', default=False,
1389 b'web', b'archivesubrepos', default=False,
1387 )
1390 )
1388 coreconfigitem(
1391 coreconfigitem(
1389 b'web', b'cache', default=True,
1392 b'web', b'cache', default=True,
1390 )
1393 )
1391 coreconfigitem(
1394 coreconfigitem(
1392 b'web', b'comparisoncontext', default=5,
1395 b'web', b'comparisoncontext', default=5,
1393 )
1396 )
1394 coreconfigitem(
1397 coreconfigitem(
1395 b'web', b'contact', default=None,
1398 b'web', b'contact', default=None,
1396 )
1399 )
1397 coreconfigitem(
1400 coreconfigitem(
1398 b'web', b'deny_push', default=list,
1401 b'web', b'deny_push', default=list,
1399 )
1402 )
1400 coreconfigitem(
1403 coreconfigitem(
1401 b'web', b'guessmime', default=False,
1404 b'web', b'guessmime', default=False,
1402 )
1405 )
1403 coreconfigitem(
1406 coreconfigitem(
1404 b'web', b'hidden', default=False,
1407 b'web', b'hidden', default=False,
1405 )
1408 )
1406 coreconfigitem(
1409 coreconfigitem(
1407 b'web', b'labels', default=list,
1410 b'web', b'labels', default=list,
1408 )
1411 )
1409 coreconfigitem(
1412 coreconfigitem(
1410 b'web', b'logoimg', default=b'hglogo.png',
1413 b'web', b'logoimg', default=b'hglogo.png',
1411 )
1414 )
1412 coreconfigitem(
1415 coreconfigitem(
1413 b'web', b'logourl', default=b'https://mercurial-scm.org/',
1416 b'web', b'logourl', default=b'https://mercurial-scm.org/',
1414 )
1417 )
1415 coreconfigitem(
1418 coreconfigitem(
1416 b'web', b'accesslog', default=b'-',
1419 b'web', b'accesslog', default=b'-',
1417 )
1420 )
1418 coreconfigitem(
1421 coreconfigitem(
1419 b'web', b'address', default=b'',
1422 b'web', b'address', default=b'',
1420 )
1423 )
1421 coreconfigitem(
1424 coreconfigitem(
1422 b'web', b'allow-archive', alias=[(b'web', b'allow_archive')], default=list,
1425 b'web', b'allow-archive', alias=[(b'web', b'allow_archive')], default=list,
1423 )
1426 )
1424 coreconfigitem(
1427 coreconfigitem(
1425 b'web', b'allow_read', default=list,
1428 b'web', b'allow_read', default=list,
1426 )
1429 )
1427 coreconfigitem(
1430 coreconfigitem(
1428 b'web', b'baseurl', default=None,
1431 b'web', b'baseurl', default=None,
1429 )
1432 )
1430 coreconfigitem(
1433 coreconfigitem(
1431 b'web', b'cacerts', default=None,
1434 b'web', b'cacerts', default=None,
1432 )
1435 )
1433 coreconfigitem(
1436 coreconfigitem(
1434 b'web', b'certificate', default=None,
1437 b'web', b'certificate', default=None,
1435 )
1438 )
1436 coreconfigitem(
1439 coreconfigitem(
1437 b'web', b'collapse', default=False,
1440 b'web', b'collapse', default=False,
1438 )
1441 )
1439 coreconfigitem(
1442 coreconfigitem(
1440 b'web', b'csp', default=None,
1443 b'web', b'csp', default=None,
1441 )
1444 )
1442 coreconfigitem(
1445 coreconfigitem(
1443 b'web', b'deny_read', default=list,
1446 b'web', b'deny_read', default=list,
1444 )
1447 )
1445 coreconfigitem(
1448 coreconfigitem(
1446 b'web', b'descend', default=True,
1449 b'web', b'descend', default=True,
1447 )
1450 )
1448 coreconfigitem(
1451 coreconfigitem(
1449 b'web', b'description', default=b"",
1452 b'web', b'description', default=b"",
1450 )
1453 )
1451 coreconfigitem(
1454 coreconfigitem(
1452 b'web', b'encoding', default=lambda: encoding.encoding,
1455 b'web', b'encoding', default=lambda: encoding.encoding,
1453 )
1456 )
1454 coreconfigitem(
1457 coreconfigitem(
1455 b'web', b'errorlog', default=b'-',
1458 b'web', b'errorlog', default=b'-',
1456 )
1459 )
1457 coreconfigitem(
1460 coreconfigitem(
1458 b'web', b'ipv6', default=False,
1461 b'web', b'ipv6', default=False,
1459 )
1462 )
1460 coreconfigitem(
1463 coreconfigitem(
1461 b'web', b'maxchanges', default=10,
1464 b'web', b'maxchanges', default=10,
1462 )
1465 )
1463 coreconfigitem(
1466 coreconfigitem(
1464 b'web', b'maxfiles', default=10,
1467 b'web', b'maxfiles', default=10,
1465 )
1468 )
1466 coreconfigitem(
1469 coreconfigitem(
1467 b'web', b'maxshortchanges', default=60,
1470 b'web', b'maxshortchanges', default=60,
1468 )
1471 )
1469 coreconfigitem(
1472 coreconfigitem(
1470 b'web', b'motd', default=b'',
1473 b'web', b'motd', default=b'',
1471 )
1474 )
1472 coreconfigitem(
1475 coreconfigitem(
1473 b'web', b'name', default=dynamicdefault,
1476 b'web', b'name', default=dynamicdefault,
1474 )
1477 )
1475 coreconfigitem(
1478 coreconfigitem(
1476 b'web', b'port', default=8000,
1479 b'web', b'port', default=8000,
1477 )
1480 )
1478 coreconfigitem(
1481 coreconfigitem(
1479 b'web', b'prefix', default=b'',
1482 b'web', b'prefix', default=b'',
1480 )
1483 )
1481 coreconfigitem(
1484 coreconfigitem(
1482 b'web', b'push_ssl', default=True,
1485 b'web', b'push_ssl', default=True,
1483 )
1486 )
1484 coreconfigitem(
1487 coreconfigitem(
1485 b'web', b'refreshinterval', default=20,
1488 b'web', b'refreshinterval', default=20,
1486 )
1489 )
1487 coreconfigitem(
1490 coreconfigitem(
1488 b'web', b'server-header', default=None,
1491 b'web', b'server-header', default=None,
1489 )
1492 )
1490 coreconfigitem(
1493 coreconfigitem(
1491 b'web', b'static', default=None,
1494 b'web', b'static', default=None,
1492 )
1495 )
1493 coreconfigitem(
1496 coreconfigitem(
1494 b'web', b'staticurl', default=None,
1497 b'web', b'staticurl', default=None,
1495 )
1498 )
1496 coreconfigitem(
1499 coreconfigitem(
1497 b'web', b'stripes', default=1,
1500 b'web', b'stripes', default=1,
1498 )
1501 )
1499 coreconfigitem(
1502 coreconfigitem(
1500 b'web', b'style', default=b'paper',
1503 b'web', b'style', default=b'paper',
1501 )
1504 )
1502 coreconfigitem(
1505 coreconfigitem(
1503 b'web', b'templates', default=None,
1506 b'web', b'templates', default=None,
1504 )
1507 )
1505 coreconfigitem(
1508 coreconfigitem(
1506 b'web', b'view', default=b'served', experimental=True,
1509 b'web', b'view', default=b'served', experimental=True,
1507 )
1510 )
1508 coreconfigitem(
1511 coreconfigitem(
1509 b'worker', b'backgroundclose', default=dynamicdefault,
1512 b'worker', b'backgroundclose', default=dynamicdefault,
1510 )
1513 )
1511 # Windows defaults to a limit of 512 open files. A buffer of 128
1514 # Windows defaults to a limit of 512 open files. A buffer of 128
1512 # should give us enough headway.
1515 # should give us enough headway.
1513 coreconfigitem(
1516 coreconfigitem(
1514 b'worker', b'backgroundclosemaxqueue', default=384,
1517 b'worker', b'backgroundclosemaxqueue', default=384,
1515 )
1518 )
1516 coreconfigitem(
1519 coreconfigitem(
1517 b'worker', b'backgroundcloseminfilecount', default=2048,
1520 b'worker', b'backgroundcloseminfilecount', default=2048,
1518 )
1521 )
1519 coreconfigitem(
1522 coreconfigitem(
1520 b'worker', b'backgroundclosethreadcount', default=4,
1523 b'worker', b'backgroundclosethreadcount', default=4,
1521 )
1524 )
1522 coreconfigitem(
1525 coreconfigitem(
1523 b'worker', b'enabled', default=True,
1526 b'worker', b'enabled', default=True,
1524 )
1527 )
1525 coreconfigitem(
1528 coreconfigitem(
1526 b'worker', b'numcpus', default=None,
1529 b'worker', b'numcpus', default=None,
1527 )
1530 )
1528
1531
1529 # Rebase related configuration moved to core because other extension are doing
1532 # Rebase related configuration moved to core because other extension are doing
1530 # strange things. For example, shelve import the extensions to reuse some bit
1533 # strange things. For example, shelve import the extensions to reuse some bit
1531 # without formally loading it.
1534 # without formally loading it.
1532 coreconfigitem(
1535 coreconfigitem(
1533 b'commands', b'rebase.requiredest', default=False,
1536 b'commands', b'rebase.requiredest', default=False,
1534 )
1537 )
1535 coreconfigitem(
1538 coreconfigitem(
1536 b'experimental', b'rebaseskipobsolete', default=True,
1539 b'experimental', b'rebaseskipobsolete', default=True,
1537 )
1540 )
1538 coreconfigitem(
1541 coreconfigitem(
1539 b'rebase', b'singletransaction', default=False,
1542 b'rebase', b'singletransaction', default=False,
1540 )
1543 )
1541 coreconfigitem(
1544 coreconfigitem(
1542 b'rebase', b'experimental.inmemory', default=False,
1545 b'rebase', b'experimental.inmemory', default=False,
1543 )
1546 )
@@ -1,455 +1,458 b''
1 # repoview.py - Filtered view of a localrepo object
1 # repoview.py - Filtered view of a localrepo object
2 #
2 #
3 # Copyright 2012 Pierre-Yves David <pierre-yves.david@ens-lyon.org>
3 # Copyright 2012 Pierre-Yves David <pierre-yves.david@ens-lyon.org>
4 # Logilab SA <contact@logilab.fr>
4 # Logilab SA <contact@logilab.fr>
5 #
5 #
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
9 from __future__ import absolute_import
9 from __future__ import absolute_import
10
10
11 import copy
11 import copy
12 import weakref
12 import weakref
13
13
14 from .i18n import _
14 from .i18n import _
15 from .node import (
15 from .node import (
16 hex,
16 hex,
17 nullrev,
17 nullrev,
18 )
18 )
19 from .pycompat import (
19 from .pycompat import (
20 delattr,
20 delattr,
21 getattr,
21 getattr,
22 setattr,
22 setattr,
23 )
23 )
24 from . import (
24 from . import (
25 error,
25 error,
26 obsolete,
26 obsolete,
27 phases,
27 phases,
28 pycompat,
28 pycompat,
29 tags as tagsmod,
29 tags as tagsmod,
30 util,
30 util,
31 )
31 )
32 from .utils import repoviewutil
32 from .utils import repoviewutil
33
33
34
34
35 def hideablerevs(repo):
35 def hideablerevs(repo):
36 """Revision candidates to be hidden
36 """Revision candidates to be hidden
37
37
38 This is a standalone function to allow extensions to wrap it.
38 This is a standalone function to allow extensions to wrap it.
39
39
40 Because we use the set of immutable changesets as a fallback subset in
40 Because we use the set of immutable changesets as a fallback subset in
41 branchmap (see mercurial.utils.repoviewutils.subsettable), you cannot set
41 branchmap (see mercurial.utils.repoviewutils.subsettable), you cannot set
42 "public" changesets as "hideable". Doing so would break multiple code
42 "public" changesets as "hideable". Doing so would break multiple code
43 assertions and lead to crashes."""
43 assertions and lead to crashes."""
44 obsoletes = obsolete.getrevs(repo, b'obsolete')
44 obsoletes = obsolete.getrevs(repo, b'obsolete')
45 internals = repo._phasecache.getrevset(repo, phases.localhiddenphases)
45 internals = repo._phasecache.getrevset(repo, phases.localhiddenphases)
46 internals = frozenset(internals)
46 internals = frozenset(internals)
47 return obsoletes | internals
47 return obsoletes | internals
48
48
49
49
50 def pinnedrevs(repo):
50 def pinnedrevs(repo):
51 """revisions blocking hidden changesets from being filtered
51 """revisions blocking hidden changesets from being filtered
52 """
52 """
53
53
54 cl = repo.changelog
54 cl = repo.changelog
55 pinned = set()
55 pinned = set()
56 pinned.update([par.rev() for par in repo[None].parents()])
56 pinned.update([par.rev() for par in repo[None].parents()])
57 pinned.update([cl.rev(bm) for bm in repo._bookmarks.values()])
57 pinned.update([cl.rev(bm) for bm in repo._bookmarks.values()])
58
58
59 tags = {}
59 tags = {}
60 tagsmod.readlocaltags(repo.ui, repo, tags, {})
60 tagsmod.readlocaltags(repo.ui, repo, tags, {})
61 if tags:
61 if tags:
62 rev = cl.index.get_rev
62 rev = cl.index.get_rev
63 pinned.update(rev(t[0]) for t in tags.values())
63 pinned.update(rev(t[0]) for t in tags.values())
64 pinned.discard(None)
64 pinned.discard(None)
65 return pinned
65 return pinned
66
66
67
67
68 def _revealancestors(pfunc, hidden, revs):
68 def _revealancestors(pfunc, hidden, revs):
69 """reveals contiguous chains of hidden ancestors of 'revs' by removing them
69 """reveals contiguous chains of hidden ancestors of 'revs' by removing them
70 from 'hidden'
70 from 'hidden'
71
71
72 - pfunc(r): a funtion returning parent of 'r',
72 - pfunc(r): a funtion returning parent of 'r',
73 - hidden: the (preliminary) hidden revisions, to be updated
73 - hidden: the (preliminary) hidden revisions, to be updated
74 - revs: iterable of revnum,
74 - revs: iterable of revnum,
75
75
76 (Ancestors are revealed exclusively, i.e. the elements in 'revs' are
76 (Ancestors are revealed exclusively, i.e. the elements in 'revs' are
77 *not* revealed)
77 *not* revealed)
78 """
78 """
79 stack = list(revs)
79 stack = list(revs)
80 while stack:
80 while stack:
81 for p in pfunc(stack.pop()):
81 for p in pfunc(stack.pop()):
82 if p != nullrev and p in hidden:
82 if p != nullrev and p in hidden:
83 hidden.remove(p)
83 hidden.remove(p)
84 stack.append(p)
84 stack.append(p)
85
85
86
86
87 def computehidden(repo, visibilityexceptions=None):
87 def computehidden(repo, visibilityexceptions=None):
88 """compute the set of hidden revision to filter
88 """compute the set of hidden revision to filter
89
89
90 During most operation hidden should be filtered."""
90 During most operation hidden should be filtered."""
91 assert not repo.changelog.filteredrevs
91 assert not repo.changelog.filteredrevs
92
92
93 hidden = hideablerevs(repo)
93 hidden = hideablerevs(repo)
94 if hidden:
94 if hidden:
95 hidden = set(hidden - pinnedrevs(repo))
95 hidden = set(hidden - pinnedrevs(repo))
96 if visibilityexceptions:
96 if visibilityexceptions:
97 hidden -= visibilityexceptions
97 hidden -= visibilityexceptions
98 pfunc = repo.changelog.parentrevs
98 pfunc = repo.changelog.parentrevs
99 mutable = repo._phasecache.getrevset(repo, phases.mutablephases)
99 mutable = repo._phasecache.getrevset(repo, phases.mutablephases)
100
100
101 visible = mutable - hidden
101 visible = mutable - hidden
102 _revealancestors(pfunc, hidden, visible)
102 _revealancestors(pfunc, hidden, visible)
103 return frozenset(hidden)
103 return frozenset(hidden)
104
104
105
105
106 def computesecret(repo, visibilityexceptions=None):
106 def computesecret(repo, visibilityexceptions=None):
107 """compute the set of revision that can never be exposed through hgweb
107 """compute the set of revision that can never be exposed through hgweb
108
108
109 Changeset in the secret phase (or above) should stay unaccessible."""
109 Changeset in the secret phase (or above) should stay unaccessible."""
110 assert not repo.changelog.filteredrevs
110 assert not repo.changelog.filteredrevs
111 secrets = repo._phasecache.getrevset(repo, phases.remotehiddenphases)
111 secrets = repo._phasecache.getrevset(repo, phases.remotehiddenphases)
112 return frozenset(secrets)
112 return frozenset(secrets)
113
113
114
114
115 def computeunserved(repo, visibilityexceptions=None):
115 def computeunserved(repo, visibilityexceptions=None):
116 """compute the set of revision that should be filtered when used a server
116 """compute the set of revision that should be filtered when used a server
117
117
118 Secret and hidden changeset should not pretend to be here."""
118 Secret and hidden changeset should not pretend to be here."""
119 assert not repo.changelog.filteredrevs
119 assert not repo.changelog.filteredrevs
120 # fast path in simple case to avoid impact of non optimised code
120 # fast path in simple case to avoid impact of non optimised code
121 hiddens = filterrevs(repo, b'visible')
121 hiddens = filterrevs(repo, b'visible')
122 secrets = filterrevs(repo, b'served.hidden')
122 secrets = filterrevs(repo, b'served.hidden')
123 if secrets:
123 if secrets:
124 return frozenset(hiddens | secrets)
124 return frozenset(hiddens | secrets)
125 else:
125 else:
126 return hiddens
126 return hiddens
127
127
128
128
129 def computemutable(repo, visibilityexceptions=None):
129 def computemutable(repo, visibilityexceptions=None):
130 assert not repo.changelog.filteredrevs
130 assert not repo.changelog.filteredrevs
131 # fast check to avoid revset call on huge repo
131 # fast check to avoid revset call on huge repo
132 if any(repo._phasecache.phaseroots[1:]):
132 if any(repo._phasecache.phaseroots[1:]):
133 getphase = repo._phasecache.phase
133 getphase = repo._phasecache.phase
134 maymutable = filterrevs(repo, b'base')
134 maymutable = filterrevs(repo, b'base')
135 return frozenset(r for r in maymutable if getphase(repo, r))
135 return frozenset(r for r in maymutable if getphase(repo, r))
136 return frozenset()
136 return frozenset()
137
137
138
138
139 def computeimpactable(repo, visibilityexceptions=None):
139 def computeimpactable(repo, visibilityexceptions=None):
140 """Everything impactable by mutable revision
140 """Everything impactable by mutable revision
141
141
142 The immutable filter still have some chance to get invalidated. This will
142 The immutable filter still have some chance to get invalidated. This will
143 happen when:
143 happen when:
144
144
145 - you garbage collect hidden changeset,
145 - you garbage collect hidden changeset,
146 - public phase is moved backward,
146 - public phase is moved backward,
147 - something is changed in the filtering (this could be fixed)
147 - something is changed in the filtering (this could be fixed)
148
148
149 This filter out any mutable changeset and any public changeset that may be
149 This filter out any mutable changeset and any public changeset that may be
150 impacted by something happening to a mutable revision.
150 impacted by something happening to a mutable revision.
151
151
152 This is achieved by filtered everything with a revision number egal or
152 This is achieved by filtered everything with a revision number egal or
153 higher than the first mutable changeset is filtered."""
153 higher than the first mutable changeset is filtered."""
154 assert not repo.changelog.filteredrevs
154 assert not repo.changelog.filteredrevs
155 cl = repo.changelog
155 cl = repo.changelog
156 firstmutable = len(cl)
156 firstmutable = len(cl)
157 for roots in repo._phasecache.phaseroots[1:]:
157 for roots in repo._phasecache.phaseroots[1:]:
158 if roots:
158 if roots:
159 firstmutable = min(firstmutable, min(cl.rev(r) for r in roots))
159 firstmutable = min(firstmutable, min(cl.rev(r) for r in roots))
160 # protect from nullrev root
160 # protect from nullrev root
161 firstmutable = max(0, firstmutable)
161 firstmutable = max(0, firstmutable)
162 return frozenset(pycompat.xrange(firstmutable, len(cl)))
162 return frozenset(pycompat.xrange(firstmutable, len(cl)))
163
163
164
164
165 # function to compute filtered set
165 # function to compute filtered set
166 #
166 #
167 # When adding a new filter you MUST update the table at:
167 # When adding a new filter you MUST update the table at:
168 # mercurial.utils.repoviewutil.subsettable
168 # mercurial.utils.repoviewutil.subsettable
169 # Otherwise your filter will have to recompute all its branches cache
169 # Otherwise your filter will have to recompute all its branches cache
170 # from scratch (very slow).
170 # from scratch (very slow).
171 filtertable = {
171 filtertable = {
172 b'visible': computehidden,
172 b'visible': computehidden,
173 b'visible-hidden': computehidden,
173 b'visible-hidden': computehidden,
174 b'served.hidden': computesecret,
174 b'served.hidden': computesecret,
175 b'served': computeunserved,
175 b'served': computeunserved,
176 b'immutable': computemutable,
176 b'immutable': computemutable,
177 b'base': computeimpactable,
177 b'base': computeimpactable,
178 }
178 }
179
179
180 _basefiltername = list(filtertable)
180 _basefiltername = list(filtertable)
181
181
182
182
183 def extrafilter(ui):
183 def extrafilter(ui):
184 """initialize extra filter and return its id
184 """initialize extra filter and return its id
185
185
186 If extra filtering is configured, we make sure the associated filtered view
186 If extra filtering is configured, we make sure the associated filtered view
187 are declared and return the associated id.
187 are declared and return the associated id.
188 """
188 """
189 frevs = ui.config(b'experimental', b'extra-filter-revs')
189 frevs = ui.config(b'experimental', b'extra-filter-revs')
190 if frevs is None:
190 if frevs is None:
191 return None
191 return None
192
192
193 fid = pycompat.sysbytes(util.DIGESTS[b'sha1'](frevs).hexdigest())[:12]
193 fid = pycompat.sysbytes(util.DIGESTS[b'sha1'](frevs).hexdigest())[:12]
194
194
195 combine = lambda fname: fname + b'%' + fid
195 combine = lambda fname: fname + b'%' + fid
196
196
197 subsettable = repoviewutil.subsettable
197 subsettable = repoviewutil.subsettable
198
198
199 if combine(b'base') not in filtertable:
199 if combine(b'base') not in filtertable:
200 for name in _basefiltername:
200 for name in _basefiltername:
201
201
202 def extrafilteredrevs(repo, *args, **kwargs):
202 def extrafilteredrevs(repo, *args, **kwargs):
203 baserevs = filtertable[name](repo, *args, **kwargs)
203 baserevs = filtertable[name](repo, *args, **kwargs)
204 extrarevs = frozenset(repo.revs(frevs))
204 extrarevs = frozenset(repo.revs(frevs))
205 return baserevs | extrarevs
205 return baserevs | extrarevs
206
206
207 filtertable[combine(name)] = extrafilteredrevs
207 filtertable[combine(name)] = extrafilteredrevs
208 if name in subsettable:
208 if name in subsettable:
209 subsettable[combine(name)] = combine(subsettable[name])
209 subsettable[combine(name)] = combine(subsettable[name])
210 return fid
210 return fid
211
211
212
212
213 def filterrevs(repo, filtername, visibilityexceptions=None):
213 def filterrevs(repo, filtername, visibilityexceptions=None):
214 """returns set of filtered revision for this filter name
214 """returns set of filtered revision for this filter name
215
215
216 visibilityexceptions is a set of revs which must are exceptions for
216 visibilityexceptions is a set of revs which must are exceptions for
217 hidden-state and must be visible. They are dynamic and hence we should not
217 hidden-state and must be visible. They are dynamic and hence we should not
218 cache it's result"""
218 cache it's result"""
219 if filtername not in repo.filteredrevcache:
219 if filtername not in repo.filteredrevcache:
220 if repo.ui.configbool(b'devel', b'debug.repo-filters'):
221 msg = b'debug.filters: computing revision filter for "%s"\n'
222 repo.ui.debug(msg % filtername)
220 func = filtertable[filtername]
223 func = filtertable[filtername]
221 if visibilityexceptions:
224 if visibilityexceptions:
222 return func(repo.unfiltered, visibilityexceptions)
225 return func(repo.unfiltered, visibilityexceptions)
223 repo.filteredrevcache[filtername] = func(repo.unfiltered())
226 repo.filteredrevcache[filtername] = func(repo.unfiltered())
224 return repo.filteredrevcache[filtername]
227 return repo.filteredrevcache[filtername]
225
228
226
229
227 def wrapchangelog(unfichangelog, filteredrevs):
230 def wrapchangelog(unfichangelog, filteredrevs):
228 cl = copy.copy(unfichangelog)
231 cl = copy.copy(unfichangelog)
229 cl.filteredrevs = filteredrevs
232 cl.filteredrevs = filteredrevs
230
233
231 class filteredchangelog(filteredchangelogmixin, cl.__class__):
234 class filteredchangelog(filteredchangelogmixin, cl.__class__):
232 pass
235 pass
233
236
234 cl.__class__ = filteredchangelog
237 cl.__class__ = filteredchangelog
235
238
236 return cl
239 return cl
237
240
238
241
239 class filteredchangelogmixin(object):
242 class filteredchangelogmixin(object):
240 def tiprev(self):
243 def tiprev(self):
241 """filtered version of revlog.tiprev"""
244 """filtered version of revlog.tiprev"""
242 for i in pycompat.xrange(len(self) - 1, -2, -1):
245 for i in pycompat.xrange(len(self) - 1, -2, -1):
243 if i not in self.filteredrevs:
246 if i not in self.filteredrevs:
244 return i
247 return i
245
248
246 def __contains__(self, rev):
249 def __contains__(self, rev):
247 """filtered version of revlog.__contains__"""
250 """filtered version of revlog.__contains__"""
248 return 0 <= rev < len(self) and rev not in self.filteredrevs
251 return 0 <= rev < len(self) and rev not in self.filteredrevs
249
252
250 def __iter__(self):
253 def __iter__(self):
251 """filtered version of revlog.__iter__"""
254 """filtered version of revlog.__iter__"""
252
255
253 def filterediter():
256 def filterediter():
254 for i in pycompat.xrange(len(self)):
257 for i in pycompat.xrange(len(self)):
255 if i not in self.filteredrevs:
258 if i not in self.filteredrevs:
256 yield i
259 yield i
257
260
258 return filterediter()
261 return filterediter()
259
262
260 def revs(self, start=0, stop=None):
263 def revs(self, start=0, stop=None):
261 """filtered version of revlog.revs"""
264 """filtered version of revlog.revs"""
262 for i in super(filteredchangelogmixin, self).revs(start, stop):
265 for i in super(filteredchangelogmixin, self).revs(start, stop):
263 if i not in self.filteredrevs:
266 if i not in self.filteredrevs:
264 yield i
267 yield i
265
268
266 def _checknofilteredinrevs(self, revs):
269 def _checknofilteredinrevs(self, revs):
267 """raise the appropriate error if 'revs' contains a filtered revision
270 """raise the appropriate error if 'revs' contains a filtered revision
268
271
269 This returns a version of 'revs' to be used thereafter by the caller.
272 This returns a version of 'revs' to be used thereafter by the caller.
270 In particular, if revs is an iterator, it is converted into a set.
273 In particular, if revs is an iterator, it is converted into a set.
271 """
274 """
272 safehasattr = util.safehasattr
275 safehasattr = util.safehasattr
273 if safehasattr(revs, '__next__'):
276 if safehasattr(revs, '__next__'):
274 # Note that inspect.isgenerator() is not true for iterators,
277 # Note that inspect.isgenerator() is not true for iterators,
275 revs = set(revs)
278 revs = set(revs)
276
279
277 filteredrevs = self.filteredrevs
280 filteredrevs = self.filteredrevs
278 if safehasattr(revs, 'first'): # smartset
281 if safehasattr(revs, 'first'): # smartset
279 offenders = revs & filteredrevs
282 offenders = revs & filteredrevs
280 else:
283 else:
281 offenders = filteredrevs.intersection(revs)
284 offenders = filteredrevs.intersection(revs)
282
285
283 for rev in offenders:
286 for rev in offenders:
284 raise error.FilteredIndexError(rev)
287 raise error.FilteredIndexError(rev)
285 return revs
288 return revs
286
289
287 def headrevs(self, revs=None):
290 def headrevs(self, revs=None):
288 if revs is None:
291 if revs is None:
289 try:
292 try:
290 return self.index.headrevsfiltered(self.filteredrevs)
293 return self.index.headrevsfiltered(self.filteredrevs)
291 # AttributeError covers non-c-extension environments and
294 # AttributeError covers non-c-extension environments and
292 # old c extensions without filter handling.
295 # old c extensions without filter handling.
293 except AttributeError:
296 except AttributeError:
294 return self._headrevs()
297 return self._headrevs()
295
298
296 revs = self._checknofilteredinrevs(revs)
299 revs = self._checknofilteredinrevs(revs)
297 return super(filteredchangelogmixin, self).headrevs(revs)
300 return super(filteredchangelogmixin, self).headrevs(revs)
298
301
299 def strip(self, *args, **kwargs):
302 def strip(self, *args, **kwargs):
300 # XXX make something better than assert
303 # XXX make something better than assert
301 # We can't expect proper strip behavior if we are filtered.
304 # We can't expect proper strip behavior if we are filtered.
302 assert not self.filteredrevs
305 assert not self.filteredrevs
303 super(filteredchangelogmixin, self).strip(*args, **kwargs)
306 super(filteredchangelogmixin, self).strip(*args, **kwargs)
304
307
305 def rev(self, node):
308 def rev(self, node):
306 """filtered version of revlog.rev"""
309 """filtered version of revlog.rev"""
307 r = super(filteredchangelogmixin, self).rev(node)
310 r = super(filteredchangelogmixin, self).rev(node)
308 if r in self.filteredrevs:
311 if r in self.filteredrevs:
309 raise error.FilteredLookupError(
312 raise error.FilteredLookupError(
310 hex(node), self.indexfile, _(b'filtered node')
313 hex(node), self.indexfile, _(b'filtered node')
311 )
314 )
312 return r
315 return r
313
316
314 def node(self, rev):
317 def node(self, rev):
315 """filtered version of revlog.node"""
318 """filtered version of revlog.node"""
316 if rev in self.filteredrevs:
319 if rev in self.filteredrevs:
317 raise error.FilteredIndexError(rev)
320 raise error.FilteredIndexError(rev)
318 return super(filteredchangelogmixin, self).node(rev)
321 return super(filteredchangelogmixin, self).node(rev)
319
322
320 def linkrev(self, rev):
323 def linkrev(self, rev):
321 """filtered version of revlog.linkrev"""
324 """filtered version of revlog.linkrev"""
322 if rev in self.filteredrevs:
325 if rev in self.filteredrevs:
323 raise error.FilteredIndexError(rev)
326 raise error.FilteredIndexError(rev)
324 return super(filteredchangelogmixin, self).linkrev(rev)
327 return super(filteredchangelogmixin, self).linkrev(rev)
325
328
326 def parentrevs(self, rev):
329 def parentrevs(self, rev):
327 """filtered version of revlog.parentrevs"""
330 """filtered version of revlog.parentrevs"""
328 if rev in self.filteredrevs:
331 if rev in self.filteredrevs:
329 raise error.FilteredIndexError(rev)
332 raise error.FilteredIndexError(rev)
330 return super(filteredchangelogmixin, self).parentrevs(rev)
333 return super(filteredchangelogmixin, self).parentrevs(rev)
331
334
332 def flags(self, rev):
335 def flags(self, rev):
333 """filtered version of revlog.flags"""
336 """filtered version of revlog.flags"""
334 if rev in self.filteredrevs:
337 if rev in self.filteredrevs:
335 raise error.FilteredIndexError(rev)
338 raise error.FilteredIndexError(rev)
336 return super(filteredchangelogmixin, self).flags(rev)
339 return super(filteredchangelogmixin, self).flags(rev)
337
340
338
341
339 class repoview(object):
342 class repoview(object):
340 """Provide a read/write view of a repo through a filtered changelog
343 """Provide a read/write view of a repo through a filtered changelog
341
344
342 This object is used to access a filtered version of a repository without
345 This object is used to access a filtered version of a repository without
343 altering the original repository object itself. We can not alter the
346 altering the original repository object itself. We can not alter the
344 original object for two main reasons:
347 original object for two main reasons:
345 - It prevents the use of a repo with multiple filters at the same time. In
348 - It prevents the use of a repo with multiple filters at the same time. In
346 particular when multiple threads are involved.
349 particular when multiple threads are involved.
347 - It makes scope of the filtering harder to control.
350 - It makes scope of the filtering harder to control.
348
351
349 This object behaves very closely to the original repository. All attribute
352 This object behaves very closely to the original repository. All attribute
350 operations are done on the original repository:
353 operations are done on the original repository:
351 - An access to `repoview.someattr` actually returns `repo.someattr`,
354 - An access to `repoview.someattr` actually returns `repo.someattr`,
352 - A write to `repoview.someattr` actually sets value of `repo.someattr`,
355 - A write to `repoview.someattr` actually sets value of `repo.someattr`,
353 - A deletion of `repoview.someattr` actually drops `someattr`
356 - A deletion of `repoview.someattr` actually drops `someattr`
354 from `repo.__dict__`.
357 from `repo.__dict__`.
355
358
356 The only exception is the `changelog` property. It is overridden to return
359 The only exception is the `changelog` property. It is overridden to return
357 a (surface) copy of `repo.changelog` with some revisions filtered. The
360 a (surface) copy of `repo.changelog` with some revisions filtered. The
358 `filtername` attribute of the view control the revisions that need to be
361 `filtername` attribute of the view control the revisions that need to be
359 filtered. (the fact the changelog is copied is an implementation detail).
362 filtered. (the fact the changelog is copied is an implementation detail).
360
363
361 Unlike attributes, this object intercepts all method calls. This means that
364 Unlike attributes, this object intercepts all method calls. This means that
362 all methods are run on the `repoview` object with the filtered `changelog`
365 all methods are run on the `repoview` object with the filtered `changelog`
363 property. For this purpose the simple `repoview` class must be mixed with
366 property. For this purpose the simple `repoview` class must be mixed with
364 the actual class of the repository. This ensures that the resulting
367 the actual class of the repository. This ensures that the resulting
365 `repoview` object have the very same methods than the repo object. This
368 `repoview` object have the very same methods than the repo object. This
366 leads to the property below.
369 leads to the property below.
367
370
368 repoview.method() --> repo.__class__.method(repoview)
371 repoview.method() --> repo.__class__.method(repoview)
369
372
370 The inheritance has to be done dynamically because `repo` can be of any
373 The inheritance has to be done dynamically because `repo` can be of any
371 subclasses of `localrepo`. Eg: `bundlerepo` or `statichttprepo`.
374 subclasses of `localrepo`. Eg: `bundlerepo` or `statichttprepo`.
372 """
375 """
373
376
374 def __init__(self, repo, filtername, visibilityexceptions=None):
377 def __init__(self, repo, filtername, visibilityexceptions=None):
375 object.__setattr__(self, '_unfilteredrepo', repo)
378 object.__setattr__(self, '_unfilteredrepo', repo)
376 object.__setattr__(self, 'filtername', filtername)
379 object.__setattr__(self, 'filtername', filtername)
377 object.__setattr__(self, '_clcachekey', None)
380 object.__setattr__(self, '_clcachekey', None)
378 object.__setattr__(self, '_clcache', None)
381 object.__setattr__(self, '_clcache', None)
379 # revs which are exceptions and must not be hidden
382 # revs which are exceptions and must not be hidden
380 object.__setattr__(self, '_visibilityexceptions', visibilityexceptions)
383 object.__setattr__(self, '_visibilityexceptions', visibilityexceptions)
381
384
382 # not a propertycache on purpose we shall implement a proper cache later
385 # not a propertycache on purpose we shall implement a proper cache later
383 @property
386 @property
384 def changelog(self):
387 def changelog(self):
385 """return a filtered version of the changeset
388 """return a filtered version of the changeset
386
389
387 this changelog must not be used for writing"""
390 this changelog must not be used for writing"""
388 # some cache may be implemented later
391 # some cache may be implemented later
389 unfi = self._unfilteredrepo
392 unfi = self._unfilteredrepo
390 unfichangelog = unfi.changelog
393 unfichangelog = unfi.changelog
391 # bypass call to changelog.method
394 # bypass call to changelog.method
392 unfiindex = unfichangelog.index
395 unfiindex = unfichangelog.index
393 unfilen = len(unfiindex)
396 unfilen = len(unfiindex)
394 unfinode = unfiindex[unfilen - 1][7]
397 unfinode = unfiindex[unfilen - 1][7]
395 with util.timedcm('repo filter for %s', self.filtername):
398 with util.timedcm('repo filter for %s', self.filtername):
396 revs = filterrevs(unfi, self.filtername, self._visibilityexceptions)
399 revs = filterrevs(unfi, self.filtername, self._visibilityexceptions)
397 cl = self._clcache
400 cl = self._clcache
398 newkey = (unfilen, unfinode, hash(revs), unfichangelog._delayed)
401 newkey = (unfilen, unfinode, hash(revs), unfichangelog._delayed)
399 # if cl.index is not unfiindex, unfi.changelog would be
402 # if cl.index is not unfiindex, unfi.changelog would be
400 # recreated, and our clcache refers to garbage object
403 # recreated, and our clcache refers to garbage object
401 if cl is not None and (
404 if cl is not None and (
402 cl.index is not unfiindex or newkey != self._clcachekey
405 cl.index is not unfiindex or newkey != self._clcachekey
403 ):
406 ):
404 cl = None
407 cl = None
405 # could have been made None by the previous if
408 # could have been made None by the previous if
406 if cl is None:
409 if cl is None:
407 # Only filter if there's something to filter
410 # Only filter if there's something to filter
408 cl = wrapchangelog(unfichangelog, revs) if revs else unfichangelog
411 cl = wrapchangelog(unfichangelog, revs) if revs else unfichangelog
409 object.__setattr__(self, '_clcache', cl)
412 object.__setattr__(self, '_clcache', cl)
410 object.__setattr__(self, '_clcachekey', newkey)
413 object.__setattr__(self, '_clcachekey', newkey)
411 return cl
414 return cl
412
415
413 def unfiltered(self):
416 def unfiltered(self):
414 """Return an unfiltered version of a repo"""
417 """Return an unfiltered version of a repo"""
415 return self._unfilteredrepo
418 return self._unfilteredrepo
416
419
417 def filtered(self, name, visibilityexceptions=None):
420 def filtered(self, name, visibilityexceptions=None):
418 """Return a filtered version of a repository"""
421 """Return a filtered version of a repository"""
419 if name == self.filtername and not visibilityexceptions:
422 if name == self.filtername and not visibilityexceptions:
420 return self
423 return self
421 return self.unfiltered().filtered(name, visibilityexceptions)
424 return self.unfiltered().filtered(name, visibilityexceptions)
422
425
423 def __repr__(self):
426 def __repr__(self):
424 return '<%s:%s %r>' % (
427 return '<%s:%s %r>' % (
425 self.__class__.__name__,
428 self.__class__.__name__,
426 pycompat.sysstr(self.filtername),
429 pycompat.sysstr(self.filtername),
427 self.unfiltered(),
430 self.unfiltered(),
428 )
431 )
429
432
430 # everything access are forwarded to the proxied repo
433 # everything access are forwarded to the proxied repo
431 def __getattr__(self, attr):
434 def __getattr__(self, attr):
432 return getattr(self._unfilteredrepo, attr)
435 return getattr(self._unfilteredrepo, attr)
433
436
434 def __setattr__(self, attr, value):
437 def __setattr__(self, attr, value):
435 return setattr(self._unfilteredrepo, attr, value)
438 return setattr(self._unfilteredrepo, attr, value)
436
439
437 def __delattr__(self, attr):
440 def __delattr__(self, attr):
438 return delattr(self._unfilteredrepo, attr)
441 return delattr(self._unfilteredrepo, attr)
439
442
440
443
441 # Python <3.4 easily leaks types via __mro__. See
444 # Python <3.4 easily leaks types via __mro__. See
442 # https://bugs.python.org/issue17950. We cache dynamically created types
445 # https://bugs.python.org/issue17950. We cache dynamically created types
443 # so they won't be leaked on every invocation of repo.filtered().
446 # so they won't be leaked on every invocation of repo.filtered().
444 _filteredrepotypes = weakref.WeakKeyDictionary()
447 _filteredrepotypes = weakref.WeakKeyDictionary()
445
448
446
449
447 def newtype(base):
450 def newtype(base):
448 """Create a new type with the repoview mixin and the given base class"""
451 """Create a new type with the repoview mixin and the given base class"""
449 if base not in _filteredrepotypes:
452 if base not in _filteredrepotypes:
450
453
451 class filteredrepo(repoview, base):
454 class filteredrepo(repoview, base):
452 pass
455 pass
453
456
454 _filteredrepotypes[base] = filteredrepo
457 _filteredrepotypes[base] = filteredrepo
455 return _filteredrepotypes[base]
458 return _filteredrepotypes[base]
General Comments 0
You need to be logged in to leave comments. Login now