Show More
The requested changes are too big and content was truncated. Show full diff
@@ -1,2731 +1,2732 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 | 1289 | b'extdata', |
|
1290 | 1290 | b'.*', |
|
1291 | 1291 | default=None, |
|
1292 | 1292 | generic=True, |
|
1293 | 1293 | ) |
|
1294 | 1294 | coreconfigitem( |
|
1295 | 1295 | b'format', |
|
1296 | 1296 | b'bookmarks-in-store', |
|
1297 | 1297 | default=False, |
|
1298 | 1298 | ) |
|
1299 | 1299 | coreconfigitem( |
|
1300 | 1300 | b'format', |
|
1301 | 1301 | b'chunkcachesize', |
|
1302 | 1302 | default=None, |
|
1303 | 1303 | experimental=True, |
|
1304 | 1304 | ) |
|
1305 | 1305 | coreconfigitem( |
|
1306 | 1306 | # Enable this dirstate format *when creating a new repository*. |
|
1307 | 1307 | # Which format to use for existing repos is controlled by .hg/requires |
|
1308 | 1308 | b'format', |
|
1309 |
b'e |
|
|
1309 | b'use-dirstate-v2', | |
|
1310 | 1310 | default=False, |
|
1311 | 1311 | experimental=True, |
|
1312 | alias=[(b'format', b'exp-rc-dirstate-v2')], | |
|
1312 | 1313 | ) |
|
1313 | 1314 | coreconfigitem( |
|
1314 | 1315 | b'format', |
|
1315 | 1316 | b'dotencode', |
|
1316 | 1317 | default=True, |
|
1317 | 1318 | ) |
|
1318 | 1319 | coreconfigitem( |
|
1319 | 1320 | b'format', |
|
1320 | 1321 | b'generaldelta', |
|
1321 | 1322 | default=False, |
|
1322 | 1323 | experimental=True, |
|
1323 | 1324 | ) |
|
1324 | 1325 | coreconfigitem( |
|
1325 | 1326 | b'format', |
|
1326 | 1327 | b'manifestcachesize', |
|
1327 | 1328 | default=None, |
|
1328 | 1329 | experimental=True, |
|
1329 | 1330 | ) |
|
1330 | 1331 | coreconfigitem( |
|
1331 | 1332 | b'format', |
|
1332 | 1333 | b'maxchainlen', |
|
1333 | 1334 | default=dynamicdefault, |
|
1334 | 1335 | experimental=True, |
|
1335 | 1336 | ) |
|
1336 | 1337 | coreconfigitem( |
|
1337 | 1338 | b'format', |
|
1338 | 1339 | b'obsstore-version', |
|
1339 | 1340 | default=None, |
|
1340 | 1341 | ) |
|
1341 | 1342 | coreconfigitem( |
|
1342 | 1343 | b'format', |
|
1343 | 1344 | b'sparse-revlog', |
|
1344 | 1345 | default=True, |
|
1345 | 1346 | ) |
|
1346 | 1347 | coreconfigitem( |
|
1347 | 1348 | b'format', |
|
1348 | 1349 | b'revlog-compression', |
|
1349 | 1350 | default=lambda: [b'zstd', b'zlib'], |
|
1350 | 1351 | alias=[(b'experimental', b'format.compression')], |
|
1351 | 1352 | ) |
|
1352 | 1353 | # Experimental TODOs: |
|
1353 | 1354 | # |
|
1354 | 1355 | # * Same as for evlogv2 (but for the reduction of the number of files) |
|
1355 | 1356 | # * Improvement to investigate |
|
1356 | 1357 | # - storing .hgtags fnode |
|
1357 | 1358 | # - storing `rank` of changesets |
|
1358 | 1359 | # - storing branch related identifier |
|
1359 | 1360 | |
|
1360 | 1361 | coreconfigitem( |
|
1361 | 1362 | b'format', |
|
1362 | 1363 | b'exp-use-changelog-v2', |
|
1363 | 1364 | default=None, |
|
1364 | 1365 | experimental=True, |
|
1365 | 1366 | ) |
|
1366 | 1367 | coreconfigitem( |
|
1367 | 1368 | b'format', |
|
1368 | 1369 | b'usefncache', |
|
1369 | 1370 | default=True, |
|
1370 | 1371 | ) |
|
1371 | 1372 | coreconfigitem( |
|
1372 | 1373 | b'format', |
|
1373 | 1374 | b'usegeneraldelta', |
|
1374 | 1375 | default=True, |
|
1375 | 1376 | ) |
|
1376 | 1377 | coreconfigitem( |
|
1377 | 1378 | b'format', |
|
1378 | 1379 | b'usestore', |
|
1379 | 1380 | default=True, |
|
1380 | 1381 | ) |
|
1381 | 1382 | |
|
1382 | 1383 | |
|
1383 | 1384 | def _persistent_nodemap_default(): |
|
1384 | 1385 | """compute `use-persistent-nodemap` default value |
|
1385 | 1386 | |
|
1386 | 1387 | The feature is disabled unless a fast implementation is available. |
|
1387 | 1388 | """ |
|
1388 | 1389 | from . import policy |
|
1389 | 1390 | |
|
1390 | 1391 | return policy.importrust('revlog') is not None |
|
1391 | 1392 | |
|
1392 | 1393 | |
|
1393 | 1394 | coreconfigitem( |
|
1394 | 1395 | b'format', |
|
1395 | 1396 | b'use-persistent-nodemap', |
|
1396 | 1397 | default=_persistent_nodemap_default, |
|
1397 | 1398 | ) |
|
1398 | 1399 | coreconfigitem( |
|
1399 | 1400 | b'format', |
|
1400 | 1401 | b'exp-use-copies-side-data-changeset', |
|
1401 | 1402 | default=False, |
|
1402 | 1403 | experimental=True, |
|
1403 | 1404 | ) |
|
1404 | 1405 | coreconfigitem( |
|
1405 | 1406 | b'format', |
|
1406 | 1407 | b'use-share-safe', |
|
1407 | 1408 | default=False, |
|
1408 | 1409 | ) |
|
1409 | 1410 | coreconfigitem( |
|
1410 | 1411 | b'format', |
|
1411 | 1412 | b'internal-phase', |
|
1412 | 1413 | default=False, |
|
1413 | 1414 | experimental=True, |
|
1414 | 1415 | ) |
|
1415 | 1416 | coreconfigitem( |
|
1416 | 1417 | b'fsmonitor', |
|
1417 | 1418 | b'warn_when_unused', |
|
1418 | 1419 | default=True, |
|
1419 | 1420 | ) |
|
1420 | 1421 | coreconfigitem( |
|
1421 | 1422 | b'fsmonitor', |
|
1422 | 1423 | b'warn_update_file_count', |
|
1423 | 1424 | default=50000, |
|
1424 | 1425 | ) |
|
1425 | 1426 | coreconfigitem( |
|
1426 | 1427 | b'fsmonitor', |
|
1427 | 1428 | b'warn_update_file_count_rust', |
|
1428 | 1429 | default=400000, |
|
1429 | 1430 | ) |
|
1430 | 1431 | coreconfigitem( |
|
1431 | 1432 | b'help', |
|
1432 | 1433 | br'hidden-command\..*', |
|
1433 | 1434 | default=False, |
|
1434 | 1435 | generic=True, |
|
1435 | 1436 | ) |
|
1436 | 1437 | coreconfigitem( |
|
1437 | 1438 | b'help', |
|
1438 | 1439 | br'hidden-topic\..*', |
|
1439 | 1440 | default=False, |
|
1440 | 1441 | generic=True, |
|
1441 | 1442 | ) |
|
1442 | 1443 | coreconfigitem( |
|
1443 | 1444 | b'hooks', |
|
1444 | 1445 | b'[^:]*', |
|
1445 | 1446 | default=dynamicdefault, |
|
1446 | 1447 | generic=True, |
|
1447 | 1448 | ) |
|
1448 | 1449 | coreconfigitem( |
|
1449 | 1450 | b'hooks', |
|
1450 | 1451 | b'.*:run-with-plain', |
|
1451 | 1452 | default=True, |
|
1452 | 1453 | generic=True, |
|
1453 | 1454 | ) |
|
1454 | 1455 | coreconfigitem( |
|
1455 | 1456 | b'hgweb-paths', |
|
1456 | 1457 | b'.*', |
|
1457 | 1458 | default=list, |
|
1458 | 1459 | generic=True, |
|
1459 | 1460 | ) |
|
1460 | 1461 | coreconfigitem( |
|
1461 | 1462 | b'hostfingerprints', |
|
1462 | 1463 | b'.*', |
|
1463 | 1464 | default=list, |
|
1464 | 1465 | generic=True, |
|
1465 | 1466 | ) |
|
1466 | 1467 | coreconfigitem( |
|
1467 | 1468 | b'hostsecurity', |
|
1468 | 1469 | b'ciphers', |
|
1469 | 1470 | default=None, |
|
1470 | 1471 | ) |
|
1471 | 1472 | coreconfigitem( |
|
1472 | 1473 | b'hostsecurity', |
|
1473 | 1474 | b'minimumprotocol', |
|
1474 | 1475 | default=dynamicdefault, |
|
1475 | 1476 | ) |
|
1476 | 1477 | coreconfigitem( |
|
1477 | 1478 | b'hostsecurity', |
|
1478 | 1479 | b'.*:minimumprotocol$', |
|
1479 | 1480 | default=dynamicdefault, |
|
1480 | 1481 | generic=True, |
|
1481 | 1482 | ) |
|
1482 | 1483 | coreconfigitem( |
|
1483 | 1484 | b'hostsecurity', |
|
1484 | 1485 | b'.*:ciphers$', |
|
1485 | 1486 | default=dynamicdefault, |
|
1486 | 1487 | generic=True, |
|
1487 | 1488 | ) |
|
1488 | 1489 | coreconfigitem( |
|
1489 | 1490 | b'hostsecurity', |
|
1490 | 1491 | b'.*:fingerprints$', |
|
1491 | 1492 | default=list, |
|
1492 | 1493 | generic=True, |
|
1493 | 1494 | ) |
|
1494 | 1495 | coreconfigitem( |
|
1495 | 1496 | b'hostsecurity', |
|
1496 | 1497 | b'.*:verifycertsfile$', |
|
1497 | 1498 | default=None, |
|
1498 | 1499 | generic=True, |
|
1499 | 1500 | ) |
|
1500 | 1501 | |
|
1501 | 1502 | coreconfigitem( |
|
1502 | 1503 | b'http_proxy', |
|
1503 | 1504 | b'always', |
|
1504 | 1505 | default=False, |
|
1505 | 1506 | ) |
|
1506 | 1507 | coreconfigitem( |
|
1507 | 1508 | b'http_proxy', |
|
1508 | 1509 | b'host', |
|
1509 | 1510 | default=None, |
|
1510 | 1511 | ) |
|
1511 | 1512 | coreconfigitem( |
|
1512 | 1513 | b'http_proxy', |
|
1513 | 1514 | b'no', |
|
1514 | 1515 | default=list, |
|
1515 | 1516 | ) |
|
1516 | 1517 | coreconfigitem( |
|
1517 | 1518 | b'http_proxy', |
|
1518 | 1519 | b'passwd', |
|
1519 | 1520 | default=None, |
|
1520 | 1521 | ) |
|
1521 | 1522 | coreconfigitem( |
|
1522 | 1523 | b'http_proxy', |
|
1523 | 1524 | b'user', |
|
1524 | 1525 | default=None, |
|
1525 | 1526 | ) |
|
1526 | 1527 | |
|
1527 | 1528 | coreconfigitem( |
|
1528 | 1529 | b'http', |
|
1529 | 1530 | b'timeout', |
|
1530 | 1531 | default=None, |
|
1531 | 1532 | ) |
|
1532 | 1533 | |
|
1533 | 1534 | coreconfigitem( |
|
1534 | 1535 | b'logtoprocess', |
|
1535 | 1536 | b'commandexception', |
|
1536 | 1537 | default=None, |
|
1537 | 1538 | ) |
|
1538 | 1539 | coreconfigitem( |
|
1539 | 1540 | b'logtoprocess', |
|
1540 | 1541 | b'commandfinish', |
|
1541 | 1542 | default=None, |
|
1542 | 1543 | ) |
|
1543 | 1544 | coreconfigitem( |
|
1544 | 1545 | b'logtoprocess', |
|
1545 | 1546 | b'command', |
|
1546 | 1547 | default=None, |
|
1547 | 1548 | ) |
|
1548 | 1549 | coreconfigitem( |
|
1549 | 1550 | b'logtoprocess', |
|
1550 | 1551 | b'develwarn', |
|
1551 | 1552 | default=None, |
|
1552 | 1553 | ) |
|
1553 | 1554 | coreconfigitem( |
|
1554 | 1555 | b'logtoprocess', |
|
1555 | 1556 | b'uiblocked', |
|
1556 | 1557 | default=None, |
|
1557 | 1558 | ) |
|
1558 | 1559 | coreconfigitem( |
|
1559 | 1560 | b'merge', |
|
1560 | 1561 | b'checkunknown', |
|
1561 | 1562 | default=b'abort', |
|
1562 | 1563 | ) |
|
1563 | 1564 | coreconfigitem( |
|
1564 | 1565 | b'merge', |
|
1565 | 1566 | b'checkignored', |
|
1566 | 1567 | default=b'abort', |
|
1567 | 1568 | ) |
|
1568 | 1569 | coreconfigitem( |
|
1569 | 1570 | b'experimental', |
|
1570 | 1571 | b'merge.checkpathconflicts', |
|
1571 | 1572 | default=False, |
|
1572 | 1573 | ) |
|
1573 | 1574 | coreconfigitem( |
|
1574 | 1575 | b'merge', |
|
1575 | 1576 | b'followcopies', |
|
1576 | 1577 | default=True, |
|
1577 | 1578 | ) |
|
1578 | 1579 | coreconfigitem( |
|
1579 | 1580 | b'merge', |
|
1580 | 1581 | b'on-failure', |
|
1581 | 1582 | default=b'continue', |
|
1582 | 1583 | ) |
|
1583 | 1584 | coreconfigitem( |
|
1584 | 1585 | b'merge', |
|
1585 | 1586 | b'preferancestor', |
|
1586 | 1587 | default=lambda: [b'*'], |
|
1587 | 1588 | experimental=True, |
|
1588 | 1589 | ) |
|
1589 | 1590 | coreconfigitem( |
|
1590 | 1591 | b'merge', |
|
1591 | 1592 | b'strict-capability-check', |
|
1592 | 1593 | default=False, |
|
1593 | 1594 | ) |
|
1594 | 1595 | coreconfigitem( |
|
1595 | 1596 | b'merge-tools', |
|
1596 | 1597 | b'.*', |
|
1597 | 1598 | default=None, |
|
1598 | 1599 | generic=True, |
|
1599 | 1600 | ) |
|
1600 | 1601 | coreconfigitem( |
|
1601 | 1602 | b'merge-tools', |
|
1602 | 1603 | br'.*\.args$', |
|
1603 | 1604 | default=b"$local $base $other", |
|
1604 | 1605 | generic=True, |
|
1605 | 1606 | priority=-1, |
|
1606 | 1607 | ) |
|
1607 | 1608 | coreconfigitem( |
|
1608 | 1609 | b'merge-tools', |
|
1609 | 1610 | br'.*\.binary$', |
|
1610 | 1611 | default=False, |
|
1611 | 1612 | generic=True, |
|
1612 | 1613 | priority=-1, |
|
1613 | 1614 | ) |
|
1614 | 1615 | coreconfigitem( |
|
1615 | 1616 | b'merge-tools', |
|
1616 | 1617 | br'.*\.check$', |
|
1617 | 1618 | default=list, |
|
1618 | 1619 | generic=True, |
|
1619 | 1620 | priority=-1, |
|
1620 | 1621 | ) |
|
1621 | 1622 | coreconfigitem( |
|
1622 | 1623 | b'merge-tools', |
|
1623 | 1624 | br'.*\.checkchanged$', |
|
1624 | 1625 | default=False, |
|
1625 | 1626 | generic=True, |
|
1626 | 1627 | priority=-1, |
|
1627 | 1628 | ) |
|
1628 | 1629 | coreconfigitem( |
|
1629 | 1630 | b'merge-tools', |
|
1630 | 1631 | br'.*\.executable$', |
|
1631 | 1632 | default=dynamicdefault, |
|
1632 | 1633 | generic=True, |
|
1633 | 1634 | priority=-1, |
|
1634 | 1635 | ) |
|
1635 | 1636 | coreconfigitem( |
|
1636 | 1637 | b'merge-tools', |
|
1637 | 1638 | br'.*\.fixeol$', |
|
1638 | 1639 | default=False, |
|
1639 | 1640 | generic=True, |
|
1640 | 1641 | priority=-1, |
|
1641 | 1642 | ) |
|
1642 | 1643 | coreconfigitem( |
|
1643 | 1644 | b'merge-tools', |
|
1644 | 1645 | br'.*\.gui$', |
|
1645 | 1646 | default=False, |
|
1646 | 1647 | generic=True, |
|
1647 | 1648 | priority=-1, |
|
1648 | 1649 | ) |
|
1649 | 1650 | coreconfigitem( |
|
1650 | 1651 | b'merge-tools', |
|
1651 | 1652 | br'.*\.mergemarkers$', |
|
1652 | 1653 | default=b'basic', |
|
1653 | 1654 | generic=True, |
|
1654 | 1655 | priority=-1, |
|
1655 | 1656 | ) |
|
1656 | 1657 | coreconfigitem( |
|
1657 | 1658 | b'merge-tools', |
|
1658 | 1659 | br'.*\.mergemarkertemplate$', |
|
1659 | 1660 | default=dynamicdefault, # take from command-templates.mergemarker |
|
1660 | 1661 | generic=True, |
|
1661 | 1662 | priority=-1, |
|
1662 | 1663 | ) |
|
1663 | 1664 | coreconfigitem( |
|
1664 | 1665 | b'merge-tools', |
|
1665 | 1666 | br'.*\.priority$', |
|
1666 | 1667 | default=0, |
|
1667 | 1668 | generic=True, |
|
1668 | 1669 | priority=-1, |
|
1669 | 1670 | ) |
|
1670 | 1671 | coreconfigitem( |
|
1671 | 1672 | b'merge-tools', |
|
1672 | 1673 | br'.*\.premerge$', |
|
1673 | 1674 | default=dynamicdefault, |
|
1674 | 1675 | generic=True, |
|
1675 | 1676 | priority=-1, |
|
1676 | 1677 | ) |
|
1677 | 1678 | coreconfigitem( |
|
1678 | 1679 | b'merge-tools', |
|
1679 | 1680 | br'.*\.symlink$', |
|
1680 | 1681 | default=False, |
|
1681 | 1682 | generic=True, |
|
1682 | 1683 | priority=-1, |
|
1683 | 1684 | ) |
|
1684 | 1685 | coreconfigitem( |
|
1685 | 1686 | b'pager', |
|
1686 | 1687 | b'attend-.*', |
|
1687 | 1688 | default=dynamicdefault, |
|
1688 | 1689 | generic=True, |
|
1689 | 1690 | ) |
|
1690 | 1691 | coreconfigitem( |
|
1691 | 1692 | b'pager', |
|
1692 | 1693 | b'ignore', |
|
1693 | 1694 | default=list, |
|
1694 | 1695 | ) |
|
1695 | 1696 | coreconfigitem( |
|
1696 | 1697 | b'pager', |
|
1697 | 1698 | b'pager', |
|
1698 | 1699 | default=dynamicdefault, |
|
1699 | 1700 | ) |
|
1700 | 1701 | coreconfigitem( |
|
1701 | 1702 | b'patch', |
|
1702 | 1703 | b'eol', |
|
1703 | 1704 | default=b'strict', |
|
1704 | 1705 | ) |
|
1705 | 1706 | coreconfigitem( |
|
1706 | 1707 | b'patch', |
|
1707 | 1708 | b'fuzz', |
|
1708 | 1709 | default=2, |
|
1709 | 1710 | ) |
|
1710 | 1711 | coreconfigitem( |
|
1711 | 1712 | b'paths', |
|
1712 | 1713 | b'default', |
|
1713 | 1714 | default=None, |
|
1714 | 1715 | ) |
|
1715 | 1716 | coreconfigitem( |
|
1716 | 1717 | b'paths', |
|
1717 | 1718 | b'default-push', |
|
1718 | 1719 | default=None, |
|
1719 | 1720 | ) |
|
1720 | 1721 | coreconfigitem( |
|
1721 | 1722 | b'paths', |
|
1722 | 1723 | b'.*', |
|
1723 | 1724 | default=None, |
|
1724 | 1725 | generic=True, |
|
1725 | 1726 | ) |
|
1726 | 1727 | coreconfigitem( |
|
1727 | 1728 | b'phases', |
|
1728 | 1729 | b'checksubrepos', |
|
1729 | 1730 | default=b'follow', |
|
1730 | 1731 | ) |
|
1731 | 1732 | coreconfigitem( |
|
1732 | 1733 | b'phases', |
|
1733 | 1734 | b'new-commit', |
|
1734 | 1735 | default=b'draft', |
|
1735 | 1736 | ) |
|
1736 | 1737 | coreconfigitem( |
|
1737 | 1738 | b'phases', |
|
1738 | 1739 | b'publish', |
|
1739 | 1740 | default=True, |
|
1740 | 1741 | ) |
|
1741 | 1742 | coreconfigitem( |
|
1742 | 1743 | b'profiling', |
|
1743 | 1744 | b'enabled', |
|
1744 | 1745 | default=False, |
|
1745 | 1746 | ) |
|
1746 | 1747 | coreconfigitem( |
|
1747 | 1748 | b'profiling', |
|
1748 | 1749 | b'format', |
|
1749 | 1750 | default=b'text', |
|
1750 | 1751 | ) |
|
1751 | 1752 | coreconfigitem( |
|
1752 | 1753 | b'profiling', |
|
1753 | 1754 | b'freq', |
|
1754 | 1755 | default=1000, |
|
1755 | 1756 | ) |
|
1756 | 1757 | coreconfigitem( |
|
1757 | 1758 | b'profiling', |
|
1758 | 1759 | b'limit', |
|
1759 | 1760 | default=30, |
|
1760 | 1761 | ) |
|
1761 | 1762 | coreconfigitem( |
|
1762 | 1763 | b'profiling', |
|
1763 | 1764 | b'nested', |
|
1764 | 1765 | default=0, |
|
1765 | 1766 | ) |
|
1766 | 1767 | coreconfigitem( |
|
1767 | 1768 | b'profiling', |
|
1768 | 1769 | b'output', |
|
1769 | 1770 | default=None, |
|
1770 | 1771 | ) |
|
1771 | 1772 | coreconfigitem( |
|
1772 | 1773 | b'profiling', |
|
1773 | 1774 | b'showmax', |
|
1774 | 1775 | default=0.999, |
|
1775 | 1776 | ) |
|
1776 | 1777 | coreconfigitem( |
|
1777 | 1778 | b'profiling', |
|
1778 | 1779 | b'showmin', |
|
1779 | 1780 | default=dynamicdefault, |
|
1780 | 1781 | ) |
|
1781 | 1782 | coreconfigitem( |
|
1782 | 1783 | b'profiling', |
|
1783 | 1784 | b'showtime', |
|
1784 | 1785 | default=True, |
|
1785 | 1786 | ) |
|
1786 | 1787 | coreconfigitem( |
|
1787 | 1788 | b'profiling', |
|
1788 | 1789 | b'sort', |
|
1789 | 1790 | default=b'inlinetime', |
|
1790 | 1791 | ) |
|
1791 | 1792 | coreconfigitem( |
|
1792 | 1793 | b'profiling', |
|
1793 | 1794 | b'statformat', |
|
1794 | 1795 | default=b'hotpath', |
|
1795 | 1796 | ) |
|
1796 | 1797 | coreconfigitem( |
|
1797 | 1798 | b'profiling', |
|
1798 | 1799 | b'time-track', |
|
1799 | 1800 | default=dynamicdefault, |
|
1800 | 1801 | ) |
|
1801 | 1802 | coreconfigitem( |
|
1802 | 1803 | b'profiling', |
|
1803 | 1804 | b'type', |
|
1804 | 1805 | default=b'stat', |
|
1805 | 1806 | ) |
|
1806 | 1807 | coreconfigitem( |
|
1807 | 1808 | b'progress', |
|
1808 | 1809 | b'assume-tty', |
|
1809 | 1810 | default=False, |
|
1810 | 1811 | ) |
|
1811 | 1812 | coreconfigitem( |
|
1812 | 1813 | b'progress', |
|
1813 | 1814 | b'changedelay', |
|
1814 | 1815 | default=1, |
|
1815 | 1816 | ) |
|
1816 | 1817 | coreconfigitem( |
|
1817 | 1818 | b'progress', |
|
1818 | 1819 | b'clear-complete', |
|
1819 | 1820 | default=True, |
|
1820 | 1821 | ) |
|
1821 | 1822 | coreconfigitem( |
|
1822 | 1823 | b'progress', |
|
1823 | 1824 | b'debug', |
|
1824 | 1825 | default=False, |
|
1825 | 1826 | ) |
|
1826 | 1827 | coreconfigitem( |
|
1827 | 1828 | b'progress', |
|
1828 | 1829 | b'delay', |
|
1829 | 1830 | default=3, |
|
1830 | 1831 | ) |
|
1831 | 1832 | coreconfigitem( |
|
1832 | 1833 | b'progress', |
|
1833 | 1834 | b'disable', |
|
1834 | 1835 | default=False, |
|
1835 | 1836 | ) |
|
1836 | 1837 | coreconfigitem( |
|
1837 | 1838 | b'progress', |
|
1838 | 1839 | b'estimateinterval', |
|
1839 | 1840 | default=60.0, |
|
1840 | 1841 | ) |
|
1841 | 1842 | coreconfigitem( |
|
1842 | 1843 | b'progress', |
|
1843 | 1844 | b'format', |
|
1844 | 1845 | default=lambda: [b'topic', b'bar', b'number', b'estimate'], |
|
1845 | 1846 | ) |
|
1846 | 1847 | coreconfigitem( |
|
1847 | 1848 | b'progress', |
|
1848 | 1849 | b'refresh', |
|
1849 | 1850 | default=0.1, |
|
1850 | 1851 | ) |
|
1851 | 1852 | coreconfigitem( |
|
1852 | 1853 | b'progress', |
|
1853 | 1854 | b'width', |
|
1854 | 1855 | default=dynamicdefault, |
|
1855 | 1856 | ) |
|
1856 | 1857 | coreconfigitem( |
|
1857 | 1858 | b'pull', |
|
1858 | 1859 | b'confirm', |
|
1859 | 1860 | default=False, |
|
1860 | 1861 | ) |
|
1861 | 1862 | coreconfigitem( |
|
1862 | 1863 | b'push', |
|
1863 | 1864 | b'pushvars.server', |
|
1864 | 1865 | default=False, |
|
1865 | 1866 | ) |
|
1866 | 1867 | coreconfigitem( |
|
1867 | 1868 | b'rewrite', |
|
1868 | 1869 | b'backup-bundle', |
|
1869 | 1870 | default=True, |
|
1870 | 1871 | alias=[(b'ui', b'history-editing-backup')], |
|
1871 | 1872 | ) |
|
1872 | 1873 | coreconfigitem( |
|
1873 | 1874 | b'rewrite', |
|
1874 | 1875 | b'update-timestamp', |
|
1875 | 1876 | default=False, |
|
1876 | 1877 | ) |
|
1877 | 1878 | coreconfigitem( |
|
1878 | 1879 | b'rewrite', |
|
1879 | 1880 | b'empty-successor', |
|
1880 | 1881 | default=b'skip', |
|
1881 | 1882 | experimental=True, |
|
1882 | 1883 | ) |
|
1883 |
# experimental as long as format.e |
|
|
1884 | # experimental as long as format.use-dirstate-v2 is. | |
|
1884 | 1885 | coreconfigitem( |
|
1885 | 1886 | b'storage', |
|
1886 | 1887 | b'dirstate-v2.slow-path', |
|
1887 | 1888 | default=b"abort", |
|
1888 | 1889 | experimental=True, |
|
1889 | 1890 | ) |
|
1890 | 1891 | coreconfigitem( |
|
1891 | 1892 | b'storage', |
|
1892 | 1893 | b'new-repo-backend', |
|
1893 | 1894 | default=b'revlogv1', |
|
1894 | 1895 | experimental=True, |
|
1895 | 1896 | ) |
|
1896 | 1897 | coreconfigitem( |
|
1897 | 1898 | b'storage', |
|
1898 | 1899 | b'revlog.optimize-delta-parent-choice', |
|
1899 | 1900 | default=True, |
|
1900 | 1901 | alias=[(b'format', b'aggressivemergedeltas')], |
|
1901 | 1902 | ) |
|
1902 | 1903 | coreconfigitem( |
|
1903 | 1904 | b'storage', |
|
1904 | 1905 | b'revlog.issue6528.fix-incoming', |
|
1905 | 1906 | default=True, |
|
1906 | 1907 | ) |
|
1907 | 1908 | # experimental as long as rust is experimental (or a C version is implemented) |
|
1908 | 1909 | coreconfigitem( |
|
1909 | 1910 | b'storage', |
|
1910 | 1911 | b'revlog.persistent-nodemap.mmap', |
|
1911 | 1912 | default=True, |
|
1912 | 1913 | ) |
|
1913 | 1914 | # experimental as long as format.use-persistent-nodemap is. |
|
1914 | 1915 | coreconfigitem( |
|
1915 | 1916 | b'storage', |
|
1916 | 1917 | b'revlog.persistent-nodemap.slow-path', |
|
1917 | 1918 | default=b"abort", |
|
1918 | 1919 | ) |
|
1919 | 1920 | |
|
1920 | 1921 | coreconfigitem( |
|
1921 | 1922 | b'storage', |
|
1922 | 1923 | b'revlog.reuse-external-delta', |
|
1923 | 1924 | default=True, |
|
1924 | 1925 | ) |
|
1925 | 1926 | coreconfigitem( |
|
1926 | 1927 | b'storage', |
|
1927 | 1928 | b'revlog.reuse-external-delta-parent', |
|
1928 | 1929 | default=None, |
|
1929 | 1930 | ) |
|
1930 | 1931 | coreconfigitem( |
|
1931 | 1932 | b'storage', |
|
1932 | 1933 | b'revlog.zlib.level', |
|
1933 | 1934 | default=None, |
|
1934 | 1935 | ) |
|
1935 | 1936 | coreconfigitem( |
|
1936 | 1937 | b'storage', |
|
1937 | 1938 | b'revlog.zstd.level', |
|
1938 | 1939 | default=None, |
|
1939 | 1940 | ) |
|
1940 | 1941 | coreconfigitem( |
|
1941 | 1942 | b'server', |
|
1942 | 1943 | b'bookmarks-pushkey-compat', |
|
1943 | 1944 | default=True, |
|
1944 | 1945 | ) |
|
1945 | 1946 | coreconfigitem( |
|
1946 | 1947 | b'server', |
|
1947 | 1948 | b'bundle1', |
|
1948 | 1949 | default=True, |
|
1949 | 1950 | ) |
|
1950 | 1951 | coreconfigitem( |
|
1951 | 1952 | b'server', |
|
1952 | 1953 | b'bundle1gd', |
|
1953 | 1954 | default=None, |
|
1954 | 1955 | ) |
|
1955 | 1956 | coreconfigitem( |
|
1956 | 1957 | b'server', |
|
1957 | 1958 | b'bundle1.pull', |
|
1958 | 1959 | default=None, |
|
1959 | 1960 | ) |
|
1960 | 1961 | coreconfigitem( |
|
1961 | 1962 | b'server', |
|
1962 | 1963 | b'bundle1gd.pull', |
|
1963 | 1964 | default=None, |
|
1964 | 1965 | ) |
|
1965 | 1966 | coreconfigitem( |
|
1966 | 1967 | b'server', |
|
1967 | 1968 | b'bundle1.push', |
|
1968 | 1969 | default=None, |
|
1969 | 1970 | ) |
|
1970 | 1971 | coreconfigitem( |
|
1971 | 1972 | b'server', |
|
1972 | 1973 | b'bundle1gd.push', |
|
1973 | 1974 | default=None, |
|
1974 | 1975 | ) |
|
1975 | 1976 | coreconfigitem( |
|
1976 | 1977 | b'server', |
|
1977 | 1978 | b'bundle2.stream', |
|
1978 | 1979 | default=True, |
|
1979 | 1980 | alias=[(b'experimental', b'bundle2.stream')], |
|
1980 | 1981 | ) |
|
1981 | 1982 | coreconfigitem( |
|
1982 | 1983 | b'server', |
|
1983 | 1984 | b'compressionengines', |
|
1984 | 1985 | default=list, |
|
1985 | 1986 | ) |
|
1986 | 1987 | coreconfigitem( |
|
1987 | 1988 | b'server', |
|
1988 | 1989 | b'concurrent-push-mode', |
|
1989 | 1990 | default=b'check-related', |
|
1990 | 1991 | ) |
|
1991 | 1992 | coreconfigitem( |
|
1992 | 1993 | b'server', |
|
1993 | 1994 | b'disablefullbundle', |
|
1994 | 1995 | default=False, |
|
1995 | 1996 | ) |
|
1996 | 1997 | coreconfigitem( |
|
1997 | 1998 | b'server', |
|
1998 | 1999 | b'maxhttpheaderlen', |
|
1999 | 2000 | default=1024, |
|
2000 | 2001 | ) |
|
2001 | 2002 | coreconfigitem( |
|
2002 | 2003 | b'server', |
|
2003 | 2004 | b'pullbundle', |
|
2004 | 2005 | default=False, |
|
2005 | 2006 | ) |
|
2006 | 2007 | coreconfigitem( |
|
2007 | 2008 | b'server', |
|
2008 | 2009 | b'preferuncompressed', |
|
2009 | 2010 | default=False, |
|
2010 | 2011 | ) |
|
2011 | 2012 | coreconfigitem( |
|
2012 | 2013 | b'server', |
|
2013 | 2014 | b'streamunbundle', |
|
2014 | 2015 | default=False, |
|
2015 | 2016 | ) |
|
2016 | 2017 | coreconfigitem( |
|
2017 | 2018 | b'server', |
|
2018 | 2019 | b'uncompressed', |
|
2019 | 2020 | default=True, |
|
2020 | 2021 | ) |
|
2021 | 2022 | coreconfigitem( |
|
2022 | 2023 | b'server', |
|
2023 | 2024 | b'uncompressedallowsecret', |
|
2024 | 2025 | default=False, |
|
2025 | 2026 | ) |
|
2026 | 2027 | coreconfigitem( |
|
2027 | 2028 | b'server', |
|
2028 | 2029 | b'view', |
|
2029 | 2030 | default=b'served', |
|
2030 | 2031 | ) |
|
2031 | 2032 | coreconfigitem( |
|
2032 | 2033 | b'server', |
|
2033 | 2034 | b'validate', |
|
2034 | 2035 | default=False, |
|
2035 | 2036 | ) |
|
2036 | 2037 | coreconfigitem( |
|
2037 | 2038 | b'server', |
|
2038 | 2039 | b'zliblevel', |
|
2039 | 2040 | default=-1, |
|
2040 | 2041 | ) |
|
2041 | 2042 | coreconfigitem( |
|
2042 | 2043 | b'server', |
|
2043 | 2044 | b'zstdlevel', |
|
2044 | 2045 | default=3, |
|
2045 | 2046 | ) |
|
2046 | 2047 | coreconfigitem( |
|
2047 | 2048 | b'share', |
|
2048 | 2049 | b'pool', |
|
2049 | 2050 | default=None, |
|
2050 | 2051 | ) |
|
2051 | 2052 | coreconfigitem( |
|
2052 | 2053 | b'share', |
|
2053 | 2054 | b'poolnaming', |
|
2054 | 2055 | default=b'identity', |
|
2055 | 2056 | ) |
|
2056 | 2057 | coreconfigitem( |
|
2057 | 2058 | b'share', |
|
2058 | 2059 | b'safe-mismatch.source-not-safe', |
|
2059 | 2060 | default=b'abort', |
|
2060 | 2061 | ) |
|
2061 | 2062 | coreconfigitem( |
|
2062 | 2063 | b'share', |
|
2063 | 2064 | b'safe-mismatch.source-safe', |
|
2064 | 2065 | default=b'abort', |
|
2065 | 2066 | ) |
|
2066 | 2067 | coreconfigitem( |
|
2067 | 2068 | b'share', |
|
2068 | 2069 | b'safe-mismatch.source-not-safe.warn', |
|
2069 | 2070 | default=True, |
|
2070 | 2071 | ) |
|
2071 | 2072 | coreconfigitem( |
|
2072 | 2073 | b'share', |
|
2073 | 2074 | b'safe-mismatch.source-safe.warn', |
|
2074 | 2075 | default=True, |
|
2075 | 2076 | ) |
|
2076 | 2077 | coreconfigitem( |
|
2077 | 2078 | b'shelve', |
|
2078 | 2079 | b'maxbackups', |
|
2079 | 2080 | default=10, |
|
2080 | 2081 | ) |
|
2081 | 2082 | coreconfigitem( |
|
2082 | 2083 | b'smtp', |
|
2083 | 2084 | b'host', |
|
2084 | 2085 | default=None, |
|
2085 | 2086 | ) |
|
2086 | 2087 | coreconfigitem( |
|
2087 | 2088 | b'smtp', |
|
2088 | 2089 | b'local_hostname', |
|
2089 | 2090 | default=None, |
|
2090 | 2091 | ) |
|
2091 | 2092 | coreconfigitem( |
|
2092 | 2093 | b'smtp', |
|
2093 | 2094 | b'password', |
|
2094 | 2095 | default=None, |
|
2095 | 2096 | ) |
|
2096 | 2097 | coreconfigitem( |
|
2097 | 2098 | b'smtp', |
|
2098 | 2099 | b'port', |
|
2099 | 2100 | default=dynamicdefault, |
|
2100 | 2101 | ) |
|
2101 | 2102 | coreconfigitem( |
|
2102 | 2103 | b'smtp', |
|
2103 | 2104 | b'tls', |
|
2104 | 2105 | default=b'none', |
|
2105 | 2106 | ) |
|
2106 | 2107 | coreconfigitem( |
|
2107 | 2108 | b'smtp', |
|
2108 | 2109 | b'username', |
|
2109 | 2110 | default=None, |
|
2110 | 2111 | ) |
|
2111 | 2112 | coreconfigitem( |
|
2112 | 2113 | b'sparse', |
|
2113 | 2114 | b'missingwarning', |
|
2114 | 2115 | default=True, |
|
2115 | 2116 | experimental=True, |
|
2116 | 2117 | ) |
|
2117 | 2118 | coreconfigitem( |
|
2118 | 2119 | b'subrepos', |
|
2119 | 2120 | b'allowed', |
|
2120 | 2121 | default=dynamicdefault, # to make backporting simpler |
|
2121 | 2122 | ) |
|
2122 | 2123 | coreconfigitem( |
|
2123 | 2124 | b'subrepos', |
|
2124 | 2125 | b'hg:allowed', |
|
2125 | 2126 | default=dynamicdefault, |
|
2126 | 2127 | ) |
|
2127 | 2128 | coreconfigitem( |
|
2128 | 2129 | b'subrepos', |
|
2129 | 2130 | b'git:allowed', |
|
2130 | 2131 | default=dynamicdefault, |
|
2131 | 2132 | ) |
|
2132 | 2133 | coreconfigitem( |
|
2133 | 2134 | b'subrepos', |
|
2134 | 2135 | b'svn:allowed', |
|
2135 | 2136 | default=dynamicdefault, |
|
2136 | 2137 | ) |
|
2137 | 2138 | coreconfigitem( |
|
2138 | 2139 | b'templates', |
|
2139 | 2140 | b'.*', |
|
2140 | 2141 | default=None, |
|
2141 | 2142 | generic=True, |
|
2142 | 2143 | ) |
|
2143 | 2144 | coreconfigitem( |
|
2144 | 2145 | b'templateconfig', |
|
2145 | 2146 | b'.*', |
|
2146 | 2147 | default=dynamicdefault, |
|
2147 | 2148 | generic=True, |
|
2148 | 2149 | ) |
|
2149 | 2150 | coreconfigitem( |
|
2150 | 2151 | b'trusted', |
|
2151 | 2152 | b'groups', |
|
2152 | 2153 | default=list, |
|
2153 | 2154 | ) |
|
2154 | 2155 | coreconfigitem( |
|
2155 | 2156 | b'trusted', |
|
2156 | 2157 | b'users', |
|
2157 | 2158 | default=list, |
|
2158 | 2159 | ) |
|
2159 | 2160 | coreconfigitem( |
|
2160 | 2161 | b'ui', |
|
2161 | 2162 | b'_usedassubrepo', |
|
2162 | 2163 | default=False, |
|
2163 | 2164 | ) |
|
2164 | 2165 | coreconfigitem( |
|
2165 | 2166 | b'ui', |
|
2166 | 2167 | b'allowemptycommit', |
|
2167 | 2168 | default=False, |
|
2168 | 2169 | ) |
|
2169 | 2170 | coreconfigitem( |
|
2170 | 2171 | b'ui', |
|
2171 | 2172 | b'archivemeta', |
|
2172 | 2173 | default=True, |
|
2173 | 2174 | ) |
|
2174 | 2175 | coreconfigitem( |
|
2175 | 2176 | b'ui', |
|
2176 | 2177 | b'askusername', |
|
2177 | 2178 | default=False, |
|
2178 | 2179 | ) |
|
2179 | 2180 | coreconfigitem( |
|
2180 | 2181 | b'ui', |
|
2181 | 2182 | b'available-memory', |
|
2182 | 2183 | default=None, |
|
2183 | 2184 | ) |
|
2184 | 2185 | |
|
2185 | 2186 | coreconfigitem( |
|
2186 | 2187 | b'ui', |
|
2187 | 2188 | b'clonebundlefallback', |
|
2188 | 2189 | default=False, |
|
2189 | 2190 | ) |
|
2190 | 2191 | coreconfigitem( |
|
2191 | 2192 | b'ui', |
|
2192 | 2193 | b'clonebundleprefers', |
|
2193 | 2194 | default=list, |
|
2194 | 2195 | ) |
|
2195 | 2196 | coreconfigitem( |
|
2196 | 2197 | b'ui', |
|
2197 | 2198 | b'clonebundles', |
|
2198 | 2199 | default=True, |
|
2199 | 2200 | ) |
|
2200 | 2201 | coreconfigitem( |
|
2201 | 2202 | b'ui', |
|
2202 | 2203 | b'color', |
|
2203 | 2204 | default=b'auto', |
|
2204 | 2205 | ) |
|
2205 | 2206 | coreconfigitem( |
|
2206 | 2207 | b'ui', |
|
2207 | 2208 | b'commitsubrepos', |
|
2208 | 2209 | default=False, |
|
2209 | 2210 | ) |
|
2210 | 2211 | coreconfigitem( |
|
2211 | 2212 | b'ui', |
|
2212 | 2213 | b'debug', |
|
2213 | 2214 | default=False, |
|
2214 | 2215 | ) |
|
2215 | 2216 | coreconfigitem( |
|
2216 | 2217 | b'ui', |
|
2217 | 2218 | b'debugger', |
|
2218 | 2219 | default=None, |
|
2219 | 2220 | ) |
|
2220 | 2221 | coreconfigitem( |
|
2221 | 2222 | b'ui', |
|
2222 | 2223 | b'editor', |
|
2223 | 2224 | default=dynamicdefault, |
|
2224 | 2225 | ) |
|
2225 | 2226 | coreconfigitem( |
|
2226 | 2227 | b'ui', |
|
2227 | 2228 | b'detailed-exit-code', |
|
2228 | 2229 | default=False, |
|
2229 | 2230 | experimental=True, |
|
2230 | 2231 | ) |
|
2231 | 2232 | coreconfigitem( |
|
2232 | 2233 | b'ui', |
|
2233 | 2234 | b'fallbackencoding', |
|
2234 | 2235 | default=None, |
|
2235 | 2236 | ) |
|
2236 | 2237 | coreconfigitem( |
|
2237 | 2238 | b'ui', |
|
2238 | 2239 | b'forcecwd', |
|
2239 | 2240 | default=None, |
|
2240 | 2241 | ) |
|
2241 | 2242 | coreconfigitem( |
|
2242 | 2243 | b'ui', |
|
2243 | 2244 | b'forcemerge', |
|
2244 | 2245 | default=None, |
|
2245 | 2246 | ) |
|
2246 | 2247 | coreconfigitem( |
|
2247 | 2248 | b'ui', |
|
2248 | 2249 | b'formatdebug', |
|
2249 | 2250 | default=False, |
|
2250 | 2251 | ) |
|
2251 | 2252 | coreconfigitem( |
|
2252 | 2253 | b'ui', |
|
2253 | 2254 | b'formatjson', |
|
2254 | 2255 | default=False, |
|
2255 | 2256 | ) |
|
2256 | 2257 | coreconfigitem( |
|
2257 | 2258 | b'ui', |
|
2258 | 2259 | b'formatted', |
|
2259 | 2260 | default=None, |
|
2260 | 2261 | ) |
|
2261 | 2262 | coreconfigitem( |
|
2262 | 2263 | b'ui', |
|
2263 | 2264 | b'interactive', |
|
2264 | 2265 | default=None, |
|
2265 | 2266 | ) |
|
2266 | 2267 | coreconfigitem( |
|
2267 | 2268 | b'ui', |
|
2268 | 2269 | b'interface', |
|
2269 | 2270 | default=None, |
|
2270 | 2271 | ) |
|
2271 | 2272 | coreconfigitem( |
|
2272 | 2273 | b'ui', |
|
2273 | 2274 | b'interface.chunkselector', |
|
2274 | 2275 | default=None, |
|
2275 | 2276 | ) |
|
2276 | 2277 | coreconfigitem( |
|
2277 | 2278 | b'ui', |
|
2278 | 2279 | b'large-file-limit', |
|
2279 | 2280 | default=10000000, |
|
2280 | 2281 | ) |
|
2281 | 2282 | coreconfigitem( |
|
2282 | 2283 | b'ui', |
|
2283 | 2284 | b'logblockedtimes', |
|
2284 | 2285 | default=False, |
|
2285 | 2286 | ) |
|
2286 | 2287 | coreconfigitem( |
|
2287 | 2288 | b'ui', |
|
2288 | 2289 | b'merge', |
|
2289 | 2290 | default=None, |
|
2290 | 2291 | ) |
|
2291 | 2292 | coreconfigitem( |
|
2292 | 2293 | b'ui', |
|
2293 | 2294 | b'mergemarkers', |
|
2294 | 2295 | default=b'basic', |
|
2295 | 2296 | ) |
|
2296 | 2297 | coreconfigitem( |
|
2297 | 2298 | b'ui', |
|
2298 | 2299 | b'message-output', |
|
2299 | 2300 | default=b'stdio', |
|
2300 | 2301 | ) |
|
2301 | 2302 | coreconfigitem( |
|
2302 | 2303 | b'ui', |
|
2303 | 2304 | b'nontty', |
|
2304 | 2305 | default=False, |
|
2305 | 2306 | ) |
|
2306 | 2307 | coreconfigitem( |
|
2307 | 2308 | b'ui', |
|
2308 | 2309 | b'origbackuppath', |
|
2309 | 2310 | default=None, |
|
2310 | 2311 | ) |
|
2311 | 2312 | coreconfigitem( |
|
2312 | 2313 | b'ui', |
|
2313 | 2314 | b'paginate', |
|
2314 | 2315 | default=True, |
|
2315 | 2316 | ) |
|
2316 | 2317 | coreconfigitem( |
|
2317 | 2318 | b'ui', |
|
2318 | 2319 | b'patch', |
|
2319 | 2320 | default=None, |
|
2320 | 2321 | ) |
|
2321 | 2322 | coreconfigitem( |
|
2322 | 2323 | b'ui', |
|
2323 | 2324 | b'portablefilenames', |
|
2324 | 2325 | default=b'warn', |
|
2325 | 2326 | ) |
|
2326 | 2327 | coreconfigitem( |
|
2327 | 2328 | b'ui', |
|
2328 | 2329 | b'promptecho', |
|
2329 | 2330 | default=False, |
|
2330 | 2331 | ) |
|
2331 | 2332 | coreconfigitem( |
|
2332 | 2333 | b'ui', |
|
2333 | 2334 | b'quiet', |
|
2334 | 2335 | default=False, |
|
2335 | 2336 | ) |
|
2336 | 2337 | coreconfigitem( |
|
2337 | 2338 | b'ui', |
|
2338 | 2339 | b'quietbookmarkmove', |
|
2339 | 2340 | default=False, |
|
2340 | 2341 | ) |
|
2341 | 2342 | coreconfigitem( |
|
2342 | 2343 | b'ui', |
|
2343 | 2344 | b'relative-paths', |
|
2344 | 2345 | default=b'legacy', |
|
2345 | 2346 | ) |
|
2346 | 2347 | coreconfigitem( |
|
2347 | 2348 | b'ui', |
|
2348 | 2349 | b'remotecmd', |
|
2349 | 2350 | default=b'hg', |
|
2350 | 2351 | ) |
|
2351 | 2352 | coreconfigitem( |
|
2352 | 2353 | b'ui', |
|
2353 | 2354 | b'report_untrusted', |
|
2354 | 2355 | default=True, |
|
2355 | 2356 | ) |
|
2356 | 2357 | coreconfigitem( |
|
2357 | 2358 | b'ui', |
|
2358 | 2359 | b'rollback', |
|
2359 | 2360 | default=True, |
|
2360 | 2361 | ) |
|
2361 | 2362 | coreconfigitem( |
|
2362 | 2363 | b'ui', |
|
2363 | 2364 | b'signal-safe-lock', |
|
2364 | 2365 | default=True, |
|
2365 | 2366 | ) |
|
2366 | 2367 | coreconfigitem( |
|
2367 | 2368 | b'ui', |
|
2368 | 2369 | b'slash', |
|
2369 | 2370 | default=False, |
|
2370 | 2371 | ) |
|
2371 | 2372 | coreconfigitem( |
|
2372 | 2373 | b'ui', |
|
2373 | 2374 | b'ssh', |
|
2374 | 2375 | default=b'ssh', |
|
2375 | 2376 | ) |
|
2376 | 2377 | coreconfigitem( |
|
2377 | 2378 | b'ui', |
|
2378 | 2379 | b'ssherrorhint', |
|
2379 | 2380 | default=None, |
|
2380 | 2381 | ) |
|
2381 | 2382 | coreconfigitem( |
|
2382 | 2383 | b'ui', |
|
2383 | 2384 | b'statuscopies', |
|
2384 | 2385 | default=False, |
|
2385 | 2386 | ) |
|
2386 | 2387 | coreconfigitem( |
|
2387 | 2388 | b'ui', |
|
2388 | 2389 | b'strict', |
|
2389 | 2390 | default=False, |
|
2390 | 2391 | ) |
|
2391 | 2392 | coreconfigitem( |
|
2392 | 2393 | b'ui', |
|
2393 | 2394 | b'style', |
|
2394 | 2395 | default=b'', |
|
2395 | 2396 | ) |
|
2396 | 2397 | coreconfigitem( |
|
2397 | 2398 | b'ui', |
|
2398 | 2399 | b'supportcontact', |
|
2399 | 2400 | default=None, |
|
2400 | 2401 | ) |
|
2401 | 2402 | coreconfigitem( |
|
2402 | 2403 | b'ui', |
|
2403 | 2404 | b'textwidth', |
|
2404 | 2405 | default=78, |
|
2405 | 2406 | ) |
|
2406 | 2407 | coreconfigitem( |
|
2407 | 2408 | b'ui', |
|
2408 | 2409 | b'timeout', |
|
2409 | 2410 | default=b'600', |
|
2410 | 2411 | ) |
|
2411 | 2412 | coreconfigitem( |
|
2412 | 2413 | b'ui', |
|
2413 | 2414 | b'timeout.warn', |
|
2414 | 2415 | default=0, |
|
2415 | 2416 | ) |
|
2416 | 2417 | coreconfigitem( |
|
2417 | 2418 | b'ui', |
|
2418 | 2419 | b'timestamp-output', |
|
2419 | 2420 | default=False, |
|
2420 | 2421 | ) |
|
2421 | 2422 | coreconfigitem( |
|
2422 | 2423 | b'ui', |
|
2423 | 2424 | b'traceback', |
|
2424 | 2425 | default=False, |
|
2425 | 2426 | ) |
|
2426 | 2427 | coreconfigitem( |
|
2427 | 2428 | b'ui', |
|
2428 | 2429 | b'tweakdefaults', |
|
2429 | 2430 | default=False, |
|
2430 | 2431 | ) |
|
2431 | 2432 | coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')]) |
|
2432 | 2433 | coreconfigitem( |
|
2433 | 2434 | b'ui', |
|
2434 | 2435 | b'verbose', |
|
2435 | 2436 | default=False, |
|
2436 | 2437 | ) |
|
2437 | 2438 | coreconfigitem( |
|
2438 | 2439 | b'verify', |
|
2439 | 2440 | b'skipflags', |
|
2440 | 2441 | default=None, |
|
2441 | 2442 | ) |
|
2442 | 2443 | coreconfigitem( |
|
2443 | 2444 | b'web', |
|
2444 | 2445 | b'allowbz2', |
|
2445 | 2446 | default=False, |
|
2446 | 2447 | ) |
|
2447 | 2448 | coreconfigitem( |
|
2448 | 2449 | b'web', |
|
2449 | 2450 | b'allowgz', |
|
2450 | 2451 | default=False, |
|
2451 | 2452 | ) |
|
2452 | 2453 | coreconfigitem( |
|
2453 | 2454 | b'web', |
|
2454 | 2455 | b'allow-pull', |
|
2455 | 2456 | alias=[(b'web', b'allowpull')], |
|
2456 | 2457 | default=True, |
|
2457 | 2458 | ) |
|
2458 | 2459 | coreconfigitem( |
|
2459 | 2460 | b'web', |
|
2460 | 2461 | b'allow-push', |
|
2461 | 2462 | alias=[(b'web', b'allow_push')], |
|
2462 | 2463 | default=list, |
|
2463 | 2464 | ) |
|
2464 | 2465 | coreconfigitem( |
|
2465 | 2466 | b'web', |
|
2466 | 2467 | b'allowzip', |
|
2467 | 2468 | default=False, |
|
2468 | 2469 | ) |
|
2469 | 2470 | coreconfigitem( |
|
2470 | 2471 | b'web', |
|
2471 | 2472 | b'archivesubrepos', |
|
2472 | 2473 | default=False, |
|
2473 | 2474 | ) |
|
2474 | 2475 | coreconfigitem( |
|
2475 | 2476 | b'web', |
|
2476 | 2477 | b'cache', |
|
2477 | 2478 | default=True, |
|
2478 | 2479 | ) |
|
2479 | 2480 | coreconfigitem( |
|
2480 | 2481 | b'web', |
|
2481 | 2482 | b'comparisoncontext', |
|
2482 | 2483 | default=5, |
|
2483 | 2484 | ) |
|
2484 | 2485 | coreconfigitem( |
|
2485 | 2486 | b'web', |
|
2486 | 2487 | b'contact', |
|
2487 | 2488 | default=None, |
|
2488 | 2489 | ) |
|
2489 | 2490 | coreconfigitem( |
|
2490 | 2491 | b'web', |
|
2491 | 2492 | b'deny_push', |
|
2492 | 2493 | default=list, |
|
2493 | 2494 | ) |
|
2494 | 2495 | coreconfigitem( |
|
2495 | 2496 | b'web', |
|
2496 | 2497 | b'guessmime', |
|
2497 | 2498 | default=False, |
|
2498 | 2499 | ) |
|
2499 | 2500 | coreconfigitem( |
|
2500 | 2501 | b'web', |
|
2501 | 2502 | b'hidden', |
|
2502 | 2503 | default=False, |
|
2503 | 2504 | ) |
|
2504 | 2505 | coreconfigitem( |
|
2505 | 2506 | b'web', |
|
2506 | 2507 | b'labels', |
|
2507 | 2508 | default=list, |
|
2508 | 2509 | ) |
|
2509 | 2510 | coreconfigitem( |
|
2510 | 2511 | b'web', |
|
2511 | 2512 | b'logoimg', |
|
2512 | 2513 | default=b'hglogo.png', |
|
2513 | 2514 | ) |
|
2514 | 2515 | coreconfigitem( |
|
2515 | 2516 | b'web', |
|
2516 | 2517 | b'logourl', |
|
2517 | 2518 | default=b'https://mercurial-scm.org/', |
|
2518 | 2519 | ) |
|
2519 | 2520 | coreconfigitem( |
|
2520 | 2521 | b'web', |
|
2521 | 2522 | b'accesslog', |
|
2522 | 2523 | default=b'-', |
|
2523 | 2524 | ) |
|
2524 | 2525 | coreconfigitem( |
|
2525 | 2526 | b'web', |
|
2526 | 2527 | b'address', |
|
2527 | 2528 | default=b'', |
|
2528 | 2529 | ) |
|
2529 | 2530 | coreconfigitem( |
|
2530 | 2531 | b'web', |
|
2531 | 2532 | b'allow-archive', |
|
2532 | 2533 | alias=[(b'web', b'allow_archive')], |
|
2533 | 2534 | default=list, |
|
2534 | 2535 | ) |
|
2535 | 2536 | coreconfigitem( |
|
2536 | 2537 | b'web', |
|
2537 | 2538 | b'allow_read', |
|
2538 | 2539 | default=list, |
|
2539 | 2540 | ) |
|
2540 | 2541 | coreconfigitem( |
|
2541 | 2542 | b'web', |
|
2542 | 2543 | b'baseurl', |
|
2543 | 2544 | default=None, |
|
2544 | 2545 | ) |
|
2545 | 2546 | coreconfigitem( |
|
2546 | 2547 | b'web', |
|
2547 | 2548 | b'cacerts', |
|
2548 | 2549 | default=None, |
|
2549 | 2550 | ) |
|
2550 | 2551 | coreconfigitem( |
|
2551 | 2552 | b'web', |
|
2552 | 2553 | b'certificate', |
|
2553 | 2554 | default=None, |
|
2554 | 2555 | ) |
|
2555 | 2556 | coreconfigitem( |
|
2556 | 2557 | b'web', |
|
2557 | 2558 | b'collapse', |
|
2558 | 2559 | default=False, |
|
2559 | 2560 | ) |
|
2560 | 2561 | coreconfigitem( |
|
2561 | 2562 | b'web', |
|
2562 | 2563 | b'csp', |
|
2563 | 2564 | default=None, |
|
2564 | 2565 | ) |
|
2565 | 2566 | coreconfigitem( |
|
2566 | 2567 | b'web', |
|
2567 | 2568 | b'deny_read', |
|
2568 | 2569 | default=list, |
|
2569 | 2570 | ) |
|
2570 | 2571 | coreconfigitem( |
|
2571 | 2572 | b'web', |
|
2572 | 2573 | b'descend', |
|
2573 | 2574 | default=True, |
|
2574 | 2575 | ) |
|
2575 | 2576 | coreconfigitem( |
|
2576 | 2577 | b'web', |
|
2577 | 2578 | b'description', |
|
2578 | 2579 | default=b"", |
|
2579 | 2580 | ) |
|
2580 | 2581 | coreconfigitem( |
|
2581 | 2582 | b'web', |
|
2582 | 2583 | b'encoding', |
|
2583 | 2584 | default=lambda: encoding.encoding, |
|
2584 | 2585 | ) |
|
2585 | 2586 | coreconfigitem( |
|
2586 | 2587 | b'web', |
|
2587 | 2588 | b'errorlog', |
|
2588 | 2589 | default=b'-', |
|
2589 | 2590 | ) |
|
2590 | 2591 | coreconfigitem( |
|
2591 | 2592 | b'web', |
|
2592 | 2593 | b'ipv6', |
|
2593 | 2594 | default=False, |
|
2594 | 2595 | ) |
|
2595 | 2596 | coreconfigitem( |
|
2596 | 2597 | b'web', |
|
2597 | 2598 | b'maxchanges', |
|
2598 | 2599 | default=10, |
|
2599 | 2600 | ) |
|
2600 | 2601 | coreconfigitem( |
|
2601 | 2602 | b'web', |
|
2602 | 2603 | b'maxfiles', |
|
2603 | 2604 | default=10, |
|
2604 | 2605 | ) |
|
2605 | 2606 | coreconfigitem( |
|
2606 | 2607 | b'web', |
|
2607 | 2608 | b'maxshortchanges', |
|
2608 | 2609 | default=60, |
|
2609 | 2610 | ) |
|
2610 | 2611 | coreconfigitem( |
|
2611 | 2612 | b'web', |
|
2612 | 2613 | b'motd', |
|
2613 | 2614 | default=b'', |
|
2614 | 2615 | ) |
|
2615 | 2616 | coreconfigitem( |
|
2616 | 2617 | b'web', |
|
2617 | 2618 | b'name', |
|
2618 | 2619 | default=dynamicdefault, |
|
2619 | 2620 | ) |
|
2620 | 2621 | coreconfigitem( |
|
2621 | 2622 | b'web', |
|
2622 | 2623 | b'port', |
|
2623 | 2624 | default=8000, |
|
2624 | 2625 | ) |
|
2625 | 2626 | coreconfigitem( |
|
2626 | 2627 | b'web', |
|
2627 | 2628 | b'prefix', |
|
2628 | 2629 | default=b'', |
|
2629 | 2630 | ) |
|
2630 | 2631 | coreconfigitem( |
|
2631 | 2632 | b'web', |
|
2632 | 2633 | b'push_ssl', |
|
2633 | 2634 | default=True, |
|
2634 | 2635 | ) |
|
2635 | 2636 | coreconfigitem( |
|
2636 | 2637 | b'web', |
|
2637 | 2638 | b'refreshinterval', |
|
2638 | 2639 | default=20, |
|
2639 | 2640 | ) |
|
2640 | 2641 | coreconfigitem( |
|
2641 | 2642 | b'web', |
|
2642 | 2643 | b'server-header', |
|
2643 | 2644 | default=None, |
|
2644 | 2645 | ) |
|
2645 | 2646 | coreconfigitem( |
|
2646 | 2647 | b'web', |
|
2647 | 2648 | b'static', |
|
2648 | 2649 | default=None, |
|
2649 | 2650 | ) |
|
2650 | 2651 | coreconfigitem( |
|
2651 | 2652 | b'web', |
|
2652 | 2653 | b'staticurl', |
|
2653 | 2654 | default=None, |
|
2654 | 2655 | ) |
|
2655 | 2656 | coreconfigitem( |
|
2656 | 2657 | b'web', |
|
2657 | 2658 | b'stripes', |
|
2658 | 2659 | default=1, |
|
2659 | 2660 | ) |
|
2660 | 2661 | coreconfigitem( |
|
2661 | 2662 | b'web', |
|
2662 | 2663 | b'style', |
|
2663 | 2664 | default=b'paper', |
|
2664 | 2665 | ) |
|
2665 | 2666 | coreconfigitem( |
|
2666 | 2667 | b'web', |
|
2667 | 2668 | b'templates', |
|
2668 | 2669 | default=None, |
|
2669 | 2670 | ) |
|
2670 | 2671 | coreconfigitem( |
|
2671 | 2672 | b'web', |
|
2672 | 2673 | b'view', |
|
2673 | 2674 | default=b'served', |
|
2674 | 2675 | experimental=True, |
|
2675 | 2676 | ) |
|
2676 | 2677 | coreconfigitem( |
|
2677 | 2678 | b'worker', |
|
2678 | 2679 | b'backgroundclose', |
|
2679 | 2680 | default=dynamicdefault, |
|
2680 | 2681 | ) |
|
2681 | 2682 | # Windows defaults to a limit of 512 open files. A buffer of 128 |
|
2682 | 2683 | # should give us enough headway. |
|
2683 | 2684 | coreconfigitem( |
|
2684 | 2685 | b'worker', |
|
2685 | 2686 | b'backgroundclosemaxqueue', |
|
2686 | 2687 | default=384, |
|
2687 | 2688 | ) |
|
2688 | 2689 | coreconfigitem( |
|
2689 | 2690 | b'worker', |
|
2690 | 2691 | b'backgroundcloseminfilecount', |
|
2691 | 2692 | default=2048, |
|
2692 | 2693 | ) |
|
2693 | 2694 | coreconfigitem( |
|
2694 | 2695 | b'worker', |
|
2695 | 2696 | b'backgroundclosethreadcount', |
|
2696 | 2697 | default=4, |
|
2697 | 2698 | ) |
|
2698 | 2699 | coreconfigitem( |
|
2699 | 2700 | b'worker', |
|
2700 | 2701 | b'enabled', |
|
2701 | 2702 | default=True, |
|
2702 | 2703 | ) |
|
2703 | 2704 | coreconfigitem( |
|
2704 | 2705 | b'worker', |
|
2705 | 2706 | b'numcpus', |
|
2706 | 2707 | default=None, |
|
2707 | 2708 | ) |
|
2708 | 2709 | |
|
2709 | 2710 | # Rebase related configuration moved to core because other extension are doing |
|
2710 | 2711 | # strange things. For example, shelve import the extensions to reuse some bit |
|
2711 | 2712 | # without formally loading it. |
|
2712 | 2713 | coreconfigitem( |
|
2713 | 2714 | b'commands', |
|
2714 | 2715 | b'rebase.requiredest', |
|
2715 | 2716 | default=False, |
|
2716 | 2717 | ) |
|
2717 | 2718 | coreconfigitem( |
|
2718 | 2719 | b'experimental', |
|
2719 | 2720 | b'rebaseskipobsolete', |
|
2720 | 2721 | default=True, |
|
2721 | 2722 | ) |
|
2722 | 2723 | coreconfigitem( |
|
2723 | 2724 | b'rebase', |
|
2724 | 2725 | b'singletransaction', |
|
2725 | 2726 | default=False, |
|
2726 | 2727 | ) |
|
2727 | 2728 | coreconfigitem( |
|
2728 | 2729 | b'rebase', |
|
2729 | 2730 | b'experimental.inmemory', |
|
2730 | 2731 | default=False, |
|
2731 | 2732 | ) |
@@ -1,3151 +1,3151 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 | 853 | |
|
854 | 854 | ``format`` |
|
855 | 855 | ---------- |
|
856 | 856 | |
|
857 | 857 | Configuration that controls the repository format. Newer format options are more |
|
858 | 858 | powerful, but incompatible with some older versions of Mercurial. Format options |
|
859 | 859 | are considered at repository initialization only. You need to make a new clone |
|
860 | 860 | for config changes to be taken into account. |
|
861 | 861 | |
|
862 | 862 | For more details about repository format and version compatibility, see |
|
863 | 863 | https://www.mercurial-scm.org/wiki/MissingRequirement |
|
864 | 864 | |
|
865 | 865 | ``usegeneraldelta`` |
|
866 | 866 | Enable or disable the "generaldelta" repository format which improves |
|
867 | 867 | repository compression by allowing "revlog" to store deltas against |
|
868 | 868 | arbitrary revisions instead of the previously stored one. This provides |
|
869 | 869 | significant improvement for repositories with branches. |
|
870 | 870 | |
|
871 | 871 | Repositories with this on-disk format require Mercurial version 1.9. |
|
872 | 872 | |
|
873 | 873 | Enabled by default. |
|
874 | 874 | |
|
875 | 875 | ``dotencode`` |
|
876 | 876 | Enable or disable the "dotencode" repository format which enhances |
|
877 | 877 | the "fncache" repository format (which has to be enabled to use |
|
878 | 878 | dotencode) to avoid issues with filenames starting with "._" on |
|
879 | 879 | Mac OS X and spaces on Windows. |
|
880 | 880 | |
|
881 | 881 | Repositories with this on-disk format require Mercurial version 1.7. |
|
882 | 882 | |
|
883 | 883 | Enabled by default. |
|
884 | 884 | |
|
885 | 885 | ``usefncache`` |
|
886 | 886 | Enable or disable the "fncache" repository format which enhances |
|
887 | 887 | the "store" repository format (which has to be enabled to use |
|
888 | 888 | fncache) to allow longer filenames and avoids using Windows |
|
889 | 889 | reserved names, e.g. "nul". |
|
890 | 890 | |
|
891 | 891 | Repositories with this on-disk format require Mercurial version 1.1. |
|
892 | 892 | |
|
893 | 893 | Enabled by default. |
|
894 | 894 | |
|
895 |
``e |
|
|
895 | ``use-dirstate-v2`` | |
|
896 | 896 | Enable or disable the experimental "dirstate-v2" feature. The dirstate |
|
897 | 897 | functionality is shared by all commands interacting with the working copy. |
|
898 | 898 | The new version is more robust, faster and stores more information. |
|
899 | 899 | |
|
900 | 900 | The performance-improving version of this feature is currently only |
|
901 | 901 | implemented in Rust (see :hg:`help rust`), so people not using a version of |
|
902 | 902 | Mercurial compiled with the Rust parts might actually suffer some slowdown. |
|
903 | 903 | For this reason, such versions will by default refuse to access repositories |
|
904 | 904 | with "dirstate-v2" enabled. |
|
905 | 905 | |
|
906 | 906 | This behavior can be adjusted via configuration: check |
|
907 | 907 | :hg:`help config.storage.dirstate-v2.slow-path` for details. |
|
908 | 908 | |
|
909 | 909 | Repositories with this on-disk format require Mercurial 6.0 or above. |
|
910 | 910 | |
|
911 | 911 | By default this format variant is disabled if the fast implementation is not |
|
912 | 912 | available, and enabled by default if the fast implementation is available. |
|
913 | 913 | |
|
914 | 914 | To accomodate installations of Mercurial without the fast implementation, |
|
915 | 915 | you can downgrade your repository. To do so run the following command: |
|
916 | 916 | |
|
917 | 917 | $ hg debugupgraderepo \ |
|
918 | 918 | --run \ |
|
919 |
--config format.e |
|
|
919 | --config format.use-dirstate-v2=False \ | |
|
920 | 920 | --config storage.dirstate-v2.slow-path=allow |
|
921 | 921 | |
|
922 | 922 | For a more comprehensive guide, see :hg:`help internals.dirstate-v2`. |
|
923 | 923 | |
|
924 | 924 | ``use-persistent-nodemap`` |
|
925 | 925 | Enable or disable the "persistent-nodemap" feature which improves |
|
926 | 926 | performance if the Rust extensions are available. |
|
927 | 927 | |
|
928 | 928 | The "persistent-nodemap" persist the "node -> rev" on disk removing the |
|
929 | 929 | need to dynamically build that mapping for each Mercurial invocation. This |
|
930 | 930 | significantly reduces the startup cost of various local and server-side |
|
931 | 931 | operation for larger repositories. |
|
932 | 932 | |
|
933 | 933 | The performance-improving version of this feature is currently only |
|
934 | 934 | implemented in Rust (see :hg:`help rust`), so people not using a version of |
|
935 | 935 | Mercurial compiled with the Rust parts might actually suffer some slowdown. |
|
936 | 936 | For this reason, such versions will by default refuse to access repositories |
|
937 | 937 | with "persistent-nodemap". |
|
938 | 938 | |
|
939 | 939 | This behavior can be adjusted via configuration: check |
|
940 | 940 | :hg:`help config.storage.revlog.persistent-nodemap.slow-path` for details. |
|
941 | 941 | |
|
942 | 942 | Repositories with this on-disk format require Mercurial 5.4 or above. |
|
943 | 943 | |
|
944 | 944 | By default this format variant is disabled if the fast implementation is not |
|
945 | 945 | available, and enabled by default if the fast implementation is available. |
|
946 | 946 | |
|
947 | 947 | To accomodate installations of Mercurial without the fast implementation, |
|
948 | 948 | you can downgrade your repository. To do so run the following command: |
|
949 | 949 | |
|
950 | 950 | $ hg debugupgraderepo \ |
|
951 | 951 | --run \ |
|
952 | 952 | --config format.use-persistent-nodemap=False \ |
|
953 | 953 | --config storage.revlog.persistent-nodemap.slow-path=allow |
|
954 | 954 | |
|
955 | 955 | ``use-share-safe`` |
|
956 | 956 | Enforce "safe" behaviors for all "shares" that access this repository. |
|
957 | 957 | |
|
958 | 958 | With this feature, "shares" using this repository as a source will: |
|
959 | 959 | |
|
960 | 960 | * read the source repository's configuration (`<source>/.hg/hgrc`). |
|
961 | 961 | * read and use the source repository's "requirements" |
|
962 | 962 | (except the working copy specific one). |
|
963 | 963 | |
|
964 | 964 | Without this feature, "shares" using this repository as a source will: |
|
965 | 965 | |
|
966 | 966 | * keep tracking the repository "requirements" in the share only, ignoring |
|
967 | 967 | the source "requirements", possibly diverging from them. |
|
968 | 968 | * ignore source repository config. This can create problems, like silently |
|
969 | 969 | ignoring important hooks. |
|
970 | 970 | |
|
971 | 971 | Beware that existing shares will not be upgraded/downgraded, and by |
|
972 | 972 | default, Mercurial will refuse to interact with them until the mismatch |
|
973 | 973 | is resolved. See :hg:`help config share.safe-mismatch.source-safe` and |
|
974 | 974 | :hg:`help config share.safe-mismatch.source-not-safe` for details. |
|
975 | 975 | |
|
976 | 976 | Introduced in Mercurial 5.7. |
|
977 | 977 | |
|
978 | 978 | Disabled by default. |
|
979 | 979 | |
|
980 | 980 | ``usestore`` |
|
981 | 981 | Enable or disable the "store" repository format which improves |
|
982 | 982 | compatibility with systems that fold case or otherwise mangle |
|
983 | 983 | filenames. Disabling this option will allow you to store longer filenames |
|
984 | 984 | in some situations at the expense of compatibility. |
|
985 | 985 | |
|
986 | 986 | Repositories with this on-disk format require Mercurial version 0.9.4. |
|
987 | 987 | |
|
988 | 988 | Enabled by default. |
|
989 | 989 | |
|
990 | 990 | ``sparse-revlog`` |
|
991 | 991 | Enable or disable the ``sparse-revlog`` delta strategy. This format improves |
|
992 | 992 | delta re-use inside revlog. For very branchy repositories, it results in a |
|
993 | 993 | smaller store. For repositories with many revisions, it also helps |
|
994 | 994 | performance (by using shortened delta chains.) |
|
995 | 995 | |
|
996 | 996 | Repositories with this on-disk format require Mercurial version 4.7 |
|
997 | 997 | |
|
998 | 998 | Enabled by default. |
|
999 | 999 | |
|
1000 | 1000 | ``revlog-compression`` |
|
1001 | 1001 | Compression algorithm used by revlog. Supported values are `zlib` and |
|
1002 | 1002 | `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is |
|
1003 | 1003 | a newer format that is usually a net win over `zlib`, operating faster at |
|
1004 | 1004 | better compression rates. Use `zstd` to reduce CPU usage. Multiple values |
|
1005 | 1005 | can be specified, the first available one will be used. |
|
1006 | 1006 | |
|
1007 | 1007 | On some systems, the Mercurial installation may lack `zstd` support. |
|
1008 | 1008 | |
|
1009 | 1009 | Default is `zstd` if available, `zlib` otherwise. |
|
1010 | 1010 | |
|
1011 | 1011 | ``bookmarks-in-store`` |
|
1012 | 1012 | Store bookmarks in .hg/store/. This means that bookmarks are shared when |
|
1013 | 1013 | using `hg share` regardless of the `-B` option. |
|
1014 | 1014 | |
|
1015 | 1015 | Repositories with this on-disk format require Mercurial version 5.1. |
|
1016 | 1016 | |
|
1017 | 1017 | Disabled by default. |
|
1018 | 1018 | |
|
1019 | 1019 | |
|
1020 | 1020 | ``graph`` |
|
1021 | 1021 | --------- |
|
1022 | 1022 | |
|
1023 | 1023 | Web graph view configuration. This section let you change graph |
|
1024 | 1024 | elements display properties by branches, for instance to make the |
|
1025 | 1025 | ``default`` branch stand out. |
|
1026 | 1026 | |
|
1027 | 1027 | Each line has the following format:: |
|
1028 | 1028 | |
|
1029 | 1029 | <branch>.<argument> = <value> |
|
1030 | 1030 | |
|
1031 | 1031 | where ``<branch>`` is the name of the branch being |
|
1032 | 1032 | customized. Example:: |
|
1033 | 1033 | |
|
1034 | 1034 | [graph] |
|
1035 | 1035 | # 2px width |
|
1036 | 1036 | default.width = 2 |
|
1037 | 1037 | # red color |
|
1038 | 1038 | default.color = FF0000 |
|
1039 | 1039 | |
|
1040 | 1040 | Supported arguments: |
|
1041 | 1041 | |
|
1042 | 1042 | ``width`` |
|
1043 | 1043 | Set branch edges width in pixels. |
|
1044 | 1044 | |
|
1045 | 1045 | ``color`` |
|
1046 | 1046 | Set branch edges color in hexadecimal RGB notation. |
|
1047 | 1047 | |
|
1048 | 1048 | ``hooks`` |
|
1049 | 1049 | --------- |
|
1050 | 1050 | |
|
1051 | 1051 | Commands or Python functions that get automatically executed by |
|
1052 | 1052 | various actions such as starting or finishing a commit. Multiple |
|
1053 | 1053 | hooks can be run for the same action by appending a suffix to the |
|
1054 | 1054 | action. Overriding a site-wide hook can be done by changing its |
|
1055 | 1055 | value or setting it to an empty string. Hooks can be prioritized |
|
1056 | 1056 | by adding a prefix of ``priority.`` to the hook name on a new line |
|
1057 | 1057 | and setting the priority. The default priority is 0. |
|
1058 | 1058 | |
|
1059 | 1059 | Example ``.hg/hgrc``:: |
|
1060 | 1060 | |
|
1061 | 1061 | [hooks] |
|
1062 | 1062 | # update working directory after adding changesets |
|
1063 | 1063 | changegroup.update = hg update |
|
1064 | 1064 | # do not use the site-wide hook |
|
1065 | 1065 | incoming = |
|
1066 | 1066 | incoming.email = /my/email/hook |
|
1067 | 1067 | incoming.autobuild = /my/build/hook |
|
1068 | 1068 | # force autobuild hook to run before other incoming hooks |
|
1069 | 1069 | priority.incoming.autobuild = 1 |
|
1070 | 1070 | ### control HGPLAIN setting when running autobuild hook |
|
1071 | 1071 | # HGPLAIN always set (default from Mercurial 5.7) |
|
1072 | 1072 | incoming.autobuild:run-with-plain = yes |
|
1073 | 1073 | # HGPLAIN never set |
|
1074 | 1074 | incoming.autobuild:run-with-plain = no |
|
1075 | 1075 | # HGPLAIN inherited from environment (default before Mercurial 5.7) |
|
1076 | 1076 | incoming.autobuild:run-with-plain = auto |
|
1077 | 1077 | |
|
1078 | 1078 | Most hooks are run with environment variables set that give useful |
|
1079 | 1079 | additional information. For each hook below, the environment variables |
|
1080 | 1080 | it is passed are listed with names in the form ``$HG_foo``. The |
|
1081 | 1081 | ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks. |
|
1082 | 1082 | They contain the type of hook which triggered the run and the full name |
|
1083 | 1083 | of the hook in the config, respectively. In the example above, this will |
|
1084 | 1084 | be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``. |
|
1085 | 1085 | |
|
1086 | 1086 | .. container:: windows |
|
1087 | 1087 | |
|
1088 | 1088 | Some basic Unix syntax can be enabled for portability, including ``$VAR`` |
|
1089 | 1089 | and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will |
|
1090 | 1090 | be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion |
|
1091 | 1091 | on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back |
|
1092 | 1092 | slash or inside of a strong quote. Strong quotes will be replaced by |
|
1093 | 1093 | double quotes after processing. |
|
1094 | 1094 | |
|
1095 | 1095 | This feature is enabled by adding a prefix of ``tonative.`` to the hook |
|
1096 | 1096 | name on a new line, and setting it to ``True``. For example:: |
|
1097 | 1097 | |
|
1098 | 1098 | [hooks] |
|
1099 | 1099 | incoming.autobuild = /my/build/hook |
|
1100 | 1100 | # enable translation to cmd.exe syntax for autobuild hook |
|
1101 | 1101 | tonative.incoming.autobuild = True |
|
1102 | 1102 | |
|
1103 | 1103 | ``changegroup`` |
|
1104 | 1104 | Run after a changegroup has been added via push, pull or unbundle. The ID of |
|
1105 | 1105 | the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``. |
|
1106 | 1106 | The URL from which changes came is in ``$HG_URL``. |
|
1107 | 1107 | |
|
1108 | 1108 | ``commit`` |
|
1109 | 1109 | Run after a changeset has been created in the local repository. The ID |
|
1110 | 1110 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
1111 | 1111 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
1112 | 1112 | |
|
1113 | 1113 | ``incoming`` |
|
1114 | 1114 | Run after a changeset has been pulled, pushed, or unbundled into |
|
1115 | 1115 | the local repository. The ID of the newly arrived changeset is in |
|
1116 | 1116 | ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``. |
|
1117 | 1117 | |
|
1118 | 1118 | ``outgoing`` |
|
1119 | 1119 | Run after sending changes from the local repository to another. The ID of |
|
1120 | 1120 | first changeset sent is in ``$HG_NODE``. The source of operation is in |
|
1121 | 1121 | ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`. |
|
1122 | 1122 | |
|
1123 | 1123 | ``post-<command>`` |
|
1124 | 1124 | Run after successful invocations of the associated command. The |
|
1125 | 1125 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
1126 | 1126 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
1127 | 1127 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
1128 | 1128 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
1129 | 1129 | dictionary of options (with unspecified options set to their defaults). |
|
1130 | 1130 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
1131 | 1131 | |
|
1132 | 1132 | ``fail-<command>`` |
|
1133 | 1133 | Run after a failed invocation of an associated command. The contents |
|
1134 | 1134 | of the command line are passed as ``$HG_ARGS``. Parsed command line |
|
1135 | 1135 | arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain |
|
1136 | 1136 | string representations of the python data internally passed to |
|
1137 | 1137 | <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified |
|
1138 | 1138 | options set to their defaults). ``$HG_PATS`` is a list of arguments. |
|
1139 | 1139 | Hook failure is ignored. |
|
1140 | 1140 | |
|
1141 | 1141 | ``pre-<command>`` |
|
1142 | 1142 | Run before executing the associated command. The contents of the |
|
1143 | 1143 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
1144 | 1144 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
1145 | 1145 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
1146 | 1146 | is a dictionary of options (with unspecified options set to their |
|
1147 | 1147 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
1148 | 1148 | failure, the command doesn't execute and Mercurial returns the failure |
|
1149 | 1149 | code. |
|
1150 | 1150 | |
|
1151 | 1151 | ``prechangegroup`` |
|
1152 | 1152 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
1153 | 1153 | status 0 allows the changegroup to proceed. A non-zero status will |
|
1154 | 1154 | cause the push, pull or unbundle to fail. The URL from which changes |
|
1155 | 1155 | will come is in ``$HG_URL``. |
|
1156 | 1156 | |
|
1157 | 1157 | ``precommit`` |
|
1158 | 1158 | Run before starting a local commit. Exit status 0 allows the |
|
1159 | 1159 | commit to proceed. A non-zero status will cause the commit to fail. |
|
1160 | 1160 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
1161 | 1161 | |
|
1162 | 1162 | ``prelistkeys`` |
|
1163 | 1163 | Run before listing pushkeys (like bookmarks) in the |
|
1164 | 1164 | repository. A non-zero status will cause failure. The key namespace is |
|
1165 | 1165 | in ``$HG_NAMESPACE``. |
|
1166 | 1166 | |
|
1167 | 1167 | ``preoutgoing`` |
|
1168 | 1168 | Run before collecting changes to send from the local repository to |
|
1169 | 1169 | another. A non-zero status will cause failure. This lets you prevent |
|
1170 | 1170 | pull over HTTP or SSH. It can also prevent propagating commits (via |
|
1171 | 1171 | local pull, push (outbound) or bundle commands), but not completely, |
|
1172 | 1172 | since you can just copy files instead. The source of operation is in |
|
1173 | 1173 | ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote |
|
1174 | 1174 | SSH or HTTP repository. If "push", "pull" or "bundle", the operation |
|
1175 | 1175 | is happening on behalf of a repository on same system. |
|
1176 | 1176 | |
|
1177 | 1177 | ``prepushkey`` |
|
1178 | 1178 | Run before a pushkey (like a bookmark) is added to the |
|
1179 | 1179 | repository. A non-zero status will cause the key to be rejected. The |
|
1180 | 1180 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
1181 | 1181 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
1182 | 1182 | ``$HG_NEW``. |
|
1183 | 1183 | |
|
1184 | 1184 | ``pretag`` |
|
1185 | 1185 | Run before creating a tag. Exit status 0 allows the tag to be |
|
1186 | 1186 | created. A non-zero status will cause the tag to fail. The ID of the |
|
1187 | 1187 | changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The |
|
1188 | 1188 | tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``. |
|
1189 | 1189 | |
|
1190 | 1190 | ``pretxnopen`` |
|
1191 | 1191 | Run before any new repository transaction is open. The reason for the |
|
1192 | 1192 | transaction will be in ``$HG_TXNNAME``, and a unique identifier for the |
|
1193 | 1193 | transaction will be in ``$HG_TXNID``. A non-zero status will prevent the |
|
1194 | 1194 | transaction from being opened. |
|
1195 | 1195 | |
|
1196 | 1196 | ``pretxnclose`` |
|
1197 | 1197 | Run right before the transaction is actually finalized. Any repository change |
|
1198 | 1198 | will be visible to the hook program. This lets you validate the transaction |
|
1199 | 1199 | content or change it. Exit status 0 allows the commit to proceed. A non-zero |
|
1200 | 1200 | status will cause the transaction to be rolled back. The reason for the |
|
1201 | 1201 | transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for |
|
1202 | 1202 | the transaction will be in ``$HG_TXNID``. The rest of the available data will |
|
1203 | 1203 | vary according the transaction type. Changes unbundled to the repository will |
|
1204 | 1204 | add ``$HG_URL`` and ``$HG_SOURCE``. New changesets will add ``$HG_NODE`` (the |
|
1205 | 1205 | ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last added |
|
1206 | 1206 | changeset). Bookmark and phase changes will set ``$HG_BOOKMARK_MOVED`` and |
|
1207 | 1207 | ``$HG_PHASES_MOVED`` to ``1`` respectively. The number of new obsmarkers, if |
|
1208 | 1208 | any, will be in ``$HG_NEW_OBSMARKERS``, etc. |
|
1209 | 1209 | |
|
1210 | 1210 | ``pretxnclose-bookmark`` |
|
1211 | 1211 | Run right before a bookmark change is actually finalized. Any repository |
|
1212 | 1212 | change will be visible to the hook program. This lets you validate the |
|
1213 | 1213 | transaction content or change it. Exit status 0 allows the commit to |
|
1214 | 1214 | proceed. A non-zero status will cause the transaction to be rolled back. |
|
1215 | 1215 | The name of the bookmark will be available in ``$HG_BOOKMARK``, the new |
|
1216 | 1216 | bookmark location will be available in ``$HG_NODE`` while the previous |
|
1217 | 1217 | location will be available in ``$HG_OLDNODE``. In case of a bookmark |
|
1218 | 1218 | creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE`` |
|
1219 | 1219 | will be empty. |
|
1220 | 1220 | In addition, the reason for the transaction opening will be in |
|
1221 | 1221 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in |
|
1222 | 1222 | ``$HG_TXNID``. |
|
1223 | 1223 | |
|
1224 | 1224 | ``pretxnclose-phase`` |
|
1225 | 1225 | Run right before a phase change is actually finalized. Any repository change |
|
1226 | 1226 | will be visible to the hook program. This lets you validate the transaction |
|
1227 | 1227 | content or change it. Exit status 0 allows the commit to proceed. A non-zero |
|
1228 | 1228 | status will cause the transaction to be rolled back. The hook is called |
|
1229 | 1229 | multiple times, once for each revision affected by a phase change. |
|
1230 | 1230 | The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE`` |
|
1231 | 1231 | while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE`` |
|
1232 | 1232 | will be empty. In addition, the reason for the transaction opening will be in |
|
1233 | 1233 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in |
|
1234 | 1234 | ``$HG_TXNID``. The hook is also run for newly added revisions. In this case |
|
1235 | 1235 | the ``$HG_OLDPHASE`` entry will be empty. |
|
1236 | 1236 | |
|
1237 | 1237 | ``txnclose`` |
|
1238 | 1238 | Run after any repository transaction has been committed. At this |
|
1239 | 1239 | point, the transaction can no longer be rolled back. The hook will run |
|
1240 | 1240 | after the lock is released. See :hg:`help config.hooks.pretxnclose` for |
|
1241 | 1241 | details about available variables. |
|
1242 | 1242 | |
|
1243 | 1243 | ``txnclose-bookmark`` |
|
1244 | 1244 | Run after any bookmark change has been committed. At this point, the |
|
1245 | 1245 | transaction can no longer be rolled back. The hook will run after the lock |
|
1246 | 1246 | is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details |
|
1247 | 1247 | about available variables. |
|
1248 | 1248 | |
|
1249 | 1249 | ``txnclose-phase`` |
|
1250 | 1250 | Run after any phase change has been committed. At this point, the |
|
1251 | 1251 | transaction can no longer be rolled back. The hook will run after the lock |
|
1252 | 1252 | is released. See :hg:`help config.hooks.pretxnclose-phase` for details about |
|
1253 | 1253 | available variables. |
|
1254 | 1254 | |
|
1255 | 1255 | ``txnabort`` |
|
1256 | 1256 | Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose` |
|
1257 | 1257 | for details about available variables. |
|
1258 | 1258 | |
|
1259 | 1259 | ``pretxnchangegroup`` |
|
1260 | 1260 | Run after a changegroup has been added via push, pull or unbundle, but before |
|
1261 | 1261 | the transaction has been committed. The changegroup is visible to the hook |
|
1262 | 1262 | program. This allows validation of incoming changes before accepting them. |
|
1263 | 1263 | The ID of the first new changeset is in ``$HG_NODE`` and last is in |
|
1264 | 1264 | ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero |
|
1265 | 1265 | status will cause the transaction to be rolled back, and the push, pull or |
|
1266 | 1266 | unbundle will fail. The URL that was the source of changes is in ``$HG_URL``. |
|
1267 | 1267 | |
|
1268 | 1268 | ``pretxncommit`` |
|
1269 | 1269 | Run after a changeset has been created, but before the transaction is |
|
1270 | 1270 | committed. The changeset is visible to the hook program. This allows |
|
1271 | 1271 | validation of the commit message and changes. Exit status 0 allows the |
|
1272 | 1272 | commit to proceed. A non-zero status will cause the transaction to |
|
1273 | 1273 | be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent |
|
1274 | 1274 | changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
1275 | 1275 | |
|
1276 | 1276 | ``preupdate`` |
|
1277 | 1277 | Run before updating the working directory. Exit status 0 allows |
|
1278 | 1278 | the update to proceed. A non-zero status will prevent the update. |
|
1279 | 1279 | The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a |
|
1280 | 1280 | merge, the ID of second new parent is in ``$HG_PARENT2``. |
|
1281 | 1281 | |
|
1282 | 1282 | ``listkeys`` |
|
1283 | 1283 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
1284 | 1284 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
1285 | 1285 | dictionary containing the keys and values. |
|
1286 | 1286 | |
|
1287 | 1287 | ``pushkey`` |
|
1288 | 1288 | Run after a pushkey (like a bookmark) is added to the |
|
1289 | 1289 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
1290 | 1290 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
1291 | 1291 | value is in ``$HG_NEW``. |
|
1292 | 1292 | |
|
1293 | 1293 | ``tag`` |
|
1294 | 1294 | Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``. |
|
1295 | 1295 | The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in |
|
1296 | 1296 | the repository if ``$HG_LOCAL=0``. |
|
1297 | 1297 | |
|
1298 | 1298 | ``update`` |
|
1299 | 1299 | Run after updating the working directory. The changeset ID of first |
|
1300 | 1300 | new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new |
|
1301 | 1301 | parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
1302 | 1302 | update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``. |
|
1303 | 1303 | |
|
1304 | 1304 | .. note:: |
|
1305 | 1305 | |
|
1306 | 1306 | It is generally better to use standard hooks rather than the |
|
1307 | 1307 | generic pre- and post- command hooks, as they are guaranteed to be |
|
1308 | 1308 | called in the appropriate contexts for influencing transactions. |
|
1309 | 1309 | Also, hooks like "commit" will be called in all contexts that |
|
1310 | 1310 | generate a commit (e.g. tag) and not just the commit command. |
|
1311 | 1311 | |
|
1312 | 1312 | .. note:: |
|
1313 | 1313 | |
|
1314 | 1314 | Environment variables with empty values may not be passed to |
|
1315 | 1315 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
1316 | 1316 | will have an empty value under Unix-like platforms for non-merge |
|
1317 | 1317 | changesets, while it will not be available at all under Windows. |
|
1318 | 1318 | |
|
1319 | 1319 | The syntax for Python hooks is as follows:: |
|
1320 | 1320 | |
|
1321 | 1321 | hookname = python:modulename.submodule.callable |
|
1322 | 1322 | hookname = python:/path/to/python/module.py:callable |
|
1323 | 1323 | |
|
1324 | 1324 | Python hooks are run within the Mercurial process. Each hook is |
|
1325 | 1325 | called with at least three keyword arguments: a ui object (keyword |
|
1326 | 1326 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
1327 | 1327 | keyword that tells what kind of hook is used. Arguments listed as |
|
1328 | 1328 | environment variables above are passed as keyword arguments, with no |
|
1329 | 1329 | ``HG_`` prefix, and names in lower case. |
|
1330 | 1330 | |
|
1331 | 1331 | If a Python hook returns a "true" value or raises an exception, this |
|
1332 | 1332 | is treated as a failure. |
|
1333 | 1333 | |
|
1334 | 1334 | |
|
1335 | 1335 | ``hostfingerprints`` |
|
1336 | 1336 | -------------------- |
|
1337 | 1337 | |
|
1338 | 1338 | (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.) |
|
1339 | 1339 | |
|
1340 | 1340 | Fingerprints of the certificates of known HTTPS servers. |
|
1341 | 1341 | |
|
1342 | 1342 | A HTTPS connection to a server with a fingerprint configured here will |
|
1343 | 1343 | only succeed if the servers certificate matches the fingerprint. |
|
1344 | 1344 | This is very similar to how ssh known hosts works. |
|
1345 | 1345 | |
|
1346 | 1346 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
1347 | 1347 | Multiple values can be specified (separated by spaces or commas). This can |
|
1348 | 1348 | be used to define both old and new fingerprints while a host transitions |
|
1349 | 1349 | to a new certificate. |
|
1350 | 1350 | |
|
1351 | 1351 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
1352 | 1352 | |
|
1353 | 1353 | For example:: |
|
1354 | 1354 | |
|
1355 | 1355 | [hostfingerprints] |
|
1356 | 1356 | hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1357 | 1357 | hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1358 | 1358 | |
|
1359 | 1359 | ``hostsecurity`` |
|
1360 | 1360 | ---------------- |
|
1361 | 1361 | |
|
1362 | 1362 | Used to specify global and per-host security settings for connecting to |
|
1363 | 1363 | other machines. |
|
1364 | 1364 | |
|
1365 | 1365 | The following options control default behavior for all hosts. |
|
1366 | 1366 | |
|
1367 | 1367 | ``ciphers`` |
|
1368 | 1368 | Defines the cryptographic ciphers to use for connections. |
|
1369 | 1369 | |
|
1370 | 1370 | Value must be a valid OpenSSL Cipher List Format as documented at |
|
1371 | 1371 | https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT. |
|
1372 | 1372 | |
|
1373 | 1373 | This setting is for advanced users only. Setting to incorrect values |
|
1374 | 1374 | can significantly lower connection security or decrease performance. |
|
1375 | 1375 | You have been warned. |
|
1376 | 1376 | |
|
1377 | 1377 | This option requires Python 2.7. |
|
1378 | 1378 | |
|
1379 | 1379 | ``minimumprotocol`` |
|
1380 | 1380 | Defines the minimum channel encryption protocol to use. |
|
1381 | 1381 | |
|
1382 | 1382 | By default, the highest version of TLS supported by both client and server |
|
1383 | 1383 | is used. |
|
1384 | 1384 | |
|
1385 | 1385 | Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``. |
|
1386 | 1386 | |
|
1387 | 1387 | When running on an old Python version, only ``tls1.0`` is allowed since |
|
1388 | 1388 | old versions of Python only support up to TLS 1.0. |
|
1389 | 1389 | |
|
1390 | 1390 | When running a Python that supports modern TLS versions, the default is |
|
1391 | 1391 | ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this |
|
1392 | 1392 | weakens security and should only be used as a feature of last resort if |
|
1393 | 1393 | a server does not support TLS 1.1+. |
|
1394 | 1394 | |
|
1395 | 1395 | Options in the ``[hostsecurity]`` section can have the form |
|
1396 | 1396 | ``hostname``:``setting``. This allows multiple settings to be defined on a |
|
1397 | 1397 | per-host basis. |
|
1398 | 1398 | |
|
1399 | 1399 | The following per-host settings can be defined. |
|
1400 | 1400 | |
|
1401 | 1401 | ``ciphers`` |
|
1402 | 1402 | This behaves like ``ciphers`` as described above except it only applies |
|
1403 | 1403 | to the host on which it is defined. |
|
1404 | 1404 | |
|
1405 | 1405 | ``fingerprints`` |
|
1406 | 1406 | A list of hashes of the DER encoded peer/remote certificate. Values have |
|
1407 | 1407 | the form ``algorithm``:``fingerprint``. e.g. |
|
1408 | 1408 | ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``. |
|
1409 | 1409 | In addition, colons (``:``) can appear in the fingerprint part. |
|
1410 | 1410 | |
|
1411 | 1411 | The following algorithms/prefixes are supported: ``sha1``, ``sha256``, |
|
1412 | 1412 | ``sha512``. |
|
1413 | 1413 | |
|
1414 | 1414 | Use of ``sha256`` or ``sha512`` is preferred. |
|
1415 | 1415 | |
|
1416 | 1416 | If a fingerprint is specified, the CA chain is not validated for this |
|
1417 | 1417 | host and Mercurial will require the remote certificate to match one |
|
1418 | 1418 | of the fingerprints specified. This means if the server updates its |
|
1419 | 1419 | certificate, Mercurial will abort until a new fingerprint is defined. |
|
1420 | 1420 | This can provide stronger security than traditional CA-based validation |
|
1421 | 1421 | at the expense of convenience. |
|
1422 | 1422 | |
|
1423 | 1423 | This option takes precedence over ``verifycertsfile``. |
|
1424 | 1424 | |
|
1425 | 1425 | ``minimumprotocol`` |
|
1426 | 1426 | This behaves like ``minimumprotocol`` as described above except it |
|
1427 | 1427 | only applies to the host on which it is defined. |
|
1428 | 1428 | |
|
1429 | 1429 | ``verifycertsfile`` |
|
1430 | 1430 | Path to file a containing a list of PEM encoded certificates used to |
|
1431 | 1431 | verify the server certificate. Environment variables and ``~user`` |
|
1432 | 1432 | constructs are expanded in the filename. |
|
1433 | 1433 | |
|
1434 | 1434 | The server certificate or the certificate's certificate authority (CA) |
|
1435 | 1435 | must match a certificate from this file or certificate verification |
|
1436 | 1436 | will fail and connections to the server will be refused. |
|
1437 | 1437 | |
|
1438 | 1438 | If defined, only certificates provided by this file will be used: |
|
1439 | 1439 | ``web.cacerts`` and any system/default certificates will not be |
|
1440 | 1440 | used. |
|
1441 | 1441 | |
|
1442 | 1442 | This option has no effect if the per-host ``fingerprints`` option |
|
1443 | 1443 | is set. |
|
1444 | 1444 | |
|
1445 | 1445 | The format of the file is as follows:: |
|
1446 | 1446 | |
|
1447 | 1447 | -----BEGIN CERTIFICATE----- |
|
1448 | 1448 | ... (certificate in base64 PEM encoding) ... |
|
1449 | 1449 | -----END CERTIFICATE----- |
|
1450 | 1450 | -----BEGIN CERTIFICATE----- |
|
1451 | 1451 | ... (certificate in base64 PEM encoding) ... |
|
1452 | 1452 | -----END CERTIFICATE----- |
|
1453 | 1453 | |
|
1454 | 1454 | For example:: |
|
1455 | 1455 | |
|
1456 | 1456 | [hostsecurity] |
|
1457 | 1457 | hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 |
|
1458 | 1458 | 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 |
|
1459 | 1459 | 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 |
|
1460 | 1460 | foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem |
|
1461 | 1461 | |
|
1462 | 1462 | To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1 |
|
1463 | 1463 | when connecting to ``hg.example.com``:: |
|
1464 | 1464 | |
|
1465 | 1465 | [hostsecurity] |
|
1466 | 1466 | minimumprotocol = tls1.2 |
|
1467 | 1467 | hg.example.com:minimumprotocol = tls1.1 |
|
1468 | 1468 | |
|
1469 | 1469 | ``http_proxy`` |
|
1470 | 1470 | -------------- |
|
1471 | 1471 | |
|
1472 | 1472 | Used to access web-based Mercurial repositories through a HTTP |
|
1473 | 1473 | proxy. |
|
1474 | 1474 | |
|
1475 | 1475 | ``host`` |
|
1476 | 1476 | Host name and (optional) port of the proxy server, for example |
|
1477 | 1477 | "myproxy:8000". |
|
1478 | 1478 | |
|
1479 | 1479 | ``no`` |
|
1480 | 1480 | Optional. Comma-separated list of host names that should bypass |
|
1481 | 1481 | the proxy. |
|
1482 | 1482 | |
|
1483 | 1483 | ``passwd`` |
|
1484 | 1484 | Optional. Password to authenticate with at the proxy server. |
|
1485 | 1485 | |
|
1486 | 1486 | ``user`` |
|
1487 | 1487 | Optional. User name to authenticate with at the proxy server. |
|
1488 | 1488 | |
|
1489 | 1489 | ``always`` |
|
1490 | 1490 | Optional. Always use the proxy, even for localhost and any entries |
|
1491 | 1491 | in ``http_proxy.no``. (default: False) |
|
1492 | 1492 | |
|
1493 | 1493 | ``http`` |
|
1494 | 1494 | ---------- |
|
1495 | 1495 | |
|
1496 | 1496 | Used to configure access to Mercurial repositories via HTTP. |
|
1497 | 1497 | |
|
1498 | 1498 | ``timeout`` |
|
1499 | 1499 | If set, blocking operations will timeout after that many seconds. |
|
1500 | 1500 | (default: None) |
|
1501 | 1501 | |
|
1502 | 1502 | ``merge`` |
|
1503 | 1503 | --------- |
|
1504 | 1504 | |
|
1505 | 1505 | This section specifies behavior during merges and updates. |
|
1506 | 1506 | |
|
1507 | 1507 | ``checkignored`` |
|
1508 | 1508 | Controls behavior when an ignored file on disk has the same name as a tracked |
|
1509 | 1509 | file in the changeset being merged or updated to, and has different |
|
1510 | 1510 | contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``, |
|
1511 | 1511 | abort on such files. With ``warn``, warn on such files and back them up as |
|
1512 | 1512 | ``.orig``. With ``ignore``, don't print a warning and back them up as |
|
1513 | 1513 | ``.orig``. (default: ``abort``) |
|
1514 | 1514 | |
|
1515 | 1515 | ``checkunknown`` |
|
1516 | 1516 | Controls behavior when an unknown file that isn't ignored has the same name |
|
1517 | 1517 | as a tracked file in the changeset being merged or updated to, and has |
|
1518 | 1518 | different contents. Similar to ``merge.checkignored``, except for files that |
|
1519 | 1519 | are not ignored. (default: ``abort``) |
|
1520 | 1520 | |
|
1521 | 1521 | ``on-failure`` |
|
1522 | 1522 | When set to ``continue`` (the default), the merge process attempts to |
|
1523 | 1523 | merge all unresolved files using the merge chosen tool, regardless of |
|
1524 | 1524 | whether previous file merge attempts during the process succeeded or not. |
|
1525 | 1525 | Setting this to ``prompt`` will prompt after any merge failure continue |
|
1526 | 1526 | or halt the merge process. Setting this to ``halt`` will automatically |
|
1527 | 1527 | halt the merge process on any merge tool failure. The merge process |
|
1528 | 1528 | can be restarted by using the ``resolve`` command. When a merge is |
|
1529 | 1529 | halted, the repository is left in a normal ``unresolved`` merge state. |
|
1530 | 1530 | (default: ``continue``) |
|
1531 | 1531 | |
|
1532 | 1532 | ``strict-capability-check`` |
|
1533 | 1533 | Whether capabilities of internal merge tools are checked strictly |
|
1534 | 1534 | or not, while examining rules to decide merge tool to be used. |
|
1535 | 1535 | (default: False) |
|
1536 | 1536 | |
|
1537 | 1537 | ``merge-patterns`` |
|
1538 | 1538 | ------------------ |
|
1539 | 1539 | |
|
1540 | 1540 | This section specifies merge tools to associate with particular file |
|
1541 | 1541 | patterns. Tools matched here will take precedence over the default |
|
1542 | 1542 | merge tool. Patterns are globs by default, rooted at the repository |
|
1543 | 1543 | root. |
|
1544 | 1544 | |
|
1545 | 1545 | Example:: |
|
1546 | 1546 | |
|
1547 | 1547 | [merge-patterns] |
|
1548 | 1548 | **.c = kdiff3 |
|
1549 | 1549 | **.jpg = myimgmerge |
|
1550 | 1550 | |
|
1551 | 1551 | ``merge-tools`` |
|
1552 | 1552 | --------------- |
|
1553 | 1553 | |
|
1554 | 1554 | This section configures external merge tools to use for file-level |
|
1555 | 1555 | merges. This section has likely been preconfigured at install time. |
|
1556 | 1556 | Use :hg:`config merge-tools` to check the existing configuration. |
|
1557 | 1557 | Also see :hg:`help merge-tools` for more details. |
|
1558 | 1558 | |
|
1559 | 1559 | Example ``~/.hgrc``:: |
|
1560 | 1560 | |
|
1561 | 1561 | [merge-tools] |
|
1562 | 1562 | # Override stock tool location |
|
1563 | 1563 | kdiff3.executable = ~/bin/kdiff3 |
|
1564 | 1564 | # Specify command line |
|
1565 | 1565 | kdiff3.args = $base $local $other -o $output |
|
1566 | 1566 | # Give higher priority |
|
1567 | 1567 | kdiff3.priority = 1 |
|
1568 | 1568 | |
|
1569 | 1569 | # Changing the priority of preconfigured tool |
|
1570 | 1570 | meld.priority = 0 |
|
1571 | 1571 | |
|
1572 | 1572 | # Disable a preconfigured tool |
|
1573 | 1573 | vimdiff.disabled = yes |
|
1574 | 1574 | |
|
1575 | 1575 | # Define new tool |
|
1576 | 1576 | myHtmlTool.args = -m $local $other $base $output |
|
1577 | 1577 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
1578 | 1578 | myHtmlTool.priority = 1 |
|
1579 | 1579 | |
|
1580 | 1580 | Supported arguments: |
|
1581 | 1581 | |
|
1582 | 1582 | ``priority`` |
|
1583 | 1583 | The priority in which to evaluate this tool. |
|
1584 | 1584 | (default: 0) |
|
1585 | 1585 | |
|
1586 | 1586 | ``executable`` |
|
1587 | 1587 | Either just the name of the executable or its pathname. |
|
1588 | 1588 | |
|
1589 | 1589 | .. container:: windows |
|
1590 | 1590 | |
|
1591 | 1591 | On Windows, the path can use environment variables with ${ProgramFiles} |
|
1592 | 1592 | syntax. |
|
1593 | 1593 | |
|
1594 | 1594 | (default: the tool name) |
|
1595 | 1595 | |
|
1596 | 1596 | ``args`` |
|
1597 | 1597 | The arguments to pass to the tool executable. You can refer to the |
|
1598 | 1598 | files being merged as well as the output file through these |
|
1599 | 1599 | variables: ``$base``, ``$local``, ``$other``, ``$output``. |
|
1600 | 1600 | |
|
1601 | 1601 | The meaning of ``$local`` and ``$other`` can vary depending on which action is |
|
1602 | 1602 | being performed. During an update or merge, ``$local`` represents the original |
|
1603 | 1603 | state of the file, while ``$other`` represents the commit you are updating to or |
|
1604 | 1604 | the commit you are merging with. During a rebase, ``$local`` represents the |
|
1605 | 1605 | destination of the rebase, and ``$other`` represents the commit being rebased. |
|
1606 | 1606 | |
|
1607 | 1607 | Some operations define custom labels to assist with identifying the revisions, |
|
1608 | 1608 | accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom |
|
1609 | 1609 | labels are not available, these will be ``local``, ``other``, and ``base``, |
|
1610 | 1610 | respectively. |
|
1611 | 1611 | (default: ``$local $base $other``) |
|
1612 | 1612 | |
|
1613 | 1613 | ``premerge`` |
|
1614 | 1614 | Attempt to run internal non-interactive 3-way merge tool before |
|
1615 | 1615 | launching external tool. Options are ``true``, ``false``, ``keep``, |
|
1616 | 1616 | ``keep-merge3``, or ``keep-mergediff`` (experimental). The ``keep`` option |
|
1617 | 1617 | will leave markers in the file if the premerge fails. The ``keep-merge3`` |
|
1618 | 1618 | will do the same but include information about the base of the merge in the |
|
1619 | 1619 | marker (see internal :merge3 in :hg:`help merge-tools`). The |
|
1620 | 1620 | ``keep-mergediff`` option is similar but uses a different marker style |
|
1621 | 1621 | (see internal :merge3 in :hg:`help merge-tools`). (default: True) |
|
1622 | 1622 | |
|
1623 | 1623 | ``binary`` |
|
1624 | 1624 | This tool can merge binary files. (default: False, unless tool |
|
1625 | 1625 | was selected by file pattern match) |
|
1626 | 1626 | |
|
1627 | 1627 | ``symlink`` |
|
1628 | 1628 | This tool can merge symlinks. (default: False) |
|
1629 | 1629 | |
|
1630 | 1630 | ``check`` |
|
1631 | 1631 | A list of merge success-checking options: |
|
1632 | 1632 | |
|
1633 | 1633 | ``changed`` |
|
1634 | 1634 | Ask whether merge was successful when the merged file shows no changes. |
|
1635 | 1635 | ``conflicts`` |
|
1636 | 1636 | Check whether there are conflicts even though the tool reported success. |
|
1637 | 1637 | ``prompt`` |
|
1638 | 1638 | Always prompt for merge success, regardless of success reported by tool. |
|
1639 | 1639 | |
|
1640 | 1640 | ``fixeol`` |
|
1641 | 1641 | Attempt to fix up EOL changes caused by the merge tool. |
|
1642 | 1642 | (default: False) |
|
1643 | 1643 | |
|
1644 | 1644 | ``gui`` |
|
1645 | 1645 | This tool requires a graphical interface to run. (default: False) |
|
1646 | 1646 | |
|
1647 | 1647 | ``mergemarkers`` |
|
1648 | 1648 | Controls whether the labels passed via ``$labellocal``, ``$labelother``, and |
|
1649 | 1649 | ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or |
|
1650 | 1650 | ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict |
|
1651 | 1651 | markers generated during premerge will be ``detailed`` if either this option or |
|
1652 | 1652 | the corresponding option in the ``[ui]`` section is ``detailed``. |
|
1653 | 1653 | (default: ``basic``) |
|
1654 | 1654 | |
|
1655 | 1655 | ``mergemarkertemplate`` |
|
1656 | 1656 | This setting can be used to override ``mergemarker`` from the |
|
1657 | 1657 | ``[command-templates]`` section on a per-tool basis; this applies to the |
|
1658 | 1658 | ``$label``-prefixed variables and to the conflict markers that are generated |
|
1659 | 1659 | if ``premerge`` is ``keep` or ``keep-merge3``. See the corresponding variable |
|
1660 | 1660 | in ``[ui]`` for more information. |
|
1661 | 1661 | |
|
1662 | 1662 | .. container:: windows |
|
1663 | 1663 | |
|
1664 | 1664 | ``regkey`` |
|
1665 | 1665 | Windows registry key which describes install location of this |
|
1666 | 1666 | tool. Mercurial will search for this key first under |
|
1667 | 1667 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
1668 | 1668 | (default: None) |
|
1669 | 1669 | |
|
1670 | 1670 | ``regkeyalt`` |
|
1671 | 1671 | An alternate Windows registry key to try if the first key is not |
|
1672 | 1672 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
1673 | 1673 | semantics of the primary key. The most common use for this key |
|
1674 | 1674 | is to search for 32bit applications on 64bit operating systems. |
|
1675 | 1675 | (default: None) |
|
1676 | 1676 | |
|
1677 | 1677 | ``regname`` |
|
1678 | 1678 | Name of value to read from specified registry key. |
|
1679 | 1679 | (default: the unnamed (default) value) |
|
1680 | 1680 | |
|
1681 | 1681 | ``regappend`` |
|
1682 | 1682 | String to append to the value read from the registry, typically |
|
1683 | 1683 | the executable name of the tool. |
|
1684 | 1684 | (default: None) |
|
1685 | 1685 | |
|
1686 | 1686 | ``pager`` |
|
1687 | 1687 | --------- |
|
1688 | 1688 | |
|
1689 | 1689 | Setting used to control when to paginate and with what external tool. See |
|
1690 | 1690 | :hg:`help pager` for details. |
|
1691 | 1691 | |
|
1692 | 1692 | ``pager`` |
|
1693 | 1693 | Define the external tool used as pager. |
|
1694 | 1694 | |
|
1695 | 1695 | If no pager is set, Mercurial uses the environment variable $PAGER. |
|
1696 | 1696 | If neither pager.pager, nor $PAGER is set, a default pager will be |
|
1697 | 1697 | used, typically `less` on Unix and `more` on Windows. Example:: |
|
1698 | 1698 | |
|
1699 | 1699 | [pager] |
|
1700 | 1700 | pager = less -FRX |
|
1701 | 1701 | |
|
1702 | 1702 | ``ignore`` |
|
1703 | 1703 | List of commands to disable the pager for. Example:: |
|
1704 | 1704 | |
|
1705 | 1705 | [pager] |
|
1706 | 1706 | ignore = version, help, update |
|
1707 | 1707 | |
|
1708 | 1708 | ``patch`` |
|
1709 | 1709 | --------- |
|
1710 | 1710 | |
|
1711 | 1711 | Settings used when applying patches, for instance through the 'import' |
|
1712 | 1712 | command or with Mercurial Queues extension. |
|
1713 | 1713 | |
|
1714 | 1714 | ``eol`` |
|
1715 | 1715 | When set to 'strict' patch content and patched files end of lines |
|
1716 | 1716 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
1717 | 1717 | lines are ignored when patching and the result line endings are |
|
1718 | 1718 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
1719 | 1719 | ``auto``, end of lines are again ignored while patching but line |
|
1720 | 1720 | endings in patched files are normalized to their original setting |
|
1721 | 1721 | on a per-file basis. If target file does not exist or has no end |
|
1722 | 1722 | of line, patch line endings are preserved. |
|
1723 | 1723 | (default: strict) |
|
1724 | 1724 | |
|
1725 | 1725 | ``fuzz`` |
|
1726 | 1726 | The number of lines of 'fuzz' to allow when applying patches. This |
|
1727 | 1727 | controls how much context the patcher is allowed to ignore when |
|
1728 | 1728 | trying to apply a patch. |
|
1729 | 1729 | (default: 2) |
|
1730 | 1730 | |
|
1731 | 1731 | ``paths`` |
|
1732 | 1732 | --------- |
|
1733 | 1733 | |
|
1734 | 1734 | Assigns symbolic names and behavior to repositories. |
|
1735 | 1735 | |
|
1736 | 1736 | Options are symbolic names defining the URL or directory that is the |
|
1737 | 1737 | location of the repository. Example:: |
|
1738 | 1738 | |
|
1739 | 1739 | [paths] |
|
1740 | 1740 | my_server = https://example.com/my_repo |
|
1741 | 1741 | local_path = /home/me/repo |
|
1742 | 1742 | |
|
1743 | 1743 | These symbolic names can be used from the command line. To pull |
|
1744 | 1744 | from ``my_server``: :hg:`pull my_server`. To push to ``local_path``: |
|
1745 | 1745 | :hg:`push local_path`. You can check :hg:`help urls` for details about |
|
1746 | 1746 | valid URLs. |
|
1747 | 1747 | |
|
1748 | 1748 | Options containing colons (``:``) denote sub-options that can influence |
|
1749 | 1749 | behavior for that specific path. Example:: |
|
1750 | 1750 | |
|
1751 | 1751 | [paths] |
|
1752 | 1752 | my_server = https://example.com/my_path |
|
1753 | 1753 | my_server:pushurl = ssh://example.com/my_path |
|
1754 | 1754 | |
|
1755 | 1755 | Paths using the `path://otherpath` scheme will inherit the sub-options value from |
|
1756 | 1756 | the path they point to. |
|
1757 | 1757 | |
|
1758 | 1758 | The following sub-options can be defined: |
|
1759 | 1759 | |
|
1760 | 1760 | ``multi-urls`` |
|
1761 | 1761 | A boolean option. When enabled the value of the `[paths]` entry will be |
|
1762 | 1762 | parsed as a list and the alias will resolve to multiple destination. If some |
|
1763 | 1763 | of the list entry use the `path://` syntax, the suboption will be inherited |
|
1764 | 1764 | individually. |
|
1765 | 1765 | |
|
1766 | 1766 | ``pushurl`` |
|
1767 | 1767 | The URL to use for push operations. If not defined, the location |
|
1768 | 1768 | defined by the path's main entry is used. |
|
1769 | 1769 | |
|
1770 | 1770 | ``pushrev`` |
|
1771 | 1771 | A revset defining which revisions to push by default. |
|
1772 | 1772 | |
|
1773 | 1773 | When :hg:`push` is executed without a ``-r`` argument, the revset |
|
1774 | 1774 | defined by this sub-option is evaluated to determine what to push. |
|
1775 | 1775 | |
|
1776 | 1776 | For example, a value of ``.`` will push the working directory's |
|
1777 | 1777 | revision by default. |
|
1778 | 1778 | |
|
1779 | 1779 | Revsets specifying bookmarks will not result in the bookmark being |
|
1780 | 1780 | pushed. |
|
1781 | 1781 | |
|
1782 | 1782 | ``bookmarks.mode`` |
|
1783 | 1783 | How bookmark will be dealt during the exchange. It support the following value |
|
1784 | 1784 | |
|
1785 | 1785 | - ``default``: the default behavior, local and remote bookmarks are "merged" |
|
1786 | 1786 | on push/pull. |
|
1787 | 1787 | |
|
1788 | 1788 | - ``mirror``: when pulling, replace local bookmarks by remote bookmarks. This |
|
1789 | 1789 | is useful to replicate a repository, or as an optimization. |
|
1790 | 1790 | |
|
1791 | 1791 | - ``ignore``: ignore bookmarks during exchange. |
|
1792 | 1792 | (This currently only affect pulling) |
|
1793 | 1793 | |
|
1794 | 1794 | The following special named paths exist: |
|
1795 | 1795 | |
|
1796 | 1796 | ``default`` |
|
1797 | 1797 | The URL or directory to use when no source or remote is specified. |
|
1798 | 1798 | |
|
1799 | 1799 | :hg:`clone` will automatically define this path to the location the |
|
1800 | 1800 | repository was cloned from. |
|
1801 | 1801 | |
|
1802 | 1802 | ``default-push`` |
|
1803 | 1803 | (deprecated) The URL or directory for the default :hg:`push` location. |
|
1804 | 1804 | ``default:pushurl`` should be used instead. |
|
1805 | 1805 | |
|
1806 | 1806 | ``phases`` |
|
1807 | 1807 | ---------- |
|
1808 | 1808 | |
|
1809 | 1809 | Specifies default handling of phases. See :hg:`help phases` for more |
|
1810 | 1810 | information about working with phases. |
|
1811 | 1811 | |
|
1812 | 1812 | ``publish`` |
|
1813 | 1813 | Controls draft phase behavior when working as a server. When true, |
|
1814 | 1814 | pushed changesets are set to public in both client and server and |
|
1815 | 1815 | pulled or cloned changesets are set to public in the client. |
|
1816 | 1816 | (default: True) |
|
1817 | 1817 | |
|
1818 | 1818 | ``new-commit`` |
|
1819 | 1819 | Phase of newly-created commits. |
|
1820 | 1820 | (default: draft) |
|
1821 | 1821 | |
|
1822 | 1822 | ``checksubrepos`` |
|
1823 | 1823 | Check the phase of the current revision of each subrepository. Allowed |
|
1824 | 1824 | values are "ignore", "follow" and "abort". For settings other than |
|
1825 | 1825 | "ignore", the phase of the current revision of each subrepository is |
|
1826 | 1826 | checked before committing the parent repository. If any of those phases is |
|
1827 | 1827 | greater than the phase of the parent repository (e.g. if a subrepo is in a |
|
1828 | 1828 | "secret" phase while the parent repo is in "draft" phase), the commit is |
|
1829 | 1829 | either aborted (if checksubrepos is set to "abort") or the higher phase is |
|
1830 | 1830 | used for the parent repository commit (if set to "follow"). |
|
1831 | 1831 | (default: follow) |
|
1832 | 1832 | |
|
1833 | 1833 | |
|
1834 | 1834 | ``profiling`` |
|
1835 | 1835 | ------------- |
|
1836 | 1836 | |
|
1837 | 1837 | Specifies profiling type, format, and file output. Two profilers are |
|
1838 | 1838 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
1839 | 1839 | profiler (named ``stat``). |
|
1840 | 1840 | |
|
1841 | 1841 | In this section description, 'profiling data' stands for the raw data |
|
1842 | 1842 | collected during profiling, while 'profiling report' stands for a |
|
1843 | 1843 | statistical text report generated from the profiling data. |
|
1844 | 1844 | |
|
1845 | 1845 | ``enabled`` |
|
1846 | 1846 | Enable the profiler. |
|
1847 | 1847 | (default: false) |
|
1848 | 1848 | |
|
1849 | 1849 | This is equivalent to passing ``--profile`` on the command line. |
|
1850 | 1850 | |
|
1851 | 1851 | ``type`` |
|
1852 | 1852 | The type of profiler to use. |
|
1853 | 1853 | (default: stat) |
|
1854 | 1854 | |
|
1855 | 1855 | ``ls`` |
|
1856 | 1856 | Use Python's built-in instrumenting profiler. This profiler |
|
1857 | 1857 | works on all platforms, but each line number it reports is the |
|
1858 | 1858 | first line of a function. This restriction makes it difficult to |
|
1859 | 1859 | identify the expensive parts of a non-trivial function. |
|
1860 | 1860 | ``stat`` |
|
1861 | 1861 | Use a statistical profiler, statprof. This profiler is most |
|
1862 | 1862 | useful for profiling commands that run for longer than about 0.1 |
|
1863 | 1863 | seconds. |
|
1864 | 1864 | |
|
1865 | 1865 | ``format`` |
|
1866 | 1866 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
1867 | 1867 | (default: text) |
|
1868 | 1868 | |
|
1869 | 1869 | ``text`` |
|
1870 | 1870 | Generate a profiling report. When saving to a file, it should be |
|
1871 | 1871 | noted that only the report is saved, and the profiling data is |
|
1872 | 1872 | not kept. |
|
1873 | 1873 | ``kcachegrind`` |
|
1874 | 1874 | Format profiling data for kcachegrind use: when saving to a |
|
1875 | 1875 | file, the generated file can directly be loaded into |
|
1876 | 1876 | kcachegrind. |
|
1877 | 1877 | |
|
1878 | 1878 | ``statformat`` |
|
1879 | 1879 | Profiling format for the ``stat`` profiler. |
|
1880 | 1880 | (default: hotpath) |
|
1881 | 1881 | |
|
1882 | 1882 | ``hotpath`` |
|
1883 | 1883 | Show a tree-based display containing the hot path of execution (where |
|
1884 | 1884 | most time was spent). |
|
1885 | 1885 | ``bymethod`` |
|
1886 | 1886 | Show a table of methods ordered by how frequently they are active. |
|
1887 | 1887 | ``byline`` |
|
1888 | 1888 | Show a table of lines in files ordered by how frequently they are active. |
|
1889 | 1889 | ``json`` |
|
1890 | 1890 | Render profiling data as JSON. |
|
1891 | 1891 | |
|
1892 | 1892 | ``freq`` |
|
1893 | 1893 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
1894 | 1894 | (default: 1000) |
|
1895 | 1895 | |
|
1896 | 1896 | ``output`` |
|
1897 | 1897 | File path where profiling data or report should be saved. If the |
|
1898 | 1898 | file exists, it is replaced. (default: None, data is printed on |
|
1899 | 1899 | stderr) |
|
1900 | 1900 | |
|
1901 | 1901 | ``sort`` |
|
1902 | 1902 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
1903 | 1903 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
1904 | 1904 | ``inlinetime``. |
|
1905 | 1905 | (default: inlinetime) |
|
1906 | 1906 | |
|
1907 | 1907 | ``time-track`` |
|
1908 | 1908 | Control if the stat profiler track ``cpu`` or ``real`` time. |
|
1909 | 1909 | (default: ``cpu`` on Windows, otherwise ``real``) |
|
1910 | 1910 | |
|
1911 | 1911 | ``limit`` |
|
1912 | 1912 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1913 | 1913 | (default: 30) |
|
1914 | 1914 | |
|
1915 | 1915 | ``nested`` |
|
1916 | 1916 | Show at most this number of lines of drill-down info after each main entry. |
|
1917 | 1917 | This can help explain the difference between Total and Inline. |
|
1918 | 1918 | Specific to the ``ls`` instrumenting profiler. |
|
1919 | 1919 | (default: 0) |
|
1920 | 1920 | |
|
1921 | 1921 | ``showmin`` |
|
1922 | 1922 | Minimum fraction of samples an entry must have for it to be displayed. |
|
1923 | 1923 | Can be specified as a float between ``0.0`` and ``1.0`` or can have a |
|
1924 | 1924 | ``%`` afterwards to allow values up to ``100``. e.g. ``5%``. |
|
1925 | 1925 | |
|
1926 | 1926 | Only used by the ``stat`` profiler. |
|
1927 | 1927 | |
|
1928 | 1928 | For the ``hotpath`` format, default is ``0.05``. |
|
1929 | 1929 | For the ``chrome`` format, default is ``0.005``. |
|
1930 | 1930 | |
|
1931 | 1931 | The option is unused on other formats. |
|
1932 | 1932 | |
|
1933 | 1933 | ``showmax`` |
|
1934 | 1934 | Maximum fraction of samples an entry can have before it is ignored in |
|
1935 | 1935 | display. Values format is the same as ``showmin``. |
|
1936 | 1936 | |
|
1937 | 1937 | Only used by the ``stat`` profiler. |
|
1938 | 1938 | |
|
1939 | 1939 | For the ``chrome`` format, default is ``0.999``. |
|
1940 | 1940 | |
|
1941 | 1941 | The option is unused on other formats. |
|
1942 | 1942 | |
|
1943 | 1943 | ``showtime`` |
|
1944 | 1944 | Show time taken as absolute durations, in addition to percentages. |
|
1945 | 1945 | Only used by the ``hotpath`` format. |
|
1946 | 1946 | (default: true) |
|
1947 | 1947 | |
|
1948 | 1948 | ``progress`` |
|
1949 | 1949 | ------------ |
|
1950 | 1950 | |
|
1951 | 1951 | Mercurial commands can draw progress bars that are as informative as |
|
1952 | 1952 | possible. Some progress bars only offer indeterminate information, while others |
|
1953 | 1953 | have a definite end point. |
|
1954 | 1954 | |
|
1955 | 1955 | ``debug`` |
|
1956 | 1956 | Whether to print debug info when updating the progress bar. (default: False) |
|
1957 | 1957 | |
|
1958 | 1958 | ``delay`` |
|
1959 | 1959 | Number of seconds (float) before showing the progress bar. (default: 3) |
|
1960 | 1960 | |
|
1961 | 1961 | ``changedelay`` |
|
1962 | 1962 | Minimum delay before showing a new topic. When set to less than 3 * refresh, |
|
1963 | 1963 | that value will be used instead. (default: 1) |
|
1964 | 1964 | |
|
1965 | 1965 | ``estimateinterval`` |
|
1966 | 1966 | Maximum sampling interval in seconds for speed and estimated time |
|
1967 | 1967 | calculation. (default: 60) |
|
1968 | 1968 | |
|
1969 | 1969 | ``refresh`` |
|
1970 | 1970 | Time in seconds between refreshes of the progress bar. (default: 0.1) |
|
1971 | 1971 | |
|
1972 | 1972 | ``format`` |
|
1973 | 1973 | Format of the progress bar. |
|
1974 | 1974 | |
|
1975 | 1975 | Valid entries for the format field are ``topic``, ``bar``, ``number``, |
|
1976 | 1976 | ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the |
|
1977 | 1977 | last 20 characters of the item, but this can be changed by adding either |
|
1978 | 1978 | ``-<num>`` which would take the last num characters, or ``+<num>`` for the |
|
1979 | 1979 | first num characters. |
|
1980 | 1980 | |
|
1981 | 1981 | (default: topic bar number estimate) |
|
1982 | 1982 | |
|
1983 | 1983 | ``width`` |
|
1984 | 1984 | If set, the maximum width of the progress information (that is, min(width, |
|
1985 | 1985 | term width) will be used). |
|
1986 | 1986 | |
|
1987 | 1987 | ``clear-complete`` |
|
1988 | 1988 | Clear the progress bar after it's done. (default: True) |
|
1989 | 1989 | |
|
1990 | 1990 | ``disable`` |
|
1991 | 1991 | If true, don't show a progress bar. |
|
1992 | 1992 | |
|
1993 | 1993 | ``assume-tty`` |
|
1994 | 1994 | If true, ALWAYS show a progress bar, unless disable is given. |
|
1995 | 1995 | |
|
1996 | 1996 | ``rebase`` |
|
1997 | 1997 | ---------- |
|
1998 | 1998 | |
|
1999 | 1999 | ``evolution.allowdivergence`` |
|
2000 | 2000 | Default to False, when True allow creating divergence when performing |
|
2001 | 2001 | rebase of obsolete changesets. |
|
2002 | 2002 | |
|
2003 | 2003 | ``revsetalias`` |
|
2004 | 2004 | --------------- |
|
2005 | 2005 | |
|
2006 | 2006 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
2007 | 2007 | |
|
2008 | 2008 | ``rewrite`` |
|
2009 | 2009 | ----------- |
|
2010 | 2010 | |
|
2011 | 2011 | ``backup-bundle`` |
|
2012 | 2012 | Whether to save stripped changesets to a bundle file. (default: True) |
|
2013 | 2013 | |
|
2014 | 2014 | ``update-timestamp`` |
|
2015 | 2015 | If true, updates the date and time of the changeset to current. It is only |
|
2016 | 2016 | applicable for `hg amend`, `hg commit --amend` and `hg uncommit` in the |
|
2017 | 2017 | current version. |
|
2018 | 2018 | |
|
2019 | 2019 | ``empty-successor`` |
|
2020 | 2020 | |
|
2021 | 2021 | Control what happens with empty successors that are the result of rewrite |
|
2022 | 2022 | operations. If set to ``skip``, the successor is not created. If set to |
|
2023 | 2023 | ``keep``, the empty successor is created and kept. |
|
2024 | 2024 | |
|
2025 | 2025 | Currently, only the rebase and absorb commands consider this configuration. |
|
2026 | 2026 | (EXPERIMENTAL) |
|
2027 | 2027 | |
|
2028 | 2028 | ``share`` |
|
2029 | 2029 | --------- |
|
2030 | 2030 | |
|
2031 | 2031 | ``safe-mismatch.source-safe`` |
|
2032 | 2032 | |
|
2033 | 2033 | Controls what happens when the shared repository does not use the |
|
2034 | 2034 | share-safe mechanism but its source repository does. |
|
2035 | 2035 | |
|
2036 | 2036 | Possible values are `abort` (default), `allow`, `upgrade-abort` and |
|
2037 | 2037 | `upgrade-abort`. |
|
2038 | 2038 | |
|
2039 | 2039 | ``abort`` |
|
2040 | 2040 | Disallows running any command and aborts |
|
2041 | 2041 | ``allow`` |
|
2042 | 2042 | Respects the feature presence in the share source |
|
2043 | 2043 | ``upgrade-abort`` |
|
2044 | 2044 | tries to upgrade the share to use share-safe; if it fails, aborts |
|
2045 | 2045 | ``upgrade-allow`` |
|
2046 | 2046 | tries to upgrade the share; if it fails, continue by |
|
2047 | 2047 | respecting the share source setting |
|
2048 | 2048 | |
|
2049 | 2049 | Check :hg:`help config format.use-share-safe` for details about the |
|
2050 | 2050 | share-safe feature. |
|
2051 | 2051 | |
|
2052 | 2052 | ``safe-mismatch.source-safe.warn`` |
|
2053 | 2053 | Shows a warning on operations if the shared repository does not use |
|
2054 | 2054 | share-safe, but the source repository does. |
|
2055 | 2055 | (default: True) |
|
2056 | 2056 | |
|
2057 | 2057 | ``safe-mismatch.source-not-safe`` |
|
2058 | 2058 | |
|
2059 | 2059 | Controls what happens when the shared repository uses the share-safe |
|
2060 | 2060 | mechanism but its source does not. |
|
2061 | 2061 | |
|
2062 | 2062 | Possible values are `abort` (default), `allow`, `downgrade-abort` and |
|
2063 | 2063 | `downgrade-abort`. |
|
2064 | 2064 | |
|
2065 | 2065 | ``abort`` |
|
2066 | 2066 | Disallows running any command and aborts |
|
2067 | 2067 | ``allow`` |
|
2068 | 2068 | Respects the feature presence in the share source |
|
2069 | 2069 | ``downgrade-abort`` |
|
2070 | 2070 | tries to downgrade the share to not use share-safe; if it fails, aborts |
|
2071 | 2071 | ``downgrade-allow`` |
|
2072 | 2072 | tries to downgrade the share to not use share-safe; |
|
2073 | 2073 | if it fails, continue by respecting the shared source setting |
|
2074 | 2074 | |
|
2075 | 2075 | Check :hg:`help config format.use-share-safe` for details about the |
|
2076 | 2076 | share-safe feature. |
|
2077 | 2077 | |
|
2078 | 2078 | ``safe-mismatch.source-not-safe.warn`` |
|
2079 | 2079 | Shows a warning on operations if the shared repository uses share-safe, |
|
2080 | 2080 | but the source repository does not. |
|
2081 | 2081 | (default: True) |
|
2082 | 2082 | |
|
2083 | 2083 | ``storage`` |
|
2084 | 2084 | ----------- |
|
2085 | 2085 | |
|
2086 | 2086 | Control the strategy Mercurial uses internally to store history. Options in this |
|
2087 | 2087 | category impact performance and repository size. |
|
2088 | 2088 | |
|
2089 | 2089 | ``revlog.issue6528.fix-incoming`` |
|
2090 | 2090 | Version 5.8 of Mercurial had a bug leading to altering the parent of file |
|
2091 | 2091 | revision with copy information (or any other metadata) on exchange. This |
|
2092 | 2092 | leads to the copy metadata to be overlooked by various internal logic. The |
|
2093 | 2093 | issue was fixed in Mercurial 5.8.1. |
|
2094 | 2094 | (See https://bz.mercurial-scm.org/show_bug.cgi?id=6528 for details) |
|
2095 | 2095 | |
|
2096 | 2096 | As a result Mercurial is now checking and fixing incoming file revisions to |
|
2097 | 2097 | make sure there parents are in the right order. This behavior can be |
|
2098 | 2098 | disabled by setting this option to `no`. This apply to revisions added |
|
2099 | 2099 | through push, pull, clone and unbundle. |
|
2100 | 2100 | |
|
2101 | 2101 | To fix affected revisions that already exist within the repository, one can |
|
2102 | 2102 | use :hg:`debug-repair-issue-6528`. |
|
2103 | 2103 | |
|
2104 | 2104 | ``revlog.optimize-delta-parent-choice`` |
|
2105 | 2105 | When storing a merge revision, both parents will be equally considered as |
|
2106 | 2106 | a possible delta base. This results in better delta selection and improved |
|
2107 | 2107 | revlog compression. This option is enabled by default. |
|
2108 | 2108 | |
|
2109 | 2109 | Turning this option off can result in large increase of repository size for |
|
2110 | 2110 | repository with many merges. |
|
2111 | 2111 | |
|
2112 | 2112 | ``revlog.persistent-nodemap.mmap`` |
|
2113 | 2113 | Whether to use the Operating System "memory mapping" feature (when |
|
2114 | 2114 | possible) to access the persistent nodemap data. This improve performance |
|
2115 | 2115 | and reduce memory pressure. |
|
2116 | 2116 | |
|
2117 | 2117 | Default to True. |
|
2118 | 2118 | |
|
2119 | 2119 | For details on the "persistent-nodemap" feature, see: |
|
2120 | 2120 | :hg:`help config format.use-persistent-nodemap`. |
|
2121 | 2121 | |
|
2122 | 2122 | ``revlog.persistent-nodemap.slow-path`` |
|
2123 | 2123 | Control the behavior of Merucrial when using a repository with "persistent" |
|
2124 | 2124 | nodemap with an installation of Mercurial without a fast implementation for |
|
2125 | 2125 | the feature: |
|
2126 | 2126 | |
|
2127 | 2127 | ``allow``: Silently use the slower implementation to access the repository. |
|
2128 | 2128 | ``warn``: Warn, but use the slower implementation to access the repository. |
|
2129 | 2129 | ``abort``: Prevent access to such repositories. (This is the default) |
|
2130 | 2130 | |
|
2131 | 2131 | For details on the "persistent-nodemap" feature, see: |
|
2132 | 2132 | :hg:`help config format.use-persistent-nodemap`. |
|
2133 | 2133 | |
|
2134 | 2134 | ``revlog.reuse-external-delta-parent`` |
|
2135 | 2135 | Control the order in which delta parents are considered when adding new |
|
2136 | 2136 | revisions from an external source. |
|
2137 | 2137 | (typically: apply bundle from `hg pull` or `hg push`). |
|
2138 | 2138 | |
|
2139 | 2139 | New revisions are usually provided as a delta against other revisions. By |
|
2140 | 2140 | default, Mercurial will try to reuse this delta first, therefore using the |
|
2141 | 2141 | same "delta parent" as the source. Directly using delta's from the source |
|
2142 | 2142 | reduces CPU usage and usually speeds up operation. However, in some case, |
|
2143 | 2143 | the source might have sub-optimal delta bases and forcing their reevaluation |
|
2144 | 2144 | is useful. For example, pushes from an old client could have sub-optimal |
|
2145 | 2145 | delta's parent that the server want to optimize. (lack of general delta, bad |
|
2146 | 2146 | parents, choice, lack of sparse-revlog, etc). |
|
2147 | 2147 | |
|
2148 | 2148 | This option is enabled by default. Turning it off will ensure bad delta |
|
2149 | 2149 | parent choices from older client do not propagate to this repository, at |
|
2150 | 2150 | the cost of a small increase in CPU consumption. |
|
2151 | 2151 | |
|
2152 | 2152 | Note: this option only control the order in which delta parents are |
|
2153 | 2153 | considered. Even when disabled, the existing delta from the source will be |
|
2154 | 2154 | reused if the same delta parent is selected. |
|
2155 | 2155 | |
|
2156 | 2156 | ``revlog.reuse-external-delta`` |
|
2157 | 2157 | Control the reuse of delta from external source. |
|
2158 | 2158 | (typically: apply bundle from `hg pull` or `hg push`). |
|
2159 | 2159 | |
|
2160 | 2160 | New revisions are usually provided as a delta against another revision. By |
|
2161 | 2161 | default, Mercurial will not recompute the same delta again, trusting |
|
2162 | 2162 | externally provided deltas. There have been rare cases of small adjustment |
|
2163 | 2163 | to the diffing algorithm in the past. So in some rare case, recomputing |
|
2164 | 2164 | delta provided by ancient clients can provides better results. Disabling |
|
2165 | 2165 | this option means going through a full delta recomputation for all incoming |
|
2166 | 2166 | revisions. It means a large increase in CPU usage and will slow operations |
|
2167 | 2167 | down. |
|
2168 | 2168 | |
|
2169 | 2169 | This option is enabled by default. When disabled, it also disables the |
|
2170 | 2170 | related ``storage.revlog.reuse-external-delta-parent`` option. |
|
2171 | 2171 | |
|
2172 | 2172 | ``revlog.zlib.level`` |
|
2173 | 2173 | Zlib compression level used when storing data into the repository. Accepted |
|
2174 | 2174 | Value range from 1 (lowest compression) to 9 (highest compression). Zlib |
|
2175 | 2175 | default value is 6. |
|
2176 | 2176 | |
|
2177 | 2177 | |
|
2178 | 2178 | ``revlog.zstd.level`` |
|
2179 | 2179 | zstd compression level used when storing data into the repository. Accepted |
|
2180 | 2180 | Value range from 1 (lowest compression) to 22 (highest compression). |
|
2181 | 2181 | (default 3) |
|
2182 | 2182 | |
|
2183 | 2183 | ``server`` |
|
2184 | 2184 | ---------- |
|
2185 | 2185 | |
|
2186 | 2186 | Controls generic server settings. |
|
2187 | 2187 | |
|
2188 | 2188 | ``bookmarks-pushkey-compat`` |
|
2189 | 2189 | Trigger pushkey hook when being pushed bookmark updates. This config exist |
|
2190 | 2190 | for compatibility purpose (default to True) |
|
2191 | 2191 | |
|
2192 | 2192 | If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark |
|
2193 | 2193 | movement we recommend you migrate them to ``txnclose-bookmark`` and |
|
2194 | 2194 | ``pretxnclose-bookmark``. |
|
2195 | 2195 | |
|
2196 | 2196 | ``compressionengines`` |
|
2197 | 2197 | List of compression engines and their relative priority to advertise |
|
2198 | 2198 | to clients. |
|
2199 | 2199 | |
|
2200 | 2200 | The order of compression engines determines their priority, the first |
|
2201 | 2201 | having the highest priority. If a compression engine is not listed |
|
2202 | 2202 | here, it won't be advertised to clients. |
|
2203 | 2203 | |
|
2204 | 2204 | If not set (the default), built-in defaults are used. Run |
|
2205 | 2205 | :hg:`debuginstall` to list available compression engines and their |
|
2206 | 2206 | default wire protocol priority. |
|
2207 | 2207 | |
|
2208 | 2208 | Older Mercurial clients only support zlib compression and this setting |
|
2209 | 2209 | has no effect for legacy clients. |
|
2210 | 2210 | |
|
2211 | 2211 | ``uncompressed`` |
|
2212 | 2212 | Whether to allow clients to clone a repository using the |
|
2213 | 2213 | uncompressed streaming protocol. This transfers about 40% more |
|
2214 | 2214 | data than a regular clone, but uses less memory and CPU on both |
|
2215 | 2215 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
2216 | 2216 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
2217 | 2217 | regular clone. Over most WAN connections (anything slower than |
|
2218 | 2218 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
2219 | 2219 | extra data transfer overhead. This mode will also temporarily hold |
|
2220 | 2220 | the write lock while determining what data to transfer. |
|
2221 | 2221 | (default: True) |
|
2222 | 2222 | |
|
2223 | 2223 | ``uncompressedallowsecret`` |
|
2224 | 2224 | Whether to allow stream clones when the repository contains secret |
|
2225 | 2225 | changesets. (default: False) |
|
2226 | 2226 | |
|
2227 | 2227 | ``preferuncompressed`` |
|
2228 | 2228 | When set, clients will try to use the uncompressed streaming |
|
2229 | 2229 | protocol. (default: False) |
|
2230 | 2230 | |
|
2231 | 2231 | ``disablefullbundle`` |
|
2232 | 2232 | When set, servers will refuse attempts to do pull-based clones. |
|
2233 | 2233 | If this option is set, ``preferuncompressed`` and/or clone bundles |
|
2234 | 2234 | are highly recommended. Partial clones will still be allowed. |
|
2235 | 2235 | (default: False) |
|
2236 | 2236 | |
|
2237 | 2237 | ``streamunbundle`` |
|
2238 | 2238 | When set, servers will apply data sent from the client directly, |
|
2239 | 2239 | otherwise it will be written to a temporary file first. This option |
|
2240 | 2240 | effectively prevents concurrent pushes. |
|
2241 | 2241 | |
|
2242 | 2242 | ``pullbundle`` |
|
2243 | 2243 | When set, the server will check pullbundle.manifest for bundles |
|
2244 | 2244 | covering the requested heads and common nodes. The first matching |
|
2245 | 2245 | entry will be streamed to the client. |
|
2246 | 2246 | |
|
2247 | 2247 | For HTTP transport, the stream will still use zlib compression |
|
2248 | 2248 | for older clients. |
|
2249 | 2249 | |
|
2250 | 2250 | ``concurrent-push-mode`` |
|
2251 | 2251 | Level of allowed race condition between two pushing clients. |
|
2252 | 2252 | |
|
2253 | 2253 | - 'strict': push is abort if another client touched the repository |
|
2254 | 2254 | while the push was preparing. |
|
2255 | 2255 | - 'check-related': push is only aborted if it affects head that got also |
|
2256 | 2256 | affected while the push was preparing. (default since 5.4) |
|
2257 | 2257 | |
|
2258 | 2258 | 'check-related' only takes effect for compatible clients (version |
|
2259 | 2259 | 4.3 and later). Older clients will use 'strict'. |
|
2260 | 2260 | |
|
2261 | 2261 | ``validate`` |
|
2262 | 2262 | Whether to validate the completeness of pushed changesets by |
|
2263 | 2263 | checking that all new file revisions specified in manifests are |
|
2264 | 2264 | present. (default: False) |
|
2265 | 2265 | |
|
2266 | 2266 | ``maxhttpheaderlen`` |
|
2267 | 2267 | Instruct HTTP clients not to send request headers longer than this |
|
2268 | 2268 | many bytes. (default: 1024) |
|
2269 | 2269 | |
|
2270 | 2270 | ``bundle1`` |
|
2271 | 2271 | Whether to allow clients to push and pull using the legacy bundle1 |
|
2272 | 2272 | exchange format. (default: True) |
|
2273 | 2273 | |
|
2274 | 2274 | ``bundle1gd`` |
|
2275 | 2275 | Like ``bundle1`` but only used if the repository is using the |
|
2276 | 2276 | *generaldelta* storage format. (default: True) |
|
2277 | 2277 | |
|
2278 | 2278 | ``bundle1.push`` |
|
2279 | 2279 | Whether to allow clients to push using the legacy bundle1 exchange |
|
2280 | 2280 | format. (default: True) |
|
2281 | 2281 | |
|
2282 | 2282 | ``bundle1gd.push`` |
|
2283 | 2283 | Like ``bundle1.push`` but only used if the repository is using the |
|
2284 | 2284 | *generaldelta* storage format. (default: True) |
|
2285 | 2285 | |
|
2286 | 2286 | ``bundle1.pull`` |
|
2287 | 2287 | Whether to allow clients to pull using the legacy bundle1 exchange |
|
2288 | 2288 | format. (default: True) |
|
2289 | 2289 | |
|
2290 | 2290 | ``bundle1gd.pull`` |
|
2291 | 2291 | Like ``bundle1.pull`` but only used if the repository is using the |
|
2292 | 2292 | *generaldelta* storage format. (default: True) |
|
2293 | 2293 | |
|
2294 | 2294 | Large repositories using the *generaldelta* storage format should |
|
2295 | 2295 | consider setting this option because converting *generaldelta* |
|
2296 | 2296 | repositories to the exchange format required by the bundle1 data |
|
2297 | 2297 | format can consume a lot of CPU. |
|
2298 | 2298 | |
|
2299 | 2299 | ``bundle2.stream`` |
|
2300 | 2300 | Whether to allow clients to pull using the bundle2 streaming protocol. |
|
2301 | 2301 | (default: True) |
|
2302 | 2302 | |
|
2303 | 2303 | ``zliblevel`` |
|
2304 | 2304 | Integer between ``-1`` and ``9`` that controls the zlib compression level |
|
2305 | 2305 | for wire protocol commands that send zlib compressed output (notably the |
|
2306 | 2306 | commands that send repository history data). |
|
2307 | 2307 | |
|
2308 | 2308 | The default (``-1``) uses the default zlib compression level, which is |
|
2309 | 2309 | likely equivalent to ``6``. ``0`` means no compression. ``9`` means |
|
2310 | 2310 | maximum compression. |
|
2311 | 2311 | |
|
2312 | 2312 | Setting this option allows server operators to make trade-offs between |
|
2313 | 2313 | bandwidth and CPU used. Lowering the compression lowers CPU utilization |
|
2314 | 2314 | but sends more bytes to clients. |
|
2315 | 2315 | |
|
2316 | 2316 | This option only impacts the HTTP server. |
|
2317 | 2317 | |
|
2318 | 2318 | ``zstdlevel`` |
|
2319 | 2319 | Integer between ``1`` and ``22`` that controls the zstd compression level |
|
2320 | 2320 | for wire protocol commands. ``1`` is the minimal amount of compression and |
|
2321 | 2321 | ``22`` is the highest amount of compression. |
|
2322 | 2322 | |
|
2323 | 2323 | The default (``3``) should be significantly faster than zlib while likely |
|
2324 | 2324 | delivering better compression ratios. |
|
2325 | 2325 | |
|
2326 | 2326 | This option only impacts the HTTP server. |
|
2327 | 2327 | |
|
2328 | 2328 | See also ``server.zliblevel``. |
|
2329 | 2329 | |
|
2330 | 2330 | ``view`` |
|
2331 | 2331 | Repository filter used when exchanging revisions with the peer. |
|
2332 | 2332 | |
|
2333 | 2333 | The default view (``served``) excludes secret and hidden changesets. |
|
2334 | 2334 | Another useful value is ``immutable`` (no draft, secret or hidden |
|
2335 | 2335 | changesets). (EXPERIMENTAL) |
|
2336 | 2336 | |
|
2337 | 2337 | ``smtp`` |
|
2338 | 2338 | -------- |
|
2339 | 2339 | |
|
2340 | 2340 | Configuration for extensions that need to send email messages. |
|
2341 | 2341 | |
|
2342 | 2342 | ``host`` |
|
2343 | 2343 | Host name of mail server, e.g. "mail.example.com". |
|
2344 | 2344 | |
|
2345 | 2345 | ``port`` |
|
2346 | 2346 | Optional. Port to connect to on mail server. (default: 465 if |
|
2347 | 2347 | ``tls`` is smtps; 25 otherwise) |
|
2348 | 2348 | |
|
2349 | 2349 | ``tls`` |
|
2350 | 2350 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
2351 | 2351 | smtps or none. (default: none) |
|
2352 | 2352 | |
|
2353 | 2353 | ``username`` |
|
2354 | 2354 | Optional. User name for authenticating with the SMTP server. |
|
2355 | 2355 | (default: None) |
|
2356 | 2356 | |
|
2357 | 2357 | ``password`` |
|
2358 | 2358 | Optional. Password for authenticating with the SMTP server. If not |
|
2359 | 2359 | specified, interactive sessions will prompt the user for a |
|
2360 | 2360 | password; non-interactive sessions will fail. (default: None) |
|
2361 | 2361 | |
|
2362 | 2362 | ``local_hostname`` |
|
2363 | 2363 | Optional. The hostname that the sender can use to identify |
|
2364 | 2364 | itself to the MTA. |
|
2365 | 2365 | |
|
2366 | 2366 | |
|
2367 | 2367 | ``subpaths`` |
|
2368 | 2368 | ------------ |
|
2369 | 2369 | |
|
2370 | 2370 | Subrepository source URLs can go stale if a remote server changes name |
|
2371 | 2371 | or becomes temporarily unavailable. This section lets you define |
|
2372 | 2372 | rewrite rules of the form:: |
|
2373 | 2373 | |
|
2374 | 2374 | <pattern> = <replacement> |
|
2375 | 2375 | |
|
2376 | 2376 | where ``pattern`` is a regular expression matching a subrepository |
|
2377 | 2377 | source URL and ``replacement`` is the replacement string used to |
|
2378 | 2378 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
2379 | 2379 | ``replacements``. For instance:: |
|
2380 | 2380 | |
|
2381 | 2381 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
2382 | 2382 | |
|
2383 | 2383 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
2384 | 2384 | |
|
2385 | 2385 | Relative subrepository paths are first made absolute, and the |
|
2386 | 2386 | rewrite rules are then applied on the full (absolute) path. If ``pattern`` |
|
2387 | 2387 | doesn't match the full path, an attempt is made to apply it on the |
|
2388 | 2388 | relative path alone. The rules are applied in definition order. |
|
2389 | 2389 | |
|
2390 | 2390 | ``subrepos`` |
|
2391 | 2391 | ------------ |
|
2392 | 2392 | |
|
2393 | 2393 | This section contains options that control the behavior of the |
|
2394 | 2394 | subrepositories feature. See also :hg:`help subrepos`. |
|
2395 | 2395 | |
|
2396 | 2396 | Security note: auditing in Mercurial is known to be insufficient to |
|
2397 | 2397 | prevent clone-time code execution with carefully constructed Git |
|
2398 | 2398 | subrepos. It is unknown if a similar detect is present in Subversion |
|
2399 | 2399 | subrepos. Both Git and Subversion subrepos are disabled by default |
|
2400 | 2400 | out of security concerns. These subrepo types can be enabled using |
|
2401 | 2401 | the respective options below. |
|
2402 | 2402 | |
|
2403 | 2403 | ``allowed`` |
|
2404 | 2404 | Whether subrepositories are allowed in the working directory. |
|
2405 | 2405 | |
|
2406 | 2406 | When false, commands involving subrepositories (like :hg:`update`) |
|
2407 | 2407 | will fail for all subrepository types. |
|
2408 | 2408 | (default: true) |
|
2409 | 2409 | |
|
2410 | 2410 | ``hg:allowed`` |
|
2411 | 2411 | Whether Mercurial subrepositories are allowed in the working |
|
2412 | 2412 | directory. This option only has an effect if ``subrepos.allowed`` |
|
2413 | 2413 | is true. |
|
2414 | 2414 | (default: true) |
|
2415 | 2415 | |
|
2416 | 2416 | ``git:allowed`` |
|
2417 | 2417 | Whether Git subrepositories are allowed in the working directory. |
|
2418 | 2418 | This option only has an effect if ``subrepos.allowed`` is true. |
|
2419 | 2419 | |
|
2420 | 2420 | See the security note above before enabling Git subrepos. |
|
2421 | 2421 | (default: false) |
|
2422 | 2422 | |
|
2423 | 2423 | ``svn:allowed`` |
|
2424 | 2424 | Whether Subversion subrepositories are allowed in the working |
|
2425 | 2425 | directory. This option only has an effect if ``subrepos.allowed`` |
|
2426 | 2426 | is true. |
|
2427 | 2427 | |
|
2428 | 2428 | See the security note above before enabling Subversion subrepos. |
|
2429 | 2429 | (default: false) |
|
2430 | 2430 | |
|
2431 | 2431 | ``templatealias`` |
|
2432 | 2432 | ----------------- |
|
2433 | 2433 | |
|
2434 | 2434 | Alias definitions for templates. See :hg:`help templates` for details. |
|
2435 | 2435 | |
|
2436 | 2436 | ``templates`` |
|
2437 | 2437 | ------------- |
|
2438 | 2438 | |
|
2439 | 2439 | Use the ``[templates]`` section to define template strings. |
|
2440 | 2440 | See :hg:`help templates` for details. |
|
2441 | 2441 | |
|
2442 | 2442 | ``trusted`` |
|
2443 | 2443 | ----------- |
|
2444 | 2444 | |
|
2445 | 2445 | Mercurial will not use the settings in the |
|
2446 | 2446 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
2447 | 2447 | user or to a trusted group, as various hgrc features allow arbitrary |
|
2448 | 2448 | commands to be run. This issue is often encountered when configuring |
|
2449 | 2449 | hooks or extensions for shared repositories or servers. However, |
|
2450 | 2450 | the web interface will use some safe settings from the ``[web]`` |
|
2451 | 2451 | section. |
|
2452 | 2452 | |
|
2453 | 2453 | This section specifies what users and groups are trusted. The |
|
2454 | 2454 | current user is always trusted. To trust everybody, list a user or a |
|
2455 | 2455 | group with name ``*``. These settings must be placed in an |
|
2456 | 2456 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
2457 | 2457 | user or service running Mercurial. |
|
2458 | 2458 | |
|
2459 | 2459 | ``users`` |
|
2460 | 2460 | Comma-separated list of trusted users. |
|
2461 | 2461 | |
|
2462 | 2462 | ``groups`` |
|
2463 | 2463 | Comma-separated list of trusted groups. |
|
2464 | 2464 | |
|
2465 | 2465 | |
|
2466 | 2466 | ``ui`` |
|
2467 | 2467 | ------ |
|
2468 | 2468 | |
|
2469 | 2469 | User interface controls. |
|
2470 | 2470 | |
|
2471 | 2471 | ``archivemeta`` |
|
2472 | 2472 | Whether to include the .hg_archival.txt file containing meta data |
|
2473 | 2473 | (hashes for the repository base and for tip) in archives created |
|
2474 | 2474 | by the :hg:`archive` command or downloaded via hgweb. |
|
2475 | 2475 | (default: True) |
|
2476 | 2476 | |
|
2477 | 2477 | ``askusername`` |
|
2478 | 2478 | Whether to prompt for a username when committing. If True, and |
|
2479 | 2479 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
2480 | 2480 | be prompted to enter a username. If no username is entered, the |
|
2481 | 2481 | default ``USER@HOST`` is used instead. |
|
2482 | 2482 | (default: False) |
|
2483 | 2483 | |
|
2484 | 2484 | ``clonebundles`` |
|
2485 | 2485 | Whether the "clone bundles" feature is enabled. |
|
2486 | 2486 | |
|
2487 | 2487 | When enabled, :hg:`clone` may download and apply a server-advertised |
|
2488 | 2488 | bundle file from a URL instead of using the normal exchange mechanism. |
|
2489 | 2489 | |
|
2490 | 2490 | This can likely result in faster and more reliable clones. |
|
2491 | 2491 | |
|
2492 | 2492 | (default: True) |
|
2493 | 2493 | |
|
2494 | 2494 | ``clonebundlefallback`` |
|
2495 | 2495 | Whether failure to apply an advertised "clone bundle" from a server |
|
2496 | 2496 | should result in fallback to a regular clone. |
|
2497 | 2497 | |
|
2498 | 2498 | This is disabled by default because servers advertising "clone |
|
2499 | 2499 | bundles" often do so to reduce server load. If advertised bundles |
|
2500 | 2500 | start mass failing and clients automatically fall back to a regular |
|
2501 | 2501 | clone, this would add significant and unexpected load to the server |
|
2502 | 2502 | since the server is expecting clone operations to be offloaded to |
|
2503 | 2503 | pre-generated bundles. Failing fast (the default behavior) ensures |
|
2504 | 2504 | clients don't overwhelm the server when "clone bundle" application |
|
2505 | 2505 | fails. |
|
2506 | 2506 | |
|
2507 | 2507 | (default: False) |
|
2508 | 2508 | |
|
2509 | 2509 | ``clonebundleprefers`` |
|
2510 | 2510 | Defines preferences for which "clone bundles" to use. |
|
2511 | 2511 | |
|
2512 | 2512 | Servers advertising "clone bundles" may advertise multiple available |
|
2513 | 2513 | bundles. Each bundle may have different attributes, such as the bundle |
|
2514 | 2514 | type and compression format. This option is used to prefer a particular |
|
2515 | 2515 | bundle over another. |
|
2516 | 2516 | |
|
2517 | 2517 | The following keys are defined by Mercurial: |
|
2518 | 2518 | |
|
2519 | 2519 | BUNDLESPEC |
|
2520 | 2520 | A bundle type specifier. These are strings passed to :hg:`bundle -t`. |
|
2521 | 2521 | e.g. ``gzip-v2`` or ``bzip2-v1``. |
|
2522 | 2522 | |
|
2523 | 2523 | COMPRESSION |
|
2524 | 2524 | The compression format of the bundle. e.g. ``gzip`` and ``bzip2``. |
|
2525 | 2525 | |
|
2526 | 2526 | Server operators may define custom keys. |
|
2527 | 2527 | |
|
2528 | 2528 | Example values: ``COMPRESSION=bzip2``, |
|
2529 | 2529 | ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``. |
|
2530 | 2530 | |
|
2531 | 2531 | By default, the first bundle advertised by the server is used. |
|
2532 | 2532 | |
|
2533 | 2533 | ``color`` |
|
2534 | 2534 | When to colorize output. Possible value are Boolean ("yes" or "no"), or |
|
2535 | 2535 | "debug", or "always". (default: "yes"). "yes" will use color whenever it |
|
2536 | 2536 | seems possible. See :hg:`help color` for details. |
|
2537 | 2537 | |
|
2538 | 2538 | ``commitsubrepos`` |
|
2539 | 2539 | Whether to commit modified subrepositories when committing the |
|
2540 | 2540 | parent repository. If False and one subrepository has uncommitted |
|
2541 | 2541 | changes, abort the commit. |
|
2542 | 2542 | (default: False) |
|
2543 | 2543 | |
|
2544 | 2544 | ``debug`` |
|
2545 | 2545 | Print debugging information. (default: False) |
|
2546 | 2546 | |
|
2547 | 2547 | ``editor`` |
|
2548 | 2548 | The editor to use during a commit. (default: ``$EDITOR`` or ``vi``) |
|
2549 | 2549 | |
|
2550 | 2550 | ``fallbackencoding`` |
|
2551 | 2551 | Encoding to try if it's not possible to decode the changelog using |
|
2552 | 2552 | UTF-8. (default: ISO-8859-1) |
|
2553 | 2553 | |
|
2554 | 2554 | ``graphnodetemplate`` |
|
2555 | 2555 | (DEPRECATED) Use ``command-templates.graphnode`` instead. |
|
2556 | 2556 | |
|
2557 | 2557 | ``ignore`` |
|
2558 | 2558 | A file to read per-user ignore patterns from. This file should be |
|
2559 | 2559 | in the same format as a repository-wide .hgignore file. Filenames |
|
2560 | 2560 | are relative to the repository root. This option supports hook syntax, |
|
2561 | 2561 | so if you want to specify multiple ignore files, you can do so by |
|
2562 | 2562 | setting something like ``ignore.other = ~/.hgignore2``. For details |
|
2563 | 2563 | of the ignore file format, see the ``hgignore(5)`` man page. |
|
2564 | 2564 | |
|
2565 | 2565 | ``interactive`` |
|
2566 | 2566 | Allow to prompt the user. (default: True) |
|
2567 | 2567 | |
|
2568 | 2568 | ``interface`` |
|
2569 | 2569 | Select the default interface for interactive features (default: text). |
|
2570 | 2570 | Possible values are 'text' and 'curses'. |
|
2571 | 2571 | |
|
2572 | 2572 | ``interface.chunkselector`` |
|
2573 | 2573 | Select the interface for change recording (e.g. :hg:`commit -i`). |
|
2574 | 2574 | Possible values are 'text' and 'curses'. |
|
2575 | 2575 | This config overrides the interface specified by ui.interface. |
|
2576 | 2576 | |
|
2577 | 2577 | ``large-file-limit`` |
|
2578 | 2578 | Largest file size that gives no memory use warning. |
|
2579 | 2579 | Possible values are integers or 0 to disable the check. |
|
2580 | 2580 | (default: 10000000) |
|
2581 | 2581 | |
|
2582 | 2582 | ``logtemplate`` |
|
2583 | 2583 | (DEPRECATED) Use ``command-templates.log`` instead. |
|
2584 | 2584 | |
|
2585 | 2585 | ``merge`` |
|
2586 | 2586 | The conflict resolution program to use during a manual merge. |
|
2587 | 2587 | For more information on merge tools see :hg:`help merge-tools`. |
|
2588 | 2588 | For configuring merge tools see the ``[merge-tools]`` section. |
|
2589 | 2589 | |
|
2590 | 2590 | ``mergemarkers`` |
|
2591 | 2591 | Sets the merge conflict marker label styling. The ``detailed`` style |
|
2592 | 2592 | uses the ``command-templates.mergemarker`` setting to style the labels. |
|
2593 | 2593 | The ``basic`` style just uses 'local' and 'other' as the marker label. |
|
2594 | 2594 | One of ``basic`` or ``detailed``. |
|
2595 | 2595 | (default: ``basic``) |
|
2596 | 2596 | |
|
2597 | 2597 | ``mergemarkertemplate`` |
|
2598 | 2598 | (DEPRECATED) Use ``command-templates.mergemarker`` instead. |
|
2599 | 2599 | |
|
2600 | 2600 | ``message-output`` |
|
2601 | 2601 | Where to write status and error messages. (default: ``stdio``) |
|
2602 | 2602 | |
|
2603 | 2603 | ``channel`` |
|
2604 | 2604 | Use separate channel for structured output. (Command-server only) |
|
2605 | 2605 | ``stderr`` |
|
2606 | 2606 | Everything to stderr. |
|
2607 | 2607 | ``stdio`` |
|
2608 | 2608 | Status to stdout, and error to stderr. |
|
2609 | 2609 | |
|
2610 | 2610 | ``origbackuppath`` |
|
2611 | 2611 | The path to a directory used to store generated .orig files. If the path is |
|
2612 | 2612 | not a directory, one will be created. If set, files stored in this |
|
2613 | 2613 | directory have the same name as the original file and do not have a .orig |
|
2614 | 2614 | suffix. |
|
2615 | 2615 | |
|
2616 | 2616 | ``paginate`` |
|
2617 | 2617 | Control the pagination of command output (default: True). See :hg:`help pager` |
|
2618 | 2618 | for details. |
|
2619 | 2619 | |
|
2620 | 2620 | ``patch`` |
|
2621 | 2621 | An optional external tool that ``hg import`` and some extensions |
|
2622 | 2622 | will use for applying patches. By default Mercurial uses an |
|
2623 | 2623 | internal patch utility. The external tool must work as the common |
|
2624 | 2624 | Unix ``patch`` program. In particular, it must accept a ``-p`` |
|
2625 | 2625 | argument to strip patch headers, a ``-d`` argument to specify the |
|
2626 | 2626 | current directory, a file name to patch, and a patch file to take |
|
2627 | 2627 | from stdin. |
|
2628 | 2628 | |
|
2629 | 2629 | It is possible to specify a patch tool together with extra |
|
2630 | 2630 | arguments. For example, setting this option to ``patch --merge`` |
|
2631 | 2631 | will use the ``patch`` program with its 2-way merge option. |
|
2632 | 2632 | |
|
2633 | 2633 | ``portablefilenames`` |
|
2634 | 2634 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
2635 | 2635 | (default: ``warn``) |
|
2636 | 2636 | |
|
2637 | 2637 | ``warn`` |
|
2638 | 2638 | Print a warning message on POSIX platforms, if a file with a non-portable |
|
2639 | 2639 | filename is added (e.g. a file with a name that can't be created on |
|
2640 | 2640 | Windows because it contains reserved parts like ``AUX``, reserved |
|
2641 | 2641 | characters like ``:``, or would cause a case collision with an existing |
|
2642 | 2642 | file). |
|
2643 | 2643 | |
|
2644 | 2644 | ``ignore`` |
|
2645 | 2645 | Don't print a warning. |
|
2646 | 2646 | |
|
2647 | 2647 | ``abort`` |
|
2648 | 2648 | The command is aborted. |
|
2649 | 2649 | |
|
2650 | 2650 | ``true`` |
|
2651 | 2651 | Alias for ``warn``. |
|
2652 | 2652 | |
|
2653 | 2653 | ``false`` |
|
2654 | 2654 | Alias for ``ignore``. |
|
2655 | 2655 | |
|
2656 | 2656 | .. container:: windows |
|
2657 | 2657 | |
|
2658 | 2658 | On Windows, this configuration option is ignored and the command aborted. |
|
2659 | 2659 | |
|
2660 | 2660 | ``pre-merge-tool-output-template`` |
|
2661 | 2661 | (DEPRECATED) Use ``command-template.pre-merge-tool-output`` instead. |
|
2662 | 2662 | |
|
2663 | 2663 | ``quiet`` |
|
2664 | 2664 | Reduce the amount of output printed. |
|
2665 | 2665 | (default: False) |
|
2666 | 2666 | |
|
2667 | 2667 | ``relative-paths`` |
|
2668 | 2668 | Prefer relative paths in the UI. |
|
2669 | 2669 | |
|
2670 | 2670 | ``remotecmd`` |
|
2671 | 2671 | Remote command to use for clone/push/pull operations. |
|
2672 | 2672 | (default: ``hg``) |
|
2673 | 2673 | |
|
2674 | 2674 | ``report_untrusted`` |
|
2675 | 2675 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
2676 | 2676 | trusted user or group. |
|
2677 | 2677 | (default: True) |
|
2678 | 2678 | |
|
2679 | 2679 | ``slash`` |
|
2680 | 2680 | (Deprecated. Use ``slashpath`` template filter instead.) |
|
2681 | 2681 | |
|
2682 | 2682 | Display paths using a slash (``/``) as the path separator. This |
|
2683 | 2683 | only makes a difference on systems where the default path |
|
2684 | 2684 | separator is not the slash character (e.g. Windows uses the |
|
2685 | 2685 | backslash character (``\``)). |
|
2686 | 2686 | (default: False) |
|
2687 | 2687 | |
|
2688 | 2688 | ``statuscopies`` |
|
2689 | 2689 | Display copies in the status command. |
|
2690 | 2690 | |
|
2691 | 2691 | ``ssh`` |
|
2692 | 2692 | Command to use for SSH connections. (default: ``ssh``) |
|
2693 | 2693 | |
|
2694 | 2694 | ``ssherrorhint`` |
|
2695 | 2695 | A hint shown to the user in the case of SSH error (e.g. |
|
2696 | 2696 | ``Please see http://company/internalwiki/ssh.html``) |
|
2697 | 2697 | |
|
2698 | 2698 | ``strict`` |
|
2699 | 2699 | Require exact command names, instead of allowing unambiguous |
|
2700 | 2700 | abbreviations. (default: False) |
|
2701 | 2701 | |
|
2702 | 2702 | ``style`` |
|
2703 | 2703 | Name of style to use for command output. |
|
2704 | 2704 | |
|
2705 | 2705 | ``supportcontact`` |
|
2706 | 2706 | A URL where users should report a Mercurial traceback. Use this if you are a |
|
2707 | 2707 | large organisation with its own Mercurial deployment process and crash |
|
2708 | 2708 | reports should be addressed to your internal support. |
|
2709 | 2709 | |
|
2710 | 2710 | ``textwidth`` |
|
2711 | 2711 | Maximum width of help text. A longer line generated by ``hg help`` or |
|
2712 | 2712 | ``hg subcommand --help`` will be broken after white space to get this |
|
2713 | 2713 | width or the terminal width, whichever comes first. |
|
2714 | 2714 | A non-positive value will disable this and the terminal width will be |
|
2715 | 2715 | used. (default: 78) |
|
2716 | 2716 | |
|
2717 | 2717 | ``timeout`` |
|
2718 | 2718 | The timeout used when a lock is held (in seconds), a negative value |
|
2719 | 2719 | means no timeout. (default: 600) |
|
2720 | 2720 | |
|
2721 | 2721 | ``timeout.warn`` |
|
2722 | 2722 | Time (in seconds) before a warning is printed about held lock. A negative |
|
2723 | 2723 | value means no warning. (default: 0) |
|
2724 | 2724 | |
|
2725 | 2725 | ``traceback`` |
|
2726 | 2726 | Mercurial always prints a traceback when an unknown exception |
|
2727 | 2727 | occurs. Setting this to True will make Mercurial print a traceback |
|
2728 | 2728 | on all exceptions, even those recognized by Mercurial (such as |
|
2729 | 2729 | IOError or MemoryError). (default: False) |
|
2730 | 2730 | |
|
2731 | 2731 | ``tweakdefaults`` |
|
2732 | 2732 | |
|
2733 | 2733 | By default Mercurial's behavior changes very little from release |
|
2734 | 2734 | to release, but over time the recommended config settings |
|
2735 | 2735 | shift. Enable this config to opt in to get automatic tweaks to |
|
2736 | 2736 | Mercurial's behavior over time. This config setting will have no |
|
2737 | 2737 | effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does |
|
2738 | 2738 | not include ``tweakdefaults``. (default: False) |
|
2739 | 2739 | |
|
2740 | 2740 | It currently means:: |
|
2741 | 2741 | |
|
2742 | 2742 | .. tweakdefaultsmarker |
|
2743 | 2743 | |
|
2744 | 2744 | ``username`` |
|
2745 | 2745 | The committer of a changeset created when running "commit". |
|
2746 | 2746 | Typically a person's name and email address, e.g. ``Fred Widget |
|
2747 | 2747 | <fred@example.com>``. Environment variables in the |
|
2748 | 2748 | username are expanded. |
|
2749 | 2749 | |
|
2750 | 2750 | (default: ``$EMAIL`` or ``username@hostname``. If the username in |
|
2751 | 2751 | hgrc is empty, e.g. if the system admin set ``username =`` in the |
|
2752 | 2752 | system hgrc, it has to be specified manually or in a different |
|
2753 | 2753 | hgrc file) |
|
2754 | 2754 | |
|
2755 | 2755 | ``verbose`` |
|
2756 | 2756 | Increase the amount of output printed. (default: False) |
|
2757 | 2757 | |
|
2758 | 2758 | |
|
2759 | 2759 | ``command-templates`` |
|
2760 | 2760 | --------------------- |
|
2761 | 2761 | |
|
2762 | 2762 | Templates used for customizing the output of commands. |
|
2763 | 2763 | |
|
2764 | 2764 | ``graphnode`` |
|
2765 | 2765 | The template used to print changeset nodes in an ASCII revision graph. |
|
2766 | 2766 | (default: ``{graphnode}``) |
|
2767 | 2767 | |
|
2768 | 2768 | ``log`` |
|
2769 | 2769 | Template string for commands that print changesets. |
|
2770 | 2770 | |
|
2771 | 2771 | ``mergemarker`` |
|
2772 | 2772 | The template used to print the commit description next to each conflict |
|
2773 | 2773 | marker during merge conflicts. See :hg:`help templates` for the template |
|
2774 | 2774 | format. |
|
2775 | 2775 | |
|
2776 | 2776 | Defaults to showing the hash, tags, branches, bookmarks, author, and |
|
2777 | 2777 | the first line of the commit description. |
|
2778 | 2778 | |
|
2779 | 2779 | If you use non-ASCII characters in names for tags, branches, bookmarks, |
|
2780 | 2780 | authors, and/or commit descriptions, you must pay attention to encodings of |
|
2781 | 2781 | managed files. At template expansion, non-ASCII characters use the encoding |
|
2782 | 2782 | specified by the ``--encoding`` global option, ``HGENCODING`` or other |
|
2783 | 2783 | environment variables that govern your locale. If the encoding of the merge |
|
2784 | 2784 | markers is different from the encoding of the merged files, |
|
2785 | 2785 | serious problems may occur. |
|
2786 | 2786 | |
|
2787 | 2787 | Can be overridden per-merge-tool, see the ``[merge-tools]`` section. |
|
2788 | 2788 | |
|
2789 | 2789 | ``oneline-summary`` |
|
2790 | 2790 | A template used by `hg rebase` and other commands for showing a one-line |
|
2791 | 2791 | summary of a commit. If the template configured here is longer than one |
|
2792 | 2792 | line, then only the first line is used. |
|
2793 | 2793 | |
|
2794 | 2794 | The template can be overridden per command by defining a template in |
|
2795 | 2795 | `oneline-summary.<command>`, where `<command>` can be e.g. "rebase". |
|
2796 | 2796 | |
|
2797 | 2797 | ``pre-merge-tool-output`` |
|
2798 | 2798 | A template that is printed before executing an external merge tool. This can |
|
2799 | 2799 | be used to print out additional context that might be useful to have during |
|
2800 | 2800 | the conflict resolution, such as the description of the various commits |
|
2801 | 2801 | involved or bookmarks/tags. |
|
2802 | 2802 | |
|
2803 | 2803 | Additional information is available in the ``local`, ``base``, and ``other`` |
|
2804 | 2804 | dicts. For example: ``{local.label}``, ``{base.name}``, or |
|
2805 | 2805 | ``{other.islink}``. |
|
2806 | 2806 | |
|
2807 | 2807 | |
|
2808 | 2808 | ``web`` |
|
2809 | 2809 | ------- |
|
2810 | 2810 | |
|
2811 | 2811 | Web interface configuration. The settings in this section apply to |
|
2812 | 2812 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
2813 | 2813 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
2814 | 2814 | and WSGI). |
|
2815 | 2815 | |
|
2816 | 2816 | The Mercurial webserver does no authentication (it does not prompt for |
|
2817 | 2817 | usernames and passwords to validate *who* users are), but it does do |
|
2818 | 2818 | authorization (it grants or denies access for *authenticated users* |
|
2819 | 2819 | based on settings in this section). You must either configure your |
|
2820 | 2820 | webserver to do authentication for you, or disable the authorization |
|
2821 | 2821 | checks. |
|
2822 | 2822 | |
|
2823 | 2823 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
2824 | 2824 | you want it to accept pushes from anybody, you can use the following |
|
2825 | 2825 | command line:: |
|
2826 | 2826 | |
|
2827 | 2827 | $ hg --config web.allow-push=* --config web.push_ssl=False serve |
|
2828 | 2828 | |
|
2829 | 2829 | Note that this will allow anybody to push anything to the server and |
|
2830 | 2830 | that this should not be used for public servers. |
|
2831 | 2831 | |
|
2832 | 2832 | The full set of options is: |
|
2833 | 2833 | |
|
2834 | 2834 | ``accesslog`` |
|
2835 | 2835 | Where to output the access log. (default: stdout) |
|
2836 | 2836 | |
|
2837 | 2837 | ``address`` |
|
2838 | 2838 | Interface address to bind to. (default: all) |
|
2839 | 2839 | |
|
2840 | 2840 | ``allow-archive`` |
|
2841 | 2841 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
2842 | 2842 | (default: empty) |
|
2843 | 2843 | |
|
2844 | 2844 | ``allowbz2`` |
|
2845 | 2845 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
2846 | 2846 | revisions. |
|
2847 | 2847 | (default: False) |
|
2848 | 2848 | |
|
2849 | 2849 | ``allowgz`` |
|
2850 | 2850 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
2851 | 2851 | revisions. |
|
2852 | 2852 | (default: False) |
|
2853 | 2853 | |
|
2854 | 2854 | ``allow-pull`` |
|
2855 | 2855 | Whether to allow pulling from the repository. (default: True) |
|
2856 | 2856 | |
|
2857 | 2857 | ``allow-push`` |
|
2858 | 2858 | Whether to allow pushing to the repository. If empty or not set, |
|
2859 | 2859 | pushing is not allowed. If the special value ``*``, any remote |
|
2860 | 2860 | user can push, including unauthenticated users. Otherwise, the |
|
2861 | 2861 | remote user must have been authenticated, and the authenticated |
|
2862 | 2862 | user name must be present in this list. The contents of the |
|
2863 | 2863 | allow-push list are examined after the deny_push list. |
|
2864 | 2864 | |
|
2865 | 2865 | ``allow_read`` |
|
2866 | 2866 | If the user has not already been denied repository access due to |
|
2867 | 2867 | the contents of deny_read, this list determines whether to grant |
|
2868 | 2868 | repository access to the user. If this list is not empty, and the |
|
2869 | 2869 | user is unauthenticated or not present in the list, then access is |
|
2870 | 2870 | denied for the user. If the list is empty or not set, then access |
|
2871 | 2871 | is permitted to all users by default. Setting allow_read to the |
|
2872 | 2872 | special value ``*`` is equivalent to it not being set (i.e. access |
|
2873 | 2873 | is permitted to all users). The contents of the allow_read list are |
|
2874 | 2874 | examined after the deny_read list. |
|
2875 | 2875 | |
|
2876 | 2876 | ``allowzip`` |
|
2877 | 2877 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
2878 | 2878 | revisions. This feature creates temporary files. |
|
2879 | 2879 | (default: False) |
|
2880 | 2880 | |
|
2881 | 2881 | ``archivesubrepos`` |
|
2882 | 2882 | Whether to recurse into subrepositories when archiving. |
|
2883 | 2883 | (default: False) |
|
2884 | 2884 | |
|
2885 | 2885 | ``baseurl`` |
|
2886 | 2886 | Base URL to use when publishing URLs in other locations, so |
|
2887 | 2887 | third-party tools like email notification hooks can construct |
|
2888 | 2888 | URLs. Example: ``http://hgserver/repos/``. |
|
2889 | 2889 | |
|
2890 | 2890 | ``cacerts`` |
|
2891 | 2891 | Path to file containing a list of PEM encoded certificate |
|
2892 | 2892 | authority certificates. Environment variables and ``~user`` |
|
2893 | 2893 | constructs are expanded in the filename. If specified on the |
|
2894 | 2894 | client, then it will verify the identity of remote HTTPS servers |
|
2895 | 2895 | with these certificates. |
|
2896 | 2896 | |
|
2897 | 2897 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
2898 | 2898 | command line. |
|
2899 | 2899 | |
|
2900 | 2900 | You can use OpenSSL's CA certificate file if your platform has |
|
2901 | 2901 | one. On most Linux systems this will be |
|
2902 | 2902 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
2903 | 2903 | generate this file manually. The form must be as follows:: |
|
2904 | 2904 | |
|
2905 | 2905 | -----BEGIN CERTIFICATE----- |
|
2906 | 2906 | ... (certificate in base64 PEM encoding) ... |
|
2907 | 2907 | -----END CERTIFICATE----- |
|
2908 | 2908 | -----BEGIN CERTIFICATE----- |
|
2909 | 2909 | ... (certificate in base64 PEM encoding) ... |
|
2910 | 2910 | -----END CERTIFICATE----- |
|
2911 | 2911 | |
|
2912 | 2912 | ``cache`` |
|
2913 | 2913 | Whether to support caching in hgweb. (default: True) |
|
2914 | 2914 | |
|
2915 | 2915 | ``certificate`` |
|
2916 | 2916 | Certificate to use when running :hg:`serve`. |
|
2917 | 2917 | |
|
2918 | 2918 | ``collapse`` |
|
2919 | 2919 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
2920 | 2920 | a single level alongside repositories in the current path. With |
|
2921 | 2921 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
2922 | 2922 | the current path are grouped behind navigable directory entries that |
|
2923 | 2923 | lead to the locations of these repositories. In effect, this setting |
|
2924 | 2924 | collapses each collection of repositories found within a subdirectory |
|
2925 | 2925 | into a single entry for that subdirectory. (default: False) |
|
2926 | 2926 | |
|
2927 | 2927 | ``comparisoncontext`` |
|
2928 | 2928 | Number of lines of context to show in side-by-side file comparison. If |
|
2929 | 2929 | negative or the value ``full``, whole files are shown. (default: 5) |
|
2930 | 2930 | |
|
2931 | 2931 | This setting can be overridden by a ``context`` request parameter to the |
|
2932 | 2932 | ``comparison`` command, taking the same values. |
|
2933 | 2933 | |
|
2934 | 2934 | ``contact`` |
|
2935 | 2935 | Name or email address of the person in charge of the repository. |
|
2936 | 2936 | (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty) |
|
2937 | 2937 | |
|
2938 | 2938 | ``csp`` |
|
2939 | 2939 | Send a ``Content-Security-Policy`` HTTP header with this value. |
|
2940 | 2940 | |
|
2941 | 2941 | The value may contain a special string ``%nonce%``, which will be replaced |
|
2942 | 2942 | by a randomly-generated one-time use value. If the value contains |
|
2943 | 2943 | ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the |
|
2944 | 2944 | one-time property of the nonce. This nonce will also be inserted into |
|
2945 | 2945 | ``<script>`` elements containing inline JavaScript. |
|
2946 | 2946 | |
|
2947 | 2947 | Note: lots of HTML content sent by the server is derived from repository |
|
2948 | 2948 | data. Please consider the potential for malicious repository data to |
|
2949 | 2949 | "inject" itself into generated HTML content as part of your security |
|
2950 | 2950 | threat model. |
|
2951 | 2951 | |
|
2952 | 2952 | ``deny_push`` |
|
2953 | 2953 | Whether to deny pushing to the repository. If empty or not set, |
|
2954 | 2954 | push is not denied. If the special value ``*``, all remote users are |
|
2955 | 2955 | denied push. Otherwise, unauthenticated users are all denied, and |
|
2956 | 2956 | any authenticated user name present in this list is also denied. The |
|
2957 | 2957 | contents of the deny_push list are examined before the allow-push list. |
|
2958 | 2958 | |
|
2959 | 2959 | ``deny_read`` |
|
2960 | 2960 | Whether to deny reading/viewing of the repository. If this list is |
|
2961 | 2961 | not empty, unauthenticated users are all denied, and any |
|
2962 | 2962 | authenticated user name present in this list is also denied access to |
|
2963 | 2963 | the repository. If set to the special value ``*``, all remote users |
|
2964 | 2964 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
2965 | 2965 | the determination of repository access depends on the presence and |
|
2966 | 2966 | content of the allow_read list (see description). If both |
|
2967 | 2967 | deny_read and allow_read are empty or not set, then access is |
|
2968 | 2968 | permitted to all users by default. If the repository is being |
|
2969 | 2969 | served via hgwebdir, denied users will not be able to see it in |
|
2970 | 2970 | the list of repositories. The contents of the deny_read list have |
|
2971 | 2971 | priority over (are examined before) the contents of the allow_read |
|
2972 | 2972 | list. |
|
2973 | 2973 | |
|
2974 | 2974 | ``descend`` |
|
2975 | 2975 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
2976 | 2976 | directly in the current path will be shown (other repositories are still |
|
2977 | 2977 | available from the index corresponding to their containing path). |
|
2978 | 2978 | |
|
2979 | 2979 | ``description`` |
|
2980 | 2980 | Textual description of the repository's purpose or contents. |
|
2981 | 2981 | (default: "unknown") |
|
2982 | 2982 | |
|
2983 | 2983 | ``encoding`` |
|
2984 | 2984 | Character encoding name. (default: the current locale charset) |
|
2985 | 2985 | Example: "UTF-8". |
|
2986 | 2986 | |
|
2987 | 2987 | ``errorlog`` |
|
2988 | 2988 | Where to output the error log. (default: stderr) |
|
2989 | 2989 | |
|
2990 | 2990 | ``guessmime`` |
|
2991 | 2991 | Control MIME types for raw download of file content. |
|
2992 | 2992 | Set to True to let hgweb guess the content type from the file |
|
2993 | 2993 | extension. This will serve HTML files as ``text/html`` and might |
|
2994 | 2994 | allow cross-site scripting attacks when serving untrusted |
|
2995 | 2995 | repositories. (default: False) |
|
2996 | 2996 | |
|
2997 | 2997 | ``hidden`` |
|
2998 | 2998 | Whether to hide the repository in the hgwebdir index. |
|
2999 | 2999 | (default: False) |
|
3000 | 3000 | |
|
3001 | 3001 | ``ipv6`` |
|
3002 | 3002 | Whether to use IPv6. (default: False) |
|
3003 | 3003 | |
|
3004 | 3004 | ``labels`` |
|
3005 | 3005 | List of string *labels* associated with the repository. |
|
3006 | 3006 | |
|
3007 | 3007 | Labels are exposed as a template keyword and can be used to customize |
|
3008 | 3008 | output. e.g. the ``index`` template can group or filter repositories |
|
3009 | 3009 | by labels and the ``summary`` template can display additional content |
|
3010 | 3010 | if a specific label is present. |
|
3011 | 3011 | |
|
3012 | 3012 | ``logoimg`` |
|
3013 | 3013 | File name of the logo image that some templates display on each page. |
|
3014 | 3014 | The file name is relative to ``staticurl``. That is, the full path to |
|
3015 | 3015 | the logo image is "staticurl/logoimg". |
|
3016 | 3016 | If unset, ``hglogo.png`` will be used. |
|
3017 | 3017 | |
|
3018 | 3018 | ``logourl`` |
|
3019 | 3019 | Base URL to use for logos. If unset, ``https://mercurial-scm.org/`` |
|
3020 | 3020 | will be used. |
|
3021 | 3021 | |
|
3022 | 3022 | ``maxchanges`` |
|
3023 | 3023 | Maximum number of changes to list on the changelog. (default: 10) |
|
3024 | 3024 | |
|
3025 | 3025 | ``maxfiles`` |
|
3026 | 3026 | Maximum number of files to list per changeset. (default: 10) |
|
3027 | 3027 | |
|
3028 | 3028 | ``maxshortchanges`` |
|
3029 | 3029 | Maximum number of changes to list on the shortlog, graph or filelog |
|
3030 | 3030 | pages. (default: 60) |
|
3031 | 3031 | |
|
3032 | 3032 | ``name`` |
|
3033 | 3033 | Repository name to use in the web interface. |
|
3034 | 3034 | (default: current working directory) |
|
3035 | 3035 | |
|
3036 | 3036 | ``port`` |
|
3037 | 3037 | Port to listen on. (default: 8000) |
|
3038 | 3038 | |
|
3039 | 3039 | ``prefix`` |
|
3040 | 3040 | Prefix path to serve from. (default: '' (server root)) |
|
3041 | 3041 | |
|
3042 | 3042 | ``push_ssl`` |
|
3043 | 3043 | Whether to require that inbound pushes be transported over SSL to |
|
3044 | 3044 | prevent password sniffing. (default: True) |
|
3045 | 3045 | |
|
3046 | 3046 | ``refreshinterval`` |
|
3047 | 3047 | How frequently directory listings re-scan the filesystem for new |
|
3048 | 3048 | repositories, in seconds. This is relevant when wildcards are used |
|
3049 | 3049 | to define paths. Depending on how much filesystem traversal is |
|
3050 | 3050 | required, refreshing may negatively impact performance. |
|
3051 | 3051 | |
|
3052 | 3052 | Values less than or equal to 0 always refresh. |
|
3053 | 3053 | (default: 20) |
|
3054 | 3054 | |
|
3055 | 3055 | ``server-header`` |
|
3056 | 3056 | Value for HTTP ``Server`` response header. |
|
3057 | 3057 | |
|
3058 | 3058 | ``static`` |
|
3059 | 3059 | Directory where static files are served from. |
|
3060 | 3060 | |
|
3061 | 3061 | ``staticurl`` |
|
3062 | 3062 | Base URL to use for static files. If unset, static files (e.g. the |
|
3063 | 3063 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
3064 | 3064 | this setting to serve them directly with the HTTP server. |
|
3065 | 3065 | Example: ``http://hgserver/static/``. |
|
3066 | 3066 | |
|
3067 | 3067 | ``stripes`` |
|
3068 | 3068 | How many lines a "zebra stripe" should span in multi-line output. |
|
3069 | 3069 | Set to 0 to disable. (default: 1) |
|
3070 | 3070 | |
|
3071 | 3071 | ``style`` |
|
3072 | 3072 | Which template map style to use. The available options are the names of |
|
3073 | 3073 | subdirectories in the HTML templates path. (default: ``paper``) |
|
3074 | 3074 | Example: ``monoblue``. |
|
3075 | 3075 | |
|
3076 | 3076 | ``templates`` |
|
3077 | 3077 | Where to find the HTML templates. The default path to the HTML templates |
|
3078 | 3078 | can be obtained from ``hg debuginstall``. |
|
3079 | 3079 | |
|
3080 | 3080 | ``websub`` |
|
3081 | 3081 | ---------- |
|
3082 | 3082 | |
|
3083 | 3083 | Web substitution filter definition. You can use this section to |
|
3084 | 3084 | define a set of regular expression substitution patterns which |
|
3085 | 3085 | let you automatically modify the hgweb server output. |
|
3086 | 3086 | |
|
3087 | 3087 | The default hgweb templates only apply these substitution patterns |
|
3088 | 3088 | on the revision description fields. You can apply them anywhere |
|
3089 | 3089 | you want when you create your own templates by adding calls to the |
|
3090 | 3090 | "websub" filter (usually after calling the "escape" filter). |
|
3091 | 3091 | |
|
3092 | 3092 | This can be used, for example, to convert issue references to links |
|
3093 | 3093 | to your issue tracker, or to convert "markdown-like" syntax into |
|
3094 | 3094 | HTML (see the examples below). |
|
3095 | 3095 | |
|
3096 | 3096 | Each entry in this section names a substitution filter. |
|
3097 | 3097 | The value of each entry defines the substitution expression itself. |
|
3098 | 3098 | The websub expressions follow the old interhg extension syntax, |
|
3099 | 3099 | which in turn imitates the Unix sed replacement syntax:: |
|
3100 | 3100 | |
|
3101 | 3101 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] |
|
3102 | 3102 | |
|
3103 | 3103 | You can use any separator other than "/". The final "i" is optional |
|
3104 | 3104 | and indicates that the search must be case insensitive. |
|
3105 | 3105 | |
|
3106 | 3106 | Examples:: |
|
3107 | 3107 | |
|
3108 | 3108 | [websub] |
|
3109 | 3109 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i |
|
3110 | 3110 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ |
|
3111 | 3111 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ |
|
3112 | 3112 | |
|
3113 | 3113 | ``worker`` |
|
3114 | 3114 | ---------- |
|
3115 | 3115 | |
|
3116 | 3116 | Parallel master/worker configuration. We currently perform working |
|
3117 | 3117 | directory updates in parallel on Unix-like systems, which greatly |
|
3118 | 3118 | helps performance. |
|
3119 | 3119 | |
|
3120 | 3120 | ``enabled`` |
|
3121 | 3121 | Whether to enable workers code to be used. |
|
3122 | 3122 | (default: true) |
|
3123 | 3123 | |
|
3124 | 3124 | ``numcpus`` |
|
3125 | 3125 | Number of CPUs to use for parallel operations. A zero or |
|
3126 | 3126 | negative value is treated as ``use the default``. |
|
3127 | 3127 | (default: 4 or the number of CPUs on the system, whichever is larger) |
|
3128 | 3128 | |
|
3129 | 3129 | ``backgroundclose`` |
|
3130 | 3130 | Whether to enable closing file handles on background threads during certain |
|
3131 | 3131 | operations. Some platforms aren't very efficient at closing file |
|
3132 | 3132 | handles that have been written or appended to. By performing file closing |
|
3133 | 3133 | on background threads, file write rate can increase substantially. |
|
3134 | 3134 | (default: true on Windows, false elsewhere) |
|
3135 | 3135 | |
|
3136 | 3136 | ``backgroundcloseminfilecount`` |
|
3137 | 3137 | Minimum number of files required to trigger background file closing. |
|
3138 | 3138 | Operations not writing this many files won't start background close |
|
3139 | 3139 | threads. |
|
3140 | 3140 | (default: 2048) |
|
3141 | 3141 | |
|
3142 | 3142 | ``backgroundclosemaxqueue`` |
|
3143 | 3143 | The maximum number of opened file handles waiting to be closed in the |
|
3144 | 3144 | background. This option only has an effect if ``backgroundclose`` is |
|
3145 | 3145 | enabled. |
|
3146 | 3146 | (default: 384) |
|
3147 | 3147 | |
|
3148 | 3148 | ``backgroundclosethreadcount`` |
|
3149 | 3149 | Number of threads to process background file closes. Only relevant if |
|
3150 | 3150 | ``backgroundclose`` is enabled. |
|
3151 | 3151 | (default: 4) |
@@ -1,616 +1,616 b'' | |||
|
1 | 1 | The *dirstate* is what Mercurial uses internally to track |
|
2 | 2 | the state of files in the working directory, |
|
3 | 3 | such as set by commands like `hg add` and `hg rm`. |
|
4 | 4 | It also contains some cached data that help make `hg status` faster. |
|
5 | 5 | The name refers both to `.hg/dirstate` on the filesystem |
|
6 | 6 | and the corresponding data structure in memory while a Mercurial process |
|
7 | 7 | is running. |
|
8 | 8 | |
|
9 | 9 | The original file format, retroactively dubbed `dirstate-v1`, |
|
10 | 10 | is described at https://www.mercurial-scm.org/wiki/DirState. |
|
11 | 11 | It is made of a flat sequence of unordered variable-size entries, |
|
12 | 12 | so accessing any information in it requires parsing all of it. |
|
13 | 13 | Similarly, saving changes requires rewriting the entire file. |
|
14 | 14 | |
|
15 | 15 | The newer `dirstate-v2` file format is designed to fix these limitations |
|
16 | 16 | and make `hg status` faster. |
|
17 | 17 | |
|
18 | 18 | User guide |
|
19 | 19 | ========== |
|
20 | 20 | |
|
21 | 21 | Compatibility |
|
22 | 22 | ------------- |
|
23 | 23 | |
|
24 | 24 | The file format is experimental and may still change. |
|
25 | 25 | Different versions of Mercurial may not be compatible with each other |
|
26 | 26 | when working on a local repository that uses this format. |
|
27 | 27 | When using an incompatible version with the experimental format, |
|
28 | 28 | anything can happen including data corruption. |
|
29 | 29 | |
|
30 | 30 | Since the dirstate is entirely local and not relevant to the wire protocol, |
|
31 | 31 | `dirstate-v2` does not affect compatibility with remote Mercurial versions. |
|
32 | 32 | |
|
33 | 33 | When `share-safe` is enabled, different repositories sharing the same store |
|
34 | 34 | can use different dirstate formats. |
|
35 | 35 | |
|
36 | 36 | Enabling `dirstate-v2` for new local repositories |
|
37 | 37 | ------------------------------------------------ |
|
38 | 38 | |
|
39 | 39 | When creating a new local repository such as with `hg init` or `hg clone`, |
|
40 |
the `e |
|
|
40 | the `use-dirstate-v2` boolean in the `format` configuration section | |
|
41 | 41 | controls whether to use this file format. |
|
42 | 42 | This is disabled by default as of this writing. |
|
43 | 43 | To enable it for a single repository, run for example:: |
|
44 | 44 | |
|
45 |
$ hg init my-project --config format.e |
|
|
45 | $ hg init my-project --config format.use-dirstate-v2=1 | |
|
46 | 46 | |
|
47 | 47 | Checking the format of an existing local repository |
|
48 | 48 | -------------------------------------------------- |
|
49 | 49 | |
|
50 | 50 | The `debugformat` commands prints information about |
|
51 | 51 | which of multiple optional formats are used in the current repository, |
|
52 | 52 | including `dirstate-v2`:: |
|
53 | 53 | |
|
54 | 54 | $ hg debugformat |
|
55 | 55 | format-variant repo |
|
56 | 56 | fncache: yes |
|
57 | 57 | dirstate-v2: yes |
|
58 | 58 | […] |
|
59 | 59 | |
|
60 | 60 | Upgrading or downgrading an existing local repository |
|
61 | 61 | ----------------------------------------------------- |
|
62 | 62 | |
|
63 | 63 | The `debugupgrade` command does various upgrades or downgrades |
|
64 | 64 | on a local repository |
|
65 | 65 | based on the current Mercurial version and on configuration. |
|
66 |
The same `format.e |
|
|
66 | The same `format.use-dirstate-v2` configuration is used again. | |
|
67 | 67 | |
|
68 | 68 | Example to upgrade:: |
|
69 | 69 | |
|
70 |
$ hg debugupgrade --config format.e |
|
|
70 | $ hg debugupgrade --config format.use-dirstate-v2=1 | |
|
71 | 71 | |
|
72 | 72 | Example to downgrade to `dirstate-v1`:: |
|
73 | 73 | |
|
74 |
$ hg debugupgrade --config format.e |
|
|
74 | $ hg debugupgrade --config format.use-dirstate-v2=0 | |
|
75 | 75 | |
|
76 | 76 | Both of this commands do nothing but print a list of proposed changes, |
|
77 | 77 | which may include changes unrelated to the dirstate. |
|
78 | 78 | Those other changes are controlled by their own configuration keys. |
|
79 | 79 | Add `--run` to a command to actually apply the proposed changes. |
|
80 | 80 | |
|
81 | 81 | Backups of `.hg/requires` and `.hg/dirstate` are created |
|
82 | 82 | in a `.hg/upgradebackup.*` directory. |
|
83 | 83 | If something goes wrong, restoring those files should undo the change. |
|
84 | 84 | |
|
85 | 85 | Note that upgrading affects compatibility with older versions of Mercurial |
|
86 | 86 | as noted above. |
|
87 | 87 | This can be relevant when a repository’s files are on a USB drive |
|
88 | 88 | or some other removable media, or shared over the network, etc. |
|
89 | 89 | |
|
90 | 90 | Internal filesystem representation |
|
91 | 91 | ================================== |
|
92 | 92 | |
|
93 | 93 | Requirements file |
|
94 | 94 | ----------------- |
|
95 | 95 | |
|
96 | 96 | The `.hg/requires` file indicates which of various optional file formats |
|
97 | 97 | are used by a given repository. |
|
98 | 98 | Mercurial aborts when seeing a requirement it does not know about, |
|
99 | 99 | which avoids older version accidentally messing up a repository |
|
100 | 100 | that uses a format that was introduced later. |
|
101 | 101 | For versions that do support a format, the presence or absence of |
|
102 | 102 | the corresponding requirement indicates whether to use that format. |
|
103 | 103 | |
|
104 | 104 | When the file contains a `dirstate-v2` line, |
|
105 | 105 | the `dirstate-v2` format is used. |
|
106 | 106 | With no such line `dirstate-v1` is used. |
|
107 | 107 | |
|
108 | 108 | High level description |
|
109 | 109 | ---------------------- |
|
110 | 110 | |
|
111 | 111 | Whereas `dirstate-v1` uses a single `.hg/dirstate` file, |
|
112 | 112 | in `dirstate-v2` that file is a "docket" file |
|
113 | 113 | that only contains some metadata |
|
114 | 114 | and points to separate data file named `.hg/dirstate.{ID}`, |
|
115 | 115 | where `{ID}` is a random identifier. |
|
116 | 116 | |
|
117 | 117 | This separation allows making data files append-only |
|
118 | 118 | and therefore safer to memory-map. |
|
119 | 119 | Creating a new data file (occasionally to clean up unused data) |
|
120 | 120 | can be done with a different ID |
|
121 | 121 | without disrupting another Mercurial process |
|
122 | 122 | that could still be using the previous data file. |
|
123 | 123 | |
|
124 | 124 | Both files have a format designed to reduce the need for parsing, |
|
125 | 125 | by using fixed-size binary components as much as possible. |
|
126 | 126 | For data that is not fixed-size, |
|
127 | 127 | references to other parts of a file can be made by storing "pseudo-pointers": |
|
128 | 128 | integers counted in bytes from the start of a file. |
|
129 | 129 | For read-only access no data structure is needed, |
|
130 | 130 | only a bytes buffer (possibly memory-mapped directly from the filesystem) |
|
131 | 131 | with specific parts read on demand. |
|
132 | 132 | |
|
133 | 133 | The data file contains "nodes" organized in a tree. |
|
134 | 134 | Each node represents a file or directory inside the working directory |
|
135 | 135 | or its parent changeset. |
|
136 | 136 | This tree has the same structure as the filesystem, |
|
137 | 137 | so a node representing a directory has child nodes representing |
|
138 | 138 | the files and subdirectories contained directly in that directory. |
|
139 | 139 | |
|
140 | 140 | The docket file format |
|
141 | 141 | ---------------------- |
|
142 | 142 | |
|
143 | 143 | This is implemented in `rust/hg-core/src/dirstate_tree/on_disk.rs` |
|
144 | 144 | and `mercurial/dirstateutils/docket.py`. |
|
145 | 145 | |
|
146 | 146 | Components of the docket file are found at fixed offsets, |
|
147 | 147 | counted in bytes from the start of the file: |
|
148 | 148 | |
|
149 | 149 | * Offset 0: |
|
150 | 150 | The 12-bytes marker string "dirstate-v2\n" ending with a newline character. |
|
151 | 151 | This makes it easier to tell a dirstate-v2 file from a dirstate-v1 file, |
|
152 | 152 | although it is not strictly necessary |
|
153 | 153 | since `.hg/requires` determines which format to use. |
|
154 | 154 | |
|
155 | 155 | * Offset 12: |
|
156 | 156 | The changeset node ID on the first parent of the working directory, |
|
157 | 157 | as up to 32 binary bytes. |
|
158 | 158 | If a node ID is shorter (20 bytes for SHA-1), |
|
159 | 159 | it is start-aligned and the rest of the bytes are set to zero. |
|
160 | 160 | |
|
161 | 161 | * Offset 44: |
|
162 | 162 | The changeset node ID on the second parent of the working directory, |
|
163 | 163 | or all zeros if there isn’t one. |
|
164 | 164 | Also 32 binary bytes. |
|
165 | 165 | |
|
166 | 166 | * Offset 76: |
|
167 | 167 | Tree metadata on 44 bytes, described below. |
|
168 | 168 | Its separation in this documentation from the rest of the docket |
|
169 | 169 | reflects a detail of the current implementation. |
|
170 | 170 | Since tree metadata is also made of fields at fixed offsets, those could |
|
171 | 171 | be inlined here by adding 76 bytes to each offset. |
|
172 | 172 | |
|
173 | 173 | * Offset 120: |
|
174 | 174 | The used size of the data file, as a 32-bit big-endian integer. |
|
175 | 175 | The actual size of the data file may be larger |
|
176 | 176 | (if another Mercurial process is appending to it |
|
177 | 177 | but has not updated the docket yet). |
|
178 | 178 | That extra data must be ignored. |
|
179 | 179 | |
|
180 | 180 | * Offset 124: |
|
181 | 181 | The length of the data file identifier, as a 8-bit integer. |
|
182 | 182 | |
|
183 | 183 | * Offset 125: |
|
184 | 184 | The data file identifier. |
|
185 | 185 | |
|
186 | 186 | * Any additional data is current ignored, and dropped when updating the file. |
|
187 | 187 | |
|
188 | 188 | Tree metadata in the docket file |
|
189 | 189 | -------------------------------- |
|
190 | 190 | |
|
191 | 191 | Tree metadata is similarly made of components at fixed offsets. |
|
192 | 192 | These offsets are counted in bytes from the start of tree metadata, |
|
193 | 193 | which is 76 bytes after the start of the docket file. |
|
194 | 194 | |
|
195 | 195 | This metadata can be thought of as the singular root of the tree |
|
196 | 196 | formed by nodes in the data file. |
|
197 | 197 | |
|
198 | 198 | * Offset 0: |
|
199 | 199 | Pseudo-pointer to the start of root nodes, |
|
200 | 200 | counted in bytes from the start of the data file, |
|
201 | 201 | as a 32-bit big-endian integer. |
|
202 | 202 | These nodes describe files and directories found directly |
|
203 | 203 | at the root of the working directory. |
|
204 | 204 | |
|
205 | 205 | * Offset 4: |
|
206 | 206 | Number of root nodes, as a 32-bit big-endian integer. |
|
207 | 207 | |
|
208 | 208 | * Offset 8: |
|
209 | 209 | Total number of nodes in the entire tree that "have a dirstate entry", |
|
210 | 210 | as a 32-bit big-endian integer. |
|
211 | 211 | Those nodes represent files that would be present at all in `dirstate-v1`. |
|
212 | 212 | This is typically less than the total number of nodes. |
|
213 | 213 | This counter is used to implement `len(dirstatemap)`. |
|
214 | 214 | |
|
215 | 215 | * Offset 12: |
|
216 | 216 | Number of nodes in the entire tree that have a copy source, |
|
217 | 217 | as a 32-bit big-endian integer. |
|
218 | 218 | At the next commit, these files are recorded |
|
219 | 219 | as having been copied or moved/renamed from that source. |
|
220 | 220 | (A move is recorded as a copy and separate removal of the source.) |
|
221 | 221 | This counter is used to implement `len(dirstatemap.copymap)`. |
|
222 | 222 | |
|
223 | 223 | * Offset 16: |
|
224 | 224 | An estimation of how many bytes of the data file |
|
225 | 225 | (within its used size) are unused, as a 32-bit big-endian integer. |
|
226 | 226 | When appending to an existing data file, |
|
227 | 227 | some existing nodes or paths can be unreachable from the new root |
|
228 | 228 | but they still take up space. |
|
229 | 229 | This counter is used to decide when to write a new data file from scratch |
|
230 | 230 | instead of appending to an existing one, |
|
231 | 231 | in order to get rid of that unreachable data |
|
232 | 232 | and avoid unbounded file size growth. |
|
233 | 233 | |
|
234 | 234 | * Offset 20: |
|
235 | 235 | These four bytes are currently ignored |
|
236 | 236 | and reset to zero when updating a docket file. |
|
237 | 237 | This is an attempt at forward compatibility: |
|
238 | 238 | future Mercurial versions could use this as a bit field |
|
239 | 239 | to indicate that a dirstate has additional data or constraints. |
|
240 | 240 | Finding a dirstate file with the relevant bit unset indicates that |
|
241 | 241 | it was written by a then-older version |
|
242 | 242 | which is not aware of that future change. |
|
243 | 243 | |
|
244 | 244 | * Offset 24: |
|
245 | 245 | Either 20 zero bytes, or a SHA-1 hash as 20 binary bytes. |
|
246 | 246 | When present, the hash is of ignore patterns |
|
247 | 247 | that were used for some previous run of the `status` algorithm. |
|
248 | 248 | |
|
249 | 249 | * (Offset 44: end of tree metadata) |
|
250 | 250 | |
|
251 | 251 | Optional hash of ignore patterns |
|
252 | 252 | -------------------------------- |
|
253 | 253 | |
|
254 | 254 | The implementation of `status` at `rust/hg-core/src/dirstate_tree/status.rs` |
|
255 | 255 | has been optimized such that its run time is dominated by calls |
|
256 | 256 | to `stat` for reading the filesystem metadata of a file or directory, |
|
257 | 257 | and to `readdir` for listing the contents of a directory. |
|
258 | 258 | In some cases the algorithm can skip calls to `readdir` |
|
259 | 259 | (saving significant time) |
|
260 | 260 | because the dirstate already contains enough of the relevant information |
|
261 | 261 | to build the correct `status` results. |
|
262 | 262 | |
|
263 | 263 | The default configuration of `hg status` is to list unknown files |
|
264 | 264 | but not ignored files. |
|
265 | 265 | In this case, it matters for the `readdir`-skipping optimization |
|
266 | 266 | if a given file used to be ignored but became unknown |
|
267 | 267 | because `.hgignore` changed. |
|
268 | 268 | To detect the possibility of such a change, |
|
269 | 269 | the tree metadata contains an optional hash of all ignore patterns. |
|
270 | 270 | |
|
271 | 271 | We define: |
|
272 | 272 | |
|
273 | 273 | * "Root" ignore files as: |
|
274 | 274 | |
|
275 | 275 | - `.hgignore` at the root of the repository if it exists |
|
276 | 276 | - And all files from `ui.ignore.*` config. |
|
277 | 277 | |
|
278 | 278 | This set of files is sorted by the string representation of their path. |
|
279 | 279 | |
|
280 | 280 | * The "expanded contents" of an ignore files is the byte string made |
|
281 | 281 | by the concatenation of its contents followed by the "expanded contents" |
|
282 | 282 | of other files included with `include:` or `subinclude:` directives, |
|
283 | 283 | in inclusion order. This definition is recursive, as included files can |
|
284 | 284 | themselves include more files. |
|
285 | 285 | |
|
286 | 286 | This hash is defined as the SHA-1 of the concatenation (in sorted |
|
287 | 287 | order) of the "expanded contents" of each "root" ignore file. |
|
288 | 288 | (Note that computing this does not require actually concatenating |
|
289 | 289 | into a single contiguous byte sequence. |
|
290 | 290 | Instead a SHA-1 hasher object can be created |
|
291 | 291 | and fed separate chunks one by one.) |
|
292 | 292 | |
|
293 | 293 | The data file format |
|
294 | 294 | -------------------- |
|
295 | 295 | |
|
296 | 296 | This is implemented in `rust/hg-core/src/dirstate_tree/on_disk.rs` |
|
297 | 297 | and `mercurial/dirstateutils/v2.py`. |
|
298 | 298 | |
|
299 | 299 | The data file contains two types of data: paths and nodes. |
|
300 | 300 | |
|
301 | 301 | Paths and nodes can be organized in any order in the file, except that sibling |
|
302 | 302 | nodes must be next to each other and sorted by their path. |
|
303 | 303 | Contiguity lets the parent refer to them all |
|
304 | 304 | by their count and a single pseudo-pointer, |
|
305 | 305 | instead of storing one pseudo-pointer per child node. |
|
306 | 306 | Sorting allows using binary search to find a child node with a given name |
|
307 | 307 | in `O(log(n))` byte sequence comparisons. |
|
308 | 308 | |
|
309 | 309 | The current implementation writes paths and child node before a given node |
|
310 | 310 | for ease of figuring out the value of pseudo-pointers by the time the are to be |
|
311 | 311 | written, but this is not an obligation and readers must not rely on it. |
|
312 | 312 | |
|
313 | 313 | A path is stored as a byte string anywhere in the file, without delimiter. |
|
314 | 314 | It is referred to by one or more node by a pseudo-pointer to its start, and its |
|
315 | 315 | length in bytes. Since there is no delimiter, |
|
316 | 316 | when a path is a substring of another the same bytes could be reused, |
|
317 | 317 | although the implementation does not exploit this as of this writing. |
|
318 | 318 | |
|
319 | 319 | A node is stored on 43 bytes with components at fixed offsets. Paths and |
|
320 | 320 | child nodes relevant to a node are stored externally and referenced though |
|
321 | 321 | pseudo-pointers. |
|
322 | 322 | |
|
323 | 323 | All integers are stored in big-endian. All pseudo-pointers are 32-bit integers |
|
324 | 324 | counting bytes from the start of the data file. Path lengths and positions |
|
325 | 325 | are 16-bit integers, also counted in bytes. |
|
326 | 326 | |
|
327 | 327 | Node components are: |
|
328 | 328 | |
|
329 | 329 | * Offset 0: |
|
330 | 330 | Pseudo-pointer to the full path of this node, |
|
331 | 331 | from the working directory root. |
|
332 | 332 | |
|
333 | 333 | * Offset 4: |
|
334 | 334 | Length of the full path. |
|
335 | 335 | |
|
336 | 336 | * Offset 6: |
|
337 | 337 | Position of the last `/` path separator within the full path, |
|
338 | 338 | in bytes from the start of the full path, |
|
339 | 339 | or zero if there isn’t one. |
|
340 | 340 | The part of the full path after this position is the "base name". |
|
341 | 341 | Since sibling nodes have the same parent, only their base name vary |
|
342 | 342 | and needs to be considered when doing binary search to find a given path. |
|
343 | 343 | |
|
344 | 344 | * Offset 8: |
|
345 | 345 | Pseudo-pointer to the "copy source" path for this node, |
|
346 | 346 | or zero if there is no copy source. |
|
347 | 347 | |
|
348 | 348 | * Offset 12: |
|
349 | 349 | Length of the copy source path, or zero if there isn’t one. |
|
350 | 350 | |
|
351 | 351 | * Offset 14: |
|
352 | 352 | Pseudo-pointer to the start of child nodes. |
|
353 | 353 | |
|
354 | 354 | * Offset 18: |
|
355 | 355 | Number of child nodes, as a 32-bit integer. |
|
356 | 356 | They occupy 43 times this number of bytes |
|
357 | 357 | (not counting space for paths, and further descendants). |
|
358 | 358 | |
|
359 | 359 | * Offset 22: |
|
360 | 360 | Number as a 32-bit integer of descendant nodes in this subtree, |
|
361 | 361 | not including this node itself, |
|
362 | 362 | that "have a dirstate entry". |
|
363 | 363 | Those nodes represent files that would be present at all in `dirstate-v1`. |
|
364 | 364 | This is typically less than the total number of descendants. |
|
365 | 365 | This counter is used to implement `has_dir`. |
|
366 | 366 | |
|
367 | 367 | * Offset 26: |
|
368 | 368 | Number as a 32-bit integer of descendant nodes in this subtree, |
|
369 | 369 | not including this node itself, |
|
370 | 370 | that represent files tracked in the working directory. |
|
371 | 371 | (For example, `hg rm` makes a file untracked.) |
|
372 | 372 | This counter is used to implement `has_tracked_dir`. |
|
373 | 373 | |
|
374 | 374 | * Offset 30: |
|
375 | 375 | A `flags` fields that packs some boolean values as bits of a 16-bit integer. |
|
376 | 376 | Starting from least-significant, bit masks are:: |
|
377 | 377 | |
|
378 | 378 | WDIR_TRACKED = 1 << 0 |
|
379 | 379 | P1_TRACKED = 1 << 1 |
|
380 | 380 | P2_INFO = 1 << 2 |
|
381 | 381 | MODE_EXEC_PERM = 1 << 3 |
|
382 | 382 | MODE_IS_SYMLINK = 1 << 4 |
|
383 | 383 | HAS_FALLBACK_EXEC = 1 << 5 |
|
384 | 384 | FALLBACK_EXEC = 1 << 6 |
|
385 | 385 | HAS_FALLBACK_SYMLINK = 1 << 7 |
|
386 | 386 | FALLBACK_SYMLINK = 1 << 8 |
|
387 | 387 | EXPECTED_STATE_IS_MODIFIED = 1 << 9 |
|
388 | 388 | HAS_MODE_AND_SIZE = 1 << 10 |
|
389 | 389 | HAS_MTIME = 1 << 11 |
|
390 | 390 | MTIME_SECOND_AMBIGUOUS = 1 << 12 |
|
391 | 391 | DIRECTORY = 1 << 13 |
|
392 | 392 | ALL_UNKNOWN_RECORDED = 1 << 14 |
|
393 | 393 | ALL_IGNORED_RECORDED = 1 << 15 |
|
394 | 394 | |
|
395 | 395 | The meaning of each bit is described below. |
|
396 | 396 | |
|
397 | 397 | Other bits are unset. |
|
398 | 398 | They may be assigned meaning if the future, |
|
399 | 399 | with the limitation that Mercurial versions that pre-date such meaning |
|
400 | 400 | will always reset those bits to unset when writing nodes. |
|
401 | 401 | (A new node is written for any mutation in its subtree, |
|
402 | 402 | leaving the bytes of the old node unreachable |
|
403 | 403 | until the data file is rewritten entirely.) |
|
404 | 404 | |
|
405 | 405 | * Offset 32: |
|
406 | 406 | A `size` field described below, as a 32-bit integer. |
|
407 | 407 | Unlike in dirstate-v1, negative values are not used. |
|
408 | 408 | |
|
409 | 409 | * Offset 36: |
|
410 | 410 | The seconds component of an `mtime` field described below, |
|
411 | 411 | as a 32-bit integer. |
|
412 | 412 | Unlike in dirstate-v1, negative values are not used. |
|
413 | 413 | When `mtime` is used, this is number of seconds since the Unix epoch |
|
414 | 414 | truncated to its lower 31 bits. |
|
415 | 415 | |
|
416 | 416 | * Offset 40: |
|
417 | 417 | The nanoseconds component of an `mtime` field described below, |
|
418 | 418 | as a 32-bit integer. |
|
419 | 419 | When `mtime` is used, |
|
420 | 420 | this is the number of nanoseconds since `mtime.seconds`, |
|
421 | 421 | always strictly less than one billion. |
|
422 | 422 | |
|
423 | 423 | This may be zero if more precision is not available. |
|
424 | 424 | (This can happen because of limitations in any of Mercurial, Python, |
|
425 | 425 | libc, the operating system, …) |
|
426 | 426 | |
|
427 | 427 | When comparing two mtimes and either has this component set to zero, |
|
428 | 428 | the sub-second precision of both should be ignored. |
|
429 | 429 | False positives when checking mtime equality due to clock resolution |
|
430 | 430 | are always possible and the status algorithm needs to deal with them, |
|
431 | 431 | but having too many false negatives could be harmful too. |
|
432 | 432 | |
|
433 | 433 | * (Offset 44: end of this node) |
|
434 | 434 | |
|
435 | 435 | The meaning of the boolean values packed in `flags` is: |
|
436 | 436 | |
|
437 | 437 | `WDIR_TRACKED` |
|
438 | 438 | Set if the working directory contains a tracked file at this node’s path. |
|
439 | 439 | This is typically set and unset by `hg add` and `hg rm`. |
|
440 | 440 | |
|
441 | 441 | `P1_TRACKED` |
|
442 | 442 | Set if the working directory’s first parent changeset |
|
443 | 443 | (whose node identifier is found in tree metadata) |
|
444 | 444 | contains a tracked file at this node’s path. |
|
445 | 445 | This is a cache to reduce manifest lookups. |
|
446 | 446 | |
|
447 | 447 | `P2_INFO` |
|
448 | 448 | Set if the file has been involved in some merge operation. |
|
449 | 449 | Either because it was actually merged, |
|
450 | 450 | or because the version in the second parent p2 version was ahead, |
|
451 | 451 | or because some rename moved it there. |
|
452 | 452 | In either case `hg status` will want it displayed as modified. |
|
453 | 453 | |
|
454 | 454 | Files that would be mentioned at all in the `dirstate-v1` file format |
|
455 | 455 | have a node with at least one of the above three bits set in `dirstate-v2`. |
|
456 | 456 | Let’s call these files "tracked anywhere", |
|
457 | 457 | and "untracked" the nodes with all three of these bits unset. |
|
458 | 458 | Untracked nodes are typically for directories: |
|
459 | 459 | they hold child nodes and form the tree structure. |
|
460 | 460 | Additional untracked nodes may also exist. |
|
461 | 461 | Although implementations should strive to clean up nodes |
|
462 | 462 | that are entirely unused, other untracked nodes may also exist. |
|
463 | 463 | For example, a future version of Mercurial might in some cases |
|
464 | 464 | add nodes for untracked files or/and ignored files in the working directory |
|
465 | 465 | in order to optimize `hg status` |
|
466 | 466 | by enabling it to skip `readdir` in more cases. |
|
467 | 467 | |
|
468 | 468 | `HAS_MODE_AND_SIZE` |
|
469 | 469 | Must be unset for untracked nodes. |
|
470 | 470 | For files tracked anywhere, if this is set: |
|
471 | 471 | - The `size` field is the expected file size, |
|
472 | 472 | in bytes truncated its lower to 31 bits. |
|
473 | 473 | - The expected execute permission for the file’s owner |
|
474 | 474 | is given by `MODE_EXEC_PERM` |
|
475 | 475 | - The expected file type is given by `MODE_IS_SIMLINK`: |
|
476 | 476 | a symbolic link if set, or a normal file if unset. |
|
477 | 477 | If this is unset the expected size, permission, and file type are unknown. |
|
478 | 478 | The `size` field is unused (set to zero). |
|
479 | 479 | |
|
480 | 480 | `HAS_MTIME` |
|
481 | 481 | The nodes contains a "valid" last modification time in the `mtime` field. |
|
482 | 482 | |
|
483 | 483 | |
|
484 | 484 | It means the `mtime` was already strictly in the past when observed, |
|
485 | 485 | meaning that later changes cannot happen in the same clock tick |
|
486 | 486 | and must cause a different modification time |
|
487 | 487 | (unless the system clock jumps back and we get unlucky, |
|
488 | 488 | which is not impossible but deemed unlikely enough). |
|
489 | 489 | |
|
490 | 490 | This means that if `std::fs::symlink_metadata` later reports |
|
491 | 491 | the same modification time |
|
492 | 492 | and ignored patterns haven’t changed, |
|
493 | 493 | we can assume the node to be unchanged on disk. |
|
494 | 494 | |
|
495 | 495 | The `mtime` field can then be used to skip more expensive lookup when |
|
496 | 496 | checking the status of "tracked" nodes. |
|
497 | 497 | |
|
498 | 498 | It can also be set for node where `DIRECTORY` is set. |
|
499 | 499 | See `DIRECTORY` documentation for details. |
|
500 | 500 | |
|
501 | 501 | `DIRECTORY` |
|
502 | 502 | When set, this entry will match a directory that exists or existed on the |
|
503 | 503 | file system. |
|
504 | 504 | |
|
505 | 505 | * When `HAS_MTIME` is set a directory has been seen on the file system and |
|
506 | 506 | `mtime` matches its last modification time. However, `HAS_MTIME` not |
|
507 | 507 | being set does not indicate the lack of directory on the file system. |
|
508 | 508 | |
|
509 | 509 | * When not tracked anywhere, this node does not represent an ignored or |
|
510 | 510 | unknown file on disk. |
|
511 | 511 | |
|
512 | 512 | If `HAS_MTIME` is set |
|
513 | 513 | and `mtime` matches the last modification time of the directory on disk, |
|
514 | 514 | the directory is unchanged |
|
515 | 515 | and we can skip calling `std::fs::read_dir` again for this directory, |
|
516 | 516 | and iterate child dirstate nodes instead. |
|
517 | 517 | (as long as `ALL_UNKNOWN_RECORDED` and `ALL_IGNORED_RECORDED` are taken |
|
518 | 518 | into account) |
|
519 | 519 | |
|
520 | 520 | `MODE_EXEC_PERM` |
|
521 | 521 | Must be unset if `HAS_MODE_AND_SIZE` is unset. |
|
522 | 522 | If `HAS_MODE_AND_SIZE` is set, |
|
523 | 523 | this indicates whether the file’s own is expected |
|
524 | 524 | to have execute permission. |
|
525 | 525 | |
|
526 | 526 | Beware that on system without fs support for this information, the value |
|
527 | 527 | stored in the dirstate might be wrong and should not be relied on. |
|
528 | 528 | |
|
529 | 529 | `MODE_IS_SYMLINK` |
|
530 | 530 | Must be unset if `HAS_MODE_AND_SIZE` is unset. |
|
531 | 531 | If `HAS_MODE_AND_SIZE` is set, |
|
532 | 532 | this indicates whether the file is expected to be a symlink |
|
533 | 533 | as opposed to a normal file. |
|
534 | 534 | |
|
535 | 535 | Beware that on system without fs support for this information, the value |
|
536 | 536 | stored in the dirstate might be wrong and should not be relied on. |
|
537 | 537 | |
|
538 | 538 | `EXPECTED_STATE_IS_MODIFIED` |
|
539 | 539 | Must be unset for untracked nodes. |
|
540 | 540 | For: |
|
541 | 541 | - a file tracked anywhere |
|
542 | 542 | - that has expected metadata (`HAS_MODE_AND_SIZE` and `HAS_MTIME`) |
|
543 | 543 | - if that metadata matches |
|
544 | 544 | metadata found in the working directory with `stat` |
|
545 | 545 | This bit indicates the status of the file. |
|
546 | 546 | If set, the status is modified. If unset, it is clean. |
|
547 | 547 | |
|
548 | 548 | In cases where `hg status` needs to read the contents of a file |
|
549 | 549 | because metadata is ambiguous, this bit lets it record the result |
|
550 | 550 | if the result is modified so that a future run of `hg status` |
|
551 | 551 | does not need to do the same again. |
|
552 | 552 | It is valid to never set this bit, |
|
553 | 553 | and consider expected metadata ambiguous if it is set. |
|
554 | 554 | |
|
555 | 555 | `ALL_UNKNOWN_RECORDED` |
|
556 | 556 | If set, all "unknown" children existing on disk (at the time of the last |
|
557 | 557 | status) have been recorded and the `mtime` associated with |
|
558 | 558 | `DIRECTORY` can be used for optimization even when "unknown" file |
|
559 | 559 | are listed. |
|
560 | 560 | |
|
561 | 561 | Note that the amount recorded "unknown" children can still be zero if None |
|
562 | 562 | where present. |
|
563 | 563 | |
|
564 | 564 | Also note that having this flag unset does not imply that no "unknown" |
|
565 | 565 | children have been recorded. Some might be present, but there is |
|
566 | 566 | no guarantee that is will be all of them. |
|
567 | 567 | |
|
568 | 568 | `ALL_IGNORED_RECORDED` |
|
569 | 569 | If set, all "ignored" children existing on disk (at the time of the last |
|
570 | 570 | status) have been recorded and the `mtime` associated with |
|
571 | 571 | `DIRECTORY` can be used for optimization even when "ignored" file |
|
572 | 572 | are listed. |
|
573 | 573 | |
|
574 | 574 | Note that the amount recorded "ignored" children can still be zero if None |
|
575 | 575 | where present. |
|
576 | 576 | |
|
577 | 577 | Also note that having this flag unset does not imply that no "ignored" |
|
578 | 578 | children have been recorded. Some might be present, but there is |
|
579 | 579 | no guarantee that is will be all of them. |
|
580 | 580 | |
|
581 | 581 | `HAS_FALLBACK_EXEC` |
|
582 | 582 | If this flag is set, the entry carries "fallback" information for the |
|
583 | 583 | executable bit in the `FALLBACK_EXEC` flag. |
|
584 | 584 | |
|
585 | 585 | Fallback information can be stored in the dirstate to keep track of |
|
586 | 586 | filesystem attribute tracked by Mercurial when the underlying file |
|
587 | 587 | system or operating system does not support that property, (e.g. |
|
588 | 588 | Windows). |
|
589 | 589 | |
|
590 | 590 | `FALLBACK_EXEC` |
|
591 | 591 | Should be ignored if `HAS_FALLBACK_EXEC` is unset. If set the file for this |
|
592 | 592 | entry should be considered executable if that information cannot be |
|
593 | 593 | extracted from the file system. If unset it should be considered |
|
594 | 594 | non-executable instead. |
|
595 | 595 | |
|
596 | 596 | `HAS_FALLBACK_SYMLINK` |
|
597 | 597 | If this flag is set, the entry carries "fallback" information for symbolic |
|
598 | 598 | link status in the `FALLBACK_SYMLINK` flag. |
|
599 | 599 | |
|
600 | 600 | Fallback information can be stored in the dirstate to keep track of |
|
601 | 601 | filesystem attribute tracked by Mercurial when the underlying file |
|
602 | 602 | system or operating system does not support that property, (e.g. |
|
603 | 603 | Windows). |
|
604 | 604 | |
|
605 | 605 | `FALLBACK_SYMLINK` |
|
606 | 606 | Should be ignored if `HAS_FALLBACK_SYMLINK` is unset. If set the file for |
|
607 | 607 | this entry should be considered a symlink if that information cannot be |
|
608 | 608 | extracted from the file system. If unset it should be considered a normal |
|
609 | 609 | file instead. |
|
610 | 610 | |
|
611 | 611 | `MTIME_SECOND_AMBIGUOUS` |
|
612 | 612 | This flag is relevant only when `HAS_FILE_MTIME` is set. When set, the |
|
613 | 613 | `mtime` stored in the entry is only valid for comparison with timestamps |
|
614 | 614 | that have nanosecond information. If available timestamp does not carries |
|
615 | 615 | nanosecond information, the `mtime` should be ignored and no optimization |
|
616 | 616 | can be applied. |
@@ -1,95 +1,95 b'' | |||
|
1 | 1 | Mercurial can be augmented with Rust extensions for speeding up certain |
|
2 | 2 | operations. |
|
3 | 3 | |
|
4 | 4 | Compatibility |
|
5 | 5 | ============= |
|
6 | 6 | |
|
7 | 7 | Though the Rust extensions are only tested by the project under Linux, users of |
|
8 | 8 | MacOS, FreeBSD and other UNIX-likes have been using the Rust extensions. Your |
|
9 | 9 | mileage may vary, but by all means do give us feedback or signal your interest |
|
10 | 10 | for better support. |
|
11 | 11 | |
|
12 | 12 | No Rust extensions are available for Windows at this time. |
|
13 | 13 | |
|
14 | 14 | Features |
|
15 | 15 | ======== |
|
16 | 16 | |
|
17 | 17 | The following operations are sped up when using Rust: |
|
18 | 18 | |
|
19 | 19 | - discovery of differences between repositories (pull/push) |
|
20 | 20 | - nodemap (see :hg:`help config.format.use-persistent-nodemap`) |
|
21 | 21 | - all commands using the dirstate (status, commit, diff, add, update, etc.) |
|
22 |
- dirstate-v2 (see :hg:`help config.format.e |
|
|
22 | - dirstate-v2 (see :hg:`help config.format.use-dirstate-v2`) | |
|
23 | 23 | - iteration over ancestors in a graph |
|
24 | 24 | |
|
25 | 25 | More features are in the works, and improvements on the above listed are still |
|
26 | 26 | in progress. For more experimental work see the "rhg" section. |
|
27 | 27 | |
|
28 | 28 | Checking for Rust |
|
29 | 29 | ================= |
|
30 | 30 | |
|
31 | 31 | You may already have the Rust extensions depending on how you install Mercurial. |
|
32 | 32 | |
|
33 | 33 | $ hg debuginstall | grep -i rust |
|
34 | 34 | checking Rust extensions (installed) |
|
35 | 35 | checking module policy (rust+c-allow) |
|
36 | 36 | |
|
37 | 37 | If those lines don't even exist, you're using an old version of `hg` which does |
|
38 | 38 | not have any Rust extensions yet. |
|
39 | 39 | |
|
40 | 40 | Installing |
|
41 | 41 | ========== |
|
42 | 42 | |
|
43 | 43 | You will need `cargo` to be in your `$PATH`. See the "MSRV" section for which |
|
44 | 44 | version to use. |
|
45 | 45 | |
|
46 | 46 | Using pip |
|
47 | 47 | --------- |
|
48 | 48 | |
|
49 | 49 | Users of `pip` can install the Rust extensions with the following command: |
|
50 | 50 | |
|
51 | 51 | $ pip install mercurial --global-option --rust --no-use-pep517 |
|
52 | 52 | |
|
53 | 53 | `--no-use-pep517` is here to tell `pip` to preserve backwards compatibility with |
|
54 | 54 | the legacy `setup.py` system. Mercurial has not yet migrated its complex setup |
|
55 | 55 | to the new system, so we still need this to add compiled extensions. |
|
56 | 56 | |
|
57 | 57 | This might take a couple of minutes because you're compiling everything. |
|
58 | 58 | |
|
59 | 59 | See the "Checking for Rust" section to see if the install succeeded. |
|
60 | 60 | |
|
61 | 61 | From your distribution |
|
62 | 62 | ---------------------- |
|
63 | 63 | |
|
64 | 64 | Some distributions are shipping Mercurial with Rust extensions enabled and |
|
65 | 65 | pre-compiled (meaning you won't have to install `cargo`), or allow you to |
|
66 | 66 | specify an install flag. Check with your specific distribution for how to do |
|
67 | 67 | that, or ask their team to add support for hg+Rust! |
|
68 | 68 | |
|
69 | 69 | From source |
|
70 | 70 | ----------- |
|
71 | 71 | |
|
72 | 72 | Please refer to the `rust/README.rst` file in the Mercurial repository for |
|
73 | 73 | instructions on how to install from source. |
|
74 | 74 | |
|
75 | 75 | MSRV |
|
76 | 76 | ==== |
|
77 | 77 | |
|
78 | 78 | The minimum supported Rust version is currently 1.48.0. The project's policy is |
|
79 | 79 | to follow the version from Debian stable, to make the distributions' job easier. |
|
80 | 80 | |
|
81 | 81 | rhg |
|
82 | 82 | === |
|
83 | 83 | |
|
84 | 84 | There exists an experimental pure-Rust version of Mercurial called `rhg` with a |
|
85 | 85 | fallback mechanism for unsupported invocations. It allows for much faster |
|
86 | 86 | execution of certain commands while adding no discernable overhead for the rest. |
|
87 | 87 | |
|
88 | 88 | The only way of trying it out is by building it from source. Please refer to |
|
89 | 89 | `rust/README.rst` in the Mercurial repository. |
|
90 | 90 | |
|
91 | 91 | Contributing |
|
92 | 92 | ============ |
|
93 | 93 | |
|
94 | 94 | If you would like to help the Rust endeavor, please refer to `rust/README.rst` |
|
95 | 95 | in the Mercurial repository. |
@@ -1,3897 +1,3897 b'' | |||
|
1 | 1 | # localrepo.py - read/write repository class 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 errno |
|
11 | 11 | import functools |
|
12 | 12 | import os |
|
13 | 13 | import random |
|
14 | 14 | import sys |
|
15 | 15 | import time |
|
16 | 16 | import weakref |
|
17 | 17 | |
|
18 | 18 | from .i18n import _ |
|
19 | 19 | from .node import ( |
|
20 | 20 | bin, |
|
21 | 21 | hex, |
|
22 | 22 | nullrev, |
|
23 | 23 | sha1nodeconstants, |
|
24 | 24 | short, |
|
25 | 25 | ) |
|
26 | 26 | from .pycompat import ( |
|
27 | 27 | delattr, |
|
28 | 28 | getattr, |
|
29 | 29 | ) |
|
30 | 30 | from . import ( |
|
31 | 31 | bookmarks, |
|
32 | 32 | branchmap, |
|
33 | 33 | bundle2, |
|
34 | 34 | bundlecaches, |
|
35 | 35 | changegroup, |
|
36 | 36 | color, |
|
37 | 37 | commit, |
|
38 | 38 | context, |
|
39 | 39 | dirstate, |
|
40 | 40 | dirstateguard, |
|
41 | 41 | discovery, |
|
42 | 42 | encoding, |
|
43 | 43 | error, |
|
44 | 44 | exchange, |
|
45 | 45 | extensions, |
|
46 | 46 | filelog, |
|
47 | 47 | hook, |
|
48 | 48 | lock as lockmod, |
|
49 | 49 | match as matchmod, |
|
50 | 50 | mergestate as mergestatemod, |
|
51 | 51 | mergeutil, |
|
52 | 52 | namespaces, |
|
53 | 53 | narrowspec, |
|
54 | 54 | obsolete, |
|
55 | 55 | pathutil, |
|
56 | 56 | phases, |
|
57 | 57 | pushkey, |
|
58 | 58 | pycompat, |
|
59 | 59 | rcutil, |
|
60 | 60 | repoview, |
|
61 | 61 | requirements as requirementsmod, |
|
62 | 62 | revlog, |
|
63 | 63 | revset, |
|
64 | 64 | revsetlang, |
|
65 | 65 | scmutil, |
|
66 | 66 | sparse, |
|
67 | 67 | store as storemod, |
|
68 | 68 | subrepoutil, |
|
69 | 69 | tags as tagsmod, |
|
70 | 70 | transaction, |
|
71 | 71 | txnutil, |
|
72 | 72 | util, |
|
73 | 73 | vfs as vfsmod, |
|
74 | 74 | wireprototypes, |
|
75 | 75 | ) |
|
76 | 76 | |
|
77 | 77 | from .interfaces import ( |
|
78 | 78 | repository, |
|
79 | 79 | util as interfaceutil, |
|
80 | 80 | ) |
|
81 | 81 | |
|
82 | 82 | from .utils import ( |
|
83 | 83 | hashutil, |
|
84 | 84 | procutil, |
|
85 | 85 | stringutil, |
|
86 | 86 | urlutil, |
|
87 | 87 | ) |
|
88 | 88 | |
|
89 | 89 | from .revlogutils import ( |
|
90 | 90 | concurrency_checker as revlogchecker, |
|
91 | 91 | constants as revlogconst, |
|
92 | 92 | sidedata as sidedatamod, |
|
93 | 93 | ) |
|
94 | 94 | |
|
95 | 95 | release = lockmod.release |
|
96 | 96 | urlerr = util.urlerr |
|
97 | 97 | urlreq = util.urlreq |
|
98 | 98 | |
|
99 | 99 | # set of (path, vfs-location) tuples. vfs-location is: |
|
100 | 100 | # - 'plain for vfs relative paths |
|
101 | 101 | # - '' for svfs relative paths |
|
102 | 102 | _cachedfiles = set() |
|
103 | 103 | |
|
104 | 104 | |
|
105 | 105 | class _basefilecache(scmutil.filecache): |
|
106 | 106 | """All filecache usage on repo are done for logic that should be unfiltered""" |
|
107 | 107 | |
|
108 | 108 | def __get__(self, repo, type=None): |
|
109 | 109 | if repo is None: |
|
110 | 110 | return self |
|
111 | 111 | # proxy to unfiltered __dict__ since filtered repo has no entry |
|
112 | 112 | unfi = repo.unfiltered() |
|
113 | 113 | try: |
|
114 | 114 | return unfi.__dict__[self.sname] |
|
115 | 115 | except KeyError: |
|
116 | 116 | pass |
|
117 | 117 | return super(_basefilecache, self).__get__(unfi, type) |
|
118 | 118 | |
|
119 | 119 | def set(self, repo, value): |
|
120 | 120 | return super(_basefilecache, self).set(repo.unfiltered(), value) |
|
121 | 121 | |
|
122 | 122 | |
|
123 | 123 | class repofilecache(_basefilecache): |
|
124 | 124 | """filecache for files in .hg but outside of .hg/store""" |
|
125 | 125 | |
|
126 | 126 | def __init__(self, *paths): |
|
127 | 127 | super(repofilecache, self).__init__(*paths) |
|
128 | 128 | for path in paths: |
|
129 | 129 | _cachedfiles.add((path, b'plain')) |
|
130 | 130 | |
|
131 | 131 | def join(self, obj, fname): |
|
132 | 132 | return obj.vfs.join(fname) |
|
133 | 133 | |
|
134 | 134 | |
|
135 | 135 | class storecache(_basefilecache): |
|
136 | 136 | """filecache for files in the store""" |
|
137 | 137 | |
|
138 | 138 | def __init__(self, *paths): |
|
139 | 139 | super(storecache, self).__init__(*paths) |
|
140 | 140 | for path in paths: |
|
141 | 141 | _cachedfiles.add((path, b'')) |
|
142 | 142 | |
|
143 | 143 | def join(self, obj, fname): |
|
144 | 144 | return obj.sjoin(fname) |
|
145 | 145 | |
|
146 | 146 | |
|
147 | 147 | class changelogcache(storecache): |
|
148 | 148 | """filecache for the changelog""" |
|
149 | 149 | |
|
150 | 150 | def __init__(self): |
|
151 | 151 | super(changelogcache, self).__init__() |
|
152 | 152 | _cachedfiles.add((b'00changelog.i', b'')) |
|
153 | 153 | _cachedfiles.add((b'00changelog.n', b'')) |
|
154 | 154 | |
|
155 | 155 | def tracked_paths(self, obj): |
|
156 | 156 | paths = [self.join(obj, b'00changelog.i')] |
|
157 | 157 | if obj.store.opener.options.get(b'persistent-nodemap', False): |
|
158 | 158 | paths.append(self.join(obj, b'00changelog.n')) |
|
159 | 159 | return paths |
|
160 | 160 | |
|
161 | 161 | |
|
162 | 162 | class manifestlogcache(storecache): |
|
163 | 163 | """filecache for the manifestlog""" |
|
164 | 164 | |
|
165 | 165 | def __init__(self): |
|
166 | 166 | super(manifestlogcache, self).__init__() |
|
167 | 167 | _cachedfiles.add((b'00manifest.i', b'')) |
|
168 | 168 | _cachedfiles.add((b'00manifest.n', b'')) |
|
169 | 169 | |
|
170 | 170 | def tracked_paths(self, obj): |
|
171 | 171 | paths = [self.join(obj, b'00manifest.i')] |
|
172 | 172 | if obj.store.opener.options.get(b'persistent-nodemap', False): |
|
173 | 173 | paths.append(self.join(obj, b'00manifest.n')) |
|
174 | 174 | return paths |
|
175 | 175 | |
|
176 | 176 | |
|
177 | 177 | class mixedrepostorecache(_basefilecache): |
|
178 | 178 | """filecache for a mix files in .hg/store and outside""" |
|
179 | 179 | |
|
180 | 180 | def __init__(self, *pathsandlocations): |
|
181 | 181 | # scmutil.filecache only uses the path for passing back into our |
|
182 | 182 | # join(), so we can safely pass a list of paths and locations |
|
183 | 183 | super(mixedrepostorecache, self).__init__(*pathsandlocations) |
|
184 | 184 | _cachedfiles.update(pathsandlocations) |
|
185 | 185 | |
|
186 | 186 | def join(self, obj, fnameandlocation): |
|
187 | 187 | fname, location = fnameandlocation |
|
188 | 188 | if location == b'plain': |
|
189 | 189 | return obj.vfs.join(fname) |
|
190 | 190 | else: |
|
191 | 191 | if location != b'': |
|
192 | 192 | raise error.ProgrammingError( |
|
193 | 193 | b'unexpected location: %s' % location |
|
194 | 194 | ) |
|
195 | 195 | return obj.sjoin(fname) |
|
196 | 196 | |
|
197 | 197 | |
|
198 | 198 | def isfilecached(repo, name): |
|
199 | 199 | """check if a repo has already cached "name" filecache-ed property |
|
200 | 200 | |
|
201 | 201 | This returns (cachedobj-or-None, iscached) tuple. |
|
202 | 202 | """ |
|
203 | 203 | cacheentry = repo.unfiltered()._filecache.get(name, None) |
|
204 | 204 | if not cacheentry: |
|
205 | 205 | return None, False |
|
206 | 206 | return cacheentry.obj, True |
|
207 | 207 | |
|
208 | 208 | |
|
209 | 209 | class unfilteredpropertycache(util.propertycache): |
|
210 | 210 | """propertycache that apply to unfiltered repo only""" |
|
211 | 211 | |
|
212 | 212 | def __get__(self, repo, type=None): |
|
213 | 213 | unfi = repo.unfiltered() |
|
214 | 214 | if unfi is repo: |
|
215 | 215 | return super(unfilteredpropertycache, self).__get__(unfi) |
|
216 | 216 | return getattr(unfi, self.name) |
|
217 | 217 | |
|
218 | 218 | |
|
219 | 219 | class filteredpropertycache(util.propertycache): |
|
220 | 220 | """propertycache that must take filtering in account""" |
|
221 | 221 | |
|
222 | 222 | def cachevalue(self, obj, value): |
|
223 | 223 | object.__setattr__(obj, self.name, value) |
|
224 | 224 | |
|
225 | 225 | |
|
226 | 226 | def hasunfilteredcache(repo, name): |
|
227 | 227 | """check if a repo has an unfilteredpropertycache value for <name>""" |
|
228 | 228 | return name in vars(repo.unfiltered()) |
|
229 | 229 | |
|
230 | 230 | |
|
231 | 231 | def unfilteredmethod(orig): |
|
232 | 232 | """decorate method that always need to be run on unfiltered version""" |
|
233 | 233 | |
|
234 | 234 | @functools.wraps(orig) |
|
235 | 235 | def wrapper(repo, *args, **kwargs): |
|
236 | 236 | return orig(repo.unfiltered(), *args, **kwargs) |
|
237 | 237 | |
|
238 | 238 | return wrapper |
|
239 | 239 | |
|
240 | 240 | |
|
241 | 241 | moderncaps = { |
|
242 | 242 | b'lookup', |
|
243 | 243 | b'branchmap', |
|
244 | 244 | b'pushkey', |
|
245 | 245 | b'known', |
|
246 | 246 | b'getbundle', |
|
247 | 247 | b'unbundle', |
|
248 | 248 | } |
|
249 | 249 | legacycaps = moderncaps.union({b'changegroupsubset'}) |
|
250 | 250 | |
|
251 | 251 | |
|
252 | 252 | @interfaceutil.implementer(repository.ipeercommandexecutor) |
|
253 | 253 | class localcommandexecutor(object): |
|
254 | 254 | def __init__(self, peer): |
|
255 | 255 | self._peer = peer |
|
256 | 256 | self._sent = False |
|
257 | 257 | self._closed = False |
|
258 | 258 | |
|
259 | 259 | def __enter__(self): |
|
260 | 260 | return self |
|
261 | 261 | |
|
262 | 262 | def __exit__(self, exctype, excvalue, exctb): |
|
263 | 263 | self.close() |
|
264 | 264 | |
|
265 | 265 | def callcommand(self, command, args): |
|
266 | 266 | if self._sent: |
|
267 | 267 | raise error.ProgrammingError( |
|
268 | 268 | b'callcommand() cannot be used after sendcommands()' |
|
269 | 269 | ) |
|
270 | 270 | |
|
271 | 271 | if self._closed: |
|
272 | 272 | raise error.ProgrammingError( |
|
273 | 273 | b'callcommand() cannot be used after close()' |
|
274 | 274 | ) |
|
275 | 275 | |
|
276 | 276 | # We don't need to support anything fancy. Just call the named |
|
277 | 277 | # method on the peer and return a resolved future. |
|
278 | 278 | fn = getattr(self._peer, pycompat.sysstr(command)) |
|
279 | 279 | |
|
280 | 280 | f = pycompat.futures.Future() |
|
281 | 281 | |
|
282 | 282 | try: |
|
283 | 283 | result = fn(**pycompat.strkwargs(args)) |
|
284 | 284 | except Exception: |
|
285 | 285 | pycompat.future_set_exception_info(f, sys.exc_info()[1:]) |
|
286 | 286 | else: |
|
287 | 287 | f.set_result(result) |
|
288 | 288 | |
|
289 | 289 | return f |
|
290 | 290 | |
|
291 | 291 | def sendcommands(self): |
|
292 | 292 | self._sent = True |
|
293 | 293 | |
|
294 | 294 | def close(self): |
|
295 | 295 | self._closed = True |
|
296 | 296 | |
|
297 | 297 | |
|
298 | 298 | @interfaceutil.implementer(repository.ipeercommands) |
|
299 | 299 | class localpeer(repository.peer): |
|
300 | 300 | '''peer for a local repo; reflects only the most recent API''' |
|
301 | 301 | |
|
302 | 302 | def __init__(self, repo, caps=None): |
|
303 | 303 | super(localpeer, self).__init__() |
|
304 | 304 | |
|
305 | 305 | if caps is None: |
|
306 | 306 | caps = moderncaps.copy() |
|
307 | 307 | self._repo = repo.filtered(b'served') |
|
308 | 308 | self.ui = repo.ui |
|
309 | 309 | |
|
310 | 310 | if repo._wanted_sidedata: |
|
311 | 311 | formatted = bundle2.format_remote_wanted_sidedata(repo) |
|
312 | 312 | caps.add(b'exp-wanted-sidedata=' + formatted) |
|
313 | 313 | |
|
314 | 314 | self._caps = repo._restrictcapabilities(caps) |
|
315 | 315 | |
|
316 | 316 | # Begin of _basepeer interface. |
|
317 | 317 | |
|
318 | 318 | def url(self): |
|
319 | 319 | return self._repo.url() |
|
320 | 320 | |
|
321 | 321 | def local(self): |
|
322 | 322 | return self._repo |
|
323 | 323 | |
|
324 | 324 | def peer(self): |
|
325 | 325 | return self |
|
326 | 326 | |
|
327 | 327 | def canpush(self): |
|
328 | 328 | return True |
|
329 | 329 | |
|
330 | 330 | def close(self): |
|
331 | 331 | self._repo.close() |
|
332 | 332 | |
|
333 | 333 | # End of _basepeer interface. |
|
334 | 334 | |
|
335 | 335 | # Begin of _basewirecommands interface. |
|
336 | 336 | |
|
337 | 337 | def branchmap(self): |
|
338 | 338 | return self._repo.branchmap() |
|
339 | 339 | |
|
340 | 340 | def capabilities(self): |
|
341 | 341 | return self._caps |
|
342 | 342 | |
|
343 | 343 | def clonebundles(self): |
|
344 | 344 | return self._repo.tryread(bundlecaches.CB_MANIFEST_FILE) |
|
345 | 345 | |
|
346 | 346 | def debugwireargs(self, one, two, three=None, four=None, five=None): |
|
347 | 347 | """Used to test argument passing over the wire""" |
|
348 | 348 | return b"%s %s %s %s %s" % ( |
|
349 | 349 | one, |
|
350 | 350 | two, |
|
351 | 351 | pycompat.bytestr(three), |
|
352 | 352 | pycompat.bytestr(four), |
|
353 | 353 | pycompat.bytestr(five), |
|
354 | 354 | ) |
|
355 | 355 | |
|
356 | 356 | def getbundle( |
|
357 | 357 | self, |
|
358 | 358 | source, |
|
359 | 359 | heads=None, |
|
360 | 360 | common=None, |
|
361 | 361 | bundlecaps=None, |
|
362 | 362 | remote_sidedata=None, |
|
363 | 363 | **kwargs |
|
364 | 364 | ): |
|
365 | 365 | chunks = exchange.getbundlechunks( |
|
366 | 366 | self._repo, |
|
367 | 367 | source, |
|
368 | 368 | heads=heads, |
|
369 | 369 | common=common, |
|
370 | 370 | bundlecaps=bundlecaps, |
|
371 | 371 | remote_sidedata=remote_sidedata, |
|
372 | 372 | **kwargs |
|
373 | 373 | )[1] |
|
374 | 374 | cb = util.chunkbuffer(chunks) |
|
375 | 375 | |
|
376 | 376 | if exchange.bundle2requested(bundlecaps): |
|
377 | 377 | # When requesting a bundle2, getbundle returns a stream to make the |
|
378 | 378 | # wire level function happier. We need to build a proper object |
|
379 | 379 | # from it in local peer. |
|
380 | 380 | return bundle2.getunbundler(self.ui, cb) |
|
381 | 381 | else: |
|
382 | 382 | return changegroup.getunbundler(b'01', cb, None) |
|
383 | 383 | |
|
384 | 384 | def heads(self): |
|
385 | 385 | return self._repo.heads() |
|
386 | 386 | |
|
387 | 387 | def known(self, nodes): |
|
388 | 388 | return self._repo.known(nodes) |
|
389 | 389 | |
|
390 | 390 | def listkeys(self, namespace): |
|
391 | 391 | return self._repo.listkeys(namespace) |
|
392 | 392 | |
|
393 | 393 | def lookup(self, key): |
|
394 | 394 | return self._repo.lookup(key) |
|
395 | 395 | |
|
396 | 396 | def pushkey(self, namespace, key, old, new): |
|
397 | 397 | return self._repo.pushkey(namespace, key, old, new) |
|
398 | 398 | |
|
399 | 399 | def stream_out(self): |
|
400 | 400 | raise error.Abort(_(b'cannot perform stream clone against local peer')) |
|
401 | 401 | |
|
402 | 402 | def unbundle(self, bundle, heads, url): |
|
403 | 403 | """apply a bundle on a repo |
|
404 | 404 | |
|
405 | 405 | This function handles the repo locking itself.""" |
|
406 | 406 | try: |
|
407 | 407 | try: |
|
408 | 408 | bundle = exchange.readbundle(self.ui, bundle, None) |
|
409 | 409 | ret = exchange.unbundle(self._repo, bundle, heads, b'push', url) |
|
410 | 410 | if util.safehasattr(ret, b'getchunks'): |
|
411 | 411 | # This is a bundle20 object, turn it into an unbundler. |
|
412 | 412 | # This little dance should be dropped eventually when the |
|
413 | 413 | # API is finally improved. |
|
414 | 414 | stream = util.chunkbuffer(ret.getchunks()) |
|
415 | 415 | ret = bundle2.getunbundler(self.ui, stream) |
|
416 | 416 | return ret |
|
417 | 417 | except Exception as exc: |
|
418 | 418 | # If the exception contains output salvaged from a bundle2 |
|
419 | 419 | # reply, we need to make sure it is printed before continuing |
|
420 | 420 | # to fail. So we build a bundle2 with such output and consume |
|
421 | 421 | # it directly. |
|
422 | 422 | # |
|
423 | 423 | # This is not very elegant but allows a "simple" solution for |
|
424 | 424 | # issue4594 |
|
425 | 425 | output = getattr(exc, '_bundle2salvagedoutput', ()) |
|
426 | 426 | if output: |
|
427 | 427 | bundler = bundle2.bundle20(self._repo.ui) |
|
428 | 428 | for out in output: |
|
429 | 429 | bundler.addpart(out) |
|
430 | 430 | stream = util.chunkbuffer(bundler.getchunks()) |
|
431 | 431 | b = bundle2.getunbundler(self.ui, stream) |
|
432 | 432 | bundle2.processbundle(self._repo, b) |
|
433 | 433 | raise |
|
434 | 434 | except error.PushRaced as exc: |
|
435 | 435 | raise error.ResponseError( |
|
436 | 436 | _(b'push failed:'), stringutil.forcebytestr(exc) |
|
437 | 437 | ) |
|
438 | 438 | |
|
439 | 439 | # End of _basewirecommands interface. |
|
440 | 440 | |
|
441 | 441 | # Begin of peer interface. |
|
442 | 442 | |
|
443 | 443 | def commandexecutor(self): |
|
444 | 444 | return localcommandexecutor(self) |
|
445 | 445 | |
|
446 | 446 | # End of peer interface. |
|
447 | 447 | |
|
448 | 448 | |
|
449 | 449 | @interfaceutil.implementer(repository.ipeerlegacycommands) |
|
450 | 450 | class locallegacypeer(localpeer): |
|
451 | 451 | """peer extension which implements legacy methods too; used for tests with |
|
452 | 452 | restricted capabilities""" |
|
453 | 453 | |
|
454 | 454 | def __init__(self, repo): |
|
455 | 455 | super(locallegacypeer, self).__init__(repo, caps=legacycaps) |
|
456 | 456 | |
|
457 | 457 | # Begin of baselegacywirecommands interface. |
|
458 | 458 | |
|
459 | 459 | def between(self, pairs): |
|
460 | 460 | return self._repo.between(pairs) |
|
461 | 461 | |
|
462 | 462 | def branches(self, nodes): |
|
463 | 463 | return self._repo.branches(nodes) |
|
464 | 464 | |
|
465 | 465 | def changegroup(self, nodes, source): |
|
466 | 466 | outgoing = discovery.outgoing( |
|
467 | 467 | self._repo, missingroots=nodes, ancestorsof=self._repo.heads() |
|
468 | 468 | ) |
|
469 | 469 | return changegroup.makechangegroup(self._repo, outgoing, b'01', source) |
|
470 | 470 | |
|
471 | 471 | def changegroupsubset(self, bases, heads, source): |
|
472 | 472 | outgoing = discovery.outgoing( |
|
473 | 473 | self._repo, missingroots=bases, ancestorsof=heads |
|
474 | 474 | ) |
|
475 | 475 | return changegroup.makechangegroup(self._repo, outgoing, b'01', source) |
|
476 | 476 | |
|
477 | 477 | # End of baselegacywirecommands interface. |
|
478 | 478 | |
|
479 | 479 | |
|
480 | 480 | # Functions receiving (ui, features) that extensions can register to impact |
|
481 | 481 | # the ability to load repositories with custom requirements. Only |
|
482 | 482 | # functions defined in loaded extensions are called. |
|
483 | 483 | # |
|
484 | 484 | # The function receives a set of requirement strings that the repository |
|
485 | 485 | # is capable of opening. Functions will typically add elements to the |
|
486 | 486 | # set to reflect that the extension knows how to handle that requirements. |
|
487 | 487 | featuresetupfuncs = set() |
|
488 | 488 | |
|
489 | 489 | |
|
490 | 490 | def _getsharedvfs(hgvfs, requirements): |
|
491 | 491 | """returns the vfs object pointing to root of shared source |
|
492 | 492 | repo for a shared repository |
|
493 | 493 | |
|
494 | 494 | hgvfs is vfs pointing at .hg/ of current repo (shared one) |
|
495 | 495 | requirements is a set of requirements of current repo (shared one) |
|
496 | 496 | """ |
|
497 | 497 | # The ``shared`` or ``relshared`` requirements indicate the |
|
498 | 498 | # store lives in the path contained in the ``.hg/sharedpath`` file. |
|
499 | 499 | # This is an absolute path for ``shared`` and relative to |
|
500 | 500 | # ``.hg/`` for ``relshared``. |
|
501 | 501 | sharedpath = hgvfs.read(b'sharedpath').rstrip(b'\n') |
|
502 | 502 | if requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements: |
|
503 | 503 | sharedpath = util.normpath(hgvfs.join(sharedpath)) |
|
504 | 504 | |
|
505 | 505 | sharedvfs = vfsmod.vfs(sharedpath, realpath=True) |
|
506 | 506 | |
|
507 | 507 | if not sharedvfs.exists(): |
|
508 | 508 | raise error.RepoError( |
|
509 | 509 | _(b'.hg/sharedpath points to nonexistent directory %s') |
|
510 | 510 | % sharedvfs.base |
|
511 | 511 | ) |
|
512 | 512 | return sharedvfs |
|
513 | 513 | |
|
514 | 514 | |
|
515 | 515 | def _readrequires(vfs, allowmissing): |
|
516 | 516 | """reads the require file present at root of this vfs |
|
517 | 517 | and return a set of requirements |
|
518 | 518 | |
|
519 | 519 | If allowmissing is True, we suppress ENOENT if raised""" |
|
520 | 520 | # requires file contains a newline-delimited list of |
|
521 | 521 | # features/capabilities the opener (us) must have in order to use |
|
522 | 522 | # the repository. This file was introduced in Mercurial 0.9.2, |
|
523 | 523 | # which means very old repositories may not have one. We assume |
|
524 | 524 | # a missing file translates to no requirements. |
|
525 | 525 | try: |
|
526 | 526 | requirements = set(vfs.read(b'requires').splitlines()) |
|
527 | 527 | except IOError as e: |
|
528 | 528 | if not (allowmissing and e.errno == errno.ENOENT): |
|
529 | 529 | raise |
|
530 | 530 | requirements = set() |
|
531 | 531 | return requirements |
|
532 | 532 | |
|
533 | 533 | |
|
534 | 534 | def makelocalrepository(baseui, path, intents=None): |
|
535 | 535 | """Create a local repository object. |
|
536 | 536 | |
|
537 | 537 | Given arguments needed to construct a local repository, this function |
|
538 | 538 | performs various early repository loading functionality (such as |
|
539 | 539 | reading the ``.hg/requires`` and ``.hg/hgrc`` files), validates that |
|
540 | 540 | the repository can be opened, derives a type suitable for representing |
|
541 | 541 | that repository, and returns an instance of it. |
|
542 | 542 | |
|
543 | 543 | The returned object conforms to the ``repository.completelocalrepository`` |
|
544 | 544 | interface. |
|
545 | 545 | |
|
546 | 546 | The repository type is derived by calling a series of factory functions |
|
547 | 547 | for each aspect/interface of the final repository. These are defined by |
|
548 | 548 | ``REPO_INTERFACES``. |
|
549 | 549 | |
|
550 | 550 | Each factory function is called to produce a type implementing a specific |
|
551 | 551 | interface. The cumulative list of returned types will be combined into a |
|
552 | 552 | new type and that type will be instantiated to represent the local |
|
553 | 553 | repository. |
|
554 | 554 | |
|
555 | 555 | The factory functions each receive various state that may be consulted |
|
556 | 556 | as part of deriving a type. |
|
557 | 557 | |
|
558 | 558 | Extensions should wrap these factory functions to customize repository type |
|
559 | 559 | creation. Note that an extension's wrapped function may be called even if |
|
560 | 560 | that extension is not loaded for the repo being constructed. Extensions |
|
561 | 561 | should check if their ``__name__`` appears in the |
|
562 | 562 | ``extensionmodulenames`` set passed to the factory function and no-op if |
|
563 | 563 | not. |
|
564 | 564 | """ |
|
565 | 565 | ui = baseui.copy() |
|
566 | 566 | # Prevent copying repo configuration. |
|
567 | 567 | ui.copy = baseui.copy |
|
568 | 568 | |
|
569 | 569 | # Working directory VFS rooted at repository root. |
|
570 | 570 | wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True) |
|
571 | 571 | |
|
572 | 572 | # Main VFS for .hg/ directory. |
|
573 | 573 | hgpath = wdirvfs.join(b'.hg') |
|
574 | 574 | hgvfs = vfsmod.vfs(hgpath, cacheaudited=True) |
|
575 | 575 | # Whether this repository is shared one or not |
|
576 | 576 | shared = False |
|
577 | 577 | # If this repository is shared, vfs pointing to shared repo |
|
578 | 578 | sharedvfs = None |
|
579 | 579 | |
|
580 | 580 | # The .hg/ path should exist and should be a directory. All other |
|
581 | 581 | # cases are errors. |
|
582 | 582 | if not hgvfs.isdir(): |
|
583 | 583 | try: |
|
584 | 584 | hgvfs.stat() |
|
585 | 585 | except OSError as e: |
|
586 | 586 | if e.errno != errno.ENOENT: |
|
587 | 587 | raise |
|
588 | 588 | except ValueError as e: |
|
589 | 589 | # Can be raised on Python 3.8 when path is invalid. |
|
590 | 590 | raise error.Abort( |
|
591 | 591 | _(b'invalid path %s: %s') % (path, stringutil.forcebytestr(e)) |
|
592 | 592 | ) |
|
593 | 593 | |
|
594 | 594 | raise error.RepoError(_(b'repository %s not found') % path) |
|
595 | 595 | |
|
596 | 596 | requirements = _readrequires(hgvfs, True) |
|
597 | 597 | shared = ( |
|
598 | 598 | requirementsmod.SHARED_REQUIREMENT in requirements |
|
599 | 599 | or requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements |
|
600 | 600 | ) |
|
601 | 601 | storevfs = None |
|
602 | 602 | if shared: |
|
603 | 603 | # This is a shared repo |
|
604 | 604 | sharedvfs = _getsharedvfs(hgvfs, requirements) |
|
605 | 605 | storevfs = vfsmod.vfs(sharedvfs.join(b'store')) |
|
606 | 606 | else: |
|
607 | 607 | storevfs = vfsmod.vfs(hgvfs.join(b'store')) |
|
608 | 608 | |
|
609 | 609 | # if .hg/requires contains the sharesafe requirement, it means |
|
610 | 610 | # there exists a `.hg/store/requires` too and we should read it |
|
611 | 611 | # NOTE: presence of SHARESAFE_REQUIREMENT imply that store requirement |
|
612 | 612 | # is present. We never write SHARESAFE_REQUIREMENT for a repo if store |
|
613 | 613 | # is not present, refer checkrequirementscompat() for that |
|
614 | 614 | # |
|
615 | 615 | # However, if SHARESAFE_REQUIREMENT is not present, it means that the |
|
616 | 616 | # repository was shared the old way. We check the share source .hg/requires |
|
617 | 617 | # for SHARESAFE_REQUIREMENT to detect whether the current repository needs |
|
618 | 618 | # to be reshared |
|
619 | 619 | hint = _(b"see `hg help config.format.use-share-safe` for more information") |
|
620 | 620 | if requirementsmod.SHARESAFE_REQUIREMENT in requirements: |
|
621 | 621 | |
|
622 | 622 | if ( |
|
623 | 623 | shared |
|
624 | 624 | and requirementsmod.SHARESAFE_REQUIREMENT |
|
625 | 625 | not in _readrequires(sharedvfs, True) |
|
626 | 626 | ): |
|
627 | 627 | mismatch_warn = ui.configbool( |
|
628 | 628 | b'share', b'safe-mismatch.source-not-safe.warn' |
|
629 | 629 | ) |
|
630 | 630 | mismatch_config = ui.config( |
|
631 | 631 | b'share', b'safe-mismatch.source-not-safe' |
|
632 | 632 | ) |
|
633 | 633 | if mismatch_config in ( |
|
634 | 634 | b'downgrade-allow', |
|
635 | 635 | b'allow', |
|
636 | 636 | b'downgrade-abort', |
|
637 | 637 | ): |
|
638 | 638 | # prevent cyclic import localrepo -> upgrade -> localrepo |
|
639 | 639 | from . import upgrade |
|
640 | 640 | |
|
641 | 641 | upgrade.downgrade_share_to_non_safe( |
|
642 | 642 | ui, |
|
643 | 643 | hgvfs, |
|
644 | 644 | sharedvfs, |
|
645 | 645 | requirements, |
|
646 | 646 | mismatch_config, |
|
647 | 647 | mismatch_warn, |
|
648 | 648 | ) |
|
649 | 649 | elif mismatch_config == b'abort': |
|
650 | 650 | raise error.Abort( |
|
651 | 651 | _(b"share source does not support share-safe requirement"), |
|
652 | 652 | hint=hint, |
|
653 | 653 | ) |
|
654 | 654 | else: |
|
655 | 655 | raise error.Abort( |
|
656 | 656 | _( |
|
657 | 657 | b"share-safe mismatch with source.\nUnrecognized" |
|
658 | 658 | b" value '%s' of `share.safe-mismatch.source-not-safe`" |
|
659 | 659 | b" set." |
|
660 | 660 | ) |
|
661 | 661 | % mismatch_config, |
|
662 | 662 | hint=hint, |
|
663 | 663 | ) |
|
664 | 664 | else: |
|
665 | 665 | requirements |= _readrequires(storevfs, False) |
|
666 | 666 | elif shared: |
|
667 | 667 | sourcerequires = _readrequires(sharedvfs, False) |
|
668 | 668 | if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires: |
|
669 | 669 | mismatch_config = ui.config(b'share', b'safe-mismatch.source-safe') |
|
670 | 670 | mismatch_warn = ui.configbool( |
|
671 | 671 | b'share', b'safe-mismatch.source-safe.warn' |
|
672 | 672 | ) |
|
673 | 673 | if mismatch_config in ( |
|
674 | 674 | b'upgrade-allow', |
|
675 | 675 | b'allow', |
|
676 | 676 | b'upgrade-abort', |
|
677 | 677 | ): |
|
678 | 678 | # prevent cyclic import localrepo -> upgrade -> localrepo |
|
679 | 679 | from . import upgrade |
|
680 | 680 | |
|
681 | 681 | upgrade.upgrade_share_to_safe( |
|
682 | 682 | ui, |
|
683 | 683 | hgvfs, |
|
684 | 684 | storevfs, |
|
685 | 685 | requirements, |
|
686 | 686 | mismatch_config, |
|
687 | 687 | mismatch_warn, |
|
688 | 688 | ) |
|
689 | 689 | elif mismatch_config == b'abort': |
|
690 | 690 | raise error.Abort( |
|
691 | 691 | _( |
|
692 | 692 | b'version mismatch: source uses share-safe' |
|
693 | 693 | b' functionality while the current share does not' |
|
694 | 694 | ), |
|
695 | 695 | hint=hint, |
|
696 | 696 | ) |
|
697 | 697 | else: |
|
698 | 698 | raise error.Abort( |
|
699 | 699 | _( |
|
700 | 700 | b"share-safe mismatch with source.\nUnrecognized" |
|
701 | 701 | b" value '%s' of `share.safe-mismatch.source-safe` set." |
|
702 | 702 | ) |
|
703 | 703 | % mismatch_config, |
|
704 | 704 | hint=hint, |
|
705 | 705 | ) |
|
706 | 706 | |
|
707 | 707 | # The .hg/hgrc file may load extensions or contain config options |
|
708 | 708 | # that influence repository construction. Attempt to load it and |
|
709 | 709 | # process any new extensions that it may have pulled in. |
|
710 | 710 | if loadhgrc(ui, wdirvfs, hgvfs, requirements, sharedvfs): |
|
711 | 711 | afterhgrcload(ui, wdirvfs, hgvfs, requirements) |
|
712 | 712 | extensions.loadall(ui) |
|
713 | 713 | extensions.populateui(ui) |
|
714 | 714 | |
|
715 | 715 | # Set of module names of extensions loaded for this repository. |
|
716 | 716 | extensionmodulenames = {m.__name__ for n, m in extensions.extensions(ui)} |
|
717 | 717 | |
|
718 | 718 | supportedrequirements = gathersupportedrequirements(ui) |
|
719 | 719 | |
|
720 | 720 | # We first validate the requirements are known. |
|
721 | 721 | ensurerequirementsrecognized(requirements, supportedrequirements) |
|
722 | 722 | |
|
723 | 723 | # Then we validate that the known set is reasonable to use together. |
|
724 | 724 | ensurerequirementscompatible(ui, requirements) |
|
725 | 725 | |
|
726 | 726 | # TODO there are unhandled edge cases related to opening repositories with |
|
727 | 727 | # shared storage. If storage is shared, we should also test for requirements |
|
728 | 728 | # compatibility in the pointed-to repo. This entails loading the .hg/hgrc in |
|
729 | 729 | # that repo, as that repo may load extensions needed to open it. This is a |
|
730 | 730 | # bit complicated because we don't want the other hgrc to overwrite settings |
|
731 | 731 | # in this hgrc. |
|
732 | 732 | # |
|
733 | 733 | # This bug is somewhat mitigated by the fact that we copy the .hg/requires |
|
734 | 734 | # file when sharing repos. But if a requirement is added after the share is |
|
735 | 735 | # performed, thereby introducing a new requirement for the opener, we may |
|
736 | 736 | # will not see that and could encounter a run-time error interacting with |
|
737 | 737 | # that shared store since it has an unknown-to-us requirement. |
|
738 | 738 | |
|
739 | 739 | # At this point, we know we should be capable of opening the repository. |
|
740 | 740 | # Now get on with doing that. |
|
741 | 741 | |
|
742 | 742 | features = set() |
|
743 | 743 | |
|
744 | 744 | # The "store" part of the repository holds versioned data. How it is |
|
745 | 745 | # accessed is determined by various requirements. If `shared` or |
|
746 | 746 | # `relshared` requirements are present, this indicates current repository |
|
747 | 747 | # is a share and store exists in path mentioned in `.hg/sharedpath` |
|
748 | 748 | if shared: |
|
749 | 749 | storebasepath = sharedvfs.base |
|
750 | 750 | cachepath = sharedvfs.join(b'cache') |
|
751 | 751 | features.add(repository.REPO_FEATURE_SHARED_STORAGE) |
|
752 | 752 | else: |
|
753 | 753 | storebasepath = hgvfs.base |
|
754 | 754 | cachepath = hgvfs.join(b'cache') |
|
755 | 755 | wcachepath = hgvfs.join(b'wcache') |
|
756 | 756 | |
|
757 | 757 | # The store has changed over time and the exact layout is dictated by |
|
758 | 758 | # requirements. The store interface abstracts differences across all |
|
759 | 759 | # of them. |
|
760 | 760 | store = makestore( |
|
761 | 761 | requirements, |
|
762 | 762 | storebasepath, |
|
763 | 763 | lambda base: vfsmod.vfs(base, cacheaudited=True), |
|
764 | 764 | ) |
|
765 | 765 | hgvfs.createmode = store.createmode |
|
766 | 766 | |
|
767 | 767 | storevfs = store.vfs |
|
768 | 768 | storevfs.options = resolvestorevfsoptions(ui, requirements, features) |
|
769 | 769 | |
|
770 | 770 | if ( |
|
771 | 771 | requirementsmod.REVLOGV2_REQUIREMENT in requirements |
|
772 | 772 | or requirementsmod.CHANGELOGV2_REQUIREMENT in requirements |
|
773 | 773 | ): |
|
774 | 774 | features.add(repository.REPO_FEATURE_SIDE_DATA) |
|
775 | 775 | # the revlogv2 docket introduced race condition that we need to fix |
|
776 | 776 | features.discard(repository.REPO_FEATURE_STREAM_CLONE) |
|
777 | 777 | |
|
778 | 778 | # The cache vfs is used to manage cache files. |
|
779 | 779 | cachevfs = vfsmod.vfs(cachepath, cacheaudited=True) |
|
780 | 780 | cachevfs.createmode = store.createmode |
|
781 | 781 | # The cache vfs is used to manage cache files related to the working copy |
|
782 | 782 | wcachevfs = vfsmod.vfs(wcachepath, cacheaudited=True) |
|
783 | 783 | wcachevfs.createmode = store.createmode |
|
784 | 784 | |
|
785 | 785 | # Now resolve the type for the repository object. We do this by repeatedly |
|
786 | 786 | # calling a factory function to produces types for specific aspects of the |
|
787 | 787 | # repo's operation. The aggregate returned types are used as base classes |
|
788 | 788 | # for a dynamically-derived type, which will represent our new repository. |
|
789 | 789 | |
|
790 | 790 | bases = [] |
|
791 | 791 | extrastate = {} |
|
792 | 792 | |
|
793 | 793 | for iface, fn in REPO_INTERFACES: |
|
794 | 794 | # We pass all potentially useful state to give extensions tons of |
|
795 | 795 | # flexibility. |
|
796 | 796 | typ = fn()( |
|
797 | 797 | ui=ui, |
|
798 | 798 | intents=intents, |
|
799 | 799 | requirements=requirements, |
|
800 | 800 | features=features, |
|
801 | 801 | wdirvfs=wdirvfs, |
|
802 | 802 | hgvfs=hgvfs, |
|
803 | 803 | store=store, |
|
804 | 804 | storevfs=storevfs, |
|
805 | 805 | storeoptions=storevfs.options, |
|
806 | 806 | cachevfs=cachevfs, |
|
807 | 807 | wcachevfs=wcachevfs, |
|
808 | 808 | extensionmodulenames=extensionmodulenames, |
|
809 | 809 | extrastate=extrastate, |
|
810 | 810 | baseclasses=bases, |
|
811 | 811 | ) |
|
812 | 812 | |
|
813 | 813 | if not isinstance(typ, type): |
|
814 | 814 | raise error.ProgrammingError( |
|
815 | 815 | b'unable to construct type for %s' % iface |
|
816 | 816 | ) |
|
817 | 817 | |
|
818 | 818 | bases.append(typ) |
|
819 | 819 | |
|
820 | 820 | # type() allows you to use characters in type names that wouldn't be |
|
821 | 821 | # recognized as Python symbols in source code. We abuse that to add |
|
822 | 822 | # rich information about our constructed repo. |
|
823 | 823 | name = pycompat.sysstr( |
|
824 | 824 | b'derivedrepo:%s<%s>' % (wdirvfs.base, b','.join(sorted(requirements))) |
|
825 | 825 | ) |
|
826 | 826 | |
|
827 | 827 | cls = type(name, tuple(bases), {}) |
|
828 | 828 | |
|
829 | 829 | return cls( |
|
830 | 830 | baseui=baseui, |
|
831 | 831 | ui=ui, |
|
832 | 832 | origroot=path, |
|
833 | 833 | wdirvfs=wdirvfs, |
|
834 | 834 | hgvfs=hgvfs, |
|
835 | 835 | requirements=requirements, |
|
836 | 836 | supportedrequirements=supportedrequirements, |
|
837 | 837 | sharedpath=storebasepath, |
|
838 | 838 | store=store, |
|
839 | 839 | cachevfs=cachevfs, |
|
840 | 840 | wcachevfs=wcachevfs, |
|
841 | 841 | features=features, |
|
842 | 842 | intents=intents, |
|
843 | 843 | ) |
|
844 | 844 | |
|
845 | 845 | |
|
846 | 846 | def loadhgrc(ui, wdirvfs, hgvfs, requirements, sharedvfs=None): |
|
847 | 847 | """Load hgrc files/content into a ui instance. |
|
848 | 848 | |
|
849 | 849 | This is called during repository opening to load any additional |
|
850 | 850 | config files or settings relevant to the current repository. |
|
851 | 851 | |
|
852 | 852 | Returns a bool indicating whether any additional configs were loaded. |
|
853 | 853 | |
|
854 | 854 | Extensions should monkeypatch this function to modify how per-repo |
|
855 | 855 | configs are loaded. For example, an extension may wish to pull in |
|
856 | 856 | configs from alternate files or sources. |
|
857 | 857 | |
|
858 | 858 | sharedvfs is vfs object pointing to source repo if the current one is a |
|
859 | 859 | shared one |
|
860 | 860 | """ |
|
861 | 861 | if not rcutil.use_repo_hgrc(): |
|
862 | 862 | return False |
|
863 | 863 | |
|
864 | 864 | ret = False |
|
865 | 865 | # first load config from shared source if we has to |
|
866 | 866 | if requirementsmod.SHARESAFE_REQUIREMENT in requirements and sharedvfs: |
|
867 | 867 | try: |
|
868 | 868 | ui.readconfig(sharedvfs.join(b'hgrc'), root=sharedvfs.base) |
|
869 | 869 | ret = True |
|
870 | 870 | except IOError: |
|
871 | 871 | pass |
|
872 | 872 | |
|
873 | 873 | try: |
|
874 | 874 | ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base) |
|
875 | 875 | ret = True |
|
876 | 876 | except IOError: |
|
877 | 877 | pass |
|
878 | 878 | |
|
879 | 879 | try: |
|
880 | 880 | ui.readconfig(hgvfs.join(b'hgrc-not-shared'), root=wdirvfs.base) |
|
881 | 881 | ret = True |
|
882 | 882 | except IOError: |
|
883 | 883 | pass |
|
884 | 884 | |
|
885 | 885 | return ret |
|
886 | 886 | |
|
887 | 887 | |
|
888 | 888 | def afterhgrcload(ui, wdirvfs, hgvfs, requirements): |
|
889 | 889 | """Perform additional actions after .hg/hgrc is loaded. |
|
890 | 890 | |
|
891 | 891 | This function is called during repository loading immediately after |
|
892 | 892 | the .hg/hgrc file is loaded and before per-repo extensions are loaded. |
|
893 | 893 | |
|
894 | 894 | The function can be used to validate configs, automatically add |
|
895 | 895 | options (including extensions) based on requirements, etc. |
|
896 | 896 | """ |
|
897 | 897 | |
|
898 | 898 | # Map of requirements to list of extensions to load automatically when |
|
899 | 899 | # requirement is present. |
|
900 | 900 | autoextensions = { |
|
901 | 901 | b'git': [b'git'], |
|
902 | 902 | b'largefiles': [b'largefiles'], |
|
903 | 903 | b'lfs': [b'lfs'], |
|
904 | 904 | } |
|
905 | 905 | |
|
906 | 906 | for requirement, names in sorted(autoextensions.items()): |
|
907 | 907 | if requirement not in requirements: |
|
908 | 908 | continue |
|
909 | 909 | |
|
910 | 910 | for name in names: |
|
911 | 911 | if not ui.hasconfig(b'extensions', name): |
|
912 | 912 | ui.setconfig(b'extensions', name, b'', source=b'autoload') |
|
913 | 913 | |
|
914 | 914 | |
|
915 | 915 | def gathersupportedrequirements(ui): |
|
916 | 916 | """Determine the complete set of recognized requirements.""" |
|
917 | 917 | # Start with all requirements supported by this file. |
|
918 | 918 | supported = set(localrepository._basesupported) |
|
919 | 919 | |
|
920 | 920 | # Execute ``featuresetupfuncs`` entries if they belong to an extension |
|
921 | 921 | # relevant to this ui instance. |
|
922 | 922 | modules = {m.__name__ for n, m in extensions.extensions(ui)} |
|
923 | 923 | |
|
924 | 924 | for fn in featuresetupfuncs: |
|
925 | 925 | if fn.__module__ in modules: |
|
926 | 926 | fn(ui, supported) |
|
927 | 927 | |
|
928 | 928 | # Add derived requirements from registered compression engines. |
|
929 | 929 | for name in util.compengines: |
|
930 | 930 | engine = util.compengines[name] |
|
931 | 931 | if engine.available() and engine.revlogheader(): |
|
932 | 932 | supported.add(b'exp-compression-%s' % name) |
|
933 | 933 | if engine.name() == b'zstd': |
|
934 | 934 | supported.add(b'revlog-compression-zstd') |
|
935 | 935 | |
|
936 | 936 | return supported |
|
937 | 937 | |
|
938 | 938 | |
|
939 | 939 | def ensurerequirementsrecognized(requirements, supported): |
|
940 | 940 | """Validate that a set of local requirements is recognized. |
|
941 | 941 | |
|
942 | 942 | Receives a set of requirements. Raises an ``error.RepoError`` if there |
|
943 | 943 | exists any requirement in that set that currently loaded code doesn't |
|
944 | 944 | recognize. |
|
945 | 945 | |
|
946 | 946 | Returns a set of supported requirements. |
|
947 | 947 | """ |
|
948 | 948 | missing = set() |
|
949 | 949 | |
|
950 | 950 | for requirement in requirements: |
|
951 | 951 | if requirement in supported: |
|
952 | 952 | continue |
|
953 | 953 | |
|
954 | 954 | if not requirement or not requirement[0:1].isalnum(): |
|
955 | 955 | raise error.RequirementError(_(b'.hg/requires file is corrupt')) |
|
956 | 956 | |
|
957 | 957 | missing.add(requirement) |
|
958 | 958 | |
|
959 | 959 | if missing: |
|
960 | 960 | raise error.RequirementError( |
|
961 | 961 | _(b'repository requires features unknown to this Mercurial: %s') |
|
962 | 962 | % b' '.join(sorted(missing)), |
|
963 | 963 | hint=_( |
|
964 | 964 | b'see https://mercurial-scm.org/wiki/MissingRequirement ' |
|
965 | 965 | b'for more information' |
|
966 | 966 | ), |
|
967 | 967 | ) |
|
968 | 968 | |
|
969 | 969 | |
|
970 | 970 | def ensurerequirementscompatible(ui, requirements): |
|
971 | 971 | """Validates that a set of recognized requirements is mutually compatible. |
|
972 | 972 | |
|
973 | 973 | Some requirements may not be compatible with others or require |
|
974 | 974 | config options that aren't enabled. This function is called during |
|
975 | 975 | repository opening to ensure that the set of requirements needed |
|
976 | 976 | to open a repository is sane and compatible with config options. |
|
977 | 977 | |
|
978 | 978 | Extensions can monkeypatch this function to perform additional |
|
979 | 979 | checking. |
|
980 | 980 | |
|
981 | 981 | ``error.RepoError`` should be raised on failure. |
|
982 | 982 | """ |
|
983 | 983 | if ( |
|
984 | 984 | requirementsmod.SPARSE_REQUIREMENT in requirements |
|
985 | 985 | and not sparse.enabled |
|
986 | 986 | ): |
|
987 | 987 | raise error.RepoError( |
|
988 | 988 | _( |
|
989 | 989 | b'repository is using sparse feature but ' |
|
990 | 990 | b'sparse is not enabled; enable the ' |
|
991 | 991 | b'"sparse" extensions to access' |
|
992 | 992 | ) |
|
993 | 993 | ) |
|
994 | 994 | |
|
995 | 995 | |
|
996 | 996 | def makestore(requirements, path, vfstype): |
|
997 | 997 | """Construct a storage object for a repository.""" |
|
998 | 998 | if requirementsmod.STORE_REQUIREMENT in requirements: |
|
999 | 999 | if requirementsmod.FNCACHE_REQUIREMENT in requirements: |
|
1000 | 1000 | dotencode = requirementsmod.DOTENCODE_REQUIREMENT in requirements |
|
1001 | 1001 | return storemod.fncachestore(path, vfstype, dotencode) |
|
1002 | 1002 | |
|
1003 | 1003 | return storemod.encodedstore(path, vfstype) |
|
1004 | 1004 | |
|
1005 | 1005 | return storemod.basicstore(path, vfstype) |
|
1006 | 1006 | |
|
1007 | 1007 | |
|
1008 | 1008 | def resolvestorevfsoptions(ui, requirements, features): |
|
1009 | 1009 | """Resolve the options to pass to the store vfs opener. |
|
1010 | 1010 | |
|
1011 | 1011 | The returned dict is used to influence behavior of the storage layer. |
|
1012 | 1012 | """ |
|
1013 | 1013 | options = {} |
|
1014 | 1014 | |
|
1015 | 1015 | if requirementsmod.TREEMANIFEST_REQUIREMENT in requirements: |
|
1016 | 1016 | options[b'treemanifest'] = True |
|
1017 | 1017 | |
|
1018 | 1018 | # experimental config: format.manifestcachesize |
|
1019 | 1019 | manifestcachesize = ui.configint(b'format', b'manifestcachesize') |
|
1020 | 1020 | if manifestcachesize is not None: |
|
1021 | 1021 | options[b'manifestcachesize'] = manifestcachesize |
|
1022 | 1022 | |
|
1023 | 1023 | # In the absence of another requirement superseding a revlog-related |
|
1024 | 1024 | # requirement, we have to assume the repo is using revlog version 0. |
|
1025 | 1025 | # This revlog format is super old and we don't bother trying to parse |
|
1026 | 1026 | # opener options for it because those options wouldn't do anything |
|
1027 | 1027 | # meaningful on such old repos. |
|
1028 | 1028 | if ( |
|
1029 | 1029 | requirementsmod.REVLOGV1_REQUIREMENT in requirements |
|
1030 | 1030 | or requirementsmod.REVLOGV2_REQUIREMENT in requirements |
|
1031 | 1031 | ): |
|
1032 | 1032 | options.update(resolverevlogstorevfsoptions(ui, requirements, features)) |
|
1033 | 1033 | else: # explicitly mark repo as using revlogv0 |
|
1034 | 1034 | options[b'revlogv0'] = True |
|
1035 | 1035 | |
|
1036 | 1036 | if requirementsmod.COPIESSDC_REQUIREMENT in requirements: |
|
1037 | 1037 | options[b'copies-storage'] = b'changeset-sidedata' |
|
1038 | 1038 | else: |
|
1039 | 1039 | writecopiesto = ui.config(b'experimental', b'copies.write-to') |
|
1040 | 1040 | copiesextramode = (b'changeset-only', b'compatibility') |
|
1041 | 1041 | if writecopiesto in copiesextramode: |
|
1042 | 1042 | options[b'copies-storage'] = b'extra' |
|
1043 | 1043 | |
|
1044 | 1044 | return options |
|
1045 | 1045 | |
|
1046 | 1046 | |
|
1047 | 1047 | def resolverevlogstorevfsoptions(ui, requirements, features): |
|
1048 | 1048 | """Resolve opener options specific to revlogs.""" |
|
1049 | 1049 | |
|
1050 | 1050 | options = {} |
|
1051 | 1051 | options[b'flagprocessors'] = {} |
|
1052 | 1052 | |
|
1053 | 1053 | if requirementsmod.REVLOGV1_REQUIREMENT in requirements: |
|
1054 | 1054 | options[b'revlogv1'] = True |
|
1055 | 1055 | if requirementsmod.REVLOGV2_REQUIREMENT in requirements: |
|
1056 | 1056 | options[b'revlogv2'] = True |
|
1057 | 1057 | if requirementsmod.CHANGELOGV2_REQUIREMENT in requirements: |
|
1058 | 1058 | options[b'changelogv2'] = True |
|
1059 | 1059 | |
|
1060 | 1060 | if requirementsmod.GENERALDELTA_REQUIREMENT in requirements: |
|
1061 | 1061 | options[b'generaldelta'] = True |
|
1062 | 1062 | |
|
1063 | 1063 | # experimental config: format.chunkcachesize |
|
1064 | 1064 | chunkcachesize = ui.configint(b'format', b'chunkcachesize') |
|
1065 | 1065 | if chunkcachesize is not None: |
|
1066 | 1066 | options[b'chunkcachesize'] = chunkcachesize |
|
1067 | 1067 | |
|
1068 | 1068 | deltabothparents = ui.configbool( |
|
1069 | 1069 | b'storage', b'revlog.optimize-delta-parent-choice' |
|
1070 | 1070 | ) |
|
1071 | 1071 | options[b'deltabothparents'] = deltabothparents |
|
1072 | 1072 | |
|
1073 | 1073 | issue6528 = ui.configbool(b'storage', b'revlog.issue6528.fix-incoming') |
|
1074 | 1074 | options[b'issue6528.fix-incoming'] = issue6528 |
|
1075 | 1075 | |
|
1076 | 1076 | lazydelta = ui.configbool(b'storage', b'revlog.reuse-external-delta') |
|
1077 | 1077 | lazydeltabase = False |
|
1078 | 1078 | if lazydelta: |
|
1079 | 1079 | lazydeltabase = ui.configbool( |
|
1080 | 1080 | b'storage', b'revlog.reuse-external-delta-parent' |
|
1081 | 1081 | ) |
|
1082 | 1082 | if lazydeltabase is None: |
|
1083 | 1083 | lazydeltabase = not scmutil.gddeltaconfig(ui) |
|
1084 | 1084 | options[b'lazydelta'] = lazydelta |
|
1085 | 1085 | options[b'lazydeltabase'] = lazydeltabase |
|
1086 | 1086 | |
|
1087 | 1087 | chainspan = ui.configbytes(b'experimental', b'maxdeltachainspan') |
|
1088 | 1088 | if 0 <= chainspan: |
|
1089 | 1089 | options[b'maxdeltachainspan'] = chainspan |
|
1090 | 1090 | |
|
1091 | 1091 | mmapindexthreshold = ui.configbytes(b'experimental', b'mmapindexthreshold') |
|
1092 | 1092 | if mmapindexthreshold is not None: |
|
1093 | 1093 | options[b'mmapindexthreshold'] = mmapindexthreshold |
|
1094 | 1094 | |
|
1095 | 1095 | withsparseread = ui.configbool(b'experimental', b'sparse-read') |
|
1096 | 1096 | srdensitythres = float( |
|
1097 | 1097 | ui.config(b'experimental', b'sparse-read.density-threshold') |
|
1098 | 1098 | ) |
|
1099 | 1099 | srmingapsize = ui.configbytes(b'experimental', b'sparse-read.min-gap-size') |
|
1100 | 1100 | options[b'with-sparse-read'] = withsparseread |
|
1101 | 1101 | options[b'sparse-read-density-threshold'] = srdensitythres |
|
1102 | 1102 | options[b'sparse-read-min-gap-size'] = srmingapsize |
|
1103 | 1103 | |
|
1104 | 1104 | sparserevlog = requirementsmod.SPARSEREVLOG_REQUIREMENT in requirements |
|
1105 | 1105 | options[b'sparse-revlog'] = sparserevlog |
|
1106 | 1106 | if sparserevlog: |
|
1107 | 1107 | options[b'generaldelta'] = True |
|
1108 | 1108 | |
|
1109 | 1109 | maxchainlen = None |
|
1110 | 1110 | if sparserevlog: |
|
1111 | 1111 | maxchainlen = revlogconst.SPARSE_REVLOG_MAX_CHAIN_LENGTH |
|
1112 | 1112 | # experimental config: format.maxchainlen |
|
1113 | 1113 | maxchainlen = ui.configint(b'format', b'maxchainlen', maxchainlen) |
|
1114 | 1114 | if maxchainlen is not None: |
|
1115 | 1115 | options[b'maxchainlen'] = maxchainlen |
|
1116 | 1116 | |
|
1117 | 1117 | for r in requirements: |
|
1118 | 1118 | # we allow multiple compression engine requirement to co-exist because |
|
1119 | 1119 | # strickly speaking, revlog seems to support mixed compression style. |
|
1120 | 1120 | # |
|
1121 | 1121 | # The compression used for new entries will be "the last one" |
|
1122 | 1122 | prefix = r.startswith |
|
1123 | 1123 | if prefix(b'revlog-compression-') or prefix(b'exp-compression-'): |
|
1124 | 1124 | options[b'compengine'] = r.split(b'-', 2)[2] |
|
1125 | 1125 | |
|
1126 | 1126 | options[b'zlib.level'] = ui.configint(b'storage', b'revlog.zlib.level') |
|
1127 | 1127 | if options[b'zlib.level'] is not None: |
|
1128 | 1128 | if not (0 <= options[b'zlib.level'] <= 9): |
|
1129 | 1129 | msg = _(b'invalid value for `storage.revlog.zlib.level` config: %d') |
|
1130 | 1130 | raise error.Abort(msg % options[b'zlib.level']) |
|
1131 | 1131 | options[b'zstd.level'] = ui.configint(b'storage', b'revlog.zstd.level') |
|
1132 | 1132 | if options[b'zstd.level'] is not None: |
|
1133 | 1133 | if not (0 <= options[b'zstd.level'] <= 22): |
|
1134 | 1134 | msg = _(b'invalid value for `storage.revlog.zstd.level` config: %d') |
|
1135 | 1135 | raise error.Abort(msg % options[b'zstd.level']) |
|
1136 | 1136 | |
|
1137 | 1137 | if requirementsmod.NARROW_REQUIREMENT in requirements: |
|
1138 | 1138 | options[b'enableellipsis'] = True |
|
1139 | 1139 | |
|
1140 | 1140 | if ui.configbool(b'experimental', b'rust.index'): |
|
1141 | 1141 | options[b'rust.index'] = True |
|
1142 | 1142 | if requirementsmod.NODEMAP_REQUIREMENT in requirements: |
|
1143 | 1143 | slow_path = ui.config( |
|
1144 | 1144 | b'storage', b'revlog.persistent-nodemap.slow-path' |
|
1145 | 1145 | ) |
|
1146 | 1146 | if slow_path not in (b'allow', b'warn', b'abort'): |
|
1147 | 1147 | default = ui.config_default( |
|
1148 | 1148 | b'storage', b'revlog.persistent-nodemap.slow-path' |
|
1149 | 1149 | ) |
|
1150 | 1150 | msg = _( |
|
1151 | 1151 | b'unknown value for config ' |
|
1152 | 1152 | b'"storage.revlog.persistent-nodemap.slow-path": "%s"\n' |
|
1153 | 1153 | ) |
|
1154 | 1154 | ui.warn(msg % slow_path) |
|
1155 | 1155 | if not ui.quiet: |
|
1156 | 1156 | ui.warn(_(b'falling back to default value: %s\n') % default) |
|
1157 | 1157 | slow_path = default |
|
1158 | 1158 | |
|
1159 | 1159 | msg = _( |
|
1160 | 1160 | b"accessing `persistent-nodemap` repository without associated " |
|
1161 | 1161 | b"fast implementation." |
|
1162 | 1162 | ) |
|
1163 | 1163 | hint = _( |
|
1164 | 1164 | b"check `hg help config.format.use-persistent-nodemap` " |
|
1165 | 1165 | b"for details" |
|
1166 | 1166 | ) |
|
1167 | 1167 | if not revlog.HAS_FAST_PERSISTENT_NODEMAP: |
|
1168 | 1168 | if slow_path == b'warn': |
|
1169 | 1169 | msg = b"warning: " + msg + b'\n' |
|
1170 | 1170 | ui.warn(msg) |
|
1171 | 1171 | if not ui.quiet: |
|
1172 | 1172 | hint = b'(' + hint + b')\n' |
|
1173 | 1173 | ui.warn(hint) |
|
1174 | 1174 | if slow_path == b'abort': |
|
1175 | 1175 | raise error.Abort(msg, hint=hint) |
|
1176 | 1176 | options[b'persistent-nodemap'] = True |
|
1177 | 1177 | if requirementsmod.DIRSTATE_V2_REQUIREMENT in requirements: |
|
1178 | 1178 | slow_path = ui.config(b'storage', b'dirstate-v2.slow-path') |
|
1179 | 1179 | if slow_path not in (b'allow', b'warn', b'abort'): |
|
1180 | 1180 | default = ui.config_default(b'storage', b'dirstate-v2.slow-path') |
|
1181 | 1181 | msg = _(b'unknown value for config "dirstate-v2.slow-path": "%s"\n') |
|
1182 | 1182 | ui.warn(msg % slow_path) |
|
1183 | 1183 | if not ui.quiet: |
|
1184 | 1184 | ui.warn(_(b'falling back to default value: %s\n') % default) |
|
1185 | 1185 | slow_path = default |
|
1186 | 1186 | |
|
1187 | 1187 | msg = _( |
|
1188 | 1188 | b"accessing `dirstate-v2` repository without associated " |
|
1189 | 1189 | b"fast implementation." |
|
1190 | 1190 | ) |
|
1191 | 1191 | hint = _( |
|
1192 |
b"check `hg help config.format.e |
|
|
1192 | b"check `hg help config.format.use-dirstate-v2` " b"for details" | |
|
1193 | 1193 | ) |
|
1194 | 1194 | if not dirstate.HAS_FAST_DIRSTATE_V2: |
|
1195 | 1195 | if slow_path == b'warn': |
|
1196 | 1196 | msg = b"warning: " + msg + b'\n' |
|
1197 | 1197 | ui.warn(msg) |
|
1198 | 1198 | if not ui.quiet: |
|
1199 | 1199 | hint = b'(' + hint + b')\n' |
|
1200 | 1200 | ui.warn(hint) |
|
1201 | 1201 | if slow_path == b'abort': |
|
1202 | 1202 | raise error.Abort(msg, hint=hint) |
|
1203 | 1203 | if ui.configbool(b'storage', b'revlog.persistent-nodemap.mmap'): |
|
1204 | 1204 | options[b'persistent-nodemap.mmap'] = True |
|
1205 | 1205 | if ui.configbool(b'devel', b'persistent-nodemap'): |
|
1206 | 1206 | options[b'devel-force-nodemap'] = True |
|
1207 | 1207 | |
|
1208 | 1208 | return options |
|
1209 | 1209 | |
|
1210 | 1210 | |
|
1211 | 1211 | def makemain(**kwargs): |
|
1212 | 1212 | """Produce a type conforming to ``ilocalrepositorymain``.""" |
|
1213 | 1213 | return localrepository |
|
1214 | 1214 | |
|
1215 | 1215 | |
|
1216 | 1216 | @interfaceutil.implementer(repository.ilocalrepositoryfilestorage) |
|
1217 | 1217 | class revlogfilestorage(object): |
|
1218 | 1218 | """File storage when using revlogs.""" |
|
1219 | 1219 | |
|
1220 | 1220 | def file(self, path): |
|
1221 | 1221 | if path.startswith(b'/'): |
|
1222 | 1222 | path = path[1:] |
|
1223 | 1223 | |
|
1224 | 1224 | return filelog.filelog(self.svfs, path) |
|
1225 | 1225 | |
|
1226 | 1226 | |
|
1227 | 1227 | @interfaceutil.implementer(repository.ilocalrepositoryfilestorage) |
|
1228 | 1228 | class revlognarrowfilestorage(object): |
|
1229 | 1229 | """File storage when using revlogs and narrow files.""" |
|
1230 | 1230 | |
|
1231 | 1231 | def file(self, path): |
|
1232 | 1232 | if path.startswith(b'/'): |
|
1233 | 1233 | path = path[1:] |
|
1234 | 1234 | |
|
1235 | 1235 | return filelog.narrowfilelog(self.svfs, path, self._storenarrowmatch) |
|
1236 | 1236 | |
|
1237 | 1237 | |
|
1238 | 1238 | def makefilestorage(requirements, features, **kwargs): |
|
1239 | 1239 | """Produce a type conforming to ``ilocalrepositoryfilestorage``.""" |
|
1240 | 1240 | features.add(repository.REPO_FEATURE_REVLOG_FILE_STORAGE) |
|
1241 | 1241 | features.add(repository.REPO_FEATURE_STREAM_CLONE) |
|
1242 | 1242 | |
|
1243 | 1243 | if requirementsmod.NARROW_REQUIREMENT in requirements: |
|
1244 | 1244 | return revlognarrowfilestorage |
|
1245 | 1245 | else: |
|
1246 | 1246 | return revlogfilestorage |
|
1247 | 1247 | |
|
1248 | 1248 | |
|
1249 | 1249 | # List of repository interfaces and factory functions for them. Each |
|
1250 | 1250 | # will be called in order during ``makelocalrepository()`` to iteratively |
|
1251 | 1251 | # derive the final type for a local repository instance. We capture the |
|
1252 | 1252 | # function as a lambda so we don't hold a reference and the module-level |
|
1253 | 1253 | # functions can be wrapped. |
|
1254 | 1254 | REPO_INTERFACES = [ |
|
1255 | 1255 | (repository.ilocalrepositorymain, lambda: makemain), |
|
1256 | 1256 | (repository.ilocalrepositoryfilestorage, lambda: makefilestorage), |
|
1257 | 1257 | ] |
|
1258 | 1258 | |
|
1259 | 1259 | |
|
1260 | 1260 | @interfaceutil.implementer(repository.ilocalrepositorymain) |
|
1261 | 1261 | class localrepository(object): |
|
1262 | 1262 | """Main class for representing local repositories. |
|
1263 | 1263 | |
|
1264 | 1264 | All local repositories are instances of this class. |
|
1265 | 1265 | |
|
1266 | 1266 | Constructed on its own, instances of this class are not usable as |
|
1267 | 1267 | repository objects. To obtain a usable repository object, call |
|
1268 | 1268 | ``hg.repository()``, ``localrepo.instance()``, or |
|
1269 | 1269 | ``localrepo.makelocalrepository()``. The latter is the lowest-level. |
|
1270 | 1270 | ``instance()`` adds support for creating new repositories. |
|
1271 | 1271 | ``hg.repository()`` adds more extension integration, including calling |
|
1272 | 1272 | ``reposetup()``. Generally speaking, ``hg.repository()`` should be |
|
1273 | 1273 | used. |
|
1274 | 1274 | """ |
|
1275 | 1275 | |
|
1276 | 1276 | # obsolete experimental requirements: |
|
1277 | 1277 | # - manifestv2: An experimental new manifest format that allowed |
|
1278 | 1278 | # for stem compression of long paths. Experiment ended up not |
|
1279 | 1279 | # being successful (repository sizes went up due to worse delta |
|
1280 | 1280 | # chains), and the code was deleted in 4.6. |
|
1281 | 1281 | supportedformats = { |
|
1282 | 1282 | requirementsmod.REVLOGV1_REQUIREMENT, |
|
1283 | 1283 | requirementsmod.GENERALDELTA_REQUIREMENT, |
|
1284 | 1284 | requirementsmod.TREEMANIFEST_REQUIREMENT, |
|
1285 | 1285 | requirementsmod.COPIESSDC_REQUIREMENT, |
|
1286 | 1286 | requirementsmod.REVLOGV2_REQUIREMENT, |
|
1287 | 1287 | requirementsmod.CHANGELOGV2_REQUIREMENT, |
|
1288 | 1288 | requirementsmod.SPARSEREVLOG_REQUIREMENT, |
|
1289 | 1289 | requirementsmod.NODEMAP_REQUIREMENT, |
|
1290 | 1290 | bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT, |
|
1291 | 1291 | requirementsmod.SHARESAFE_REQUIREMENT, |
|
1292 | 1292 | requirementsmod.DIRSTATE_V2_REQUIREMENT, |
|
1293 | 1293 | } |
|
1294 | 1294 | _basesupported = supportedformats | { |
|
1295 | 1295 | requirementsmod.STORE_REQUIREMENT, |
|
1296 | 1296 | requirementsmod.FNCACHE_REQUIREMENT, |
|
1297 | 1297 | requirementsmod.SHARED_REQUIREMENT, |
|
1298 | 1298 | requirementsmod.RELATIVE_SHARED_REQUIREMENT, |
|
1299 | 1299 | requirementsmod.DOTENCODE_REQUIREMENT, |
|
1300 | 1300 | requirementsmod.SPARSE_REQUIREMENT, |
|
1301 | 1301 | requirementsmod.INTERNAL_PHASE_REQUIREMENT, |
|
1302 | 1302 | } |
|
1303 | 1303 | |
|
1304 | 1304 | # list of prefix for file which can be written without 'wlock' |
|
1305 | 1305 | # Extensions should extend this list when needed |
|
1306 | 1306 | _wlockfreeprefix = { |
|
1307 | 1307 | # We migh consider requiring 'wlock' for the next |
|
1308 | 1308 | # two, but pretty much all the existing code assume |
|
1309 | 1309 | # wlock is not needed so we keep them excluded for |
|
1310 | 1310 | # now. |
|
1311 | 1311 | b'hgrc', |
|
1312 | 1312 | b'requires', |
|
1313 | 1313 | # XXX cache is a complicatged business someone |
|
1314 | 1314 | # should investigate this in depth at some point |
|
1315 | 1315 | b'cache/', |
|
1316 | 1316 | # XXX shouldn't be dirstate covered by the wlock? |
|
1317 | 1317 | b'dirstate', |
|
1318 | 1318 | # XXX bisect was still a bit too messy at the time |
|
1319 | 1319 | # this changeset was introduced. Someone should fix |
|
1320 | 1320 | # the remainig bit and drop this line |
|
1321 | 1321 | b'bisect.state', |
|
1322 | 1322 | } |
|
1323 | 1323 | |
|
1324 | 1324 | def __init__( |
|
1325 | 1325 | self, |
|
1326 | 1326 | baseui, |
|
1327 | 1327 | ui, |
|
1328 | 1328 | origroot, |
|
1329 | 1329 | wdirvfs, |
|
1330 | 1330 | hgvfs, |
|
1331 | 1331 | requirements, |
|
1332 | 1332 | supportedrequirements, |
|
1333 | 1333 | sharedpath, |
|
1334 | 1334 | store, |
|
1335 | 1335 | cachevfs, |
|
1336 | 1336 | wcachevfs, |
|
1337 | 1337 | features, |
|
1338 | 1338 | intents=None, |
|
1339 | 1339 | ): |
|
1340 | 1340 | """Create a new local repository instance. |
|
1341 | 1341 | |
|
1342 | 1342 | Most callers should use ``hg.repository()``, ``localrepo.instance()``, |
|
1343 | 1343 | or ``localrepo.makelocalrepository()`` for obtaining a new repository |
|
1344 | 1344 | object. |
|
1345 | 1345 | |
|
1346 | 1346 | Arguments: |
|
1347 | 1347 | |
|
1348 | 1348 | baseui |
|
1349 | 1349 | ``ui.ui`` instance that ``ui`` argument was based off of. |
|
1350 | 1350 | |
|
1351 | 1351 | ui |
|
1352 | 1352 | ``ui.ui`` instance for use by the repository. |
|
1353 | 1353 | |
|
1354 | 1354 | origroot |
|
1355 | 1355 | ``bytes`` path to working directory root of this repository. |
|
1356 | 1356 | |
|
1357 | 1357 | wdirvfs |
|
1358 | 1358 | ``vfs.vfs`` rooted at the working directory. |
|
1359 | 1359 | |
|
1360 | 1360 | hgvfs |
|
1361 | 1361 | ``vfs.vfs`` rooted at .hg/ |
|
1362 | 1362 | |
|
1363 | 1363 | requirements |
|
1364 | 1364 | ``set`` of bytestrings representing repository opening requirements. |
|
1365 | 1365 | |
|
1366 | 1366 | supportedrequirements |
|
1367 | 1367 | ``set`` of bytestrings representing repository requirements that we |
|
1368 | 1368 | know how to open. May be a supetset of ``requirements``. |
|
1369 | 1369 | |
|
1370 | 1370 | sharedpath |
|
1371 | 1371 | ``bytes`` Defining path to storage base directory. Points to a |
|
1372 | 1372 | ``.hg/`` directory somewhere. |
|
1373 | 1373 | |
|
1374 | 1374 | store |
|
1375 | 1375 | ``store.basicstore`` (or derived) instance providing access to |
|
1376 | 1376 | versioned storage. |
|
1377 | 1377 | |
|
1378 | 1378 | cachevfs |
|
1379 | 1379 | ``vfs.vfs`` used for cache files. |
|
1380 | 1380 | |
|
1381 | 1381 | wcachevfs |
|
1382 | 1382 | ``vfs.vfs`` used for cache files related to the working copy. |
|
1383 | 1383 | |
|
1384 | 1384 | features |
|
1385 | 1385 | ``set`` of bytestrings defining features/capabilities of this |
|
1386 | 1386 | instance. |
|
1387 | 1387 | |
|
1388 | 1388 | intents |
|
1389 | 1389 | ``set`` of system strings indicating what this repo will be used |
|
1390 | 1390 | for. |
|
1391 | 1391 | """ |
|
1392 | 1392 | self.baseui = baseui |
|
1393 | 1393 | self.ui = ui |
|
1394 | 1394 | self.origroot = origroot |
|
1395 | 1395 | # vfs rooted at working directory. |
|
1396 | 1396 | self.wvfs = wdirvfs |
|
1397 | 1397 | self.root = wdirvfs.base |
|
1398 | 1398 | # vfs rooted at .hg/. Used to access most non-store paths. |
|
1399 | 1399 | self.vfs = hgvfs |
|
1400 | 1400 | self.path = hgvfs.base |
|
1401 | 1401 | self.requirements = requirements |
|
1402 | 1402 | self.nodeconstants = sha1nodeconstants |
|
1403 | 1403 | self.nullid = self.nodeconstants.nullid |
|
1404 | 1404 | self.supported = supportedrequirements |
|
1405 | 1405 | self.sharedpath = sharedpath |
|
1406 | 1406 | self.store = store |
|
1407 | 1407 | self.cachevfs = cachevfs |
|
1408 | 1408 | self.wcachevfs = wcachevfs |
|
1409 | 1409 | self.features = features |
|
1410 | 1410 | |
|
1411 | 1411 | self.filtername = None |
|
1412 | 1412 | |
|
1413 | 1413 | if self.ui.configbool(b'devel', b'all-warnings') or self.ui.configbool( |
|
1414 | 1414 | b'devel', b'check-locks' |
|
1415 | 1415 | ): |
|
1416 | 1416 | self.vfs.audit = self._getvfsward(self.vfs.audit) |
|
1417 | 1417 | # A list of callback to shape the phase if no data were found. |
|
1418 | 1418 | # Callback are in the form: func(repo, roots) --> processed root. |
|
1419 | 1419 | # This list it to be filled by extension during repo setup |
|
1420 | 1420 | self._phasedefaults = [] |
|
1421 | 1421 | |
|
1422 | 1422 | color.setup(self.ui) |
|
1423 | 1423 | |
|
1424 | 1424 | self.spath = self.store.path |
|
1425 | 1425 | self.svfs = self.store.vfs |
|
1426 | 1426 | self.sjoin = self.store.join |
|
1427 | 1427 | if self.ui.configbool(b'devel', b'all-warnings') or self.ui.configbool( |
|
1428 | 1428 | b'devel', b'check-locks' |
|
1429 | 1429 | ): |
|
1430 | 1430 | if util.safehasattr(self.svfs, b'vfs'): # this is filtervfs |
|
1431 | 1431 | self.svfs.vfs.audit = self._getsvfsward(self.svfs.vfs.audit) |
|
1432 | 1432 | else: # standard vfs |
|
1433 | 1433 | self.svfs.audit = self._getsvfsward(self.svfs.audit) |
|
1434 | 1434 | |
|
1435 | 1435 | self._dirstatevalidatewarned = False |
|
1436 | 1436 | |
|
1437 | 1437 | self._branchcaches = branchmap.BranchMapCache() |
|
1438 | 1438 | self._revbranchcache = None |
|
1439 | 1439 | self._filterpats = {} |
|
1440 | 1440 | self._datafilters = {} |
|
1441 | 1441 | self._transref = self._lockref = self._wlockref = None |
|
1442 | 1442 | |
|
1443 | 1443 | # A cache for various files under .hg/ that tracks file changes, |
|
1444 | 1444 | # (used by the filecache decorator) |
|
1445 | 1445 | # |
|
1446 | 1446 | # Maps a property name to its util.filecacheentry |
|
1447 | 1447 | self._filecache = {} |
|
1448 | 1448 | |
|
1449 | 1449 | # hold sets of revision to be filtered |
|
1450 | 1450 | # should be cleared when something might have changed the filter value: |
|
1451 | 1451 | # - new changesets, |
|
1452 | 1452 | # - phase change, |
|
1453 | 1453 | # - new obsolescence marker, |
|
1454 | 1454 | # - working directory parent change, |
|
1455 | 1455 | # - bookmark changes |
|
1456 | 1456 | self.filteredrevcache = {} |
|
1457 | 1457 | |
|
1458 | 1458 | # post-dirstate-status hooks |
|
1459 | 1459 | self._postdsstatus = [] |
|
1460 | 1460 | |
|
1461 | 1461 | # generic mapping between names and nodes |
|
1462 | 1462 | self.names = namespaces.namespaces() |
|
1463 | 1463 | |
|
1464 | 1464 | # Key to signature value. |
|
1465 | 1465 | self._sparsesignaturecache = {} |
|
1466 | 1466 | # Signature to cached matcher instance. |
|
1467 | 1467 | self._sparsematchercache = {} |
|
1468 | 1468 | |
|
1469 | 1469 | self._extrafilterid = repoview.extrafilter(ui) |
|
1470 | 1470 | |
|
1471 | 1471 | self.filecopiesmode = None |
|
1472 | 1472 | if requirementsmod.COPIESSDC_REQUIREMENT in self.requirements: |
|
1473 | 1473 | self.filecopiesmode = b'changeset-sidedata' |
|
1474 | 1474 | |
|
1475 | 1475 | self._wanted_sidedata = set() |
|
1476 | 1476 | self._sidedata_computers = {} |
|
1477 | 1477 | sidedatamod.set_sidedata_spec_for_repo(self) |
|
1478 | 1478 | |
|
1479 | 1479 | def _getvfsward(self, origfunc): |
|
1480 | 1480 | """build a ward for self.vfs""" |
|
1481 | 1481 | rref = weakref.ref(self) |
|
1482 | 1482 | |
|
1483 | 1483 | def checkvfs(path, mode=None): |
|
1484 | 1484 | ret = origfunc(path, mode=mode) |
|
1485 | 1485 | repo = rref() |
|
1486 | 1486 | if ( |
|
1487 | 1487 | repo is None |
|
1488 | 1488 | or not util.safehasattr(repo, b'_wlockref') |
|
1489 | 1489 | or not util.safehasattr(repo, b'_lockref') |
|
1490 | 1490 | ): |
|
1491 | 1491 | return |
|
1492 | 1492 | if mode in (None, b'r', b'rb'): |
|
1493 | 1493 | return |
|
1494 | 1494 | if path.startswith(repo.path): |
|
1495 | 1495 | # truncate name relative to the repository (.hg) |
|
1496 | 1496 | path = path[len(repo.path) + 1 :] |
|
1497 | 1497 | if path.startswith(b'cache/'): |
|
1498 | 1498 | msg = b'accessing cache with vfs instead of cachevfs: "%s"' |
|
1499 | 1499 | repo.ui.develwarn(msg % path, stacklevel=3, config=b"cache-vfs") |
|
1500 | 1500 | # path prefixes covered by 'lock' |
|
1501 | 1501 | vfs_path_prefixes = ( |
|
1502 | 1502 | b'journal.', |
|
1503 | 1503 | b'undo.', |
|
1504 | 1504 | b'strip-backup/', |
|
1505 | 1505 | b'cache/', |
|
1506 | 1506 | ) |
|
1507 | 1507 | if any(path.startswith(prefix) for prefix in vfs_path_prefixes): |
|
1508 | 1508 | if repo._currentlock(repo._lockref) is None: |
|
1509 | 1509 | repo.ui.develwarn( |
|
1510 | 1510 | b'write with no lock: "%s"' % path, |
|
1511 | 1511 | stacklevel=3, |
|
1512 | 1512 | config=b'check-locks', |
|
1513 | 1513 | ) |
|
1514 | 1514 | elif repo._currentlock(repo._wlockref) is None: |
|
1515 | 1515 | # rest of vfs files are covered by 'wlock' |
|
1516 | 1516 | # |
|
1517 | 1517 | # exclude special files |
|
1518 | 1518 | for prefix in self._wlockfreeprefix: |
|
1519 | 1519 | if path.startswith(prefix): |
|
1520 | 1520 | return |
|
1521 | 1521 | repo.ui.develwarn( |
|
1522 | 1522 | b'write with no wlock: "%s"' % path, |
|
1523 | 1523 | stacklevel=3, |
|
1524 | 1524 | config=b'check-locks', |
|
1525 | 1525 | ) |
|
1526 | 1526 | return ret |
|
1527 | 1527 | |
|
1528 | 1528 | return checkvfs |
|
1529 | 1529 | |
|
1530 | 1530 | def _getsvfsward(self, origfunc): |
|
1531 | 1531 | """build a ward for self.svfs""" |
|
1532 | 1532 | rref = weakref.ref(self) |
|
1533 | 1533 | |
|
1534 | 1534 | def checksvfs(path, mode=None): |
|
1535 | 1535 | ret = origfunc(path, mode=mode) |
|
1536 | 1536 | repo = rref() |
|
1537 | 1537 | if repo is None or not util.safehasattr(repo, b'_lockref'): |
|
1538 | 1538 | return |
|
1539 | 1539 | if mode in (None, b'r', b'rb'): |
|
1540 | 1540 | return |
|
1541 | 1541 | if path.startswith(repo.sharedpath): |
|
1542 | 1542 | # truncate name relative to the repository (.hg) |
|
1543 | 1543 | path = path[len(repo.sharedpath) + 1 :] |
|
1544 | 1544 | if repo._currentlock(repo._lockref) is None: |
|
1545 | 1545 | repo.ui.develwarn( |
|
1546 | 1546 | b'write with no lock: "%s"' % path, stacklevel=4 |
|
1547 | 1547 | ) |
|
1548 | 1548 | return ret |
|
1549 | 1549 | |
|
1550 | 1550 | return checksvfs |
|
1551 | 1551 | |
|
1552 | 1552 | def close(self): |
|
1553 | 1553 | self._writecaches() |
|
1554 | 1554 | |
|
1555 | 1555 | def _writecaches(self): |
|
1556 | 1556 | if self._revbranchcache: |
|
1557 | 1557 | self._revbranchcache.write() |
|
1558 | 1558 | |
|
1559 | 1559 | def _restrictcapabilities(self, caps): |
|
1560 | 1560 | if self.ui.configbool(b'experimental', b'bundle2-advertise'): |
|
1561 | 1561 | caps = set(caps) |
|
1562 | 1562 | capsblob = bundle2.encodecaps( |
|
1563 | 1563 | bundle2.getrepocaps(self, role=b'client') |
|
1564 | 1564 | ) |
|
1565 | 1565 | caps.add(b'bundle2=' + urlreq.quote(capsblob)) |
|
1566 | 1566 | if self.ui.configbool(b'experimental', b'narrow'): |
|
1567 | 1567 | caps.add(wireprototypes.NARROWCAP) |
|
1568 | 1568 | return caps |
|
1569 | 1569 | |
|
1570 | 1570 | # Don't cache auditor/nofsauditor, or you'll end up with reference cycle: |
|
1571 | 1571 | # self -> auditor -> self._checknested -> self |
|
1572 | 1572 | |
|
1573 | 1573 | @property |
|
1574 | 1574 | def auditor(self): |
|
1575 | 1575 | # This is only used by context.workingctx.match in order to |
|
1576 | 1576 | # detect files in subrepos. |
|
1577 | 1577 | return pathutil.pathauditor(self.root, callback=self._checknested) |
|
1578 | 1578 | |
|
1579 | 1579 | @property |
|
1580 | 1580 | def nofsauditor(self): |
|
1581 | 1581 | # This is only used by context.basectx.match in order to detect |
|
1582 | 1582 | # files in subrepos. |
|
1583 | 1583 | return pathutil.pathauditor( |
|
1584 | 1584 | self.root, callback=self._checknested, realfs=False, cached=True |
|
1585 | 1585 | ) |
|
1586 | 1586 | |
|
1587 | 1587 | def _checknested(self, path): |
|
1588 | 1588 | """Determine if path is a legal nested repository.""" |
|
1589 | 1589 | if not path.startswith(self.root): |
|
1590 | 1590 | return False |
|
1591 | 1591 | subpath = path[len(self.root) + 1 :] |
|
1592 | 1592 | normsubpath = util.pconvert(subpath) |
|
1593 | 1593 | |
|
1594 | 1594 | # XXX: Checking against the current working copy is wrong in |
|
1595 | 1595 | # the sense that it can reject things like |
|
1596 | 1596 | # |
|
1597 | 1597 | # $ hg cat -r 10 sub/x.txt |
|
1598 | 1598 | # |
|
1599 | 1599 | # if sub/ is no longer a subrepository in the working copy |
|
1600 | 1600 | # parent revision. |
|
1601 | 1601 | # |
|
1602 | 1602 | # However, it can of course also allow things that would have |
|
1603 | 1603 | # been rejected before, such as the above cat command if sub/ |
|
1604 | 1604 | # is a subrepository now, but was a normal directory before. |
|
1605 | 1605 | # The old path auditor would have rejected by mistake since it |
|
1606 | 1606 | # panics when it sees sub/.hg/. |
|
1607 | 1607 | # |
|
1608 | 1608 | # All in all, checking against the working copy seems sensible |
|
1609 | 1609 | # since we want to prevent access to nested repositories on |
|
1610 | 1610 | # the filesystem *now*. |
|
1611 | 1611 | ctx = self[None] |
|
1612 | 1612 | parts = util.splitpath(subpath) |
|
1613 | 1613 | while parts: |
|
1614 | 1614 | prefix = b'/'.join(parts) |
|
1615 | 1615 | if prefix in ctx.substate: |
|
1616 | 1616 | if prefix == normsubpath: |
|
1617 | 1617 | return True |
|
1618 | 1618 | else: |
|
1619 | 1619 | sub = ctx.sub(prefix) |
|
1620 | 1620 | return sub.checknested(subpath[len(prefix) + 1 :]) |
|
1621 | 1621 | else: |
|
1622 | 1622 | parts.pop() |
|
1623 | 1623 | return False |
|
1624 | 1624 | |
|
1625 | 1625 | def peer(self): |
|
1626 | 1626 | return localpeer(self) # not cached to avoid reference cycle |
|
1627 | 1627 | |
|
1628 | 1628 | def unfiltered(self): |
|
1629 | 1629 | """Return unfiltered version of the repository |
|
1630 | 1630 | |
|
1631 | 1631 | Intended to be overwritten by filtered repo.""" |
|
1632 | 1632 | return self |
|
1633 | 1633 | |
|
1634 | 1634 | def filtered(self, name, visibilityexceptions=None): |
|
1635 | 1635 | """Return a filtered version of a repository |
|
1636 | 1636 | |
|
1637 | 1637 | The `name` parameter is the identifier of the requested view. This |
|
1638 | 1638 | will return a repoview object set "exactly" to the specified view. |
|
1639 | 1639 | |
|
1640 | 1640 | This function does not apply recursive filtering to a repository. For |
|
1641 | 1641 | example calling `repo.filtered("served")` will return a repoview using |
|
1642 | 1642 | the "served" view, regardless of the initial view used by `repo`. |
|
1643 | 1643 | |
|
1644 | 1644 | In other word, there is always only one level of `repoview` "filtering". |
|
1645 | 1645 | """ |
|
1646 | 1646 | if self._extrafilterid is not None and b'%' not in name: |
|
1647 | 1647 | name = name + b'%' + self._extrafilterid |
|
1648 | 1648 | |
|
1649 | 1649 | cls = repoview.newtype(self.unfiltered().__class__) |
|
1650 | 1650 | return cls(self, name, visibilityexceptions) |
|
1651 | 1651 | |
|
1652 | 1652 | @mixedrepostorecache( |
|
1653 | 1653 | (b'bookmarks', b'plain'), |
|
1654 | 1654 | (b'bookmarks.current', b'plain'), |
|
1655 | 1655 | (b'bookmarks', b''), |
|
1656 | 1656 | (b'00changelog.i', b''), |
|
1657 | 1657 | ) |
|
1658 | 1658 | def _bookmarks(self): |
|
1659 | 1659 | # Since the multiple files involved in the transaction cannot be |
|
1660 | 1660 | # written atomically (with current repository format), there is a race |
|
1661 | 1661 | # condition here. |
|
1662 | 1662 | # |
|
1663 | 1663 | # 1) changelog content A is read |
|
1664 | 1664 | # 2) outside transaction update changelog to content B |
|
1665 | 1665 | # 3) outside transaction update bookmark file referring to content B |
|
1666 | 1666 | # 4) bookmarks file content is read and filtered against changelog-A |
|
1667 | 1667 | # |
|
1668 | 1668 | # When this happens, bookmarks against nodes missing from A are dropped. |
|
1669 | 1669 | # |
|
1670 | 1670 | # Having this happening during read is not great, but it become worse |
|
1671 | 1671 | # when this happen during write because the bookmarks to the "unknown" |
|
1672 | 1672 | # nodes will be dropped for good. However, writes happen within locks. |
|
1673 | 1673 | # This locking makes it possible to have a race free consistent read. |
|
1674 | 1674 | # For this purpose data read from disc before locking are |
|
1675 | 1675 | # "invalidated" right after the locks are taken. This invalidations are |
|
1676 | 1676 | # "light", the `filecache` mechanism keep the data in memory and will |
|
1677 | 1677 | # reuse them if the underlying files did not changed. Not parsing the |
|
1678 | 1678 | # same data multiple times helps performances. |
|
1679 | 1679 | # |
|
1680 | 1680 | # Unfortunately in the case describe above, the files tracked by the |
|
1681 | 1681 | # bookmarks file cache might not have changed, but the in-memory |
|
1682 | 1682 | # content is still "wrong" because we used an older changelog content |
|
1683 | 1683 | # to process the on-disk data. So after locking, the changelog would be |
|
1684 | 1684 | # refreshed but `_bookmarks` would be preserved. |
|
1685 | 1685 | # Adding `00changelog.i` to the list of tracked file is not |
|
1686 | 1686 | # enough, because at the time we build the content for `_bookmarks` in |
|
1687 | 1687 | # (4), the changelog file has already diverged from the content used |
|
1688 | 1688 | # for loading `changelog` in (1) |
|
1689 | 1689 | # |
|
1690 | 1690 | # To prevent the issue, we force the changelog to be explicitly |
|
1691 | 1691 | # reloaded while computing `_bookmarks`. The data race can still happen |
|
1692 | 1692 | # without the lock (with a narrower window), but it would no longer go |
|
1693 | 1693 | # undetected during the lock time refresh. |
|
1694 | 1694 | # |
|
1695 | 1695 | # The new schedule is as follow |
|
1696 | 1696 | # |
|
1697 | 1697 | # 1) filecache logic detect that `_bookmarks` needs to be computed |
|
1698 | 1698 | # 2) cachestat for `bookmarks` and `changelog` are captured (for book) |
|
1699 | 1699 | # 3) We force `changelog` filecache to be tested |
|
1700 | 1700 | # 4) cachestat for `changelog` are captured (for changelog) |
|
1701 | 1701 | # 5) `_bookmarks` is computed and cached |
|
1702 | 1702 | # |
|
1703 | 1703 | # The step in (3) ensure we have a changelog at least as recent as the |
|
1704 | 1704 | # cache stat computed in (1). As a result at locking time: |
|
1705 | 1705 | # * if the changelog did not changed since (1) -> we can reuse the data |
|
1706 | 1706 | # * otherwise -> the bookmarks get refreshed. |
|
1707 | 1707 | self._refreshchangelog() |
|
1708 | 1708 | return bookmarks.bmstore(self) |
|
1709 | 1709 | |
|
1710 | 1710 | def _refreshchangelog(self): |
|
1711 | 1711 | """make sure the in memory changelog match the on-disk one""" |
|
1712 | 1712 | if 'changelog' in vars(self) and self.currenttransaction() is None: |
|
1713 | 1713 | del self.changelog |
|
1714 | 1714 | |
|
1715 | 1715 | @property |
|
1716 | 1716 | def _activebookmark(self): |
|
1717 | 1717 | return self._bookmarks.active |
|
1718 | 1718 | |
|
1719 | 1719 | # _phasesets depend on changelog. what we need is to call |
|
1720 | 1720 | # _phasecache.invalidate() if '00changelog.i' was changed, but it |
|
1721 | 1721 | # can't be easily expressed in filecache mechanism. |
|
1722 | 1722 | @storecache(b'phaseroots', b'00changelog.i') |
|
1723 | 1723 | def _phasecache(self): |
|
1724 | 1724 | return phases.phasecache(self, self._phasedefaults) |
|
1725 | 1725 | |
|
1726 | 1726 | @storecache(b'obsstore') |
|
1727 | 1727 | def obsstore(self): |
|
1728 | 1728 | return obsolete.makestore(self.ui, self) |
|
1729 | 1729 | |
|
1730 | 1730 | @changelogcache() |
|
1731 | 1731 | def changelog(repo): |
|
1732 | 1732 | # load dirstate before changelog to avoid race see issue6303 |
|
1733 | 1733 | repo.dirstate.prefetch_parents() |
|
1734 | 1734 | return repo.store.changelog( |
|
1735 | 1735 | txnutil.mayhavepending(repo.root), |
|
1736 | 1736 | concurrencychecker=revlogchecker.get_checker(repo.ui, b'changelog'), |
|
1737 | 1737 | ) |
|
1738 | 1738 | |
|
1739 | 1739 | @manifestlogcache() |
|
1740 | 1740 | def manifestlog(self): |
|
1741 | 1741 | return self.store.manifestlog(self, self._storenarrowmatch) |
|
1742 | 1742 | |
|
1743 | 1743 | @repofilecache(b'dirstate') |
|
1744 | 1744 | def dirstate(self): |
|
1745 | 1745 | return self._makedirstate() |
|
1746 | 1746 | |
|
1747 | 1747 | def _makedirstate(self): |
|
1748 | 1748 | """Extension point for wrapping the dirstate per-repo.""" |
|
1749 | 1749 | sparsematchfn = lambda: sparse.matcher(self) |
|
1750 | 1750 | v2_req = requirementsmod.DIRSTATE_V2_REQUIREMENT |
|
1751 | 1751 | use_dirstate_v2 = v2_req in self.requirements |
|
1752 | 1752 | |
|
1753 | 1753 | return dirstate.dirstate( |
|
1754 | 1754 | self.vfs, |
|
1755 | 1755 | self.ui, |
|
1756 | 1756 | self.root, |
|
1757 | 1757 | self._dirstatevalidate, |
|
1758 | 1758 | sparsematchfn, |
|
1759 | 1759 | self.nodeconstants, |
|
1760 | 1760 | use_dirstate_v2, |
|
1761 | 1761 | ) |
|
1762 | 1762 | |
|
1763 | 1763 | def _dirstatevalidate(self, node): |
|
1764 | 1764 | try: |
|
1765 | 1765 | self.changelog.rev(node) |
|
1766 | 1766 | return node |
|
1767 | 1767 | except error.LookupError: |
|
1768 | 1768 | if not self._dirstatevalidatewarned: |
|
1769 | 1769 | self._dirstatevalidatewarned = True |
|
1770 | 1770 | self.ui.warn( |
|
1771 | 1771 | _(b"warning: ignoring unknown working parent %s!\n") |
|
1772 | 1772 | % short(node) |
|
1773 | 1773 | ) |
|
1774 | 1774 | return self.nullid |
|
1775 | 1775 | |
|
1776 | 1776 | @storecache(narrowspec.FILENAME) |
|
1777 | 1777 | def narrowpats(self): |
|
1778 | 1778 | """matcher patterns for this repository's narrowspec |
|
1779 | 1779 | |
|
1780 | 1780 | A tuple of (includes, excludes). |
|
1781 | 1781 | """ |
|
1782 | 1782 | return narrowspec.load(self) |
|
1783 | 1783 | |
|
1784 | 1784 | @storecache(narrowspec.FILENAME) |
|
1785 | 1785 | def _storenarrowmatch(self): |
|
1786 | 1786 | if requirementsmod.NARROW_REQUIREMENT not in self.requirements: |
|
1787 | 1787 | return matchmod.always() |
|
1788 | 1788 | include, exclude = self.narrowpats |
|
1789 | 1789 | return narrowspec.match(self.root, include=include, exclude=exclude) |
|
1790 | 1790 | |
|
1791 | 1791 | @storecache(narrowspec.FILENAME) |
|
1792 | 1792 | def _narrowmatch(self): |
|
1793 | 1793 | if requirementsmod.NARROW_REQUIREMENT not in self.requirements: |
|
1794 | 1794 | return matchmod.always() |
|
1795 | 1795 | narrowspec.checkworkingcopynarrowspec(self) |
|
1796 | 1796 | include, exclude = self.narrowpats |
|
1797 | 1797 | return narrowspec.match(self.root, include=include, exclude=exclude) |
|
1798 | 1798 | |
|
1799 | 1799 | def narrowmatch(self, match=None, includeexact=False): |
|
1800 | 1800 | """matcher corresponding the the repo's narrowspec |
|
1801 | 1801 | |
|
1802 | 1802 | If `match` is given, then that will be intersected with the narrow |
|
1803 | 1803 | matcher. |
|
1804 | 1804 | |
|
1805 | 1805 | If `includeexact` is True, then any exact matches from `match` will |
|
1806 | 1806 | be included even if they're outside the narrowspec. |
|
1807 | 1807 | """ |
|
1808 | 1808 | if match: |
|
1809 | 1809 | if includeexact and not self._narrowmatch.always(): |
|
1810 | 1810 | # do not exclude explicitly-specified paths so that they can |
|
1811 | 1811 | # be warned later on |
|
1812 | 1812 | em = matchmod.exact(match.files()) |
|
1813 | 1813 | nm = matchmod.unionmatcher([self._narrowmatch, em]) |
|
1814 | 1814 | return matchmod.intersectmatchers(match, nm) |
|
1815 | 1815 | return matchmod.intersectmatchers(match, self._narrowmatch) |
|
1816 | 1816 | return self._narrowmatch |
|
1817 | 1817 | |
|
1818 | 1818 | def setnarrowpats(self, newincludes, newexcludes): |
|
1819 | 1819 | narrowspec.save(self, newincludes, newexcludes) |
|
1820 | 1820 | self.invalidate(clearfilecache=True) |
|
1821 | 1821 | |
|
1822 | 1822 | @unfilteredpropertycache |
|
1823 | 1823 | def _quick_access_changeid_null(self): |
|
1824 | 1824 | return { |
|
1825 | 1825 | b'null': (nullrev, self.nodeconstants.nullid), |
|
1826 | 1826 | nullrev: (nullrev, self.nodeconstants.nullid), |
|
1827 | 1827 | self.nullid: (nullrev, self.nullid), |
|
1828 | 1828 | } |
|
1829 | 1829 | |
|
1830 | 1830 | @unfilteredpropertycache |
|
1831 | 1831 | def _quick_access_changeid_wc(self): |
|
1832 | 1832 | # also fast path access to the working copy parents |
|
1833 | 1833 | # however, only do it for filter that ensure wc is visible. |
|
1834 | 1834 | quick = self._quick_access_changeid_null.copy() |
|
1835 | 1835 | cl = self.unfiltered().changelog |
|
1836 | 1836 | for node in self.dirstate.parents(): |
|
1837 | 1837 | if node == self.nullid: |
|
1838 | 1838 | continue |
|
1839 | 1839 | rev = cl.index.get_rev(node) |
|
1840 | 1840 | if rev is None: |
|
1841 | 1841 | # unknown working copy parent case: |
|
1842 | 1842 | # |
|
1843 | 1843 | # skip the fast path and let higher code deal with it |
|
1844 | 1844 | continue |
|
1845 | 1845 | pair = (rev, node) |
|
1846 | 1846 | quick[rev] = pair |
|
1847 | 1847 | quick[node] = pair |
|
1848 | 1848 | # also add the parents of the parents |
|
1849 | 1849 | for r in cl.parentrevs(rev): |
|
1850 | 1850 | if r == nullrev: |
|
1851 | 1851 | continue |
|
1852 | 1852 | n = cl.node(r) |
|
1853 | 1853 | pair = (r, n) |
|
1854 | 1854 | quick[r] = pair |
|
1855 | 1855 | quick[n] = pair |
|
1856 | 1856 | p1node = self.dirstate.p1() |
|
1857 | 1857 | if p1node != self.nullid: |
|
1858 | 1858 | quick[b'.'] = quick[p1node] |
|
1859 | 1859 | return quick |
|
1860 | 1860 | |
|
1861 | 1861 | @unfilteredmethod |
|
1862 | 1862 | def _quick_access_changeid_invalidate(self): |
|
1863 | 1863 | if '_quick_access_changeid_wc' in vars(self): |
|
1864 | 1864 | del self.__dict__['_quick_access_changeid_wc'] |
|
1865 | 1865 | |
|
1866 | 1866 | @property |
|
1867 | 1867 | def _quick_access_changeid(self): |
|
1868 | 1868 | """an helper dictionnary for __getitem__ calls |
|
1869 | 1869 | |
|
1870 | 1870 | This contains a list of symbol we can recognise right away without |
|
1871 | 1871 | further processing. |
|
1872 | 1872 | """ |
|
1873 | 1873 | if self.filtername in repoview.filter_has_wc: |
|
1874 | 1874 | return self._quick_access_changeid_wc |
|
1875 | 1875 | return self._quick_access_changeid_null |
|
1876 | 1876 | |
|
1877 | 1877 | def __getitem__(self, changeid): |
|
1878 | 1878 | # dealing with special cases |
|
1879 | 1879 | if changeid is None: |
|
1880 | 1880 | return context.workingctx(self) |
|
1881 | 1881 | if isinstance(changeid, context.basectx): |
|
1882 | 1882 | return changeid |
|
1883 | 1883 | |
|
1884 | 1884 | # dealing with multiple revisions |
|
1885 | 1885 | if isinstance(changeid, slice): |
|
1886 | 1886 | # wdirrev isn't contiguous so the slice shouldn't include it |
|
1887 | 1887 | return [ |
|
1888 | 1888 | self[i] |
|
1889 | 1889 | for i in pycompat.xrange(*changeid.indices(len(self))) |
|
1890 | 1890 | if i not in self.changelog.filteredrevs |
|
1891 | 1891 | ] |
|
1892 | 1892 | |
|
1893 | 1893 | # dealing with some special values |
|
1894 | 1894 | quick_access = self._quick_access_changeid.get(changeid) |
|
1895 | 1895 | if quick_access is not None: |
|
1896 | 1896 | rev, node = quick_access |
|
1897 | 1897 | return context.changectx(self, rev, node, maybe_filtered=False) |
|
1898 | 1898 | if changeid == b'tip': |
|
1899 | 1899 | node = self.changelog.tip() |
|
1900 | 1900 | rev = self.changelog.rev(node) |
|
1901 | 1901 | return context.changectx(self, rev, node) |
|
1902 | 1902 | |
|
1903 | 1903 | # dealing with arbitrary values |
|
1904 | 1904 | try: |
|
1905 | 1905 | if isinstance(changeid, int): |
|
1906 | 1906 | node = self.changelog.node(changeid) |
|
1907 | 1907 | rev = changeid |
|
1908 | 1908 | elif changeid == b'.': |
|
1909 | 1909 | # this is a hack to delay/avoid loading obsmarkers |
|
1910 | 1910 | # when we know that '.' won't be hidden |
|
1911 | 1911 | node = self.dirstate.p1() |
|
1912 | 1912 | rev = self.unfiltered().changelog.rev(node) |
|
1913 | 1913 | elif len(changeid) == self.nodeconstants.nodelen: |
|
1914 | 1914 | try: |
|
1915 | 1915 | node = changeid |
|
1916 | 1916 | rev = self.changelog.rev(changeid) |
|
1917 | 1917 | except error.FilteredLookupError: |
|
1918 | 1918 | changeid = hex(changeid) # for the error message |
|
1919 | 1919 | raise |
|
1920 | 1920 | except LookupError: |
|
1921 | 1921 | # check if it might have come from damaged dirstate |
|
1922 | 1922 | # |
|
1923 | 1923 | # XXX we could avoid the unfiltered if we had a recognizable |
|
1924 | 1924 | # exception for filtered changeset access |
|
1925 | 1925 | if ( |
|
1926 | 1926 | self.local() |
|
1927 | 1927 | and changeid in self.unfiltered().dirstate.parents() |
|
1928 | 1928 | ): |
|
1929 | 1929 | msg = _(b"working directory has unknown parent '%s'!") |
|
1930 | 1930 | raise error.Abort(msg % short(changeid)) |
|
1931 | 1931 | changeid = hex(changeid) # for the error message |
|
1932 | 1932 | raise |
|
1933 | 1933 | |
|
1934 | 1934 | elif len(changeid) == 2 * self.nodeconstants.nodelen: |
|
1935 | 1935 | node = bin(changeid) |
|
1936 | 1936 | rev = self.changelog.rev(node) |
|
1937 | 1937 | else: |
|
1938 | 1938 | raise error.ProgrammingError( |
|
1939 | 1939 | b"unsupported changeid '%s' of type %s" |
|
1940 | 1940 | % (changeid, pycompat.bytestr(type(changeid))) |
|
1941 | 1941 | ) |
|
1942 | 1942 | |
|
1943 | 1943 | return context.changectx(self, rev, node) |
|
1944 | 1944 | |
|
1945 | 1945 | except (error.FilteredIndexError, error.FilteredLookupError): |
|
1946 | 1946 | raise error.FilteredRepoLookupError( |
|
1947 | 1947 | _(b"filtered revision '%s'") % pycompat.bytestr(changeid) |
|
1948 | 1948 | ) |
|
1949 | 1949 | except (IndexError, LookupError): |
|
1950 | 1950 | raise error.RepoLookupError( |
|
1951 | 1951 | _(b"unknown revision '%s'") % pycompat.bytestr(changeid) |
|
1952 | 1952 | ) |
|
1953 | 1953 | except error.WdirUnsupported: |
|
1954 | 1954 | return context.workingctx(self) |
|
1955 | 1955 | |
|
1956 | 1956 | def __contains__(self, changeid): |
|
1957 | 1957 | """True if the given changeid exists""" |
|
1958 | 1958 | try: |
|
1959 | 1959 | self[changeid] |
|
1960 | 1960 | return True |
|
1961 | 1961 | except error.RepoLookupError: |
|
1962 | 1962 | return False |
|
1963 | 1963 | |
|
1964 | 1964 | def __nonzero__(self): |
|
1965 | 1965 | return True |
|
1966 | 1966 | |
|
1967 | 1967 | __bool__ = __nonzero__ |
|
1968 | 1968 | |
|
1969 | 1969 | def __len__(self): |
|
1970 | 1970 | # no need to pay the cost of repoview.changelog |
|
1971 | 1971 | unfi = self.unfiltered() |
|
1972 | 1972 | return len(unfi.changelog) |
|
1973 | 1973 | |
|
1974 | 1974 | def __iter__(self): |
|
1975 | 1975 | return iter(self.changelog) |
|
1976 | 1976 | |
|
1977 | 1977 | def revs(self, expr, *args): |
|
1978 | 1978 | """Find revisions matching a revset. |
|
1979 | 1979 | |
|
1980 | 1980 | The revset is specified as a string ``expr`` that may contain |
|
1981 | 1981 | %-formatting to escape certain types. See ``revsetlang.formatspec``. |
|
1982 | 1982 | |
|
1983 | 1983 | Revset aliases from the configuration are not expanded. To expand |
|
1984 | 1984 | user aliases, consider calling ``scmutil.revrange()`` or |
|
1985 | 1985 | ``repo.anyrevs([expr], user=True)``. |
|
1986 | 1986 | |
|
1987 | 1987 | Returns a smartset.abstractsmartset, which is a list-like interface |
|
1988 | 1988 | that contains integer revisions. |
|
1989 | 1989 | """ |
|
1990 | 1990 | tree = revsetlang.spectree(expr, *args) |
|
1991 | 1991 | return revset.makematcher(tree)(self) |
|
1992 | 1992 | |
|
1993 | 1993 | def set(self, expr, *args): |
|
1994 | 1994 | """Find revisions matching a revset and emit changectx instances. |
|
1995 | 1995 | |
|
1996 | 1996 | This is a convenience wrapper around ``revs()`` that iterates the |
|
1997 | 1997 | result and is a generator of changectx instances. |
|
1998 | 1998 | |
|
1999 | 1999 | Revset aliases from the configuration are not expanded. To expand |
|
2000 | 2000 | user aliases, consider calling ``scmutil.revrange()``. |
|
2001 | 2001 | """ |
|
2002 | 2002 | for r in self.revs(expr, *args): |
|
2003 | 2003 | yield self[r] |
|
2004 | 2004 | |
|
2005 | 2005 | def anyrevs(self, specs, user=False, localalias=None): |
|
2006 | 2006 | """Find revisions matching one of the given revsets. |
|
2007 | 2007 | |
|
2008 | 2008 | Revset aliases from the configuration are not expanded by default. To |
|
2009 | 2009 | expand user aliases, specify ``user=True``. To provide some local |
|
2010 | 2010 | definitions overriding user aliases, set ``localalias`` to |
|
2011 | 2011 | ``{name: definitionstring}``. |
|
2012 | 2012 | """ |
|
2013 | 2013 | if specs == [b'null']: |
|
2014 | 2014 | return revset.baseset([nullrev]) |
|
2015 | 2015 | if specs == [b'.']: |
|
2016 | 2016 | quick_data = self._quick_access_changeid.get(b'.') |
|
2017 | 2017 | if quick_data is not None: |
|
2018 | 2018 | return revset.baseset([quick_data[0]]) |
|
2019 | 2019 | if user: |
|
2020 | 2020 | m = revset.matchany( |
|
2021 | 2021 | self.ui, |
|
2022 | 2022 | specs, |
|
2023 | 2023 | lookup=revset.lookupfn(self), |
|
2024 | 2024 | localalias=localalias, |
|
2025 | 2025 | ) |
|
2026 | 2026 | else: |
|
2027 | 2027 | m = revset.matchany(None, specs, localalias=localalias) |
|
2028 | 2028 | return m(self) |
|
2029 | 2029 | |
|
2030 | 2030 | def url(self): |
|
2031 | 2031 | return b'file:' + self.root |
|
2032 | 2032 | |
|
2033 | 2033 | def hook(self, name, throw=False, **args): |
|
2034 | 2034 | """Call a hook, passing this repo instance. |
|
2035 | 2035 | |
|
2036 | 2036 | This a convenience method to aid invoking hooks. Extensions likely |
|
2037 | 2037 | won't call this unless they have registered a custom hook or are |
|
2038 | 2038 | replacing code that is expected to call a hook. |
|
2039 | 2039 | """ |
|
2040 | 2040 | return hook.hook(self.ui, self, name, throw, **args) |
|
2041 | 2041 | |
|
2042 | 2042 | @filteredpropertycache |
|
2043 | 2043 | def _tagscache(self): |
|
2044 | 2044 | """Returns a tagscache object that contains various tags related |
|
2045 | 2045 | caches.""" |
|
2046 | 2046 | |
|
2047 | 2047 | # This simplifies its cache management by having one decorated |
|
2048 | 2048 | # function (this one) and the rest simply fetch things from it. |
|
2049 | 2049 | class tagscache(object): |
|
2050 | 2050 | def __init__(self): |
|
2051 | 2051 | # These two define the set of tags for this repository. tags |
|
2052 | 2052 | # maps tag name to node; tagtypes maps tag name to 'global' or |
|
2053 | 2053 | # 'local'. (Global tags are defined by .hgtags across all |
|
2054 | 2054 | # heads, and local tags are defined in .hg/localtags.) |
|
2055 | 2055 | # They constitute the in-memory cache of tags. |
|
2056 | 2056 | self.tags = self.tagtypes = None |
|
2057 | 2057 | |
|
2058 | 2058 | self.nodetagscache = self.tagslist = None |
|
2059 | 2059 | |
|
2060 | 2060 | cache = tagscache() |
|
2061 | 2061 | cache.tags, cache.tagtypes = self._findtags() |
|
2062 | 2062 | |
|
2063 | 2063 | return cache |
|
2064 | 2064 | |
|
2065 | 2065 | def tags(self): |
|
2066 | 2066 | '''return a mapping of tag to node''' |
|
2067 | 2067 | t = {} |
|
2068 | 2068 | if self.changelog.filteredrevs: |
|
2069 | 2069 | tags, tt = self._findtags() |
|
2070 | 2070 | else: |
|
2071 | 2071 | tags = self._tagscache.tags |
|
2072 | 2072 | rev = self.changelog.rev |
|
2073 | 2073 | for k, v in pycompat.iteritems(tags): |
|
2074 | 2074 | try: |
|
2075 | 2075 | # ignore tags to unknown nodes |
|
2076 | 2076 | rev(v) |
|
2077 | 2077 | t[k] = v |
|
2078 | 2078 | except (error.LookupError, ValueError): |
|
2079 | 2079 | pass |
|
2080 | 2080 | return t |
|
2081 | 2081 | |
|
2082 | 2082 | def _findtags(self): |
|
2083 | 2083 | """Do the hard work of finding tags. Return a pair of dicts |
|
2084 | 2084 | (tags, tagtypes) where tags maps tag name to node, and tagtypes |
|
2085 | 2085 | maps tag name to a string like \'global\' or \'local\'. |
|
2086 | 2086 | Subclasses or extensions are free to add their own tags, but |
|
2087 | 2087 | should be aware that the returned dicts will be retained for the |
|
2088 | 2088 | duration of the localrepo object.""" |
|
2089 | 2089 | |
|
2090 | 2090 | # XXX what tagtype should subclasses/extensions use? Currently |
|
2091 | 2091 | # mq and bookmarks add tags, but do not set the tagtype at all. |
|
2092 | 2092 | # Should each extension invent its own tag type? Should there |
|
2093 | 2093 | # be one tagtype for all such "virtual" tags? Or is the status |
|
2094 | 2094 | # quo fine? |
|
2095 | 2095 | |
|
2096 | 2096 | # map tag name to (node, hist) |
|
2097 | 2097 | alltags = tagsmod.findglobaltags(self.ui, self) |
|
2098 | 2098 | # map tag name to tag type |
|
2099 | 2099 | tagtypes = {tag: b'global' for tag in alltags} |
|
2100 | 2100 | |
|
2101 | 2101 | tagsmod.readlocaltags(self.ui, self, alltags, tagtypes) |
|
2102 | 2102 | |
|
2103 | 2103 | # Build the return dicts. Have to re-encode tag names because |
|
2104 | 2104 | # the tags module always uses UTF-8 (in order not to lose info |
|
2105 | 2105 | # writing to the cache), but the rest of Mercurial wants them in |
|
2106 | 2106 | # local encoding. |
|
2107 | 2107 | tags = {} |
|
2108 | 2108 | for (name, (node, hist)) in pycompat.iteritems(alltags): |
|
2109 | 2109 | if node != self.nullid: |
|
2110 | 2110 | tags[encoding.tolocal(name)] = node |
|
2111 | 2111 | tags[b'tip'] = self.changelog.tip() |
|
2112 | 2112 | tagtypes = { |
|
2113 | 2113 | encoding.tolocal(name): value |
|
2114 | 2114 | for (name, value) in pycompat.iteritems(tagtypes) |
|
2115 | 2115 | } |
|
2116 | 2116 | return (tags, tagtypes) |
|
2117 | 2117 | |
|
2118 | 2118 | def tagtype(self, tagname): |
|
2119 | 2119 | """ |
|
2120 | 2120 | return the type of the given tag. result can be: |
|
2121 | 2121 | |
|
2122 | 2122 | 'local' : a local tag |
|
2123 | 2123 | 'global' : a global tag |
|
2124 | 2124 | None : tag does not exist |
|
2125 | 2125 | """ |
|
2126 | 2126 | |
|
2127 | 2127 | return self._tagscache.tagtypes.get(tagname) |
|
2128 | 2128 | |
|
2129 | 2129 | def tagslist(self): |
|
2130 | 2130 | '''return a list of tags ordered by revision''' |
|
2131 | 2131 | if not self._tagscache.tagslist: |
|
2132 | 2132 | l = [] |
|
2133 | 2133 | for t, n in pycompat.iteritems(self.tags()): |
|
2134 | 2134 | l.append((self.changelog.rev(n), t, n)) |
|
2135 | 2135 | self._tagscache.tagslist = [(t, n) for r, t, n in sorted(l)] |
|
2136 | 2136 | |
|
2137 | 2137 | return self._tagscache.tagslist |
|
2138 | 2138 | |
|
2139 | 2139 | def nodetags(self, node): |
|
2140 | 2140 | '''return the tags associated with a node''' |
|
2141 | 2141 | if not self._tagscache.nodetagscache: |
|
2142 | 2142 | nodetagscache = {} |
|
2143 | 2143 | for t, n in pycompat.iteritems(self._tagscache.tags): |
|
2144 | 2144 | nodetagscache.setdefault(n, []).append(t) |
|
2145 | 2145 | for tags in pycompat.itervalues(nodetagscache): |
|
2146 | 2146 | tags.sort() |
|
2147 | 2147 | self._tagscache.nodetagscache = nodetagscache |
|
2148 | 2148 | return self._tagscache.nodetagscache.get(node, []) |
|
2149 | 2149 | |
|
2150 | 2150 | def nodebookmarks(self, node): |
|
2151 | 2151 | """return the list of bookmarks pointing to the specified node""" |
|
2152 | 2152 | return self._bookmarks.names(node) |
|
2153 | 2153 | |
|
2154 | 2154 | def branchmap(self): |
|
2155 | 2155 | """returns a dictionary {branch: [branchheads]} with branchheads |
|
2156 | 2156 | ordered by increasing revision number""" |
|
2157 | 2157 | return self._branchcaches[self] |
|
2158 | 2158 | |
|
2159 | 2159 | @unfilteredmethod |
|
2160 | 2160 | def revbranchcache(self): |
|
2161 | 2161 | if not self._revbranchcache: |
|
2162 | 2162 | self._revbranchcache = branchmap.revbranchcache(self.unfiltered()) |
|
2163 | 2163 | return self._revbranchcache |
|
2164 | 2164 | |
|
2165 | 2165 | def register_changeset(self, rev, changelogrevision): |
|
2166 | 2166 | self.revbranchcache().setdata(rev, changelogrevision) |
|
2167 | 2167 | |
|
2168 | 2168 | def branchtip(self, branch, ignoremissing=False): |
|
2169 | 2169 | """return the tip node for a given branch |
|
2170 | 2170 | |
|
2171 | 2171 | If ignoremissing is True, then this method will not raise an error. |
|
2172 | 2172 | This is helpful for callers that only expect None for a missing branch |
|
2173 | 2173 | (e.g. namespace). |
|
2174 | 2174 | |
|
2175 | 2175 | """ |
|
2176 | 2176 | try: |
|
2177 | 2177 | return self.branchmap().branchtip(branch) |
|
2178 | 2178 | except KeyError: |
|
2179 | 2179 | if not ignoremissing: |
|
2180 | 2180 | raise error.RepoLookupError(_(b"unknown branch '%s'") % branch) |
|
2181 | 2181 | else: |
|
2182 | 2182 | pass |
|
2183 | 2183 | |
|
2184 | 2184 | def lookup(self, key): |
|
2185 | 2185 | node = scmutil.revsymbol(self, key).node() |
|
2186 | 2186 | if node is None: |
|
2187 | 2187 | raise error.RepoLookupError(_(b"unknown revision '%s'") % key) |
|
2188 | 2188 | return node |
|
2189 | 2189 | |
|
2190 | 2190 | def lookupbranch(self, key): |
|
2191 | 2191 | if self.branchmap().hasbranch(key): |
|
2192 | 2192 | return key |
|
2193 | 2193 | |
|
2194 | 2194 | return scmutil.revsymbol(self, key).branch() |
|
2195 | 2195 | |
|
2196 | 2196 | def known(self, nodes): |
|
2197 | 2197 | cl = self.changelog |
|
2198 | 2198 | get_rev = cl.index.get_rev |
|
2199 | 2199 | filtered = cl.filteredrevs |
|
2200 | 2200 | result = [] |
|
2201 | 2201 | for n in nodes: |
|
2202 | 2202 | r = get_rev(n) |
|
2203 | 2203 | resp = not (r is None or r in filtered) |
|
2204 | 2204 | result.append(resp) |
|
2205 | 2205 | return result |
|
2206 | 2206 | |
|
2207 | 2207 | def local(self): |
|
2208 | 2208 | return self |
|
2209 | 2209 | |
|
2210 | 2210 | def publishing(self): |
|
2211 | 2211 | # it's safe (and desirable) to trust the publish flag unconditionally |
|
2212 | 2212 | # so that we don't finalize changes shared between users via ssh or nfs |
|
2213 | 2213 | return self.ui.configbool(b'phases', b'publish', untrusted=True) |
|
2214 | 2214 | |
|
2215 | 2215 | def cancopy(self): |
|
2216 | 2216 | # so statichttprepo's override of local() works |
|
2217 | 2217 | if not self.local(): |
|
2218 | 2218 | return False |
|
2219 | 2219 | if not self.publishing(): |
|
2220 | 2220 | return True |
|
2221 | 2221 | # if publishing we can't copy if there is filtered content |
|
2222 | 2222 | return not self.filtered(b'visible').changelog.filteredrevs |
|
2223 | 2223 | |
|
2224 | 2224 | def shared(self): |
|
2225 | 2225 | '''the type of shared repository (None if not shared)''' |
|
2226 | 2226 | if self.sharedpath != self.path: |
|
2227 | 2227 | return b'store' |
|
2228 | 2228 | return None |
|
2229 | 2229 | |
|
2230 | 2230 | def wjoin(self, f, *insidef): |
|
2231 | 2231 | return self.vfs.reljoin(self.root, f, *insidef) |
|
2232 | 2232 | |
|
2233 | 2233 | def setparents(self, p1, p2=None): |
|
2234 | 2234 | if p2 is None: |
|
2235 | 2235 | p2 = self.nullid |
|
2236 | 2236 | self[None].setparents(p1, p2) |
|
2237 | 2237 | self._quick_access_changeid_invalidate() |
|
2238 | 2238 | |
|
2239 | 2239 | def filectx(self, path, changeid=None, fileid=None, changectx=None): |
|
2240 | 2240 | """changeid must be a changeset revision, if specified. |
|
2241 | 2241 | fileid can be a file revision or node.""" |
|
2242 | 2242 | return context.filectx( |
|
2243 | 2243 | self, path, changeid, fileid, changectx=changectx |
|
2244 | 2244 | ) |
|
2245 | 2245 | |
|
2246 | 2246 | def getcwd(self): |
|
2247 | 2247 | return self.dirstate.getcwd() |
|
2248 | 2248 | |
|
2249 | 2249 | def pathto(self, f, cwd=None): |
|
2250 | 2250 | return self.dirstate.pathto(f, cwd) |
|
2251 | 2251 | |
|
2252 | 2252 | def _loadfilter(self, filter): |
|
2253 | 2253 | if filter not in self._filterpats: |
|
2254 | 2254 | l = [] |
|
2255 | 2255 | for pat, cmd in self.ui.configitems(filter): |
|
2256 | 2256 | if cmd == b'!': |
|
2257 | 2257 | continue |
|
2258 | 2258 | mf = matchmod.match(self.root, b'', [pat]) |
|
2259 | 2259 | fn = None |
|
2260 | 2260 | params = cmd |
|
2261 | 2261 | for name, filterfn in pycompat.iteritems(self._datafilters): |
|
2262 | 2262 | if cmd.startswith(name): |
|
2263 | 2263 | fn = filterfn |
|
2264 | 2264 | params = cmd[len(name) :].lstrip() |
|
2265 | 2265 | break |
|
2266 | 2266 | if not fn: |
|
2267 | 2267 | fn = lambda s, c, **kwargs: procutil.filter(s, c) |
|
2268 | 2268 | fn.__name__ = 'commandfilter' |
|
2269 | 2269 | # Wrap old filters not supporting keyword arguments |
|
2270 | 2270 | if not pycompat.getargspec(fn)[2]: |
|
2271 | 2271 | oldfn = fn |
|
2272 | 2272 | fn = lambda s, c, oldfn=oldfn, **kwargs: oldfn(s, c) |
|
2273 | 2273 | fn.__name__ = 'compat-' + oldfn.__name__ |
|
2274 | 2274 | l.append((mf, fn, params)) |
|
2275 | 2275 | self._filterpats[filter] = l |
|
2276 | 2276 | return self._filterpats[filter] |
|
2277 | 2277 | |
|
2278 | 2278 | def _filter(self, filterpats, filename, data): |
|
2279 | 2279 | for mf, fn, cmd in filterpats: |
|
2280 | 2280 | if mf(filename): |
|
2281 | 2281 | self.ui.debug( |
|
2282 | 2282 | b"filtering %s through %s\n" |
|
2283 | 2283 | % (filename, cmd or pycompat.sysbytes(fn.__name__)) |
|
2284 | 2284 | ) |
|
2285 | 2285 | data = fn(data, cmd, ui=self.ui, repo=self, filename=filename) |
|
2286 | 2286 | break |
|
2287 | 2287 | |
|
2288 | 2288 | return data |
|
2289 | 2289 | |
|
2290 | 2290 | @unfilteredpropertycache |
|
2291 | 2291 | def _encodefilterpats(self): |
|
2292 | 2292 | return self._loadfilter(b'encode') |
|
2293 | 2293 | |
|
2294 | 2294 | @unfilteredpropertycache |
|
2295 | 2295 | def _decodefilterpats(self): |
|
2296 | 2296 | return self._loadfilter(b'decode') |
|
2297 | 2297 | |
|
2298 | 2298 | def adddatafilter(self, name, filter): |
|
2299 | 2299 | self._datafilters[name] = filter |
|
2300 | 2300 | |
|
2301 | 2301 | def wread(self, filename): |
|
2302 | 2302 | if self.wvfs.islink(filename): |
|
2303 | 2303 | data = self.wvfs.readlink(filename) |
|
2304 | 2304 | else: |
|
2305 | 2305 | data = self.wvfs.read(filename) |
|
2306 | 2306 | return self._filter(self._encodefilterpats, filename, data) |
|
2307 | 2307 | |
|
2308 | 2308 | def wwrite(self, filename, data, flags, backgroundclose=False, **kwargs): |
|
2309 | 2309 | """write ``data`` into ``filename`` in the working directory |
|
2310 | 2310 | |
|
2311 | 2311 | This returns length of written (maybe decoded) data. |
|
2312 | 2312 | """ |
|
2313 | 2313 | data = self._filter(self._decodefilterpats, filename, data) |
|
2314 | 2314 | if b'l' in flags: |
|
2315 | 2315 | self.wvfs.symlink(data, filename) |
|
2316 | 2316 | else: |
|
2317 | 2317 | self.wvfs.write( |
|
2318 | 2318 | filename, data, backgroundclose=backgroundclose, **kwargs |
|
2319 | 2319 | ) |
|
2320 | 2320 | if b'x' in flags: |
|
2321 | 2321 | self.wvfs.setflags(filename, False, True) |
|
2322 | 2322 | else: |
|
2323 | 2323 | self.wvfs.setflags(filename, False, False) |
|
2324 | 2324 | return len(data) |
|
2325 | 2325 | |
|
2326 | 2326 | def wwritedata(self, filename, data): |
|
2327 | 2327 | return self._filter(self._decodefilterpats, filename, data) |
|
2328 | 2328 | |
|
2329 | 2329 | def currenttransaction(self): |
|
2330 | 2330 | """return the current transaction or None if non exists""" |
|
2331 | 2331 | if self._transref: |
|
2332 | 2332 | tr = self._transref() |
|
2333 | 2333 | else: |
|
2334 | 2334 | tr = None |
|
2335 | 2335 | |
|
2336 | 2336 | if tr and tr.running(): |
|
2337 | 2337 | return tr |
|
2338 | 2338 | return None |
|
2339 | 2339 | |
|
2340 | 2340 | def transaction(self, desc, report=None): |
|
2341 | 2341 | if self.ui.configbool(b'devel', b'all-warnings') or self.ui.configbool( |
|
2342 | 2342 | b'devel', b'check-locks' |
|
2343 | 2343 | ): |
|
2344 | 2344 | if self._currentlock(self._lockref) is None: |
|
2345 | 2345 | raise error.ProgrammingError(b'transaction requires locking') |
|
2346 | 2346 | tr = self.currenttransaction() |
|
2347 | 2347 | if tr is not None: |
|
2348 | 2348 | return tr.nest(name=desc) |
|
2349 | 2349 | |
|
2350 | 2350 | # abort here if the journal already exists |
|
2351 | 2351 | if self.svfs.exists(b"journal"): |
|
2352 | 2352 | raise error.RepoError( |
|
2353 | 2353 | _(b"abandoned transaction found"), |
|
2354 | 2354 | hint=_(b"run 'hg recover' to clean up transaction"), |
|
2355 | 2355 | ) |
|
2356 | 2356 | |
|
2357 | 2357 | idbase = b"%.40f#%f" % (random.random(), time.time()) |
|
2358 | 2358 | ha = hex(hashutil.sha1(idbase).digest()) |
|
2359 | 2359 | txnid = b'TXN:' + ha |
|
2360 | 2360 | self.hook(b'pretxnopen', throw=True, txnname=desc, txnid=txnid) |
|
2361 | 2361 | |
|
2362 | 2362 | self._writejournal(desc) |
|
2363 | 2363 | renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] |
|
2364 | 2364 | if report: |
|
2365 | 2365 | rp = report |
|
2366 | 2366 | else: |
|
2367 | 2367 | rp = self.ui.warn |
|
2368 | 2368 | vfsmap = {b'plain': self.vfs, b'store': self.svfs} # root of .hg/ |
|
2369 | 2369 | # we must avoid cyclic reference between repo and transaction. |
|
2370 | 2370 | reporef = weakref.ref(self) |
|
2371 | 2371 | # Code to track tag movement |
|
2372 | 2372 | # |
|
2373 | 2373 | # Since tags are all handled as file content, it is actually quite hard |
|
2374 | 2374 | # to track these movement from a code perspective. So we fallback to a |
|
2375 | 2375 | # tracking at the repository level. One could envision to track changes |
|
2376 | 2376 | # to the '.hgtags' file through changegroup apply but that fails to |
|
2377 | 2377 | # cope with case where transaction expose new heads without changegroup |
|
2378 | 2378 | # being involved (eg: phase movement). |
|
2379 | 2379 | # |
|
2380 | 2380 | # For now, We gate the feature behind a flag since this likely comes |
|
2381 | 2381 | # with performance impacts. The current code run more often than needed |
|
2382 | 2382 | # and do not use caches as much as it could. The current focus is on |
|
2383 | 2383 | # the behavior of the feature so we disable it by default. The flag |
|
2384 | 2384 | # will be removed when we are happy with the performance impact. |
|
2385 | 2385 | # |
|
2386 | 2386 | # Once this feature is no longer experimental move the following |
|
2387 | 2387 | # documentation to the appropriate help section: |
|
2388 | 2388 | # |
|
2389 | 2389 | # The ``HG_TAG_MOVED`` variable will be set if the transaction touched |
|
2390 | 2390 | # tags (new or changed or deleted tags). In addition the details of |
|
2391 | 2391 | # these changes are made available in a file at: |
|
2392 | 2392 | # ``REPOROOT/.hg/changes/tags.changes``. |
|
2393 | 2393 | # Make sure you check for HG_TAG_MOVED before reading that file as it |
|
2394 | 2394 | # might exist from a previous transaction even if no tag were touched |
|
2395 | 2395 | # in this one. Changes are recorded in a line base format:: |
|
2396 | 2396 | # |
|
2397 | 2397 | # <action> <hex-node> <tag-name>\n |
|
2398 | 2398 | # |
|
2399 | 2399 | # Actions are defined as follow: |
|
2400 | 2400 | # "-R": tag is removed, |
|
2401 | 2401 | # "+A": tag is added, |
|
2402 | 2402 | # "-M": tag is moved (old value), |
|
2403 | 2403 | # "+M": tag is moved (new value), |
|
2404 | 2404 | tracktags = lambda x: None |
|
2405 | 2405 | # experimental config: experimental.hook-track-tags |
|
2406 | 2406 | shouldtracktags = self.ui.configbool( |
|
2407 | 2407 | b'experimental', b'hook-track-tags' |
|
2408 | 2408 | ) |
|
2409 | 2409 | if desc != b'strip' and shouldtracktags: |
|
2410 | 2410 | oldheads = self.changelog.headrevs() |
|
2411 | 2411 | |
|
2412 | 2412 | def tracktags(tr2): |
|
2413 | 2413 | repo = reporef() |
|
2414 | 2414 | assert repo is not None # help pytype |
|
2415 | 2415 | oldfnodes = tagsmod.fnoderevs(repo.ui, repo, oldheads) |
|
2416 | 2416 | newheads = repo.changelog.headrevs() |
|
2417 | 2417 | newfnodes = tagsmod.fnoderevs(repo.ui, repo, newheads) |
|
2418 | 2418 | # notes: we compare lists here. |
|
2419 | 2419 | # As we do it only once buiding set would not be cheaper |
|
2420 | 2420 | changes = tagsmod.difftags(repo.ui, repo, oldfnodes, newfnodes) |
|
2421 | 2421 | if changes: |
|
2422 | 2422 | tr2.hookargs[b'tag_moved'] = b'1' |
|
2423 | 2423 | with repo.vfs( |
|
2424 | 2424 | b'changes/tags.changes', b'w', atomictemp=True |
|
2425 | 2425 | ) as changesfile: |
|
2426 | 2426 | # note: we do not register the file to the transaction |
|
2427 | 2427 | # because we needs it to still exist on the transaction |
|
2428 | 2428 | # is close (for txnclose hooks) |
|
2429 | 2429 | tagsmod.writediff(changesfile, changes) |
|
2430 | 2430 | |
|
2431 | 2431 | def validate(tr2): |
|
2432 | 2432 | """will run pre-closing hooks""" |
|
2433 | 2433 | # XXX the transaction API is a bit lacking here so we take a hacky |
|
2434 | 2434 | # path for now |
|
2435 | 2435 | # |
|
2436 | 2436 | # We cannot add this as a "pending" hooks since the 'tr.hookargs' |
|
2437 | 2437 | # dict is copied before these run. In addition we needs the data |
|
2438 | 2438 | # available to in memory hooks too. |
|
2439 | 2439 | # |
|
2440 | 2440 | # Moreover, we also need to make sure this runs before txnclose |
|
2441 | 2441 | # hooks and there is no "pending" mechanism that would execute |
|
2442 | 2442 | # logic only if hooks are about to run. |
|
2443 | 2443 | # |
|
2444 | 2444 | # Fixing this limitation of the transaction is also needed to track |
|
2445 | 2445 | # other families of changes (bookmarks, phases, obsolescence). |
|
2446 | 2446 | # |
|
2447 | 2447 | # This will have to be fixed before we remove the experimental |
|
2448 | 2448 | # gating. |
|
2449 | 2449 | tracktags(tr2) |
|
2450 | 2450 | repo = reporef() |
|
2451 | 2451 | assert repo is not None # help pytype |
|
2452 | 2452 | |
|
2453 | 2453 | singleheadopt = (b'experimental', b'single-head-per-branch') |
|
2454 | 2454 | singlehead = repo.ui.configbool(*singleheadopt) |
|
2455 | 2455 | if singlehead: |
|
2456 | 2456 | singleheadsub = repo.ui.configsuboptions(*singleheadopt)[1] |
|
2457 | 2457 | accountclosed = singleheadsub.get( |
|
2458 | 2458 | b"account-closed-heads", False |
|
2459 | 2459 | ) |
|
2460 | 2460 | if singleheadsub.get(b"public-changes-only", False): |
|
2461 | 2461 | filtername = b"immutable" |
|
2462 | 2462 | else: |
|
2463 | 2463 | filtername = b"visible" |
|
2464 | 2464 | scmutil.enforcesinglehead( |
|
2465 | 2465 | repo, tr2, desc, accountclosed, filtername |
|
2466 | 2466 | ) |
|
2467 | 2467 | if hook.hashook(repo.ui, b'pretxnclose-bookmark'): |
|
2468 | 2468 | for name, (old, new) in sorted( |
|
2469 | 2469 | tr.changes[b'bookmarks'].items() |
|
2470 | 2470 | ): |
|
2471 | 2471 | args = tr.hookargs.copy() |
|
2472 | 2472 | args.update(bookmarks.preparehookargs(name, old, new)) |
|
2473 | 2473 | repo.hook( |
|
2474 | 2474 | b'pretxnclose-bookmark', |
|
2475 | 2475 | throw=True, |
|
2476 | 2476 | **pycompat.strkwargs(args) |
|
2477 | 2477 | ) |
|
2478 | 2478 | if hook.hashook(repo.ui, b'pretxnclose-phase'): |
|
2479 | 2479 | cl = repo.unfiltered().changelog |
|
2480 | 2480 | for revs, (old, new) in tr.changes[b'phases']: |
|
2481 | 2481 | for rev in revs: |
|
2482 | 2482 | args = tr.hookargs.copy() |
|
2483 | 2483 | node = hex(cl.node(rev)) |
|
2484 | 2484 | args.update(phases.preparehookargs(node, old, new)) |
|
2485 | 2485 | repo.hook( |
|
2486 | 2486 | b'pretxnclose-phase', |
|
2487 | 2487 | throw=True, |
|
2488 | 2488 | **pycompat.strkwargs(args) |
|
2489 | 2489 | ) |
|
2490 | 2490 | |
|
2491 | 2491 | repo.hook( |
|
2492 | 2492 | b'pretxnclose', throw=True, **pycompat.strkwargs(tr.hookargs) |
|
2493 | 2493 | ) |
|
2494 | 2494 | |
|
2495 | 2495 | def releasefn(tr, success): |
|
2496 | 2496 | repo = reporef() |
|
2497 | 2497 | if repo is None: |
|
2498 | 2498 | # If the repo has been GC'd (and this release function is being |
|
2499 | 2499 | # called from transaction.__del__), there's not much we can do, |
|
2500 | 2500 | # so just leave the unfinished transaction there and let the |
|
2501 | 2501 | # user run `hg recover`. |
|
2502 | 2502 | return |
|
2503 | 2503 | if success: |
|
2504 | 2504 | # this should be explicitly invoked here, because |
|
2505 | 2505 | # in-memory changes aren't written out at closing |
|
2506 | 2506 | # transaction, if tr.addfilegenerator (via |
|
2507 | 2507 | # dirstate.write or so) isn't invoked while |
|
2508 | 2508 | # transaction running |
|
2509 | 2509 | repo.dirstate.write(None) |
|
2510 | 2510 | else: |
|
2511 | 2511 | # discard all changes (including ones already written |
|
2512 | 2512 | # out) in this transaction |
|
2513 | 2513 | narrowspec.restorebackup(self, b'journal.narrowspec') |
|
2514 | 2514 | narrowspec.restorewcbackup(self, b'journal.narrowspec.dirstate') |
|
2515 | 2515 | repo.dirstate.restorebackup(None, b'journal.dirstate') |
|
2516 | 2516 | |
|
2517 | 2517 | repo.invalidate(clearfilecache=True) |
|
2518 | 2518 | |
|
2519 | 2519 | tr = transaction.transaction( |
|
2520 | 2520 | rp, |
|
2521 | 2521 | self.svfs, |
|
2522 | 2522 | vfsmap, |
|
2523 | 2523 | b"journal", |
|
2524 | 2524 | b"undo", |
|
2525 | 2525 | aftertrans(renames), |
|
2526 | 2526 | self.store.createmode, |
|
2527 | 2527 | validator=validate, |
|
2528 | 2528 | releasefn=releasefn, |
|
2529 | 2529 | checkambigfiles=_cachedfiles, |
|
2530 | 2530 | name=desc, |
|
2531 | 2531 | ) |
|
2532 | 2532 | tr.changes[b'origrepolen'] = len(self) |
|
2533 | 2533 | tr.changes[b'obsmarkers'] = set() |
|
2534 | 2534 | tr.changes[b'phases'] = [] |
|
2535 | 2535 | tr.changes[b'bookmarks'] = {} |
|
2536 | 2536 | |
|
2537 | 2537 | tr.hookargs[b'txnid'] = txnid |
|
2538 | 2538 | tr.hookargs[b'txnname'] = desc |
|
2539 | 2539 | tr.hookargs[b'changes'] = tr.changes |
|
2540 | 2540 | # note: writing the fncache only during finalize mean that the file is |
|
2541 | 2541 | # outdated when running hooks. As fncache is used for streaming clone, |
|
2542 | 2542 | # this is not expected to break anything that happen during the hooks. |
|
2543 | 2543 | tr.addfinalize(b'flush-fncache', self.store.write) |
|
2544 | 2544 | |
|
2545 | 2545 | def txnclosehook(tr2): |
|
2546 | 2546 | """To be run if transaction is successful, will schedule a hook run""" |
|
2547 | 2547 | # Don't reference tr2 in hook() so we don't hold a reference. |
|
2548 | 2548 | # This reduces memory consumption when there are multiple |
|
2549 | 2549 | # transactions per lock. This can likely go away if issue5045 |
|
2550 | 2550 | # fixes the function accumulation. |
|
2551 | 2551 | hookargs = tr2.hookargs |
|
2552 | 2552 | |
|
2553 | 2553 | def hookfunc(unused_success): |
|
2554 | 2554 | repo = reporef() |
|
2555 | 2555 | assert repo is not None # help pytype |
|
2556 | 2556 | |
|
2557 | 2557 | if hook.hashook(repo.ui, b'txnclose-bookmark'): |
|
2558 | 2558 | bmchanges = sorted(tr.changes[b'bookmarks'].items()) |
|
2559 | 2559 | for name, (old, new) in bmchanges: |
|
2560 | 2560 | args = tr.hookargs.copy() |
|
2561 | 2561 | args.update(bookmarks.preparehookargs(name, old, new)) |
|
2562 | 2562 | repo.hook( |
|
2563 | 2563 | b'txnclose-bookmark', |
|
2564 | 2564 | throw=False, |
|
2565 | 2565 | **pycompat.strkwargs(args) |
|
2566 | 2566 | ) |
|
2567 | 2567 | |
|
2568 | 2568 | if hook.hashook(repo.ui, b'txnclose-phase'): |
|
2569 | 2569 | cl = repo.unfiltered().changelog |
|
2570 | 2570 | phasemv = sorted( |
|
2571 | 2571 | tr.changes[b'phases'], key=lambda r: r[0][0] |
|
2572 | 2572 | ) |
|
2573 | 2573 | for revs, (old, new) in phasemv: |
|
2574 | 2574 | for rev in revs: |
|
2575 | 2575 | args = tr.hookargs.copy() |
|
2576 | 2576 | node = hex(cl.node(rev)) |
|
2577 | 2577 | args.update(phases.preparehookargs(node, old, new)) |
|
2578 | 2578 | repo.hook( |
|
2579 | 2579 | b'txnclose-phase', |
|
2580 | 2580 | throw=False, |
|
2581 | 2581 | **pycompat.strkwargs(args) |
|
2582 | 2582 | ) |
|
2583 | 2583 | |
|
2584 | 2584 | repo.hook( |
|
2585 | 2585 | b'txnclose', throw=False, **pycompat.strkwargs(hookargs) |
|
2586 | 2586 | ) |
|
2587 | 2587 | |
|
2588 | 2588 | repo = reporef() |
|
2589 | 2589 | assert repo is not None # help pytype |
|
2590 | 2590 | repo._afterlock(hookfunc) |
|
2591 | 2591 | |
|
2592 | 2592 | tr.addfinalize(b'txnclose-hook', txnclosehook) |
|
2593 | 2593 | # Include a leading "-" to make it happen before the transaction summary |
|
2594 | 2594 | # reports registered via scmutil.registersummarycallback() whose names |
|
2595 | 2595 | # are 00-txnreport etc. That way, the caches will be warm when the |
|
2596 | 2596 | # callbacks run. |
|
2597 | 2597 | tr.addpostclose(b'-warm-cache', self._buildcacheupdater(tr)) |
|
2598 | 2598 | |
|
2599 | 2599 | def txnaborthook(tr2): |
|
2600 | 2600 | """To be run if transaction is aborted""" |
|
2601 | 2601 | repo = reporef() |
|
2602 | 2602 | assert repo is not None # help pytype |
|
2603 | 2603 | repo.hook( |
|
2604 | 2604 | b'txnabort', throw=False, **pycompat.strkwargs(tr2.hookargs) |
|
2605 | 2605 | ) |
|
2606 | 2606 | |
|
2607 | 2607 | tr.addabort(b'txnabort-hook', txnaborthook) |
|
2608 | 2608 | # avoid eager cache invalidation. in-memory data should be identical |
|
2609 | 2609 | # to stored data if transaction has no error. |
|
2610 | 2610 | tr.addpostclose(b'refresh-filecachestats', self._refreshfilecachestats) |
|
2611 | 2611 | self._transref = weakref.ref(tr) |
|
2612 | 2612 | scmutil.registersummarycallback(self, tr, desc) |
|
2613 | 2613 | return tr |
|
2614 | 2614 | |
|
2615 | 2615 | def _journalfiles(self): |
|
2616 | 2616 | return ( |
|
2617 | 2617 | (self.svfs, b'journal'), |
|
2618 | 2618 | (self.svfs, b'journal.narrowspec'), |
|
2619 | 2619 | (self.vfs, b'journal.narrowspec.dirstate'), |
|
2620 | 2620 | (self.vfs, b'journal.dirstate'), |
|
2621 | 2621 | (self.vfs, b'journal.branch'), |
|
2622 | 2622 | (self.vfs, b'journal.desc'), |
|
2623 | 2623 | (bookmarks.bookmarksvfs(self), b'journal.bookmarks'), |
|
2624 | 2624 | (self.svfs, b'journal.phaseroots'), |
|
2625 | 2625 | ) |
|
2626 | 2626 | |
|
2627 | 2627 | def undofiles(self): |
|
2628 | 2628 | return [(vfs, undoname(x)) for vfs, x in self._journalfiles()] |
|
2629 | 2629 | |
|
2630 | 2630 | @unfilteredmethod |
|
2631 | 2631 | def _writejournal(self, desc): |
|
2632 | 2632 | self.dirstate.savebackup(None, b'journal.dirstate') |
|
2633 | 2633 | narrowspec.savewcbackup(self, b'journal.narrowspec.dirstate') |
|
2634 | 2634 | narrowspec.savebackup(self, b'journal.narrowspec') |
|
2635 | 2635 | self.vfs.write( |
|
2636 | 2636 | b"journal.branch", encoding.fromlocal(self.dirstate.branch()) |
|
2637 | 2637 | ) |
|
2638 | 2638 | self.vfs.write(b"journal.desc", b"%d\n%s\n" % (len(self), desc)) |
|
2639 | 2639 | bookmarksvfs = bookmarks.bookmarksvfs(self) |
|
2640 | 2640 | bookmarksvfs.write( |
|
2641 | 2641 | b"journal.bookmarks", bookmarksvfs.tryread(b"bookmarks") |
|
2642 | 2642 | ) |
|
2643 | 2643 | self.svfs.write(b"journal.phaseroots", self.svfs.tryread(b"phaseroots")) |
|
2644 | 2644 | |
|
2645 | 2645 | def recover(self): |
|
2646 | 2646 | with self.lock(): |
|
2647 | 2647 | if self.svfs.exists(b"journal"): |
|
2648 | 2648 | self.ui.status(_(b"rolling back interrupted transaction\n")) |
|
2649 | 2649 | vfsmap = { |
|
2650 | 2650 | b'': self.svfs, |
|
2651 | 2651 | b'plain': self.vfs, |
|
2652 | 2652 | } |
|
2653 | 2653 | transaction.rollback( |
|
2654 | 2654 | self.svfs, |
|
2655 | 2655 | vfsmap, |
|
2656 | 2656 | b"journal", |
|
2657 | 2657 | self.ui.warn, |
|
2658 | 2658 | checkambigfiles=_cachedfiles, |
|
2659 | 2659 | ) |
|
2660 | 2660 | self.invalidate() |
|
2661 | 2661 | return True |
|
2662 | 2662 | else: |
|
2663 | 2663 | self.ui.warn(_(b"no interrupted transaction available\n")) |
|
2664 | 2664 | return False |
|
2665 | 2665 | |
|
2666 | 2666 | def rollback(self, dryrun=False, force=False): |
|
2667 | 2667 | wlock = lock = dsguard = None |
|
2668 | 2668 | try: |
|
2669 | 2669 | wlock = self.wlock() |
|
2670 | 2670 | lock = self.lock() |
|
2671 | 2671 | if self.svfs.exists(b"undo"): |
|
2672 | 2672 | dsguard = dirstateguard.dirstateguard(self, b'rollback') |
|
2673 | 2673 | |
|
2674 | 2674 | return self._rollback(dryrun, force, dsguard) |
|
2675 | 2675 | else: |
|
2676 | 2676 | self.ui.warn(_(b"no rollback information available\n")) |
|
2677 | 2677 | return 1 |
|
2678 | 2678 | finally: |
|
2679 | 2679 | release(dsguard, lock, wlock) |
|
2680 | 2680 | |
|
2681 | 2681 | @unfilteredmethod # Until we get smarter cache management |
|
2682 | 2682 | def _rollback(self, dryrun, force, dsguard): |
|
2683 | 2683 | ui = self.ui |
|
2684 | 2684 | try: |
|
2685 | 2685 | args = self.vfs.read(b'undo.desc').splitlines() |
|
2686 | 2686 | (oldlen, desc, detail) = (int(args[0]), args[1], None) |
|
2687 | 2687 | if len(args) >= 3: |
|
2688 | 2688 | detail = args[2] |
|
2689 | 2689 | oldtip = oldlen - 1 |
|
2690 | 2690 | |
|
2691 | 2691 | if detail and ui.verbose: |
|
2692 | 2692 | msg = _( |
|
2693 | 2693 | b'repository tip rolled back to revision %d' |
|
2694 | 2694 | b' (undo %s: %s)\n' |
|
2695 | 2695 | ) % (oldtip, desc, detail) |
|
2696 | 2696 | else: |
|
2697 | 2697 | msg = _( |
|
2698 | 2698 | b'repository tip rolled back to revision %d (undo %s)\n' |
|
2699 | 2699 | ) % (oldtip, desc) |
|
2700 | 2700 | except IOError: |
|
2701 | 2701 | msg = _(b'rolling back unknown transaction\n') |
|
2702 | 2702 | desc = None |
|
2703 | 2703 | |
|
2704 | 2704 | if not force and self[b'.'] != self[b'tip'] and desc == b'commit': |
|
2705 | 2705 | raise error.Abort( |
|
2706 | 2706 | _( |
|
2707 | 2707 | b'rollback of last commit while not checked out ' |
|
2708 | 2708 | b'may lose data' |
|
2709 | 2709 | ), |
|
2710 | 2710 | hint=_(b'use -f to force'), |
|
2711 | 2711 | ) |
|
2712 | 2712 | |
|
2713 | 2713 | ui.status(msg) |
|
2714 | 2714 | if dryrun: |
|
2715 | 2715 | return 0 |
|
2716 | 2716 | |
|
2717 | 2717 | parents = self.dirstate.parents() |
|
2718 | 2718 | self.destroying() |
|
2719 | 2719 | vfsmap = {b'plain': self.vfs, b'': self.svfs} |
|
2720 | 2720 | transaction.rollback( |
|
2721 | 2721 | self.svfs, vfsmap, b'undo', ui.warn, checkambigfiles=_cachedfiles |
|
2722 | 2722 | ) |
|
2723 | 2723 | bookmarksvfs = bookmarks.bookmarksvfs(self) |
|
2724 | 2724 | if bookmarksvfs.exists(b'undo.bookmarks'): |
|
2725 | 2725 | bookmarksvfs.rename( |
|
2726 | 2726 | b'undo.bookmarks', b'bookmarks', checkambig=True |
|
2727 | 2727 | ) |
|
2728 | 2728 | if self.svfs.exists(b'undo.phaseroots'): |
|
2729 | 2729 | self.svfs.rename(b'undo.phaseroots', b'phaseroots', checkambig=True) |
|
2730 | 2730 | self.invalidate() |
|
2731 | 2731 | |
|
2732 | 2732 | has_node = self.changelog.index.has_node |
|
2733 | 2733 | parentgone = any(not has_node(p) for p in parents) |
|
2734 | 2734 | if parentgone: |
|
2735 | 2735 | # prevent dirstateguard from overwriting already restored one |
|
2736 | 2736 | dsguard.close() |
|
2737 | 2737 | |
|
2738 | 2738 | narrowspec.restorebackup(self, b'undo.narrowspec') |
|
2739 | 2739 | narrowspec.restorewcbackup(self, b'undo.narrowspec.dirstate') |
|
2740 | 2740 | self.dirstate.restorebackup(None, b'undo.dirstate') |
|
2741 | 2741 | try: |
|
2742 | 2742 | branch = self.vfs.read(b'undo.branch') |
|
2743 | 2743 | self.dirstate.setbranch(encoding.tolocal(branch)) |
|
2744 | 2744 | except IOError: |
|
2745 | 2745 | ui.warn( |
|
2746 | 2746 | _( |
|
2747 | 2747 | b'named branch could not be reset: ' |
|
2748 | 2748 | b'current branch is still \'%s\'\n' |
|
2749 | 2749 | ) |
|
2750 | 2750 | % self.dirstate.branch() |
|
2751 | 2751 | ) |
|
2752 | 2752 | |
|
2753 | 2753 | parents = tuple([p.rev() for p in self[None].parents()]) |
|
2754 | 2754 | if len(parents) > 1: |
|
2755 | 2755 | ui.status( |
|
2756 | 2756 | _( |
|
2757 | 2757 | b'working directory now based on ' |
|
2758 | 2758 | b'revisions %d and %d\n' |
|
2759 | 2759 | ) |
|
2760 | 2760 | % parents |
|
2761 | 2761 | ) |
|
2762 | 2762 | else: |
|
2763 | 2763 | ui.status( |
|
2764 | 2764 | _(b'working directory now based on revision %d\n') % parents |
|
2765 | 2765 | ) |
|
2766 | 2766 | mergestatemod.mergestate.clean(self) |
|
2767 | 2767 | |
|
2768 | 2768 | # TODO: if we know which new heads may result from this rollback, pass |
|
2769 | 2769 | # them to destroy(), which will prevent the branchhead cache from being |
|
2770 | 2770 | # invalidated. |
|
2771 | 2771 | self.destroyed() |
|
2772 | 2772 | return 0 |
|
2773 | 2773 | |
|
2774 | 2774 | def _buildcacheupdater(self, newtransaction): |
|
2775 | 2775 | """called during transaction to build the callback updating cache |
|
2776 | 2776 | |
|
2777 | 2777 | Lives on the repository to help extension who might want to augment |
|
2778 | 2778 | this logic. For this purpose, the created transaction is passed to the |
|
2779 | 2779 | method. |
|
2780 | 2780 | """ |
|
2781 | 2781 | # we must avoid cyclic reference between repo and transaction. |
|
2782 | 2782 | reporef = weakref.ref(self) |
|
2783 | 2783 | |
|
2784 | 2784 | def updater(tr): |
|
2785 | 2785 | repo = reporef() |
|
2786 | 2786 | assert repo is not None # help pytype |
|
2787 | 2787 | repo.updatecaches(tr) |
|
2788 | 2788 | |
|
2789 | 2789 | return updater |
|
2790 | 2790 | |
|
2791 | 2791 | @unfilteredmethod |
|
2792 | 2792 | def updatecaches(self, tr=None, full=False, caches=None): |
|
2793 | 2793 | """warm appropriate caches |
|
2794 | 2794 | |
|
2795 | 2795 | If this function is called after a transaction closed. The transaction |
|
2796 | 2796 | will be available in the 'tr' argument. This can be used to selectively |
|
2797 | 2797 | update caches relevant to the changes in that transaction. |
|
2798 | 2798 | |
|
2799 | 2799 | If 'full' is set, make sure all caches the function knows about have |
|
2800 | 2800 | up-to-date data. Even the ones usually loaded more lazily. |
|
2801 | 2801 | |
|
2802 | 2802 | The `full` argument can take a special "post-clone" value. In this case |
|
2803 | 2803 | the cache warming is made after a clone and of the slower cache might |
|
2804 | 2804 | be skipped, namely the `.fnodetags` one. This argument is 5.8 specific |
|
2805 | 2805 | as we plan for a cleaner way to deal with this for 5.9. |
|
2806 | 2806 | """ |
|
2807 | 2807 | if tr is not None and tr.hookargs.get(b'source') == b'strip': |
|
2808 | 2808 | # During strip, many caches are invalid but |
|
2809 | 2809 | # later call to `destroyed` will refresh them. |
|
2810 | 2810 | return |
|
2811 | 2811 | |
|
2812 | 2812 | unfi = self.unfiltered() |
|
2813 | 2813 | |
|
2814 | 2814 | if full: |
|
2815 | 2815 | msg = ( |
|
2816 | 2816 | "`full` argument for `repo.updatecaches` is deprecated\n" |
|
2817 | 2817 | "(use `caches=repository.CACHE_ALL` instead)" |
|
2818 | 2818 | ) |
|
2819 | 2819 | self.ui.deprecwarn(msg, b"5.9") |
|
2820 | 2820 | caches = repository.CACHES_ALL |
|
2821 | 2821 | if full == b"post-clone": |
|
2822 | 2822 | caches = repository.CACHES_POST_CLONE |
|
2823 | 2823 | caches = repository.CACHES_ALL |
|
2824 | 2824 | elif caches is None: |
|
2825 | 2825 | caches = repository.CACHES_DEFAULT |
|
2826 | 2826 | |
|
2827 | 2827 | if repository.CACHE_BRANCHMAP_SERVED in caches: |
|
2828 | 2828 | if tr is None or tr.changes[b'origrepolen'] < len(self): |
|
2829 | 2829 | # accessing the 'served' branchmap should refresh all the others, |
|
2830 | 2830 | self.ui.debug(b'updating the branch cache\n') |
|
2831 | 2831 | self.filtered(b'served').branchmap() |
|
2832 | 2832 | self.filtered(b'served.hidden').branchmap() |
|
2833 | 2833 | |
|
2834 | 2834 | if repository.CACHE_CHANGELOG_CACHE in caches: |
|
2835 | 2835 | self.changelog.update_caches(transaction=tr) |
|
2836 | 2836 | |
|
2837 | 2837 | if repository.CACHE_MANIFESTLOG_CACHE in caches: |
|
2838 | 2838 | self.manifestlog.update_caches(transaction=tr) |
|
2839 | 2839 | |
|
2840 | 2840 | if repository.CACHE_REV_BRANCH in caches: |
|
2841 | 2841 | rbc = unfi.revbranchcache() |
|
2842 | 2842 | for r in unfi.changelog: |
|
2843 | 2843 | rbc.branchinfo(r) |
|
2844 | 2844 | rbc.write() |
|
2845 | 2845 | |
|
2846 | 2846 | if repository.CACHE_FULL_MANIFEST in caches: |
|
2847 | 2847 | # ensure the working copy parents are in the manifestfulltextcache |
|
2848 | 2848 | for ctx in self[b'.'].parents(): |
|
2849 | 2849 | ctx.manifest() # accessing the manifest is enough |
|
2850 | 2850 | |
|
2851 | 2851 | if repository.CACHE_FILE_NODE_TAGS in caches: |
|
2852 | 2852 | # accessing fnode cache warms the cache |
|
2853 | 2853 | tagsmod.fnoderevs(self.ui, unfi, unfi.changelog.revs()) |
|
2854 | 2854 | |
|
2855 | 2855 | if repository.CACHE_TAGS_DEFAULT in caches: |
|
2856 | 2856 | # accessing tags warm the cache |
|
2857 | 2857 | self.tags() |
|
2858 | 2858 | if repository.CACHE_TAGS_SERVED in caches: |
|
2859 | 2859 | self.filtered(b'served').tags() |
|
2860 | 2860 | |
|
2861 | 2861 | if repository.CACHE_BRANCHMAP_ALL in caches: |
|
2862 | 2862 | # The CACHE_BRANCHMAP_ALL updates lazily-loaded caches immediately, |
|
2863 | 2863 | # so we're forcing a write to cause these caches to be warmed up |
|
2864 | 2864 | # even if they haven't explicitly been requested yet (if they've |
|
2865 | 2865 | # never been used by hg, they won't ever have been written, even if |
|
2866 | 2866 | # they're a subset of another kind of cache that *has* been used). |
|
2867 | 2867 | for filt in repoview.filtertable.keys(): |
|
2868 | 2868 | filtered = self.filtered(filt) |
|
2869 | 2869 | filtered.branchmap().write(filtered) |
|
2870 | 2870 | |
|
2871 | 2871 | def invalidatecaches(self): |
|
2872 | 2872 | |
|
2873 | 2873 | if '_tagscache' in vars(self): |
|
2874 | 2874 | # can't use delattr on proxy |
|
2875 | 2875 | del self.__dict__['_tagscache'] |
|
2876 | 2876 | |
|
2877 | 2877 | self._branchcaches.clear() |
|
2878 | 2878 | self.invalidatevolatilesets() |
|
2879 | 2879 | self._sparsesignaturecache.clear() |
|
2880 | 2880 | |
|
2881 | 2881 | def invalidatevolatilesets(self): |
|
2882 | 2882 | self.filteredrevcache.clear() |
|
2883 | 2883 | obsolete.clearobscaches(self) |
|
2884 | 2884 | self._quick_access_changeid_invalidate() |
|
2885 | 2885 | |
|
2886 | 2886 | def invalidatedirstate(self): |
|
2887 | 2887 | """Invalidates the dirstate, causing the next call to dirstate |
|
2888 | 2888 | to check if it was modified since the last time it was read, |
|
2889 | 2889 | rereading it if it has. |
|
2890 | 2890 | |
|
2891 | 2891 | This is different to dirstate.invalidate() that it doesn't always |
|
2892 | 2892 | rereads the dirstate. Use dirstate.invalidate() if you want to |
|
2893 | 2893 | explicitly read the dirstate again (i.e. restoring it to a previous |
|
2894 | 2894 | known good state).""" |
|
2895 | 2895 | if hasunfilteredcache(self, 'dirstate'): |
|
2896 | 2896 | for k in self.dirstate._filecache: |
|
2897 | 2897 | try: |
|
2898 | 2898 | delattr(self.dirstate, k) |
|
2899 | 2899 | except AttributeError: |
|
2900 | 2900 | pass |
|
2901 | 2901 | delattr(self.unfiltered(), 'dirstate') |
|
2902 | 2902 | |
|
2903 | 2903 | def invalidate(self, clearfilecache=False): |
|
2904 | 2904 | """Invalidates both store and non-store parts other than dirstate |
|
2905 | 2905 | |
|
2906 | 2906 | If a transaction is running, invalidation of store is omitted, |
|
2907 | 2907 | because discarding in-memory changes might cause inconsistency |
|
2908 | 2908 | (e.g. incomplete fncache causes unintentional failure, but |
|
2909 | 2909 | redundant one doesn't). |
|
2910 | 2910 | """ |
|
2911 | 2911 | unfiltered = self.unfiltered() # all file caches are stored unfiltered |
|
2912 | 2912 | for k in list(self._filecache.keys()): |
|
2913 | 2913 | # dirstate is invalidated separately in invalidatedirstate() |
|
2914 | 2914 | if k == b'dirstate': |
|
2915 | 2915 | continue |
|
2916 | 2916 | if ( |
|
2917 | 2917 | k == b'changelog' |
|
2918 | 2918 | and self.currenttransaction() |
|
2919 | 2919 | and self.changelog._delayed |
|
2920 | 2920 | ): |
|
2921 | 2921 | # The changelog object may store unwritten revisions. We don't |
|
2922 | 2922 | # want to lose them. |
|
2923 | 2923 | # TODO: Solve the problem instead of working around it. |
|
2924 | 2924 | continue |
|
2925 | 2925 | |
|
2926 | 2926 | if clearfilecache: |
|
2927 | 2927 | del self._filecache[k] |
|
2928 | 2928 | try: |
|
2929 | 2929 | delattr(unfiltered, k) |
|
2930 | 2930 | except AttributeError: |
|
2931 | 2931 | pass |
|
2932 | 2932 | self.invalidatecaches() |
|
2933 | 2933 | if not self.currenttransaction(): |
|
2934 | 2934 | # TODO: Changing contents of store outside transaction |
|
2935 | 2935 | # causes inconsistency. We should make in-memory store |
|
2936 | 2936 | # changes detectable, and abort if changed. |
|
2937 | 2937 | self.store.invalidatecaches() |
|
2938 | 2938 | |
|
2939 | 2939 | def invalidateall(self): |
|
2940 | 2940 | """Fully invalidates both store and non-store parts, causing the |
|
2941 | 2941 | subsequent operation to reread any outside changes.""" |
|
2942 | 2942 | # extension should hook this to invalidate its caches |
|
2943 | 2943 | self.invalidate() |
|
2944 | 2944 | self.invalidatedirstate() |
|
2945 | 2945 | |
|
2946 | 2946 | @unfilteredmethod |
|
2947 | 2947 | def _refreshfilecachestats(self, tr): |
|
2948 | 2948 | """Reload stats of cached files so that they are flagged as valid""" |
|
2949 | 2949 | for k, ce in self._filecache.items(): |
|
2950 | 2950 | k = pycompat.sysstr(k) |
|
2951 | 2951 | if k == 'dirstate' or k not in self.__dict__: |
|
2952 | 2952 | continue |
|
2953 | 2953 | ce.refresh() |
|
2954 | 2954 | |
|
2955 | 2955 | def _lock( |
|
2956 | 2956 | self, |
|
2957 | 2957 | vfs, |
|
2958 | 2958 | lockname, |
|
2959 | 2959 | wait, |
|
2960 | 2960 | releasefn, |
|
2961 | 2961 | acquirefn, |
|
2962 | 2962 | desc, |
|
2963 | 2963 | ): |
|
2964 | 2964 | timeout = 0 |
|
2965 | 2965 | warntimeout = 0 |
|
2966 | 2966 | if wait: |
|
2967 | 2967 | timeout = self.ui.configint(b"ui", b"timeout") |
|
2968 | 2968 | warntimeout = self.ui.configint(b"ui", b"timeout.warn") |
|
2969 | 2969 | # internal config: ui.signal-safe-lock |
|
2970 | 2970 | signalsafe = self.ui.configbool(b'ui', b'signal-safe-lock') |
|
2971 | 2971 | |
|
2972 | 2972 | l = lockmod.trylock( |
|
2973 | 2973 | self.ui, |
|
2974 | 2974 | vfs, |
|
2975 | 2975 | lockname, |
|
2976 | 2976 | timeout, |
|
2977 | 2977 | warntimeout, |
|
2978 | 2978 | releasefn=releasefn, |
|
2979 | 2979 | acquirefn=acquirefn, |
|
2980 | 2980 | desc=desc, |
|
2981 | 2981 | signalsafe=signalsafe, |
|
2982 | 2982 | ) |
|
2983 | 2983 | return l |
|
2984 | 2984 | |
|
2985 | 2985 | def _afterlock(self, callback): |
|
2986 | 2986 | """add a callback to be run when the repository is fully unlocked |
|
2987 | 2987 | |
|
2988 | 2988 | The callback will be executed when the outermost lock is released |
|
2989 | 2989 | (with wlock being higher level than 'lock').""" |
|
2990 | 2990 | for ref in (self._wlockref, self._lockref): |
|
2991 | 2991 | l = ref and ref() |
|
2992 | 2992 | if l and l.held: |
|
2993 | 2993 | l.postrelease.append(callback) |
|
2994 | 2994 | break |
|
2995 | 2995 | else: # no lock have been found. |
|
2996 | 2996 | callback(True) |
|
2997 | 2997 | |
|
2998 | 2998 | def lock(self, wait=True): |
|
2999 | 2999 | """Lock the repository store (.hg/store) and return a weak reference |
|
3000 | 3000 | to the lock. Use this before modifying the store (e.g. committing or |
|
3001 | 3001 | stripping). If you are opening a transaction, get a lock as well.) |
|
3002 | 3002 | |
|
3003 | 3003 | If both 'lock' and 'wlock' must be acquired, ensure you always acquires |
|
3004 | 3004 | 'wlock' first to avoid a dead-lock hazard.""" |
|
3005 | 3005 | l = self._currentlock(self._lockref) |
|
3006 | 3006 | if l is not None: |
|
3007 | 3007 | l.lock() |
|
3008 | 3008 | return l |
|
3009 | 3009 | |
|
3010 | 3010 | l = self._lock( |
|
3011 | 3011 | vfs=self.svfs, |
|
3012 | 3012 | lockname=b"lock", |
|
3013 | 3013 | wait=wait, |
|
3014 | 3014 | releasefn=None, |
|
3015 | 3015 | acquirefn=self.invalidate, |
|
3016 | 3016 | desc=_(b'repository %s') % self.origroot, |
|
3017 | 3017 | ) |
|
3018 | 3018 | self._lockref = weakref.ref(l) |
|
3019 | 3019 | return l |
|
3020 | 3020 | |
|
3021 | 3021 | def wlock(self, wait=True): |
|
3022 | 3022 | """Lock the non-store parts of the repository (everything under |
|
3023 | 3023 | .hg except .hg/store) and return a weak reference to the lock. |
|
3024 | 3024 | |
|
3025 | 3025 | Use this before modifying files in .hg. |
|
3026 | 3026 | |
|
3027 | 3027 | If both 'lock' and 'wlock' must be acquired, ensure you always acquires |
|
3028 | 3028 | 'wlock' first to avoid a dead-lock hazard.""" |
|
3029 | 3029 | l = self._wlockref() if self._wlockref else None |
|
3030 | 3030 | if l is not None and l.held: |
|
3031 | 3031 | l.lock() |
|
3032 | 3032 | return l |
|
3033 | 3033 | |
|
3034 | 3034 | # We do not need to check for non-waiting lock acquisition. Such |
|
3035 | 3035 | # acquisition would not cause dead-lock as they would just fail. |
|
3036 | 3036 | if wait and ( |
|
3037 | 3037 | self.ui.configbool(b'devel', b'all-warnings') |
|
3038 | 3038 | or self.ui.configbool(b'devel', b'check-locks') |
|
3039 | 3039 | ): |
|
3040 | 3040 | if self._currentlock(self._lockref) is not None: |
|
3041 | 3041 | self.ui.develwarn(b'"wlock" acquired after "lock"') |
|
3042 | 3042 | |
|
3043 | 3043 | def unlock(): |
|
3044 | 3044 | if self.dirstate.pendingparentchange(): |
|
3045 | 3045 | self.dirstate.invalidate() |
|
3046 | 3046 | else: |
|
3047 | 3047 | self.dirstate.write(None) |
|
3048 | 3048 | |
|
3049 | 3049 | self._filecache[b'dirstate'].refresh() |
|
3050 | 3050 | |
|
3051 | 3051 | l = self._lock( |
|
3052 | 3052 | self.vfs, |
|
3053 | 3053 | b"wlock", |
|
3054 | 3054 | wait, |
|
3055 | 3055 | unlock, |
|
3056 | 3056 | self.invalidatedirstate, |
|
3057 | 3057 | _(b'working directory of %s') % self.origroot, |
|
3058 | 3058 | ) |
|
3059 | 3059 | self._wlockref = weakref.ref(l) |
|
3060 | 3060 | return l |
|
3061 | 3061 | |
|
3062 | 3062 | def _currentlock(self, lockref): |
|
3063 | 3063 | """Returns the lock if it's held, or None if it's not.""" |
|
3064 | 3064 | if lockref is None: |
|
3065 | 3065 | return None |
|
3066 | 3066 | l = lockref() |
|
3067 | 3067 | if l is None or not l.held: |
|
3068 | 3068 | return None |
|
3069 | 3069 | return l |
|
3070 | 3070 | |
|
3071 | 3071 | def currentwlock(self): |
|
3072 | 3072 | """Returns the wlock if it's held, or None if it's not.""" |
|
3073 | 3073 | return self._currentlock(self._wlockref) |
|
3074 | 3074 | |
|
3075 | 3075 | def checkcommitpatterns(self, wctx, match, status, fail): |
|
3076 | 3076 | """check for commit arguments that aren't committable""" |
|
3077 | 3077 | if match.isexact() or match.prefix(): |
|
3078 | 3078 | matched = set(status.modified + status.added + status.removed) |
|
3079 | 3079 | |
|
3080 | 3080 | for f in match.files(): |
|
3081 | 3081 | f = self.dirstate.normalize(f) |
|
3082 | 3082 | if f == b'.' or f in matched or f in wctx.substate: |
|
3083 | 3083 | continue |
|
3084 | 3084 | if f in status.deleted: |
|
3085 | 3085 | fail(f, _(b'file not found!')) |
|
3086 | 3086 | # Is it a directory that exists or used to exist? |
|
3087 | 3087 | if self.wvfs.isdir(f) or wctx.p1().hasdir(f): |
|
3088 | 3088 | d = f + b'/' |
|
3089 | 3089 | for mf in matched: |
|
3090 | 3090 | if mf.startswith(d): |
|
3091 | 3091 | break |
|
3092 | 3092 | else: |
|
3093 | 3093 | fail(f, _(b"no match under directory!")) |
|
3094 | 3094 | elif f not in self.dirstate: |
|
3095 | 3095 | fail(f, _(b"file not tracked!")) |
|
3096 | 3096 | |
|
3097 | 3097 | @unfilteredmethod |
|
3098 | 3098 | def commit( |
|
3099 | 3099 | self, |
|
3100 | 3100 | text=b"", |
|
3101 | 3101 | user=None, |
|
3102 | 3102 | date=None, |
|
3103 | 3103 | match=None, |
|
3104 | 3104 | force=False, |
|
3105 | 3105 | editor=None, |
|
3106 | 3106 | extra=None, |
|
3107 | 3107 | ): |
|
3108 | 3108 | """Add a new revision to current repository. |
|
3109 | 3109 | |
|
3110 | 3110 | Revision information is gathered from the working directory, |
|
3111 | 3111 | match can be used to filter the committed files. If editor is |
|
3112 | 3112 | supplied, it is called to get a commit message. |
|
3113 | 3113 | """ |
|
3114 | 3114 | if extra is None: |
|
3115 | 3115 | extra = {} |
|
3116 | 3116 | |
|
3117 | 3117 | def fail(f, msg): |
|
3118 | 3118 | raise error.InputError(b'%s: %s' % (f, msg)) |
|
3119 | 3119 | |
|
3120 | 3120 | if not match: |
|
3121 | 3121 | match = matchmod.always() |
|
3122 | 3122 | |
|
3123 | 3123 | if not force: |
|
3124 | 3124 | match.bad = fail |
|
3125 | 3125 | |
|
3126 | 3126 | # lock() for recent changelog (see issue4368) |
|
3127 | 3127 | with self.wlock(), self.lock(): |
|
3128 | 3128 | wctx = self[None] |
|
3129 | 3129 | merge = len(wctx.parents()) > 1 |
|
3130 | 3130 | |
|
3131 | 3131 | if not force and merge and not match.always(): |
|
3132 | 3132 | raise error.Abort( |
|
3133 | 3133 | _( |
|
3134 | 3134 | b'cannot partially commit a merge ' |
|
3135 | 3135 | b'(do not specify files or patterns)' |
|
3136 | 3136 | ) |
|
3137 | 3137 | ) |
|
3138 | 3138 | |
|
3139 | 3139 | status = self.status(match=match, clean=force) |
|
3140 | 3140 | if force: |
|
3141 | 3141 | status.modified.extend( |
|
3142 | 3142 | status.clean |
|
3143 | 3143 | ) # mq may commit clean files |
|
3144 | 3144 | |
|
3145 | 3145 | # check subrepos |
|
3146 | 3146 | subs, commitsubs, newstate = subrepoutil.precommit( |
|
3147 | 3147 | self.ui, wctx, status, match, force=force |
|
3148 | 3148 | ) |
|
3149 | 3149 | |
|
3150 | 3150 | # make sure all explicit patterns are matched |
|
3151 | 3151 | if not force: |
|
3152 | 3152 | self.checkcommitpatterns(wctx, match, status, fail) |
|
3153 | 3153 | |
|
3154 | 3154 | cctx = context.workingcommitctx( |
|
3155 | 3155 | self, status, text, user, date, extra |
|
3156 | 3156 | ) |
|
3157 | 3157 | |
|
3158 | 3158 | ms = mergestatemod.mergestate.read(self) |
|
3159 | 3159 | mergeutil.checkunresolved(ms) |
|
3160 | 3160 | |
|
3161 | 3161 | # internal config: ui.allowemptycommit |
|
3162 | 3162 | if cctx.isempty() and not self.ui.configbool( |
|
3163 | 3163 | b'ui', b'allowemptycommit' |
|
3164 | 3164 | ): |
|
3165 | 3165 | self.ui.debug(b'nothing to commit, clearing merge state\n') |
|
3166 | 3166 | ms.reset() |
|
3167 | 3167 | return None |
|
3168 | 3168 | |
|
3169 | 3169 | if merge and cctx.deleted(): |
|
3170 | 3170 | raise error.Abort(_(b"cannot commit merge with missing files")) |
|
3171 | 3171 | |
|
3172 | 3172 | if editor: |
|
3173 | 3173 | cctx._text = editor(self, cctx, subs) |
|
3174 | 3174 | edited = text != cctx._text |
|
3175 | 3175 | |
|
3176 | 3176 | # Save commit message in case this transaction gets rolled back |
|
3177 | 3177 | # (e.g. by a pretxncommit hook). Leave the content alone on |
|
3178 | 3178 | # the assumption that the user will use the same editor again. |
|
3179 | 3179 | msgfn = self.savecommitmessage(cctx._text) |
|
3180 | 3180 | |
|
3181 | 3181 | # commit subs and write new state |
|
3182 | 3182 | if subs: |
|
3183 | 3183 | uipathfn = scmutil.getuipathfn(self) |
|
3184 | 3184 | for s in sorted(commitsubs): |
|
3185 | 3185 | sub = wctx.sub(s) |
|
3186 | 3186 | self.ui.status( |
|
3187 | 3187 | _(b'committing subrepository %s\n') |
|
3188 | 3188 | % uipathfn(subrepoutil.subrelpath(sub)) |
|
3189 | 3189 | ) |
|
3190 | 3190 | sr = sub.commit(cctx._text, user, date) |
|
3191 | 3191 | newstate[s] = (newstate[s][0], sr) |
|
3192 | 3192 | subrepoutil.writestate(self, newstate) |
|
3193 | 3193 | |
|
3194 | 3194 | p1, p2 = self.dirstate.parents() |
|
3195 | 3195 | hookp1, hookp2 = hex(p1), (p2 != self.nullid and hex(p2) or b'') |
|
3196 | 3196 | try: |
|
3197 | 3197 | self.hook( |
|
3198 | 3198 | b"precommit", throw=True, parent1=hookp1, parent2=hookp2 |
|
3199 | 3199 | ) |
|
3200 | 3200 | with self.transaction(b'commit'): |
|
3201 | 3201 | ret = self.commitctx(cctx, True) |
|
3202 | 3202 | # update bookmarks, dirstate and mergestate |
|
3203 | 3203 | bookmarks.update(self, [p1, p2], ret) |
|
3204 | 3204 | cctx.markcommitted(ret) |
|
3205 | 3205 | ms.reset() |
|
3206 | 3206 | except: # re-raises |
|
3207 | 3207 | if edited: |
|
3208 | 3208 | self.ui.write( |
|
3209 | 3209 | _(b'note: commit message saved in %s\n') % msgfn |
|
3210 | 3210 | ) |
|
3211 | 3211 | self.ui.write( |
|
3212 | 3212 | _( |
|
3213 | 3213 | b"note: use 'hg commit --logfile " |
|
3214 | 3214 | b".hg/last-message.txt --edit' to reuse it\n" |
|
3215 | 3215 | ) |
|
3216 | 3216 | ) |
|
3217 | 3217 | raise |
|
3218 | 3218 | |
|
3219 | 3219 | def commithook(unused_success): |
|
3220 | 3220 | # hack for command that use a temporary commit (eg: histedit) |
|
3221 | 3221 | # temporary commit got stripped before hook release |
|
3222 | 3222 | if self.changelog.hasnode(ret): |
|
3223 | 3223 | self.hook( |
|
3224 | 3224 | b"commit", node=hex(ret), parent1=hookp1, parent2=hookp2 |
|
3225 | 3225 | ) |
|
3226 | 3226 | |
|
3227 | 3227 | self._afterlock(commithook) |
|
3228 | 3228 | return ret |
|
3229 | 3229 | |
|
3230 | 3230 | @unfilteredmethod |
|
3231 | 3231 | def commitctx(self, ctx, error=False, origctx=None): |
|
3232 | 3232 | return commit.commitctx(self, ctx, error=error, origctx=origctx) |
|
3233 | 3233 | |
|
3234 | 3234 | @unfilteredmethod |
|
3235 | 3235 | def destroying(self): |
|
3236 | 3236 | """Inform the repository that nodes are about to be destroyed. |
|
3237 | 3237 | Intended for use by strip and rollback, so there's a common |
|
3238 | 3238 | place for anything that has to be done before destroying history. |
|
3239 | 3239 | |
|
3240 | 3240 | This is mostly useful for saving state that is in memory and waiting |
|
3241 | 3241 | to be flushed when the current lock is released. Because a call to |
|
3242 | 3242 | destroyed is imminent, the repo will be invalidated causing those |
|
3243 | 3243 | changes to stay in memory (waiting for the next unlock), or vanish |
|
3244 | 3244 | completely. |
|
3245 | 3245 | """ |
|
3246 | 3246 | # When using the same lock to commit and strip, the phasecache is left |
|
3247 | 3247 | # dirty after committing. Then when we strip, the repo is invalidated, |
|
3248 | 3248 | # causing those changes to disappear. |
|
3249 | 3249 | if '_phasecache' in vars(self): |
|
3250 | 3250 | self._phasecache.write() |
|
3251 | 3251 | |
|
3252 | 3252 | @unfilteredmethod |
|
3253 | 3253 | def destroyed(self): |
|
3254 | 3254 | """Inform the repository that nodes have been destroyed. |
|
3255 | 3255 | Intended for use by strip and rollback, so there's a common |
|
3256 | 3256 | place for anything that has to be done after destroying history. |
|
3257 | 3257 | """ |
|
3258 | 3258 | # When one tries to: |
|
3259 | 3259 | # 1) destroy nodes thus calling this method (e.g. strip) |
|
3260 | 3260 | # 2) use phasecache somewhere (e.g. commit) |
|
3261 | 3261 | # |
|
3262 | 3262 | # then 2) will fail because the phasecache contains nodes that were |
|
3263 | 3263 | # removed. We can either remove phasecache from the filecache, |
|
3264 | 3264 | # causing it to reload next time it is accessed, or simply filter |
|
3265 | 3265 | # the removed nodes now and write the updated cache. |
|
3266 | 3266 | self._phasecache.filterunknown(self) |
|
3267 | 3267 | self._phasecache.write() |
|
3268 | 3268 | |
|
3269 | 3269 | # refresh all repository caches |
|
3270 | 3270 | self.updatecaches() |
|
3271 | 3271 | |
|
3272 | 3272 | # Ensure the persistent tag cache is updated. Doing it now |
|
3273 | 3273 | # means that the tag cache only has to worry about destroyed |
|
3274 | 3274 | # heads immediately after a strip/rollback. That in turn |
|
3275 | 3275 | # guarantees that "cachetip == currenttip" (comparing both rev |
|
3276 | 3276 | # and node) always means no nodes have been added or destroyed. |
|
3277 | 3277 | |
|
3278 | 3278 | # XXX this is suboptimal when qrefresh'ing: we strip the current |
|
3279 | 3279 | # head, refresh the tag cache, then immediately add a new head. |
|
3280 | 3280 | # But I think doing it this way is necessary for the "instant |
|
3281 | 3281 | # tag cache retrieval" case to work. |
|
3282 | 3282 | self.invalidate() |
|
3283 | 3283 | |
|
3284 | 3284 | def status( |
|
3285 | 3285 | self, |
|
3286 | 3286 | node1=b'.', |
|
3287 | 3287 | node2=None, |
|
3288 | 3288 | match=None, |
|
3289 | 3289 | ignored=False, |
|
3290 | 3290 | clean=False, |
|
3291 | 3291 | unknown=False, |
|
3292 | 3292 | listsubrepos=False, |
|
3293 | 3293 | ): |
|
3294 | 3294 | '''a convenience method that calls node1.status(node2)''' |
|
3295 | 3295 | return self[node1].status( |
|
3296 | 3296 | node2, match, ignored, clean, unknown, listsubrepos |
|
3297 | 3297 | ) |
|
3298 | 3298 | |
|
3299 | 3299 | def addpostdsstatus(self, ps): |
|
3300 | 3300 | """Add a callback to run within the wlock, at the point at which status |
|
3301 | 3301 | fixups happen. |
|
3302 | 3302 | |
|
3303 | 3303 | On status completion, callback(wctx, status) will be called with the |
|
3304 | 3304 | wlock held, unless the dirstate has changed from underneath or the wlock |
|
3305 | 3305 | couldn't be grabbed. |
|
3306 | 3306 | |
|
3307 | 3307 | Callbacks should not capture and use a cached copy of the dirstate -- |
|
3308 | 3308 | it might change in the meanwhile. Instead, they should access the |
|
3309 | 3309 | dirstate via wctx.repo().dirstate. |
|
3310 | 3310 | |
|
3311 | 3311 | This list is emptied out after each status run -- extensions should |
|
3312 | 3312 | make sure it adds to this list each time dirstate.status is called. |
|
3313 | 3313 | Extensions should also make sure they don't call this for statuses |
|
3314 | 3314 | that don't involve the dirstate. |
|
3315 | 3315 | """ |
|
3316 | 3316 | |
|
3317 | 3317 | # The list is located here for uniqueness reasons -- it is actually |
|
3318 | 3318 | # managed by the workingctx, but that isn't unique per-repo. |
|
3319 | 3319 | self._postdsstatus.append(ps) |
|
3320 | 3320 | |
|
3321 | 3321 | def postdsstatus(self): |
|
3322 | 3322 | """Used by workingctx to get the list of post-dirstate-status hooks.""" |
|
3323 | 3323 | return self._postdsstatus |
|
3324 | 3324 | |
|
3325 | 3325 | def clearpostdsstatus(self): |
|
3326 | 3326 | """Used by workingctx to clear post-dirstate-status hooks.""" |
|
3327 | 3327 | del self._postdsstatus[:] |
|
3328 | 3328 | |
|
3329 | 3329 | def heads(self, start=None): |
|
3330 | 3330 | if start is None: |
|
3331 | 3331 | cl = self.changelog |
|
3332 | 3332 | headrevs = reversed(cl.headrevs()) |
|
3333 | 3333 | return [cl.node(rev) for rev in headrevs] |
|
3334 | 3334 | |
|
3335 | 3335 | heads = self.changelog.heads(start) |
|
3336 | 3336 | # sort the output in rev descending order |
|
3337 | 3337 | return sorted(heads, key=self.changelog.rev, reverse=True) |
|
3338 | 3338 | |
|
3339 | 3339 | def branchheads(self, branch=None, start=None, closed=False): |
|
3340 | 3340 | """return a (possibly filtered) list of heads for the given branch |
|
3341 | 3341 | |
|
3342 | 3342 | Heads are returned in topological order, from newest to oldest. |
|
3343 | 3343 | If branch is None, use the dirstate branch. |
|
3344 | 3344 | If start is not None, return only heads reachable from start. |
|
3345 | 3345 | If closed is True, return heads that are marked as closed as well. |
|
3346 | 3346 | """ |
|
3347 | 3347 | if branch is None: |
|
3348 | 3348 | branch = self[None].branch() |
|
3349 | 3349 | branches = self.branchmap() |
|
3350 | 3350 | if not branches.hasbranch(branch): |
|
3351 | 3351 | return [] |
|
3352 | 3352 | # the cache returns heads ordered lowest to highest |
|
3353 | 3353 | bheads = list(reversed(branches.branchheads(branch, closed=closed))) |
|
3354 | 3354 | if start is not None: |
|
3355 | 3355 | # filter out the heads that cannot be reached from startrev |
|
3356 | 3356 | fbheads = set(self.changelog.nodesbetween([start], bheads)[2]) |
|
3357 | 3357 | bheads = [h for h in bheads if h in fbheads] |
|
3358 | 3358 | return bheads |
|
3359 | 3359 | |
|
3360 | 3360 | def branches(self, nodes): |
|
3361 | 3361 | if not nodes: |
|
3362 | 3362 | nodes = [self.changelog.tip()] |
|
3363 | 3363 | b = [] |
|
3364 | 3364 | for n in nodes: |
|
3365 | 3365 | t = n |
|
3366 | 3366 | while True: |
|
3367 | 3367 | p = self.changelog.parents(n) |
|
3368 | 3368 | if p[1] != self.nullid or p[0] == self.nullid: |
|
3369 | 3369 | b.append((t, n, p[0], p[1])) |
|
3370 | 3370 | break |
|
3371 | 3371 | n = p[0] |
|
3372 | 3372 | return b |
|
3373 | 3373 | |
|
3374 | 3374 | def between(self, pairs): |
|
3375 | 3375 | r = [] |
|
3376 | 3376 | |
|
3377 | 3377 | for top, bottom in pairs: |
|
3378 | 3378 | n, l, i = top, [], 0 |
|
3379 | 3379 | f = 1 |
|
3380 | 3380 | |
|
3381 | 3381 | while n != bottom and n != self.nullid: |
|
3382 | 3382 | p = self.changelog.parents(n)[0] |
|
3383 | 3383 | if i == f: |
|
3384 | 3384 | l.append(n) |
|
3385 | 3385 | f = f * 2 |
|
3386 | 3386 | n = p |
|
3387 | 3387 | i += 1 |
|
3388 | 3388 | |
|
3389 | 3389 | r.append(l) |
|
3390 | 3390 | |
|
3391 | 3391 | return r |
|
3392 | 3392 | |
|
3393 | 3393 | def checkpush(self, pushop): |
|
3394 | 3394 | """Extensions can override this function if additional checks have |
|
3395 | 3395 | to be performed before pushing, or call it if they override push |
|
3396 | 3396 | command. |
|
3397 | 3397 | """ |
|
3398 | 3398 | |
|
3399 | 3399 | @unfilteredpropertycache |
|
3400 | 3400 | def prepushoutgoinghooks(self): |
|
3401 | 3401 | """Return util.hooks consists of a pushop with repo, remote, outgoing |
|
3402 | 3402 | methods, which are called before pushing changesets. |
|
3403 | 3403 | """ |
|
3404 | 3404 | return util.hooks() |
|
3405 | 3405 | |
|
3406 | 3406 | def pushkey(self, namespace, key, old, new): |
|
3407 | 3407 | try: |
|
3408 | 3408 | tr = self.currenttransaction() |
|
3409 | 3409 | hookargs = {} |
|
3410 | 3410 | if tr is not None: |
|
3411 | 3411 | hookargs.update(tr.hookargs) |
|
3412 | 3412 | hookargs = pycompat.strkwargs(hookargs) |
|
3413 | 3413 | hookargs['namespace'] = namespace |
|
3414 | 3414 | hookargs['key'] = key |
|
3415 | 3415 | hookargs['old'] = old |
|
3416 | 3416 | hookargs['new'] = new |
|
3417 | 3417 | self.hook(b'prepushkey', throw=True, **hookargs) |
|
3418 | 3418 | except error.HookAbort as exc: |
|
3419 | 3419 | self.ui.write_err(_(b"pushkey-abort: %s\n") % exc) |
|
3420 | 3420 | if exc.hint: |
|
3421 | 3421 | self.ui.write_err(_(b"(%s)\n") % exc.hint) |
|
3422 | 3422 | return False |
|
3423 | 3423 | self.ui.debug(b'pushing key for "%s:%s"\n' % (namespace, key)) |
|
3424 | 3424 | ret = pushkey.push(self, namespace, key, old, new) |
|
3425 | 3425 | |
|
3426 | 3426 | def runhook(unused_success): |
|
3427 | 3427 | self.hook( |
|
3428 | 3428 | b'pushkey', |
|
3429 | 3429 | namespace=namespace, |
|
3430 | 3430 | key=key, |
|
3431 | 3431 | old=old, |
|
3432 | 3432 | new=new, |
|
3433 | 3433 | ret=ret, |
|
3434 | 3434 | ) |
|
3435 | 3435 | |
|
3436 | 3436 | self._afterlock(runhook) |
|
3437 | 3437 | return ret |
|
3438 | 3438 | |
|
3439 | 3439 | def listkeys(self, namespace): |
|
3440 | 3440 | self.hook(b'prelistkeys', throw=True, namespace=namespace) |
|
3441 | 3441 | self.ui.debug(b'listing keys for "%s"\n' % namespace) |
|
3442 | 3442 | values = pushkey.list(self, namespace) |
|
3443 | 3443 | self.hook(b'listkeys', namespace=namespace, values=values) |
|
3444 | 3444 | return values |
|
3445 | 3445 | |
|
3446 | 3446 | def debugwireargs(self, one, two, three=None, four=None, five=None): |
|
3447 | 3447 | '''used to test argument passing over the wire''' |
|
3448 | 3448 | return b"%s %s %s %s %s" % ( |
|
3449 | 3449 | one, |
|
3450 | 3450 | two, |
|
3451 | 3451 | pycompat.bytestr(three), |
|
3452 | 3452 | pycompat.bytestr(four), |
|
3453 | 3453 | pycompat.bytestr(five), |
|
3454 | 3454 | ) |
|
3455 | 3455 | |
|
3456 | 3456 | def savecommitmessage(self, text): |
|
3457 | 3457 | fp = self.vfs(b'last-message.txt', b'wb') |
|
3458 | 3458 | try: |
|
3459 | 3459 | fp.write(text) |
|
3460 | 3460 | finally: |
|
3461 | 3461 | fp.close() |
|
3462 | 3462 | return self.pathto(fp.name[len(self.root) + 1 :]) |
|
3463 | 3463 | |
|
3464 | 3464 | def register_wanted_sidedata(self, category): |
|
3465 | 3465 | if repository.REPO_FEATURE_SIDE_DATA not in self.features: |
|
3466 | 3466 | # Only revlogv2 repos can want sidedata. |
|
3467 | 3467 | return |
|
3468 | 3468 | self._wanted_sidedata.add(pycompat.bytestr(category)) |
|
3469 | 3469 | |
|
3470 | 3470 | def register_sidedata_computer( |
|
3471 | 3471 | self, kind, category, keys, computer, flags, replace=False |
|
3472 | 3472 | ): |
|
3473 | 3473 | if kind not in revlogconst.ALL_KINDS: |
|
3474 | 3474 | msg = _(b"unexpected revlog kind '%s'.") |
|
3475 | 3475 | raise error.ProgrammingError(msg % kind) |
|
3476 | 3476 | category = pycompat.bytestr(category) |
|
3477 | 3477 | already_registered = category in self._sidedata_computers.get(kind, []) |
|
3478 | 3478 | if already_registered and not replace: |
|
3479 | 3479 | msg = _( |
|
3480 | 3480 | b"cannot register a sidedata computer twice for category '%s'." |
|
3481 | 3481 | ) |
|
3482 | 3482 | raise error.ProgrammingError(msg % category) |
|
3483 | 3483 | if replace and not already_registered: |
|
3484 | 3484 | msg = _( |
|
3485 | 3485 | b"cannot replace a sidedata computer that isn't registered " |
|
3486 | 3486 | b"for category '%s'." |
|
3487 | 3487 | ) |
|
3488 | 3488 | raise error.ProgrammingError(msg % category) |
|
3489 | 3489 | self._sidedata_computers.setdefault(kind, {}) |
|
3490 | 3490 | self._sidedata_computers[kind][category] = (keys, computer, flags) |
|
3491 | 3491 | |
|
3492 | 3492 | |
|
3493 | 3493 | # used to avoid circular references so destructors work |
|
3494 | 3494 | def aftertrans(files): |
|
3495 | 3495 | renamefiles = [tuple(t) for t in files] |
|
3496 | 3496 | |
|
3497 | 3497 | def a(): |
|
3498 | 3498 | for vfs, src, dest in renamefiles: |
|
3499 | 3499 | # if src and dest refer to a same file, vfs.rename is a no-op, |
|
3500 | 3500 | # leaving both src and dest on disk. delete dest to make sure |
|
3501 | 3501 | # the rename couldn't be such a no-op. |
|
3502 | 3502 | vfs.tryunlink(dest) |
|
3503 | 3503 | try: |
|
3504 | 3504 | vfs.rename(src, dest) |
|
3505 | 3505 | except OSError as exc: # journal file does not yet exist |
|
3506 | 3506 | if exc.errno != errno.ENOENT: |
|
3507 | 3507 | raise |
|
3508 | 3508 | |
|
3509 | 3509 | return a |
|
3510 | 3510 | |
|
3511 | 3511 | |
|
3512 | 3512 | def undoname(fn): |
|
3513 | 3513 | base, name = os.path.split(fn) |
|
3514 | 3514 | assert name.startswith(b'journal') |
|
3515 | 3515 | return os.path.join(base, name.replace(b'journal', b'undo', 1)) |
|
3516 | 3516 | |
|
3517 | 3517 | |
|
3518 | 3518 | def instance(ui, path, create, intents=None, createopts=None): |
|
3519 | 3519 | localpath = urlutil.urllocalpath(path) |
|
3520 | 3520 | if create: |
|
3521 | 3521 | createrepository(ui, localpath, createopts=createopts) |
|
3522 | 3522 | |
|
3523 | 3523 | return makelocalrepository(ui, localpath, intents=intents) |
|
3524 | 3524 | |
|
3525 | 3525 | |
|
3526 | 3526 | def islocal(path): |
|
3527 | 3527 | return True |
|
3528 | 3528 | |
|
3529 | 3529 | |
|
3530 | 3530 | def defaultcreateopts(ui, createopts=None): |
|
3531 | 3531 | """Populate the default creation options for a repository. |
|
3532 | 3532 | |
|
3533 | 3533 | A dictionary of explicitly requested creation options can be passed |
|
3534 | 3534 | in. Missing keys will be populated. |
|
3535 | 3535 | """ |
|
3536 | 3536 | createopts = dict(createopts or {}) |
|
3537 | 3537 | |
|
3538 | 3538 | if b'backend' not in createopts: |
|
3539 | 3539 | # experimental config: storage.new-repo-backend |
|
3540 | 3540 | createopts[b'backend'] = ui.config(b'storage', b'new-repo-backend') |
|
3541 | 3541 | |
|
3542 | 3542 | return createopts |
|
3543 | 3543 | |
|
3544 | 3544 | |
|
3545 | 3545 | def clone_requirements(ui, createopts, srcrepo): |
|
3546 | 3546 | """clone the requirements of a local repo for a local clone |
|
3547 | 3547 | |
|
3548 | 3548 | The store requirements are unchanged while the working copy requirements |
|
3549 | 3549 | depends on the configuration |
|
3550 | 3550 | """ |
|
3551 | 3551 | target_requirements = set() |
|
3552 | 3552 | createopts = defaultcreateopts(ui, createopts=createopts) |
|
3553 | 3553 | for r in newreporequirements(ui, createopts): |
|
3554 | 3554 | if r in requirementsmod.WORKING_DIR_REQUIREMENTS: |
|
3555 | 3555 | target_requirements.add(r) |
|
3556 | 3556 | |
|
3557 | 3557 | for r in srcrepo.requirements: |
|
3558 | 3558 | if r not in requirementsmod.WORKING_DIR_REQUIREMENTS: |
|
3559 | 3559 | target_requirements.add(r) |
|
3560 | 3560 | return target_requirements |
|
3561 | 3561 | |
|
3562 | 3562 | |
|
3563 | 3563 | def newreporequirements(ui, createopts): |
|
3564 | 3564 | """Determine the set of requirements for a new local repository. |
|
3565 | 3565 | |
|
3566 | 3566 | Extensions can wrap this function to specify custom requirements for |
|
3567 | 3567 | new repositories. |
|
3568 | 3568 | """ |
|
3569 | 3569 | # If the repo is being created from a shared repository, we copy |
|
3570 | 3570 | # its requirements. |
|
3571 | 3571 | if b'sharedrepo' in createopts: |
|
3572 | 3572 | requirements = set(createopts[b'sharedrepo'].requirements) |
|
3573 | 3573 | if createopts.get(b'sharedrelative'): |
|
3574 | 3574 | requirements.add(requirementsmod.RELATIVE_SHARED_REQUIREMENT) |
|
3575 | 3575 | else: |
|
3576 | 3576 | requirements.add(requirementsmod.SHARED_REQUIREMENT) |
|
3577 | 3577 | |
|
3578 | 3578 | return requirements |
|
3579 | 3579 | |
|
3580 | 3580 | if b'backend' not in createopts: |
|
3581 | 3581 | raise error.ProgrammingError( |
|
3582 | 3582 | b'backend key not present in createopts; ' |
|
3583 | 3583 | b'was defaultcreateopts() called?' |
|
3584 | 3584 | ) |
|
3585 | 3585 | |
|
3586 | 3586 | if createopts[b'backend'] != b'revlogv1': |
|
3587 | 3587 | raise error.Abort( |
|
3588 | 3588 | _( |
|
3589 | 3589 | b'unable to determine repository requirements for ' |
|
3590 | 3590 | b'storage backend: %s' |
|
3591 | 3591 | ) |
|
3592 | 3592 | % createopts[b'backend'] |
|
3593 | 3593 | ) |
|
3594 | 3594 | |
|
3595 | 3595 | requirements = {requirementsmod.REVLOGV1_REQUIREMENT} |
|
3596 | 3596 | if ui.configbool(b'format', b'usestore'): |
|
3597 | 3597 | requirements.add(requirementsmod.STORE_REQUIREMENT) |
|
3598 | 3598 | if ui.configbool(b'format', b'usefncache'): |
|
3599 | 3599 | requirements.add(requirementsmod.FNCACHE_REQUIREMENT) |
|
3600 | 3600 | if ui.configbool(b'format', b'dotencode'): |
|
3601 | 3601 | requirements.add(requirementsmod.DOTENCODE_REQUIREMENT) |
|
3602 | 3602 | |
|
3603 | 3603 | compengines = ui.configlist(b'format', b'revlog-compression') |
|
3604 | 3604 | for compengine in compengines: |
|
3605 | 3605 | if compengine in util.compengines: |
|
3606 | 3606 | engine = util.compengines[compengine] |
|
3607 | 3607 | if engine.available() and engine.revlogheader(): |
|
3608 | 3608 | break |
|
3609 | 3609 | else: |
|
3610 | 3610 | raise error.Abort( |
|
3611 | 3611 | _( |
|
3612 | 3612 | b'compression engines %s defined by ' |
|
3613 | 3613 | b'format.revlog-compression not available' |
|
3614 | 3614 | ) |
|
3615 | 3615 | % b', '.join(b'"%s"' % e for e in compengines), |
|
3616 | 3616 | hint=_( |
|
3617 | 3617 | b'run "hg debuginstall" to list available ' |
|
3618 | 3618 | b'compression engines' |
|
3619 | 3619 | ), |
|
3620 | 3620 | ) |
|
3621 | 3621 | |
|
3622 | 3622 | # zlib is the historical default and doesn't need an explicit requirement. |
|
3623 | 3623 | if compengine == b'zstd': |
|
3624 | 3624 | requirements.add(b'revlog-compression-zstd') |
|
3625 | 3625 | elif compengine != b'zlib': |
|
3626 | 3626 | requirements.add(b'exp-compression-%s' % compengine) |
|
3627 | 3627 | |
|
3628 | 3628 | if scmutil.gdinitconfig(ui): |
|
3629 | 3629 | requirements.add(requirementsmod.GENERALDELTA_REQUIREMENT) |
|
3630 | 3630 | if ui.configbool(b'format', b'sparse-revlog'): |
|
3631 | 3631 | requirements.add(requirementsmod.SPARSEREVLOG_REQUIREMENT) |
|
3632 | 3632 | |
|
3633 |
# experimental config: format.e |
|
|
3633 | # experimental config: format.use-dirstate-v2 | |
|
3634 | 3634 | # Keep this logic in sync with `has_dirstate_v2()` in `tests/hghave.py` |
|
3635 |
if ui.configbool(b'format', b'e |
|
|
3635 | if ui.configbool(b'format', b'use-dirstate-v2'): | |
|
3636 | 3636 | requirements.add(requirementsmod.DIRSTATE_V2_REQUIREMENT) |
|
3637 | 3637 | |
|
3638 | 3638 | # experimental config: format.exp-use-copies-side-data-changeset |
|
3639 | 3639 | if ui.configbool(b'format', b'exp-use-copies-side-data-changeset'): |
|
3640 | 3640 | requirements.add(requirementsmod.CHANGELOGV2_REQUIREMENT) |
|
3641 | 3641 | requirements.add(requirementsmod.COPIESSDC_REQUIREMENT) |
|
3642 | 3642 | if ui.configbool(b'experimental', b'treemanifest'): |
|
3643 | 3643 | requirements.add(requirementsmod.TREEMANIFEST_REQUIREMENT) |
|
3644 | 3644 | |
|
3645 | 3645 | changelogv2 = ui.config(b'format', b'exp-use-changelog-v2') |
|
3646 | 3646 | if changelogv2 == b'enable-unstable-format-and-corrupt-my-data': |
|
3647 | 3647 | requirements.add(requirementsmod.CHANGELOGV2_REQUIREMENT) |
|
3648 | 3648 | |
|
3649 | 3649 | revlogv2 = ui.config(b'experimental', b'revlogv2') |
|
3650 | 3650 | if revlogv2 == b'enable-unstable-format-and-corrupt-my-data': |
|
3651 | 3651 | requirements.discard(requirementsmod.REVLOGV1_REQUIREMENT) |
|
3652 | 3652 | requirements.add(requirementsmod.REVLOGV2_REQUIREMENT) |
|
3653 | 3653 | # experimental config: format.internal-phase |
|
3654 | 3654 | if ui.configbool(b'format', b'internal-phase'): |
|
3655 | 3655 | requirements.add(requirementsmod.INTERNAL_PHASE_REQUIREMENT) |
|
3656 | 3656 | |
|
3657 | 3657 | if createopts.get(b'narrowfiles'): |
|
3658 | 3658 | requirements.add(requirementsmod.NARROW_REQUIREMENT) |
|
3659 | 3659 | |
|
3660 | 3660 | if createopts.get(b'lfs'): |
|
3661 | 3661 | requirements.add(b'lfs') |
|
3662 | 3662 | |
|
3663 | 3663 | if ui.configbool(b'format', b'bookmarks-in-store'): |
|
3664 | 3664 | requirements.add(bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT) |
|
3665 | 3665 | |
|
3666 | 3666 | if ui.configbool(b'format', b'use-persistent-nodemap'): |
|
3667 | 3667 | requirements.add(requirementsmod.NODEMAP_REQUIREMENT) |
|
3668 | 3668 | |
|
3669 | 3669 | # if share-safe is enabled, let's create the new repository with the new |
|
3670 | 3670 | # requirement |
|
3671 | 3671 | if ui.configbool(b'format', b'use-share-safe'): |
|
3672 | 3672 | requirements.add(requirementsmod.SHARESAFE_REQUIREMENT) |
|
3673 | 3673 | |
|
3674 | 3674 | return requirements |
|
3675 | 3675 | |
|
3676 | 3676 | |
|
3677 | 3677 | def checkrequirementscompat(ui, requirements): |
|
3678 | 3678 | """Checks compatibility of repository requirements enabled and disabled. |
|
3679 | 3679 | |
|
3680 | 3680 | Returns a set of requirements which needs to be dropped because dependend |
|
3681 | 3681 | requirements are not enabled. Also warns users about it""" |
|
3682 | 3682 | |
|
3683 | 3683 | dropped = set() |
|
3684 | 3684 | |
|
3685 | 3685 | if requirementsmod.STORE_REQUIREMENT not in requirements: |
|
3686 | 3686 | if bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT in requirements: |
|
3687 | 3687 | ui.warn( |
|
3688 | 3688 | _( |
|
3689 | 3689 | b'ignoring enabled \'format.bookmarks-in-store\' config ' |
|
3690 | 3690 | b'beacuse it is incompatible with disabled ' |
|
3691 | 3691 | b'\'format.usestore\' config\n' |
|
3692 | 3692 | ) |
|
3693 | 3693 | ) |
|
3694 | 3694 | dropped.add(bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT) |
|
3695 | 3695 | |
|
3696 | 3696 | if ( |
|
3697 | 3697 | requirementsmod.SHARED_REQUIREMENT in requirements |
|
3698 | 3698 | or requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements |
|
3699 | 3699 | ): |
|
3700 | 3700 | raise error.Abort( |
|
3701 | 3701 | _( |
|
3702 | 3702 | b"cannot create shared repository as source was created" |
|
3703 | 3703 | b" with 'format.usestore' config disabled" |
|
3704 | 3704 | ) |
|
3705 | 3705 | ) |
|
3706 | 3706 | |
|
3707 | 3707 | if requirementsmod.SHARESAFE_REQUIREMENT in requirements: |
|
3708 | 3708 | ui.warn( |
|
3709 | 3709 | _( |
|
3710 | 3710 | b"ignoring enabled 'format.use-share-safe' config because " |
|
3711 | 3711 | b"it is incompatible with disabled 'format.usestore'" |
|
3712 | 3712 | b" config\n" |
|
3713 | 3713 | ) |
|
3714 | 3714 | ) |
|
3715 | 3715 | dropped.add(requirementsmod.SHARESAFE_REQUIREMENT) |
|
3716 | 3716 | |
|
3717 | 3717 | return dropped |
|
3718 | 3718 | |
|
3719 | 3719 | |
|
3720 | 3720 | def filterknowncreateopts(ui, createopts): |
|
3721 | 3721 | """Filters a dict of repo creation options against options that are known. |
|
3722 | 3722 | |
|
3723 | 3723 | Receives a dict of repo creation options and returns a dict of those |
|
3724 | 3724 | options that we don't know how to handle. |
|
3725 | 3725 | |
|
3726 | 3726 | This function is called as part of repository creation. If the |
|
3727 | 3727 | returned dict contains any items, repository creation will not |
|
3728 | 3728 | be allowed, as it means there was a request to create a repository |
|
3729 | 3729 | with options not recognized by loaded code. |
|
3730 | 3730 | |
|
3731 | 3731 | Extensions can wrap this function to filter out creation options |
|
3732 | 3732 | they know how to handle. |
|
3733 | 3733 | """ |
|
3734 | 3734 | known = { |
|
3735 | 3735 | b'backend', |
|
3736 | 3736 | b'lfs', |
|
3737 | 3737 | b'narrowfiles', |
|
3738 | 3738 | b'sharedrepo', |
|
3739 | 3739 | b'sharedrelative', |
|
3740 | 3740 | b'shareditems', |
|
3741 | 3741 | b'shallowfilestore', |
|
3742 | 3742 | } |
|
3743 | 3743 | |
|
3744 | 3744 | return {k: v for k, v in createopts.items() if k not in known} |
|
3745 | 3745 | |
|
3746 | 3746 | |
|
3747 | 3747 | def createrepository(ui, path, createopts=None, requirements=None): |
|
3748 | 3748 | """Create a new repository in a vfs. |
|
3749 | 3749 | |
|
3750 | 3750 | ``path`` path to the new repo's working directory. |
|
3751 | 3751 | ``createopts`` options for the new repository. |
|
3752 | 3752 | ``requirement`` predefined set of requirements. |
|
3753 | 3753 | (incompatible with ``createopts``) |
|
3754 | 3754 | |
|
3755 | 3755 | The following keys for ``createopts`` are recognized: |
|
3756 | 3756 | |
|
3757 | 3757 | backend |
|
3758 | 3758 | The storage backend to use. |
|
3759 | 3759 | lfs |
|
3760 | 3760 | Repository will be created with ``lfs`` requirement. The lfs extension |
|
3761 | 3761 | will automatically be loaded when the repository is accessed. |
|
3762 | 3762 | narrowfiles |
|
3763 | 3763 | Set up repository to support narrow file storage. |
|
3764 | 3764 | sharedrepo |
|
3765 | 3765 | Repository object from which storage should be shared. |
|
3766 | 3766 | sharedrelative |
|
3767 | 3767 | Boolean indicating if the path to the shared repo should be |
|
3768 | 3768 | stored as relative. By default, the pointer to the "parent" repo |
|
3769 | 3769 | is stored as an absolute path. |
|
3770 | 3770 | shareditems |
|
3771 | 3771 | Set of items to share to the new repository (in addition to storage). |
|
3772 | 3772 | shallowfilestore |
|
3773 | 3773 | Indicates that storage for files should be shallow (not all ancestor |
|
3774 | 3774 | revisions are known). |
|
3775 | 3775 | """ |
|
3776 | 3776 | |
|
3777 | 3777 | if requirements is not None: |
|
3778 | 3778 | if createopts is not None: |
|
3779 | 3779 | msg = b'cannot specify both createopts and requirements' |
|
3780 | 3780 | raise error.ProgrammingError(msg) |
|
3781 | 3781 | createopts = {} |
|
3782 | 3782 | else: |
|
3783 | 3783 | createopts = defaultcreateopts(ui, createopts=createopts) |
|
3784 | 3784 | |
|
3785 | 3785 | unknownopts = filterknowncreateopts(ui, createopts) |
|
3786 | 3786 | |
|
3787 | 3787 | if not isinstance(unknownopts, dict): |
|
3788 | 3788 | raise error.ProgrammingError( |
|
3789 | 3789 | b'filterknowncreateopts() did not return a dict' |
|
3790 | 3790 | ) |
|
3791 | 3791 | |
|
3792 | 3792 | if unknownopts: |
|
3793 | 3793 | raise error.Abort( |
|
3794 | 3794 | _( |
|
3795 | 3795 | b'unable to create repository because of unknown ' |
|
3796 | 3796 | b'creation option: %s' |
|
3797 | 3797 | ) |
|
3798 | 3798 | % b', '.join(sorted(unknownopts)), |
|
3799 | 3799 | hint=_(b'is a required extension not loaded?'), |
|
3800 | 3800 | ) |
|
3801 | 3801 | |
|
3802 | 3802 | requirements = newreporequirements(ui, createopts=createopts) |
|
3803 | 3803 | requirements -= checkrequirementscompat(ui, requirements) |
|
3804 | 3804 | |
|
3805 | 3805 | wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True) |
|
3806 | 3806 | |
|
3807 | 3807 | hgvfs = vfsmod.vfs(wdirvfs.join(b'.hg')) |
|
3808 | 3808 | if hgvfs.exists(): |
|
3809 | 3809 | raise error.RepoError(_(b'repository %s already exists') % path) |
|
3810 | 3810 | |
|
3811 | 3811 | if b'sharedrepo' in createopts: |
|
3812 | 3812 | sharedpath = createopts[b'sharedrepo'].sharedpath |
|
3813 | 3813 | |
|
3814 | 3814 | if createopts.get(b'sharedrelative'): |
|
3815 | 3815 | try: |
|
3816 | 3816 | sharedpath = os.path.relpath(sharedpath, hgvfs.base) |
|
3817 | 3817 | sharedpath = util.pconvert(sharedpath) |
|
3818 | 3818 | except (IOError, ValueError) as e: |
|
3819 | 3819 | # ValueError is raised on Windows if the drive letters differ |
|
3820 | 3820 | # on each path. |
|
3821 | 3821 | raise error.Abort( |
|
3822 | 3822 | _(b'cannot calculate relative path'), |
|
3823 | 3823 | hint=stringutil.forcebytestr(e), |
|
3824 | 3824 | ) |
|
3825 | 3825 | |
|
3826 | 3826 | if not wdirvfs.exists(): |
|
3827 | 3827 | wdirvfs.makedirs() |
|
3828 | 3828 | |
|
3829 | 3829 | hgvfs.makedir(notindexed=True) |
|
3830 | 3830 | if b'sharedrepo' not in createopts: |
|
3831 | 3831 | hgvfs.mkdir(b'cache') |
|
3832 | 3832 | hgvfs.mkdir(b'wcache') |
|
3833 | 3833 | |
|
3834 | 3834 | has_store = requirementsmod.STORE_REQUIREMENT in requirements |
|
3835 | 3835 | if has_store and b'sharedrepo' not in createopts: |
|
3836 | 3836 | hgvfs.mkdir(b'store') |
|
3837 | 3837 | |
|
3838 | 3838 | # We create an invalid changelog outside the store so very old |
|
3839 | 3839 | # Mercurial versions (which didn't know about the requirements |
|
3840 | 3840 | # file) encounter an error on reading the changelog. This |
|
3841 | 3841 | # effectively locks out old clients and prevents them from |
|
3842 | 3842 | # mucking with a repo in an unknown format. |
|
3843 | 3843 | # |
|
3844 | 3844 | # The revlog header has version 65535, which won't be recognized by |
|
3845 | 3845 | # such old clients. |
|
3846 | 3846 | hgvfs.append( |
|
3847 | 3847 | b'00changelog.i', |
|
3848 | 3848 | b'\0\0\xFF\xFF dummy changelog to prevent using the old repo ' |
|
3849 | 3849 | b'layout', |
|
3850 | 3850 | ) |
|
3851 | 3851 | |
|
3852 | 3852 | # Filter the requirements into working copy and store ones |
|
3853 | 3853 | wcreq, storereq = scmutil.filterrequirements(requirements) |
|
3854 | 3854 | # write working copy ones |
|
3855 | 3855 | scmutil.writerequires(hgvfs, wcreq) |
|
3856 | 3856 | # If there are store requirements and the current repository |
|
3857 | 3857 | # is not a shared one, write stored requirements |
|
3858 | 3858 | # For new shared repository, we don't need to write the store |
|
3859 | 3859 | # requirements as they are already present in store requires |
|
3860 | 3860 | if storereq and b'sharedrepo' not in createopts: |
|
3861 | 3861 | storevfs = vfsmod.vfs(hgvfs.join(b'store'), cacheaudited=True) |
|
3862 | 3862 | scmutil.writerequires(storevfs, storereq) |
|
3863 | 3863 | |
|
3864 | 3864 | # Write out file telling readers where to find the shared store. |
|
3865 | 3865 | if b'sharedrepo' in createopts: |
|
3866 | 3866 | hgvfs.write(b'sharedpath', sharedpath) |
|
3867 | 3867 | |
|
3868 | 3868 | if createopts.get(b'shareditems'): |
|
3869 | 3869 | shared = b'\n'.join(sorted(createopts[b'shareditems'])) + b'\n' |
|
3870 | 3870 | hgvfs.write(b'shared', shared) |
|
3871 | 3871 | |
|
3872 | 3872 | |
|
3873 | 3873 | def poisonrepository(repo): |
|
3874 | 3874 | """Poison a repository instance so it can no longer be used.""" |
|
3875 | 3875 | # Perform any cleanup on the instance. |
|
3876 | 3876 | repo.close() |
|
3877 | 3877 | |
|
3878 | 3878 | # Our strategy is to replace the type of the object with one that |
|
3879 | 3879 | # has all attribute lookups result in error. |
|
3880 | 3880 | # |
|
3881 | 3881 | # But we have to allow the close() method because some constructors |
|
3882 | 3882 | # of repos call close() on repo references. |
|
3883 | 3883 | class poisonedrepository(object): |
|
3884 | 3884 | def __getattribute__(self, item): |
|
3885 | 3885 | if item == 'close': |
|
3886 | 3886 | return object.__getattribute__(self, item) |
|
3887 | 3887 | |
|
3888 | 3888 | raise error.ProgrammingError( |
|
3889 | 3889 | b'repo instances should not be used after unshare' |
|
3890 | 3890 | ) |
|
3891 | 3891 | |
|
3892 | 3892 | def close(self): |
|
3893 | 3893 | pass |
|
3894 | 3894 | |
|
3895 | 3895 | # We may have a repoview, which intercepts __setattr__. So be sure |
|
3896 | 3896 | # we operate at the lowest level possible. |
|
3897 | 3897 | object.__setattr__(repo, '__class__', poisonedrepository) |
@@ -1,258 +1,258 b'' | |||
|
1 | 1 | Create a repository: |
|
2 | 2 | |
|
3 | 3 | #if no-extraextensions |
|
4 | 4 | $ hg config |
|
5 | 5 | chgserver.idletimeout=60 |
|
6 | 6 | devel.all-warnings=true |
|
7 | 7 | devel.default-date=0 0 |
|
8 | 8 | extensions.fsmonitor= (fsmonitor !) |
|
9 |
format.e |
|
|
9 | format.use-dirstate-v2=1 (dirstate-v2 !) | |
|
10 | 10 | largefiles.usercache=$TESTTMP/.cache/largefiles |
|
11 | 11 | lfs.usercache=$TESTTMP/.cache/lfs |
|
12 | 12 | ui.slash=True |
|
13 | 13 | ui.interactive=False |
|
14 | 14 | ui.detailed-exit-code=True |
|
15 | 15 | ui.merge=internal:merge |
|
16 | 16 | ui.mergemarkers=detailed |
|
17 | 17 | ui.promptecho=True |
|
18 | 18 | ui.ssh=* (glob) |
|
19 | 19 | ui.timeout.warn=15 |
|
20 | 20 | web.address=localhost |
|
21 | 21 | web\.ipv6=(?:True|False) (re) |
|
22 | 22 | web.server-header=testing stub value |
|
23 | 23 | #endif |
|
24 | 24 | |
|
25 | 25 | $ hg init t |
|
26 | 26 | $ cd t |
|
27 | 27 | |
|
28 | 28 | Prepare a changeset: |
|
29 | 29 | |
|
30 | 30 | $ echo a > a |
|
31 | 31 | $ hg add a |
|
32 | 32 | |
|
33 | 33 | $ hg status |
|
34 | 34 | A a |
|
35 | 35 | |
|
36 | 36 | Writes to stdio succeed and fail appropriately |
|
37 | 37 | |
|
38 | 38 | #if devfull |
|
39 | 39 | $ hg status 2>/dev/full |
|
40 | 40 | A a |
|
41 | 41 | |
|
42 | 42 | $ hg status >/dev/full |
|
43 | 43 | abort: No space left on device |
|
44 | 44 | [255] |
|
45 | 45 | #endif |
|
46 | 46 | |
|
47 | 47 | #if devfull |
|
48 | 48 | $ hg status >/dev/full 2>&1 |
|
49 | 49 | [255] |
|
50 | 50 | |
|
51 | 51 | $ hg status ENOENT 2>/dev/full |
|
52 | 52 | [255] |
|
53 | 53 | #endif |
|
54 | 54 | |
|
55 | 55 | On Python 3, stdio may be None: |
|
56 | 56 | |
|
57 | 57 | $ hg debuguiprompt --config ui.interactive=true 0<&- |
|
58 | 58 | abort: Bad file descriptor (no-rhg !) |
|
59 | 59 | abort: response expected (rhg !) |
|
60 | 60 | [255] |
|
61 | 61 | $ hg version -q 0<&- |
|
62 | 62 | Mercurial Distributed SCM * (glob) |
|
63 | 63 | |
|
64 | 64 | #if py3 no-rhg |
|
65 | 65 | $ hg version -q 1>&- |
|
66 | 66 | abort: Bad file descriptor |
|
67 | 67 | [255] |
|
68 | 68 | #else |
|
69 | 69 | $ hg version -q 1>&- |
|
70 | 70 | #endif |
|
71 | 71 | $ hg unknown -q 1>&- |
|
72 | 72 | hg: unknown command 'unknown' |
|
73 | 73 | (did you mean debugknown?) |
|
74 | 74 | [10] |
|
75 | 75 | |
|
76 | 76 | $ hg version -q 2>&- |
|
77 | 77 | Mercurial Distributed SCM * (glob) |
|
78 | 78 | $ hg unknown -q 2>&- |
|
79 | 79 | [10] |
|
80 | 80 | |
|
81 | 81 | $ hg commit -m test |
|
82 | 82 | |
|
83 | 83 | This command is ancient: |
|
84 | 84 | |
|
85 | 85 | $ hg history |
|
86 | 86 | changeset: 0:acb14030fe0a |
|
87 | 87 | tag: tip |
|
88 | 88 | user: test |
|
89 | 89 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
90 | 90 | summary: test |
|
91 | 91 | |
|
92 | 92 | |
|
93 | 93 | Verify that updating to revision 0 via commands.update() works properly |
|
94 | 94 | |
|
95 | 95 | $ cat <<EOF > update_to_rev0.py |
|
96 | 96 | > from mercurial import commands, hg, ui as uimod |
|
97 | 97 | > myui = uimod.ui.load() |
|
98 | 98 | > repo = hg.repository(myui, path=b'.') |
|
99 | 99 | > commands.update(myui, repo, rev=b"0") |
|
100 | 100 | > EOF |
|
101 | 101 | $ hg up null |
|
102 | 102 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
103 | 103 | $ "$PYTHON" ./update_to_rev0.py |
|
104 | 104 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
105 | 105 | $ hg identify -n |
|
106 | 106 | 0 |
|
107 | 107 | |
|
108 | 108 | |
|
109 | 109 | Poke around at hashes: |
|
110 | 110 | |
|
111 | 111 | $ hg manifest --debug |
|
112 | 112 | b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644 a |
|
113 | 113 | |
|
114 | 114 | $ hg cat a |
|
115 | 115 | a |
|
116 | 116 | |
|
117 | 117 | Verify should succeed: |
|
118 | 118 | |
|
119 | 119 | $ hg verify |
|
120 | 120 | checking changesets |
|
121 | 121 | checking manifests |
|
122 | 122 | crosschecking files in changesets and manifests |
|
123 | 123 | checking files |
|
124 | 124 | checked 1 changesets with 1 changes to 1 files |
|
125 | 125 | |
|
126 | 126 | Repository root: |
|
127 | 127 | |
|
128 | 128 | $ hg root |
|
129 | 129 | $TESTTMP/t |
|
130 | 130 | $ hg log -l1 -T '{reporoot}\n' |
|
131 | 131 | $TESTTMP/t |
|
132 | 132 | $ hg root -Tjson | sed 's|\\\\|\\|g' |
|
133 | 133 | [ |
|
134 | 134 | { |
|
135 | 135 | "hgpath": "$TESTTMP/t/.hg", |
|
136 | 136 | "reporoot": "$TESTTMP/t", |
|
137 | 137 | "storepath": "$TESTTMP/t/.hg/store" |
|
138 | 138 | } |
|
139 | 139 | ] |
|
140 | 140 | |
|
141 | 141 | At the end... |
|
142 | 142 | |
|
143 | 143 | $ cd .. |
|
144 | 144 | |
|
145 | 145 | Status message redirection: |
|
146 | 146 | |
|
147 | 147 | $ hg init empty |
|
148 | 148 | |
|
149 | 149 | status messages are sent to stdout by default: |
|
150 | 150 | |
|
151 | 151 | $ hg outgoing -R t empty -Tjson 2>/dev/null |
|
152 | 152 | comparing with empty |
|
153 | 153 | searching for changes |
|
154 | 154 | [ |
|
155 | 155 | { |
|
156 | 156 | "bookmarks": [], |
|
157 | 157 | "branch": "default", |
|
158 | 158 | "date": [0, 0], |
|
159 | 159 | "desc": "test", |
|
160 | 160 | "node": "acb14030fe0a21b60322c440ad2d20cf7685a376", |
|
161 | 161 | "parents": ["0000000000000000000000000000000000000000"], |
|
162 | 162 | "phase": "draft", |
|
163 | 163 | "rev": 0, |
|
164 | 164 | "tags": ["tip"], |
|
165 | 165 | "user": "test" |
|
166 | 166 | } |
|
167 | 167 | ] |
|
168 | 168 | |
|
169 | 169 | which can be configured to send to stderr, so the output wouldn't be |
|
170 | 170 | interleaved: |
|
171 | 171 | |
|
172 | 172 | $ cat <<'EOF' >> "$HGRCPATH" |
|
173 | 173 | > [ui] |
|
174 | 174 | > message-output = stderr |
|
175 | 175 | > EOF |
|
176 | 176 | $ hg outgoing -R t empty -Tjson 2>/dev/null |
|
177 | 177 | [ |
|
178 | 178 | { |
|
179 | 179 | "bookmarks": [], |
|
180 | 180 | "branch": "default", |
|
181 | 181 | "date": [0, 0], |
|
182 | 182 | "desc": "test", |
|
183 | 183 | "node": "acb14030fe0a21b60322c440ad2d20cf7685a376", |
|
184 | 184 | "parents": ["0000000000000000000000000000000000000000"], |
|
185 | 185 | "phase": "draft", |
|
186 | 186 | "rev": 0, |
|
187 | 187 | "tags": ["tip"], |
|
188 | 188 | "user": "test" |
|
189 | 189 | } |
|
190 | 190 | ] |
|
191 | 191 | $ hg outgoing -R t empty -Tjson >/dev/null |
|
192 | 192 | comparing with empty |
|
193 | 193 | searching for changes |
|
194 | 194 | |
|
195 | 195 | this option should be turned off by HGPLAIN= since it may break scripting use: |
|
196 | 196 | |
|
197 | 197 | $ HGPLAIN= hg outgoing -R t empty -Tjson 2>/dev/null |
|
198 | 198 | comparing with empty |
|
199 | 199 | searching for changes |
|
200 | 200 | [ |
|
201 | 201 | { |
|
202 | 202 | "bookmarks": [], |
|
203 | 203 | "branch": "default", |
|
204 | 204 | "date": [0, 0], |
|
205 | 205 | "desc": "test", |
|
206 | 206 | "node": "acb14030fe0a21b60322c440ad2d20cf7685a376", |
|
207 | 207 | "parents": ["0000000000000000000000000000000000000000"], |
|
208 | 208 | "phase": "draft", |
|
209 | 209 | "rev": 0, |
|
210 | 210 | "tags": ["tip"], |
|
211 | 211 | "user": "test" |
|
212 | 212 | } |
|
213 | 213 | ] |
|
214 | 214 | |
|
215 | 215 | but still overridden by --config: |
|
216 | 216 | |
|
217 | 217 | $ HGPLAIN= hg outgoing -R t empty -Tjson --config ui.message-output=stderr \ |
|
218 | 218 | > 2>/dev/null |
|
219 | 219 | [ |
|
220 | 220 | { |
|
221 | 221 | "bookmarks": [], |
|
222 | 222 | "branch": "default", |
|
223 | 223 | "date": [0, 0], |
|
224 | 224 | "desc": "test", |
|
225 | 225 | "node": "acb14030fe0a21b60322c440ad2d20cf7685a376", |
|
226 | 226 | "parents": ["0000000000000000000000000000000000000000"], |
|
227 | 227 | "phase": "draft", |
|
228 | 228 | "rev": 0, |
|
229 | 229 | "tags": ["tip"], |
|
230 | 230 | "user": "test" |
|
231 | 231 | } |
|
232 | 232 | ] |
|
233 | 233 | |
|
234 | 234 | Invalid ui.message-output option: |
|
235 | 235 | |
|
236 | 236 | $ hg log -R t --config ui.message-output=bad |
|
237 | 237 | abort: invalid ui.message-output destination: bad |
|
238 | 238 | [255] |
|
239 | 239 | |
|
240 | 240 | Underlying message streams should be updated when ui.fout/ferr are set: |
|
241 | 241 | |
|
242 | 242 | $ cat <<'EOF' > capui.py |
|
243 | 243 | > from mercurial import pycompat, registrar |
|
244 | 244 | > cmdtable = {} |
|
245 | 245 | > command = registrar.command(cmdtable) |
|
246 | 246 | > @command(b'capui', norepo=True) |
|
247 | 247 | > def capui(ui): |
|
248 | 248 | > out = ui.fout |
|
249 | 249 | > ui.fout = pycompat.bytesio() |
|
250 | 250 | > ui.status(b'status\n') |
|
251 | 251 | > ui.ferr = pycompat.bytesio() |
|
252 | 252 | > ui.warn(b'warn\n') |
|
253 | 253 | > out.write(b'stdout: %s' % ui.fout.getvalue()) |
|
254 | 254 | > out.write(b'stderr: %s' % ui.ferr.getvalue()) |
|
255 | 255 | > EOF |
|
256 | 256 | $ hg --config extensions.capui=capui.py --config ui.message-output=stdio capui |
|
257 | 257 | stdout: status |
|
258 | 258 | stderr: warn |
@@ -1,1174 +1,1174 b'' | |||
|
1 | 1 | #require no-rhg no-chg |
|
2 | 2 | |
|
3 | 3 | XXX-RHG this test hangs if `hg` is really `rhg`. This was hidden by the use of |
|
4 | 4 | `alias hg=rhg` by run-tests.py. With such alias removed, this test is revealed |
|
5 | 5 | buggy. This need to be resolved sooner than later. |
|
6 | 6 | |
|
7 | 7 | XXX-CHG this test hangs if `hg` is really `chg`. This was hidden by the use of |
|
8 | 8 | `alias hg=chg` by run-tests.py. With such alias removed, this test is revealed |
|
9 | 9 | buggy. This need to be resolved sooner than later. |
|
10 | 10 | |
|
11 | 11 | #if windows |
|
12 | 12 | $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH" |
|
13 | 13 | #else |
|
14 | 14 | $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH" |
|
15 | 15 | #endif |
|
16 | 16 | $ export PYTHONPATH |
|
17 | 17 | |
|
18 | 18 | typical client does not want echo-back messages, so test without it: |
|
19 | 19 | |
|
20 | 20 | $ grep -v '^promptecho ' < $HGRCPATH >> $HGRCPATH.new |
|
21 | 21 | $ mv $HGRCPATH.new $HGRCPATH |
|
22 | 22 | |
|
23 | 23 | $ hg init repo |
|
24 | 24 | $ cd repo |
|
25 | 25 | |
|
26 | 26 | >>> from __future__ import absolute_import |
|
27 | 27 | >>> import os |
|
28 | 28 | >>> import sys |
|
29 | 29 | >>> from hgclient import bprint, check, readchannel, runcommand |
|
30 | 30 | >>> @check |
|
31 | 31 | ... def hellomessage(server): |
|
32 | 32 | ... ch, data = readchannel(server) |
|
33 | 33 | ... bprint(b'%c, %r' % (ch, data)) |
|
34 | 34 | ... # run an arbitrary command to make sure the next thing the server |
|
35 | 35 | ... # sends isn't part of the hello message |
|
36 | 36 | ... runcommand(server, [b'id']) |
|
37 | 37 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
38 | 38 | *** runcommand id |
|
39 | 39 | 000000000000 tip |
|
40 | 40 | |
|
41 | 41 | >>> from hgclient import check |
|
42 | 42 | >>> @check |
|
43 | 43 | ... def unknowncommand(server): |
|
44 | 44 | ... server.stdin.write(b'unknowncommand\n') |
|
45 | 45 | abort: unknown command unknowncommand |
|
46 | 46 | |
|
47 | 47 | >>> from hgclient import check, readchannel, runcommand |
|
48 | 48 | >>> @check |
|
49 | 49 | ... def checkruncommand(server): |
|
50 | 50 | ... # hello block |
|
51 | 51 | ... readchannel(server) |
|
52 | 52 | ... |
|
53 | 53 | ... # no args |
|
54 | 54 | ... runcommand(server, []) |
|
55 | 55 | ... |
|
56 | 56 | ... # global options |
|
57 | 57 | ... runcommand(server, [b'id', b'--quiet']) |
|
58 | 58 | ... |
|
59 | 59 | ... # make sure global options don't stick through requests |
|
60 | 60 | ... runcommand(server, [b'id']) |
|
61 | 61 | ... |
|
62 | 62 | ... # --config |
|
63 | 63 | ... runcommand(server, [b'id', b'--config', b'ui.quiet=True']) |
|
64 | 64 | ... |
|
65 | 65 | ... # make sure --config doesn't stick |
|
66 | 66 | ... runcommand(server, [b'id']) |
|
67 | 67 | ... |
|
68 | 68 | ... # negative return code should be masked |
|
69 | 69 | ... runcommand(server, [b'id', b'-runknown']) |
|
70 | 70 | *** runcommand |
|
71 | 71 | Mercurial Distributed SCM |
|
72 | 72 | |
|
73 | 73 | basic commands: |
|
74 | 74 | |
|
75 | 75 | add add the specified files on the next commit |
|
76 | 76 | annotate show changeset information by line for each file |
|
77 | 77 | clone make a copy of an existing repository |
|
78 | 78 | commit commit the specified files or all outstanding changes |
|
79 | 79 | diff diff repository (or selected files) |
|
80 | 80 | export dump the header and diffs for one or more changesets |
|
81 | 81 | forget forget the specified files on the next commit |
|
82 | 82 | init create a new repository in the given directory |
|
83 | 83 | log show revision history of entire repository or files |
|
84 | 84 | merge merge another revision into working directory |
|
85 | 85 | pull pull changes from the specified source |
|
86 | 86 | push push changes to the specified destination |
|
87 | 87 | remove remove the specified files on the next commit |
|
88 | 88 | serve start stand-alone webserver |
|
89 | 89 | status show changed files in the working directory |
|
90 | 90 | summary summarize working directory state |
|
91 | 91 | update update working directory (or switch revisions) |
|
92 | 92 | |
|
93 | 93 | (use 'hg help' for the full list of commands or 'hg -v' for details) |
|
94 | 94 | *** runcommand id --quiet |
|
95 | 95 | 000000000000 |
|
96 | 96 | *** runcommand id |
|
97 | 97 | 000000000000 tip |
|
98 | 98 | *** runcommand id --config ui.quiet=True |
|
99 | 99 | 000000000000 |
|
100 | 100 | *** runcommand id |
|
101 | 101 | 000000000000 tip |
|
102 | 102 | *** runcommand id -runknown |
|
103 | 103 | abort: unknown revision 'unknown' |
|
104 | 104 | [10] |
|
105 | 105 | |
|
106 | 106 | >>> from hgclient import bprint, check, readchannel |
|
107 | 107 | >>> @check |
|
108 | 108 | ... def inputeof(server): |
|
109 | 109 | ... readchannel(server) |
|
110 | 110 | ... server.stdin.write(b'runcommand\n') |
|
111 | 111 | ... # close stdin while server is waiting for input |
|
112 | 112 | ... server.stdin.close() |
|
113 | 113 | ... |
|
114 | 114 | ... # server exits with 1 if the pipe closed while reading the command |
|
115 | 115 | ... bprint(b'server exit code =', b'%d' % server.wait()) |
|
116 | 116 | server exit code = 1 |
|
117 | 117 | |
|
118 | 118 | >>> from hgclient import check, readchannel, runcommand, stringio |
|
119 | 119 | >>> @check |
|
120 | 120 | ... def serverinput(server): |
|
121 | 121 | ... readchannel(server) |
|
122 | 122 | ... |
|
123 | 123 | ... patch = b""" |
|
124 | 124 | ... # HG changeset patch |
|
125 | 125 | ... # User test |
|
126 | 126 | ... # Date 0 0 |
|
127 | 127 | ... # Node ID c103a3dec114d882c98382d684d8af798d09d857 |
|
128 | 128 | ... # Parent 0000000000000000000000000000000000000000 |
|
129 | 129 | ... 1 |
|
130 | 130 | ... |
|
131 | 131 | ... diff -r 000000000000 -r c103a3dec114 a |
|
132 | 132 | ... --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
133 | 133 | ... +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
134 | 134 | ... @@ -0,0 +1,1 @@ |
|
135 | 135 | ... +1 |
|
136 | 136 | ... """ |
|
137 | 137 | ... |
|
138 | 138 | ... runcommand(server, [b'import', b'-'], input=stringio(patch)) |
|
139 | 139 | ... runcommand(server, [b'log']) |
|
140 | 140 | *** runcommand import - |
|
141 | 141 | applying patch from stdin |
|
142 | 142 | *** runcommand log |
|
143 | 143 | changeset: 0:eff892de26ec |
|
144 | 144 | tag: tip |
|
145 | 145 | user: test |
|
146 | 146 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
147 | 147 | summary: 1 |
|
148 | 148 | |
|
149 | 149 | |
|
150 | 150 | check strict parsing of early options: |
|
151 | 151 | |
|
152 | 152 | >>> import os |
|
153 | 153 | >>> from hgclient import check, readchannel, runcommand |
|
154 | 154 | >>> os.environ['HGPLAIN'] = '+strictflags' |
|
155 | 155 | >>> @check |
|
156 | 156 | ... def cwd(server): |
|
157 | 157 | ... readchannel(server) |
|
158 | 158 | ... runcommand(server, [b'log', b'-b', b'--config=alias.log=!echo pwned', |
|
159 | 159 | ... b'default']) |
|
160 | 160 | *** runcommand log -b --config=alias.log=!echo pwned default |
|
161 | 161 | abort: unknown revision '--config=alias.log=!echo pwned' |
|
162 | 162 | [255] |
|
163 | 163 | |
|
164 | 164 | check that "histedit --commands=-" can read rules from the input channel: |
|
165 | 165 | |
|
166 | 166 | >>> from hgclient import check, readchannel, runcommand, stringio |
|
167 | 167 | >>> @check |
|
168 | 168 | ... def serverinput(server): |
|
169 | 169 | ... readchannel(server) |
|
170 | 170 | ... rules = b'pick eff892de26ec\n' |
|
171 | 171 | ... runcommand(server, [b'histedit', b'0', b'--commands=-', |
|
172 | 172 | ... b'--config', b'extensions.histedit='], |
|
173 | 173 | ... input=stringio(rules)) |
|
174 | 174 | *** runcommand histedit 0 --commands=- --config extensions.histedit= |
|
175 | 175 | |
|
176 | 176 | check that --cwd doesn't persist between requests: |
|
177 | 177 | |
|
178 | 178 | $ mkdir foo |
|
179 | 179 | $ touch foo/bar |
|
180 | 180 | >>> from hgclient import check, readchannel, runcommand |
|
181 | 181 | >>> @check |
|
182 | 182 | ... def cwd(server): |
|
183 | 183 | ... readchannel(server) |
|
184 | 184 | ... runcommand(server, [b'--cwd', b'foo', b'st', b'bar']) |
|
185 | 185 | ... runcommand(server, [b'st', b'foo/bar']) |
|
186 | 186 | *** runcommand --cwd foo st bar |
|
187 | 187 | ? bar |
|
188 | 188 | *** runcommand st foo/bar |
|
189 | 189 | ? foo/bar |
|
190 | 190 | |
|
191 | 191 | $ rm foo/bar |
|
192 | 192 | |
|
193 | 193 | |
|
194 | 194 | check that local configs for the cached repo aren't inherited when -R is used: |
|
195 | 195 | |
|
196 | 196 | $ cat <<EOF >> .hg/hgrc |
|
197 | 197 | > [ui] |
|
198 | 198 | > foo = bar |
|
199 | 199 | > EOF |
|
200 | 200 | |
|
201 | 201 | #if no-extraextensions |
|
202 | 202 | |
|
203 | 203 | >>> from hgclient import check, readchannel, runcommand, sep |
|
204 | 204 | >>> @check |
|
205 | 205 | ... def localhgrc(server): |
|
206 | 206 | ... readchannel(server) |
|
207 | 207 | ... |
|
208 | 208 | ... # the cached repo local hgrc contains ui.foo=bar, so showconfig should |
|
209 | 209 | ... # show it |
|
210 | 210 | ... runcommand(server, [b'showconfig'], outfilter=sep) |
|
211 | 211 | ... |
|
212 | 212 | ... # but not for this repo |
|
213 | 213 | ... runcommand(server, [b'init', b'foo']) |
|
214 | 214 | ... runcommand(server, [b'-R', b'foo', b'showconfig', b'ui', b'defaults']) |
|
215 | 215 | *** runcommand showconfig |
|
216 | 216 | bundle.mainreporoot=$TESTTMP/repo |
|
217 | 217 | chgserver.idletimeout=60 |
|
218 | 218 | devel.all-warnings=true |
|
219 | 219 | devel.default-date=0 0 |
|
220 | 220 | extensions.fsmonitor= (fsmonitor !) |
|
221 |
format.e |
|
|
221 | format.use-dirstate-v2=1 (dirstate-v2 !) | |
|
222 | 222 | largefiles.usercache=$TESTTMP/.cache/largefiles |
|
223 | 223 | lfs.usercache=$TESTTMP/.cache/lfs |
|
224 | 224 | ui.slash=True |
|
225 | 225 | ui.interactive=False |
|
226 | 226 | ui.detailed-exit-code=True |
|
227 | 227 | ui.merge=internal:merge |
|
228 | 228 | ui.mergemarkers=detailed |
|
229 | 229 | ui.ssh=* (glob) |
|
230 | 230 | ui.timeout.warn=15 |
|
231 | 231 | ui.foo=bar |
|
232 | 232 | ui.nontty=true |
|
233 | 233 | web.address=localhost |
|
234 | 234 | web\.ipv6=(?:True|False) (re) |
|
235 | 235 | web.server-header=testing stub value |
|
236 | 236 | *** runcommand init foo |
|
237 | 237 | *** runcommand -R foo showconfig ui defaults |
|
238 | 238 | ui.slash=True |
|
239 | 239 | ui.interactive=False |
|
240 | 240 | ui.detailed-exit-code=True |
|
241 | 241 | ui.merge=internal:merge |
|
242 | 242 | ui.mergemarkers=detailed |
|
243 | 243 | ui.ssh=* (glob) |
|
244 | 244 | ui.timeout.warn=15 |
|
245 | 245 | ui.nontty=true |
|
246 | 246 | #endif |
|
247 | 247 | |
|
248 | 248 | $ rm -R foo |
|
249 | 249 | |
|
250 | 250 | #if windows |
|
251 | 251 | $ PYTHONPATH="$TESTTMP/repo;$PYTHONPATH" |
|
252 | 252 | #else |
|
253 | 253 | $ PYTHONPATH="$TESTTMP/repo:$PYTHONPATH" |
|
254 | 254 | #endif |
|
255 | 255 | |
|
256 | 256 | $ cat <<EOF > hook.py |
|
257 | 257 | > import sys |
|
258 | 258 | > from hgclient import bprint |
|
259 | 259 | > def hook(**args): |
|
260 | 260 | > bprint(b'hook talking') |
|
261 | 261 | > bprint(b'now try to read something: %r' % sys.stdin.read()) |
|
262 | 262 | > EOF |
|
263 | 263 | |
|
264 | 264 | >>> from hgclient import check, readchannel, runcommand, stringio |
|
265 | 265 | >>> @check |
|
266 | 266 | ... def hookoutput(server): |
|
267 | 267 | ... readchannel(server) |
|
268 | 268 | ... runcommand(server, [b'--config', |
|
269 | 269 | ... b'hooks.pre-identify=python:hook.hook', |
|
270 | 270 | ... b'id'], |
|
271 | 271 | ... input=stringio(b'some input')) |
|
272 | 272 | *** runcommand --config hooks.pre-identify=python:hook.hook id |
|
273 | 273 | eff892de26ec tip |
|
274 | 274 | hook talking |
|
275 | 275 | now try to read something: '' |
|
276 | 276 | |
|
277 | 277 | Clean hook cached version |
|
278 | 278 | $ rm hook.py* |
|
279 | 279 | $ rm -Rf __pycache__ |
|
280 | 280 | |
|
281 | 281 | $ echo a >> a |
|
282 | 282 | >>> import os |
|
283 | 283 | >>> from hgclient import check, readchannel, runcommand |
|
284 | 284 | >>> @check |
|
285 | 285 | ... def outsidechanges(server): |
|
286 | 286 | ... readchannel(server) |
|
287 | 287 | ... runcommand(server, [b'status']) |
|
288 | 288 | ... os.system('hg ci -Am2') |
|
289 | 289 | ... runcommand(server, [b'tip']) |
|
290 | 290 | ... runcommand(server, [b'status']) |
|
291 | 291 | *** runcommand status |
|
292 | 292 | M a |
|
293 | 293 | *** runcommand tip |
|
294 | 294 | changeset: 1:d3a0a68be6de |
|
295 | 295 | tag: tip |
|
296 | 296 | user: test |
|
297 | 297 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
298 | 298 | summary: 2 |
|
299 | 299 | |
|
300 | 300 | *** runcommand status |
|
301 | 301 | |
|
302 | 302 | >>> import os |
|
303 | 303 | >>> from hgclient import bprint, check, readchannel, runcommand |
|
304 | 304 | >>> @check |
|
305 | 305 | ... def bookmarks(server): |
|
306 | 306 | ... readchannel(server) |
|
307 | 307 | ... runcommand(server, [b'bookmarks']) |
|
308 | 308 | ... |
|
309 | 309 | ... # changes .hg/bookmarks |
|
310 | 310 | ... os.system('hg bookmark -i bm1') |
|
311 | 311 | ... os.system('hg bookmark -i bm2') |
|
312 | 312 | ... runcommand(server, [b'bookmarks']) |
|
313 | 313 | ... |
|
314 | 314 | ... # changes .hg/bookmarks.current |
|
315 | 315 | ... os.system('hg upd bm1 -q') |
|
316 | 316 | ... runcommand(server, [b'bookmarks']) |
|
317 | 317 | ... |
|
318 | 318 | ... runcommand(server, [b'bookmarks', b'bm3']) |
|
319 | 319 | ... f = open('a', 'ab') |
|
320 | 320 | ... f.write(b'a\n') and None |
|
321 | 321 | ... f.close() |
|
322 | 322 | ... runcommand(server, [b'commit', b'-Amm']) |
|
323 | 323 | ... runcommand(server, [b'bookmarks']) |
|
324 | 324 | ... bprint(b'') |
|
325 | 325 | *** runcommand bookmarks |
|
326 | 326 | no bookmarks set |
|
327 | 327 | *** runcommand bookmarks |
|
328 | 328 | bm1 1:d3a0a68be6de |
|
329 | 329 | bm2 1:d3a0a68be6de |
|
330 | 330 | *** runcommand bookmarks |
|
331 | 331 | * bm1 1:d3a0a68be6de |
|
332 | 332 | bm2 1:d3a0a68be6de |
|
333 | 333 | *** runcommand bookmarks bm3 |
|
334 | 334 | *** runcommand commit -Amm |
|
335 | 335 | *** runcommand bookmarks |
|
336 | 336 | bm1 1:d3a0a68be6de |
|
337 | 337 | bm2 1:d3a0a68be6de |
|
338 | 338 | * bm3 2:aef17e88f5f0 |
|
339 | 339 | |
|
340 | 340 | |
|
341 | 341 | >>> import os |
|
342 | 342 | >>> from hgclient import check, readchannel, runcommand |
|
343 | 343 | >>> @check |
|
344 | 344 | ... def tagscache(server): |
|
345 | 345 | ... readchannel(server) |
|
346 | 346 | ... runcommand(server, [b'id', b'-t', b'-r', b'0']) |
|
347 | 347 | ... os.system('hg tag -r 0 foo') |
|
348 | 348 | ... runcommand(server, [b'id', b'-t', b'-r', b'0']) |
|
349 | 349 | *** runcommand id -t -r 0 |
|
350 | 350 | |
|
351 | 351 | *** runcommand id -t -r 0 |
|
352 | 352 | foo |
|
353 | 353 | |
|
354 | 354 | >>> import os |
|
355 | 355 | >>> from hgclient import check, readchannel, runcommand |
|
356 | 356 | >>> @check |
|
357 | 357 | ... def setphase(server): |
|
358 | 358 | ... readchannel(server) |
|
359 | 359 | ... runcommand(server, [b'phase', b'-r', b'.']) |
|
360 | 360 | ... os.system('hg phase -r . -p') |
|
361 | 361 | ... runcommand(server, [b'phase', b'-r', b'.']) |
|
362 | 362 | *** runcommand phase -r . |
|
363 | 363 | 3: draft |
|
364 | 364 | *** runcommand phase -r . |
|
365 | 365 | 3: public |
|
366 | 366 | |
|
367 | 367 | $ echo a >> a |
|
368 | 368 | >>> from hgclient import bprint, check, readchannel, runcommand |
|
369 | 369 | >>> @check |
|
370 | 370 | ... def rollback(server): |
|
371 | 371 | ... readchannel(server) |
|
372 | 372 | ... runcommand(server, [b'phase', b'-r', b'.', b'-p']) |
|
373 | 373 | ... runcommand(server, [b'commit', b'-Am.']) |
|
374 | 374 | ... runcommand(server, [b'rollback']) |
|
375 | 375 | ... runcommand(server, [b'phase', b'-r', b'.']) |
|
376 | 376 | ... bprint(b'') |
|
377 | 377 | *** runcommand phase -r . -p |
|
378 | 378 | no phases changed |
|
379 | 379 | *** runcommand commit -Am. |
|
380 | 380 | *** runcommand rollback |
|
381 | 381 | repository tip rolled back to revision 3 (undo commit) |
|
382 | 382 | working directory now based on revision 3 |
|
383 | 383 | *** runcommand phase -r . |
|
384 | 384 | 3: public |
|
385 | 385 | |
|
386 | 386 | |
|
387 | 387 | >>> import os |
|
388 | 388 | >>> from hgclient import check, readchannel, runcommand |
|
389 | 389 | >>> @check |
|
390 | 390 | ... def branch(server): |
|
391 | 391 | ... readchannel(server) |
|
392 | 392 | ... runcommand(server, [b'branch']) |
|
393 | 393 | ... os.system('hg branch foo') |
|
394 | 394 | ... runcommand(server, [b'branch']) |
|
395 | 395 | ... os.system('hg branch default') |
|
396 | 396 | *** runcommand branch |
|
397 | 397 | default |
|
398 | 398 | marked working directory as branch foo |
|
399 | 399 | (branches are permanent and global, did you want a bookmark?) |
|
400 | 400 | *** runcommand branch |
|
401 | 401 | foo |
|
402 | 402 | marked working directory as branch default |
|
403 | 403 | (branches are permanent and global, did you want a bookmark?) |
|
404 | 404 | |
|
405 | 405 | $ touch .hgignore |
|
406 | 406 | >>> import os |
|
407 | 407 | >>> from hgclient import bprint, check, readchannel, runcommand |
|
408 | 408 | >>> @check |
|
409 | 409 | ... def hgignore(server): |
|
410 | 410 | ... readchannel(server) |
|
411 | 411 | ... runcommand(server, [b'commit', b'-Am.']) |
|
412 | 412 | ... f = open('ignored-file', 'ab') |
|
413 | 413 | ... f.write(b'') and None |
|
414 | 414 | ... f.close() |
|
415 | 415 | ... f = open('.hgignore', 'ab') |
|
416 | 416 | ... f.write(b'ignored-file') |
|
417 | 417 | ... f.close() |
|
418 | 418 | ... runcommand(server, [b'status', b'-i', b'-u']) |
|
419 | 419 | ... bprint(b'') |
|
420 | 420 | *** runcommand commit -Am. |
|
421 | 421 | adding .hgignore |
|
422 | 422 | *** runcommand status -i -u |
|
423 | 423 | I ignored-file |
|
424 | 424 | |
|
425 | 425 | |
|
426 | 426 | cache of non-public revisions should be invalidated on repository change |
|
427 | 427 | (issue4855): |
|
428 | 428 | |
|
429 | 429 | >>> import os |
|
430 | 430 | >>> from hgclient import bprint, check, readchannel, runcommand |
|
431 | 431 | >>> @check |
|
432 | 432 | ... def phasesetscacheaftercommit(server): |
|
433 | 433 | ... readchannel(server) |
|
434 | 434 | ... # load _phasecache._phaserevs and _phasesets |
|
435 | 435 | ... runcommand(server, [b'log', b'-qr', b'draft()']) |
|
436 | 436 | ... # create draft commits by another process |
|
437 | 437 | ... for i in range(5, 7): |
|
438 | 438 | ... f = open('a', 'ab') |
|
439 | 439 | ... f.seek(0, os.SEEK_END) |
|
440 | 440 | ... f.write(b'a\n') and None |
|
441 | 441 | ... f.close() |
|
442 | 442 | ... os.system('hg commit -Aqm%d' % i) |
|
443 | 443 | ... # new commits should be listed as draft revisions |
|
444 | 444 | ... runcommand(server, [b'log', b'-qr', b'draft()']) |
|
445 | 445 | ... bprint(b'') |
|
446 | 446 | *** runcommand log -qr draft() |
|
447 | 447 | 4:7966c8e3734d |
|
448 | 448 | *** runcommand log -qr draft() |
|
449 | 449 | 4:7966c8e3734d |
|
450 | 450 | 5:41f6602d1c4f |
|
451 | 451 | 6:10501e202c35 |
|
452 | 452 | |
|
453 | 453 | |
|
454 | 454 | >>> import os |
|
455 | 455 | >>> from hgclient import bprint, check, readchannel, runcommand |
|
456 | 456 | >>> @check |
|
457 | 457 | ... def phasesetscacheafterstrip(server): |
|
458 | 458 | ... readchannel(server) |
|
459 | 459 | ... # load _phasecache._phaserevs and _phasesets |
|
460 | 460 | ... runcommand(server, [b'log', b'-qr', b'draft()']) |
|
461 | 461 | ... # strip cached revisions by another process |
|
462 | 462 | ... os.system('hg --config extensions.strip= strip -q 5') |
|
463 | 463 | ... # shouldn't abort by "unknown revision '6'" |
|
464 | 464 | ... runcommand(server, [b'log', b'-qr', b'draft()']) |
|
465 | 465 | ... bprint(b'') |
|
466 | 466 | *** runcommand log -qr draft() |
|
467 | 467 | 4:7966c8e3734d |
|
468 | 468 | 5:41f6602d1c4f |
|
469 | 469 | 6:10501e202c35 |
|
470 | 470 | *** runcommand log -qr draft() |
|
471 | 471 | 4:7966c8e3734d |
|
472 | 472 | |
|
473 | 473 | |
|
474 | 474 | cache of phase roots should be invalidated on strip (issue3827): |
|
475 | 475 | |
|
476 | 476 | >>> import os |
|
477 | 477 | >>> from hgclient import check, readchannel, runcommand, sep |
|
478 | 478 | >>> @check |
|
479 | 479 | ... def phasecacheafterstrip(server): |
|
480 | 480 | ... readchannel(server) |
|
481 | 481 | ... |
|
482 | 482 | ... # create new head, 5:731265503d86 |
|
483 | 483 | ... runcommand(server, [b'update', b'-C', b'0']) |
|
484 | 484 | ... f = open('a', 'ab') |
|
485 | 485 | ... f.write(b'a\n') and None |
|
486 | 486 | ... f.close() |
|
487 | 487 | ... runcommand(server, [b'commit', b'-Am.', b'a']) |
|
488 | 488 | ... runcommand(server, [b'log', b'-Gq']) |
|
489 | 489 | ... |
|
490 | 490 | ... # make it public; draft marker moves to 4:7966c8e3734d |
|
491 | 491 | ... runcommand(server, [b'phase', b'-p', b'.']) |
|
492 | 492 | ... # load _phasecache.phaseroots |
|
493 | 493 | ... runcommand(server, [b'phase', b'.'], outfilter=sep) |
|
494 | 494 | ... |
|
495 | 495 | ... # strip 1::4 outside server |
|
496 | 496 | ... os.system('hg -q --config extensions.mq= strip 1') |
|
497 | 497 | ... |
|
498 | 498 | ... # shouldn't raise "7966c8e3734d: no node!" |
|
499 | 499 | ... runcommand(server, [b'branches']) |
|
500 | 500 | *** runcommand update -C 0 |
|
501 | 501 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
502 | 502 | (leaving bookmark bm3) |
|
503 | 503 | *** runcommand commit -Am. a |
|
504 | 504 | created new head |
|
505 | 505 | *** runcommand log -Gq |
|
506 | 506 | @ 5:731265503d86 |
|
507 | 507 | | |
|
508 | 508 | | o 4:7966c8e3734d |
|
509 | 509 | | | |
|
510 | 510 | | o 3:b9b85890c400 |
|
511 | 511 | | | |
|
512 | 512 | | o 2:aef17e88f5f0 |
|
513 | 513 | | | |
|
514 | 514 | | o 1:d3a0a68be6de |
|
515 | 515 | |/ |
|
516 | 516 | o 0:eff892de26ec |
|
517 | 517 | |
|
518 | 518 | *** runcommand phase -p . |
|
519 | 519 | *** runcommand phase . |
|
520 | 520 | 5: public |
|
521 | 521 | *** runcommand branches |
|
522 | 522 | default 1:731265503d86 |
|
523 | 523 | |
|
524 | 524 | in-memory cache must be reloaded if transaction is aborted. otherwise |
|
525 | 525 | changelog and manifest would have invalid node: |
|
526 | 526 | |
|
527 | 527 | $ echo a >> a |
|
528 | 528 | >>> from hgclient import check, readchannel, runcommand |
|
529 | 529 | >>> @check |
|
530 | 530 | ... def txabort(server): |
|
531 | 531 | ... readchannel(server) |
|
532 | 532 | ... runcommand(server, [b'commit', b'--config', b'hooks.pretxncommit=false', |
|
533 | 533 | ... b'-mfoo']) |
|
534 | 534 | ... runcommand(server, [b'verify']) |
|
535 | 535 | *** runcommand commit --config hooks.pretxncommit=false -mfoo |
|
536 | 536 | transaction abort! |
|
537 | 537 | rollback completed |
|
538 | 538 | abort: pretxncommit hook exited with status 1 |
|
539 | 539 | [40] |
|
540 | 540 | *** runcommand verify |
|
541 | 541 | checking changesets |
|
542 | 542 | checking manifests |
|
543 | 543 | crosschecking files in changesets and manifests |
|
544 | 544 | checking files |
|
545 | 545 | checked 2 changesets with 2 changes to 1 files |
|
546 | 546 | $ hg revert --no-backup -aq |
|
547 | 547 | |
|
548 | 548 | $ cat >> .hg/hgrc << EOF |
|
549 | 549 | > [experimental] |
|
550 | 550 | > evolution.createmarkers=True |
|
551 | 551 | > EOF |
|
552 | 552 | |
|
553 | 553 | >>> import os |
|
554 | 554 | >>> from hgclient import check, readchannel, runcommand |
|
555 | 555 | >>> @check |
|
556 | 556 | ... def obsolete(server): |
|
557 | 557 | ... readchannel(server) |
|
558 | 558 | ... |
|
559 | 559 | ... runcommand(server, [b'up', b'null']) |
|
560 | 560 | ... runcommand(server, [b'phase', b'-df', b'tip']) |
|
561 | 561 | ... cmd = 'hg debugobsolete `hg log -r tip --template {node}`' |
|
562 | 562 | ... if os.name == 'nt': |
|
563 | 563 | ... cmd = 'sh -c "%s"' % cmd # run in sh, not cmd.exe |
|
564 | 564 | ... os.system(cmd) |
|
565 | 565 | ... runcommand(server, [b'log', b'--hidden']) |
|
566 | 566 | ... runcommand(server, [b'log']) |
|
567 | 567 | *** runcommand up null |
|
568 | 568 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
569 | 569 | *** runcommand phase -df tip |
|
570 | 570 | 1 new obsolescence markers |
|
571 | 571 | obsoleted 1 changesets |
|
572 | 572 | *** runcommand log --hidden |
|
573 | 573 | changeset: 1:731265503d86 |
|
574 | 574 | tag: tip |
|
575 | 575 | user: test |
|
576 | 576 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
577 | 577 | obsolete: pruned |
|
578 | 578 | summary: . |
|
579 | 579 | |
|
580 | 580 | changeset: 0:eff892de26ec |
|
581 | 581 | bookmark: bm1 |
|
582 | 582 | bookmark: bm2 |
|
583 | 583 | bookmark: bm3 |
|
584 | 584 | user: test |
|
585 | 585 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
586 | 586 | summary: 1 |
|
587 | 587 | |
|
588 | 588 | *** runcommand log |
|
589 | 589 | changeset: 0:eff892de26ec |
|
590 | 590 | bookmark: bm1 |
|
591 | 591 | bookmark: bm2 |
|
592 | 592 | bookmark: bm3 |
|
593 | 593 | tag: tip |
|
594 | 594 | user: test |
|
595 | 595 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
596 | 596 | summary: 1 |
|
597 | 597 | |
|
598 | 598 | |
|
599 | 599 | $ cat <<EOF >> .hg/hgrc |
|
600 | 600 | > [extensions] |
|
601 | 601 | > mq = |
|
602 | 602 | > EOF |
|
603 | 603 | |
|
604 | 604 | >>> import os |
|
605 | 605 | >>> from hgclient import check, readchannel, runcommand |
|
606 | 606 | >>> @check |
|
607 | 607 | ... def mqoutsidechanges(server): |
|
608 | 608 | ... readchannel(server) |
|
609 | 609 | ... |
|
610 | 610 | ... # load repo.mq |
|
611 | 611 | ... runcommand(server, [b'qapplied']) |
|
612 | 612 | ... os.system('hg qnew 0.diff') |
|
613 | 613 | ... # repo.mq should be invalidated |
|
614 | 614 | ... runcommand(server, [b'qapplied']) |
|
615 | 615 | ... |
|
616 | 616 | ... runcommand(server, [b'qpop', b'--all']) |
|
617 | 617 | ... os.system('hg qqueue --create foo') |
|
618 | 618 | ... # repo.mq should be recreated to point to new queue |
|
619 | 619 | ... runcommand(server, [b'qqueue', b'--active']) |
|
620 | 620 | *** runcommand qapplied |
|
621 | 621 | *** runcommand qapplied |
|
622 | 622 | 0.diff |
|
623 | 623 | *** runcommand qpop --all |
|
624 | 624 | popping 0.diff |
|
625 | 625 | patch queue now empty |
|
626 | 626 | *** runcommand qqueue --active |
|
627 | 627 | foo |
|
628 | 628 | |
|
629 | 629 | $ cat <<'EOF' > ../dbgui.py |
|
630 | 630 | > import os |
|
631 | 631 | > import sys |
|
632 | 632 | > from mercurial import commands, registrar |
|
633 | 633 | > cmdtable = {} |
|
634 | 634 | > command = registrar.command(cmdtable) |
|
635 | 635 | > @command(b"debuggetpass", norepo=True) |
|
636 | 636 | > def debuggetpass(ui): |
|
637 | 637 | > ui.write(b"%s\n" % ui.getpass()) |
|
638 | 638 | > @command(b"debugprompt", norepo=True) |
|
639 | 639 | > def debugprompt(ui): |
|
640 | 640 | > ui.write(b"%s\n" % ui.prompt(b"prompt:")) |
|
641 | 641 | > @command(b"debugpromptchoice", norepo=True) |
|
642 | 642 | > def debugpromptchoice(ui): |
|
643 | 643 | > msg = b"promptchoice (y/n)? $$ &Yes $$ &No" |
|
644 | 644 | > ui.write(b"%d\n" % ui.promptchoice(msg)) |
|
645 | 645 | > @command(b"debugreadstdin", norepo=True) |
|
646 | 646 | > def debugreadstdin(ui): |
|
647 | 647 | > ui.write(b"read: %r\n" % sys.stdin.read(1)) |
|
648 | 648 | > @command(b"debugwritestdout", norepo=True) |
|
649 | 649 | > def debugwritestdout(ui): |
|
650 | 650 | > os.write(1, b"low-level stdout fd and\n") |
|
651 | 651 | > sys.stdout.write("stdout should be redirected to stderr\n") |
|
652 | 652 | > sys.stdout.flush() |
|
653 | 653 | > EOF |
|
654 | 654 | $ cat <<EOF >> .hg/hgrc |
|
655 | 655 | > [extensions] |
|
656 | 656 | > dbgui = ../dbgui.py |
|
657 | 657 | > EOF |
|
658 | 658 | |
|
659 | 659 | >>> from hgclient import check, readchannel, runcommand, stringio |
|
660 | 660 | >>> @check |
|
661 | 661 | ... def getpass(server): |
|
662 | 662 | ... readchannel(server) |
|
663 | 663 | ... runcommand(server, [b'debuggetpass', b'--config', |
|
664 | 664 | ... b'ui.interactive=True'], |
|
665 | 665 | ... input=stringio(b'1234\n')) |
|
666 | 666 | ... runcommand(server, [b'debuggetpass', b'--config', |
|
667 | 667 | ... b'ui.interactive=True'], |
|
668 | 668 | ... input=stringio(b'\n')) |
|
669 | 669 | ... runcommand(server, [b'debuggetpass', b'--config', |
|
670 | 670 | ... b'ui.interactive=True'], |
|
671 | 671 | ... input=stringio(b'')) |
|
672 | 672 | ... runcommand(server, [b'debugprompt', b'--config', |
|
673 | 673 | ... b'ui.interactive=True'], |
|
674 | 674 | ... input=stringio(b'5678\n')) |
|
675 | 675 | ... runcommand(server, [b'debugprompt', b'--config', |
|
676 | 676 | ... b'ui.interactive=True'], |
|
677 | 677 | ... input=stringio(b'\nremainder\nshould\nnot\nbe\nread\n')) |
|
678 | 678 | ... runcommand(server, [b'debugreadstdin']) |
|
679 | 679 | ... runcommand(server, [b'debugwritestdout']) |
|
680 | 680 | *** runcommand debuggetpass --config ui.interactive=True |
|
681 | 681 | password: 1234 |
|
682 | 682 | *** runcommand debuggetpass --config ui.interactive=True |
|
683 | 683 | password: |
|
684 | 684 | *** runcommand debuggetpass --config ui.interactive=True |
|
685 | 685 | password: abort: response expected |
|
686 | 686 | [255] |
|
687 | 687 | *** runcommand debugprompt --config ui.interactive=True |
|
688 | 688 | prompt: 5678 |
|
689 | 689 | *** runcommand debugprompt --config ui.interactive=True |
|
690 | 690 | prompt: y |
|
691 | 691 | *** runcommand debugreadstdin |
|
692 | 692 | read: '' |
|
693 | 693 | *** runcommand debugwritestdout |
|
694 | 694 | low-level stdout fd and |
|
695 | 695 | stdout should be redirected to stderr |
|
696 | 696 | |
|
697 | 697 | |
|
698 | 698 | run commandserver in commandserver, which is silly but should work: |
|
699 | 699 | |
|
700 | 700 | >>> from hgclient import bprint, check, readchannel, runcommand, stringio |
|
701 | 701 | >>> @check |
|
702 | 702 | ... def nested(server): |
|
703 | 703 | ... bprint(b'%c, %r' % readchannel(server)) |
|
704 | 704 | ... class nestedserver(object): |
|
705 | 705 | ... stdin = stringio(b'getencoding\n') |
|
706 | 706 | ... stdout = stringio() |
|
707 | 707 | ... runcommand(server, [b'serve', b'--cmdserver', b'pipe'], |
|
708 | 708 | ... output=nestedserver.stdout, input=nestedserver.stdin) |
|
709 | 709 | ... nestedserver.stdout.seek(0) |
|
710 | 710 | ... bprint(b'%c, %r' % readchannel(nestedserver)) # hello |
|
711 | 711 | ... bprint(b'%c, %r' % readchannel(nestedserver)) # getencoding |
|
712 | 712 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
713 | 713 | *** runcommand serve --cmdserver pipe |
|
714 | 714 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
715 | 715 | r, '*' (glob) |
|
716 | 716 | |
|
717 | 717 | |
|
718 | 718 | start without repository: |
|
719 | 719 | |
|
720 | 720 | $ cd .. |
|
721 | 721 | |
|
722 | 722 | >>> from hgclient import bprint, check, readchannel, runcommand |
|
723 | 723 | >>> @check |
|
724 | 724 | ... def hellomessage(server): |
|
725 | 725 | ... ch, data = readchannel(server) |
|
726 | 726 | ... bprint(b'%c, %r' % (ch, data)) |
|
727 | 727 | ... # run an arbitrary command to make sure the next thing the server |
|
728 | 728 | ... # sends isn't part of the hello message |
|
729 | 729 | ... runcommand(server, [b'id']) |
|
730 | 730 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
731 | 731 | *** runcommand id |
|
732 | 732 | abort: there is no Mercurial repository here (.hg not found) |
|
733 | 733 | [10] |
|
734 | 734 | |
|
735 | 735 | >>> from hgclient import check, readchannel, runcommand |
|
736 | 736 | >>> @check |
|
737 | 737 | ... def startwithoutrepo(server): |
|
738 | 738 | ... readchannel(server) |
|
739 | 739 | ... runcommand(server, [b'init', b'repo2']) |
|
740 | 740 | ... runcommand(server, [b'id', b'-R', b'repo2']) |
|
741 | 741 | *** runcommand init repo2 |
|
742 | 742 | *** runcommand id -R repo2 |
|
743 | 743 | 000000000000 tip |
|
744 | 744 | |
|
745 | 745 | |
|
746 | 746 | don't fall back to cwd if invalid -R path is specified (issue4805): |
|
747 | 747 | |
|
748 | 748 | $ cd repo |
|
749 | 749 | $ hg serve --cmdserver pipe -R ../nonexistent |
|
750 | 750 | abort: repository ../nonexistent not found |
|
751 | 751 | [255] |
|
752 | 752 | $ cd .. |
|
753 | 753 | |
|
754 | 754 | |
|
755 | 755 | #if no-windows |
|
756 | 756 | |
|
757 | 757 | option to not shutdown on SIGINT: |
|
758 | 758 | |
|
759 | 759 | $ cat <<'EOF' > dbgint.py |
|
760 | 760 | > import os |
|
761 | 761 | > import signal |
|
762 | 762 | > import time |
|
763 | 763 | > from mercurial import commands, registrar |
|
764 | 764 | > cmdtable = {} |
|
765 | 765 | > command = registrar.command(cmdtable) |
|
766 | 766 | > @command(b"debugsleep", norepo=True) |
|
767 | 767 | > def debugsleep(ui): |
|
768 | 768 | > time.sleep(1) |
|
769 | 769 | > @command(b"debugsuicide", norepo=True) |
|
770 | 770 | > def debugsuicide(ui): |
|
771 | 771 | > os.kill(os.getpid(), signal.SIGINT) |
|
772 | 772 | > time.sleep(1) |
|
773 | 773 | > EOF |
|
774 | 774 | |
|
775 | 775 | >>> import signal |
|
776 | 776 | >>> import time |
|
777 | 777 | >>> from hgclient import checkwith, readchannel, runcommand |
|
778 | 778 | >>> @checkwith(extraargs=[b'--config', b'cmdserver.shutdown-on-interrupt=False', |
|
779 | 779 | ... b'--config', b'extensions.dbgint=dbgint.py']) |
|
780 | 780 | ... def nointr(server): |
|
781 | 781 | ... readchannel(server) |
|
782 | 782 | ... server.send_signal(signal.SIGINT) # server won't be terminated |
|
783 | 783 | ... time.sleep(1) |
|
784 | 784 | ... runcommand(server, [b'debugsleep']) |
|
785 | 785 | ... server.send_signal(signal.SIGINT) # server won't be terminated |
|
786 | 786 | ... runcommand(server, [b'debugsleep']) |
|
787 | 787 | ... runcommand(server, [b'debugsuicide']) # command can be interrupted |
|
788 | 788 | ... server.send_signal(signal.SIGTERM) # server will be terminated |
|
789 | 789 | ... time.sleep(1) |
|
790 | 790 | *** runcommand debugsleep |
|
791 | 791 | *** runcommand debugsleep |
|
792 | 792 | *** runcommand debugsuicide |
|
793 | 793 | interrupted! |
|
794 | 794 | killed! |
|
795 | 795 | [255] |
|
796 | 796 | |
|
797 | 797 | #endif |
|
798 | 798 | |
|
799 | 799 | |
|
800 | 800 | structured message channel: |
|
801 | 801 | |
|
802 | 802 | $ cat <<'EOF' >> repo2/.hg/hgrc |
|
803 | 803 | > [ui] |
|
804 | 804 | > # server --config should precede repository option |
|
805 | 805 | > message-output = stdio |
|
806 | 806 | > EOF |
|
807 | 807 | |
|
808 | 808 | >>> from hgclient import bprint, checkwith, readchannel, runcommand |
|
809 | 809 | >>> @checkwith(extraargs=[b'--config', b'ui.message-output=channel', |
|
810 | 810 | ... b'--config', b'cmdserver.message-encodings=foo cbor']) |
|
811 | 811 | ... def verify(server): |
|
812 | 812 | ... _ch, data = readchannel(server) |
|
813 | 813 | ... bprint(data) |
|
814 | 814 | ... runcommand(server, [b'-R', b'repo2', b'verify']) |
|
815 | 815 | capabilities: getencoding runcommand |
|
816 | 816 | encoding: ascii |
|
817 | 817 | message-encoding: cbor |
|
818 | 818 | pid: * (glob) |
|
819 | 819 | pgid: * (glob) (no-windows !) |
|
820 | 820 | *** runcommand -R repo2 verify |
|
821 | 821 | message: '\xa2DdataTchecking changesets\nDtypeFstatus' |
|
822 | 822 | message: '\xa6Ditem@Cpos\xf6EtopicHcheckingEtotal\xf6DtypeHprogressDunit@' |
|
823 | 823 | message: '\xa2DdataSchecking manifests\nDtypeFstatus' |
|
824 | 824 | message: '\xa6Ditem@Cpos\xf6EtopicHcheckingEtotal\xf6DtypeHprogressDunit@' |
|
825 | 825 | message: '\xa2DdataX0crosschecking files in changesets and manifests\nDtypeFstatus' |
|
826 | 826 | message: '\xa6Ditem@Cpos\xf6EtopicMcrosscheckingEtotal\xf6DtypeHprogressDunit@' |
|
827 | 827 | message: '\xa2DdataOchecking files\nDtypeFstatus' |
|
828 | 828 | message: '\xa6Ditem@Cpos\xf6EtopicHcheckingEtotal\xf6DtypeHprogressDunit@' |
|
829 | 829 | message: '\xa2DdataX/checked 0 changesets with 0 changes to 0 files\nDtypeFstatus' |
|
830 | 830 | |
|
831 | 831 | >>> from hgclient import checkwith, readchannel, runcommand, stringio |
|
832 | 832 | >>> @checkwith(extraargs=[b'--config', b'ui.message-output=channel', |
|
833 | 833 | ... b'--config', b'cmdserver.message-encodings=cbor', |
|
834 | 834 | ... b'--config', b'extensions.dbgui=dbgui.py']) |
|
835 | 835 | ... def prompt(server): |
|
836 | 836 | ... readchannel(server) |
|
837 | 837 | ... interactive = [b'--config', b'ui.interactive=True'] |
|
838 | 838 | ... runcommand(server, [b'debuggetpass'] + interactive, |
|
839 | 839 | ... input=stringio(b'1234\n')) |
|
840 | 840 | ... runcommand(server, [b'debugprompt'] + interactive, |
|
841 | 841 | ... input=stringio(b'5678\n')) |
|
842 | 842 | ... runcommand(server, [b'debugpromptchoice'] + interactive, |
|
843 | 843 | ... input=stringio(b'n\n')) |
|
844 | 844 | *** runcommand debuggetpass --config ui.interactive=True |
|
845 | 845 | message: '\xa3DdataJpassword: Hpassword\xf5DtypeFprompt' |
|
846 | 846 | 1234 |
|
847 | 847 | *** runcommand debugprompt --config ui.interactive=True |
|
848 | 848 | message: '\xa3DdataGprompt:GdefaultAyDtypeFprompt' |
|
849 | 849 | 5678 |
|
850 | 850 | *** runcommand debugpromptchoice --config ui.interactive=True |
|
851 | 851 | message: '\xa4Gchoices\x82\x82AyCYes\x82AnBNoDdataTpromptchoice (y/n)? GdefaultAyDtypeFprompt' |
|
852 | 852 | 1 |
|
853 | 853 | |
|
854 | 854 | bad message encoding: |
|
855 | 855 | |
|
856 | 856 | $ hg serve --cmdserver pipe --config ui.message-output=channel |
|
857 | 857 | abort: no supported message encodings: |
|
858 | 858 | [255] |
|
859 | 859 | $ hg serve --cmdserver pipe --config ui.message-output=channel \ |
|
860 | 860 | > --config cmdserver.message-encodings='foo bar' |
|
861 | 861 | abort: no supported message encodings: foo bar |
|
862 | 862 | [255] |
|
863 | 863 | |
|
864 | 864 | unix domain socket: |
|
865 | 865 | |
|
866 | 866 | $ cd repo |
|
867 | 867 | $ hg update -q |
|
868 | 868 | |
|
869 | 869 | #if unix-socket unix-permissions |
|
870 | 870 | |
|
871 | 871 | >>> from hgclient import bprint, check, readchannel, runcommand, stringio, unixserver |
|
872 | 872 | >>> server = unixserver(b'.hg/server.sock', b'.hg/server.log') |
|
873 | 873 | >>> def hellomessage(conn): |
|
874 | 874 | ... ch, data = readchannel(conn) |
|
875 | 875 | ... bprint(b'%c, %r' % (ch, data)) |
|
876 | 876 | ... runcommand(conn, [b'id']) |
|
877 | 877 | >>> check(hellomessage, server.connect) |
|
878 | 878 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
879 | 879 | *** runcommand id |
|
880 | 880 | eff892de26ec tip bm1/bm2/bm3 |
|
881 | 881 | >>> def unknowncommand(conn): |
|
882 | 882 | ... readchannel(conn) |
|
883 | 883 | ... conn.stdin.write(b'unknowncommand\n') |
|
884 | 884 | >>> check(unknowncommand, server.connect) # error sent to server.log |
|
885 | 885 | >>> def serverinput(conn): |
|
886 | 886 | ... readchannel(conn) |
|
887 | 887 | ... patch = b""" |
|
888 | 888 | ... # HG changeset patch |
|
889 | 889 | ... # User test |
|
890 | 890 | ... # Date 0 0 |
|
891 | 891 | ... 2 |
|
892 | 892 | ... |
|
893 | 893 | ... diff -r eff892de26ec -r 1ed24be7e7a0 a |
|
894 | 894 | ... --- a/a |
|
895 | 895 | ... +++ b/a |
|
896 | 896 | ... @@ -1,1 +1,2 @@ |
|
897 | 897 | ... 1 |
|
898 | 898 | ... +2 |
|
899 | 899 | ... """ |
|
900 | 900 | ... runcommand(conn, [b'import', b'-'], input=stringio(patch)) |
|
901 | 901 | ... runcommand(conn, [b'log', b'-rtip', b'-q']) |
|
902 | 902 | >>> check(serverinput, server.connect) |
|
903 | 903 | *** runcommand import - |
|
904 | 904 | applying patch from stdin |
|
905 | 905 | *** runcommand log -rtip -q |
|
906 | 906 | 2:1ed24be7e7a0 |
|
907 | 907 | >>> server.shutdown() |
|
908 | 908 | |
|
909 | 909 | $ cat .hg/server.log |
|
910 | 910 | listening at .hg/server.sock |
|
911 | 911 | abort: unknown command unknowncommand |
|
912 | 912 | killed! |
|
913 | 913 | $ rm .hg/server.log |
|
914 | 914 | |
|
915 | 915 | if server crashed before hello, traceback will be sent to 'e' channel as |
|
916 | 916 | last ditch: |
|
917 | 917 | |
|
918 | 918 | $ cat <<'EOF' > ../earlycrasher.py |
|
919 | 919 | > from mercurial import commandserver, extensions |
|
920 | 920 | > def _serverequest(orig, ui, repo, conn, createcmdserver, prereposetups): |
|
921 | 921 | > def createcmdserver(*args, **kwargs): |
|
922 | 922 | > raise Exception('crash') |
|
923 | 923 | > return orig(ui, repo, conn, createcmdserver, prereposetups) |
|
924 | 924 | > def extsetup(ui): |
|
925 | 925 | > extensions.wrapfunction(commandserver, b'_serverequest', _serverequest) |
|
926 | 926 | > EOF |
|
927 | 927 | $ cat <<EOF >> .hg/hgrc |
|
928 | 928 | > [extensions] |
|
929 | 929 | > earlycrasher = ../earlycrasher.py |
|
930 | 930 | > EOF |
|
931 | 931 | >>> from hgclient import bprint, check, readchannel, unixserver |
|
932 | 932 | >>> server = unixserver(b'.hg/server.sock', b'.hg/server.log') |
|
933 | 933 | >>> def earlycrash(conn): |
|
934 | 934 | ... while True: |
|
935 | 935 | ... try: |
|
936 | 936 | ... ch, data = readchannel(conn) |
|
937 | 937 | ... for l in data.splitlines(True): |
|
938 | 938 | ... if not l.startswith(b' '): |
|
939 | 939 | ... bprint(b'%c, %r' % (ch, l)) |
|
940 | 940 | ... except EOFError: |
|
941 | 941 | ... break |
|
942 | 942 | >>> check(earlycrash, server.connect) |
|
943 | 943 | e, 'Traceback (most recent call last):\n' |
|
944 | 944 | e, 'Exception: crash\n' |
|
945 | 945 | >>> server.shutdown() |
|
946 | 946 | |
|
947 | 947 | $ cat .hg/server.log | grep -v '^ ' |
|
948 | 948 | listening at .hg/server.sock |
|
949 | 949 | Traceback (most recent call last): |
|
950 | 950 | Exception: crash |
|
951 | 951 | killed! |
|
952 | 952 | #endif |
|
953 | 953 | #if no-unix-socket |
|
954 | 954 | |
|
955 | 955 | $ hg serve --cmdserver unix -a .hg/server.sock |
|
956 | 956 | abort: unsupported platform |
|
957 | 957 | [255] |
|
958 | 958 | |
|
959 | 959 | #endif |
|
960 | 960 | |
|
961 | 961 | $ cd .. |
|
962 | 962 | |
|
963 | 963 | Test that accessing to invalid changelog cache is avoided at |
|
964 | 964 | subsequent operations even if repo object is reused even after failure |
|
965 | 965 | of transaction (see 0a7610758c42 also) |
|
966 | 966 | |
|
967 | 967 | "hg log" after failure of transaction is needed to detect invalid |
|
968 | 968 | cache in repoview: this can't detect by "hg verify" only. |
|
969 | 969 | |
|
970 | 970 | Combination of "finalization" and "empty-ness of changelog" (2 x 2 = |
|
971 | 971 | 4) are tested, because '00changelog.i' are differently changed in each |
|
972 | 972 | cases. |
|
973 | 973 | |
|
974 | 974 | $ cat > $TESTTMP/failafterfinalize.py <<EOF |
|
975 | 975 | > # extension to abort transaction after finalization forcibly |
|
976 | 976 | > from mercurial import commands, error, extensions, lock as lockmod |
|
977 | 977 | > from mercurial import registrar |
|
978 | 978 | > cmdtable = {} |
|
979 | 979 | > command = registrar.command(cmdtable) |
|
980 | 980 | > configtable = {} |
|
981 | 981 | > configitem = registrar.configitem(configtable) |
|
982 | 982 | > configitem(b'failafterfinalize', b'fail', |
|
983 | 983 | > default=None, |
|
984 | 984 | > ) |
|
985 | 985 | > def fail(tr): |
|
986 | 986 | > raise error.Abort(b'fail after finalization') |
|
987 | 987 | > def reposetup(ui, repo): |
|
988 | 988 | > class failrepo(repo.__class__): |
|
989 | 989 | > def commitctx(self, ctx, error=False, origctx=None): |
|
990 | 990 | > if self.ui.configbool(b'failafterfinalize', b'fail'): |
|
991 | 991 | > # 'sorted()' by ASCII code on category names causes |
|
992 | 992 | > # invoking 'fail' after finalization of changelog |
|
993 | 993 | > # using "'cl-%i' % id(self)" as category name |
|
994 | 994 | > self.currenttransaction().addfinalize(b'zzzzzzzz', fail) |
|
995 | 995 | > return super(failrepo, self).commitctx(ctx, error, origctx) |
|
996 | 996 | > repo.__class__ = failrepo |
|
997 | 997 | > EOF |
|
998 | 998 | |
|
999 | 999 | $ hg init repo3 |
|
1000 | 1000 | $ cd repo3 |
|
1001 | 1001 | |
|
1002 | 1002 | $ cat <<EOF >> $HGRCPATH |
|
1003 | 1003 | > [command-templates] |
|
1004 | 1004 | > log = {rev} {desc|firstline} ({files})\n |
|
1005 | 1005 | > |
|
1006 | 1006 | > [extensions] |
|
1007 | 1007 | > failafterfinalize = $TESTTMP/failafterfinalize.py |
|
1008 | 1008 | > EOF |
|
1009 | 1009 | |
|
1010 | 1010 | - test failure with "empty changelog" |
|
1011 | 1011 | |
|
1012 | 1012 | $ echo foo > foo |
|
1013 | 1013 | $ hg add foo |
|
1014 | 1014 | |
|
1015 | 1015 | (failure before finalization) |
|
1016 | 1016 | |
|
1017 | 1017 | >>> from hgclient import check, readchannel, runcommand |
|
1018 | 1018 | >>> @check |
|
1019 | 1019 | ... def abort(server): |
|
1020 | 1020 | ... readchannel(server) |
|
1021 | 1021 | ... runcommand(server, [b'commit', |
|
1022 | 1022 | ... b'--config', b'hooks.pretxncommit=false', |
|
1023 | 1023 | ... b'-mfoo']) |
|
1024 | 1024 | ... runcommand(server, [b'log']) |
|
1025 | 1025 | ... runcommand(server, [b'verify', b'-q']) |
|
1026 | 1026 | *** runcommand commit --config hooks.pretxncommit=false -mfoo |
|
1027 | 1027 | transaction abort! |
|
1028 | 1028 | rollback completed |
|
1029 | 1029 | abort: pretxncommit hook exited with status 1 |
|
1030 | 1030 | [40] |
|
1031 | 1031 | *** runcommand log |
|
1032 | 1032 | *** runcommand verify -q |
|
1033 | 1033 | |
|
1034 | 1034 | (failure after finalization) |
|
1035 | 1035 | |
|
1036 | 1036 | >>> from hgclient import check, readchannel, runcommand |
|
1037 | 1037 | >>> @check |
|
1038 | 1038 | ... def abort(server): |
|
1039 | 1039 | ... readchannel(server) |
|
1040 | 1040 | ... runcommand(server, [b'commit', |
|
1041 | 1041 | ... b'--config', b'failafterfinalize.fail=true', |
|
1042 | 1042 | ... b'-mfoo']) |
|
1043 | 1043 | ... runcommand(server, [b'log']) |
|
1044 | 1044 | ... runcommand(server, [b'verify', b'-q']) |
|
1045 | 1045 | *** runcommand commit --config failafterfinalize.fail=true -mfoo |
|
1046 | 1046 | transaction abort! |
|
1047 | 1047 | rollback completed |
|
1048 | 1048 | abort: fail after finalization |
|
1049 | 1049 | [255] |
|
1050 | 1050 | *** runcommand log |
|
1051 | 1051 | *** runcommand verify -q |
|
1052 | 1052 | |
|
1053 | 1053 | - test failure with "not-empty changelog" |
|
1054 | 1054 | |
|
1055 | 1055 | $ echo bar > bar |
|
1056 | 1056 | $ hg add bar |
|
1057 | 1057 | $ hg commit -mbar bar |
|
1058 | 1058 | |
|
1059 | 1059 | (failure before finalization) |
|
1060 | 1060 | |
|
1061 | 1061 | >>> from hgclient import check, readchannel, runcommand |
|
1062 | 1062 | >>> @check |
|
1063 | 1063 | ... def abort(server): |
|
1064 | 1064 | ... readchannel(server) |
|
1065 | 1065 | ... runcommand(server, [b'commit', |
|
1066 | 1066 | ... b'--config', b'hooks.pretxncommit=false', |
|
1067 | 1067 | ... b'-mfoo', b'foo']) |
|
1068 | 1068 | ... runcommand(server, [b'log']) |
|
1069 | 1069 | ... runcommand(server, [b'verify', b'-q']) |
|
1070 | 1070 | *** runcommand commit --config hooks.pretxncommit=false -mfoo foo |
|
1071 | 1071 | transaction abort! |
|
1072 | 1072 | rollback completed |
|
1073 | 1073 | abort: pretxncommit hook exited with status 1 |
|
1074 | 1074 | [40] |
|
1075 | 1075 | *** runcommand log |
|
1076 | 1076 | 0 bar (bar) |
|
1077 | 1077 | *** runcommand verify -q |
|
1078 | 1078 | |
|
1079 | 1079 | (failure after finalization) |
|
1080 | 1080 | |
|
1081 | 1081 | >>> from hgclient import check, readchannel, runcommand |
|
1082 | 1082 | >>> @check |
|
1083 | 1083 | ... def abort(server): |
|
1084 | 1084 | ... readchannel(server) |
|
1085 | 1085 | ... runcommand(server, [b'commit', |
|
1086 | 1086 | ... b'--config', b'failafterfinalize.fail=true', |
|
1087 | 1087 | ... b'-mfoo', b'foo']) |
|
1088 | 1088 | ... runcommand(server, [b'log']) |
|
1089 | 1089 | ... runcommand(server, [b'verify', b'-q']) |
|
1090 | 1090 | *** runcommand commit --config failafterfinalize.fail=true -mfoo foo |
|
1091 | 1091 | transaction abort! |
|
1092 | 1092 | rollback completed |
|
1093 | 1093 | abort: fail after finalization |
|
1094 | 1094 | [255] |
|
1095 | 1095 | *** runcommand log |
|
1096 | 1096 | 0 bar (bar) |
|
1097 | 1097 | *** runcommand verify -q |
|
1098 | 1098 | |
|
1099 | 1099 | $ cd .. |
|
1100 | 1100 | |
|
1101 | 1101 | Test symlink traversal over cached audited paths: |
|
1102 | 1102 | ------------------------------------------------- |
|
1103 | 1103 | |
|
1104 | 1104 | #if symlink |
|
1105 | 1105 | |
|
1106 | 1106 | set up symlink hell |
|
1107 | 1107 | |
|
1108 | 1108 | $ mkdir merge-symlink-out |
|
1109 | 1109 | $ hg init merge-symlink |
|
1110 | 1110 | $ cd merge-symlink |
|
1111 | 1111 | $ touch base |
|
1112 | 1112 | $ hg commit -qAm base |
|
1113 | 1113 | $ ln -s ../merge-symlink-out a |
|
1114 | 1114 | $ hg commit -qAm 'symlink a -> ../merge-symlink-out' |
|
1115 | 1115 | $ hg up -q 0 |
|
1116 | 1116 | $ mkdir a |
|
1117 | 1117 | $ touch a/poisoned |
|
1118 | 1118 | $ hg commit -qAm 'file a/poisoned' |
|
1119 | 1119 | $ hg log -G -T '{rev}: {desc}\n' |
|
1120 | 1120 | @ 2: file a/poisoned |
|
1121 | 1121 | | |
|
1122 | 1122 | | o 1: symlink a -> ../merge-symlink-out |
|
1123 | 1123 | |/ |
|
1124 | 1124 | o 0: base |
|
1125 | 1125 | |
|
1126 | 1126 | |
|
1127 | 1127 | try trivial merge after update: cache of audited paths should be discarded, |
|
1128 | 1128 | and the merge should fail (issue5628) |
|
1129 | 1129 | |
|
1130 | 1130 | $ hg up -q null |
|
1131 | 1131 | >>> from hgclient import check, readchannel, runcommand |
|
1132 | 1132 | >>> @check |
|
1133 | 1133 | ... def merge(server): |
|
1134 | 1134 | ... readchannel(server) |
|
1135 | 1135 | ... # audit a/poisoned as a good path |
|
1136 | 1136 | ... runcommand(server, [b'up', b'-qC', b'2']) |
|
1137 | 1137 | ... runcommand(server, [b'up', b'-qC', b'1']) |
|
1138 | 1138 | ... # here a is a symlink, so a/poisoned is bad |
|
1139 | 1139 | ... runcommand(server, [b'merge', b'2']) |
|
1140 | 1140 | *** runcommand up -qC 2 |
|
1141 | 1141 | *** runcommand up -qC 1 |
|
1142 | 1142 | *** runcommand merge 2 |
|
1143 | 1143 | abort: path 'a/poisoned' traverses symbolic link 'a' |
|
1144 | 1144 | [255] |
|
1145 | 1145 | $ ls ../merge-symlink-out |
|
1146 | 1146 | |
|
1147 | 1147 | cache of repo.auditor should be discarded, so matcher would never traverse |
|
1148 | 1148 | symlinks: |
|
1149 | 1149 | |
|
1150 | 1150 | $ hg up -qC 0 |
|
1151 | 1151 | $ touch ../merge-symlink-out/poisoned |
|
1152 | 1152 | >>> from hgclient import check, readchannel, runcommand |
|
1153 | 1153 | >>> @check |
|
1154 | 1154 | ... def files(server): |
|
1155 | 1155 | ... readchannel(server) |
|
1156 | 1156 | ... runcommand(server, [b'up', b'-qC', b'2']) |
|
1157 | 1157 | ... # audit a/poisoned as a good path |
|
1158 | 1158 | ... runcommand(server, [b'files', b'a/poisoned']) |
|
1159 | 1159 | ... runcommand(server, [b'up', b'-qC', b'0']) |
|
1160 | 1160 | ... runcommand(server, [b'up', b'-qC', b'1']) |
|
1161 | 1161 | ... # here 'a' is a symlink, so a/poisoned should be warned |
|
1162 | 1162 | ... runcommand(server, [b'files', b'a/poisoned']) |
|
1163 | 1163 | *** runcommand up -qC 2 |
|
1164 | 1164 | *** runcommand files a/poisoned |
|
1165 | 1165 | a/poisoned |
|
1166 | 1166 | *** runcommand up -qC 0 |
|
1167 | 1167 | *** runcommand up -qC 1 |
|
1168 | 1168 | *** runcommand files a/poisoned |
|
1169 | 1169 | abort: path 'a/poisoned' traverses symbolic link 'a' |
|
1170 | 1170 | [255] |
|
1171 | 1171 | |
|
1172 | 1172 | $ cd .. |
|
1173 | 1173 | |
|
1174 | 1174 | #endif |
@@ -1,247 +1,247 b'' | |||
|
1 | 1 | #testcases dirstate-v1 dirstate-v2 |
|
2 | 2 | |
|
3 | 3 | #if dirstate-v2 |
|
4 | 4 | $ cat >> $HGRCPATH << EOF |
|
5 | 5 | > [format] |
|
6 |
> e |
|
|
6 | > use-dirstate-v2=1 | |
|
7 | 7 | > [storage] |
|
8 | 8 | > dirstate-v2.slow-path=allow |
|
9 | 9 | > EOF |
|
10 | 10 | #endif |
|
11 | 11 | |
|
12 | 12 | $ hg init repo |
|
13 | 13 | $ cd repo |
|
14 | 14 | $ echo a > a |
|
15 | 15 | $ hg add a |
|
16 | 16 | $ hg commit -m test |
|
17 | 17 | |
|
18 | 18 | Do we ever miss a sub-second change?: |
|
19 | 19 | |
|
20 | 20 | $ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do |
|
21 | 21 | > hg co -qC 0 |
|
22 | 22 | > echo b > a |
|
23 | 23 | > hg st |
|
24 | 24 | > done |
|
25 | 25 | M a |
|
26 | 26 | M a |
|
27 | 27 | M a |
|
28 | 28 | M a |
|
29 | 29 | M a |
|
30 | 30 | M a |
|
31 | 31 | M a |
|
32 | 32 | M a |
|
33 | 33 | M a |
|
34 | 34 | M a |
|
35 | 35 | M a |
|
36 | 36 | M a |
|
37 | 37 | M a |
|
38 | 38 | M a |
|
39 | 39 | M a |
|
40 | 40 | M a |
|
41 | 41 | M a |
|
42 | 42 | M a |
|
43 | 43 | M a |
|
44 | 44 | M a |
|
45 | 45 | |
|
46 | 46 | $ echo test > b |
|
47 | 47 | $ mkdir dir1 |
|
48 | 48 | $ echo test > dir1/c |
|
49 | 49 | $ echo test > d |
|
50 | 50 | |
|
51 | 51 | $ echo test > e |
|
52 | 52 | #if execbit |
|
53 | 53 | A directory will typically have the execute bit -- make sure it doesn't get |
|
54 | 54 | confused with a file with the exec bit set |
|
55 | 55 | $ chmod +x e |
|
56 | 56 | #endif |
|
57 | 57 | |
|
58 | 58 | $ hg add b dir1 d e |
|
59 | 59 | adding dir1/c |
|
60 | 60 | $ hg commit -m test2 |
|
61 | 61 | |
|
62 | 62 | $ cat >> $TESTTMP/dirstaterace.py << EOF |
|
63 | 63 | > from mercurial import ( |
|
64 | 64 | > context, |
|
65 | 65 | > extensions, |
|
66 | 66 | > ) |
|
67 | 67 | > def extsetup(ui): |
|
68 | 68 | > extensions.wrapfunction(context.workingctx, '_checklookup', overridechecklookup) |
|
69 | 69 | > def overridechecklookup(orig, self, files): |
|
70 | 70 | > # make an update that changes the dirstate from underneath |
|
71 | 71 | > self._repo.ui.system(br"sh '$TESTTMP/dirstaterace.sh'", |
|
72 | 72 | > cwd=self._repo.root) |
|
73 | 73 | > return orig(self, files) |
|
74 | 74 | > EOF |
|
75 | 75 | |
|
76 | 76 | $ hg debugrebuilddirstate |
|
77 | 77 | $ hg debugdirstate |
|
78 | 78 | n 0 -1 unset a |
|
79 | 79 | n 0 -1 unset b |
|
80 | 80 | n 0 -1 unset d |
|
81 | 81 | n 0 -1 unset dir1/c |
|
82 | 82 | n 0 -1 unset e |
|
83 | 83 | |
|
84 | 84 | XXX Note that this returns M for files that got replaced by directories. This is |
|
85 | 85 | definitely a bug, but the fix for that is hard and the next status run is fine |
|
86 | 86 | anyway. |
|
87 | 87 | |
|
88 | 88 | $ cat > $TESTTMP/dirstaterace.sh <<EOF |
|
89 | 89 | > rm b && rm -r dir1 && rm d && mkdir d && rm e && mkdir e |
|
90 | 90 | > EOF |
|
91 | 91 | |
|
92 | 92 | $ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py |
|
93 | 93 | M d |
|
94 | 94 | M e |
|
95 | 95 | ! b |
|
96 | 96 | ! dir1/c |
|
97 | 97 | $ hg debugdirstate |
|
98 | 98 | n 644 2 * a (glob) |
|
99 | 99 | n 0 -1 unset b |
|
100 | 100 | n 0 -1 unset d |
|
101 | 101 | n 0 -1 unset dir1/c |
|
102 | 102 | n 0 -1 unset e |
|
103 | 103 | |
|
104 | 104 | $ hg status |
|
105 | 105 | ! b |
|
106 | 106 | ! d |
|
107 | 107 | ! dir1/c |
|
108 | 108 | ! e |
|
109 | 109 | |
|
110 | 110 | $ rmdir d e |
|
111 | 111 | $ hg update -C -q . |
|
112 | 112 | |
|
113 | 113 | Test that dirstate changes aren't written out at the end of "hg |
|
114 | 114 | status", if .hg/dirstate is already changed simultaneously before |
|
115 | 115 | acquisition of wlock in workingctx._poststatusfixup(). |
|
116 | 116 | |
|
117 | 117 | This avoidance is important to keep consistency of dirstate in race |
|
118 | 118 | condition (see issue5584 for detail). |
|
119 | 119 | |
|
120 | 120 | $ hg parents -q |
|
121 | 121 | 1:* (glob) |
|
122 | 122 | |
|
123 | 123 | $ hg debugrebuilddirstate |
|
124 | 124 | $ hg debugdirstate |
|
125 | 125 | n 0 -1 unset a |
|
126 | 126 | n 0 -1 unset b |
|
127 | 127 | n 0 -1 unset d |
|
128 | 128 | n 0 -1 unset dir1/c |
|
129 | 129 | n 0 -1 unset e |
|
130 | 130 | |
|
131 | 131 | $ cat > $TESTTMP/dirstaterace.sh <<EOF |
|
132 | 132 | > # This script assumes timetable of typical issue5584 case below: |
|
133 | 133 | > # |
|
134 | 134 | > # 1. "hg status" loads .hg/dirstate |
|
135 | 135 | > # 2. "hg status" confirms clean-ness of FILE |
|
136 | 136 | > # 3. "hg update -C 0" updates the working directory simultaneously |
|
137 | 137 | > # (FILE is removed, and FILE is dropped from .hg/dirstate) |
|
138 | 138 | > # 4. "hg status" acquires wlock |
|
139 | 139 | > # (.hg/dirstate is re-loaded = no FILE entry in dirstate) |
|
140 | 140 | > # 5. "hg status" marks FILE in dirstate as clean |
|
141 | 141 | > # (FILE entry is added to in-memory dirstate) |
|
142 | 142 | > # 6. "hg status" writes dirstate changes into .hg/dirstate |
|
143 | 143 | > # (FILE entry is written into .hg/dirstate) |
|
144 | 144 | > # |
|
145 | 145 | > # To reproduce similar situation easily and certainly, #2 and #3 |
|
146 | 146 | > # are swapped. "hg cat" below ensures #2 on "hg status" side. |
|
147 | 147 | > |
|
148 | 148 | > hg update -q -C 0 |
|
149 | 149 | > hg cat -r 1 b > b |
|
150 | 150 | > EOF |
|
151 | 151 | |
|
152 | 152 | "hg status" below should excludes "e", of which exec flag is set, for |
|
153 | 153 | portability of test scenario, because unsure but missing "e" is |
|
154 | 154 | treated differently in _checklookup() according to runtime platform. |
|
155 | 155 | |
|
156 | 156 | - "missing(!)" on POSIX, "pctx[f].cmp(self[f])" raises ENOENT |
|
157 | 157 | - "modified(M)" on Windows, "self.flags(f) != pctx.flags(f)" is True |
|
158 | 158 | |
|
159 | 159 | $ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py --debug -X path:e |
|
160 | 160 | skip updating dirstate: identity mismatch |
|
161 | 161 | M a |
|
162 | 162 | ! d |
|
163 | 163 | ! dir1/c |
|
164 | 164 | |
|
165 | 165 | $ hg parents -q |
|
166 | 166 | 0:* (glob) |
|
167 | 167 | $ hg files |
|
168 | 168 | a |
|
169 | 169 | $ hg debugdirstate |
|
170 | 170 | n * * * a (glob) |
|
171 | 171 | |
|
172 | 172 | $ rm b |
|
173 | 173 | |
|
174 | 174 | #if fsmonitor |
|
175 | 175 | |
|
176 | 176 | Create fsmonitor state. |
|
177 | 177 | |
|
178 | 178 | $ hg status |
|
179 | 179 | $ f --type .hg/fsmonitor.state |
|
180 | 180 | .hg/fsmonitor.state: file |
|
181 | 181 | |
|
182 | 182 | Test that invalidating fsmonitor state in the middle (which doesn't require the |
|
183 | 183 | wlock) causes the fsmonitor update to be skipped. |
|
184 | 184 | hg debugrebuilddirstate ensures that the dirstaterace hook will be called, but |
|
185 | 185 | it also invalidates the fsmonitor state. So back it up and restore it. |
|
186 | 186 | |
|
187 | 187 | $ mv .hg/fsmonitor.state .hg/fsmonitor.state.tmp |
|
188 | 188 | $ hg debugrebuilddirstate |
|
189 | 189 | $ mv .hg/fsmonitor.state.tmp .hg/fsmonitor.state |
|
190 | 190 | |
|
191 | 191 | $ cat > $TESTTMP/dirstaterace.sh <<EOF |
|
192 | 192 | > rm .hg/fsmonitor.state |
|
193 | 193 | > EOF |
|
194 | 194 | |
|
195 | 195 | $ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py --debug |
|
196 | 196 | skip updating fsmonitor.state: identity mismatch |
|
197 | 197 | $ f .hg/fsmonitor.state |
|
198 | 198 | .hg/fsmonitor.state: file not found |
|
199 | 199 | |
|
200 | 200 | #endif |
|
201 | 201 | |
|
202 | 202 | Set up a rebase situation for issue5581. |
|
203 | 203 | |
|
204 | 204 | $ echo c2 > a |
|
205 | 205 | $ echo c2 > b |
|
206 | 206 | $ hg add b |
|
207 | 207 | $ hg commit -m c2 |
|
208 | 208 | created new head |
|
209 | 209 | $ echo c3 >> a |
|
210 | 210 | $ hg commit -m c3 |
|
211 | 211 | $ hg update 2 |
|
212 | 212 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
213 | 213 | $ echo c4 >> a |
|
214 | 214 | $ echo c4 >> b |
|
215 | 215 | $ hg commit -m c4 |
|
216 | 216 | created new head |
|
217 | 217 | |
|
218 | 218 | Configure a merge tool that runs status in the middle of the rebase. The goal of |
|
219 | 219 | the status call is to trigger a potential bug if fsmonitor's state is written |
|
220 | 220 | even though the wlock is held by another process. The output of 'hg status' in |
|
221 | 221 | the merge tool goes to /dev/null because we're more interested in the results of |
|
222 | 222 | 'hg status' run after the rebase. |
|
223 | 223 | |
|
224 | 224 | $ cat >> $TESTTMP/mergetool-race.sh << EOF |
|
225 | 225 | > echo "custom merge tool" |
|
226 | 226 | > printf "c2\nc3\nc4\n" > \$1 |
|
227 | 227 | > hg --cwd "$TESTTMP/repo" status > /dev/null |
|
228 | 228 | > echo "custom merge tool end" |
|
229 | 229 | > EOF |
|
230 | 230 | $ cat >> $HGRCPATH << EOF |
|
231 | 231 | > [extensions] |
|
232 | 232 | > rebase = |
|
233 | 233 | > [merge-tools] |
|
234 | 234 | > test.executable=sh |
|
235 | 235 | > test.args=$TESTTMP/mergetool-race.sh \$output |
|
236 | 236 | > EOF |
|
237 | 237 | |
|
238 | 238 | $ hg rebase -s . -d 3 --tool test |
|
239 | 239 | rebasing 4:b08445fd6b2a tip "c4" |
|
240 | 240 | merging a |
|
241 | 241 | custom merge tool |
|
242 | 242 | custom merge tool end |
|
243 | 243 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/* (glob) |
|
244 | 244 | |
|
245 | 245 | This hg status should be empty, whether or not fsmonitor is enabled (issue5581). |
|
246 | 246 | |
|
247 | 247 | $ hg status |
@@ -1,48 +1,48 b'' | |||
|
1 | 1 | #testcases dirstate-v1 dirstate-v2 |
|
2 | 2 | |
|
3 | 3 | #if dirstate-v2 |
|
4 | 4 | $ cat >> $HGRCPATH << EOF |
|
5 | 5 | > [format] |
|
6 |
> e |
|
|
6 | > use-dirstate-v2=1 | |
|
7 | 7 | > [storage] |
|
8 | 8 | > dirstate-v2.slow-path=allow |
|
9 | 9 | > EOF |
|
10 | 10 | #endif |
|
11 | 11 | |
|
12 | 12 | Checking the size/permissions/file-type of files stored in the |
|
13 | 13 | dirstate after an update where the files are changed concurrently |
|
14 | 14 | outside of hg's control. |
|
15 | 15 | |
|
16 | 16 | $ hg init repo |
|
17 | 17 | $ cd repo |
|
18 | 18 | $ echo a > a |
|
19 | 19 | $ hg commit -qAm _ |
|
20 | 20 | $ echo aa > a |
|
21 | 21 | $ hg commit -m _ |
|
22 | 22 | |
|
23 | 23 | $ hg debugdirstate --no-dates |
|
24 | 24 | n 644 3 (set |unset) a (re) |
|
25 | 25 | |
|
26 | 26 | $ cat >> $TESTTMP/dirstaterace.py << EOF |
|
27 | 27 | > from mercurial import ( |
|
28 | 28 | > extensions, |
|
29 | 29 | > merge, |
|
30 | 30 | > ) |
|
31 | 31 | > def extsetup(ui): |
|
32 | 32 | > extensions.wrapfunction(merge, 'applyupdates', wrap) |
|
33 | 33 | > def wrap(orig, *args, **kwargs): |
|
34 | 34 | > res = orig(*args, **kwargs) |
|
35 | 35 | > with open("a", "w"): |
|
36 | 36 | > pass # just truncate the file |
|
37 | 37 | > return res |
|
38 | 38 | > EOF |
|
39 | 39 | |
|
40 | 40 | Do an update where file 'a' is changed between hg writing it to disk |
|
41 | 41 | and hg writing the dirstate. The dirstate is correct nonetheless, and |
|
42 | 42 | so hg status correctly shows a as clean. |
|
43 | 43 | |
|
44 | 44 | $ hg up -r 0 --config extensions.race=$TESTTMP/dirstaterace.py |
|
45 | 45 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
46 | 46 | $ hg debugdirstate --no-dates |
|
47 | 47 | n 644 2 (set |unset) a (re) |
|
48 | 48 | $ echo a > a; hg status; hg diff |
@@ -1,105 +1,105 b'' | |||
|
1 | 1 | #testcases dirstate-v1 dirstate-v2 |
|
2 | 2 | |
|
3 | 3 | #if dirstate-v2 |
|
4 | 4 | $ cat >> $HGRCPATH << EOF |
|
5 | 5 | > [format] |
|
6 |
> e |
|
|
6 | > use-dirstate-v2=1 | |
|
7 | 7 | > [storage] |
|
8 | 8 | > dirstate-v2.slow-path=allow |
|
9 | 9 | > EOF |
|
10 | 10 | #endif |
|
11 | 11 | |
|
12 | 12 | ------ Test dirstate._dirs refcounting |
|
13 | 13 | |
|
14 | 14 | $ hg init t |
|
15 | 15 | $ cd t |
|
16 | 16 | $ mkdir -p a/b/c/d |
|
17 | 17 | $ touch a/b/c/d/x |
|
18 | 18 | $ touch a/b/c/d/y |
|
19 | 19 | $ touch a/b/c/d/z |
|
20 | 20 | $ hg ci -Am m |
|
21 | 21 | adding a/b/c/d/x |
|
22 | 22 | adding a/b/c/d/y |
|
23 | 23 | adding a/b/c/d/z |
|
24 | 24 | $ hg mv a z |
|
25 | 25 | moving a/b/c/d/x to z/b/c/d/x |
|
26 | 26 | moving a/b/c/d/y to z/b/c/d/y |
|
27 | 27 | moving a/b/c/d/z to z/b/c/d/z |
|
28 | 28 | |
|
29 | 29 | Test name collisions |
|
30 | 30 | |
|
31 | 31 | $ rm z/b/c/d/x |
|
32 | 32 | $ mkdir z/b/c/d/x |
|
33 | 33 | $ touch z/b/c/d/x/y |
|
34 | 34 | $ hg add z/b/c/d/x/y |
|
35 | 35 | abort: file 'z/b/c/d/x' in dirstate clashes with 'z/b/c/d/x/y' |
|
36 | 36 | [255] |
|
37 | 37 | $ rm -rf z/b/c/d |
|
38 | 38 | $ touch z/b/c/d |
|
39 | 39 | $ hg add z/b/c/d |
|
40 | 40 | abort: directory 'z/b/c/d' already in dirstate |
|
41 | 41 | [255] |
|
42 | 42 | |
|
43 | 43 | $ cd .. |
|
44 | 44 | |
|
45 | 45 | Issue1790: dirstate entry locked into unset if file mtime is set into |
|
46 | 46 | the future |
|
47 | 47 | |
|
48 | 48 | Prepare test repo: |
|
49 | 49 | |
|
50 | 50 | $ hg init u |
|
51 | 51 | $ cd u |
|
52 | 52 | $ echo a > a |
|
53 | 53 | $ hg add |
|
54 | 54 | adding a |
|
55 | 55 | $ hg ci -m1 |
|
56 | 56 | |
|
57 | 57 | Set mtime of a into the future: |
|
58 | 58 | |
|
59 | 59 | $ touch -t 203101011200 a |
|
60 | 60 | |
|
61 | 61 | Status must not set a's entry to unset (issue1790): |
|
62 | 62 | |
|
63 | 63 | $ hg status |
|
64 | 64 | $ hg debugstate |
|
65 | 65 | n 644 2 2031-01-01 12:00:00 a |
|
66 | 66 | |
|
67 | 67 | Test modulo storage/comparison of absurd dates: |
|
68 | 68 | |
|
69 | 69 | #if no-aix |
|
70 | 70 | $ touch -t 195001011200 a |
|
71 | 71 | $ hg st |
|
72 | 72 | $ hg debugstate |
|
73 | 73 | n 644 2 2018-01-19 15:14:08 a |
|
74 | 74 | #endif |
|
75 | 75 | |
|
76 | 76 | Verify that exceptions during a dirstate change leave the dirstate |
|
77 | 77 | coherent (issue4353) |
|
78 | 78 | |
|
79 | 79 | $ cat > ../dirstateexception.py <<EOF |
|
80 | 80 | > from __future__ import absolute_import |
|
81 | 81 | > from mercurial import ( |
|
82 | 82 | > error, |
|
83 | 83 | > extensions, |
|
84 | 84 | > mergestate as mergestatemod, |
|
85 | 85 | > ) |
|
86 | 86 | > |
|
87 | 87 | > def wraprecordupdates(*args): |
|
88 | 88 | > raise error.Abort(b"simulated error while recording dirstateupdates") |
|
89 | 89 | > |
|
90 | 90 | > def reposetup(ui, repo): |
|
91 | 91 | > extensions.wrapfunction(mergestatemod, 'recordupdates', |
|
92 | 92 | > wraprecordupdates) |
|
93 | 93 | > EOF |
|
94 | 94 | |
|
95 | 95 | $ hg rm a |
|
96 | 96 | $ hg commit -m 'rm a' |
|
97 | 97 | $ echo "[extensions]" >> .hg/hgrc |
|
98 | 98 | $ echo "dirstateex=../dirstateexception.py" >> .hg/hgrc |
|
99 | 99 | $ hg up 0 |
|
100 | 100 | abort: simulated error while recording dirstateupdates |
|
101 | 101 | [255] |
|
102 | 102 | $ hg log -r . -T '{rev}\n' |
|
103 | 103 | 1 |
|
104 | 104 | $ hg status |
|
105 | 105 | ? a |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
General Comments 0
You need to be logged in to leave comments.
Login now