Show More
@@ -1,979 +1,982 | |||||
1 | # configitems.py - centralized declaration of configuration option |
|
1 | # configitems.py - centralized declaration of configuration option | |
2 | # |
|
2 | # | |
3 | # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net> |
|
3 | # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import functools |
|
10 | import functools | |
11 | import re |
|
11 | import re | |
12 |
|
12 | |||
13 | from . import ( |
|
13 | from . import ( | |
14 | encoding, |
|
14 | encoding, | |
15 | error, |
|
15 | error, | |
16 | ) |
|
16 | ) | |
17 |
|
17 | |||
18 | def loadconfigtable(ui, extname, configtable): |
|
18 | def loadconfigtable(ui, extname, configtable): | |
19 | """update config item known to the ui with the extension ones""" |
|
19 | """update config item known to the ui with the extension ones""" | |
20 | for section, items in configtable.items(): |
|
20 | for section, items in configtable.items(): | |
21 | knownitems = ui._knownconfig.setdefault(section, {}) |
|
21 | knownitems = ui._knownconfig.setdefault(section, {}) | |
22 | knownkeys = set(knownitems) |
|
22 | knownkeys = set(knownitems) | |
23 | newkeys = set(items) |
|
23 | newkeys = set(items) | |
24 | for key in sorted(knownkeys & newkeys): |
|
24 | for key in sorted(knownkeys & newkeys): | |
25 | msg = "extension '%s' overwrite config item '%s.%s'" |
|
25 | msg = "extension '%s' overwrite config item '%s.%s'" | |
26 | msg %= (extname, section, key) |
|
26 | msg %= (extname, section, key) | |
27 | ui.develwarn(msg, config='warn-config') |
|
27 | ui.develwarn(msg, config='warn-config') | |
28 |
|
28 | |||
29 | knownitems.update(items) |
|
29 | knownitems.update(items) | |
30 |
|
30 | |||
31 | class configitem(object): |
|
31 | class configitem(object): | |
32 | """represent a known config item |
|
32 | """represent a known config item | |
33 |
|
33 | |||
34 | :section: the official config section where to find this item, |
|
34 | :section: the official config section where to find this item, | |
35 | :name: the official name within the section, |
|
35 | :name: the official name within the section, | |
36 | :default: default value for this item, |
|
36 | :default: default value for this item, | |
37 | :alias: optional list of tuples as alternatives, |
|
37 | :alias: optional list of tuples as alternatives, | |
38 | :generic: this is a generic definition, match name using regular expression. |
|
38 | :generic: this is a generic definition, match name using regular expression. | |
39 | """ |
|
39 | """ | |
40 |
|
40 | |||
41 | def __init__(self, section, name, default=None, alias=(), |
|
41 | def __init__(self, section, name, default=None, alias=(), | |
42 | generic=False, priority=0): |
|
42 | generic=False, priority=0): | |
43 | self.section = section |
|
43 | self.section = section | |
44 | self.name = name |
|
44 | self.name = name | |
45 | self.default = default |
|
45 | self.default = default | |
46 | self.alias = list(alias) |
|
46 | self.alias = list(alias) | |
47 | self.generic = generic |
|
47 | self.generic = generic | |
48 | self.priority = priority |
|
48 | self.priority = priority | |
49 | self._re = None |
|
49 | self._re = None | |
50 | if generic: |
|
50 | if generic: | |
51 | self._re = re.compile(self.name) |
|
51 | self._re = re.compile(self.name) | |
52 |
|
52 | |||
53 | class itemregister(dict): |
|
53 | class itemregister(dict): | |
54 | """A specialized dictionary that can handle wild-card selection""" |
|
54 | """A specialized dictionary that can handle wild-card selection""" | |
55 |
|
55 | |||
56 | def __init__(self): |
|
56 | def __init__(self): | |
57 | super(itemregister, self).__init__() |
|
57 | super(itemregister, self).__init__() | |
58 | self._generics = set() |
|
58 | self._generics = set() | |
59 |
|
59 | |||
60 | def update(self, other): |
|
60 | def update(self, other): | |
61 | super(itemregister, self).update(other) |
|
61 | super(itemregister, self).update(other) | |
62 | self._generics.update(other._generics) |
|
62 | self._generics.update(other._generics) | |
63 |
|
63 | |||
64 | def __setitem__(self, key, item): |
|
64 | def __setitem__(self, key, item): | |
65 | super(itemregister, self).__setitem__(key, item) |
|
65 | super(itemregister, self).__setitem__(key, item) | |
66 | if item.generic: |
|
66 | if item.generic: | |
67 | self._generics.add(item) |
|
67 | self._generics.add(item) | |
68 |
|
68 | |||
69 | def get(self, key): |
|
69 | def get(self, key): | |
70 | if key in self: |
|
70 | if key in self: | |
71 | return self[key] |
|
71 | return self[key] | |
72 |
|
72 | |||
73 | # search for a matching generic item |
|
73 | # search for a matching generic item | |
74 | generics = sorted(self._generics, key=(lambda x: (x.priority, x.name))) |
|
74 | generics = sorted(self._generics, key=(lambda x: (x.priority, x.name))) | |
75 | for item in generics: |
|
75 | for item in generics: | |
76 | if item._re.match(key): |
|
76 | if item._re.match(key): | |
77 | return item |
|
77 | return item | |
78 |
|
78 | |||
79 | # fallback to dict get |
|
79 | # fallback to dict get | |
80 | return super(itemregister, self).get(key) |
|
80 | return super(itemregister, self).get(key) | |
81 |
|
81 | |||
82 | coreitems = {} |
|
82 | coreitems = {} | |
83 |
|
83 | |||
84 | def _register(configtable, *args, **kwargs): |
|
84 | def _register(configtable, *args, **kwargs): | |
85 | item = configitem(*args, **kwargs) |
|
85 | item = configitem(*args, **kwargs) | |
86 | section = configtable.setdefault(item.section, itemregister()) |
|
86 | section = configtable.setdefault(item.section, itemregister()) | |
87 | if item.name in section: |
|
87 | if item.name in section: | |
88 | msg = "duplicated config item registration for '%s.%s'" |
|
88 | msg = "duplicated config item registration for '%s.%s'" | |
89 | raise error.ProgrammingError(msg % (item.section, item.name)) |
|
89 | raise error.ProgrammingError(msg % (item.section, item.name)) | |
90 | section[item.name] = item |
|
90 | section[item.name] = item | |
91 |
|
91 | |||
92 | # special value for case where the default is derived from other values |
|
92 | # special value for case where the default is derived from other values | |
93 | dynamicdefault = object() |
|
93 | dynamicdefault = object() | |
94 |
|
94 | |||
95 | # Registering actual config items |
|
95 | # Registering actual config items | |
96 |
|
96 | |||
97 | def getitemregister(configtable): |
|
97 | def getitemregister(configtable): | |
98 | return functools.partial(_register, configtable) |
|
98 | return functools.partial(_register, configtable) | |
99 |
|
99 | |||
100 | coreconfigitem = getitemregister(coreitems) |
|
100 | coreconfigitem = getitemregister(coreitems) | |
101 |
|
101 | |||
102 | coreconfigitem('alias', '.*', |
|
102 | coreconfigitem('alias', '.*', | |
103 | default=None, |
|
103 | default=None, | |
104 | generic=True, |
|
104 | generic=True, | |
105 | ) |
|
105 | ) | |
106 | coreconfigitem('annotate', 'nodates', |
|
106 | coreconfigitem('annotate', 'nodates', | |
107 | default=False, |
|
107 | default=False, | |
108 | ) |
|
108 | ) | |
109 | coreconfigitem('annotate', 'showfunc', |
|
109 | coreconfigitem('annotate', 'showfunc', | |
110 | default=False, |
|
110 | default=False, | |
111 | ) |
|
111 | ) | |
112 | coreconfigitem('annotate', 'unified', |
|
112 | coreconfigitem('annotate', 'unified', | |
113 | default=None, |
|
113 | default=None, | |
114 | ) |
|
114 | ) | |
115 | coreconfigitem('annotate', 'git', |
|
115 | coreconfigitem('annotate', 'git', | |
116 | default=False, |
|
116 | default=False, | |
117 | ) |
|
117 | ) | |
118 | coreconfigitem('annotate', 'ignorews', |
|
118 | coreconfigitem('annotate', 'ignorews', | |
119 | default=False, |
|
119 | default=False, | |
120 | ) |
|
120 | ) | |
121 | coreconfigitem('annotate', 'ignorewsamount', |
|
121 | coreconfigitem('annotate', 'ignorewsamount', | |
122 | default=False, |
|
122 | default=False, | |
123 | ) |
|
123 | ) | |
124 | coreconfigitem('annotate', 'ignoreblanklines', |
|
124 | coreconfigitem('annotate', 'ignoreblanklines', | |
125 | default=False, |
|
125 | default=False, | |
126 | ) |
|
126 | ) | |
127 | coreconfigitem('annotate', 'ignorewseol', |
|
127 | coreconfigitem('annotate', 'ignorewseol', | |
128 | default=False, |
|
128 | default=False, | |
129 | ) |
|
129 | ) | |
130 | coreconfigitem('annotate', 'nobinary', |
|
130 | coreconfigitem('annotate', 'nobinary', | |
131 | default=False, |
|
131 | default=False, | |
132 | ) |
|
132 | ) | |
133 | coreconfigitem('annotate', 'noprefix', |
|
133 | coreconfigitem('annotate', 'noprefix', | |
134 | default=False, |
|
134 | default=False, | |
135 | ) |
|
135 | ) | |
136 | coreconfigitem('auth', 'cookiefile', |
|
136 | coreconfigitem('auth', 'cookiefile', | |
137 | default=None, |
|
137 | default=None, | |
138 | ) |
|
138 | ) | |
139 | # bookmarks.pushing: internal hack for discovery |
|
139 | # bookmarks.pushing: internal hack for discovery | |
140 | coreconfigitem('bookmarks', 'pushing', |
|
140 | coreconfigitem('bookmarks', 'pushing', | |
141 | default=list, |
|
141 | default=list, | |
142 | ) |
|
142 | ) | |
143 | # bundle.mainreporoot: internal hack for bundlerepo |
|
143 | # bundle.mainreporoot: internal hack for bundlerepo | |
144 | coreconfigitem('bundle', 'mainreporoot', |
|
144 | coreconfigitem('bundle', 'mainreporoot', | |
145 | default='', |
|
145 | default='', | |
146 | ) |
|
146 | ) | |
147 | # bundle.reorder: experimental config |
|
147 | # bundle.reorder: experimental config | |
148 | coreconfigitem('bundle', 'reorder', |
|
148 | coreconfigitem('bundle', 'reorder', | |
149 | default='auto', |
|
149 | default='auto', | |
150 | ) |
|
150 | ) | |
151 | coreconfigitem('censor', 'policy', |
|
151 | coreconfigitem('censor', 'policy', | |
152 | default='abort', |
|
152 | default='abort', | |
153 | ) |
|
153 | ) | |
154 | coreconfigitem('chgserver', 'idletimeout', |
|
154 | coreconfigitem('chgserver', 'idletimeout', | |
155 | default=3600, |
|
155 | default=3600, | |
156 | ) |
|
156 | ) | |
157 | coreconfigitem('chgserver', 'skiphash', |
|
157 | coreconfigitem('chgserver', 'skiphash', | |
158 | default=False, |
|
158 | default=False, | |
159 | ) |
|
159 | ) | |
160 | coreconfigitem('cmdserver', 'log', |
|
160 | coreconfigitem('cmdserver', 'log', | |
161 | default=None, |
|
161 | default=None, | |
162 | ) |
|
162 | ) | |
163 | coreconfigitem('color', '.*', |
|
163 | coreconfigitem('color', '.*', | |
164 | default=None, |
|
164 | default=None, | |
165 | generic=True, |
|
165 | generic=True, | |
166 | ) |
|
166 | ) | |
167 | coreconfigitem('color', 'mode', |
|
167 | coreconfigitem('color', 'mode', | |
168 | default='auto', |
|
168 | default='auto', | |
169 | ) |
|
169 | ) | |
170 | coreconfigitem('color', 'pagermode', |
|
170 | coreconfigitem('color', 'pagermode', | |
171 | default=dynamicdefault, |
|
171 | default=dynamicdefault, | |
172 | ) |
|
172 | ) | |
173 | coreconfigitem('commands', 'status.relative', |
|
173 | coreconfigitem('commands', 'status.relative', | |
174 | default=False, |
|
174 | default=False, | |
175 | ) |
|
175 | ) | |
176 | coreconfigitem('commands', 'status.skipstates', |
|
176 | coreconfigitem('commands', 'status.skipstates', | |
177 | default=[], |
|
177 | default=[], | |
178 | ) |
|
178 | ) | |
179 | coreconfigitem('commands', 'status.verbose', |
|
179 | coreconfigitem('commands', 'status.verbose', | |
180 | default=False, |
|
180 | default=False, | |
181 | ) |
|
181 | ) | |
182 | coreconfigitem('commands', 'update.check', |
|
182 | coreconfigitem('commands', 'update.check', | |
183 | default=None, |
|
183 | default=None, | |
184 | ) |
|
184 | ) | |
185 | coreconfigitem('commands', 'update.requiredest', |
|
185 | coreconfigitem('commands', 'update.requiredest', | |
186 | default=False, |
|
186 | default=False, | |
187 | ) |
|
187 | ) | |
188 | coreconfigitem('committemplate', '.*', |
|
188 | coreconfigitem('committemplate', '.*', | |
189 | default=None, |
|
189 | default=None, | |
190 | generic=True, |
|
190 | generic=True, | |
191 | ) |
|
191 | ) | |
192 | coreconfigitem('debug', 'dirstate.delaywrite', |
|
192 | coreconfigitem('debug', 'dirstate.delaywrite', | |
193 | default=0, |
|
193 | default=0, | |
194 | ) |
|
194 | ) | |
195 | coreconfigitem('defaults', '.*', |
|
195 | coreconfigitem('defaults', '.*', | |
196 | default=None, |
|
196 | default=None, | |
197 | generic=True, |
|
197 | generic=True, | |
198 | ) |
|
198 | ) | |
199 | coreconfigitem('devel', 'all-warnings', |
|
199 | coreconfigitem('devel', 'all-warnings', | |
200 | default=False, |
|
200 | default=False, | |
201 | ) |
|
201 | ) | |
202 | coreconfigitem('devel', 'bundle2.debug', |
|
202 | coreconfigitem('devel', 'bundle2.debug', | |
203 | default=False, |
|
203 | default=False, | |
204 | ) |
|
204 | ) | |
205 | coreconfigitem('devel', 'cache-vfs', |
|
205 | coreconfigitem('devel', 'cache-vfs', | |
206 | default=None, |
|
206 | default=None, | |
207 | ) |
|
207 | ) | |
208 | coreconfigitem('devel', 'check-locks', |
|
208 | coreconfigitem('devel', 'check-locks', | |
209 | default=False, |
|
209 | default=False, | |
210 | ) |
|
210 | ) | |
211 | coreconfigitem('devel', 'check-relroot', |
|
211 | coreconfigitem('devel', 'check-relroot', | |
212 | default=False, |
|
212 | default=False, | |
213 | ) |
|
213 | ) | |
214 | coreconfigitem('devel', 'default-date', |
|
214 | coreconfigitem('devel', 'default-date', | |
215 | default=None, |
|
215 | default=None, | |
216 | ) |
|
216 | ) | |
217 | coreconfigitem('devel', 'deprec-warn', |
|
217 | coreconfigitem('devel', 'deprec-warn', | |
218 | default=False, |
|
218 | default=False, | |
219 | ) |
|
219 | ) | |
220 | coreconfigitem('devel', 'disableloaddefaultcerts', |
|
220 | coreconfigitem('devel', 'disableloaddefaultcerts', | |
221 | default=False, |
|
221 | default=False, | |
222 | ) |
|
222 | ) | |
223 | coreconfigitem('devel', 'warn-empty-changegroup', |
|
223 | coreconfigitem('devel', 'warn-empty-changegroup', | |
224 | default=False, |
|
224 | default=False, | |
225 | ) |
|
225 | ) | |
226 | coreconfigitem('devel', 'legacy.exchange', |
|
226 | coreconfigitem('devel', 'legacy.exchange', | |
227 | default=list, |
|
227 | default=list, | |
228 | ) |
|
228 | ) | |
229 | coreconfigitem('devel', 'servercafile', |
|
229 | coreconfigitem('devel', 'servercafile', | |
230 | default='', |
|
230 | default='', | |
231 | ) |
|
231 | ) | |
232 | coreconfigitem('devel', 'serverexactprotocol', |
|
232 | coreconfigitem('devel', 'serverexactprotocol', | |
233 | default='', |
|
233 | default='', | |
234 | ) |
|
234 | ) | |
235 | coreconfigitem('devel', 'serverrequirecert', |
|
235 | coreconfigitem('devel', 'serverrequirecert', | |
236 | default=False, |
|
236 | default=False, | |
237 | ) |
|
237 | ) | |
238 | coreconfigitem('devel', 'strip-obsmarkers', |
|
238 | coreconfigitem('devel', 'strip-obsmarkers', | |
239 | default=True, |
|
239 | default=True, | |
240 | ) |
|
240 | ) | |
241 | coreconfigitem('devel', 'warn-config', |
|
241 | coreconfigitem('devel', 'warn-config', | |
242 | default=None, |
|
242 | default=None, | |
243 | ) |
|
243 | ) | |
244 | coreconfigitem('devel', 'warn-config-default', |
|
244 | coreconfigitem('devel', 'warn-config-default', | |
245 | default=None, |
|
245 | default=None, | |
246 | ) |
|
246 | ) | |
247 | coreconfigitem('devel', 'user.obsmarker', |
|
247 | coreconfigitem('devel', 'user.obsmarker', | |
248 | default=None, |
|
248 | default=None, | |
249 | ) |
|
249 | ) | |
250 | coreconfigitem('diff', 'nodates', |
|
250 | coreconfigitem('diff', 'nodates', | |
251 | default=False, |
|
251 | default=False, | |
252 | ) |
|
252 | ) | |
253 | coreconfigitem('diff', 'showfunc', |
|
253 | coreconfigitem('diff', 'showfunc', | |
254 | default=False, |
|
254 | default=False, | |
255 | ) |
|
255 | ) | |
256 | coreconfigitem('diff', 'unified', |
|
256 | coreconfigitem('diff', 'unified', | |
257 | default=None, |
|
257 | default=None, | |
258 | ) |
|
258 | ) | |
259 | coreconfigitem('diff', 'git', |
|
259 | coreconfigitem('diff', 'git', | |
260 | default=False, |
|
260 | default=False, | |
261 | ) |
|
261 | ) | |
262 | coreconfigitem('diff', 'ignorews', |
|
262 | coreconfigitem('diff', 'ignorews', | |
263 | default=False, |
|
263 | default=False, | |
264 | ) |
|
264 | ) | |
265 | coreconfigitem('diff', 'ignorewsamount', |
|
265 | coreconfigitem('diff', 'ignorewsamount', | |
266 | default=False, |
|
266 | default=False, | |
267 | ) |
|
267 | ) | |
268 | coreconfigitem('diff', 'ignoreblanklines', |
|
268 | coreconfigitem('diff', 'ignoreblanklines', | |
269 | default=False, |
|
269 | default=False, | |
270 | ) |
|
270 | ) | |
271 | coreconfigitem('diff', 'ignorewseol', |
|
271 | coreconfigitem('diff', 'ignorewseol', | |
272 | default=False, |
|
272 | default=False, | |
273 | ) |
|
273 | ) | |
274 | coreconfigitem('diff', 'nobinary', |
|
274 | coreconfigitem('diff', 'nobinary', | |
275 | default=False, |
|
275 | default=False, | |
276 | ) |
|
276 | ) | |
277 | coreconfigitem('diff', 'noprefix', |
|
277 | coreconfigitem('diff', 'noprefix', | |
278 | default=False, |
|
278 | default=False, | |
279 | ) |
|
279 | ) | |
280 | coreconfigitem('email', 'bcc', |
|
280 | coreconfigitem('email', 'bcc', | |
281 | default=None, |
|
281 | default=None, | |
282 | ) |
|
282 | ) | |
283 | coreconfigitem('email', 'cc', |
|
283 | coreconfigitem('email', 'cc', | |
284 | default=None, |
|
284 | default=None, | |
285 | ) |
|
285 | ) | |
286 | coreconfigitem('email', 'charsets', |
|
286 | coreconfigitem('email', 'charsets', | |
287 | default=list, |
|
287 | default=list, | |
288 | ) |
|
288 | ) | |
289 | coreconfigitem('email', 'from', |
|
289 | coreconfigitem('email', 'from', | |
290 | default=None, |
|
290 | default=None, | |
291 | ) |
|
291 | ) | |
292 | coreconfigitem('email', 'method', |
|
292 | coreconfigitem('email', 'method', | |
293 | default='smtp', |
|
293 | default='smtp', | |
294 | ) |
|
294 | ) | |
295 | coreconfigitem('email', 'reply-to', |
|
295 | coreconfigitem('email', 'reply-to', | |
296 | default=None, |
|
296 | default=None, | |
297 | ) |
|
297 | ) | |
298 | coreconfigitem('experimental', 'allowdivergence', |
|
298 | coreconfigitem('experimental', 'allowdivergence', | |
299 | default=False, |
|
299 | default=False, | |
300 | ) |
|
300 | ) | |
301 | coreconfigitem('experimental', 'archivemetatemplate', |
|
301 | coreconfigitem('experimental', 'archivemetatemplate', | |
302 | default=dynamicdefault, |
|
302 | default=dynamicdefault, | |
303 | ) |
|
303 | ) | |
304 | coreconfigitem('experimental', 'bundle-phases', |
|
304 | coreconfigitem('experimental', 'bundle-phases', | |
305 | default=False, |
|
305 | default=False, | |
306 | ) |
|
306 | ) | |
307 | coreconfigitem('experimental', 'bundle2-advertise', |
|
307 | coreconfigitem('experimental', 'bundle2-advertise', | |
308 | default=True, |
|
308 | default=True, | |
309 | ) |
|
309 | ) | |
310 | coreconfigitem('experimental', 'bundle2-output-capture', |
|
310 | coreconfigitem('experimental', 'bundle2-output-capture', | |
311 | default=False, |
|
311 | default=False, | |
312 | ) |
|
312 | ) | |
313 | coreconfigitem('experimental', 'bundle2.pushback', |
|
313 | coreconfigitem('experimental', 'bundle2.pushback', | |
314 | default=False, |
|
314 | default=False, | |
315 | ) |
|
315 | ) | |
316 | coreconfigitem('experimental', 'bundle2lazylocking', |
|
316 | coreconfigitem('experimental', 'bundle2lazylocking', | |
317 | default=False, |
|
317 | default=False, | |
318 | ) |
|
318 | ) | |
319 | coreconfigitem('experimental', 'bundlecomplevel', |
|
319 | coreconfigitem('experimental', 'bundlecomplevel', | |
320 | default=None, |
|
320 | default=None, | |
321 | ) |
|
321 | ) | |
322 | coreconfigitem('experimental', 'changegroup3', |
|
322 | coreconfigitem('experimental', 'changegroup3', | |
323 | default=False, |
|
323 | default=False, | |
324 | ) |
|
324 | ) | |
325 | coreconfigitem('experimental', 'clientcompressionengines', |
|
325 | coreconfigitem('experimental', 'clientcompressionengines', | |
326 | default=list, |
|
326 | default=list, | |
327 | ) |
|
327 | ) | |
328 | coreconfigitem('experimental', 'copytrace', |
|
328 | coreconfigitem('experimental', 'copytrace', | |
329 | default='on', |
|
329 | default='on', | |
330 | ) |
|
330 | ) | |
331 | coreconfigitem('experimental', 'copytrace.sourcecommitlimit', |
|
331 | coreconfigitem('experimental', 'copytrace.sourcecommitlimit', | |
332 | default=100, |
|
332 | default=100, | |
333 | ) |
|
333 | ) | |
334 | coreconfigitem('experimental', 'crecordtest', |
|
334 | coreconfigitem('experimental', 'crecordtest', | |
335 | default=None, |
|
335 | default=None, | |
336 | ) |
|
336 | ) | |
337 | coreconfigitem('experimental', 'editortmpinhg', |
|
337 | coreconfigitem('experimental', 'editortmpinhg', | |
338 | default=False, |
|
338 | default=False, | |
339 | ) |
|
339 | ) | |
340 | coreconfigitem('experimental', 'maxdeltachainspan', |
|
340 | coreconfigitem('experimental', 'maxdeltachainspan', | |
341 | default=-1, |
|
341 | default=-1, | |
342 | ) |
|
342 | ) | |
343 | coreconfigitem('experimental', 'mmapindexthreshold', |
|
343 | coreconfigitem('experimental', 'mmapindexthreshold', | |
344 | default=None, |
|
344 | default=None, | |
345 | ) |
|
345 | ) | |
346 | coreconfigitem('experimental', 'nonnormalparanoidcheck', |
|
346 | coreconfigitem('experimental', 'nonnormalparanoidcheck', | |
347 | default=False, |
|
347 | default=False, | |
348 | ) |
|
348 | ) | |
349 | coreconfigitem('experimental', 'stabilization', |
|
349 | coreconfigitem('experimental', 'stabilization', | |
350 | default=list, |
|
350 | default=list, | |
351 | alias=[('experimental', 'evolution')], |
|
351 | alias=[('experimental', 'evolution')], | |
352 | ) |
|
352 | ) | |
353 | coreconfigitem('experimental', 'stabilization.bundle-obsmarker', |
|
353 | coreconfigitem('experimental', 'stabilization.bundle-obsmarker', | |
354 | default=False, |
|
354 | default=False, | |
355 | alias=[('experimental', 'evolution.bundle-obsmarker')], |
|
355 | alias=[('experimental', 'evolution.bundle-obsmarker')], | |
356 | ) |
|
356 | ) | |
357 | coreconfigitem('experimental', 'stabilization.track-operation', |
|
357 | coreconfigitem('experimental', 'stabilization.track-operation', | |
358 | default=True, |
|
358 | default=True, | |
359 | alias=[('experimental', 'evolution.track-operation')] |
|
359 | alias=[('experimental', 'evolution.track-operation')] | |
360 | ) |
|
360 | ) | |
361 | coreconfigitem('experimental', 'exportableenviron', |
|
361 | coreconfigitem('experimental', 'exportableenviron', | |
362 | default=list, |
|
362 | default=list, | |
363 | ) |
|
363 | ) | |
364 | coreconfigitem('experimental', 'extendedheader.index', |
|
364 | coreconfigitem('experimental', 'extendedheader.index', | |
365 | default=None, |
|
365 | default=None, | |
366 | ) |
|
366 | ) | |
367 | coreconfigitem('experimental', 'extendedheader.similarity', |
|
367 | coreconfigitem('experimental', 'extendedheader.similarity', | |
368 | default=False, |
|
368 | default=False, | |
369 | ) |
|
369 | ) | |
370 | coreconfigitem('experimental', 'format.compression', |
|
370 | coreconfigitem('experimental', 'format.compression', | |
371 | default='zlib', |
|
371 | default='zlib', | |
372 | ) |
|
372 | ) | |
373 | coreconfigitem('experimental', 'graphshorten', |
|
373 | coreconfigitem('experimental', 'graphshorten', | |
374 | default=False, |
|
374 | default=False, | |
375 | ) |
|
375 | ) | |
376 | coreconfigitem('experimental', 'graphstyle.parent', |
|
376 | coreconfigitem('experimental', 'graphstyle.parent', | |
377 | default=dynamicdefault, |
|
377 | default=dynamicdefault, | |
378 | ) |
|
378 | ) | |
379 | coreconfigitem('experimental', 'graphstyle.missing', |
|
379 | coreconfigitem('experimental', 'graphstyle.missing', | |
380 | default=dynamicdefault, |
|
380 | default=dynamicdefault, | |
381 | ) |
|
381 | ) | |
382 | coreconfigitem('experimental', 'graphstyle.grandparent', |
|
382 | coreconfigitem('experimental', 'graphstyle.grandparent', | |
383 | default=dynamicdefault, |
|
383 | default=dynamicdefault, | |
384 | ) |
|
384 | ) | |
385 | coreconfigitem('experimental', 'hook-track-tags', |
|
385 | coreconfigitem('experimental', 'hook-track-tags', | |
386 | default=False, |
|
386 | default=False, | |
387 | ) |
|
387 | ) | |
388 | coreconfigitem('experimental', 'httppostargs', |
|
388 | coreconfigitem('experimental', 'httppostargs', | |
389 | default=False, |
|
389 | default=False, | |
390 | ) |
|
390 | ) | |
391 | coreconfigitem('experimental', 'manifestv2', |
|
391 | coreconfigitem('experimental', 'manifestv2', | |
392 | default=False, |
|
392 | default=False, | |
393 | ) |
|
393 | ) | |
394 | coreconfigitem('experimental', 'mergedriver', |
|
394 | coreconfigitem('experimental', 'mergedriver', | |
395 | default=None, |
|
395 | default=None, | |
396 | ) |
|
396 | ) | |
397 | coreconfigitem('experimental', 'obsmarkers-exchange-debug', |
|
397 | coreconfigitem('experimental', 'obsmarkers-exchange-debug', | |
398 | default=False, |
|
398 | default=False, | |
399 | ) |
|
399 | ) | |
400 | coreconfigitem('experimental', 'rebase.multidest', |
|
400 | coreconfigitem('experimental', 'rebase.multidest', | |
401 | default=False, |
|
401 | default=False, | |
402 | ) |
|
402 | ) | |
403 | coreconfigitem('experimental', 'revertalternateinteractivemode', |
|
403 | coreconfigitem('experimental', 'revertalternateinteractivemode', | |
404 | default=True, |
|
404 | default=True, | |
405 | ) |
|
405 | ) | |
406 | coreconfigitem('experimental', 'revlogv2', |
|
406 | coreconfigitem('experimental', 'revlogv2', | |
407 | default=None, |
|
407 | default=None, | |
408 | ) |
|
408 | ) | |
409 | coreconfigitem('experimental', 'spacemovesdown', |
|
409 | coreconfigitem('experimental', 'spacemovesdown', | |
410 | default=False, |
|
410 | default=False, | |
411 | ) |
|
411 | ) | |
412 | coreconfigitem('experimental', 'treemanifest', |
|
412 | coreconfigitem('experimental', 'treemanifest', | |
413 | default=False, |
|
413 | default=False, | |
414 | ) |
|
414 | ) | |
415 | # Deprecated, remove after 4.4 release |
|
415 | # Deprecated, remove after 4.4 release | |
416 | coreconfigitem('experimental', 'updatecheck', |
|
416 | coreconfigitem('experimental', 'updatecheck', | |
417 | default=None, |
|
417 | default=None, | |
418 | ) |
|
418 | ) | |
419 | coreconfigitem('extensions', '.*', |
|
419 | coreconfigitem('extensions', '.*', | |
420 | default=None, |
|
420 | default=None, | |
421 | generic=True, |
|
421 | generic=True, | |
422 | ) |
|
422 | ) | |
423 | coreconfigitem('format', 'aggressivemergedeltas', |
|
423 | coreconfigitem('format', 'aggressivemergedeltas', | |
424 | default=False, |
|
424 | default=False, | |
425 | ) |
|
425 | ) | |
426 | coreconfigitem('format', 'chunkcachesize', |
|
426 | coreconfigitem('format', 'chunkcachesize', | |
427 | default=None, |
|
427 | default=None, | |
428 | ) |
|
428 | ) | |
429 | coreconfigitem('format', 'dotencode', |
|
429 | coreconfigitem('format', 'dotencode', | |
430 | default=True, |
|
430 | default=True, | |
431 | ) |
|
431 | ) | |
432 | coreconfigitem('format', 'generaldelta', |
|
432 | coreconfigitem('format', 'generaldelta', | |
433 | default=False, |
|
433 | default=False, | |
434 | ) |
|
434 | ) | |
435 | coreconfigitem('format', 'manifestcachesize', |
|
435 | coreconfigitem('format', 'manifestcachesize', | |
436 | default=None, |
|
436 | default=None, | |
437 | ) |
|
437 | ) | |
438 | coreconfigitem('format', 'maxchainlen', |
|
438 | coreconfigitem('format', 'maxchainlen', | |
439 | default=None, |
|
439 | default=None, | |
440 | ) |
|
440 | ) | |
441 | coreconfigitem('format', 'obsstore-version', |
|
441 | coreconfigitem('format', 'obsstore-version', | |
442 | default=None, |
|
442 | default=None, | |
443 | ) |
|
443 | ) | |
444 | coreconfigitem('format', 'usefncache', |
|
444 | coreconfigitem('format', 'usefncache', | |
445 | default=True, |
|
445 | default=True, | |
446 | ) |
|
446 | ) | |
447 | coreconfigitem('format', 'usegeneraldelta', |
|
447 | coreconfigitem('format', 'usegeneraldelta', | |
448 | default=True, |
|
448 | default=True, | |
449 | ) |
|
449 | ) | |
450 | coreconfigitem('format', 'usestore', |
|
450 | coreconfigitem('format', 'usestore', | |
451 | default=True, |
|
451 | default=True, | |
452 | ) |
|
452 | ) | |
453 | coreconfigitem('hooks', '.*', |
|
453 | coreconfigitem('hooks', '.*', | |
454 | default=dynamicdefault, |
|
454 | default=dynamicdefault, | |
455 | generic=True, |
|
455 | generic=True, | |
456 | ) |
|
456 | ) | |
457 | coreconfigitem('hostsecurity', 'ciphers', |
|
457 | coreconfigitem('hostsecurity', 'ciphers', | |
458 | default=None, |
|
458 | default=None, | |
459 | ) |
|
459 | ) | |
460 | coreconfigitem('hostsecurity', 'disabletls10warning', |
|
460 | coreconfigitem('hostsecurity', 'disabletls10warning', | |
461 | default=False, |
|
461 | default=False, | |
462 | ) |
|
462 | ) | |
463 | coreconfigitem('http_proxy', 'always', |
|
463 | coreconfigitem('http_proxy', 'always', | |
464 | default=False, |
|
464 | default=False, | |
465 | ) |
|
465 | ) | |
466 | coreconfigitem('http_proxy', 'host', |
|
466 | coreconfigitem('http_proxy', 'host', | |
467 | default=None, |
|
467 | default=None, | |
468 | ) |
|
468 | ) | |
469 | coreconfigitem('http_proxy', 'no', |
|
469 | coreconfigitem('http_proxy', 'no', | |
470 | default=list, |
|
470 | default=list, | |
471 | ) |
|
471 | ) | |
472 | coreconfigitem('http_proxy', 'passwd', |
|
472 | coreconfigitem('http_proxy', 'passwd', | |
473 | default=None, |
|
473 | default=None, | |
474 | ) |
|
474 | ) | |
475 | coreconfigitem('http_proxy', 'user', |
|
475 | coreconfigitem('http_proxy', 'user', | |
476 | default=None, |
|
476 | default=None, | |
477 | ) |
|
477 | ) | |
478 | coreconfigitem('logtoprocess', 'commandexception', |
|
478 | coreconfigitem('logtoprocess', 'commandexception', | |
479 | default=None, |
|
479 | default=None, | |
480 | ) |
|
480 | ) | |
481 | coreconfigitem('logtoprocess', 'commandfinish', |
|
481 | coreconfigitem('logtoprocess', 'commandfinish', | |
482 | default=None, |
|
482 | default=None, | |
483 | ) |
|
483 | ) | |
484 | coreconfigitem('logtoprocess', 'command', |
|
484 | coreconfigitem('logtoprocess', 'command', | |
485 | default=None, |
|
485 | default=None, | |
486 | ) |
|
486 | ) | |
487 | coreconfigitem('logtoprocess', 'develwarn', |
|
487 | coreconfigitem('logtoprocess', 'develwarn', | |
488 | default=None, |
|
488 | default=None, | |
489 | ) |
|
489 | ) | |
490 | coreconfigitem('logtoprocess', 'uiblocked', |
|
490 | coreconfigitem('logtoprocess', 'uiblocked', | |
491 | default=None, |
|
491 | default=None, | |
492 | ) |
|
492 | ) | |
493 | coreconfigitem('merge', 'checkunknown', |
|
493 | coreconfigitem('merge', 'checkunknown', | |
494 | default='abort', |
|
494 | default='abort', | |
495 | ) |
|
495 | ) | |
496 | coreconfigitem('merge', 'checkignored', |
|
496 | coreconfigitem('merge', 'checkignored', | |
497 | default='abort', |
|
497 | default='abort', | |
498 | ) |
|
498 | ) | |
499 | coreconfigitem('merge', 'followcopies', |
|
499 | coreconfigitem('merge', 'followcopies', | |
500 | default=True, |
|
500 | default=True, | |
501 | ) |
|
501 | ) | |
502 | coreconfigitem('merge', 'preferancestor', |
|
502 | coreconfigitem('merge', 'preferancestor', | |
503 | default=lambda: ['*'], |
|
503 | default=lambda: ['*'], | |
504 | ) |
|
504 | ) | |
505 | coreconfigitem('pager', 'attend-.*', |
|
505 | coreconfigitem('pager', 'attend-.*', | |
506 | default=dynamicdefault, |
|
506 | default=dynamicdefault, | |
507 | generic=True, |
|
507 | generic=True, | |
508 | ) |
|
508 | ) | |
509 | coreconfigitem('pager', 'ignore', |
|
509 | coreconfigitem('pager', 'ignore', | |
510 | default=list, |
|
510 | default=list, | |
511 | ) |
|
511 | ) | |
512 | coreconfigitem('pager', 'pager', |
|
512 | coreconfigitem('pager', 'pager', | |
513 | default=dynamicdefault, |
|
513 | default=dynamicdefault, | |
514 | ) |
|
514 | ) | |
515 | coreconfigitem('patch', 'eol', |
|
515 | coreconfigitem('patch', 'eol', | |
516 | default='strict', |
|
516 | default='strict', | |
517 | ) |
|
517 | ) | |
518 | coreconfigitem('patch', 'fuzz', |
|
518 | coreconfigitem('patch', 'fuzz', | |
519 | default=2, |
|
519 | default=2, | |
520 | ) |
|
520 | ) | |
521 | coreconfigitem('paths', 'default', |
|
521 | coreconfigitem('paths', 'default', | |
522 | default=None, |
|
522 | default=None, | |
523 | ) |
|
523 | ) | |
524 | coreconfigitem('paths', 'default-push', |
|
524 | coreconfigitem('paths', 'default-push', | |
525 | default=None, |
|
525 | default=None, | |
526 | ) |
|
526 | ) | |
527 | coreconfigitem('paths', '.*', |
|
527 | coreconfigitem('paths', '.*', | |
528 | default=None, |
|
528 | default=None, | |
529 | generic=True, |
|
529 | generic=True, | |
530 | ) |
|
530 | ) | |
531 | coreconfigitem('phases', 'checksubrepos', |
|
531 | coreconfigitem('phases', 'checksubrepos', | |
532 | default='follow', |
|
532 | default='follow', | |
533 | ) |
|
533 | ) | |
534 | coreconfigitem('phases', 'new-commit', |
|
534 | coreconfigitem('phases', 'new-commit', | |
535 | default='draft', |
|
535 | default='draft', | |
536 | ) |
|
536 | ) | |
537 | coreconfigitem('phases', 'publish', |
|
537 | coreconfigitem('phases', 'publish', | |
538 | default=True, |
|
538 | default=True, | |
539 | ) |
|
539 | ) | |
540 | coreconfigitem('profiling', 'enabled', |
|
540 | coreconfigitem('profiling', 'enabled', | |
541 | default=False, |
|
541 | default=False, | |
542 | ) |
|
542 | ) | |
543 | coreconfigitem('profiling', 'format', |
|
543 | coreconfigitem('profiling', 'format', | |
544 | default='text', |
|
544 | default='text', | |
545 | ) |
|
545 | ) | |
546 | coreconfigitem('profiling', 'freq', |
|
546 | coreconfigitem('profiling', 'freq', | |
547 | default=1000, |
|
547 | default=1000, | |
548 | ) |
|
548 | ) | |
549 | coreconfigitem('profiling', 'limit', |
|
549 | coreconfigitem('profiling', 'limit', | |
550 | default=30, |
|
550 | default=30, | |
551 | ) |
|
551 | ) | |
552 | coreconfigitem('profiling', 'nested', |
|
552 | coreconfigitem('profiling', 'nested', | |
553 | default=0, |
|
553 | default=0, | |
554 | ) |
|
554 | ) | |
555 | coreconfigitem('profiling', 'output', |
|
555 | coreconfigitem('profiling', 'output', | |
556 | default=None, |
|
556 | default=None, | |
557 | ) |
|
557 | ) | |
558 | coreconfigitem('profiling', 'showmax', |
|
558 | coreconfigitem('profiling', 'showmax', | |
559 | default=0.999, |
|
559 | default=0.999, | |
560 | ) |
|
560 | ) | |
561 | coreconfigitem('profiling', 'showmin', |
|
561 | coreconfigitem('profiling', 'showmin', | |
562 | default=dynamicdefault, |
|
562 | default=dynamicdefault, | |
563 | ) |
|
563 | ) | |
564 | coreconfigitem('profiling', 'sort', |
|
564 | coreconfigitem('profiling', 'sort', | |
565 | default='inlinetime', |
|
565 | default='inlinetime', | |
566 | ) |
|
566 | ) | |
567 | coreconfigitem('profiling', 'statformat', |
|
567 | coreconfigitem('profiling', 'statformat', | |
568 | default='hotpath', |
|
568 | default='hotpath', | |
569 | ) |
|
569 | ) | |
570 | coreconfigitem('profiling', 'type', |
|
570 | coreconfigitem('profiling', 'type', | |
571 | default='stat', |
|
571 | default='stat', | |
572 | ) |
|
572 | ) | |
573 | coreconfigitem('progress', 'assume-tty', |
|
573 | coreconfigitem('progress', 'assume-tty', | |
574 | default=False, |
|
574 | default=False, | |
575 | ) |
|
575 | ) | |
576 | coreconfigitem('progress', 'changedelay', |
|
576 | coreconfigitem('progress', 'changedelay', | |
577 | default=1, |
|
577 | default=1, | |
578 | ) |
|
578 | ) | |
579 | coreconfigitem('progress', 'clear-complete', |
|
579 | coreconfigitem('progress', 'clear-complete', | |
580 | default=True, |
|
580 | default=True, | |
581 | ) |
|
581 | ) | |
582 | coreconfigitem('progress', 'debug', |
|
582 | coreconfigitem('progress', 'debug', | |
583 | default=False, |
|
583 | default=False, | |
584 | ) |
|
584 | ) | |
585 | coreconfigitem('progress', 'delay', |
|
585 | coreconfigitem('progress', 'delay', | |
586 | default=3, |
|
586 | default=3, | |
587 | ) |
|
587 | ) | |
588 | coreconfigitem('progress', 'disable', |
|
588 | coreconfigitem('progress', 'disable', | |
589 | default=False, |
|
589 | default=False, | |
590 | ) |
|
590 | ) | |
591 | coreconfigitem('progress', 'estimateinterval', |
|
591 | coreconfigitem('progress', 'estimateinterval', | |
592 | default=60.0, |
|
592 | default=60.0, | |
593 | ) |
|
593 | ) | |
|
594 | coreconfigitem('progress', 'format', | |||
|
595 | default=lambda: ['topic', 'bar', 'number', 'estimate'], | |||
|
596 | ) | |||
594 | coreconfigitem('progress', 'refresh', |
|
597 | coreconfigitem('progress', 'refresh', | |
595 | default=0.1, |
|
598 | default=0.1, | |
596 | ) |
|
599 | ) | |
597 | coreconfigitem('progress', 'width', |
|
600 | coreconfigitem('progress', 'width', | |
598 | default=dynamicdefault, |
|
601 | default=dynamicdefault, | |
599 | ) |
|
602 | ) | |
600 | coreconfigitem('push', 'pushvars.server', |
|
603 | coreconfigitem('push', 'pushvars.server', | |
601 | default=False, |
|
604 | default=False, | |
602 | ) |
|
605 | ) | |
603 | coreconfigitem('server', 'bundle1', |
|
606 | coreconfigitem('server', 'bundle1', | |
604 | default=True, |
|
607 | default=True, | |
605 | ) |
|
608 | ) | |
606 | coreconfigitem('server', 'bundle1gd', |
|
609 | coreconfigitem('server', 'bundle1gd', | |
607 | default=None, |
|
610 | default=None, | |
608 | ) |
|
611 | ) | |
609 | coreconfigitem('server', 'bundle1.pull', |
|
612 | coreconfigitem('server', 'bundle1.pull', | |
610 | default=None, |
|
613 | default=None, | |
611 | ) |
|
614 | ) | |
612 | coreconfigitem('server', 'bundle1gd.pull', |
|
615 | coreconfigitem('server', 'bundle1gd.pull', | |
613 | default=None, |
|
616 | default=None, | |
614 | ) |
|
617 | ) | |
615 | coreconfigitem('server', 'bundle1.push', |
|
618 | coreconfigitem('server', 'bundle1.push', | |
616 | default=None, |
|
619 | default=None, | |
617 | ) |
|
620 | ) | |
618 | coreconfigitem('server', 'bundle1gd.push', |
|
621 | coreconfigitem('server', 'bundle1gd.push', | |
619 | default=None, |
|
622 | default=None, | |
620 | ) |
|
623 | ) | |
621 | coreconfigitem('server', 'compressionengines', |
|
624 | coreconfigitem('server', 'compressionengines', | |
622 | default=list, |
|
625 | default=list, | |
623 | ) |
|
626 | ) | |
624 | coreconfigitem('server', 'concurrent-push-mode', |
|
627 | coreconfigitem('server', 'concurrent-push-mode', | |
625 | default='strict', |
|
628 | default='strict', | |
626 | ) |
|
629 | ) | |
627 | coreconfigitem('server', 'disablefullbundle', |
|
630 | coreconfigitem('server', 'disablefullbundle', | |
628 | default=False, |
|
631 | default=False, | |
629 | ) |
|
632 | ) | |
630 | coreconfigitem('server', 'maxhttpheaderlen', |
|
633 | coreconfigitem('server', 'maxhttpheaderlen', | |
631 | default=1024, |
|
634 | default=1024, | |
632 | ) |
|
635 | ) | |
633 | coreconfigitem('server', 'preferuncompressed', |
|
636 | coreconfigitem('server', 'preferuncompressed', | |
634 | default=False, |
|
637 | default=False, | |
635 | ) |
|
638 | ) | |
636 | coreconfigitem('server', 'uncompressed', |
|
639 | coreconfigitem('server', 'uncompressed', | |
637 | default=True, |
|
640 | default=True, | |
638 | ) |
|
641 | ) | |
639 | coreconfigitem('server', 'uncompressedallowsecret', |
|
642 | coreconfigitem('server', 'uncompressedallowsecret', | |
640 | default=False, |
|
643 | default=False, | |
641 | ) |
|
644 | ) | |
642 | coreconfigitem('server', 'validate', |
|
645 | coreconfigitem('server', 'validate', | |
643 | default=False, |
|
646 | default=False, | |
644 | ) |
|
647 | ) | |
645 | coreconfigitem('server', 'zliblevel', |
|
648 | coreconfigitem('server', 'zliblevel', | |
646 | default=-1, |
|
649 | default=-1, | |
647 | ) |
|
650 | ) | |
648 | coreconfigitem('smtp', 'host', |
|
651 | coreconfigitem('smtp', 'host', | |
649 | default=None, |
|
652 | default=None, | |
650 | ) |
|
653 | ) | |
651 | coreconfigitem('smtp', 'local_hostname', |
|
654 | coreconfigitem('smtp', 'local_hostname', | |
652 | default=None, |
|
655 | default=None, | |
653 | ) |
|
656 | ) | |
654 | coreconfigitem('smtp', 'password', |
|
657 | coreconfigitem('smtp', 'password', | |
655 | default=None, |
|
658 | default=None, | |
656 | ) |
|
659 | ) | |
657 | coreconfigitem('smtp', 'port', |
|
660 | coreconfigitem('smtp', 'port', | |
658 | default=dynamicdefault, |
|
661 | default=dynamicdefault, | |
659 | ) |
|
662 | ) | |
660 | coreconfigitem('smtp', 'tls', |
|
663 | coreconfigitem('smtp', 'tls', | |
661 | default='none', |
|
664 | default='none', | |
662 | ) |
|
665 | ) | |
663 | coreconfigitem('smtp', 'username', |
|
666 | coreconfigitem('smtp', 'username', | |
664 | default=None, |
|
667 | default=None, | |
665 | ) |
|
668 | ) | |
666 | coreconfigitem('sparse', 'missingwarning', |
|
669 | coreconfigitem('sparse', 'missingwarning', | |
667 | default=True, |
|
670 | default=True, | |
668 | ) |
|
671 | ) | |
669 | coreconfigitem('templates', '.*', |
|
672 | coreconfigitem('templates', '.*', | |
670 | default=None, |
|
673 | default=None, | |
671 | generic=True, |
|
674 | generic=True, | |
672 | ) |
|
675 | ) | |
673 | coreconfigitem('trusted', 'groups', |
|
676 | coreconfigitem('trusted', 'groups', | |
674 | default=list, |
|
677 | default=list, | |
675 | ) |
|
678 | ) | |
676 | coreconfigitem('trusted', 'users', |
|
679 | coreconfigitem('trusted', 'users', | |
677 | default=list, |
|
680 | default=list, | |
678 | ) |
|
681 | ) | |
679 | coreconfigitem('ui', '_usedassubrepo', |
|
682 | coreconfigitem('ui', '_usedassubrepo', | |
680 | default=False, |
|
683 | default=False, | |
681 | ) |
|
684 | ) | |
682 | coreconfigitem('ui', 'allowemptycommit', |
|
685 | coreconfigitem('ui', 'allowemptycommit', | |
683 | default=False, |
|
686 | default=False, | |
684 | ) |
|
687 | ) | |
685 | coreconfigitem('ui', 'archivemeta', |
|
688 | coreconfigitem('ui', 'archivemeta', | |
686 | default=True, |
|
689 | default=True, | |
687 | ) |
|
690 | ) | |
688 | coreconfigitem('ui', 'askusername', |
|
691 | coreconfigitem('ui', 'askusername', | |
689 | default=False, |
|
692 | default=False, | |
690 | ) |
|
693 | ) | |
691 | coreconfigitem('ui', 'clonebundlefallback', |
|
694 | coreconfigitem('ui', 'clonebundlefallback', | |
692 | default=False, |
|
695 | default=False, | |
693 | ) |
|
696 | ) | |
694 | coreconfigitem('ui', 'clonebundleprefers', |
|
697 | coreconfigitem('ui', 'clonebundleprefers', | |
695 | default=list, |
|
698 | default=list, | |
696 | ) |
|
699 | ) | |
697 | coreconfigitem('ui', 'clonebundles', |
|
700 | coreconfigitem('ui', 'clonebundles', | |
698 | default=True, |
|
701 | default=True, | |
699 | ) |
|
702 | ) | |
700 | coreconfigitem('ui', 'color', |
|
703 | coreconfigitem('ui', 'color', | |
701 | default='auto', |
|
704 | default='auto', | |
702 | ) |
|
705 | ) | |
703 | coreconfigitem('ui', 'commitsubrepos', |
|
706 | coreconfigitem('ui', 'commitsubrepos', | |
704 | default=False, |
|
707 | default=False, | |
705 | ) |
|
708 | ) | |
706 | coreconfigitem('ui', 'debug', |
|
709 | coreconfigitem('ui', 'debug', | |
707 | default=False, |
|
710 | default=False, | |
708 | ) |
|
711 | ) | |
709 | coreconfigitem('ui', 'debugger', |
|
712 | coreconfigitem('ui', 'debugger', | |
710 | default=None, |
|
713 | default=None, | |
711 | ) |
|
714 | ) | |
712 | coreconfigitem('ui', 'fallbackencoding', |
|
715 | coreconfigitem('ui', 'fallbackencoding', | |
713 | default=None, |
|
716 | default=None, | |
714 | ) |
|
717 | ) | |
715 | coreconfigitem('ui', 'forcecwd', |
|
718 | coreconfigitem('ui', 'forcecwd', | |
716 | default=None, |
|
719 | default=None, | |
717 | ) |
|
720 | ) | |
718 | coreconfigitem('ui', 'forcemerge', |
|
721 | coreconfigitem('ui', 'forcemerge', | |
719 | default=None, |
|
722 | default=None, | |
720 | ) |
|
723 | ) | |
721 | coreconfigitem('ui', 'formatdebug', |
|
724 | coreconfigitem('ui', 'formatdebug', | |
722 | default=False, |
|
725 | default=False, | |
723 | ) |
|
726 | ) | |
724 | coreconfigitem('ui', 'formatjson', |
|
727 | coreconfigitem('ui', 'formatjson', | |
725 | default=False, |
|
728 | default=False, | |
726 | ) |
|
729 | ) | |
727 | coreconfigitem('ui', 'formatted', |
|
730 | coreconfigitem('ui', 'formatted', | |
728 | default=None, |
|
731 | default=None, | |
729 | ) |
|
732 | ) | |
730 | coreconfigitem('ui', 'graphnodetemplate', |
|
733 | coreconfigitem('ui', 'graphnodetemplate', | |
731 | default=None, |
|
734 | default=None, | |
732 | ) |
|
735 | ) | |
733 | coreconfigitem('ui', 'http2debuglevel', |
|
736 | coreconfigitem('ui', 'http2debuglevel', | |
734 | default=None, |
|
737 | default=None, | |
735 | ) |
|
738 | ) | |
736 | coreconfigitem('ui', 'interactive', |
|
739 | coreconfigitem('ui', 'interactive', | |
737 | default=None, |
|
740 | default=None, | |
738 | ) |
|
741 | ) | |
739 | coreconfigitem('ui', 'interface', |
|
742 | coreconfigitem('ui', 'interface', | |
740 | default=None, |
|
743 | default=None, | |
741 | ) |
|
744 | ) | |
742 | coreconfigitem('ui', 'interface.chunkselector', |
|
745 | coreconfigitem('ui', 'interface.chunkselector', | |
743 | default=None, |
|
746 | default=None, | |
744 | ) |
|
747 | ) | |
745 | coreconfigitem('ui', 'logblockedtimes', |
|
748 | coreconfigitem('ui', 'logblockedtimes', | |
746 | default=False, |
|
749 | default=False, | |
747 | ) |
|
750 | ) | |
748 | coreconfigitem('ui', 'logtemplate', |
|
751 | coreconfigitem('ui', 'logtemplate', | |
749 | default=None, |
|
752 | default=None, | |
750 | ) |
|
753 | ) | |
751 | coreconfigitem('ui', 'merge', |
|
754 | coreconfigitem('ui', 'merge', | |
752 | default=None, |
|
755 | default=None, | |
753 | ) |
|
756 | ) | |
754 | coreconfigitem('ui', 'mergemarkers', |
|
757 | coreconfigitem('ui', 'mergemarkers', | |
755 | default='basic', |
|
758 | default='basic', | |
756 | ) |
|
759 | ) | |
757 | coreconfigitem('ui', 'mergemarkertemplate', |
|
760 | coreconfigitem('ui', 'mergemarkertemplate', | |
758 | default=('{node|short} ' |
|
761 | default=('{node|short} ' | |
759 | '{ifeq(tags, "tip", "", ' |
|
762 | '{ifeq(tags, "tip", "", ' | |
760 | 'ifeq(tags, "", "", "{tags} "))}' |
|
763 | 'ifeq(tags, "", "", "{tags} "))}' | |
761 | '{if(bookmarks, "{bookmarks} ")}' |
|
764 | '{if(bookmarks, "{bookmarks} ")}' | |
762 | '{ifeq(branch, "default", "", "{branch} ")}' |
|
765 | '{ifeq(branch, "default", "", "{branch} ")}' | |
763 | '- {author|user}: {desc|firstline}') |
|
766 | '- {author|user}: {desc|firstline}') | |
764 | ) |
|
767 | ) | |
765 | coreconfigitem('ui', 'nontty', |
|
768 | coreconfigitem('ui', 'nontty', | |
766 | default=False, |
|
769 | default=False, | |
767 | ) |
|
770 | ) | |
768 | coreconfigitem('ui', 'origbackuppath', |
|
771 | coreconfigitem('ui', 'origbackuppath', | |
769 | default=None, |
|
772 | default=None, | |
770 | ) |
|
773 | ) | |
771 | coreconfigitem('ui', 'paginate', |
|
774 | coreconfigitem('ui', 'paginate', | |
772 | default=True, |
|
775 | default=True, | |
773 | ) |
|
776 | ) | |
774 | coreconfigitem('ui', 'patch', |
|
777 | coreconfigitem('ui', 'patch', | |
775 | default=None, |
|
778 | default=None, | |
776 | ) |
|
779 | ) | |
777 | coreconfigitem('ui', 'portablefilenames', |
|
780 | coreconfigitem('ui', 'portablefilenames', | |
778 | default='warn', |
|
781 | default='warn', | |
779 | ) |
|
782 | ) | |
780 | coreconfigitem('ui', 'promptecho', |
|
783 | coreconfigitem('ui', 'promptecho', | |
781 | default=False, |
|
784 | default=False, | |
782 | ) |
|
785 | ) | |
783 | coreconfigitem('ui', 'quiet', |
|
786 | coreconfigitem('ui', 'quiet', | |
784 | default=False, |
|
787 | default=False, | |
785 | ) |
|
788 | ) | |
786 | coreconfigitem('ui', 'quietbookmarkmove', |
|
789 | coreconfigitem('ui', 'quietbookmarkmove', | |
787 | default=False, |
|
790 | default=False, | |
788 | ) |
|
791 | ) | |
789 | coreconfigitem('ui', 'remotecmd', |
|
792 | coreconfigitem('ui', 'remotecmd', | |
790 | default='hg', |
|
793 | default='hg', | |
791 | ) |
|
794 | ) | |
792 | coreconfigitem('ui', 'report_untrusted', |
|
795 | coreconfigitem('ui', 'report_untrusted', | |
793 | default=True, |
|
796 | default=True, | |
794 | ) |
|
797 | ) | |
795 | coreconfigitem('ui', 'rollback', |
|
798 | coreconfigitem('ui', 'rollback', | |
796 | default=True, |
|
799 | default=True, | |
797 | ) |
|
800 | ) | |
798 | coreconfigitem('ui', 'slash', |
|
801 | coreconfigitem('ui', 'slash', | |
799 | default=False, |
|
802 | default=False, | |
800 | ) |
|
803 | ) | |
801 | coreconfigitem('ui', 'ssh', |
|
804 | coreconfigitem('ui', 'ssh', | |
802 | default='ssh', |
|
805 | default='ssh', | |
803 | ) |
|
806 | ) | |
804 | coreconfigitem('ui', 'statuscopies', |
|
807 | coreconfigitem('ui', 'statuscopies', | |
805 | default=False, |
|
808 | default=False, | |
806 | ) |
|
809 | ) | |
807 | coreconfigitem('ui', 'strict', |
|
810 | coreconfigitem('ui', 'strict', | |
808 | default=False, |
|
811 | default=False, | |
809 | ) |
|
812 | ) | |
810 | coreconfigitem('ui', 'style', |
|
813 | coreconfigitem('ui', 'style', | |
811 | default='', |
|
814 | default='', | |
812 | ) |
|
815 | ) | |
813 | coreconfigitem('ui', 'supportcontact', |
|
816 | coreconfigitem('ui', 'supportcontact', | |
814 | default=None, |
|
817 | default=None, | |
815 | ) |
|
818 | ) | |
816 | coreconfigitem('ui', 'textwidth', |
|
819 | coreconfigitem('ui', 'textwidth', | |
817 | default=78, |
|
820 | default=78, | |
818 | ) |
|
821 | ) | |
819 | coreconfigitem('ui', 'timeout', |
|
822 | coreconfigitem('ui', 'timeout', | |
820 | default='600', |
|
823 | default='600', | |
821 | ) |
|
824 | ) | |
822 | coreconfigitem('ui', 'traceback', |
|
825 | coreconfigitem('ui', 'traceback', | |
823 | default=False, |
|
826 | default=False, | |
824 | ) |
|
827 | ) | |
825 | coreconfigitem('ui', 'tweakdefaults', |
|
828 | coreconfigitem('ui', 'tweakdefaults', | |
826 | default=False, |
|
829 | default=False, | |
827 | ) |
|
830 | ) | |
828 | coreconfigitem('ui', 'usehttp2', |
|
831 | coreconfigitem('ui', 'usehttp2', | |
829 | default=False, |
|
832 | default=False, | |
830 | ) |
|
833 | ) | |
831 | coreconfigitem('ui', 'username', |
|
834 | coreconfigitem('ui', 'username', | |
832 | alias=[('ui', 'user')] |
|
835 | alias=[('ui', 'user')] | |
833 | ) |
|
836 | ) | |
834 | coreconfigitem('ui', 'verbose', |
|
837 | coreconfigitem('ui', 'verbose', | |
835 | default=False, |
|
838 | default=False, | |
836 | ) |
|
839 | ) | |
837 | coreconfigitem('verify', 'skipflags', |
|
840 | coreconfigitem('verify', 'skipflags', | |
838 | default=None, |
|
841 | default=None, | |
839 | ) |
|
842 | ) | |
840 | coreconfigitem('web', 'allowbz2', |
|
843 | coreconfigitem('web', 'allowbz2', | |
841 | default=False, |
|
844 | default=False, | |
842 | ) |
|
845 | ) | |
843 | coreconfigitem('web', 'allowgz', |
|
846 | coreconfigitem('web', 'allowgz', | |
844 | default=False, |
|
847 | default=False, | |
845 | ) |
|
848 | ) | |
846 | coreconfigitem('web', 'allowpull', |
|
849 | coreconfigitem('web', 'allowpull', | |
847 | default=True, |
|
850 | default=True, | |
848 | ) |
|
851 | ) | |
849 | coreconfigitem('web', 'allow_push', |
|
852 | coreconfigitem('web', 'allow_push', | |
850 | default=list, |
|
853 | default=list, | |
851 | ) |
|
854 | ) | |
852 | coreconfigitem('web', 'allowzip', |
|
855 | coreconfigitem('web', 'allowzip', | |
853 | default=False, |
|
856 | default=False, | |
854 | ) |
|
857 | ) | |
855 | coreconfigitem('web', 'cache', |
|
858 | coreconfigitem('web', 'cache', | |
856 | default=True, |
|
859 | default=True, | |
857 | ) |
|
860 | ) | |
858 | coreconfigitem('web', 'contact', |
|
861 | coreconfigitem('web', 'contact', | |
859 | default=None, |
|
862 | default=None, | |
860 | ) |
|
863 | ) | |
861 | coreconfigitem('web', 'deny_push', |
|
864 | coreconfigitem('web', 'deny_push', | |
862 | default=list, |
|
865 | default=list, | |
863 | ) |
|
866 | ) | |
864 | coreconfigitem('web', 'guessmime', |
|
867 | coreconfigitem('web', 'guessmime', | |
865 | default=False, |
|
868 | default=False, | |
866 | ) |
|
869 | ) | |
867 | coreconfigitem('web', 'hidden', |
|
870 | coreconfigitem('web', 'hidden', | |
868 | default=False, |
|
871 | default=False, | |
869 | ) |
|
872 | ) | |
870 | coreconfigitem('web', 'labels', |
|
873 | coreconfigitem('web', 'labels', | |
871 | default=list, |
|
874 | default=list, | |
872 | ) |
|
875 | ) | |
873 | coreconfigitem('web', 'logoimg', |
|
876 | coreconfigitem('web', 'logoimg', | |
874 | default='hglogo.png', |
|
877 | default='hglogo.png', | |
875 | ) |
|
878 | ) | |
876 | coreconfigitem('web', 'logourl', |
|
879 | coreconfigitem('web', 'logourl', | |
877 | default='https://mercurial-scm.org/', |
|
880 | default='https://mercurial-scm.org/', | |
878 | ) |
|
881 | ) | |
879 | coreconfigitem('web', 'accesslog', |
|
882 | coreconfigitem('web', 'accesslog', | |
880 | default='-', |
|
883 | default='-', | |
881 | ) |
|
884 | ) | |
882 | coreconfigitem('web', 'address', |
|
885 | coreconfigitem('web', 'address', | |
883 | default='', |
|
886 | default='', | |
884 | ) |
|
887 | ) | |
885 | coreconfigitem('web', 'allow_archive', |
|
888 | coreconfigitem('web', 'allow_archive', | |
886 | default=list, |
|
889 | default=list, | |
887 | ) |
|
890 | ) | |
888 | coreconfigitem('web', 'allow_read', |
|
891 | coreconfigitem('web', 'allow_read', | |
889 | default=list, |
|
892 | default=list, | |
890 | ) |
|
893 | ) | |
891 | coreconfigitem('web', 'baseurl', |
|
894 | coreconfigitem('web', 'baseurl', | |
892 | default=None, |
|
895 | default=None, | |
893 | ) |
|
896 | ) | |
894 | coreconfigitem('web', 'cacerts', |
|
897 | coreconfigitem('web', 'cacerts', | |
895 | default=None, |
|
898 | default=None, | |
896 | ) |
|
899 | ) | |
897 | coreconfigitem('web', 'certificate', |
|
900 | coreconfigitem('web', 'certificate', | |
898 | default=None, |
|
901 | default=None, | |
899 | ) |
|
902 | ) | |
900 | coreconfigitem('web', 'collapse', |
|
903 | coreconfigitem('web', 'collapse', | |
901 | default=False, |
|
904 | default=False, | |
902 | ) |
|
905 | ) | |
903 | coreconfigitem('web', 'csp', |
|
906 | coreconfigitem('web', 'csp', | |
904 | default=None, |
|
907 | default=None, | |
905 | ) |
|
908 | ) | |
906 | coreconfigitem('web', 'deny_read', |
|
909 | coreconfigitem('web', 'deny_read', | |
907 | default=list, |
|
910 | default=list, | |
908 | ) |
|
911 | ) | |
909 | coreconfigitem('web', 'descend', |
|
912 | coreconfigitem('web', 'descend', | |
910 | default=True, |
|
913 | default=True, | |
911 | ) |
|
914 | ) | |
912 | coreconfigitem('web', 'description', |
|
915 | coreconfigitem('web', 'description', | |
913 | default="", |
|
916 | default="", | |
914 | ) |
|
917 | ) | |
915 | coreconfigitem('web', 'encoding', |
|
918 | coreconfigitem('web', 'encoding', | |
916 | default=lambda: encoding.encoding, |
|
919 | default=lambda: encoding.encoding, | |
917 | ) |
|
920 | ) | |
918 | coreconfigitem('web', 'errorlog', |
|
921 | coreconfigitem('web', 'errorlog', | |
919 | default='-', |
|
922 | default='-', | |
920 | ) |
|
923 | ) | |
921 | coreconfigitem('web', 'ipv6', |
|
924 | coreconfigitem('web', 'ipv6', | |
922 | default=False, |
|
925 | default=False, | |
923 | ) |
|
926 | ) | |
924 | coreconfigitem('web', 'maxchanges', |
|
927 | coreconfigitem('web', 'maxchanges', | |
925 | default=10, |
|
928 | default=10, | |
926 | ) |
|
929 | ) | |
927 | coreconfigitem('web', 'maxfiles', |
|
930 | coreconfigitem('web', 'maxfiles', | |
928 | default=10, |
|
931 | default=10, | |
929 | ) |
|
932 | ) | |
930 | coreconfigitem('web', 'maxshortchanges', |
|
933 | coreconfigitem('web', 'maxshortchanges', | |
931 | default=60, |
|
934 | default=60, | |
932 | ) |
|
935 | ) | |
933 | coreconfigitem('web', 'motd', |
|
936 | coreconfigitem('web', 'motd', | |
934 | default='', |
|
937 | default='', | |
935 | ) |
|
938 | ) | |
936 | coreconfigitem('web', 'name', |
|
939 | coreconfigitem('web', 'name', | |
937 | default=dynamicdefault, |
|
940 | default=dynamicdefault, | |
938 | ) |
|
941 | ) | |
939 | coreconfigitem('web', 'port', |
|
942 | coreconfigitem('web', 'port', | |
940 | default=8000, |
|
943 | default=8000, | |
941 | ) |
|
944 | ) | |
942 | coreconfigitem('web', 'prefix', |
|
945 | coreconfigitem('web', 'prefix', | |
943 | default='', |
|
946 | default='', | |
944 | ) |
|
947 | ) | |
945 | coreconfigitem('web', 'push_ssl', |
|
948 | coreconfigitem('web', 'push_ssl', | |
946 | default=True, |
|
949 | default=True, | |
947 | ) |
|
950 | ) | |
948 | coreconfigitem('web', 'refreshinterval', |
|
951 | coreconfigitem('web', 'refreshinterval', | |
949 | default=20, |
|
952 | default=20, | |
950 | ) |
|
953 | ) | |
951 | coreconfigitem('web', 'stripes', |
|
954 | coreconfigitem('web', 'stripes', | |
952 | default=1, |
|
955 | default=1, | |
953 | ) |
|
956 | ) | |
954 | coreconfigitem('web', 'style', |
|
957 | coreconfigitem('web', 'style', | |
955 | default='paper', |
|
958 | default='paper', | |
956 | ) |
|
959 | ) | |
957 | coreconfigitem('web', 'templates', |
|
960 | coreconfigitem('web', 'templates', | |
958 | default=None, |
|
961 | default=None, | |
959 | ) |
|
962 | ) | |
960 | coreconfigitem('web', 'view', |
|
963 | coreconfigitem('web', 'view', | |
961 | default='served', |
|
964 | default='served', | |
962 | ) |
|
965 | ) | |
963 | coreconfigitem('worker', 'backgroundclose', |
|
966 | coreconfigitem('worker', 'backgroundclose', | |
964 | default=dynamicdefault, |
|
967 | default=dynamicdefault, | |
965 | ) |
|
968 | ) | |
966 | # Windows defaults to a limit of 512 open files. A buffer of 128 |
|
969 | # Windows defaults to a limit of 512 open files. A buffer of 128 | |
967 | # should give us enough headway. |
|
970 | # should give us enough headway. | |
968 | coreconfigitem('worker', 'backgroundclosemaxqueue', |
|
971 | coreconfigitem('worker', 'backgroundclosemaxqueue', | |
969 | default=384, |
|
972 | default=384, | |
970 | ) |
|
973 | ) | |
971 | coreconfigitem('worker', 'backgroundcloseminfilecount', |
|
974 | coreconfigitem('worker', 'backgroundcloseminfilecount', | |
972 | default=2048, |
|
975 | default=2048, | |
973 | ) |
|
976 | ) | |
974 | coreconfigitem('worker', 'backgroundclosethreadcount', |
|
977 | coreconfigitem('worker', 'backgroundclosethreadcount', | |
975 | default=4, |
|
978 | default=4, | |
976 | ) |
|
979 | ) | |
977 | coreconfigitem('worker', 'numcpus', |
|
980 | coreconfigitem('worker', 'numcpus', | |
978 | default=None, |
|
981 | default=None, | |
979 | ) |
|
982 | ) |
@@ -1,305 +1,303 | |||||
1 | # progress.py progress bars related code |
|
1 | # progress.py progress bars related code | |
2 | # |
|
2 | # | |
3 | # Copyright (C) 2010 Augie Fackler <durin42@gmail.com> |
|
3 | # Copyright (C) 2010 Augie Fackler <durin42@gmail.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import errno |
|
10 | import errno | |
11 | import threading |
|
11 | import threading | |
12 | import time |
|
12 | import time | |
13 |
|
13 | |||
14 | from .i18n import _ |
|
14 | from .i18n import _ | |
15 | from . import encoding |
|
15 | from . import encoding | |
16 |
|
16 | |||
17 | def spacejoin(*args): |
|
17 | def spacejoin(*args): | |
18 | return ' '.join(s for s in args if s) |
|
18 | return ' '.join(s for s in args if s) | |
19 |
|
19 | |||
20 | def shouldprint(ui): |
|
20 | def shouldprint(ui): | |
21 | return not (ui.quiet or ui.plain('progress')) and ( |
|
21 | return not (ui.quiet or ui.plain('progress')) and ( | |
22 | ui._isatty(ui.ferr) or ui.configbool('progress', 'assume-tty')) |
|
22 | ui._isatty(ui.ferr) or ui.configbool('progress', 'assume-tty')) | |
23 |
|
23 | |||
24 | def fmtremaining(seconds): |
|
24 | def fmtremaining(seconds): | |
25 | """format a number of remaining seconds in human readable way |
|
25 | """format a number of remaining seconds in human readable way | |
26 |
|
26 | |||
27 | This will properly display seconds, minutes, hours, days if needed""" |
|
27 | This will properly display seconds, minutes, hours, days if needed""" | |
28 | if seconds < 60: |
|
28 | if seconds < 60: | |
29 | # i18n: format XX seconds as "XXs" |
|
29 | # i18n: format XX seconds as "XXs" | |
30 | return _("%02ds") % (seconds) |
|
30 | return _("%02ds") % (seconds) | |
31 | minutes = seconds // 60 |
|
31 | minutes = seconds // 60 | |
32 | if minutes < 60: |
|
32 | if minutes < 60: | |
33 | seconds -= minutes * 60 |
|
33 | seconds -= minutes * 60 | |
34 | # i18n: format X minutes and YY seconds as "XmYYs" |
|
34 | # i18n: format X minutes and YY seconds as "XmYYs" | |
35 | return _("%dm%02ds") % (minutes, seconds) |
|
35 | return _("%dm%02ds") % (minutes, seconds) | |
36 | # we're going to ignore seconds in this case |
|
36 | # we're going to ignore seconds in this case | |
37 | minutes += 1 |
|
37 | minutes += 1 | |
38 | hours = minutes // 60 |
|
38 | hours = minutes // 60 | |
39 | minutes -= hours * 60 |
|
39 | minutes -= hours * 60 | |
40 | if hours < 30: |
|
40 | if hours < 30: | |
41 | # i18n: format X hours and YY minutes as "XhYYm" |
|
41 | # i18n: format X hours and YY minutes as "XhYYm" | |
42 | return _("%dh%02dm") % (hours, minutes) |
|
42 | return _("%dh%02dm") % (hours, minutes) | |
43 | # we're going to ignore minutes in this case |
|
43 | # we're going to ignore minutes in this case | |
44 | hours += 1 |
|
44 | hours += 1 | |
45 | days = hours // 24 |
|
45 | days = hours // 24 | |
46 | hours -= days * 24 |
|
46 | hours -= days * 24 | |
47 | if days < 15: |
|
47 | if days < 15: | |
48 | # i18n: format X days and YY hours as "XdYYh" |
|
48 | # i18n: format X days and YY hours as "XdYYh" | |
49 | return _("%dd%02dh") % (days, hours) |
|
49 | return _("%dd%02dh") % (days, hours) | |
50 | # we're going to ignore hours in this case |
|
50 | # we're going to ignore hours in this case | |
51 | days += 1 |
|
51 | days += 1 | |
52 | weeks = days // 7 |
|
52 | weeks = days // 7 | |
53 | days -= weeks * 7 |
|
53 | days -= weeks * 7 | |
54 | if weeks < 55: |
|
54 | if weeks < 55: | |
55 | # i18n: format X weeks and YY days as "XwYYd" |
|
55 | # i18n: format X weeks and YY days as "XwYYd" | |
56 | return _("%dw%02dd") % (weeks, days) |
|
56 | return _("%dw%02dd") % (weeks, days) | |
57 | # we're going to ignore days and treat a year as 52 weeks |
|
57 | # we're going to ignore days and treat a year as 52 weeks | |
58 | weeks += 1 |
|
58 | weeks += 1 | |
59 | years = weeks // 52 |
|
59 | years = weeks // 52 | |
60 | weeks -= years * 52 |
|
60 | weeks -= years * 52 | |
61 | # i18n: format X years and YY weeks as "XyYYw" |
|
61 | # i18n: format X years and YY weeks as "XyYYw" | |
62 | return _("%dy%02dw") % (years, weeks) |
|
62 | return _("%dy%02dw") % (years, weeks) | |
63 |
|
63 | |||
64 | # file_write() and file_flush() of Python 2 do not restart on EINTR if |
|
64 | # file_write() and file_flush() of Python 2 do not restart on EINTR if | |
65 | # the file is attached to a "slow" device (e.g. a terminal) and raise |
|
65 | # the file is attached to a "slow" device (e.g. a terminal) and raise | |
66 | # IOError. We cannot know how many bytes would be written by file_write(), |
|
66 | # IOError. We cannot know how many bytes would be written by file_write(), | |
67 | # but a progress text is known to be short enough to be written by a |
|
67 | # but a progress text is known to be short enough to be written by a | |
68 | # single write() syscall, so we can just retry file_write() with the whole |
|
68 | # single write() syscall, so we can just retry file_write() with the whole | |
69 | # text. (issue5532) |
|
69 | # text. (issue5532) | |
70 | # |
|
70 | # | |
71 | # This should be a short-term workaround. We'll need to fix every occurrence |
|
71 | # This should be a short-term workaround. We'll need to fix every occurrence | |
72 | # of write() to a terminal or pipe. |
|
72 | # of write() to a terminal or pipe. | |
73 | def _eintrretry(func, *args): |
|
73 | def _eintrretry(func, *args): | |
74 | while True: |
|
74 | while True: | |
75 | try: |
|
75 | try: | |
76 | return func(*args) |
|
76 | return func(*args) | |
77 | except IOError as err: |
|
77 | except IOError as err: | |
78 | if err.errno == errno.EINTR: |
|
78 | if err.errno == errno.EINTR: | |
79 | continue |
|
79 | continue | |
80 | raise |
|
80 | raise | |
81 |
|
81 | |||
82 | class progbar(object): |
|
82 | class progbar(object): | |
83 | def __init__(self, ui): |
|
83 | def __init__(self, ui): | |
84 | self.ui = ui |
|
84 | self.ui = ui | |
85 | self._refreshlock = threading.Lock() |
|
85 | self._refreshlock = threading.Lock() | |
86 | self.resetstate() |
|
86 | self.resetstate() | |
87 |
|
87 | |||
88 | def resetstate(self): |
|
88 | def resetstate(self): | |
89 | self.topics = [] |
|
89 | self.topics = [] | |
90 | self.topicstates = {} |
|
90 | self.topicstates = {} | |
91 | self.starttimes = {} |
|
91 | self.starttimes = {} | |
92 | self.startvals = {} |
|
92 | self.startvals = {} | |
93 | self.printed = False |
|
93 | self.printed = False | |
94 | self.lastprint = time.time() + float(self.ui.config( |
|
94 | self.lastprint = time.time() + float(self.ui.config( | |
95 | 'progress', 'delay')) |
|
95 | 'progress', 'delay')) | |
96 | self.curtopic = None |
|
96 | self.curtopic = None | |
97 | self.lasttopic = None |
|
97 | self.lasttopic = None | |
98 | self.indetcount = 0 |
|
98 | self.indetcount = 0 | |
99 | self.refresh = float(self.ui.config( |
|
99 | self.refresh = float(self.ui.config( | |
100 | 'progress', 'refresh')) |
|
100 | 'progress', 'refresh')) | |
101 | self.changedelay = max(3 * self.refresh, |
|
101 | self.changedelay = max(3 * self.refresh, | |
102 | float(self.ui.config( |
|
102 | float(self.ui.config( | |
103 | 'progress', 'changedelay'))) |
|
103 | 'progress', 'changedelay'))) | |
104 | self.order = self.ui.configlist( |
|
104 | self.order = self.ui.configlist('progress', 'format') | |
105 | 'progress', 'format', |
|
|||
106 | default=['topic', 'bar', 'number', 'estimate']) |
|
|||
107 | self.estimateinterval = self.ui.configwith( |
|
105 | self.estimateinterval = self.ui.configwith( | |
108 | float, 'progress', 'estimateinterval') |
|
106 | float, 'progress', 'estimateinterval') | |
109 |
|
107 | |||
110 | def show(self, now, topic, pos, item, unit, total): |
|
108 | def show(self, now, topic, pos, item, unit, total): | |
111 | if not shouldprint(self.ui): |
|
109 | if not shouldprint(self.ui): | |
112 | return |
|
110 | return | |
113 | termwidth = self.width() |
|
111 | termwidth = self.width() | |
114 | self.printed = True |
|
112 | self.printed = True | |
115 | head = '' |
|
113 | head = '' | |
116 | needprogress = False |
|
114 | needprogress = False | |
117 | tail = '' |
|
115 | tail = '' | |
118 | for indicator in self.order: |
|
116 | for indicator in self.order: | |
119 | add = '' |
|
117 | add = '' | |
120 | if indicator == 'topic': |
|
118 | if indicator == 'topic': | |
121 | add = topic |
|
119 | add = topic | |
122 | elif indicator == 'number': |
|
120 | elif indicator == 'number': | |
123 | if total: |
|
121 | if total: | |
124 | add = ('% ' + str(len(str(total))) + |
|
122 | add = ('% ' + str(len(str(total))) + | |
125 | 's/%s') % (pos, total) |
|
123 | 's/%s') % (pos, total) | |
126 | else: |
|
124 | else: | |
127 | add = str(pos) |
|
125 | add = str(pos) | |
128 | elif indicator.startswith('item') and item: |
|
126 | elif indicator.startswith('item') and item: | |
129 | slice = 'end' |
|
127 | slice = 'end' | |
130 | if '-' in indicator: |
|
128 | if '-' in indicator: | |
131 | wid = int(indicator.split('-')[1]) |
|
129 | wid = int(indicator.split('-')[1]) | |
132 | elif '+' in indicator: |
|
130 | elif '+' in indicator: | |
133 | slice = 'beginning' |
|
131 | slice = 'beginning' | |
134 | wid = int(indicator.split('+')[1]) |
|
132 | wid = int(indicator.split('+')[1]) | |
135 | else: |
|
133 | else: | |
136 | wid = 20 |
|
134 | wid = 20 | |
137 | if slice == 'end': |
|
135 | if slice == 'end': | |
138 | add = encoding.trim(item, wid, leftside=True) |
|
136 | add = encoding.trim(item, wid, leftside=True) | |
139 | else: |
|
137 | else: | |
140 | add = encoding.trim(item, wid) |
|
138 | add = encoding.trim(item, wid) | |
141 | add += (wid - encoding.colwidth(add)) * ' ' |
|
139 | add += (wid - encoding.colwidth(add)) * ' ' | |
142 | elif indicator == 'bar': |
|
140 | elif indicator == 'bar': | |
143 | add = '' |
|
141 | add = '' | |
144 | needprogress = True |
|
142 | needprogress = True | |
145 | elif indicator == 'unit' and unit: |
|
143 | elif indicator == 'unit' and unit: | |
146 | add = unit |
|
144 | add = unit | |
147 | elif indicator == 'estimate': |
|
145 | elif indicator == 'estimate': | |
148 | add = self.estimate(topic, pos, total, now) |
|
146 | add = self.estimate(topic, pos, total, now) | |
149 | elif indicator == 'speed': |
|
147 | elif indicator == 'speed': | |
150 | add = self.speed(topic, pos, unit, now) |
|
148 | add = self.speed(topic, pos, unit, now) | |
151 | if not needprogress: |
|
149 | if not needprogress: | |
152 | head = spacejoin(head, add) |
|
150 | head = spacejoin(head, add) | |
153 | else: |
|
151 | else: | |
154 | tail = spacejoin(tail, add) |
|
152 | tail = spacejoin(tail, add) | |
155 | if needprogress: |
|
153 | if needprogress: | |
156 | used = 0 |
|
154 | used = 0 | |
157 | if head: |
|
155 | if head: | |
158 | used += encoding.colwidth(head) + 1 |
|
156 | used += encoding.colwidth(head) + 1 | |
159 | if tail: |
|
157 | if tail: | |
160 | used += encoding.colwidth(tail) + 1 |
|
158 | used += encoding.colwidth(tail) + 1 | |
161 | progwidth = termwidth - used - 3 |
|
159 | progwidth = termwidth - used - 3 | |
162 | if total and pos <= total: |
|
160 | if total and pos <= total: | |
163 | amt = pos * progwidth // total |
|
161 | amt = pos * progwidth // total | |
164 | bar = '=' * (amt - 1) |
|
162 | bar = '=' * (amt - 1) | |
165 | if amt > 0: |
|
163 | if amt > 0: | |
166 | bar += '>' |
|
164 | bar += '>' | |
167 | bar += ' ' * (progwidth - amt) |
|
165 | bar += ' ' * (progwidth - amt) | |
168 | else: |
|
166 | else: | |
169 | progwidth -= 3 |
|
167 | progwidth -= 3 | |
170 | self.indetcount += 1 |
|
168 | self.indetcount += 1 | |
171 | # mod the count by twice the width so we can make the |
|
169 | # mod the count by twice the width so we can make the | |
172 | # cursor bounce between the right and left sides |
|
170 | # cursor bounce between the right and left sides | |
173 | amt = self.indetcount % (2 * progwidth) |
|
171 | amt = self.indetcount % (2 * progwidth) | |
174 | amt -= progwidth |
|
172 | amt -= progwidth | |
175 | bar = (' ' * int(progwidth - abs(amt)) + '<=>' + |
|
173 | bar = (' ' * int(progwidth - abs(amt)) + '<=>' + | |
176 | ' ' * int(abs(amt))) |
|
174 | ' ' * int(abs(amt))) | |
177 | prog = ''.join(('[', bar, ']')) |
|
175 | prog = ''.join(('[', bar, ']')) | |
178 | out = spacejoin(head, prog, tail) |
|
176 | out = spacejoin(head, prog, tail) | |
179 | else: |
|
177 | else: | |
180 | out = spacejoin(head, tail) |
|
178 | out = spacejoin(head, tail) | |
181 | self._writeerr('\r' + encoding.trim(out, termwidth)) |
|
179 | self._writeerr('\r' + encoding.trim(out, termwidth)) | |
182 | self.lasttopic = topic |
|
180 | self.lasttopic = topic | |
183 | self._flusherr() |
|
181 | self._flusherr() | |
184 |
|
182 | |||
185 | def clear(self): |
|
183 | def clear(self): | |
186 | if not self.printed or not self.lastprint or not shouldprint(self.ui): |
|
184 | if not self.printed or not self.lastprint or not shouldprint(self.ui): | |
187 | return |
|
185 | return | |
188 | self._writeerr('\r%s\r' % (' ' * self.width())) |
|
186 | self._writeerr('\r%s\r' % (' ' * self.width())) | |
189 | if self.printed: |
|
187 | if self.printed: | |
190 | # force immediate re-paint of progress bar |
|
188 | # force immediate re-paint of progress bar | |
191 | self.lastprint = 0 |
|
189 | self.lastprint = 0 | |
192 |
|
190 | |||
193 | def complete(self): |
|
191 | def complete(self): | |
194 | if not shouldprint(self.ui): |
|
192 | if not shouldprint(self.ui): | |
195 | return |
|
193 | return | |
196 | if self.ui.configbool('progress', 'clear-complete'): |
|
194 | if self.ui.configbool('progress', 'clear-complete'): | |
197 | self.clear() |
|
195 | self.clear() | |
198 | else: |
|
196 | else: | |
199 | self._writeerr('\n') |
|
197 | self._writeerr('\n') | |
200 | self._flusherr() |
|
198 | self._flusherr() | |
201 |
|
199 | |||
202 | def _flusherr(self): |
|
200 | def _flusherr(self): | |
203 | _eintrretry(self.ui.ferr.flush) |
|
201 | _eintrretry(self.ui.ferr.flush) | |
204 |
|
202 | |||
205 | def _writeerr(self, msg): |
|
203 | def _writeerr(self, msg): | |
206 | _eintrretry(self.ui.ferr.write, msg) |
|
204 | _eintrretry(self.ui.ferr.write, msg) | |
207 |
|
205 | |||
208 | def width(self): |
|
206 | def width(self): | |
209 | tw = self.ui.termwidth() |
|
207 | tw = self.ui.termwidth() | |
210 | return min(int(self.ui.config('progress', 'width', default=tw)), tw) |
|
208 | return min(int(self.ui.config('progress', 'width', default=tw)), tw) | |
211 |
|
209 | |||
212 | def estimate(self, topic, pos, total, now): |
|
210 | def estimate(self, topic, pos, total, now): | |
213 | if total is None: |
|
211 | if total is None: | |
214 | return '' |
|
212 | return '' | |
215 | initialpos = self.startvals[topic] |
|
213 | initialpos = self.startvals[topic] | |
216 | target = total - initialpos |
|
214 | target = total - initialpos | |
217 | delta = pos - initialpos |
|
215 | delta = pos - initialpos | |
218 | if delta > 0: |
|
216 | if delta > 0: | |
219 | elapsed = now - self.starttimes[topic] |
|
217 | elapsed = now - self.starttimes[topic] | |
220 | seconds = (elapsed * (target - delta)) // delta + 1 |
|
218 | seconds = (elapsed * (target - delta)) // delta + 1 | |
221 | return fmtremaining(seconds) |
|
219 | return fmtremaining(seconds) | |
222 | return '' |
|
220 | return '' | |
223 |
|
221 | |||
224 | def speed(self, topic, pos, unit, now): |
|
222 | def speed(self, topic, pos, unit, now): | |
225 | initialpos = self.startvals[topic] |
|
223 | initialpos = self.startvals[topic] | |
226 | delta = pos - initialpos |
|
224 | delta = pos - initialpos | |
227 | elapsed = now - self.starttimes[topic] |
|
225 | elapsed = now - self.starttimes[topic] | |
228 | if elapsed > 0: |
|
226 | if elapsed > 0: | |
229 | return _('%d %s/sec') % (delta / elapsed, unit) |
|
227 | return _('%d %s/sec') % (delta / elapsed, unit) | |
230 | return '' |
|
228 | return '' | |
231 |
|
229 | |||
232 | def _oktoprint(self, now): |
|
230 | def _oktoprint(self, now): | |
233 | '''Check if conditions are met to print - e.g. changedelay elapsed''' |
|
231 | '''Check if conditions are met to print - e.g. changedelay elapsed''' | |
234 | if (self.lasttopic is None # first time we printed |
|
232 | if (self.lasttopic is None # first time we printed | |
235 | # not a topic change |
|
233 | # not a topic change | |
236 | or self.curtopic == self.lasttopic |
|
234 | or self.curtopic == self.lasttopic | |
237 | # it's been long enough we should print anyway |
|
235 | # it's been long enough we should print anyway | |
238 | or now - self.lastprint >= self.changedelay): |
|
236 | or now - self.lastprint >= self.changedelay): | |
239 | return True |
|
237 | return True | |
240 | else: |
|
238 | else: | |
241 | return False |
|
239 | return False | |
242 |
|
240 | |||
243 | def _calibrateestimate(self, topic, now, pos): |
|
241 | def _calibrateestimate(self, topic, now, pos): | |
244 | '''Adjust starttimes and startvals for topic so ETA works better |
|
242 | '''Adjust starttimes and startvals for topic so ETA works better | |
245 |
|
243 | |||
246 | If progress is non-linear (ex. get much slower in the last minute), |
|
244 | If progress is non-linear (ex. get much slower in the last minute), | |
247 | it's more friendly to only use a recent time span for ETA and speed |
|
245 | it's more friendly to only use a recent time span for ETA and speed | |
248 | calculation. |
|
246 | calculation. | |
249 |
|
247 | |||
250 | [======================================> ] |
|
248 | [======================================> ] | |
251 | ^^^^^^^ |
|
249 | ^^^^^^^ | |
252 | estimateinterval, only use this for estimation |
|
250 | estimateinterval, only use this for estimation | |
253 | ''' |
|
251 | ''' | |
254 | interval = self.estimateinterval |
|
252 | interval = self.estimateinterval | |
255 | if interval <= 0: |
|
253 | if interval <= 0: | |
256 | return |
|
254 | return | |
257 | elapsed = now - self.starttimes[topic] |
|
255 | elapsed = now - self.starttimes[topic] | |
258 | if elapsed > interval: |
|
256 | if elapsed > interval: | |
259 | delta = pos - self.startvals[topic] |
|
257 | delta = pos - self.startvals[topic] | |
260 | newdelta = delta * interval / elapsed |
|
258 | newdelta = delta * interval / elapsed | |
261 | # If a stall happens temporarily, ETA could change dramatically |
|
259 | # If a stall happens temporarily, ETA could change dramatically | |
262 | # frequently. This is to avoid such dramatical change and make ETA |
|
260 | # frequently. This is to avoid such dramatical change and make ETA | |
263 | # smoother. |
|
261 | # smoother. | |
264 | if newdelta < 0.1: |
|
262 | if newdelta < 0.1: | |
265 | return |
|
263 | return | |
266 | self.startvals[topic] = pos - newdelta |
|
264 | self.startvals[topic] = pos - newdelta | |
267 | self.starttimes[topic] = now - interval |
|
265 | self.starttimes[topic] = now - interval | |
268 |
|
266 | |||
269 | def progress(self, topic, pos, item='', unit='', total=None): |
|
267 | def progress(self, topic, pos, item='', unit='', total=None): | |
270 | now = time.time() |
|
268 | now = time.time() | |
271 | self._refreshlock.acquire() |
|
269 | self._refreshlock.acquire() | |
272 | try: |
|
270 | try: | |
273 | if pos is None: |
|
271 | if pos is None: | |
274 | self.starttimes.pop(topic, None) |
|
272 | self.starttimes.pop(topic, None) | |
275 | self.startvals.pop(topic, None) |
|
273 | self.startvals.pop(topic, None) | |
276 | self.topicstates.pop(topic, None) |
|
274 | self.topicstates.pop(topic, None) | |
277 | # reset the progress bar if this is the outermost topic |
|
275 | # reset the progress bar if this is the outermost topic | |
278 | if self.topics and self.topics[0] == topic and self.printed: |
|
276 | if self.topics and self.topics[0] == topic and self.printed: | |
279 | self.complete() |
|
277 | self.complete() | |
280 | self.resetstate() |
|
278 | self.resetstate() | |
281 | # truncate the list of topics assuming all topics within |
|
279 | # truncate the list of topics assuming all topics within | |
282 | # this one are also closed |
|
280 | # this one are also closed | |
283 | if topic in self.topics: |
|
281 | if topic in self.topics: | |
284 | self.topics = self.topics[:self.topics.index(topic)] |
|
282 | self.topics = self.topics[:self.topics.index(topic)] | |
285 | # reset the last topic to the one we just unwound to, |
|
283 | # reset the last topic to the one we just unwound to, | |
286 | # so that higher-level topics will be stickier than |
|
284 | # so that higher-level topics will be stickier than | |
287 | # lower-level topics |
|
285 | # lower-level topics | |
288 | if self.topics: |
|
286 | if self.topics: | |
289 | self.lasttopic = self.topics[-1] |
|
287 | self.lasttopic = self.topics[-1] | |
290 | else: |
|
288 | else: | |
291 | self.lasttopic = None |
|
289 | self.lasttopic = None | |
292 | else: |
|
290 | else: | |
293 | if topic not in self.topics: |
|
291 | if topic not in self.topics: | |
294 | self.starttimes[topic] = now |
|
292 | self.starttimes[topic] = now | |
295 | self.startvals[topic] = pos |
|
293 | self.startvals[topic] = pos | |
296 | self.topics.append(topic) |
|
294 | self.topics.append(topic) | |
297 | self.topicstates[topic] = pos, item, unit, total |
|
295 | self.topicstates[topic] = pos, item, unit, total | |
298 | self.curtopic = topic |
|
296 | self.curtopic = topic | |
299 | self._calibrateestimate(topic, now, pos) |
|
297 | self._calibrateestimate(topic, now, pos) | |
300 | if now - self.lastprint >= self.refresh and self.topics: |
|
298 | if now - self.lastprint >= self.refresh and self.topics: | |
301 | if self._oktoprint(now): |
|
299 | if self._oktoprint(now): | |
302 | self.lastprint = now |
|
300 | self.lastprint = now | |
303 | self.show(now, topic, *self.topicstates[topic]) |
|
301 | self.show(now, topic, *self.topicstates[topic]) | |
304 | finally: |
|
302 | finally: | |
305 | self._refreshlock.release() |
|
303 | self._refreshlock.release() |
General Comments 0
You need to be logged in to leave comments.
Login now