Show More
@@ -1,2731 +1,2737 b'' | |||
|
1 | 1 | # configitems.py - centralized declaration of configuration option |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | 10 | import functools |
|
11 | 11 | import re |
|
12 | 12 | |
|
13 | 13 | from . import ( |
|
14 | 14 | encoding, |
|
15 | 15 | error, |
|
16 | 16 | ) |
|
17 | 17 | |
|
18 | 18 | |
|
19 | 19 | def loadconfigtable(ui, extname, configtable): |
|
20 | 20 | """update config item known to the ui with the extension ones""" |
|
21 | 21 | for section, items in sorted(configtable.items()): |
|
22 | 22 | knownitems = ui._knownconfig.setdefault(section, itemregister()) |
|
23 | 23 | knownkeys = set(knownitems) |
|
24 | 24 | newkeys = set(items) |
|
25 | 25 | for key in sorted(knownkeys & newkeys): |
|
26 | 26 | msg = b"extension '%s' overwrite config item '%s.%s'" |
|
27 | 27 | msg %= (extname, section, key) |
|
28 | 28 | ui.develwarn(msg, config=b'warn-config') |
|
29 | 29 | |
|
30 | 30 | knownitems.update(items) |
|
31 | 31 | |
|
32 | 32 | |
|
33 | 33 | class configitem(object): |
|
34 | 34 | """represent a known config item |
|
35 | 35 | |
|
36 | 36 | :section: the official config section where to find this item, |
|
37 | 37 | :name: the official name within the section, |
|
38 | 38 | :default: default value for this item, |
|
39 | 39 | :alias: optional list of tuples as alternatives, |
|
40 | 40 | :generic: this is a generic definition, match name using regular expression. |
|
41 | 41 | """ |
|
42 | 42 | |
|
43 | 43 | def __init__( |
|
44 | 44 | self, |
|
45 | 45 | section, |
|
46 | 46 | name, |
|
47 | 47 | default=None, |
|
48 | 48 | alias=(), |
|
49 | 49 | generic=False, |
|
50 | 50 | priority=0, |
|
51 | 51 | experimental=False, |
|
52 | 52 | ): |
|
53 | 53 | self.section = section |
|
54 | 54 | self.name = name |
|
55 | 55 | self.default = default |
|
56 | 56 | self.alias = list(alias) |
|
57 | 57 | self.generic = generic |
|
58 | 58 | self.priority = priority |
|
59 | 59 | self.experimental = experimental |
|
60 | 60 | self._re = None |
|
61 | 61 | if generic: |
|
62 | 62 | self._re = re.compile(self.name) |
|
63 | 63 | |
|
64 | 64 | |
|
65 | 65 | class itemregister(dict): |
|
66 | 66 | """A specialized dictionary that can handle wild-card selection""" |
|
67 | 67 | |
|
68 | 68 | def __init__(self): |
|
69 | 69 | super(itemregister, self).__init__() |
|
70 | 70 | self._generics = set() |
|
71 | 71 | |
|
72 | 72 | def update(self, other): |
|
73 | 73 | super(itemregister, self).update(other) |
|
74 | 74 | self._generics.update(other._generics) |
|
75 | 75 | |
|
76 | 76 | def __setitem__(self, key, item): |
|
77 | 77 | super(itemregister, self).__setitem__(key, item) |
|
78 | 78 | if item.generic: |
|
79 | 79 | self._generics.add(item) |
|
80 | 80 | |
|
81 | 81 | def get(self, key): |
|
82 | 82 | baseitem = super(itemregister, self).get(key) |
|
83 | 83 | if baseitem is not None and not baseitem.generic: |
|
84 | 84 | return baseitem |
|
85 | 85 | |
|
86 | 86 | # search for a matching generic item |
|
87 | 87 | generics = sorted(self._generics, key=(lambda x: (x.priority, x.name))) |
|
88 | 88 | for item in generics: |
|
89 | 89 | # we use 'match' instead of 'search' to make the matching simpler |
|
90 | 90 | # for people unfamiliar with regular expression. Having the match |
|
91 | 91 | # rooted to the start of the string will produce less surprising |
|
92 | 92 | # result for user writing simple regex for sub-attribute. |
|
93 | 93 | # |
|
94 | 94 | # For example using "color\..*" match produces an unsurprising |
|
95 | 95 | # result, while using search could suddenly match apparently |
|
96 | 96 | # unrelated configuration that happens to contains "color." |
|
97 | 97 | # anywhere. This is a tradeoff where we favor requiring ".*" on |
|
98 | 98 | # some match to avoid the need to prefix most pattern with "^". |
|
99 | 99 | # The "^" seems more error prone. |
|
100 | 100 | if item._re.match(key): |
|
101 | 101 | return item |
|
102 | 102 | |
|
103 | 103 | return None |
|
104 | 104 | |
|
105 | 105 | |
|
106 | 106 | coreitems = {} |
|
107 | 107 | |
|
108 | 108 | |
|
109 | 109 | def _register(configtable, *args, **kwargs): |
|
110 | 110 | item = configitem(*args, **kwargs) |
|
111 | 111 | section = configtable.setdefault(item.section, itemregister()) |
|
112 | 112 | if item.name in section: |
|
113 | 113 | msg = b"duplicated config item registration for '%s.%s'" |
|
114 | 114 | raise error.ProgrammingError(msg % (item.section, item.name)) |
|
115 | 115 | section[item.name] = item |
|
116 | 116 | |
|
117 | 117 | |
|
118 | 118 | # special value for case where the default is derived from other values |
|
119 | 119 | dynamicdefault = object() |
|
120 | 120 | |
|
121 | 121 | # Registering actual config items |
|
122 | 122 | |
|
123 | 123 | |
|
124 | 124 | def getitemregister(configtable): |
|
125 | 125 | f = functools.partial(_register, configtable) |
|
126 | 126 | # export pseudo enum as configitem.* |
|
127 | 127 | f.dynamicdefault = dynamicdefault |
|
128 | 128 | return f |
|
129 | 129 | |
|
130 | 130 | |
|
131 | 131 | coreconfigitem = getitemregister(coreitems) |
|
132 | 132 | |
|
133 | 133 | |
|
134 | 134 | def _registerdiffopts(section, configprefix=b''): |
|
135 | 135 | coreconfigitem( |
|
136 | 136 | section, |
|
137 | 137 | configprefix + b'nodates', |
|
138 | 138 | default=False, |
|
139 | 139 | ) |
|
140 | 140 | coreconfigitem( |
|
141 | 141 | section, |
|
142 | 142 | configprefix + b'showfunc', |
|
143 | 143 | default=False, |
|
144 | 144 | ) |
|
145 | 145 | coreconfigitem( |
|
146 | 146 | section, |
|
147 | 147 | configprefix + b'unified', |
|
148 | 148 | default=None, |
|
149 | 149 | ) |
|
150 | 150 | coreconfigitem( |
|
151 | 151 | section, |
|
152 | 152 | configprefix + b'git', |
|
153 | 153 | default=False, |
|
154 | 154 | ) |
|
155 | 155 | coreconfigitem( |
|
156 | 156 | section, |
|
157 | 157 | configprefix + b'ignorews', |
|
158 | 158 | default=False, |
|
159 | 159 | ) |
|
160 | 160 | coreconfigitem( |
|
161 | 161 | section, |
|
162 | 162 | configprefix + b'ignorewsamount', |
|
163 | 163 | default=False, |
|
164 | 164 | ) |
|
165 | 165 | coreconfigitem( |
|
166 | 166 | section, |
|
167 | 167 | configprefix + b'ignoreblanklines', |
|
168 | 168 | default=False, |
|
169 | 169 | ) |
|
170 | 170 | coreconfigitem( |
|
171 | 171 | section, |
|
172 | 172 | configprefix + b'ignorewseol', |
|
173 | 173 | default=False, |
|
174 | 174 | ) |
|
175 | 175 | coreconfigitem( |
|
176 | 176 | section, |
|
177 | 177 | configprefix + b'nobinary', |
|
178 | 178 | default=False, |
|
179 | 179 | ) |
|
180 | 180 | coreconfigitem( |
|
181 | 181 | section, |
|
182 | 182 | configprefix + b'noprefix', |
|
183 | 183 | default=False, |
|
184 | 184 | ) |
|
185 | 185 | coreconfigitem( |
|
186 | 186 | section, |
|
187 | 187 | configprefix + b'word-diff', |
|
188 | 188 | default=False, |
|
189 | 189 | ) |
|
190 | 190 | |
|
191 | 191 | |
|
192 | 192 | coreconfigitem( |
|
193 | 193 | b'alias', |
|
194 | 194 | b'.*', |
|
195 | 195 | default=dynamicdefault, |
|
196 | 196 | generic=True, |
|
197 | 197 | ) |
|
198 | 198 | coreconfigitem( |
|
199 | 199 | b'auth', |
|
200 | 200 | b'cookiefile', |
|
201 | 201 | default=None, |
|
202 | 202 | ) |
|
203 | 203 | _registerdiffopts(section=b'annotate') |
|
204 | 204 | # bookmarks.pushing: internal hack for discovery |
|
205 | 205 | coreconfigitem( |
|
206 | 206 | b'bookmarks', |
|
207 | 207 | b'pushing', |
|
208 | 208 | default=list, |
|
209 | 209 | ) |
|
210 | 210 | # bundle.mainreporoot: internal hack for bundlerepo |
|
211 | 211 | coreconfigitem( |
|
212 | 212 | b'bundle', |
|
213 | 213 | b'mainreporoot', |
|
214 | 214 | default=b'', |
|
215 | 215 | ) |
|
216 | 216 | coreconfigitem( |
|
217 | 217 | b'censor', |
|
218 | 218 | b'policy', |
|
219 | 219 | default=b'abort', |
|
220 | 220 | experimental=True, |
|
221 | 221 | ) |
|
222 | 222 | coreconfigitem( |
|
223 | 223 | b'chgserver', |
|
224 | 224 | b'idletimeout', |
|
225 | 225 | default=3600, |
|
226 | 226 | ) |
|
227 | 227 | coreconfigitem( |
|
228 | 228 | b'chgserver', |
|
229 | 229 | b'skiphash', |
|
230 | 230 | default=False, |
|
231 | 231 | ) |
|
232 | 232 | coreconfigitem( |
|
233 | 233 | b'cmdserver', |
|
234 | 234 | b'log', |
|
235 | 235 | default=None, |
|
236 | 236 | ) |
|
237 | 237 | coreconfigitem( |
|
238 | 238 | b'cmdserver', |
|
239 | 239 | b'max-log-files', |
|
240 | 240 | default=7, |
|
241 | 241 | ) |
|
242 | 242 | coreconfigitem( |
|
243 | 243 | b'cmdserver', |
|
244 | 244 | b'max-log-size', |
|
245 | 245 | default=b'1 MB', |
|
246 | 246 | ) |
|
247 | 247 | coreconfigitem( |
|
248 | 248 | b'cmdserver', |
|
249 | 249 | b'max-repo-cache', |
|
250 | 250 | default=0, |
|
251 | 251 | experimental=True, |
|
252 | 252 | ) |
|
253 | 253 | coreconfigitem( |
|
254 | 254 | b'cmdserver', |
|
255 | 255 | b'message-encodings', |
|
256 | 256 | default=list, |
|
257 | 257 | ) |
|
258 | 258 | coreconfigitem( |
|
259 | 259 | b'cmdserver', |
|
260 | 260 | b'track-log', |
|
261 | 261 | default=lambda: [b'chgserver', b'cmdserver', b'repocache'], |
|
262 | 262 | ) |
|
263 | 263 | coreconfigitem( |
|
264 | 264 | b'cmdserver', |
|
265 | 265 | b'shutdown-on-interrupt', |
|
266 | 266 | default=True, |
|
267 | 267 | ) |
|
268 | 268 | coreconfigitem( |
|
269 | 269 | b'color', |
|
270 | 270 | b'.*', |
|
271 | 271 | default=None, |
|
272 | 272 | generic=True, |
|
273 | 273 | ) |
|
274 | 274 | coreconfigitem( |
|
275 | 275 | b'color', |
|
276 | 276 | b'mode', |
|
277 | 277 | default=b'auto', |
|
278 | 278 | ) |
|
279 | 279 | coreconfigitem( |
|
280 | 280 | b'color', |
|
281 | 281 | b'pagermode', |
|
282 | 282 | default=dynamicdefault, |
|
283 | 283 | ) |
|
284 | 284 | coreconfigitem( |
|
285 | 285 | b'command-templates', |
|
286 | 286 | b'graphnode', |
|
287 | 287 | default=None, |
|
288 | 288 | alias=[(b'ui', b'graphnodetemplate')], |
|
289 | 289 | ) |
|
290 | 290 | coreconfigitem( |
|
291 | 291 | b'command-templates', |
|
292 | 292 | b'log', |
|
293 | 293 | default=None, |
|
294 | 294 | alias=[(b'ui', b'logtemplate')], |
|
295 | 295 | ) |
|
296 | 296 | coreconfigitem( |
|
297 | 297 | b'command-templates', |
|
298 | 298 | b'mergemarker', |
|
299 | 299 | default=( |
|
300 | 300 | b'{node|short} ' |
|
301 | 301 | b'{ifeq(tags, "tip", "", ' |
|
302 | 302 | b'ifeq(tags, "", "", "{tags} "))}' |
|
303 | 303 | b'{if(bookmarks, "{bookmarks} ")}' |
|
304 | 304 | b'{ifeq(branch, "default", "", "{branch} ")}' |
|
305 | 305 | b'- {author|user}: {desc|firstline}' |
|
306 | 306 | ), |
|
307 | 307 | alias=[(b'ui', b'mergemarkertemplate')], |
|
308 | 308 | ) |
|
309 | 309 | coreconfigitem( |
|
310 | 310 | b'command-templates', |
|
311 | 311 | b'pre-merge-tool-output', |
|
312 | 312 | default=None, |
|
313 | 313 | alias=[(b'ui', b'pre-merge-tool-output-template')], |
|
314 | 314 | ) |
|
315 | 315 | coreconfigitem( |
|
316 | 316 | b'command-templates', |
|
317 | 317 | b'oneline-summary', |
|
318 | 318 | default=None, |
|
319 | 319 | ) |
|
320 | 320 | coreconfigitem( |
|
321 | 321 | b'command-templates', |
|
322 | 322 | b'oneline-summary.*', |
|
323 | 323 | default=dynamicdefault, |
|
324 | 324 | generic=True, |
|
325 | 325 | ) |
|
326 | 326 | _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.') |
|
327 | 327 | coreconfigitem( |
|
328 | 328 | b'commands', |
|
329 | 329 | b'commit.post-status', |
|
330 | 330 | default=False, |
|
331 | 331 | ) |
|
332 | 332 | coreconfigitem( |
|
333 | 333 | b'commands', |
|
334 | 334 | b'grep.all-files', |
|
335 | 335 | default=False, |
|
336 | 336 | experimental=True, |
|
337 | 337 | ) |
|
338 | 338 | coreconfigitem( |
|
339 | 339 | b'commands', |
|
340 | 340 | b'merge.require-rev', |
|
341 | 341 | default=False, |
|
342 | 342 | ) |
|
343 | 343 | coreconfigitem( |
|
344 | 344 | b'commands', |
|
345 | 345 | b'push.require-revs', |
|
346 | 346 | default=False, |
|
347 | 347 | ) |
|
348 | 348 | coreconfigitem( |
|
349 | 349 | b'commands', |
|
350 | 350 | b'resolve.confirm', |
|
351 | 351 | default=False, |
|
352 | 352 | ) |
|
353 | 353 | coreconfigitem( |
|
354 | 354 | b'commands', |
|
355 | 355 | b'resolve.explicit-re-merge', |
|
356 | 356 | default=False, |
|
357 | 357 | ) |
|
358 | 358 | coreconfigitem( |
|
359 | 359 | b'commands', |
|
360 | 360 | b'resolve.mark-check', |
|
361 | 361 | default=b'none', |
|
362 | 362 | ) |
|
363 | 363 | _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.') |
|
364 | 364 | coreconfigitem( |
|
365 | 365 | b'commands', |
|
366 | 366 | b'show.aliasprefix', |
|
367 | 367 | default=list, |
|
368 | 368 | ) |
|
369 | 369 | coreconfigitem( |
|
370 | 370 | b'commands', |
|
371 | 371 | b'status.relative', |
|
372 | 372 | default=False, |
|
373 | 373 | ) |
|
374 | 374 | coreconfigitem( |
|
375 | 375 | b'commands', |
|
376 | 376 | b'status.skipstates', |
|
377 | 377 | default=[], |
|
378 | 378 | experimental=True, |
|
379 | 379 | ) |
|
380 | 380 | coreconfigitem( |
|
381 | 381 | b'commands', |
|
382 | 382 | b'status.terse', |
|
383 | 383 | default=b'', |
|
384 | 384 | ) |
|
385 | 385 | coreconfigitem( |
|
386 | 386 | b'commands', |
|
387 | 387 | b'status.verbose', |
|
388 | 388 | default=False, |
|
389 | 389 | ) |
|
390 | 390 | coreconfigitem( |
|
391 | 391 | b'commands', |
|
392 | 392 | b'update.check', |
|
393 | 393 | default=None, |
|
394 | 394 | ) |
|
395 | 395 | coreconfigitem( |
|
396 | 396 | b'commands', |
|
397 | 397 | b'update.requiredest', |
|
398 | 398 | default=False, |
|
399 | 399 | ) |
|
400 | 400 | coreconfigitem( |
|
401 | 401 | b'committemplate', |
|
402 | 402 | b'.*', |
|
403 | 403 | default=None, |
|
404 | 404 | generic=True, |
|
405 | 405 | ) |
|
406 | 406 | coreconfigitem( |
|
407 | 407 | b'convert', |
|
408 | 408 | b'bzr.saverev', |
|
409 | 409 | default=True, |
|
410 | 410 | ) |
|
411 | 411 | coreconfigitem( |
|
412 | 412 | b'convert', |
|
413 | 413 | b'cvsps.cache', |
|
414 | 414 | default=True, |
|
415 | 415 | ) |
|
416 | 416 | coreconfigitem( |
|
417 | 417 | b'convert', |
|
418 | 418 | b'cvsps.fuzz', |
|
419 | 419 | default=60, |
|
420 | 420 | ) |
|
421 | 421 | coreconfigitem( |
|
422 | 422 | b'convert', |
|
423 | 423 | b'cvsps.logencoding', |
|
424 | 424 | default=None, |
|
425 | 425 | ) |
|
426 | 426 | coreconfigitem( |
|
427 | 427 | b'convert', |
|
428 | 428 | b'cvsps.mergefrom', |
|
429 | 429 | default=None, |
|
430 | 430 | ) |
|
431 | 431 | coreconfigitem( |
|
432 | 432 | b'convert', |
|
433 | 433 | b'cvsps.mergeto', |
|
434 | 434 | default=None, |
|
435 | 435 | ) |
|
436 | 436 | coreconfigitem( |
|
437 | 437 | b'convert', |
|
438 | 438 | b'git.committeractions', |
|
439 | 439 | default=lambda: [b'messagedifferent'], |
|
440 | 440 | ) |
|
441 | 441 | coreconfigitem( |
|
442 | 442 | b'convert', |
|
443 | 443 | b'git.extrakeys', |
|
444 | 444 | default=list, |
|
445 | 445 | ) |
|
446 | 446 | coreconfigitem( |
|
447 | 447 | b'convert', |
|
448 | 448 | b'git.findcopiesharder', |
|
449 | 449 | default=False, |
|
450 | 450 | ) |
|
451 | 451 | coreconfigitem( |
|
452 | 452 | b'convert', |
|
453 | 453 | b'git.remoteprefix', |
|
454 | 454 | default=b'remote', |
|
455 | 455 | ) |
|
456 | 456 | coreconfigitem( |
|
457 | 457 | b'convert', |
|
458 | 458 | b'git.renamelimit', |
|
459 | 459 | default=400, |
|
460 | 460 | ) |
|
461 | 461 | coreconfigitem( |
|
462 | 462 | b'convert', |
|
463 | 463 | b'git.saverev', |
|
464 | 464 | default=True, |
|
465 | 465 | ) |
|
466 | 466 | coreconfigitem( |
|
467 | 467 | b'convert', |
|
468 | 468 | b'git.similarity', |
|
469 | 469 | default=50, |
|
470 | 470 | ) |
|
471 | 471 | coreconfigitem( |
|
472 | 472 | b'convert', |
|
473 | 473 | b'git.skipsubmodules', |
|
474 | 474 | default=False, |
|
475 | 475 | ) |
|
476 | 476 | coreconfigitem( |
|
477 | 477 | b'convert', |
|
478 | 478 | b'hg.clonebranches', |
|
479 | 479 | default=False, |
|
480 | 480 | ) |
|
481 | 481 | coreconfigitem( |
|
482 | 482 | b'convert', |
|
483 | 483 | b'hg.ignoreerrors', |
|
484 | 484 | default=False, |
|
485 | 485 | ) |
|
486 | 486 | coreconfigitem( |
|
487 | 487 | b'convert', |
|
488 | 488 | b'hg.preserve-hash', |
|
489 | 489 | default=False, |
|
490 | 490 | ) |
|
491 | 491 | coreconfigitem( |
|
492 | 492 | b'convert', |
|
493 | 493 | b'hg.revs', |
|
494 | 494 | default=None, |
|
495 | 495 | ) |
|
496 | 496 | coreconfigitem( |
|
497 | 497 | b'convert', |
|
498 | 498 | b'hg.saverev', |
|
499 | 499 | default=False, |
|
500 | 500 | ) |
|
501 | 501 | coreconfigitem( |
|
502 | 502 | b'convert', |
|
503 | 503 | b'hg.sourcename', |
|
504 | 504 | default=None, |
|
505 | 505 | ) |
|
506 | 506 | coreconfigitem( |
|
507 | 507 | b'convert', |
|
508 | 508 | b'hg.startrev', |
|
509 | 509 | default=None, |
|
510 | 510 | ) |
|
511 | 511 | coreconfigitem( |
|
512 | 512 | b'convert', |
|
513 | 513 | b'hg.tagsbranch', |
|
514 | 514 | default=b'default', |
|
515 | 515 | ) |
|
516 | 516 | coreconfigitem( |
|
517 | 517 | b'convert', |
|
518 | 518 | b'hg.usebranchnames', |
|
519 | 519 | default=True, |
|
520 | 520 | ) |
|
521 | 521 | coreconfigitem( |
|
522 | 522 | b'convert', |
|
523 | 523 | b'ignoreancestorcheck', |
|
524 | 524 | default=False, |
|
525 | 525 | experimental=True, |
|
526 | 526 | ) |
|
527 | 527 | coreconfigitem( |
|
528 | 528 | b'convert', |
|
529 | 529 | b'localtimezone', |
|
530 | 530 | default=False, |
|
531 | 531 | ) |
|
532 | 532 | coreconfigitem( |
|
533 | 533 | b'convert', |
|
534 | 534 | b'p4.encoding', |
|
535 | 535 | default=dynamicdefault, |
|
536 | 536 | ) |
|
537 | 537 | coreconfigitem( |
|
538 | 538 | b'convert', |
|
539 | 539 | b'p4.startrev', |
|
540 | 540 | default=0, |
|
541 | 541 | ) |
|
542 | 542 | coreconfigitem( |
|
543 | 543 | b'convert', |
|
544 | 544 | b'skiptags', |
|
545 | 545 | default=False, |
|
546 | 546 | ) |
|
547 | 547 | coreconfigitem( |
|
548 | 548 | b'convert', |
|
549 | 549 | b'svn.debugsvnlog', |
|
550 | 550 | default=True, |
|
551 | 551 | ) |
|
552 | 552 | coreconfigitem( |
|
553 | 553 | b'convert', |
|
554 | 554 | b'svn.trunk', |
|
555 | 555 | default=None, |
|
556 | 556 | ) |
|
557 | 557 | coreconfigitem( |
|
558 | 558 | b'convert', |
|
559 | 559 | b'svn.tags', |
|
560 | 560 | default=None, |
|
561 | 561 | ) |
|
562 | 562 | coreconfigitem( |
|
563 | 563 | b'convert', |
|
564 | 564 | b'svn.branches', |
|
565 | 565 | default=None, |
|
566 | 566 | ) |
|
567 | 567 | coreconfigitem( |
|
568 | 568 | b'convert', |
|
569 | 569 | b'svn.startrev', |
|
570 | 570 | default=0, |
|
571 | 571 | ) |
|
572 | 572 | coreconfigitem( |
|
573 | 573 | b'convert', |
|
574 | 574 | b'svn.dangerous-set-commit-dates', |
|
575 | 575 | default=False, |
|
576 | 576 | ) |
|
577 | 577 | coreconfigitem( |
|
578 | 578 | b'debug', |
|
579 | 579 | b'dirstate.delaywrite', |
|
580 | 580 | default=0, |
|
581 | 581 | ) |
|
582 | 582 | coreconfigitem( |
|
583 | 583 | b'debug', |
|
584 | 584 | b'revlog.verifyposition.changelog', |
|
585 | 585 | default=b'', |
|
586 | 586 | ) |
|
587 | 587 | coreconfigitem( |
|
588 | 588 | b'defaults', |
|
589 | 589 | b'.*', |
|
590 | 590 | default=None, |
|
591 | 591 | generic=True, |
|
592 | 592 | ) |
|
593 | 593 | coreconfigitem( |
|
594 | 594 | b'devel', |
|
595 | 595 | b'all-warnings', |
|
596 | 596 | default=False, |
|
597 | 597 | ) |
|
598 | 598 | coreconfigitem( |
|
599 | 599 | b'devel', |
|
600 | 600 | b'bundle2.debug', |
|
601 | 601 | default=False, |
|
602 | 602 | ) |
|
603 | 603 | coreconfigitem( |
|
604 | 604 | b'devel', |
|
605 | 605 | b'bundle.delta', |
|
606 | 606 | default=b'', |
|
607 | 607 | ) |
|
608 | 608 | coreconfigitem( |
|
609 | 609 | b'devel', |
|
610 | 610 | b'cache-vfs', |
|
611 | 611 | default=None, |
|
612 | 612 | ) |
|
613 | 613 | coreconfigitem( |
|
614 | 614 | b'devel', |
|
615 | 615 | b'check-locks', |
|
616 | 616 | default=False, |
|
617 | 617 | ) |
|
618 | 618 | coreconfigitem( |
|
619 | 619 | b'devel', |
|
620 | 620 | b'check-relroot', |
|
621 | 621 | default=False, |
|
622 | 622 | ) |
|
623 | 623 | # Track copy information for all file, not just "added" one (very slow) |
|
624 | 624 | coreconfigitem( |
|
625 | 625 | b'devel', |
|
626 | 626 | b'copy-tracing.trace-all-files', |
|
627 | 627 | default=False, |
|
628 | 628 | ) |
|
629 | 629 | coreconfigitem( |
|
630 | 630 | b'devel', |
|
631 | 631 | b'default-date', |
|
632 | 632 | default=None, |
|
633 | 633 | ) |
|
634 | 634 | coreconfigitem( |
|
635 | 635 | b'devel', |
|
636 | 636 | b'deprec-warn', |
|
637 | 637 | default=False, |
|
638 | 638 | ) |
|
639 | 639 | coreconfigitem( |
|
640 | 640 | b'devel', |
|
641 | 641 | b'disableloaddefaultcerts', |
|
642 | 642 | default=False, |
|
643 | 643 | ) |
|
644 | 644 | coreconfigitem( |
|
645 | 645 | b'devel', |
|
646 | 646 | b'warn-empty-changegroup', |
|
647 | 647 | default=False, |
|
648 | 648 | ) |
|
649 | 649 | coreconfigitem( |
|
650 | 650 | b'devel', |
|
651 | 651 | b'legacy.exchange', |
|
652 | 652 | default=list, |
|
653 | 653 | ) |
|
654 | 654 | # When True, revlogs use a special reference version of the nodemap, that is not |
|
655 | 655 | # performant but is "known" to behave properly. |
|
656 | 656 | coreconfigitem( |
|
657 | 657 | b'devel', |
|
658 | 658 | b'persistent-nodemap', |
|
659 | 659 | default=False, |
|
660 | 660 | ) |
|
661 | 661 | coreconfigitem( |
|
662 | 662 | b'devel', |
|
663 | 663 | b'servercafile', |
|
664 | 664 | default=b'', |
|
665 | 665 | ) |
|
666 | 666 | coreconfigitem( |
|
667 | 667 | b'devel', |
|
668 | 668 | b'serverexactprotocol', |
|
669 | 669 | default=b'', |
|
670 | 670 | ) |
|
671 | 671 | coreconfigitem( |
|
672 | 672 | b'devel', |
|
673 | 673 | b'serverrequirecert', |
|
674 | 674 | default=False, |
|
675 | 675 | ) |
|
676 | 676 | coreconfigitem( |
|
677 | 677 | b'devel', |
|
678 | 678 | b'strip-obsmarkers', |
|
679 | 679 | default=True, |
|
680 | 680 | ) |
|
681 | 681 | coreconfigitem( |
|
682 | 682 | b'devel', |
|
683 | 683 | b'warn-config', |
|
684 | 684 | default=None, |
|
685 | 685 | ) |
|
686 | 686 | coreconfigitem( |
|
687 | 687 | b'devel', |
|
688 | 688 | b'warn-config-default', |
|
689 | 689 | default=None, |
|
690 | 690 | ) |
|
691 | 691 | coreconfigitem( |
|
692 | 692 | b'devel', |
|
693 | 693 | b'user.obsmarker', |
|
694 | 694 | default=None, |
|
695 | 695 | ) |
|
696 | 696 | coreconfigitem( |
|
697 | 697 | b'devel', |
|
698 | 698 | b'warn-config-unknown', |
|
699 | 699 | default=None, |
|
700 | 700 | ) |
|
701 | 701 | coreconfigitem( |
|
702 | 702 | b'devel', |
|
703 | 703 | b'debug.copies', |
|
704 | 704 | default=False, |
|
705 | 705 | ) |
|
706 | 706 | coreconfigitem( |
|
707 | 707 | b'devel', |
|
708 | 708 | b'copy-tracing.multi-thread', |
|
709 | 709 | default=True, |
|
710 | 710 | ) |
|
711 | 711 | coreconfigitem( |
|
712 | 712 | b'devel', |
|
713 | 713 | b'debug.extensions', |
|
714 | 714 | default=False, |
|
715 | 715 | ) |
|
716 | 716 | coreconfigitem( |
|
717 | 717 | b'devel', |
|
718 | 718 | b'debug.repo-filters', |
|
719 | 719 | default=False, |
|
720 | 720 | ) |
|
721 | 721 | coreconfigitem( |
|
722 | 722 | b'devel', |
|
723 | 723 | b'debug.peer-request', |
|
724 | 724 | default=False, |
|
725 | 725 | ) |
|
726 | 726 | # If discovery.exchange-heads is False, the discovery will not start with |
|
727 | 727 | # remote head fetching and local head querying. |
|
728 | 728 | coreconfigitem( |
|
729 | 729 | b'devel', |
|
730 | 730 | b'discovery.exchange-heads', |
|
731 | 731 | default=True, |
|
732 | 732 | ) |
|
733 | 733 | # If discovery.grow-sample is False, the sample size used in set discovery will |
|
734 | 734 | # not be increased through the process |
|
735 | 735 | coreconfigitem( |
|
736 | 736 | b'devel', |
|
737 | 737 | b'discovery.grow-sample', |
|
738 | 738 | default=True, |
|
739 | 739 | ) |
|
740 | 740 | # When discovery.grow-sample.dynamic is True, the default, the sample size is |
|
741 | 741 | # adapted to the shape of the undecided set (it is set to the max of: |
|
742 | 742 | # <target-size>, len(roots(undecided)), len(heads(undecided) |
|
743 | 743 | coreconfigitem( |
|
744 | 744 | b'devel', |
|
745 | 745 | b'discovery.grow-sample.dynamic', |
|
746 | 746 | default=True, |
|
747 | 747 | ) |
|
748 | 748 | # discovery.grow-sample.rate control the rate at which the sample grow |
|
749 | 749 | coreconfigitem( |
|
750 | 750 | b'devel', |
|
751 | 751 | b'discovery.grow-sample.rate', |
|
752 | 752 | default=1.05, |
|
753 | 753 | ) |
|
754 | 754 | # If discovery.randomize is False, random sampling during discovery are |
|
755 | 755 | # deterministic. It is meant for integration tests. |
|
756 | 756 | coreconfigitem( |
|
757 | 757 | b'devel', |
|
758 | 758 | b'discovery.randomize', |
|
759 | 759 | default=True, |
|
760 | 760 | ) |
|
761 | 761 | # Control the initial size of the discovery sample |
|
762 | 762 | coreconfigitem( |
|
763 | 763 | b'devel', |
|
764 | 764 | b'discovery.sample-size', |
|
765 | 765 | default=200, |
|
766 | 766 | ) |
|
767 | 767 | # Control the initial size of the discovery for initial change |
|
768 | 768 | coreconfigitem( |
|
769 | 769 | b'devel', |
|
770 | 770 | b'discovery.sample-size.initial', |
|
771 | 771 | default=100, |
|
772 | 772 | ) |
|
773 | 773 | _registerdiffopts(section=b'diff') |
|
774 | 774 | coreconfigitem( |
|
775 | 775 | b'diff', |
|
776 | 776 | b'merge', |
|
777 | 777 | default=False, |
|
778 | 778 | experimental=True, |
|
779 | 779 | ) |
|
780 | 780 | coreconfigitem( |
|
781 | 781 | b'email', |
|
782 | 782 | b'bcc', |
|
783 | 783 | default=None, |
|
784 | 784 | ) |
|
785 | 785 | coreconfigitem( |
|
786 | 786 | b'email', |
|
787 | 787 | b'cc', |
|
788 | 788 | default=None, |
|
789 | 789 | ) |
|
790 | 790 | coreconfigitem( |
|
791 | 791 | b'email', |
|
792 | 792 | b'charsets', |
|
793 | 793 | default=list, |
|
794 | 794 | ) |
|
795 | 795 | coreconfigitem( |
|
796 | 796 | b'email', |
|
797 | 797 | b'from', |
|
798 | 798 | default=None, |
|
799 | 799 | ) |
|
800 | 800 | coreconfigitem( |
|
801 | 801 | b'email', |
|
802 | 802 | b'method', |
|
803 | 803 | default=b'smtp', |
|
804 | 804 | ) |
|
805 | 805 | coreconfigitem( |
|
806 | 806 | b'email', |
|
807 | 807 | b'reply-to', |
|
808 | 808 | default=None, |
|
809 | 809 | ) |
|
810 | 810 | coreconfigitem( |
|
811 | 811 | b'email', |
|
812 | 812 | b'to', |
|
813 | 813 | default=None, |
|
814 | 814 | ) |
|
815 | 815 | coreconfigitem( |
|
816 | 816 | b'experimental', |
|
817 | 817 | b'archivemetatemplate', |
|
818 | 818 | default=dynamicdefault, |
|
819 | 819 | ) |
|
820 | 820 | coreconfigitem( |
|
821 | 821 | b'experimental', |
|
822 | 822 | b'auto-publish', |
|
823 | 823 | default=b'publish', |
|
824 | 824 | ) |
|
825 | 825 | coreconfigitem( |
|
826 | 826 | b'experimental', |
|
827 | 827 | b'bundle-phases', |
|
828 | 828 | default=False, |
|
829 | 829 | ) |
|
830 | 830 | coreconfigitem( |
|
831 | 831 | b'experimental', |
|
832 | 832 | b'bundle2-advertise', |
|
833 | 833 | default=True, |
|
834 | 834 | ) |
|
835 | 835 | coreconfigitem( |
|
836 | 836 | b'experimental', |
|
837 | 837 | b'bundle2-output-capture', |
|
838 | 838 | default=False, |
|
839 | 839 | ) |
|
840 | 840 | coreconfigitem( |
|
841 | 841 | b'experimental', |
|
842 | 842 | b'bundle2.pushback', |
|
843 | 843 | default=False, |
|
844 | 844 | ) |
|
845 | 845 | coreconfigitem( |
|
846 | 846 | b'experimental', |
|
847 | 847 | b'bundle2lazylocking', |
|
848 | 848 | default=False, |
|
849 | 849 | ) |
|
850 | 850 | coreconfigitem( |
|
851 | 851 | b'experimental', |
|
852 | 852 | b'bundlecomplevel', |
|
853 | 853 | default=None, |
|
854 | 854 | ) |
|
855 | 855 | coreconfigitem( |
|
856 | 856 | b'experimental', |
|
857 | 857 | b'bundlecomplevel.bzip2', |
|
858 | 858 | default=None, |
|
859 | 859 | ) |
|
860 | 860 | coreconfigitem( |
|
861 | 861 | b'experimental', |
|
862 | 862 | b'bundlecomplevel.gzip', |
|
863 | 863 | default=None, |
|
864 | 864 | ) |
|
865 | 865 | coreconfigitem( |
|
866 | 866 | b'experimental', |
|
867 | 867 | b'bundlecomplevel.none', |
|
868 | 868 | default=None, |
|
869 | 869 | ) |
|
870 | 870 | coreconfigitem( |
|
871 | 871 | b'experimental', |
|
872 | 872 | b'bundlecomplevel.zstd', |
|
873 | 873 | default=None, |
|
874 | 874 | ) |
|
875 | 875 | coreconfigitem( |
|
876 | 876 | b'experimental', |
|
877 | 877 | b'bundlecompthreads', |
|
878 | 878 | default=None, |
|
879 | 879 | ) |
|
880 | 880 | coreconfigitem( |
|
881 | 881 | b'experimental', |
|
882 | 882 | b'bundlecompthreads.bzip2', |
|
883 | 883 | default=None, |
|
884 | 884 | ) |
|
885 | 885 | coreconfigitem( |
|
886 | 886 | b'experimental', |
|
887 | 887 | b'bundlecompthreads.gzip', |
|
888 | 888 | default=None, |
|
889 | 889 | ) |
|
890 | 890 | coreconfigitem( |
|
891 | 891 | b'experimental', |
|
892 | 892 | b'bundlecompthreads.none', |
|
893 | 893 | default=None, |
|
894 | 894 | ) |
|
895 | 895 | coreconfigitem( |
|
896 | 896 | b'experimental', |
|
897 | 897 | b'bundlecompthreads.zstd', |
|
898 | 898 | default=None, |
|
899 | 899 | ) |
|
900 | 900 | coreconfigitem( |
|
901 | 901 | b'experimental', |
|
902 | 902 | b'changegroup3', |
|
903 | 903 | default=False, |
|
904 | 904 | ) |
|
905 | 905 | coreconfigitem( |
|
906 | 906 | b'experimental', |
|
907 | 907 | b'changegroup4', |
|
908 | 908 | default=False, |
|
909 | 909 | ) |
|
910 | 910 | coreconfigitem( |
|
911 | 911 | b'experimental', |
|
912 | 912 | b'cleanup-as-archived', |
|
913 | 913 | default=False, |
|
914 | 914 | ) |
|
915 | 915 | coreconfigitem( |
|
916 | 916 | b'experimental', |
|
917 | 917 | b'clientcompressionengines', |
|
918 | 918 | default=list, |
|
919 | 919 | ) |
|
920 | 920 | coreconfigitem( |
|
921 | 921 | b'experimental', |
|
922 | 922 | b'copytrace', |
|
923 | 923 | default=b'on', |
|
924 | 924 | ) |
|
925 | 925 | coreconfigitem( |
|
926 | 926 | b'experimental', |
|
927 | 927 | b'copytrace.movecandidateslimit', |
|
928 | 928 | default=100, |
|
929 | 929 | ) |
|
930 | 930 | coreconfigitem( |
|
931 | 931 | b'experimental', |
|
932 | 932 | b'copytrace.sourcecommitlimit', |
|
933 | 933 | default=100, |
|
934 | 934 | ) |
|
935 | 935 | coreconfigitem( |
|
936 | 936 | b'experimental', |
|
937 | 937 | b'copies.read-from', |
|
938 | 938 | default=b"filelog-only", |
|
939 | 939 | ) |
|
940 | 940 | coreconfigitem( |
|
941 | 941 | b'experimental', |
|
942 | 942 | b'copies.write-to', |
|
943 | 943 | default=b'filelog-only', |
|
944 | 944 | ) |
|
945 | 945 | coreconfigitem( |
|
946 | 946 | b'experimental', |
|
947 | 947 | b'crecordtest', |
|
948 | 948 | default=None, |
|
949 | 949 | ) |
|
950 | 950 | coreconfigitem( |
|
951 | 951 | b'experimental', |
|
952 | 952 | b'directaccess', |
|
953 | 953 | default=False, |
|
954 | 954 | ) |
|
955 | 955 | coreconfigitem( |
|
956 | 956 | b'experimental', |
|
957 | 957 | b'directaccess.revnums', |
|
958 | 958 | default=False, |
|
959 | 959 | ) |
|
960 | 960 | coreconfigitem( |
|
961 | 961 | b'experimental', |
|
962 | 962 | b'editortmpinhg', |
|
963 | 963 | default=False, |
|
964 | 964 | ) |
|
965 | 965 | coreconfigitem( |
|
966 | 966 | b'experimental', |
|
967 | 967 | b'evolution', |
|
968 | 968 | default=list, |
|
969 | 969 | ) |
|
970 | 970 | coreconfigitem( |
|
971 | 971 | b'experimental', |
|
972 | 972 | b'evolution.allowdivergence', |
|
973 | 973 | default=False, |
|
974 | 974 | alias=[(b'experimental', b'allowdivergence')], |
|
975 | 975 | ) |
|
976 | 976 | coreconfigitem( |
|
977 | 977 | b'experimental', |
|
978 | 978 | b'evolution.allowunstable', |
|
979 | 979 | default=None, |
|
980 | 980 | ) |
|
981 | 981 | coreconfigitem( |
|
982 | 982 | b'experimental', |
|
983 | 983 | b'evolution.createmarkers', |
|
984 | 984 | default=None, |
|
985 | 985 | ) |
|
986 | 986 | coreconfigitem( |
|
987 | 987 | b'experimental', |
|
988 | 988 | b'evolution.effect-flags', |
|
989 | 989 | default=True, |
|
990 | 990 | alias=[(b'experimental', b'effect-flags')], |
|
991 | 991 | ) |
|
992 | 992 | coreconfigitem( |
|
993 | 993 | b'experimental', |
|
994 | 994 | b'evolution.exchange', |
|
995 | 995 | default=None, |
|
996 | 996 | ) |
|
997 | 997 | coreconfigitem( |
|
998 | 998 | b'experimental', |
|
999 | 999 | b'evolution.bundle-obsmarker', |
|
1000 | 1000 | default=False, |
|
1001 | 1001 | ) |
|
1002 | 1002 | coreconfigitem( |
|
1003 | 1003 | b'experimental', |
|
1004 | 1004 | b'evolution.bundle-obsmarker:mandatory', |
|
1005 | 1005 | default=True, |
|
1006 | 1006 | ) |
|
1007 | 1007 | coreconfigitem( |
|
1008 | 1008 | b'experimental', |
|
1009 | 1009 | b'log.topo', |
|
1010 | 1010 | default=False, |
|
1011 | 1011 | ) |
|
1012 | 1012 | coreconfigitem( |
|
1013 | 1013 | b'experimental', |
|
1014 | 1014 | b'evolution.report-instabilities', |
|
1015 | 1015 | default=True, |
|
1016 | 1016 | ) |
|
1017 | 1017 | coreconfigitem( |
|
1018 | 1018 | b'experimental', |
|
1019 | 1019 | b'evolution.track-operation', |
|
1020 | 1020 | default=True, |
|
1021 | 1021 | ) |
|
1022 | 1022 | # repo-level config to exclude a revset visibility |
|
1023 | 1023 | # |
|
1024 | 1024 | # The target use case is to use `share` to expose different subset of the same |
|
1025 | 1025 | # repository, especially server side. See also `server.view`. |
|
1026 | 1026 | coreconfigitem( |
|
1027 | 1027 | b'experimental', |
|
1028 | 1028 | b'extra-filter-revs', |
|
1029 | 1029 | default=None, |
|
1030 | 1030 | ) |
|
1031 | 1031 | coreconfigitem( |
|
1032 | 1032 | b'experimental', |
|
1033 | 1033 | b'maxdeltachainspan', |
|
1034 | 1034 | default=-1, |
|
1035 | 1035 | ) |
|
1036 | 1036 | # tracks files which were undeleted (merge might delete them but we explicitly |
|
1037 | 1037 | # kept/undeleted them) and creates new filenodes for them |
|
1038 | 1038 | coreconfigitem( |
|
1039 | 1039 | b'experimental', |
|
1040 | 1040 | b'merge-track-salvaged', |
|
1041 | 1041 | default=False, |
|
1042 | 1042 | ) |
|
1043 | 1043 | coreconfigitem( |
|
1044 | 1044 | b'experimental', |
|
1045 | 1045 | b'mergetempdirprefix', |
|
1046 | 1046 | default=None, |
|
1047 | 1047 | ) |
|
1048 | 1048 | coreconfigitem( |
|
1049 | 1049 | b'experimental', |
|
1050 | 1050 | b'mmapindexthreshold', |
|
1051 | 1051 | default=None, |
|
1052 | 1052 | ) |
|
1053 | 1053 | coreconfigitem( |
|
1054 | 1054 | b'experimental', |
|
1055 | 1055 | b'narrow', |
|
1056 | 1056 | default=False, |
|
1057 | 1057 | ) |
|
1058 | 1058 | coreconfigitem( |
|
1059 | 1059 | b'experimental', |
|
1060 | 1060 | b'nonnormalparanoidcheck', |
|
1061 | 1061 | default=False, |
|
1062 | 1062 | ) |
|
1063 | 1063 | coreconfigitem( |
|
1064 | 1064 | b'experimental', |
|
1065 | 1065 | b'exportableenviron', |
|
1066 | 1066 | default=list, |
|
1067 | 1067 | ) |
|
1068 | 1068 | coreconfigitem( |
|
1069 | 1069 | b'experimental', |
|
1070 | 1070 | b'extendedheader.index', |
|
1071 | 1071 | default=None, |
|
1072 | 1072 | ) |
|
1073 | 1073 | coreconfigitem( |
|
1074 | 1074 | b'experimental', |
|
1075 | 1075 | b'extendedheader.similarity', |
|
1076 | 1076 | default=False, |
|
1077 | 1077 | ) |
|
1078 | 1078 | coreconfigitem( |
|
1079 | 1079 | b'experimental', |
|
1080 | 1080 | b'graphshorten', |
|
1081 | 1081 | default=False, |
|
1082 | 1082 | ) |
|
1083 | 1083 | coreconfigitem( |
|
1084 | 1084 | b'experimental', |
|
1085 | 1085 | b'graphstyle.parent', |
|
1086 | 1086 | default=dynamicdefault, |
|
1087 | 1087 | ) |
|
1088 | 1088 | coreconfigitem( |
|
1089 | 1089 | b'experimental', |
|
1090 | 1090 | b'graphstyle.missing', |
|
1091 | 1091 | default=dynamicdefault, |
|
1092 | 1092 | ) |
|
1093 | 1093 | coreconfigitem( |
|
1094 | 1094 | b'experimental', |
|
1095 | 1095 | b'graphstyle.grandparent', |
|
1096 | 1096 | default=dynamicdefault, |
|
1097 | 1097 | ) |
|
1098 | 1098 | coreconfigitem( |
|
1099 | 1099 | b'experimental', |
|
1100 | 1100 | b'hook-track-tags', |
|
1101 | 1101 | default=False, |
|
1102 | 1102 | ) |
|
1103 | 1103 | coreconfigitem( |
|
1104 | 1104 | b'experimental', |
|
1105 | 1105 | b'httppeer.advertise-v2', |
|
1106 | 1106 | default=False, |
|
1107 | 1107 | ) |
|
1108 | 1108 | coreconfigitem( |
|
1109 | 1109 | b'experimental', |
|
1110 | 1110 | b'httppeer.v2-encoder-order', |
|
1111 | 1111 | default=None, |
|
1112 | 1112 | ) |
|
1113 | 1113 | coreconfigitem( |
|
1114 | 1114 | b'experimental', |
|
1115 | 1115 | b'httppostargs', |
|
1116 | 1116 | default=False, |
|
1117 | 1117 | ) |
|
1118 | 1118 | coreconfigitem(b'experimental', b'nointerrupt', default=False) |
|
1119 | 1119 | coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True) |
|
1120 | 1120 | |
|
1121 | 1121 | coreconfigitem( |
|
1122 | 1122 | b'experimental', |
|
1123 | 1123 | b'obsmarkers-exchange-debug', |
|
1124 | 1124 | default=False, |
|
1125 | 1125 | ) |
|
1126 | 1126 | coreconfigitem( |
|
1127 | 1127 | b'experimental', |
|
1128 | 1128 | b'remotenames', |
|
1129 | 1129 | default=False, |
|
1130 | 1130 | ) |
|
1131 | 1131 | coreconfigitem( |
|
1132 | 1132 | b'experimental', |
|
1133 | 1133 | b'removeemptydirs', |
|
1134 | 1134 | default=True, |
|
1135 | 1135 | ) |
|
1136 | 1136 | coreconfigitem( |
|
1137 | 1137 | b'experimental', |
|
1138 | 1138 | b'revert.interactive.select-to-keep', |
|
1139 | 1139 | default=False, |
|
1140 | 1140 | ) |
|
1141 | 1141 | coreconfigitem( |
|
1142 | 1142 | b'experimental', |
|
1143 | 1143 | b'revisions.prefixhexnode', |
|
1144 | 1144 | default=False, |
|
1145 | 1145 | ) |
|
1146 | 1146 | # "out of experimental" todo list. |
|
1147 | 1147 | # |
|
1148 | 1148 | # * include management of a persistent nodemap in the main docket |
|
1149 | 1149 | # * enforce a "no-truncate" policy for mmap safety |
|
1150 | 1150 | # - for censoring operation |
|
1151 | 1151 | # - for stripping operation |
|
1152 | 1152 | # - for rollback operation |
|
1153 | 1153 | # * proper streaming (race free) of the docket file |
|
1154 | 1154 | # * track garbage data to evemtually allow rewriting -existing- sidedata. |
|
1155 | 1155 | # * Exchange-wise, we will also need to do something more efficient than |
|
1156 | 1156 | # keeping references to the affected revlogs, especially memory-wise when |
|
1157 | 1157 | # rewriting sidedata. |
|
1158 | 1158 | # * introduce a proper solution to reduce the number of filelog related files. |
|
1159 | 1159 | # * use caching for reading sidedata (similar to what we do for data). |
|
1160 | 1160 | # * no longer set offset=0 if sidedata_size=0 (simplify cutoff computation). |
|
1161 | 1161 | # * Improvement to consider |
|
1162 | 1162 | # - avoid compression header in chunk using the default compression? |
|
1163 | 1163 | # - forbid "inline" compression mode entirely? |
|
1164 | 1164 | # - split the data offset and flag field (the 2 bytes save are mostly trouble) |
|
1165 | 1165 | # - keep track of uncompressed -chunk- size (to preallocate memory better) |
|
1166 | 1166 | # - keep track of chain base or size (probably not that useful anymore) |
|
1167 | 1167 | coreconfigitem( |
|
1168 | 1168 | b'experimental', |
|
1169 | 1169 | b'revlogv2', |
|
1170 | 1170 | default=None, |
|
1171 | 1171 | ) |
|
1172 | 1172 | coreconfigitem( |
|
1173 | 1173 | b'experimental', |
|
1174 | 1174 | b'revisions.disambiguatewithin', |
|
1175 | 1175 | default=None, |
|
1176 | 1176 | ) |
|
1177 | 1177 | coreconfigitem( |
|
1178 | 1178 | b'experimental', |
|
1179 | 1179 | b'rust.index', |
|
1180 | 1180 | default=False, |
|
1181 | 1181 | ) |
|
1182 | 1182 | coreconfigitem( |
|
1183 | 1183 | b'experimental', |
|
1184 | 1184 | b'server.filesdata.recommended-batch-size', |
|
1185 | 1185 | default=50000, |
|
1186 | 1186 | ) |
|
1187 | 1187 | coreconfigitem( |
|
1188 | 1188 | b'experimental', |
|
1189 | 1189 | b'server.manifestdata.recommended-batch-size', |
|
1190 | 1190 | default=100000, |
|
1191 | 1191 | ) |
|
1192 | 1192 | coreconfigitem( |
|
1193 | 1193 | b'experimental', |
|
1194 | 1194 | b'server.stream-narrow-clones', |
|
1195 | 1195 | default=False, |
|
1196 | 1196 | ) |
|
1197 | 1197 | coreconfigitem( |
|
1198 | 1198 | b'experimental', |
|
1199 | 1199 | b'single-head-per-branch', |
|
1200 | 1200 | default=False, |
|
1201 | 1201 | ) |
|
1202 | 1202 | coreconfigitem( |
|
1203 | 1203 | b'experimental', |
|
1204 | 1204 | b'single-head-per-branch:account-closed-heads', |
|
1205 | 1205 | default=False, |
|
1206 | 1206 | ) |
|
1207 | 1207 | coreconfigitem( |
|
1208 | 1208 | b'experimental', |
|
1209 | 1209 | b'single-head-per-branch:public-changes-only', |
|
1210 | 1210 | default=False, |
|
1211 | 1211 | ) |
|
1212 | 1212 | coreconfigitem( |
|
1213 | 1213 | b'experimental', |
|
1214 | 1214 | b'sshserver.support-v2', |
|
1215 | 1215 | default=False, |
|
1216 | 1216 | ) |
|
1217 | 1217 | coreconfigitem( |
|
1218 | 1218 | b'experimental', |
|
1219 | 1219 | b'sparse-read', |
|
1220 | 1220 | default=False, |
|
1221 | 1221 | ) |
|
1222 | 1222 | coreconfigitem( |
|
1223 | 1223 | b'experimental', |
|
1224 | 1224 | b'sparse-read.density-threshold', |
|
1225 | 1225 | default=0.50, |
|
1226 | 1226 | ) |
|
1227 | 1227 | coreconfigitem( |
|
1228 | 1228 | b'experimental', |
|
1229 | 1229 | b'sparse-read.min-gap-size', |
|
1230 | 1230 | default=b'65K', |
|
1231 | 1231 | ) |
|
1232 | 1232 | coreconfigitem( |
|
1233 | 1233 | b'experimental', |
|
1234 | 1234 | b'treemanifest', |
|
1235 | 1235 | default=False, |
|
1236 | 1236 | ) |
|
1237 | 1237 | coreconfigitem( |
|
1238 | 1238 | b'experimental', |
|
1239 | 1239 | b'update.atomic-file', |
|
1240 | 1240 | default=False, |
|
1241 | 1241 | ) |
|
1242 | 1242 | coreconfigitem( |
|
1243 | 1243 | b'experimental', |
|
1244 | 1244 | b'sshpeer.advertise-v2', |
|
1245 | 1245 | default=False, |
|
1246 | 1246 | ) |
|
1247 | 1247 | coreconfigitem( |
|
1248 | 1248 | b'experimental', |
|
1249 | 1249 | b'web.apiserver', |
|
1250 | 1250 | default=False, |
|
1251 | 1251 | ) |
|
1252 | 1252 | coreconfigitem( |
|
1253 | 1253 | b'experimental', |
|
1254 | 1254 | b'web.api.http-v2', |
|
1255 | 1255 | default=False, |
|
1256 | 1256 | ) |
|
1257 | 1257 | coreconfigitem( |
|
1258 | 1258 | b'experimental', |
|
1259 | 1259 | b'web.api.debugreflect', |
|
1260 | 1260 | default=False, |
|
1261 | 1261 | ) |
|
1262 | 1262 | coreconfigitem( |
|
1263 | 1263 | b'experimental', |
|
1264 | 1264 | b'web.full-garbage-collection-rate', |
|
1265 | 1265 | default=1, # still forcing a full collection on each request |
|
1266 | 1266 | ) |
|
1267 | 1267 | coreconfigitem( |
|
1268 | 1268 | b'experimental', |
|
1269 | 1269 | b'worker.wdir-get-thread-safe', |
|
1270 | 1270 | default=False, |
|
1271 | 1271 | ) |
|
1272 | 1272 | coreconfigitem( |
|
1273 | 1273 | b'experimental', |
|
1274 | 1274 | b'worker.repository-upgrade', |
|
1275 | 1275 | default=False, |
|
1276 | 1276 | ) |
|
1277 | 1277 | coreconfigitem( |
|
1278 | 1278 | b'experimental', |
|
1279 | 1279 | b'xdiff', |
|
1280 | 1280 | default=False, |
|
1281 | 1281 | ) |
|
1282 | 1282 | coreconfigitem( |
|
1283 | 1283 | b'extensions', |
|
1284 | 1284 | b'[^:]*', |
|
1285 | 1285 | default=None, |
|
1286 | 1286 | generic=True, |
|
1287 | 1287 | ) |
|
1288 | 1288 | coreconfigitem( |
|
1289 | b'extensions', | |
|
1290 | b'[^:]*:required', | |
|
1291 | default=False, | |
|
1292 | generic=True, | |
|
1293 | ) | |
|
1294 | coreconfigitem( | |
|
1289 | 1295 | b'extdata', |
|
1290 | 1296 | b'.*', |
|
1291 | 1297 | default=None, |
|
1292 | 1298 | generic=True, |
|
1293 | 1299 | ) |
|
1294 | 1300 | coreconfigitem( |
|
1295 | 1301 | b'format', |
|
1296 | 1302 | b'bookmarks-in-store', |
|
1297 | 1303 | default=False, |
|
1298 | 1304 | ) |
|
1299 | 1305 | coreconfigitem( |
|
1300 | 1306 | b'format', |
|
1301 | 1307 | b'chunkcachesize', |
|
1302 | 1308 | default=None, |
|
1303 | 1309 | experimental=True, |
|
1304 | 1310 | ) |
|
1305 | 1311 | coreconfigitem( |
|
1306 | 1312 | # Enable this dirstate format *when creating a new repository*. |
|
1307 | 1313 | # Which format to use for existing repos is controlled by .hg/requires |
|
1308 | 1314 | b'format', |
|
1309 | 1315 | b'exp-rc-dirstate-v2', |
|
1310 | 1316 | default=False, |
|
1311 | 1317 | experimental=True, |
|
1312 | 1318 | ) |
|
1313 | 1319 | coreconfigitem( |
|
1314 | 1320 | b'format', |
|
1315 | 1321 | b'dotencode', |
|
1316 | 1322 | default=True, |
|
1317 | 1323 | ) |
|
1318 | 1324 | coreconfigitem( |
|
1319 | 1325 | b'format', |
|
1320 | 1326 | b'generaldelta', |
|
1321 | 1327 | default=False, |
|
1322 | 1328 | experimental=True, |
|
1323 | 1329 | ) |
|
1324 | 1330 | coreconfigitem( |
|
1325 | 1331 | b'format', |
|
1326 | 1332 | b'manifestcachesize', |
|
1327 | 1333 | default=None, |
|
1328 | 1334 | experimental=True, |
|
1329 | 1335 | ) |
|
1330 | 1336 | coreconfigitem( |
|
1331 | 1337 | b'format', |
|
1332 | 1338 | b'maxchainlen', |
|
1333 | 1339 | default=dynamicdefault, |
|
1334 | 1340 | experimental=True, |
|
1335 | 1341 | ) |
|
1336 | 1342 | coreconfigitem( |
|
1337 | 1343 | b'format', |
|
1338 | 1344 | b'obsstore-version', |
|
1339 | 1345 | default=None, |
|
1340 | 1346 | ) |
|
1341 | 1347 | coreconfigitem( |
|
1342 | 1348 | b'format', |
|
1343 | 1349 | b'sparse-revlog', |
|
1344 | 1350 | default=True, |
|
1345 | 1351 | ) |
|
1346 | 1352 | coreconfigitem( |
|
1347 | 1353 | b'format', |
|
1348 | 1354 | b'revlog-compression', |
|
1349 | 1355 | default=lambda: [b'zstd', b'zlib'], |
|
1350 | 1356 | alias=[(b'experimental', b'format.compression')], |
|
1351 | 1357 | ) |
|
1352 | 1358 | # Experimental TODOs: |
|
1353 | 1359 | # |
|
1354 | 1360 | # * Same as for evlogv2 (but for the reduction of the number of files) |
|
1355 | 1361 | # * Improvement to investigate |
|
1356 | 1362 | # - storing .hgtags fnode |
|
1357 | 1363 | # - storing `rank` of changesets |
|
1358 | 1364 | # - storing branch related identifier |
|
1359 | 1365 | |
|
1360 | 1366 | coreconfigitem( |
|
1361 | 1367 | b'format', |
|
1362 | 1368 | b'exp-use-changelog-v2', |
|
1363 | 1369 | default=None, |
|
1364 | 1370 | experimental=True, |
|
1365 | 1371 | ) |
|
1366 | 1372 | coreconfigitem( |
|
1367 | 1373 | b'format', |
|
1368 | 1374 | b'usefncache', |
|
1369 | 1375 | default=True, |
|
1370 | 1376 | ) |
|
1371 | 1377 | coreconfigitem( |
|
1372 | 1378 | b'format', |
|
1373 | 1379 | b'usegeneraldelta', |
|
1374 | 1380 | default=True, |
|
1375 | 1381 | ) |
|
1376 | 1382 | coreconfigitem( |
|
1377 | 1383 | b'format', |
|
1378 | 1384 | b'usestore', |
|
1379 | 1385 | default=True, |
|
1380 | 1386 | ) |
|
1381 | 1387 | |
|
1382 | 1388 | |
|
1383 | 1389 | def _persistent_nodemap_default(): |
|
1384 | 1390 | """compute `use-persistent-nodemap` default value |
|
1385 | 1391 | |
|
1386 | 1392 | The feature is disabled unless a fast implementation is available. |
|
1387 | 1393 | """ |
|
1388 | 1394 | from . import policy |
|
1389 | 1395 | |
|
1390 | 1396 | return policy.importrust('revlog') is not None |
|
1391 | 1397 | |
|
1392 | 1398 | |
|
1393 | 1399 | coreconfigitem( |
|
1394 | 1400 | b'format', |
|
1395 | 1401 | b'use-persistent-nodemap', |
|
1396 | 1402 | default=_persistent_nodemap_default, |
|
1397 | 1403 | ) |
|
1398 | 1404 | coreconfigitem( |
|
1399 | 1405 | b'format', |
|
1400 | 1406 | b'exp-use-copies-side-data-changeset', |
|
1401 | 1407 | default=False, |
|
1402 | 1408 | experimental=True, |
|
1403 | 1409 | ) |
|
1404 | 1410 | coreconfigitem( |
|
1405 | 1411 | b'format', |
|
1406 | 1412 | b'use-share-safe', |
|
1407 | 1413 | default=False, |
|
1408 | 1414 | ) |
|
1409 | 1415 | coreconfigitem( |
|
1410 | 1416 | b'format', |
|
1411 | 1417 | b'internal-phase', |
|
1412 | 1418 | default=False, |
|
1413 | 1419 | experimental=True, |
|
1414 | 1420 | ) |
|
1415 | 1421 | coreconfigitem( |
|
1416 | 1422 | b'fsmonitor', |
|
1417 | 1423 | b'warn_when_unused', |
|
1418 | 1424 | default=True, |
|
1419 | 1425 | ) |
|
1420 | 1426 | coreconfigitem( |
|
1421 | 1427 | b'fsmonitor', |
|
1422 | 1428 | b'warn_update_file_count', |
|
1423 | 1429 | default=50000, |
|
1424 | 1430 | ) |
|
1425 | 1431 | coreconfigitem( |
|
1426 | 1432 | b'fsmonitor', |
|
1427 | 1433 | b'warn_update_file_count_rust', |
|
1428 | 1434 | default=400000, |
|
1429 | 1435 | ) |
|
1430 | 1436 | coreconfigitem( |
|
1431 | 1437 | b'help', |
|
1432 | 1438 | br'hidden-command\..*', |
|
1433 | 1439 | default=False, |
|
1434 | 1440 | generic=True, |
|
1435 | 1441 | ) |
|
1436 | 1442 | coreconfigitem( |
|
1437 | 1443 | b'help', |
|
1438 | 1444 | br'hidden-topic\..*', |
|
1439 | 1445 | default=False, |
|
1440 | 1446 | generic=True, |
|
1441 | 1447 | ) |
|
1442 | 1448 | coreconfigitem( |
|
1443 | 1449 | b'hooks', |
|
1444 | 1450 | b'[^:]*', |
|
1445 | 1451 | default=dynamicdefault, |
|
1446 | 1452 | generic=True, |
|
1447 | 1453 | ) |
|
1448 | 1454 | coreconfigitem( |
|
1449 | 1455 | b'hooks', |
|
1450 | 1456 | b'.*:run-with-plain', |
|
1451 | 1457 | default=True, |
|
1452 | 1458 | generic=True, |
|
1453 | 1459 | ) |
|
1454 | 1460 | coreconfigitem( |
|
1455 | 1461 | b'hgweb-paths', |
|
1456 | 1462 | b'.*', |
|
1457 | 1463 | default=list, |
|
1458 | 1464 | generic=True, |
|
1459 | 1465 | ) |
|
1460 | 1466 | coreconfigitem( |
|
1461 | 1467 | b'hostfingerprints', |
|
1462 | 1468 | b'.*', |
|
1463 | 1469 | default=list, |
|
1464 | 1470 | generic=True, |
|
1465 | 1471 | ) |
|
1466 | 1472 | coreconfigitem( |
|
1467 | 1473 | b'hostsecurity', |
|
1468 | 1474 | b'ciphers', |
|
1469 | 1475 | default=None, |
|
1470 | 1476 | ) |
|
1471 | 1477 | coreconfigitem( |
|
1472 | 1478 | b'hostsecurity', |
|
1473 | 1479 | b'minimumprotocol', |
|
1474 | 1480 | default=dynamicdefault, |
|
1475 | 1481 | ) |
|
1476 | 1482 | coreconfigitem( |
|
1477 | 1483 | b'hostsecurity', |
|
1478 | 1484 | b'.*:minimumprotocol$', |
|
1479 | 1485 | default=dynamicdefault, |
|
1480 | 1486 | generic=True, |
|
1481 | 1487 | ) |
|
1482 | 1488 | coreconfigitem( |
|
1483 | 1489 | b'hostsecurity', |
|
1484 | 1490 | b'.*:ciphers$', |
|
1485 | 1491 | default=dynamicdefault, |
|
1486 | 1492 | generic=True, |
|
1487 | 1493 | ) |
|
1488 | 1494 | coreconfigitem( |
|
1489 | 1495 | b'hostsecurity', |
|
1490 | 1496 | b'.*:fingerprints$', |
|
1491 | 1497 | default=list, |
|
1492 | 1498 | generic=True, |
|
1493 | 1499 | ) |
|
1494 | 1500 | coreconfigitem( |
|
1495 | 1501 | b'hostsecurity', |
|
1496 | 1502 | b'.*:verifycertsfile$', |
|
1497 | 1503 | default=None, |
|
1498 | 1504 | generic=True, |
|
1499 | 1505 | ) |
|
1500 | 1506 | |
|
1501 | 1507 | coreconfigitem( |
|
1502 | 1508 | b'http_proxy', |
|
1503 | 1509 | b'always', |
|
1504 | 1510 | default=False, |
|
1505 | 1511 | ) |
|
1506 | 1512 | coreconfigitem( |
|
1507 | 1513 | b'http_proxy', |
|
1508 | 1514 | b'host', |
|
1509 | 1515 | default=None, |
|
1510 | 1516 | ) |
|
1511 | 1517 | coreconfigitem( |
|
1512 | 1518 | b'http_proxy', |
|
1513 | 1519 | b'no', |
|
1514 | 1520 | default=list, |
|
1515 | 1521 | ) |
|
1516 | 1522 | coreconfigitem( |
|
1517 | 1523 | b'http_proxy', |
|
1518 | 1524 | b'passwd', |
|
1519 | 1525 | default=None, |
|
1520 | 1526 | ) |
|
1521 | 1527 | coreconfigitem( |
|
1522 | 1528 | b'http_proxy', |
|
1523 | 1529 | b'user', |
|
1524 | 1530 | default=None, |
|
1525 | 1531 | ) |
|
1526 | 1532 | |
|
1527 | 1533 | coreconfigitem( |
|
1528 | 1534 | b'http', |
|
1529 | 1535 | b'timeout', |
|
1530 | 1536 | default=None, |
|
1531 | 1537 | ) |
|
1532 | 1538 | |
|
1533 | 1539 | coreconfigitem( |
|
1534 | 1540 | b'logtoprocess', |
|
1535 | 1541 | b'commandexception', |
|
1536 | 1542 | default=None, |
|
1537 | 1543 | ) |
|
1538 | 1544 | coreconfigitem( |
|
1539 | 1545 | b'logtoprocess', |
|
1540 | 1546 | b'commandfinish', |
|
1541 | 1547 | default=None, |
|
1542 | 1548 | ) |
|
1543 | 1549 | coreconfigitem( |
|
1544 | 1550 | b'logtoprocess', |
|
1545 | 1551 | b'command', |
|
1546 | 1552 | default=None, |
|
1547 | 1553 | ) |
|
1548 | 1554 | coreconfigitem( |
|
1549 | 1555 | b'logtoprocess', |
|
1550 | 1556 | b'develwarn', |
|
1551 | 1557 | default=None, |
|
1552 | 1558 | ) |
|
1553 | 1559 | coreconfigitem( |
|
1554 | 1560 | b'logtoprocess', |
|
1555 | 1561 | b'uiblocked', |
|
1556 | 1562 | default=None, |
|
1557 | 1563 | ) |
|
1558 | 1564 | coreconfigitem( |
|
1559 | 1565 | b'merge', |
|
1560 | 1566 | b'checkunknown', |
|
1561 | 1567 | default=b'abort', |
|
1562 | 1568 | ) |
|
1563 | 1569 | coreconfigitem( |
|
1564 | 1570 | b'merge', |
|
1565 | 1571 | b'checkignored', |
|
1566 | 1572 | default=b'abort', |
|
1567 | 1573 | ) |
|
1568 | 1574 | coreconfigitem( |
|
1569 | 1575 | b'experimental', |
|
1570 | 1576 | b'merge.checkpathconflicts', |
|
1571 | 1577 | default=False, |
|
1572 | 1578 | ) |
|
1573 | 1579 | coreconfigitem( |
|
1574 | 1580 | b'merge', |
|
1575 | 1581 | b'followcopies', |
|
1576 | 1582 | default=True, |
|
1577 | 1583 | ) |
|
1578 | 1584 | coreconfigitem( |
|
1579 | 1585 | b'merge', |
|
1580 | 1586 | b'on-failure', |
|
1581 | 1587 | default=b'continue', |
|
1582 | 1588 | ) |
|
1583 | 1589 | coreconfigitem( |
|
1584 | 1590 | b'merge', |
|
1585 | 1591 | b'preferancestor', |
|
1586 | 1592 | default=lambda: [b'*'], |
|
1587 | 1593 | experimental=True, |
|
1588 | 1594 | ) |
|
1589 | 1595 | coreconfigitem( |
|
1590 | 1596 | b'merge', |
|
1591 | 1597 | b'strict-capability-check', |
|
1592 | 1598 | default=False, |
|
1593 | 1599 | ) |
|
1594 | 1600 | coreconfigitem( |
|
1595 | 1601 | b'merge-tools', |
|
1596 | 1602 | b'.*', |
|
1597 | 1603 | default=None, |
|
1598 | 1604 | generic=True, |
|
1599 | 1605 | ) |
|
1600 | 1606 | coreconfigitem( |
|
1601 | 1607 | b'merge-tools', |
|
1602 | 1608 | br'.*\.args$', |
|
1603 | 1609 | default=b"$local $base $other", |
|
1604 | 1610 | generic=True, |
|
1605 | 1611 | priority=-1, |
|
1606 | 1612 | ) |
|
1607 | 1613 | coreconfigitem( |
|
1608 | 1614 | b'merge-tools', |
|
1609 | 1615 | br'.*\.binary$', |
|
1610 | 1616 | default=False, |
|
1611 | 1617 | generic=True, |
|
1612 | 1618 | priority=-1, |
|
1613 | 1619 | ) |
|
1614 | 1620 | coreconfigitem( |
|
1615 | 1621 | b'merge-tools', |
|
1616 | 1622 | br'.*\.check$', |
|
1617 | 1623 | default=list, |
|
1618 | 1624 | generic=True, |
|
1619 | 1625 | priority=-1, |
|
1620 | 1626 | ) |
|
1621 | 1627 | coreconfigitem( |
|
1622 | 1628 | b'merge-tools', |
|
1623 | 1629 | br'.*\.checkchanged$', |
|
1624 | 1630 | default=False, |
|
1625 | 1631 | generic=True, |
|
1626 | 1632 | priority=-1, |
|
1627 | 1633 | ) |
|
1628 | 1634 | coreconfigitem( |
|
1629 | 1635 | b'merge-tools', |
|
1630 | 1636 | br'.*\.executable$', |
|
1631 | 1637 | default=dynamicdefault, |
|
1632 | 1638 | generic=True, |
|
1633 | 1639 | priority=-1, |
|
1634 | 1640 | ) |
|
1635 | 1641 | coreconfigitem( |
|
1636 | 1642 | b'merge-tools', |
|
1637 | 1643 | br'.*\.fixeol$', |
|
1638 | 1644 | default=False, |
|
1639 | 1645 | generic=True, |
|
1640 | 1646 | priority=-1, |
|
1641 | 1647 | ) |
|
1642 | 1648 | coreconfigitem( |
|
1643 | 1649 | b'merge-tools', |
|
1644 | 1650 | br'.*\.gui$', |
|
1645 | 1651 | default=False, |
|
1646 | 1652 | generic=True, |
|
1647 | 1653 | priority=-1, |
|
1648 | 1654 | ) |
|
1649 | 1655 | coreconfigitem( |
|
1650 | 1656 | b'merge-tools', |
|
1651 | 1657 | br'.*\.mergemarkers$', |
|
1652 | 1658 | default=b'basic', |
|
1653 | 1659 | generic=True, |
|
1654 | 1660 | priority=-1, |
|
1655 | 1661 | ) |
|
1656 | 1662 | coreconfigitem( |
|
1657 | 1663 | b'merge-tools', |
|
1658 | 1664 | br'.*\.mergemarkertemplate$', |
|
1659 | 1665 | default=dynamicdefault, # take from command-templates.mergemarker |
|
1660 | 1666 | generic=True, |
|
1661 | 1667 | priority=-1, |
|
1662 | 1668 | ) |
|
1663 | 1669 | coreconfigitem( |
|
1664 | 1670 | b'merge-tools', |
|
1665 | 1671 | br'.*\.priority$', |
|
1666 | 1672 | default=0, |
|
1667 | 1673 | generic=True, |
|
1668 | 1674 | priority=-1, |
|
1669 | 1675 | ) |
|
1670 | 1676 | coreconfigitem( |
|
1671 | 1677 | b'merge-tools', |
|
1672 | 1678 | br'.*\.premerge$', |
|
1673 | 1679 | default=dynamicdefault, |
|
1674 | 1680 | generic=True, |
|
1675 | 1681 | priority=-1, |
|
1676 | 1682 | ) |
|
1677 | 1683 | coreconfigitem( |
|
1678 | 1684 | b'merge-tools', |
|
1679 | 1685 | br'.*\.symlink$', |
|
1680 | 1686 | default=False, |
|
1681 | 1687 | generic=True, |
|
1682 | 1688 | priority=-1, |
|
1683 | 1689 | ) |
|
1684 | 1690 | coreconfigitem( |
|
1685 | 1691 | b'pager', |
|
1686 | 1692 | b'attend-.*', |
|
1687 | 1693 | default=dynamicdefault, |
|
1688 | 1694 | generic=True, |
|
1689 | 1695 | ) |
|
1690 | 1696 | coreconfigitem( |
|
1691 | 1697 | b'pager', |
|
1692 | 1698 | b'ignore', |
|
1693 | 1699 | default=list, |
|
1694 | 1700 | ) |
|
1695 | 1701 | coreconfigitem( |
|
1696 | 1702 | b'pager', |
|
1697 | 1703 | b'pager', |
|
1698 | 1704 | default=dynamicdefault, |
|
1699 | 1705 | ) |
|
1700 | 1706 | coreconfigitem( |
|
1701 | 1707 | b'patch', |
|
1702 | 1708 | b'eol', |
|
1703 | 1709 | default=b'strict', |
|
1704 | 1710 | ) |
|
1705 | 1711 | coreconfigitem( |
|
1706 | 1712 | b'patch', |
|
1707 | 1713 | b'fuzz', |
|
1708 | 1714 | default=2, |
|
1709 | 1715 | ) |
|
1710 | 1716 | coreconfigitem( |
|
1711 | 1717 | b'paths', |
|
1712 | 1718 | b'default', |
|
1713 | 1719 | default=None, |
|
1714 | 1720 | ) |
|
1715 | 1721 | coreconfigitem( |
|
1716 | 1722 | b'paths', |
|
1717 | 1723 | b'default-push', |
|
1718 | 1724 | default=None, |
|
1719 | 1725 | ) |
|
1720 | 1726 | coreconfigitem( |
|
1721 | 1727 | b'paths', |
|
1722 | 1728 | b'.*', |
|
1723 | 1729 | default=None, |
|
1724 | 1730 | generic=True, |
|
1725 | 1731 | ) |
|
1726 | 1732 | coreconfigitem( |
|
1727 | 1733 | b'phases', |
|
1728 | 1734 | b'checksubrepos', |
|
1729 | 1735 | default=b'follow', |
|
1730 | 1736 | ) |
|
1731 | 1737 | coreconfigitem( |
|
1732 | 1738 | b'phases', |
|
1733 | 1739 | b'new-commit', |
|
1734 | 1740 | default=b'draft', |
|
1735 | 1741 | ) |
|
1736 | 1742 | coreconfigitem( |
|
1737 | 1743 | b'phases', |
|
1738 | 1744 | b'publish', |
|
1739 | 1745 | default=True, |
|
1740 | 1746 | ) |
|
1741 | 1747 | coreconfigitem( |
|
1742 | 1748 | b'profiling', |
|
1743 | 1749 | b'enabled', |
|
1744 | 1750 | default=False, |
|
1745 | 1751 | ) |
|
1746 | 1752 | coreconfigitem( |
|
1747 | 1753 | b'profiling', |
|
1748 | 1754 | b'format', |
|
1749 | 1755 | default=b'text', |
|
1750 | 1756 | ) |
|
1751 | 1757 | coreconfigitem( |
|
1752 | 1758 | b'profiling', |
|
1753 | 1759 | b'freq', |
|
1754 | 1760 | default=1000, |
|
1755 | 1761 | ) |
|
1756 | 1762 | coreconfigitem( |
|
1757 | 1763 | b'profiling', |
|
1758 | 1764 | b'limit', |
|
1759 | 1765 | default=30, |
|
1760 | 1766 | ) |
|
1761 | 1767 | coreconfigitem( |
|
1762 | 1768 | b'profiling', |
|
1763 | 1769 | b'nested', |
|
1764 | 1770 | default=0, |
|
1765 | 1771 | ) |
|
1766 | 1772 | coreconfigitem( |
|
1767 | 1773 | b'profiling', |
|
1768 | 1774 | b'output', |
|
1769 | 1775 | default=None, |
|
1770 | 1776 | ) |
|
1771 | 1777 | coreconfigitem( |
|
1772 | 1778 | b'profiling', |
|
1773 | 1779 | b'showmax', |
|
1774 | 1780 | default=0.999, |
|
1775 | 1781 | ) |
|
1776 | 1782 | coreconfigitem( |
|
1777 | 1783 | b'profiling', |
|
1778 | 1784 | b'showmin', |
|
1779 | 1785 | default=dynamicdefault, |
|
1780 | 1786 | ) |
|
1781 | 1787 | coreconfigitem( |
|
1782 | 1788 | b'profiling', |
|
1783 | 1789 | b'showtime', |
|
1784 | 1790 | default=True, |
|
1785 | 1791 | ) |
|
1786 | 1792 | coreconfigitem( |
|
1787 | 1793 | b'profiling', |
|
1788 | 1794 | b'sort', |
|
1789 | 1795 | default=b'inlinetime', |
|
1790 | 1796 | ) |
|
1791 | 1797 | coreconfigitem( |
|
1792 | 1798 | b'profiling', |
|
1793 | 1799 | b'statformat', |
|
1794 | 1800 | default=b'hotpath', |
|
1795 | 1801 | ) |
|
1796 | 1802 | coreconfigitem( |
|
1797 | 1803 | b'profiling', |
|
1798 | 1804 | b'time-track', |
|
1799 | 1805 | default=dynamicdefault, |
|
1800 | 1806 | ) |
|
1801 | 1807 | coreconfigitem( |
|
1802 | 1808 | b'profiling', |
|
1803 | 1809 | b'type', |
|
1804 | 1810 | default=b'stat', |
|
1805 | 1811 | ) |
|
1806 | 1812 | coreconfigitem( |
|
1807 | 1813 | b'progress', |
|
1808 | 1814 | b'assume-tty', |
|
1809 | 1815 | default=False, |
|
1810 | 1816 | ) |
|
1811 | 1817 | coreconfigitem( |
|
1812 | 1818 | b'progress', |
|
1813 | 1819 | b'changedelay', |
|
1814 | 1820 | default=1, |
|
1815 | 1821 | ) |
|
1816 | 1822 | coreconfigitem( |
|
1817 | 1823 | b'progress', |
|
1818 | 1824 | b'clear-complete', |
|
1819 | 1825 | default=True, |
|
1820 | 1826 | ) |
|
1821 | 1827 | coreconfigitem( |
|
1822 | 1828 | b'progress', |
|
1823 | 1829 | b'debug', |
|
1824 | 1830 | default=False, |
|
1825 | 1831 | ) |
|
1826 | 1832 | coreconfigitem( |
|
1827 | 1833 | b'progress', |
|
1828 | 1834 | b'delay', |
|
1829 | 1835 | default=3, |
|
1830 | 1836 | ) |
|
1831 | 1837 | coreconfigitem( |
|
1832 | 1838 | b'progress', |
|
1833 | 1839 | b'disable', |
|
1834 | 1840 | default=False, |
|
1835 | 1841 | ) |
|
1836 | 1842 | coreconfigitem( |
|
1837 | 1843 | b'progress', |
|
1838 | 1844 | b'estimateinterval', |
|
1839 | 1845 | default=60.0, |
|
1840 | 1846 | ) |
|
1841 | 1847 | coreconfigitem( |
|
1842 | 1848 | b'progress', |
|
1843 | 1849 | b'format', |
|
1844 | 1850 | default=lambda: [b'topic', b'bar', b'number', b'estimate'], |
|
1845 | 1851 | ) |
|
1846 | 1852 | coreconfigitem( |
|
1847 | 1853 | b'progress', |
|
1848 | 1854 | b'refresh', |
|
1849 | 1855 | default=0.1, |
|
1850 | 1856 | ) |
|
1851 | 1857 | coreconfigitem( |
|
1852 | 1858 | b'progress', |
|
1853 | 1859 | b'width', |
|
1854 | 1860 | default=dynamicdefault, |
|
1855 | 1861 | ) |
|
1856 | 1862 | coreconfigitem( |
|
1857 | 1863 | b'pull', |
|
1858 | 1864 | b'confirm', |
|
1859 | 1865 | default=False, |
|
1860 | 1866 | ) |
|
1861 | 1867 | coreconfigitem( |
|
1862 | 1868 | b'push', |
|
1863 | 1869 | b'pushvars.server', |
|
1864 | 1870 | default=False, |
|
1865 | 1871 | ) |
|
1866 | 1872 | coreconfigitem( |
|
1867 | 1873 | b'rewrite', |
|
1868 | 1874 | b'backup-bundle', |
|
1869 | 1875 | default=True, |
|
1870 | 1876 | alias=[(b'ui', b'history-editing-backup')], |
|
1871 | 1877 | ) |
|
1872 | 1878 | coreconfigitem( |
|
1873 | 1879 | b'rewrite', |
|
1874 | 1880 | b'update-timestamp', |
|
1875 | 1881 | default=False, |
|
1876 | 1882 | ) |
|
1877 | 1883 | coreconfigitem( |
|
1878 | 1884 | b'rewrite', |
|
1879 | 1885 | b'empty-successor', |
|
1880 | 1886 | default=b'skip', |
|
1881 | 1887 | experimental=True, |
|
1882 | 1888 | ) |
|
1883 | 1889 | # experimental as long as format.exp-rc-dirstate-v2 is. |
|
1884 | 1890 | coreconfigitem( |
|
1885 | 1891 | b'storage', |
|
1886 | 1892 | b'dirstate-v2.slow-path', |
|
1887 | 1893 | default=b"abort", |
|
1888 | 1894 | experimental=True, |
|
1889 | 1895 | ) |
|
1890 | 1896 | coreconfigitem( |
|
1891 | 1897 | b'storage', |
|
1892 | 1898 | b'new-repo-backend', |
|
1893 | 1899 | default=b'revlogv1', |
|
1894 | 1900 | experimental=True, |
|
1895 | 1901 | ) |
|
1896 | 1902 | coreconfigitem( |
|
1897 | 1903 | b'storage', |
|
1898 | 1904 | b'revlog.optimize-delta-parent-choice', |
|
1899 | 1905 | default=True, |
|
1900 | 1906 | alias=[(b'format', b'aggressivemergedeltas')], |
|
1901 | 1907 | ) |
|
1902 | 1908 | coreconfigitem( |
|
1903 | 1909 | b'storage', |
|
1904 | 1910 | b'revlog.issue6528.fix-incoming', |
|
1905 | 1911 | default=True, |
|
1906 | 1912 | ) |
|
1907 | 1913 | # experimental as long as rust is experimental (or a C version is implemented) |
|
1908 | 1914 | coreconfigitem( |
|
1909 | 1915 | b'storage', |
|
1910 | 1916 | b'revlog.persistent-nodemap.mmap', |
|
1911 | 1917 | default=True, |
|
1912 | 1918 | ) |
|
1913 | 1919 | # experimental as long as format.use-persistent-nodemap is. |
|
1914 | 1920 | coreconfigitem( |
|
1915 | 1921 | b'storage', |
|
1916 | 1922 | b'revlog.persistent-nodemap.slow-path', |
|
1917 | 1923 | default=b"abort", |
|
1918 | 1924 | ) |
|
1919 | 1925 | |
|
1920 | 1926 | coreconfigitem( |
|
1921 | 1927 | b'storage', |
|
1922 | 1928 | b'revlog.reuse-external-delta', |
|
1923 | 1929 | default=True, |
|
1924 | 1930 | ) |
|
1925 | 1931 | coreconfigitem( |
|
1926 | 1932 | b'storage', |
|
1927 | 1933 | b'revlog.reuse-external-delta-parent', |
|
1928 | 1934 | default=None, |
|
1929 | 1935 | ) |
|
1930 | 1936 | coreconfigitem( |
|
1931 | 1937 | b'storage', |
|
1932 | 1938 | b'revlog.zlib.level', |
|
1933 | 1939 | default=None, |
|
1934 | 1940 | ) |
|
1935 | 1941 | coreconfigitem( |
|
1936 | 1942 | b'storage', |
|
1937 | 1943 | b'revlog.zstd.level', |
|
1938 | 1944 | default=None, |
|
1939 | 1945 | ) |
|
1940 | 1946 | coreconfigitem( |
|
1941 | 1947 | b'server', |
|
1942 | 1948 | b'bookmarks-pushkey-compat', |
|
1943 | 1949 | default=True, |
|
1944 | 1950 | ) |
|
1945 | 1951 | coreconfigitem( |
|
1946 | 1952 | b'server', |
|
1947 | 1953 | b'bundle1', |
|
1948 | 1954 | default=True, |
|
1949 | 1955 | ) |
|
1950 | 1956 | coreconfigitem( |
|
1951 | 1957 | b'server', |
|
1952 | 1958 | b'bundle1gd', |
|
1953 | 1959 | default=None, |
|
1954 | 1960 | ) |
|
1955 | 1961 | coreconfigitem( |
|
1956 | 1962 | b'server', |
|
1957 | 1963 | b'bundle1.pull', |
|
1958 | 1964 | default=None, |
|
1959 | 1965 | ) |
|
1960 | 1966 | coreconfigitem( |
|
1961 | 1967 | b'server', |
|
1962 | 1968 | b'bundle1gd.pull', |
|
1963 | 1969 | default=None, |
|
1964 | 1970 | ) |
|
1965 | 1971 | coreconfigitem( |
|
1966 | 1972 | b'server', |
|
1967 | 1973 | b'bundle1.push', |
|
1968 | 1974 | default=None, |
|
1969 | 1975 | ) |
|
1970 | 1976 | coreconfigitem( |
|
1971 | 1977 | b'server', |
|
1972 | 1978 | b'bundle1gd.push', |
|
1973 | 1979 | default=None, |
|
1974 | 1980 | ) |
|
1975 | 1981 | coreconfigitem( |
|
1976 | 1982 | b'server', |
|
1977 | 1983 | b'bundle2.stream', |
|
1978 | 1984 | default=True, |
|
1979 | 1985 | alias=[(b'experimental', b'bundle2.stream')], |
|
1980 | 1986 | ) |
|
1981 | 1987 | coreconfigitem( |
|
1982 | 1988 | b'server', |
|
1983 | 1989 | b'compressionengines', |
|
1984 | 1990 | default=list, |
|
1985 | 1991 | ) |
|
1986 | 1992 | coreconfigitem( |
|
1987 | 1993 | b'server', |
|
1988 | 1994 | b'concurrent-push-mode', |
|
1989 | 1995 | default=b'check-related', |
|
1990 | 1996 | ) |
|
1991 | 1997 | coreconfigitem( |
|
1992 | 1998 | b'server', |
|
1993 | 1999 | b'disablefullbundle', |
|
1994 | 2000 | default=False, |
|
1995 | 2001 | ) |
|
1996 | 2002 | coreconfigitem( |
|
1997 | 2003 | b'server', |
|
1998 | 2004 | b'maxhttpheaderlen', |
|
1999 | 2005 | default=1024, |
|
2000 | 2006 | ) |
|
2001 | 2007 | coreconfigitem( |
|
2002 | 2008 | b'server', |
|
2003 | 2009 | b'pullbundle', |
|
2004 | 2010 | default=False, |
|
2005 | 2011 | ) |
|
2006 | 2012 | coreconfigitem( |
|
2007 | 2013 | b'server', |
|
2008 | 2014 | b'preferuncompressed', |
|
2009 | 2015 | default=False, |
|
2010 | 2016 | ) |
|
2011 | 2017 | coreconfigitem( |
|
2012 | 2018 | b'server', |
|
2013 | 2019 | b'streamunbundle', |
|
2014 | 2020 | default=False, |
|
2015 | 2021 | ) |
|
2016 | 2022 | coreconfigitem( |
|
2017 | 2023 | b'server', |
|
2018 | 2024 | b'uncompressed', |
|
2019 | 2025 | default=True, |
|
2020 | 2026 | ) |
|
2021 | 2027 | coreconfigitem( |
|
2022 | 2028 | b'server', |
|
2023 | 2029 | b'uncompressedallowsecret', |
|
2024 | 2030 | default=False, |
|
2025 | 2031 | ) |
|
2026 | 2032 | coreconfigitem( |
|
2027 | 2033 | b'server', |
|
2028 | 2034 | b'view', |
|
2029 | 2035 | default=b'served', |
|
2030 | 2036 | ) |
|
2031 | 2037 | coreconfigitem( |
|
2032 | 2038 | b'server', |
|
2033 | 2039 | b'validate', |
|
2034 | 2040 | default=False, |
|
2035 | 2041 | ) |
|
2036 | 2042 | coreconfigitem( |
|
2037 | 2043 | b'server', |
|
2038 | 2044 | b'zliblevel', |
|
2039 | 2045 | default=-1, |
|
2040 | 2046 | ) |
|
2041 | 2047 | coreconfigitem( |
|
2042 | 2048 | b'server', |
|
2043 | 2049 | b'zstdlevel', |
|
2044 | 2050 | default=3, |
|
2045 | 2051 | ) |
|
2046 | 2052 | coreconfigitem( |
|
2047 | 2053 | b'share', |
|
2048 | 2054 | b'pool', |
|
2049 | 2055 | default=None, |
|
2050 | 2056 | ) |
|
2051 | 2057 | coreconfigitem( |
|
2052 | 2058 | b'share', |
|
2053 | 2059 | b'poolnaming', |
|
2054 | 2060 | default=b'identity', |
|
2055 | 2061 | ) |
|
2056 | 2062 | coreconfigitem( |
|
2057 | 2063 | b'share', |
|
2058 | 2064 | b'safe-mismatch.source-not-safe', |
|
2059 | 2065 | default=b'abort', |
|
2060 | 2066 | ) |
|
2061 | 2067 | coreconfigitem( |
|
2062 | 2068 | b'share', |
|
2063 | 2069 | b'safe-mismatch.source-safe', |
|
2064 | 2070 | default=b'abort', |
|
2065 | 2071 | ) |
|
2066 | 2072 | coreconfigitem( |
|
2067 | 2073 | b'share', |
|
2068 | 2074 | b'safe-mismatch.source-not-safe.warn', |
|
2069 | 2075 | default=True, |
|
2070 | 2076 | ) |
|
2071 | 2077 | coreconfigitem( |
|
2072 | 2078 | b'share', |
|
2073 | 2079 | b'safe-mismatch.source-safe.warn', |
|
2074 | 2080 | default=True, |
|
2075 | 2081 | ) |
|
2076 | 2082 | coreconfigitem( |
|
2077 | 2083 | b'shelve', |
|
2078 | 2084 | b'maxbackups', |
|
2079 | 2085 | default=10, |
|
2080 | 2086 | ) |
|
2081 | 2087 | coreconfigitem( |
|
2082 | 2088 | b'smtp', |
|
2083 | 2089 | b'host', |
|
2084 | 2090 | default=None, |
|
2085 | 2091 | ) |
|
2086 | 2092 | coreconfigitem( |
|
2087 | 2093 | b'smtp', |
|
2088 | 2094 | b'local_hostname', |
|
2089 | 2095 | default=None, |
|
2090 | 2096 | ) |
|
2091 | 2097 | coreconfigitem( |
|
2092 | 2098 | b'smtp', |
|
2093 | 2099 | b'password', |
|
2094 | 2100 | default=None, |
|
2095 | 2101 | ) |
|
2096 | 2102 | coreconfigitem( |
|
2097 | 2103 | b'smtp', |
|
2098 | 2104 | b'port', |
|
2099 | 2105 | default=dynamicdefault, |
|
2100 | 2106 | ) |
|
2101 | 2107 | coreconfigitem( |
|
2102 | 2108 | b'smtp', |
|
2103 | 2109 | b'tls', |
|
2104 | 2110 | default=b'none', |
|
2105 | 2111 | ) |
|
2106 | 2112 | coreconfigitem( |
|
2107 | 2113 | b'smtp', |
|
2108 | 2114 | b'username', |
|
2109 | 2115 | default=None, |
|
2110 | 2116 | ) |
|
2111 | 2117 | coreconfigitem( |
|
2112 | 2118 | b'sparse', |
|
2113 | 2119 | b'missingwarning', |
|
2114 | 2120 | default=True, |
|
2115 | 2121 | experimental=True, |
|
2116 | 2122 | ) |
|
2117 | 2123 | coreconfigitem( |
|
2118 | 2124 | b'subrepos', |
|
2119 | 2125 | b'allowed', |
|
2120 | 2126 | default=dynamicdefault, # to make backporting simpler |
|
2121 | 2127 | ) |
|
2122 | 2128 | coreconfigitem( |
|
2123 | 2129 | b'subrepos', |
|
2124 | 2130 | b'hg:allowed', |
|
2125 | 2131 | default=dynamicdefault, |
|
2126 | 2132 | ) |
|
2127 | 2133 | coreconfigitem( |
|
2128 | 2134 | b'subrepos', |
|
2129 | 2135 | b'git:allowed', |
|
2130 | 2136 | default=dynamicdefault, |
|
2131 | 2137 | ) |
|
2132 | 2138 | coreconfigitem( |
|
2133 | 2139 | b'subrepos', |
|
2134 | 2140 | b'svn:allowed', |
|
2135 | 2141 | default=dynamicdefault, |
|
2136 | 2142 | ) |
|
2137 | 2143 | coreconfigitem( |
|
2138 | 2144 | b'templates', |
|
2139 | 2145 | b'.*', |
|
2140 | 2146 | default=None, |
|
2141 | 2147 | generic=True, |
|
2142 | 2148 | ) |
|
2143 | 2149 | coreconfigitem( |
|
2144 | 2150 | b'templateconfig', |
|
2145 | 2151 | b'.*', |
|
2146 | 2152 | default=dynamicdefault, |
|
2147 | 2153 | generic=True, |
|
2148 | 2154 | ) |
|
2149 | 2155 | coreconfigitem( |
|
2150 | 2156 | b'trusted', |
|
2151 | 2157 | b'groups', |
|
2152 | 2158 | default=list, |
|
2153 | 2159 | ) |
|
2154 | 2160 | coreconfigitem( |
|
2155 | 2161 | b'trusted', |
|
2156 | 2162 | b'users', |
|
2157 | 2163 | default=list, |
|
2158 | 2164 | ) |
|
2159 | 2165 | coreconfigitem( |
|
2160 | 2166 | b'ui', |
|
2161 | 2167 | b'_usedassubrepo', |
|
2162 | 2168 | default=False, |
|
2163 | 2169 | ) |
|
2164 | 2170 | coreconfigitem( |
|
2165 | 2171 | b'ui', |
|
2166 | 2172 | b'allowemptycommit', |
|
2167 | 2173 | default=False, |
|
2168 | 2174 | ) |
|
2169 | 2175 | coreconfigitem( |
|
2170 | 2176 | b'ui', |
|
2171 | 2177 | b'archivemeta', |
|
2172 | 2178 | default=True, |
|
2173 | 2179 | ) |
|
2174 | 2180 | coreconfigitem( |
|
2175 | 2181 | b'ui', |
|
2176 | 2182 | b'askusername', |
|
2177 | 2183 | default=False, |
|
2178 | 2184 | ) |
|
2179 | 2185 | coreconfigitem( |
|
2180 | 2186 | b'ui', |
|
2181 | 2187 | b'available-memory', |
|
2182 | 2188 | default=None, |
|
2183 | 2189 | ) |
|
2184 | 2190 | |
|
2185 | 2191 | coreconfigitem( |
|
2186 | 2192 | b'ui', |
|
2187 | 2193 | b'clonebundlefallback', |
|
2188 | 2194 | default=False, |
|
2189 | 2195 | ) |
|
2190 | 2196 | coreconfigitem( |
|
2191 | 2197 | b'ui', |
|
2192 | 2198 | b'clonebundleprefers', |
|
2193 | 2199 | default=list, |
|
2194 | 2200 | ) |
|
2195 | 2201 | coreconfigitem( |
|
2196 | 2202 | b'ui', |
|
2197 | 2203 | b'clonebundles', |
|
2198 | 2204 | default=True, |
|
2199 | 2205 | ) |
|
2200 | 2206 | coreconfigitem( |
|
2201 | 2207 | b'ui', |
|
2202 | 2208 | b'color', |
|
2203 | 2209 | default=b'auto', |
|
2204 | 2210 | ) |
|
2205 | 2211 | coreconfigitem( |
|
2206 | 2212 | b'ui', |
|
2207 | 2213 | b'commitsubrepos', |
|
2208 | 2214 | default=False, |
|
2209 | 2215 | ) |
|
2210 | 2216 | coreconfigitem( |
|
2211 | 2217 | b'ui', |
|
2212 | 2218 | b'debug', |
|
2213 | 2219 | default=False, |
|
2214 | 2220 | ) |
|
2215 | 2221 | coreconfigitem( |
|
2216 | 2222 | b'ui', |
|
2217 | 2223 | b'debugger', |
|
2218 | 2224 | default=None, |
|
2219 | 2225 | ) |
|
2220 | 2226 | coreconfigitem( |
|
2221 | 2227 | b'ui', |
|
2222 | 2228 | b'editor', |
|
2223 | 2229 | default=dynamicdefault, |
|
2224 | 2230 | ) |
|
2225 | 2231 | coreconfigitem( |
|
2226 | 2232 | b'ui', |
|
2227 | 2233 | b'detailed-exit-code', |
|
2228 | 2234 | default=False, |
|
2229 | 2235 | experimental=True, |
|
2230 | 2236 | ) |
|
2231 | 2237 | coreconfigitem( |
|
2232 | 2238 | b'ui', |
|
2233 | 2239 | b'fallbackencoding', |
|
2234 | 2240 | default=None, |
|
2235 | 2241 | ) |
|
2236 | 2242 | coreconfigitem( |
|
2237 | 2243 | b'ui', |
|
2238 | 2244 | b'forcecwd', |
|
2239 | 2245 | default=None, |
|
2240 | 2246 | ) |
|
2241 | 2247 | coreconfigitem( |
|
2242 | 2248 | b'ui', |
|
2243 | 2249 | b'forcemerge', |
|
2244 | 2250 | default=None, |
|
2245 | 2251 | ) |
|
2246 | 2252 | coreconfigitem( |
|
2247 | 2253 | b'ui', |
|
2248 | 2254 | b'formatdebug', |
|
2249 | 2255 | default=False, |
|
2250 | 2256 | ) |
|
2251 | 2257 | coreconfigitem( |
|
2252 | 2258 | b'ui', |
|
2253 | 2259 | b'formatjson', |
|
2254 | 2260 | default=False, |
|
2255 | 2261 | ) |
|
2256 | 2262 | coreconfigitem( |
|
2257 | 2263 | b'ui', |
|
2258 | 2264 | b'formatted', |
|
2259 | 2265 | default=None, |
|
2260 | 2266 | ) |
|
2261 | 2267 | coreconfigitem( |
|
2262 | 2268 | b'ui', |
|
2263 | 2269 | b'interactive', |
|
2264 | 2270 | default=None, |
|
2265 | 2271 | ) |
|
2266 | 2272 | coreconfigitem( |
|
2267 | 2273 | b'ui', |
|
2268 | 2274 | b'interface', |
|
2269 | 2275 | default=None, |
|
2270 | 2276 | ) |
|
2271 | 2277 | coreconfigitem( |
|
2272 | 2278 | b'ui', |
|
2273 | 2279 | b'interface.chunkselector', |
|
2274 | 2280 | default=None, |
|
2275 | 2281 | ) |
|
2276 | 2282 | coreconfigitem( |
|
2277 | 2283 | b'ui', |
|
2278 | 2284 | b'large-file-limit', |
|
2279 | 2285 | default=10000000, |
|
2280 | 2286 | ) |
|
2281 | 2287 | coreconfigitem( |
|
2282 | 2288 | b'ui', |
|
2283 | 2289 | b'logblockedtimes', |
|
2284 | 2290 | default=False, |
|
2285 | 2291 | ) |
|
2286 | 2292 | coreconfigitem( |
|
2287 | 2293 | b'ui', |
|
2288 | 2294 | b'merge', |
|
2289 | 2295 | default=None, |
|
2290 | 2296 | ) |
|
2291 | 2297 | coreconfigitem( |
|
2292 | 2298 | b'ui', |
|
2293 | 2299 | b'mergemarkers', |
|
2294 | 2300 | default=b'basic', |
|
2295 | 2301 | ) |
|
2296 | 2302 | coreconfigitem( |
|
2297 | 2303 | b'ui', |
|
2298 | 2304 | b'message-output', |
|
2299 | 2305 | default=b'stdio', |
|
2300 | 2306 | ) |
|
2301 | 2307 | coreconfigitem( |
|
2302 | 2308 | b'ui', |
|
2303 | 2309 | b'nontty', |
|
2304 | 2310 | default=False, |
|
2305 | 2311 | ) |
|
2306 | 2312 | coreconfigitem( |
|
2307 | 2313 | b'ui', |
|
2308 | 2314 | b'origbackuppath', |
|
2309 | 2315 | default=None, |
|
2310 | 2316 | ) |
|
2311 | 2317 | coreconfigitem( |
|
2312 | 2318 | b'ui', |
|
2313 | 2319 | b'paginate', |
|
2314 | 2320 | default=True, |
|
2315 | 2321 | ) |
|
2316 | 2322 | coreconfigitem( |
|
2317 | 2323 | b'ui', |
|
2318 | 2324 | b'patch', |
|
2319 | 2325 | default=None, |
|
2320 | 2326 | ) |
|
2321 | 2327 | coreconfigitem( |
|
2322 | 2328 | b'ui', |
|
2323 | 2329 | b'portablefilenames', |
|
2324 | 2330 | default=b'warn', |
|
2325 | 2331 | ) |
|
2326 | 2332 | coreconfigitem( |
|
2327 | 2333 | b'ui', |
|
2328 | 2334 | b'promptecho', |
|
2329 | 2335 | default=False, |
|
2330 | 2336 | ) |
|
2331 | 2337 | coreconfigitem( |
|
2332 | 2338 | b'ui', |
|
2333 | 2339 | b'quiet', |
|
2334 | 2340 | default=False, |
|
2335 | 2341 | ) |
|
2336 | 2342 | coreconfigitem( |
|
2337 | 2343 | b'ui', |
|
2338 | 2344 | b'quietbookmarkmove', |
|
2339 | 2345 | default=False, |
|
2340 | 2346 | ) |
|
2341 | 2347 | coreconfigitem( |
|
2342 | 2348 | b'ui', |
|
2343 | 2349 | b'relative-paths', |
|
2344 | 2350 | default=b'legacy', |
|
2345 | 2351 | ) |
|
2346 | 2352 | coreconfigitem( |
|
2347 | 2353 | b'ui', |
|
2348 | 2354 | b'remotecmd', |
|
2349 | 2355 | default=b'hg', |
|
2350 | 2356 | ) |
|
2351 | 2357 | coreconfigitem( |
|
2352 | 2358 | b'ui', |
|
2353 | 2359 | b'report_untrusted', |
|
2354 | 2360 | default=True, |
|
2355 | 2361 | ) |
|
2356 | 2362 | coreconfigitem( |
|
2357 | 2363 | b'ui', |
|
2358 | 2364 | b'rollback', |
|
2359 | 2365 | default=True, |
|
2360 | 2366 | ) |
|
2361 | 2367 | coreconfigitem( |
|
2362 | 2368 | b'ui', |
|
2363 | 2369 | b'signal-safe-lock', |
|
2364 | 2370 | default=True, |
|
2365 | 2371 | ) |
|
2366 | 2372 | coreconfigitem( |
|
2367 | 2373 | b'ui', |
|
2368 | 2374 | b'slash', |
|
2369 | 2375 | default=False, |
|
2370 | 2376 | ) |
|
2371 | 2377 | coreconfigitem( |
|
2372 | 2378 | b'ui', |
|
2373 | 2379 | b'ssh', |
|
2374 | 2380 | default=b'ssh', |
|
2375 | 2381 | ) |
|
2376 | 2382 | coreconfigitem( |
|
2377 | 2383 | b'ui', |
|
2378 | 2384 | b'ssherrorhint', |
|
2379 | 2385 | default=None, |
|
2380 | 2386 | ) |
|
2381 | 2387 | coreconfigitem( |
|
2382 | 2388 | b'ui', |
|
2383 | 2389 | b'statuscopies', |
|
2384 | 2390 | default=False, |
|
2385 | 2391 | ) |
|
2386 | 2392 | coreconfigitem( |
|
2387 | 2393 | b'ui', |
|
2388 | 2394 | b'strict', |
|
2389 | 2395 | default=False, |
|
2390 | 2396 | ) |
|
2391 | 2397 | coreconfigitem( |
|
2392 | 2398 | b'ui', |
|
2393 | 2399 | b'style', |
|
2394 | 2400 | default=b'', |
|
2395 | 2401 | ) |
|
2396 | 2402 | coreconfigitem( |
|
2397 | 2403 | b'ui', |
|
2398 | 2404 | b'supportcontact', |
|
2399 | 2405 | default=None, |
|
2400 | 2406 | ) |
|
2401 | 2407 | coreconfigitem( |
|
2402 | 2408 | b'ui', |
|
2403 | 2409 | b'textwidth', |
|
2404 | 2410 | default=78, |
|
2405 | 2411 | ) |
|
2406 | 2412 | coreconfigitem( |
|
2407 | 2413 | b'ui', |
|
2408 | 2414 | b'timeout', |
|
2409 | 2415 | default=b'600', |
|
2410 | 2416 | ) |
|
2411 | 2417 | coreconfigitem( |
|
2412 | 2418 | b'ui', |
|
2413 | 2419 | b'timeout.warn', |
|
2414 | 2420 | default=0, |
|
2415 | 2421 | ) |
|
2416 | 2422 | coreconfigitem( |
|
2417 | 2423 | b'ui', |
|
2418 | 2424 | b'timestamp-output', |
|
2419 | 2425 | default=False, |
|
2420 | 2426 | ) |
|
2421 | 2427 | coreconfigitem( |
|
2422 | 2428 | b'ui', |
|
2423 | 2429 | b'traceback', |
|
2424 | 2430 | default=False, |
|
2425 | 2431 | ) |
|
2426 | 2432 | coreconfigitem( |
|
2427 | 2433 | b'ui', |
|
2428 | 2434 | b'tweakdefaults', |
|
2429 | 2435 | default=False, |
|
2430 | 2436 | ) |
|
2431 | 2437 | coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')]) |
|
2432 | 2438 | coreconfigitem( |
|
2433 | 2439 | b'ui', |
|
2434 | 2440 | b'verbose', |
|
2435 | 2441 | default=False, |
|
2436 | 2442 | ) |
|
2437 | 2443 | coreconfigitem( |
|
2438 | 2444 | b'verify', |
|
2439 | 2445 | b'skipflags', |
|
2440 | 2446 | default=None, |
|
2441 | 2447 | ) |
|
2442 | 2448 | coreconfigitem( |
|
2443 | 2449 | b'web', |
|
2444 | 2450 | b'allowbz2', |
|
2445 | 2451 | default=False, |
|
2446 | 2452 | ) |
|
2447 | 2453 | coreconfigitem( |
|
2448 | 2454 | b'web', |
|
2449 | 2455 | b'allowgz', |
|
2450 | 2456 | default=False, |
|
2451 | 2457 | ) |
|
2452 | 2458 | coreconfigitem( |
|
2453 | 2459 | b'web', |
|
2454 | 2460 | b'allow-pull', |
|
2455 | 2461 | alias=[(b'web', b'allowpull')], |
|
2456 | 2462 | default=True, |
|
2457 | 2463 | ) |
|
2458 | 2464 | coreconfigitem( |
|
2459 | 2465 | b'web', |
|
2460 | 2466 | b'allow-push', |
|
2461 | 2467 | alias=[(b'web', b'allow_push')], |
|
2462 | 2468 | default=list, |
|
2463 | 2469 | ) |
|
2464 | 2470 | coreconfigitem( |
|
2465 | 2471 | b'web', |
|
2466 | 2472 | b'allowzip', |
|
2467 | 2473 | default=False, |
|
2468 | 2474 | ) |
|
2469 | 2475 | coreconfigitem( |
|
2470 | 2476 | b'web', |
|
2471 | 2477 | b'archivesubrepos', |
|
2472 | 2478 | default=False, |
|
2473 | 2479 | ) |
|
2474 | 2480 | coreconfigitem( |
|
2475 | 2481 | b'web', |
|
2476 | 2482 | b'cache', |
|
2477 | 2483 | default=True, |
|
2478 | 2484 | ) |
|
2479 | 2485 | coreconfigitem( |
|
2480 | 2486 | b'web', |
|
2481 | 2487 | b'comparisoncontext', |
|
2482 | 2488 | default=5, |
|
2483 | 2489 | ) |
|
2484 | 2490 | coreconfigitem( |
|
2485 | 2491 | b'web', |
|
2486 | 2492 | b'contact', |
|
2487 | 2493 | default=None, |
|
2488 | 2494 | ) |
|
2489 | 2495 | coreconfigitem( |
|
2490 | 2496 | b'web', |
|
2491 | 2497 | b'deny_push', |
|
2492 | 2498 | default=list, |
|
2493 | 2499 | ) |
|
2494 | 2500 | coreconfigitem( |
|
2495 | 2501 | b'web', |
|
2496 | 2502 | b'guessmime', |
|
2497 | 2503 | default=False, |
|
2498 | 2504 | ) |
|
2499 | 2505 | coreconfigitem( |
|
2500 | 2506 | b'web', |
|
2501 | 2507 | b'hidden', |
|
2502 | 2508 | default=False, |
|
2503 | 2509 | ) |
|
2504 | 2510 | coreconfigitem( |
|
2505 | 2511 | b'web', |
|
2506 | 2512 | b'labels', |
|
2507 | 2513 | default=list, |
|
2508 | 2514 | ) |
|
2509 | 2515 | coreconfigitem( |
|
2510 | 2516 | b'web', |
|
2511 | 2517 | b'logoimg', |
|
2512 | 2518 | default=b'hglogo.png', |
|
2513 | 2519 | ) |
|
2514 | 2520 | coreconfigitem( |
|
2515 | 2521 | b'web', |
|
2516 | 2522 | b'logourl', |
|
2517 | 2523 | default=b'https://mercurial-scm.org/', |
|
2518 | 2524 | ) |
|
2519 | 2525 | coreconfigitem( |
|
2520 | 2526 | b'web', |
|
2521 | 2527 | b'accesslog', |
|
2522 | 2528 | default=b'-', |
|
2523 | 2529 | ) |
|
2524 | 2530 | coreconfigitem( |
|
2525 | 2531 | b'web', |
|
2526 | 2532 | b'address', |
|
2527 | 2533 | default=b'', |
|
2528 | 2534 | ) |
|
2529 | 2535 | coreconfigitem( |
|
2530 | 2536 | b'web', |
|
2531 | 2537 | b'allow-archive', |
|
2532 | 2538 | alias=[(b'web', b'allow_archive')], |
|
2533 | 2539 | default=list, |
|
2534 | 2540 | ) |
|
2535 | 2541 | coreconfigitem( |
|
2536 | 2542 | b'web', |
|
2537 | 2543 | b'allow_read', |
|
2538 | 2544 | default=list, |
|
2539 | 2545 | ) |
|
2540 | 2546 | coreconfigitem( |
|
2541 | 2547 | b'web', |
|
2542 | 2548 | b'baseurl', |
|
2543 | 2549 | default=None, |
|
2544 | 2550 | ) |
|
2545 | 2551 | coreconfigitem( |
|
2546 | 2552 | b'web', |
|
2547 | 2553 | b'cacerts', |
|
2548 | 2554 | default=None, |
|
2549 | 2555 | ) |
|
2550 | 2556 | coreconfigitem( |
|
2551 | 2557 | b'web', |
|
2552 | 2558 | b'certificate', |
|
2553 | 2559 | default=None, |
|
2554 | 2560 | ) |
|
2555 | 2561 | coreconfigitem( |
|
2556 | 2562 | b'web', |
|
2557 | 2563 | b'collapse', |
|
2558 | 2564 | default=False, |
|
2559 | 2565 | ) |
|
2560 | 2566 | coreconfigitem( |
|
2561 | 2567 | b'web', |
|
2562 | 2568 | b'csp', |
|
2563 | 2569 | default=None, |
|
2564 | 2570 | ) |
|
2565 | 2571 | coreconfigitem( |
|
2566 | 2572 | b'web', |
|
2567 | 2573 | b'deny_read', |
|
2568 | 2574 | default=list, |
|
2569 | 2575 | ) |
|
2570 | 2576 | coreconfigitem( |
|
2571 | 2577 | b'web', |
|
2572 | 2578 | b'descend', |
|
2573 | 2579 | default=True, |
|
2574 | 2580 | ) |
|
2575 | 2581 | coreconfigitem( |
|
2576 | 2582 | b'web', |
|
2577 | 2583 | b'description', |
|
2578 | 2584 | default=b"", |
|
2579 | 2585 | ) |
|
2580 | 2586 | coreconfigitem( |
|
2581 | 2587 | b'web', |
|
2582 | 2588 | b'encoding', |
|
2583 | 2589 | default=lambda: encoding.encoding, |
|
2584 | 2590 | ) |
|
2585 | 2591 | coreconfigitem( |
|
2586 | 2592 | b'web', |
|
2587 | 2593 | b'errorlog', |
|
2588 | 2594 | default=b'-', |
|
2589 | 2595 | ) |
|
2590 | 2596 | coreconfigitem( |
|
2591 | 2597 | b'web', |
|
2592 | 2598 | b'ipv6', |
|
2593 | 2599 | default=False, |
|
2594 | 2600 | ) |
|
2595 | 2601 | coreconfigitem( |
|
2596 | 2602 | b'web', |
|
2597 | 2603 | b'maxchanges', |
|
2598 | 2604 | default=10, |
|
2599 | 2605 | ) |
|
2600 | 2606 | coreconfigitem( |
|
2601 | 2607 | b'web', |
|
2602 | 2608 | b'maxfiles', |
|
2603 | 2609 | default=10, |
|
2604 | 2610 | ) |
|
2605 | 2611 | coreconfigitem( |
|
2606 | 2612 | b'web', |
|
2607 | 2613 | b'maxshortchanges', |
|
2608 | 2614 | default=60, |
|
2609 | 2615 | ) |
|
2610 | 2616 | coreconfigitem( |
|
2611 | 2617 | b'web', |
|
2612 | 2618 | b'motd', |
|
2613 | 2619 | default=b'', |
|
2614 | 2620 | ) |
|
2615 | 2621 | coreconfigitem( |
|
2616 | 2622 | b'web', |
|
2617 | 2623 | b'name', |
|
2618 | 2624 | default=dynamicdefault, |
|
2619 | 2625 | ) |
|
2620 | 2626 | coreconfigitem( |
|
2621 | 2627 | b'web', |
|
2622 | 2628 | b'port', |
|
2623 | 2629 | default=8000, |
|
2624 | 2630 | ) |
|
2625 | 2631 | coreconfigitem( |
|
2626 | 2632 | b'web', |
|
2627 | 2633 | b'prefix', |
|
2628 | 2634 | default=b'', |
|
2629 | 2635 | ) |
|
2630 | 2636 | coreconfigitem( |
|
2631 | 2637 | b'web', |
|
2632 | 2638 | b'push_ssl', |
|
2633 | 2639 | default=True, |
|
2634 | 2640 | ) |
|
2635 | 2641 | coreconfigitem( |
|
2636 | 2642 | b'web', |
|
2637 | 2643 | b'refreshinterval', |
|
2638 | 2644 | default=20, |
|
2639 | 2645 | ) |
|
2640 | 2646 | coreconfigitem( |
|
2641 | 2647 | b'web', |
|
2642 | 2648 | b'server-header', |
|
2643 | 2649 | default=None, |
|
2644 | 2650 | ) |
|
2645 | 2651 | coreconfigitem( |
|
2646 | 2652 | b'web', |
|
2647 | 2653 | b'static', |
|
2648 | 2654 | default=None, |
|
2649 | 2655 | ) |
|
2650 | 2656 | coreconfigitem( |
|
2651 | 2657 | b'web', |
|
2652 | 2658 | b'staticurl', |
|
2653 | 2659 | default=None, |
|
2654 | 2660 | ) |
|
2655 | 2661 | coreconfigitem( |
|
2656 | 2662 | b'web', |
|
2657 | 2663 | b'stripes', |
|
2658 | 2664 | default=1, |
|
2659 | 2665 | ) |
|
2660 | 2666 | coreconfigitem( |
|
2661 | 2667 | b'web', |
|
2662 | 2668 | b'style', |
|
2663 | 2669 | default=b'paper', |
|
2664 | 2670 | ) |
|
2665 | 2671 | coreconfigitem( |
|
2666 | 2672 | b'web', |
|
2667 | 2673 | b'templates', |
|
2668 | 2674 | default=None, |
|
2669 | 2675 | ) |
|
2670 | 2676 | coreconfigitem( |
|
2671 | 2677 | b'web', |
|
2672 | 2678 | b'view', |
|
2673 | 2679 | default=b'served', |
|
2674 | 2680 | experimental=True, |
|
2675 | 2681 | ) |
|
2676 | 2682 | coreconfigitem( |
|
2677 | 2683 | b'worker', |
|
2678 | 2684 | b'backgroundclose', |
|
2679 | 2685 | default=dynamicdefault, |
|
2680 | 2686 | ) |
|
2681 | 2687 | # Windows defaults to a limit of 512 open files. A buffer of 128 |
|
2682 | 2688 | # should give us enough headway. |
|
2683 | 2689 | coreconfigitem( |
|
2684 | 2690 | b'worker', |
|
2685 | 2691 | b'backgroundclosemaxqueue', |
|
2686 | 2692 | default=384, |
|
2687 | 2693 | ) |
|
2688 | 2694 | coreconfigitem( |
|
2689 | 2695 | b'worker', |
|
2690 | 2696 | b'backgroundcloseminfilecount', |
|
2691 | 2697 | default=2048, |
|
2692 | 2698 | ) |
|
2693 | 2699 | coreconfigitem( |
|
2694 | 2700 | b'worker', |
|
2695 | 2701 | b'backgroundclosethreadcount', |
|
2696 | 2702 | default=4, |
|
2697 | 2703 | ) |
|
2698 | 2704 | coreconfigitem( |
|
2699 | 2705 | b'worker', |
|
2700 | 2706 | b'enabled', |
|
2701 | 2707 | default=True, |
|
2702 | 2708 | ) |
|
2703 | 2709 | coreconfigitem( |
|
2704 | 2710 | b'worker', |
|
2705 | 2711 | b'numcpus', |
|
2706 | 2712 | default=None, |
|
2707 | 2713 | ) |
|
2708 | 2714 | |
|
2709 | 2715 | # Rebase related configuration moved to core because other extension are doing |
|
2710 | 2716 | # strange things. For example, shelve import the extensions to reuse some bit |
|
2711 | 2717 | # without formally loading it. |
|
2712 | 2718 | coreconfigitem( |
|
2713 | 2719 | b'commands', |
|
2714 | 2720 | b'rebase.requiredest', |
|
2715 | 2721 | default=False, |
|
2716 | 2722 | ) |
|
2717 | 2723 | coreconfigitem( |
|
2718 | 2724 | b'experimental', |
|
2719 | 2725 | b'rebaseskipobsolete', |
|
2720 | 2726 | default=True, |
|
2721 | 2727 | ) |
|
2722 | 2728 | coreconfigitem( |
|
2723 | 2729 | b'rebase', |
|
2724 | 2730 | b'singletransaction', |
|
2725 | 2731 | default=False, |
|
2726 | 2732 | ) |
|
2727 | 2733 | coreconfigitem( |
|
2728 | 2734 | b'rebase', |
|
2729 | 2735 | b'experimental.inmemory', |
|
2730 | 2736 | default=False, |
|
2731 | 2737 | ) |
@@ -1,957 +1,970 b'' | |||
|
1 | 1 | # extensions.py - extension handling for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | 10 | import ast |
|
11 | 11 | import collections |
|
12 | 12 | import functools |
|
13 | 13 | import imp |
|
14 | 14 | import inspect |
|
15 | 15 | import os |
|
16 | 16 | |
|
17 | 17 | from .i18n import ( |
|
18 | 18 | _, |
|
19 | 19 | gettext, |
|
20 | 20 | ) |
|
21 | 21 | from .pycompat import ( |
|
22 | 22 | getattr, |
|
23 | 23 | open, |
|
24 | 24 | setattr, |
|
25 | 25 | ) |
|
26 | 26 | |
|
27 | 27 | from . import ( |
|
28 | 28 | cmdutil, |
|
29 | 29 | configitems, |
|
30 | 30 | error, |
|
31 | 31 | pycompat, |
|
32 | 32 | util, |
|
33 | 33 | ) |
|
34 | 34 | |
|
35 | 35 | from .utils import stringutil |
|
36 | 36 | |
|
37 | 37 | _extensions = {} |
|
38 | 38 | _disabledextensions = {} |
|
39 | 39 | _aftercallbacks = {} |
|
40 | 40 | _order = [] |
|
41 | 41 | _builtin = { |
|
42 | 42 | b'hbisect', |
|
43 | 43 | b'bookmarks', |
|
44 | 44 | b'color', |
|
45 | 45 | b'parentrevspec', |
|
46 | 46 | b'progress', |
|
47 | 47 | b'interhg', |
|
48 | 48 | b'inotify', |
|
49 | 49 | b'hgcia', |
|
50 | 50 | b'shelve', |
|
51 | 51 | } |
|
52 | 52 | |
|
53 | 53 | |
|
54 | 54 | def extensions(ui=None): |
|
55 | 55 | if ui: |
|
56 | 56 | |
|
57 | 57 | def enabled(name): |
|
58 | 58 | for format in [b'%s', b'hgext.%s']: |
|
59 | 59 | conf = ui.config(b'extensions', format % name) |
|
60 | 60 | if conf is not None and not conf.startswith(b'!'): |
|
61 | 61 | return True |
|
62 | 62 | |
|
63 | 63 | else: |
|
64 | 64 | enabled = lambda name: True |
|
65 | 65 | for name in _order: |
|
66 | 66 | module = _extensions[name] |
|
67 | 67 | if module and enabled(name): |
|
68 | 68 | yield name, module |
|
69 | 69 | |
|
70 | 70 | |
|
71 | 71 | def find(name): |
|
72 | 72 | '''return module with given extension name''' |
|
73 | 73 | mod = None |
|
74 | 74 | try: |
|
75 | 75 | mod = _extensions[name] |
|
76 | 76 | except KeyError: |
|
77 | 77 | for k, v in pycompat.iteritems(_extensions): |
|
78 | 78 | if k.endswith(b'.' + name) or k.endswith(b'/' + name): |
|
79 | 79 | mod = v |
|
80 | 80 | break |
|
81 | 81 | if not mod: |
|
82 | 82 | raise KeyError(name) |
|
83 | 83 | return mod |
|
84 | 84 | |
|
85 | 85 | |
|
86 | 86 | def loadpath(path, module_name): |
|
87 | 87 | module_name = module_name.replace(b'.', b'_') |
|
88 | 88 | path = util.normpath(util.expandpath(path)) |
|
89 | 89 | module_name = pycompat.fsdecode(module_name) |
|
90 | 90 | path = pycompat.fsdecode(path) |
|
91 | 91 | if os.path.isdir(path): |
|
92 | 92 | # module/__init__.py style |
|
93 | 93 | d, f = os.path.split(path) |
|
94 | 94 | fd, fpath, desc = imp.find_module(f, [d]) |
|
95 | 95 | # When https://github.com/python/typeshed/issues/3466 is fixed |
|
96 | 96 | # and in a pytype release we can drop this disable. |
|
97 | 97 | return imp.load_module( |
|
98 | 98 | module_name, fd, fpath, desc # pytype: disable=wrong-arg-types |
|
99 | 99 | ) |
|
100 | 100 | else: |
|
101 | 101 | try: |
|
102 | 102 | return imp.load_source(module_name, path) |
|
103 | 103 | except IOError as exc: |
|
104 | 104 | if not exc.filename: |
|
105 | 105 | exc.filename = path # python does not fill this |
|
106 | 106 | raise |
|
107 | 107 | |
|
108 | 108 | |
|
109 | 109 | def _importh(name): |
|
110 | 110 | """import and return the <name> module""" |
|
111 | 111 | mod = __import__(pycompat.sysstr(name)) |
|
112 | 112 | components = name.split(b'.') |
|
113 | 113 | for comp in components[1:]: |
|
114 | 114 | mod = getattr(mod, comp) |
|
115 | 115 | return mod |
|
116 | 116 | |
|
117 | 117 | |
|
118 | 118 | def _importext(name, path=None, reportfunc=None): |
|
119 | 119 | if path: |
|
120 | 120 | # the module will be loaded in sys.modules |
|
121 | 121 | # choose an unique name so that it doesn't |
|
122 | 122 | # conflicts with other modules |
|
123 | 123 | mod = loadpath(path, b'hgext.%s' % name) |
|
124 | 124 | else: |
|
125 | 125 | try: |
|
126 | 126 | mod = _importh(b"hgext.%s" % name) |
|
127 | 127 | except ImportError as err: |
|
128 | 128 | if reportfunc: |
|
129 | 129 | reportfunc(err, b"hgext.%s" % name, b"hgext3rd.%s" % name) |
|
130 | 130 | try: |
|
131 | 131 | mod = _importh(b"hgext3rd.%s" % name) |
|
132 | 132 | except ImportError as err: |
|
133 | 133 | if reportfunc: |
|
134 | 134 | reportfunc(err, b"hgext3rd.%s" % name, name) |
|
135 | 135 | mod = _importh(name) |
|
136 | 136 | return mod |
|
137 | 137 | |
|
138 | 138 | |
|
139 | 139 | def _reportimporterror(ui, err, failed, next): |
|
140 | 140 | # note: this ui.log happens before --debug is processed, |
|
141 | 141 | # Use --config ui.debug=1 to see them. |
|
142 | 142 | ui.log( |
|
143 | 143 | b'extension', |
|
144 | 144 | b' - could not import %s (%s): trying %s\n', |
|
145 | 145 | failed, |
|
146 | 146 | stringutil.forcebytestr(err), |
|
147 | 147 | next, |
|
148 | 148 | ) |
|
149 | 149 | if ui.debugflag and ui.configbool(b'devel', b'debug.extensions'): |
|
150 | 150 | ui.traceback() |
|
151 | 151 | |
|
152 | 152 | |
|
153 | 153 | def _rejectunicode(name, xs): |
|
154 | 154 | if isinstance(xs, (list, set, tuple)): |
|
155 | 155 | for x in xs: |
|
156 | 156 | _rejectunicode(name, x) |
|
157 | 157 | elif isinstance(xs, dict): |
|
158 | 158 | for k, v in xs.items(): |
|
159 | 159 | _rejectunicode(name, k) |
|
160 | 160 | _rejectunicode(b'%s.%s' % (name, stringutil.forcebytestr(k)), v) |
|
161 | 161 | elif isinstance(xs, type(u'')): |
|
162 | 162 | raise error.ProgrammingError( |
|
163 | 163 | b"unicode %r found in %s" % (xs, name), |
|
164 | 164 | hint=b"use b'' to make it byte string", |
|
165 | 165 | ) |
|
166 | 166 | |
|
167 | 167 | |
|
168 | 168 | # attributes set by registrar.command |
|
169 | 169 | _cmdfuncattrs = (b'norepo', b'optionalrepo', b'inferrepo') |
|
170 | 170 | |
|
171 | 171 | |
|
172 | 172 | def _validatecmdtable(ui, cmdtable): |
|
173 | 173 | """Check if extension commands have required attributes""" |
|
174 | 174 | for c, e in pycompat.iteritems(cmdtable): |
|
175 | 175 | f = e[0] |
|
176 | 176 | missing = [a for a in _cmdfuncattrs if not util.safehasattr(f, a)] |
|
177 | 177 | if not missing: |
|
178 | 178 | continue |
|
179 | 179 | raise error.ProgrammingError( |
|
180 | 180 | b'missing attributes: %s' % b', '.join(missing), |
|
181 | 181 | hint=b"use @command decorator to register '%s'" % c, |
|
182 | 182 | ) |
|
183 | 183 | |
|
184 | 184 | |
|
185 | 185 | def _validatetables(ui, mod): |
|
186 | 186 | """Sanity check for loadable tables provided by extension module""" |
|
187 | 187 | for t in [b'cmdtable', b'colortable', b'configtable']: |
|
188 | 188 | _rejectunicode(t, getattr(mod, t, {})) |
|
189 | 189 | for t in [ |
|
190 | 190 | b'filesetpredicate', |
|
191 | 191 | b'internalmerge', |
|
192 | 192 | b'revsetpredicate', |
|
193 | 193 | b'templatefilter', |
|
194 | 194 | b'templatefunc', |
|
195 | 195 | b'templatekeyword', |
|
196 | 196 | ]: |
|
197 | 197 | o = getattr(mod, t, None) |
|
198 | 198 | if o: |
|
199 | 199 | _rejectunicode(t, o._table) |
|
200 | 200 | _validatecmdtable(ui, getattr(mod, 'cmdtable', {})) |
|
201 | 201 | |
|
202 | 202 | |
|
203 | 203 | def load(ui, name, path, loadingtime=None): |
|
204 | 204 | if name.startswith(b'hgext.') or name.startswith(b'hgext/'): |
|
205 | 205 | shortname = name[6:] |
|
206 | 206 | else: |
|
207 | 207 | shortname = name |
|
208 | 208 | if shortname in _builtin: |
|
209 | 209 | return None |
|
210 | 210 | if shortname in _extensions: |
|
211 | 211 | return _extensions[shortname] |
|
212 | 212 | ui.log(b'extension', b' - loading extension: %s\n', shortname) |
|
213 | 213 | _extensions[shortname] = None |
|
214 | 214 | with util.timedcm('load extension %s', shortname) as stats: |
|
215 | 215 | mod = _importext(name, path, bind(_reportimporterror, ui)) |
|
216 | 216 | ui.log(b'extension', b' > %s extension loaded in %s\n', shortname, stats) |
|
217 | 217 | if loadingtime is not None: |
|
218 | 218 | loadingtime[shortname] += stats.elapsed |
|
219 | 219 | |
|
220 | 220 | # Before we do anything with the extension, check against minimum stated |
|
221 | 221 | # compatibility. This gives extension authors a mechanism to have their |
|
222 | 222 | # extensions short circuit when loaded with a known incompatible version |
|
223 | 223 | # of Mercurial. |
|
224 | 224 | minver = getattr(mod, 'minimumhgversion', None) |
|
225 | 225 | if minver: |
|
226 | 226 | curver = util.versiontuple(n=2) |
|
227 | 227 | extmin = util.versiontuple(stringutil.forcebytestr(minver), 2) |
|
228 | 228 | |
|
229 | 229 | if None in extmin: |
|
230 | 230 | extmin = (extmin[0] or 0, extmin[1] or 0) |
|
231 | 231 | |
|
232 | 232 | if None in curver or extmin > curver: |
|
233 | 233 | msg = _( |
|
234 | 234 | b'(third party extension %s requires version %s or newer ' |
|
235 | 235 | b'of Mercurial (current: %s); disabling)\n' |
|
236 | 236 | ) |
|
237 | 237 | ui.warn(msg % (shortname, minver, util.version())) |
|
238 | 238 | return |
|
239 | 239 | ui.log(b'extension', b' - validating extension tables: %s\n', shortname) |
|
240 | 240 | _validatetables(ui, mod) |
|
241 | 241 | |
|
242 | 242 | _extensions[shortname] = mod |
|
243 | 243 | _order.append(shortname) |
|
244 | 244 | ui.log( |
|
245 | 245 | b'extension', b' - invoking registered callbacks: %s\n', shortname |
|
246 | 246 | ) |
|
247 | 247 | with util.timedcm('callbacks extension %s', shortname) as stats: |
|
248 | 248 | for fn in _aftercallbacks.get(shortname, []): |
|
249 | 249 | fn(loaded=True) |
|
250 | 250 | ui.log(b'extension', b' > callbacks completed in %s\n', stats) |
|
251 | 251 | return mod |
|
252 | 252 | |
|
253 | 253 | |
|
254 | 254 | def _runuisetup(name, ui): |
|
255 | 255 | uisetup = getattr(_extensions[name], 'uisetup', None) |
|
256 | 256 | if uisetup: |
|
257 | 257 | try: |
|
258 | 258 | uisetup(ui) |
|
259 | 259 | except Exception as inst: |
|
260 | 260 | ui.traceback(force=True) |
|
261 | 261 | msg = stringutil.forcebytestr(inst) |
|
262 | 262 | ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg)) |
|
263 | 263 | return False |
|
264 | 264 | return True |
|
265 | 265 | |
|
266 | 266 | |
|
267 | 267 | def _runextsetup(name, ui): |
|
268 | 268 | extsetup = getattr(_extensions[name], 'extsetup', None) |
|
269 | 269 | if extsetup: |
|
270 | 270 | try: |
|
271 | 271 | extsetup(ui) |
|
272 | 272 | except Exception as inst: |
|
273 | 273 | ui.traceback(force=True) |
|
274 | 274 | msg = stringutil.forcebytestr(inst) |
|
275 | 275 | ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg)) |
|
276 | 276 | return False |
|
277 | 277 | return True |
|
278 | 278 | |
|
279 | 279 | |
|
280 | 280 | def loadall(ui, whitelist=None): |
|
281 | 281 | loadingtime = collections.defaultdict(int) |
|
282 | 282 | result = ui.configitems(b"extensions") |
|
283 | 283 | if whitelist is not None: |
|
284 | 284 | result = [(k, v) for (k, v) in result if k in whitelist] |
|
285 | 285 | result = [(k, v) for (k, v) in result if b':' not in k] |
|
286 | 286 | newindex = len(_order) |
|
287 | 287 | ui.log( |
|
288 | 288 | b'extension', |
|
289 | 289 | b'loading %sextensions\n', |
|
290 | 290 | b'additional ' if newindex else b'', |
|
291 | 291 | ) |
|
292 | 292 | ui.log(b'extension', b'- processing %d entries\n', len(result)) |
|
293 | 293 | with util.timedcm('load all extensions') as stats: |
|
294 | 294 | for (name, path) in result: |
|
295 | 295 | if path: |
|
296 | 296 | if path[0:1] == b'!': |
|
297 | 297 | if name not in _disabledextensions: |
|
298 | 298 | ui.log( |
|
299 | 299 | b'extension', |
|
300 | 300 | b' - skipping disabled extension: %s\n', |
|
301 | 301 | name, |
|
302 | 302 | ) |
|
303 | 303 | _disabledextensions[name] = path[1:] |
|
304 | 304 | continue |
|
305 | 305 | try: |
|
306 | 306 | load(ui, name, path, loadingtime) |
|
307 | 307 | except Exception as inst: |
|
308 | 308 | msg = stringutil.forcebytestr(inst) |
|
309 | 309 | if path: |
|
310 | 310 | error_msg = _( |
|
311 | 311 | b'failed to import extension "%s" from %s: %s' |
|
312 | 312 | ) |
|
313 | 313 | error_msg %= (name, path, msg) |
|
314 | 314 | else: |
|
315 | 315 | error_msg = _(b'failed to import extension "%s": %s') |
|
316 | 316 | error_msg %= (name, msg) |
|
317 | ui.warn((b"*** %s\n") % error_msg) | |
|
318 | if isinstance(inst, error.Hint) and inst.hint: | |
|
319 | ui.warn(_(b"*** (%s)\n") % inst.hint) | |
|
320 |
|
|
|
317 | ||
|
318 | ext_options = ui.configsuboptions(b"extensions", name)[1] | |
|
319 | if stringutil.parsebool(ext_options.get(b"required", b'no')): | |
|
320 | hint = None | |
|
321 | if isinstance(inst, error.Hint) and inst.hint: | |
|
322 | hint = inst.hint | |
|
323 | if hint is None: | |
|
324 | hint = _( | |
|
325 | b"loading of this extension was required, " | |
|
326 | b"see `hg help config.extensions` for details" | |
|
327 | ) | |
|
328 | raise error.Abort(error_msg, hint=hint) | |
|
329 | else: | |
|
330 | ui.warn((b"*** %s\n") % error_msg) | |
|
331 | if isinstance(inst, error.Hint) and inst.hint: | |
|
332 | ui.warn(_(b"*** (%s)\n") % inst.hint) | |
|
333 | ui.traceback() | |
|
321 | 334 | |
|
322 | 335 | ui.log( |
|
323 | 336 | b'extension', |
|
324 | 337 | b'> loaded %d extensions, total time %s\n', |
|
325 | 338 | len(_order) - newindex, |
|
326 | 339 | stats, |
|
327 | 340 | ) |
|
328 | 341 | # list of (objname, loadermod, loadername) tuple: |
|
329 | 342 | # - objname is the name of an object in extension module, |
|
330 | 343 | # from which extra information is loaded |
|
331 | 344 | # - loadermod is the module where loader is placed |
|
332 | 345 | # - loadername is the name of the function, |
|
333 | 346 | # which takes (ui, extensionname, extraobj) arguments |
|
334 | 347 | # |
|
335 | 348 | # This one is for the list of item that must be run before running any setup |
|
336 | 349 | earlyextraloaders = [ |
|
337 | 350 | (b'configtable', configitems, b'loadconfigtable'), |
|
338 | 351 | ] |
|
339 | 352 | |
|
340 | 353 | ui.log(b'extension', b'- loading configtable attributes\n') |
|
341 | 354 | _loadextra(ui, newindex, earlyextraloaders) |
|
342 | 355 | |
|
343 | 356 | broken = set() |
|
344 | 357 | ui.log(b'extension', b'- executing uisetup hooks\n') |
|
345 | 358 | with util.timedcm('all uisetup') as alluisetupstats: |
|
346 | 359 | for name in _order[newindex:]: |
|
347 | 360 | ui.log(b'extension', b' - running uisetup for %s\n', name) |
|
348 | 361 | with util.timedcm('uisetup %s', name) as stats: |
|
349 | 362 | if not _runuisetup(name, ui): |
|
350 | 363 | ui.log( |
|
351 | 364 | b'extension', |
|
352 | 365 | b' - the %s extension uisetup failed\n', |
|
353 | 366 | name, |
|
354 | 367 | ) |
|
355 | 368 | broken.add(name) |
|
356 | 369 | ui.log(b'extension', b' > uisetup for %s took %s\n', name, stats) |
|
357 | 370 | loadingtime[name] += stats.elapsed |
|
358 | 371 | ui.log(b'extension', b'> all uisetup took %s\n', alluisetupstats) |
|
359 | 372 | |
|
360 | 373 | ui.log(b'extension', b'- executing extsetup hooks\n') |
|
361 | 374 | with util.timedcm('all extsetup') as allextetupstats: |
|
362 | 375 | for name in _order[newindex:]: |
|
363 | 376 | if name in broken: |
|
364 | 377 | continue |
|
365 | 378 | ui.log(b'extension', b' - running extsetup for %s\n', name) |
|
366 | 379 | with util.timedcm('extsetup %s', name) as stats: |
|
367 | 380 | if not _runextsetup(name, ui): |
|
368 | 381 | ui.log( |
|
369 | 382 | b'extension', |
|
370 | 383 | b' - the %s extension extsetup failed\n', |
|
371 | 384 | name, |
|
372 | 385 | ) |
|
373 | 386 | broken.add(name) |
|
374 | 387 | ui.log(b'extension', b' > extsetup for %s took %s\n', name, stats) |
|
375 | 388 | loadingtime[name] += stats.elapsed |
|
376 | 389 | ui.log(b'extension', b'> all extsetup took %s\n', allextetupstats) |
|
377 | 390 | |
|
378 | 391 | for name in broken: |
|
379 | 392 | ui.log(b'extension', b' - disabling broken %s extension\n', name) |
|
380 | 393 | _extensions[name] = None |
|
381 | 394 | |
|
382 | 395 | # Call aftercallbacks that were never met. |
|
383 | 396 | ui.log(b'extension', b'- executing remaining aftercallbacks\n') |
|
384 | 397 | with util.timedcm('aftercallbacks') as stats: |
|
385 | 398 | for shortname in _aftercallbacks: |
|
386 | 399 | if shortname in _extensions: |
|
387 | 400 | continue |
|
388 | 401 | |
|
389 | 402 | for fn in _aftercallbacks[shortname]: |
|
390 | 403 | ui.log( |
|
391 | 404 | b'extension', |
|
392 | 405 | b' - extension %s not loaded, notify callbacks\n', |
|
393 | 406 | shortname, |
|
394 | 407 | ) |
|
395 | 408 | fn(loaded=False) |
|
396 | 409 | ui.log(b'extension', b'> remaining aftercallbacks completed in %s\n', stats) |
|
397 | 410 | |
|
398 | 411 | # loadall() is called multiple times and lingering _aftercallbacks |
|
399 | 412 | # entries could result in double execution. See issue4646. |
|
400 | 413 | _aftercallbacks.clear() |
|
401 | 414 | |
|
402 | 415 | # delay importing avoids cyclic dependency (especially commands) |
|
403 | 416 | from . import ( |
|
404 | 417 | color, |
|
405 | 418 | commands, |
|
406 | 419 | filemerge, |
|
407 | 420 | fileset, |
|
408 | 421 | revset, |
|
409 | 422 | templatefilters, |
|
410 | 423 | templatefuncs, |
|
411 | 424 | templatekw, |
|
412 | 425 | ) |
|
413 | 426 | |
|
414 | 427 | # list of (objname, loadermod, loadername) tuple: |
|
415 | 428 | # - objname is the name of an object in extension module, |
|
416 | 429 | # from which extra information is loaded |
|
417 | 430 | # - loadermod is the module where loader is placed |
|
418 | 431 | # - loadername is the name of the function, |
|
419 | 432 | # which takes (ui, extensionname, extraobj) arguments |
|
420 | 433 | ui.log(b'extension', b'- loading extension registration objects\n') |
|
421 | 434 | extraloaders = [ |
|
422 | 435 | (b'cmdtable', commands, b'loadcmdtable'), |
|
423 | 436 | (b'colortable', color, b'loadcolortable'), |
|
424 | 437 | (b'filesetpredicate', fileset, b'loadpredicate'), |
|
425 | 438 | (b'internalmerge', filemerge, b'loadinternalmerge'), |
|
426 | 439 | (b'revsetpredicate', revset, b'loadpredicate'), |
|
427 | 440 | (b'templatefilter', templatefilters, b'loadfilter'), |
|
428 | 441 | (b'templatefunc', templatefuncs, b'loadfunction'), |
|
429 | 442 | (b'templatekeyword', templatekw, b'loadkeyword'), |
|
430 | 443 | ] |
|
431 | 444 | with util.timedcm('load registration objects') as stats: |
|
432 | 445 | _loadextra(ui, newindex, extraloaders) |
|
433 | 446 | ui.log( |
|
434 | 447 | b'extension', |
|
435 | 448 | b'> extension registration object loading took %s\n', |
|
436 | 449 | stats, |
|
437 | 450 | ) |
|
438 | 451 | |
|
439 | 452 | # Report per extension loading time (except reposetup) |
|
440 | 453 | for name in sorted(loadingtime): |
|
441 | 454 | ui.log( |
|
442 | 455 | b'extension', |
|
443 | 456 | b'> extension %s take a total of %s to load\n', |
|
444 | 457 | name, |
|
445 | 458 | util.timecount(loadingtime[name]), |
|
446 | 459 | ) |
|
447 | 460 | |
|
448 | 461 | ui.log(b'extension', b'extension loading complete\n') |
|
449 | 462 | |
|
450 | 463 | |
|
451 | 464 | def _loadextra(ui, newindex, extraloaders): |
|
452 | 465 | for name in _order[newindex:]: |
|
453 | 466 | module = _extensions[name] |
|
454 | 467 | if not module: |
|
455 | 468 | continue # loading this module failed |
|
456 | 469 | |
|
457 | 470 | for objname, loadermod, loadername in extraloaders: |
|
458 | 471 | extraobj = getattr(module, objname, None) |
|
459 | 472 | if extraobj is not None: |
|
460 | 473 | getattr(loadermod, loadername)(ui, name, extraobj) |
|
461 | 474 | |
|
462 | 475 | |
|
463 | 476 | def afterloaded(extension, callback): |
|
464 | 477 | """Run the specified function after a named extension is loaded. |
|
465 | 478 | |
|
466 | 479 | If the named extension is already loaded, the callback will be called |
|
467 | 480 | immediately. |
|
468 | 481 | |
|
469 | 482 | If the named extension never loads, the callback will be called after |
|
470 | 483 | all extensions have been loaded. |
|
471 | 484 | |
|
472 | 485 | The callback receives the named argument ``loaded``, which is a boolean |
|
473 | 486 | indicating whether the dependent extension actually loaded. |
|
474 | 487 | """ |
|
475 | 488 | |
|
476 | 489 | if extension in _extensions: |
|
477 | 490 | # Report loaded as False if the extension is disabled |
|
478 | 491 | loaded = _extensions[extension] is not None |
|
479 | 492 | callback(loaded=loaded) |
|
480 | 493 | else: |
|
481 | 494 | _aftercallbacks.setdefault(extension, []).append(callback) |
|
482 | 495 | |
|
483 | 496 | |
|
484 | 497 | def populateui(ui): |
|
485 | 498 | """Run extension hooks on the given ui to populate additional members, |
|
486 | 499 | extend the class dynamically, etc. |
|
487 | 500 | |
|
488 | 501 | This will be called after the configuration is loaded, and/or extensions |
|
489 | 502 | are loaded. In general, it's once per ui instance, but in command-server |
|
490 | 503 | and hgweb, this may be called more than once with the same ui. |
|
491 | 504 | """ |
|
492 | 505 | for name, mod in extensions(ui): |
|
493 | 506 | hook = getattr(mod, 'uipopulate', None) |
|
494 | 507 | if not hook: |
|
495 | 508 | continue |
|
496 | 509 | try: |
|
497 | 510 | hook(ui) |
|
498 | 511 | except Exception as inst: |
|
499 | 512 | ui.traceback(force=True) |
|
500 | 513 | ui.warn( |
|
501 | 514 | _(b'*** failed to populate ui by extension %s: %s\n') |
|
502 | 515 | % (name, stringutil.forcebytestr(inst)) |
|
503 | 516 | ) |
|
504 | 517 | |
|
505 | 518 | |
|
506 | 519 | def bind(func, *args): |
|
507 | 520 | """Partial function application |
|
508 | 521 | |
|
509 | 522 | Returns a new function that is the partial application of args and kwargs |
|
510 | 523 | to func. For example, |
|
511 | 524 | |
|
512 | 525 | f(1, 2, bar=3) === bind(f, 1)(2, bar=3)""" |
|
513 | 526 | assert callable(func) |
|
514 | 527 | |
|
515 | 528 | def closure(*a, **kw): |
|
516 | 529 | return func(*(args + a), **kw) |
|
517 | 530 | |
|
518 | 531 | return closure |
|
519 | 532 | |
|
520 | 533 | |
|
521 | 534 | def _updatewrapper(wrap, origfn, unboundwrapper): |
|
522 | 535 | '''Copy and add some useful attributes to wrapper''' |
|
523 | 536 | try: |
|
524 | 537 | wrap.__name__ = origfn.__name__ |
|
525 | 538 | except AttributeError: |
|
526 | 539 | pass |
|
527 | 540 | wrap.__module__ = getattr(origfn, '__module__') |
|
528 | 541 | wrap.__doc__ = getattr(origfn, '__doc__') |
|
529 | 542 | wrap.__dict__.update(getattr(origfn, '__dict__', {})) |
|
530 | 543 | wrap._origfunc = origfn |
|
531 | 544 | wrap._unboundwrapper = unboundwrapper |
|
532 | 545 | |
|
533 | 546 | |
|
534 | 547 | def wrapcommand(table, command, wrapper, synopsis=None, docstring=None): |
|
535 | 548 | '''Wrap the command named `command' in table |
|
536 | 549 | |
|
537 | 550 | Replace command in the command table with wrapper. The wrapped command will |
|
538 | 551 | be inserted into the command table specified by the table argument. |
|
539 | 552 | |
|
540 | 553 | The wrapper will be called like |
|
541 | 554 | |
|
542 | 555 | wrapper(orig, *args, **kwargs) |
|
543 | 556 | |
|
544 | 557 | where orig is the original (wrapped) function, and *args, **kwargs |
|
545 | 558 | are the arguments passed to it. |
|
546 | 559 | |
|
547 | 560 | Optionally append to the command synopsis and docstring, used for help. |
|
548 | 561 | For example, if your extension wraps the ``bookmarks`` command to add the |
|
549 | 562 | flags ``--remote`` and ``--all`` you might call this function like so: |
|
550 | 563 | |
|
551 | 564 | synopsis = ' [-a] [--remote]' |
|
552 | 565 | docstring = """ |
|
553 | 566 | |
|
554 | 567 | The ``remotenames`` extension adds the ``--remote`` and ``--all`` (``-a``) |
|
555 | 568 | flags to the bookmarks command. Either flag will show the remote bookmarks |
|
556 | 569 | known to the repository; ``--remote`` will also suppress the output of the |
|
557 | 570 | local bookmarks. |
|
558 | 571 | """ |
|
559 | 572 | |
|
560 | 573 | extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks, |
|
561 | 574 | synopsis, docstring) |
|
562 | 575 | ''' |
|
563 | 576 | assert callable(wrapper) |
|
564 | 577 | aliases, entry = cmdutil.findcmd(command, table) |
|
565 | 578 | for alias, e in pycompat.iteritems(table): |
|
566 | 579 | if e is entry: |
|
567 | 580 | key = alias |
|
568 | 581 | break |
|
569 | 582 | |
|
570 | 583 | origfn = entry[0] |
|
571 | 584 | wrap = functools.partial( |
|
572 | 585 | util.checksignature(wrapper), util.checksignature(origfn) |
|
573 | 586 | ) |
|
574 | 587 | _updatewrapper(wrap, origfn, wrapper) |
|
575 | 588 | if docstring is not None: |
|
576 | 589 | wrap.__doc__ += docstring |
|
577 | 590 | |
|
578 | 591 | newentry = list(entry) |
|
579 | 592 | newentry[0] = wrap |
|
580 | 593 | if synopsis is not None: |
|
581 | 594 | newentry[2] += synopsis |
|
582 | 595 | table[key] = tuple(newentry) |
|
583 | 596 | return entry |
|
584 | 597 | |
|
585 | 598 | |
|
586 | 599 | def wrapfilecache(cls, propname, wrapper): |
|
587 | 600 | """Wraps a filecache property. |
|
588 | 601 | |
|
589 | 602 | These can't be wrapped using the normal wrapfunction. |
|
590 | 603 | """ |
|
591 | 604 | propname = pycompat.sysstr(propname) |
|
592 | 605 | assert callable(wrapper) |
|
593 | 606 | for currcls in cls.__mro__: |
|
594 | 607 | if propname in currcls.__dict__: |
|
595 | 608 | origfn = currcls.__dict__[propname].func |
|
596 | 609 | assert callable(origfn) |
|
597 | 610 | |
|
598 | 611 | def wrap(*args, **kwargs): |
|
599 | 612 | return wrapper(origfn, *args, **kwargs) |
|
600 | 613 | |
|
601 | 614 | currcls.__dict__[propname].func = wrap |
|
602 | 615 | break |
|
603 | 616 | |
|
604 | 617 | if currcls is object: |
|
605 | 618 | raise AttributeError("type '%s' has no property '%s'" % (cls, propname)) |
|
606 | 619 | |
|
607 | 620 | |
|
608 | 621 | class wrappedfunction(object): |
|
609 | 622 | '''context manager for temporarily wrapping a function''' |
|
610 | 623 | |
|
611 | 624 | def __init__(self, container, funcname, wrapper): |
|
612 | 625 | assert callable(wrapper) |
|
613 | 626 | self._container = container |
|
614 | 627 | self._funcname = funcname |
|
615 | 628 | self._wrapper = wrapper |
|
616 | 629 | |
|
617 | 630 | def __enter__(self): |
|
618 | 631 | wrapfunction(self._container, self._funcname, self._wrapper) |
|
619 | 632 | |
|
620 | 633 | def __exit__(self, exctype, excvalue, traceback): |
|
621 | 634 | unwrapfunction(self._container, self._funcname, self._wrapper) |
|
622 | 635 | |
|
623 | 636 | |
|
624 | 637 | def wrapfunction(container, funcname, wrapper): |
|
625 | 638 | """Wrap the function named funcname in container |
|
626 | 639 | |
|
627 | 640 | Replace the funcname member in the given container with the specified |
|
628 | 641 | wrapper. The container is typically a module, class, or instance. |
|
629 | 642 | |
|
630 | 643 | The wrapper will be called like |
|
631 | 644 | |
|
632 | 645 | wrapper(orig, *args, **kwargs) |
|
633 | 646 | |
|
634 | 647 | where orig is the original (wrapped) function, and *args, **kwargs |
|
635 | 648 | are the arguments passed to it. |
|
636 | 649 | |
|
637 | 650 | Wrapping methods of the repository object is not recommended since |
|
638 | 651 | it conflicts with extensions that extend the repository by |
|
639 | 652 | subclassing. All extensions that need to extend methods of |
|
640 | 653 | localrepository should use this subclassing trick: namely, |
|
641 | 654 | reposetup() should look like |
|
642 | 655 | |
|
643 | 656 | def reposetup(ui, repo): |
|
644 | 657 | class myrepo(repo.__class__): |
|
645 | 658 | def whatever(self, *args, **kwargs): |
|
646 | 659 | [...extension stuff...] |
|
647 | 660 | super(myrepo, self).whatever(*args, **kwargs) |
|
648 | 661 | [...extension stuff...] |
|
649 | 662 | |
|
650 | 663 | repo.__class__ = myrepo |
|
651 | 664 | |
|
652 | 665 | In general, combining wrapfunction() with subclassing does not |
|
653 | 666 | work. Since you cannot control what other extensions are loaded by |
|
654 | 667 | your end users, you should play nicely with others by using the |
|
655 | 668 | subclass trick. |
|
656 | 669 | """ |
|
657 | 670 | assert callable(wrapper) |
|
658 | 671 | |
|
659 | 672 | origfn = getattr(container, funcname) |
|
660 | 673 | assert callable(origfn) |
|
661 | 674 | if inspect.ismodule(container): |
|
662 | 675 | # origfn is not an instance or class method. "partial" can be used. |
|
663 | 676 | # "partial" won't insert a frame in traceback. |
|
664 | 677 | wrap = functools.partial(wrapper, origfn) |
|
665 | 678 | else: |
|
666 | 679 | # "partial" cannot be safely used. Emulate its effect by using "bind". |
|
667 | 680 | # The downside is one more frame in traceback. |
|
668 | 681 | wrap = bind(wrapper, origfn) |
|
669 | 682 | _updatewrapper(wrap, origfn, wrapper) |
|
670 | 683 | setattr(container, funcname, wrap) |
|
671 | 684 | return origfn |
|
672 | 685 | |
|
673 | 686 | |
|
674 | 687 | def unwrapfunction(container, funcname, wrapper=None): |
|
675 | 688 | """undo wrapfunction |
|
676 | 689 | |
|
677 | 690 | If wrappers is None, undo the last wrap. Otherwise removes the wrapper |
|
678 | 691 | from the chain of wrappers. |
|
679 | 692 | |
|
680 | 693 | Return the removed wrapper. |
|
681 | 694 | Raise IndexError if wrapper is None and nothing to unwrap; ValueError if |
|
682 | 695 | wrapper is not None but is not found in the wrapper chain. |
|
683 | 696 | """ |
|
684 | 697 | chain = getwrapperchain(container, funcname) |
|
685 | 698 | origfn = chain.pop() |
|
686 | 699 | if wrapper is None: |
|
687 | 700 | wrapper = chain[0] |
|
688 | 701 | chain.remove(wrapper) |
|
689 | 702 | setattr(container, funcname, origfn) |
|
690 | 703 | for w in reversed(chain): |
|
691 | 704 | wrapfunction(container, funcname, w) |
|
692 | 705 | return wrapper |
|
693 | 706 | |
|
694 | 707 | |
|
695 | 708 | def getwrapperchain(container, funcname): |
|
696 | 709 | """get a chain of wrappers of a function |
|
697 | 710 | |
|
698 | 711 | Return a list of functions: [newest wrapper, ..., oldest wrapper, origfunc] |
|
699 | 712 | |
|
700 | 713 | The wrapper functions are the ones passed to wrapfunction, whose first |
|
701 | 714 | argument is origfunc. |
|
702 | 715 | """ |
|
703 | 716 | result = [] |
|
704 | 717 | fn = getattr(container, funcname) |
|
705 | 718 | while fn: |
|
706 | 719 | assert callable(fn) |
|
707 | 720 | result.append(getattr(fn, '_unboundwrapper', fn)) |
|
708 | 721 | fn = getattr(fn, '_origfunc', None) |
|
709 | 722 | return result |
|
710 | 723 | |
|
711 | 724 | |
|
712 | 725 | def _disabledpaths(): |
|
713 | 726 | '''find paths of disabled extensions. returns a dict of {name: path}''' |
|
714 | 727 | import hgext |
|
715 | 728 | |
|
716 | 729 | # The hgext might not have a __file__ attribute (e.g. in PyOxidizer) and |
|
717 | 730 | # it might not be on a filesystem even if it does. |
|
718 | 731 | if util.safehasattr(hgext, '__file__'): |
|
719 | 732 | extpath = os.path.dirname( |
|
720 | 733 | util.abspath(pycompat.fsencode(hgext.__file__)) |
|
721 | 734 | ) |
|
722 | 735 | try: |
|
723 | 736 | files = os.listdir(extpath) |
|
724 | 737 | except OSError: |
|
725 | 738 | return {} |
|
726 | 739 | else: |
|
727 | 740 | return {} |
|
728 | 741 | |
|
729 | 742 | exts = {} |
|
730 | 743 | for e in files: |
|
731 | 744 | if e.endswith(b'.py'): |
|
732 | 745 | name = e.rsplit(b'.', 1)[0] |
|
733 | 746 | path = os.path.join(extpath, e) |
|
734 | 747 | else: |
|
735 | 748 | name = e |
|
736 | 749 | path = os.path.join(extpath, e, b'__init__.py') |
|
737 | 750 | if not os.path.exists(path): |
|
738 | 751 | continue |
|
739 | 752 | if name in exts or name in _order or name == b'__init__': |
|
740 | 753 | continue |
|
741 | 754 | exts[name] = path |
|
742 | 755 | for name, path in pycompat.iteritems(_disabledextensions): |
|
743 | 756 | # If no path was provided for a disabled extension (e.g. "color=!"), |
|
744 | 757 | # don't replace the path we already found by the scan above. |
|
745 | 758 | if path: |
|
746 | 759 | exts[name] = path |
|
747 | 760 | return exts |
|
748 | 761 | |
|
749 | 762 | |
|
750 | 763 | def _moduledoc(file): |
|
751 | 764 | """return the top-level python documentation for the given file |
|
752 | 765 | |
|
753 | 766 | Loosely inspired by pydoc.source_synopsis(), but rewritten to |
|
754 | 767 | handle triple quotes and to return the whole text instead of just |
|
755 | 768 | the synopsis""" |
|
756 | 769 | result = [] |
|
757 | 770 | |
|
758 | 771 | line = file.readline() |
|
759 | 772 | while line[:1] == b'#' or not line.strip(): |
|
760 | 773 | line = file.readline() |
|
761 | 774 | if not line: |
|
762 | 775 | break |
|
763 | 776 | |
|
764 | 777 | start = line[:3] |
|
765 | 778 | if start == b'"""' or start == b"'''": |
|
766 | 779 | line = line[3:] |
|
767 | 780 | while line: |
|
768 | 781 | if line.rstrip().endswith(start): |
|
769 | 782 | line = line.split(start)[0] |
|
770 | 783 | if line: |
|
771 | 784 | result.append(line) |
|
772 | 785 | break |
|
773 | 786 | elif not line: |
|
774 | 787 | return None # unmatched delimiter |
|
775 | 788 | result.append(line) |
|
776 | 789 | line = file.readline() |
|
777 | 790 | else: |
|
778 | 791 | return None |
|
779 | 792 | |
|
780 | 793 | return b''.join(result) |
|
781 | 794 | |
|
782 | 795 | |
|
783 | 796 | def _disabledhelp(path): |
|
784 | 797 | '''retrieve help synopsis of a disabled extension (without importing)''' |
|
785 | 798 | try: |
|
786 | 799 | with open(path, b'rb') as src: |
|
787 | 800 | doc = _moduledoc(src) |
|
788 | 801 | except IOError: |
|
789 | 802 | return |
|
790 | 803 | |
|
791 | 804 | if doc: # extracting localized synopsis |
|
792 | 805 | return gettext(doc) |
|
793 | 806 | else: |
|
794 | 807 | return _(b'(no help text available)') |
|
795 | 808 | |
|
796 | 809 | |
|
797 | 810 | def disabled(): |
|
798 | 811 | '''find disabled extensions from hgext. returns a dict of {name: desc}''' |
|
799 | 812 | try: |
|
800 | 813 | from hgext import __index__ # pytype: disable=import-error |
|
801 | 814 | |
|
802 | 815 | return { |
|
803 | 816 | name: gettext(desc) |
|
804 | 817 | for name, desc in pycompat.iteritems(__index__.docs) |
|
805 | 818 | if name not in _order |
|
806 | 819 | } |
|
807 | 820 | except (ImportError, AttributeError): |
|
808 | 821 | pass |
|
809 | 822 | |
|
810 | 823 | paths = _disabledpaths() |
|
811 | 824 | if not paths: |
|
812 | 825 | return {} |
|
813 | 826 | |
|
814 | 827 | exts = {} |
|
815 | 828 | for name, path in pycompat.iteritems(paths): |
|
816 | 829 | doc = _disabledhelp(path) |
|
817 | 830 | if doc and name != b'__index__': |
|
818 | 831 | exts[name] = doc.splitlines()[0] |
|
819 | 832 | |
|
820 | 833 | return exts |
|
821 | 834 | |
|
822 | 835 | |
|
823 | 836 | def disabled_help(name): |
|
824 | 837 | """Obtain the full help text for a disabled extension, or None.""" |
|
825 | 838 | paths = _disabledpaths() |
|
826 | 839 | if name in paths: |
|
827 | 840 | return _disabledhelp(paths[name]) |
|
828 | 841 | |
|
829 | 842 | |
|
830 | 843 | def _walkcommand(node): |
|
831 | 844 | """Scan @command() decorators in the tree starting at node""" |
|
832 | 845 | todo = collections.deque([node]) |
|
833 | 846 | while todo: |
|
834 | 847 | node = todo.popleft() |
|
835 | 848 | if not isinstance(node, ast.FunctionDef): |
|
836 | 849 | todo.extend(ast.iter_child_nodes(node)) |
|
837 | 850 | continue |
|
838 | 851 | for d in node.decorator_list: |
|
839 | 852 | if not isinstance(d, ast.Call): |
|
840 | 853 | continue |
|
841 | 854 | if not isinstance(d.func, ast.Name): |
|
842 | 855 | continue |
|
843 | 856 | if d.func.id != 'command': |
|
844 | 857 | continue |
|
845 | 858 | yield d |
|
846 | 859 | |
|
847 | 860 | |
|
848 | 861 | def _disabledcmdtable(path): |
|
849 | 862 | """Construct a dummy command table without loading the extension module |
|
850 | 863 | |
|
851 | 864 | This may raise IOError or SyntaxError. |
|
852 | 865 | """ |
|
853 | 866 | with open(path, b'rb') as src: |
|
854 | 867 | root = ast.parse(src.read(), path) |
|
855 | 868 | cmdtable = {} |
|
856 | 869 | for node in _walkcommand(root): |
|
857 | 870 | if not node.args: |
|
858 | 871 | continue |
|
859 | 872 | a = node.args[0] |
|
860 | 873 | if isinstance(a, ast.Str): |
|
861 | 874 | name = pycompat.sysbytes(a.s) |
|
862 | 875 | elif pycompat.ispy3 and isinstance(a, ast.Bytes): |
|
863 | 876 | name = a.s |
|
864 | 877 | else: |
|
865 | 878 | continue |
|
866 | 879 | cmdtable[name] = (None, [], b'') |
|
867 | 880 | return cmdtable |
|
868 | 881 | |
|
869 | 882 | |
|
870 | 883 | def _finddisabledcmd(ui, cmd, name, path, strict): |
|
871 | 884 | try: |
|
872 | 885 | cmdtable = _disabledcmdtable(path) |
|
873 | 886 | except (IOError, SyntaxError): |
|
874 | 887 | return |
|
875 | 888 | try: |
|
876 | 889 | aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict) |
|
877 | 890 | except (error.AmbiguousCommand, error.UnknownCommand): |
|
878 | 891 | return |
|
879 | 892 | for c in aliases: |
|
880 | 893 | if c.startswith(cmd): |
|
881 | 894 | cmd = c |
|
882 | 895 | break |
|
883 | 896 | else: |
|
884 | 897 | cmd = aliases[0] |
|
885 | 898 | doc = _disabledhelp(path) |
|
886 | 899 | return (cmd, name, doc) |
|
887 | 900 | |
|
888 | 901 | |
|
889 | 902 | def disabledcmd(ui, cmd, strict=False): |
|
890 | 903 | """find cmd from disabled extensions without importing. |
|
891 | 904 | returns (cmdname, extname, doc)""" |
|
892 | 905 | |
|
893 | 906 | paths = _disabledpaths() |
|
894 | 907 | if not paths: |
|
895 | 908 | raise error.UnknownCommand(cmd) |
|
896 | 909 | |
|
897 | 910 | ext = None |
|
898 | 911 | # first, search for an extension with the same name as the command |
|
899 | 912 | path = paths.pop(cmd, None) |
|
900 | 913 | if path: |
|
901 | 914 | ext = _finddisabledcmd(ui, cmd, cmd, path, strict=strict) |
|
902 | 915 | if not ext: |
|
903 | 916 | # otherwise, interrogate each extension until there's a match |
|
904 | 917 | for name, path in pycompat.iteritems(paths): |
|
905 | 918 | ext = _finddisabledcmd(ui, cmd, name, path, strict=strict) |
|
906 | 919 | if ext: |
|
907 | 920 | break |
|
908 | 921 | if ext: |
|
909 | 922 | return ext |
|
910 | 923 | |
|
911 | 924 | raise error.UnknownCommand(cmd) |
|
912 | 925 | |
|
913 | 926 | |
|
914 | 927 | def enabled(shortname=True): |
|
915 | 928 | '''return a dict of {name: desc} of extensions''' |
|
916 | 929 | exts = {} |
|
917 | 930 | for ename, ext in extensions(): |
|
918 | 931 | doc = gettext(ext.__doc__) or _(b'(no help text available)') |
|
919 | 932 | assert doc is not None # help pytype |
|
920 | 933 | if shortname: |
|
921 | 934 | ename = ename.split(b'.')[-1] |
|
922 | 935 | exts[ename] = doc.splitlines()[0].strip() |
|
923 | 936 | |
|
924 | 937 | return exts |
|
925 | 938 | |
|
926 | 939 | |
|
927 | 940 | def notloaded(): |
|
928 | 941 | '''return short names of extensions that failed to load''' |
|
929 | 942 | return [ |
|
930 | 943 | name for name, mod in pycompat.iteritems(_extensions) if mod is None |
|
931 | 944 | ] |
|
932 | 945 | |
|
933 | 946 | |
|
934 | 947 | def moduleversion(module): |
|
935 | 948 | '''return version information from given module as a string''' |
|
936 | 949 | if util.safehasattr(module, b'getversion') and callable(module.getversion): |
|
937 | 950 | try: |
|
938 | 951 | version = module.getversion() |
|
939 | 952 | except Exception: |
|
940 | 953 | version = b'unknown' |
|
941 | 954 | |
|
942 | 955 | elif util.safehasattr(module, b'__version__'): |
|
943 | 956 | version = module.__version__ |
|
944 | 957 | else: |
|
945 | 958 | version = b'' |
|
946 | 959 | if isinstance(version, (list, tuple)): |
|
947 | 960 | version = b'.'.join(pycompat.bytestr(o) for o in version) |
|
948 | 961 | else: |
|
949 | 962 | # version data should be bytes, but not all extensions are ported |
|
950 | 963 | # to py3. |
|
951 | 964 | version = stringutil.forcebytestr(version) |
|
952 | 965 | return version |
|
953 | 966 | |
|
954 | 967 | |
|
955 | 968 | def ismoduleinternal(module): |
|
956 | 969 | exttestedwith = getattr(module, 'testedwith', None) |
|
957 | 970 | return exttestedwith == b"ships-with-hg-core" |
@@ -1,3120 +1,3131 b'' | |||
|
1 | 1 | The Mercurial system uses a set of configuration files to control |
|
2 | 2 | aspects of its behavior. |
|
3 | 3 | |
|
4 | 4 | Troubleshooting |
|
5 | 5 | =============== |
|
6 | 6 | |
|
7 | 7 | If you're having problems with your configuration, |
|
8 | 8 | :hg:`config --source` can help you understand what is introducing |
|
9 | 9 | a setting into your environment. |
|
10 | 10 | |
|
11 | 11 | See :hg:`help config.syntax` and :hg:`help config.files` |
|
12 | 12 | for information about how and where to override things. |
|
13 | 13 | |
|
14 | 14 | Structure |
|
15 | 15 | ========= |
|
16 | 16 | |
|
17 | 17 | The configuration files use a simple ini-file format. A configuration |
|
18 | 18 | file consists of sections, led by a ``[section]`` header and followed |
|
19 | 19 | by ``name = value`` entries:: |
|
20 | 20 | |
|
21 | 21 | [ui] |
|
22 | 22 | username = Firstname Lastname <firstname.lastname@example.net> |
|
23 | 23 | verbose = True |
|
24 | 24 | |
|
25 | 25 | The above entries will be referred to as ``ui.username`` and |
|
26 | 26 | ``ui.verbose``, respectively. See :hg:`help config.syntax`. |
|
27 | 27 | |
|
28 | 28 | Files |
|
29 | 29 | ===== |
|
30 | 30 | |
|
31 | 31 | Mercurial reads configuration data from several files, if they exist. |
|
32 | 32 | These files do not exist by default and you will have to create the |
|
33 | 33 | appropriate configuration files yourself: |
|
34 | 34 | |
|
35 | 35 | Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. |
|
36 | 36 | |
|
37 | 37 | Global configuration like the username setting is typically put into: |
|
38 | 38 | |
|
39 | 39 | .. container:: windows |
|
40 | 40 | |
|
41 | 41 | - ``%USERPROFILE%\mercurial.ini`` (on Windows) |
|
42 | 42 | |
|
43 | 43 | .. container:: unix.plan9 |
|
44 | 44 | |
|
45 | 45 | - ``$HOME/.hgrc`` (on Unix, Plan9) |
|
46 | 46 | |
|
47 | 47 | The names of these files depend on the system on which Mercurial is |
|
48 | 48 | installed. ``*.rc`` files from a single directory are read in |
|
49 | 49 | alphabetical order, later ones overriding earlier ones. Where multiple |
|
50 | 50 | paths are given below, settings from earlier paths override later |
|
51 | 51 | ones. |
|
52 | 52 | |
|
53 | 53 | .. container:: verbose.unix |
|
54 | 54 | |
|
55 | 55 | On Unix, the following files are consulted: |
|
56 | 56 | |
|
57 | 57 | - ``<repo>/.hg/hgrc-not-shared`` (per-repository) |
|
58 | 58 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
59 | 59 | - ``$HOME/.hgrc`` (per-user) |
|
60 | 60 | - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user) |
|
61 | 61 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) |
|
62 | 62 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) |
|
63 | 63 | - ``/etc/mercurial/hgrc`` (per-system) |
|
64 | 64 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) |
|
65 | 65 | - ``<internal>/*.rc`` (defaults) |
|
66 | 66 | |
|
67 | 67 | .. container:: verbose.windows |
|
68 | 68 | |
|
69 | 69 | On Windows, the following files are consulted: |
|
70 | 70 | |
|
71 | 71 | - ``<repo>/.hg/hgrc-not-shared`` (per-repository) |
|
72 | 72 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
73 | 73 | - ``%USERPROFILE%\.hgrc`` (per-user) |
|
74 | 74 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) |
|
75 | 75 | - ``%HOME%\.hgrc`` (per-user) |
|
76 | 76 | - ``%HOME%\Mercurial.ini`` (per-user) |
|
77 | 77 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-system) |
|
78 | 78 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) |
|
79 | 79 | - ``<install-dir>\Mercurial.ini`` (per-installation) |
|
80 | 80 | - ``%PROGRAMDATA%\Mercurial\hgrc`` (per-system) |
|
81 | 81 | - ``%PROGRAMDATA%\Mercurial\Mercurial.ini`` (per-system) |
|
82 | 82 | - ``%PROGRAMDATA%\Mercurial\hgrc.d\*.rc`` (per-system) |
|
83 | 83 | - ``<internal>/*.rc`` (defaults) |
|
84 | 84 | |
|
85 | 85 | .. note:: |
|
86 | 86 | |
|
87 | 87 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` |
|
88 | 88 | is used when running 32-bit Python on 64-bit Windows. |
|
89 | 89 | |
|
90 | 90 | .. container:: verbose.plan9 |
|
91 | 91 | |
|
92 | 92 | On Plan9, the following files are consulted: |
|
93 | 93 | |
|
94 | 94 | - ``<repo>/.hg/hgrc-not-shared`` (per-repository) |
|
95 | 95 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
96 | 96 | - ``$home/lib/hgrc`` (per-user) |
|
97 | 97 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) |
|
98 | 98 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) |
|
99 | 99 | - ``/lib/mercurial/hgrc`` (per-system) |
|
100 | 100 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) |
|
101 | 101 | - ``<internal>/*.rc`` (defaults) |
|
102 | 102 | |
|
103 | 103 | Per-repository configuration options only apply in a |
|
104 | 104 | particular repository. This file is not version-controlled, and |
|
105 | 105 | will not get transferred during a "clone" operation. Options in |
|
106 | 106 | this file override options in all other configuration files. |
|
107 | 107 | |
|
108 | 108 | .. container:: unix.plan9 |
|
109 | 109 | |
|
110 | 110 | On Plan 9 and Unix, most of this file will be ignored if it doesn't |
|
111 | 111 | belong to a trusted user or to a trusted group. See |
|
112 | 112 | :hg:`help config.trusted` for more details. |
|
113 | 113 | |
|
114 | 114 | Per-user configuration file(s) are for the user running Mercurial. Options |
|
115 | 115 | in these files apply to all Mercurial commands executed by this user in any |
|
116 | 116 | directory. Options in these files override per-system and per-installation |
|
117 | 117 | options. |
|
118 | 118 | |
|
119 | 119 | Per-installation configuration files are searched for in the |
|
120 | 120 | directory where Mercurial is installed. ``<install-root>`` is the |
|
121 | 121 | parent directory of the **hg** executable (or symlink) being run. |
|
122 | 122 | |
|
123 | 123 | .. container:: unix.plan9 |
|
124 | 124 | |
|
125 | 125 | For example, if installed in ``/shared/tools/bin/hg``, Mercurial |
|
126 | 126 | will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these |
|
127 | 127 | files apply to all Mercurial commands executed by any user in any |
|
128 | 128 | directory. |
|
129 | 129 | |
|
130 | 130 | Per-installation configuration files are for the system on |
|
131 | 131 | which Mercurial is running. Options in these files apply to all |
|
132 | 132 | Mercurial commands executed by any user in any directory. Registry |
|
133 | 133 | keys contain PATH-like strings, every part of which must reference |
|
134 | 134 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
135 | 135 | be read. Mercurial checks each of these locations in the specified |
|
136 | 136 | order until one or more configuration files are detected. |
|
137 | 137 | |
|
138 | 138 | Per-system configuration files are for the system on which Mercurial |
|
139 | 139 | is running. Options in these files apply to all Mercurial commands |
|
140 | 140 | executed by any user in any directory. Options in these files |
|
141 | 141 | override per-installation options. |
|
142 | 142 | |
|
143 | 143 | Mercurial comes with some default configuration. The default configuration |
|
144 | 144 | files are installed with Mercurial and will be overwritten on upgrades. Default |
|
145 | 145 | configuration files should never be edited by users or administrators but can |
|
146 | 146 | be overridden in other configuration files. So far the directory only contains |
|
147 | 147 | merge tool configuration but packagers can also put other default configuration |
|
148 | 148 | there. |
|
149 | 149 | |
|
150 | 150 | On versions 5.7 and later, if share-safe functionality is enabled, |
|
151 | 151 | shares will read config file of share source too. |
|
152 | 152 | `<share-source/.hg/hgrc>` is read before reading `<repo/.hg/hgrc>`. |
|
153 | 153 | |
|
154 | 154 | For configs which should not be shared, `<repo/.hg/hgrc-not-shared>` |
|
155 | 155 | should be used. |
|
156 | 156 | |
|
157 | 157 | Syntax |
|
158 | 158 | ====== |
|
159 | 159 | |
|
160 | 160 | A configuration file consists of sections, led by a ``[section]`` header |
|
161 | 161 | and followed by ``name = value`` entries (sometimes called |
|
162 | 162 | ``configuration keys``):: |
|
163 | 163 | |
|
164 | 164 | [spam] |
|
165 | 165 | eggs=ham |
|
166 | 166 | green= |
|
167 | 167 | eggs |
|
168 | 168 | |
|
169 | 169 | Each line contains one entry. If the lines that follow are indented, |
|
170 | 170 | they are treated as continuations of that entry. Leading whitespace is |
|
171 | 171 | removed from values. Empty lines are skipped. Lines beginning with |
|
172 | 172 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
173 | 173 | |
|
174 | 174 | Configuration keys can be set multiple times, in which case Mercurial |
|
175 | 175 | will use the value that was configured last. As an example:: |
|
176 | 176 | |
|
177 | 177 | [spam] |
|
178 | 178 | eggs=large |
|
179 | 179 | ham=serrano |
|
180 | 180 | eggs=small |
|
181 | 181 | |
|
182 | 182 | This would set the configuration key named ``eggs`` to ``small``. |
|
183 | 183 | |
|
184 | 184 | It is also possible to define a section multiple times. A section can |
|
185 | 185 | be redefined on the same and/or on different configuration files. For |
|
186 | 186 | example:: |
|
187 | 187 | |
|
188 | 188 | [foo] |
|
189 | 189 | eggs=large |
|
190 | 190 | ham=serrano |
|
191 | 191 | eggs=small |
|
192 | 192 | |
|
193 | 193 | [bar] |
|
194 | 194 | eggs=ham |
|
195 | 195 | green= |
|
196 | 196 | eggs |
|
197 | 197 | |
|
198 | 198 | [foo] |
|
199 | 199 | ham=prosciutto |
|
200 | 200 | eggs=medium |
|
201 | 201 | bread=toasted |
|
202 | 202 | |
|
203 | 203 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys |
|
204 | 204 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, |
|
205 | 205 | respectively. As you can see there only thing that matters is the last |
|
206 | 206 | value that was set for each of the configuration keys. |
|
207 | 207 | |
|
208 | 208 | If a configuration key is set multiple times in different |
|
209 | 209 | configuration files the final value will depend on the order in which |
|
210 | 210 | the different configuration files are read, with settings from earlier |
|
211 | 211 | paths overriding later ones as described on the ``Files`` section |
|
212 | 212 | above. |
|
213 | 213 | |
|
214 | 214 | A line of the form ``%include file`` will include ``file`` into the |
|
215 | 215 | current configuration file. The inclusion is recursive, which means |
|
216 | 216 | that included files can include other files. Filenames are relative to |
|
217 | 217 | the configuration file in which the ``%include`` directive is found. |
|
218 | 218 | Environment variables and ``~user`` constructs are expanded in |
|
219 | 219 | ``file``. This lets you do something like:: |
|
220 | 220 | |
|
221 | 221 | %include ~/.hgrc.d/$HOST.rc |
|
222 | 222 | |
|
223 | 223 | to include a different configuration file on each computer you use. |
|
224 | 224 | |
|
225 | 225 | A line with ``%unset name`` will remove ``name`` from the current |
|
226 | 226 | section, if it has been set previously. |
|
227 | 227 | |
|
228 | 228 | The values are either free-form text strings, lists of text strings, |
|
229 | 229 | or Boolean values. Boolean values can be set to true using any of "1", |
|
230 | 230 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" |
|
231 | 231 | (all case insensitive). |
|
232 | 232 | |
|
233 | 233 | List values are separated by whitespace or comma, except when values are |
|
234 | 234 | placed in double quotation marks:: |
|
235 | 235 | |
|
236 | 236 | allow_read = "John Doe, PhD", brian, betty |
|
237 | 237 | |
|
238 | 238 | Quotation marks can be escaped by prefixing them with a backslash. Only |
|
239 | 239 | quotation marks at the beginning of a word is counted as a quotation |
|
240 | 240 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). |
|
241 | 241 | |
|
242 | 242 | Sections |
|
243 | 243 | ======== |
|
244 | 244 | |
|
245 | 245 | This section describes the different sections that may appear in a |
|
246 | 246 | Mercurial configuration file, the purpose of each section, its possible |
|
247 | 247 | keys, and their possible values. |
|
248 | 248 | |
|
249 | 249 | ``alias`` |
|
250 | 250 | --------- |
|
251 | 251 | |
|
252 | 252 | Defines command aliases. |
|
253 | 253 | |
|
254 | 254 | Aliases allow you to define your own commands in terms of other |
|
255 | 255 | commands (or aliases), optionally including arguments. Positional |
|
256 | 256 | arguments in the form of ``$1``, ``$2``, etc. in the alias definition |
|
257 | 257 | are expanded by Mercurial before execution. Positional arguments not |
|
258 | 258 | already used by ``$N`` in the definition are put at the end of the |
|
259 | 259 | command to be executed. |
|
260 | 260 | |
|
261 | 261 | Alias definitions consist of lines of the form:: |
|
262 | 262 | |
|
263 | 263 | <alias> = <command> [<argument>]... |
|
264 | 264 | |
|
265 | 265 | For example, this definition:: |
|
266 | 266 | |
|
267 | 267 | latest = log --limit 5 |
|
268 | 268 | |
|
269 | 269 | creates a new command ``latest`` that shows only the five most recent |
|
270 | 270 | changesets. You can define subsequent aliases using earlier ones:: |
|
271 | 271 | |
|
272 | 272 | stable5 = latest -b stable |
|
273 | 273 | |
|
274 | 274 | .. note:: |
|
275 | 275 | |
|
276 | 276 | It is possible to create aliases with the same names as |
|
277 | 277 | existing commands, which will then override the original |
|
278 | 278 | definitions. This is almost always a bad idea! |
|
279 | 279 | |
|
280 | 280 | An alias can start with an exclamation point (``!``) to make it a |
|
281 | 281 | shell alias. A shell alias is executed with the shell and will let you |
|
282 | 282 | run arbitrary commands. As an example, :: |
|
283 | 283 | |
|
284 | 284 | echo = !echo $@ |
|
285 | 285 | |
|
286 | 286 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
287 | 287 | terminal. A better example might be:: |
|
288 | 288 | |
|
289 | 289 | purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f |
|
290 | 290 | |
|
291 | 291 | which will make ``hg purge`` delete all unknown files in the |
|
292 | 292 | repository in the same manner as the purge extension. |
|
293 | 293 | |
|
294 | 294 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition |
|
295 | 295 | expand to the command arguments. Unmatched arguments are |
|
296 | 296 | removed. ``$0`` expands to the alias name and ``$@`` expands to all |
|
297 | 297 | arguments separated by a space. ``"$@"`` (with quotes) expands to all |
|
298 | 298 | arguments quoted individually and separated by a space. These expansions |
|
299 | 299 | happen before the command is passed to the shell. |
|
300 | 300 | |
|
301 | 301 | Shell aliases are executed in an environment where ``$HG`` expands to |
|
302 | 302 | the path of the Mercurial that was used to execute the alias. This is |
|
303 | 303 | useful when you want to call further Mercurial commands in a shell |
|
304 | 304 | alias, as was done above for the purge alias. In addition, |
|
305 | 305 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg |
|
306 | 306 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
307 | 307 | |
|
308 | 308 | .. note:: |
|
309 | 309 | |
|
310 | 310 | Some global configuration options such as ``-R`` are |
|
311 | 311 | processed before shell aliases and will thus not be passed to |
|
312 | 312 | aliases. |
|
313 | 313 | |
|
314 | 314 | |
|
315 | 315 | ``annotate`` |
|
316 | 316 | ------------ |
|
317 | 317 | |
|
318 | 318 | Settings used when displaying file annotations. All values are |
|
319 | 319 | Booleans and default to False. See :hg:`help config.diff` for |
|
320 | 320 | related options for the diff command. |
|
321 | 321 | |
|
322 | 322 | ``ignorews`` |
|
323 | 323 | Ignore white space when comparing lines. |
|
324 | 324 | |
|
325 | 325 | ``ignorewseol`` |
|
326 | 326 | Ignore white space at the end of a line when comparing lines. |
|
327 | 327 | |
|
328 | 328 | ``ignorewsamount`` |
|
329 | 329 | Ignore changes in the amount of white space. |
|
330 | 330 | |
|
331 | 331 | ``ignoreblanklines`` |
|
332 | 332 | Ignore changes whose lines are all blank. |
|
333 | 333 | |
|
334 | 334 | |
|
335 | 335 | ``auth`` |
|
336 | 336 | -------- |
|
337 | 337 | |
|
338 | 338 | Authentication credentials and other authentication-like configuration |
|
339 | 339 | for HTTP connections. This section allows you to store usernames and |
|
340 | 340 | passwords for use when logging *into* HTTP servers. See |
|
341 | 341 | :hg:`help config.web` if you want to configure *who* can login to |
|
342 | 342 | your HTTP server. |
|
343 | 343 | |
|
344 | 344 | The following options apply to all hosts. |
|
345 | 345 | |
|
346 | 346 | ``cookiefile`` |
|
347 | 347 | Path to a file containing HTTP cookie lines. Cookies matching a |
|
348 | 348 | host will be sent automatically. |
|
349 | 349 | |
|
350 | 350 | The file format uses the Mozilla cookies.txt format, which defines cookies |
|
351 | 351 | on their own lines. Each line contains 7 fields delimited by the tab |
|
352 | 352 | character (domain, is_domain_cookie, path, is_secure, expires, name, |
|
353 | 353 | value). For more info, do an Internet search for "Netscape cookies.txt |
|
354 | 354 | format." |
|
355 | 355 | |
|
356 | 356 | Note: the cookies parser does not handle port numbers on domains. You |
|
357 | 357 | will need to remove ports from the domain for the cookie to be recognized. |
|
358 | 358 | This could result in a cookie being disclosed to an unwanted server. |
|
359 | 359 | |
|
360 | 360 | The cookies file is read-only. |
|
361 | 361 | |
|
362 | 362 | Other options in this section are grouped by name and have the following |
|
363 | 363 | format:: |
|
364 | 364 | |
|
365 | 365 | <name>.<argument> = <value> |
|
366 | 366 | |
|
367 | 367 | where ``<name>`` is used to group arguments into authentication |
|
368 | 368 | entries. Example:: |
|
369 | 369 | |
|
370 | 370 | foo.prefix = hg.intevation.de/mercurial |
|
371 | 371 | foo.username = foo |
|
372 | 372 | foo.password = bar |
|
373 | 373 | foo.schemes = http https |
|
374 | 374 | |
|
375 | 375 | bar.prefix = secure.example.org |
|
376 | 376 | bar.key = path/to/file.key |
|
377 | 377 | bar.cert = path/to/file.cert |
|
378 | 378 | bar.schemes = https |
|
379 | 379 | |
|
380 | 380 | Supported arguments: |
|
381 | 381 | |
|
382 | 382 | ``prefix`` |
|
383 | 383 | Either ``*`` or a URI prefix with or without the scheme part. |
|
384 | 384 | The authentication entry with the longest matching prefix is used |
|
385 | 385 | (where ``*`` matches everything and counts as a match of length |
|
386 | 386 | 1). If the prefix doesn't include a scheme, the match is performed |
|
387 | 387 | against the URI with its scheme stripped as well, and the schemes |
|
388 | 388 | argument, q.v., is then subsequently consulted. |
|
389 | 389 | |
|
390 | 390 | ``username`` |
|
391 | 391 | Optional. Username to authenticate with. If not given, and the |
|
392 | 392 | remote site requires basic or digest authentication, the user will |
|
393 | 393 | be prompted for it. Environment variables are expanded in the |
|
394 | 394 | username letting you do ``foo.username = $USER``. If the URI |
|
395 | 395 | includes a username, only ``[auth]`` entries with a matching |
|
396 | 396 | username or without a username will be considered. |
|
397 | 397 | |
|
398 | 398 | ``password`` |
|
399 | 399 | Optional. Password to authenticate with. If not given, and the |
|
400 | 400 | remote site requires basic or digest authentication, the user |
|
401 | 401 | will be prompted for it. |
|
402 | 402 | |
|
403 | 403 | ``key`` |
|
404 | 404 | Optional. PEM encoded client certificate key file. Environment |
|
405 | 405 | variables are expanded in the filename. |
|
406 | 406 | |
|
407 | 407 | ``cert`` |
|
408 | 408 | Optional. PEM encoded client certificate chain file. Environment |
|
409 | 409 | variables are expanded in the filename. |
|
410 | 410 | |
|
411 | 411 | ``schemes`` |
|
412 | 412 | Optional. Space separated list of URI schemes to use this |
|
413 | 413 | authentication entry with. Only used if the prefix doesn't include |
|
414 | 414 | a scheme. Supported schemes are http and https. They will match |
|
415 | 415 | static-http and static-https respectively, as well. |
|
416 | 416 | (default: https) |
|
417 | 417 | |
|
418 | 418 | If no suitable authentication entry is found, the user is prompted |
|
419 | 419 | for credentials as usual if required by the remote. |
|
420 | 420 | |
|
421 | 421 | ``cmdserver`` |
|
422 | 422 | ------------- |
|
423 | 423 | |
|
424 | 424 | Controls command server settings. (ADVANCED) |
|
425 | 425 | |
|
426 | 426 | ``message-encodings`` |
|
427 | 427 | List of encodings for the ``m`` (message) channel. The first encoding |
|
428 | 428 | supported by the server will be selected and advertised in the hello |
|
429 | 429 | message. This is useful only when ``ui.message-output`` is set to |
|
430 | 430 | ``channel``. Supported encodings are ``cbor``. |
|
431 | 431 | |
|
432 | 432 | ``shutdown-on-interrupt`` |
|
433 | 433 | If set to false, the server's main loop will continue running after |
|
434 | 434 | SIGINT received. ``runcommand`` requests can still be interrupted by |
|
435 | 435 | SIGINT. Close the write end of the pipe to shut down the server |
|
436 | 436 | process gracefully. |
|
437 | 437 | (default: True) |
|
438 | 438 | |
|
439 | 439 | ``color`` |
|
440 | 440 | --------- |
|
441 | 441 | |
|
442 | 442 | Configure the Mercurial color mode. For details about how to define your custom |
|
443 | 443 | effect and style see :hg:`help color`. |
|
444 | 444 | |
|
445 | 445 | ``mode`` |
|
446 | 446 | String: control the method used to output color. One of ``auto``, ``ansi``, |
|
447 | 447 | ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will |
|
448 | 448 | use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a |
|
449 | 449 | terminal. Any invalid value will disable color. |
|
450 | 450 | |
|
451 | 451 | ``pagermode`` |
|
452 | 452 | String: optional override of ``color.mode`` used with pager. |
|
453 | 453 | |
|
454 | 454 | On some systems, terminfo mode may cause problems when using |
|
455 | 455 | color with ``less -R`` as a pager program. less with the -R option |
|
456 | 456 | will only display ECMA-48 color codes, and terminfo mode may sometimes |
|
457 | 457 | emit codes that less doesn't understand. You can work around this by |
|
458 | 458 | either using ansi mode (or auto mode), or by using less -r (which will |
|
459 | 459 | pass through all terminal control codes, not just color control |
|
460 | 460 | codes). |
|
461 | 461 | |
|
462 | 462 | On some systems (such as MSYS in Windows), the terminal may support |
|
463 | 463 | a different color mode than the pager program. |
|
464 | 464 | |
|
465 | 465 | ``commands`` |
|
466 | 466 | ------------ |
|
467 | 467 | |
|
468 | 468 | ``commit.post-status`` |
|
469 | 469 | Show status of files in the working directory after successful commit. |
|
470 | 470 | (default: False) |
|
471 | 471 | |
|
472 | 472 | ``merge.require-rev`` |
|
473 | 473 | Require that the revision to merge the current commit with be specified on |
|
474 | 474 | the command line. If this is enabled and a revision is not specified, the |
|
475 | 475 | command aborts. |
|
476 | 476 | (default: False) |
|
477 | 477 | |
|
478 | 478 | ``push.require-revs`` |
|
479 | 479 | Require revisions to push be specified using one or more mechanisms such as |
|
480 | 480 | specifying them positionally on the command line, using ``-r``, ``-b``, |
|
481 | 481 | and/or ``-B`` on the command line, or using ``paths.<path>:pushrev`` in the |
|
482 | 482 | configuration. If this is enabled and revisions are not specified, the |
|
483 | 483 | command aborts. |
|
484 | 484 | (default: False) |
|
485 | 485 | |
|
486 | 486 | ``resolve.confirm`` |
|
487 | 487 | Confirm before performing action if no filename is passed. |
|
488 | 488 | (default: False) |
|
489 | 489 | |
|
490 | 490 | ``resolve.explicit-re-merge`` |
|
491 | 491 | Require uses of ``hg resolve`` to specify which action it should perform, |
|
492 | 492 | instead of re-merging files by default. |
|
493 | 493 | (default: False) |
|
494 | 494 | |
|
495 | 495 | ``resolve.mark-check`` |
|
496 | 496 | Determines what level of checking :hg:`resolve --mark` will perform before |
|
497 | 497 | marking files as resolved. Valid values are ``none`, ``warn``, and |
|
498 | 498 | ``abort``. ``warn`` will output a warning listing the file(s) that still |
|
499 | 499 | have conflict markers in them, but will still mark everything resolved. |
|
500 | 500 | ``abort`` will output the same warning but will not mark things as resolved. |
|
501 | 501 | If --all is passed and this is set to ``abort``, only a warning will be |
|
502 | 502 | shown (an error will not be raised). |
|
503 | 503 | (default: ``none``) |
|
504 | 504 | |
|
505 | 505 | ``status.relative`` |
|
506 | 506 | Make paths in :hg:`status` output relative to the current directory. |
|
507 | 507 | (default: False) |
|
508 | 508 | |
|
509 | 509 | ``status.terse`` |
|
510 | 510 | Default value for the --terse flag, which condenses status output. |
|
511 | 511 | (default: empty) |
|
512 | 512 | |
|
513 | 513 | ``update.check`` |
|
514 | 514 | Determines what level of checking :hg:`update` will perform before moving |
|
515 | 515 | to a destination revision. Valid values are ``abort``, ``none``, |
|
516 | 516 | ``linear``, and ``noconflict``. ``abort`` always fails if the working |
|
517 | 517 | directory has uncommitted changes. ``none`` performs no checking, and may |
|
518 | 518 | result in a merge with uncommitted changes. ``linear`` allows any update |
|
519 | 519 | as long as it follows a straight line in the revision history, and may |
|
520 | 520 | trigger a merge with uncommitted changes. ``noconflict`` will allow any |
|
521 | 521 | update which would not trigger a merge with uncommitted changes, if any |
|
522 | 522 | are present. |
|
523 | 523 | (default: ``linear``) |
|
524 | 524 | |
|
525 | 525 | ``update.requiredest`` |
|
526 | 526 | Require that the user pass a destination when running :hg:`update`. |
|
527 | 527 | For example, :hg:`update .::` will be allowed, but a plain :hg:`update` |
|
528 | 528 | will be disallowed. |
|
529 | 529 | (default: False) |
|
530 | 530 | |
|
531 | 531 | ``committemplate`` |
|
532 | 532 | ------------------ |
|
533 | 533 | |
|
534 | 534 | ``changeset`` |
|
535 | 535 | String: configuration in this section is used as the template to |
|
536 | 536 | customize the text shown in the editor when committing. |
|
537 | 537 | |
|
538 | 538 | In addition to pre-defined template keywords, commit log specific one |
|
539 | 539 | below can be used for customization: |
|
540 | 540 | |
|
541 | 541 | ``extramsg`` |
|
542 | 542 | String: Extra message (typically 'Leave message empty to abort |
|
543 | 543 | commit.'). This may be changed by some commands or extensions. |
|
544 | 544 | |
|
545 | 545 | For example, the template configuration below shows as same text as |
|
546 | 546 | one shown by default:: |
|
547 | 547 | |
|
548 | 548 | [committemplate] |
|
549 | 549 | changeset = {desc}\n\n |
|
550 | 550 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
551 | 551 | HG: {extramsg} |
|
552 | 552 | HG: -- |
|
553 | 553 | HG: user: {author}\n{ifeq(p2rev, "-1", "", |
|
554 | 554 | "HG: branch merge\n") |
|
555 | 555 | }HG: branch '{branch}'\n{if(activebookmark, |
|
556 | 556 | "HG: bookmark '{activebookmark}'\n") }{subrepos % |
|
557 | 557 | "HG: subrepo {subrepo}\n" }{file_adds % |
|
558 | 558 | "HG: added {file}\n" }{file_mods % |
|
559 | 559 | "HG: changed {file}\n" }{file_dels % |
|
560 | 560 | "HG: removed {file}\n" }{if(files, "", |
|
561 | 561 | "HG: no files changed\n")} |
|
562 | 562 | |
|
563 | 563 | ``diff()`` |
|
564 | 564 | String: show the diff (see :hg:`help templates` for detail) |
|
565 | 565 | |
|
566 | 566 | Sometimes it is helpful to show the diff of the changeset in the editor without |
|
567 | 567 | having to prefix 'HG: ' to each line so that highlighting works correctly. For |
|
568 | 568 | this, Mercurial provides a special string which will ignore everything below |
|
569 | 569 | it:: |
|
570 | 570 | |
|
571 | 571 | HG: ------------------------ >8 ------------------------ |
|
572 | 572 | |
|
573 | 573 | For example, the template configuration below will show the diff below the |
|
574 | 574 | extra message:: |
|
575 | 575 | |
|
576 | 576 | [committemplate] |
|
577 | 577 | changeset = {desc}\n\n |
|
578 | 578 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
579 | 579 | HG: {extramsg} |
|
580 | 580 | HG: ------------------------ >8 ------------------------ |
|
581 | 581 | HG: Do not touch the line above. |
|
582 | 582 | HG: Everything below will be removed. |
|
583 | 583 | {diff()} |
|
584 | 584 | |
|
585 | 585 | .. note:: |
|
586 | 586 | |
|
587 | 587 | For some problematic encodings (see :hg:`help win32mbcs` for |
|
588 | 588 | detail), this customization should be configured carefully, to |
|
589 | 589 | avoid showing broken characters. |
|
590 | 590 | |
|
591 | 591 | For example, if a multibyte character ending with backslash (0x5c) is |
|
592 | 592 | followed by the ASCII character 'n' in the customized template, |
|
593 | 593 | the sequence of backslash and 'n' is treated as line-feed unexpectedly |
|
594 | 594 | (and the multibyte character is broken, too). |
|
595 | 595 | |
|
596 | 596 | Customized template is used for commands below (``--edit`` may be |
|
597 | 597 | required): |
|
598 | 598 | |
|
599 | 599 | - :hg:`backout` |
|
600 | 600 | - :hg:`commit` |
|
601 | 601 | - :hg:`fetch` (for merge commit only) |
|
602 | 602 | - :hg:`graft` |
|
603 | 603 | - :hg:`histedit` |
|
604 | 604 | - :hg:`import` |
|
605 | 605 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` |
|
606 | 606 | - :hg:`rebase` |
|
607 | 607 | - :hg:`shelve` |
|
608 | 608 | - :hg:`sign` |
|
609 | 609 | - :hg:`tag` |
|
610 | 610 | - :hg:`transplant` |
|
611 | 611 | |
|
612 | 612 | Configuring items below instead of ``changeset`` allows showing |
|
613 | 613 | customized message only for specific actions, or showing different |
|
614 | 614 | messages for each action. |
|
615 | 615 | |
|
616 | 616 | - ``changeset.backout`` for :hg:`backout` |
|
617 | 617 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges |
|
618 | 618 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other |
|
619 | 619 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges |
|
620 | 620 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other |
|
621 | 621 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) |
|
622 | 622 | - ``changeset.gpg.sign`` for :hg:`sign` |
|
623 | 623 | - ``changeset.graft`` for :hg:`graft` |
|
624 | 624 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` |
|
625 | 625 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` |
|
626 | 626 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` |
|
627 | 627 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` |
|
628 | 628 | - ``changeset.import.bypass`` for :hg:`import --bypass` |
|
629 | 629 | - ``changeset.import.normal.merge`` for :hg:`import` on merges |
|
630 | 630 | - ``changeset.import.normal.normal`` for :hg:`import` on other |
|
631 | 631 | - ``changeset.mq.qnew`` for :hg:`qnew` |
|
632 | 632 | - ``changeset.mq.qfold`` for :hg:`qfold` |
|
633 | 633 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` |
|
634 | 634 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` |
|
635 | 635 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges |
|
636 | 636 | - ``changeset.rebase.normal`` for :hg:`rebase` on other |
|
637 | 637 | - ``changeset.shelve.shelve`` for :hg:`shelve` |
|
638 | 638 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` |
|
639 | 639 | - ``changeset.tag.remove`` for :hg:`tag --remove` |
|
640 | 640 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges |
|
641 | 641 | - ``changeset.transplant.normal`` for :hg:`transplant` on other |
|
642 | 642 | |
|
643 | 643 | These dot-separated lists of names are treated as hierarchical ones. |
|
644 | 644 | For example, ``changeset.tag.remove`` customizes the commit message |
|
645 | 645 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the |
|
646 | 646 | commit message for :hg:`tag` regardless of ``--remove`` option. |
|
647 | 647 | |
|
648 | 648 | When the external editor is invoked for a commit, the corresponding |
|
649 | 649 | dot-separated list of names without the ``changeset.`` prefix |
|
650 | 650 | (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment |
|
651 | 651 | variable. |
|
652 | 652 | |
|
653 | 653 | In this section, items other than ``changeset`` can be referred from |
|
654 | 654 | others. For example, the configuration to list committed files up |
|
655 | 655 | below can be referred as ``{listupfiles}``:: |
|
656 | 656 | |
|
657 | 657 | [committemplate] |
|
658 | 658 | listupfiles = {file_adds % |
|
659 | 659 | "HG: added {file}\n" }{file_mods % |
|
660 | 660 | "HG: changed {file}\n" }{file_dels % |
|
661 | 661 | "HG: removed {file}\n" }{if(files, "", |
|
662 | 662 | "HG: no files changed\n")} |
|
663 | 663 | |
|
664 | 664 | ``decode/encode`` |
|
665 | 665 | ----------------- |
|
666 | 666 | |
|
667 | 667 | Filters for transforming files on checkout/checkin. This would |
|
668 | 668 | typically be used for newline processing or other |
|
669 | 669 | localization/canonicalization of files. |
|
670 | 670 | |
|
671 | 671 | Filters consist of a filter pattern followed by a filter command. |
|
672 | 672 | Filter patterns are globs by default, rooted at the repository root. |
|
673 | 673 | For example, to match any file ending in ``.txt`` in the root |
|
674 | 674 | directory only, use the pattern ``*.txt``. To match any file ending |
|
675 | 675 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
676 | 676 | For each file only the first matching filter applies. |
|
677 | 677 | |
|
678 | 678 | The filter command can start with a specifier, either ``pipe:`` or |
|
679 | 679 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
680 | 680 | |
|
681 | 681 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
682 | 682 | data on stdout. |
|
683 | 683 | |
|
684 | 684 | Pipe example:: |
|
685 | 685 | |
|
686 | 686 | [encode] |
|
687 | 687 | # uncompress gzip files on checkin to improve delta compression |
|
688 | 688 | # note: not necessarily a good idea, just an example |
|
689 | 689 | *.gz = pipe: gunzip |
|
690 | 690 | |
|
691 | 691 | [decode] |
|
692 | 692 | # recompress gzip files when writing them to the working dir (we |
|
693 | 693 | # can safely omit "pipe:", because it's the default) |
|
694 | 694 | *.gz = gzip |
|
695 | 695 | |
|
696 | 696 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
697 | 697 | with the name of a temporary file that contains the data to be |
|
698 | 698 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
699 | 699 | of an empty temporary file, where the filtered data must be written by |
|
700 | 700 | the command. |
|
701 | 701 | |
|
702 | 702 | .. container:: windows |
|
703 | 703 | |
|
704 | 704 | .. note:: |
|
705 | 705 | |
|
706 | 706 | The tempfile mechanism is recommended for Windows systems, |
|
707 | 707 | where the standard shell I/O redirection operators often have |
|
708 | 708 | strange effects and may corrupt the contents of your files. |
|
709 | 709 | |
|
710 | 710 | This filter mechanism is used internally by the ``eol`` extension to |
|
711 | 711 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
712 | 712 | format. We suggest you use the ``eol`` extension for convenience. |
|
713 | 713 | |
|
714 | 714 | |
|
715 | 715 | ``defaults`` |
|
716 | 716 | ------------ |
|
717 | 717 | |
|
718 | 718 | (defaults are deprecated. Don't use them. Use aliases instead.) |
|
719 | 719 | |
|
720 | 720 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
721 | 721 | default options/arguments to pass to the specified commands. |
|
722 | 722 | |
|
723 | 723 | The following example makes :hg:`log` run in verbose mode, and |
|
724 | 724 | :hg:`status` show only the modified files, by default:: |
|
725 | 725 | |
|
726 | 726 | [defaults] |
|
727 | 727 | log = -v |
|
728 | 728 | status = -m |
|
729 | 729 | |
|
730 | 730 | The actual commands, instead of their aliases, must be used when |
|
731 | 731 | defining command defaults. The command defaults will also be applied |
|
732 | 732 | to the aliases of the commands defined. |
|
733 | 733 | |
|
734 | 734 | |
|
735 | 735 | ``diff`` |
|
736 | 736 | -------- |
|
737 | 737 | |
|
738 | 738 | Settings used when displaying diffs. Everything except for ``unified`` |
|
739 | 739 | is a Boolean and defaults to False. See :hg:`help config.annotate` |
|
740 | 740 | for related options for the annotate command. |
|
741 | 741 | |
|
742 | 742 | ``git`` |
|
743 | 743 | Use git extended diff format. |
|
744 | 744 | |
|
745 | 745 | ``nobinary`` |
|
746 | 746 | Omit git binary patches. |
|
747 | 747 | |
|
748 | 748 | ``nodates`` |
|
749 | 749 | Don't include dates in diff headers. |
|
750 | 750 | |
|
751 | 751 | ``noprefix`` |
|
752 | 752 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. |
|
753 | 753 | |
|
754 | 754 | ``showfunc`` |
|
755 | 755 | Show which function each change is in. |
|
756 | 756 | |
|
757 | 757 | ``ignorews`` |
|
758 | 758 | Ignore white space when comparing lines. |
|
759 | 759 | |
|
760 | 760 | ``ignorewsamount`` |
|
761 | 761 | Ignore changes in the amount of white space. |
|
762 | 762 | |
|
763 | 763 | ``ignoreblanklines`` |
|
764 | 764 | Ignore changes whose lines are all blank. |
|
765 | 765 | |
|
766 | 766 | ``unified`` |
|
767 | 767 | Number of lines of context to show. |
|
768 | 768 | |
|
769 | 769 | ``word-diff`` |
|
770 | 770 | Highlight changed words. |
|
771 | 771 | |
|
772 | 772 | ``email`` |
|
773 | 773 | --------- |
|
774 | 774 | |
|
775 | 775 | Settings for extensions that send email messages. |
|
776 | 776 | |
|
777 | 777 | ``from`` |
|
778 | 778 | Optional. Email address to use in "From" header and SMTP envelope |
|
779 | 779 | of outgoing messages. |
|
780 | 780 | |
|
781 | 781 | ``to`` |
|
782 | 782 | Optional. Comma-separated list of recipients' email addresses. |
|
783 | 783 | |
|
784 | 784 | ``cc`` |
|
785 | 785 | Optional. Comma-separated list of carbon copy recipients' |
|
786 | 786 | email addresses. |
|
787 | 787 | |
|
788 | 788 | ``bcc`` |
|
789 | 789 | Optional. Comma-separated list of blind carbon copy recipients' |
|
790 | 790 | email addresses. |
|
791 | 791 | |
|
792 | 792 | ``method`` |
|
793 | 793 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
794 | 794 | (default), use SMTP (see the ``[smtp]`` section for configuration). |
|
795 | 795 | Otherwise, use as name of program to run that acts like sendmail |
|
796 | 796 | (takes ``-f`` option for sender, list of recipients on command line, |
|
797 | 797 | message on stdin). Normally, setting this to ``sendmail`` or |
|
798 | 798 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
799 | 799 | |
|
800 | 800 | ``charsets`` |
|
801 | 801 | Optional. Comma-separated list of character sets considered |
|
802 | 802 | convenient for recipients. Addresses, headers, and parts not |
|
803 | 803 | containing patches of outgoing messages will be encoded in the |
|
804 | 804 | first character set to which conversion from local encoding |
|
805 | 805 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
806 | 806 | conversion fails, the text in question is sent as is. |
|
807 | 807 | (default: '') |
|
808 | 808 | |
|
809 | 809 | Order of outgoing email character sets: |
|
810 | 810 | |
|
811 | 811 | 1. ``us-ascii``: always first, regardless of settings |
|
812 | 812 | 2. ``email.charsets``: in order given by user |
|
813 | 813 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
814 | 814 | 4. ``$HGENCODING``: if not in email.charsets |
|
815 | 815 | 5. ``utf-8``: always last, regardless of settings |
|
816 | 816 | |
|
817 | 817 | Email example:: |
|
818 | 818 | |
|
819 | 819 | [email] |
|
820 | 820 | from = Joseph User <joe.user@example.com> |
|
821 | 821 | method = /usr/sbin/sendmail |
|
822 | 822 | # charsets for western Europeans |
|
823 | 823 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
824 | 824 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
825 | 825 | |
|
826 | 826 | |
|
827 | 827 | ``extensions`` |
|
828 | 828 | -------------- |
|
829 | 829 | |
|
830 | 830 | Mercurial has an extension mechanism for adding new features. To |
|
831 | 831 | enable an extension, create an entry for it in this section. |
|
832 | 832 | |
|
833 | 833 | If you know that the extension is already in Python's search path, |
|
834 | 834 | you can give the name of the module, followed by ``=``, with nothing |
|
835 | 835 | after the ``=``. |
|
836 | 836 | |
|
837 | 837 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
838 | 838 | the path to the ``.py`` file (including the file name extension) that |
|
839 | 839 | defines the extension. |
|
840 | 840 | |
|
841 | 841 | To explicitly disable an extension that is enabled in an hgrc of |
|
842 | 842 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` |
|
843 | 843 | or ``foo = !`` when path is not supplied. |
|
844 | 844 | |
|
845 | 845 | Example for ``~/.hgrc``:: |
|
846 | 846 | |
|
847 | 847 | [extensions] |
|
848 | 848 | # (the churn extension will get loaded from Mercurial's path) |
|
849 | 849 | churn = |
|
850 | 850 | # (this extension will get loaded from the file specified) |
|
851 | 851 | myfeature = ~/.hgext/myfeature.py |
|
852 | 852 | |
|
853 | If an extension fails to load, a warning will be issued, and Mercurial will | |
|
854 | proceed. To enforce that an extension must be loaded, one can set the `required` | |
|
855 | suboption in the config:: | |
|
856 | ||
|
857 | [extensions] | |
|
858 | myfeature = ~/.hgext/myfeature.py | |
|
859 | myfeature:required = yes | |
|
860 | ||
|
861 | To debug extension loading issue, one can add `--traceback` to their mercurial | |
|
862 | invocation. | |
|
863 | ||
|
853 | 864 | |
|
854 | 865 | ``format`` |
|
855 | 866 | ---------- |
|
856 | 867 | |
|
857 | 868 | Configuration that controls the repository format. Newer format options are more |
|
858 | 869 | powerful, but incompatible with some older versions of Mercurial. Format options |
|
859 | 870 | are considered at repository initialization only. You need to make a new clone |
|
860 | 871 | for config changes to be taken into account. |
|
861 | 872 | |
|
862 | 873 | For more details about repository format and version compatibility, see |
|
863 | 874 | https://www.mercurial-scm.org/wiki/MissingRequirement |
|
864 | 875 | |
|
865 | 876 | ``usegeneraldelta`` |
|
866 | 877 | Enable or disable the "generaldelta" repository format which improves |
|
867 | 878 | repository compression by allowing "revlog" to store deltas against |
|
868 | 879 | arbitrary revisions instead of the previously stored one. This provides |
|
869 | 880 | significant improvement for repositories with branches. |
|
870 | 881 | |
|
871 | 882 | Repositories with this on-disk format require Mercurial version 1.9. |
|
872 | 883 | |
|
873 | 884 | Enabled by default. |
|
874 | 885 | |
|
875 | 886 | ``dotencode`` |
|
876 | 887 | Enable or disable the "dotencode" repository format which enhances |
|
877 | 888 | the "fncache" repository format (which has to be enabled to use |
|
878 | 889 | dotencode) to avoid issues with filenames starting with "._" on |
|
879 | 890 | Mac OS X and spaces on Windows. |
|
880 | 891 | |
|
881 | 892 | Repositories with this on-disk format require Mercurial version 1.7. |
|
882 | 893 | |
|
883 | 894 | Enabled by default. |
|
884 | 895 | |
|
885 | 896 | ``usefncache`` |
|
886 | 897 | Enable or disable the "fncache" repository format which enhances |
|
887 | 898 | the "store" repository format (which has to be enabled to use |
|
888 | 899 | fncache) to allow longer filenames and avoids using Windows |
|
889 | 900 | reserved names, e.g. "nul". |
|
890 | 901 | |
|
891 | 902 | Repositories with this on-disk format require Mercurial version 1.1. |
|
892 | 903 | |
|
893 | 904 | Enabled by default. |
|
894 | 905 | |
|
895 | 906 | ``use-persistent-nodemap`` |
|
896 | 907 | Enable or disable the "persistent-nodemap" feature which improves |
|
897 | 908 | performance if the rust extensions are available. |
|
898 | 909 | |
|
899 | 910 | The "persistence-nodemap" persist the "node -> rev" on disk removing the |
|
900 | 911 | need to dynamically build that mapping for each Mercurial invocation. This |
|
901 | 912 | significantly reduce the startup cost of various local and server-side |
|
902 | 913 | operation for larger repository. |
|
903 | 914 | |
|
904 | 915 | The performance improving version of this feature is currently only |
|
905 | 916 | implemented in Rust, so people not using a version of Mercurial compiled |
|
906 | 917 | with the Rust part might actually suffer some slowdown. For this reason, |
|
907 | 918 | Such version will by default refuse to access such repositories. That |
|
908 | 919 | behavior can be controlled by configuration. Check |
|
909 | 920 | :hg:`help config.storage.revlog.persistent-nodemap.slow-path` for details. |
|
910 | 921 | |
|
911 | 922 | Repository with this on-disk format require Mercurial version 5.4 or above. |
|
912 | 923 | |
|
913 | 924 | By default this format variant is disabled if fast implementation is not |
|
914 | 925 | available and enabled by default if the fast implementation is available. |
|
915 | 926 | |
|
916 | 927 | To accomodate install of Mercurial without the fast implementation you can |
|
917 | 928 | downgrade your repository. To do so run the following command: |
|
918 | 929 | |
|
919 | 930 | $ hg debugupgraderepo \ |
|
920 | 931 | --run \ |
|
921 | 932 | --config format.use-persistent-nodemap=False \ |
|
922 | 933 | --config storage.revlog.persistent-nodemap.slow-path=allow |
|
923 | 934 | |
|
924 | 935 | ``use-share-safe`` |
|
925 | 936 | Enforce "safe" behaviors for all "shares" that access this repository. |
|
926 | 937 | |
|
927 | 938 | With this feature, "shares" using this repository as a source will: |
|
928 | 939 | |
|
929 | 940 | * read the source repository's configuration (`<source>/.hg/hgrc`). |
|
930 | 941 | * read and use the source repository's "requirements" |
|
931 | 942 | (except the working copy specific one). |
|
932 | 943 | |
|
933 | 944 | Without this feature, "shares" using this repository as a source will: |
|
934 | 945 | |
|
935 | 946 | * keep tracking the repository "requirements" in the share only, ignoring |
|
936 | 947 | the source "requirements", possibly diverging from them. |
|
937 | 948 | * ignore source repository config. This can create problems, like silently |
|
938 | 949 | ignoring important hooks. |
|
939 | 950 | |
|
940 | 951 | Beware that existing shares will not be upgraded/downgraded, and by |
|
941 | 952 | default, Mercurial will refuse to interact with them until the mismatch |
|
942 | 953 | is resolved. See :hg:`help config share.safe-mismatch.source-safe` and |
|
943 | 954 | :hg:`help config share.safe-mismatch.source-not-safe` for details. |
|
944 | 955 | |
|
945 | 956 | Introduced in Mercurial 5.7. |
|
946 | 957 | |
|
947 | 958 | Disabled by default. |
|
948 | 959 | |
|
949 | 960 | ``usestore`` |
|
950 | 961 | Enable or disable the "store" repository format which improves |
|
951 | 962 | compatibility with systems that fold case or otherwise mangle |
|
952 | 963 | filenames. Disabling this option will allow you to store longer filenames |
|
953 | 964 | in some situations at the expense of compatibility. |
|
954 | 965 | |
|
955 | 966 | Repositories with this on-disk format require Mercurial version 0.9.4. |
|
956 | 967 | |
|
957 | 968 | Enabled by default. |
|
958 | 969 | |
|
959 | 970 | ``sparse-revlog`` |
|
960 | 971 | Enable or disable the ``sparse-revlog`` delta strategy. This format improves |
|
961 | 972 | delta re-use inside revlog. For very branchy repositories, it results in a |
|
962 | 973 | smaller store. For repositories with many revisions, it also helps |
|
963 | 974 | performance (by using shortened delta chains.) |
|
964 | 975 | |
|
965 | 976 | Repositories with this on-disk format require Mercurial version 4.7 |
|
966 | 977 | |
|
967 | 978 | Enabled by default. |
|
968 | 979 | |
|
969 | 980 | ``revlog-compression`` |
|
970 | 981 | Compression algorithm used by revlog. Supported values are `zlib` and |
|
971 | 982 | `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is |
|
972 | 983 | a newer format that is usually a net win over `zlib`, operating faster at |
|
973 | 984 | better compression rates. Use `zstd` to reduce CPU usage. Multiple values |
|
974 | 985 | can be specified, the first available one will be used. |
|
975 | 986 | |
|
976 | 987 | On some systems, the Mercurial installation may lack `zstd` support. |
|
977 | 988 | |
|
978 | 989 | Default is `zstd` if available, `zlib` otherwise. |
|
979 | 990 | |
|
980 | 991 | ``bookmarks-in-store`` |
|
981 | 992 | Store bookmarks in .hg/store/. This means that bookmarks are shared when |
|
982 | 993 | using `hg share` regardless of the `-B` option. |
|
983 | 994 | |
|
984 | 995 | Repositories with this on-disk format require Mercurial version 5.1. |
|
985 | 996 | |
|
986 | 997 | Disabled by default. |
|
987 | 998 | |
|
988 | 999 | |
|
989 | 1000 | ``graph`` |
|
990 | 1001 | --------- |
|
991 | 1002 | |
|
992 | 1003 | Web graph view configuration. This section let you change graph |
|
993 | 1004 | elements display properties by branches, for instance to make the |
|
994 | 1005 | ``default`` branch stand out. |
|
995 | 1006 | |
|
996 | 1007 | Each line has the following format:: |
|
997 | 1008 | |
|
998 | 1009 | <branch>.<argument> = <value> |
|
999 | 1010 | |
|
1000 | 1011 | where ``<branch>`` is the name of the branch being |
|
1001 | 1012 | customized. Example:: |
|
1002 | 1013 | |
|
1003 | 1014 | [graph] |
|
1004 | 1015 | # 2px width |
|
1005 | 1016 | default.width = 2 |
|
1006 | 1017 | # red color |
|
1007 | 1018 | default.color = FF0000 |
|
1008 | 1019 | |
|
1009 | 1020 | Supported arguments: |
|
1010 | 1021 | |
|
1011 | 1022 | ``width`` |
|
1012 | 1023 | Set branch edges width in pixels. |
|
1013 | 1024 | |
|
1014 | 1025 | ``color`` |
|
1015 | 1026 | Set branch edges color in hexadecimal RGB notation. |
|
1016 | 1027 | |
|
1017 | 1028 | ``hooks`` |
|
1018 | 1029 | --------- |
|
1019 | 1030 | |
|
1020 | 1031 | Commands or Python functions that get automatically executed by |
|
1021 | 1032 | various actions such as starting or finishing a commit. Multiple |
|
1022 | 1033 | hooks can be run for the same action by appending a suffix to the |
|
1023 | 1034 | action. Overriding a site-wide hook can be done by changing its |
|
1024 | 1035 | value or setting it to an empty string. Hooks can be prioritized |
|
1025 | 1036 | by adding a prefix of ``priority.`` to the hook name on a new line |
|
1026 | 1037 | and setting the priority. The default priority is 0. |
|
1027 | 1038 | |
|
1028 | 1039 | Example ``.hg/hgrc``:: |
|
1029 | 1040 | |
|
1030 | 1041 | [hooks] |
|
1031 | 1042 | # update working directory after adding changesets |
|
1032 | 1043 | changegroup.update = hg update |
|
1033 | 1044 | # do not use the site-wide hook |
|
1034 | 1045 | incoming = |
|
1035 | 1046 | incoming.email = /my/email/hook |
|
1036 | 1047 | incoming.autobuild = /my/build/hook |
|
1037 | 1048 | # force autobuild hook to run before other incoming hooks |
|
1038 | 1049 | priority.incoming.autobuild = 1 |
|
1039 | 1050 | ### control HGPLAIN setting when running autobuild hook |
|
1040 | 1051 | # HGPLAIN always set (default from Mercurial 5.7) |
|
1041 | 1052 | incoming.autobuild:run-with-plain = yes |
|
1042 | 1053 | # HGPLAIN never set |
|
1043 | 1054 | incoming.autobuild:run-with-plain = no |
|
1044 | 1055 | # HGPLAIN inherited from environment (default before Mercurial 5.7) |
|
1045 | 1056 | incoming.autobuild:run-with-plain = auto |
|
1046 | 1057 | |
|
1047 | 1058 | Most hooks are run with environment variables set that give useful |
|
1048 | 1059 | additional information. For each hook below, the environment variables |
|
1049 | 1060 | it is passed are listed with names in the form ``$HG_foo``. The |
|
1050 | 1061 | ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks. |
|
1051 | 1062 | They contain the type of hook which triggered the run and the full name |
|
1052 | 1063 | of the hook in the config, respectively. In the example above, this will |
|
1053 | 1064 | be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``. |
|
1054 | 1065 | |
|
1055 | 1066 | .. container:: windows |
|
1056 | 1067 | |
|
1057 | 1068 | Some basic Unix syntax can be enabled for portability, including ``$VAR`` |
|
1058 | 1069 | and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will |
|
1059 | 1070 | be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion |
|
1060 | 1071 | on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back |
|
1061 | 1072 | slash or inside of a strong quote. Strong quotes will be replaced by |
|
1062 | 1073 | double quotes after processing. |
|
1063 | 1074 | |
|
1064 | 1075 | This feature is enabled by adding a prefix of ``tonative.`` to the hook |
|
1065 | 1076 | name on a new line, and setting it to ``True``. For example:: |
|
1066 | 1077 | |
|
1067 | 1078 | [hooks] |
|
1068 | 1079 | incoming.autobuild = /my/build/hook |
|
1069 | 1080 | # enable translation to cmd.exe syntax for autobuild hook |
|
1070 | 1081 | tonative.incoming.autobuild = True |
|
1071 | 1082 | |
|
1072 | 1083 | ``changegroup`` |
|
1073 | 1084 | Run after a changegroup has been added via push, pull or unbundle. The ID of |
|
1074 | 1085 | the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``. |
|
1075 | 1086 | The URL from which changes came is in ``$HG_URL``. |
|
1076 | 1087 | |
|
1077 | 1088 | ``commit`` |
|
1078 | 1089 | Run after a changeset has been created in the local repository. The ID |
|
1079 | 1090 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
1080 | 1091 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
1081 | 1092 | |
|
1082 | 1093 | ``incoming`` |
|
1083 | 1094 | Run after a changeset has been pulled, pushed, or unbundled into |
|
1084 | 1095 | the local repository. The ID of the newly arrived changeset is in |
|
1085 | 1096 | ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``. |
|
1086 | 1097 | |
|
1087 | 1098 | ``outgoing`` |
|
1088 | 1099 | Run after sending changes from the local repository to another. The ID of |
|
1089 | 1100 | first changeset sent is in ``$HG_NODE``. The source of operation is in |
|
1090 | 1101 | ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`. |
|
1091 | 1102 | |
|
1092 | 1103 | ``post-<command>`` |
|
1093 | 1104 | Run after successful invocations of the associated command. The |
|
1094 | 1105 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
1095 | 1106 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
1096 | 1107 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
1097 | 1108 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
1098 | 1109 | dictionary of options (with unspecified options set to their defaults). |
|
1099 | 1110 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
1100 | 1111 | |
|
1101 | 1112 | ``fail-<command>`` |
|
1102 | 1113 | Run after a failed invocation of an associated command. The contents |
|
1103 | 1114 | of the command line are passed as ``$HG_ARGS``. Parsed command line |
|
1104 | 1115 | arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain |
|
1105 | 1116 | string representations of the python data internally passed to |
|
1106 | 1117 | <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified |
|
1107 | 1118 | options set to their defaults). ``$HG_PATS`` is a list of arguments. |
|
1108 | 1119 | Hook failure is ignored. |
|
1109 | 1120 | |
|
1110 | 1121 | ``pre-<command>`` |
|
1111 | 1122 | Run before executing the associated command. The contents of the |
|
1112 | 1123 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
1113 | 1124 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
1114 | 1125 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
1115 | 1126 | is a dictionary of options (with unspecified options set to their |
|
1116 | 1127 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
1117 | 1128 | failure, the command doesn't execute and Mercurial returns the failure |
|
1118 | 1129 | code. |
|
1119 | 1130 | |
|
1120 | 1131 | ``prechangegroup`` |
|
1121 | 1132 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
1122 | 1133 | status 0 allows the changegroup to proceed. A non-zero status will |
|
1123 | 1134 | cause the push, pull or unbundle to fail. The URL from which changes |
|
1124 | 1135 | will come is in ``$HG_URL``. |
|
1125 | 1136 | |
|
1126 | 1137 | ``precommit`` |
|
1127 | 1138 | Run before starting a local commit. Exit status 0 allows the |
|
1128 | 1139 | commit to proceed. A non-zero status will cause the commit to fail. |
|
1129 | 1140 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
1130 | 1141 | |
|
1131 | 1142 | ``prelistkeys`` |
|
1132 | 1143 | Run before listing pushkeys (like bookmarks) in the |
|
1133 | 1144 | repository. A non-zero status will cause failure. The key namespace is |
|
1134 | 1145 | in ``$HG_NAMESPACE``. |
|
1135 | 1146 | |
|
1136 | 1147 | ``preoutgoing`` |
|
1137 | 1148 | Run before collecting changes to send from the local repository to |
|
1138 | 1149 | another. A non-zero status will cause failure. This lets you prevent |
|
1139 | 1150 | pull over HTTP or SSH. It can also prevent propagating commits (via |
|
1140 | 1151 | local pull, push (outbound) or bundle commands), but not completely, |
|
1141 | 1152 | since you can just copy files instead. The source of operation is in |
|
1142 | 1153 | ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote |
|
1143 | 1154 | SSH or HTTP repository. If "push", "pull" or "bundle", the operation |
|
1144 | 1155 | is happening on behalf of a repository on same system. |
|
1145 | 1156 | |
|
1146 | 1157 | ``prepushkey`` |
|
1147 | 1158 | Run before a pushkey (like a bookmark) is added to the |
|
1148 | 1159 | repository. A non-zero status will cause the key to be rejected. The |
|
1149 | 1160 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
1150 | 1161 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
1151 | 1162 | ``$HG_NEW``. |
|
1152 | 1163 | |
|
1153 | 1164 | ``pretag`` |
|
1154 | 1165 | Run before creating a tag. Exit status 0 allows the tag to be |
|
1155 | 1166 | created. A non-zero status will cause the tag to fail. The ID of the |
|
1156 | 1167 | changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The |
|
1157 | 1168 | tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``. |
|
1158 | 1169 | |
|
1159 | 1170 | ``pretxnopen`` |
|
1160 | 1171 | Run before any new repository transaction is open. The reason for the |
|
1161 | 1172 | transaction will be in ``$HG_TXNNAME``, and a unique identifier for the |
|
1162 | 1173 | transaction will be in ``$HG_TXNID``. A non-zero status will prevent the |
|
1163 | 1174 | transaction from being opened. |
|
1164 | 1175 | |
|
1165 | 1176 | ``pretxnclose`` |
|
1166 | 1177 | Run right before the transaction is actually finalized. Any repository change |
|
1167 | 1178 | will be visible to the hook program. This lets you validate the transaction |
|
1168 | 1179 | content or change it. Exit status 0 allows the commit to proceed. A non-zero |
|
1169 | 1180 | status will cause the transaction to be rolled back. The reason for the |
|
1170 | 1181 | transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for |
|
1171 | 1182 | the transaction will be in ``$HG_TXNID``. The rest of the available data will |
|
1172 | 1183 | vary according the transaction type. Changes unbundled to the repository will |
|
1173 | 1184 | add ``$HG_URL`` and ``$HG_SOURCE``. New changesets will add ``$HG_NODE`` (the |
|
1174 | 1185 | ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last added |
|
1175 | 1186 | changeset). Bookmark and phase changes will set ``$HG_BOOKMARK_MOVED`` and |
|
1176 | 1187 | ``$HG_PHASES_MOVED`` to ``1`` respectively. The number of new obsmarkers, if |
|
1177 | 1188 | any, will be in ``$HG_NEW_OBSMARKERS``, etc. |
|
1178 | 1189 | |
|
1179 | 1190 | ``pretxnclose-bookmark`` |
|
1180 | 1191 | Run right before a bookmark change is actually finalized. Any repository |
|
1181 | 1192 | change will be visible to the hook program. This lets you validate the |
|
1182 | 1193 | transaction content or change it. Exit status 0 allows the commit to |
|
1183 | 1194 | proceed. A non-zero status will cause the transaction to be rolled back. |
|
1184 | 1195 | The name of the bookmark will be available in ``$HG_BOOKMARK``, the new |
|
1185 | 1196 | bookmark location will be available in ``$HG_NODE`` while the previous |
|
1186 | 1197 | location will be available in ``$HG_OLDNODE``. In case of a bookmark |
|
1187 | 1198 | creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE`` |
|
1188 | 1199 | will be empty. |
|
1189 | 1200 | In addition, the reason for the transaction opening will be in |
|
1190 | 1201 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in |
|
1191 | 1202 | ``$HG_TXNID``. |
|
1192 | 1203 | |
|
1193 | 1204 | ``pretxnclose-phase`` |
|
1194 | 1205 | Run right before a phase change is actually finalized. Any repository change |
|
1195 | 1206 | will be visible to the hook program. This lets you validate the transaction |
|
1196 | 1207 | content or change it. Exit status 0 allows the commit to proceed. A non-zero |
|
1197 | 1208 | status will cause the transaction to be rolled back. The hook is called |
|
1198 | 1209 | multiple times, once for each revision affected by a phase change. |
|
1199 | 1210 | The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE`` |
|
1200 | 1211 | while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE`` |
|
1201 | 1212 | will be empty. In addition, the reason for the transaction opening will be in |
|
1202 | 1213 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in |
|
1203 | 1214 | ``$HG_TXNID``. The hook is also run for newly added revisions. In this case |
|
1204 | 1215 | the ``$HG_OLDPHASE`` entry will be empty. |
|
1205 | 1216 | |
|
1206 | 1217 | ``txnclose`` |
|
1207 | 1218 | Run after any repository transaction has been committed. At this |
|
1208 | 1219 | point, the transaction can no longer be rolled back. The hook will run |
|
1209 | 1220 | after the lock is released. See :hg:`help config.hooks.pretxnclose` for |
|
1210 | 1221 | details about available variables. |
|
1211 | 1222 | |
|
1212 | 1223 | ``txnclose-bookmark`` |
|
1213 | 1224 | Run after any bookmark change has been committed. At this point, the |
|
1214 | 1225 | transaction can no longer be rolled back. The hook will run after the lock |
|
1215 | 1226 | is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details |
|
1216 | 1227 | about available variables. |
|
1217 | 1228 | |
|
1218 | 1229 | ``txnclose-phase`` |
|
1219 | 1230 | Run after any phase change has been committed. At this point, the |
|
1220 | 1231 | transaction can no longer be rolled back. The hook will run after the lock |
|
1221 | 1232 | is released. See :hg:`help config.hooks.pretxnclose-phase` for details about |
|
1222 | 1233 | available variables. |
|
1223 | 1234 | |
|
1224 | 1235 | ``txnabort`` |
|
1225 | 1236 | Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose` |
|
1226 | 1237 | for details about available variables. |
|
1227 | 1238 | |
|
1228 | 1239 | ``pretxnchangegroup`` |
|
1229 | 1240 | Run after a changegroup has been added via push, pull or unbundle, but before |
|
1230 | 1241 | the transaction has been committed. The changegroup is visible to the hook |
|
1231 | 1242 | program. This allows validation of incoming changes before accepting them. |
|
1232 | 1243 | The ID of the first new changeset is in ``$HG_NODE`` and last is in |
|
1233 | 1244 | ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero |
|
1234 | 1245 | status will cause the transaction to be rolled back, and the push, pull or |
|
1235 | 1246 | unbundle will fail. The URL that was the source of changes is in ``$HG_URL``. |
|
1236 | 1247 | |
|
1237 | 1248 | ``pretxncommit`` |
|
1238 | 1249 | Run after a changeset has been created, but before the transaction is |
|
1239 | 1250 | committed. The changeset is visible to the hook program. This allows |
|
1240 | 1251 | validation of the commit message and changes. Exit status 0 allows the |
|
1241 | 1252 | commit to proceed. A non-zero status will cause the transaction to |
|
1242 | 1253 | be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent |
|
1243 | 1254 | changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
1244 | 1255 | |
|
1245 | 1256 | ``preupdate`` |
|
1246 | 1257 | Run before updating the working directory. Exit status 0 allows |
|
1247 | 1258 | the update to proceed. A non-zero status will prevent the update. |
|
1248 | 1259 | The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a |
|
1249 | 1260 | merge, the ID of second new parent is in ``$HG_PARENT2``. |
|
1250 | 1261 | |
|
1251 | 1262 | ``listkeys`` |
|
1252 | 1263 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
1253 | 1264 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
1254 | 1265 | dictionary containing the keys and values. |
|
1255 | 1266 | |
|
1256 | 1267 | ``pushkey`` |
|
1257 | 1268 | Run after a pushkey (like a bookmark) is added to the |
|
1258 | 1269 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
1259 | 1270 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
1260 | 1271 | value is in ``$HG_NEW``. |
|
1261 | 1272 | |
|
1262 | 1273 | ``tag`` |
|
1263 | 1274 | Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``. |
|
1264 | 1275 | The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in |
|
1265 | 1276 | the repository if ``$HG_LOCAL=0``. |
|
1266 | 1277 | |
|
1267 | 1278 | ``update`` |
|
1268 | 1279 | Run after updating the working directory. The changeset ID of first |
|
1269 | 1280 | new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new |
|
1270 | 1281 | parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
1271 | 1282 | update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``. |
|
1272 | 1283 | |
|
1273 | 1284 | .. note:: |
|
1274 | 1285 | |
|
1275 | 1286 | It is generally better to use standard hooks rather than the |
|
1276 | 1287 | generic pre- and post- command hooks, as they are guaranteed to be |
|
1277 | 1288 | called in the appropriate contexts for influencing transactions. |
|
1278 | 1289 | Also, hooks like "commit" will be called in all contexts that |
|
1279 | 1290 | generate a commit (e.g. tag) and not just the commit command. |
|
1280 | 1291 | |
|
1281 | 1292 | .. note:: |
|
1282 | 1293 | |
|
1283 | 1294 | Environment variables with empty values may not be passed to |
|
1284 | 1295 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
1285 | 1296 | will have an empty value under Unix-like platforms for non-merge |
|
1286 | 1297 | changesets, while it will not be available at all under Windows. |
|
1287 | 1298 | |
|
1288 | 1299 | The syntax for Python hooks is as follows:: |
|
1289 | 1300 | |
|
1290 | 1301 | hookname = python:modulename.submodule.callable |
|
1291 | 1302 | hookname = python:/path/to/python/module.py:callable |
|
1292 | 1303 | |
|
1293 | 1304 | Python hooks are run within the Mercurial process. Each hook is |
|
1294 | 1305 | called with at least three keyword arguments: a ui object (keyword |
|
1295 | 1306 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
1296 | 1307 | keyword that tells what kind of hook is used. Arguments listed as |
|
1297 | 1308 | environment variables above are passed as keyword arguments, with no |
|
1298 | 1309 | ``HG_`` prefix, and names in lower case. |
|
1299 | 1310 | |
|
1300 | 1311 | If a Python hook returns a "true" value or raises an exception, this |
|
1301 | 1312 | is treated as a failure. |
|
1302 | 1313 | |
|
1303 | 1314 | |
|
1304 | 1315 | ``hostfingerprints`` |
|
1305 | 1316 | -------------------- |
|
1306 | 1317 | |
|
1307 | 1318 | (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.) |
|
1308 | 1319 | |
|
1309 | 1320 | Fingerprints of the certificates of known HTTPS servers. |
|
1310 | 1321 | |
|
1311 | 1322 | A HTTPS connection to a server with a fingerprint configured here will |
|
1312 | 1323 | only succeed if the servers certificate matches the fingerprint. |
|
1313 | 1324 | This is very similar to how ssh known hosts works. |
|
1314 | 1325 | |
|
1315 | 1326 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
1316 | 1327 | Multiple values can be specified (separated by spaces or commas). This can |
|
1317 | 1328 | be used to define both old and new fingerprints while a host transitions |
|
1318 | 1329 | to a new certificate. |
|
1319 | 1330 | |
|
1320 | 1331 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
1321 | 1332 | |
|
1322 | 1333 | For example:: |
|
1323 | 1334 | |
|
1324 | 1335 | [hostfingerprints] |
|
1325 | 1336 | hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1326 | 1337 | hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1327 | 1338 | |
|
1328 | 1339 | ``hostsecurity`` |
|
1329 | 1340 | ---------------- |
|
1330 | 1341 | |
|
1331 | 1342 | Used to specify global and per-host security settings for connecting to |
|
1332 | 1343 | other machines. |
|
1333 | 1344 | |
|
1334 | 1345 | The following options control default behavior for all hosts. |
|
1335 | 1346 | |
|
1336 | 1347 | ``ciphers`` |
|
1337 | 1348 | Defines the cryptographic ciphers to use for connections. |
|
1338 | 1349 | |
|
1339 | 1350 | Value must be a valid OpenSSL Cipher List Format as documented at |
|
1340 | 1351 | https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT. |
|
1341 | 1352 | |
|
1342 | 1353 | This setting is for advanced users only. Setting to incorrect values |
|
1343 | 1354 | can significantly lower connection security or decrease performance. |
|
1344 | 1355 | You have been warned. |
|
1345 | 1356 | |
|
1346 | 1357 | This option requires Python 2.7. |
|
1347 | 1358 | |
|
1348 | 1359 | ``minimumprotocol`` |
|
1349 | 1360 | Defines the minimum channel encryption protocol to use. |
|
1350 | 1361 | |
|
1351 | 1362 | By default, the highest version of TLS supported by both client and server |
|
1352 | 1363 | is used. |
|
1353 | 1364 | |
|
1354 | 1365 | Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``. |
|
1355 | 1366 | |
|
1356 | 1367 | When running on an old Python version, only ``tls1.0`` is allowed since |
|
1357 | 1368 | old versions of Python only support up to TLS 1.0. |
|
1358 | 1369 | |
|
1359 | 1370 | When running a Python that supports modern TLS versions, the default is |
|
1360 | 1371 | ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this |
|
1361 | 1372 | weakens security and should only be used as a feature of last resort if |
|
1362 | 1373 | a server does not support TLS 1.1+. |
|
1363 | 1374 | |
|
1364 | 1375 | Options in the ``[hostsecurity]`` section can have the form |
|
1365 | 1376 | ``hostname``:``setting``. This allows multiple settings to be defined on a |
|
1366 | 1377 | per-host basis. |
|
1367 | 1378 | |
|
1368 | 1379 | The following per-host settings can be defined. |
|
1369 | 1380 | |
|
1370 | 1381 | ``ciphers`` |
|
1371 | 1382 | This behaves like ``ciphers`` as described above except it only applies |
|
1372 | 1383 | to the host on which it is defined. |
|
1373 | 1384 | |
|
1374 | 1385 | ``fingerprints`` |
|
1375 | 1386 | A list of hashes of the DER encoded peer/remote certificate. Values have |
|
1376 | 1387 | the form ``algorithm``:``fingerprint``. e.g. |
|
1377 | 1388 | ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``. |
|
1378 | 1389 | In addition, colons (``:``) can appear in the fingerprint part. |
|
1379 | 1390 | |
|
1380 | 1391 | The following algorithms/prefixes are supported: ``sha1``, ``sha256``, |
|
1381 | 1392 | ``sha512``. |
|
1382 | 1393 | |
|
1383 | 1394 | Use of ``sha256`` or ``sha512`` is preferred. |
|
1384 | 1395 | |
|
1385 | 1396 | If a fingerprint is specified, the CA chain is not validated for this |
|
1386 | 1397 | host and Mercurial will require the remote certificate to match one |
|
1387 | 1398 | of the fingerprints specified. This means if the server updates its |
|
1388 | 1399 | certificate, Mercurial will abort until a new fingerprint is defined. |
|
1389 | 1400 | This can provide stronger security than traditional CA-based validation |
|
1390 | 1401 | at the expense of convenience. |
|
1391 | 1402 | |
|
1392 | 1403 | This option takes precedence over ``verifycertsfile``. |
|
1393 | 1404 | |
|
1394 | 1405 | ``minimumprotocol`` |
|
1395 | 1406 | This behaves like ``minimumprotocol`` as described above except it |
|
1396 | 1407 | only applies to the host on which it is defined. |
|
1397 | 1408 | |
|
1398 | 1409 | ``verifycertsfile`` |
|
1399 | 1410 | Path to file a containing a list of PEM encoded certificates used to |
|
1400 | 1411 | verify the server certificate. Environment variables and ``~user`` |
|
1401 | 1412 | constructs are expanded in the filename. |
|
1402 | 1413 | |
|
1403 | 1414 | The server certificate or the certificate's certificate authority (CA) |
|
1404 | 1415 | must match a certificate from this file or certificate verification |
|
1405 | 1416 | will fail and connections to the server will be refused. |
|
1406 | 1417 | |
|
1407 | 1418 | If defined, only certificates provided by this file will be used: |
|
1408 | 1419 | ``web.cacerts`` and any system/default certificates will not be |
|
1409 | 1420 | used. |
|
1410 | 1421 | |
|
1411 | 1422 | This option has no effect if the per-host ``fingerprints`` option |
|
1412 | 1423 | is set. |
|
1413 | 1424 | |
|
1414 | 1425 | The format of the file is as follows:: |
|
1415 | 1426 | |
|
1416 | 1427 | -----BEGIN CERTIFICATE----- |
|
1417 | 1428 | ... (certificate in base64 PEM encoding) ... |
|
1418 | 1429 | -----END CERTIFICATE----- |
|
1419 | 1430 | -----BEGIN CERTIFICATE----- |
|
1420 | 1431 | ... (certificate in base64 PEM encoding) ... |
|
1421 | 1432 | -----END CERTIFICATE----- |
|
1422 | 1433 | |
|
1423 | 1434 | For example:: |
|
1424 | 1435 | |
|
1425 | 1436 | [hostsecurity] |
|
1426 | 1437 | hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 |
|
1427 | 1438 | hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1428 | 1439 | hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2 |
|
1429 | 1440 | foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem |
|
1430 | 1441 | |
|
1431 | 1442 | To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1 |
|
1432 | 1443 | when connecting to ``hg.example.com``:: |
|
1433 | 1444 | |
|
1434 | 1445 | [hostsecurity] |
|
1435 | 1446 | minimumprotocol = tls1.2 |
|
1436 | 1447 | hg.example.com:minimumprotocol = tls1.1 |
|
1437 | 1448 | |
|
1438 | 1449 | ``http_proxy`` |
|
1439 | 1450 | -------------- |
|
1440 | 1451 | |
|
1441 | 1452 | Used to access web-based Mercurial repositories through a HTTP |
|
1442 | 1453 | proxy. |
|
1443 | 1454 | |
|
1444 | 1455 | ``host`` |
|
1445 | 1456 | Host name and (optional) port of the proxy server, for example |
|
1446 | 1457 | "myproxy:8000". |
|
1447 | 1458 | |
|
1448 | 1459 | ``no`` |
|
1449 | 1460 | Optional. Comma-separated list of host names that should bypass |
|
1450 | 1461 | the proxy. |
|
1451 | 1462 | |
|
1452 | 1463 | ``passwd`` |
|
1453 | 1464 | Optional. Password to authenticate with at the proxy server. |
|
1454 | 1465 | |
|
1455 | 1466 | ``user`` |
|
1456 | 1467 | Optional. User name to authenticate with at the proxy server. |
|
1457 | 1468 | |
|
1458 | 1469 | ``always`` |
|
1459 | 1470 | Optional. Always use the proxy, even for localhost and any entries |
|
1460 | 1471 | in ``http_proxy.no``. (default: False) |
|
1461 | 1472 | |
|
1462 | 1473 | ``http`` |
|
1463 | 1474 | ---------- |
|
1464 | 1475 | |
|
1465 | 1476 | Used to configure access to Mercurial repositories via HTTP. |
|
1466 | 1477 | |
|
1467 | 1478 | ``timeout`` |
|
1468 | 1479 | If set, blocking operations will timeout after that many seconds. |
|
1469 | 1480 | (default: None) |
|
1470 | 1481 | |
|
1471 | 1482 | ``merge`` |
|
1472 | 1483 | --------- |
|
1473 | 1484 | |
|
1474 | 1485 | This section specifies behavior during merges and updates. |
|
1475 | 1486 | |
|
1476 | 1487 | ``checkignored`` |
|
1477 | 1488 | Controls behavior when an ignored file on disk has the same name as a tracked |
|
1478 | 1489 | file in the changeset being merged or updated to, and has different |
|
1479 | 1490 | contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``, |
|
1480 | 1491 | abort on such files. With ``warn``, warn on such files and back them up as |
|
1481 | 1492 | ``.orig``. With ``ignore``, don't print a warning and back them up as |
|
1482 | 1493 | ``.orig``. (default: ``abort``) |
|
1483 | 1494 | |
|
1484 | 1495 | ``checkunknown`` |
|
1485 | 1496 | Controls behavior when an unknown file that isn't ignored has the same name |
|
1486 | 1497 | as a tracked file in the changeset being merged or updated to, and has |
|
1487 | 1498 | different contents. Similar to ``merge.checkignored``, except for files that |
|
1488 | 1499 | are not ignored. (default: ``abort``) |
|
1489 | 1500 | |
|
1490 | 1501 | ``on-failure`` |
|
1491 | 1502 | When set to ``continue`` (the default), the merge process attempts to |
|
1492 | 1503 | merge all unresolved files using the merge chosen tool, regardless of |
|
1493 | 1504 | whether previous file merge attempts during the process succeeded or not. |
|
1494 | 1505 | Setting this to ``prompt`` will prompt after any merge failure continue |
|
1495 | 1506 | or halt the merge process. Setting this to ``halt`` will automatically |
|
1496 | 1507 | halt the merge process on any merge tool failure. The merge process |
|
1497 | 1508 | can be restarted by using the ``resolve`` command. When a merge is |
|
1498 | 1509 | halted, the repository is left in a normal ``unresolved`` merge state. |
|
1499 | 1510 | (default: ``continue``) |
|
1500 | 1511 | |
|
1501 | 1512 | ``strict-capability-check`` |
|
1502 | 1513 | Whether capabilities of internal merge tools are checked strictly |
|
1503 | 1514 | or not, while examining rules to decide merge tool to be used. |
|
1504 | 1515 | (default: False) |
|
1505 | 1516 | |
|
1506 | 1517 | ``merge-patterns`` |
|
1507 | 1518 | ------------------ |
|
1508 | 1519 | |
|
1509 | 1520 | This section specifies merge tools to associate with particular file |
|
1510 | 1521 | patterns. Tools matched here will take precedence over the default |
|
1511 | 1522 | merge tool. Patterns are globs by default, rooted at the repository |
|
1512 | 1523 | root. |
|
1513 | 1524 | |
|
1514 | 1525 | Example:: |
|
1515 | 1526 | |
|
1516 | 1527 | [merge-patterns] |
|
1517 | 1528 | **.c = kdiff3 |
|
1518 | 1529 | **.jpg = myimgmerge |
|
1519 | 1530 | |
|
1520 | 1531 | ``merge-tools`` |
|
1521 | 1532 | --------------- |
|
1522 | 1533 | |
|
1523 | 1534 | This section configures external merge tools to use for file-level |
|
1524 | 1535 | merges. This section has likely been preconfigured at install time. |
|
1525 | 1536 | Use :hg:`config merge-tools` to check the existing configuration. |
|
1526 | 1537 | Also see :hg:`help merge-tools` for more details. |
|
1527 | 1538 | |
|
1528 | 1539 | Example ``~/.hgrc``:: |
|
1529 | 1540 | |
|
1530 | 1541 | [merge-tools] |
|
1531 | 1542 | # Override stock tool location |
|
1532 | 1543 | kdiff3.executable = ~/bin/kdiff3 |
|
1533 | 1544 | # Specify command line |
|
1534 | 1545 | kdiff3.args = $base $local $other -o $output |
|
1535 | 1546 | # Give higher priority |
|
1536 | 1547 | kdiff3.priority = 1 |
|
1537 | 1548 | |
|
1538 | 1549 | # Changing the priority of preconfigured tool |
|
1539 | 1550 | meld.priority = 0 |
|
1540 | 1551 | |
|
1541 | 1552 | # Disable a preconfigured tool |
|
1542 | 1553 | vimdiff.disabled = yes |
|
1543 | 1554 | |
|
1544 | 1555 | # Define new tool |
|
1545 | 1556 | myHtmlTool.args = -m $local $other $base $output |
|
1546 | 1557 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
1547 | 1558 | myHtmlTool.priority = 1 |
|
1548 | 1559 | |
|
1549 | 1560 | Supported arguments: |
|
1550 | 1561 | |
|
1551 | 1562 | ``priority`` |
|
1552 | 1563 | The priority in which to evaluate this tool. |
|
1553 | 1564 | (default: 0) |
|
1554 | 1565 | |
|
1555 | 1566 | ``executable`` |
|
1556 | 1567 | Either just the name of the executable or its pathname. |
|
1557 | 1568 | |
|
1558 | 1569 | .. container:: windows |
|
1559 | 1570 | |
|
1560 | 1571 | On Windows, the path can use environment variables with ${ProgramFiles} |
|
1561 | 1572 | syntax. |
|
1562 | 1573 | |
|
1563 | 1574 | (default: the tool name) |
|
1564 | 1575 | |
|
1565 | 1576 | ``args`` |
|
1566 | 1577 | The arguments to pass to the tool executable. You can refer to the |
|
1567 | 1578 | files being merged as well as the output file through these |
|
1568 | 1579 | variables: ``$base``, ``$local``, ``$other``, ``$output``. |
|
1569 | 1580 | |
|
1570 | 1581 | The meaning of ``$local`` and ``$other`` can vary depending on which action is |
|
1571 | 1582 | being performed. During an update or merge, ``$local`` represents the original |
|
1572 | 1583 | state of the file, while ``$other`` represents the commit you are updating to or |
|
1573 | 1584 | the commit you are merging with. During a rebase, ``$local`` represents the |
|
1574 | 1585 | destination of the rebase, and ``$other`` represents the commit being rebased. |
|
1575 | 1586 | |
|
1576 | 1587 | Some operations define custom labels to assist with identifying the revisions, |
|
1577 | 1588 | accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom |
|
1578 | 1589 | labels are not available, these will be ``local``, ``other``, and ``base``, |
|
1579 | 1590 | respectively. |
|
1580 | 1591 | (default: ``$local $base $other``) |
|
1581 | 1592 | |
|
1582 | 1593 | ``premerge`` |
|
1583 | 1594 | Attempt to run internal non-interactive 3-way merge tool before |
|
1584 | 1595 | launching external tool. Options are ``true``, ``false``, ``keep``, |
|
1585 | 1596 | ``keep-merge3``, or ``keep-mergediff`` (experimental). The ``keep`` option |
|
1586 | 1597 | will leave markers in the file if the premerge fails. The ``keep-merge3`` |
|
1587 | 1598 | will do the same but include information about the base of the merge in the |
|
1588 | 1599 | marker (see internal :merge3 in :hg:`help merge-tools`). The |
|
1589 | 1600 | ``keep-mergediff`` option is similar but uses a different marker style |
|
1590 | 1601 | (see internal :merge3 in :hg:`help merge-tools`). (default: True) |
|
1591 | 1602 | |
|
1592 | 1603 | ``binary`` |
|
1593 | 1604 | This tool can merge binary files. (default: False, unless tool |
|
1594 | 1605 | was selected by file pattern match) |
|
1595 | 1606 | |
|
1596 | 1607 | ``symlink`` |
|
1597 | 1608 | This tool can merge symlinks. (default: False) |
|
1598 | 1609 | |
|
1599 | 1610 | ``check`` |
|
1600 | 1611 | A list of merge success-checking options: |
|
1601 | 1612 | |
|
1602 | 1613 | ``changed`` |
|
1603 | 1614 | Ask whether merge was successful when the merged file shows no changes. |
|
1604 | 1615 | ``conflicts`` |
|
1605 | 1616 | Check whether there are conflicts even though the tool reported success. |
|
1606 | 1617 | ``prompt`` |
|
1607 | 1618 | Always prompt for merge success, regardless of success reported by tool. |
|
1608 | 1619 | |
|
1609 | 1620 | ``fixeol`` |
|
1610 | 1621 | Attempt to fix up EOL changes caused by the merge tool. |
|
1611 | 1622 | (default: False) |
|
1612 | 1623 | |
|
1613 | 1624 | ``gui`` |
|
1614 | 1625 | This tool requires a graphical interface to run. (default: False) |
|
1615 | 1626 | |
|
1616 | 1627 | ``mergemarkers`` |
|
1617 | 1628 | Controls whether the labels passed via ``$labellocal``, ``$labelother``, and |
|
1618 | 1629 | ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or |
|
1619 | 1630 | ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict |
|
1620 | 1631 | markers generated during premerge will be ``detailed`` if either this option or |
|
1621 | 1632 | the corresponding option in the ``[ui]`` section is ``detailed``. |
|
1622 | 1633 | (default: ``basic``) |
|
1623 | 1634 | |
|
1624 | 1635 | ``mergemarkertemplate`` |
|
1625 | 1636 | This setting can be used to override ``mergemarker`` from the |
|
1626 | 1637 | ``[command-templates]`` section on a per-tool basis; this applies to the |
|
1627 | 1638 | ``$label``-prefixed variables and to the conflict markers that are generated |
|
1628 | 1639 | if ``premerge`` is ``keep` or ``keep-merge3``. See the corresponding variable |
|
1629 | 1640 | in ``[ui]`` for more information. |
|
1630 | 1641 | |
|
1631 | 1642 | .. container:: windows |
|
1632 | 1643 | |
|
1633 | 1644 | ``regkey`` |
|
1634 | 1645 | Windows registry key which describes install location of this |
|
1635 | 1646 | tool. Mercurial will search for this key first under |
|
1636 | 1647 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
1637 | 1648 | (default: None) |
|
1638 | 1649 | |
|
1639 | 1650 | ``regkeyalt`` |
|
1640 | 1651 | An alternate Windows registry key to try if the first key is not |
|
1641 | 1652 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
1642 | 1653 | semantics of the primary key. The most common use for this key |
|
1643 | 1654 | is to search for 32bit applications on 64bit operating systems. |
|
1644 | 1655 | (default: None) |
|
1645 | 1656 | |
|
1646 | 1657 | ``regname`` |
|
1647 | 1658 | Name of value to read from specified registry key. |
|
1648 | 1659 | (default: the unnamed (default) value) |
|
1649 | 1660 | |
|
1650 | 1661 | ``regappend`` |
|
1651 | 1662 | String to append to the value read from the registry, typically |
|
1652 | 1663 | the executable name of the tool. |
|
1653 | 1664 | (default: None) |
|
1654 | 1665 | |
|
1655 | 1666 | ``pager`` |
|
1656 | 1667 | --------- |
|
1657 | 1668 | |
|
1658 | 1669 | Setting used to control when to paginate and with what external tool. See |
|
1659 | 1670 | :hg:`help pager` for details. |
|
1660 | 1671 | |
|
1661 | 1672 | ``pager`` |
|
1662 | 1673 | Define the external tool used as pager. |
|
1663 | 1674 | |
|
1664 | 1675 | If no pager is set, Mercurial uses the environment variable $PAGER. |
|
1665 | 1676 | If neither pager.pager, nor $PAGER is set, a default pager will be |
|
1666 | 1677 | used, typically `less` on Unix and `more` on Windows. Example:: |
|
1667 | 1678 | |
|
1668 | 1679 | [pager] |
|
1669 | 1680 | pager = less -FRX |
|
1670 | 1681 | |
|
1671 | 1682 | ``ignore`` |
|
1672 | 1683 | List of commands to disable the pager for. Example:: |
|
1673 | 1684 | |
|
1674 | 1685 | [pager] |
|
1675 | 1686 | ignore = version, help, update |
|
1676 | 1687 | |
|
1677 | 1688 | ``patch`` |
|
1678 | 1689 | --------- |
|
1679 | 1690 | |
|
1680 | 1691 | Settings used when applying patches, for instance through the 'import' |
|
1681 | 1692 | command or with Mercurial Queues extension. |
|
1682 | 1693 | |
|
1683 | 1694 | ``eol`` |
|
1684 | 1695 | When set to 'strict' patch content and patched files end of lines |
|
1685 | 1696 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
1686 | 1697 | lines are ignored when patching and the result line endings are |
|
1687 | 1698 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
1688 | 1699 | ``auto``, end of lines are again ignored while patching but line |
|
1689 | 1700 | endings in patched files are normalized to their original setting |
|
1690 | 1701 | on a per-file basis. If target file does not exist or has no end |
|
1691 | 1702 | of line, patch line endings are preserved. |
|
1692 | 1703 | (default: strict) |
|
1693 | 1704 | |
|
1694 | 1705 | ``fuzz`` |
|
1695 | 1706 | The number of lines of 'fuzz' to allow when applying patches. This |
|
1696 | 1707 | controls how much context the patcher is allowed to ignore when |
|
1697 | 1708 | trying to apply a patch. |
|
1698 | 1709 | (default: 2) |
|
1699 | 1710 | |
|
1700 | 1711 | ``paths`` |
|
1701 | 1712 | --------- |
|
1702 | 1713 | |
|
1703 | 1714 | Assigns symbolic names and behavior to repositories. |
|
1704 | 1715 | |
|
1705 | 1716 | Options are symbolic names defining the URL or directory that is the |
|
1706 | 1717 | location of the repository. Example:: |
|
1707 | 1718 | |
|
1708 | 1719 | [paths] |
|
1709 | 1720 | my_server = https://example.com/my_repo |
|
1710 | 1721 | local_path = /home/me/repo |
|
1711 | 1722 | |
|
1712 | 1723 | These symbolic names can be used from the command line. To pull |
|
1713 | 1724 | from ``my_server``: :hg:`pull my_server`. To push to ``local_path``: |
|
1714 | 1725 | :hg:`push local_path`. You can check :hg:`help urls` for details about |
|
1715 | 1726 | valid URLs. |
|
1716 | 1727 | |
|
1717 | 1728 | Options containing colons (``:``) denote sub-options that can influence |
|
1718 | 1729 | behavior for that specific path. Example:: |
|
1719 | 1730 | |
|
1720 | 1731 | [paths] |
|
1721 | 1732 | my_server = https://example.com/my_path |
|
1722 | 1733 | my_server:pushurl = ssh://example.com/my_path |
|
1723 | 1734 | |
|
1724 | 1735 | Paths using the `path://otherpath` scheme will inherit the sub-options value from |
|
1725 | 1736 | the path they point to. |
|
1726 | 1737 | |
|
1727 | 1738 | The following sub-options can be defined: |
|
1728 | 1739 | |
|
1729 | 1740 | ``multi-urls`` |
|
1730 | 1741 | A boolean option. When enabled the value of the `[paths]` entry will be |
|
1731 | 1742 | parsed as a list and the alias will resolve to multiple destination. If some |
|
1732 | 1743 | of the list entry use the `path://` syntax, the suboption will be inherited |
|
1733 | 1744 | individually. |
|
1734 | 1745 | |
|
1735 | 1746 | ``pushurl`` |
|
1736 | 1747 | The URL to use for push operations. If not defined, the location |
|
1737 | 1748 | defined by the path's main entry is used. |
|
1738 | 1749 | |
|
1739 | 1750 | ``pushrev`` |
|
1740 | 1751 | A revset defining which revisions to push by default. |
|
1741 | 1752 | |
|
1742 | 1753 | When :hg:`push` is executed without a ``-r`` argument, the revset |
|
1743 | 1754 | defined by this sub-option is evaluated to determine what to push. |
|
1744 | 1755 | |
|
1745 | 1756 | For example, a value of ``.`` will push the working directory's |
|
1746 | 1757 | revision by default. |
|
1747 | 1758 | |
|
1748 | 1759 | Revsets specifying bookmarks will not result in the bookmark being |
|
1749 | 1760 | pushed. |
|
1750 | 1761 | |
|
1751 | 1762 | ``bookmarks.mode`` |
|
1752 | 1763 | How bookmark will be dealt during the exchange. It support the following value |
|
1753 | 1764 | |
|
1754 | 1765 | - ``default``: the default behavior, local and remote bookmarks are "merged" |
|
1755 | 1766 | on push/pull. |
|
1756 | 1767 | |
|
1757 | 1768 | - ``mirror``: when pulling, replace local bookmarks by remote bookmarks. This |
|
1758 | 1769 | is useful to replicate a repository, or as an optimization. |
|
1759 | 1770 | |
|
1760 | 1771 | - ``ignore``: ignore bookmarks during exchange. |
|
1761 | 1772 | (This currently only affect pulling) |
|
1762 | 1773 | |
|
1763 | 1774 | The following special named paths exist: |
|
1764 | 1775 | |
|
1765 | 1776 | ``default`` |
|
1766 | 1777 | The URL or directory to use when no source or remote is specified. |
|
1767 | 1778 | |
|
1768 | 1779 | :hg:`clone` will automatically define this path to the location the |
|
1769 | 1780 | repository was cloned from. |
|
1770 | 1781 | |
|
1771 | 1782 | ``default-push`` |
|
1772 | 1783 | (deprecated) The URL or directory for the default :hg:`push` location. |
|
1773 | 1784 | ``default:pushurl`` should be used instead. |
|
1774 | 1785 | |
|
1775 | 1786 | ``phases`` |
|
1776 | 1787 | ---------- |
|
1777 | 1788 | |
|
1778 | 1789 | Specifies default handling of phases. See :hg:`help phases` for more |
|
1779 | 1790 | information about working with phases. |
|
1780 | 1791 | |
|
1781 | 1792 | ``publish`` |
|
1782 | 1793 | Controls draft phase behavior when working as a server. When true, |
|
1783 | 1794 | pushed changesets are set to public in both client and server and |
|
1784 | 1795 | pulled or cloned changesets are set to public in the client. |
|
1785 | 1796 | (default: True) |
|
1786 | 1797 | |
|
1787 | 1798 | ``new-commit`` |
|
1788 | 1799 | Phase of newly-created commits. |
|
1789 | 1800 | (default: draft) |
|
1790 | 1801 | |
|
1791 | 1802 | ``checksubrepos`` |
|
1792 | 1803 | Check the phase of the current revision of each subrepository. Allowed |
|
1793 | 1804 | values are "ignore", "follow" and "abort". For settings other than |
|
1794 | 1805 | "ignore", the phase of the current revision of each subrepository is |
|
1795 | 1806 | checked before committing the parent repository. If any of those phases is |
|
1796 | 1807 | greater than the phase of the parent repository (e.g. if a subrepo is in a |
|
1797 | 1808 | "secret" phase while the parent repo is in "draft" phase), the commit is |
|
1798 | 1809 | either aborted (if checksubrepos is set to "abort") or the higher phase is |
|
1799 | 1810 | used for the parent repository commit (if set to "follow"). |
|
1800 | 1811 | (default: follow) |
|
1801 | 1812 | |
|
1802 | 1813 | |
|
1803 | 1814 | ``profiling`` |
|
1804 | 1815 | ------------- |
|
1805 | 1816 | |
|
1806 | 1817 | Specifies profiling type, format, and file output. Two profilers are |
|
1807 | 1818 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
1808 | 1819 | profiler (named ``stat``). |
|
1809 | 1820 | |
|
1810 | 1821 | In this section description, 'profiling data' stands for the raw data |
|
1811 | 1822 | collected during profiling, while 'profiling report' stands for a |
|
1812 | 1823 | statistical text report generated from the profiling data. |
|
1813 | 1824 | |
|
1814 | 1825 | ``enabled`` |
|
1815 | 1826 | Enable the profiler. |
|
1816 | 1827 | (default: false) |
|
1817 | 1828 | |
|
1818 | 1829 | This is equivalent to passing ``--profile`` on the command line. |
|
1819 | 1830 | |
|
1820 | 1831 | ``type`` |
|
1821 | 1832 | The type of profiler to use. |
|
1822 | 1833 | (default: stat) |
|
1823 | 1834 | |
|
1824 | 1835 | ``ls`` |
|
1825 | 1836 | Use Python's built-in instrumenting profiler. This profiler |
|
1826 | 1837 | works on all platforms, but each line number it reports is the |
|
1827 | 1838 | first line of a function. This restriction makes it difficult to |
|
1828 | 1839 | identify the expensive parts of a non-trivial function. |
|
1829 | 1840 | ``stat`` |
|
1830 | 1841 | Use a statistical profiler, statprof. This profiler is most |
|
1831 | 1842 | useful for profiling commands that run for longer than about 0.1 |
|
1832 | 1843 | seconds. |
|
1833 | 1844 | |
|
1834 | 1845 | ``format`` |
|
1835 | 1846 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
1836 | 1847 | (default: text) |
|
1837 | 1848 | |
|
1838 | 1849 | ``text`` |
|
1839 | 1850 | Generate a profiling report. When saving to a file, it should be |
|
1840 | 1851 | noted that only the report is saved, and the profiling data is |
|
1841 | 1852 | not kept. |
|
1842 | 1853 | ``kcachegrind`` |
|
1843 | 1854 | Format profiling data for kcachegrind use: when saving to a |
|
1844 | 1855 | file, the generated file can directly be loaded into |
|
1845 | 1856 | kcachegrind. |
|
1846 | 1857 | |
|
1847 | 1858 | ``statformat`` |
|
1848 | 1859 | Profiling format for the ``stat`` profiler. |
|
1849 | 1860 | (default: hotpath) |
|
1850 | 1861 | |
|
1851 | 1862 | ``hotpath`` |
|
1852 | 1863 | Show a tree-based display containing the hot path of execution (where |
|
1853 | 1864 | most time was spent). |
|
1854 | 1865 | ``bymethod`` |
|
1855 | 1866 | Show a table of methods ordered by how frequently they are active. |
|
1856 | 1867 | ``byline`` |
|
1857 | 1868 | Show a table of lines in files ordered by how frequently they are active. |
|
1858 | 1869 | ``json`` |
|
1859 | 1870 | Render profiling data as JSON. |
|
1860 | 1871 | |
|
1861 | 1872 | ``freq`` |
|
1862 | 1873 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
1863 | 1874 | (default: 1000) |
|
1864 | 1875 | |
|
1865 | 1876 | ``output`` |
|
1866 | 1877 | File path where profiling data or report should be saved. If the |
|
1867 | 1878 | file exists, it is replaced. (default: None, data is printed on |
|
1868 | 1879 | stderr) |
|
1869 | 1880 | |
|
1870 | 1881 | ``sort`` |
|
1871 | 1882 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
1872 | 1883 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
1873 | 1884 | ``inlinetime``. |
|
1874 | 1885 | (default: inlinetime) |
|
1875 | 1886 | |
|
1876 | 1887 | ``time-track`` |
|
1877 | 1888 | Control if the stat profiler track ``cpu`` or ``real`` time. |
|
1878 | 1889 | (default: ``cpu`` on Windows, otherwise ``real``) |
|
1879 | 1890 | |
|
1880 | 1891 | ``limit`` |
|
1881 | 1892 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1882 | 1893 | (default: 30) |
|
1883 | 1894 | |
|
1884 | 1895 | ``nested`` |
|
1885 | 1896 | Show at most this number of lines of drill-down info after each main entry. |
|
1886 | 1897 | This can help explain the difference between Total and Inline. |
|
1887 | 1898 | Specific to the ``ls`` instrumenting profiler. |
|
1888 | 1899 | (default: 0) |
|
1889 | 1900 | |
|
1890 | 1901 | ``showmin`` |
|
1891 | 1902 | Minimum fraction of samples an entry must have for it to be displayed. |
|
1892 | 1903 | Can be specified as a float between ``0.0`` and ``1.0`` or can have a |
|
1893 | 1904 | ``%`` afterwards to allow values up to ``100``. e.g. ``5%``. |
|
1894 | 1905 | |
|
1895 | 1906 | Only used by the ``stat`` profiler. |
|
1896 | 1907 | |
|
1897 | 1908 | For the ``hotpath`` format, default is ``0.05``. |
|
1898 | 1909 | For the ``chrome`` format, default is ``0.005``. |
|
1899 | 1910 | |
|
1900 | 1911 | The option is unused on other formats. |
|
1901 | 1912 | |
|
1902 | 1913 | ``showmax`` |
|
1903 | 1914 | Maximum fraction of samples an entry can have before it is ignored in |
|
1904 | 1915 | display. Values format is the same as ``showmin``. |
|
1905 | 1916 | |
|
1906 | 1917 | Only used by the ``stat`` profiler. |
|
1907 | 1918 | |
|
1908 | 1919 | For the ``chrome`` format, default is ``0.999``. |
|
1909 | 1920 | |
|
1910 | 1921 | The option is unused on other formats. |
|
1911 | 1922 | |
|
1912 | 1923 | ``showtime`` |
|
1913 | 1924 | Show time taken as absolute durations, in addition to percentages. |
|
1914 | 1925 | Only used by the ``hotpath`` format. |
|
1915 | 1926 | (default: true) |
|
1916 | 1927 | |
|
1917 | 1928 | ``progress`` |
|
1918 | 1929 | ------------ |
|
1919 | 1930 | |
|
1920 | 1931 | Mercurial commands can draw progress bars that are as informative as |
|
1921 | 1932 | possible. Some progress bars only offer indeterminate information, while others |
|
1922 | 1933 | have a definite end point. |
|
1923 | 1934 | |
|
1924 | 1935 | ``debug`` |
|
1925 | 1936 | Whether to print debug info when updating the progress bar. (default: False) |
|
1926 | 1937 | |
|
1927 | 1938 | ``delay`` |
|
1928 | 1939 | Number of seconds (float) before showing the progress bar. (default: 3) |
|
1929 | 1940 | |
|
1930 | 1941 | ``changedelay`` |
|
1931 | 1942 | Minimum delay before showing a new topic. When set to less than 3 * refresh, |
|
1932 | 1943 | that value will be used instead. (default: 1) |
|
1933 | 1944 | |
|
1934 | 1945 | ``estimateinterval`` |
|
1935 | 1946 | Maximum sampling interval in seconds for speed and estimated time |
|
1936 | 1947 | calculation. (default: 60) |
|
1937 | 1948 | |
|
1938 | 1949 | ``refresh`` |
|
1939 | 1950 | Time in seconds between refreshes of the progress bar. (default: 0.1) |
|
1940 | 1951 | |
|
1941 | 1952 | ``format`` |
|
1942 | 1953 | Format of the progress bar. |
|
1943 | 1954 | |
|
1944 | 1955 | Valid entries for the format field are ``topic``, ``bar``, ``number``, |
|
1945 | 1956 | ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the |
|
1946 | 1957 | last 20 characters of the item, but this can be changed by adding either |
|
1947 | 1958 | ``-<num>`` which would take the last num characters, or ``+<num>`` for the |
|
1948 | 1959 | first num characters. |
|
1949 | 1960 | |
|
1950 | 1961 | (default: topic bar number estimate) |
|
1951 | 1962 | |
|
1952 | 1963 | ``width`` |
|
1953 | 1964 | If set, the maximum width of the progress information (that is, min(width, |
|
1954 | 1965 | term width) will be used). |
|
1955 | 1966 | |
|
1956 | 1967 | ``clear-complete`` |
|
1957 | 1968 | Clear the progress bar after it's done. (default: True) |
|
1958 | 1969 | |
|
1959 | 1970 | ``disable`` |
|
1960 | 1971 | If true, don't show a progress bar. |
|
1961 | 1972 | |
|
1962 | 1973 | ``assume-tty`` |
|
1963 | 1974 | If true, ALWAYS show a progress bar, unless disable is given. |
|
1964 | 1975 | |
|
1965 | 1976 | ``rebase`` |
|
1966 | 1977 | ---------- |
|
1967 | 1978 | |
|
1968 | 1979 | ``evolution.allowdivergence`` |
|
1969 | 1980 | Default to False, when True allow creating divergence when performing |
|
1970 | 1981 | rebase of obsolete changesets. |
|
1971 | 1982 | |
|
1972 | 1983 | ``revsetalias`` |
|
1973 | 1984 | --------------- |
|
1974 | 1985 | |
|
1975 | 1986 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
1976 | 1987 | |
|
1977 | 1988 | ``rewrite`` |
|
1978 | 1989 | ----------- |
|
1979 | 1990 | |
|
1980 | 1991 | ``backup-bundle`` |
|
1981 | 1992 | Whether to save stripped changesets to a bundle file. (default: True) |
|
1982 | 1993 | |
|
1983 | 1994 | ``update-timestamp`` |
|
1984 | 1995 | If true, updates the date and time of the changeset to current. It is only |
|
1985 | 1996 | applicable for `hg amend`, `hg commit --amend` and `hg uncommit` in the |
|
1986 | 1997 | current version. |
|
1987 | 1998 | |
|
1988 | 1999 | ``empty-successor`` |
|
1989 | 2000 | |
|
1990 | 2001 | Control what happens with empty successors that are the result of rewrite |
|
1991 | 2002 | operations. If set to ``skip``, the successor is not created. If set to |
|
1992 | 2003 | ``keep``, the empty successor is created and kept. |
|
1993 | 2004 | |
|
1994 | 2005 | Currently, only the rebase and absorb commands consider this configuration. |
|
1995 | 2006 | (EXPERIMENTAL) |
|
1996 | 2007 | |
|
1997 | 2008 | ``share`` |
|
1998 | 2009 | --------- |
|
1999 | 2010 | |
|
2000 | 2011 | ``safe-mismatch.source-safe`` |
|
2001 | 2012 | |
|
2002 | 2013 | Controls what happens when the shared repository does not use the |
|
2003 | 2014 | share-safe mechanism but its source repository does. |
|
2004 | 2015 | |
|
2005 | 2016 | Possible values are `abort` (default), `allow`, `upgrade-abort` and |
|
2006 | 2017 | `upgrade-abort`. |
|
2007 | 2018 | |
|
2008 | 2019 | ``abort`` |
|
2009 | 2020 | Disallows running any command and aborts |
|
2010 | 2021 | ``allow`` |
|
2011 | 2022 | Respects the feature presence in the share source |
|
2012 | 2023 | ``upgrade-abort`` |
|
2013 | 2024 | tries to upgrade the share to use share-safe; if it fails, aborts |
|
2014 | 2025 | ``upgrade-allow`` |
|
2015 | 2026 | tries to upgrade the share; if it fails, continue by |
|
2016 | 2027 | respecting the share source setting |
|
2017 | 2028 | |
|
2018 | 2029 | Check :hg:`help config format.use-share-safe` for details about the |
|
2019 | 2030 | share-safe feature. |
|
2020 | 2031 | |
|
2021 | 2032 | ``safe-mismatch.source-safe.warn`` |
|
2022 | 2033 | Shows a warning on operations if the shared repository does not use |
|
2023 | 2034 | share-safe, but the source repository does. |
|
2024 | 2035 | (default: True) |
|
2025 | 2036 | |
|
2026 | 2037 | ``safe-mismatch.source-not-safe`` |
|
2027 | 2038 | |
|
2028 | 2039 | Controls what happens when the shared repository uses the share-safe |
|
2029 | 2040 | mechanism but its source does not. |
|
2030 | 2041 | |
|
2031 | 2042 | Possible values are `abort` (default), `allow`, `downgrade-abort` and |
|
2032 | 2043 | `downgrade-abort`. |
|
2033 | 2044 | |
|
2034 | 2045 | ``abort`` |
|
2035 | 2046 | Disallows running any command and aborts |
|
2036 | 2047 | ``allow`` |
|
2037 | 2048 | Respects the feature presence in the share source |
|
2038 | 2049 | ``downgrade-abort`` |
|
2039 | 2050 | tries to downgrade the share to not use share-safe; if it fails, aborts |
|
2040 | 2051 | ``downgrade-allow`` |
|
2041 | 2052 | tries to downgrade the share to not use share-safe; |
|
2042 | 2053 | if it fails, continue by respecting the shared source setting |
|
2043 | 2054 | |
|
2044 | 2055 | Check :hg:`help config format.use-share-safe` for details about the |
|
2045 | 2056 | share-safe feature. |
|
2046 | 2057 | |
|
2047 | 2058 | ``safe-mismatch.source-not-safe.warn`` |
|
2048 | 2059 | Shows a warning on operations if the shared repository uses share-safe, |
|
2049 | 2060 | but the source repository does not. |
|
2050 | 2061 | (default: True) |
|
2051 | 2062 | |
|
2052 | 2063 | ``storage`` |
|
2053 | 2064 | ----------- |
|
2054 | 2065 | |
|
2055 | 2066 | Control the strategy Mercurial uses internally to store history. Options in this |
|
2056 | 2067 | category impact performance and repository size. |
|
2057 | 2068 | |
|
2058 | 2069 | ``revlog.issue6528.fix-incoming`` |
|
2059 | 2070 | Version 5.8 of Mercurial had a bug leading to altering the parent of file |
|
2060 | 2071 | revision with copy information (or any other metadata) on exchange. This |
|
2061 | 2072 | leads to the copy metadata to be overlooked by various internal logic. The |
|
2062 | 2073 | issue was fixed in Mercurial 5.8.1. |
|
2063 | 2074 | (See https://bz.mercurial-scm.org/show_bug.cgi?id=6528 for details) |
|
2064 | 2075 | |
|
2065 | 2076 | As a result Mercurial is now checking and fixing incoming file revisions to |
|
2066 | 2077 | make sure there parents are in the right order. This behavior can be |
|
2067 | 2078 | disabled by setting this option to `no`. This apply to revisions added |
|
2068 | 2079 | through push, pull, clone and unbundle. |
|
2069 | 2080 | |
|
2070 | 2081 | To fix affected revisions that already exist within the repository, one can |
|
2071 | 2082 | use :hg:`debug-repair-issue-6528`. |
|
2072 | 2083 | |
|
2073 | 2084 | ``revlog.optimize-delta-parent-choice`` |
|
2074 | 2085 | When storing a merge revision, both parents will be equally considered as |
|
2075 | 2086 | a possible delta base. This results in better delta selection and improved |
|
2076 | 2087 | revlog compression. This option is enabled by default. |
|
2077 | 2088 | |
|
2078 | 2089 | Turning this option off can result in large increase of repository size for |
|
2079 | 2090 | repository with many merges. |
|
2080 | 2091 | |
|
2081 | 2092 | ``revlog.persistent-nodemap.mmap`` |
|
2082 | 2093 | Whether to use the Operating System "memory mapping" feature (when |
|
2083 | 2094 | possible) to access the persistent nodemap data. This improve performance |
|
2084 | 2095 | and reduce memory pressure. |
|
2085 | 2096 | |
|
2086 | 2097 | Default to True. |
|
2087 | 2098 | |
|
2088 | 2099 | For details on the "persistent-nodemap" feature, see: |
|
2089 | 2100 | :hg:`help config format.use-persistent-nodemap`. |
|
2090 | 2101 | |
|
2091 | 2102 | ``revlog.persistent-nodemap.slow-path`` |
|
2092 | 2103 | Control the behavior of Merucrial when using a repository with "persistent" |
|
2093 | 2104 | nodemap with an installation of Mercurial without a fast implementation for |
|
2094 | 2105 | the feature: |
|
2095 | 2106 | |
|
2096 | 2107 | ``allow``: Silently use the slower implementation to access the repository. |
|
2097 | 2108 | ``warn``: Warn, but use the slower implementation to access the repository. |
|
2098 | 2109 | ``abort``: Prevent access to such repositories. (This is the default) |
|
2099 | 2110 | |
|
2100 | 2111 | For details on the "persistent-nodemap" feature, see: |
|
2101 | 2112 | :hg:`help config format.use-persistent-nodemap`. |
|
2102 | 2113 | |
|
2103 | 2114 | ``revlog.reuse-external-delta-parent`` |
|
2104 | 2115 | Control the order in which delta parents are considered when adding new |
|
2105 | 2116 | revisions from an external source. |
|
2106 | 2117 | (typically: apply bundle from `hg pull` or `hg push`). |
|
2107 | 2118 | |
|
2108 | 2119 | New revisions are usually provided as a delta against other revisions. By |
|
2109 | 2120 | default, Mercurial will try to reuse this delta first, therefore using the |
|
2110 | 2121 | same "delta parent" as the source. Directly using delta's from the source |
|
2111 | 2122 | reduces CPU usage and usually speeds up operation. However, in some case, |
|
2112 | 2123 | the source might have sub-optimal delta bases and forcing their reevaluation |
|
2113 | 2124 | is useful. For example, pushes from an old client could have sub-optimal |
|
2114 | 2125 | delta's parent that the server want to optimize. (lack of general delta, bad |
|
2115 | 2126 | parents, choice, lack of sparse-revlog, etc). |
|
2116 | 2127 | |
|
2117 | 2128 | This option is enabled by default. Turning it off will ensure bad delta |
|
2118 | 2129 | parent choices from older client do not propagate to this repository, at |
|
2119 | 2130 | the cost of a small increase in CPU consumption. |
|
2120 | 2131 | |
|
2121 | 2132 | Note: this option only control the order in which delta parents are |
|
2122 | 2133 | considered. Even when disabled, the existing delta from the source will be |
|
2123 | 2134 | reused if the same delta parent is selected. |
|
2124 | 2135 | |
|
2125 | 2136 | ``revlog.reuse-external-delta`` |
|
2126 | 2137 | Control the reuse of delta from external source. |
|
2127 | 2138 | (typically: apply bundle from `hg pull` or `hg push`). |
|
2128 | 2139 | |
|
2129 | 2140 | New revisions are usually provided as a delta against another revision. By |
|
2130 | 2141 | default, Mercurial will not recompute the same delta again, trusting |
|
2131 | 2142 | externally provided deltas. There have been rare cases of small adjustment |
|
2132 | 2143 | to the diffing algorithm in the past. So in some rare case, recomputing |
|
2133 | 2144 | delta provided by ancient clients can provides better results. Disabling |
|
2134 | 2145 | this option means going through a full delta recomputation for all incoming |
|
2135 | 2146 | revisions. It means a large increase in CPU usage and will slow operations |
|
2136 | 2147 | down. |
|
2137 | 2148 | |
|
2138 | 2149 | This option is enabled by default. When disabled, it also disables the |
|
2139 | 2150 | related ``storage.revlog.reuse-external-delta-parent`` option. |
|
2140 | 2151 | |
|
2141 | 2152 | ``revlog.zlib.level`` |
|
2142 | 2153 | Zlib compression level used when storing data into the repository. Accepted |
|
2143 | 2154 | Value range from 1 (lowest compression) to 9 (highest compression). Zlib |
|
2144 | 2155 | default value is 6. |
|
2145 | 2156 | |
|
2146 | 2157 | |
|
2147 | 2158 | ``revlog.zstd.level`` |
|
2148 | 2159 | zstd compression level used when storing data into the repository. Accepted |
|
2149 | 2160 | Value range from 1 (lowest compression) to 22 (highest compression). |
|
2150 | 2161 | (default 3) |
|
2151 | 2162 | |
|
2152 | 2163 | ``server`` |
|
2153 | 2164 | ---------- |
|
2154 | 2165 | |
|
2155 | 2166 | Controls generic server settings. |
|
2156 | 2167 | |
|
2157 | 2168 | ``bookmarks-pushkey-compat`` |
|
2158 | 2169 | Trigger pushkey hook when being pushed bookmark updates. This config exist |
|
2159 | 2170 | for compatibility purpose (default to True) |
|
2160 | 2171 | |
|
2161 | 2172 | If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark |
|
2162 | 2173 | movement we recommend you migrate them to ``txnclose-bookmark`` and |
|
2163 | 2174 | ``pretxnclose-bookmark``. |
|
2164 | 2175 | |
|
2165 | 2176 | ``compressionengines`` |
|
2166 | 2177 | List of compression engines and their relative priority to advertise |
|
2167 | 2178 | to clients. |
|
2168 | 2179 | |
|
2169 | 2180 | The order of compression engines determines their priority, the first |
|
2170 | 2181 | having the highest priority. If a compression engine is not listed |
|
2171 | 2182 | here, it won't be advertised to clients. |
|
2172 | 2183 | |
|
2173 | 2184 | If not set (the default), built-in defaults are used. Run |
|
2174 | 2185 | :hg:`debuginstall` to list available compression engines and their |
|
2175 | 2186 | default wire protocol priority. |
|
2176 | 2187 | |
|
2177 | 2188 | Older Mercurial clients only support zlib compression and this setting |
|
2178 | 2189 | has no effect for legacy clients. |
|
2179 | 2190 | |
|
2180 | 2191 | ``uncompressed`` |
|
2181 | 2192 | Whether to allow clients to clone a repository using the |
|
2182 | 2193 | uncompressed streaming protocol. This transfers about 40% more |
|
2183 | 2194 | data than a regular clone, but uses less memory and CPU on both |
|
2184 | 2195 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
2185 | 2196 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
2186 | 2197 | regular clone. Over most WAN connections (anything slower than |
|
2187 | 2198 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
2188 | 2199 | extra data transfer overhead. This mode will also temporarily hold |
|
2189 | 2200 | the write lock while determining what data to transfer. |
|
2190 | 2201 | (default: True) |
|
2191 | 2202 | |
|
2192 | 2203 | ``uncompressedallowsecret`` |
|
2193 | 2204 | Whether to allow stream clones when the repository contains secret |
|
2194 | 2205 | changesets. (default: False) |
|
2195 | 2206 | |
|
2196 | 2207 | ``preferuncompressed`` |
|
2197 | 2208 | When set, clients will try to use the uncompressed streaming |
|
2198 | 2209 | protocol. (default: False) |
|
2199 | 2210 | |
|
2200 | 2211 | ``disablefullbundle`` |
|
2201 | 2212 | When set, servers will refuse attempts to do pull-based clones. |
|
2202 | 2213 | If this option is set, ``preferuncompressed`` and/or clone bundles |
|
2203 | 2214 | are highly recommended. Partial clones will still be allowed. |
|
2204 | 2215 | (default: False) |
|
2205 | 2216 | |
|
2206 | 2217 | ``streamunbundle`` |
|
2207 | 2218 | When set, servers will apply data sent from the client directly, |
|
2208 | 2219 | otherwise it will be written to a temporary file first. This option |
|
2209 | 2220 | effectively prevents concurrent pushes. |
|
2210 | 2221 | |
|
2211 | 2222 | ``pullbundle`` |
|
2212 | 2223 | When set, the server will check pullbundle.manifest for bundles |
|
2213 | 2224 | covering the requested heads and common nodes. The first matching |
|
2214 | 2225 | entry will be streamed to the client. |
|
2215 | 2226 | |
|
2216 | 2227 | For HTTP transport, the stream will still use zlib compression |
|
2217 | 2228 | for older clients. |
|
2218 | 2229 | |
|
2219 | 2230 | ``concurrent-push-mode`` |
|
2220 | 2231 | Level of allowed race condition between two pushing clients. |
|
2221 | 2232 | |
|
2222 | 2233 | - 'strict': push is abort if another client touched the repository |
|
2223 | 2234 | while the push was preparing. |
|
2224 | 2235 | - 'check-related': push is only aborted if it affects head that got also |
|
2225 | 2236 | affected while the push was preparing. (default since 5.4) |
|
2226 | 2237 | |
|
2227 | 2238 | 'check-related' only takes effect for compatible clients (version |
|
2228 | 2239 | 4.3 and later). Older clients will use 'strict'. |
|
2229 | 2240 | |
|
2230 | 2241 | ``validate`` |
|
2231 | 2242 | Whether to validate the completeness of pushed changesets by |
|
2232 | 2243 | checking that all new file revisions specified in manifests are |
|
2233 | 2244 | present. (default: False) |
|
2234 | 2245 | |
|
2235 | 2246 | ``maxhttpheaderlen`` |
|
2236 | 2247 | Instruct HTTP clients not to send request headers longer than this |
|
2237 | 2248 | many bytes. (default: 1024) |
|
2238 | 2249 | |
|
2239 | 2250 | ``bundle1`` |
|
2240 | 2251 | Whether to allow clients to push and pull using the legacy bundle1 |
|
2241 | 2252 | exchange format. (default: True) |
|
2242 | 2253 | |
|
2243 | 2254 | ``bundle1gd`` |
|
2244 | 2255 | Like ``bundle1`` but only used if the repository is using the |
|
2245 | 2256 | *generaldelta* storage format. (default: True) |
|
2246 | 2257 | |
|
2247 | 2258 | ``bundle1.push`` |
|
2248 | 2259 | Whether to allow clients to push using the legacy bundle1 exchange |
|
2249 | 2260 | format. (default: True) |
|
2250 | 2261 | |
|
2251 | 2262 | ``bundle1gd.push`` |
|
2252 | 2263 | Like ``bundle1.push`` but only used if the repository is using the |
|
2253 | 2264 | *generaldelta* storage format. (default: True) |
|
2254 | 2265 | |
|
2255 | 2266 | ``bundle1.pull`` |
|
2256 | 2267 | Whether to allow clients to pull using the legacy bundle1 exchange |
|
2257 | 2268 | format. (default: True) |
|
2258 | 2269 | |
|
2259 | 2270 | ``bundle1gd.pull`` |
|
2260 | 2271 | Like ``bundle1.pull`` but only used if the repository is using the |
|
2261 | 2272 | *generaldelta* storage format. (default: True) |
|
2262 | 2273 | |
|
2263 | 2274 | Large repositories using the *generaldelta* storage format should |
|
2264 | 2275 | consider setting this option because converting *generaldelta* |
|
2265 | 2276 | repositories to the exchange format required by the bundle1 data |
|
2266 | 2277 | format can consume a lot of CPU. |
|
2267 | 2278 | |
|
2268 | 2279 | ``bundle2.stream`` |
|
2269 | 2280 | Whether to allow clients to pull using the bundle2 streaming protocol. |
|
2270 | 2281 | (default: True) |
|
2271 | 2282 | |
|
2272 | 2283 | ``zliblevel`` |
|
2273 | 2284 | Integer between ``-1`` and ``9`` that controls the zlib compression level |
|
2274 | 2285 | for wire protocol commands that send zlib compressed output (notably the |
|
2275 | 2286 | commands that send repository history data). |
|
2276 | 2287 | |
|
2277 | 2288 | The default (``-1``) uses the default zlib compression level, which is |
|
2278 | 2289 | likely equivalent to ``6``. ``0`` means no compression. ``9`` means |
|
2279 | 2290 | maximum compression. |
|
2280 | 2291 | |
|
2281 | 2292 | Setting this option allows server operators to make trade-offs between |
|
2282 | 2293 | bandwidth and CPU used. Lowering the compression lowers CPU utilization |
|
2283 | 2294 | but sends more bytes to clients. |
|
2284 | 2295 | |
|
2285 | 2296 | This option only impacts the HTTP server. |
|
2286 | 2297 | |
|
2287 | 2298 | ``zstdlevel`` |
|
2288 | 2299 | Integer between ``1`` and ``22`` that controls the zstd compression level |
|
2289 | 2300 | for wire protocol commands. ``1`` is the minimal amount of compression and |
|
2290 | 2301 | ``22`` is the highest amount of compression. |
|
2291 | 2302 | |
|
2292 | 2303 | The default (``3``) should be significantly faster than zlib while likely |
|
2293 | 2304 | delivering better compression ratios. |
|
2294 | 2305 | |
|
2295 | 2306 | This option only impacts the HTTP server. |
|
2296 | 2307 | |
|
2297 | 2308 | See also ``server.zliblevel``. |
|
2298 | 2309 | |
|
2299 | 2310 | ``view`` |
|
2300 | 2311 | Repository filter used when exchanging revisions with the peer. |
|
2301 | 2312 | |
|
2302 | 2313 | The default view (``served``) excludes secret and hidden changesets. |
|
2303 | 2314 | Another useful value is ``immutable`` (no draft, secret or hidden |
|
2304 | 2315 | changesets). (EXPERIMENTAL) |
|
2305 | 2316 | |
|
2306 | 2317 | ``smtp`` |
|
2307 | 2318 | -------- |
|
2308 | 2319 | |
|
2309 | 2320 | Configuration for extensions that need to send email messages. |
|
2310 | 2321 | |
|
2311 | 2322 | ``host`` |
|
2312 | 2323 | Host name of mail server, e.g. "mail.example.com". |
|
2313 | 2324 | |
|
2314 | 2325 | ``port`` |
|
2315 | 2326 | Optional. Port to connect to on mail server. (default: 465 if |
|
2316 | 2327 | ``tls`` is smtps; 25 otherwise) |
|
2317 | 2328 | |
|
2318 | 2329 | ``tls`` |
|
2319 | 2330 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
2320 | 2331 | smtps or none. (default: none) |
|
2321 | 2332 | |
|
2322 | 2333 | ``username`` |
|
2323 | 2334 | Optional. User name for authenticating with the SMTP server. |
|
2324 | 2335 | (default: None) |
|
2325 | 2336 | |
|
2326 | 2337 | ``password`` |
|
2327 | 2338 | Optional. Password for authenticating with the SMTP server. If not |
|
2328 | 2339 | specified, interactive sessions will prompt the user for a |
|
2329 | 2340 | password; non-interactive sessions will fail. (default: None) |
|
2330 | 2341 | |
|
2331 | 2342 | ``local_hostname`` |
|
2332 | 2343 | Optional. The hostname that the sender can use to identify |
|
2333 | 2344 | itself to the MTA. |
|
2334 | 2345 | |
|
2335 | 2346 | |
|
2336 | 2347 | ``subpaths`` |
|
2337 | 2348 | ------------ |
|
2338 | 2349 | |
|
2339 | 2350 | Subrepository source URLs can go stale if a remote server changes name |
|
2340 | 2351 | or becomes temporarily unavailable. This section lets you define |
|
2341 | 2352 | rewrite rules of the form:: |
|
2342 | 2353 | |
|
2343 | 2354 | <pattern> = <replacement> |
|
2344 | 2355 | |
|
2345 | 2356 | where ``pattern`` is a regular expression matching a subrepository |
|
2346 | 2357 | source URL and ``replacement`` is the replacement string used to |
|
2347 | 2358 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
2348 | 2359 | ``replacements``. For instance:: |
|
2349 | 2360 | |
|
2350 | 2361 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
2351 | 2362 | |
|
2352 | 2363 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
2353 | 2364 | |
|
2354 | 2365 | Relative subrepository paths are first made absolute, and the |
|
2355 | 2366 | rewrite rules are then applied on the full (absolute) path. If ``pattern`` |
|
2356 | 2367 | doesn't match the full path, an attempt is made to apply it on the |
|
2357 | 2368 | relative path alone. The rules are applied in definition order. |
|
2358 | 2369 | |
|
2359 | 2370 | ``subrepos`` |
|
2360 | 2371 | ------------ |
|
2361 | 2372 | |
|
2362 | 2373 | This section contains options that control the behavior of the |
|
2363 | 2374 | subrepositories feature. See also :hg:`help subrepos`. |
|
2364 | 2375 | |
|
2365 | 2376 | Security note: auditing in Mercurial is known to be insufficient to |
|
2366 | 2377 | prevent clone-time code execution with carefully constructed Git |
|
2367 | 2378 | subrepos. It is unknown if a similar detect is present in Subversion |
|
2368 | 2379 | subrepos. Both Git and Subversion subrepos are disabled by default |
|
2369 | 2380 | out of security concerns. These subrepo types can be enabled using |
|
2370 | 2381 | the respective options below. |
|
2371 | 2382 | |
|
2372 | 2383 | ``allowed`` |
|
2373 | 2384 | Whether subrepositories are allowed in the working directory. |
|
2374 | 2385 | |
|
2375 | 2386 | When false, commands involving subrepositories (like :hg:`update`) |
|
2376 | 2387 | will fail for all subrepository types. |
|
2377 | 2388 | (default: true) |
|
2378 | 2389 | |
|
2379 | 2390 | ``hg:allowed`` |
|
2380 | 2391 | Whether Mercurial subrepositories are allowed in the working |
|
2381 | 2392 | directory. This option only has an effect if ``subrepos.allowed`` |
|
2382 | 2393 | is true. |
|
2383 | 2394 | (default: true) |
|
2384 | 2395 | |
|
2385 | 2396 | ``git:allowed`` |
|
2386 | 2397 | Whether Git subrepositories are allowed in the working directory. |
|
2387 | 2398 | This option only has an effect if ``subrepos.allowed`` is true. |
|
2388 | 2399 | |
|
2389 | 2400 | See the security note above before enabling Git subrepos. |
|
2390 | 2401 | (default: false) |
|
2391 | 2402 | |
|
2392 | 2403 | ``svn:allowed`` |
|
2393 | 2404 | Whether Subversion subrepositories are allowed in the working |
|
2394 | 2405 | directory. This option only has an effect if ``subrepos.allowed`` |
|
2395 | 2406 | is true. |
|
2396 | 2407 | |
|
2397 | 2408 | See the security note above before enabling Subversion subrepos. |
|
2398 | 2409 | (default: false) |
|
2399 | 2410 | |
|
2400 | 2411 | ``templatealias`` |
|
2401 | 2412 | ----------------- |
|
2402 | 2413 | |
|
2403 | 2414 | Alias definitions for templates. See :hg:`help templates` for details. |
|
2404 | 2415 | |
|
2405 | 2416 | ``templates`` |
|
2406 | 2417 | ------------- |
|
2407 | 2418 | |
|
2408 | 2419 | Use the ``[templates]`` section to define template strings. |
|
2409 | 2420 | See :hg:`help templates` for details. |
|
2410 | 2421 | |
|
2411 | 2422 | ``trusted`` |
|
2412 | 2423 | ----------- |
|
2413 | 2424 | |
|
2414 | 2425 | Mercurial will not use the settings in the |
|
2415 | 2426 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
2416 | 2427 | user or to a trusted group, as various hgrc features allow arbitrary |
|
2417 | 2428 | commands to be run. This issue is often encountered when configuring |
|
2418 | 2429 | hooks or extensions for shared repositories or servers. However, |
|
2419 | 2430 | the web interface will use some safe settings from the ``[web]`` |
|
2420 | 2431 | section. |
|
2421 | 2432 | |
|
2422 | 2433 | This section specifies what users and groups are trusted. The |
|
2423 | 2434 | current user is always trusted. To trust everybody, list a user or a |
|
2424 | 2435 | group with name ``*``. These settings must be placed in an |
|
2425 | 2436 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
2426 | 2437 | user or service running Mercurial. |
|
2427 | 2438 | |
|
2428 | 2439 | ``users`` |
|
2429 | 2440 | Comma-separated list of trusted users. |
|
2430 | 2441 | |
|
2431 | 2442 | ``groups`` |
|
2432 | 2443 | Comma-separated list of trusted groups. |
|
2433 | 2444 | |
|
2434 | 2445 | |
|
2435 | 2446 | ``ui`` |
|
2436 | 2447 | ------ |
|
2437 | 2448 | |
|
2438 | 2449 | User interface controls. |
|
2439 | 2450 | |
|
2440 | 2451 | ``archivemeta`` |
|
2441 | 2452 | Whether to include the .hg_archival.txt file containing meta data |
|
2442 | 2453 | (hashes for the repository base and for tip) in archives created |
|
2443 | 2454 | by the :hg:`archive` command or downloaded via hgweb. |
|
2444 | 2455 | (default: True) |
|
2445 | 2456 | |
|
2446 | 2457 | ``askusername`` |
|
2447 | 2458 | Whether to prompt for a username when committing. If True, and |
|
2448 | 2459 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
2449 | 2460 | be prompted to enter a username. If no username is entered, the |
|
2450 | 2461 | default ``USER@HOST`` is used instead. |
|
2451 | 2462 | (default: False) |
|
2452 | 2463 | |
|
2453 | 2464 | ``clonebundles`` |
|
2454 | 2465 | Whether the "clone bundles" feature is enabled. |
|
2455 | 2466 | |
|
2456 | 2467 | When enabled, :hg:`clone` may download and apply a server-advertised |
|
2457 | 2468 | bundle file from a URL instead of using the normal exchange mechanism. |
|
2458 | 2469 | |
|
2459 | 2470 | This can likely result in faster and more reliable clones. |
|
2460 | 2471 | |
|
2461 | 2472 | (default: True) |
|
2462 | 2473 | |
|
2463 | 2474 | ``clonebundlefallback`` |
|
2464 | 2475 | Whether failure to apply an advertised "clone bundle" from a server |
|
2465 | 2476 | should result in fallback to a regular clone. |
|
2466 | 2477 | |
|
2467 | 2478 | This is disabled by default because servers advertising "clone |
|
2468 | 2479 | bundles" often do so to reduce server load. If advertised bundles |
|
2469 | 2480 | start mass failing and clients automatically fall back to a regular |
|
2470 | 2481 | clone, this would add significant and unexpected load to the server |
|
2471 | 2482 | since the server is expecting clone operations to be offloaded to |
|
2472 | 2483 | pre-generated bundles. Failing fast (the default behavior) ensures |
|
2473 | 2484 | clients don't overwhelm the server when "clone bundle" application |
|
2474 | 2485 | fails. |
|
2475 | 2486 | |
|
2476 | 2487 | (default: False) |
|
2477 | 2488 | |
|
2478 | 2489 | ``clonebundleprefers`` |
|
2479 | 2490 | Defines preferences for which "clone bundles" to use. |
|
2480 | 2491 | |
|
2481 | 2492 | Servers advertising "clone bundles" may advertise multiple available |
|
2482 | 2493 | bundles. Each bundle may have different attributes, such as the bundle |
|
2483 | 2494 | type and compression format. This option is used to prefer a particular |
|
2484 | 2495 | bundle over another. |
|
2485 | 2496 | |
|
2486 | 2497 | The following keys are defined by Mercurial: |
|
2487 | 2498 | |
|
2488 | 2499 | BUNDLESPEC |
|
2489 | 2500 | A bundle type specifier. These are strings passed to :hg:`bundle -t`. |
|
2490 | 2501 | e.g. ``gzip-v2`` or ``bzip2-v1``. |
|
2491 | 2502 | |
|
2492 | 2503 | COMPRESSION |
|
2493 | 2504 | The compression format of the bundle. e.g. ``gzip`` and ``bzip2``. |
|
2494 | 2505 | |
|
2495 | 2506 | Server operators may define custom keys. |
|
2496 | 2507 | |
|
2497 | 2508 | Example values: ``COMPRESSION=bzip2``, |
|
2498 | 2509 | ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``. |
|
2499 | 2510 | |
|
2500 | 2511 | By default, the first bundle advertised by the server is used. |
|
2501 | 2512 | |
|
2502 | 2513 | ``color`` |
|
2503 | 2514 | When to colorize output. Possible value are Boolean ("yes" or "no"), or |
|
2504 | 2515 | "debug", or "always". (default: "yes"). "yes" will use color whenever it |
|
2505 | 2516 | seems possible. See :hg:`help color` for details. |
|
2506 | 2517 | |
|
2507 | 2518 | ``commitsubrepos`` |
|
2508 | 2519 | Whether to commit modified subrepositories when committing the |
|
2509 | 2520 | parent repository. If False and one subrepository has uncommitted |
|
2510 | 2521 | changes, abort the commit. |
|
2511 | 2522 | (default: False) |
|
2512 | 2523 | |
|
2513 | 2524 | ``debug`` |
|
2514 | 2525 | Print debugging information. (default: False) |
|
2515 | 2526 | |
|
2516 | 2527 | ``editor`` |
|
2517 | 2528 | The editor to use during a commit. (default: ``$EDITOR`` or ``vi``) |
|
2518 | 2529 | |
|
2519 | 2530 | ``fallbackencoding`` |
|
2520 | 2531 | Encoding to try if it's not possible to decode the changelog using |
|
2521 | 2532 | UTF-8. (default: ISO-8859-1) |
|
2522 | 2533 | |
|
2523 | 2534 | ``graphnodetemplate`` |
|
2524 | 2535 | (DEPRECATED) Use ``command-templates.graphnode`` instead. |
|
2525 | 2536 | |
|
2526 | 2537 | ``ignore`` |
|
2527 | 2538 | A file to read per-user ignore patterns from. This file should be |
|
2528 | 2539 | in the same format as a repository-wide .hgignore file. Filenames |
|
2529 | 2540 | are relative to the repository root. This option supports hook syntax, |
|
2530 | 2541 | so if you want to specify multiple ignore files, you can do so by |
|
2531 | 2542 | setting something like ``ignore.other = ~/.hgignore2``. For details |
|
2532 | 2543 | of the ignore file format, see the ``hgignore(5)`` man page. |
|
2533 | 2544 | |
|
2534 | 2545 | ``interactive`` |
|
2535 | 2546 | Allow to prompt the user. (default: True) |
|
2536 | 2547 | |
|
2537 | 2548 | ``interface`` |
|
2538 | 2549 | Select the default interface for interactive features (default: text). |
|
2539 | 2550 | Possible values are 'text' and 'curses'. |
|
2540 | 2551 | |
|
2541 | 2552 | ``interface.chunkselector`` |
|
2542 | 2553 | Select the interface for change recording (e.g. :hg:`commit -i`). |
|
2543 | 2554 | Possible values are 'text' and 'curses'. |
|
2544 | 2555 | This config overrides the interface specified by ui.interface. |
|
2545 | 2556 | |
|
2546 | 2557 | ``large-file-limit`` |
|
2547 | 2558 | Largest file size that gives no memory use warning. |
|
2548 | 2559 | Possible values are integers or 0 to disable the check. |
|
2549 | 2560 | (default: 10000000) |
|
2550 | 2561 | |
|
2551 | 2562 | ``logtemplate`` |
|
2552 | 2563 | (DEPRECATED) Use ``command-templates.log`` instead. |
|
2553 | 2564 | |
|
2554 | 2565 | ``merge`` |
|
2555 | 2566 | The conflict resolution program to use during a manual merge. |
|
2556 | 2567 | For more information on merge tools see :hg:`help merge-tools`. |
|
2557 | 2568 | For configuring merge tools see the ``[merge-tools]`` section. |
|
2558 | 2569 | |
|
2559 | 2570 | ``mergemarkers`` |
|
2560 | 2571 | Sets the merge conflict marker label styling. The ``detailed`` style |
|
2561 | 2572 | uses the ``command-templates.mergemarker`` setting to style the labels. |
|
2562 | 2573 | The ``basic`` style just uses 'local' and 'other' as the marker label. |
|
2563 | 2574 | One of ``basic`` or ``detailed``. |
|
2564 | 2575 | (default: ``basic``) |
|
2565 | 2576 | |
|
2566 | 2577 | ``mergemarkertemplate`` |
|
2567 | 2578 | (DEPRECATED) Use ``command-templates.mergemarker`` instead. |
|
2568 | 2579 | |
|
2569 | 2580 | ``message-output`` |
|
2570 | 2581 | Where to write status and error messages. (default: ``stdio``) |
|
2571 | 2582 | |
|
2572 | 2583 | ``channel`` |
|
2573 | 2584 | Use separate channel for structured output. (Command-server only) |
|
2574 | 2585 | ``stderr`` |
|
2575 | 2586 | Everything to stderr. |
|
2576 | 2587 | ``stdio`` |
|
2577 | 2588 | Status to stdout, and error to stderr. |
|
2578 | 2589 | |
|
2579 | 2590 | ``origbackuppath`` |
|
2580 | 2591 | The path to a directory used to store generated .orig files. If the path is |
|
2581 | 2592 | not a directory, one will be created. If set, files stored in this |
|
2582 | 2593 | directory have the same name as the original file and do not have a .orig |
|
2583 | 2594 | suffix. |
|
2584 | 2595 | |
|
2585 | 2596 | ``paginate`` |
|
2586 | 2597 | Control the pagination of command output (default: True). See :hg:`help pager` |
|
2587 | 2598 | for details. |
|
2588 | 2599 | |
|
2589 | 2600 | ``patch`` |
|
2590 | 2601 | An optional external tool that ``hg import`` and some extensions |
|
2591 | 2602 | will use for applying patches. By default Mercurial uses an |
|
2592 | 2603 | internal patch utility. The external tool must work as the common |
|
2593 | 2604 | Unix ``patch`` program. In particular, it must accept a ``-p`` |
|
2594 | 2605 | argument to strip patch headers, a ``-d`` argument to specify the |
|
2595 | 2606 | current directory, a file name to patch, and a patch file to take |
|
2596 | 2607 | from stdin. |
|
2597 | 2608 | |
|
2598 | 2609 | It is possible to specify a patch tool together with extra |
|
2599 | 2610 | arguments. For example, setting this option to ``patch --merge`` |
|
2600 | 2611 | will use the ``patch`` program with its 2-way merge option. |
|
2601 | 2612 | |
|
2602 | 2613 | ``portablefilenames`` |
|
2603 | 2614 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
2604 | 2615 | (default: ``warn``) |
|
2605 | 2616 | |
|
2606 | 2617 | ``warn`` |
|
2607 | 2618 | Print a warning message on POSIX platforms, if a file with a non-portable |
|
2608 | 2619 | filename is added (e.g. a file with a name that can't be created on |
|
2609 | 2620 | Windows because it contains reserved parts like ``AUX``, reserved |
|
2610 | 2621 | characters like ``:``, or would cause a case collision with an existing |
|
2611 | 2622 | file). |
|
2612 | 2623 | |
|
2613 | 2624 | ``ignore`` |
|
2614 | 2625 | Don't print a warning. |
|
2615 | 2626 | |
|
2616 | 2627 | ``abort`` |
|
2617 | 2628 | The command is aborted. |
|
2618 | 2629 | |
|
2619 | 2630 | ``true`` |
|
2620 | 2631 | Alias for ``warn``. |
|
2621 | 2632 | |
|
2622 | 2633 | ``false`` |
|
2623 | 2634 | Alias for ``ignore``. |
|
2624 | 2635 | |
|
2625 | 2636 | .. container:: windows |
|
2626 | 2637 | |
|
2627 | 2638 | On Windows, this configuration option is ignored and the command aborted. |
|
2628 | 2639 | |
|
2629 | 2640 | ``pre-merge-tool-output-template`` |
|
2630 | 2641 | (DEPRECATED) Use ``command-template.pre-merge-tool-output`` instead. |
|
2631 | 2642 | |
|
2632 | 2643 | ``quiet`` |
|
2633 | 2644 | Reduce the amount of output printed. |
|
2634 | 2645 | (default: False) |
|
2635 | 2646 | |
|
2636 | 2647 | ``relative-paths`` |
|
2637 | 2648 | Prefer relative paths in the UI. |
|
2638 | 2649 | |
|
2639 | 2650 | ``remotecmd`` |
|
2640 | 2651 | Remote command to use for clone/push/pull operations. |
|
2641 | 2652 | (default: ``hg``) |
|
2642 | 2653 | |
|
2643 | 2654 | ``report_untrusted`` |
|
2644 | 2655 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
2645 | 2656 | trusted user or group. |
|
2646 | 2657 | (default: True) |
|
2647 | 2658 | |
|
2648 | 2659 | ``slash`` |
|
2649 | 2660 | (Deprecated. Use ``slashpath`` template filter instead.) |
|
2650 | 2661 | |
|
2651 | 2662 | Display paths using a slash (``/``) as the path separator. This |
|
2652 | 2663 | only makes a difference on systems where the default path |
|
2653 | 2664 | separator is not the slash character (e.g. Windows uses the |
|
2654 | 2665 | backslash character (``\``)). |
|
2655 | 2666 | (default: False) |
|
2656 | 2667 | |
|
2657 | 2668 | ``statuscopies`` |
|
2658 | 2669 | Display copies in the status command. |
|
2659 | 2670 | |
|
2660 | 2671 | ``ssh`` |
|
2661 | 2672 | Command to use for SSH connections. (default: ``ssh``) |
|
2662 | 2673 | |
|
2663 | 2674 | ``ssherrorhint`` |
|
2664 | 2675 | A hint shown to the user in the case of SSH error (e.g. |
|
2665 | 2676 | ``Please see http://company/internalwiki/ssh.html``) |
|
2666 | 2677 | |
|
2667 | 2678 | ``strict`` |
|
2668 | 2679 | Require exact command names, instead of allowing unambiguous |
|
2669 | 2680 | abbreviations. (default: False) |
|
2670 | 2681 | |
|
2671 | 2682 | ``style`` |
|
2672 | 2683 | Name of style to use for command output. |
|
2673 | 2684 | |
|
2674 | 2685 | ``supportcontact`` |
|
2675 | 2686 | A URL where users should report a Mercurial traceback. Use this if you are a |
|
2676 | 2687 | large organisation with its own Mercurial deployment process and crash |
|
2677 | 2688 | reports should be addressed to your internal support. |
|
2678 | 2689 | |
|
2679 | 2690 | ``textwidth`` |
|
2680 | 2691 | Maximum width of help text. A longer line generated by ``hg help`` or |
|
2681 | 2692 | ``hg subcommand --help`` will be broken after white space to get this |
|
2682 | 2693 | width or the terminal width, whichever comes first. |
|
2683 | 2694 | A non-positive value will disable this and the terminal width will be |
|
2684 | 2695 | used. (default: 78) |
|
2685 | 2696 | |
|
2686 | 2697 | ``timeout`` |
|
2687 | 2698 | The timeout used when a lock is held (in seconds), a negative value |
|
2688 | 2699 | means no timeout. (default: 600) |
|
2689 | 2700 | |
|
2690 | 2701 | ``timeout.warn`` |
|
2691 | 2702 | Time (in seconds) before a warning is printed about held lock. A negative |
|
2692 | 2703 | value means no warning. (default: 0) |
|
2693 | 2704 | |
|
2694 | 2705 | ``traceback`` |
|
2695 | 2706 | Mercurial always prints a traceback when an unknown exception |
|
2696 | 2707 | occurs. Setting this to True will make Mercurial print a traceback |
|
2697 | 2708 | on all exceptions, even those recognized by Mercurial (such as |
|
2698 | 2709 | IOError or MemoryError). (default: False) |
|
2699 | 2710 | |
|
2700 | 2711 | ``tweakdefaults`` |
|
2701 | 2712 | |
|
2702 | 2713 | By default Mercurial's behavior changes very little from release |
|
2703 | 2714 | to release, but over time the recommended config settings |
|
2704 | 2715 | shift. Enable this config to opt in to get automatic tweaks to |
|
2705 | 2716 | Mercurial's behavior over time. This config setting will have no |
|
2706 | 2717 | effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does |
|
2707 | 2718 | not include ``tweakdefaults``. (default: False) |
|
2708 | 2719 | |
|
2709 | 2720 | It currently means:: |
|
2710 | 2721 | |
|
2711 | 2722 | .. tweakdefaultsmarker |
|
2712 | 2723 | |
|
2713 | 2724 | ``username`` |
|
2714 | 2725 | The committer of a changeset created when running "commit". |
|
2715 | 2726 | Typically a person's name and email address, e.g. ``Fred Widget |
|
2716 | 2727 | <fred@example.com>``. Environment variables in the |
|
2717 | 2728 | username are expanded. |
|
2718 | 2729 | |
|
2719 | 2730 | (default: ``$EMAIL`` or ``username@hostname``. If the username in |
|
2720 | 2731 | hgrc is empty, e.g. if the system admin set ``username =`` in the |
|
2721 | 2732 | system hgrc, it has to be specified manually or in a different |
|
2722 | 2733 | hgrc file) |
|
2723 | 2734 | |
|
2724 | 2735 | ``verbose`` |
|
2725 | 2736 | Increase the amount of output printed. (default: False) |
|
2726 | 2737 | |
|
2727 | 2738 | |
|
2728 | 2739 | ``command-templates`` |
|
2729 | 2740 | --------------------- |
|
2730 | 2741 | |
|
2731 | 2742 | Templates used for customizing the output of commands. |
|
2732 | 2743 | |
|
2733 | 2744 | ``graphnode`` |
|
2734 | 2745 | The template used to print changeset nodes in an ASCII revision graph. |
|
2735 | 2746 | (default: ``{graphnode}``) |
|
2736 | 2747 | |
|
2737 | 2748 | ``log`` |
|
2738 | 2749 | Template string for commands that print changesets. |
|
2739 | 2750 | |
|
2740 | 2751 | ``mergemarker`` |
|
2741 | 2752 | The template used to print the commit description next to each conflict |
|
2742 | 2753 | marker during merge conflicts. See :hg:`help templates` for the template |
|
2743 | 2754 | format. |
|
2744 | 2755 | |
|
2745 | 2756 | Defaults to showing the hash, tags, branches, bookmarks, author, and |
|
2746 | 2757 | the first line of the commit description. |
|
2747 | 2758 | |
|
2748 | 2759 | If you use non-ASCII characters in names for tags, branches, bookmarks, |
|
2749 | 2760 | authors, and/or commit descriptions, you must pay attention to encodings of |
|
2750 | 2761 | managed files. At template expansion, non-ASCII characters use the encoding |
|
2751 | 2762 | specified by the ``--encoding`` global option, ``HGENCODING`` or other |
|
2752 | 2763 | environment variables that govern your locale. If the encoding of the merge |
|
2753 | 2764 | markers is different from the encoding of the merged files, |
|
2754 | 2765 | serious problems may occur. |
|
2755 | 2766 | |
|
2756 | 2767 | Can be overridden per-merge-tool, see the ``[merge-tools]`` section. |
|
2757 | 2768 | |
|
2758 | 2769 | ``oneline-summary`` |
|
2759 | 2770 | A template used by `hg rebase` and other commands for showing a one-line |
|
2760 | 2771 | summary of a commit. If the template configured here is longer than one |
|
2761 | 2772 | line, then only the first line is used. |
|
2762 | 2773 | |
|
2763 | 2774 | The template can be overridden per command by defining a template in |
|
2764 | 2775 | `oneline-summary.<command>`, where `<command>` can be e.g. "rebase". |
|
2765 | 2776 | |
|
2766 | 2777 | ``pre-merge-tool-output`` |
|
2767 | 2778 | A template that is printed before executing an external merge tool. This can |
|
2768 | 2779 | be used to print out additional context that might be useful to have during |
|
2769 | 2780 | the conflict resolution, such as the description of the various commits |
|
2770 | 2781 | involved or bookmarks/tags. |
|
2771 | 2782 | |
|
2772 | 2783 | Additional information is available in the ``local`, ``base``, and ``other`` |
|
2773 | 2784 | dicts. For example: ``{local.label}``, ``{base.name}``, or |
|
2774 | 2785 | ``{other.islink}``. |
|
2775 | 2786 | |
|
2776 | 2787 | |
|
2777 | 2788 | ``web`` |
|
2778 | 2789 | ------- |
|
2779 | 2790 | |
|
2780 | 2791 | Web interface configuration. The settings in this section apply to |
|
2781 | 2792 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
2782 | 2793 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
2783 | 2794 | and WSGI). |
|
2784 | 2795 | |
|
2785 | 2796 | The Mercurial webserver does no authentication (it does not prompt for |
|
2786 | 2797 | usernames and passwords to validate *who* users are), but it does do |
|
2787 | 2798 | authorization (it grants or denies access for *authenticated users* |
|
2788 | 2799 | based on settings in this section). You must either configure your |
|
2789 | 2800 | webserver to do authentication for you, or disable the authorization |
|
2790 | 2801 | checks. |
|
2791 | 2802 | |
|
2792 | 2803 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
2793 | 2804 | you want it to accept pushes from anybody, you can use the following |
|
2794 | 2805 | command line:: |
|
2795 | 2806 | |
|
2796 | 2807 | $ hg --config web.allow-push=* --config web.push_ssl=False serve |
|
2797 | 2808 | |
|
2798 | 2809 | Note that this will allow anybody to push anything to the server and |
|
2799 | 2810 | that this should not be used for public servers. |
|
2800 | 2811 | |
|
2801 | 2812 | The full set of options is: |
|
2802 | 2813 | |
|
2803 | 2814 | ``accesslog`` |
|
2804 | 2815 | Where to output the access log. (default: stdout) |
|
2805 | 2816 | |
|
2806 | 2817 | ``address`` |
|
2807 | 2818 | Interface address to bind to. (default: all) |
|
2808 | 2819 | |
|
2809 | 2820 | ``allow-archive`` |
|
2810 | 2821 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
2811 | 2822 | (default: empty) |
|
2812 | 2823 | |
|
2813 | 2824 | ``allowbz2`` |
|
2814 | 2825 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
2815 | 2826 | revisions. |
|
2816 | 2827 | (default: False) |
|
2817 | 2828 | |
|
2818 | 2829 | ``allowgz`` |
|
2819 | 2830 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
2820 | 2831 | revisions. |
|
2821 | 2832 | (default: False) |
|
2822 | 2833 | |
|
2823 | 2834 | ``allow-pull`` |
|
2824 | 2835 | Whether to allow pulling from the repository. (default: True) |
|
2825 | 2836 | |
|
2826 | 2837 | ``allow-push`` |
|
2827 | 2838 | Whether to allow pushing to the repository. If empty or not set, |
|
2828 | 2839 | pushing is not allowed. If the special value ``*``, any remote |
|
2829 | 2840 | user can push, including unauthenticated users. Otherwise, the |
|
2830 | 2841 | remote user must have been authenticated, and the authenticated |
|
2831 | 2842 | user name must be present in this list. The contents of the |
|
2832 | 2843 | allow-push list are examined after the deny_push list. |
|
2833 | 2844 | |
|
2834 | 2845 | ``allow_read`` |
|
2835 | 2846 | If the user has not already been denied repository access due to |
|
2836 | 2847 | the contents of deny_read, this list determines whether to grant |
|
2837 | 2848 | repository access to the user. If this list is not empty, and the |
|
2838 | 2849 | user is unauthenticated or not present in the list, then access is |
|
2839 | 2850 | denied for the user. If the list is empty or not set, then access |
|
2840 | 2851 | is permitted to all users by default. Setting allow_read to the |
|
2841 | 2852 | special value ``*`` is equivalent to it not being set (i.e. access |
|
2842 | 2853 | is permitted to all users). The contents of the allow_read list are |
|
2843 | 2854 | examined after the deny_read list. |
|
2844 | 2855 | |
|
2845 | 2856 | ``allowzip`` |
|
2846 | 2857 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
2847 | 2858 | revisions. This feature creates temporary files. |
|
2848 | 2859 | (default: False) |
|
2849 | 2860 | |
|
2850 | 2861 | ``archivesubrepos`` |
|
2851 | 2862 | Whether to recurse into subrepositories when archiving. |
|
2852 | 2863 | (default: False) |
|
2853 | 2864 | |
|
2854 | 2865 | ``baseurl`` |
|
2855 | 2866 | Base URL to use when publishing URLs in other locations, so |
|
2856 | 2867 | third-party tools like email notification hooks can construct |
|
2857 | 2868 | URLs. Example: ``http://hgserver/repos/``. |
|
2858 | 2869 | |
|
2859 | 2870 | ``cacerts`` |
|
2860 | 2871 | Path to file containing a list of PEM encoded certificate |
|
2861 | 2872 | authority certificates. Environment variables and ``~user`` |
|
2862 | 2873 | constructs are expanded in the filename. If specified on the |
|
2863 | 2874 | client, then it will verify the identity of remote HTTPS servers |
|
2864 | 2875 | with these certificates. |
|
2865 | 2876 | |
|
2866 | 2877 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
2867 | 2878 | command line. |
|
2868 | 2879 | |
|
2869 | 2880 | You can use OpenSSL's CA certificate file if your platform has |
|
2870 | 2881 | one. On most Linux systems this will be |
|
2871 | 2882 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
2872 | 2883 | generate this file manually. The form must be as follows:: |
|
2873 | 2884 | |
|
2874 | 2885 | -----BEGIN CERTIFICATE----- |
|
2875 | 2886 | ... (certificate in base64 PEM encoding) ... |
|
2876 | 2887 | -----END CERTIFICATE----- |
|
2877 | 2888 | -----BEGIN CERTIFICATE----- |
|
2878 | 2889 | ... (certificate in base64 PEM encoding) ... |
|
2879 | 2890 | -----END CERTIFICATE----- |
|
2880 | 2891 | |
|
2881 | 2892 | ``cache`` |
|
2882 | 2893 | Whether to support caching in hgweb. (default: True) |
|
2883 | 2894 | |
|
2884 | 2895 | ``certificate`` |
|
2885 | 2896 | Certificate to use when running :hg:`serve`. |
|
2886 | 2897 | |
|
2887 | 2898 | ``collapse`` |
|
2888 | 2899 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
2889 | 2900 | a single level alongside repositories in the current path. With |
|
2890 | 2901 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
2891 | 2902 | the current path are grouped behind navigable directory entries that |
|
2892 | 2903 | lead to the locations of these repositories. In effect, this setting |
|
2893 | 2904 | collapses each collection of repositories found within a subdirectory |
|
2894 | 2905 | into a single entry for that subdirectory. (default: False) |
|
2895 | 2906 | |
|
2896 | 2907 | ``comparisoncontext`` |
|
2897 | 2908 | Number of lines of context to show in side-by-side file comparison. If |
|
2898 | 2909 | negative or the value ``full``, whole files are shown. (default: 5) |
|
2899 | 2910 | |
|
2900 | 2911 | This setting can be overridden by a ``context`` request parameter to the |
|
2901 | 2912 | ``comparison`` command, taking the same values. |
|
2902 | 2913 | |
|
2903 | 2914 | ``contact`` |
|
2904 | 2915 | Name or email address of the person in charge of the repository. |
|
2905 | 2916 | (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty) |
|
2906 | 2917 | |
|
2907 | 2918 | ``csp`` |
|
2908 | 2919 | Send a ``Content-Security-Policy`` HTTP header with this value. |
|
2909 | 2920 | |
|
2910 | 2921 | The value may contain a special string ``%nonce%``, which will be replaced |
|
2911 | 2922 | by a randomly-generated one-time use value. If the value contains |
|
2912 | 2923 | ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the |
|
2913 | 2924 | one-time property of the nonce. This nonce will also be inserted into |
|
2914 | 2925 | ``<script>`` elements containing inline JavaScript. |
|
2915 | 2926 | |
|
2916 | 2927 | Note: lots of HTML content sent by the server is derived from repository |
|
2917 | 2928 | data. Please consider the potential for malicious repository data to |
|
2918 | 2929 | "inject" itself into generated HTML content as part of your security |
|
2919 | 2930 | threat model. |
|
2920 | 2931 | |
|
2921 | 2932 | ``deny_push`` |
|
2922 | 2933 | Whether to deny pushing to the repository. If empty or not set, |
|
2923 | 2934 | push is not denied. If the special value ``*``, all remote users are |
|
2924 | 2935 | denied push. Otherwise, unauthenticated users are all denied, and |
|
2925 | 2936 | any authenticated user name present in this list is also denied. The |
|
2926 | 2937 | contents of the deny_push list are examined before the allow-push list. |
|
2927 | 2938 | |
|
2928 | 2939 | ``deny_read`` |
|
2929 | 2940 | Whether to deny reading/viewing of the repository. If this list is |
|
2930 | 2941 | not empty, unauthenticated users are all denied, and any |
|
2931 | 2942 | authenticated user name present in this list is also denied access to |
|
2932 | 2943 | the repository. If set to the special value ``*``, all remote users |
|
2933 | 2944 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
2934 | 2945 | the determination of repository access depends on the presence and |
|
2935 | 2946 | content of the allow_read list (see description). If both |
|
2936 | 2947 | deny_read and allow_read are empty or not set, then access is |
|
2937 | 2948 | permitted to all users by default. If the repository is being |
|
2938 | 2949 | served via hgwebdir, denied users will not be able to see it in |
|
2939 | 2950 | the list of repositories. The contents of the deny_read list have |
|
2940 | 2951 | priority over (are examined before) the contents of the allow_read |
|
2941 | 2952 | list. |
|
2942 | 2953 | |
|
2943 | 2954 | ``descend`` |
|
2944 | 2955 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
2945 | 2956 | directly in the current path will be shown (other repositories are still |
|
2946 | 2957 | available from the index corresponding to their containing path). |
|
2947 | 2958 | |
|
2948 | 2959 | ``description`` |
|
2949 | 2960 | Textual description of the repository's purpose or contents. |
|
2950 | 2961 | (default: "unknown") |
|
2951 | 2962 | |
|
2952 | 2963 | ``encoding`` |
|
2953 | 2964 | Character encoding name. (default: the current locale charset) |
|
2954 | 2965 | Example: "UTF-8". |
|
2955 | 2966 | |
|
2956 | 2967 | ``errorlog`` |
|
2957 | 2968 | Where to output the error log. (default: stderr) |
|
2958 | 2969 | |
|
2959 | 2970 | ``guessmime`` |
|
2960 | 2971 | Control MIME types for raw download of file content. |
|
2961 | 2972 | Set to True to let hgweb guess the content type from the file |
|
2962 | 2973 | extension. This will serve HTML files as ``text/html`` and might |
|
2963 | 2974 | allow cross-site scripting attacks when serving untrusted |
|
2964 | 2975 | repositories. (default: False) |
|
2965 | 2976 | |
|
2966 | 2977 | ``hidden`` |
|
2967 | 2978 | Whether to hide the repository in the hgwebdir index. |
|
2968 | 2979 | (default: False) |
|
2969 | 2980 | |
|
2970 | 2981 | ``ipv6`` |
|
2971 | 2982 | Whether to use IPv6. (default: False) |
|
2972 | 2983 | |
|
2973 | 2984 | ``labels`` |
|
2974 | 2985 | List of string *labels* associated with the repository. |
|
2975 | 2986 | |
|
2976 | 2987 | Labels are exposed as a template keyword and can be used to customize |
|
2977 | 2988 | output. e.g. the ``index`` template can group or filter repositories |
|
2978 | 2989 | by labels and the ``summary`` template can display additional content |
|
2979 | 2990 | if a specific label is present. |
|
2980 | 2991 | |
|
2981 | 2992 | ``logoimg`` |
|
2982 | 2993 | File name of the logo image that some templates display on each page. |
|
2983 | 2994 | The file name is relative to ``staticurl``. That is, the full path to |
|
2984 | 2995 | the logo image is "staticurl/logoimg". |
|
2985 | 2996 | If unset, ``hglogo.png`` will be used. |
|
2986 | 2997 | |
|
2987 | 2998 | ``logourl`` |
|
2988 | 2999 | Base URL to use for logos. If unset, ``https://mercurial-scm.org/`` |
|
2989 | 3000 | will be used. |
|
2990 | 3001 | |
|
2991 | 3002 | ``maxchanges`` |
|
2992 | 3003 | Maximum number of changes to list on the changelog. (default: 10) |
|
2993 | 3004 | |
|
2994 | 3005 | ``maxfiles`` |
|
2995 | 3006 | Maximum number of files to list per changeset. (default: 10) |
|
2996 | 3007 | |
|
2997 | 3008 | ``maxshortchanges`` |
|
2998 | 3009 | Maximum number of changes to list on the shortlog, graph or filelog |
|
2999 | 3010 | pages. (default: 60) |
|
3000 | 3011 | |
|
3001 | 3012 | ``name`` |
|
3002 | 3013 | Repository name to use in the web interface. |
|
3003 | 3014 | (default: current working directory) |
|
3004 | 3015 | |
|
3005 | 3016 | ``port`` |
|
3006 | 3017 | Port to listen on. (default: 8000) |
|
3007 | 3018 | |
|
3008 | 3019 | ``prefix`` |
|
3009 | 3020 | Prefix path to serve from. (default: '' (server root)) |
|
3010 | 3021 | |
|
3011 | 3022 | ``push_ssl`` |
|
3012 | 3023 | Whether to require that inbound pushes be transported over SSL to |
|
3013 | 3024 | prevent password sniffing. (default: True) |
|
3014 | 3025 | |
|
3015 | 3026 | ``refreshinterval`` |
|
3016 | 3027 | How frequently directory listings re-scan the filesystem for new |
|
3017 | 3028 | repositories, in seconds. This is relevant when wildcards are used |
|
3018 | 3029 | to define paths. Depending on how much filesystem traversal is |
|
3019 | 3030 | required, refreshing may negatively impact performance. |
|
3020 | 3031 | |
|
3021 | 3032 | Values less than or equal to 0 always refresh. |
|
3022 | 3033 | (default: 20) |
|
3023 | 3034 | |
|
3024 | 3035 | ``server-header`` |
|
3025 | 3036 | Value for HTTP ``Server`` response header. |
|
3026 | 3037 | |
|
3027 | 3038 | ``static`` |
|
3028 | 3039 | Directory where static files are served from. |
|
3029 | 3040 | |
|
3030 | 3041 | ``staticurl`` |
|
3031 | 3042 | Base URL to use for static files. If unset, static files (e.g. the |
|
3032 | 3043 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
3033 | 3044 | this setting to serve them directly with the HTTP server. |
|
3034 | 3045 | Example: ``http://hgserver/static/``. |
|
3035 | 3046 | |
|
3036 | 3047 | ``stripes`` |
|
3037 | 3048 | How many lines a "zebra stripe" should span in multi-line output. |
|
3038 | 3049 | Set to 0 to disable. (default: 1) |
|
3039 | 3050 | |
|
3040 | 3051 | ``style`` |
|
3041 | 3052 | Which template map style to use. The available options are the names of |
|
3042 | 3053 | subdirectories in the HTML templates path. (default: ``paper``) |
|
3043 | 3054 | Example: ``monoblue``. |
|
3044 | 3055 | |
|
3045 | 3056 | ``templates`` |
|
3046 | 3057 | Where to find the HTML templates. The default path to the HTML templates |
|
3047 | 3058 | can be obtained from ``hg debuginstall``. |
|
3048 | 3059 | |
|
3049 | 3060 | ``websub`` |
|
3050 | 3061 | ---------- |
|
3051 | 3062 | |
|
3052 | 3063 | Web substitution filter definition. You can use this section to |
|
3053 | 3064 | define a set of regular expression substitution patterns which |
|
3054 | 3065 | let you automatically modify the hgweb server output. |
|
3055 | 3066 | |
|
3056 | 3067 | The default hgweb templates only apply these substitution patterns |
|
3057 | 3068 | on the revision description fields. You can apply them anywhere |
|
3058 | 3069 | you want when you create your own templates by adding calls to the |
|
3059 | 3070 | "websub" filter (usually after calling the "escape" filter). |
|
3060 | 3071 | |
|
3061 | 3072 | This can be used, for example, to convert issue references to links |
|
3062 | 3073 | to your issue tracker, or to convert "markdown-like" syntax into |
|
3063 | 3074 | HTML (see the examples below). |
|
3064 | 3075 | |
|
3065 | 3076 | Each entry in this section names a substitution filter. |
|
3066 | 3077 | The value of each entry defines the substitution expression itself. |
|
3067 | 3078 | The websub expressions follow the old interhg extension syntax, |
|
3068 | 3079 | which in turn imitates the Unix sed replacement syntax:: |
|
3069 | 3080 | |
|
3070 | 3081 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] |
|
3071 | 3082 | |
|
3072 | 3083 | You can use any separator other than "/". The final "i" is optional |
|
3073 | 3084 | and indicates that the search must be case insensitive. |
|
3074 | 3085 | |
|
3075 | 3086 | Examples:: |
|
3076 | 3087 | |
|
3077 | 3088 | [websub] |
|
3078 | 3089 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i |
|
3079 | 3090 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ |
|
3080 | 3091 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ |
|
3081 | 3092 | |
|
3082 | 3093 | ``worker`` |
|
3083 | 3094 | ---------- |
|
3084 | 3095 | |
|
3085 | 3096 | Parallel master/worker configuration. We currently perform working |
|
3086 | 3097 | directory updates in parallel on Unix-like systems, which greatly |
|
3087 | 3098 | helps performance. |
|
3088 | 3099 | |
|
3089 | 3100 | ``enabled`` |
|
3090 | 3101 | Whether to enable workers code to be used. |
|
3091 | 3102 | (default: true) |
|
3092 | 3103 | |
|
3093 | 3104 | ``numcpus`` |
|
3094 | 3105 | Number of CPUs to use for parallel operations. A zero or |
|
3095 | 3106 | negative value is treated as ``use the default``. |
|
3096 | 3107 | (default: 4 or the number of CPUs on the system, whichever is larger) |
|
3097 | 3108 | |
|
3098 | 3109 | ``backgroundclose`` |
|
3099 | 3110 | Whether to enable closing file handles on background threads during certain |
|
3100 | 3111 | operations. Some platforms aren't very efficient at closing file |
|
3101 | 3112 | handles that have been written or appended to. By performing file closing |
|
3102 | 3113 | on background threads, file write rate can increase substantially. |
|
3103 | 3114 | (default: true on Windows, false elsewhere) |
|
3104 | 3115 | |
|
3105 | 3116 | ``backgroundcloseminfilecount`` |
|
3106 | 3117 | Minimum number of files required to trigger background file closing. |
|
3107 | 3118 | Operations not writing this many files won't start background close |
|
3108 | 3119 | threads. |
|
3109 | 3120 | (default: 2048) |
|
3110 | 3121 | |
|
3111 | 3122 | ``backgroundclosemaxqueue`` |
|
3112 | 3123 | The maximum number of opened file handles waiting to be closed in the |
|
3113 | 3124 | background. This option only has an effect if ``backgroundclose`` is |
|
3114 | 3125 | enabled. |
|
3115 | 3126 | (default: 384) |
|
3116 | 3127 | |
|
3117 | 3128 | ``backgroundclosethreadcount`` |
|
3118 | 3129 | Number of threads to process background file closes. Only relevant if |
|
3119 | 3130 | ``backgroundclose`` is enabled. |
|
3120 | 3131 | (default: 4) |
@@ -1,1946 +1,2037 b'' | |||
|
1 | 1 | Test basic extension support |
|
2 | 2 | $ cat > unflush.py <<EOF |
|
3 | 3 | > import sys |
|
4 | 4 | > from mercurial import pycompat |
|
5 | 5 | > if pycompat.ispy3: |
|
6 | 6 | > # no changes required |
|
7 | 7 | > sys.exit(0) |
|
8 | 8 | > with open(sys.argv[1], 'rb') as f: |
|
9 | 9 | > data = f.read() |
|
10 | 10 | > with open(sys.argv[1], 'wb') as f: |
|
11 | 11 | > f.write(data.replace(b', flush=True', b'')) |
|
12 | 12 | > EOF |
|
13 | 13 | |
|
14 | 14 | $ cat > foobar.py <<EOF |
|
15 | 15 | > import os |
|
16 | 16 | > from mercurial import commands, exthelper, registrar |
|
17 | 17 | > |
|
18 | 18 | > eh = exthelper.exthelper() |
|
19 | 19 | > eh.configitem(b'tests', b'foo', default=b"Foo") |
|
20 | 20 | > |
|
21 | 21 | > uisetup = eh.finaluisetup |
|
22 | 22 | > uipopulate = eh.finaluipopulate |
|
23 | 23 | > reposetup = eh.finalreposetup |
|
24 | 24 | > cmdtable = eh.cmdtable |
|
25 | 25 | > configtable = eh.configtable |
|
26 | 26 | > |
|
27 | 27 | > @eh.uisetup |
|
28 | 28 | > def _uisetup(ui): |
|
29 | 29 | > ui.debug(b"uisetup called [debug]\\n") |
|
30 | 30 | > ui.write(b"uisetup called\\n") |
|
31 | 31 | > ui.status(b"uisetup called [status]\\n") |
|
32 | 32 | > ui.flush() |
|
33 | 33 | > @eh.uipopulate |
|
34 | 34 | > def _uipopulate(ui): |
|
35 | 35 | > ui._populatecnt = getattr(ui, "_populatecnt", 0) + 1 |
|
36 | 36 | > ui.write(b"uipopulate called (%d times)\n" % ui._populatecnt) |
|
37 | 37 | > @eh.reposetup |
|
38 | 38 | > def _reposetup(ui, repo): |
|
39 | 39 | > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root)) |
|
40 | 40 | > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!")) |
|
41 | 41 | > ui.flush() |
|
42 | 42 | > @eh.command(b'foo', [], b'hg foo') |
|
43 | 43 | > def foo(ui, *args, **kwargs): |
|
44 | 44 | > foo = ui.config(b'tests', b'foo') |
|
45 | 45 | > ui.write(foo) |
|
46 | 46 | > ui.write(b"\\n") |
|
47 | 47 | > @eh.command(b'bar', [], b'hg bar', norepo=True) |
|
48 | 48 | > def bar(ui, *args, **kwargs): |
|
49 | 49 | > ui.write(b"Bar\\n") |
|
50 | 50 | > EOF |
|
51 | 51 | $ abspath=`pwd`/foobar.py |
|
52 | 52 | |
|
53 | 53 | $ mkdir barfoo |
|
54 | 54 | $ cp foobar.py barfoo/__init__.py |
|
55 | 55 | $ barfoopath=`pwd`/barfoo |
|
56 | 56 | |
|
57 | 57 | $ hg init a |
|
58 | 58 | $ cd a |
|
59 | 59 | $ echo foo > file |
|
60 | 60 | $ hg add file |
|
61 | 61 | $ hg commit -m 'add file' |
|
62 | 62 | |
|
63 | 63 | $ echo '[extensions]' >> $HGRCPATH |
|
64 | 64 | $ echo "foobar = $abspath" >> $HGRCPATH |
|
65 | 65 | $ hg foo |
|
66 | 66 | uisetup called |
|
67 | 67 | uisetup called [status] |
|
68 | 68 | uipopulate called (1 times) |
|
69 | 69 | uipopulate called (1 times) |
|
70 | 70 | uipopulate called (1 times) |
|
71 | 71 | reposetup called for a |
|
72 | 72 | ui == repo.ui |
|
73 | 73 | uipopulate called (1 times) (chg !) |
|
74 | 74 | uipopulate called (1 times) (chg !) |
|
75 | 75 | uipopulate called (1 times) (chg !) |
|
76 | 76 | uipopulate called (1 times) (chg !) |
|
77 | 77 | uipopulate called (1 times) (chg !) |
|
78 | 78 | reposetup called for a (chg !) |
|
79 | 79 | ui == repo.ui (chg !) |
|
80 | 80 | Foo |
|
81 | 81 | $ hg foo --quiet |
|
82 | 82 | uisetup called (no-chg !) |
|
83 | 83 | uipopulate called (1 times) |
|
84 | 84 | uipopulate called (1 times) |
|
85 | 85 | uipopulate called (1 times) (chg !) |
|
86 | 86 | uipopulate called (1 times) (chg !) |
|
87 | 87 | uipopulate called (1 times) |
|
88 | 88 | reposetup called for a |
|
89 | 89 | ui == repo.ui |
|
90 | 90 | Foo |
|
91 | 91 | $ hg foo --debug |
|
92 | 92 | uisetup called [debug] (no-chg !) |
|
93 | 93 | uisetup called (no-chg !) |
|
94 | 94 | uisetup called [status] (no-chg !) |
|
95 | 95 | uipopulate called (1 times) |
|
96 | 96 | uipopulate called (1 times) |
|
97 | 97 | uipopulate called (1 times) (chg !) |
|
98 | 98 | uipopulate called (1 times) (chg !) |
|
99 | 99 | uipopulate called (1 times) |
|
100 | 100 | reposetup called for a |
|
101 | 101 | ui == repo.ui |
|
102 | 102 | Foo |
|
103 | 103 | |
|
104 | 104 | $ cd .. |
|
105 | 105 | $ hg clone a b |
|
106 | 106 | uisetup called (no-chg !) |
|
107 | 107 | uisetup called [status] (no-chg !) |
|
108 | 108 | uipopulate called (1 times) |
|
109 | 109 | uipopulate called (1 times) (chg !) |
|
110 | 110 | uipopulate called (1 times) |
|
111 | 111 | reposetup called for a |
|
112 | 112 | ui == repo.ui |
|
113 | 113 | uipopulate called (1 times) |
|
114 | 114 | uipopulate called (1 times) |
|
115 | 115 | reposetup called for b |
|
116 | 116 | ui == repo.ui |
|
117 | 117 | updating to branch default |
|
118 | 118 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
119 | 119 | |
|
120 | 120 | $ hg bar |
|
121 | 121 | uisetup called (no-chg !) |
|
122 | 122 | uisetup called [status] (no-chg !) |
|
123 | 123 | uipopulate called (1 times) |
|
124 | 124 | uipopulate called (1 times) (chg !) |
|
125 | 125 | Bar |
|
126 | 126 | $ echo 'foobar = !' >> $HGRCPATH |
|
127 | 127 | |
|
128 | 128 | module/__init__.py-style |
|
129 | 129 | |
|
130 | 130 | $ echo "barfoo = $barfoopath" >> $HGRCPATH |
|
131 | 131 | $ cd a |
|
132 | 132 | $ hg foo |
|
133 | 133 | uisetup called |
|
134 | 134 | uisetup called [status] |
|
135 | 135 | uipopulate called (1 times) |
|
136 | 136 | uipopulate called (1 times) |
|
137 | 137 | uipopulate called (1 times) |
|
138 | 138 | reposetup called for a |
|
139 | 139 | ui == repo.ui |
|
140 | 140 | uipopulate called (1 times) (chg !) |
|
141 | 141 | uipopulate called (1 times) (chg !) |
|
142 | 142 | uipopulate called (1 times) (chg !) |
|
143 | 143 | uipopulate called (1 times) (chg !) |
|
144 | 144 | uipopulate called (1 times) (chg !) |
|
145 | 145 | reposetup called for a (chg !) |
|
146 | 146 | ui == repo.ui (chg !) |
|
147 | 147 | Foo |
|
148 | 148 | $ echo 'barfoo = !' >> $HGRCPATH |
|
149 | 149 | |
|
150 | 150 | Check that extensions are loaded in phases: |
|
151 | 151 | |
|
152 | 152 | $ cat > foo.py <<EOF |
|
153 | 153 | > from __future__ import print_function |
|
154 | 154 | > import os |
|
155 | 155 | > from mercurial import exthelper |
|
156 | 156 | > from mercurial.utils import procutil |
|
157 | 157 | > |
|
158 | 158 | > def write(msg): |
|
159 | 159 | > procutil.stdout.write(msg) |
|
160 | 160 | > procutil.stdout.flush() |
|
161 | 161 | > |
|
162 | 162 | > name = os.path.basename(__file__).rsplit('.', 1)[0] |
|
163 | 163 | > bytesname = name.encode('utf-8') |
|
164 | 164 | > write(b"1) %s imported\n" % bytesname) |
|
165 | 165 | > eh = exthelper.exthelper() |
|
166 | 166 | > @eh.uisetup |
|
167 | 167 | > def _uisetup(ui): |
|
168 | 168 | > write(b"2) %s uisetup\n" % bytesname) |
|
169 | 169 | > @eh.extsetup |
|
170 | 170 | > def _extsetup(ui): |
|
171 | 171 | > write(b"3) %s extsetup\n" % bytesname) |
|
172 | 172 | > @eh.uipopulate |
|
173 | 173 | > def _uipopulate(ui): |
|
174 | 174 | > write(b"4) %s uipopulate\n" % bytesname) |
|
175 | 175 | > @eh.reposetup |
|
176 | 176 | > def _reposetup(ui, repo): |
|
177 | 177 | > write(b"5) %s reposetup\n" % bytesname) |
|
178 | 178 | > |
|
179 | 179 | > extsetup = eh.finalextsetup |
|
180 | 180 | > reposetup = eh.finalreposetup |
|
181 | 181 | > uipopulate = eh.finaluipopulate |
|
182 | 182 | > uisetup = eh.finaluisetup |
|
183 | 183 | > revsetpredicate = eh.revsetpredicate |
|
184 | 184 | > |
|
185 | 185 | > # custom predicate to check registration of functions at loading |
|
186 | 186 | > from mercurial import ( |
|
187 | 187 | > smartset, |
|
188 | 188 | > ) |
|
189 | 189 | > @eh.revsetpredicate(bytesname, safe=True) # safe=True for query via hgweb |
|
190 | 190 | > def custompredicate(repo, subset, x): |
|
191 | 191 | > return smartset.baseset([r for r in subset if r in {0}]) |
|
192 | 192 | > EOF |
|
193 | 193 | $ "$PYTHON" $TESTTMP/unflush.py foo.py |
|
194 | 194 | |
|
195 | 195 | $ cp foo.py bar.py |
|
196 | 196 | $ echo 'foo = foo.py' >> $HGRCPATH |
|
197 | 197 | $ echo 'bar = bar.py' >> $HGRCPATH |
|
198 | 198 | |
|
199 | 199 | Check normal command's load order of extensions and registration of functions |
|
200 | 200 | |
|
201 | 201 | On chg server, extension should be first set up by the server. Then |
|
202 | 202 | object-level setup should follow in the worker process. |
|
203 | 203 | |
|
204 | 204 | $ hg log -r "foo() and bar()" -q |
|
205 | 205 | 1) foo imported |
|
206 | 206 | 1) bar imported |
|
207 | 207 | 2) foo uisetup |
|
208 | 208 | 2) bar uisetup |
|
209 | 209 | 3) foo extsetup |
|
210 | 210 | 3) bar extsetup |
|
211 | 211 | 4) foo uipopulate |
|
212 | 212 | 4) bar uipopulate |
|
213 | 213 | 4) foo uipopulate |
|
214 | 214 | 4) bar uipopulate |
|
215 | 215 | 4) foo uipopulate |
|
216 | 216 | 4) bar uipopulate |
|
217 | 217 | 5) foo reposetup |
|
218 | 218 | 5) bar reposetup |
|
219 | 219 | 4) foo uipopulate (chg !) |
|
220 | 220 | 4) bar uipopulate (chg !) |
|
221 | 221 | 4) foo uipopulate (chg !) |
|
222 | 222 | 4) bar uipopulate (chg !) |
|
223 | 223 | 4) foo uipopulate (chg !) |
|
224 | 224 | 4) bar uipopulate (chg !) |
|
225 | 225 | 4) foo uipopulate (chg !) |
|
226 | 226 | 4) bar uipopulate (chg !) |
|
227 | 227 | 4) foo uipopulate (chg !) |
|
228 | 228 | 4) bar uipopulate (chg !) |
|
229 | 229 | 5) foo reposetup (chg !) |
|
230 | 230 | 5) bar reposetup (chg !) |
|
231 | 231 | 0:c24b9ac61126 |
|
232 | 232 | |
|
233 | 233 | Check hgweb's load order of extensions and registration of functions |
|
234 | 234 | |
|
235 | 235 | $ cat > hgweb.cgi <<EOF |
|
236 | 236 | > #!$PYTHON |
|
237 | 237 | > from mercurial import demandimport; demandimport.enable() |
|
238 | 238 | > from mercurial.hgweb import hgweb |
|
239 | 239 | > from mercurial.hgweb import wsgicgi |
|
240 | 240 | > application = hgweb(b'.', b'test repo') |
|
241 | 241 | > wsgicgi.launch(application) |
|
242 | 242 | > EOF |
|
243 | 243 | $ . "$TESTDIR/cgienv" |
|
244 | 244 | |
|
245 | 245 | $ PATH_INFO='/' SCRIPT_NAME='' "$PYTHON" hgweb.cgi \ |
|
246 | 246 | > | grep '^[0-9]) ' # ignores HTML output |
|
247 | 247 | 1) foo imported |
|
248 | 248 | 1) bar imported |
|
249 | 249 | 2) foo uisetup |
|
250 | 250 | 2) bar uisetup |
|
251 | 251 | 3) foo extsetup |
|
252 | 252 | 3) bar extsetup |
|
253 | 253 | 4) foo uipopulate |
|
254 | 254 | 4) bar uipopulate |
|
255 | 255 | 4) foo uipopulate |
|
256 | 256 | 4) bar uipopulate |
|
257 | 257 | 5) foo reposetup |
|
258 | 258 | 5) bar reposetup |
|
259 | 259 | |
|
260 | 260 | (check that revset predicate foo() and bar() are available) |
|
261 | 261 | |
|
262 | 262 | #if msys |
|
263 | 263 | $ PATH_INFO='//shortlog' |
|
264 | 264 | #else |
|
265 | 265 | $ PATH_INFO='/shortlog' |
|
266 | 266 | #endif |
|
267 | 267 | $ export PATH_INFO |
|
268 | 268 | $ SCRIPT_NAME='' QUERY_STRING='rev=foo() and bar()' "$PYTHON" hgweb.cgi \ |
|
269 | 269 | > | grep '<a href="/rev/[0-9a-z]*">' |
|
270 | 270 | <a href="/rev/c24b9ac61126">add file</a> |
|
271 | 271 | |
|
272 | 272 | $ echo 'foo = !' >> $HGRCPATH |
|
273 | 273 | $ echo 'bar = !' >> $HGRCPATH |
|
274 | 274 | |
|
275 | 275 | Check "from __future__ import absolute_import" support for external libraries |
|
276 | 276 | |
|
277 | 277 | (import-checker.py reports issues for some of heredoc python code |
|
278 | 278 | fragments below, because import-checker.py does not know test specific |
|
279 | 279 | package hierarchy. NO_CHECK_* should be used as a limit mark of |
|
280 | 280 | heredoc, in order to make import-checker.py ignore them. For |
|
281 | 281 | simplicity, all python code fragments below are generated with such |
|
282 | 282 | limit mark, regardless of importing module or not.) |
|
283 | 283 | |
|
284 | 284 | #if windows |
|
285 | 285 | $ PATHSEP=";" |
|
286 | 286 | #else |
|
287 | 287 | $ PATHSEP=":" |
|
288 | 288 | #endif |
|
289 | 289 | $ export PATHSEP |
|
290 | 290 | |
|
291 | 291 | $ mkdir $TESTTMP/libroot |
|
292 | 292 | $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py |
|
293 | 293 | $ mkdir $TESTTMP/libroot/mod |
|
294 | 294 | $ touch $TESTTMP/libroot/mod/__init__.py |
|
295 | 295 | $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py |
|
296 | 296 | |
|
297 | 297 | $ cat > $TESTTMP/libroot/mod/ambigabs.py <<NO_CHECK_EOF |
|
298 | 298 | > from __future__ import absolute_import, print_function |
|
299 | 299 | > import ambig # should load "libroot/ambig.py" |
|
300 | 300 | > s = ambig.s |
|
301 | 301 | > NO_CHECK_EOF |
|
302 | 302 | $ cat > loadabs.py <<NO_CHECK_EOF |
|
303 | 303 | > import mod.ambigabs as ambigabs |
|
304 | 304 | > def extsetup(ui): |
|
305 | 305 | > print('ambigabs.s=%s' % ambigabs.s, flush=True) |
|
306 | 306 | > NO_CHECK_EOF |
|
307 | 307 | $ "$PYTHON" $TESTTMP/unflush.py loadabs.py |
|
308 | 308 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root) |
|
309 | 309 | ambigabs.s=libroot/ambig.py |
|
310 | 310 | $TESTTMP/a |
|
311 | 311 | |
|
312 | 312 | #if no-py3 |
|
313 | 313 | $ cat > $TESTTMP/libroot/mod/ambigrel.py <<NO_CHECK_EOF |
|
314 | 314 | > from __future__ import print_function |
|
315 | 315 | > import ambig # should load "libroot/mod/ambig.py" |
|
316 | 316 | > s = ambig.s |
|
317 | 317 | > NO_CHECK_EOF |
|
318 | 318 | $ cat > loadrel.py <<NO_CHECK_EOF |
|
319 | 319 | > import mod.ambigrel as ambigrel |
|
320 | 320 | > def extsetup(ui): |
|
321 | 321 | > print('ambigrel.s=%s' % ambigrel.s, flush=True) |
|
322 | 322 | > NO_CHECK_EOF |
|
323 | 323 | $ "$PYTHON" $TESTTMP/unflush.py loadrel.py |
|
324 | 324 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root) |
|
325 | 325 | ambigrel.s=libroot/mod/ambig.py |
|
326 | 326 | $TESTTMP/a |
|
327 | 327 | #endif |
|
328 | 328 | |
|
329 | 329 | Check absolute/relative import of extension specific modules |
|
330 | 330 | |
|
331 | 331 | $ mkdir $TESTTMP/extroot |
|
332 | 332 | $ cat > $TESTTMP/extroot/bar.py <<NO_CHECK_EOF |
|
333 | 333 | > s = b'this is extroot.bar' |
|
334 | 334 | > NO_CHECK_EOF |
|
335 | 335 | $ mkdir $TESTTMP/extroot/sub1 |
|
336 | 336 | $ cat > $TESTTMP/extroot/sub1/__init__.py <<NO_CHECK_EOF |
|
337 | 337 | > s = b'this is extroot.sub1.__init__' |
|
338 | 338 | > NO_CHECK_EOF |
|
339 | 339 | $ cat > $TESTTMP/extroot/sub1/baz.py <<NO_CHECK_EOF |
|
340 | 340 | > s = b'this is extroot.sub1.baz' |
|
341 | 341 | > NO_CHECK_EOF |
|
342 | 342 | $ cat > $TESTTMP/extroot/__init__.py <<NO_CHECK_EOF |
|
343 | 343 | > from __future__ import absolute_import |
|
344 | 344 | > s = b'this is extroot.__init__' |
|
345 | 345 | > from . import foo |
|
346 | 346 | > def extsetup(ui): |
|
347 | 347 | > ui.write(b'(extroot) ', foo.func(), b'\n') |
|
348 | 348 | > ui.flush() |
|
349 | 349 | > NO_CHECK_EOF |
|
350 | 350 | |
|
351 | 351 | $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF |
|
352 | 352 | > # test absolute import |
|
353 | 353 | > buf = [] |
|
354 | 354 | > def func(): |
|
355 | 355 | > # "not locals" case |
|
356 | 356 | > import extroot.bar |
|
357 | 357 | > buf.append(b'import extroot.bar in func(): %s' % extroot.bar.s) |
|
358 | 358 | > return b'\n(extroot) '.join(buf) |
|
359 | 359 | > # b"fromlist == ('*',)" case |
|
360 | 360 | > from extroot.bar import * |
|
361 | 361 | > buf.append(b'from extroot.bar import *: %s' % s) |
|
362 | 362 | > # "not fromlist" and "if '.' in name" case |
|
363 | 363 | > import extroot.sub1.baz |
|
364 | 364 | > buf.append(b'import extroot.sub1.baz: %s' % extroot.sub1.baz.s) |
|
365 | 365 | > # "not fromlist" and NOT "if '.' in name" case |
|
366 | 366 | > import extroot |
|
367 | 367 | > buf.append(b'import extroot: %s' % extroot.s) |
|
368 | 368 | > # NOT "not fromlist" and NOT "level != -1" case |
|
369 | 369 | > from extroot.bar import s |
|
370 | 370 | > buf.append(b'from extroot.bar import s: %s' % s) |
|
371 | 371 | > NO_CHECK_EOF |
|
372 | 372 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root) |
|
373 | 373 | (extroot) from extroot.bar import *: this is extroot.bar |
|
374 | 374 | (extroot) import extroot.sub1.baz: this is extroot.sub1.baz |
|
375 | 375 | (extroot) import extroot: this is extroot.__init__ |
|
376 | 376 | (extroot) from extroot.bar import s: this is extroot.bar |
|
377 | 377 | (extroot) import extroot.bar in func(): this is extroot.bar |
|
378 | 378 | $TESTTMP/a |
|
379 | 379 | |
|
380 | 380 | #if no-py3 |
|
381 | 381 | $ rm "$TESTTMP"/extroot/foo.* |
|
382 | 382 | $ rm -Rf "$TESTTMP/extroot/__pycache__" |
|
383 | 383 | $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF |
|
384 | 384 | > # test relative import |
|
385 | 385 | > buf = [] |
|
386 | 386 | > def func(): |
|
387 | 387 | > # "not locals" case |
|
388 | 388 | > import bar |
|
389 | 389 | > buf.append('import bar in func(): %s' % bar.s) |
|
390 | 390 | > return '\n(extroot) '.join(buf) |
|
391 | 391 | > # "fromlist == ('*',)" case |
|
392 | 392 | > from bar import * |
|
393 | 393 | > buf.append('from bar import *: %s' % s) |
|
394 | 394 | > # "not fromlist" and "if '.' in name" case |
|
395 | 395 | > import sub1.baz |
|
396 | 396 | > buf.append('import sub1.baz: %s' % sub1.baz.s) |
|
397 | 397 | > # "not fromlist" and NOT "if '.' in name" case |
|
398 | 398 | > import sub1 |
|
399 | 399 | > buf.append('import sub1: %s' % sub1.s) |
|
400 | 400 | > # NOT "not fromlist" and NOT "level != -1" case |
|
401 | 401 | > from bar import s |
|
402 | 402 | > buf.append('from bar import s: %s' % s) |
|
403 | 403 | > NO_CHECK_EOF |
|
404 | 404 | $ hg --config extensions.extroot=$TESTTMP/extroot root |
|
405 | 405 | (extroot) from bar import *: this is extroot.bar |
|
406 | 406 | (extroot) import sub1.baz: this is extroot.sub1.baz |
|
407 | 407 | (extroot) import sub1: this is extroot.sub1.__init__ |
|
408 | 408 | (extroot) from bar import s: this is extroot.bar |
|
409 | 409 | (extroot) import bar in func(): this is extroot.bar |
|
410 | 410 | $TESTTMP/a |
|
411 | 411 | #endif |
|
412 | 412 | |
|
413 | 413 | #if demandimport |
|
414 | 414 | |
|
415 | 415 | Examine whether module loading is delayed until actual referring, even |
|
416 | 416 | though module is imported with "absolute_import" feature. |
|
417 | 417 | |
|
418 | 418 | Files below in each packages are used for described purpose: |
|
419 | 419 | |
|
420 | 420 | - "called": examine whether "from MODULE import ATTR" works correctly |
|
421 | 421 | - "unused": examine whether loading is delayed correctly |
|
422 | 422 | - "used": examine whether "from PACKAGE import MODULE" works correctly |
|
423 | 423 | |
|
424 | 424 | Package hierarchy is needed to examine whether demand importing works |
|
425 | 425 | as expected for "from SUB.PACK.AGE import MODULE". |
|
426 | 426 | |
|
427 | 427 | Setup "external library" to be imported with "absolute_import" |
|
428 | 428 | feature. |
|
429 | 429 | |
|
430 | 430 | $ mkdir -p $TESTTMP/extlibroot/lsub1/lsub2 |
|
431 | 431 | $ touch $TESTTMP/extlibroot/__init__.py |
|
432 | 432 | $ touch $TESTTMP/extlibroot/lsub1/__init__.py |
|
433 | 433 | $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py |
|
434 | 434 | |
|
435 | 435 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<NO_CHECK_EOF |
|
436 | 436 | > def func(): |
|
437 | 437 | > return b"this is extlibroot.lsub1.lsub2.called.func()" |
|
438 | 438 | > NO_CHECK_EOF |
|
439 | 439 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<NO_CHECK_EOF |
|
440 | 440 | > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally") |
|
441 | 441 | > NO_CHECK_EOF |
|
442 | 442 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<NO_CHECK_EOF |
|
443 | 443 | > detail = b"this is extlibroot.lsub1.lsub2.used" |
|
444 | 444 | > NO_CHECK_EOF |
|
445 | 445 | |
|
446 | 446 | Setup sub-package of "external library", which causes instantiation of |
|
447 | 447 | demandmod in "recurse down the module chain" code path. Relative |
|
448 | 448 | importing with "absolute_import" feature isn't tested, because "level |
|
449 | 449 | >=1 " doesn't cause instantiation of demandmod. |
|
450 | 450 | |
|
451 | 451 | $ mkdir -p $TESTTMP/extlibroot/recursedown/abs |
|
452 | 452 | $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<NO_CHECK_EOF |
|
453 | 453 | > detail = b"this is extlibroot.recursedown.abs.used" |
|
454 | 454 | > NO_CHECK_EOF |
|
455 | 455 | $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<NO_CHECK_EOF |
|
456 | 456 | > from __future__ import absolute_import |
|
457 | 457 | > from extlibroot.recursedown.abs.used import detail |
|
458 | 458 | > NO_CHECK_EOF |
|
459 | 459 | |
|
460 | 460 | $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy |
|
461 | 461 | $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<NO_CHECK_EOF |
|
462 | 462 | > detail = b"this is extlibroot.recursedown.legacy.used" |
|
463 | 463 | > NO_CHECK_EOF |
|
464 | 464 | $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<NO_CHECK_EOF |
|
465 | 465 | > # legacy style (level == -1) import |
|
466 | 466 | > from extlibroot.recursedown.legacy.used import detail |
|
467 | 467 | > NO_CHECK_EOF |
|
468 | 468 | |
|
469 | 469 | $ cat > $TESTTMP/extlibroot/recursedown/__init__.py <<NO_CHECK_EOF |
|
470 | 470 | > from __future__ import absolute_import |
|
471 | 471 | > from extlibroot.recursedown.abs import detail as absdetail |
|
472 | 472 | > from .legacy import detail as legacydetail |
|
473 | 473 | > NO_CHECK_EOF |
|
474 | 474 | |
|
475 | 475 | Setup package that re-exports an attribute of its submodule as the same |
|
476 | 476 | name. This leaves 'shadowing.used' pointing to 'used.detail', but still |
|
477 | 477 | the submodule 'used' should be somehow accessible. (issue5617) |
|
478 | 478 | |
|
479 | 479 | $ mkdir -p $TESTTMP/extlibroot/shadowing |
|
480 | 480 | $ cat > $TESTTMP/extlibroot/shadowing/used.py <<NO_CHECK_EOF |
|
481 | 481 | > detail = b"this is extlibroot.shadowing.used" |
|
482 | 482 | > NO_CHECK_EOF |
|
483 | 483 | $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<NO_CHECK_EOF |
|
484 | 484 | > from __future__ import absolute_import |
|
485 | 485 | > from extlibroot.shadowing.used import detail |
|
486 | 486 | > NO_CHECK_EOF |
|
487 | 487 | $ cat > $TESTTMP/extlibroot/shadowing/__init__.py <<NO_CHECK_EOF |
|
488 | 488 | > from __future__ import absolute_import |
|
489 | 489 | > from .used import detail as used |
|
490 | 490 | > NO_CHECK_EOF |
|
491 | 491 | |
|
492 | 492 | Setup extension local modules to be imported with "absolute_import" |
|
493 | 493 | feature. |
|
494 | 494 | |
|
495 | 495 | $ mkdir -p $TESTTMP/absextroot/xsub1/xsub2 |
|
496 | 496 | $ touch $TESTTMP/absextroot/xsub1/__init__.py |
|
497 | 497 | $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py |
|
498 | 498 | |
|
499 | 499 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<NO_CHECK_EOF |
|
500 | 500 | > def func(): |
|
501 | 501 | > return b"this is absextroot.xsub1.xsub2.called.func()" |
|
502 | 502 | > NO_CHECK_EOF |
|
503 | 503 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<NO_CHECK_EOF |
|
504 | 504 | > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally") |
|
505 | 505 | > NO_CHECK_EOF |
|
506 | 506 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<NO_CHECK_EOF |
|
507 | 507 | > detail = b"this is absextroot.xsub1.xsub2.used" |
|
508 | 508 | > NO_CHECK_EOF |
|
509 | 509 | |
|
510 | 510 | Setup extension local modules to examine whether demand importing |
|
511 | 511 | works as expected in "level > 1" case. |
|
512 | 512 | |
|
513 | 513 | $ cat > $TESTTMP/absextroot/relimportee.py <<NO_CHECK_EOF |
|
514 | 514 | > detail = b"this is absextroot.relimportee" |
|
515 | 515 | > NO_CHECK_EOF |
|
516 | 516 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<NO_CHECK_EOF |
|
517 | 517 | > from __future__ import absolute_import |
|
518 | 518 | > from mercurial import pycompat |
|
519 | 519 | > from ... import relimportee |
|
520 | 520 | > detail = b"this relimporter imports %r" % ( |
|
521 | 521 | > pycompat.bytestr(relimportee.detail)) |
|
522 | 522 | > NO_CHECK_EOF |
|
523 | 523 | |
|
524 | 524 | Setup modules, which actually import extension local modules at |
|
525 | 525 | runtime. |
|
526 | 526 | |
|
527 | 527 | $ cat > $TESTTMP/absextroot/absolute.py << NO_CHECK_EOF |
|
528 | 528 | > from __future__ import absolute_import |
|
529 | 529 | > |
|
530 | 530 | > # import extension local modules absolutely (level = 0) |
|
531 | 531 | > from absextroot.xsub1.xsub2 import used, unused |
|
532 | 532 | > from absextroot.xsub1.xsub2.called import func |
|
533 | 533 | > |
|
534 | 534 | > def getresult(): |
|
535 | 535 | > result = [] |
|
536 | 536 | > result.append(used.detail) |
|
537 | 537 | > result.append(func()) |
|
538 | 538 | > return result |
|
539 | 539 | > NO_CHECK_EOF |
|
540 | 540 | |
|
541 | 541 | $ cat > $TESTTMP/absextroot/relative.py << NO_CHECK_EOF |
|
542 | 542 | > from __future__ import absolute_import |
|
543 | 543 | > |
|
544 | 544 | > # import extension local modules relatively (level == 1) |
|
545 | 545 | > from .xsub1.xsub2 import used, unused |
|
546 | 546 | > from .xsub1.xsub2.called import func |
|
547 | 547 | > |
|
548 | 548 | > # import a module, which implies "importing with level > 1" |
|
549 | 549 | > from .xsub1.xsub2 import relimporter |
|
550 | 550 | > |
|
551 | 551 | > def getresult(): |
|
552 | 552 | > result = [] |
|
553 | 553 | > result.append(used.detail) |
|
554 | 554 | > result.append(func()) |
|
555 | 555 | > result.append(relimporter.detail) |
|
556 | 556 | > return result |
|
557 | 557 | > NO_CHECK_EOF |
|
558 | 558 | |
|
559 | 559 | Setup main procedure of extension. |
|
560 | 560 | |
|
561 | 561 | $ cat > $TESTTMP/absextroot/__init__.py <<NO_CHECK_EOF |
|
562 | 562 | > from __future__ import absolute_import |
|
563 | 563 | > from mercurial import registrar |
|
564 | 564 | > cmdtable = {} |
|
565 | 565 | > command = registrar.command(cmdtable) |
|
566 | 566 | > |
|
567 | 567 | > # "absolute" and "relative" shouldn't be imported before actual |
|
568 | 568 | > # command execution, because (1) they import same modules, and (2) |
|
569 | 569 | > # preceding import (= instantiate "demandmod" object instead of |
|
570 | 570 | > # real "module" object) might hide problem of succeeding import. |
|
571 | 571 | > |
|
572 | 572 | > @command(b'showabsolute', [], norepo=True) |
|
573 | 573 | > def showabsolute(ui, *args, **opts): |
|
574 | 574 | > from absextroot import absolute |
|
575 | 575 | > ui.write(b'ABS: %s\n' % b'\nABS: '.join(absolute.getresult())) |
|
576 | 576 | > |
|
577 | 577 | > @command(b'showrelative', [], norepo=True) |
|
578 | 578 | > def showrelative(ui, *args, **opts): |
|
579 | 579 | > from . import relative |
|
580 | 580 | > ui.write(b'REL: %s\n' % b'\nREL: '.join(relative.getresult())) |
|
581 | 581 | > |
|
582 | 582 | > # import modules from external library |
|
583 | 583 | > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused |
|
584 | 584 | > from extlibroot.lsub1.lsub2.called import func as lfunc |
|
585 | 585 | > from extlibroot.recursedown import absdetail, legacydetail |
|
586 | 586 | > from extlibroot.shadowing import proxied |
|
587 | 587 | > |
|
588 | 588 | > def uisetup(ui): |
|
589 | 589 | > result = [] |
|
590 | 590 | > result.append(lused.detail) |
|
591 | 591 | > result.append(lfunc()) |
|
592 | 592 | > result.append(absdetail) |
|
593 | 593 | > result.append(legacydetail) |
|
594 | 594 | > result.append(proxied.detail) |
|
595 | 595 | > ui.write(b'LIB: %s\n' % b'\nLIB: '.join(result)) |
|
596 | 596 | > NO_CHECK_EOF |
|
597 | 597 | |
|
598 | 598 | Examine module importing. |
|
599 | 599 | |
|
600 | 600 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute) |
|
601 | 601 | LIB: this is extlibroot.lsub1.lsub2.used |
|
602 | 602 | LIB: this is extlibroot.lsub1.lsub2.called.func() |
|
603 | 603 | LIB: this is extlibroot.recursedown.abs.used |
|
604 | 604 | LIB: this is extlibroot.recursedown.legacy.used |
|
605 | 605 | LIB: this is extlibroot.shadowing.used |
|
606 | 606 | ABS: this is absextroot.xsub1.xsub2.used |
|
607 | 607 | ABS: this is absextroot.xsub1.xsub2.called.func() |
|
608 | 608 | |
|
609 | 609 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative) |
|
610 | 610 | LIB: this is extlibroot.lsub1.lsub2.used |
|
611 | 611 | LIB: this is extlibroot.lsub1.lsub2.called.func() |
|
612 | 612 | LIB: this is extlibroot.recursedown.abs.used |
|
613 | 613 | LIB: this is extlibroot.recursedown.legacy.used |
|
614 | 614 | LIB: this is extlibroot.shadowing.used |
|
615 | 615 | REL: this is absextroot.xsub1.xsub2.used |
|
616 | 616 | REL: this is absextroot.xsub1.xsub2.called.func() |
|
617 | 617 | REL: this relimporter imports 'this is absextroot.relimportee' |
|
618 | 618 | |
|
619 | 619 | Examine whether sub-module is imported relatively as expected. |
|
620 | 620 | |
|
621 | 621 | See also issue5208 for detail about example case on Python 3.x. |
|
622 | 622 | |
|
623 | 623 | $ f -q $TESTTMP/extlibroot/lsub1/lsub2/notexist.py |
|
624 | 624 | $TESTTMP/extlibroot/lsub1/lsub2/notexist.py: file not found |
|
625 | 625 | |
|
626 | 626 | $ cat > $TESTTMP/notexist.py <<NO_CHECK_EOF |
|
627 | 627 | > text = 'notexist.py at root is loaded unintentionally\n' |
|
628 | 628 | > NO_CHECK_EOF |
|
629 | 629 | |
|
630 | 630 | $ cat > $TESTTMP/checkrelativity.py <<NO_CHECK_EOF |
|
631 | 631 | > from mercurial import registrar |
|
632 | 632 | > cmdtable = {} |
|
633 | 633 | > command = registrar.command(cmdtable) |
|
634 | 634 | > |
|
635 | 635 | > # demand import avoids failure of importing notexist here, but only on |
|
636 | 636 | > # Python 2. |
|
637 | 637 | > import extlibroot.lsub1.lsub2.notexist |
|
638 | 638 | > |
|
639 | 639 | > @command(b'checkrelativity', [], norepo=True) |
|
640 | 640 | > def checkrelativity(ui, *args, **opts): |
|
641 | 641 | > try: |
|
642 | 642 | > ui.write(extlibroot.lsub1.lsub2.notexist.text) |
|
643 | 643 | > return 1 # unintentional success |
|
644 | 644 | > except ImportError: |
|
645 | 645 | > pass # intentional failure |
|
646 | 646 | > NO_CHECK_EOF |
|
647 | 647 | |
|
648 | 648 | Python 3's lazy importer verifies modules exist before returning the lazy |
|
649 | 649 | module stub. Our custom lazy importer for Python 2 always returns a stub. |
|
650 | 650 | |
|
651 | 651 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity) || true |
|
652 | 652 | *** failed to import extension "checkrelativity" from $TESTTMP/checkrelativity.py: No module named 'extlibroot.lsub1.lsub2.notexist' |
|
653 | 653 | hg: unknown command 'checkrelativity' (py3 !) |
|
654 | 654 | (use 'hg help' for a list of commands) (py3 !) |
|
655 | 655 | |
|
656 | 656 | #endif |
|
657 | 657 | |
|
658 | 658 | (Here, module importing tests are finished. Therefore, use other than |
|
659 | 659 | NO_CHECK_* limit mark for heredoc python files, in order to apply |
|
660 | 660 | import-checker.py or so on their contents) |
|
661 | 661 | |
|
662 | 662 | Make sure a broken uisetup doesn't globally break hg: |
|
663 | 663 | $ cat > $TESTTMP/baduisetup.py <<EOF |
|
664 | 664 | > def uisetup(ui): |
|
665 | 665 | > 1 / 0 |
|
666 | 666 | > EOF |
|
667 | 667 | |
|
668 | 668 | Even though the extension fails during uisetup, hg is still basically usable: |
|
669 | 669 | $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version |
|
670 | 670 | Traceback (most recent call last): |
|
671 | 671 | File "*/mercurial/extensions.py", line *, in _runuisetup (glob) (no-pyoxidizer !) |
|
672 | 672 | File "mercurial.extensions", line *, in _runuisetup (glob) (pyoxidizer !) |
|
673 | 673 | uisetup(ui) |
|
674 | 674 | File "$TESTTMP/baduisetup.py", line 2, in uisetup |
|
675 | 675 | 1 / 0 |
|
676 | 676 | ZeroDivisionError: * by zero (glob) |
|
677 | 677 | *** failed to set up extension baduisetup: * by zero (glob) |
|
678 | 678 | Mercurial Distributed SCM (version *) (glob) |
|
679 | 679 | (see https://mercurial-scm.org for more information) |
|
680 | 680 | |
|
681 | 681 | Copyright (C) 2005-* Olivia Mackall and others (glob) |
|
682 | 682 | This is free software; see the source for copying conditions. There is NO |
|
683 | 683 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
684 | 684 | |
|
685 | 685 | $ cd .. |
|
686 | 686 | |
|
687 | 687 | hide outer repo |
|
688 | 688 | $ hg init |
|
689 | 689 | |
|
690 | 690 | $ cat > empty.py <<EOF |
|
691 | 691 | > '''empty cmdtable |
|
692 | 692 | > ''' |
|
693 | 693 | > cmdtable = {} |
|
694 | 694 | > EOF |
|
695 | 695 | $ emptypath=`pwd`/empty.py |
|
696 | 696 | $ echo "empty = $emptypath" >> $HGRCPATH |
|
697 | 697 | $ hg help empty |
|
698 | 698 | empty extension - empty cmdtable |
|
699 | 699 | |
|
700 | 700 | no commands defined |
|
701 | 701 | |
|
702 | 702 | |
|
703 | 703 | $ echo 'empty = !' >> $HGRCPATH |
|
704 | 704 | |
|
705 | 705 | $ cat > debugextension.py <<EOF |
|
706 | 706 | > '''only debugcommands |
|
707 | 707 | > ''' |
|
708 | 708 | > from mercurial import registrar |
|
709 | 709 | > cmdtable = {} |
|
710 | 710 | > command = registrar.command(cmdtable) |
|
711 | 711 | > @command(b'debugfoobar', [], b'hg debugfoobar') |
|
712 | 712 | > def debugfoobar(ui, repo, *args, **opts): |
|
713 | 713 | > "yet another debug command" |
|
714 | 714 | > @command(b'foo', [], b'hg foo') |
|
715 | 715 | > def foo(ui, repo, *args, **opts): |
|
716 | 716 | > """yet another foo command |
|
717 | 717 | > This command has been DEPRECATED since forever. |
|
718 | 718 | > """ |
|
719 | 719 | > EOF |
|
720 | 720 | $ debugpath=`pwd`/debugextension.py |
|
721 | 721 | $ echo "debugextension = $debugpath" >> $HGRCPATH |
|
722 | 722 | |
|
723 | 723 | $ hg help debugextension |
|
724 | 724 | hg debugextensions |
|
725 | 725 | |
|
726 | 726 | show information about active extensions |
|
727 | 727 | |
|
728 | 728 | options: |
|
729 | 729 | |
|
730 | 730 | -T --template TEMPLATE display with template |
|
731 | 731 | |
|
732 | 732 | (some details hidden, use --verbose to show complete help) |
|
733 | 733 | |
|
734 | 734 | |
|
735 | 735 | $ hg --verbose help debugextension |
|
736 | 736 | hg debugextensions |
|
737 | 737 | |
|
738 | 738 | show information about active extensions |
|
739 | 739 | |
|
740 | 740 | options: |
|
741 | 741 | |
|
742 | 742 | -T --template TEMPLATE display with template |
|
743 | 743 | |
|
744 | 744 | global options ([+] can be repeated): |
|
745 | 745 | |
|
746 | 746 | -R --repository REPO repository root directory or name of overlay bundle |
|
747 | 747 | file |
|
748 | 748 | --cwd DIR change working directory |
|
749 | 749 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
750 | 750 | all prompts |
|
751 | 751 | -q --quiet suppress output |
|
752 | 752 | -v --verbose enable additional output |
|
753 | 753 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
754 | 754 | debug) |
|
755 | 755 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
756 | 756 | --debug enable debugging output |
|
757 | 757 | --debugger start debugger |
|
758 | 758 | --encoding ENCODE set the charset encoding (default: ascii) |
|
759 | 759 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
760 | 760 | --traceback always print a traceback on exception |
|
761 | 761 | --time time how long the command takes |
|
762 | 762 | --profile print command execution profile |
|
763 | 763 | --version output version information and exit |
|
764 | 764 | -h --help display help and exit |
|
765 | 765 | --hidden consider hidden changesets |
|
766 | 766 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
767 | 767 | (default: auto) |
|
768 | 768 | |
|
769 | 769 | |
|
770 | 770 | |
|
771 | 771 | |
|
772 | 772 | |
|
773 | 773 | |
|
774 | 774 | $ hg --debug help debugextension |
|
775 | 775 | hg debugextensions |
|
776 | 776 | |
|
777 | 777 | show information about active extensions |
|
778 | 778 | |
|
779 | 779 | options: |
|
780 | 780 | |
|
781 | 781 | -T --template TEMPLATE display with template |
|
782 | 782 | |
|
783 | 783 | global options ([+] can be repeated): |
|
784 | 784 | |
|
785 | 785 | -R --repository REPO repository root directory or name of overlay bundle |
|
786 | 786 | file |
|
787 | 787 | --cwd DIR change working directory |
|
788 | 788 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
789 | 789 | all prompts |
|
790 | 790 | -q --quiet suppress output |
|
791 | 791 | -v --verbose enable additional output |
|
792 | 792 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
793 | 793 | debug) |
|
794 | 794 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
795 | 795 | --debug enable debugging output |
|
796 | 796 | --debugger start debugger |
|
797 | 797 | --encoding ENCODE set the charset encoding (default: ascii) |
|
798 | 798 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
799 | 799 | --traceback always print a traceback on exception |
|
800 | 800 | --time time how long the command takes |
|
801 | 801 | --profile print command execution profile |
|
802 | 802 | --version output version information and exit |
|
803 | 803 | -h --help display help and exit |
|
804 | 804 | --hidden consider hidden changesets |
|
805 | 805 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
806 | 806 | (default: auto) |
|
807 | 807 | |
|
808 | 808 | |
|
809 | 809 | |
|
810 | 810 | |
|
811 | 811 | |
|
812 | 812 | $ echo 'debugextension = !' >> $HGRCPATH |
|
813 | 813 | |
|
814 | 814 | Asking for help about a deprecated extension should do something useful: |
|
815 | 815 | |
|
816 | 816 | $ hg help glog |
|
817 | 817 | 'glog' is provided by the following extension: |
|
818 | 818 | |
|
819 | 819 | graphlog command to view revision graphs from a shell (DEPRECATED) |
|
820 | 820 | |
|
821 | 821 | (use 'hg help extensions' for information on enabling extensions) |
|
822 | 822 | |
|
823 | 823 | Extension module help vs command help: |
|
824 | 824 | |
|
825 | 825 | $ echo 'extdiff =' >> $HGRCPATH |
|
826 | 826 | $ hg help extdiff |
|
827 | 827 | hg extdiff [OPT]... [FILE]... |
|
828 | 828 | |
|
829 | 829 | use external program to diff repository (or selected files) |
|
830 | 830 | |
|
831 | 831 | Show differences between revisions for the specified files, using an |
|
832 | 832 | external program. The default program used is diff, with default options |
|
833 | 833 | "-Npru". |
|
834 | 834 | |
|
835 | 835 | To select a different program, use the -p/--program option. The program |
|
836 | 836 | will be passed the names of two directories to compare, unless the --per- |
|
837 | 837 | file option is specified (see below). To pass additional options to the |
|
838 | 838 | program, use -o/--option. These will be passed before the names of the |
|
839 | 839 | directories or files to compare. |
|
840 | 840 | |
|
841 | 841 | The --from, --to, and --change options work the same way they do for 'hg |
|
842 | 842 | diff'. |
|
843 | 843 | |
|
844 | 844 | The --per-file option runs the external program repeatedly on each file to |
|
845 | 845 | diff, instead of once on two directories. By default, this happens one by |
|
846 | 846 | one, where the next file diff is open in the external program only once |
|
847 | 847 | the previous external program (for the previous file diff) has exited. If |
|
848 | 848 | the external program has a graphical interface, it can open all the file |
|
849 | 849 | diffs at once instead of one by one. See 'hg help -e extdiff' for |
|
850 | 850 | information about how to tell Mercurial that a given program has a |
|
851 | 851 | graphical interface. |
|
852 | 852 | |
|
853 | 853 | The --confirm option will prompt the user before each invocation of the |
|
854 | 854 | external program. It is ignored if --per-file isn't specified. |
|
855 | 855 | |
|
856 | 856 | (use 'hg help -e extdiff' to show help for the extdiff extension) |
|
857 | 857 | |
|
858 | 858 | options ([+] can be repeated): |
|
859 | 859 | |
|
860 | 860 | -p --program CMD comparison program to run |
|
861 | 861 | -o --option OPT [+] pass option to comparison program |
|
862 | 862 | --from REV1 revision to diff from |
|
863 | 863 | --to REV2 revision to diff to |
|
864 | 864 | -c --change REV change made by revision |
|
865 | 865 | --per-file compare each file instead of revision snapshots |
|
866 | 866 | --confirm prompt user before each external program invocation |
|
867 | 867 | --patch compare patches for two revisions |
|
868 | 868 | -I --include PATTERN [+] include names matching the given patterns |
|
869 | 869 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
870 | 870 | -S --subrepos recurse into subrepositories |
|
871 | 871 | |
|
872 | 872 | (some details hidden, use --verbose to show complete help) |
|
873 | 873 | |
|
874 | 874 | |
|
875 | 875 | |
|
876 | 876 | |
|
877 | 877 | |
|
878 | 878 | |
|
879 | 879 | |
|
880 | 880 | |
|
881 | 881 | |
|
882 | 882 | |
|
883 | 883 | $ hg help --extension extdiff |
|
884 | 884 | extdiff extension - command to allow external programs to compare revisions |
|
885 | 885 | |
|
886 | 886 | The extdiff Mercurial extension allows you to use external programs to compare |
|
887 | 887 | revisions, or revision with working directory. The external diff programs are |
|
888 | 888 | called with a configurable set of options and two non-option arguments: paths |
|
889 | 889 | to directories containing snapshots of files to compare. |
|
890 | 890 | |
|
891 | 891 | If there is more than one file being compared and the "child" revision is the |
|
892 | 892 | working directory, any modifications made in the external diff program will be |
|
893 | 893 | copied back to the working directory from the temporary directory. |
|
894 | 894 | |
|
895 | 895 | The extdiff extension also allows you to configure new diff commands, so you |
|
896 | 896 | do not need to type 'hg extdiff -p kdiff3' always. |
|
897 | 897 | |
|
898 | 898 | [extdiff] |
|
899 | 899 | # add new command that runs GNU diff(1) in 'context diff' mode |
|
900 | 900 | cdiff = gdiff -Nprc5 |
|
901 | 901 | ## or the old way: |
|
902 | 902 | #cmd.cdiff = gdiff |
|
903 | 903 | #opts.cdiff = -Nprc5 |
|
904 | 904 | |
|
905 | 905 | # add new command called meld, runs meld (no need to name twice). If |
|
906 | 906 | # the meld executable is not available, the meld tool in [merge-tools] |
|
907 | 907 | # will be used, if available |
|
908 | 908 | meld = |
|
909 | 909 | |
|
910 | 910 | # add new command called vimdiff, runs gvimdiff with DirDiff plugin |
|
911 | 911 | # (see http://www.vim.org/scripts/script.php?script_id=102) Non |
|
912 | 912 | # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in |
|
913 | 913 | # your .vimrc |
|
914 | 914 | vimdiff = gvim -f "+next" \ |
|
915 | 915 | "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" |
|
916 | 916 | |
|
917 | 917 | Tool arguments can include variables that are expanded at runtime: |
|
918 | 918 | |
|
919 | 919 | $parent1, $plabel1 - filename, descriptive label of first parent |
|
920 | 920 | $child, $clabel - filename, descriptive label of child revision |
|
921 | 921 | $parent2, $plabel2 - filename, descriptive label of second parent |
|
922 | 922 | $root - repository root |
|
923 | 923 | $parent is an alias for $parent1. |
|
924 | 924 | |
|
925 | 925 | The extdiff extension will look in your [diff-tools] and [merge-tools] |
|
926 | 926 | sections for diff tool arguments, when none are specified in [extdiff]. |
|
927 | 927 | |
|
928 | 928 | [extdiff] |
|
929 | 929 | kdiff3 = |
|
930 | 930 | |
|
931 | 931 | [diff-tools] |
|
932 | 932 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child |
|
933 | 933 | |
|
934 | 934 | If a program has a graphical interface, it might be interesting to tell |
|
935 | 935 | Mercurial about it. It will prevent the program from being mistakenly used in |
|
936 | 936 | a terminal-only environment (such as an SSH terminal session), and will make |
|
937 | 937 | 'hg extdiff --per-file' open multiple file diffs at once instead of one by one |
|
938 | 938 | (if you still want to open file diffs one by one, you can use the --confirm |
|
939 | 939 | option). |
|
940 | 940 | |
|
941 | 941 | Declaring that a tool has a graphical interface can be done with the "gui" |
|
942 | 942 | flag next to where "diffargs" are specified: |
|
943 | 943 | |
|
944 | 944 | [diff-tools] |
|
945 | 945 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child |
|
946 | 946 | kdiff3.gui = true |
|
947 | 947 | |
|
948 | 948 | You can use -I/-X and list of file or directory names like normal 'hg diff' |
|
949 | 949 | command. The extdiff extension makes snapshots of only needed files, so |
|
950 | 950 | running the external diff program will actually be pretty fast (at least |
|
951 | 951 | faster than having to compare the entire tree). |
|
952 | 952 | |
|
953 | 953 | list of commands: |
|
954 | 954 | |
|
955 | 955 | extdiff use external program to diff repository (or selected files) |
|
956 | 956 | |
|
957 | 957 | (use 'hg help -v -e extdiff' to show built-in aliases and global options) |
|
958 | 958 | |
|
959 | 959 | |
|
960 | 960 | |
|
961 | 961 | |
|
962 | 962 | |
|
963 | 963 | |
|
964 | 964 | |
|
965 | 965 | |
|
966 | 966 | |
|
967 | 967 | |
|
968 | 968 | |
|
969 | 969 | |
|
970 | 970 | |
|
971 | 971 | |
|
972 | 972 | |
|
973 | 973 | |
|
974 | 974 | $ echo 'extdiff = !' >> $HGRCPATH |
|
975 | 975 | |
|
976 | 976 | Test help topic with same name as extension |
|
977 | 977 | |
|
978 | 978 | $ cat > multirevs.py <<EOF |
|
979 | 979 | > from mercurial import commands, registrar |
|
980 | 980 | > cmdtable = {} |
|
981 | 981 | > command = registrar.command(cmdtable) |
|
982 | 982 | > """multirevs extension |
|
983 | 983 | > Big multi-line module docstring.""" |
|
984 | 984 | > @command(b'multirevs', [], b'ARG', norepo=True) |
|
985 | 985 | > def multirevs(ui, repo, arg, *args, **opts): |
|
986 | 986 | > """multirevs command""" |
|
987 | 987 | > EOF |
|
988 | 988 | $ echo "multirevs = multirevs.py" >> $HGRCPATH |
|
989 | 989 | |
|
990 | 990 | $ hg help multirevs | tail |
|
991 | 991 | used): |
|
992 | 992 | |
|
993 | 993 | hg update :@ |
|
994 | 994 | |
|
995 | 995 | - Show diff between tags 1.3 and 1.5 (this works because the first and the |
|
996 | 996 | last revisions of the revset are used): |
|
997 | 997 | |
|
998 | 998 | hg diff -r 1.3::1.5 |
|
999 | 999 | |
|
1000 | 1000 | use 'hg help -c multirevs' to see help for the multirevs command |
|
1001 | 1001 | |
|
1002 | 1002 | |
|
1003 | 1003 | |
|
1004 | 1004 | |
|
1005 | 1005 | |
|
1006 | 1006 | |
|
1007 | 1007 | $ hg help -c multirevs |
|
1008 | 1008 | hg multirevs ARG |
|
1009 | 1009 | |
|
1010 | 1010 | multirevs command |
|
1011 | 1011 | |
|
1012 | 1012 | (some details hidden, use --verbose to show complete help) |
|
1013 | 1013 | |
|
1014 | 1014 | |
|
1015 | 1015 | |
|
1016 | 1016 | $ hg multirevs |
|
1017 | 1017 | hg multirevs: invalid arguments |
|
1018 | 1018 | hg multirevs ARG |
|
1019 | 1019 | |
|
1020 | 1020 | multirevs command |
|
1021 | 1021 | |
|
1022 | 1022 | (use 'hg multirevs -h' to show more help) |
|
1023 | 1023 | [10] |
|
1024 | 1024 | |
|
1025 | 1025 | |
|
1026 | 1026 | |
|
1027 | 1027 | $ echo "multirevs = !" >> $HGRCPATH |
|
1028 | 1028 | |
|
1029 | 1029 | Issue811: Problem loading extensions twice (by site and by user) |
|
1030 | 1030 | |
|
1031 | 1031 | $ cat <<EOF >> $HGRCPATH |
|
1032 | 1032 | > mq = |
|
1033 | 1033 | > strip = |
|
1034 | 1034 | > hgext.mq = |
|
1035 | 1035 | > hgext/mq = |
|
1036 | 1036 | > EOF |
|
1037 | 1037 | |
|
1038 | 1038 | Show extensions: |
|
1039 | 1039 | (note that mq force load strip, also checking it's not loaded twice) |
|
1040 | 1040 | |
|
1041 | 1041 | #if no-extraextensions |
|
1042 | 1042 | $ hg debugextensions |
|
1043 | 1043 | mq |
|
1044 | 1044 | strip |
|
1045 | 1045 | #endif |
|
1046 | 1046 | |
|
1047 | 1047 | For extensions, which name matches one of its commands, help |
|
1048 | 1048 | message should ask '-v -e' to get list of built-in aliases |
|
1049 | 1049 | along with extension help itself |
|
1050 | 1050 | |
|
1051 | 1051 | $ mkdir $TESTTMP/d |
|
1052 | 1052 | $ cat > $TESTTMP/d/dodo.py <<EOF |
|
1053 | 1053 | > """ |
|
1054 | 1054 | > This is an awesome 'dodo' extension. It does nothing and |
|
1055 | 1055 | > writes 'Foo foo' |
|
1056 | 1056 | > """ |
|
1057 | 1057 | > from mercurial import commands, registrar |
|
1058 | 1058 | > cmdtable = {} |
|
1059 | 1059 | > command = registrar.command(cmdtable) |
|
1060 | 1060 | > @command(b'dodo', [], b'hg dodo') |
|
1061 | 1061 | > def dodo(ui, *args, **kwargs): |
|
1062 | 1062 | > """Does nothing""" |
|
1063 | 1063 | > ui.write(b"I do nothing. Yay\\n") |
|
1064 | 1064 | > @command(b'foofoo', [], b'hg foofoo') |
|
1065 | 1065 | > def foofoo(ui, *args, **kwargs): |
|
1066 | 1066 | > """Writes 'Foo foo'""" |
|
1067 | 1067 | > ui.write(b"Foo foo\\n") |
|
1068 | 1068 | > EOF |
|
1069 | 1069 | $ dodopath=$TESTTMP/d/dodo.py |
|
1070 | 1070 | |
|
1071 | 1071 | $ echo "dodo = $dodopath" >> $HGRCPATH |
|
1072 | 1072 | |
|
1073 | 1073 | Make sure that user is asked to enter '-v -e' to get list of built-in aliases |
|
1074 | 1074 | $ hg help -e dodo |
|
1075 | 1075 | dodo extension - |
|
1076 | 1076 | |
|
1077 | 1077 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' |
|
1078 | 1078 | |
|
1079 | 1079 | list of commands: |
|
1080 | 1080 | |
|
1081 | 1081 | dodo Does nothing |
|
1082 | 1082 | foofoo Writes 'Foo foo' |
|
1083 | 1083 | |
|
1084 | 1084 | (use 'hg help -v -e dodo' to show built-in aliases and global options) |
|
1085 | 1085 | |
|
1086 | 1086 | Make sure that '-v -e' prints list of built-in aliases along with |
|
1087 | 1087 | extension help itself |
|
1088 | 1088 | $ hg help -v -e dodo |
|
1089 | 1089 | dodo extension - |
|
1090 | 1090 | |
|
1091 | 1091 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' |
|
1092 | 1092 | |
|
1093 | 1093 | list of commands: |
|
1094 | 1094 | |
|
1095 | 1095 | dodo Does nothing |
|
1096 | 1096 | foofoo Writes 'Foo foo' |
|
1097 | 1097 | |
|
1098 | 1098 | global options ([+] can be repeated): |
|
1099 | 1099 | |
|
1100 | 1100 | -R --repository REPO repository root directory or name of overlay bundle |
|
1101 | 1101 | file |
|
1102 | 1102 | --cwd DIR change working directory |
|
1103 | 1103 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1104 | 1104 | all prompts |
|
1105 | 1105 | -q --quiet suppress output |
|
1106 | 1106 | -v --verbose enable additional output |
|
1107 | 1107 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1108 | 1108 | debug) |
|
1109 | 1109 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1110 | 1110 | --debug enable debugging output |
|
1111 | 1111 | --debugger start debugger |
|
1112 | 1112 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1113 | 1113 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1114 | 1114 | --traceback always print a traceback on exception |
|
1115 | 1115 | --time time how long the command takes |
|
1116 | 1116 | --profile print command execution profile |
|
1117 | 1117 | --version output version information and exit |
|
1118 | 1118 | -h --help display help and exit |
|
1119 | 1119 | --hidden consider hidden changesets |
|
1120 | 1120 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1121 | 1121 | (default: auto) |
|
1122 | 1122 | |
|
1123 | 1123 | Make sure that single '-v' option shows help and built-ins only for 'dodo' command |
|
1124 | 1124 | $ hg help -v dodo |
|
1125 | 1125 | hg dodo |
|
1126 | 1126 | |
|
1127 | 1127 | Does nothing |
|
1128 | 1128 | |
|
1129 | 1129 | (use 'hg help -e dodo' to show help for the dodo extension) |
|
1130 | 1130 | |
|
1131 | 1131 | options: |
|
1132 | 1132 | |
|
1133 | 1133 | --mq operate on patch repository |
|
1134 | 1134 | |
|
1135 | 1135 | global options ([+] can be repeated): |
|
1136 | 1136 | |
|
1137 | 1137 | -R --repository REPO repository root directory or name of overlay bundle |
|
1138 | 1138 | file |
|
1139 | 1139 | --cwd DIR change working directory |
|
1140 | 1140 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1141 | 1141 | all prompts |
|
1142 | 1142 | -q --quiet suppress output |
|
1143 | 1143 | -v --verbose enable additional output |
|
1144 | 1144 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1145 | 1145 | debug) |
|
1146 | 1146 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1147 | 1147 | --debug enable debugging output |
|
1148 | 1148 | --debugger start debugger |
|
1149 | 1149 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1150 | 1150 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1151 | 1151 | --traceback always print a traceback on exception |
|
1152 | 1152 | --time time how long the command takes |
|
1153 | 1153 | --profile print command execution profile |
|
1154 | 1154 | --version output version information and exit |
|
1155 | 1155 | -h --help display help and exit |
|
1156 | 1156 | --hidden consider hidden changesets |
|
1157 | 1157 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1158 | 1158 | (default: auto) |
|
1159 | 1159 | |
|
1160 | 1160 | In case when extension name doesn't match any of its commands, |
|
1161 | 1161 | help message should ask for '-v' to get list of built-in aliases |
|
1162 | 1162 | along with extension help |
|
1163 | 1163 | $ cat > $TESTTMP/d/dudu.py <<EOF |
|
1164 | 1164 | > """ |
|
1165 | 1165 | > This is an awesome 'dudu' extension. It does something and |
|
1166 | 1166 | > also writes 'Beep beep' |
|
1167 | 1167 | > """ |
|
1168 | 1168 | > from mercurial import commands, registrar |
|
1169 | 1169 | > cmdtable = {} |
|
1170 | 1170 | > command = registrar.command(cmdtable) |
|
1171 | 1171 | > @command(b'something', [], b'hg something') |
|
1172 | 1172 | > def something(ui, *args, **kwargs): |
|
1173 | 1173 | > """Does something""" |
|
1174 | 1174 | > ui.write(b"I do something. Yaaay\\n") |
|
1175 | 1175 | > @command(b'beep', [], b'hg beep') |
|
1176 | 1176 | > def beep(ui, *args, **kwargs): |
|
1177 | 1177 | > """Writes 'Beep beep'""" |
|
1178 | 1178 | > ui.write(b"Beep beep\\n") |
|
1179 | 1179 | > EOF |
|
1180 | 1180 | $ dudupath=$TESTTMP/d/dudu.py |
|
1181 | 1181 | |
|
1182 | 1182 | $ echo "dudu = $dudupath" >> $HGRCPATH |
|
1183 | 1183 | |
|
1184 | 1184 | $ hg help -e dudu |
|
1185 | 1185 | dudu extension - |
|
1186 | 1186 | |
|
1187 | 1187 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
1188 | 1188 | beep' |
|
1189 | 1189 | |
|
1190 | 1190 | list of commands: |
|
1191 | 1191 | |
|
1192 | 1192 | beep Writes 'Beep beep' |
|
1193 | 1193 | something Does something |
|
1194 | 1194 | |
|
1195 | 1195 | (use 'hg help -v dudu' to show built-in aliases and global options) |
|
1196 | 1196 | |
|
1197 | 1197 | In case when extension name doesn't match any of its commands, |
|
1198 | 1198 | help options '-v' and '-v -e' should be equivalent |
|
1199 | 1199 | $ hg help -v dudu |
|
1200 | 1200 | dudu extension - |
|
1201 | 1201 | |
|
1202 | 1202 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
1203 | 1203 | beep' |
|
1204 | 1204 | |
|
1205 | 1205 | list of commands: |
|
1206 | 1206 | |
|
1207 | 1207 | beep Writes 'Beep beep' |
|
1208 | 1208 | something Does something |
|
1209 | 1209 | |
|
1210 | 1210 | global options ([+] can be repeated): |
|
1211 | 1211 | |
|
1212 | 1212 | -R --repository REPO repository root directory or name of overlay bundle |
|
1213 | 1213 | file |
|
1214 | 1214 | --cwd DIR change working directory |
|
1215 | 1215 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1216 | 1216 | all prompts |
|
1217 | 1217 | -q --quiet suppress output |
|
1218 | 1218 | -v --verbose enable additional output |
|
1219 | 1219 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1220 | 1220 | debug) |
|
1221 | 1221 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1222 | 1222 | --debug enable debugging output |
|
1223 | 1223 | --debugger start debugger |
|
1224 | 1224 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1225 | 1225 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1226 | 1226 | --traceback always print a traceback on exception |
|
1227 | 1227 | --time time how long the command takes |
|
1228 | 1228 | --profile print command execution profile |
|
1229 | 1229 | --version output version information and exit |
|
1230 | 1230 | -h --help display help and exit |
|
1231 | 1231 | --hidden consider hidden changesets |
|
1232 | 1232 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1233 | 1233 | (default: auto) |
|
1234 | 1234 | |
|
1235 | 1235 | $ hg help -v -e dudu |
|
1236 | 1236 | dudu extension - |
|
1237 | 1237 | |
|
1238 | 1238 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
1239 | 1239 | beep' |
|
1240 | 1240 | |
|
1241 | 1241 | list of commands: |
|
1242 | 1242 | |
|
1243 | 1243 | beep Writes 'Beep beep' |
|
1244 | 1244 | something Does something |
|
1245 | 1245 | |
|
1246 | 1246 | global options ([+] can be repeated): |
|
1247 | 1247 | |
|
1248 | 1248 | -R --repository REPO repository root directory or name of overlay bundle |
|
1249 | 1249 | file |
|
1250 | 1250 | --cwd DIR change working directory |
|
1251 | 1251 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1252 | 1252 | all prompts |
|
1253 | 1253 | -q --quiet suppress output |
|
1254 | 1254 | -v --verbose enable additional output |
|
1255 | 1255 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1256 | 1256 | debug) |
|
1257 | 1257 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1258 | 1258 | --debug enable debugging output |
|
1259 | 1259 | --debugger start debugger |
|
1260 | 1260 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1261 | 1261 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1262 | 1262 | --traceback always print a traceback on exception |
|
1263 | 1263 | --time time how long the command takes |
|
1264 | 1264 | --profile print command execution profile |
|
1265 | 1265 | --version output version information and exit |
|
1266 | 1266 | -h --help display help and exit |
|
1267 | 1267 | --hidden consider hidden changesets |
|
1268 | 1268 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1269 | 1269 | (default: auto) |
|
1270 | 1270 | |
|
1271 | 1271 | Disabled extension commands: |
|
1272 | 1272 | |
|
1273 | 1273 | $ ORGHGRCPATH=$HGRCPATH |
|
1274 | 1274 | $ HGRCPATH= |
|
1275 | 1275 | $ export HGRCPATH |
|
1276 | 1276 | $ hg help email |
|
1277 | 1277 | 'email' is provided by the following extension: |
|
1278 | 1278 | |
|
1279 | 1279 | patchbomb command to send changesets as (a series of) patch emails |
|
1280 | 1280 | |
|
1281 | 1281 | (use 'hg help extensions' for information on enabling extensions) |
|
1282 | 1282 | |
|
1283 | 1283 | |
|
1284 | 1284 | $ hg qdel |
|
1285 | 1285 | hg: unknown command 'qdel' |
|
1286 | 1286 | 'qdelete' is provided by the following extension: |
|
1287 | 1287 | |
|
1288 | 1288 | mq manage a stack of patches |
|
1289 | 1289 | |
|
1290 | 1290 | (use 'hg help extensions' for information on enabling extensions) |
|
1291 | 1291 | [255] |
|
1292 | 1292 | |
|
1293 | 1293 | |
|
1294 | 1294 | $ hg churn |
|
1295 | 1295 | hg: unknown command 'churn' |
|
1296 | 1296 | 'churn' is provided by the following extension: |
|
1297 | 1297 | |
|
1298 | 1298 | churn command to display statistics about repository history |
|
1299 | 1299 | |
|
1300 | 1300 | (use 'hg help extensions' for information on enabling extensions) |
|
1301 | 1301 | [255] |
|
1302 | 1302 | |
|
1303 | 1303 | |
|
1304 | 1304 | |
|
1305 | 1305 | Disabled extensions: |
|
1306 | 1306 | |
|
1307 | 1307 | $ hg help churn |
|
1308 | 1308 | churn extension - command to display statistics about repository history |
|
1309 | 1309 | |
|
1310 | 1310 | (use 'hg help extensions' for information on enabling extensions) |
|
1311 | 1311 | |
|
1312 | 1312 | $ hg help patchbomb |
|
1313 | 1313 | patchbomb extension - command to send changesets as (a series of) patch emails |
|
1314 | 1314 | |
|
1315 | 1315 | The series is started off with a "[PATCH 0 of N]" introduction, which |
|
1316 | 1316 | describes the series as a whole. |
|
1317 | 1317 | |
|
1318 | 1318 | Each patch email has a Subject line of "[PATCH M of N] ...", using the first |
|
1319 | 1319 | line of the changeset description as the subject text. The message contains |
|
1320 | 1320 | two or three body parts: |
|
1321 | 1321 | |
|
1322 | 1322 | - The changeset description. |
|
1323 | 1323 | - [Optional] The result of running diffstat on the patch. |
|
1324 | 1324 | - The patch itself, as generated by 'hg export'. |
|
1325 | 1325 | |
|
1326 | 1326 | Each message refers to the first in the series using the In-Reply-To and |
|
1327 | 1327 | References headers, so they will show up as a sequence in threaded mail and |
|
1328 | 1328 | news readers, and in mail archives. |
|
1329 | 1329 | |
|
1330 | 1330 | To configure other defaults, add a section like this to your configuration |
|
1331 | 1331 | file: |
|
1332 | 1332 | |
|
1333 | 1333 | [email] |
|
1334 | 1334 | from = My Name <my@email> |
|
1335 | 1335 | to = recipient1, recipient2, ... |
|
1336 | 1336 | cc = cc1, cc2, ... |
|
1337 | 1337 | bcc = bcc1, bcc2, ... |
|
1338 | 1338 | reply-to = address1, address2, ... |
|
1339 | 1339 | |
|
1340 | 1340 | Use "[patchbomb]" as configuration section name if you need to override global |
|
1341 | 1341 | "[email]" address settings. |
|
1342 | 1342 | |
|
1343 | 1343 | Then you can use the 'hg email' command to mail a series of changesets as a |
|
1344 | 1344 | patchbomb. |
|
1345 | 1345 | |
|
1346 | 1346 | You can also either configure the method option in the email section to be a |
|
1347 | 1347 | sendmail compatible mailer or fill out the [smtp] section so that the |
|
1348 | 1348 | patchbomb extension can automatically send patchbombs directly from the |
|
1349 | 1349 | commandline. See the [email] and [smtp] sections in hgrc(5) for details. |
|
1350 | 1350 | |
|
1351 | 1351 | By default, 'hg email' will prompt for a "To" or "CC" header if you do not |
|
1352 | 1352 | supply one via configuration or the command line. You can override this to |
|
1353 | 1353 | never prompt by configuring an empty value: |
|
1354 | 1354 | |
|
1355 | 1355 | [email] |
|
1356 | 1356 | cc = |
|
1357 | 1357 | |
|
1358 | 1358 | You can control the default inclusion of an introduction message with the |
|
1359 | 1359 | "patchbomb.intro" configuration option. The configuration is always |
|
1360 | 1360 | overwritten by command line flags like --intro and --desc: |
|
1361 | 1361 | |
|
1362 | 1362 | [patchbomb] |
|
1363 | 1363 | intro=auto # include introduction message if more than 1 patch (default) |
|
1364 | 1364 | intro=never # never include an introduction message |
|
1365 | 1365 | intro=always # always include an introduction message |
|
1366 | 1366 | |
|
1367 | 1367 | You can specify a template for flags to be added in subject prefixes. Flags |
|
1368 | 1368 | specified by --flag option are exported as "{flags}" keyword: |
|
1369 | 1369 | |
|
1370 | 1370 | [patchbomb] |
|
1371 | 1371 | flagtemplate = "{separate(' ', |
|
1372 | 1372 | ifeq(branch, 'default', '', branch|upper), |
|
1373 | 1373 | flags)}" |
|
1374 | 1374 | |
|
1375 | 1375 | You can set patchbomb to always ask for confirmation by setting |
|
1376 | 1376 | "patchbomb.confirm" to true. |
|
1377 | 1377 | |
|
1378 | 1378 | (use 'hg help extensions' for information on enabling extensions) |
|
1379 | 1379 | |
|
1380 | 1380 | |
|
1381 | 1381 | Help can find unimported extensions |
|
1382 | 1382 | ----------------------------------- |
|
1383 | 1383 | |
|
1384 | 1384 | XXX-PYOXIDIZER since the frozen binary does not have source directory tree, |
|
1385 | 1385 | this make the checking for actual file under `hgext` a bit complicated. In |
|
1386 | 1386 | addition these tests do some strange dance to ensure some other module are the |
|
1387 | 1387 | first in `sys.path` (since the current install path is always in front |
|
1388 | 1388 | otherwise) that are fragile and that does not match reality in the field. So |
|
1389 | 1389 | for now we disable this test untill a deeper rework of that logic is done. |
|
1390 | 1390 | |
|
1391 | 1391 | #if no-pyoxidizer |
|
1392 | 1392 | |
|
1393 | 1393 | Broken disabled extension and command: |
|
1394 | 1394 | |
|
1395 | 1395 | $ mkdir hgext |
|
1396 | 1396 | $ echo > hgext/__init__.py |
|
1397 | 1397 | $ cat > hgext/broken.py <<NO_CHECK_EOF |
|
1398 | 1398 | > "broken extension' |
|
1399 | 1399 | > NO_CHECK_EOF |
|
1400 | 1400 | $ cat > path.py <<EOF |
|
1401 | 1401 | > import os |
|
1402 | 1402 | > import sys |
|
1403 | 1403 | > sys.path.insert(0, os.environ['HGEXTPATH']) |
|
1404 | 1404 | > EOF |
|
1405 | 1405 | $ HGEXTPATH=`pwd` |
|
1406 | 1406 | $ export HGEXTPATH |
|
1407 | 1407 | |
|
1408 | 1408 | $ hg --config extensions.path=./path.py help broken |
|
1409 | 1409 | broken extension - (no help text available) |
|
1410 | 1410 | |
|
1411 | 1411 | (use 'hg help extensions' for information on enabling extensions) |
|
1412 | 1412 | |
|
1413 | 1413 | |
|
1414 | 1414 | $ cat > hgext/forest.py <<EOF |
|
1415 | 1415 | > cmdtable = None |
|
1416 | 1416 | > @command() |
|
1417 | 1417 | > def f(): |
|
1418 | 1418 | > pass |
|
1419 | 1419 | > @command(123) |
|
1420 | 1420 | > def g(): |
|
1421 | 1421 | > pass |
|
1422 | 1422 | > EOF |
|
1423 | 1423 | $ hg --config extensions.path=./path.py help foo |
|
1424 | 1424 | abort: no such help topic: foo |
|
1425 | 1425 | (try 'hg help --keyword foo') |
|
1426 | 1426 | [255] |
|
1427 | 1427 | |
|
1428 | 1428 | #endif |
|
1429 | 1429 | |
|
1430 | 1430 | --- |
|
1431 | 1431 | |
|
1432 | 1432 | $ cat > throw.py <<EOF |
|
1433 | 1433 | > from mercurial import commands, registrar, util |
|
1434 | 1434 | > cmdtable = {} |
|
1435 | 1435 | > command = registrar.command(cmdtable) |
|
1436 | 1436 | > class Bogon(Exception): pass |
|
1437 | 1437 | > # NB: version should be bytes; simulating extension not ported to py3 |
|
1438 | 1438 | > __version__ = '1.0.0' |
|
1439 | 1439 | > @command(b'throw', [], b'hg throw', norepo=True) |
|
1440 | 1440 | > def throw(ui, **opts): |
|
1441 | 1441 | > """throws an exception""" |
|
1442 | 1442 | > raise Bogon() |
|
1443 | 1443 | > EOF |
|
1444 | 1444 | |
|
1445 | 1445 | Test extension without proper byteification of key attributes doesn't crash when |
|
1446 | 1446 | accessed. |
|
1447 | 1447 | |
|
1448 | 1448 | $ hg version -v --config extensions.throw=throw.py | grep '^ ' |
|
1449 | 1449 | throw external 1.0.0 |
|
1450 | 1450 | |
|
1451 | 1451 | No declared supported version, extension complains: |
|
1452 | 1452 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1453 | 1453 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 |
|
1454 | 1454 | ** which supports versions unknown of Mercurial. |
|
1455 | 1455 | ** Please disable "throw" and try your action again. |
|
1456 | 1456 | ** If that fixes the bug please report it to the extension author. |
|
1457 | 1457 | ** Python * (glob) |
|
1458 | 1458 | ** Mercurial Distributed SCM * (glob) |
|
1459 | 1459 | ** Extensions loaded: throw 1.0.0 |
|
1460 | 1460 | |
|
1461 | 1461 | empty declaration of supported version, extension complains (but doesn't choke if |
|
1462 | 1462 | the value is improperly a str instead of bytes): |
|
1463 | 1463 | $ echo "testedwith = ''" >> throw.py |
|
1464 | 1464 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1465 | 1465 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 |
|
1466 | 1466 | ** which supports versions unknown of Mercurial. |
|
1467 | 1467 | ** Please disable "throw" and try your action again. |
|
1468 | 1468 | ** If that fixes the bug please report it to the extension author. |
|
1469 | 1469 | ** Python * (glob) |
|
1470 | 1470 | ** Mercurial Distributed SCM (*) (glob) |
|
1471 | 1471 | ** Extensions loaded: throw 1.0.0 |
|
1472 | 1472 | |
|
1473 | 1473 | If the extension specifies a buglink, show that (but don't choke if the value is |
|
1474 | 1474 | improperly a str instead of bytes): |
|
1475 | 1475 | $ echo 'buglink = "http://example.com/bts"' >> throw.py |
|
1476 | 1476 | $ rm -f throw.pyc throw.pyo |
|
1477 | 1477 | $ rm -Rf __pycache__ |
|
1478 | 1478 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1479 | 1479 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 |
|
1480 | 1480 | ** which supports versions unknown of Mercurial. |
|
1481 | 1481 | ** Please disable "throw" and try your action again. |
|
1482 | 1482 | ** If that fixes the bug please report it to http://example.com/bts |
|
1483 | 1483 | ** Python * (glob) |
|
1484 | 1484 | ** Mercurial Distributed SCM (*) (glob) |
|
1485 | 1485 | ** Extensions loaded: throw 1.0.0 |
|
1486 | 1486 | |
|
1487 | 1487 | If the extensions declare outdated versions, accuse the older extension first: |
|
1488 | 1488 | $ echo "from mercurial import util" >> older.py |
|
1489 | 1489 | $ echo "util.version = lambda:b'2.2'" >> older.py |
|
1490 | 1490 | $ echo "testedwith = b'1.9.3'" >> older.py |
|
1491 | 1491 | $ echo "testedwith = b'2.1.1'" >> throw.py |
|
1492 | 1492 | $ rm -f throw.pyc throw.pyo |
|
1493 | 1493 | $ rm -Rf __pycache__ |
|
1494 | 1494 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1495 | 1495 | > throw 2>&1 | egrep '^\*\*' |
|
1496 | 1496 | ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A) |
|
1497 | 1497 | ** which supports versions 1.9 of Mercurial. |
|
1498 | 1498 | ** Please disable "older" and try your action again. |
|
1499 | 1499 | ** If that fixes the bug please report it to the extension author. |
|
1500 | 1500 | ** Python * (glob) |
|
1501 | 1501 | ** Mercurial Distributed SCM (version 2.2) |
|
1502 | 1502 | ** Extensions loaded: older, throw 1.0.0 |
|
1503 | 1503 | |
|
1504 | 1504 | One extension only tested with older, one only with newer versions: |
|
1505 | 1505 | $ echo "util.version = lambda:b'2.1'" >> older.py |
|
1506 | 1506 | $ rm -f older.pyc older.pyo |
|
1507 | 1507 | $ rm -Rf __pycache__ |
|
1508 | 1508 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1509 | 1509 | > throw 2>&1 | egrep '^\*\*' |
|
1510 | 1510 | ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A) |
|
1511 | 1511 | ** which supports versions 1.9 of Mercurial. |
|
1512 | 1512 | ** Please disable "older" and try your action again. |
|
1513 | 1513 | ** If that fixes the bug please report it to the extension author. |
|
1514 | 1514 | ** Python * (glob) |
|
1515 | 1515 | ** Mercurial Distributed SCM (version 2.1) |
|
1516 | 1516 | ** Extensions loaded: older, throw 1.0.0 |
|
1517 | 1517 | |
|
1518 | 1518 | Older extension is tested with current version, the other only with newer: |
|
1519 | 1519 | $ echo "util.version = lambda:b'1.9.3'" >> older.py |
|
1520 | 1520 | $ rm -f older.pyc older.pyo |
|
1521 | 1521 | $ rm -Rf __pycache__ |
|
1522 | 1522 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1523 | 1523 | > throw 2>&1 | egrep '^\*\*' |
|
1524 | 1524 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 |
|
1525 | 1525 | ** which supports versions 2.1 of Mercurial. |
|
1526 | 1526 | ** Please disable "throw" and try your action again. |
|
1527 | 1527 | ** If that fixes the bug please report it to http://example.com/bts |
|
1528 | 1528 | ** Python * (glob) |
|
1529 | 1529 | ** Mercurial Distributed SCM (version 1.9.3) |
|
1530 | 1530 | ** Extensions loaded: older, throw 1.0.0 |
|
1531 | 1531 | |
|
1532 | 1532 | Ability to point to a different point |
|
1533 | 1533 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1534 | 1534 | > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*' |
|
1535 | 1535 | ** unknown exception encountered, please report by visiting |
|
1536 | 1536 | ** Your Local Goat Lenders |
|
1537 | 1537 | ** Python * (glob) |
|
1538 | 1538 | ** Mercurial Distributed SCM (*) (glob) |
|
1539 | 1539 | ** Extensions loaded: older, throw 1.0.0 |
|
1540 | 1540 | |
|
1541 | 1541 | Declare the version as supporting this hg version, show regular bts link: |
|
1542 | 1542 | $ hgver=`hg debuginstall -T '{hgver}'` |
|
1543 | 1543 | $ echo 'testedwith = """'"$hgver"'"""' >> throw.py |
|
1544 | 1544 | $ if [ -z "$hgver" ]; then |
|
1545 | 1545 | > echo "unable to fetch a mercurial version. Make sure __version__ is correct"; |
|
1546 | 1546 | > fi |
|
1547 | 1547 | $ rm -f throw.pyc throw.pyo |
|
1548 | 1548 | $ rm -Rf __pycache__ |
|
1549 | 1549 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1550 | 1550 | ** unknown exception encountered, please report by visiting |
|
1551 | 1551 | ** https://mercurial-scm.org/wiki/BugTracker |
|
1552 | 1552 | ** Python * (glob) |
|
1553 | 1553 | ** Mercurial Distributed SCM (*) (glob) |
|
1554 | 1554 | ** Extensions loaded: throw 1.0.0 |
|
1555 | 1555 | |
|
1556 | 1556 | Patch version is ignored during compatibility check |
|
1557 | 1557 | $ echo "testedwith = b'3.2'" >> throw.py |
|
1558 | 1558 | $ echo "util.version = lambda:b'3.2.2'" >> throw.py |
|
1559 | 1559 | $ rm -f throw.pyc throw.pyo |
|
1560 | 1560 | $ rm -Rf __pycache__ |
|
1561 | 1561 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1562 | 1562 | ** unknown exception encountered, please report by visiting |
|
1563 | 1563 | ** https://mercurial-scm.org/wiki/BugTracker |
|
1564 | 1564 | ** Python * (glob) |
|
1565 | 1565 | ** Mercurial Distributed SCM (*) (glob) |
|
1566 | 1566 | ** Extensions loaded: throw 1.0.0 |
|
1567 | 1567 | |
|
1568 | 1568 | Test version number support in 'hg version': |
|
1569 | 1569 | $ echo '__version__ = (1, 2, 3)' >> throw.py |
|
1570 | 1570 | $ rm -f throw.pyc throw.pyo |
|
1571 | 1571 | $ rm -Rf __pycache__ |
|
1572 | 1572 | $ hg version -v |
|
1573 | 1573 | Mercurial Distributed SCM (version *) (glob) |
|
1574 | 1574 | (see https://mercurial-scm.org for more information) |
|
1575 | 1575 | |
|
1576 | 1576 | Copyright (C) 2005-* Olivia Mackall and others (glob) |
|
1577 | 1577 | This is free software; see the source for copying conditions. There is NO |
|
1578 | 1578 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1579 | 1579 | |
|
1580 | 1580 | Enabled extensions: |
|
1581 | 1581 | |
|
1582 | 1582 | |
|
1583 | 1583 | $ hg version -v --config extensions.throw=throw.py |
|
1584 | 1584 | Mercurial Distributed SCM (version *) (glob) |
|
1585 | 1585 | (see https://mercurial-scm.org for more information) |
|
1586 | 1586 | |
|
1587 | 1587 | Copyright (C) 2005-* Olivia Mackall and others (glob) |
|
1588 | 1588 | This is free software; see the source for copying conditions. There is NO |
|
1589 | 1589 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1590 | 1590 | |
|
1591 | 1591 | Enabled extensions: |
|
1592 | 1592 | |
|
1593 | 1593 | throw external 1.2.3 |
|
1594 | 1594 | $ echo 'getversion = lambda: b"1.twentythree"' >> throw.py |
|
1595 | 1595 | $ rm -f throw.pyc throw.pyo |
|
1596 | 1596 | $ rm -Rf __pycache__ |
|
1597 | 1597 | $ hg version -v --config extensions.throw=throw.py --config extensions.strip= |
|
1598 | 1598 | Mercurial Distributed SCM (version *) (glob) |
|
1599 | 1599 | (see https://mercurial-scm.org for more information) |
|
1600 | 1600 | |
|
1601 | 1601 | Copyright (C) 2005-* Olivia Mackall and others (glob) |
|
1602 | 1602 | This is free software; see the source for copying conditions. There is NO |
|
1603 | 1603 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1604 | 1604 | |
|
1605 | 1605 | Enabled extensions: |
|
1606 | 1606 | |
|
1607 | 1607 | strip internal |
|
1608 | 1608 | throw external 1.twentythree |
|
1609 | 1609 | |
|
1610 | 1610 | $ hg version -q --config extensions.throw=throw.py |
|
1611 | 1611 | Mercurial Distributed SCM (version *) (glob) |
|
1612 | 1612 | |
|
1613 | 1613 | Test template output: |
|
1614 | 1614 | |
|
1615 | 1615 | $ hg version --config extensions.strip= -T'{extensions}' |
|
1616 | 1616 | strip |
|
1617 | 1617 | |
|
1618 | 1618 | Test JSON output of version: |
|
1619 | 1619 | |
|
1620 | 1620 | $ hg version -Tjson |
|
1621 | 1621 | [ |
|
1622 | 1622 | { |
|
1623 | 1623 | "extensions": [], |
|
1624 | 1624 | "ver": "*" (glob) |
|
1625 | 1625 | } |
|
1626 | 1626 | ] |
|
1627 | 1627 | |
|
1628 | 1628 | $ hg version --config extensions.throw=throw.py -Tjson |
|
1629 | 1629 | [ |
|
1630 | 1630 | { |
|
1631 | 1631 | "extensions": [{"bundled": false, "name": "throw", "ver": "1.twentythree"}], |
|
1632 | 1632 | "ver": "3.2.2" |
|
1633 | 1633 | } |
|
1634 | 1634 | ] |
|
1635 | 1635 | |
|
1636 | 1636 | $ hg version --config extensions.strip= -Tjson |
|
1637 | 1637 | [ |
|
1638 | 1638 | { |
|
1639 | 1639 | "extensions": [{"bundled": true, "name": "strip", "ver": null}], |
|
1640 | 1640 | "ver": "*" (glob) |
|
1641 | 1641 | } |
|
1642 | 1642 | ] |
|
1643 | 1643 | |
|
1644 | 1644 | Test template output of version: |
|
1645 | 1645 | |
|
1646 | 1646 | $ hg version --config extensions.throw=throw.py --config extensions.strip= \ |
|
1647 | 1647 | > -T'{extensions % "{name} {pad(ver, 16)} ({if(bundled, "internal", "external")})\n"}' |
|
1648 | 1648 | strip (internal) |
|
1649 | 1649 | throw 1.twentythree (external) |
|
1650 | 1650 | |
|
1651 | 1651 | Refuse to load extensions with minimum version requirements |
|
1652 | 1652 | |
|
1653 | 1653 | $ cat > minversion1.py << EOF |
|
1654 | 1654 | > from mercurial import util |
|
1655 | 1655 | > util.version = lambda: b'3.5.2' |
|
1656 | 1656 | > minimumhgversion = b'3.6' |
|
1657 | 1657 | > EOF |
|
1658 | 1658 | $ hg --config extensions.minversion=minversion1.py version |
|
1659 | 1659 | (third party extension minversion requires version 3.6 or newer of Mercurial (current: 3.5.2); disabling) |
|
1660 | 1660 | Mercurial Distributed SCM (version 3.5.2) |
|
1661 | 1661 | (see https://mercurial-scm.org for more information) |
|
1662 | 1662 | |
|
1663 | 1663 | Copyright (C) 2005-* Olivia Mackall and others (glob) |
|
1664 | 1664 | This is free software; see the source for copying conditions. There is NO |
|
1665 | 1665 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1666 | 1666 | |
|
1667 | 1667 | $ cat > minversion2.py << EOF |
|
1668 | 1668 | > from mercurial import util |
|
1669 | 1669 | > util.version = lambda: b'3.6' |
|
1670 | 1670 | > minimumhgversion = b'3.7' |
|
1671 | 1671 | > EOF |
|
1672 | 1672 | $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third' |
|
1673 | 1673 | (third party extension minversion requires version 3.7 or newer of Mercurial (current: 3.6); disabling) |
|
1674 | 1674 | |
|
1675 | 1675 | Can load version that is only off by point release |
|
1676 | 1676 | |
|
1677 | 1677 | $ cat > minversion2.py << EOF |
|
1678 | 1678 | > from mercurial import util |
|
1679 | 1679 | > util.version = lambda: b'3.6.1' |
|
1680 | 1680 | > minimumhgversion = b'3.6' |
|
1681 | 1681 | > EOF |
|
1682 | 1682 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' |
|
1683 | 1683 | [1] |
|
1684 | 1684 | |
|
1685 | 1685 | Can load minimum version identical to current |
|
1686 | 1686 | |
|
1687 | 1687 | $ cat > minversion3.py << EOF |
|
1688 | 1688 | > from mercurial import util |
|
1689 | 1689 | > util.version = lambda: b'3.5' |
|
1690 | 1690 | > minimumhgversion = b'3.5' |
|
1691 | 1691 | > EOF |
|
1692 | 1692 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' |
|
1693 | 1693 | [1] |
|
1694 | 1694 | |
|
1695 | 1695 | Don't explode on py3 with a bad version number (both str vs bytes, and not enough |
|
1696 | 1696 | parts) |
|
1697 | 1697 | |
|
1698 | 1698 | $ cat > minversion4.py << EOF |
|
1699 | 1699 | > from mercurial import util |
|
1700 | 1700 | > util.version = lambda: b'3.5' |
|
1701 | 1701 | > minimumhgversion = '3' |
|
1702 | 1702 | > EOF |
|
1703 | 1703 | $ hg --config extensions.minversion=minversion4.py version -v |
|
1704 | 1704 | Mercurial Distributed SCM (version 3.5) |
|
1705 | 1705 | (see https://mercurial-scm.org for more information) |
|
1706 | 1706 | |
|
1707 | 1707 | Copyright (C) 2005-* Olivia Mackall and others (glob) |
|
1708 | 1708 | This is free software; see the source for copying conditions. There is NO |
|
1709 | 1709 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1710 | 1710 | |
|
1711 | 1711 | Enabled extensions: |
|
1712 | 1712 | |
|
1713 | 1713 | minversion external |
|
1714 | 1714 | |
|
1715 | 1715 | Restore HGRCPATH |
|
1716 | 1716 | |
|
1717 | 1717 | $ HGRCPATH=$ORGHGRCPATH |
|
1718 | 1718 | $ export HGRCPATH |
|
1719 | 1719 | |
|
1720 | 1720 | Commands handling multiple repositories at a time should invoke only |
|
1721 | 1721 | "reposetup()" of extensions enabling in the target repository. |
|
1722 | 1722 | |
|
1723 | 1723 | $ mkdir reposetup-test |
|
1724 | 1724 | $ cd reposetup-test |
|
1725 | 1725 | |
|
1726 | 1726 | $ cat > $TESTTMP/reposetuptest.py <<EOF |
|
1727 | 1727 | > from mercurial import extensions |
|
1728 | 1728 | > def reposetup(ui, repo): |
|
1729 | 1729 | > ui.write(b'reposetup() for %s\n' % (repo.root)) |
|
1730 | 1730 | > ui.flush() |
|
1731 | 1731 | > EOF |
|
1732 | 1732 | $ hg init src |
|
1733 | 1733 | $ echo a > src/a |
|
1734 | 1734 | $ hg -R src commit -Am '#0 at src/a' |
|
1735 | 1735 | adding a |
|
1736 | 1736 | $ echo '[extensions]' >> src/.hg/hgrc |
|
1737 | 1737 | $ echo '# enable extension locally' >> src/.hg/hgrc |
|
1738 | 1738 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc |
|
1739 | 1739 | $ hg -R src status |
|
1740 | 1740 | reposetup() for $TESTTMP/reposetup-test/src |
|
1741 | 1741 | reposetup() for $TESTTMP/reposetup-test/src (chg !) |
|
1742 | 1742 | |
|
1743 | 1743 | #if no-extraextensions |
|
1744 | 1744 | $ hg --cwd src debugextensions |
|
1745 | 1745 | reposetup() for $TESTTMP/reposetup-test/src |
|
1746 | 1746 | dodo (untested!) |
|
1747 | 1747 | dudu (untested!) |
|
1748 | 1748 | mq |
|
1749 | 1749 | reposetuptest (untested!) |
|
1750 | 1750 | strip |
|
1751 | 1751 | #endif |
|
1752 | 1752 | |
|
1753 | 1753 | $ hg clone -U src clone-dst1 |
|
1754 | 1754 | reposetup() for $TESTTMP/reposetup-test/src |
|
1755 | 1755 | $ hg init push-dst1 |
|
1756 | 1756 | $ hg -q -R src push push-dst1 |
|
1757 | 1757 | reposetup() for $TESTTMP/reposetup-test/src |
|
1758 | 1758 | $ hg init pull-src1 |
|
1759 | 1759 | $ hg -q -R pull-src1 pull src |
|
1760 | 1760 | reposetup() for $TESTTMP/reposetup-test/src |
|
1761 | 1761 | |
|
1762 | 1762 | $ cat <<EOF >> $HGRCPATH |
|
1763 | 1763 | > [extensions] |
|
1764 | 1764 | > # disable extension globally and explicitly |
|
1765 | 1765 | > reposetuptest = ! |
|
1766 | 1766 | > EOF |
|
1767 | 1767 | $ hg clone -U src clone-dst2 |
|
1768 | 1768 | reposetup() for $TESTTMP/reposetup-test/src |
|
1769 | 1769 | $ hg init push-dst2 |
|
1770 | 1770 | $ hg -q -R src push push-dst2 |
|
1771 | 1771 | reposetup() for $TESTTMP/reposetup-test/src |
|
1772 | 1772 | $ hg init pull-src2 |
|
1773 | 1773 | $ hg -q -R pull-src2 pull src |
|
1774 | 1774 | reposetup() for $TESTTMP/reposetup-test/src |
|
1775 | 1775 | |
|
1776 | 1776 | $ cat <<EOF >> $HGRCPATH |
|
1777 | 1777 | > [extensions] |
|
1778 | 1778 | > # enable extension globally |
|
1779 | 1779 | > reposetuptest = $TESTTMP/reposetuptest.py |
|
1780 | 1780 | > EOF |
|
1781 | 1781 | $ hg clone -U src clone-dst3 |
|
1782 | 1782 | reposetup() for $TESTTMP/reposetup-test/src |
|
1783 | 1783 | reposetup() for $TESTTMP/reposetup-test/clone-dst3 |
|
1784 | 1784 | $ hg init push-dst3 |
|
1785 | 1785 | reposetup() for $TESTTMP/reposetup-test/push-dst3 |
|
1786 | 1786 | $ hg -q -R src push push-dst3 |
|
1787 | 1787 | reposetup() for $TESTTMP/reposetup-test/src |
|
1788 | 1788 | reposetup() for $TESTTMP/reposetup-test/push-dst3 |
|
1789 | 1789 | $ hg init pull-src3 |
|
1790 | 1790 | reposetup() for $TESTTMP/reposetup-test/pull-src3 |
|
1791 | 1791 | $ hg -q -R pull-src3 pull src |
|
1792 | 1792 | reposetup() for $TESTTMP/reposetup-test/pull-src3 |
|
1793 | 1793 | reposetup() for $TESTTMP/reposetup-test/src |
|
1794 | 1794 | |
|
1795 | 1795 | $ echo '[extensions]' >> src/.hg/hgrc |
|
1796 | 1796 | $ echo '# disable extension locally' >> src/.hg/hgrc |
|
1797 | 1797 | $ echo 'reposetuptest = !' >> src/.hg/hgrc |
|
1798 | 1798 | $ hg clone -U src clone-dst4 |
|
1799 | 1799 | reposetup() for $TESTTMP/reposetup-test/clone-dst4 |
|
1800 | 1800 | $ hg init push-dst4 |
|
1801 | 1801 | reposetup() for $TESTTMP/reposetup-test/push-dst4 |
|
1802 | 1802 | $ hg -q -R src push push-dst4 |
|
1803 | 1803 | reposetup() for $TESTTMP/reposetup-test/push-dst4 |
|
1804 | 1804 | $ hg init pull-src4 |
|
1805 | 1805 | reposetup() for $TESTTMP/reposetup-test/pull-src4 |
|
1806 | 1806 | $ hg -q -R pull-src4 pull src |
|
1807 | 1807 | reposetup() for $TESTTMP/reposetup-test/pull-src4 |
|
1808 | 1808 | |
|
1809 | 1809 | disabling in command line overlays with all configuration |
|
1810 | 1810 | $ hg --config extensions.reposetuptest=! clone -U src clone-dst5 |
|
1811 | 1811 | $ hg --config extensions.reposetuptest=! init push-dst5 |
|
1812 | 1812 | $ hg --config extensions.reposetuptest=! -q -R src push push-dst5 |
|
1813 | 1813 | $ hg --config extensions.reposetuptest=! init pull-src5 |
|
1814 | 1814 | $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src |
|
1815 | 1815 | |
|
1816 | 1816 | $ cat <<EOF >> $HGRCPATH |
|
1817 | 1817 | > [extensions] |
|
1818 | 1818 | > # disable extension globally and explicitly |
|
1819 | 1819 | > reposetuptest = ! |
|
1820 | 1820 | > EOF |
|
1821 | 1821 | $ hg init parent |
|
1822 | 1822 | $ hg init parent/sub1 |
|
1823 | 1823 | $ echo 1 > parent/sub1/1 |
|
1824 | 1824 | $ hg -R parent/sub1 commit -Am '#0 at parent/sub1' |
|
1825 | 1825 | adding 1 |
|
1826 | 1826 | $ hg init parent/sub2 |
|
1827 | 1827 | $ hg init parent/sub2/sub21 |
|
1828 | 1828 | $ echo 21 > parent/sub2/sub21/21 |
|
1829 | 1829 | $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21' |
|
1830 | 1830 | adding 21 |
|
1831 | 1831 | $ cat > parent/sub2/.hgsub <<EOF |
|
1832 | 1832 | > sub21 = sub21 |
|
1833 | 1833 | > EOF |
|
1834 | 1834 | $ hg -R parent/sub2 commit -Am '#0 at parent/sub2' |
|
1835 | 1835 | adding .hgsub |
|
1836 | 1836 | $ hg init parent/sub3 |
|
1837 | 1837 | $ echo 3 > parent/sub3/3 |
|
1838 | 1838 | $ hg -R parent/sub3 commit -Am '#0 at parent/sub3' |
|
1839 | 1839 | adding 3 |
|
1840 | 1840 | $ cat > parent/.hgsub <<EOF |
|
1841 | 1841 | > sub1 = sub1 |
|
1842 | 1842 | > sub2 = sub2 |
|
1843 | 1843 | > sub3 = sub3 |
|
1844 | 1844 | > EOF |
|
1845 | 1845 | $ hg -R parent commit -Am '#0 at parent' |
|
1846 | 1846 | adding .hgsub |
|
1847 | 1847 | $ echo '[extensions]' >> parent/.hg/hgrc |
|
1848 | 1848 | $ echo '# enable extension locally' >> parent/.hg/hgrc |
|
1849 | 1849 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc |
|
1850 | 1850 | $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc |
|
1851 | 1851 | $ hg -R parent status -S -A |
|
1852 | 1852 | reposetup() for $TESTTMP/reposetup-test/parent |
|
1853 | 1853 | reposetup() for $TESTTMP/reposetup-test/parent/sub2 |
|
1854 | 1854 | C .hgsub |
|
1855 | 1855 | C .hgsubstate |
|
1856 | 1856 | C sub1/1 |
|
1857 | 1857 | C sub2/.hgsub |
|
1858 | 1858 | C sub2/.hgsubstate |
|
1859 | 1859 | C sub2/sub21/21 |
|
1860 | 1860 | C sub3/3 |
|
1861 | 1861 | |
|
1862 | 1862 | $ cd .. |
|
1863 | 1863 | |
|
1864 | 1864 | Prohibit registration of commands that don't use @command (issue5137) |
|
1865 | 1865 | |
|
1866 | 1866 | $ hg init deprecated |
|
1867 | 1867 | $ cd deprecated |
|
1868 | 1868 | |
|
1869 | 1869 | $ cat <<EOF > deprecatedcmd.py |
|
1870 | 1870 | > def deprecatedcmd(repo, ui): |
|
1871 | 1871 | > pass |
|
1872 | 1872 | > cmdtable = { |
|
1873 | 1873 | > b'deprecatedcmd': (deprecatedcmd, [], b''), |
|
1874 | 1874 | > } |
|
1875 | 1875 | > EOF |
|
1876 | 1876 | $ cat <<EOF > .hg/hgrc |
|
1877 | 1877 | > [extensions] |
|
1878 | 1878 | > deprecatedcmd = `pwd`/deprecatedcmd.py |
|
1879 | 1879 | > mq = ! |
|
1880 | 1880 | > hgext.mq = ! |
|
1881 | 1881 | > hgext/mq = ! |
|
1882 | 1882 | > EOF |
|
1883 | 1883 | |
|
1884 | 1884 | $ hg deprecatedcmd > /dev/null |
|
1885 | 1885 | *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo |
|
1886 | 1886 | *** (use @command decorator to register 'deprecatedcmd') |
|
1887 | 1887 | hg: unknown command 'deprecatedcmd' |
|
1888 | 1888 | (use 'hg help' for a list of commands) |
|
1889 | 1889 | [10] |
|
1890 | 1890 | |
|
1891 | 1891 | the extension shouldn't be loaded at all so the mq works: |
|
1892 | 1892 | |
|
1893 | 1893 | $ hg qseries --config extensions.mq= > /dev/null |
|
1894 | 1894 | *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo |
|
1895 | 1895 | *** (use @command decorator to register 'deprecatedcmd') |
|
1896 | 1896 | |
|
1897 | 1897 | $ cd .. |
|
1898 | 1898 | |
|
1899 | 1899 | Test synopsis and docstring extending |
|
1900 | 1900 | |
|
1901 | 1901 | $ hg init exthelp |
|
1902 | 1902 | $ cat > exthelp.py <<EOF |
|
1903 | 1903 | > from mercurial import commands, extensions |
|
1904 | 1904 | > def exbookmarks(orig, *args, **opts): |
|
1905 | 1905 | > return orig(*args, **opts) |
|
1906 | 1906 | > def uisetup(ui): |
|
1907 | 1907 | > synopsis = b' GREPME [--foo] [-x]' |
|
1908 | 1908 | > docstring = ''' |
|
1909 | 1909 | > GREPME make sure that this is in the help! |
|
1910 | 1910 | > ''' |
|
1911 | 1911 | > extensions.wrapcommand(commands.table, b'bookmarks', exbookmarks, |
|
1912 | 1912 | > synopsis, docstring) |
|
1913 | 1913 | > EOF |
|
1914 | 1914 | $ abspath=`pwd`/exthelp.py |
|
1915 | 1915 | $ echo '[extensions]' >> $HGRCPATH |
|
1916 | 1916 | $ echo "exthelp = $abspath" >> $HGRCPATH |
|
1917 | 1917 | $ cd exthelp |
|
1918 | 1918 | $ hg help bookmarks | grep GREPME |
|
1919 | 1919 | hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x] |
|
1920 | 1920 | GREPME make sure that this is in the help! |
|
1921 | 1921 | $ cd .. |
|
1922 | 1922 | |
|
1923 | 1923 | Prohibit the use of unicode strings as the default value of options |
|
1924 | 1924 | |
|
1925 | 1925 | $ hg init $TESTTMP/opt-unicode-default |
|
1926 | 1926 | |
|
1927 | 1927 | $ cat > $TESTTMP/test_unicode_default_value.py << EOF |
|
1928 | 1928 | > from __future__ import print_function |
|
1929 | 1929 | > from mercurial import registrar |
|
1930 | 1930 | > cmdtable = {} |
|
1931 | 1931 | > command = registrar.command(cmdtable) |
|
1932 | 1932 | > @command(b'dummy', [(b'', b'opt', u'value', u'help')], 'ext [OPTIONS]') |
|
1933 | 1933 | > def ext(*args, **opts): |
|
1934 | 1934 | > print(opts[b'opt'], flush=True) |
|
1935 | 1935 | > EOF |
|
1936 | 1936 | $ "$PYTHON" $TESTTMP/unflush.py $TESTTMP/test_unicode_default_value.py |
|
1937 | 1937 | $ cat > $TESTTMP/opt-unicode-default/.hg/hgrc << EOF |
|
1938 | 1938 | > [extensions] |
|
1939 | 1939 | > test_unicode_default_value = $TESTTMP/test_unicode_default_value.py |
|
1940 | 1940 | > EOF |
|
1941 | 1941 | $ hg -R $TESTTMP/opt-unicode-default dummy |
|
1942 | 1942 | *** failed to import extension "test_unicode_default_value" from $TESTTMP/test_unicode_default_value.py: unicode 'value' found in cmdtable.dummy |
|
1943 | 1943 | *** (use b'' to make it byte string) |
|
1944 | 1944 | hg: unknown command 'dummy' |
|
1945 | 1945 | (did you mean summary?) |
|
1946 | 1946 | [10] |
|
1947 | ||
|
1948 | Check the mandatory extension feature | |
|
1949 | ------------------------------------- | |
|
1950 | ||
|
1951 | $ hg init mandatory-extensions | |
|
1952 | $ cat > $TESTTMP/mandatory-extensions/.hg/good.py << EOF | |
|
1953 | > pass | |
|
1954 | > EOF | |
|
1955 | $ cat > $TESTTMP/mandatory-extensions/.hg/bad.py << EOF | |
|
1956 | > raise RuntimeError("babar") | |
|
1957 | > EOF | |
|
1958 | $ cat > $TESTTMP/mandatory-extensions/.hg/syntax.py << EOF | |
|
1959 | > def ( | |
|
1960 | > EOF | |
|
1961 | ||
|
1962 | Check that the good one load : | |
|
1963 | ||
|
1964 | $ cat > $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
|
1965 | > [extensions] | |
|
1966 | > good = $TESTTMP/mandatory-extensions/.hg/good.py | |
|
1967 | > EOF | |
|
1968 | ||
|
1969 | $ hg -R mandatory-extensions id | |
|
1970 | 000000000000 tip | |
|
1971 | ||
|
1972 | Make it mandatory to load | |
|
1973 | ||
|
1974 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
|
1975 | > good:required = yes | |
|
1976 | > EOF | |
|
1977 | ||
|
1978 | $ hg -R mandatory-extensions id | |
|
1979 | 000000000000 tip | |
|
1980 | ||
|
1981 | Check that the bad one does not load | |
|
1982 | ||
|
1983 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
|
1984 | > bad = $TESTTMP/mandatory-extensions/.hg/bad.py | |
|
1985 | > EOF | |
|
1986 | ||
|
1987 | $ hg -R mandatory-extensions id | |
|
1988 | *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar | |
|
1989 | 000000000000 tip | |
|
1990 | ||
|
1991 | Make it mandatory to load | |
|
1992 | ||
|
1993 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
|
1994 | > bad:required = yes | |
|
1995 | > EOF | |
|
1996 | ||
|
1997 | $ hg -R mandatory-extensions id | |
|
1998 | abort: failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar | |
|
1999 | (loading of this extension was required, see `hg help config.extensions` for details) | |
|
2000 | [255] | |
|
2001 | ||
|
2002 | Make it not mandatory to load | |
|
2003 | ||
|
2004 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
|
2005 | > bad:required = no | |
|
2006 | > EOF | |
|
2007 | ||
|
2008 | $ hg -R mandatory-extensions id | |
|
2009 | *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar | |
|
2010 | 000000000000 tip | |
|
2011 | ||
|
2012 | Same check with the syntax error one | |
|
2013 | ||
|
2014 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
|
2015 | > bad = ! | |
|
2016 | > syntax = $TESTTMP/mandatory-extensions/.hg/syntax.py | |
|
2017 | > syntax:required = yes | |
|
2018 | > EOF | |
|
2019 | ||
|
2020 | $ hg -R mandatory-extensions id | |
|
2021 | abort: failed to import extension "syntax" from $TESTTMP/mandatory-extensions/.hg/syntax.py: invalid syntax (*syntax.py, line 1) (glob) | |
|
2022 | (loading of this extension was required, see `hg help config.extensions` for details) | |
|
2023 | [255] | |
|
2024 | ||
|
2025 | Same check with a missing one | |
|
2026 | ||
|
2027 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
|
2028 | > syntax = ! | |
|
2029 | > syntax:required = | |
|
2030 | > missing = foo/bar/baz/I/do/not/exist/ | |
|
2031 | > missing:required = yes | |
|
2032 | > EOF | |
|
2033 | ||
|
2034 | $ hg -R mandatory-extensions id | |
|
2035 | abort: failed to import extension "missing" from foo/bar/baz/I/do/not/exist/: [Errno 2] $ENOENT$: 'foo/bar/baz/I/do/not/exist' | |
|
2036 | (loading of this extension was required, see `hg help config.extensions` for details) | |
|
2037 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now