Show More
@@ -1,1364 +1,1367 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 | def loadconfigtable(ui, extname, configtable): |
|
19 | 19 | """update config item known to the ui with the extension ones""" |
|
20 | 20 | for section, items in sorted(configtable.items()): |
|
21 | 21 | knownitems = ui._knownconfig.setdefault(section, itemregister()) |
|
22 | 22 | knownkeys = set(knownitems) |
|
23 | 23 | newkeys = set(items) |
|
24 | 24 | for key in sorted(knownkeys & newkeys): |
|
25 | 25 | msg = "extension '%s' overwrite config item '%s.%s'" |
|
26 | 26 | msg %= (extname, section, key) |
|
27 | 27 | ui.develwarn(msg, config='warn-config') |
|
28 | 28 | |
|
29 | 29 | knownitems.update(items) |
|
30 | 30 | |
|
31 | 31 | class configitem(object): |
|
32 | 32 | """represent a known config item |
|
33 | 33 | |
|
34 | 34 | :section: the official config section where to find this item, |
|
35 | 35 | :name: the official name within the section, |
|
36 | 36 | :default: default value for this item, |
|
37 | 37 | :alias: optional list of tuples as alternatives, |
|
38 | 38 | :generic: this is a generic definition, match name using regular expression. |
|
39 | 39 | """ |
|
40 | 40 | |
|
41 | 41 | def __init__(self, section, name, default=None, alias=(), |
|
42 | 42 | generic=False, priority=0): |
|
43 | 43 | self.section = section |
|
44 | 44 | self.name = name |
|
45 | 45 | self.default = default |
|
46 | 46 | self.alias = list(alias) |
|
47 | 47 | self.generic = generic |
|
48 | 48 | self.priority = priority |
|
49 | 49 | self._re = None |
|
50 | 50 | if generic: |
|
51 | 51 | self._re = re.compile(self.name) |
|
52 | 52 | |
|
53 | 53 | class itemregister(dict): |
|
54 | 54 | """A specialized dictionary that can handle wild-card selection""" |
|
55 | 55 | |
|
56 | 56 | def __init__(self): |
|
57 | 57 | super(itemregister, self).__init__() |
|
58 | 58 | self._generics = set() |
|
59 | 59 | |
|
60 | 60 | def update(self, other): |
|
61 | 61 | super(itemregister, self).update(other) |
|
62 | 62 | self._generics.update(other._generics) |
|
63 | 63 | |
|
64 | 64 | def __setitem__(self, key, item): |
|
65 | 65 | super(itemregister, self).__setitem__(key, item) |
|
66 | 66 | if item.generic: |
|
67 | 67 | self._generics.add(item) |
|
68 | 68 | |
|
69 | 69 | def get(self, key): |
|
70 | 70 | baseitem = super(itemregister, self).get(key) |
|
71 | 71 | if baseitem is not None and not baseitem.generic: |
|
72 | 72 | return baseitem |
|
73 | 73 | |
|
74 | 74 | # search for a matching generic item |
|
75 | 75 | generics = sorted(self._generics, key=(lambda x: (x.priority, x.name))) |
|
76 | 76 | for item in generics: |
|
77 | 77 | # we use 'match' instead of 'search' to make the matching simpler |
|
78 | 78 | # for people unfamiliar with regular expression. Having the match |
|
79 | 79 | # rooted to the start of the string will produce less surprising |
|
80 | 80 | # result for user writing simple regex for sub-attribute. |
|
81 | 81 | # |
|
82 | 82 | # For example using "color\..*" match produces an unsurprising |
|
83 | 83 | # result, while using search could suddenly match apparently |
|
84 | 84 | # unrelated configuration that happens to contains "color." |
|
85 | 85 | # anywhere. This is a tradeoff where we favor requiring ".*" on |
|
86 | 86 | # some match to avoid the need to prefix most pattern with "^". |
|
87 | 87 | # The "^" seems more error prone. |
|
88 | 88 | if item._re.match(key): |
|
89 | 89 | return item |
|
90 | 90 | |
|
91 | 91 | return None |
|
92 | 92 | |
|
93 | 93 | coreitems = {} |
|
94 | 94 | |
|
95 | 95 | def _register(configtable, *args, **kwargs): |
|
96 | 96 | item = configitem(*args, **kwargs) |
|
97 | 97 | section = configtable.setdefault(item.section, itemregister()) |
|
98 | 98 | if item.name in section: |
|
99 | 99 | msg = "duplicated config item registration for '%s.%s'" |
|
100 | 100 | raise error.ProgrammingError(msg % (item.section, item.name)) |
|
101 | 101 | section[item.name] = item |
|
102 | 102 | |
|
103 | 103 | # special value for case where the default is derived from other values |
|
104 | 104 | dynamicdefault = object() |
|
105 | 105 | |
|
106 | 106 | # Registering actual config items |
|
107 | 107 | |
|
108 | 108 | def getitemregister(configtable): |
|
109 | 109 | f = functools.partial(_register, configtable) |
|
110 | 110 | # export pseudo enum as configitem.* |
|
111 | 111 | f.dynamicdefault = dynamicdefault |
|
112 | 112 | return f |
|
113 | 113 | |
|
114 | 114 | coreconfigitem = getitemregister(coreitems) |
|
115 | 115 | |
|
116 | 116 | coreconfigitem('alias', '.*', |
|
117 | 117 | default=dynamicdefault, |
|
118 | 118 | generic=True, |
|
119 | 119 | ) |
|
120 | 120 | coreconfigitem('annotate', 'nodates', |
|
121 | 121 | default=False, |
|
122 | 122 | ) |
|
123 | 123 | coreconfigitem('annotate', 'showfunc', |
|
124 | 124 | default=False, |
|
125 | 125 | ) |
|
126 | 126 | coreconfigitem('annotate', 'unified', |
|
127 | 127 | default=None, |
|
128 | 128 | ) |
|
129 | 129 | coreconfigitem('annotate', 'git', |
|
130 | 130 | default=False, |
|
131 | 131 | ) |
|
132 | 132 | coreconfigitem('annotate', 'ignorews', |
|
133 | 133 | default=False, |
|
134 | 134 | ) |
|
135 | 135 | coreconfigitem('annotate', 'ignorewsamount', |
|
136 | 136 | default=False, |
|
137 | 137 | ) |
|
138 | 138 | coreconfigitem('annotate', 'ignoreblanklines', |
|
139 | 139 | default=False, |
|
140 | 140 | ) |
|
141 | 141 | coreconfigitem('annotate', 'ignorewseol', |
|
142 | 142 | default=False, |
|
143 | 143 | ) |
|
144 | 144 | coreconfigitem('annotate', 'nobinary', |
|
145 | 145 | default=False, |
|
146 | 146 | ) |
|
147 | 147 | coreconfigitem('annotate', 'noprefix', |
|
148 | 148 | default=False, |
|
149 | 149 | ) |
|
150 | 150 | coreconfigitem('annotate', 'word-diff', |
|
151 | 151 | default=False, |
|
152 | 152 | ) |
|
153 | 153 | coreconfigitem('auth', 'cookiefile', |
|
154 | 154 | default=None, |
|
155 | 155 | ) |
|
156 | 156 | # bookmarks.pushing: internal hack for discovery |
|
157 | 157 | coreconfigitem('bookmarks', 'pushing', |
|
158 | 158 | default=list, |
|
159 | 159 | ) |
|
160 | 160 | # bundle.mainreporoot: internal hack for bundlerepo |
|
161 | 161 | coreconfigitem('bundle', 'mainreporoot', |
|
162 | 162 | default='', |
|
163 | 163 | ) |
|
164 | 164 | # bundle.reorder: experimental config |
|
165 | 165 | coreconfigitem('bundle', 'reorder', |
|
166 | 166 | default='auto', |
|
167 | 167 | ) |
|
168 | 168 | coreconfigitem('censor', 'policy', |
|
169 | 169 | default='abort', |
|
170 | 170 | ) |
|
171 | 171 | coreconfigitem('chgserver', 'idletimeout', |
|
172 | 172 | default=3600, |
|
173 | 173 | ) |
|
174 | 174 | coreconfigitem('chgserver', 'skiphash', |
|
175 | 175 | default=False, |
|
176 | 176 | ) |
|
177 | 177 | coreconfigitem('cmdserver', 'log', |
|
178 | 178 | default=None, |
|
179 | 179 | ) |
|
180 | 180 | coreconfigitem('color', '.*', |
|
181 | 181 | default=None, |
|
182 | 182 | generic=True, |
|
183 | 183 | ) |
|
184 | 184 | coreconfigitem('color', 'mode', |
|
185 | 185 | default='auto', |
|
186 | 186 | ) |
|
187 | 187 | coreconfigitem('color', 'pagermode', |
|
188 | 188 | default=dynamicdefault, |
|
189 | 189 | ) |
|
190 | 190 | coreconfigitem('commands', 'show.aliasprefix', |
|
191 | 191 | default=list, |
|
192 | 192 | ) |
|
193 | 193 | coreconfigitem('commands', 'status.relative', |
|
194 | 194 | default=False, |
|
195 | 195 | ) |
|
196 | 196 | coreconfigitem('commands', 'status.skipstates', |
|
197 | 197 | default=[], |
|
198 | 198 | ) |
|
199 | 199 | coreconfigitem('commands', 'status.terse', |
|
200 | 200 | default='', |
|
201 | 201 | ) |
|
202 | 202 | coreconfigitem('commands', 'status.verbose', |
|
203 | 203 | default=False, |
|
204 | 204 | ) |
|
205 | 205 | coreconfigitem('commands', 'update.check', |
|
206 | 206 | default=None, |
|
207 | 207 | ) |
|
208 | 208 | coreconfigitem('commands', 'update.requiredest', |
|
209 | 209 | default=False, |
|
210 | 210 | ) |
|
211 | 211 | coreconfigitem('committemplate', '.*', |
|
212 | 212 | default=None, |
|
213 | 213 | generic=True, |
|
214 | 214 | ) |
|
215 | 215 | coreconfigitem('convert', 'bzr.saverev', |
|
216 | 216 | default=True, |
|
217 | 217 | ) |
|
218 | 218 | coreconfigitem('convert', 'cvsps.cache', |
|
219 | 219 | default=True, |
|
220 | 220 | ) |
|
221 | 221 | coreconfigitem('convert', 'cvsps.fuzz', |
|
222 | 222 | default=60, |
|
223 | 223 | ) |
|
224 | 224 | coreconfigitem('convert', 'cvsps.logencoding', |
|
225 | 225 | default=None, |
|
226 | 226 | ) |
|
227 | 227 | coreconfigitem('convert', 'cvsps.mergefrom', |
|
228 | 228 | default=None, |
|
229 | 229 | ) |
|
230 | 230 | coreconfigitem('convert', 'cvsps.mergeto', |
|
231 | 231 | default=None, |
|
232 | 232 | ) |
|
233 | 233 | coreconfigitem('convert', 'git.committeractions', |
|
234 | 234 | default=lambda: ['messagedifferent'], |
|
235 | 235 | ) |
|
236 | 236 | coreconfigitem('convert', 'git.extrakeys', |
|
237 | 237 | default=list, |
|
238 | 238 | ) |
|
239 | 239 | coreconfigitem('convert', 'git.findcopiesharder', |
|
240 | 240 | default=False, |
|
241 | 241 | ) |
|
242 | 242 | coreconfigitem('convert', 'git.remoteprefix', |
|
243 | 243 | default='remote', |
|
244 | 244 | ) |
|
245 | 245 | coreconfigitem('convert', 'git.renamelimit', |
|
246 | 246 | default=400, |
|
247 | 247 | ) |
|
248 | 248 | coreconfigitem('convert', 'git.saverev', |
|
249 | 249 | default=True, |
|
250 | 250 | ) |
|
251 | 251 | coreconfigitem('convert', 'git.similarity', |
|
252 | 252 | default=50, |
|
253 | 253 | ) |
|
254 | 254 | coreconfigitem('convert', 'git.skipsubmodules', |
|
255 | 255 | default=False, |
|
256 | 256 | ) |
|
257 | 257 | coreconfigitem('convert', 'hg.clonebranches', |
|
258 | 258 | default=False, |
|
259 | 259 | ) |
|
260 | 260 | coreconfigitem('convert', 'hg.ignoreerrors', |
|
261 | 261 | default=False, |
|
262 | 262 | ) |
|
263 | 263 | coreconfigitem('convert', 'hg.revs', |
|
264 | 264 | default=None, |
|
265 | 265 | ) |
|
266 | 266 | coreconfigitem('convert', 'hg.saverev', |
|
267 | 267 | default=False, |
|
268 | 268 | ) |
|
269 | 269 | coreconfigitem('convert', 'hg.sourcename', |
|
270 | 270 | default=None, |
|
271 | 271 | ) |
|
272 | 272 | coreconfigitem('convert', 'hg.startrev', |
|
273 | 273 | default=None, |
|
274 | 274 | ) |
|
275 | 275 | coreconfigitem('convert', 'hg.tagsbranch', |
|
276 | 276 | default='default', |
|
277 | 277 | ) |
|
278 | 278 | coreconfigitem('convert', 'hg.usebranchnames', |
|
279 | 279 | default=True, |
|
280 | 280 | ) |
|
281 | 281 | coreconfigitem('convert', 'ignoreancestorcheck', |
|
282 | 282 | default=False, |
|
283 | 283 | ) |
|
284 | 284 | coreconfigitem('convert', 'localtimezone', |
|
285 | 285 | default=False, |
|
286 | 286 | ) |
|
287 | 287 | coreconfigitem('convert', 'p4.encoding', |
|
288 | 288 | default=dynamicdefault, |
|
289 | 289 | ) |
|
290 | 290 | coreconfigitem('convert', 'p4.startrev', |
|
291 | 291 | default=0, |
|
292 | 292 | ) |
|
293 | 293 | coreconfigitem('convert', 'skiptags', |
|
294 | 294 | default=False, |
|
295 | 295 | ) |
|
296 | 296 | coreconfigitem('convert', 'svn.debugsvnlog', |
|
297 | 297 | default=True, |
|
298 | 298 | ) |
|
299 | 299 | coreconfigitem('convert', 'svn.trunk', |
|
300 | 300 | default=None, |
|
301 | 301 | ) |
|
302 | 302 | coreconfigitem('convert', 'svn.tags', |
|
303 | 303 | default=None, |
|
304 | 304 | ) |
|
305 | 305 | coreconfigitem('convert', 'svn.branches', |
|
306 | 306 | default=None, |
|
307 | 307 | ) |
|
308 | 308 | coreconfigitem('convert', 'svn.startrev', |
|
309 | 309 | default=0, |
|
310 | 310 | ) |
|
311 | 311 | coreconfigitem('debug', 'dirstate.delaywrite', |
|
312 | 312 | default=0, |
|
313 | 313 | ) |
|
314 | 314 | coreconfigitem('defaults', '.*', |
|
315 | 315 | default=None, |
|
316 | 316 | generic=True, |
|
317 | 317 | ) |
|
318 | 318 | coreconfigitem('devel', 'all-warnings', |
|
319 | 319 | default=False, |
|
320 | 320 | ) |
|
321 | 321 | coreconfigitem('devel', 'bundle2.debug', |
|
322 | 322 | default=False, |
|
323 | 323 | ) |
|
324 | 324 | coreconfigitem('devel', 'cache-vfs', |
|
325 | 325 | default=None, |
|
326 | 326 | ) |
|
327 | 327 | coreconfigitem('devel', 'check-locks', |
|
328 | 328 | default=False, |
|
329 | 329 | ) |
|
330 | 330 | coreconfigitem('devel', 'check-relroot', |
|
331 | 331 | default=False, |
|
332 | 332 | ) |
|
333 | 333 | coreconfigitem('devel', 'default-date', |
|
334 | 334 | default=None, |
|
335 | 335 | ) |
|
336 | 336 | coreconfigitem('devel', 'deprec-warn', |
|
337 | 337 | default=False, |
|
338 | 338 | ) |
|
339 | 339 | coreconfigitem('devel', 'disableloaddefaultcerts', |
|
340 | 340 | default=False, |
|
341 | 341 | ) |
|
342 | 342 | coreconfigitem('devel', 'warn-empty-changegroup', |
|
343 | 343 | default=False, |
|
344 | 344 | ) |
|
345 | 345 | coreconfigitem('devel', 'legacy.exchange', |
|
346 | 346 | default=list, |
|
347 | 347 | ) |
|
348 | 348 | coreconfigitem('devel', 'servercafile', |
|
349 | 349 | default='', |
|
350 | 350 | ) |
|
351 | 351 | coreconfigitem('devel', 'serverexactprotocol', |
|
352 | 352 | default='', |
|
353 | 353 | ) |
|
354 | 354 | coreconfigitem('devel', 'serverrequirecert', |
|
355 | 355 | default=False, |
|
356 | 356 | ) |
|
357 | 357 | coreconfigitem('devel', 'strip-obsmarkers', |
|
358 | 358 | default=True, |
|
359 | 359 | ) |
|
360 | 360 | coreconfigitem('devel', 'warn-config', |
|
361 | 361 | default=None, |
|
362 | 362 | ) |
|
363 | 363 | coreconfigitem('devel', 'warn-config-default', |
|
364 | 364 | default=None, |
|
365 | 365 | ) |
|
366 | 366 | coreconfigitem('devel', 'user.obsmarker', |
|
367 | 367 | default=None, |
|
368 | 368 | ) |
|
369 | 369 | coreconfigitem('devel', 'warn-config-unknown', |
|
370 | 370 | default=None, |
|
371 | 371 | ) |
|
372 | 372 | coreconfigitem('devel', 'debug.peer-request', |
|
373 | 373 | default=False, |
|
374 | 374 | ) |
|
375 | 375 | coreconfigitem('diff', 'nodates', |
|
376 | 376 | default=False, |
|
377 | 377 | ) |
|
378 | 378 | coreconfigitem('diff', 'showfunc', |
|
379 | 379 | default=False, |
|
380 | 380 | ) |
|
381 | 381 | coreconfigitem('diff', 'unified', |
|
382 | 382 | default=None, |
|
383 | 383 | ) |
|
384 | 384 | coreconfigitem('diff', 'git', |
|
385 | 385 | default=False, |
|
386 | 386 | ) |
|
387 | 387 | coreconfigitem('diff', 'ignorews', |
|
388 | 388 | default=False, |
|
389 | 389 | ) |
|
390 | 390 | coreconfigitem('diff', 'ignorewsamount', |
|
391 | 391 | default=False, |
|
392 | 392 | ) |
|
393 | 393 | coreconfigitem('diff', 'ignoreblanklines', |
|
394 | 394 | default=False, |
|
395 | 395 | ) |
|
396 | 396 | coreconfigitem('diff', 'ignorewseol', |
|
397 | 397 | default=False, |
|
398 | 398 | ) |
|
399 | 399 | coreconfigitem('diff', 'nobinary', |
|
400 | 400 | default=False, |
|
401 | 401 | ) |
|
402 | 402 | coreconfigitem('diff', 'noprefix', |
|
403 | 403 | default=False, |
|
404 | 404 | ) |
|
405 | 405 | coreconfigitem('diff', 'word-diff', |
|
406 | 406 | default=False, |
|
407 | 407 | ) |
|
408 | 408 | coreconfigitem('email', 'bcc', |
|
409 | 409 | default=None, |
|
410 | 410 | ) |
|
411 | 411 | coreconfigitem('email', 'cc', |
|
412 | 412 | default=None, |
|
413 | 413 | ) |
|
414 | 414 | coreconfigitem('email', 'charsets', |
|
415 | 415 | default=list, |
|
416 | 416 | ) |
|
417 | 417 | coreconfigitem('email', 'from', |
|
418 | 418 | default=None, |
|
419 | 419 | ) |
|
420 | 420 | coreconfigitem('email', 'method', |
|
421 | 421 | default='smtp', |
|
422 | 422 | ) |
|
423 | 423 | coreconfigitem('email', 'reply-to', |
|
424 | 424 | default=None, |
|
425 | 425 | ) |
|
426 | 426 | coreconfigitem('email', 'to', |
|
427 | 427 | default=None, |
|
428 | 428 | ) |
|
429 | 429 | coreconfigitem('experimental', 'archivemetatemplate', |
|
430 | 430 | default=dynamicdefault, |
|
431 | 431 | ) |
|
432 | 432 | coreconfigitem('experimental', 'bundle-phases', |
|
433 | 433 | default=False, |
|
434 | 434 | ) |
|
435 | 435 | coreconfigitem('experimental', 'bundle2-advertise', |
|
436 | 436 | default=True, |
|
437 | 437 | ) |
|
438 | 438 | coreconfigitem('experimental', 'bundle2-output-capture', |
|
439 | 439 | default=False, |
|
440 | 440 | ) |
|
441 | 441 | coreconfigitem('experimental', 'bundle2.pushback', |
|
442 | 442 | default=False, |
|
443 | 443 | ) |
|
444 | 444 | coreconfigitem('experimental', 'bundle2.stream', |
|
445 | 445 | default=False, |
|
446 | 446 | ) |
|
447 | 447 | coreconfigitem('experimental', 'bundle2lazylocking', |
|
448 | 448 | default=False, |
|
449 | 449 | ) |
|
450 | 450 | coreconfigitem('experimental', 'bundlecomplevel', |
|
451 | 451 | default=None, |
|
452 | 452 | ) |
|
453 | 453 | coreconfigitem('experimental', 'bundlecomplevel.bzip2', |
|
454 | 454 | default=None, |
|
455 | 455 | ) |
|
456 | 456 | coreconfigitem('experimental', 'bundlecomplevel.gzip', |
|
457 | 457 | default=None, |
|
458 | 458 | ) |
|
459 | 459 | coreconfigitem('experimental', 'bundlecomplevel.none', |
|
460 | 460 | default=None, |
|
461 | 461 | ) |
|
462 | 462 | coreconfigitem('experimental', 'bundlecomplevel.zstd', |
|
463 | 463 | default=None, |
|
464 | 464 | ) |
|
465 | 465 | coreconfigitem('experimental', 'changegroup3', |
|
466 | 466 | default=False, |
|
467 | 467 | ) |
|
468 | 468 | coreconfigitem('experimental', 'clientcompressionengines', |
|
469 | 469 | default=list, |
|
470 | 470 | ) |
|
471 | 471 | coreconfigitem('experimental', 'copytrace', |
|
472 | 472 | default='on', |
|
473 | 473 | ) |
|
474 | 474 | coreconfigitem('experimental', 'copytrace.movecandidateslimit', |
|
475 | 475 | default=100, |
|
476 | 476 | ) |
|
477 | 477 | coreconfigitem('experimental', 'copytrace.sourcecommitlimit', |
|
478 | 478 | default=100, |
|
479 | 479 | ) |
|
480 | 480 | coreconfigitem('experimental', 'crecordtest', |
|
481 | 481 | default=None, |
|
482 | 482 | ) |
|
483 | 483 | coreconfigitem('experimental', 'directaccess', |
|
484 | 484 | default=False, |
|
485 | 485 | ) |
|
486 | 486 | coreconfigitem('experimental', 'directaccess.revnums', |
|
487 | 487 | default=False, |
|
488 | 488 | ) |
|
489 | 489 | coreconfigitem('experimental', 'editortmpinhg', |
|
490 | 490 | default=False, |
|
491 | 491 | ) |
|
492 | 492 | coreconfigitem('experimental', 'evolution', |
|
493 | 493 | default=list, |
|
494 | 494 | ) |
|
495 | 495 | coreconfigitem('experimental', 'evolution.allowdivergence', |
|
496 | 496 | default=False, |
|
497 | 497 | alias=[('experimental', 'allowdivergence')] |
|
498 | 498 | ) |
|
499 | 499 | coreconfigitem('experimental', 'evolution.allowunstable', |
|
500 | 500 | default=None, |
|
501 | 501 | ) |
|
502 | 502 | coreconfigitem('experimental', 'evolution.createmarkers', |
|
503 | 503 | default=None, |
|
504 | 504 | ) |
|
505 | 505 | coreconfigitem('experimental', 'evolution.effect-flags', |
|
506 | 506 | default=True, |
|
507 | 507 | alias=[('experimental', 'effect-flags')] |
|
508 | 508 | ) |
|
509 | 509 | coreconfigitem('experimental', 'evolution.exchange', |
|
510 | 510 | default=None, |
|
511 | 511 | ) |
|
512 | 512 | coreconfigitem('experimental', 'evolution.bundle-obsmarker', |
|
513 | 513 | default=False, |
|
514 | 514 | ) |
|
515 | 515 | coreconfigitem('experimental', 'evolution.report-instabilities', |
|
516 | 516 | default=True, |
|
517 | 517 | ) |
|
518 | 518 | coreconfigitem('experimental', 'evolution.track-operation', |
|
519 | 519 | default=True, |
|
520 | 520 | ) |
|
521 | 521 | coreconfigitem('experimental', 'maxdeltachainspan', |
|
522 | 522 | default=-1, |
|
523 | 523 | ) |
|
524 | 524 | coreconfigitem('experimental', 'mergetempdirprefix', |
|
525 | 525 | default=None, |
|
526 | 526 | ) |
|
527 | 527 | coreconfigitem('experimental', 'mmapindexthreshold', |
|
528 | 528 | default=None, |
|
529 | 529 | ) |
|
530 | 530 | coreconfigitem('experimental', 'nonnormalparanoidcheck', |
|
531 | 531 | default=False, |
|
532 | 532 | ) |
|
533 | 533 | coreconfigitem('experimental', 'exportableenviron', |
|
534 | 534 | default=list, |
|
535 | 535 | ) |
|
536 | 536 | coreconfigitem('experimental', 'extendedheader.index', |
|
537 | 537 | default=None, |
|
538 | 538 | ) |
|
539 | 539 | coreconfigitem('experimental', 'extendedheader.similarity', |
|
540 | 540 | default=False, |
|
541 | 541 | ) |
|
542 | 542 | coreconfigitem('experimental', 'format.compression', |
|
543 | 543 | default='zlib', |
|
544 | 544 | ) |
|
545 | 545 | coreconfigitem('experimental', 'graphshorten', |
|
546 | 546 | default=False, |
|
547 | 547 | ) |
|
548 | 548 | coreconfigitem('experimental', 'graphstyle.parent', |
|
549 | 549 | default=dynamicdefault, |
|
550 | 550 | ) |
|
551 | 551 | coreconfigitem('experimental', 'graphstyle.missing', |
|
552 | 552 | default=dynamicdefault, |
|
553 | 553 | ) |
|
554 | 554 | coreconfigitem('experimental', 'graphstyle.grandparent', |
|
555 | 555 | default=dynamicdefault, |
|
556 | 556 | ) |
|
557 | 557 | coreconfigitem('experimental', 'hook-track-tags', |
|
558 | 558 | default=False, |
|
559 | 559 | ) |
|
560 | 560 | coreconfigitem('experimental', 'httppeer.advertise-v2', |
|
561 | 561 | default=False, |
|
562 | 562 | ) |
|
563 | 563 | coreconfigitem('experimental', 'httppostargs', |
|
564 | 564 | default=False, |
|
565 | 565 | ) |
|
566 | 566 | coreconfigitem('experimental', 'mergedriver', |
|
567 | 567 | default=None, |
|
568 | 568 | ) |
|
569 | 569 | coreconfigitem('experimental', 'nointerrupt', default=False) |
|
570 | 570 | coreconfigitem('experimental', 'nointerrupt-interactiveonly', default=True) |
|
571 | 571 | |
|
572 | 572 | coreconfigitem('experimental', 'obsmarkers-exchange-debug', |
|
573 | 573 | default=False, |
|
574 | 574 | ) |
|
575 | 575 | coreconfigitem('experimental', 'remotenames', |
|
576 | 576 | default=False, |
|
577 | 577 | ) |
|
578 | 578 | coreconfigitem('experimental', 'removeemptydirs', |
|
579 | 579 | default=True, |
|
580 | 580 | ) |
|
581 | 581 | coreconfigitem('experimental', 'revlogv2', |
|
582 | 582 | default=None, |
|
583 | 583 | ) |
|
584 | 584 | coreconfigitem('experimental', 'single-head-per-branch', |
|
585 | 585 | default=False, |
|
586 | 586 | ) |
|
587 | 587 | coreconfigitem('experimental', 'sshserver.support-v2', |
|
588 | 588 | default=False, |
|
589 | 589 | ) |
|
590 | 590 | coreconfigitem('experimental', 'spacemovesdown', |
|
591 | 591 | default=False, |
|
592 | 592 | ) |
|
593 | 593 | coreconfigitem('experimental', 'sparse-read', |
|
594 | 594 | default=False, |
|
595 | 595 | ) |
|
596 | 596 | coreconfigitem('experimental', 'sparse-read.density-threshold', |
|
597 | 597 | default=0.25, |
|
598 | 598 | ) |
|
599 | 599 | coreconfigitem('experimental', 'sparse-read.min-gap-size', |
|
600 | 600 | default='256K', |
|
601 | 601 | ) |
|
602 | 602 | coreconfigitem('experimental', 'treemanifest', |
|
603 | 603 | default=False, |
|
604 | 604 | ) |
|
605 | 605 | coreconfigitem('experimental', 'update.atomic-file', |
|
606 | 606 | default=False, |
|
607 | 607 | ) |
|
608 | 608 | coreconfigitem('experimental', 'sshpeer.advertise-v2', |
|
609 | 609 | default=False, |
|
610 | 610 | ) |
|
611 | 611 | coreconfigitem('experimental', 'web.apiserver', |
|
612 | 612 | default=False, |
|
613 | 613 | ) |
|
614 | 614 | coreconfigitem('experimental', 'web.api.http-v2', |
|
615 | 615 | default=False, |
|
616 | 616 | ) |
|
617 | 617 | coreconfigitem('experimental', 'web.api.debugreflect', |
|
618 | 618 | default=False, |
|
619 | 619 | ) |
|
620 | 620 | coreconfigitem('experimental', 'xdiff', |
|
621 | 621 | default=False, |
|
622 | 622 | ) |
|
623 | 623 | coreconfigitem('extensions', '.*', |
|
624 | 624 | default=None, |
|
625 | 625 | generic=True, |
|
626 | 626 | ) |
|
627 | 627 | coreconfigitem('extdata', '.*', |
|
628 | 628 | default=None, |
|
629 | 629 | generic=True, |
|
630 | 630 | ) |
|
631 | 631 | coreconfigitem('format', 'aggressivemergedeltas', |
|
632 | 632 | default=False, |
|
633 | 633 | ) |
|
634 | 634 | coreconfigitem('format', 'chunkcachesize', |
|
635 | 635 | default=None, |
|
636 | 636 | ) |
|
637 | 637 | coreconfigitem('format', 'dotencode', |
|
638 | 638 | default=True, |
|
639 | 639 | ) |
|
640 | 640 | coreconfigitem('format', 'generaldelta', |
|
641 | 641 | default=False, |
|
642 | 642 | ) |
|
643 | 643 | coreconfigitem('format', 'manifestcachesize', |
|
644 | 644 | default=None, |
|
645 | 645 | ) |
|
646 | 646 | coreconfigitem('format', 'maxchainlen', |
|
647 | 647 | default=None, |
|
648 | 648 | ) |
|
649 | 649 | coreconfigitem('format', 'obsstore-version', |
|
650 | 650 | default=None, |
|
651 | 651 | ) |
|
652 | 652 | coreconfigitem('format', 'usefncache', |
|
653 | 653 | default=True, |
|
654 | 654 | ) |
|
655 | 655 | coreconfigitem('format', 'usegeneraldelta', |
|
656 | 656 | default=True, |
|
657 | 657 | ) |
|
658 | 658 | coreconfigitem('format', 'usestore', |
|
659 | 659 | default=True, |
|
660 | 660 | ) |
|
661 | 661 | coreconfigitem('fsmonitor', 'warn_when_unused', |
|
662 | 662 | default=True, |
|
663 | 663 | ) |
|
664 | 664 | coreconfigitem('fsmonitor', 'warn_update_file_count', |
|
665 | 665 | default=50000, |
|
666 | 666 | ) |
|
667 | 667 | coreconfigitem('hooks', '.*', |
|
668 | 668 | default=dynamicdefault, |
|
669 | 669 | generic=True, |
|
670 | 670 | ) |
|
671 | 671 | coreconfigitem('hgweb-paths', '.*', |
|
672 | 672 | default=list, |
|
673 | 673 | generic=True, |
|
674 | 674 | ) |
|
675 | 675 | coreconfigitem('hostfingerprints', '.*', |
|
676 | 676 | default=list, |
|
677 | 677 | generic=True, |
|
678 | 678 | ) |
|
679 | 679 | coreconfigitem('hostsecurity', 'ciphers', |
|
680 | 680 | default=None, |
|
681 | 681 | ) |
|
682 | 682 | coreconfigitem('hostsecurity', 'disabletls10warning', |
|
683 | 683 | default=False, |
|
684 | 684 | ) |
|
685 | 685 | coreconfigitem('hostsecurity', 'minimumprotocol', |
|
686 | 686 | default=dynamicdefault, |
|
687 | 687 | ) |
|
688 | 688 | coreconfigitem('hostsecurity', '.*:minimumprotocol$', |
|
689 | 689 | default=dynamicdefault, |
|
690 | 690 | generic=True, |
|
691 | 691 | ) |
|
692 | 692 | coreconfigitem('hostsecurity', '.*:ciphers$', |
|
693 | 693 | default=dynamicdefault, |
|
694 | 694 | generic=True, |
|
695 | 695 | ) |
|
696 | 696 | coreconfigitem('hostsecurity', '.*:fingerprints$', |
|
697 | 697 | default=list, |
|
698 | 698 | generic=True, |
|
699 | 699 | ) |
|
700 | 700 | coreconfigitem('hostsecurity', '.*:verifycertsfile$', |
|
701 | 701 | default=None, |
|
702 | 702 | generic=True, |
|
703 | 703 | ) |
|
704 | 704 | |
|
705 | 705 | coreconfigitem('http_proxy', 'always', |
|
706 | 706 | default=False, |
|
707 | 707 | ) |
|
708 | 708 | coreconfigitem('http_proxy', 'host', |
|
709 | 709 | default=None, |
|
710 | 710 | ) |
|
711 | 711 | coreconfigitem('http_proxy', 'no', |
|
712 | 712 | default=list, |
|
713 | 713 | ) |
|
714 | 714 | coreconfigitem('http_proxy', 'passwd', |
|
715 | 715 | default=None, |
|
716 | 716 | ) |
|
717 | 717 | coreconfigitem('http_proxy', 'user', |
|
718 | 718 | default=None, |
|
719 | 719 | ) |
|
720 | 720 | coreconfigitem('logtoprocess', 'commandexception', |
|
721 | 721 | default=None, |
|
722 | 722 | ) |
|
723 | 723 | coreconfigitem('logtoprocess', 'commandfinish', |
|
724 | 724 | default=None, |
|
725 | 725 | ) |
|
726 | 726 | coreconfigitem('logtoprocess', 'command', |
|
727 | 727 | default=None, |
|
728 | 728 | ) |
|
729 | 729 | coreconfigitem('logtoprocess', 'develwarn', |
|
730 | 730 | default=None, |
|
731 | 731 | ) |
|
732 | 732 | coreconfigitem('logtoprocess', 'uiblocked', |
|
733 | 733 | default=None, |
|
734 | 734 | ) |
|
735 | 735 | coreconfigitem('merge', 'checkunknown', |
|
736 | 736 | default='abort', |
|
737 | 737 | ) |
|
738 | 738 | coreconfigitem('merge', 'checkignored', |
|
739 | 739 | default='abort', |
|
740 | 740 | ) |
|
741 | 741 | coreconfigitem('experimental', 'merge.checkpathconflicts', |
|
742 | 742 | default=False, |
|
743 | 743 | ) |
|
744 | 744 | coreconfigitem('merge', 'followcopies', |
|
745 | 745 | default=True, |
|
746 | 746 | ) |
|
747 | 747 | coreconfigitem('merge', 'on-failure', |
|
748 | 748 | default='continue', |
|
749 | 749 | ) |
|
750 | 750 | coreconfigitem('merge', 'preferancestor', |
|
751 | 751 | default=lambda: ['*'], |
|
752 | 752 | ) |
|
753 | 753 | coreconfigitem('merge-tools', '.*', |
|
754 | 754 | default=None, |
|
755 | 755 | generic=True, |
|
756 | 756 | ) |
|
757 | 757 | coreconfigitem('merge-tools', br'.*\.args$', |
|
758 | 758 | default="$local $base $other", |
|
759 | 759 | generic=True, |
|
760 | 760 | priority=-1, |
|
761 | 761 | ) |
|
762 | 762 | coreconfigitem('merge-tools', br'.*\.binary$', |
|
763 | 763 | default=False, |
|
764 | 764 | generic=True, |
|
765 | 765 | priority=-1, |
|
766 | 766 | ) |
|
767 | 767 | coreconfigitem('merge-tools', br'.*\.check$', |
|
768 | 768 | default=list, |
|
769 | 769 | generic=True, |
|
770 | 770 | priority=-1, |
|
771 | 771 | ) |
|
772 | 772 | coreconfigitem('merge-tools', br'.*\.checkchanged$', |
|
773 | 773 | default=False, |
|
774 | 774 | generic=True, |
|
775 | 775 | priority=-1, |
|
776 | 776 | ) |
|
777 | 777 | coreconfigitem('merge-tools', br'.*\.executable$', |
|
778 | 778 | default=dynamicdefault, |
|
779 | 779 | generic=True, |
|
780 | 780 | priority=-1, |
|
781 | 781 | ) |
|
782 | 782 | coreconfigitem('merge-tools', br'.*\.fixeol$', |
|
783 | 783 | default=False, |
|
784 | 784 | generic=True, |
|
785 | 785 | priority=-1, |
|
786 | 786 | ) |
|
787 | 787 | coreconfigitem('merge-tools', br'.*\.gui$', |
|
788 | 788 | default=False, |
|
789 | 789 | generic=True, |
|
790 | 790 | priority=-1, |
|
791 | 791 | ) |
|
792 | 792 | coreconfigitem('merge-tools', br'.*\.mergemarkers$', |
|
793 | 793 | default='basic', |
|
794 | 794 | generic=True, |
|
795 | 795 | priority=-1, |
|
796 | 796 | ) |
|
797 | 797 | coreconfigitem('merge-tools', br'.*\.mergemarkertemplate$', |
|
798 | 798 | default=dynamicdefault, # take from ui.mergemarkertemplate |
|
799 | 799 | generic=True, |
|
800 | 800 | priority=-1, |
|
801 | 801 | ) |
|
802 | 802 | coreconfigitem('merge-tools', br'.*\.priority$', |
|
803 | 803 | default=0, |
|
804 | 804 | generic=True, |
|
805 | 805 | priority=-1, |
|
806 | 806 | ) |
|
807 | 807 | coreconfigitem('merge-tools', br'.*\.premerge$', |
|
808 | 808 | default=dynamicdefault, |
|
809 | 809 | generic=True, |
|
810 | 810 | priority=-1, |
|
811 | 811 | ) |
|
812 | 812 | coreconfigitem('merge-tools', br'.*\.symlink$', |
|
813 | 813 | default=False, |
|
814 | 814 | generic=True, |
|
815 | 815 | priority=-1, |
|
816 | 816 | ) |
|
817 | 817 | coreconfigitem('pager', 'attend-.*', |
|
818 | 818 | default=dynamicdefault, |
|
819 | 819 | generic=True, |
|
820 | 820 | ) |
|
821 | 821 | coreconfigitem('pager', 'ignore', |
|
822 | 822 | default=list, |
|
823 | 823 | ) |
|
824 | 824 | coreconfigitem('pager', 'pager', |
|
825 | 825 | default=dynamicdefault, |
|
826 | 826 | ) |
|
827 | 827 | coreconfigitem('patch', 'eol', |
|
828 | 828 | default='strict', |
|
829 | 829 | ) |
|
830 | 830 | coreconfigitem('patch', 'fuzz', |
|
831 | 831 | default=2, |
|
832 | 832 | ) |
|
833 | 833 | coreconfigitem('paths', 'default', |
|
834 | 834 | default=None, |
|
835 | 835 | ) |
|
836 | 836 | coreconfigitem('paths', 'default-push', |
|
837 | 837 | default=None, |
|
838 | 838 | ) |
|
839 | 839 | coreconfigitem('paths', '.*', |
|
840 | 840 | default=None, |
|
841 | 841 | generic=True, |
|
842 | 842 | ) |
|
843 | 843 | coreconfigitem('phases', 'checksubrepos', |
|
844 | 844 | default='follow', |
|
845 | 845 | ) |
|
846 | 846 | coreconfigitem('phases', 'new-commit', |
|
847 | 847 | default='draft', |
|
848 | 848 | ) |
|
849 | 849 | coreconfigitem('phases', 'publish', |
|
850 | 850 | default=True, |
|
851 | 851 | ) |
|
852 | 852 | coreconfigitem('profiling', 'enabled', |
|
853 | 853 | default=False, |
|
854 | 854 | ) |
|
855 | 855 | coreconfigitem('profiling', 'format', |
|
856 | 856 | default='text', |
|
857 | 857 | ) |
|
858 | 858 | coreconfigitem('profiling', 'freq', |
|
859 | 859 | default=1000, |
|
860 | 860 | ) |
|
861 | 861 | coreconfigitem('profiling', 'limit', |
|
862 | 862 | default=30, |
|
863 | 863 | ) |
|
864 | 864 | coreconfigitem('profiling', 'nested', |
|
865 | 865 | default=0, |
|
866 | 866 | ) |
|
867 | 867 | coreconfigitem('profiling', 'output', |
|
868 | 868 | default=None, |
|
869 | 869 | ) |
|
870 | 870 | coreconfigitem('profiling', 'showmax', |
|
871 | 871 | default=0.999, |
|
872 | 872 | ) |
|
873 | 873 | coreconfigitem('profiling', 'showmin', |
|
874 | 874 | default=dynamicdefault, |
|
875 | 875 | ) |
|
876 | 876 | coreconfigitem('profiling', 'sort', |
|
877 | 877 | default='inlinetime', |
|
878 | 878 | ) |
|
879 | 879 | coreconfigitem('profiling', 'statformat', |
|
880 | 880 | default='hotpath', |
|
881 | 881 | ) |
|
882 | 882 | coreconfigitem('profiling', 'time-track', |
|
883 | 883 | default='cpu', |
|
884 | 884 | ) |
|
885 | 885 | coreconfigitem('profiling', 'type', |
|
886 | 886 | default='stat', |
|
887 | 887 | ) |
|
888 | 888 | coreconfigitem('progress', 'assume-tty', |
|
889 | 889 | default=False, |
|
890 | 890 | ) |
|
891 | 891 | coreconfigitem('progress', 'changedelay', |
|
892 | 892 | default=1, |
|
893 | 893 | ) |
|
894 | 894 | coreconfigitem('progress', 'clear-complete', |
|
895 | 895 | default=True, |
|
896 | 896 | ) |
|
897 | 897 | coreconfigitem('progress', 'debug', |
|
898 | 898 | default=False, |
|
899 | 899 | ) |
|
900 | 900 | coreconfigitem('progress', 'delay', |
|
901 | 901 | default=3, |
|
902 | 902 | ) |
|
903 | 903 | coreconfigitem('progress', 'disable', |
|
904 | 904 | default=False, |
|
905 | 905 | ) |
|
906 | 906 | coreconfigitem('progress', 'estimateinterval', |
|
907 | 907 | default=60.0, |
|
908 | 908 | ) |
|
909 | 909 | coreconfigitem('progress', 'format', |
|
910 | 910 | default=lambda: ['topic', 'bar', 'number', 'estimate'], |
|
911 | 911 | ) |
|
912 | 912 | coreconfigitem('progress', 'refresh', |
|
913 | 913 | default=0.1, |
|
914 | 914 | ) |
|
915 | 915 | coreconfigitem('progress', 'width', |
|
916 | 916 | default=dynamicdefault, |
|
917 | 917 | ) |
|
918 | 918 | coreconfigitem('push', 'pushvars.server', |
|
919 | 919 | default=False, |
|
920 | 920 | ) |
|
921 | 921 | coreconfigitem('server', 'bookmarks-pushkey-compat', |
|
922 | 922 | default=True, |
|
923 | 923 | ) |
|
924 | 924 | coreconfigitem('server', 'bundle1', |
|
925 | 925 | default=True, |
|
926 | 926 | ) |
|
927 | 927 | coreconfigitem('server', 'bundle1gd', |
|
928 | 928 | default=None, |
|
929 | 929 | ) |
|
930 | 930 | coreconfigitem('server', 'bundle1.pull', |
|
931 | 931 | default=None, |
|
932 | 932 | ) |
|
933 | 933 | coreconfigitem('server', 'bundle1gd.pull', |
|
934 | 934 | default=None, |
|
935 | 935 | ) |
|
936 | 936 | coreconfigitem('server', 'bundle1.push', |
|
937 | 937 | default=None, |
|
938 | 938 | ) |
|
939 | 939 | coreconfigitem('server', 'bundle1gd.push', |
|
940 | 940 | default=None, |
|
941 | 941 | ) |
|
942 | 942 | coreconfigitem('server', 'compressionengines', |
|
943 | 943 | default=list, |
|
944 | 944 | ) |
|
945 | 945 | coreconfigitem('server', 'concurrent-push-mode', |
|
946 | 946 | default='strict', |
|
947 | 947 | ) |
|
948 | 948 | coreconfigitem('server', 'disablefullbundle', |
|
949 | 949 | default=False, |
|
950 | 950 | ) |
|
951 | 951 | coreconfigitem('server', 'maxhttpheaderlen', |
|
952 | 952 | default=1024, |
|
953 | 953 | ) |
|
954 | 954 | coreconfigitem('server', 'pullbundle', |
|
955 | 955 | default=False, |
|
956 | 956 | ) |
|
957 | 957 | coreconfigitem('server', 'preferuncompressed', |
|
958 | 958 | default=False, |
|
959 | 959 | ) |
|
960 | 960 | coreconfigitem('server', 'streamunbundle', |
|
961 | 961 | default=False, |
|
962 | 962 | ) |
|
963 | 963 | coreconfigitem('server', 'uncompressed', |
|
964 | 964 | default=True, |
|
965 | 965 | ) |
|
966 | 966 | coreconfigitem('server', 'uncompressedallowsecret', |
|
967 | 967 | default=False, |
|
968 | 968 | ) |
|
969 | 969 | coreconfigitem('server', 'validate', |
|
970 | 970 | default=False, |
|
971 | 971 | ) |
|
972 | 972 | coreconfigitem('server', 'zliblevel', |
|
973 | 973 | default=-1, |
|
974 | 974 | ) |
|
975 | 975 | coreconfigitem('server', 'zstdlevel', |
|
976 | 976 | default=3, |
|
977 | 977 | ) |
|
978 | 978 | coreconfigitem('share', 'pool', |
|
979 | 979 | default=None, |
|
980 | 980 | ) |
|
981 | 981 | coreconfigitem('share', 'poolnaming', |
|
982 | 982 | default='identity', |
|
983 | 983 | ) |
|
984 | 984 | coreconfigitem('smtp', 'host', |
|
985 | 985 | default=None, |
|
986 | 986 | ) |
|
987 | 987 | coreconfigitem('smtp', 'local_hostname', |
|
988 | 988 | default=None, |
|
989 | 989 | ) |
|
990 | 990 | coreconfigitem('smtp', 'password', |
|
991 | 991 | default=None, |
|
992 | 992 | ) |
|
993 | 993 | coreconfigitem('smtp', 'port', |
|
994 | 994 | default=dynamicdefault, |
|
995 | 995 | ) |
|
996 | 996 | coreconfigitem('smtp', 'tls', |
|
997 | 997 | default='none', |
|
998 | 998 | ) |
|
999 | 999 | coreconfigitem('smtp', 'username', |
|
1000 | 1000 | default=None, |
|
1001 | 1001 | ) |
|
1002 | 1002 | coreconfigitem('sparse', 'missingwarning', |
|
1003 | 1003 | default=True, |
|
1004 | 1004 | ) |
|
1005 | 1005 | coreconfigitem('subrepos', 'allowed', |
|
1006 | 1006 | default=dynamicdefault, # to make backporting simpler |
|
1007 | 1007 | ) |
|
1008 | 1008 | coreconfigitem('subrepos', 'hg:allowed', |
|
1009 | 1009 | default=dynamicdefault, |
|
1010 | 1010 | ) |
|
1011 | 1011 | coreconfigitem('subrepos', 'git:allowed', |
|
1012 | 1012 | default=dynamicdefault, |
|
1013 | 1013 | ) |
|
1014 | 1014 | coreconfigitem('subrepos', 'svn:allowed', |
|
1015 | 1015 | default=dynamicdefault, |
|
1016 | 1016 | ) |
|
1017 | 1017 | coreconfigitem('templates', '.*', |
|
1018 | 1018 | default=None, |
|
1019 | 1019 | generic=True, |
|
1020 | 1020 | ) |
|
1021 | 1021 | coreconfigitem('trusted', 'groups', |
|
1022 | 1022 | default=list, |
|
1023 | 1023 | ) |
|
1024 | 1024 | coreconfigitem('trusted', 'users', |
|
1025 | 1025 | default=list, |
|
1026 | 1026 | ) |
|
1027 | 1027 | coreconfigitem('ui', '_usedassubrepo', |
|
1028 | 1028 | default=False, |
|
1029 | 1029 | ) |
|
1030 | 1030 | coreconfigitem('ui', 'allowemptycommit', |
|
1031 | 1031 | default=False, |
|
1032 | 1032 | ) |
|
1033 | 1033 | coreconfigitem('ui', 'archivemeta', |
|
1034 | 1034 | default=True, |
|
1035 | 1035 | ) |
|
1036 | 1036 | coreconfigitem('ui', 'askusername', |
|
1037 | 1037 | default=False, |
|
1038 | 1038 | ) |
|
1039 | 1039 | coreconfigitem('ui', 'clonebundlefallback', |
|
1040 | 1040 | default=False, |
|
1041 | 1041 | ) |
|
1042 | 1042 | coreconfigitem('ui', 'clonebundleprefers', |
|
1043 | 1043 | default=list, |
|
1044 | 1044 | ) |
|
1045 | 1045 | coreconfigitem('ui', 'clonebundles', |
|
1046 | 1046 | default=True, |
|
1047 | 1047 | ) |
|
1048 | 1048 | coreconfigitem('ui', 'color', |
|
1049 | 1049 | default='auto', |
|
1050 | 1050 | ) |
|
1051 | 1051 | coreconfigitem('ui', 'commitsubrepos', |
|
1052 | 1052 | default=False, |
|
1053 | 1053 | ) |
|
1054 | 1054 | coreconfigitem('ui', 'debug', |
|
1055 | 1055 | default=False, |
|
1056 | 1056 | ) |
|
1057 | 1057 | coreconfigitem('ui', 'debugger', |
|
1058 | 1058 | default=None, |
|
1059 | 1059 | ) |
|
1060 | 1060 | coreconfigitem('ui', 'editor', |
|
1061 | 1061 | default=dynamicdefault, |
|
1062 | 1062 | ) |
|
1063 | 1063 | coreconfigitem('ui', 'fallbackencoding', |
|
1064 | 1064 | default=None, |
|
1065 | 1065 | ) |
|
1066 | 1066 | coreconfigitem('ui', 'forcecwd', |
|
1067 | 1067 | default=None, |
|
1068 | 1068 | ) |
|
1069 | 1069 | coreconfigitem('ui', 'forcemerge', |
|
1070 | 1070 | default=None, |
|
1071 | 1071 | ) |
|
1072 | 1072 | coreconfigitem('ui', 'formatdebug', |
|
1073 | 1073 | default=False, |
|
1074 | 1074 | ) |
|
1075 | 1075 | coreconfigitem('ui', 'formatjson', |
|
1076 | 1076 | default=False, |
|
1077 | 1077 | ) |
|
1078 | 1078 | coreconfigitem('ui', 'formatted', |
|
1079 | 1079 | default=None, |
|
1080 | 1080 | ) |
|
1081 | 1081 | coreconfigitem('ui', 'graphnodetemplate', |
|
1082 | 1082 | default=None, |
|
1083 | 1083 | ) |
|
1084 | 1084 | coreconfigitem('ui', 'interactive', |
|
1085 | 1085 | default=None, |
|
1086 | 1086 | ) |
|
1087 | 1087 | coreconfigitem('ui', 'interface', |
|
1088 | 1088 | default=None, |
|
1089 | 1089 | ) |
|
1090 | 1090 | coreconfigitem('ui', 'interface.chunkselector', |
|
1091 | 1091 | default=None, |
|
1092 | 1092 | ) |
|
1093 | coreconfigitem('ui', 'large-file-limit', | |
|
1094 | default=10000000, | |
|
1095 | ) | |
|
1093 | 1096 | coreconfigitem('ui', 'logblockedtimes', |
|
1094 | 1097 | default=False, |
|
1095 | 1098 | ) |
|
1096 | 1099 | coreconfigitem('ui', 'logtemplate', |
|
1097 | 1100 | default=None, |
|
1098 | 1101 | ) |
|
1099 | 1102 | coreconfigitem('ui', 'merge', |
|
1100 | 1103 | default=None, |
|
1101 | 1104 | ) |
|
1102 | 1105 | coreconfigitem('ui', 'mergemarkers', |
|
1103 | 1106 | default='basic', |
|
1104 | 1107 | ) |
|
1105 | 1108 | coreconfigitem('ui', 'mergemarkertemplate', |
|
1106 | 1109 | default=('{node|short} ' |
|
1107 | 1110 | '{ifeq(tags, "tip", "", ' |
|
1108 | 1111 | 'ifeq(tags, "", "", "{tags} "))}' |
|
1109 | 1112 | '{if(bookmarks, "{bookmarks} ")}' |
|
1110 | 1113 | '{ifeq(branch, "default", "", "{branch} ")}' |
|
1111 | 1114 | '- {author|user}: {desc|firstline}') |
|
1112 | 1115 | ) |
|
1113 | 1116 | coreconfigitem('ui', 'nontty', |
|
1114 | 1117 | default=False, |
|
1115 | 1118 | ) |
|
1116 | 1119 | coreconfigitem('ui', 'origbackuppath', |
|
1117 | 1120 | default=None, |
|
1118 | 1121 | ) |
|
1119 | 1122 | coreconfigitem('ui', 'paginate', |
|
1120 | 1123 | default=True, |
|
1121 | 1124 | ) |
|
1122 | 1125 | coreconfigitem('ui', 'patch', |
|
1123 | 1126 | default=None, |
|
1124 | 1127 | ) |
|
1125 | 1128 | coreconfigitem('ui', 'portablefilenames', |
|
1126 | 1129 | default='warn', |
|
1127 | 1130 | ) |
|
1128 | 1131 | coreconfigitem('ui', 'promptecho', |
|
1129 | 1132 | default=False, |
|
1130 | 1133 | ) |
|
1131 | 1134 | coreconfigitem('ui', 'quiet', |
|
1132 | 1135 | default=False, |
|
1133 | 1136 | ) |
|
1134 | 1137 | coreconfigitem('ui', 'quietbookmarkmove', |
|
1135 | 1138 | default=False, |
|
1136 | 1139 | ) |
|
1137 | 1140 | coreconfigitem('ui', 'remotecmd', |
|
1138 | 1141 | default='hg', |
|
1139 | 1142 | ) |
|
1140 | 1143 | coreconfigitem('ui', 'report_untrusted', |
|
1141 | 1144 | default=True, |
|
1142 | 1145 | ) |
|
1143 | 1146 | coreconfigitem('ui', 'rollback', |
|
1144 | 1147 | default=True, |
|
1145 | 1148 | ) |
|
1146 | 1149 | coreconfigitem('ui', 'signal-safe-lock', |
|
1147 | 1150 | default=True, |
|
1148 | 1151 | ) |
|
1149 | 1152 | coreconfigitem('ui', 'slash', |
|
1150 | 1153 | default=False, |
|
1151 | 1154 | ) |
|
1152 | 1155 | coreconfigitem('ui', 'ssh', |
|
1153 | 1156 | default='ssh', |
|
1154 | 1157 | ) |
|
1155 | 1158 | coreconfigitem('ui', 'ssherrorhint', |
|
1156 | 1159 | default=None, |
|
1157 | 1160 | ) |
|
1158 | 1161 | coreconfigitem('ui', 'statuscopies', |
|
1159 | 1162 | default=False, |
|
1160 | 1163 | ) |
|
1161 | 1164 | coreconfigitem('ui', 'strict', |
|
1162 | 1165 | default=False, |
|
1163 | 1166 | ) |
|
1164 | 1167 | coreconfigitem('ui', 'style', |
|
1165 | 1168 | default='', |
|
1166 | 1169 | ) |
|
1167 | 1170 | coreconfigitem('ui', 'supportcontact', |
|
1168 | 1171 | default=None, |
|
1169 | 1172 | ) |
|
1170 | 1173 | coreconfigitem('ui', 'textwidth', |
|
1171 | 1174 | default=78, |
|
1172 | 1175 | ) |
|
1173 | 1176 | coreconfigitem('ui', 'timeout', |
|
1174 | 1177 | default='600', |
|
1175 | 1178 | ) |
|
1176 | 1179 | coreconfigitem('ui', 'timeout.warn', |
|
1177 | 1180 | default=0, |
|
1178 | 1181 | ) |
|
1179 | 1182 | coreconfigitem('ui', 'traceback', |
|
1180 | 1183 | default=False, |
|
1181 | 1184 | ) |
|
1182 | 1185 | coreconfigitem('ui', 'tweakdefaults', |
|
1183 | 1186 | default=False, |
|
1184 | 1187 | ) |
|
1185 | 1188 | coreconfigitem('ui', 'username', |
|
1186 | 1189 | alias=[('ui', 'user')] |
|
1187 | 1190 | ) |
|
1188 | 1191 | coreconfigitem('ui', 'verbose', |
|
1189 | 1192 | default=False, |
|
1190 | 1193 | ) |
|
1191 | 1194 | coreconfigitem('verify', 'skipflags', |
|
1192 | 1195 | default=None, |
|
1193 | 1196 | ) |
|
1194 | 1197 | coreconfigitem('web', 'allowbz2', |
|
1195 | 1198 | default=False, |
|
1196 | 1199 | ) |
|
1197 | 1200 | coreconfigitem('web', 'allowgz', |
|
1198 | 1201 | default=False, |
|
1199 | 1202 | ) |
|
1200 | 1203 | coreconfigitem('web', 'allow-pull', |
|
1201 | 1204 | alias=[('web', 'allowpull')], |
|
1202 | 1205 | default=True, |
|
1203 | 1206 | ) |
|
1204 | 1207 | coreconfigitem('web', 'allow-push', |
|
1205 | 1208 | alias=[('web', 'allow_push')], |
|
1206 | 1209 | default=list, |
|
1207 | 1210 | ) |
|
1208 | 1211 | coreconfigitem('web', 'allowzip', |
|
1209 | 1212 | default=False, |
|
1210 | 1213 | ) |
|
1211 | 1214 | coreconfigitem('web', 'archivesubrepos', |
|
1212 | 1215 | default=False, |
|
1213 | 1216 | ) |
|
1214 | 1217 | coreconfigitem('web', 'cache', |
|
1215 | 1218 | default=True, |
|
1216 | 1219 | ) |
|
1217 | 1220 | coreconfigitem('web', 'contact', |
|
1218 | 1221 | default=None, |
|
1219 | 1222 | ) |
|
1220 | 1223 | coreconfigitem('web', 'deny_push', |
|
1221 | 1224 | default=list, |
|
1222 | 1225 | ) |
|
1223 | 1226 | coreconfigitem('web', 'guessmime', |
|
1224 | 1227 | default=False, |
|
1225 | 1228 | ) |
|
1226 | 1229 | coreconfigitem('web', 'hidden', |
|
1227 | 1230 | default=False, |
|
1228 | 1231 | ) |
|
1229 | 1232 | coreconfigitem('web', 'labels', |
|
1230 | 1233 | default=list, |
|
1231 | 1234 | ) |
|
1232 | 1235 | coreconfigitem('web', 'logoimg', |
|
1233 | 1236 | default='hglogo.png', |
|
1234 | 1237 | ) |
|
1235 | 1238 | coreconfigitem('web', 'logourl', |
|
1236 | 1239 | default='https://mercurial-scm.org/', |
|
1237 | 1240 | ) |
|
1238 | 1241 | coreconfigitem('web', 'accesslog', |
|
1239 | 1242 | default='-', |
|
1240 | 1243 | ) |
|
1241 | 1244 | coreconfigitem('web', 'address', |
|
1242 | 1245 | default='', |
|
1243 | 1246 | ) |
|
1244 | 1247 | coreconfigitem('web', 'allow-archive', |
|
1245 | 1248 | alias=[('web', 'allow_archive')], |
|
1246 | 1249 | default=list, |
|
1247 | 1250 | ) |
|
1248 | 1251 | coreconfigitem('web', 'allow_read', |
|
1249 | 1252 | default=list, |
|
1250 | 1253 | ) |
|
1251 | 1254 | coreconfigitem('web', 'baseurl', |
|
1252 | 1255 | default=None, |
|
1253 | 1256 | ) |
|
1254 | 1257 | coreconfigitem('web', 'cacerts', |
|
1255 | 1258 | default=None, |
|
1256 | 1259 | ) |
|
1257 | 1260 | coreconfigitem('web', 'certificate', |
|
1258 | 1261 | default=None, |
|
1259 | 1262 | ) |
|
1260 | 1263 | coreconfigitem('web', 'collapse', |
|
1261 | 1264 | default=False, |
|
1262 | 1265 | ) |
|
1263 | 1266 | coreconfigitem('web', 'csp', |
|
1264 | 1267 | default=None, |
|
1265 | 1268 | ) |
|
1266 | 1269 | coreconfigitem('web', 'deny_read', |
|
1267 | 1270 | default=list, |
|
1268 | 1271 | ) |
|
1269 | 1272 | coreconfigitem('web', 'descend', |
|
1270 | 1273 | default=True, |
|
1271 | 1274 | ) |
|
1272 | 1275 | coreconfigitem('web', 'description', |
|
1273 | 1276 | default="", |
|
1274 | 1277 | ) |
|
1275 | 1278 | coreconfigitem('web', 'encoding', |
|
1276 | 1279 | default=lambda: encoding.encoding, |
|
1277 | 1280 | ) |
|
1278 | 1281 | coreconfigitem('web', 'errorlog', |
|
1279 | 1282 | default='-', |
|
1280 | 1283 | ) |
|
1281 | 1284 | coreconfigitem('web', 'ipv6', |
|
1282 | 1285 | default=False, |
|
1283 | 1286 | ) |
|
1284 | 1287 | coreconfigitem('web', 'maxchanges', |
|
1285 | 1288 | default=10, |
|
1286 | 1289 | ) |
|
1287 | 1290 | coreconfigitem('web', 'maxfiles', |
|
1288 | 1291 | default=10, |
|
1289 | 1292 | ) |
|
1290 | 1293 | coreconfigitem('web', 'maxshortchanges', |
|
1291 | 1294 | default=60, |
|
1292 | 1295 | ) |
|
1293 | 1296 | coreconfigitem('web', 'motd', |
|
1294 | 1297 | default='', |
|
1295 | 1298 | ) |
|
1296 | 1299 | coreconfigitem('web', 'name', |
|
1297 | 1300 | default=dynamicdefault, |
|
1298 | 1301 | ) |
|
1299 | 1302 | coreconfigitem('web', 'port', |
|
1300 | 1303 | default=8000, |
|
1301 | 1304 | ) |
|
1302 | 1305 | coreconfigitem('web', 'prefix', |
|
1303 | 1306 | default='', |
|
1304 | 1307 | ) |
|
1305 | 1308 | coreconfigitem('web', 'push_ssl', |
|
1306 | 1309 | default=True, |
|
1307 | 1310 | ) |
|
1308 | 1311 | coreconfigitem('web', 'refreshinterval', |
|
1309 | 1312 | default=20, |
|
1310 | 1313 | ) |
|
1311 | 1314 | coreconfigitem('web', 'server-header', |
|
1312 | 1315 | default=None, |
|
1313 | 1316 | ) |
|
1314 | 1317 | coreconfigitem('web', 'staticurl', |
|
1315 | 1318 | default=None, |
|
1316 | 1319 | ) |
|
1317 | 1320 | coreconfigitem('web', 'stripes', |
|
1318 | 1321 | default=1, |
|
1319 | 1322 | ) |
|
1320 | 1323 | coreconfigitem('web', 'style', |
|
1321 | 1324 | default='paper', |
|
1322 | 1325 | ) |
|
1323 | 1326 | coreconfigitem('web', 'templates', |
|
1324 | 1327 | default=None, |
|
1325 | 1328 | ) |
|
1326 | 1329 | coreconfigitem('web', 'view', |
|
1327 | 1330 | default='served', |
|
1328 | 1331 | ) |
|
1329 | 1332 | coreconfigitem('worker', 'backgroundclose', |
|
1330 | 1333 | default=dynamicdefault, |
|
1331 | 1334 | ) |
|
1332 | 1335 | # Windows defaults to a limit of 512 open files. A buffer of 128 |
|
1333 | 1336 | # should give us enough headway. |
|
1334 | 1337 | coreconfigitem('worker', 'backgroundclosemaxqueue', |
|
1335 | 1338 | default=384, |
|
1336 | 1339 | ) |
|
1337 | 1340 | coreconfigitem('worker', 'backgroundcloseminfilecount', |
|
1338 | 1341 | default=2048, |
|
1339 | 1342 | ) |
|
1340 | 1343 | coreconfigitem('worker', 'backgroundclosethreadcount', |
|
1341 | 1344 | default=4, |
|
1342 | 1345 | ) |
|
1343 | 1346 | coreconfigitem('worker', 'enabled', |
|
1344 | 1347 | default=True, |
|
1345 | 1348 | ) |
|
1346 | 1349 | coreconfigitem('worker', 'numcpus', |
|
1347 | 1350 | default=None, |
|
1348 | 1351 | ) |
|
1349 | 1352 | |
|
1350 | 1353 | # Rebase related configuration moved to core because other extension are doing |
|
1351 | 1354 | # strange things. For example, shelve import the extensions to reuse some bit |
|
1352 | 1355 | # without formally loading it. |
|
1353 | 1356 | coreconfigitem('commands', 'rebase.requiredest', |
|
1354 | 1357 | default=False, |
|
1355 | 1358 | ) |
|
1356 | 1359 | coreconfigitem('experimental', 'rebaseskipobsolete', |
|
1357 | 1360 | default=True, |
|
1358 | 1361 | ) |
|
1359 | 1362 | coreconfigitem('rebase', 'singletransaction', |
|
1360 | 1363 | default=False, |
|
1361 | 1364 | ) |
|
1362 | 1365 | coreconfigitem('rebase', 'experimental.inmemory', |
|
1363 | 1366 | default=False, |
|
1364 | 1367 | ) |
@@ -1,2544 +1,2545 b'' | |||
|
1 | 1 | # context.py - changeset and file context objects for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2006, 2007 Matt Mackall <mpm@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 filecmp |
|
12 | 12 | import os |
|
13 | 13 | import stat |
|
14 | 14 | |
|
15 | 15 | from .i18n import _ |
|
16 | 16 | from .node import ( |
|
17 | 17 | addednodeid, |
|
18 | 18 | bin, |
|
19 | 19 | hex, |
|
20 | 20 | modifiednodeid, |
|
21 | 21 | nullid, |
|
22 | 22 | nullrev, |
|
23 | 23 | short, |
|
24 | 24 | wdirfilenodeids, |
|
25 | 25 | wdirid, |
|
26 | 26 | ) |
|
27 | 27 | from . import ( |
|
28 | 28 | dagop, |
|
29 | 29 | encoding, |
|
30 | 30 | error, |
|
31 | 31 | fileset, |
|
32 | 32 | match as matchmod, |
|
33 | 33 | obsolete as obsmod, |
|
34 | 34 | patch, |
|
35 | 35 | pathutil, |
|
36 | 36 | phases, |
|
37 | 37 | pycompat, |
|
38 | 38 | repoview, |
|
39 | 39 | revlog, |
|
40 | 40 | scmutil, |
|
41 | 41 | sparse, |
|
42 | 42 | subrepo, |
|
43 | 43 | subrepoutil, |
|
44 | 44 | util, |
|
45 | 45 | ) |
|
46 | 46 | from .utils import ( |
|
47 | 47 | dateutil, |
|
48 | 48 | stringutil, |
|
49 | 49 | ) |
|
50 | 50 | |
|
51 | 51 | propertycache = util.propertycache |
|
52 | 52 | |
|
53 | 53 | class basectx(object): |
|
54 | 54 | """A basectx object represents the common logic for its children: |
|
55 | 55 | changectx: read-only context that is already present in the repo, |
|
56 | 56 | workingctx: a context that represents the working directory and can |
|
57 | 57 | be committed, |
|
58 | 58 | memctx: a context that represents changes in-memory and can also |
|
59 | 59 | be committed.""" |
|
60 | 60 | |
|
61 | 61 | def __init__(self, repo): |
|
62 | 62 | self._repo = repo |
|
63 | 63 | |
|
64 | 64 | def __bytes__(self): |
|
65 | 65 | return short(self.node()) |
|
66 | 66 | |
|
67 | 67 | __str__ = encoding.strmethod(__bytes__) |
|
68 | 68 | |
|
69 | 69 | def __repr__(self): |
|
70 | 70 | return r"<%s %s>" % (type(self).__name__, str(self)) |
|
71 | 71 | |
|
72 | 72 | def __eq__(self, other): |
|
73 | 73 | try: |
|
74 | 74 | return type(self) == type(other) and self._rev == other._rev |
|
75 | 75 | except AttributeError: |
|
76 | 76 | return False |
|
77 | 77 | |
|
78 | 78 | def __ne__(self, other): |
|
79 | 79 | return not (self == other) |
|
80 | 80 | |
|
81 | 81 | def __contains__(self, key): |
|
82 | 82 | return key in self._manifest |
|
83 | 83 | |
|
84 | 84 | def __getitem__(self, key): |
|
85 | 85 | return self.filectx(key) |
|
86 | 86 | |
|
87 | 87 | def __iter__(self): |
|
88 | 88 | return iter(self._manifest) |
|
89 | 89 | |
|
90 | 90 | def _buildstatusmanifest(self, status): |
|
91 | 91 | """Builds a manifest that includes the given status results, if this is |
|
92 | 92 | a working copy context. For non-working copy contexts, it just returns |
|
93 | 93 | the normal manifest.""" |
|
94 | 94 | return self.manifest() |
|
95 | 95 | |
|
96 | 96 | def _matchstatus(self, other, match): |
|
97 | 97 | """This internal method provides a way for child objects to override the |
|
98 | 98 | match operator. |
|
99 | 99 | """ |
|
100 | 100 | return match |
|
101 | 101 | |
|
102 | 102 | def _buildstatus(self, other, s, match, listignored, listclean, |
|
103 | 103 | listunknown): |
|
104 | 104 | """build a status with respect to another context""" |
|
105 | 105 | # Load earliest manifest first for caching reasons. More specifically, |
|
106 | 106 | # if you have revisions 1000 and 1001, 1001 is probably stored as a |
|
107 | 107 | # delta against 1000. Thus, if you read 1000 first, we'll reconstruct |
|
108 | 108 | # 1000 and cache it so that when you read 1001, we just need to apply a |
|
109 | 109 | # delta to what's in the cache. So that's one full reconstruction + one |
|
110 | 110 | # delta application. |
|
111 | 111 | mf2 = None |
|
112 | 112 | if self.rev() is not None and self.rev() < other.rev(): |
|
113 | 113 | mf2 = self._buildstatusmanifest(s) |
|
114 | 114 | mf1 = other._buildstatusmanifest(s) |
|
115 | 115 | if mf2 is None: |
|
116 | 116 | mf2 = self._buildstatusmanifest(s) |
|
117 | 117 | |
|
118 | 118 | modified, added = [], [] |
|
119 | 119 | removed = [] |
|
120 | 120 | clean = [] |
|
121 | 121 | deleted, unknown, ignored = s.deleted, s.unknown, s.ignored |
|
122 | 122 | deletedset = set(deleted) |
|
123 | 123 | d = mf1.diff(mf2, match=match, clean=listclean) |
|
124 | 124 | for fn, value in d.iteritems(): |
|
125 | 125 | if fn in deletedset: |
|
126 | 126 | continue |
|
127 | 127 | if value is None: |
|
128 | 128 | clean.append(fn) |
|
129 | 129 | continue |
|
130 | 130 | (node1, flag1), (node2, flag2) = value |
|
131 | 131 | if node1 is None: |
|
132 | 132 | added.append(fn) |
|
133 | 133 | elif node2 is None: |
|
134 | 134 | removed.append(fn) |
|
135 | 135 | elif flag1 != flag2: |
|
136 | 136 | modified.append(fn) |
|
137 | 137 | elif node2 not in wdirfilenodeids: |
|
138 | 138 | # When comparing files between two commits, we save time by |
|
139 | 139 | # not comparing the file contents when the nodeids differ. |
|
140 | 140 | # Note that this means we incorrectly report a reverted change |
|
141 | 141 | # to a file as a modification. |
|
142 | 142 | modified.append(fn) |
|
143 | 143 | elif self[fn].cmp(other[fn]): |
|
144 | 144 | modified.append(fn) |
|
145 | 145 | else: |
|
146 | 146 | clean.append(fn) |
|
147 | 147 | |
|
148 | 148 | if removed: |
|
149 | 149 | # need to filter files if they are already reported as removed |
|
150 | 150 | unknown = [fn for fn in unknown if fn not in mf1 and |
|
151 | 151 | (not match or match(fn))] |
|
152 | 152 | ignored = [fn for fn in ignored if fn not in mf1 and |
|
153 | 153 | (not match or match(fn))] |
|
154 | 154 | # if they're deleted, don't report them as removed |
|
155 | 155 | removed = [fn for fn in removed if fn not in deletedset] |
|
156 | 156 | |
|
157 | 157 | return scmutil.status(modified, added, removed, deleted, unknown, |
|
158 | 158 | ignored, clean) |
|
159 | 159 | |
|
160 | 160 | @propertycache |
|
161 | 161 | def substate(self): |
|
162 | 162 | return subrepoutil.state(self, self._repo.ui) |
|
163 | 163 | |
|
164 | 164 | def subrev(self, subpath): |
|
165 | 165 | return self.substate[subpath][1] |
|
166 | 166 | |
|
167 | 167 | def rev(self): |
|
168 | 168 | return self._rev |
|
169 | 169 | def node(self): |
|
170 | 170 | return self._node |
|
171 | 171 | def hex(self): |
|
172 | 172 | return hex(self.node()) |
|
173 | 173 | def manifest(self): |
|
174 | 174 | return self._manifest |
|
175 | 175 | def manifestctx(self): |
|
176 | 176 | return self._manifestctx |
|
177 | 177 | def repo(self): |
|
178 | 178 | return self._repo |
|
179 | 179 | def phasestr(self): |
|
180 | 180 | return phases.phasenames[self.phase()] |
|
181 | 181 | def mutable(self): |
|
182 | 182 | return self.phase() > phases.public |
|
183 | 183 | |
|
184 | 184 | def getfileset(self, expr): |
|
185 | 185 | return fileset.getfileset(self, expr) |
|
186 | 186 | |
|
187 | 187 | def obsolete(self): |
|
188 | 188 | """True if the changeset is obsolete""" |
|
189 | 189 | return self.rev() in obsmod.getrevs(self._repo, 'obsolete') |
|
190 | 190 | |
|
191 | 191 | def extinct(self): |
|
192 | 192 | """True if the changeset is extinct""" |
|
193 | 193 | return self.rev() in obsmod.getrevs(self._repo, 'extinct') |
|
194 | 194 | |
|
195 | 195 | def orphan(self): |
|
196 | 196 | """True if the changeset is not obsolete but it's ancestor are""" |
|
197 | 197 | return self.rev() in obsmod.getrevs(self._repo, 'orphan') |
|
198 | 198 | |
|
199 | 199 | def phasedivergent(self): |
|
200 | 200 | """True if the changeset try to be a successor of a public changeset |
|
201 | 201 | |
|
202 | 202 | Only non-public and non-obsolete changesets may be bumped. |
|
203 | 203 | """ |
|
204 | 204 | return self.rev() in obsmod.getrevs(self._repo, 'phasedivergent') |
|
205 | 205 | |
|
206 | 206 | def contentdivergent(self): |
|
207 | 207 | """Is a successors of a changeset with multiple possible successors set |
|
208 | 208 | |
|
209 | 209 | Only non-public and non-obsolete changesets may be divergent. |
|
210 | 210 | """ |
|
211 | 211 | return self.rev() in obsmod.getrevs(self._repo, 'contentdivergent') |
|
212 | 212 | |
|
213 | 213 | def isunstable(self): |
|
214 | 214 | """True if the changeset is either unstable, bumped or divergent""" |
|
215 | 215 | return self.orphan() or self.phasedivergent() or self.contentdivergent() |
|
216 | 216 | |
|
217 | 217 | def instabilities(self): |
|
218 | 218 | """return the list of instabilities affecting this changeset. |
|
219 | 219 | |
|
220 | 220 | Instabilities are returned as strings. possible values are: |
|
221 | 221 | - orphan, |
|
222 | 222 | - phase-divergent, |
|
223 | 223 | - content-divergent. |
|
224 | 224 | """ |
|
225 | 225 | instabilities = [] |
|
226 | 226 | if self.orphan(): |
|
227 | 227 | instabilities.append('orphan') |
|
228 | 228 | if self.phasedivergent(): |
|
229 | 229 | instabilities.append('phase-divergent') |
|
230 | 230 | if self.contentdivergent(): |
|
231 | 231 | instabilities.append('content-divergent') |
|
232 | 232 | return instabilities |
|
233 | 233 | |
|
234 | 234 | def parents(self): |
|
235 | 235 | """return contexts for each parent changeset""" |
|
236 | 236 | return self._parents |
|
237 | 237 | |
|
238 | 238 | def p1(self): |
|
239 | 239 | return self._parents[0] |
|
240 | 240 | |
|
241 | 241 | def p2(self): |
|
242 | 242 | parents = self._parents |
|
243 | 243 | if len(parents) == 2: |
|
244 | 244 | return parents[1] |
|
245 | 245 | return changectx(self._repo, nullrev) |
|
246 | 246 | |
|
247 | 247 | def _fileinfo(self, path): |
|
248 | 248 | if r'_manifest' in self.__dict__: |
|
249 | 249 | try: |
|
250 | 250 | return self._manifest[path], self._manifest.flags(path) |
|
251 | 251 | except KeyError: |
|
252 | 252 | raise error.ManifestLookupError(self._node, path, |
|
253 | 253 | _('not found in manifest')) |
|
254 | 254 | if r'_manifestdelta' in self.__dict__ or path in self.files(): |
|
255 | 255 | if path in self._manifestdelta: |
|
256 | 256 | return (self._manifestdelta[path], |
|
257 | 257 | self._manifestdelta.flags(path)) |
|
258 | 258 | mfl = self._repo.manifestlog |
|
259 | 259 | try: |
|
260 | 260 | node, flag = mfl[self._changeset.manifest].find(path) |
|
261 | 261 | except KeyError: |
|
262 | 262 | raise error.ManifestLookupError(self._node, path, |
|
263 | 263 | _('not found in manifest')) |
|
264 | 264 | |
|
265 | 265 | return node, flag |
|
266 | 266 | |
|
267 | 267 | def filenode(self, path): |
|
268 | 268 | return self._fileinfo(path)[0] |
|
269 | 269 | |
|
270 | 270 | def flags(self, path): |
|
271 | 271 | try: |
|
272 | 272 | return self._fileinfo(path)[1] |
|
273 | 273 | except error.LookupError: |
|
274 | 274 | return '' |
|
275 | 275 | |
|
276 | 276 | def sub(self, path, allowcreate=True): |
|
277 | 277 | '''return a subrepo for the stored revision of path, never wdir()''' |
|
278 | 278 | return subrepo.subrepo(self, path, allowcreate=allowcreate) |
|
279 | 279 | |
|
280 | 280 | def nullsub(self, path, pctx): |
|
281 | 281 | return subrepo.nullsubrepo(self, path, pctx) |
|
282 | 282 | |
|
283 | 283 | def workingsub(self, path): |
|
284 | 284 | '''return a subrepo for the stored revision, or wdir if this is a wdir |
|
285 | 285 | context. |
|
286 | 286 | ''' |
|
287 | 287 | return subrepo.subrepo(self, path, allowwdir=True) |
|
288 | 288 | |
|
289 | 289 | def match(self, pats=None, include=None, exclude=None, default='glob', |
|
290 | 290 | listsubrepos=False, badfn=None): |
|
291 | 291 | r = self._repo |
|
292 | 292 | return matchmod.match(r.root, r.getcwd(), pats, |
|
293 | 293 | include, exclude, default, |
|
294 | 294 | auditor=r.nofsauditor, ctx=self, |
|
295 | 295 | listsubrepos=listsubrepos, badfn=badfn) |
|
296 | 296 | |
|
297 | 297 | def diff(self, ctx2=None, match=None, changes=None, opts=None, |
|
298 | 298 | losedatafn=None, prefix='', relroot='', copy=None, |
|
299 | 299 | hunksfilterfn=None): |
|
300 | 300 | """Returns a diff generator for the given contexts and matcher""" |
|
301 | 301 | if ctx2 is None: |
|
302 | 302 | ctx2 = self.p1() |
|
303 | 303 | if ctx2 is not None: |
|
304 | 304 | ctx2 = self._repo[ctx2] |
|
305 | 305 | return patch.diff(self._repo, ctx2, self, match=match, changes=changes, |
|
306 | 306 | opts=opts, losedatafn=losedatafn, prefix=prefix, |
|
307 | 307 | relroot=relroot, copy=copy, |
|
308 | 308 | hunksfilterfn=hunksfilterfn) |
|
309 | 309 | |
|
310 | 310 | def dirs(self): |
|
311 | 311 | return self._manifest.dirs() |
|
312 | 312 | |
|
313 | 313 | def hasdir(self, dir): |
|
314 | 314 | return self._manifest.hasdir(dir) |
|
315 | 315 | |
|
316 | 316 | def status(self, other=None, match=None, listignored=False, |
|
317 | 317 | listclean=False, listunknown=False, listsubrepos=False): |
|
318 | 318 | """return status of files between two nodes or node and working |
|
319 | 319 | directory. |
|
320 | 320 | |
|
321 | 321 | If other is None, compare this node with working directory. |
|
322 | 322 | |
|
323 | 323 | returns (modified, added, removed, deleted, unknown, ignored, clean) |
|
324 | 324 | """ |
|
325 | 325 | |
|
326 | 326 | ctx1 = self |
|
327 | 327 | ctx2 = self._repo[other] |
|
328 | 328 | |
|
329 | 329 | # This next code block is, admittedly, fragile logic that tests for |
|
330 | 330 | # reversing the contexts and wouldn't need to exist if it weren't for |
|
331 | 331 | # the fast (and common) code path of comparing the working directory |
|
332 | 332 | # with its first parent. |
|
333 | 333 | # |
|
334 | 334 | # What we're aiming for here is the ability to call: |
|
335 | 335 | # |
|
336 | 336 | # workingctx.status(parentctx) |
|
337 | 337 | # |
|
338 | 338 | # If we always built the manifest for each context and compared those, |
|
339 | 339 | # then we'd be done. But the special case of the above call means we |
|
340 | 340 | # just copy the manifest of the parent. |
|
341 | 341 | reversed = False |
|
342 | 342 | if (not isinstance(ctx1, changectx) |
|
343 | 343 | and isinstance(ctx2, changectx)): |
|
344 | 344 | reversed = True |
|
345 | 345 | ctx1, ctx2 = ctx2, ctx1 |
|
346 | 346 | |
|
347 | 347 | match = match or matchmod.always(self._repo.root, self._repo.getcwd()) |
|
348 | 348 | match = ctx2._matchstatus(ctx1, match) |
|
349 | 349 | r = scmutil.status([], [], [], [], [], [], []) |
|
350 | 350 | r = ctx2._buildstatus(ctx1, r, match, listignored, listclean, |
|
351 | 351 | listunknown) |
|
352 | 352 | |
|
353 | 353 | if reversed: |
|
354 | 354 | # Reverse added and removed. Clear deleted, unknown and ignored as |
|
355 | 355 | # these make no sense to reverse. |
|
356 | 356 | r = scmutil.status(r.modified, r.removed, r.added, [], [], [], |
|
357 | 357 | r.clean) |
|
358 | 358 | |
|
359 | 359 | if listsubrepos: |
|
360 | 360 | for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): |
|
361 | 361 | try: |
|
362 | 362 | rev2 = ctx2.subrev(subpath) |
|
363 | 363 | except KeyError: |
|
364 | 364 | # A subrepo that existed in node1 was deleted between |
|
365 | 365 | # node1 and node2 (inclusive). Thus, ctx2's substate |
|
366 | 366 | # won't contain that subpath. The best we can do ignore it. |
|
367 | 367 | rev2 = None |
|
368 | 368 | submatch = matchmod.subdirmatcher(subpath, match) |
|
369 | 369 | s = sub.status(rev2, match=submatch, ignored=listignored, |
|
370 | 370 | clean=listclean, unknown=listunknown, |
|
371 | 371 | listsubrepos=True) |
|
372 | 372 | for rfiles, sfiles in zip(r, s): |
|
373 | 373 | rfiles.extend("%s/%s" % (subpath, f) for f in sfiles) |
|
374 | 374 | |
|
375 | 375 | for l in r: |
|
376 | 376 | l.sort() |
|
377 | 377 | |
|
378 | 378 | return r |
|
379 | 379 | |
|
380 | 380 | class changectx(basectx): |
|
381 | 381 | """A changecontext object makes access to data related to a particular |
|
382 | 382 | changeset convenient. It represents a read-only context already present in |
|
383 | 383 | the repo.""" |
|
384 | 384 | def __init__(self, repo, changeid='.'): |
|
385 | 385 | """changeid is a revision number, node, or tag""" |
|
386 | 386 | super(changectx, self).__init__(repo) |
|
387 | 387 | |
|
388 | 388 | try: |
|
389 | 389 | if isinstance(changeid, int): |
|
390 | 390 | self._node = repo.changelog.node(changeid) |
|
391 | 391 | self._rev = changeid |
|
392 | 392 | return |
|
393 | 393 | elif changeid == 'null': |
|
394 | 394 | self._node = nullid |
|
395 | 395 | self._rev = nullrev |
|
396 | 396 | return |
|
397 | 397 | elif changeid == 'tip': |
|
398 | 398 | self._node = repo.changelog.tip() |
|
399 | 399 | self._rev = repo.changelog.rev(self._node) |
|
400 | 400 | return |
|
401 | 401 | elif (changeid == '.' |
|
402 | 402 | or repo.local() and changeid == repo.dirstate.p1()): |
|
403 | 403 | # this is a hack to delay/avoid loading obsmarkers |
|
404 | 404 | # when we know that '.' won't be hidden |
|
405 | 405 | self._node = repo.dirstate.p1() |
|
406 | 406 | self._rev = repo.unfiltered().changelog.rev(self._node) |
|
407 | 407 | return |
|
408 | 408 | elif len(changeid) == 20: |
|
409 | 409 | try: |
|
410 | 410 | self._node = changeid |
|
411 | 411 | self._rev = repo.changelog.rev(changeid) |
|
412 | 412 | return |
|
413 | 413 | except error.FilteredLookupError: |
|
414 | 414 | raise |
|
415 | 415 | except LookupError: |
|
416 | 416 | # check if it might have come from damaged dirstate |
|
417 | 417 | # |
|
418 | 418 | # XXX we could avoid the unfiltered if we had a recognizable |
|
419 | 419 | # exception for filtered changeset access |
|
420 | 420 | if (repo.local() |
|
421 | 421 | and changeid in repo.unfiltered().dirstate.parents()): |
|
422 | 422 | msg = _("working directory has unknown parent '%s'!") |
|
423 | 423 | raise error.Abort(msg % short(changeid)) |
|
424 | 424 | changeid = hex(changeid) # for the error message |
|
425 | 425 | |
|
426 | 426 | elif len(changeid) == 40: |
|
427 | 427 | try: |
|
428 | 428 | self._node = bin(changeid) |
|
429 | 429 | self._rev = repo.changelog.rev(self._node) |
|
430 | 430 | return |
|
431 | 431 | except error.FilteredLookupError: |
|
432 | 432 | raise |
|
433 | 433 | except (TypeError, LookupError): |
|
434 | 434 | pass |
|
435 | 435 | else: |
|
436 | 436 | raise error.ProgrammingError( |
|
437 | 437 | "unsupported changeid '%s' of type %s" % |
|
438 | 438 | (changeid, type(changeid))) |
|
439 | 439 | |
|
440 | 440 | # lookup failed |
|
441 | 441 | except (error.FilteredIndexError, error.FilteredLookupError): |
|
442 | 442 | raise error.FilteredRepoLookupError(_("filtered revision '%s'") |
|
443 | 443 | % pycompat.bytestr(changeid)) |
|
444 | 444 | except error.FilteredRepoLookupError: |
|
445 | 445 | raise |
|
446 | 446 | except IndexError: |
|
447 | 447 | pass |
|
448 | 448 | raise error.RepoLookupError( |
|
449 | 449 | _("unknown revision '%s'") % changeid) |
|
450 | 450 | |
|
451 | 451 | def __hash__(self): |
|
452 | 452 | try: |
|
453 | 453 | return hash(self._rev) |
|
454 | 454 | except AttributeError: |
|
455 | 455 | return id(self) |
|
456 | 456 | |
|
457 | 457 | def __nonzero__(self): |
|
458 | 458 | return self._rev != nullrev |
|
459 | 459 | |
|
460 | 460 | __bool__ = __nonzero__ |
|
461 | 461 | |
|
462 | 462 | @propertycache |
|
463 | 463 | def _changeset(self): |
|
464 | 464 | return self._repo.changelog.changelogrevision(self.rev()) |
|
465 | 465 | |
|
466 | 466 | @propertycache |
|
467 | 467 | def _manifest(self): |
|
468 | 468 | return self._manifestctx.read() |
|
469 | 469 | |
|
470 | 470 | @property |
|
471 | 471 | def _manifestctx(self): |
|
472 | 472 | return self._repo.manifestlog[self._changeset.manifest] |
|
473 | 473 | |
|
474 | 474 | @propertycache |
|
475 | 475 | def _manifestdelta(self): |
|
476 | 476 | return self._manifestctx.readdelta() |
|
477 | 477 | |
|
478 | 478 | @propertycache |
|
479 | 479 | def _parents(self): |
|
480 | 480 | repo = self._repo |
|
481 | 481 | p1, p2 = repo.changelog.parentrevs(self._rev) |
|
482 | 482 | if p2 == nullrev: |
|
483 | 483 | return [changectx(repo, p1)] |
|
484 | 484 | return [changectx(repo, p1), changectx(repo, p2)] |
|
485 | 485 | |
|
486 | 486 | def changeset(self): |
|
487 | 487 | c = self._changeset |
|
488 | 488 | return ( |
|
489 | 489 | c.manifest, |
|
490 | 490 | c.user, |
|
491 | 491 | c.date, |
|
492 | 492 | c.files, |
|
493 | 493 | c.description, |
|
494 | 494 | c.extra, |
|
495 | 495 | ) |
|
496 | 496 | def manifestnode(self): |
|
497 | 497 | return self._changeset.manifest |
|
498 | 498 | |
|
499 | 499 | def user(self): |
|
500 | 500 | return self._changeset.user |
|
501 | 501 | def date(self): |
|
502 | 502 | return self._changeset.date |
|
503 | 503 | def files(self): |
|
504 | 504 | return self._changeset.files |
|
505 | 505 | def description(self): |
|
506 | 506 | return self._changeset.description |
|
507 | 507 | def branch(self): |
|
508 | 508 | return encoding.tolocal(self._changeset.extra.get("branch")) |
|
509 | 509 | def closesbranch(self): |
|
510 | 510 | return 'close' in self._changeset.extra |
|
511 | 511 | def extra(self): |
|
512 | 512 | """Return a dict of extra information.""" |
|
513 | 513 | return self._changeset.extra |
|
514 | 514 | def tags(self): |
|
515 | 515 | """Return a list of byte tag names""" |
|
516 | 516 | return self._repo.nodetags(self._node) |
|
517 | 517 | def bookmarks(self): |
|
518 | 518 | """Return a list of byte bookmark names.""" |
|
519 | 519 | return self._repo.nodebookmarks(self._node) |
|
520 | 520 | def phase(self): |
|
521 | 521 | return self._repo._phasecache.phase(self._repo, self._rev) |
|
522 | 522 | def hidden(self): |
|
523 | 523 | return self._rev in repoview.filterrevs(self._repo, 'visible') |
|
524 | 524 | |
|
525 | 525 | def isinmemory(self): |
|
526 | 526 | return False |
|
527 | 527 | |
|
528 | 528 | def children(self): |
|
529 | 529 | """return list of changectx contexts for each child changeset. |
|
530 | 530 | |
|
531 | 531 | This returns only the immediate child changesets. Use descendants() to |
|
532 | 532 | recursively walk children. |
|
533 | 533 | """ |
|
534 | 534 | c = self._repo.changelog.children(self._node) |
|
535 | 535 | return [changectx(self._repo, x) for x in c] |
|
536 | 536 | |
|
537 | 537 | def ancestors(self): |
|
538 | 538 | for a in self._repo.changelog.ancestors([self._rev]): |
|
539 | 539 | yield changectx(self._repo, a) |
|
540 | 540 | |
|
541 | 541 | def descendants(self): |
|
542 | 542 | """Recursively yield all children of the changeset. |
|
543 | 543 | |
|
544 | 544 | For just the immediate children, use children() |
|
545 | 545 | """ |
|
546 | 546 | for d in self._repo.changelog.descendants([self._rev]): |
|
547 | 547 | yield changectx(self._repo, d) |
|
548 | 548 | |
|
549 | 549 | def filectx(self, path, fileid=None, filelog=None): |
|
550 | 550 | """get a file context from this changeset""" |
|
551 | 551 | if fileid is None: |
|
552 | 552 | fileid = self.filenode(path) |
|
553 | 553 | return filectx(self._repo, path, fileid=fileid, |
|
554 | 554 | changectx=self, filelog=filelog) |
|
555 | 555 | |
|
556 | 556 | def ancestor(self, c2, warn=False): |
|
557 | 557 | """return the "best" ancestor context of self and c2 |
|
558 | 558 | |
|
559 | 559 | If there are multiple candidates, it will show a message and check |
|
560 | 560 | merge.preferancestor configuration before falling back to the |
|
561 | 561 | revlog ancestor.""" |
|
562 | 562 | # deal with workingctxs |
|
563 | 563 | n2 = c2._node |
|
564 | 564 | if n2 is None: |
|
565 | 565 | n2 = c2._parents[0]._node |
|
566 | 566 | cahs = self._repo.changelog.commonancestorsheads(self._node, n2) |
|
567 | 567 | if not cahs: |
|
568 | 568 | anc = nullid |
|
569 | 569 | elif len(cahs) == 1: |
|
570 | 570 | anc = cahs[0] |
|
571 | 571 | else: |
|
572 | 572 | # experimental config: merge.preferancestor |
|
573 | 573 | for r in self._repo.ui.configlist('merge', 'preferancestor'): |
|
574 | 574 | try: |
|
575 | 575 | ctx = scmutil.revsymbol(self._repo, r) |
|
576 | 576 | except error.RepoLookupError: |
|
577 | 577 | continue |
|
578 | 578 | anc = ctx.node() |
|
579 | 579 | if anc in cahs: |
|
580 | 580 | break |
|
581 | 581 | else: |
|
582 | 582 | anc = self._repo.changelog.ancestor(self._node, n2) |
|
583 | 583 | if warn: |
|
584 | 584 | self._repo.ui.status( |
|
585 | 585 | (_("note: using %s as ancestor of %s and %s\n") % |
|
586 | 586 | (short(anc), short(self._node), short(n2))) + |
|
587 | 587 | ''.join(_(" alternatively, use --config " |
|
588 | 588 | "merge.preferancestor=%s\n") % |
|
589 | 589 | short(n) for n in sorted(cahs) if n != anc)) |
|
590 | 590 | return changectx(self._repo, anc) |
|
591 | 591 | |
|
592 | 592 | def descendant(self, other): |
|
593 | 593 | """True if other is descendant of this changeset""" |
|
594 | 594 | return self._repo.changelog.descendant(self._rev, other._rev) |
|
595 | 595 | |
|
596 | 596 | def walk(self, match): |
|
597 | 597 | '''Generates matching file names.''' |
|
598 | 598 | |
|
599 | 599 | # Wrap match.bad method to have message with nodeid |
|
600 | 600 | def bad(fn, msg): |
|
601 | 601 | # The manifest doesn't know about subrepos, so don't complain about |
|
602 | 602 | # paths into valid subrepos. |
|
603 | 603 | if any(fn == s or fn.startswith(s + '/') |
|
604 | 604 | for s in self.substate): |
|
605 | 605 | return |
|
606 | 606 | match.bad(fn, _('no such file in rev %s') % self) |
|
607 | 607 | |
|
608 | 608 | m = matchmod.badmatch(match, bad) |
|
609 | 609 | return self._manifest.walk(m) |
|
610 | 610 | |
|
611 | 611 | def matches(self, match): |
|
612 | 612 | return self.walk(match) |
|
613 | 613 | |
|
614 | 614 | class basefilectx(object): |
|
615 | 615 | """A filecontext object represents the common logic for its children: |
|
616 | 616 | filectx: read-only access to a filerevision that is already present |
|
617 | 617 | in the repo, |
|
618 | 618 | workingfilectx: a filecontext that represents files from the working |
|
619 | 619 | directory, |
|
620 | 620 | memfilectx: a filecontext that represents files in-memory, |
|
621 | 621 | overlayfilectx: duplicate another filecontext with some fields overridden. |
|
622 | 622 | """ |
|
623 | 623 | @propertycache |
|
624 | 624 | def _filelog(self): |
|
625 | 625 | return self._repo.file(self._path) |
|
626 | 626 | |
|
627 | 627 | @propertycache |
|
628 | 628 | def _changeid(self): |
|
629 | 629 | if r'_changeid' in self.__dict__: |
|
630 | 630 | return self._changeid |
|
631 | 631 | elif r'_changectx' in self.__dict__: |
|
632 | 632 | return self._changectx.rev() |
|
633 | 633 | elif r'_descendantrev' in self.__dict__: |
|
634 | 634 | # this file context was created from a revision with a known |
|
635 | 635 | # descendant, we can (lazily) correct for linkrev aliases |
|
636 | 636 | return self._adjustlinkrev(self._descendantrev) |
|
637 | 637 | else: |
|
638 | 638 | return self._filelog.linkrev(self._filerev) |
|
639 | 639 | |
|
640 | 640 | @propertycache |
|
641 | 641 | def _filenode(self): |
|
642 | 642 | if r'_fileid' in self.__dict__: |
|
643 | 643 | return self._filelog.lookup(self._fileid) |
|
644 | 644 | else: |
|
645 | 645 | return self._changectx.filenode(self._path) |
|
646 | 646 | |
|
647 | 647 | @propertycache |
|
648 | 648 | def _filerev(self): |
|
649 | 649 | return self._filelog.rev(self._filenode) |
|
650 | 650 | |
|
651 | 651 | @propertycache |
|
652 | 652 | def _repopath(self): |
|
653 | 653 | return self._path |
|
654 | 654 | |
|
655 | 655 | def __nonzero__(self): |
|
656 | 656 | try: |
|
657 | 657 | self._filenode |
|
658 | 658 | return True |
|
659 | 659 | except error.LookupError: |
|
660 | 660 | # file is missing |
|
661 | 661 | return False |
|
662 | 662 | |
|
663 | 663 | __bool__ = __nonzero__ |
|
664 | 664 | |
|
665 | 665 | def __bytes__(self): |
|
666 | 666 | try: |
|
667 | 667 | return "%s@%s" % (self.path(), self._changectx) |
|
668 | 668 | except error.LookupError: |
|
669 | 669 | return "%s@???" % self.path() |
|
670 | 670 | |
|
671 | 671 | __str__ = encoding.strmethod(__bytes__) |
|
672 | 672 | |
|
673 | 673 | def __repr__(self): |
|
674 | 674 | return r"<%s %s>" % (type(self).__name__, str(self)) |
|
675 | 675 | |
|
676 | 676 | def __hash__(self): |
|
677 | 677 | try: |
|
678 | 678 | return hash((self._path, self._filenode)) |
|
679 | 679 | except AttributeError: |
|
680 | 680 | return id(self) |
|
681 | 681 | |
|
682 | 682 | def __eq__(self, other): |
|
683 | 683 | try: |
|
684 | 684 | return (type(self) == type(other) and self._path == other._path |
|
685 | 685 | and self._filenode == other._filenode) |
|
686 | 686 | except AttributeError: |
|
687 | 687 | return False |
|
688 | 688 | |
|
689 | 689 | def __ne__(self, other): |
|
690 | 690 | return not (self == other) |
|
691 | 691 | |
|
692 | 692 | def filerev(self): |
|
693 | 693 | return self._filerev |
|
694 | 694 | def filenode(self): |
|
695 | 695 | return self._filenode |
|
696 | 696 | @propertycache |
|
697 | 697 | def _flags(self): |
|
698 | 698 | return self._changectx.flags(self._path) |
|
699 | 699 | def flags(self): |
|
700 | 700 | return self._flags |
|
701 | 701 | def filelog(self): |
|
702 | 702 | return self._filelog |
|
703 | 703 | def rev(self): |
|
704 | 704 | return self._changeid |
|
705 | 705 | def linkrev(self): |
|
706 | 706 | return self._filelog.linkrev(self._filerev) |
|
707 | 707 | def node(self): |
|
708 | 708 | return self._changectx.node() |
|
709 | 709 | def hex(self): |
|
710 | 710 | return self._changectx.hex() |
|
711 | 711 | def user(self): |
|
712 | 712 | return self._changectx.user() |
|
713 | 713 | def date(self): |
|
714 | 714 | return self._changectx.date() |
|
715 | 715 | def files(self): |
|
716 | 716 | return self._changectx.files() |
|
717 | 717 | def description(self): |
|
718 | 718 | return self._changectx.description() |
|
719 | 719 | def branch(self): |
|
720 | 720 | return self._changectx.branch() |
|
721 | 721 | def extra(self): |
|
722 | 722 | return self._changectx.extra() |
|
723 | 723 | def phase(self): |
|
724 | 724 | return self._changectx.phase() |
|
725 | 725 | def phasestr(self): |
|
726 | 726 | return self._changectx.phasestr() |
|
727 | 727 | def obsolete(self): |
|
728 | 728 | return self._changectx.obsolete() |
|
729 | 729 | def instabilities(self): |
|
730 | 730 | return self._changectx.instabilities() |
|
731 | 731 | def manifest(self): |
|
732 | 732 | return self._changectx.manifest() |
|
733 | 733 | def changectx(self): |
|
734 | 734 | return self._changectx |
|
735 | 735 | def renamed(self): |
|
736 | 736 | return self._copied |
|
737 | 737 | def repo(self): |
|
738 | 738 | return self._repo |
|
739 | 739 | def size(self): |
|
740 | 740 | return len(self.data()) |
|
741 | 741 | |
|
742 | 742 | def path(self): |
|
743 | 743 | return self._path |
|
744 | 744 | |
|
745 | 745 | def isbinary(self): |
|
746 | 746 | try: |
|
747 | 747 | return stringutil.binary(self.data()) |
|
748 | 748 | except IOError: |
|
749 | 749 | return False |
|
750 | 750 | def isexec(self): |
|
751 | 751 | return 'x' in self.flags() |
|
752 | 752 | def islink(self): |
|
753 | 753 | return 'l' in self.flags() |
|
754 | 754 | |
|
755 | 755 | def isabsent(self): |
|
756 | 756 | """whether this filectx represents a file not in self._changectx |
|
757 | 757 | |
|
758 | 758 | This is mainly for merge code to detect change/delete conflicts. This is |
|
759 | 759 | expected to be True for all subclasses of basectx.""" |
|
760 | 760 | return False |
|
761 | 761 | |
|
762 | 762 | _customcmp = False |
|
763 | 763 | def cmp(self, fctx): |
|
764 | 764 | """compare with other file context |
|
765 | 765 | |
|
766 | 766 | returns True if different than fctx. |
|
767 | 767 | """ |
|
768 | 768 | if fctx._customcmp: |
|
769 | 769 | return fctx.cmp(self) |
|
770 | 770 | |
|
771 | 771 | if (fctx._filenode is None |
|
772 | 772 | and (self._repo._encodefilterpats |
|
773 | 773 | # if file data starts with '\1\n', empty metadata block is |
|
774 | 774 | # prepended, which adds 4 bytes to filelog.size(). |
|
775 | 775 | or self.size() - 4 == fctx.size()) |
|
776 | 776 | or self.size() == fctx.size()): |
|
777 | 777 | return self._filelog.cmp(self._filenode, fctx.data()) |
|
778 | 778 | |
|
779 | 779 | return True |
|
780 | 780 | |
|
781 | 781 | def _adjustlinkrev(self, srcrev, inclusive=False): |
|
782 | 782 | """return the first ancestor of <srcrev> introducing <fnode> |
|
783 | 783 | |
|
784 | 784 | If the linkrev of the file revision does not point to an ancestor of |
|
785 | 785 | srcrev, we'll walk down the ancestors until we find one introducing |
|
786 | 786 | this file revision. |
|
787 | 787 | |
|
788 | 788 | :srcrev: the changeset revision we search ancestors from |
|
789 | 789 | :inclusive: if true, the src revision will also be checked |
|
790 | 790 | """ |
|
791 | 791 | repo = self._repo |
|
792 | 792 | cl = repo.unfiltered().changelog |
|
793 | 793 | mfl = repo.manifestlog |
|
794 | 794 | # fetch the linkrev |
|
795 | 795 | lkr = self.linkrev() |
|
796 | 796 | # hack to reuse ancestor computation when searching for renames |
|
797 | 797 | memberanc = getattr(self, '_ancestrycontext', None) |
|
798 | 798 | iteranc = None |
|
799 | 799 | if srcrev is None: |
|
800 | 800 | # wctx case, used by workingfilectx during mergecopy |
|
801 | 801 | revs = [p.rev() for p in self._repo[None].parents()] |
|
802 | 802 | inclusive = True # we skipped the real (revless) source |
|
803 | 803 | else: |
|
804 | 804 | revs = [srcrev] |
|
805 | 805 | if memberanc is None: |
|
806 | 806 | memberanc = iteranc = cl.ancestors(revs, lkr, |
|
807 | 807 | inclusive=inclusive) |
|
808 | 808 | # check if this linkrev is an ancestor of srcrev |
|
809 | 809 | if lkr not in memberanc: |
|
810 | 810 | if iteranc is None: |
|
811 | 811 | iteranc = cl.ancestors(revs, lkr, inclusive=inclusive) |
|
812 | 812 | fnode = self._filenode |
|
813 | 813 | path = self._path |
|
814 | 814 | for a in iteranc: |
|
815 | 815 | ac = cl.read(a) # get changeset data (we avoid object creation) |
|
816 | 816 | if path in ac[3]: # checking the 'files' field. |
|
817 | 817 | # The file has been touched, check if the content is |
|
818 | 818 | # similar to the one we search for. |
|
819 | 819 | if fnode == mfl[ac[0]].readfast().get(path): |
|
820 | 820 | return a |
|
821 | 821 | # In theory, we should never get out of that loop without a result. |
|
822 | 822 | # But if manifest uses a buggy file revision (not children of the |
|
823 | 823 | # one it replaces) we could. Such a buggy situation will likely |
|
824 | 824 | # result is crash somewhere else at to some point. |
|
825 | 825 | return lkr |
|
826 | 826 | |
|
827 | 827 | def introrev(self): |
|
828 | 828 | """return the rev of the changeset which introduced this file revision |
|
829 | 829 | |
|
830 | 830 | This method is different from linkrev because it take into account the |
|
831 | 831 | changeset the filectx was created from. It ensures the returned |
|
832 | 832 | revision is one of its ancestors. This prevents bugs from |
|
833 | 833 | 'linkrev-shadowing' when a file revision is used by multiple |
|
834 | 834 | changesets. |
|
835 | 835 | """ |
|
836 | 836 | lkr = self.linkrev() |
|
837 | 837 | attrs = vars(self) |
|
838 | 838 | noctx = not (r'_changeid' in attrs or r'_changectx' in attrs) |
|
839 | 839 | if noctx or self.rev() == lkr: |
|
840 | 840 | return self.linkrev() |
|
841 | 841 | return self._adjustlinkrev(self.rev(), inclusive=True) |
|
842 | 842 | |
|
843 | 843 | def introfilectx(self): |
|
844 | 844 | """Return filectx having identical contents, but pointing to the |
|
845 | 845 | changeset revision where this filectx was introduced""" |
|
846 | 846 | introrev = self.introrev() |
|
847 | 847 | if self.rev() == introrev: |
|
848 | 848 | return self |
|
849 | 849 | return self.filectx(self.filenode(), changeid=introrev) |
|
850 | 850 | |
|
851 | 851 | def _parentfilectx(self, path, fileid, filelog): |
|
852 | 852 | """create parent filectx keeping ancestry info for _adjustlinkrev()""" |
|
853 | 853 | fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog) |
|
854 | 854 | if r'_changeid' in vars(self) or r'_changectx' in vars(self): |
|
855 | 855 | # If self is associated with a changeset (probably explicitly |
|
856 | 856 | # fed), ensure the created filectx is associated with a |
|
857 | 857 | # changeset that is an ancestor of self.changectx. |
|
858 | 858 | # This lets us later use _adjustlinkrev to get a correct link. |
|
859 | 859 | fctx._descendantrev = self.rev() |
|
860 | 860 | fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) |
|
861 | 861 | elif r'_descendantrev' in vars(self): |
|
862 | 862 | # Otherwise propagate _descendantrev if we have one associated. |
|
863 | 863 | fctx._descendantrev = self._descendantrev |
|
864 | 864 | fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) |
|
865 | 865 | return fctx |
|
866 | 866 | |
|
867 | 867 | def parents(self): |
|
868 | 868 | _path = self._path |
|
869 | 869 | fl = self._filelog |
|
870 | 870 | parents = self._filelog.parents(self._filenode) |
|
871 | 871 | pl = [(_path, node, fl) for node in parents if node != nullid] |
|
872 | 872 | |
|
873 | 873 | r = fl.renamed(self._filenode) |
|
874 | 874 | if r: |
|
875 | 875 | # - In the simple rename case, both parent are nullid, pl is empty. |
|
876 | 876 | # - In case of merge, only one of the parent is null id and should |
|
877 | 877 | # be replaced with the rename information. This parent is -always- |
|
878 | 878 | # the first one. |
|
879 | 879 | # |
|
880 | 880 | # As null id have always been filtered out in the previous list |
|
881 | 881 | # comprehension, inserting to 0 will always result in "replacing |
|
882 | 882 | # first nullid parent with rename information. |
|
883 | 883 | pl.insert(0, (r[0], r[1], self._repo.file(r[0]))) |
|
884 | 884 | |
|
885 | 885 | return [self._parentfilectx(path, fnode, l) for path, fnode, l in pl] |
|
886 | 886 | |
|
887 | 887 | def p1(self): |
|
888 | 888 | return self.parents()[0] |
|
889 | 889 | |
|
890 | 890 | def p2(self): |
|
891 | 891 | p = self.parents() |
|
892 | 892 | if len(p) == 2: |
|
893 | 893 | return p[1] |
|
894 | 894 | return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog) |
|
895 | 895 | |
|
896 | 896 | def annotate(self, follow=False, skiprevs=None, diffopts=None): |
|
897 | 897 | """Returns a list of annotateline objects for each line in the file |
|
898 | 898 | |
|
899 | 899 | - line.fctx is the filectx of the node where that line was last changed |
|
900 | 900 | - line.lineno is the line number at the first appearance in the managed |
|
901 | 901 | file |
|
902 | 902 | - line.text is the data on that line (including newline character) |
|
903 | 903 | """ |
|
904 | 904 | getlog = util.lrucachefunc(lambda x: self._repo.file(x)) |
|
905 | 905 | |
|
906 | 906 | def parents(f): |
|
907 | 907 | # Cut _descendantrev here to mitigate the penalty of lazy linkrev |
|
908 | 908 | # adjustment. Otherwise, p._adjustlinkrev() would walk changelog |
|
909 | 909 | # from the topmost introrev (= srcrev) down to p.linkrev() if it |
|
910 | 910 | # isn't an ancestor of the srcrev. |
|
911 | 911 | f._changeid |
|
912 | 912 | pl = f.parents() |
|
913 | 913 | |
|
914 | 914 | # Don't return renamed parents if we aren't following. |
|
915 | 915 | if not follow: |
|
916 | 916 | pl = [p for p in pl if p.path() == f.path()] |
|
917 | 917 | |
|
918 | 918 | # renamed filectx won't have a filelog yet, so set it |
|
919 | 919 | # from the cache to save time |
|
920 | 920 | for p in pl: |
|
921 | 921 | if not r'_filelog' in p.__dict__: |
|
922 | 922 | p._filelog = getlog(p.path()) |
|
923 | 923 | |
|
924 | 924 | return pl |
|
925 | 925 | |
|
926 | 926 | # use linkrev to find the first changeset where self appeared |
|
927 | 927 | base = self.introfilectx() |
|
928 | 928 | if getattr(base, '_ancestrycontext', None) is None: |
|
929 | 929 | cl = self._repo.changelog |
|
930 | 930 | if base.rev() is None: |
|
931 | 931 | # wctx is not inclusive, but works because _ancestrycontext |
|
932 | 932 | # is used to test filelog revisions |
|
933 | 933 | ac = cl.ancestors([p.rev() for p in base.parents()], |
|
934 | 934 | inclusive=True) |
|
935 | 935 | else: |
|
936 | 936 | ac = cl.ancestors([base.rev()], inclusive=True) |
|
937 | 937 | base._ancestrycontext = ac |
|
938 | 938 | |
|
939 | 939 | return dagop.annotate(base, parents, skiprevs=skiprevs, |
|
940 | 940 | diffopts=diffopts) |
|
941 | 941 | |
|
942 | 942 | def ancestors(self, followfirst=False): |
|
943 | 943 | visit = {} |
|
944 | 944 | c = self |
|
945 | 945 | if followfirst: |
|
946 | 946 | cut = 1 |
|
947 | 947 | else: |
|
948 | 948 | cut = None |
|
949 | 949 | |
|
950 | 950 | while True: |
|
951 | 951 | for parent in c.parents()[:cut]: |
|
952 | 952 | visit[(parent.linkrev(), parent.filenode())] = parent |
|
953 | 953 | if not visit: |
|
954 | 954 | break |
|
955 | 955 | c = visit.pop(max(visit)) |
|
956 | 956 | yield c |
|
957 | 957 | |
|
958 | 958 | def decodeddata(self): |
|
959 | 959 | """Returns `data()` after running repository decoding filters. |
|
960 | 960 | |
|
961 | 961 | This is often equivalent to how the data would be expressed on disk. |
|
962 | 962 | """ |
|
963 | 963 | return self._repo.wwritedata(self.path(), self.data()) |
|
964 | 964 | |
|
965 | 965 | class filectx(basefilectx): |
|
966 | 966 | """A filecontext object makes access to data related to a particular |
|
967 | 967 | filerevision convenient.""" |
|
968 | 968 | def __init__(self, repo, path, changeid=None, fileid=None, |
|
969 | 969 | filelog=None, changectx=None): |
|
970 | 970 | """changeid can be a changeset revision, node, or tag. |
|
971 | 971 | fileid can be a file revision or node.""" |
|
972 | 972 | self._repo = repo |
|
973 | 973 | self._path = path |
|
974 | 974 | |
|
975 | 975 | assert (changeid is not None |
|
976 | 976 | or fileid is not None |
|
977 | 977 | or changectx is not None), \ |
|
978 | 978 | ("bad args: changeid=%r, fileid=%r, changectx=%r" |
|
979 | 979 | % (changeid, fileid, changectx)) |
|
980 | 980 | |
|
981 | 981 | if filelog is not None: |
|
982 | 982 | self._filelog = filelog |
|
983 | 983 | |
|
984 | 984 | if changeid is not None: |
|
985 | 985 | self._changeid = changeid |
|
986 | 986 | if changectx is not None: |
|
987 | 987 | self._changectx = changectx |
|
988 | 988 | if fileid is not None: |
|
989 | 989 | self._fileid = fileid |
|
990 | 990 | |
|
991 | 991 | @propertycache |
|
992 | 992 | def _changectx(self): |
|
993 | 993 | try: |
|
994 | 994 | return changectx(self._repo, self._changeid) |
|
995 | 995 | except error.FilteredRepoLookupError: |
|
996 | 996 | # Linkrev may point to any revision in the repository. When the |
|
997 | 997 | # repository is filtered this may lead to `filectx` trying to build |
|
998 | 998 | # `changectx` for filtered revision. In such case we fallback to |
|
999 | 999 | # creating `changectx` on the unfiltered version of the reposition. |
|
1000 | 1000 | # This fallback should not be an issue because `changectx` from |
|
1001 | 1001 | # `filectx` are not used in complex operations that care about |
|
1002 | 1002 | # filtering. |
|
1003 | 1003 | # |
|
1004 | 1004 | # This fallback is a cheap and dirty fix that prevent several |
|
1005 | 1005 | # crashes. It does not ensure the behavior is correct. However the |
|
1006 | 1006 | # behavior was not correct before filtering either and "incorrect |
|
1007 | 1007 | # behavior" is seen as better as "crash" |
|
1008 | 1008 | # |
|
1009 | 1009 | # Linkrevs have several serious troubles with filtering that are |
|
1010 | 1010 | # complicated to solve. Proper handling of the issue here should be |
|
1011 | 1011 | # considered when solving linkrev issue are on the table. |
|
1012 | 1012 | return changectx(self._repo.unfiltered(), self._changeid) |
|
1013 | 1013 | |
|
1014 | 1014 | def filectx(self, fileid, changeid=None): |
|
1015 | 1015 | '''opens an arbitrary revision of the file without |
|
1016 | 1016 | opening a new filelog''' |
|
1017 | 1017 | return filectx(self._repo, self._path, fileid=fileid, |
|
1018 | 1018 | filelog=self._filelog, changeid=changeid) |
|
1019 | 1019 | |
|
1020 | 1020 | def rawdata(self): |
|
1021 | 1021 | return self._filelog.revision(self._filenode, raw=True) |
|
1022 | 1022 | |
|
1023 | 1023 | def rawflags(self): |
|
1024 | 1024 | """low-level revlog flags""" |
|
1025 | 1025 | return self._filelog.flags(self._filerev) |
|
1026 | 1026 | |
|
1027 | 1027 | def data(self): |
|
1028 | 1028 | try: |
|
1029 | 1029 | return self._filelog.read(self._filenode) |
|
1030 | 1030 | except error.CensoredNodeError: |
|
1031 | 1031 | if self._repo.ui.config("censor", "policy") == "ignore": |
|
1032 | 1032 | return "" |
|
1033 | 1033 | raise error.Abort(_("censored node: %s") % short(self._filenode), |
|
1034 | 1034 | hint=_("set censor.policy to ignore errors")) |
|
1035 | 1035 | |
|
1036 | 1036 | def size(self): |
|
1037 | 1037 | return self._filelog.size(self._filerev) |
|
1038 | 1038 | |
|
1039 | 1039 | @propertycache |
|
1040 | 1040 | def _copied(self): |
|
1041 | 1041 | """check if file was actually renamed in this changeset revision |
|
1042 | 1042 | |
|
1043 | 1043 | If rename logged in file revision, we report copy for changeset only |
|
1044 | 1044 | if file revisions linkrev points back to the changeset in question |
|
1045 | 1045 | or both changeset parents contain different file revisions. |
|
1046 | 1046 | """ |
|
1047 | 1047 | |
|
1048 | 1048 | renamed = self._filelog.renamed(self._filenode) |
|
1049 | 1049 | if not renamed: |
|
1050 | 1050 | return renamed |
|
1051 | 1051 | |
|
1052 | 1052 | if self.rev() == self.linkrev(): |
|
1053 | 1053 | return renamed |
|
1054 | 1054 | |
|
1055 | 1055 | name = self.path() |
|
1056 | 1056 | fnode = self._filenode |
|
1057 | 1057 | for p in self._changectx.parents(): |
|
1058 | 1058 | try: |
|
1059 | 1059 | if fnode == p.filenode(name): |
|
1060 | 1060 | return None |
|
1061 | 1061 | except error.LookupError: |
|
1062 | 1062 | pass |
|
1063 | 1063 | return renamed |
|
1064 | 1064 | |
|
1065 | 1065 | def children(self): |
|
1066 | 1066 | # hard for renames |
|
1067 | 1067 | c = self._filelog.children(self._filenode) |
|
1068 | 1068 | return [filectx(self._repo, self._path, fileid=x, |
|
1069 | 1069 | filelog=self._filelog) for x in c] |
|
1070 | 1070 | |
|
1071 | 1071 | class committablectx(basectx): |
|
1072 | 1072 | """A committablectx object provides common functionality for a context that |
|
1073 | 1073 | wants the ability to commit, e.g. workingctx or memctx.""" |
|
1074 | 1074 | def __init__(self, repo, text="", user=None, date=None, extra=None, |
|
1075 | 1075 | changes=None): |
|
1076 | 1076 | super(committablectx, self).__init__(repo) |
|
1077 | 1077 | self._rev = None |
|
1078 | 1078 | self._node = None |
|
1079 | 1079 | self._text = text |
|
1080 | 1080 | if date: |
|
1081 | 1081 | self._date = dateutil.parsedate(date) |
|
1082 | 1082 | if user: |
|
1083 | 1083 | self._user = user |
|
1084 | 1084 | if changes: |
|
1085 | 1085 | self._status = changes |
|
1086 | 1086 | |
|
1087 | 1087 | self._extra = {} |
|
1088 | 1088 | if extra: |
|
1089 | 1089 | self._extra = extra.copy() |
|
1090 | 1090 | if 'branch' not in self._extra: |
|
1091 | 1091 | try: |
|
1092 | 1092 | branch = encoding.fromlocal(self._repo.dirstate.branch()) |
|
1093 | 1093 | except UnicodeDecodeError: |
|
1094 | 1094 | raise error.Abort(_('branch name not in UTF-8!')) |
|
1095 | 1095 | self._extra['branch'] = branch |
|
1096 | 1096 | if self._extra['branch'] == '': |
|
1097 | 1097 | self._extra['branch'] = 'default' |
|
1098 | 1098 | |
|
1099 | 1099 | def __bytes__(self): |
|
1100 | 1100 | return bytes(self._parents[0]) + "+" |
|
1101 | 1101 | |
|
1102 | 1102 | __str__ = encoding.strmethod(__bytes__) |
|
1103 | 1103 | |
|
1104 | 1104 | def __nonzero__(self): |
|
1105 | 1105 | return True |
|
1106 | 1106 | |
|
1107 | 1107 | __bool__ = __nonzero__ |
|
1108 | 1108 | |
|
1109 | 1109 | def _buildflagfunc(self): |
|
1110 | 1110 | # Create a fallback function for getting file flags when the |
|
1111 | 1111 | # filesystem doesn't support them |
|
1112 | 1112 | |
|
1113 | 1113 | copiesget = self._repo.dirstate.copies().get |
|
1114 | 1114 | parents = self.parents() |
|
1115 | 1115 | if len(parents) < 2: |
|
1116 | 1116 | # when we have one parent, it's easy: copy from parent |
|
1117 | 1117 | man = parents[0].manifest() |
|
1118 | 1118 | def func(f): |
|
1119 | 1119 | f = copiesget(f, f) |
|
1120 | 1120 | return man.flags(f) |
|
1121 | 1121 | else: |
|
1122 | 1122 | # merges are tricky: we try to reconstruct the unstored |
|
1123 | 1123 | # result from the merge (issue1802) |
|
1124 | 1124 | p1, p2 = parents |
|
1125 | 1125 | pa = p1.ancestor(p2) |
|
1126 | 1126 | m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest() |
|
1127 | 1127 | |
|
1128 | 1128 | def func(f): |
|
1129 | 1129 | f = copiesget(f, f) # may be wrong for merges with copies |
|
1130 | 1130 | fl1, fl2, fla = m1.flags(f), m2.flags(f), ma.flags(f) |
|
1131 | 1131 | if fl1 == fl2: |
|
1132 | 1132 | return fl1 |
|
1133 | 1133 | if fl1 == fla: |
|
1134 | 1134 | return fl2 |
|
1135 | 1135 | if fl2 == fla: |
|
1136 | 1136 | return fl1 |
|
1137 | 1137 | return '' # punt for conflicts |
|
1138 | 1138 | |
|
1139 | 1139 | return func |
|
1140 | 1140 | |
|
1141 | 1141 | @propertycache |
|
1142 | 1142 | def _flagfunc(self): |
|
1143 | 1143 | return self._repo.dirstate.flagfunc(self._buildflagfunc) |
|
1144 | 1144 | |
|
1145 | 1145 | @propertycache |
|
1146 | 1146 | def _status(self): |
|
1147 | 1147 | return self._repo.status() |
|
1148 | 1148 | |
|
1149 | 1149 | @propertycache |
|
1150 | 1150 | def _user(self): |
|
1151 | 1151 | return self._repo.ui.username() |
|
1152 | 1152 | |
|
1153 | 1153 | @propertycache |
|
1154 | 1154 | def _date(self): |
|
1155 | 1155 | ui = self._repo.ui |
|
1156 | 1156 | date = ui.configdate('devel', 'default-date') |
|
1157 | 1157 | if date is None: |
|
1158 | 1158 | date = dateutil.makedate() |
|
1159 | 1159 | return date |
|
1160 | 1160 | |
|
1161 | 1161 | def subrev(self, subpath): |
|
1162 | 1162 | return None |
|
1163 | 1163 | |
|
1164 | 1164 | def manifestnode(self): |
|
1165 | 1165 | return None |
|
1166 | 1166 | def user(self): |
|
1167 | 1167 | return self._user or self._repo.ui.username() |
|
1168 | 1168 | def date(self): |
|
1169 | 1169 | return self._date |
|
1170 | 1170 | def description(self): |
|
1171 | 1171 | return self._text |
|
1172 | 1172 | def files(self): |
|
1173 | 1173 | return sorted(self._status.modified + self._status.added + |
|
1174 | 1174 | self._status.removed) |
|
1175 | 1175 | |
|
1176 | 1176 | def modified(self): |
|
1177 | 1177 | return self._status.modified |
|
1178 | 1178 | def added(self): |
|
1179 | 1179 | return self._status.added |
|
1180 | 1180 | def removed(self): |
|
1181 | 1181 | return self._status.removed |
|
1182 | 1182 | def deleted(self): |
|
1183 | 1183 | return self._status.deleted |
|
1184 | 1184 | def branch(self): |
|
1185 | 1185 | return encoding.tolocal(self._extra['branch']) |
|
1186 | 1186 | def closesbranch(self): |
|
1187 | 1187 | return 'close' in self._extra |
|
1188 | 1188 | def extra(self): |
|
1189 | 1189 | return self._extra |
|
1190 | 1190 | |
|
1191 | 1191 | def isinmemory(self): |
|
1192 | 1192 | return False |
|
1193 | 1193 | |
|
1194 | 1194 | def tags(self): |
|
1195 | 1195 | return [] |
|
1196 | 1196 | |
|
1197 | 1197 | def bookmarks(self): |
|
1198 | 1198 | b = [] |
|
1199 | 1199 | for p in self.parents(): |
|
1200 | 1200 | b.extend(p.bookmarks()) |
|
1201 | 1201 | return b |
|
1202 | 1202 | |
|
1203 | 1203 | def phase(self): |
|
1204 | 1204 | phase = phases.draft # default phase to draft |
|
1205 | 1205 | for p in self.parents(): |
|
1206 | 1206 | phase = max(phase, p.phase()) |
|
1207 | 1207 | return phase |
|
1208 | 1208 | |
|
1209 | 1209 | def hidden(self): |
|
1210 | 1210 | return False |
|
1211 | 1211 | |
|
1212 | 1212 | def children(self): |
|
1213 | 1213 | return [] |
|
1214 | 1214 | |
|
1215 | 1215 | def flags(self, path): |
|
1216 | 1216 | if r'_manifest' in self.__dict__: |
|
1217 | 1217 | try: |
|
1218 | 1218 | return self._manifest.flags(path) |
|
1219 | 1219 | except KeyError: |
|
1220 | 1220 | return '' |
|
1221 | 1221 | |
|
1222 | 1222 | try: |
|
1223 | 1223 | return self._flagfunc(path) |
|
1224 | 1224 | except OSError: |
|
1225 | 1225 | return '' |
|
1226 | 1226 | |
|
1227 | 1227 | def ancestor(self, c2): |
|
1228 | 1228 | """return the "best" ancestor context of self and c2""" |
|
1229 | 1229 | return self._parents[0].ancestor(c2) # punt on two parents for now |
|
1230 | 1230 | |
|
1231 | 1231 | def walk(self, match): |
|
1232 | 1232 | '''Generates matching file names.''' |
|
1233 | 1233 | return sorted(self._repo.dirstate.walk(match, |
|
1234 | 1234 | subrepos=sorted(self.substate), |
|
1235 | 1235 | unknown=True, ignored=False)) |
|
1236 | 1236 | |
|
1237 | 1237 | def matches(self, match): |
|
1238 | 1238 | ds = self._repo.dirstate |
|
1239 | 1239 | return sorted(f for f in ds.matches(match) if ds[f] != 'r') |
|
1240 | 1240 | |
|
1241 | 1241 | def ancestors(self): |
|
1242 | 1242 | for p in self._parents: |
|
1243 | 1243 | yield p |
|
1244 | 1244 | for a in self._repo.changelog.ancestors( |
|
1245 | 1245 | [p.rev() for p in self._parents]): |
|
1246 | 1246 | yield changectx(self._repo, a) |
|
1247 | 1247 | |
|
1248 | 1248 | def markcommitted(self, node): |
|
1249 | 1249 | """Perform post-commit cleanup necessary after committing this ctx |
|
1250 | 1250 | |
|
1251 | 1251 | Specifically, this updates backing stores this working context |
|
1252 | 1252 | wraps to reflect the fact that the changes reflected by this |
|
1253 | 1253 | workingctx have been committed. For example, it marks |
|
1254 | 1254 | modified and added files as normal in the dirstate. |
|
1255 | 1255 | |
|
1256 | 1256 | """ |
|
1257 | 1257 | |
|
1258 | 1258 | with self._repo.dirstate.parentchange(): |
|
1259 | 1259 | for f in self.modified() + self.added(): |
|
1260 | 1260 | self._repo.dirstate.normal(f) |
|
1261 | 1261 | for f in self.removed(): |
|
1262 | 1262 | self._repo.dirstate.drop(f) |
|
1263 | 1263 | self._repo.dirstate.setparents(node) |
|
1264 | 1264 | |
|
1265 | 1265 | # write changes out explicitly, because nesting wlock at |
|
1266 | 1266 | # runtime may prevent 'wlock.release()' in 'repo.commit()' |
|
1267 | 1267 | # from immediately doing so for subsequent changing files |
|
1268 | 1268 | self._repo.dirstate.write(self._repo.currenttransaction()) |
|
1269 | 1269 | |
|
1270 | 1270 | def dirty(self, missing=False, merge=True, branch=True): |
|
1271 | 1271 | return False |
|
1272 | 1272 | |
|
1273 | 1273 | class workingctx(committablectx): |
|
1274 | 1274 | """A workingctx object makes access to data related to |
|
1275 | 1275 | the current working directory convenient. |
|
1276 | 1276 | date - any valid date string or (unixtime, offset), or None. |
|
1277 | 1277 | user - username string, or None. |
|
1278 | 1278 | extra - a dictionary of extra values, or None. |
|
1279 | 1279 | changes - a list of file lists as returned by localrepo.status() |
|
1280 | 1280 | or None to use the repository status. |
|
1281 | 1281 | """ |
|
1282 | 1282 | def __init__(self, repo, text="", user=None, date=None, extra=None, |
|
1283 | 1283 | changes=None): |
|
1284 | 1284 | super(workingctx, self).__init__(repo, text, user, date, extra, changes) |
|
1285 | 1285 | |
|
1286 | 1286 | def __iter__(self): |
|
1287 | 1287 | d = self._repo.dirstate |
|
1288 | 1288 | for f in d: |
|
1289 | 1289 | if d[f] != 'r': |
|
1290 | 1290 | yield f |
|
1291 | 1291 | |
|
1292 | 1292 | def __contains__(self, key): |
|
1293 | 1293 | return self._repo.dirstate[key] not in "?r" |
|
1294 | 1294 | |
|
1295 | 1295 | def hex(self): |
|
1296 | 1296 | return hex(wdirid) |
|
1297 | 1297 | |
|
1298 | 1298 | @propertycache |
|
1299 | 1299 | def _parents(self): |
|
1300 | 1300 | p = self._repo.dirstate.parents() |
|
1301 | 1301 | if p[1] == nullid: |
|
1302 | 1302 | p = p[:-1] |
|
1303 | 1303 | return [changectx(self._repo, x) for x in p] |
|
1304 | 1304 | |
|
1305 | 1305 | def _fileinfo(self, path): |
|
1306 | 1306 | # populate __dict__['_manifest'] as workingctx has no _manifestdelta |
|
1307 | 1307 | self._manifest |
|
1308 | 1308 | return super(workingctx, self)._fileinfo(path) |
|
1309 | 1309 | |
|
1310 | 1310 | def filectx(self, path, filelog=None): |
|
1311 | 1311 | """get a file context from the working directory""" |
|
1312 | 1312 | return workingfilectx(self._repo, path, workingctx=self, |
|
1313 | 1313 | filelog=filelog) |
|
1314 | 1314 | |
|
1315 | 1315 | def dirty(self, missing=False, merge=True, branch=True): |
|
1316 | 1316 | "check whether a working directory is modified" |
|
1317 | 1317 | # check subrepos first |
|
1318 | 1318 | for s in sorted(self.substate): |
|
1319 | 1319 | if self.sub(s).dirty(missing=missing): |
|
1320 | 1320 | return True |
|
1321 | 1321 | # check current working dir |
|
1322 | 1322 | return ((merge and self.p2()) or |
|
1323 | 1323 | (branch and self.branch() != self.p1().branch()) or |
|
1324 | 1324 | self.modified() or self.added() or self.removed() or |
|
1325 | 1325 | (missing and self.deleted())) |
|
1326 | 1326 | |
|
1327 | 1327 | def add(self, list, prefix=""): |
|
1328 | 1328 | with self._repo.wlock(): |
|
1329 | 1329 | ui, ds = self._repo.ui, self._repo.dirstate |
|
1330 | 1330 | uipath = lambda f: ds.pathto(pathutil.join(prefix, f)) |
|
1331 | 1331 | rejected = [] |
|
1332 | 1332 | lstat = self._repo.wvfs.lstat |
|
1333 | 1333 | for f in list: |
|
1334 | 1334 | # ds.pathto() returns an absolute file when this is invoked from |
|
1335 | 1335 | # the keyword extension. That gets flagged as non-portable on |
|
1336 | 1336 | # Windows, since it contains the drive letter and colon. |
|
1337 | 1337 | scmutil.checkportable(ui, os.path.join(prefix, f)) |
|
1338 | 1338 | try: |
|
1339 | 1339 | st = lstat(f) |
|
1340 | 1340 | except OSError: |
|
1341 | 1341 | ui.warn(_("%s does not exist!\n") % uipath(f)) |
|
1342 | 1342 | rejected.append(f) |
|
1343 | 1343 | continue |
|
1344 | if st.st_size > 10000000: | |
|
1344 | limit = ui.configbytes('ui', 'large-file-limit') | |
|
1345 | if limit != 0 and st.st_size > limit: | |
|
1345 | 1346 | ui.warn(_("%s: up to %d MB of RAM may be required " |
|
1346 | 1347 | "to manage this file\n" |
|
1347 | 1348 | "(use 'hg revert %s' to cancel the " |
|
1348 | 1349 | "pending addition)\n") |
|
1349 | 1350 | % (f, 3 * st.st_size // 1000000, uipath(f))) |
|
1350 | 1351 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): |
|
1351 | 1352 | ui.warn(_("%s not added: only files and symlinks " |
|
1352 | 1353 | "supported currently\n") % uipath(f)) |
|
1353 | 1354 | rejected.append(f) |
|
1354 | 1355 | elif ds[f] in 'amn': |
|
1355 | 1356 | ui.warn(_("%s already tracked!\n") % uipath(f)) |
|
1356 | 1357 | elif ds[f] == 'r': |
|
1357 | 1358 | ds.normallookup(f) |
|
1358 | 1359 | else: |
|
1359 | 1360 | ds.add(f) |
|
1360 | 1361 | return rejected |
|
1361 | 1362 | |
|
1362 | 1363 | def forget(self, files, prefix=""): |
|
1363 | 1364 | with self._repo.wlock(): |
|
1364 | 1365 | ds = self._repo.dirstate |
|
1365 | 1366 | uipath = lambda f: ds.pathto(pathutil.join(prefix, f)) |
|
1366 | 1367 | rejected = [] |
|
1367 | 1368 | for f in files: |
|
1368 | 1369 | if f not in self._repo.dirstate: |
|
1369 | 1370 | self._repo.ui.warn(_("%s not tracked!\n") % uipath(f)) |
|
1370 | 1371 | rejected.append(f) |
|
1371 | 1372 | elif self._repo.dirstate[f] != 'a': |
|
1372 | 1373 | self._repo.dirstate.remove(f) |
|
1373 | 1374 | else: |
|
1374 | 1375 | self._repo.dirstate.drop(f) |
|
1375 | 1376 | return rejected |
|
1376 | 1377 | |
|
1377 | 1378 | def undelete(self, list): |
|
1378 | 1379 | pctxs = self.parents() |
|
1379 | 1380 | with self._repo.wlock(): |
|
1380 | 1381 | ds = self._repo.dirstate |
|
1381 | 1382 | for f in list: |
|
1382 | 1383 | if self._repo.dirstate[f] != 'r': |
|
1383 | 1384 | self._repo.ui.warn(_("%s not removed!\n") % ds.pathto(f)) |
|
1384 | 1385 | else: |
|
1385 | 1386 | fctx = f in pctxs[0] and pctxs[0][f] or pctxs[1][f] |
|
1386 | 1387 | t = fctx.data() |
|
1387 | 1388 | self._repo.wwrite(f, t, fctx.flags()) |
|
1388 | 1389 | self._repo.dirstate.normal(f) |
|
1389 | 1390 | |
|
1390 | 1391 | def copy(self, source, dest): |
|
1391 | 1392 | try: |
|
1392 | 1393 | st = self._repo.wvfs.lstat(dest) |
|
1393 | 1394 | except OSError as err: |
|
1394 | 1395 | if err.errno != errno.ENOENT: |
|
1395 | 1396 | raise |
|
1396 | 1397 | self._repo.ui.warn(_("%s does not exist!\n") |
|
1397 | 1398 | % self._repo.dirstate.pathto(dest)) |
|
1398 | 1399 | return |
|
1399 | 1400 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): |
|
1400 | 1401 | self._repo.ui.warn(_("copy failed: %s is not a file or a " |
|
1401 | 1402 | "symbolic link\n") |
|
1402 | 1403 | % self._repo.dirstate.pathto(dest)) |
|
1403 | 1404 | else: |
|
1404 | 1405 | with self._repo.wlock(): |
|
1405 | 1406 | if self._repo.dirstate[dest] in '?': |
|
1406 | 1407 | self._repo.dirstate.add(dest) |
|
1407 | 1408 | elif self._repo.dirstate[dest] in 'r': |
|
1408 | 1409 | self._repo.dirstate.normallookup(dest) |
|
1409 | 1410 | self._repo.dirstate.copy(source, dest) |
|
1410 | 1411 | |
|
1411 | 1412 | def match(self, pats=None, include=None, exclude=None, default='glob', |
|
1412 | 1413 | listsubrepos=False, badfn=None): |
|
1413 | 1414 | r = self._repo |
|
1414 | 1415 | |
|
1415 | 1416 | # Only a case insensitive filesystem needs magic to translate user input |
|
1416 | 1417 | # to actual case in the filesystem. |
|
1417 | 1418 | icasefs = not util.fscasesensitive(r.root) |
|
1418 | 1419 | return matchmod.match(r.root, r.getcwd(), pats, include, exclude, |
|
1419 | 1420 | default, auditor=r.auditor, ctx=self, |
|
1420 | 1421 | listsubrepos=listsubrepos, badfn=badfn, |
|
1421 | 1422 | icasefs=icasefs) |
|
1422 | 1423 | |
|
1423 | 1424 | def _filtersuspectsymlink(self, files): |
|
1424 | 1425 | if not files or self._repo.dirstate._checklink: |
|
1425 | 1426 | return files |
|
1426 | 1427 | |
|
1427 | 1428 | # Symlink placeholders may get non-symlink-like contents |
|
1428 | 1429 | # via user error or dereferencing by NFS or Samba servers, |
|
1429 | 1430 | # so we filter out any placeholders that don't look like a |
|
1430 | 1431 | # symlink |
|
1431 | 1432 | sane = [] |
|
1432 | 1433 | for f in files: |
|
1433 | 1434 | if self.flags(f) == 'l': |
|
1434 | 1435 | d = self[f].data() |
|
1435 | 1436 | if (d == '' or len(d) >= 1024 or '\n' in d |
|
1436 | 1437 | or stringutil.binary(d)): |
|
1437 | 1438 | self._repo.ui.debug('ignoring suspect symlink placeholder' |
|
1438 | 1439 | ' "%s"\n' % f) |
|
1439 | 1440 | continue |
|
1440 | 1441 | sane.append(f) |
|
1441 | 1442 | return sane |
|
1442 | 1443 | |
|
1443 | 1444 | def _checklookup(self, files): |
|
1444 | 1445 | # check for any possibly clean files |
|
1445 | 1446 | if not files: |
|
1446 | 1447 | return [], [], [] |
|
1447 | 1448 | |
|
1448 | 1449 | modified = [] |
|
1449 | 1450 | deleted = [] |
|
1450 | 1451 | fixup = [] |
|
1451 | 1452 | pctx = self._parents[0] |
|
1452 | 1453 | # do a full compare of any files that might have changed |
|
1453 | 1454 | for f in sorted(files): |
|
1454 | 1455 | try: |
|
1455 | 1456 | # This will return True for a file that got replaced by a |
|
1456 | 1457 | # directory in the interim, but fixing that is pretty hard. |
|
1457 | 1458 | if (f not in pctx or self.flags(f) != pctx.flags(f) |
|
1458 | 1459 | or pctx[f].cmp(self[f])): |
|
1459 | 1460 | modified.append(f) |
|
1460 | 1461 | else: |
|
1461 | 1462 | fixup.append(f) |
|
1462 | 1463 | except (IOError, OSError): |
|
1463 | 1464 | # A file become inaccessible in between? Mark it as deleted, |
|
1464 | 1465 | # matching dirstate behavior (issue5584). |
|
1465 | 1466 | # The dirstate has more complex behavior around whether a |
|
1466 | 1467 | # missing file matches a directory, etc, but we don't need to |
|
1467 | 1468 | # bother with that: if f has made it to this point, we're sure |
|
1468 | 1469 | # it's in the dirstate. |
|
1469 | 1470 | deleted.append(f) |
|
1470 | 1471 | |
|
1471 | 1472 | return modified, deleted, fixup |
|
1472 | 1473 | |
|
1473 | 1474 | def _poststatusfixup(self, status, fixup): |
|
1474 | 1475 | """update dirstate for files that are actually clean""" |
|
1475 | 1476 | poststatus = self._repo.postdsstatus() |
|
1476 | 1477 | if fixup or poststatus: |
|
1477 | 1478 | try: |
|
1478 | 1479 | oldid = self._repo.dirstate.identity() |
|
1479 | 1480 | |
|
1480 | 1481 | # updating the dirstate is optional |
|
1481 | 1482 | # so we don't wait on the lock |
|
1482 | 1483 | # wlock can invalidate the dirstate, so cache normal _after_ |
|
1483 | 1484 | # taking the lock |
|
1484 | 1485 | with self._repo.wlock(False): |
|
1485 | 1486 | if self._repo.dirstate.identity() == oldid: |
|
1486 | 1487 | if fixup: |
|
1487 | 1488 | normal = self._repo.dirstate.normal |
|
1488 | 1489 | for f in fixup: |
|
1489 | 1490 | normal(f) |
|
1490 | 1491 | # write changes out explicitly, because nesting |
|
1491 | 1492 | # wlock at runtime may prevent 'wlock.release()' |
|
1492 | 1493 | # after this block from doing so for subsequent |
|
1493 | 1494 | # changing files |
|
1494 | 1495 | tr = self._repo.currenttransaction() |
|
1495 | 1496 | self._repo.dirstate.write(tr) |
|
1496 | 1497 | |
|
1497 | 1498 | if poststatus: |
|
1498 | 1499 | for ps in poststatus: |
|
1499 | 1500 | ps(self, status) |
|
1500 | 1501 | else: |
|
1501 | 1502 | # in this case, writing changes out breaks |
|
1502 | 1503 | # consistency, because .hg/dirstate was |
|
1503 | 1504 | # already changed simultaneously after last |
|
1504 | 1505 | # caching (see also issue5584 for detail) |
|
1505 | 1506 | self._repo.ui.debug('skip updating dirstate: ' |
|
1506 | 1507 | 'identity mismatch\n') |
|
1507 | 1508 | except error.LockError: |
|
1508 | 1509 | pass |
|
1509 | 1510 | finally: |
|
1510 | 1511 | # Even if the wlock couldn't be grabbed, clear out the list. |
|
1511 | 1512 | self._repo.clearpostdsstatus() |
|
1512 | 1513 | |
|
1513 | 1514 | def _dirstatestatus(self, match, ignored=False, clean=False, unknown=False): |
|
1514 | 1515 | '''Gets the status from the dirstate -- internal use only.''' |
|
1515 | 1516 | subrepos = [] |
|
1516 | 1517 | if '.hgsub' in self: |
|
1517 | 1518 | subrepos = sorted(self.substate) |
|
1518 | 1519 | cmp, s = self._repo.dirstate.status(match, subrepos, ignored=ignored, |
|
1519 | 1520 | clean=clean, unknown=unknown) |
|
1520 | 1521 | |
|
1521 | 1522 | # check for any possibly clean files |
|
1522 | 1523 | fixup = [] |
|
1523 | 1524 | if cmp: |
|
1524 | 1525 | modified2, deleted2, fixup = self._checklookup(cmp) |
|
1525 | 1526 | s.modified.extend(modified2) |
|
1526 | 1527 | s.deleted.extend(deleted2) |
|
1527 | 1528 | |
|
1528 | 1529 | if fixup and clean: |
|
1529 | 1530 | s.clean.extend(fixup) |
|
1530 | 1531 | |
|
1531 | 1532 | self._poststatusfixup(s, fixup) |
|
1532 | 1533 | |
|
1533 | 1534 | if match.always(): |
|
1534 | 1535 | # cache for performance |
|
1535 | 1536 | if s.unknown or s.ignored or s.clean: |
|
1536 | 1537 | # "_status" is cached with list*=False in the normal route |
|
1537 | 1538 | self._status = scmutil.status(s.modified, s.added, s.removed, |
|
1538 | 1539 | s.deleted, [], [], []) |
|
1539 | 1540 | else: |
|
1540 | 1541 | self._status = s |
|
1541 | 1542 | |
|
1542 | 1543 | return s |
|
1543 | 1544 | |
|
1544 | 1545 | @propertycache |
|
1545 | 1546 | def _manifest(self): |
|
1546 | 1547 | """generate a manifest corresponding to the values in self._status |
|
1547 | 1548 | |
|
1548 | 1549 | This reuse the file nodeid from parent, but we use special node |
|
1549 | 1550 | identifiers for added and modified files. This is used by manifests |
|
1550 | 1551 | merge to see that files are different and by update logic to avoid |
|
1551 | 1552 | deleting newly added files. |
|
1552 | 1553 | """ |
|
1553 | 1554 | return self._buildstatusmanifest(self._status) |
|
1554 | 1555 | |
|
1555 | 1556 | def _buildstatusmanifest(self, status): |
|
1556 | 1557 | """Builds a manifest that includes the given status results.""" |
|
1557 | 1558 | parents = self.parents() |
|
1558 | 1559 | |
|
1559 | 1560 | man = parents[0].manifest().copy() |
|
1560 | 1561 | |
|
1561 | 1562 | ff = self._flagfunc |
|
1562 | 1563 | for i, l in ((addednodeid, status.added), |
|
1563 | 1564 | (modifiednodeid, status.modified)): |
|
1564 | 1565 | for f in l: |
|
1565 | 1566 | man[f] = i |
|
1566 | 1567 | try: |
|
1567 | 1568 | man.setflag(f, ff(f)) |
|
1568 | 1569 | except OSError: |
|
1569 | 1570 | pass |
|
1570 | 1571 | |
|
1571 | 1572 | for f in status.deleted + status.removed: |
|
1572 | 1573 | if f in man: |
|
1573 | 1574 | del man[f] |
|
1574 | 1575 | |
|
1575 | 1576 | return man |
|
1576 | 1577 | |
|
1577 | 1578 | def _buildstatus(self, other, s, match, listignored, listclean, |
|
1578 | 1579 | listunknown): |
|
1579 | 1580 | """build a status with respect to another context |
|
1580 | 1581 | |
|
1581 | 1582 | This includes logic for maintaining the fast path of status when |
|
1582 | 1583 | comparing the working directory against its parent, which is to skip |
|
1583 | 1584 | building a new manifest if self (working directory) is not comparing |
|
1584 | 1585 | against its parent (repo['.']). |
|
1585 | 1586 | """ |
|
1586 | 1587 | s = self._dirstatestatus(match, listignored, listclean, listunknown) |
|
1587 | 1588 | # Filter out symlinks that, in the case of FAT32 and NTFS filesystems, |
|
1588 | 1589 | # might have accidentally ended up with the entire contents of the file |
|
1589 | 1590 | # they are supposed to be linking to. |
|
1590 | 1591 | s.modified[:] = self._filtersuspectsymlink(s.modified) |
|
1591 | 1592 | if other != self._repo['.']: |
|
1592 | 1593 | s = super(workingctx, self)._buildstatus(other, s, match, |
|
1593 | 1594 | listignored, listclean, |
|
1594 | 1595 | listunknown) |
|
1595 | 1596 | return s |
|
1596 | 1597 | |
|
1597 | 1598 | def _matchstatus(self, other, match): |
|
1598 | 1599 | """override the match method with a filter for directory patterns |
|
1599 | 1600 | |
|
1600 | 1601 | We use inheritance to customize the match.bad method only in cases of |
|
1601 | 1602 | workingctx since it belongs only to the working directory when |
|
1602 | 1603 | comparing against the parent changeset. |
|
1603 | 1604 | |
|
1604 | 1605 | If we aren't comparing against the working directory's parent, then we |
|
1605 | 1606 | just use the default match object sent to us. |
|
1606 | 1607 | """ |
|
1607 | 1608 | if other != self._repo['.']: |
|
1608 | 1609 | def bad(f, msg): |
|
1609 | 1610 | # 'f' may be a directory pattern from 'match.files()', |
|
1610 | 1611 | # so 'f not in ctx1' is not enough |
|
1611 | 1612 | if f not in other and not other.hasdir(f): |
|
1612 | 1613 | self._repo.ui.warn('%s: %s\n' % |
|
1613 | 1614 | (self._repo.dirstate.pathto(f), msg)) |
|
1614 | 1615 | match.bad = bad |
|
1615 | 1616 | return match |
|
1616 | 1617 | |
|
1617 | 1618 | def markcommitted(self, node): |
|
1618 | 1619 | super(workingctx, self).markcommitted(node) |
|
1619 | 1620 | |
|
1620 | 1621 | sparse.aftercommit(self._repo, node) |
|
1621 | 1622 | |
|
1622 | 1623 | class committablefilectx(basefilectx): |
|
1623 | 1624 | """A committablefilectx provides common functionality for a file context |
|
1624 | 1625 | that wants the ability to commit, e.g. workingfilectx or memfilectx.""" |
|
1625 | 1626 | def __init__(self, repo, path, filelog=None, ctx=None): |
|
1626 | 1627 | self._repo = repo |
|
1627 | 1628 | self._path = path |
|
1628 | 1629 | self._changeid = None |
|
1629 | 1630 | self._filerev = self._filenode = None |
|
1630 | 1631 | |
|
1631 | 1632 | if filelog is not None: |
|
1632 | 1633 | self._filelog = filelog |
|
1633 | 1634 | if ctx: |
|
1634 | 1635 | self._changectx = ctx |
|
1635 | 1636 | |
|
1636 | 1637 | def __nonzero__(self): |
|
1637 | 1638 | return True |
|
1638 | 1639 | |
|
1639 | 1640 | __bool__ = __nonzero__ |
|
1640 | 1641 | |
|
1641 | 1642 | def linkrev(self): |
|
1642 | 1643 | # linked to self._changectx no matter if file is modified or not |
|
1643 | 1644 | return self.rev() |
|
1644 | 1645 | |
|
1645 | 1646 | def parents(self): |
|
1646 | 1647 | '''return parent filectxs, following copies if necessary''' |
|
1647 | 1648 | def filenode(ctx, path): |
|
1648 | 1649 | return ctx._manifest.get(path, nullid) |
|
1649 | 1650 | |
|
1650 | 1651 | path = self._path |
|
1651 | 1652 | fl = self._filelog |
|
1652 | 1653 | pcl = self._changectx._parents |
|
1653 | 1654 | renamed = self.renamed() |
|
1654 | 1655 | |
|
1655 | 1656 | if renamed: |
|
1656 | 1657 | pl = [renamed + (None,)] |
|
1657 | 1658 | else: |
|
1658 | 1659 | pl = [(path, filenode(pcl[0], path), fl)] |
|
1659 | 1660 | |
|
1660 | 1661 | for pc in pcl[1:]: |
|
1661 | 1662 | pl.append((path, filenode(pc, path), fl)) |
|
1662 | 1663 | |
|
1663 | 1664 | return [self._parentfilectx(p, fileid=n, filelog=l) |
|
1664 | 1665 | for p, n, l in pl if n != nullid] |
|
1665 | 1666 | |
|
1666 | 1667 | def children(self): |
|
1667 | 1668 | return [] |
|
1668 | 1669 | |
|
1669 | 1670 | class workingfilectx(committablefilectx): |
|
1670 | 1671 | """A workingfilectx object makes access to data related to a particular |
|
1671 | 1672 | file in the working directory convenient.""" |
|
1672 | 1673 | def __init__(self, repo, path, filelog=None, workingctx=None): |
|
1673 | 1674 | super(workingfilectx, self).__init__(repo, path, filelog, workingctx) |
|
1674 | 1675 | |
|
1675 | 1676 | @propertycache |
|
1676 | 1677 | def _changectx(self): |
|
1677 | 1678 | return workingctx(self._repo) |
|
1678 | 1679 | |
|
1679 | 1680 | def data(self): |
|
1680 | 1681 | return self._repo.wread(self._path) |
|
1681 | 1682 | def renamed(self): |
|
1682 | 1683 | rp = self._repo.dirstate.copied(self._path) |
|
1683 | 1684 | if not rp: |
|
1684 | 1685 | return None |
|
1685 | 1686 | return rp, self._changectx._parents[0]._manifest.get(rp, nullid) |
|
1686 | 1687 | |
|
1687 | 1688 | def size(self): |
|
1688 | 1689 | return self._repo.wvfs.lstat(self._path).st_size |
|
1689 | 1690 | def date(self): |
|
1690 | 1691 | t, tz = self._changectx.date() |
|
1691 | 1692 | try: |
|
1692 | 1693 | return (self._repo.wvfs.lstat(self._path)[stat.ST_MTIME], tz) |
|
1693 | 1694 | except OSError as err: |
|
1694 | 1695 | if err.errno != errno.ENOENT: |
|
1695 | 1696 | raise |
|
1696 | 1697 | return (t, tz) |
|
1697 | 1698 | |
|
1698 | 1699 | def exists(self): |
|
1699 | 1700 | return self._repo.wvfs.exists(self._path) |
|
1700 | 1701 | |
|
1701 | 1702 | def lexists(self): |
|
1702 | 1703 | return self._repo.wvfs.lexists(self._path) |
|
1703 | 1704 | |
|
1704 | 1705 | def audit(self): |
|
1705 | 1706 | return self._repo.wvfs.audit(self._path) |
|
1706 | 1707 | |
|
1707 | 1708 | def cmp(self, fctx): |
|
1708 | 1709 | """compare with other file context |
|
1709 | 1710 | |
|
1710 | 1711 | returns True if different than fctx. |
|
1711 | 1712 | """ |
|
1712 | 1713 | # fctx should be a filectx (not a workingfilectx) |
|
1713 | 1714 | # invert comparison to reuse the same code path |
|
1714 | 1715 | return fctx.cmp(self) |
|
1715 | 1716 | |
|
1716 | 1717 | def remove(self, ignoremissing=False): |
|
1717 | 1718 | """wraps unlink for a repo's working directory""" |
|
1718 | 1719 | rmdir = self._repo.ui.configbool('experimental', 'removeemptydirs') |
|
1719 | 1720 | self._repo.wvfs.unlinkpath(self._path, ignoremissing=ignoremissing, |
|
1720 | 1721 | rmdir=rmdir) |
|
1721 | 1722 | |
|
1722 | 1723 | def write(self, data, flags, backgroundclose=False, **kwargs): |
|
1723 | 1724 | """wraps repo.wwrite""" |
|
1724 | 1725 | self._repo.wwrite(self._path, data, flags, |
|
1725 | 1726 | backgroundclose=backgroundclose, |
|
1726 | 1727 | **kwargs) |
|
1727 | 1728 | |
|
1728 | 1729 | def markcopied(self, src): |
|
1729 | 1730 | """marks this file a copy of `src`""" |
|
1730 | 1731 | if self._repo.dirstate[self._path] in "nma": |
|
1731 | 1732 | self._repo.dirstate.copy(src, self._path) |
|
1732 | 1733 | |
|
1733 | 1734 | def clearunknown(self): |
|
1734 | 1735 | """Removes conflicting items in the working directory so that |
|
1735 | 1736 | ``write()`` can be called successfully. |
|
1736 | 1737 | """ |
|
1737 | 1738 | wvfs = self._repo.wvfs |
|
1738 | 1739 | f = self._path |
|
1739 | 1740 | wvfs.audit(f) |
|
1740 | 1741 | if wvfs.isdir(f) and not wvfs.islink(f): |
|
1741 | 1742 | wvfs.rmtree(f, forcibly=True) |
|
1742 | 1743 | if self._repo.ui.configbool('experimental', 'merge.checkpathconflicts'): |
|
1743 | 1744 | for p in reversed(list(util.finddirs(f))): |
|
1744 | 1745 | if wvfs.isfileorlink(p): |
|
1745 | 1746 | wvfs.unlink(p) |
|
1746 | 1747 | break |
|
1747 | 1748 | |
|
1748 | 1749 | def setflags(self, l, x): |
|
1749 | 1750 | self._repo.wvfs.setflags(self._path, l, x) |
|
1750 | 1751 | |
|
1751 | 1752 | class overlayworkingctx(committablectx): |
|
1752 | 1753 | """Wraps another mutable context with a write-back cache that can be |
|
1753 | 1754 | converted into a commit context. |
|
1754 | 1755 | |
|
1755 | 1756 | self._cache[path] maps to a dict with keys: { |
|
1756 | 1757 | 'exists': bool? |
|
1757 | 1758 | 'date': date? |
|
1758 | 1759 | 'data': str? |
|
1759 | 1760 | 'flags': str? |
|
1760 | 1761 | 'copied': str? (path or None) |
|
1761 | 1762 | } |
|
1762 | 1763 | If `exists` is True, `flags` must be non-None and 'date' is non-None. If it |
|
1763 | 1764 | is `False`, the file was deleted. |
|
1764 | 1765 | """ |
|
1765 | 1766 | |
|
1766 | 1767 | def __init__(self, repo): |
|
1767 | 1768 | super(overlayworkingctx, self).__init__(repo) |
|
1768 | 1769 | self.clean() |
|
1769 | 1770 | |
|
1770 | 1771 | def setbase(self, wrappedctx): |
|
1771 | 1772 | self._wrappedctx = wrappedctx |
|
1772 | 1773 | self._parents = [wrappedctx] |
|
1773 | 1774 | # Drop old manifest cache as it is now out of date. |
|
1774 | 1775 | # This is necessary when, e.g., rebasing several nodes with one |
|
1775 | 1776 | # ``overlayworkingctx`` (e.g. with --collapse). |
|
1776 | 1777 | util.clearcachedproperty(self, '_manifest') |
|
1777 | 1778 | |
|
1778 | 1779 | def data(self, path): |
|
1779 | 1780 | if self.isdirty(path): |
|
1780 | 1781 | if self._cache[path]['exists']: |
|
1781 | 1782 | if self._cache[path]['data']: |
|
1782 | 1783 | return self._cache[path]['data'] |
|
1783 | 1784 | else: |
|
1784 | 1785 | # Must fallback here, too, because we only set flags. |
|
1785 | 1786 | return self._wrappedctx[path].data() |
|
1786 | 1787 | else: |
|
1787 | 1788 | raise error.ProgrammingError("No such file or directory: %s" % |
|
1788 | 1789 | path) |
|
1789 | 1790 | else: |
|
1790 | 1791 | return self._wrappedctx[path].data() |
|
1791 | 1792 | |
|
1792 | 1793 | @propertycache |
|
1793 | 1794 | def _manifest(self): |
|
1794 | 1795 | parents = self.parents() |
|
1795 | 1796 | man = parents[0].manifest().copy() |
|
1796 | 1797 | |
|
1797 | 1798 | flag = self._flagfunc |
|
1798 | 1799 | for path in self.added(): |
|
1799 | 1800 | man[path] = addednodeid |
|
1800 | 1801 | man.setflag(path, flag(path)) |
|
1801 | 1802 | for path in self.modified(): |
|
1802 | 1803 | man[path] = modifiednodeid |
|
1803 | 1804 | man.setflag(path, flag(path)) |
|
1804 | 1805 | for path in self.removed(): |
|
1805 | 1806 | del man[path] |
|
1806 | 1807 | return man |
|
1807 | 1808 | |
|
1808 | 1809 | @propertycache |
|
1809 | 1810 | def _flagfunc(self): |
|
1810 | 1811 | def f(path): |
|
1811 | 1812 | return self._cache[path]['flags'] |
|
1812 | 1813 | return f |
|
1813 | 1814 | |
|
1814 | 1815 | def files(self): |
|
1815 | 1816 | return sorted(self.added() + self.modified() + self.removed()) |
|
1816 | 1817 | |
|
1817 | 1818 | def modified(self): |
|
1818 | 1819 | return [f for f in self._cache.keys() if self._cache[f]['exists'] and |
|
1819 | 1820 | self._existsinparent(f)] |
|
1820 | 1821 | |
|
1821 | 1822 | def added(self): |
|
1822 | 1823 | return [f for f in self._cache.keys() if self._cache[f]['exists'] and |
|
1823 | 1824 | not self._existsinparent(f)] |
|
1824 | 1825 | |
|
1825 | 1826 | def removed(self): |
|
1826 | 1827 | return [f for f in self._cache.keys() if |
|
1827 | 1828 | not self._cache[f]['exists'] and self._existsinparent(f)] |
|
1828 | 1829 | |
|
1829 | 1830 | def isinmemory(self): |
|
1830 | 1831 | return True |
|
1831 | 1832 | |
|
1832 | 1833 | def filedate(self, path): |
|
1833 | 1834 | if self.isdirty(path): |
|
1834 | 1835 | return self._cache[path]['date'] |
|
1835 | 1836 | else: |
|
1836 | 1837 | return self._wrappedctx[path].date() |
|
1837 | 1838 | |
|
1838 | 1839 | def markcopied(self, path, origin): |
|
1839 | 1840 | if self.isdirty(path): |
|
1840 | 1841 | self._cache[path]['copied'] = origin |
|
1841 | 1842 | else: |
|
1842 | 1843 | raise error.ProgrammingError('markcopied() called on clean context') |
|
1843 | 1844 | |
|
1844 | 1845 | def copydata(self, path): |
|
1845 | 1846 | if self.isdirty(path): |
|
1846 | 1847 | return self._cache[path]['copied'] |
|
1847 | 1848 | else: |
|
1848 | 1849 | raise error.ProgrammingError('copydata() called on clean context') |
|
1849 | 1850 | |
|
1850 | 1851 | def flags(self, path): |
|
1851 | 1852 | if self.isdirty(path): |
|
1852 | 1853 | if self._cache[path]['exists']: |
|
1853 | 1854 | return self._cache[path]['flags'] |
|
1854 | 1855 | else: |
|
1855 | 1856 | raise error.ProgrammingError("No such file or directory: %s" % |
|
1856 | 1857 | self._path) |
|
1857 | 1858 | else: |
|
1858 | 1859 | return self._wrappedctx[path].flags() |
|
1859 | 1860 | |
|
1860 | 1861 | def _existsinparent(self, path): |
|
1861 | 1862 | try: |
|
1862 | 1863 | # ``commitctx` raises a ``ManifestLookupError`` if a path does not |
|
1863 | 1864 | # exist, unlike ``workingctx``, which returns a ``workingfilectx`` |
|
1864 | 1865 | # with an ``exists()`` function. |
|
1865 | 1866 | self._wrappedctx[path] |
|
1866 | 1867 | return True |
|
1867 | 1868 | except error.ManifestLookupError: |
|
1868 | 1869 | return False |
|
1869 | 1870 | |
|
1870 | 1871 | def _auditconflicts(self, path): |
|
1871 | 1872 | """Replicates conflict checks done by wvfs.write(). |
|
1872 | 1873 | |
|
1873 | 1874 | Since we never write to the filesystem and never call `applyupdates` in |
|
1874 | 1875 | IMM, we'll never check that a path is actually writable -- e.g., because |
|
1875 | 1876 | it adds `a/foo`, but `a` is actually a file in the other commit. |
|
1876 | 1877 | """ |
|
1877 | 1878 | def fail(path, component): |
|
1878 | 1879 | # p1() is the base and we're receiving "writes" for p2()'s |
|
1879 | 1880 | # files. |
|
1880 | 1881 | if 'l' in self.p1()[component].flags(): |
|
1881 | 1882 | raise error.Abort("error: %s conflicts with symlink %s " |
|
1882 | 1883 | "in %s." % (path, component, |
|
1883 | 1884 | self.p1().rev())) |
|
1884 | 1885 | else: |
|
1885 | 1886 | raise error.Abort("error: '%s' conflicts with file '%s' in " |
|
1886 | 1887 | "%s." % (path, component, |
|
1887 | 1888 | self.p1().rev())) |
|
1888 | 1889 | |
|
1889 | 1890 | # Test that each new directory to be created to write this path from p2 |
|
1890 | 1891 | # is not a file in p1. |
|
1891 | 1892 | components = path.split('/') |
|
1892 | 1893 | for i in xrange(len(components)): |
|
1893 | 1894 | component = "/".join(components[0:i]) |
|
1894 | 1895 | if component in self.p1(): |
|
1895 | 1896 | fail(path, component) |
|
1896 | 1897 | |
|
1897 | 1898 | # Test the other direction -- that this path from p2 isn't a directory |
|
1898 | 1899 | # in p1 (test that p1 doesn't any paths matching `path/*`). |
|
1899 | 1900 | match = matchmod.match('/', '', [path + '/'], default=b'relpath') |
|
1900 | 1901 | matches = self.p1().manifest().matches(match) |
|
1901 | 1902 | if len(matches) > 0: |
|
1902 | 1903 | if len(matches) == 1 and matches.keys()[0] == path: |
|
1903 | 1904 | return |
|
1904 | 1905 | raise error.Abort("error: file '%s' cannot be written because " |
|
1905 | 1906 | " '%s/' is a folder in %s (containing %d " |
|
1906 | 1907 | "entries: %s)" |
|
1907 | 1908 | % (path, path, self.p1(), len(matches), |
|
1908 | 1909 | ', '.join(matches.keys()))) |
|
1909 | 1910 | |
|
1910 | 1911 | def write(self, path, data, flags='', **kwargs): |
|
1911 | 1912 | if data is None: |
|
1912 | 1913 | raise error.ProgrammingError("data must be non-None") |
|
1913 | 1914 | self._auditconflicts(path) |
|
1914 | 1915 | self._markdirty(path, exists=True, data=data, date=dateutil.makedate(), |
|
1915 | 1916 | flags=flags) |
|
1916 | 1917 | |
|
1917 | 1918 | def setflags(self, path, l, x): |
|
1918 | 1919 | self._markdirty(path, exists=True, date=dateutil.makedate(), |
|
1919 | 1920 | flags=(l and 'l' or '') + (x and 'x' or '')) |
|
1920 | 1921 | |
|
1921 | 1922 | def remove(self, path): |
|
1922 | 1923 | self._markdirty(path, exists=False) |
|
1923 | 1924 | |
|
1924 | 1925 | def exists(self, path): |
|
1925 | 1926 | """exists behaves like `lexists`, but needs to follow symlinks and |
|
1926 | 1927 | return False if they are broken. |
|
1927 | 1928 | """ |
|
1928 | 1929 | if self.isdirty(path): |
|
1929 | 1930 | # If this path exists and is a symlink, "follow" it by calling |
|
1930 | 1931 | # exists on the destination path. |
|
1931 | 1932 | if (self._cache[path]['exists'] and |
|
1932 | 1933 | 'l' in self._cache[path]['flags']): |
|
1933 | 1934 | return self.exists(self._cache[path]['data'].strip()) |
|
1934 | 1935 | else: |
|
1935 | 1936 | return self._cache[path]['exists'] |
|
1936 | 1937 | |
|
1937 | 1938 | return self._existsinparent(path) |
|
1938 | 1939 | |
|
1939 | 1940 | def lexists(self, path): |
|
1940 | 1941 | """lexists returns True if the path exists""" |
|
1941 | 1942 | if self.isdirty(path): |
|
1942 | 1943 | return self._cache[path]['exists'] |
|
1943 | 1944 | |
|
1944 | 1945 | return self._existsinparent(path) |
|
1945 | 1946 | |
|
1946 | 1947 | def size(self, path): |
|
1947 | 1948 | if self.isdirty(path): |
|
1948 | 1949 | if self._cache[path]['exists']: |
|
1949 | 1950 | return len(self._cache[path]['data']) |
|
1950 | 1951 | else: |
|
1951 | 1952 | raise error.ProgrammingError("No such file or directory: %s" % |
|
1952 | 1953 | self._path) |
|
1953 | 1954 | return self._wrappedctx[path].size() |
|
1954 | 1955 | |
|
1955 | 1956 | def tomemctx(self, text, branch=None, extra=None, date=None, parents=None, |
|
1956 | 1957 | user=None, editor=None): |
|
1957 | 1958 | """Converts this ``overlayworkingctx`` into a ``memctx`` ready to be |
|
1958 | 1959 | committed. |
|
1959 | 1960 | |
|
1960 | 1961 | ``text`` is the commit message. |
|
1961 | 1962 | ``parents`` (optional) are rev numbers. |
|
1962 | 1963 | """ |
|
1963 | 1964 | # Default parents to the wrapped contexts' if not passed. |
|
1964 | 1965 | if parents is None: |
|
1965 | 1966 | parents = self._wrappedctx.parents() |
|
1966 | 1967 | if len(parents) == 1: |
|
1967 | 1968 | parents = (parents[0], None) |
|
1968 | 1969 | |
|
1969 | 1970 | # ``parents`` is passed as rev numbers; convert to ``commitctxs``. |
|
1970 | 1971 | if parents[1] is None: |
|
1971 | 1972 | parents = (self._repo[parents[0]], None) |
|
1972 | 1973 | else: |
|
1973 | 1974 | parents = (self._repo[parents[0]], self._repo[parents[1]]) |
|
1974 | 1975 | |
|
1975 | 1976 | files = self._cache.keys() |
|
1976 | 1977 | def getfile(repo, memctx, path): |
|
1977 | 1978 | if self._cache[path]['exists']: |
|
1978 | 1979 | return memfilectx(repo, memctx, path, |
|
1979 | 1980 | self._cache[path]['data'], |
|
1980 | 1981 | 'l' in self._cache[path]['flags'], |
|
1981 | 1982 | 'x' in self._cache[path]['flags'], |
|
1982 | 1983 | self._cache[path]['copied']) |
|
1983 | 1984 | else: |
|
1984 | 1985 | # Returning None, but including the path in `files`, is |
|
1985 | 1986 | # necessary for memctx to register a deletion. |
|
1986 | 1987 | return None |
|
1987 | 1988 | return memctx(self._repo, parents, text, files, getfile, date=date, |
|
1988 | 1989 | extra=extra, user=user, branch=branch, editor=editor) |
|
1989 | 1990 | |
|
1990 | 1991 | def isdirty(self, path): |
|
1991 | 1992 | return path in self._cache |
|
1992 | 1993 | |
|
1993 | 1994 | def isempty(self): |
|
1994 | 1995 | # We need to discard any keys that are actually clean before the empty |
|
1995 | 1996 | # commit check. |
|
1996 | 1997 | self._compact() |
|
1997 | 1998 | return len(self._cache) == 0 |
|
1998 | 1999 | |
|
1999 | 2000 | def clean(self): |
|
2000 | 2001 | self._cache = {} |
|
2001 | 2002 | |
|
2002 | 2003 | def _compact(self): |
|
2003 | 2004 | """Removes keys from the cache that are actually clean, by comparing |
|
2004 | 2005 | them with the underlying context. |
|
2005 | 2006 | |
|
2006 | 2007 | This can occur during the merge process, e.g. by passing --tool :local |
|
2007 | 2008 | to resolve a conflict. |
|
2008 | 2009 | """ |
|
2009 | 2010 | keys = [] |
|
2010 | 2011 | for path in self._cache.keys(): |
|
2011 | 2012 | cache = self._cache[path] |
|
2012 | 2013 | try: |
|
2013 | 2014 | underlying = self._wrappedctx[path] |
|
2014 | 2015 | if (underlying.data() == cache['data'] and |
|
2015 | 2016 | underlying.flags() == cache['flags']): |
|
2016 | 2017 | keys.append(path) |
|
2017 | 2018 | except error.ManifestLookupError: |
|
2018 | 2019 | # Path not in the underlying manifest (created). |
|
2019 | 2020 | continue |
|
2020 | 2021 | |
|
2021 | 2022 | for path in keys: |
|
2022 | 2023 | del self._cache[path] |
|
2023 | 2024 | return keys |
|
2024 | 2025 | |
|
2025 | 2026 | def _markdirty(self, path, exists, data=None, date=None, flags=''): |
|
2026 | 2027 | self._cache[path] = { |
|
2027 | 2028 | 'exists': exists, |
|
2028 | 2029 | 'data': data, |
|
2029 | 2030 | 'date': date, |
|
2030 | 2031 | 'flags': flags, |
|
2031 | 2032 | 'copied': None, |
|
2032 | 2033 | } |
|
2033 | 2034 | |
|
2034 | 2035 | def filectx(self, path, filelog=None): |
|
2035 | 2036 | return overlayworkingfilectx(self._repo, path, parent=self, |
|
2036 | 2037 | filelog=filelog) |
|
2037 | 2038 | |
|
2038 | 2039 | class overlayworkingfilectx(committablefilectx): |
|
2039 | 2040 | """Wrap a ``workingfilectx`` but intercepts all writes into an in-memory |
|
2040 | 2041 | cache, which can be flushed through later by calling ``flush()``.""" |
|
2041 | 2042 | |
|
2042 | 2043 | def __init__(self, repo, path, filelog=None, parent=None): |
|
2043 | 2044 | super(overlayworkingfilectx, self).__init__(repo, path, filelog, |
|
2044 | 2045 | parent) |
|
2045 | 2046 | self._repo = repo |
|
2046 | 2047 | self._parent = parent |
|
2047 | 2048 | self._path = path |
|
2048 | 2049 | |
|
2049 | 2050 | def cmp(self, fctx): |
|
2050 | 2051 | return self.data() != fctx.data() |
|
2051 | 2052 | |
|
2052 | 2053 | def changectx(self): |
|
2053 | 2054 | return self._parent |
|
2054 | 2055 | |
|
2055 | 2056 | def data(self): |
|
2056 | 2057 | return self._parent.data(self._path) |
|
2057 | 2058 | |
|
2058 | 2059 | def date(self): |
|
2059 | 2060 | return self._parent.filedate(self._path) |
|
2060 | 2061 | |
|
2061 | 2062 | def exists(self): |
|
2062 | 2063 | return self.lexists() |
|
2063 | 2064 | |
|
2064 | 2065 | def lexists(self): |
|
2065 | 2066 | return self._parent.exists(self._path) |
|
2066 | 2067 | |
|
2067 | 2068 | def renamed(self): |
|
2068 | 2069 | path = self._parent.copydata(self._path) |
|
2069 | 2070 | if not path: |
|
2070 | 2071 | return None |
|
2071 | 2072 | return path, self._changectx._parents[0]._manifest.get(path, nullid) |
|
2072 | 2073 | |
|
2073 | 2074 | def size(self): |
|
2074 | 2075 | return self._parent.size(self._path) |
|
2075 | 2076 | |
|
2076 | 2077 | def markcopied(self, origin): |
|
2077 | 2078 | self._parent.markcopied(self._path, origin) |
|
2078 | 2079 | |
|
2079 | 2080 | def audit(self): |
|
2080 | 2081 | pass |
|
2081 | 2082 | |
|
2082 | 2083 | def flags(self): |
|
2083 | 2084 | return self._parent.flags(self._path) |
|
2084 | 2085 | |
|
2085 | 2086 | def setflags(self, islink, isexec): |
|
2086 | 2087 | return self._parent.setflags(self._path, islink, isexec) |
|
2087 | 2088 | |
|
2088 | 2089 | def write(self, data, flags, backgroundclose=False, **kwargs): |
|
2089 | 2090 | return self._parent.write(self._path, data, flags, **kwargs) |
|
2090 | 2091 | |
|
2091 | 2092 | def remove(self, ignoremissing=False): |
|
2092 | 2093 | return self._parent.remove(self._path) |
|
2093 | 2094 | |
|
2094 | 2095 | def clearunknown(self): |
|
2095 | 2096 | pass |
|
2096 | 2097 | |
|
2097 | 2098 | class workingcommitctx(workingctx): |
|
2098 | 2099 | """A workingcommitctx object makes access to data related to |
|
2099 | 2100 | the revision being committed convenient. |
|
2100 | 2101 | |
|
2101 | 2102 | This hides changes in the working directory, if they aren't |
|
2102 | 2103 | committed in this context. |
|
2103 | 2104 | """ |
|
2104 | 2105 | def __init__(self, repo, changes, |
|
2105 | 2106 | text="", user=None, date=None, extra=None): |
|
2106 | 2107 | super(workingctx, self).__init__(repo, text, user, date, extra, |
|
2107 | 2108 | changes) |
|
2108 | 2109 | |
|
2109 | 2110 | def _dirstatestatus(self, match, ignored=False, clean=False, unknown=False): |
|
2110 | 2111 | """Return matched files only in ``self._status`` |
|
2111 | 2112 | |
|
2112 | 2113 | Uncommitted files appear "clean" via this context, even if |
|
2113 | 2114 | they aren't actually so in the working directory. |
|
2114 | 2115 | """ |
|
2115 | 2116 | if clean: |
|
2116 | 2117 | clean = [f for f in self._manifest if f not in self._changedset] |
|
2117 | 2118 | else: |
|
2118 | 2119 | clean = [] |
|
2119 | 2120 | return scmutil.status([f for f in self._status.modified if match(f)], |
|
2120 | 2121 | [f for f in self._status.added if match(f)], |
|
2121 | 2122 | [f for f in self._status.removed if match(f)], |
|
2122 | 2123 | [], [], [], clean) |
|
2123 | 2124 | |
|
2124 | 2125 | @propertycache |
|
2125 | 2126 | def _changedset(self): |
|
2126 | 2127 | """Return the set of files changed in this context |
|
2127 | 2128 | """ |
|
2128 | 2129 | changed = set(self._status.modified) |
|
2129 | 2130 | changed.update(self._status.added) |
|
2130 | 2131 | changed.update(self._status.removed) |
|
2131 | 2132 | return changed |
|
2132 | 2133 | |
|
2133 | 2134 | def makecachingfilectxfn(func): |
|
2134 | 2135 | """Create a filectxfn that caches based on the path. |
|
2135 | 2136 | |
|
2136 | 2137 | We can't use util.cachefunc because it uses all arguments as the cache |
|
2137 | 2138 | key and this creates a cycle since the arguments include the repo and |
|
2138 | 2139 | memctx. |
|
2139 | 2140 | """ |
|
2140 | 2141 | cache = {} |
|
2141 | 2142 | |
|
2142 | 2143 | def getfilectx(repo, memctx, path): |
|
2143 | 2144 | if path not in cache: |
|
2144 | 2145 | cache[path] = func(repo, memctx, path) |
|
2145 | 2146 | return cache[path] |
|
2146 | 2147 | |
|
2147 | 2148 | return getfilectx |
|
2148 | 2149 | |
|
2149 | 2150 | def memfilefromctx(ctx): |
|
2150 | 2151 | """Given a context return a memfilectx for ctx[path] |
|
2151 | 2152 | |
|
2152 | 2153 | This is a convenience method for building a memctx based on another |
|
2153 | 2154 | context. |
|
2154 | 2155 | """ |
|
2155 | 2156 | def getfilectx(repo, memctx, path): |
|
2156 | 2157 | fctx = ctx[path] |
|
2157 | 2158 | # this is weird but apparently we only keep track of one parent |
|
2158 | 2159 | # (why not only store that instead of a tuple?) |
|
2159 | 2160 | copied = fctx.renamed() |
|
2160 | 2161 | if copied: |
|
2161 | 2162 | copied = copied[0] |
|
2162 | 2163 | return memfilectx(repo, memctx, path, fctx.data(), |
|
2163 | 2164 | islink=fctx.islink(), isexec=fctx.isexec(), |
|
2164 | 2165 | copied=copied) |
|
2165 | 2166 | |
|
2166 | 2167 | return getfilectx |
|
2167 | 2168 | |
|
2168 | 2169 | def memfilefrompatch(patchstore): |
|
2169 | 2170 | """Given a patch (e.g. patchstore object) return a memfilectx |
|
2170 | 2171 | |
|
2171 | 2172 | This is a convenience method for building a memctx based on a patchstore. |
|
2172 | 2173 | """ |
|
2173 | 2174 | def getfilectx(repo, memctx, path): |
|
2174 | 2175 | data, mode, copied = patchstore.getfile(path) |
|
2175 | 2176 | if data is None: |
|
2176 | 2177 | return None |
|
2177 | 2178 | islink, isexec = mode |
|
2178 | 2179 | return memfilectx(repo, memctx, path, data, islink=islink, |
|
2179 | 2180 | isexec=isexec, copied=copied) |
|
2180 | 2181 | |
|
2181 | 2182 | return getfilectx |
|
2182 | 2183 | |
|
2183 | 2184 | class memctx(committablectx): |
|
2184 | 2185 | """Use memctx to perform in-memory commits via localrepo.commitctx(). |
|
2185 | 2186 | |
|
2186 | 2187 | Revision information is supplied at initialization time while |
|
2187 | 2188 | related files data and is made available through a callback |
|
2188 | 2189 | mechanism. 'repo' is the current localrepo, 'parents' is a |
|
2189 | 2190 | sequence of two parent revisions identifiers (pass None for every |
|
2190 | 2191 | missing parent), 'text' is the commit message and 'files' lists |
|
2191 | 2192 | names of files touched by the revision (normalized and relative to |
|
2192 | 2193 | repository root). |
|
2193 | 2194 | |
|
2194 | 2195 | filectxfn(repo, memctx, path) is a callable receiving the |
|
2195 | 2196 | repository, the current memctx object and the normalized path of |
|
2196 | 2197 | requested file, relative to repository root. It is fired by the |
|
2197 | 2198 | commit function for every file in 'files', but calls order is |
|
2198 | 2199 | undefined. If the file is available in the revision being |
|
2199 | 2200 | committed (updated or added), filectxfn returns a memfilectx |
|
2200 | 2201 | object. If the file was removed, filectxfn return None for recent |
|
2201 | 2202 | Mercurial. Moved files are represented by marking the source file |
|
2202 | 2203 | removed and the new file added with copy information (see |
|
2203 | 2204 | memfilectx). |
|
2204 | 2205 | |
|
2205 | 2206 | user receives the committer name and defaults to current |
|
2206 | 2207 | repository username, date is the commit date in any format |
|
2207 | 2208 | supported by dateutil.parsedate() and defaults to current date, extra |
|
2208 | 2209 | is a dictionary of metadata or is left empty. |
|
2209 | 2210 | """ |
|
2210 | 2211 | |
|
2211 | 2212 | # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing files. |
|
2212 | 2213 | # Extensions that need to retain compatibility across Mercurial 3.1 can use |
|
2213 | 2214 | # this field to determine what to do in filectxfn. |
|
2214 | 2215 | _returnnoneformissingfiles = True |
|
2215 | 2216 | |
|
2216 | 2217 | def __init__(self, repo, parents, text, files, filectxfn, user=None, |
|
2217 | 2218 | date=None, extra=None, branch=None, editor=False): |
|
2218 | 2219 | super(memctx, self).__init__(repo, text, user, date, extra) |
|
2219 | 2220 | self._rev = None |
|
2220 | 2221 | self._node = None |
|
2221 | 2222 | parents = [(p or nullid) for p in parents] |
|
2222 | 2223 | p1, p2 = parents |
|
2223 | 2224 | self._parents = [self._repo[p] for p in (p1, p2)] |
|
2224 | 2225 | files = sorted(set(files)) |
|
2225 | 2226 | self._files = files |
|
2226 | 2227 | if branch is not None: |
|
2227 | 2228 | self._extra['branch'] = encoding.fromlocal(branch) |
|
2228 | 2229 | self.substate = {} |
|
2229 | 2230 | |
|
2230 | 2231 | if isinstance(filectxfn, patch.filestore): |
|
2231 | 2232 | filectxfn = memfilefrompatch(filectxfn) |
|
2232 | 2233 | elif not callable(filectxfn): |
|
2233 | 2234 | # if store is not callable, wrap it in a function |
|
2234 | 2235 | filectxfn = memfilefromctx(filectxfn) |
|
2235 | 2236 | |
|
2236 | 2237 | # memoizing increases performance for e.g. vcs convert scenarios. |
|
2237 | 2238 | self._filectxfn = makecachingfilectxfn(filectxfn) |
|
2238 | 2239 | |
|
2239 | 2240 | if editor: |
|
2240 | 2241 | self._text = editor(self._repo, self, []) |
|
2241 | 2242 | self._repo.savecommitmessage(self._text) |
|
2242 | 2243 | |
|
2243 | 2244 | def filectx(self, path, filelog=None): |
|
2244 | 2245 | """get a file context from the working directory |
|
2245 | 2246 | |
|
2246 | 2247 | Returns None if file doesn't exist and should be removed.""" |
|
2247 | 2248 | return self._filectxfn(self._repo, self, path) |
|
2248 | 2249 | |
|
2249 | 2250 | def commit(self): |
|
2250 | 2251 | """commit context to the repo""" |
|
2251 | 2252 | return self._repo.commitctx(self) |
|
2252 | 2253 | |
|
2253 | 2254 | @propertycache |
|
2254 | 2255 | def _manifest(self): |
|
2255 | 2256 | """generate a manifest based on the return values of filectxfn""" |
|
2256 | 2257 | |
|
2257 | 2258 | # keep this simple for now; just worry about p1 |
|
2258 | 2259 | pctx = self._parents[0] |
|
2259 | 2260 | man = pctx.manifest().copy() |
|
2260 | 2261 | |
|
2261 | 2262 | for f in self._status.modified: |
|
2262 | 2263 | p1node = nullid |
|
2263 | 2264 | p2node = nullid |
|
2264 | 2265 | p = pctx[f].parents() # if file isn't in pctx, check p2? |
|
2265 | 2266 | if len(p) > 0: |
|
2266 | 2267 | p1node = p[0].filenode() |
|
2267 | 2268 | if len(p) > 1: |
|
2268 | 2269 | p2node = p[1].filenode() |
|
2269 | 2270 | man[f] = revlog.hash(self[f].data(), p1node, p2node) |
|
2270 | 2271 | |
|
2271 | 2272 | for f in self._status.added: |
|
2272 | 2273 | man[f] = revlog.hash(self[f].data(), nullid, nullid) |
|
2273 | 2274 | |
|
2274 | 2275 | for f in self._status.removed: |
|
2275 | 2276 | if f in man: |
|
2276 | 2277 | del man[f] |
|
2277 | 2278 | |
|
2278 | 2279 | return man |
|
2279 | 2280 | |
|
2280 | 2281 | @propertycache |
|
2281 | 2282 | def _status(self): |
|
2282 | 2283 | """Calculate exact status from ``files`` specified at construction |
|
2283 | 2284 | """ |
|
2284 | 2285 | man1 = self.p1().manifest() |
|
2285 | 2286 | p2 = self._parents[1] |
|
2286 | 2287 | # "1 < len(self._parents)" can't be used for checking |
|
2287 | 2288 | # existence of the 2nd parent, because "memctx._parents" is |
|
2288 | 2289 | # explicitly initialized by the list, of which length is 2. |
|
2289 | 2290 | if p2.node() != nullid: |
|
2290 | 2291 | man2 = p2.manifest() |
|
2291 | 2292 | managing = lambda f: f in man1 or f in man2 |
|
2292 | 2293 | else: |
|
2293 | 2294 | managing = lambda f: f in man1 |
|
2294 | 2295 | |
|
2295 | 2296 | modified, added, removed = [], [], [] |
|
2296 | 2297 | for f in self._files: |
|
2297 | 2298 | if not managing(f): |
|
2298 | 2299 | added.append(f) |
|
2299 | 2300 | elif self[f]: |
|
2300 | 2301 | modified.append(f) |
|
2301 | 2302 | else: |
|
2302 | 2303 | removed.append(f) |
|
2303 | 2304 | |
|
2304 | 2305 | return scmutil.status(modified, added, removed, [], [], [], []) |
|
2305 | 2306 | |
|
2306 | 2307 | class memfilectx(committablefilectx): |
|
2307 | 2308 | """memfilectx represents an in-memory file to commit. |
|
2308 | 2309 | |
|
2309 | 2310 | See memctx and committablefilectx for more details. |
|
2310 | 2311 | """ |
|
2311 | 2312 | def __init__(self, repo, changectx, path, data, islink=False, |
|
2312 | 2313 | isexec=False, copied=None): |
|
2313 | 2314 | """ |
|
2314 | 2315 | path is the normalized file path relative to repository root. |
|
2315 | 2316 | data is the file content as a string. |
|
2316 | 2317 | islink is True if the file is a symbolic link. |
|
2317 | 2318 | isexec is True if the file is executable. |
|
2318 | 2319 | copied is the source file path if current file was copied in the |
|
2319 | 2320 | revision being committed, or None.""" |
|
2320 | 2321 | super(memfilectx, self).__init__(repo, path, None, changectx) |
|
2321 | 2322 | self._data = data |
|
2322 | 2323 | self._flags = (islink and 'l' or '') + (isexec and 'x' or '') |
|
2323 | 2324 | self._copied = None |
|
2324 | 2325 | if copied: |
|
2325 | 2326 | self._copied = (copied, nullid) |
|
2326 | 2327 | |
|
2327 | 2328 | def data(self): |
|
2328 | 2329 | return self._data |
|
2329 | 2330 | |
|
2330 | 2331 | def remove(self, ignoremissing=False): |
|
2331 | 2332 | """wraps unlink for a repo's working directory""" |
|
2332 | 2333 | # need to figure out what to do here |
|
2333 | 2334 | del self._changectx[self._path] |
|
2334 | 2335 | |
|
2335 | 2336 | def write(self, data, flags, **kwargs): |
|
2336 | 2337 | """wraps repo.wwrite""" |
|
2337 | 2338 | self._data = data |
|
2338 | 2339 | |
|
2339 | 2340 | class overlayfilectx(committablefilectx): |
|
2340 | 2341 | """Like memfilectx but take an original filectx and optional parameters to |
|
2341 | 2342 | override parts of it. This is useful when fctx.data() is expensive (i.e. |
|
2342 | 2343 | flag processor is expensive) and raw data, flags, and filenode could be |
|
2343 | 2344 | reused (ex. rebase or mode-only amend a REVIDX_EXTSTORED file). |
|
2344 | 2345 | """ |
|
2345 | 2346 | |
|
2346 | 2347 | def __init__(self, originalfctx, datafunc=None, path=None, flags=None, |
|
2347 | 2348 | copied=None, ctx=None): |
|
2348 | 2349 | """originalfctx: filecontext to duplicate |
|
2349 | 2350 | |
|
2350 | 2351 | datafunc: None or a function to override data (file content). It is a |
|
2351 | 2352 | function to be lazy. path, flags, copied, ctx: None or overridden value |
|
2352 | 2353 | |
|
2353 | 2354 | copied could be (path, rev), or False. copied could also be just path, |
|
2354 | 2355 | and will be converted to (path, nullid). This simplifies some callers. |
|
2355 | 2356 | """ |
|
2356 | 2357 | |
|
2357 | 2358 | if path is None: |
|
2358 | 2359 | path = originalfctx.path() |
|
2359 | 2360 | if ctx is None: |
|
2360 | 2361 | ctx = originalfctx.changectx() |
|
2361 | 2362 | ctxmatch = lambda: True |
|
2362 | 2363 | else: |
|
2363 | 2364 | ctxmatch = lambda: ctx == originalfctx.changectx() |
|
2364 | 2365 | |
|
2365 | 2366 | repo = originalfctx.repo() |
|
2366 | 2367 | flog = originalfctx.filelog() |
|
2367 | 2368 | super(overlayfilectx, self).__init__(repo, path, flog, ctx) |
|
2368 | 2369 | |
|
2369 | 2370 | if copied is None: |
|
2370 | 2371 | copied = originalfctx.renamed() |
|
2371 | 2372 | copiedmatch = lambda: True |
|
2372 | 2373 | else: |
|
2373 | 2374 | if copied and not isinstance(copied, tuple): |
|
2374 | 2375 | # repo._filecommit will recalculate copyrev so nullid is okay |
|
2375 | 2376 | copied = (copied, nullid) |
|
2376 | 2377 | copiedmatch = lambda: copied == originalfctx.renamed() |
|
2377 | 2378 | |
|
2378 | 2379 | # When data, copied (could affect data), ctx (could affect filelog |
|
2379 | 2380 | # parents) are not overridden, rawdata, rawflags, and filenode may be |
|
2380 | 2381 | # reused (repo._filecommit should double check filelog parents). |
|
2381 | 2382 | # |
|
2382 | 2383 | # path, flags are not hashed in filelog (but in manifestlog) so they do |
|
2383 | 2384 | # not affect reusable here. |
|
2384 | 2385 | # |
|
2385 | 2386 | # If ctx or copied is overridden to a same value with originalfctx, |
|
2386 | 2387 | # still consider it's reusable. originalfctx.renamed() may be a bit |
|
2387 | 2388 | # expensive so it's not called unless necessary. Assuming datafunc is |
|
2388 | 2389 | # always expensive, do not call it for this "reusable" test. |
|
2389 | 2390 | reusable = datafunc is None and ctxmatch() and copiedmatch() |
|
2390 | 2391 | |
|
2391 | 2392 | if datafunc is None: |
|
2392 | 2393 | datafunc = originalfctx.data |
|
2393 | 2394 | if flags is None: |
|
2394 | 2395 | flags = originalfctx.flags() |
|
2395 | 2396 | |
|
2396 | 2397 | self._datafunc = datafunc |
|
2397 | 2398 | self._flags = flags |
|
2398 | 2399 | self._copied = copied |
|
2399 | 2400 | |
|
2400 | 2401 | if reusable: |
|
2401 | 2402 | # copy extra fields from originalfctx |
|
2402 | 2403 | attrs = ['rawdata', 'rawflags', '_filenode', '_filerev'] |
|
2403 | 2404 | for attr_ in attrs: |
|
2404 | 2405 | if util.safehasattr(originalfctx, attr_): |
|
2405 | 2406 | setattr(self, attr_, getattr(originalfctx, attr_)) |
|
2406 | 2407 | |
|
2407 | 2408 | def data(self): |
|
2408 | 2409 | return self._datafunc() |
|
2409 | 2410 | |
|
2410 | 2411 | class metadataonlyctx(committablectx): |
|
2411 | 2412 | """Like memctx but it's reusing the manifest of different commit. |
|
2412 | 2413 | Intended to be used by lightweight operations that are creating |
|
2413 | 2414 | metadata-only changes. |
|
2414 | 2415 | |
|
2415 | 2416 | Revision information is supplied at initialization time. 'repo' is the |
|
2416 | 2417 | current localrepo, 'ctx' is original revision which manifest we're reuisng |
|
2417 | 2418 | 'parents' is a sequence of two parent revisions identifiers (pass None for |
|
2418 | 2419 | every missing parent), 'text' is the commit. |
|
2419 | 2420 | |
|
2420 | 2421 | user receives the committer name and defaults to current repository |
|
2421 | 2422 | username, date is the commit date in any format supported by |
|
2422 | 2423 | dateutil.parsedate() and defaults to current date, extra is a dictionary of |
|
2423 | 2424 | metadata or is left empty. |
|
2424 | 2425 | """ |
|
2425 | 2426 | def __init__(self, repo, originalctx, parents=None, text=None, user=None, |
|
2426 | 2427 | date=None, extra=None, editor=False): |
|
2427 | 2428 | if text is None: |
|
2428 | 2429 | text = originalctx.description() |
|
2429 | 2430 | super(metadataonlyctx, self).__init__(repo, text, user, date, extra) |
|
2430 | 2431 | self._rev = None |
|
2431 | 2432 | self._node = None |
|
2432 | 2433 | self._originalctx = originalctx |
|
2433 | 2434 | self._manifestnode = originalctx.manifestnode() |
|
2434 | 2435 | if parents is None: |
|
2435 | 2436 | parents = originalctx.parents() |
|
2436 | 2437 | else: |
|
2437 | 2438 | parents = [repo[p] for p in parents if p is not None] |
|
2438 | 2439 | parents = parents[:] |
|
2439 | 2440 | while len(parents) < 2: |
|
2440 | 2441 | parents.append(repo[nullid]) |
|
2441 | 2442 | p1, p2 = self._parents = parents |
|
2442 | 2443 | |
|
2443 | 2444 | # sanity check to ensure that the reused manifest parents are |
|
2444 | 2445 | # manifests of our commit parents |
|
2445 | 2446 | mp1, mp2 = self.manifestctx().parents |
|
2446 | 2447 | if p1 != nullid and p1.manifestnode() != mp1: |
|
2447 | 2448 | raise RuntimeError('can\'t reuse the manifest: ' |
|
2448 | 2449 | 'its p1 doesn\'t match the new ctx p1') |
|
2449 | 2450 | if p2 != nullid and p2.manifestnode() != mp2: |
|
2450 | 2451 | raise RuntimeError('can\'t reuse the manifest: ' |
|
2451 | 2452 | 'its p2 doesn\'t match the new ctx p2') |
|
2452 | 2453 | |
|
2453 | 2454 | self._files = originalctx.files() |
|
2454 | 2455 | self.substate = {} |
|
2455 | 2456 | |
|
2456 | 2457 | if editor: |
|
2457 | 2458 | self._text = editor(self._repo, self, []) |
|
2458 | 2459 | self._repo.savecommitmessage(self._text) |
|
2459 | 2460 | |
|
2460 | 2461 | def manifestnode(self): |
|
2461 | 2462 | return self._manifestnode |
|
2462 | 2463 | |
|
2463 | 2464 | @property |
|
2464 | 2465 | def _manifestctx(self): |
|
2465 | 2466 | return self._repo.manifestlog[self._manifestnode] |
|
2466 | 2467 | |
|
2467 | 2468 | def filectx(self, path, filelog=None): |
|
2468 | 2469 | return self._originalctx.filectx(path, filelog=filelog) |
|
2469 | 2470 | |
|
2470 | 2471 | def commit(self): |
|
2471 | 2472 | """commit context to the repo""" |
|
2472 | 2473 | return self._repo.commitctx(self) |
|
2473 | 2474 | |
|
2474 | 2475 | @property |
|
2475 | 2476 | def _manifest(self): |
|
2476 | 2477 | return self._originalctx.manifest() |
|
2477 | 2478 | |
|
2478 | 2479 | @propertycache |
|
2479 | 2480 | def _status(self): |
|
2480 | 2481 | """Calculate exact status from ``files`` specified in the ``origctx`` |
|
2481 | 2482 | and parents manifests. |
|
2482 | 2483 | """ |
|
2483 | 2484 | man1 = self.p1().manifest() |
|
2484 | 2485 | p2 = self._parents[1] |
|
2485 | 2486 | # "1 < len(self._parents)" can't be used for checking |
|
2486 | 2487 | # existence of the 2nd parent, because "metadataonlyctx._parents" is |
|
2487 | 2488 | # explicitly initialized by the list, of which length is 2. |
|
2488 | 2489 | if p2.node() != nullid: |
|
2489 | 2490 | man2 = p2.manifest() |
|
2490 | 2491 | managing = lambda f: f in man1 or f in man2 |
|
2491 | 2492 | else: |
|
2492 | 2493 | managing = lambda f: f in man1 |
|
2493 | 2494 | |
|
2494 | 2495 | modified, added, removed = [], [], [] |
|
2495 | 2496 | for f in self._files: |
|
2496 | 2497 | if not managing(f): |
|
2497 | 2498 | added.append(f) |
|
2498 | 2499 | elif f in self: |
|
2499 | 2500 | modified.append(f) |
|
2500 | 2501 | else: |
|
2501 | 2502 | removed.append(f) |
|
2502 | 2503 | |
|
2503 | 2504 | return scmutil.status(modified, added, removed, [], [], [], []) |
|
2504 | 2505 | |
|
2505 | 2506 | class arbitraryfilectx(object): |
|
2506 | 2507 | """Allows you to use filectx-like functions on a file in an arbitrary |
|
2507 | 2508 | location on disk, possibly not in the working directory. |
|
2508 | 2509 | """ |
|
2509 | 2510 | def __init__(self, path, repo=None): |
|
2510 | 2511 | # Repo is optional because contrib/simplemerge uses this class. |
|
2511 | 2512 | self._repo = repo |
|
2512 | 2513 | self._path = path |
|
2513 | 2514 | |
|
2514 | 2515 | def cmp(self, fctx): |
|
2515 | 2516 | # filecmp follows symlinks whereas `cmp` should not, so skip the fast |
|
2516 | 2517 | # path if either side is a symlink. |
|
2517 | 2518 | symlinks = ('l' in self.flags() or 'l' in fctx.flags()) |
|
2518 | 2519 | if not symlinks and isinstance(fctx, workingfilectx) and self._repo: |
|
2519 | 2520 | # Add a fast-path for merge if both sides are disk-backed. |
|
2520 | 2521 | # Note that filecmp uses the opposite return values (True if same) |
|
2521 | 2522 | # from our cmp functions (True if different). |
|
2522 | 2523 | return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path())) |
|
2523 | 2524 | return self.data() != fctx.data() |
|
2524 | 2525 | |
|
2525 | 2526 | def path(self): |
|
2526 | 2527 | return self._path |
|
2527 | 2528 | |
|
2528 | 2529 | def flags(self): |
|
2529 | 2530 | return '' |
|
2530 | 2531 | |
|
2531 | 2532 | def data(self): |
|
2532 | 2533 | return util.readfile(self._path) |
|
2533 | 2534 | |
|
2534 | 2535 | def decodeddata(self): |
|
2535 | 2536 | with open(self._path, "rb") as f: |
|
2536 | 2537 | return f.read() |
|
2537 | 2538 | |
|
2538 | 2539 | def remove(self): |
|
2539 | 2540 | util.unlink(self._path) |
|
2540 | 2541 | |
|
2541 | 2542 | def write(self, data, flags, **kwargs): |
|
2542 | 2543 | assert not flags |
|
2543 | 2544 | with open(self._path, "w") as f: |
|
2544 | 2545 | f.write(data) |
@@ -1,2653 +1,2658 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 --debug` 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`` (per-repository) |
|
58 | 58 | - ``$HOME/.hgrc`` (per-user) |
|
59 | 59 | - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user) |
|
60 | 60 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) |
|
61 | 61 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) |
|
62 | 62 | - ``/etc/mercurial/hgrc`` (per-system) |
|
63 | 63 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) |
|
64 | 64 | - ``<internal>/default.d/*.rc`` (defaults) |
|
65 | 65 | |
|
66 | 66 | .. container:: verbose.windows |
|
67 | 67 | |
|
68 | 68 | On Windows, the following files are consulted: |
|
69 | 69 | |
|
70 | 70 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
71 | 71 | - ``%USERPROFILE%\.hgrc`` (per-user) |
|
72 | 72 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) |
|
73 | 73 | - ``%HOME%\.hgrc`` (per-user) |
|
74 | 74 | - ``%HOME%\Mercurial.ini`` (per-user) |
|
75 | 75 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation) |
|
76 | 76 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) |
|
77 | 77 | - ``<install-dir>\Mercurial.ini`` (per-installation) |
|
78 | 78 | - ``<internal>/default.d/*.rc`` (defaults) |
|
79 | 79 | |
|
80 | 80 | .. note:: |
|
81 | 81 | |
|
82 | 82 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` |
|
83 | 83 | is used when running 32-bit Python on 64-bit Windows. |
|
84 | 84 | |
|
85 | 85 | .. container:: windows |
|
86 | 86 | |
|
87 | 87 | On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. |
|
88 | 88 | |
|
89 | 89 | .. container:: verbose.plan9 |
|
90 | 90 | |
|
91 | 91 | On Plan9, the following files are consulted: |
|
92 | 92 | |
|
93 | 93 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
94 | 94 | - ``$home/lib/hgrc`` (per-user) |
|
95 | 95 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) |
|
96 | 96 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) |
|
97 | 97 | - ``/lib/mercurial/hgrc`` (per-system) |
|
98 | 98 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) |
|
99 | 99 | - ``<internal>/default.d/*.rc`` (defaults) |
|
100 | 100 | |
|
101 | 101 | Per-repository configuration options only apply in a |
|
102 | 102 | particular repository. This file is not version-controlled, and |
|
103 | 103 | will not get transferred during a "clone" operation. Options in |
|
104 | 104 | this file override options in all other configuration files. |
|
105 | 105 | |
|
106 | 106 | .. container:: unix.plan9 |
|
107 | 107 | |
|
108 | 108 | On Plan 9 and Unix, most of this file will be ignored if it doesn't |
|
109 | 109 | belong to a trusted user or to a trusted group. See |
|
110 | 110 | :hg:`help config.trusted` for more details. |
|
111 | 111 | |
|
112 | 112 | Per-user configuration file(s) are for the user running Mercurial. Options |
|
113 | 113 | in these files apply to all Mercurial commands executed by this user in any |
|
114 | 114 | directory. Options in these files override per-system and per-installation |
|
115 | 115 | options. |
|
116 | 116 | |
|
117 | 117 | Per-installation configuration files are searched for in the |
|
118 | 118 | directory where Mercurial is installed. ``<install-root>`` is the |
|
119 | 119 | parent directory of the **hg** executable (or symlink) being run. |
|
120 | 120 | |
|
121 | 121 | .. container:: unix.plan9 |
|
122 | 122 | |
|
123 | 123 | For example, if installed in ``/shared/tools/bin/hg``, Mercurial |
|
124 | 124 | will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these |
|
125 | 125 | files apply to all Mercurial commands executed by any user in any |
|
126 | 126 | directory. |
|
127 | 127 | |
|
128 | 128 | Per-installation configuration files are for the system on |
|
129 | 129 | which Mercurial is running. Options in these files apply to all |
|
130 | 130 | Mercurial commands executed by any user in any directory. Registry |
|
131 | 131 | keys contain PATH-like strings, every part of which must reference |
|
132 | 132 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
133 | 133 | be read. Mercurial checks each of these locations in the specified |
|
134 | 134 | order until one or more configuration files are detected. |
|
135 | 135 | |
|
136 | 136 | Per-system configuration files are for the system on which Mercurial |
|
137 | 137 | is running. Options in these files apply to all Mercurial commands |
|
138 | 138 | executed by any user in any directory. Options in these files |
|
139 | 139 | override per-installation options. |
|
140 | 140 | |
|
141 | 141 | Mercurial comes with some default configuration. The default configuration |
|
142 | 142 | files are installed with Mercurial and will be overwritten on upgrades. Default |
|
143 | 143 | configuration files should never be edited by users or administrators but can |
|
144 | 144 | be overridden in other configuration files. So far the directory only contains |
|
145 | 145 | merge tool configuration but packagers can also put other default configuration |
|
146 | 146 | there. |
|
147 | 147 | |
|
148 | 148 | Syntax |
|
149 | 149 | ====== |
|
150 | 150 | |
|
151 | 151 | A configuration file consists of sections, led by a ``[section]`` header |
|
152 | 152 | and followed by ``name = value`` entries (sometimes called |
|
153 | 153 | ``configuration keys``):: |
|
154 | 154 | |
|
155 | 155 | [spam] |
|
156 | 156 | eggs=ham |
|
157 | 157 | green= |
|
158 | 158 | eggs |
|
159 | 159 | |
|
160 | 160 | Each line contains one entry. If the lines that follow are indented, |
|
161 | 161 | they are treated as continuations of that entry. Leading whitespace is |
|
162 | 162 | removed from values. Empty lines are skipped. Lines beginning with |
|
163 | 163 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
164 | 164 | |
|
165 | 165 | Configuration keys can be set multiple times, in which case Mercurial |
|
166 | 166 | will use the value that was configured last. As an example:: |
|
167 | 167 | |
|
168 | 168 | [spam] |
|
169 | 169 | eggs=large |
|
170 | 170 | ham=serrano |
|
171 | 171 | eggs=small |
|
172 | 172 | |
|
173 | 173 | This would set the configuration key named ``eggs`` to ``small``. |
|
174 | 174 | |
|
175 | 175 | It is also possible to define a section multiple times. A section can |
|
176 | 176 | be redefined on the same and/or on different configuration files. For |
|
177 | 177 | example:: |
|
178 | 178 | |
|
179 | 179 | [foo] |
|
180 | 180 | eggs=large |
|
181 | 181 | ham=serrano |
|
182 | 182 | eggs=small |
|
183 | 183 | |
|
184 | 184 | [bar] |
|
185 | 185 | eggs=ham |
|
186 | 186 | green= |
|
187 | 187 | eggs |
|
188 | 188 | |
|
189 | 189 | [foo] |
|
190 | 190 | ham=prosciutto |
|
191 | 191 | eggs=medium |
|
192 | 192 | bread=toasted |
|
193 | 193 | |
|
194 | 194 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys |
|
195 | 195 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, |
|
196 | 196 | respectively. As you can see there only thing that matters is the last |
|
197 | 197 | value that was set for each of the configuration keys. |
|
198 | 198 | |
|
199 | 199 | If a configuration key is set multiple times in different |
|
200 | 200 | configuration files the final value will depend on the order in which |
|
201 | 201 | the different configuration files are read, with settings from earlier |
|
202 | 202 | paths overriding later ones as described on the ``Files`` section |
|
203 | 203 | above. |
|
204 | 204 | |
|
205 | 205 | A line of the form ``%include file`` will include ``file`` into the |
|
206 | 206 | current configuration file. The inclusion is recursive, which means |
|
207 | 207 | that included files can include other files. Filenames are relative to |
|
208 | 208 | the configuration file in which the ``%include`` directive is found. |
|
209 | 209 | Environment variables and ``~user`` constructs are expanded in |
|
210 | 210 | ``file``. This lets you do something like:: |
|
211 | 211 | |
|
212 | 212 | %include ~/.hgrc.d/$HOST.rc |
|
213 | 213 | |
|
214 | 214 | to include a different configuration file on each computer you use. |
|
215 | 215 | |
|
216 | 216 | A line with ``%unset name`` will remove ``name`` from the current |
|
217 | 217 | section, if it has been set previously. |
|
218 | 218 | |
|
219 | 219 | The values are either free-form text strings, lists of text strings, |
|
220 | 220 | or Boolean values. Boolean values can be set to true using any of "1", |
|
221 | 221 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" |
|
222 | 222 | (all case insensitive). |
|
223 | 223 | |
|
224 | 224 | List values are separated by whitespace or comma, except when values are |
|
225 | 225 | placed in double quotation marks:: |
|
226 | 226 | |
|
227 | 227 | allow_read = "John Doe, PhD", brian, betty |
|
228 | 228 | |
|
229 | 229 | Quotation marks can be escaped by prefixing them with a backslash. Only |
|
230 | 230 | quotation marks at the beginning of a word is counted as a quotation |
|
231 | 231 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). |
|
232 | 232 | |
|
233 | 233 | Sections |
|
234 | 234 | ======== |
|
235 | 235 | |
|
236 | 236 | This section describes the different sections that may appear in a |
|
237 | 237 | Mercurial configuration file, the purpose of each section, its possible |
|
238 | 238 | keys, and their possible values. |
|
239 | 239 | |
|
240 | 240 | ``alias`` |
|
241 | 241 | --------- |
|
242 | 242 | |
|
243 | 243 | Defines command aliases. |
|
244 | 244 | |
|
245 | 245 | Aliases allow you to define your own commands in terms of other |
|
246 | 246 | commands (or aliases), optionally including arguments. Positional |
|
247 | 247 | arguments in the form of ``$1``, ``$2``, etc. in the alias definition |
|
248 | 248 | are expanded by Mercurial before execution. Positional arguments not |
|
249 | 249 | already used by ``$N`` in the definition are put at the end of the |
|
250 | 250 | command to be executed. |
|
251 | 251 | |
|
252 | 252 | Alias definitions consist of lines of the form:: |
|
253 | 253 | |
|
254 | 254 | <alias> = <command> [<argument>]... |
|
255 | 255 | |
|
256 | 256 | For example, this definition:: |
|
257 | 257 | |
|
258 | 258 | latest = log --limit 5 |
|
259 | 259 | |
|
260 | 260 | creates a new command ``latest`` that shows only the five most recent |
|
261 | 261 | changesets. You can define subsequent aliases using earlier ones:: |
|
262 | 262 | |
|
263 | 263 | stable5 = latest -b stable |
|
264 | 264 | |
|
265 | 265 | .. note:: |
|
266 | 266 | |
|
267 | 267 | It is possible to create aliases with the same names as |
|
268 | 268 | existing commands, which will then override the original |
|
269 | 269 | definitions. This is almost always a bad idea! |
|
270 | 270 | |
|
271 | 271 | An alias can start with an exclamation point (``!``) to make it a |
|
272 | 272 | shell alias. A shell alias is executed with the shell and will let you |
|
273 | 273 | run arbitrary commands. As an example, :: |
|
274 | 274 | |
|
275 | 275 | echo = !echo $@ |
|
276 | 276 | |
|
277 | 277 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
278 | 278 | terminal. A better example might be:: |
|
279 | 279 | |
|
280 | 280 | purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f |
|
281 | 281 | |
|
282 | 282 | which will make ``hg purge`` delete all unknown files in the |
|
283 | 283 | repository in the same manner as the purge extension. |
|
284 | 284 | |
|
285 | 285 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition |
|
286 | 286 | expand to the command arguments. Unmatched arguments are |
|
287 | 287 | removed. ``$0`` expands to the alias name and ``$@`` expands to all |
|
288 | 288 | arguments separated by a space. ``"$@"`` (with quotes) expands to all |
|
289 | 289 | arguments quoted individually and separated by a space. These expansions |
|
290 | 290 | happen before the command is passed to the shell. |
|
291 | 291 | |
|
292 | 292 | Shell aliases are executed in an environment where ``$HG`` expands to |
|
293 | 293 | the path of the Mercurial that was used to execute the alias. This is |
|
294 | 294 | useful when you want to call further Mercurial commands in a shell |
|
295 | 295 | alias, as was done above for the purge alias. In addition, |
|
296 | 296 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg |
|
297 | 297 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
298 | 298 | |
|
299 | 299 | .. note:: |
|
300 | 300 | |
|
301 | 301 | Some global configuration options such as ``-R`` are |
|
302 | 302 | processed before shell aliases and will thus not be passed to |
|
303 | 303 | aliases. |
|
304 | 304 | |
|
305 | 305 | |
|
306 | 306 | ``annotate`` |
|
307 | 307 | ------------ |
|
308 | 308 | |
|
309 | 309 | Settings used when displaying file annotations. All values are |
|
310 | 310 | Booleans and default to False. See :hg:`help config.diff` for |
|
311 | 311 | related options for the diff command. |
|
312 | 312 | |
|
313 | 313 | ``ignorews`` |
|
314 | 314 | Ignore white space when comparing lines. |
|
315 | 315 | |
|
316 | 316 | ``ignorewseol`` |
|
317 | 317 | Ignore white space at the end of a line when comparing lines. |
|
318 | 318 | |
|
319 | 319 | ``ignorewsamount`` |
|
320 | 320 | Ignore changes in the amount of white space. |
|
321 | 321 | |
|
322 | 322 | ``ignoreblanklines`` |
|
323 | 323 | Ignore changes whose lines are all blank. |
|
324 | 324 | |
|
325 | 325 | |
|
326 | 326 | ``auth`` |
|
327 | 327 | -------- |
|
328 | 328 | |
|
329 | 329 | Authentication credentials and other authentication-like configuration |
|
330 | 330 | for HTTP connections. This section allows you to store usernames and |
|
331 | 331 | passwords for use when logging *into* HTTP servers. See |
|
332 | 332 | :hg:`help config.web` if you want to configure *who* can login to |
|
333 | 333 | your HTTP server. |
|
334 | 334 | |
|
335 | 335 | The following options apply to all hosts. |
|
336 | 336 | |
|
337 | 337 | ``cookiefile`` |
|
338 | 338 | Path to a file containing HTTP cookie lines. Cookies matching a |
|
339 | 339 | host will be sent automatically. |
|
340 | 340 | |
|
341 | 341 | The file format uses the Mozilla cookies.txt format, which defines cookies |
|
342 | 342 | on their own lines. Each line contains 7 fields delimited by the tab |
|
343 | 343 | character (domain, is_domain_cookie, path, is_secure, expires, name, |
|
344 | 344 | value). For more info, do an Internet search for "Netscape cookies.txt |
|
345 | 345 | format." |
|
346 | 346 | |
|
347 | 347 | Note: the cookies parser does not handle port numbers on domains. You |
|
348 | 348 | will need to remove ports from the domain for the cookie to be recognized. |
|
349 | 349 | This could result in a cookie being disclosed to an unwanted server. |
|
350 | 350 | |
|
351 | 351 | The cookies file is read-only. |
|
352 | 352 | |
|
353 | 353 | Other options in this section are grouped by name and have the following |
|
354 | 354 | format:: |
|
355 | 355 | |
|
356 | 356 | <name>.<argument> = <value> |
|
357 | 357 | |
|
358 | 358 | where ``<name>`` is used to group arguments into authentication |
|
359 | 359 | entries. Example:: |
|
360 | 360 | |
|
361 | 361 | foo.prefix = hg.intevation.de/mercurial |
|
362 | 362 | foo.username = foo |
|
363 | 363 | foo.password = bar |
|
364 | 364 | foo.schemes = http https |
|
365 | 365 | |
|
366 | 366 | bar.prefix = secure.example.org |
|
367 | 367 | bar.key = path/to/file.key |
|
368 | 368 | bar.cert = path/to/file.cert |
|
369 | 369 | bar.schemes = https |
|
370 | 370 | |
|
371 | 371 | Supported arguments: |
|
372 | 372 | |
|
373 | 373 | ``prefix`` |
|
374 | 374 | Either ``*`` or a URI prefix with or without the scheme part. |
|
375 | 375 | The authentication entry with the longest matching prefix is used |
|
376 | 376 | (where ``*`` matches everything and counts as a match of length |
|
377 | 377 | 1). If the prefix doesn't include a scheme, the match is performed |
|
378 | 378 | against the URI with its scheme stripped as well, and the schemes |
|
379 | 379 | argument, q.v., is then subsequently consulted. |
|
380 | 380 | |
|
381 | 381 | ``username`` |
|
382 | 382 | Optional. Username to authenticate with. If not given, and the |
|
383 | 383 | remote site requires basic or digest authentication, the user will |
|
384 | 384 | be prompted for it. Environment variables are expanded in the |
|
385 | 385 | username letting you do ``foo.username = $USER``. If the URI |
|
386 | 386 | includes a username, only ``[auth]`` entries with a matching |
|
387 | 387 | username or without a username will be considered. |
|
388 | 388 | |
|
389 | 389 | ``password`` |
|
390 | 390 | Optional. Password to authenticate with. If not given, and the |
|
391 | 391 | remote site requires basic or digest authentication, the user |
|
392 | 392 | will be prompted for it. |
|
393 | 393 | |
|
394 | 394 | ``key`` |
|
395 | 395 | Optional. PEM encoded client certificate key file. Environment |
|
396 | 396 | variables are expanded in the filename. |
|
397 | 397 | |
|
398 | 398 | ``cert`` |
|
399 | 399 | Optional. PEM encoded client certificate chain file. Environment |
|
400 | 400 | variables are expanded in the filename. |
|
401 | 401 | |
|
402 | 402 | ``schemes`` |
|
403 | 403 | Optional. Space separated list of URI schemes to use this |
|
404 | 404 | authentication entry with. Only used if the prefix doesn't include |
|
405 | 405 | a scheme. Supported schemes are http and https. They will match |
|
406 | 406 | static-http and static-https respectively, as well. |
|
407 | 407 | (default: https) |
|
408 | 408 | |
|
409 | 409 | If no suitable authentication entry is found, the user is prompted |
|
410 | 410 | for credentials as usual if required by the remote. |
|
411 | 411 | |
|
412 | 412 | ``color`` |
|
413 | 413 | --------- |
|
414 | 414 | |
|
415 | 415 | Configure the Mercurial color mode. For details about how to define your custom |
|
416 | 416 | effect and style see :hg:`help color`. |
|
417 | 417 | |
|
418 | 418 | ``mode`` |
|
419 | 419 | String: control the method used to output color. One of ``auto``, ``ansi``, |
|
420 | 420 | ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will |
|
421 | 421 | use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a |
|
422 | 422 | terminal. Any invalid value will disable color. |
|
423 | 423 | |
|
424 | 424 | ``pagermode`` |
|
425 | 425 | String: optional override of ``color.mode`` used with pager. |
|
426 | 426 | |
|
427 | 427 | On some systems, terminfo mode may cause problems when using |
|
428 | 428 | color with ``less -R`` as a pager program. less with the -R option |
|
429 | 429 | will only display ECMA-48 color codes, and terminfo mode may sometimes |
|
430 | 430 | emit codes that less doesn't understand. You can work around this by |
|
431 | 431 | either using ansi mode (or auto mode), or by using less -r (which will |
|
432 | 432 | pass through all terminal control codes, not just color control |
|
433 | 433 | codes). |
|
434 | 434 | |
|
435 | 435 | On some systems (such as MSYS in Windows), the terminal may support |
|
436 | 436 | a different color mode than the pager program. |
|
437 | 437 | |
|
438 | 438 | ``commands`` |
|
439 | 439 | ------------ |
|
440 | 440 | |
|
441 | 441 | ``status.relative`` |
|
442 | 442 | Make paths in :hg:`status` output relative to the current directory. |
|
443 | 443 | (default: False) |
|
444 | 444 | |
|
445 | 445 | ``status.terse`` |
|
446 | 446 | Default value for the --terse flag, which condenes status output. |
|
447 | 447 | (default: empty) |
|
448 | 448 | |
|
449 | 449 | ``update.check`` |
|
450 | 450 | Determines what level of checking :hg:`update` will perform before moving |
|
451 | 451 | to a destination revision. Valid values are ``abort``, ``none``, |
|
452 | 452 | ``linear``, and ``noconflict``. ``abort`` always fails if the working |
|
453 | 453 | directory has uncommitted changes. ``none`` performs no checking, and may |
|
454 | 454 | result in a merge with uncommitted changes. ``linear`` allows any update |
|
455 | 455 | as long as it follows a straight line in the revision history, and may |
|
456 | 456 | trigger a merge with uncommitted changes. ``noconflict`` will allow any |
|
457 | 457 | update which would not trigger a merge with uncommitted changes, if any |
|
458 | 458 | are present. |
|
459 | 459 | (default: ``linear``) |
|
460 | 460 | |
|
461 | 461 | ``update.requiredest`` |
|
462 | 462 | Require that the user pass a destination when running :hg:`update`. |
|
463 | 463 | For example, :hg:`update .::` will be allowed, but a plain :hg:`update` |
|
464 | 464 | will be disallowed. |
|
465 | 465 | (default: False) |
|
466 | 466 | |
|
467 | 467 | ``committemplate`` |
|
468 | 468 | ------------------ |
|
469 | 469 | |
|
470 | 470 | ``changeset`` |
|
471 | 471 | String: configuration in this section is used as the template to |
|
472 | 472 | customize the text shown in the editor when committing. |
|
473 | 473 | |
|
474 | 474 | In addition to pre-defined template keywords, commit log specific one |
|
475 | 475 | below can be used for customization: |
|
476 | 476 | |
|
477 | 477 | ``extramsg`` |
|
478 | 478 | String: Extra message (typically 'Leave message empty to abort |
|
479 | 479 | commit.'). This may be changed by some commands or extensions. |
|
480 | 480 | |
|
481 | 481 | For example, the template configuration below shows as same text as |
|
482 | 482 | one shown by default:: |
|
483 | 483 | |
|
484 | 484 | [committemplate] |
|
485 | 485 | changeset = {desc}\n\n |
|
486 | 486 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
487 | 487 | HG: {extramsg} |
|
488 | 488 | HG: -- |
|
489 | 489 | HG: user: {author}\n{ifeq(p2rev, "-1", "", |
|
490 | 490 | "HG: branch merge\n") |
|
491 | 491 | }HG: branch '{branch}'\n{if(activebookmark, |
|
492 | 492 | "HG: bookmark '{activebookmark}'\n") }{subrepos % |
|
493 | 493 | "HG: subrepo {subrepo}\n" }{file_adds % |
|
494 | 494 | "HG: added {file}\n" }{file_mods % |
|
495 | 495 | "HG: changed {file}\n" }{file_dels % |
|
496 | 496 | "HG: removed {file}\n" }{if(files, "", |
|
497 | 497 | "HG: no files changed\n")} |
|
498 | 498 | |
|
499 | 499 | ``diff()`` |
|
500 | 500 | String: show the diff (see :hg:`help templates` for detail) |
|
501 | 501 | |
|
502 | 502 | Sometimes it is helpful to show the diff of the changeset in the editor without |
|
503 | 503 | having to prefix 'HG: ' to each line so that highlighting works correctly. For |
|
504 | 504 | this, Mercurial provides a special string which will ignore everything below |
|
505 | 505 | it:: |
|
506 | 506 | |
|
507 | 507 | HG: ------------------------ >8 ------------------------ |
|
508 | 508 | |
|
509 | 509 | For example, the template configuration below will show the diff below the |
|
510 | 510 | extra message:: |
|
511 | 511 | |
|
512 | 512 | [committemplate] |
|
513 | 513 | changeset = {desc}\n\n |
|
514 | 514 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
515 | 515 | HG: {extramsg} |
|
516 | 516 | HG: ------------------------ >8 ------------------------ |
|
517 | 517 | HG: Do not touch the line above. |
|
518 | 518 | HG: Everything below will be removed. |
|
519 | 519 | {diff()} |
|
520 | 520 | |
|
521 | 521 | .. note:: |
|
522 | 522 | |
|
523 | 523 | For some problematic encodings (see :hg:`help win32mbcs` for |
|
524 | 524 | detail), this customization should be configured carefully, to |
|
525 | 525 | avoid showing broken characters. |
|
526 | 526 | |
|
527 | 527 | For example, if a multibyte character ending with backslash (0x5c) is |
|
528 | 528 | followed by the ASCII character 'n' in the customized template, |
|
529 | 529 | the sequence of backslash and 'n' is treated as line-feed unexpectedly |
|
530 | 530 | (and the multibyte character is broken, too). |
|
531 | 531 | |
|
532 | 532 | Customized template is used for commands below (``--edit`` may be |
|
533 | 533 | required): |
|
534 | 534 | |
|
535 | 535 | - :hg:`backout` |
|
536 | 536 | - :hg:`commit` |
|
537 | 537 | - :hg:`fetch` (for merge commit only) |
|
538 | 538 | - :hg:`graft` |
|
539 | 539 | - :hg:`histedit` |
|
540 | 540 | - :hg:`import` |
|
541 | 541 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` |
|
542 | 542 | - :hg:`rebase` |
|
543 | 543 | - :hg:`shelve` |
|
544 | 544 | - :hg:`sign` |
|
545 | 545 | - :hg:`tag` |
|
546 | 546 | - :hg:`transplant` |
|
547 | 547 | |
|
548 | 548 | Configuring items below instead of ``changeset`` allows showing |
|
549 | 549 | customized message only for specific actions, or showing different |
|
550 | 550 | messages for each action. |
|
551 | 551 | |
|
552 | 552 | - ``changeset.backout`` for :hg:`backout` |
|
553 | 553 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges |
|
554 | 554 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other |
|
555 | 555 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges |
|
556 | 556 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other |
|
557 | 557 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) |
|
558 | 558 | - ``changeset.gpg.sign`` for :hg:`sign` |
|
559 | 559 | - ``changeset.graft`` for :hg:`graft` |
|
560 | 560 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` |
|
561 | 561 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` |
|
562 | 562 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` |
|
563 | 563 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` |
|
564 | 564 | - ``changeset.import.bypass`` for :hg:`import --bypass` |
|
565 | 565 | - ``changeset.import.normal.merge`` for :hg:`import` on merges |
|
566 | 566 | - ``changeset.import.normal.normal`` for :hg:`import` on other |
|
567 | 567 | - ``changeset.mq.qnew`` for :hg:`qnew` |
|
568 | 568 | - ``changeset.mq.qfold`` for :hg:`qfold` |
|
569 | 569 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` |
|
570 | 570 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` |
|
571 | 571 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges |
|
572 | 572 | - ``changeset.rebase.normal`` for :hg:`rebase` on other |
|
573 | 573 | - ``changeset.shelve.shelve`` for :hg:`shelve` |
|
574 | 574 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` |
|
575 | 575 | - ``changeset.tag.remove`` for :hg:`tag --remove` |
|
576 | 576 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges |
|
577 | 577 | - ``changeset.transplant.normal`` for :hg:`transplant` on other |
|
578 | 578 | |
|
579 | 579 | These dot-separated lists of names are treated as hierarchical ones. |
|
580 | 580 | For example, ``changeset.tag.remove`` customizes the commit message |
|
581 | 581 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the |
|
582 | 582 | commit message for :hg:`tag` regardless of ``--remove`` option. |
|
583 | 583 | |
|
584 | 584 | When the external editor is invoked for a commit, the corresponding |
|
585 | 585 | dot-separated list of names without the ``changeset.`` prefix |
|
586 | 586 | (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment |
|
587 | 587 | variable. |
|
588 | 588 | |
|
589 | 589 | In this section, items other than ``changeset`` can be referred from |
|
590 | 590 | others. For example, the configuration to list committed files up |
|
591 | 591 | below can be referred as ``{listupfiles}``:: |
|
592 | 592 | |
|
593 | 593 | [committemplate] |
|
594 | 594 | listupfiles = {file_adds % |
|
595 | 595 | "HG: added {file}\n" }{file_mods % |
|
596 | 596 | "HG: changed {file}\n" }{file_dels % |
|
597 | 597 | "HG: removed {file}\n" }{if(files, "", |
|
598 | 598 | "HG: no files changed\n")} |
|
599 | 599 | |
|
600 | 600 | ``decode/encode`` |
|
601 | 601 | ----------------- |
|
602 | 602 | |
|
603 | 603 | Filters for transforming files on checkout/checkin. This would |
|
604 | 604 | typically be used for newline processing or other |
|
605 | 605 | localization/canonicalization of files. |
|
606 | 606 | |
|
607 | 607 | Filters consist of a filter pattern followed by a filter command. |
|
608 | 608 | Filter patterns are globs by default, rooted at the repository root. |
|
609 | 609 | For example, to match any file ending in ``.txt`` in the root |
|
610 | 610 | directory only, use the pattern ``*.txt``. To match any file ending |
|
611 | 611 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
612 | 612 | For each file only the first matching filter applies. |
|
613 | 613 | |
|
614 | 614 | The filter command can start with a specifier, either ``pipe:`` or |
|
615 | 615 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
616 | 616 | |
|
617 | 617 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
618 | 618 | data on stdout. |
|
619 | 619 | |
|
620 | 620 | Pipe example:: |
|
621 | 621 | |
|
622 | 622 | [encode] |
|
623 | 623 | # uncompress gzip files on checkin to improve delta compression |
|
624 | 624 | # note: not necessarily a good idea, just an example |
|
625 | 625 | *.gz = pipe: gunzip |
|
626 | 626 | |
|
627 | 627 | [decode] |
|
628 | 628 | # recompress gzip files when writing them to the working dir (we |
|
629 | 629 | # can safely omit "pipe:", because it's the default) |
|
630 | 630 | *.gz = gzip |
|
631 | 631 | |
|
632 | 632 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
633 | 633 | with the name of a temporary file that contains the data to be |
|
634 | 634 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
635 | 635 | of an empty temporary file, where the filtered data must be written by |
|
636 | 636 | the command. |
|
637 | 637 | |
|
638 | 638 | .. container:: windows |
|
639 | 639 | |
|
640 | 640 | .. note:: |
|
641 | 641 | |
|
642 | 642 | The tempfile mechanism is recommended for Windows systems, |
|
643 | 643 | where the standard shell I/O redirection operators often have |
|
644 | 644 | strange effects and may corrupt the contents of your files. |
|
645 | 645 | |
|
646 | 646 | This filter mechanism is used internally by the ``eol`` extension to |
|
647 | 647 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
648 | 648 | format. We suggest you use the ``eol`` extension for convenience. |
|
649 | 649 | |
|
650 | 650 | |
|
651 | 651 | ``defaults`` |
|
652 | 652 | ------------ |
|
653 | 653 | |
|
654 | 654 | (defaults are deprecated. Don't use them. Use aliases instead.) |
|
655 | 655 | |
|
656 | 656 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
657 | 657 | default options/arguments to pass to the specified commands. |
|
658 | 658 | |
|
659 | 659 | The following example makes :hg:`log` run in verbose mode, and |
|
660 | 660 | :hg:`status` show only the modified files, by default:: |
|
661 | 661 | |
|
662 | 662 | [defaults] |
|
663 | 663 | log = -v |
|
664 | 664 | status = -m |
|
665 | 665 | |
|
666 | 666 | The actual commands, instead of their aliases, must be used when |
|
667 | 667 | defining command defaults. The command defaults will also be applied |
|
668 | 668 | to the aliases of the commands defined. |
|
669 | 669 | |
|
670 | 670 | |
|
671 | 671 | ``diff`` |
|
672 | 672 | -------- |
|
673 | 673 | |
|
674 | 674 | Settings used when displaying diffs. Everything except for ``unified`` |
|
675 | 675 | is a Boolean and defaults to False. See :hg:`help config.annotate` |
|
676 | 676 | for related options for the annotate command. |
|
677 | 677 | |
|
678 | 678 | ``git`` |
|
679 | 679 | Use git extended diff format. |
|
680 | 680 | |
|
681 | 681 | ``nobinary`` |
|
682 | 682 | Omit git binary patches. |
|
683 | 683 | |
|
684 | 684 | ``nodates`` |
|
685 | 685 | Don't include dates in diff headers. |
|
686 | 686 | |
|
687 | 687 | ``noprefix`` |
|
688 | 688 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. |
|
689 | 689 | |
|
690 | 690 | ``showfunc`` |
|
691 | 691 | Show which function each change is in. |
|
692 | 692 | |
|
693 | 693 | ``ignorews`` |
|
694 | 694 | Ignore white space when comparing lines. |
|
695 | 695 | |
|
696 | 696 | ``ignorewsamount`` |
|
697 | 697 | Ignore changes in the amount of white space. |
|
698 | 698 | |
|
699 | 699 | ``ignoreblanklines`` |
|
700 | 700 | Ignore changes whose lines are all blank. |
|
701 | 701 | |
|
702 | 702 | ``unified`` |
|
703 | 703 | Number of lines of context to show. |
|
704 | 704 | |
|
705 | 705 | ``word-diff`` |
|
706 | 706 | Highlight changed words. |
|
707 | 707 | |
|
708 | 708 | ``email`` |
|
709 | 709 | --------- |
|
710 | 710 | |
|
711 | 711 | Settings for extensions that send email messages. |
|
712 | 712 | |
|
713 | 713 | ``from`` |
|
714 | 714 | Optional. Email address to use in "From" header and SMTP envelope |
|
715 | 715 | of outgoing messages. |
|
716 | 716 | |
|
717 | 717 | ``to`` |
|
718 | 718 | Optional. Comma-separated list of recipients' email addresses. |
|
719 | 719 | |
|
720 | 720 | ``cc`` |
|
721 | 721 | Optional. Comma-separated list of carbon copy recipients' |
|
722 | 722 | email addresses. |
|
723 | 723 | |
|
724 | 724 | ``bcc`` |
|
725 | 725 | Optional. Comma-separated list of blind carbon copy recipients' |
|
726 | 726 | email addresses. |
|
727 | 727 | |
|
728 | 728 | ``method`` |
|
729 | 729 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
730 | 730 | (default), use SMTP (see the ``[smtp]`` section for configuration). |
|
731 | 731 | Otherwise, use as name of program to run that acts like sendmail |
|
732 | 732 | (takes ``-f`` option for sender, list of recipients on command line, |
|
733 | 733 | message on stdin). Normally, setting this to ``sendmail`` or |
|
734 | 734 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
735 | 735 | |
|
736 | 736 | ``charsets`` |
|
737 | 737 | Optional. Comma-separated list of character sets considered |
|
738 | 738 | convenient for recipients. Addresses, headers, and parts not |
|
739 | 739 | containing patches of outgoing messages will be encoded in the |
|
740 | 740 | first character set to which conversion from local encoding |
|
741 | 741 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
742 | 742 | conversion fails, the text in question is sent as is. |
|
743 | 743 | (default: '') |
|
744 | 744 | |
|
745 | 745 | Order of outgoing email character sets: |
|
746 | 746 | |
|
747 | 747 | 1. ``us-ascii``: always first, regardless of settings |
|
748 | 748 | 2. ``email.charsets``: in order given by user |
|
749 | 749 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
750 | 750 | 4. ``$HGENCODING``: if not in email.charsets |
|
751 | 751 | 5. ``utf-8``: always last, regardless of settings |
|
752 | 752 | |
|
753 | 753 | Email example:: |
|
754 | 754 | |
|
755 | 755 | [email] |
|
756 | 756 | from = Joseph User <joe.user@example.com> |
|
757 | 757 | method = /usr/sbin/sendmail |
|
758 | 758 | # charsets for western Europeans |
|
759 | 759 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
760 | 760 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
761 | 761 | |
|
762 | 762 | |
|
763 | 763 | ``extensions`` |
|
764 | 764 | -------------- |
|
765 | 765 | |
|
766 | 766 | Mercurial has an extension mechanism for adding new features. To |
|
767 | 767 | enable an extension, create an entry for it in this section. |
|
768 | 768 | |
|
769 | 769 | If you know that the extension is already in Python's search path, |
|
770 | 770 | you can give the name of the module, followed by ``=``, with nothing |
|
771 | 771 | after the ``=``. |
|
772 | 772 | |
|
773 | 773 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
774 | 774 | the path to the ``.py`` file (including the file name extension) that |
|
775 | 775 | defines the extension. |
|
776 | 776 | |
|
777 | 777 | To explicitly disable an extension that is enabled in an hgrc of |
|
778 | 778 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` |
|
779 | 779 | or ``foo = !`` when path is not supplied. |
|
780 | 780 | |
|
781 | 781 | Example for ``~/.hgrc``:: |
|
782 | 782 | |
|
783 | 783 | [extensions] |
|
784 | 784 | # (the churn extension will get loaded from Mercurial's path) |
|
785 | 785 | churn = |
|
786 | 786 | # (this extension will get loaded from the file specified) |
|
787 | 787 | myfeature = ~/.hgext/myfeature.py |
|
788 | 788 | |
|
789 | 789 | |
|
790 | 790 | ``format`` |
|
791 | 791 | ---------- |
|
792 | 792 | |
|
793 | 793 | ``usegeneraldelta`` |
|
794 | 794 | Enable or disable the "generaldelta" repository format which improves |
|
795 | 795 | repository compression by allowing "revlog" to store delta against arbitrary |
|
796 | 796 | revision instead of the previous stored one. This provides significant |
|
797 | 797 | improvement for repositories with branches. |
|
798 | 798 | |
|
799 | 799 | Repositories with this on-disk format require Mercurial version 1.9. |
|
800 | 800 | |
|
801 | 801 | Enabled by default. |
|
802 | 802 | |
|
803 | 803 | ``dotencode`` |
|
804 | 804 | Enable or disable the "dotencode" repository format which enhances |
|
805 | 805 | the "fncache" repository format (which has to be enabled to use |
|
806 | 806 | dotencode) to avoid issues with filenames starting with ._ on |
|
807 | 807 | Mac OS X and spaces on Windows. |
|
808 | 808 | |
|
809 | 809 | Repositories with this on-disk format require Mercurial version 1.7. |
|
810 | 810 | |
|
811 | 811 | Enabled by default. |
|
812 | 812 | |
|
813 | 813 | ``usefncache`` |
|
814 | 814 | Enable or disable the "fncache" repository format which enhances |
|
815 | 815 | the "store" repository format (which has to be enabled to use |
|
816 | 816 | fncache) to allow longer filenames and avoids using Windows |
|
817 | 817 | reserved names, e.g. "nul". |
|
818 | 818 | |
|
819 | 819 | Repositories with this on-disk format require Mercurial version 1.1. |
|
820 | 820 | |
|
821 | 821 | Enabled by default. |
|
822 | 822 | |
|
823 | 823 | ``usestore`` |
|
824 | 824 | Enable or disable the "store" repository format which improves |
|
825 | 825 | compatibility with systems that fold case or otherwise mangle |
|
826 | 826 | filenames. Disabling this option will allow you to store longer filenames |
|
827 | 827 | in some situations at the expense of compatibility. |
|
828 | 828 | |
|
829 | 829 | Repositories with this on-disk format require Mercurial version 0.9.4. |
|
830 | 830 | |
|
831 | 831 | Enabled by default. |
|
832 | 832 | |
|
833 | 833 | ``graph`` |
|
834 | 834 | --------- |
|
835 | 835 | |
|
836 | 836 | Web graph view configuration. This section let you change graph |
|
837 | 837 | elements display properties by branches, for instance to make the |
|
838 | 838 | ``default`` branch stand out. |
|
839 | 839 | |
|
840 | 840 | Each line has the following format:: |
|
841 | 841 | |
|
842 | 842 | <branch>.<argument> = <value> |
|
843 | 843 | |
|
844 | 844 | where ``<branch>`` is the name of the branch being |
|
845 | 845 | customized. Example:: |
|
846 | 846 | |
|
847 | 847 | [graph] |
|
848 | 848 | # 2px width |
|
849 | 849 | default.width = 2 |
|
850 | 850 | # red color |
|
851 | 851 | default.color = FF0000 |
|
852 | 852 | |
|
853 | 853 | Supported arguments: |
|
854 | 854 | |
|
855 | 855 | ``width`` |
|
856 | 856 | Set branch edges width in pixels. |
|
857 | 857 | |
|
858 | 858 | ``color`` |
|
859 | 859 | Set branch edges color in hexadecimal RGB notation. |
|
860 | 860 | |
|
861 | 861 | ``hooks`` |
|
862 | 862 | --------- |
|
863 | 863 | |
|
864 | 864 | Commands or Python functions that get automatically executed by |
|
865 | 865 | various actions such as starting or finishing a commit. Multiple |
|
866 | 866 | hooks can be run for the same action by appending a suffix to the |
|
867 | 867 | action. Overriding a site-wide hook can be done by changing its |
|
868 | 868 | value or setting it to an empty string. Hooks can be prioritized |
|
869 | 869 | by adding a prefix of ``priority.`` to the hook name on a new line |
|
870 | 870 | and setting the priority. The default priority is 0. |
|
871 | 871 | |
|
872 | 872 | Example ``.hg/hgrc``:: |
|
873 | 873 | |
|
874 | 874 | [hooks] |
|
875 | 875 | # update working directory after adding changesets |
|
876 | 876 | changegroup.update = hg update |
|
877 | 877 | # do not use the site-wide hook |
|
878 | 878 | incoming = |
|
879 | 879 | incoming.email = /my/email/hook |
|
880 | 880 | incoming.autobuild = /my/build/hook |
|
881 | 881 | # force autobuild hook to run before other incoming hooks |
|
882 | 882 | priority.incoming.autobuild = 1 |
|
883 | 883 | |
|
884 | 884 | Most hooks are run with environment variables set that give useful |
|
885 | 885 | additional information. For each hook below, the environment variables |
|
886 | 886 | it is passed are listed with names in the form ``$HG_foo``. The |
|
887 | 887 | ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks. |
|
888 | 888 | They contain the type of hook which triggered the run and the full name |
|
889 | 889 | of the hook in the config, respectively. In the example above, this will |
|
890 | 890 | be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``. |
|
891 | 891 | |
|
892 | 892 | .. container:: windows |
|
893 | 893 | |
|
894 | 894 | Some basic Unix syntax is supported for portability, including ``$VAR`` |
|
895 | 895 | and ``${VAR}`` style variables. To use a literal ``$``, it must be |
|
896 | 896 | escaped with a back slash or inside of a strong quote. |
|
897 | 897 | |
|
898 | 898 | ``changegroup`` |
|
899 | 899 | Run after a changegroup has been added via push, pull or unbundle. The ID of |
|
900 | 900 | the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``. |
|
901 | 901 | The URL from which changes came is in ``$HG_URL``. |
|
902 | 902 | |
|
903 | 903 | ``commit`` |
|
904 | 904 | Run after a changeset has been created in the local repository. The ID |
|
905 | 905 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
906 | 906 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
907 | 907 | |
|
908 | 908 | ``incoming`` |
|
909 | 909 | Run after a changeset has been pulled, pushed, or unbundled into |
|
910 | 910 | the local repository. The ID of the newly arrived changeset is in |
|
911 | 911 | ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``. |
|
912 | 912 | |
|
913 | 913 | ``outgoing`` |
|
914 | 914 | Run after sending changes from the local repository to another. The ID of |
|
915 | 915 | first changeset sent is in ``$HG_NODE``. The source of operation is in |
|
916 | 916 | ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`. |
|
917 | 917 | |
|
918 | 918 | ``post-<command>`` |
|
919 | 919 | Run after successful invocations of the associated command. The |
|
920 | 920 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
921 | 921 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
922 | 922 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
923 | 923 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
924 | 924 | dictionary of options (with unspecified options set to their defaults). |
|
925 | 925 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
926 | 926 | |
|
927 | 927 | ``fail-<command>`` |
|
928 | 928 | Run after a failed invocation of an associated command. The contents |
|
929 | 929 | of the command line are passed as ``$HG_ARGS``. Parsed command line |
|
930 | 930 | arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain |
|
931 | 931 | string representations of the python data internally passed to |
|
932 | 932 | <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified |
|
933 | 933 | options set to their defaults). ``$HG_PATS`` is a list of arguments. |
|
934 | 934 | Hook failure is ignored. |
|
935 | 935 | |
|
936 | 936 | ``pre-<command>`` |
|
937 | 937 | Run before executing the associated command. The contents of the |
|
938 | 938 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
939 | 939 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
940 | 940 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
941 | 941 | is a dictionary of options (with unspecified options set to their |
|
942 | 942 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
943 | 943 | failure, the command doesn't execute and Mercurial returns the failure |
|
944 | 944 | code. |
|
945 | 945 | |
|
946 | 946 | ``prechangegroup`` |
|
947 | 947 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
948 | 948 | status 0 allows the changegroup to proceed. A non-zero status will |
|
949 | 949 | cause the push, pull or unbundle to fail. The URL from which changes |
|
950 | 950 | will come is in ``$HG_URL``. |
|
951 | 951 | |
|
952 | 952 | ``precommit`` |
|
953 | 953 | Run before starting a local commit. Exit status 0 allows the |
|
954 | 954 | commit to proceed. A non-zero status will cause the commit to fail. |
|
955 | 955 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
956 | 956 | |
|
957 | 957 | ``prelistkeys`` |
|
958 | 958 | Run before listing pushkeys (like bookmarks) in the |
|
959 | 959 | repository. A non-zero status will cause failure. The key namespace is |
|
960 | 960 | in ``$HG_NAMESPACE``. |
|
961 | 961 | |
|
962 | 962 | ``preoutgoing`` |
|
963 | 963 | Run before collecting changes to send from the local repository to |
|
964 | 964 | another. A non-zero status will cause failure. This lets you prevent |
|
965 | 965 | pull over HTTP or SSH. It can also prevent propagating commits (via |
|
966 | 966 | local pull, push (outbound) or bundle commands), but not completely, |
|
967 | 967 | since you can just copy files instead. The source of operation is in |
|
968 | 968 | ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote |
|
969 | 969 | SSH or HTTP repository. If "push", "pull" or "bundle", the operation |
|
970 | 970 | is happening on behalf of a repository on same system. |
|
971 | 971 | |
|
972 | 972 | ``prepushkey`` |
|
973 | 973 | Run before a pushkey (like a bookmark) is added to the |
|
974 | 974 | repository. A non-zero status will cause the key to be rejected. The |
|
975 | 975 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
976 | 976 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
977 | 977 | ``$HG_NEW``. |
|
978 | 978 | |
|
979 | 979 | ``pretag`` |
|
980 | 980 | Run before creating a tag. Exit status 0 allows the tag to be |
|
981 | 981 | created. A non-zero status will cause the tag to fail. The ID of the |
|
982 | 982 | changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The |
|
983 | 983 | tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``. |
|
984 | 984 | |
|
985 | 985 | ``pretxnopen`` |
|
986 | 986 | Run before any new repository transaction is open. The reason for the |
|
987 | 987 | transaction will be in ``$HG_TXNNAME``, and a unique identifier for the |
|
988 | 988 | transaction will be in ``HG_TXNID``. A non-zero status will prevent the |
|
989 | 989 | transaction from being opened. |
|
990 | 990 | |
|
991 | 991 | ``pretxnclose`` |
|
992 | 992 | Run right before the transaction is actually finalized. Any repository change |
|
993 | 993 | will be visible to the hook program. This lets you validate the transaction |
|
994 | 994 | content or change it. Exit status 0 allows the commit to proceed. A non-zero |
|
995 | 995 | status will cause the transaction to be rolled back. The reason for the |
|
996 | 996 | transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for |
|
997 | 997 | the transaction will be in ``HG_TXNID``. The rest of the available data will |
|
998 | 998 | vary according the transaction type. New changesets will add ``$HG_NODE`` |
|
999 | 999 | (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last |
|
1000 | 1000 | added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and |
|
1001 | 1001 | phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1`` |
|
1002 | 1002 | respectively, etc. |
|
1003 | 1003 | |
|
1004 | 1004 | ``pretxnclose-bookmark`` |
|
1005 | 1005 | Run right before a bookmark change is actually finalized. Any repository |
|
1006 | 1006 | change will be visible to the hook program. This lets you validate the |
|
1007 | 1007 | transaction content or change it. Exit status 0 allows the commit to |
|
1008 | 1008 | proceed. A non-zero status will cause the transaction to be rolled back. |
|
1009 | 1009 | The name of the bookmark will be available in ``$HG_BOOKMARK``, the new |
|
1010 | 1010 | bookmark location will be available in ``$HG_NODE`` while the previous |
|
1011 | 1011 | location will be available in ``$HG_OLDNODE``. In case of a bookmark |
|
1012 | 1012 | creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE`` |
|
1013 | 1013 | will be empty. |
|
1014 | 1014 | In addition, the reason for the transaction opening will be in |
|
1015 | 1015 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in |
|
1016 | 1016 | ``HG_TXNID``. |
|
1017 | 1017 | |
|
1018 | 1018 | ``pretxnclose-phase`` |
|
1019 | 1019 | Run right before a phase change is actually finalized. Any repository change |
|
1020 | 1020 | will be visible to the hook program. This lets you validate the transaction |
|
1021 | 1021 | content or change it. Exit status 0 allows the commit to proceed. A non-zero |
|
1022 | 1022 | status will cause the transaction to be rolled back. The hook is called |
|
1023 | 1023 | multiple times, once for each revision affected by a phase change. |
|
1024 | 1024 | The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE`` |
|
1025 | 1025 | while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE`` |
|
1026 | 1026 | will be empty. In addition, the reason for the transaction opening will be in |
|
1027 | 1027 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in |
|
1028 | 1028 | ``HG_TXNID``. The hook is also run for newly added revisions. In this case |
|
1029 | 1029 | the ``$HG_OLDPHASE`` entry will be empty. |
|
1030 | 1030 | |
|
1031 | 1031 | ``txnclose`` |
|
1032 | 1032 | Run after any repository transaction has been committed. At this |
|
1033 | 1033 | point, the transaction can no longer be rolled back. The hook will run |
|
1034 | 1034 | after the lock is released. See :hg:`help config.hooks.pretxnclose` for |
|
1035 | 1035 | details about available variables. |
|
1036 | 1036 | |
|
1037 | 1037 | ``txnclose-bookmark`` |
|
1038 | 1038 | Run after any bookmark change has been committed. At this point, the |
|
1039 | 1039 | transaction can no longer be rolled back. The hook will run after the lock |
|
1040 | 1040 | is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details |
|
1041 | 1041 | about available variables. |
|
1042 | 1042 | |
|
1043 | 1043 | ``txnclose-phase`` |
|
1044 | 1044 | Run after any phase change has been committed. At this point, the |
|
1045 | 1045 | transaction can no longer be rolled back. The hook will run after the lock |
|
1046 | 1046 | is released. See :hg:`help config.hooks.pretxnclose-phase` for details about |
|
1047 | 1047 | available variables. |
|
1048 | 1048 | |
|
1049 | 1049 | ``txnabort`` |
|
1050 | 1050 | Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose` |
|
1051 | 1051 | for details about available variables. |
|
1052 | 1052 | |
|
1053 | 1053 | ``pretxnchangegroup`` |
|
1054 | 1054 | Run after a changegroup has been added via push, pull or unbundle, but before |
|
1055 | 1055 | the transaction has been committed. The changegroup is visible to the hook |
|
1056 | 1056 | program. This allows validation of incoming changes before accepting them. |
|
1057 | 1057 | The ID of the first new changeset is in ``$HG_NODE`` and last is in |
|
1058 | 1058 | ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero |
|
1059 | 1059 | status will cause the transaction to be rolled back, and the push, pull or |
|
1060 | 1060 | unbundle will fail. The URL that was the source of changes is in ``$HG_URL``. |
|
1061 | 1061 | |
|
1062 | 1062 | ``pretxncommit`` |
|
1063 | 1063 | Run after a changeset has been created, but before the transaction is |
|
1064 | 1064 | committed. The changeset is visible to the hook program. This allows |
|
1065 | 1065 | validation of the commit message and changes. Exit status 0 allows the |
|
1066 | 1066 | commit to proceed. A non-zero status will cause the transaction to |
|
1067 | 1067 | be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent |
|
1068 | 1068 | changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
1069 | 1069 | |
|
1070 | 1070 | ``preupdate`` |
|
1071 | 1071 | Run before updating the working directory. Exit status 0 allows |
|
1072 | 1072 | the update to proceed. A non-zero status will prevent the update. |
|
1073 | 1073 | The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a |
|
1074 | 1074 | merge, the ID of second new parent is in ``$HG_PARENT2``. |
|
1075 | 1075 | |
|
1076 | 1076 | ``listkeys`` |
|
1077 | 1077 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
1078 | 1078 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
1079 | 1079 | dictionary containing the keys and values. |
|
1080 | 1080 | |
|
1081 | 1081 | ``pushkey`` |
|
1082 | 1082 | Run after a pushkey (like a bookmark) is added to the |
|
1083 | 1083 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
1084 | 1084 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
1085 | 1085 | value is in ``$HG_NEW``. |
|
1086 | 1086 | |
|
1087 | 1087 | ``tag`` |
|
1088 | 1088 | Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``. |
|
1089 | 1089 | The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in |
|
1090 | 1090 | the repository if ``$HG_LOCAL=0``. |
|
1091 | 1091 | |
|
1092 | 1092 | ``update`` |
|
1093 | 1093 | Run after updating the working directory. The changeset ID of first |
|
1094 | 1094 | new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new |
|
1095 | 1095 | parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
1096 | 1096 | update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``. |
|
1097 | 1097 | |
|
1098 | 1098 | .. note:: |
|
1099 | 1099 | |
|
1100 | 1100 | It is generally better to use standard hooks rather than the |
|
1101 | 1101 | generic pre- and post- command hooks, as they are guaranteed to be |
|
1102 | 1102 | called in the appropriate contexts for influencing transactions. |
|
1103 | 1103 | Also, hooks like "commit" will be called in all contexts that |
|
1104 | 1104 | generate a commit (e.g. tag) and not just the commit command. |
|
1105 | 1105 | |
|
1106 | 1106 | .. note:: |
|
1107 | 1107 | |
|
1108 | 1108 | Environment variables with empty values may not be passed to |
|
1109 | 1109 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
1110 | 1110 | will have an empty value under Unix-like platforms for non-merge |
|
1111 | 1111 | changesets, while it will not be available at all under Windows. |
|
1112 | 1112 | |
|
1113 | 1113 | The syntax for Python hooks is as follows:: |
|
1114 | 1114 | |
|
1115 | 1115 | hookname = python:modulename.submodule.callable |
|
1116 | 1116 | hookname = python:/path/to/python/module.py:callable |
|
1117 | 1117 | |
|
1118 | 1118 | Python hooks are run within the Mercurial process. Each hook is |
|
1119 | 1119 | called with at least three keyword arguments: a ui object (keyword |
|
1120 | 1120 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
1121 | 1121 | keyword that tells what kind of hook is used. Arguments listed as |
|
1122 | 1122 | environment variables above are passed as keyword arguments, with no |
|
1123 | 1123 | ``HG_`` prefix, and names in lower case. |
|
1124 | 1124 | |
|
1125 | 1125 | If a Python hook returns a "true" value or raises an exception, this |
|
1126 | 1126 | is treated as a failure. |
|
1127 | 1127 | |
|
1128 | 1128 | |
|
1129 | 1129 | ``hostfingerprints`` |
|
1130 | 1130 | -------------------- |
|
1131 | 1131 | |
|
1132 | 1132 | (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.) |
|
1133 | 1133 | |
|
1134 | 1134 | Fingerprints of the certificates of known HTTPS servers. |
|
1135 | 1135 | |
|
1136 | 1136 | A HTTPS connection to a server with a fingerprint configured here will |
|
1137 | 1137 | only succeed if the servers certificate matches the fingerprint. |
|
1138 | 1138 | This is very similar to how ssh known hosts works. |
|
1139 | 1139 | |
|
1140 | 1140 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
1141 | 1141 | Multiple values can be specified (separated by spaces or commas). This can |
|
1142 | 1142 | be used to define both old and new fingerprints while a host transitions |
|
1143 | 1143 | to a new certificate. |
|
1144 | 1144 | |
|
1145 | 1145 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
1146 | 1146 | |
|
1147 | 1147 | For example:: |
|
1148 | 1148 | |
|
1149 | 1149 | [hostfingerprints] |
|
1150 | 1150 | hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1151 | 1151 | hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1152 | 1152 | |
|
1153 | 1153 | ``hostsecurity`` |
|
1154 | 1154 | ---------------- |
|
1155 | 1155 | |
|
1156 | 1156 | Used to specify global and per-host security settings for connecting to |
|
1157 | 1157 | other machines. |
|
1158 | 1158 | |
|
1159 | 1159 | The following options control default behavior for all hosts. |
|
1160 | 1160 | |
|
1161 | 1161 | ``ciphers`` |
|
1162 | 1162 | Defines the cryptographic ciphers to use for connections. |
|
1163 | 1163 | |
|
1164 | 1164 | Value must be a valid OpenSSL Cipher List Format as documented at |
|
1165 | 1165 | https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT. |
|
1166 | 1166 | |
|
1167 | 1167 | This setting is for advanced users only. Setting to incorrect values |
|
1168 | 1168 | can significantly lower connection security or decrease performance. |
|
1169 | 1169 | You have been warned. |
|
1170 | 1170 | |
|
1171 | 1171 | This option requires Python 2.7. |
|
1172 | 1172 | |
|
1173 | 1173 | ``minimumprotocol`` |
|
1174 | 1174 | Defines the minimum channel encryption protocol to use. |
|
1175 | 1175 | |
|
1176 | 1176 | By default, the highest version of TLS supported by both client and server |
|
1177 | 1177 | is used. |
|
1178 | 1178 | |
|
1179 | 1179 | Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``. |
|
1180 | 1180 | |
|
1181 | 1181 | When running on an old Python version, only ``tls1.0`` is allowed since |
|
1182 | 1182 | old versions of Python only support up to TLS 1.0. |
|
1183 | 1183 | |
|
1184 | 1184 | When running a Python that supports modern TLS versions, the default is |
|
1185 | 1185 | ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this |
|
1186 | 1186 | weakens security and should only be used as a feature of last resort if |
|
1187 | 1187 | a server does not support TLS 1.1+. |
|
1188 | 1188 | |
|
1189 | 1189 | Options in the ``[hostsecurity]`` section can have the form |
|
1190 | 1190 | ``hostname``:``setting``. This allows multiple settings to be defined on a |
|
1191 | 1191 | per-host basis. |
|
1192 | 1192 | |
|
1193 | 1193 | The following per-host settings can be defined. |
|
1194 | 1194 | |
|
1195 | 1195 | ``ciphers`` |
|
1196 | 1196 | This behaves like ``ciphers`` as described above except it only applies |
|
1197 | 1197 | to the host on which it is defined. |
|
1198 | 1198 | |
|
1199 | 1199 | ``fingerprints`` |
|
1200 | 1200 | A list of hashes of the DER encoded peer/remote certificate. Values have |
|
1201 | 1201 | the form ``algorithm``:``fingerprint``. e.g. |
|
1202 | 1202 | ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``. |
|
1203 | 1203 | In addition, colons (``:``) can appear in the fingerprint part. |
|
1204 | 1204 | |
|
1205 | 1205 | The following algorithms/prefixes are supported: ``sha1``, ``sha256``, |
|
1206 | 1206 | ``sha512``. |
|
1207 | 1207 | |
|
1208 | 1208 | Use of ``sha256`` or ``sha512`` is preferred. |
|
1209 | 1209 | |
|
1210 | 1210 | If a fingerprint is specified, the CA chain is not validated for this |
|
1211 | 1211 | host and Mercurial will require the remote certificate to match one |
|
1212 | 1212 | of the fingerprints specified. This means if the server updates its |
|
1213 | 1213 | certificate, Mercurial will abort until a new fingerprint is defined. |
|
1214 | 1214 | This can provide stronger security than traditional CA-based validation |
|
1215 | 1215 | at the expense of convenience. |
|
1216 | 1216 | |
|
1217 | 1217 | This option takes precedence over ``verifycertsfile``. |
|
1218 | 1218 | |
|
1219 | 1219 | ``minimumprotocol`` |
|
1220 | 1220 | This behaves like ``minimumprotocol`` as described above except it |
|
1221 | 1221 | only applies to the host on which it is defined. |
|
1222 | 1222 | |
|
1223 | 1223 | ``verifycertsfile`` |
|
1224 | 1224 | Path to file a containing a list of PEM encoded certificates used to |
|
1225 | 1225 | verify the server certificate. Environment variables and ``~user`` |
|
1226 | 1226 | constructs are expanded in the filename. |
|
1227 | 1227 | |
|
1228 | 1228 | The server certificate or the certificate's certificate authority (CA) |
|
1229 | 1229 | must match a certificate from this file or certificate verification |
|
1230 | 1230 | will fail and connections to the server will be refused. |
|
1231 | 1231 | |
|
1232 | 1232 | If defined, only certificates provided by this file will be used: |
|
1233 | 1233 | ``web.cacerts`` and any system/default certificates will not be |
|
1234 | 1234 | used. |
|
1235 | 1235 | |
|
1236 | 1236 | This option has no effect if the per-host ``fingerprints`` option |
|
1237 | 1237 | is set. |
|
1238 | 1238 | |
|
1239 | 1239 | The format of the file is as follows:: |
|
1240 | 1240 | |
|
1241 | 1241 | -----BEGIN CERTIFICATE----- |
|
1242 | 1242 | ... (certificate in base64 PEM encoding) ... |
|
1243 | 1243 | -----END CERTIFICATE----- |
|
1244 | 1244 | -----BEGIN CERTIFICATE----- |
|
1245 | 1245 | ... (certificate in base64 PEM encoding) ... |
|
1246 | 1246 | -----END CERTIFICATE----- |
|
1247 | 1247 | |
|
1248 | 1248 | For example:: |
|
1249 | 1249 | |
|
1250 | 1250 | [hostsecurity] |
|
1251 | 1251 | hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 |
|
1252 | 1252 | 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 |
|
1253 | 1253 | 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 |
|
1254 | 1254 | foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem |
|
1255 | 1255 | |
|
1256 | 1256 | To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1 |
|
1257 | 1257 | when connecting to ``hg.example.com``:: |
|
1258 | 1258 | |
|
1259 | 1259 | [hostsecurity] |
|
1260 | 1260 | minimumprotocol = tls1.2 |
|
1261 | 1261 | hg.example.com:minimumprotocol = tls1.1 |
|
1262 | 1262 | |
|
1263 | 1263 | ``http_proxy`` |
|
1264 | 1264 | -------------- |
|
1265 | 1265 | |
|
1266 | 1266 | Used to access web-based Mercurial repositories through a HTTP |
|
1267 | 1267 | proxy. |
|
1268 | 1268 | |
|
1269 | 1269 | ``host`` |
|
1270 | 1270 | Host name and (optional) port of the proxy server, for example |
|
1271 | 1271 | "myproxy:8000". |
|
1272 | 1272 | |
|
1273 | 1273 | ``no`` |
|
1274 | 1274 | Optional. Comma-separated list of host names that should bypass |
|
1275 | 1275 | the proxy. |
|
1276 | 1276 | |
|
1277 | 1277 | ``passwd`` |
|
1278 | 1278 | Optional. Password to authenticate with at the proxy server. |
|
1279 | 1279 | |
|
1280 | 1280 | ``user`` |
|
1281 | 1281 | Optional. User name to authenticate with at the proxy server. |
|
1282 | 1282 | |
|
1283 | 1283 | ``always`` |
|
1284 | 1284 | Optional. Always use the proxy, even for localhost and any entries |
|
1285 | 1285 | in ``http_proxy.no``. (default: False) |
|
1286 | 1286 | |
|
1287 | 1287 | ``merge`` |
|
1288 | 1288 | --------- |
|
1289 | 1289 | |
|
1290 | 1290 | This section specifies behavior during merges and updates. |
|
1291 | 1291 | |
|
1292 | 1292 | ``checkignored`` |
|
1293 | 1293 | Controls behavior when an ignored file on disk has the same name as a tracked |
|
1294 | 1294 | file in the changeset being merged or updated to, and has different |
|
1295 | 1295 | contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``, |
|
1296 | 1296 | abort on such files. With ``warn``, warn on such files and back them up as |
|
1297 | 1297 | ``.orig``. With ``ignore``, don't print a warning and back them up as |
|
1298 | 1298 | ``.orig``. (default: ``abort``) |
|
1299 | 1299 | |
|
1300 | 1300 | ``checkunknown`` |
|
1301 | 1301 | Controls behavior when an unknown file that isn't ignored has the same name |
|
1302 | 1302 | as a tracked file in the changeset being merged or updated to, and has |
|
1303 | 1303 | different contents. Similar to ``merge.checkignored``, except for files that |
|
1304 | 1304 | are not ignored. (default: ``abort``) |
|
1305 | 1305 | |
|
1306 | 1306 | ``on-failure`` |
|
1307 | 1307 | When set to ``continue`` (the default), the merge process attempts to |
|
1308 | 1308 | merge all unresolved files using the merge chosen tool, regardless of |
|
1309 | 1309 | whether previous file merge attempts during the process succeeded or not. |
|
1310 | 1310 | Setting this to ``prompt`` will prompt after any merge failure continue |
|
1311 | 1311 | or halt the merge process. Setting this to ``halt`` will automatically |
|
1312 | 1312 | halt the merge process on any merge tool failure. The merge process |
|
1313 | 1313 | can be restarted by using the ``resolve`` command. When a merge is |
|
1314 | 1314 | halted, the repository is left in a normal ``unresolved`` merge state. |
|
1315 | 1315 | (default: ``continue``) |
|
1316 | 1316 | |
|
1317 | 1317 | ``merge-patterns`` |
|
1318 | 1318 | ------------------ |
|
1319 | 1319 | |
|
1320 | 1320 | This section specifies merge tools to associate with particular file |
|
1321 | 1321 | patterns. Tools matched here will take precedence over the default |
|
1322 | 1322 | merge tool. Patterns are globs by default, rooted at the repository |
|
1323 | 1323 | root. |
|
1324 | 1324 | |
|
1325 | 1325 | Example:: |
|
1326 | 1326 | |
|
1327 | 1327 | [merge-patterns] |
|
1328 | 1328 | **.c = kdiff3 |
|
1329 | 1329 | **.jpg = myimgmerge |
|
1330 | 1330 | |
|
1331 | 1331 | ``merge-tools`` |
|
1332 | 1332 | --------------- |
|
1333 | 1333 | |
|
1334 | 1334 | This section configures external merge tools to use for file-level |
|
1335 | 1335 | merges. This section has likely been preconfigured at install time. |
|
1336 | 1336 | Use :hg:`config merge-tools` to check the existing configuration. |
|
1337 | 1337 | Also see :hg:`help merge-tools` for more details. |
|
1338 | 1338 | |
|
1339 | 1339 | Example ``~/.hgrc``:: |
|
1340 | 1340 | |
|
1341 | 1341 | [merge-tools] |
|
1342 | 1342 | # Override stock tool location |
|
1343 | 1343 | kdiff3.executable = ~/bin/kdiff3 |
|
1344 | 1344 | # Specify command line |
|
1345 | 1345 | kdiff3.args = $base $local $other -o $output |
|
1346 | 1346 | # Give higher priority |
|
1347 | 1347 | kdiff3.priority = 1 |
|
1348 | 1348 | |
|
1349 | 1349 | # Changing the priority of preconfigured tool |
|
1350 | 1350 | meld.priority = 0 |
|
1351 | 1351 | |
|
1352 | 1352 | # Disable a preconfigured tool |
|
1353 | 1353 | vimdiff.disabled = yes |
|
1354 | 1354 | |
|
1355 | 1355 | # Define new tool |
|
1356 | 1356 | myHtmlTool.args = -m $local $other $base $output |
|
1357 | 1357 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
1358 | 1358 | myHtmlTool.priority = 1 |
|
1359 | 1359 | |
|
1360 | 1360 | Supported arguments: |
|
1361 | 1361 | |
|
1362 | 1362 | ``priority`` |
|
1363 | 1363 | The priority in which to evaluate this tool. |
|
1364 | 1364 | (default: 0) |
|
1365 | 1365 | |
|
1366 | 1366 | ``executable`` |
|
1367 | 1367 | Either just the name of the executable or its pathname. |
|
1368 | 1368 | |
|
1369 | 1369 | .. container:: windows |
|
1370 | 1370 | |
|
1371 | 1371 | On Windows, the path can use environment variables with ${ProgramFiles} |
|
1372 | 1372 | syntax. |
|
1373 | 1373 | |
|
1374 | 1374 | (default: the tool name) |
|
1375 | 1375 | |
|
1376 | 1376 | ``args`` |
|
1377 | 1377 | The arguments to pass to the tool executable. You can refer to the |
|
1378 | 1378 | files being merged as well as the output file through these |
|
1379 | 1379 | variables: ``$base``, ``$local``, ``$other``, ``$output``. |
|
1380 | 1380 | |
|
1381 | 1381 | The meaning of ``$local`` and ``$other`` can vary depending on which action is |
|
1382 | 1382 | being performed. During an update or merge, ``$local`` represents the original |
|
1383 | 1383 | state of the file, while ``$other`` represents the commit you are updating to or |
|
1384 | 1384 | the commit you are merging with. During a rebase, ``$local`` represents the |
|
1385 | 1385 | destination of the rebase, and ``$other`` represents the commit being rebased. |
|
1386 | 1386 | |
|
1387 | 1387 | Some operations define custom labels to assist with identifying the revisions, |
|
1388 | 1388 | accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom |
|
1389 | 1389 | labels are not available, these will be ``local``, ``other``, and ``base``, |
|
1390 | 1390 | respectively. |
|
1391 | 1391 | (default: ``$local $base $other``) |
|
1392 | 1392 | |
|
1393 | 1393 | ``premerge`` |
|
1394 | 1394 | Attempt to run internal non-interactive 3-way merge tool before |
|
1395 | 1395 | launching external tool. Options are ``true``, ``false``, ``keep`` or |
|
1396 | 1396 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the |
|
1397 | 1397 | premerge fails. The ``keep-merge3`` will do the same but include information |
|
1398 | 1398 | about the base of the merge in the marker (see internal :merge3 in |
|
1399 | 1399 | :hg:`help merge-tools`). |
|
1400 | 1400 | (default: True) |
|
1401 | 1401 | |
|
1402 | 1402 | ``binary`` |
|
1403 | 1403 | This tool can merge binary files. (default: False, unless tool |
|
1404 | 1404 | was selected by file pattern match) |
|
1405 | 1405 | |
|
1406 | 1406 | ``symlink`` |
|
1407 | 1407 | This tool can merge symlinks. (default: False) |
|
1408 | 1408 | |
|
1409 | 1409 | ``check`` |
|
1410 | 1410 | A list of merge success-checking options: |
|
1411 | 1411 | |
|
1412 | 1412 | ``changed`` |
|
1413 | 1413 | Ask whether merge was successful when the merged file shows no changes. |
|
1414 | 1414 | ``conflicts`` |
|
1415 | 1415 | Check whether there are conflicts even though the tool reported success. |
|
1416 | 1416 | ``prompt`` |
|
1417 | 1417 | Always prompt for merge success, regardless of success reported by tool. |
|
1418 | 1418 | |
|
1419 | 1419 | ``fixeol`` |
|
1420 | 1420 | Attempt to fix up EOL changes caused by the merge tool. |
|
1421 | 1421 | (default: False) |
|
1422 | 1422 | |
|
1423 | 1423 | ``gui`` |
|
1424 | 1424 | This tool requires a graphical interface to run. (default: False) |
|
1425 | 1425 | |
|
1426 | 1426 | ``mergemarkers`` |
|
1427 | 1427 | Controls whether the labels passed via ``$labellocal``, ``$labelother``, and |
|
1428 | 1428 | ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or |
|
1429 | 1429 | ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict |
|
1430 | 1430 | markers generated during premerge will be ``detailed`` if either this option or |
|
1431 | 1431 | the corresponding option in the ``[ui]`` section is ``detailed``. |
|
1432 | 1432 | (default: ``basic``) |
|
1433 | 1433 | |
|
1434 | 1434 | ``mergemarkertemplate`` |
|
1435 | 1435 | This setting can be used to override ``mergemarkertemplate`` from the ``[ui]`` |
|
1436 | 1436 | section on a per-tool basis; this applies to the ``$label``-prefixed variables |
|
1437 | 1437 | and to the conflict markers that are generated if ``premerge`` is ``keep` or |
|
1438 | 1438 | ``keep-merge3``. See the corresponding variable in ``[ui]`` for more |
|
1439 | 1439 | information. |
|
1440 | 1440 | |
|
1441 | 1441 | .. container:: windows |
|
1442 | 1442 | |
|
1443 | 1443 | ``regkey`` |
|
1444 | 1444 | Windows registry key which describes install location of this |
|
1445 | 1445 | tool. Mercurial will search for this key first under |
|
1446 | 1446 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
1447 | 1447 | (default: None) |
|
1448 | 1448 | |
|
1449 | 1449 | ``regkeyalt`` |
|
1450 | 1450 | An alternate Windows registry key to try if the first key is not |
|
1451 | 1451 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
1452 | 1452 | semantics of the primary key. The most common use for this key |
|
1453 | 1453 | is to search for 32bit applications on 64bit operating systems. |
|
1454 | 1454 | (default: None) |
|
1455 | 1455 | |
|
1456 | 1456 | ``regname`` |
|
1457 | 1457 | Name of value to read from specified registry key. |
|
1458 | 1458 | (default: the unnamed (default) value) |
|
1459 | 1459 | |
|
1460 | 1460 | ``regappend`` |
|
1461 | 1461 | String to append to the value read from the registry, typically |
|
1462 | 1462 | the executable name of the tool. |
|
1463 | 1463 | (default: None) |
|
1464 | 1464 | |
|
1465 | 1465 | ``pager`` |
|
1466 | 1466 | --------- |
|
1467 | 1467 | |
|
1468 | 1468 | Setting used to control when to paginate and with what external tool. See |
|
1469 | 1469 | :hg:`help pager` for details. |
|
1470 | 1470 | |
|
1471 | 1471 | ``pager`` |
|
1472 | 1472 | Define the external tool used as pager. |
|
1473 | 1473 | |
|
1474 | 1474 | If no pager is set, Mercurial uses the environment variable $PAGER. |
|
1475 | 1475 | If neither pager.pager, nor $PAGER is set, a default pager will be |
|
1476 | 1476 | used, typically `less` on Unix and `more` on Windows. Example:: |
|
1477 | 1477 | |
|
1478 | 1478 | [pager] |
|
1479 | 1479 | pager = less -FRX |
|
1480 | 1480 | |
|
1481 | 1481 | ``ignore`` |
|
1482 | 1482 | List of commands to disable the pager for. Example:: |
|
1483 | 1483 | |
|
1484 | 1484 | [pager] |
|
1485 | 1485 | ignore = version, help, update |
|
1486 | 1486 | |
|
1487 | 1487 | ``patch`` |
|
1488 | 1488 | --------- |
|
1489 | 1489 | |
|
1490 | 1490 | Settings used when applying patches, for instance through the 'import' |
|
1491 | 1491 | command or with Mercurial Queues extension. |
|
1492 | 1492 | |
|
1493 | 1493 | ``eol`` |
|
1494 | 1494 | When set to 'strict' patch content and patched files end of lines |
|
1495 | 1495 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
1496 | 1496 | lines are ignored when patching and the result line endings are |
|
1497 | 1497 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
1498 | 1498 | ``auto``, end of lines are again ignored while patching but line |
|
1499 | 1499 | endings in patched files are normalized to their original setting |
|
1500 | 1500 | on a per-file basis. If target file does not exist or has no end |
|
1501 | 1501 | of line, patch line endings are preserved. |
|
1502 | 1502 | (default: strict) |
|
1503 | 1503 | |
|
1504 | 1504 | ``fuzz`` |
|
1505 | 1505 | The number of lines of 'fuzz' to allow when applying patches. This |
|
1506 | 1506 | controls how much context the patcher is allowed to ignore when |
|
1507 | 1507 | trying to apply a patch. |
|
1508 | 1508 | (default: 2) |
|
1509 | 1509 | |
|
1510 | 1510 | ``paths`` |
|
1511 | 1511 | --------- |
|
1512 | 1512 | |
|
1513 | 1513 | Assigns symbolic names and behavior to repositories. |
|
1514 | 1514 | |
|
1515 | 1515 | Options are symbolic names defining the URL or directory that is the |
|
1516 | 1516 | location of the repository. Example:: |
|
1517 | 1517 | |
|
1518 | 1518 | [paths] |
|
1519 | 1519 | my_server = https://example.com/my_repo |
|
1520 | 1520 | local_path = /home/me/repo |
|
1521 | 1521 | |
|
1522 | 1522 | These symbolic names can be used from the command line. To pull |
|
1523 | 1523 | from ``my_server``: :hg:`pull my_server`. To push to ``local_path``: |
|
1524 | 1524 | :hg:`push local_path`. |
|
1525 | 1525 | |
|
1526 | 1526 | Options containing colons (``:``) denote sub-options that can influence |
|
1527 | 1527 | behavior for that specific path. Example:: |
|
1528 | 1528 | |
|
1529 | 1529 | [paths] |
|
1530 | 1530 | my_server = https://example.com/my_path |
|
1531 | 1531 | my_server:pushurl = ssh://example.com/my_path |
|
1532 | 1532 | |
|
1533 | 1533 | The following sub-options can be defined: |
|
1534 | 1534 | |
|
1535 | 1535 | ``pushurl`` |
|
1536 | 1536 | The URL to use for push operations. If not defined, the location |
|
1537 | 1537 | defined by the path's main entry is used. |
|
1538 | 1538 | |
|
1539 | 1539 | ``pushrev`` |
|
1540 | 1540 | A revset defining which revisions to push by default. |
|
1541 | 1541 | |
|
1542 | 1542 | When :hg:`push` is executed without a ``-r`` argument, the revset |
|
1543 | 1543 | defined by this sub-option is evaluated to determine what to push. |
|
1544 | 1544 | |
|
1545 | 1545 | For example, a value of ``.`` will push the working directory's |
|
1546 | 1546 | revision by default. |
|
1547 | 1547 | |
|
1548 | 1548 | Revsets specifying bookmarks will not result in the bookmark being |
|
1549 | 1549 | pushed. |
|
1550 | 1550 | |
|
1551 | 1551 | The following special named paths exist: |
|
1552 | 1552 | |
|
1553 | 1553 | ``default`` |
|
1554 | 1554 | The URL or directory to use when no source or remote is specified. |
|
1555 | 1555 | |
|
1556 | 1556 | :hg:`clone` will automatically define this path to the location the |
|
1557 | 1557 | repository was cloned from. |
|
1558 | 1558 | |
|
1559 | 1559 | ``default-push`` |
|
1560 | 1560 | (deprecated) The URL or directory for the default :hg:`push` location. |
|
1561 | 1561 | ``default:pushurl`` should be used instead. |
|
1562 | 1562 | |
|
1563 | 1563 | ``phases`` |
|
1564 | 1564 | ---------- |
|
1565 | 1565 | |
|
1566 | 1566 | Specifies default handling of phases. See :hg:`help phases` for more |
|
1567 | 1567 | information about working with phases. |
|
1568 | 1568 | |
|
1569 | 1569 | ``publish`` |
|
1570 | 1570 | Controls draft phase behavior when working as a server. When true, |
|
1571 | 1571 | pushed changesets are set to public in both client and server and |
|
1572 | 1572 | pulled or cloned changesets are set to public in the client. |
|
1573 | 1573 | (default: True) |
|
1574 | 1574 | |
|
1575 | 1575 | ``new-commit`` |
|
1576 | 1576 | Phase of newly-created commits. |
|
1577 | 1577 | (default: draft) |
|
1578 | 1578 | |
|
1579 | 1579 | ``checksubrepos`` |
|
1580 | 1580 | Check the phase of the current revision of each subrepository. Allowed |
|
1581 | 1581 | values are "ignore", "follow" and "abort". For settings other than |
|
1582 | 1582 | "ignore", the phase of the current revision of each subrepository is |
|
1583 | 1583 | checked before committing the parent repository. If any of those phases is |
|
1584 | 1584 | greater than the phase of the parent repository (e.g. if a subrepo is in a |
|
1585 | 1585 | "secret" phase while the parent repo is in "draft" phase), the commit is |
|
1586 | 1586 | either aborted (if checksubrepos is set to "abort") or the higher phase is |
|
1587 | 1587 | used for the parent repository commit (if set to "follow"). |
|
1588 | 1588 | (default: follow) |
|
1589 | 1589 | |
|
1590 | 1590 | |
|
1591 | 1591 | ``profiling`` |
|
1592 | 1592 | ------------- |
|
1593 | 1593 | |
|
1594 | 1594 | Specifies profiling type, format, and file output. Two profilers are |
|
1595 | 1595 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
1596 | 1596 | profiler (named ``stat``). |
|
1597 | 1597 | |
|
1598 | 1598 | In this section description, 'profiling data' stands for the raw data |
|
1599 | 1599 | collected during profiling, while 'profiling report' stands for a |
|
1600 | 1600 | statistical text report generated from the profiling data. |
|
1601 | 1601 | |
|
1602 | 1602 | ``enabled`` |
|
1603 | 1603 | Enable the profiler. |
|
1604 | 1604 | (default: false) |
|
1605 | 1605 | |
|
1606 | 1606 | This is equivalent to passing ``--profile`` on the command line. |
|
1607 | 1607 | |
|
1608 | 1608 | ``type`` |
|
1609 | 1609 | The type of profiler to use. |
|
1610 | 1610 | (default: stat) |
|
1611 | 1611 | |
|
1612 | 1612 | ``ls`` |
|
1613 | 1613 | Use Python's built-in instrumenting profiler. This profiler |
|
1614 | 1614 | works on all platforms, but each line number it reports is the |
|
1615 | 1615 | first line of a function. This restriction makes it difficult to |
|
1616 | 1616 | identify the expensive parts of a non-trivial function. |
|
1617 | 1617 | ``stat`` |
|
1618 | 1618 | Use a statistical profiler, statprof. This profiler is most |
|
1619 | 1619 | useful for profiling commands that run for longer than about 0.1 |
|
1620 | 1620 | seconds. |
|
1621 | 1621 | |
|
1622 | 1622 | ``format`` |
|
1623 | 1623 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
1624 | 1624 | (default: text) |
|
1625 | 1625 | |
|
1626 | 1626 | ``text`` |
|
1627 | 1627 | Generate a profiling report. When saving to a file, it should be |
|
1628 | 1628 | noted that only the report is saved, and the profiling data is |
|
1629 | 1629 | not kept. |
|
1630 | 1630 | ``kcachegrind`` |
|
1631 | 1631 | Format profiling data for kcachegrind use: when saving to a |
|
1632 | 1632 | file, the generated file can directly be loaded into |
|
1633 | 1633 | kcachegrind. |
|
1634 | 1634 | |
|
1635 | 1635 | ``statformat`` |
|
1636 | 1636 | Profiling format for the ``stat`` profiler. |
|
1637 | 1637 | (default: hotpath) |
|
1638 | 1638 | |
|
1639 | 1639 | ``hotpath`` |
|
1640 | 1640 | Show a tree-based display containing the hot path of execution (where |
|
1641 | 1641 | most time was spent). |
|
1642 | 1642 | ``bymethod`` |
|
1643 | 1643 | Show a table of methods ordered by how frequently they are active. |
|
1644 | 1644 | ``byline`` |
|
1645 | 1645 | Show a table of lines in files ordered by how frequently they are active. |
|
1646 | 1646 | ``json`` |
|
1647 | 1647 | Render profiling data as JSON. |
|
1648 | 1648 | |
|
1649 | 1649 | ``frequency`` |
|
1650 | 1650 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
1651 | 1651 | (default: 1000) |
|
1652 | 1652 | |
|
1653 | 1653 | ``output`` |
|
1654 | 1654 | File path where profiling data or report should be saved. If the |
|
1655 | 1655 | file exists, it is replaced. (default: None, data is printed on |
|
1656 | 1656 | stderr) |
|
1657 | 1657 | |
|
1658 | 1658 | ``sort`` |
|
1659 | 1659 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
1660 | 1660 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
1661 | 1661 | ``inlinetime``. |
|
1662 | 1662 | (default: inlinetime) |
|
1663 | 1663 | |
|
1664 | 1664 | ``time-track`` |
|
1665 | 1665 | Control if the stat profiler track ``cpu`` or ``real`` time. |
|
1666 | 1666 | (default: ``cpu``) |
|
1667 | 1667 | |
|
1668 | 1668 | ``limit`` |
|
1669 | 1669 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1670 | 1670 | (default: 30) |
|
1671 | 1671 | |
|
1672 | 1672 | ``nested`` |
|
1673 | 1673 | Show at most this number of lines of drill-down info after each main entry. |
|
1674 | 1674 | This can help explain the difference between Total and Inline. |
|
1675 | 1675 | Specific to the ``ls`` instrumenting profiler. |
|
1676 | 1676 | (default: 0) |
|
1677 | 1677 | |
|
1678 | 1678 | ``showmin`` |
|
1679 | 1679 | Minimum fraction of samples an entry must have for it to be displayed. |
|
1680 | 1680 | Can be specified as a float between ``0.0`` and ``1.0`` or can have a |
|
1681 | 1681 | ``%`` afterwards to allow values up to ``100``. e.g. ``5%``. |
|
1682 | 1682 | |
|
1683 | 1683 | Only used by the ``stat`` profiler. |
|
1684 | 1684 | |
|
1685 | 1685 | For the ``hotpath`` format, default is ``0.05``. |
|
1686 | 1686 | For the ``chrome`` format, default is ``0.005``. |
|
1687 | 1687 | |
|
1688 | 1688 | The option is unused on other formats. |
|
1689 | 1689 | |
|
1690 | 1690 | ``showmax`` |
|
1691 | 1691 | Maximum fraction of samples an entry can have before it is ignored in |
|
1692 | 1692 | display. Values format is the same as ``showmin``. |
|
1693 | 1693 | |
|
1694 | 1694 | Only used by the ``stat`` profiler. |
|
1695 | 1695 | |
|
1696 | 1696 | For the ``chrome`` format, default is ``0.999``. |
|
1697 | 1697 | |
|
1698 | 1698 | The option is unused on other formats. |
|
1699 | 1699 | |
|
1700 | 1700 | ``progress`` |
|
1701 | 1701 | ------------ |
|
1702 | 1702 | |
|
1703 | 1703 | Mercurial commands can draw progress bars that are as informative as |
|
1704 | 1704 | possible. Some progress bars only offer indeterminate information, while others |
|
1705 | 1705 | have a definite end point. |
|
1706 | 1706 | |
|
1707 | 1707 | ``delay`` |
|
1708 | 1708 | Number of seconds (float) before showing the progress bar. (default: 3) |
|
1709 | 1709 | |
|
1710 | 1710 | ``changedelay`` |
|
1711 | 1711 | Minimum delay before showing a new topic. When set to less than 3 * refresh, |
|
1712 | 1712 | that value will be used instead. (default: 1) |
|
1713 | 1713 | |
|
1714 | 1714 | ``estimateinterval`` |
|
1715 | 1715 | Maximum sampling interval in seconds for speed and estimated time |
|
1716 | 1716 | calculation. (default: 60) |
|
1717 | 1717 | |
|
1718 | 1718 | ``refresh`` |
|
1719 | 1719 | Time in seconds between refreshes of the progress bar. (default: 0.1) |
|
1720 | 1720 | |
|
1721 | 1721 | ``format`` |
|
1722 | 1722 | Format of the progress bar. |
|
1723 | 1723 | |
|
1724 | 1724 | Valid entries for the format field are ``topic``, ``bar``, ``number``, |
|
1725 | 1725 | ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the |
|
1726 | 1726 | last 20 characters of the item, but this can be changed by adding either |
|
1727 | 1727 | ``-<num>`` which would take the last num characters, or ``+<num>`` for the |
|
1728 | 1728 | first num characters. |
|
1729 | 1729 | |
|
1730 | 1730 | (default: topic bar number estimate) |
|
1731 | 1731 | |
|
1732 | 1732 | ``width`` |
|
1733 | 1733 | If set, the maximum width of the progress information (that is, min(width, |
|
1734 | 1734 | term width) will be used). |
|
1735 | 1735 | |
|
1736 | 1736 | ``clear-complete`` |
|
1737 | 1737 | Clear the progress bar after it's done. (default: True) |
|
1738 | 1738 | |
|
1739 | 1739 | ``disable`` |
|
1740 | 1740 | If true, don't show a progress bar. |
|
1741 | 1741 | |
|
1742 | 1742 | ``assume-tty`` |
|
1743 | 1743 | If true, ALWAYS show a progress bar, unless disable is given. |
|
1744 | 1744 | |
|
1745 | 1745 | ``rebase`` |
|
1746 | 1746 | ---------- |
|
1747 | 1747 | |
|
1748 | 1748 | ``evolution.allowdivergence`` |
|
1749 | 1749 | Default to False, when True allow creating divergence when performing |
|
1750 | 1750 | rebase of obsolete changesets. |
|
1751 | 1751 | |
|
1752 | 1752 | ``revsetalias`` |
|
1753 | 1753 | --------------- |
|
1754 | 1754 | |
|
1755 | 1755 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
1756 | 1756 | |
|
1757 | 1757 | ``server`` |
|
1758 | 1758 | ---------- |
|
1759 | 1759 | |
|
1760 | 1760 | Controls generic server settings. |
|
1761 | 1761 | |
|
1762 | 1762 | ``bookmarks-pushkey-compat`` |
|
1763 | 1763 | Trigger pushkey hook when being pushed bookmark updates. This config exist |
|
1764 | 1764 | for compatibility purpose (default to True) |
|
1765 | 1765 | |
|
1766 | 1766 | If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark |
|
1767 | 1767 | movement we recommend you migrate them to ``txnclose-bookmark`` and |
|
1768 | 1768 | ``pretxnclose-bookmark``. |
|
1769 | 1769 | |
|
1770 | 1770 | ``compressionengines`` |
|
1771 | 1771 | List of compression engines and their relative priority to advertise |
|
1772 | 1772 | to clients. |
|
1773 | 1773 | |
|
1774 | 1774 | The order of compression engines determines their priority, the first |
|
1775 | 1775 | having the highest priority. If a compression engine is not listed |
|
1776 | 1776 | here, it won't be advertised to clients. |
|
1777 | 1777 | |
|
1778 | 1778 | If not set (the default), built-in defaults are used. Run |
|
1779 | 1779 | :hg:`debuginstall` to list available compression engines and their |
|
1780 | 1780 | default wire protocol priority. |
|
1781 | 1781 | |
|
1782 | 1782 | Older Mercurial clients only support zlib compression and this setting |
|
1783 | 1783 | has no effect for legacy clients. |
|
1784 | 1784 | |
|
1785 | 1785 | ``uncompressed`` |
|
1786 | 1786 | Whether to allow clients to clone a repository using the |
|
1787 | 1787 | uncompressed streaming protocol. This transfers about 40% more |
|
1788 | 1788 | data than a regular clone, but uses less memory and CPU on both |
|
1789 | 1789 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
1790 | 1790 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
1791 | 1791 | regular clone. Over most WAN connections (anything slower than |
|
1792 | 1792 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
1793 | 1793 | extra data transfer overhead. This mode will also temporarily hold |
|
1794 | 1794 | the write lock while determining what data to transfer. |
|
1795 | 1795 | (default: True) |
|
1796 | 1796 | |
|
1797 | 1797 | ``uncompressedallowsecret`` |
|
1798 | 1798 | Whether to allow stream clones when the repository contains secret |
|
1799 | 1799 | changesets. (default: False) |
|
1800 | 1800 | |
|
1801 | 1801 | ``preferuncompressed`` |
|
1802 | 1802 | When set, clients will try to use the uncompressed streaming |
|
1803 | 1803 | protocol. (default: False) |
|
1804 | 1804 | |
|
1805 | 1805 | ``disablefullbundle`` |
|
1806 | 1806 | When set, servers will refuse attempts to do pull-based clones. |
|
1807 | 1807 | If this option is set, ``preferuncompressed`` and/or clone bundles |
|
1808 | 1808 | are highly recommended. Partial clones will still be allowed. |
|
1809 | 1809 | (default: False) |
|
1810 | 1810 | |
|
1811 | 1811 | ``streamunbundle`` |
|
1812 | 1812 | When set, servers will apply data sent from the client directly, |
|
1813 | 1813 | otherwise it will be written to a temporary file first. This option |
|
1814 | 1814 | effectively prevents concurrent pushes. |
|
1815 | 1815 | |
|
1816 | 1816 | ``pullbundle`` |
|
1817 | 1817 | When set, the server will check pullbundle.manifest for bundles |
|
1818 | 1818 | covering the requested heads and common nodes. The first matching |
|
1819 | 1819 | entry will be streamed to the client. |
|
1820 | 1820 | |
|
1821 | 1821 | For HTTP transport, the stream will still use zlib compression |
|
1822 | 1822 | for older clients. |
|
1823 | 1823 | |
|
1824 | 1824 | ``concurrent-push-mode`` |
|
1825 | 1825 | Level of allowed race condition between two pushing clients. |
|
1826 | 1826 | |
|
1827 | 1827 | - 'strict': push is abort if another client touched the repository |
|
1828 | 1828 | while the push was preparing. (default) |
|
1829 | 1829 | - 'check-related': push is only aborted if it affects head that got also |
|
1830 | 1830 | affected while the push was preparing. |
|
1831 | 1831 | |
|
1832 | 1832 | This requires compatible client (version 4.3 and later). Old client will |
|
1833 | 1833 | use 'strict'. |
|
1834 | 1834 | |
|
1835 | 1835 | ``validate`` |
|
1836 | 1836 | Whether to validate the completeness of pushed changesets by |
|
1837 | 1837 | checking that all new file revisions specified in manifests are |
|
1838 | 1838 | present. (default: False) |
|
1839 | 1839 | |
|
1840 | 1840 | ``maxhttpheaderlen`` |
|
1841 | 1841 | Instruct HTTP clients not to send request headers longer than this |
|
1842 | 1842 | many bytes. (default: 1024) |
|
1843 | 1843 | |
|
1844 | 1844 | ``bundle1`` |
|
1845 | 1845 | Whether to allow clients to push and pull using the legacy bundle1 |
|
1846 | 1846 | exchange format. (default: True) |
|
1847 | 1847 | |
|
1848 | 1848 | ``bundle1gd`` |
|
1849 | 1849 | Like ``bundle1`` but only used if the repository is using the |
|
1850 | 1850 | *generaldelta* storage format. (default: True) |
|
1851 | 1851 | |
|
1852 | 1852 | ``bundle1.push`` |
|
1853 | 1853 | Whether to allow clients to push using the legacy bundle1 exchange |
|
1854 | 1854 | format. (default: True) |
|
1855 | 1855 | |
|
1856 | 1856 | ``bundle1gd.push`` |
|
1857 | 1857 | Like ``bundle1.push`` but only used if the repository is using the |
|
1858 | 1858 | *generaldelta* storage format. (default: True) |
|
1859 | 1859 | |
|
1860 | 1860 | ``bundle1.pull`` |
|
1861 | 1861 | Whether to allow clients to pull using the legacy bundle1 exchange |
|
1862 | 1862 | format. (default: True) |
|
1863 | 1863 | |
|
1864 | 1864 | ``bundle1gd.pull`` |
|
1865 | 1865 | Like ``bundle1.pull`` but only used if the repository is using the |
|
1866 | 1866 | *generaldelta* storage format. (default: True) |
|
1867 | 1867 | |
|
1868 | 1868 | Large repositories using the *generaldelta* storage format should |
|
1869 | 1869 | consider setting this option because converting *generaldelta* |
|
1870 | 1870 | repositories to the exchange format required by the bundle1 data |
|
1871 | 1871 | format can consume a lot of CPU. |
|
1872 | 1872 | |
|
1873 | 1873 | ``zliblevel`` |
|
1874 | 1874 | Integer between ``-1`` and ``9`` that controls the zlib compression level |
|
1875 | 1875 | for wire protocol commands that send zlib compressed output (notably the |
|
1876 | 1876 | commands that send repository history data). |
|
1877 | 1877 | |
|
1878 | 1878 | The default (``-1``) uses the default zlib compression level, which is |
|
1879 | 1879 | likely equivalent to ``6``. ``0`` means no compression. ``9`` means |
|
1880 | 1880 | maximum compression. |
|
1881 | 1881 | |
|
1882 | 1882 | Setting this option allows server operators to make trade-offs between |
|
1883 | 1883 | bandwidth and CPU used. Lowering the compression lowers CPU utilization |
|
1884 | 1884 | but sends more bytes to clients. |
|
1885 | 1885 | |
|
1886 | 1886 | This option only impacts the HTTP server. |
|
1887 | 1887 | |
|
1888 | 1888 | ``zstdlevel`` |
|
1889 | 1889 | Integer between ``1`` and ``22`` that controls the zstd compression level |
|
1890 | 1890 | for wire protocol commands. ``1`` is the minimal amount of compression and |
|
1891 | 1891 | ``22`` is the highest amount of compression. |
|
1892 | 1892 | |
|
1893 | 1893 | The default (``3``) should be significantly faster than zlib while likely |
|
1894 | 1894 | delivering better compression ratios. |
|
1895 | 1895 | |
|
1896 | 1896 | This option only impacts the HTTP server. |
|
1897 | 1897 | |
|
1898 | 1898 | See also ``server.zliblevel``. |
|
1899 | 1899 | |
|
1900 | 1900 | ``smtp`` |
|
1901 | 1901 | -------- |
|
1902 | 1902 | |
|
1903 | 1903 | Configuration for extensions that need to send email messages. |
|
1904 | 1904 | |
|
1905 | 1905 | ``host`` |
|
1906 | 1906 | Host name of mail server, e.g. "mail.example.com". |
|
1907 | 1907 | |
|
1908 | 1908 | ``port`` |
|
1909 | 1909 | Optional. Port to connect to on mail server. (default: 465 if |
|
1910 | 1910 | ``tls`` is smtps; 25 otherwise) |
|
1911 | 1911 | |
|
1912 | 1912 | ``tls`` |
|
1913 | 1913 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
1914 | 1914 | smtps or none. (default: none) |
|
1915 | 1915 | |
|
1916 | 1916 | ``username`` |
|
1917 | 1917 | Optional. User name for authenticating with the SMTP server. |
|
1918 | 1918 | (default: None) |
|
1919 | 1919 | |
|
1920 | 1920 | ``password`` |
|
1921 | 1921 | Optional. Password for authenticating with the SMTP server. If not |
|
1922 | 1922 | specified, interactive sessions will prompt the user for a |
|
1923 | 1923 | password; non-interactive sessions will fail. (default: None) |
|
1924 | 1924 | |
|
1925 | 1925 | ``local_hostname`` |
|
1926 | 1926 | Optional. The hostname that the sender can use to identify |
|
1927 | 1927 | itself to the MTA. |
|
1928 | 1928 | |
|
1929 | 1929 | |
|
1930 | 1930 | ``subpaths`` |
|
1931 | 1931 | ------------ |
|
1932 | 1932 | |
|
1933 | 1933 | Subrepository source URLs can go stale if a remote server changes name |
|
1934 | 1934 | or becomes temporarily unavailable. This section lets you define |
|
1935 | 1935 | rewrite rules of the form:: |
|
1936 | 1936 | |
|
1937 | 1937 | <pattern> = <replacement> |
|
1938 | 1938 | |
|
1939 | 1939 | where ``pattern`` is a regular expression matching a subrepository |
|
1940 | 1940 | source URL and ``replacement`` is the replacement string used to |
|
1941 | 1941 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
1942 | 1942 | ``replacements``. For instance:: |
|
1943 | 1943 | |
|
1944 | 1944 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
1945 | 1945 | |
|
1946 | 1946 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
1947 | 1947 | |
|
1948 | 1948 | Relative subrepository paths are first made absolute, and the |
|
1949 | 1949 | rewrite rules are then applied on the full (absolute) path. If ``pattern`` |
|
1950 | 1950 | doesn't match the full path, an attempt is made to apply it on the |
|
1951 | 1951 | relative path alone. The rules are applied in definition order. |
|
1952 | 1952 | |
|
1953 | 1953 | ``subrepos`` |
|
1954 | 1954 | ------------ |
|
1955 | 1955 | |
|
1956 | 1956 | This section contains options that control the behavior of the |
|
1957 | 1957 | subrepositories feature. See also :hg:`help subrepos`. |
|
1958 | 1958 | |
|
1959 | 1959 | Security note: auditing in Mercurial is known to be insufficient to |
|
1960 | 1960 | prevent clone-time code execution with carefully constructed Git |
|
1961 | 1961 | subrepos. It is unknown if a similar detect is present in Subversion |
|
1962 | 1962 | subrepos. Both Git and Subversion subrepos are disabled by default |
|
1963 | 1963 | out of security concerns. These subrepo types can be enabled using |
|
1964 | 1964 | the respective options below. |
|
1965 | 1965 | |
|
1966 | 1966 | ``allowed`` |
|
1967 | 1967 | Whether subrepositories are allowed in the working directory. |
|
1968 | 1968 | |
|
1969 | 1969 | When false, commands involving subrepositories (like :hg:`update`) |
|
1970 | 1970 | will fail for all subrepository types. |
|
1971 | 1971 | (default: true) |
|
1972 | 1972 | |
|
1973 | 1973 | ``hg:allowed`` |
|
1974 | 1974 | Whether Mercurial subrepositories are allowed in the working |
|
1975 | 1975 | directory. This option only has an effect if ``subrepos.allowed`` |
|
1976 | 1976 | is true. |
|
1977 | 1977 | (default: true) |
|
1978 | 1978 | |
|
1979 | 1979 | ``git:allowed`` |
|
1980 | 1980 | Whether Git subrepositories are allowed in the working directory. |
|
1981 | 1981 | This option only has an effect if ``subrepos.allowed`` is true. |
|
1982 | 1982 | |
|
1983 | 1983 | See the security note above before enabling Git subrepos. |
|
1984 | 1984 | (default: false) |
|
1985 | 1985 | |
|
1986 | 1986 | ``svn:allowed`` |
|
1987 | 1987 | Whether Subversion subrepositories are allowed in the working |
|
1988 | 1988 | directory. This option only has an effect if ``subrepos.allowed`` |
|
1989 | 1989 | is true. |
|
1990 | 1990 | |
|
1991 | 1991 | See the security note above before enabling Subversion subrepos. |
|
1992 | 1992 | (default: false) |
|
1993 | 1993 | |
|
1994 | 1994 | ``templatealias`` |
|
1995 | 1995 | ----------------- |
|
1996 | 1996 | |
|
1997 | 1997 | Alias definitions for templates. See :hg:`help templates` for details. |
|
1998 | 1998 | |
|
1999 | 1999 | ``templates`` |
|
2000 | 2000 | ------------- |
|
2001 | 2001 | |
|
2002 | 2002 | Use the ``[templates]`` section to define template strings. |
|
2003 | 2003 | See :hg:`help templates` for details. |
|
2004 | 2004 | |
|
2005 | 2005 | ``trusted`` |
|
2006 | 2006 | ----------- |
|
2007 | 2007 | |
|
2008 | 2008 | Mercurial will not use the settings in the |
|
2009 | 2009 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
2010 | 2010 | user or to a trusted group, as various hgrc features allow arbitrary |
|
2011 | 2011 | commands to be run. This issue is often encountered when configuring |
|
2012 | 2012 | hooks or extensions for shared repositories or servers. However, |
|
2013 | 2013 | the web interface will use some safe settings from the ``[web]`` |
|
2014 | 2014 | section. |
|
2015 | 2015 | |
|
2016 | 2016 | This section specifies what users and groups are trusted. The |
|
2017 | 2017 | current user is always trusted. To trust everybody, list a user or a |
|
2018 | 2018 | group with name ``*``. These settings must be placed in an |
|
2019 | 2019 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
2020 | 2020 | user or service running Mercurial. |
|
2021 | 2021 | |
|
2022 | 2022 | ``users`` |
|
2023 | 2023 | Comma-separated list of trusted users. |
|
2024 | 2024 | |
|
2025 | 2025 | ``groups`` |
|
2026 | 2026 | Comma-separated list of trusted groups. |
|
2027 | 2027 | |
|
2028 | 2028 | |
|
2029 | 2029 | ``ui`` |
|
2030 | 2030 | ------ |
|
2031 | 2031 | |
|
2032 | 2032 | User interface controls. |
|
2033 | 2033 | |
|
2034 | 2034 | ``archivemeta`` |
|
2035 | 2035 | Whether to include the .hg_archival.txt file containing meta data |
|
2036 | 2036 | (hashes for the repository base and for tip) in archives created |
|
2037 | 2037 | by the :hg:`archive` command or downloaded via hgweb. |
|
2038 | 2038 | (default: True) |
|
2039 | 2039 | |
|
2040 | 2040 | ``askusername`` |
|
2041 | 2041 | Whether to prompt for a username when committing. If True, and |
|
2042 | 2042 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
2043 | 2043 | be prompted to enter a username. If no username is entered, the |
|
2044 | 2044 | default ``USER@HOST`` is used instead. |
|
2045 | 2045 | (default: False) |
|
2046 | 2046 | |
|
2047 | 2047 | ``clonebundles`` |
|
2048 | 2048 | Whether the "clone bundles" feature is enabled. |
|
2049 | 2049 | |
|
2050 | 2050 | When enabled, :hg:`clone` may download and apply a server-advertised |
|
2051 | 2051 | bundle file from a URL instead of using the normal exchange mechanism. |
|
2052 | 2052 | |
|
2053 | 2053 | This can likely result in faster and more reliable clones. |
|
2054 | 2054 | |
|
2055 | 2055 | (default: True) |
|
2056 | 2056 | |
|
2057 | 2057 | ``clonebundlefallback`` |
|
2058 | 2058 | Whether failure to apply an advertised "clone bundle" from a server |
|
2059 | 2059 | should result in fallback to a regular clone. |
|
2060 | 2060 | |
|
2061 | 2061 | This is disabled by default because servers advertising "clone |
|
2062 | 2062 | bundles" often do so to reduce server load. If advertised bundles |
|
2063 | 2063 | start mass failing and clients automatically fall back to a regular |
|
2064 | 2064 | clone, this would add significant and unexpected load to the server |
|
2065 | 2065 | since the server is expecting clone operations to be offloaded to |
|
2066 | 2066 | pre-generated bundles. Failing fast (the default behavior) ensures |
|
2067 | 2067 | clients don't overwhelm the server when "clone bundle" application |
|
2068 | 2068 | fails. |
|
2069 | 2069 | |
|
2070 | 2070 | (default: False) |
|
2071 | 2071 | |
|
2072 | 2072 | ``clonebundleprefers`` |
|
2073 | 2073 | Defines preferences for which "clone bundles" to use. |
|
2074 | 2074 | |
|
2075 | 2075 | Servers advertising "clone bundles" may advertise multiple available |
|
2076 | 2076 | bundles. Each bundle may have different attributes, such as the bundle |
|
2077 | 2077 | type and compression format. This option is used to prefer a particular |
|
2078 | 2078 | bundle over another. |
|
2079 | 2079 | |
|
2080 | 2080 | The following keys are defined by Mercurial: |
|
2081 | 2081 | |
|
2082 | 2082 | BUNDLESPEC |
|
2083 | 2083 | A bundle type specifier. These are strings passed to :hg:`bundle -t`. |
|
2084 | 2084 | e.g. ``gzip-v2`` or ``bzip2-v1``. |
|
2085 | 2085 | |
|
2086 | 2086 | COMPRESSION |
|
2087 | 2087 | The compression format of the bundle. e.g. ``gzip`` and ``bzip2``. |
|
2088 | 2088 | |
|
2089 | 2089 | Server operators may define custom keys. |
|
2090 | 2090 | |
|
2091 | 2091 | Example values: ``COMPRESSION=bzip2``, |
|
2092 | 2092 | ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``. |
|
2093 | 2093 | |
|
2094 | 2094 | By default, the first bundle advertised by the server is used. |
|
2095 | 2095 | |
|
2096 | 2096 | ``color`` |
|
2097 | 2097 | When to colorize output. Possible value are Boolean ("yes" or "no"), or |
|
2098 | 2098 | "debug", or "always". (default: "yes"). "yes" will use color whenever it |
|
2099 | 2099 | seems possible. See :hg:`help color` for details. |
|
2100 | 2100 | |
|
2101 | 2101 | ``commitsubrepos`` |
|
2102 | 2102 | Whether to commit modified subrepositories when committing the |
|
2103 | 2103 | parent repository. If False and one subrepository has uncommitted |
|
2104 | 2104 | changes, abort the commit. |
|
2105 | 2105 | (default: False) |
|
2106 | 2106 | |
|
2107 | 2107 | ``debug`` |
|
2108 | 2108 | Print debugging information. (default: False) |
|
2109 | 2109 | |
|
2110 | 2110 | ``editor`` |
|
2111 | 2111 | The editor to use during a commit. (default: ``$EDITOR`` or ``vi``) |
|
2112 | 2112 | |
|
2113 | 2113 | ``fallbackencoding`` |
|
2114 | 2114 | Encoding to try if it's not possible to decode the changelog using |
|
2115 | 2115 | UTF-8. (default: ISO-8859-1) |
|
2116 | 2116 | |
|
2117 | 2117 | ``graphnodetemplate`` |
|
2118 | 2118 | The template used to print changeset nodes in an ASCII revision graph. |
|
2119 | 2119 | (default: ``{graphnode}``) |
|
2120 | 2120 | |
|
2121 | 2121 | ``ignore`` |
|
2122 | 2122 | A file to read per-user ignore patterns from. This file should be |
|
2123 | 2123 | in the same format as a repository-wide .hgignore file. Filenames |
|
2124 | 2124 | are relative to the repository root. This option supports hook syntax, |
|
2125 | 2125 | so if you want to specify multiple ignore files, you can do so by |
|
2126 | 2126 | setting something like ``ignore.other = ~/.hgignore2``. For details |
|
2127 | 2127 | of the ignore file format, see the ``hgignore(5)`` man page. |
|
2128 | 2128 | |
|
2129 | 2129 | ``interactive`` |
|
2130 | 2130 | Allow to prompt the user. (default: True) |
|
2131 | 2131 | |
|
2132 | 2132 | ``interface`` |
|
2133 | 2133 | Select the default interface for interactive features (default: text). |
|
2134 | 2134 | Possible values are 'text' and 'curses'. |
|
2135 | 2135 | |
|
2136 | 2136 | ``interface.chunkselector`` |
|
2137 | 2137 | Select the interface for change recording (e.g. :hg:`commit -i`). |
|
2138 | 2138 | Possible values are 'text' and 'curses'. |
|
2139 | 2139 | This config overrides the interface specified by ui.interface. |
|
2140 | 2140 | |
|
2141 | ``large-file-limit`` | |
|
2142 | Largest file size that gives no memory use warning. | |
|
2143 | Possible values are integers or 0 to disable the check. | |
|
2144 | (default: 10000000) | |
|
2145 | ||
|
2141 | 2146 | ``logtemplate`` |
|
2142 | 2147 | Template string for commands that print changesets. |
|
2143 | 2148 | |
|
2144 | 2149 | ``merge`` |
|
2145 | 2150 | The conflict resolution program to use during a manual merge. |
|
2146 | 2151 | For more information on merge tools see :hg:`help merge-tools`. |
|
2147 | 2152 | For configuring merge tools see the ``[merge-tools]`` section. |
|
2148 | 2153 | |
|
2149 | 2154 | ``mergemarkers`` |
|
2150 | 2155 | Sets the merge conflict marker label styling. The ``detailed`` |
|
2151 | 2156 | style uses the ``mergemarkertemplate`` setting to style the labels. |
|
2152 | 2157 | The ``basic`` style just uses 'local' and 'other' as the marker label. |
|
2153 | 2158 | One of ``basic`` or ``detailed``. |
|
2154 | 2159 | (default: ``basic``) |
|
2155 | 2160 | |
|
2156 | 2161 | ``mergemarkertemplate`` |
|
2157 | 2162 | The template used to print the commit description next to each conflict |
|
2158 | 2163 | marker during merge conflicts. See :hg:`help templates` for the template |
|
2159 | 2164 | format. |
|
2160 | 2165 | |
|
2161 | 2166 | Defaults to showing the hash, tags, branches, bookmarks, author, and |
|
2162 | 2167 | the first line of the commit description. |
|
2163 | 2168 | |
|
2164 | 2169 | If you use non-ASCII characters in names for tags, branches, bookmarks, |
|
2165 | 2170 | authors, and/or commit descriptions, you must pay attention to encodings of |
|
2166 | 2171 | managed files. At template expansion, non-ASCII characters use the encoding |
|
2167 | 2172 | specified by the ``--encoding`` global option, ``HGENCODING`` or other |
|
2168 | 2173 | environment variables that govern your locale. If the encoding of the merge |
|
2169 | 2174 | markers is different from the encoding of the merged files, |
|
2170 | 2175 | serious problems may occur. |
|
2171 | 2176 | |
|
2172 | 2177 | Can be overridden per-merge-tool, see the ``[merge-tools]`` section. |
|
2173 | 2178 | |
|
2174 | 2179 | ``origbackuppath`` |
|
2175 | 2180 | The path to a directory used to store generated .orig files. If the path is |
|
2176 | 2181 | not a directory, one will be created. If set, files stored in this |
|
2177 | 2182 | directory have the same name as the original file and do not have a .orig |
|
2178 | 2183 | suffix. |
|
2179 | 2184 | |
|
2180 | 2185 | ``paginate`` |
|
2181 | 2186 | Control the pagination of command output (default: True). See :hg:`help pager` |
|
2182 | 2187 | for details. |
|
2183 | 2188 | |
|
2184 | 2189 | ``patch`` |
|
2185 | 2190 | An optional external tool that ``hg import`` and some extensions |
|
2186 | 2191 | will use for applying patches. By default Mercurial uses an |
|
2187 | 2192 | internal patch utility. The external tool must work as the common |
|
2188 | 2193 | Unix ``patch`` program. In particular, it must accept a ``-p`` |
|
2189 | 2194 | argument to strip patch headers, a ``-d`` argument to specify the |
|
2190 | 2195 | current directory, a file name to patch, and a patch file to take |
|
2191 | 2196 | from stdin. |
|
2192 | 2197 | |
|
2193 | 2198 | It is possible to specify a patch tool together with extra |
|
2194 | 2199 | arguments. For example, setting this option to ``patch --merge`` |
|
2195 | 2200 | will use the ``patch`` program with its 2-way merge option. |
|
2196 | 2201 | |
|
2197 | 2202 | ``portablefilenames`` |
|
2198 | 2203 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
2199 | 2204 | (default: ``warn``) |
|
2200 | 2205 | |
|
2201 | 2206 | ``warn`` |
|
2202 | 2207 | Print a warning message on POSIX platforms, if a file with a non-portable |
|
2203 | 2208 | filename is added (e.g. a file with a name that can't be created on |
|
2204 | 2209 | Windows because it contains reserved parts like ``AUX``, reserved |
|
2205 | 2210 | characters like ``:``, or would cause a case collision with an existing |
|
2206 | 2211 | file). |
|
2207 | 2212 | |
|
2208 | 2213 | ``ignore`` |
|
2209 | 2214 | Don't print a warning. |
|
2210 | 2215 | |
|
2211 | 2216 | ``abort`` |
|
2212 | 2217 | The command is aborted. |
|
2213 | 2218 | |
|
2214 | 2219 | ``true`` |
|
2215 | 2220 | Alias for ``warn``. |
|
2216 | 2221 | |
|
2217 | 2222 | ``false`` |
|
2218 | 2223 | Alias for ``ignore``. |
|
2219 | 2224 | |
|
2220 | 2225 | .. container:: windows |
|
2221 | 2226 | |
|
2222 | 2227 | On Windows, this configuration option is ignored and the command aborted. |
|
2223 | 2228 | |
|
2224 | 2229 | ``quiet`` |
|
2225 | 2230 | Reduce the amount of output printed. |
|
2226 | 2231 | (default: False) |
|
2227 | 2232 | |
|
2228 | 2233 | ``remotecmd`` |
|
2229 | 2234 | Remote command to use for clone/push/pull operations. |
|
2230 | 2235 | (default: ``hg``) |
|
2231 | 2236 | |
|
2232 | 2237 | ``report_untrusted`` |
|
2233 | 2238 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
2234 | 2239 | trusted user or group. |
|
2235 | 2240 | (default: True) |
|
2236 | 2241 | |
|
2237 | 2242 | ``slash`` |
|
2238 | 2243 | (Deprecated. Use ``slashpath`` template filter instead.) |
|
2239 | 2244 | |
|
2240 | 2245 | Display paths using a slash (``/``) as the path separator. This |
|
2241 | 2246 | only makes a difference on systems where the default path |
|
2242 | 2247 | separator is not the slash character (e.g. Windows uses the |
|
2243 | 2248 | backslash character (``\``)). |
|
2244 | 2249 | (default: False) |
|
2245 | 2250 | |
|
2246 | 2251 | ``statuscopies`` |
|
2247 | 2252 | Display copies in the status command. |
|
2248 | 2253 | |
|
2249 | 2254 | ``ssh`` |
|
2250 | 2255 | Command to use for SSH connections. (default: ``ssh``) |
|
2251 | 2256 | |
|
2252 | 2257 | ``ssherrorhint`` |
|
2253 | 2258 | A hint shown to the user in the case of SSH error (e.g. |
|
2254 | 2259 | ``Please see http://company/internalwiki/ssh.html``) |
|
2255 | 2260 | |
|
2256 | 2261 | ``strict`` |
|
2257 | 2262 | Require exact command names, instead of allowing unambiguous |
|
2258 | 2263 | abbreviations. (default: False) |
|
2259 | 2264 | |
|
2260 | 2265 | ``style`` |
|
2261 | 2266 | Name of style to use for command output. |
|
2262 | 2267 | |
|
2263 | 2268 | ``supportcontact`` |
|
2264 | 2269 | A URL where users should report a Mercurial traceback. Use this if you are a |
|
2265 | 2270 | large organisation with its own Mercurial deployment process and crash |
|
2266 | 2271 | reports should be addressed to your internal support. |
|
2267 | 2272 | |
|
2268 | 2273 | ``textwidth`` |
|
2269 | 2274 | Maximum width of help text. A longer line generated by ``hg help`` or |
|
2270 | 2275 | ``hg subcommand --help`` will be broken after white space to get this |
|
2271 | 2276 | width or the terminal width, whichever comes first. |
|
2272 | 2277 | A non-positive value will disable this and the terminal width will be |
|
2273 | 2278 | used. (default: 78) |
|
2274 | 2279 | |
|
2275 | 2280 | ``timeout`` |
|
2276 | 2281 | The timeout used when a lock is held (in seconds), a negative value |
|
2277 | 2282 | means no timeout. (default: 600) |
|
2278 | 2283 | |
|
2279 | 2284 | ``timeout.warn`` |
|
2280 | 2285 | Time (in seconds) before a warning is printed about held lock. A negative |
|
2281 | 2286 | value means no warning. (default: 0) |
|
2282 | 2287 | |
|
2283 | 2288 | ``traceback`` |
|
2284 | 2289 | Mercurial always prints a traceback when an unknown exception |
|
2285 | 2290 | occurs. Setting this to True will make Mercurial print a traceback |
|
2286 | 2291 | on all exceptions, even those recognized by Mercurial (such as |
|
2287 | 2292 | IOError or MemoryError). (default: False) |
|
2288 | 2293 | |
|
2289 | 2294 | ``tweakdefaults`` |
|
2290 | 2295 | |
|
2291 | 2296 | By default Mercurial's behavior changes very little from release |
|
2292 | 2297 | to release, but over time the recommended config settings |
|
2293 | 2298 | shift. Enable this config to opt in to get automatic tweaks to |
|
2294 | 2299 | Mercurial's behavior over time. This config setting will have no |
|
2295 | 2300 | effet if ``HGPLAIN` is set or ``HGPLAINEXCEPT`` is set and does |
|
2296 | 2301 | not include ``tweakdefaults``. (default: False) |
|
2297 | 2302 | |
|
2298 | 2303 | ``username`` |
|
2299 | 2304 | The committer of a changeset created when running "commit". |
|
2300 | 2305 | Typically a person's name and email address, e.g. ``Fred Widget |
|
2301 | 2306 | <fred@example.com>``. Environment variables in the |
|
2302 | 2307 | username are expanded. |
|
2303 | 2308 | |
|
2304 | 2309 | (default: ``$EMAIL`` or ``username@hostname``. If the username in |
|
2305 | 2310 | hgrc is empty, e.g. if the system admin set ``username =`` in the |
|
2306 | 2311 | system hgrc, it has to be specified manually or in a different |
|
2307 | 2312 | hgrc file) |
|
2308 | 2313 | |
|
2309 | 2314 | ``verbose`` |
|
2310 | 2315 | Increase the amount of output printed. (default: False) |
|
2311 | 2316 | |
|
2312 | 2317 | |
|
2313 | 2318 | ``web`` |
|
2314 | 2319 | ------- |
|
2315 | 2320 | |
|
2316 | 2321 | Web interface configuration. The settings in this section apply to |
|
2317 | 2322 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
2318 | 2323 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
2319 | 2324 | and WSGI). |
|
2320 | 2325 | |
|
2321 | 2326 | The Mercurial webserver does no authentication (it does not prompt for |
|
2322 | 2327 | usernames and passwords to validate *who* users are), but it does do |
|
2323 | 2328 | authorization (it grants or denies access for *authenticated users* |
|
2324 | 2329 | based on settings in this section). You must either configure your |
|
2325 | 2330 | webserver to do authentication for you, or disable the authorization |
|
2326 | 2331 | checks. |
|
2327 | 2332 | |
|
2328 | 2333 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
2329 | 2334 | you want it to accept pushes from anybody, you can use the following |
|
2330 | 2335 | command line:: |
|
2331 | 2336 | |
|
2332 | 2337 | $ hg --config web.allow-push=* --config web.push_ssl=False serve |
|
2333 | 2338 | |
|
2334 | 2339 | Note that this will allow anybody to push anything to the server and |
|
2335 | 2340 | that this should not be used for public servers. |
|
2336 | 2341 | |
|
2337 | 2342 | The full set of options is: |
|
2338 | 2343 | |
|
2339 | 2344 | ``accesslog`` |
|
2340 | 2345 | Where to output the access log. (default: stdout) |
|
2341 | 2346 | |
|
2342 | 2347 | ``address`` |
|
2343 | 2348 | Interface address to bind to. (default: all) |
|
2344 | 2349 | |
|
2345 | 2350 | ``allow-archive`` |
|
2346 | 2351 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
2347 | 2352 | (default: empty) |
|
2348 | 2353 | |
|
2349 | 2354 | ``allowbz2`` |
|
2350 | 2355 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
2351 | 2356 | revisions. |
|
2352 | 2357 | (default: False) |
|
2353 | 2358 | |
|
2354 | 2359 | ``allowgz`` |
|
2355 | 2360 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
2356 | 2361 | revisions. |
|
2357 | 2362 | (default: False) |
|
2358 | 2363 | |
|
2359 | 2364 | ``allow-pull`` |
|
2360 | 2365 | Whether to allow pulling from the repository. (default: True) |
|
2361 | 2366 | |
|
2362 | 2367 | ``allow-push`` |
|
2363 | 2368 | Whether to allow pushing to the repository. If empty or not set, |
|
2364 | 2369 | pushing is not allowed. If the special value ``*``, any remote |
|
2365 | 2370 | user can push, including unauthenticated users. Otherwise, the |
|
2366 | 2371 | remote user must have been authenticated, and the authenticated |
|
2367 | 2372 | user name must be present in this list. The contents of the |
|
2368 | 2373 | allow-push list are examined after the deny_push list. |
|
2369 | 2374 | |
|
2370 | 2375 | ``allow_read`` |
|
2371 | 2376 | If the user has not already been denied repository access due to |
|
2372 | 2377 | the contents of deny_read, this list determines whether to grant |
|
2373 | 2378 | repository access to the user. If this list is not empty, and the |
|
2374 | 2379 | user is unauthenticated or not present in the list, then access is |
|
2375 | 2380 | denied for the user. If the list is empty or not set, then access |
|
2376 | 2381 | is permitted to all users by default. Setting allow_read to the |
|
2377 | 2382 | special value ``*`` is equivalent to it not being set (i.e. access |
|
2378 | 2383 | is permitted to all users). The contents of the allow_read list are |
|
2379 | 2384 | examined after the deny_read list. |
|
2380 | 2385 | |
|
2381 | 2386 | ``allowzip`` |
|
2382 | 2387 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
2383 | 2388 | revisions. This feature creates temporary files. |
|
2384 | 2389 | (default: False) |
|
2385 | 2390 | |
|
2386 | 2391 | ``archivesubrepos`` |
|
2387 | 2392 | Whether to recurse into subrepositories when archiving. |
|
2388 | 2393 | (default: False) |
|
2389 | 2394 | |
|
2390 | 2395 | ``baseurl`` |
|
2391 | 2396 | Base URL to use when publishing URLs in other locations, so |
|
2392 | 2397 | third-party tools like email notification hooks can construct |
|
2393 | 2398 | URLs. Example: ``http://hgserver/repos/``. |
|
2394 | 2399 | |
|
2395 | 2400 | ``cacerts`` |
|
2396 | 2401 | Path to file containing a list of PEM encoded certificate |
|
2397 | 2402 | authority certificates. Environment variables and ``~user`` |
|
2398 | 2403 | constructs are expanded in the filename. If specified on the |
|
2399 | 2404 | client, then it will verify the identity of remote HTTPS servers |
|
2400 | 2405 | with these certificates. |
|
2401 | 2406 | |
|
2402 | 2407 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
2403 | 2408 | command line. |
|
2404 | 2409 | |
|
2405 | 2410 | You can use OpenSSL's CA certificate file if your platform has |
|
2406 | 2411 | one. On most Linux systems this will be |
|
2407 | 2412 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
2408 | 2413 | generate this file manually. The form must be as follows:: |
|
2409 | 2414 | |
|
2410 | 2415 | -----BEGIN CERTIFICATE----- |
|
2411 | 2416 | ... (certificate in base64 PEM encoding) ... |
|
2412 | 2417 | -----END CERTIFICATE----- |
|
2413 | 2418 | -----BEGIN CERTIFICATE----- |
|
2414 | 2419 | ... (certificate in base64 PEM encoding) ... |
|
2415 | 2420 | -----END CERTIFICATE----- |
|
2416 | 2421 | |
|
2417 | 2422 | ``cache`` |
|
2418 | 2423 | Whether to support caching in hgweb. (default: True) |
|
2419 | 2424 | |
|
2420 | 2425 | ``certificate`` |
|
2421 | 2426 | Certificate to use when running :hg:`serve`. |
|
2422 | 2427 | |
|
2423 | 2428 | ``collapse`` |
|
2424 | 2429 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
2425 | 2430 | a single level alongside repositories in the current path. With |
|
2426 | 2431 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
2427 | 2432 | the current path are grouped behind navigable directory entries that |
|
2428 | 2433 | lead to the locations of these repositories. In effect, this setting |
|
2429 | 2434 | collapses each collection of repositories found within a subdirectory |
|
2430 | 2435 | into a single entry for that subdirectory. (default: False) |
|
2431 | 2436 | |
|
2432 | 2437 | ``comparisoncontext`` |
|
2433 | 2438 | Number of lines of context to show in side-by-side file comparison. If |
|
2434 | 2439 | negative or the value ``full``, whole files are shown. (default: 5) |
|
2435 | 2440 | |
|
2436 | 2441 | This setting can be overridden by a ``context`` request parameter to the |
|
2437 | 2442 | ``comparison`` command, taking the same values. |
|
2438 | 2443 | |
|
2439 | 2444 | ``contact`` |
|
2440 | 2445 | Name or email address of the person in charge of the repository. |
|
2441 | 2446 | (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty) |
|
2442 | 2447 | |
|
2443 | 2448 | ``csp`` |
|
2444 | 2449 | Send a ``Content-Security-Policy`` HTTP header with this value. |
|
2445 | 2450 | |
|
2446 | 2451 | The value may contain a special string ``%nonce%``, which will be replaced |
|
2447 | 2452 | by a randomly-generated one-time use value. If the value contains |
|
2448 | 2453 | ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the |
|
2449 | 2454 | one-time property of the nonce. This nonce will also be inserted into |
|
2450 | 2455 | ``<script>`` elements containing inline JavaScript. |
|
2451 | 2456 | |
|
2452 | 2457 | Note: lots of HTML content sent by the server is derived from repository |
|
2453 | 2458 | data. Please consider the potential for malicious repository data to |
|
2454 | 2459 | "inject" itself into generated HTML content as part of your security |
|
2455 | 2460 | threat model. |
|
2456 | 2461 | |
|
2457 | 2462 | ``deny_push`` |
|
2458 | 2463 | Whether to deny pushing to the repository. If empty or not set, |
|
2459 | 2464 | push is not denied. If the special value ``*``, all remote users are |
|
2460 | 2465 | denied push. Otherwise, unauthenticated users are all denied, and |
|
2461 | 2466 | any authenticated user name present in this list is also denied. The |
|
2462 | 2467 | contents of the deny_push list are examined before the allow-push list. |
|
2463 | 2468 | |
|
2464 | 2469 | ``deny_read`` |
|
2465 | 2470 | Whether to deny reading/viewing of the repository. If this list is |
|
2466 | 2471 | not empty, unauthenticated users are all denied, and any |
|
2467 | 2472 | authenticated user name present in this list is also denied access to |
|
2468 | 2473 | the repository. If set to the special value ``*``, all remote users |
|
2469 | 2474 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
2470 | 2475 | the determination of repository access depends on the presence and |
|
2471 | 2476 | content of the allow_read list (see description). If both |
|
2472 | 2477 | deny_read and allow_read are empty or not set, then access is |
|
2473 | 2478 | permitted to all users by default. If the repository is being |
|
2474 | 2479 | served via hgwebdir, denied users will not be able to see it in |
|
2475 | 2480 | the list of repositories. The contents of the deny_read list have |
|
2476 | 2481 | priority over (are examined before) the contents of the allow_read |
|
2477 | 2482 | list. |
|
2478 | 2483 | |
|
2479 | 2484 | ``descend`` |
|
2480 | 2485 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
2481 | 2486 | directly in the current path will be shown (other repositories are still |
|
2482 | 2487 | available from the index corresponding to their containing path). |
|
2483 | 2488 | |
|
2484 | 2489 | ``description`` |
|
2485 | 2490 | Textual description of the repository's purpose or contents. |
|
2486 | 2491 | (default: "unknown") |
|
2487 | 2492 | |
|
2488 | 2493 | ``encoding`` |
|
2489 | 2494 | Character encoding name. (default: the current locale charset) |
|
2490 | 2495 | Example: "UTF-8". |
|
2491 | 2496 | |
|
2492 | 2497 | ``errorlog`` |
|
2493 | 2498 | Where to output the error log. (default: stderr) |
|
2494 | 2499 | |
|
2495 | 2500 | ``guessmime`` |
|
2496 | 2501 | Control MIME types for raw download of file content. |
|
2497 | 2502 | Set to True to let hgweb guess the content type from the file |
|
2498 | 2503 | extension. This will serve HTML files as ``text/html`` and might |
|
2499 | 2504 | allow cross-site scripting attacks when serving untrusted |
|
2500 | 2505 | repositories. (default: False) |
|
2501 | 2506 | |
|
2502 | 2507 | ``hidden`` |
|
2503 | 2508 | Whether to hide the repository in the hgwebdir index. |
|
2504 | 2509 | (default: False) |
|
2505 | 2510 | |
|
2506 | 2511 | ``ipv6`` |
|
2507 | 2512 | Whether to use IPv6. (default: False) |
|
2508 | 2513 | |
|
2509 | 2514 | ``labels`` |
|
2510 | 2515 | List of string *labels* associated with the repository. |
|
2511 | 2516 | |
|
2512 | 2517 | Labels are exposed as a template keyword and can be used to customize |
|
2513 | 2518 | output. e.g. the ``index`` template can group or filter repositories |
|
2514 | 2519 | by labels and the ``summary`` template can display additional content |
|
2515 | 2520 | if a specific label is present. |
|
2516 | 2521 | |
|
2517 | 2522 | ``logoimg`` |
|
2518 | 2523 | File name of the logo image that some templates display on each page. |
|
2519 | 2524 | The file name is relative to ``staticurl``. That is, the full path to |
|
2520 | 2525 | the logo image is "staticurl/logoimg". |
|
2521 | 2526 | If unset, ``hglogo.png`` will be used. |
|
2522 | 2527 | |
|
2523 | 2528 | ``logourl`` |
|
2524 | 2529 | Base URL to use for logos. If unset, ``https://mercurial-scm.org/`` |
|
2525 | 2530 | will be used. |
|
2526 | 2531 | |
|
2527 | 2532 | ``maxchanges`` |
|
2528 | 2533 | Maximum number of changes to list on the changelog. (default: 10) |
|
2529 | 2534 | |
|
2530 | 2535 | ``maxfiles`` |
|
2531 | 2536 | Maximum number of files to list per changeset. (default: 10) |
|
2532 | 2537 | |
|
2533 | 2538 | ``maxshortchanges`` |
|
2534 | 2539 | Maximum number of changes to list on the shortlog, graph or filelog |
|
2535 | 2540 | pages. (default: 60) |
|
2536 | 2541 | |
|
2537 | 2542 | ``name`` |
|
2538 | 2543 | Repository name to use in the web interface. |
|
2539 | 2544 | (default: current working directory) |
|
2540 | 2545 | |
|
2541 | 2546 | ``port`` |
|
2542 | 2547 | Port to listen on. (default: 8000) |
|
2543 | 2548 | |
|
2544 | 2549 | ``prefix`` |
|
2545 | 2550 | Prefix path to serve from. (default: '' (server root)) |
|
2546 | 2551 | |
|
2547 | 2552 | ``push_ssl`` |
|
2548 | 2553 | Whether to require that inbound pushes be transported over SSL to |
|
2549 | 2554 | prevent password sniffing. (default: True) |
|
2550 | 2555 | |
|
2551 | 2556 | ``refreshinterval`` |
|
2552 | 2557 | How frequently directory listings re-scan the filesystem for new |
|
2553 | 2558 | repositories, in seconds. This is relevant when wildcards are used |
|
2554 | 2559 | to define paths. Depending on how much filesystem traversal is |
|
2555 | 2560 | required, refreshing may negatively impact performance. |
|
2556 | 2561 | |
|
2557 | 2562 | Values less than or equal to 0 always refresh. |
|
2558 | 2563 | (default: 20) |
|
2559 | 2564 | |
|
2560 | 2565 | ``server-header`` |
|
2561 | 2566 | Value for HTTP ``Server`` response header. |
|
2562 | 2567 | |
|
2563 | 2568 | ``staticurl`` |
|
2564 | 2569 | Base URL to use for static files. If unset, static files (e.g. the |
|
2565 | 2570 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
2566 | 2571 | this setting to serve them directly with the HTTP server. |
|
2567 | 2572 | Example: ``http://hgserver/static/``. |
|
2568 | 2573 | |
|
2569 | 2574 | ``stripes`` |
|
2570 | 2575 | How many lines a "zebra stripe" should span in multi-line output. |
|
2571 | 2576 | Set to 0 to disable. (default: 1) |
|
2572 | 2577 | |
|
2573 | 2578 | ``style`` |
|
2574 | 2579 | Which template map style to use. The available options are the names of |
|
2575 | 2580 | subdirectories in the HTML templates path. (default: ``paper``) |
|
2576 | 2581 | Example: ``monoblue``. |
|
2577 | 2582 | |
|
2578 | 2583 | ``templates`` |
|
2579 | 2584 | Where to find the HTML templates. The default path to the HTML templates |
|
2580 | 2585 | can be obtained from ``hg debuginstall``. |
|
2581 | 2586 | |
|
2582 | 2587 | ``websub`` |
|
2583 | 2588 | ---------- |
|
2584 | 2589 | |
|
2585 | 2590 | Web substitution filter definition. You can use this section to |
|
2586 | 2591 | define a set of regular expression substitution patterns which |
|
2587 | 2592 | let you automatically modify the hgweb server output. |
|
2588 | 2593 | |
|
2589 | 2594 | The default hgweb templates only apply these substitution patterns |
|
2590 | 2595 | on the revision description fields. You can apply them anywhere |
|
2591 | 2596 | you want when you create your own templates by adding calls to the |
|
2592 | 2597 | "websub" filter (usually after calling the "escape" filter). |
|
2593 | 2598 | |
|
2594 | 2599 | This can be used, for example, to convert issue references to links |
|
2595 | 2600 | to your issue tracker, or to convert "markdown-like" syntax into |
|
2596 | 2601 | HTML (see the examples below). |
|
2597 | 2602 | |
|
2598 | 2603 | Each entry in this section names a substitution filter. |
|
2599 | 2604 | The value of each entry defines the substitution expression itself. |
|
2600 | 2605 | The websub expressions follow the old interhg extension syntax, |
|
2601 | 2606 | which in turn imitates the Unix sed replacement syntax:: |
|
2602 | 2607 | |
|
2603 | 2608 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] |
|
2604 | 2609 | |
|
2605 | 2610 | You can use any separator other than "/". The final "i" is optional |
|
2606 | 2611 | and indicates that the search must be case insensitive. |
|
2607 | 2612 | |
|
2608 | 2613 | Examples:: |
|
2609 | 2614 | |
|
2610 | 2615 | [websub] |
|
2611 | 2616 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i |
|
2612 | 2617 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ |
|
2613 | 2618 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ |
|
2614 | 2619 | |
|
2615 | 2620 | ``worker`` |
|
2616 | 2621 | ---------- |
|
2617 | 2622 | |
|
2618 | 2623 | Parallel master/worker configuration. We currently perform working |
|
2619 | 2624 | directory updates in parallel on Unix-like systems, which greatly |
|
2620 | 2625 | helps performance. |
|
2621 | 2626 | |
|
2622 | 2627 | ``enabled`` |
|
2623 | 2628 | Whether to enable workers code to be used. |
|
2624 | 2629 | (default: true) |
|
2625 | 2630 | |
|
2626 | 2631 | ``numcpus`` |
|
2627 | 2632 | Number of CPUs to use for parallel operations. A zero or |
|
2628 | 2633 | negative value is treated as ``use the default``. |
|
2629 | 2634 | (default: 4 or the number of CPUs on the system, whichever is larger) |
|
2630 | 2635 | |
|
2631 | 2636 | ``backgroundclose`` |
|
2632 | 2637 | Whether to enable closing file handles on background threads during certain |
|
2633 | 2638 | operations. Some platforms aren't very efficient at closing file |
|
2634 | 2639 | handles that have been written or appended to. By performing file closing |
|
2635 | 2640 | on background threads, file write rate can increase substantially. |
|
2636 | 2641 | (default: true on Windows, false elsewhere) |
|
2637 | 2642 | |
|
2638 | 2643 | ``backgroundcloseminfilecount`` |
|
2639 | 2644 | Minimum number of files required to trigger background file closing. |
|
2640 | 2645 | Operations not writing this many files won't start background close |
|
2641 | 2646 | threads. |
|
2642 | 2647 | (default: 2048) |
|
2643 | 2648 | |
|
2644 | 2649 | ``backgroundclosemaxqueue`` |
|
2645 | 2650 | The maximum number of opened file handles waiting to be closed in the |
|
2646 | 2651 | background. This option only has an effect if ``backgroundclose`` is |
|
2647 | 2652 | enabled. |
|
2648 | 2653 | (default: 384) |
|
2649 | 2654 | |
|
2650 | 2655 | ``backgroundclosethreadcount`` |
|
2651 | 2656 | Number of threads to process background file closes. Only relevant if |
|
2652 | 2657 | ``backgroundclose`` is enabled. |
|
2653 | 2658 | (default: 4) |
@@ -1,1887 +1,1889 b'' | |||
|
1 | 1 | This file used to contains all largefile tests. |
|
2 | 2 | Do not add any new tests in this file as it his already far too long to run. |
|
3 | 3 | |
|
4 | 4 | It contains all the testing of the basic concepts of large file in a single block. |
|
5 | 5 | |
|
6 | 6 | $ USERCACHE="$TESTTMP/cache"; export USERCACHE |
|
7 | 7 | $ mkdir "${USERCACHE}" |
|
8 | 8 | $ cat >> $HGRCPATH <<EOF |
|
9 | 9 | > [extensions] |
|
10 | 10 | > largefiles= |
|
11 | 11 | > purge= |
|
12 | 12 | > rebase= |
|
13 | 13 | > transplant= |
|
14 | 14 | > [phases] |
|
15 | 15 | > publish=False |
|
16 | 16 | > [largefiles] |
|
17 | 17 | > minsize=2 |
|
18 | 18 | > patterns=glob:**.dat |
|
19 | 19 | > usercache=${USERCACHE} |
|
20 | 20 | > [hooks] |
|
21 | 21 | > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status" |
|
22 | 22 | > EOF |
|
23 | 23 | |
|
24 | 24 | Create the repo with a couple of revisions of both large and normal |
|
25 | 25 | files. |
|
26 | 26 | Test status and dirstate of largefiles and that summary output is correct. |
|
27 | 27 | |
|
28 | 28 | $ hg init a |
|
29 | 29 | $ cd a |
|
30 | 30 | $ mkdir sub |
|
31 | 31 | $ echo normal1 > normal1 |
|
32 | 32 | $ echo normal2 > sub/normal2 |
|
33 | 33 | $ echo large1 > large1 |
|
34 | 34 | $ echo large2 > sub/large2 |
|
35 | 35 | $ hg add normal1 sub/normal2 |
|
36 | 36 | $ hg add --large large1 sub/large2 |
|
37 | 37 | $ hg commit -m "add files" |
|
38 | 38 | Invoking status precommit hook |
|
39 | 39 | A large1 |
|
40 | 40 | A normal1 |
|
41 | 41 | A sub/large2 |
|
42 | 42 | A sub/normal2 |
|
43 | 43 | $ touch large1 sub/large2 |
|
44 | 44 | $ sleep 1 |
|
45 | 45 | $ hg st |
|
46 | 46 | $ hg debugstate --nodates |
|
47 | 47 | n 644 41 set .hglf/large1 |
|
48 | 48 | n 644 41 set .hglf/sub/large2 |
|
49 | 49 | n 644 8 set normal1 |
|
50 | 50 | n 644 8 set sub/normal2 |
|
51 | 51 | $ hg debugstate --large --nodates |
|
52 | 52 | n 644 7 set large1 |
|
53 | 53 | n 644 7 set sub/large2 |
|
54 | 54 | $ echo normal11 > normal1 |
|
55 | 55 | $ echo normal22 > sub/normal2 |
|
56 | 56 | $ echo large11 > large1 |
|
57 | 57 | $ echo large22 > sub/large2 |
|
58 | 58 | $ hg commit -m "edit files" |
|
59 | 59 | Invoking status precommit hook |
|
60 | 60 | M large1 |
|
61 | 61 | M normal1 |
|
62 | 62 | M sub/large2 |
|
63 | 63 | M sub/normal2 |
|
64 | 64 | $ hg sum --large |
|
65 | 65 | parent: 1:ce8896473775 tip |
|
66 | 66 | edit files |
|
67 | 67 | branch: default |
|
68 | 68 | commit: (clean) |
|
69 | 69 | update: (current) |
|
70 | 70 | phases: 2 draft |
|
71 | 71 | largefiles: (no remote repo) |
|
72 | 72 | |
|
73 | 73 | Commit preserved largefile contents. |
|
74 | 74 | |
|
75 | 75 | $ cat normal1 |
|
76 | 76 | normal11 |
|
77 | 77 | $ cat large1 |
|
78 | 78 | large11 |
|
79 | 79 | $ cat sub/normal2 |
|
80 | 80 | normal22 |
|
81 | 81 | $ cat sub/large2 |
|
82 | 82 | large22 |
|
83 | 83 | |
|
84 | 84 | Test status, subdir and unknown files |
|
85 | 85 | |
|
86 | 86 | $ echo unknown > sub/unknown |
|
87 | 87 | $ hg st --all |
|
88 | 88 | ? sub/unknown |
|
89 | 89 | C large1 |
|
90 | 90 | C normal1 |
|
91 | 91 | C sub/large2 |
|
92 | 92 | C sub/normal2 |
|
93 | 93 | $ hg st --all sub |
|
94 | 94 | ? sub/unknown |
|
95 | 95 | C sub/large2 |
|
96 | 96 | C sub/normal2 |
|
97 | 97 | $ rm sub/unknown |
|
98 | 98 | |
|
99 | 99 | Test messages and exit codes for remove warning cases |
|
100 | 100 | |
|
101 | 101 | $ hg remove -A large1 |
|
102 | 102 | not removing large1: file still exists |
|
103 | 103 | [1] |
|
104 | 104 | $ echo 'modified' > large1 |
|
105 | 105 | $ hg remove large1 |
|
106 | 106 | not removing large1: file is modified (use -f to force removal) |
|
107 | 107 | [1] |
|
108 | 108 | $ echo 'new' > normalnew |
|
109 | 109 | $ hg add normalnew |
|
110 | 110 | $ echo 'new' > largenew |
|
111 | 111 | $ hg add --large normalnew |
|
112 | 112 | normalnew already tracked! |
|
113 | 113 | $ hg remove normalnew largenew |
|
114 | 114 | not removing largenew: file is untracked |
|
115 | 115 | not removing normalnew: file has been marked for add (use 'hg forget' to undo add) |
|
116 | 116 | [1] |
|
117 | 117 | $ rm normalnew largenew |
|
118 | 118 | $ hg up -Cq |
|
119 | 119 | |
|
120 | 120 | Remove both largefiles and normal files. |
|
121 | 121 | |
|
122 | 122 | $ hg remove normal1 large1 |
|
123 | 123 | $ hg status large1 |
|
124 | 124 | R large1 |
|
125 | 125 | $ hg commit -m "remove files" |
|
126 | 126 | Invoking status precommit hook |
|
127 | 127 | R large1 |
|
128 | 128 | R normal1 |
|
129 | 129 | $ ls |
|
130 | 130 | sub |
|
131 | 131 | $ echo "testlargefile" > large1-test |
|
132 | 132 | $ hg add --large large1-test |
|
133 | 133 | $ hg st |
|
134 | 134 | A large1-test |
|
135 | 135 | $ hg rm large1-test |
|
136 | 136 | not removing large1-test: file has been marked for add (use forget to undo) |
|
137 | 137 | [1] |
|
138 | 138 | $ hg st |
|
139 | 139 | A large1-test |
|
140 | 140 | $ hg forget large1-test |
|
141 | 141 | $ hg st |
|
142 | 142 | ? large1-test |
|
143 | 143 | $ hg remove large1-test |
|
144 | 144 | not removing large1-test: file is untracked |
|
145 | 145 | [1] |
|
146 | 146 | $ hg forget large1-test |
|
147 | 147 | not removing large1-test: file is already untracked |
|
148 | 148 | [1] |
|
149 | 149 | $ rm large1-test |
|
150 | 150 | |
|
151 | 151 | Copy both largefiles and normal files (testing that status output is correct). |
|
152 | 152 | |
|
153 | 153 | $ hg cp sub/normal2 normal1 |
|
154 | 154 | $ hg cp sub/large2 large1 |
|
155 | 155 | $ hg commit -m "copy files" |
|
156 | 156 | Invoking status precommit hook |
|
157 | 157 | A large1 |
|
158 | 158 | A normal1 |
|
159 | 159 | $ cat normal1 |
|
160 | 160 | normal22 |
|
161 | 161 | $ cat large1 |
|
162 | 162 | large22 |
|
163 | 163 | |
|
164 | 164 | Test moving largefiles and verify that normal files are also unaffected. |
|
165 | 165 | |
|
166 | 166 | $ hg mv normal1 normal3 |
|
167 | 167 | $ hg mv large1 large3 |
|
168 | 168 | $ hg mv sub/normal2 sub/normal4 |
|
169 | 169 | $ hg mv sub/large2 sub/large4 |
|
170 | 170 | $ hg commit -m "move files" |
|
171 | 171 | Invoking status precommit hook |
|
172 | 172 | A large3 |
|
173 | 173 | A normal3 |
|
174 | 174 | A sub/large4 |
|
175 | 175 | A sub/normal4 |
|
176 | 176 | R large1 |
|
177 | 177 | R normal1 |
|
178 | 178 | R sub/large2 |
|
179 | 179 | R sub/normal2 |
|
180 | 180 | $ cat normal3 |
|
181 | 181 | normal22 |
|
182 | 182 | $ cat large3 |
|
183 | 183 | large22 |
|
184 | 184 | $ cat sub/normal4 |
|
185 | 185 | normal22 |
|
186 | 186 | $ cat sub/large4 |
|
187 | 187 | large22 |
|
188 | 188 | |
|
189 | 189 | |
|
190 | 190 | #if serve |
|
191 | 191 | Test display of largefiles in hgweb |
|
192 | 192 | |
|
193 | 193 | $ hg serve -d -p $HGPORT --pid-file ../hg.pid |
|
194 | 194 | $ cat ../hg.pid >> $DAEMON_PIDS |
|
195 | 195 | $ get-with-headers.py $LOCALIP:$HGPORT 'file/tip/?style=raw' |
|
196 | 196 | 200 Script output follows |
|
197 | 197 | |
|
198 | 198 | |
|
199 | 199 | drwxr-xr-x sub |
|
200 | 200 | -rw-r--r-- 41 large3 |
|
201 | 201 | -rw-r--r-- 9 normal3 |
|
202 | 202 | |
|
203 | 203 | |
|
204 | 204 | $ get-with-headers.py $LOCALIP:$HGPORT 'file/tip/sub/?style=raw' |
|
205 | 205 | 200 Script output follows |
|
206 | 206 | |
|
207 | 207 | |
|
208 | 208 | -rw-r--r-- 41 large4 |
|
209 | 209 | -rw-r--r-- 9 normal4 |
|
210 | 210 | |
|
211 | 211 | |
|
212 | 212 | $ killdaemons.py |
|
213 | 213 | #endif |
|
214 | 214 | |
|
215 | 215 | Test largefiles can be loaded in hgweb (wrapcommand() shouldn't fail) |
|
216 | 216 | |
|
217 | 217 | $ cat <<EOF > "$TESTTMP/hgweb.cgi" |
|
218 | 218 | > #!$PYTHON |
|
219 | 219 | > from mercurial import demandimport; demandimport.enable() |
|
220 | 220 | > from mercurial.hgweb import hgweb |
|
221 | 221 | > from mercurial.hgweb import wsgicgi |
|
222 | 222 | > application = hgweb(b'.', b'test repo') |
|
223 | 223 | > wsgicgi.launch(application) |
|
224 | 224 | > EOF |
|
225 | 225 | $ . "$TESTDIR/cgienv" |
|
226 | 226 | |
|
227 | 227 | $ SCRIPT_NAME='' \ |
|
228 | 228 | > $PYTHON "$TESTTMP/hgweb.cgi" > /dev/null |
|
229 | 229 | |
|
230 | 230 | Test archiving the various revisions. These hit corner cases known with |
|
231 | 231 | archiving. |
|
232 | 232 | |
|
233 | 233 | $ hg archive -r 0 ../archive0 |
|
234 | 234 | $ hg archive -r 1 ../archive1 |
|
235 | 235 | $ hg archive -r 2 ../archive2 |
|
236 | 236 | $ hg archive -r 3 ../archive3 |
|
237 | 237 | $ hg archive -r 4 ../archive4 |
|
238 | 238 | $ cd ../archive0 |
|
239 | 239 | $ cat normal1 |
|
240 | 240 | normal1 |
|
241 | 241 | $ cat large1 |
|
242 | 242 | large1 |
|
243 | 243 | $ cat sub/normal2 |
|
244 | 244 | normal2 |
|
245 | 245 | $ cat sub/large2 |
|
246 | 246 | large2 |
|
247 | 247 | $ cd ../archive1 |
|
248 | 248 | $ cat normal1 |
|
249 | 249 | normal11 |
|
250 | 250 | $ cat large1 |
|
251 | 251 | large11 |
|
252 | 252 | $ cat sub/normal2 |
|
253 | 253 | normal22 |
|
254 | 254 | $ cat sub/large2 |
|
255 | 255 | large22 |
|
256 | 256 | $ cd ../archive2 |
|
257 | 257 | $ ls |
|
258 | 258 | sub |
|
259 | 259 | $ cat sub/normal2 |
|
260 | 260 | normal22 |
|
261 | 261 | $ cat sub/large2 |
|
262 | 262 | large22 |
|
263 | 263 | $ cd ../archive3 |
|
264 | 264 | $ cat normal1 |
|
265 | 265 | normal22 |
|
266 | 266 | $ cat large1 |
|
267 | 267 | large22 |
|
268 | 268 | $ cat sub/normal2 |
|
269 | 269 | normal22 |
|
270 | 270 | $ cat sub/large2 |
|
271 | 271 | large22 |
|
272 | 272 | $ cd ../archive4 |
|
273 | 273 | $ cat normal3 |
|
274 | 274 | normal22 |
|
275 | 275 | $ cat large3 |
|
276 | 276 | large22 |
|
277 | 277 | $ cat sub/normal4 |
|
278 | 278 | normal22 |
|
279 | 279 | $ cat sub/large4 |
|
280 | 280 | large22 |
|
281 | 281 | |
|
282 | 282 | Commit corner case: specify files to commit. |
|
283 | 283 | |
|
284 | 284 | $ cd ../a |
|
285 | 285 | $ echo normal3 > normal3 |
|
286 | 286 | $ echo large3 > large3 |
|
287 | 287 | $ echo normal4 > sub/normal4 |
|
288 | 288 | $ echo large4 > sub/large4 |
|
289 | 289 | $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again" |
|
290 | 290 | Invoking status precommit hook |
|
291 | 291 | M large3 |
|
292 | 292 | M normal3 |
|
293 | 293 | M sub/large4 |
|
294 | 294 | M sub/normal4 |
|
295 | 295 | $ cat normal3 |
|
296 | 296 | normal3 |
|
297 | 297 | $ cat large3 |
|
298 | 298 | large3 |
|
299 | 299 | $ cat sub/normal4 |
|
300 | 300 | normal4 |
|
301 | 301 | $ cat sub/large4 |
|
302 | 302 | large4 |
|
303 | 303 | |
|
304 | 304 | One more commit corner case: commit from a subdirectory. |
|
305 | 305 | |
|
306 | 306 | $ cd ../a |
|
307 | 307 | $ echo normal33 > normal3 |
|
308 | 308 | $ echo large33 > large3 |
|
309 | 309 | $ echo normal44 > sub/normal4 |
|
310 | 310 | $ echo large44 > sub/large4 |
|
311 | 311 | $ cd sub |
|
312 | 312 | $ hg commit -m "edit files yet again" |
|
313 | 313 | Invoking status precommit hook |
|
314 | 314 | M large3 |
|
315 | 315 | M normal3 |
|
316 | 316 | M sub/large4 |
|
317 | 317 | M sub/normal4 |
|
318 | 318 | $ cat ../normal3 |
|
319 | 319 | normal33 |
|
320 | 320 | $ cat ../large3 |
|
321 | 321 | large33 |
|
322 | 322 | $ cat normal4 |
|
323 | 323 | normal44 |
|
324 | 324 | $ cat large4 |
|
325 | 325 | large44 |
|
326 | 326 | |
|
327 | 327 | Committing standins is not allowed. |
|
328 | 328 | |
|
329 | 329 | $ cd .. |
|
330 | 330 | $ echo large3 > large3 |
|
331 | 331 | $ hg commit .hglf/large3 -m "try to commit standin" |
|
332 | 332 | abort: file ".hglf/large3" is a largefile standin |
|
333 | 333 | (commit the largefile itself instead) |
|
334 | 334 | [255] |
|
335 | 335 | |
|
336 | 336 | Corner cases for adding largefiles. |
|
337 | 337 | |
|
338 | 338 | $ echo large5 > large5 |
|
339 | 339 | $ hg add --large large5 |
|
340 | 340 | $ hg add --large large5 |
|
341 | 341 | large5 already a largefile |
|
342 | 342 | $ mkdir sub2 |
|
343 | 343 | $ echo large6 > sub2/large6 |
|
344 | 344 | $ echo large7 > sub2/large7 |
|
345 | 345 | $ hg add --large sub2 |
|
346 | 346 | adding sub2/large6 as a largefile |
|
347 | 347 | adding sub2/large7 as a largefile |
|
348 | 348 | $ hg st |
|
349 | 349 | M large3 |
|
350 | 350 | A large5 |
|
351 | 351 | A sub2/large6 |
|
352 | 352 | A sub2/large7 |
|
353 | 353 | |
|
354 | 354 | Committing directories containing only largefiles. |
|
355 | 355 | |
|
356 | 356 | $ mkdir -p z/y/x/m |
|
357 | 357 | $ touch z/y/x/m/large1 |
|
358 | 358 | $ touch z/y/x/large2 |
|
359 | 359 | $ hg add --large z/y/x/m/large1 z/y/x/large2 |
|
360 | 360 | $ hg commit -m "Subdir with directory only containing largefiles" z |
|
361 | 361 | Invoking status precommit hook |
|
362 | 362 | M large3 |
|
363 | 363 | A large5 |
|
364 | 364 | A sub2/large6 |
|
365 | 365 | A sub2/large7 |
|
366 | 366 | A z/y/x/large2 |
|
367 | 367 | A z/y/x/m/large1 |
|
368 | 368 | |
|
369 | 369 | (and a bit of log testing) |
|
370 | 370 | |
|
371 | 371 | $ hg log -T '{rev}\n' z/y/x/m/large1 |
|
372 | 372 | 7 |
|
373 | 373 | $ hg log -T '{rev}\n' z/y/x/m # with only a largefile |
|
374 | 374 | 7 |
|
375 | 375 | |
|
376 | 376 | $ hg rollback --quiet |
|
377 | 377 | $ touch z/y/x/m/normal |
|
378 | 378 | $ hg add z/y/x/m/normal |
|
379 | 379 | $ hg commit -m "Subdir with mixed contents" z |
|
380 | 380 | Invoking status precommit hook |
|
381 | 381 | M large3 |
|
382 | 382 | A large5 |
|
383 | 383 | A sub2/large6 |
|
384 | 384 | A sub2/large7 |
|
385 | 385 | A z/y/x/large2 |
|
386 | 386 | A z/y/x/m/large1 |
|
387 | 387 | A z/y/x/m/normal |
|
388 | 388 | $ hg st |
|
389 | 389 | M large3 |
|
390 | 390 | A large5 |
|
391 | 391 | A sub2/large6 |
|
392 | 392 | A sub2/large7 |
|
393 | 393 | $ hg rollback --quiet |
|
394 | 394 | $ hg revert z/y/x/large2 z/y/x/m/large1 |
|
395 | 395 | $ rm z/y/x/large2 z/y/x/m/large1 |
|
396 | 396 | $ hg commit -m "Subdir with normal contents" z |
|
397 | 397 | Invoking status precommit hook |
|
398 | 398 | M large3 |
|
399 | 399 | A large5 |
|
400 | 400 | A sub2/large6 |
|
401 | 401 | A sub2/large7 |
|
402 | 402 | A z/y/x/m/normal |
|
403 | 403 | $ hg st |
|
404 | 404 | M large3 |
|
405 | 405 | A large5 |
|
406 | 406 | A sub2/large6 |
|
407 | 407 | A sub2/large7 |
|
408 | 408 | $ hg rollback --quiet |
|
409 | 409 | $ hg revert --quiet z |
|
410 | 410 | $ hg commit -m "Empty subdir" z |
|
411 | 411 | abort: z: no match under directory! |
|
412 | 412 | [255] |
|
413 | 413 | $ rm -rf z |
|
414 | 414 | $ hg ci -m "standin" .hglf |
|
415 | 415 | abort: file ".hglf" is a largefile standin |
|
416 | 416 | (commit the largefile itself instead) |
|
417 | 417 | [255] |
|
418 | 418 | |
|
419 | 419 | Test "hg status" with combination of 'file pattern' and 'directory |
|
420 | 420 | pattern' for largefiles: |
|
421 | 421 | |
|
422 | 422 | $ hg status sub2/large6 sub2 |
|
423 | 423 | A sub2/large6 |
|
424 | 424 | A sub2/large7 |
|
425 | 425 | |
|
426 | 426 | Config settings (pattern **.dat, minsize 2 MB) are respected. |
|
427 | 427 | |
|
428 | 428 | $ echo testdata > test.dat |
|
429 | 429 | $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null |
|
430 | 430 | $ hg add |
|
431 | 431 | adding reallylarge as a largefile |
|
432 | 432 | adding test.dat as a largefile |
|
433 | 433 | |
|
434 | 434 | Test that minsize and --lfsize handle float values; |
|
435 | 435 | also tests that --lfsize overrides largefiles.minsize. |
|
436 | 436 | (0.250 MB = 256 kB = 262144 B) |
|
437 | 437 | |
|
438 | 438 | $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null |
|
439 | 439 | $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null |
|
440 | 440 | $ hg --config largefiles.minsize=.25 add |
|
441 | 441 | adding ratherlarge as a largefile |
|
442 | 442 | adding medium |
|
443 | 443 | $ hg forget medium |
|
444 | 444 | $ hg --config largefiles.minsize=.25 add --lfsize=.125 |
|
445 | 445 | adding medium as a largefile |
|
446 | 446 | $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null |
|
447 | 447 | $ hg --config largefiles.minsize=.25 add --lfsize=.125 |
|
448 | 448 | adding notlarge |
|
449 | 449 | $ hg forget notlarge |
|
450 | 450 | |
|
451 | 451 | Test forget on largefiles. |
|
452 | 452 | |
|
453 | 453 | $ hg forget large3 large5 test.dat reallylarge ratherlarge medium |
|
454 | 454 | $ hg commit -m "add/edit more largefiles" |
|
455 | 455 | Invoking status precommit hook |
|
456 | 456 | A sub2/large6 |
|
457 | 457 | A sub2/large7 |
|
458 | 458 | R large3 |
|
459 | 459 | ? large5 |
|
460 | 460 | ? medium |
|
461 | 461 | ? notlarge |
|
462 | 462 | ? ratherlarge |
|
463 | 463 | ? reallylarge |
|
464 | 464 | ? test.dat |
|
465 | 465 | $ hg st |
|
466 | 466 | ? large3 |
|
467 | 467 | ? large5 |
|
468 | 468 | ? medium |
|
469 | 469 | ? notlarge |
|
470 | 470 | ? ratherlarge |
|
471 | 471 | ? reallylarge |
|
472 | 472 | ? test.dat |
|
473 | 473 | |
|
474 | 474 | Purge with largefiles: verify that largefiles are still in the working |
|
475 | 475 | dir after a purge. |
|
476 | 476 | |
|
477 | 477 | $ hg purge --all |
|
478 | 478 | $ cat sub/large4 |
|
479 | 479 | large44 |
|
480 | 480 | $ cat sub2/large6 |
|
481 | 481 | large6 |
|
482 | 482 | $ cat sub2/large7 |
|
483 | 483 | large7 |
|
484 | 484 | |
|
485 | 485 | Test addremove: verify that files that should be added as largefiles are added as |
|
486 | 486 | such and that already-existing largefiles are not added as normal files by |
|
487 | 487 | accident. |
|
488 | 488 | |
|
489 | 489 | $ rm normal3 |
|
490 | 490 | $ rm sub/large4 |
|
491 | 491 | $ echo "testing addremove with patterns" > testaddremove.dat |
|
492 | 492 | $ echo "normaladdremove" > normaladdremove |
|
493 | 493 | $ hg addremove |
|
494 | 494 | removing sub/large4 |
|
495 | 495 | adding testaddremove.dat as a largefile |
|
496 | 496 | removing normal3 |
|
497 | 497 | adding normaladdremove |
|
498 | 498 | |
|
499 | 499 | Test addremove with -R |
|
500 | 500 | |
|
501 | 501 | $ hg up -C |
|
502 | 502 | getting changed largefiles |
|
503 | 503 | 1 largefiles updated, 0 removed |
|
504 | 504 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
505 | 505 | $ rm normal3 |
|
506 | 506 | $ rm sub/large4 |
|
507 | 507 | $ echo "testing addremove with patterns" > testaddremove.dat |
|
508 | 508 | $ echo "normaladdremove" > normaladdremove |
|
509 | 509 | $ cd .. |
|
510 | 510 | $ hg -R a -v addremove |
|
511 | 511 | removing sub/large4 |
|
512 | 512 | adding testaddremove.dat as a largefile |
|
513 | 513 | removing normal3 |
|
514 | 514 | adding normaladdremove |
|
515 | 515 | $ cd a |
|
516 | 516 | |
|
517 | 517 | Test 3364 |
|
518 | 518 | $ hg clone . ../addrm |
|
519 | 519 | updating to branch default |
|
520 | 520 | getting changed largefiles |
|
521 | 521 | 3 largefiles updated, 0 removed |
|
522 | 522 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
523 | 523 | $ cd ../addrm |
|
524 | 524 | $ cat >> .hg/hgrc <<EOF |
|
525 | 525 | > [hooks] |
|
526 | 526 | > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A" |
|
527 | 527 | > EOF |
|
528 | 528 | $ touch foo |
|
529 | 529 | $ hg add --large foo |
|
530 | 530 | $ hg ci -m "add foo" |
|
531 | 531 | Invoking status precommit hook |
|
532 | 532 | A foo |
|
533 | 533 | Invoking status postcommit hook |
|
534 | 534 | C foo |
|
535 | 535 | C normal3 |
|
536 | 536 | C sub/large4 |
|
537 | 537 | C sub/normal4 |
|
538 | 538 | C sub2/large6 |
|
539 | 539 | C sub2/large7 |
|
540 | 540 | $ rm foo |
|
541 | 541 | $ hg st |
|
542 | 542 | ! foo |
|
543 | 543 | hmm.. no precommit invoked, but there is a postcommit?? |
|
544 | 544 | $ hg ci -m "will not checkin" |
|
545 | 545 | nothing changed (1 missing files, see 'hg status') |
|
546 | 546 | Invoking status postcommit hook |
|
547 | 547 | ! foo |
|
548 | 548 | C normal3 |
|
549 | 549 | C sub/large4 |
|
550 | 550 | C sub/normal4 |
|
551 | 551 | C sub2/large6 |
|
552 | 552 | C sub2/large7 |
|
553 | 553 | [1] |
|
554 | 554 | $ hg addremove |
|
555 | 555 | removing foo |
|
556 | 556 | $ hg st |
|
557 | 557 | R foo |
|
558 | 558 | $ hg ci -m "used to say nothing changed" |
|
559 | 559 | Invoking status precommit hook |
|
560 | 560 | R foo |
|
561 | 561 | Invoking status postcommit hook |
|
562 | 562 | C normal3 |
|
563 | 563 | C sub/large4 |
|
564 | 564 | C sub/normal4 |
|
565 | 565 | C sub2/large6 |
|
566 | 566 | C sub2/large7 |
|
567 | 567 | $ hg st |
|
568 | 568 | |
|
569 | 569 | Test 3507 (both normal files and largefiles were a problem) |
|
570 | 570 | |
|
571 | 571 | $ touch normal |
|
572 | 572 | $ touch large |
|
573 | 573 | $ hg add normal |
|
574 | 574 | $ hg add --large large |
|
575 | 575 | $ hg ci -m "added" |
|
576 | 576 | Invoking status precommit hook |
|
577 | 577 | A large |
|
578 | 578 | A normal |
|
579 | 579 | Invoking status postcommit hook |
|
580 | 580 | C large |
|
581 | 581 | C normal |
|
582 | 582 | C normal3 |
|
583 | 583 | C sub/large4 |
|
584 | 584 | C sub/normal4 |
|
585 | 585 | C sub2/large6 |
|
586 | 586 | C sub2/large7 |
|
587 | 587 | $ hg remove normal |
|
588 | 588 | $ hg addremove --traceback |
|
589 | 589 | $ hg ci -m "addremoved normal" |
|
590 | 590 | Invoking status precommit hook |
|
591 | 591 | R normal |
|
592 | 592 | Invoking status postcommit hook |
|
593 | 593 | C large |
|
594 | 594 | C normal3 |
|
595 | 595 | C sub/large4 |
|
596 | 596 | C sub/normal4 |
|
597 | 597 | C sub2/large6 |
|
598 | 598 | C sub2/large7 |
|
599 | 599 | $ hg up -C '.^' |
|
600 | 600 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
601 | 601 | $ hg remove large |
|
602 | 602 | $ hg addremove --traceback |
|
603 | 603 | $ hg ci -m "removed large" |
|
604 | 604 | Invoking status precommit hook |
|
605 | 605 | R large |
|
606 | 606 | created new head |
|
607 | 607 | Invoking status postcommit hook |
|
608 | 608 | C normal |
|
609 | 609 | C normal3 |
|
610 | 610 | C sub/large4 |
|
611 | 611 | C sub/normal4 |
|
612 | 612 | C sub2/large6 |
|
613 | 613 | C sub2/large7 |
|
614 | 614 | |
|
615 | 615 | Test commit -A (issue3542) |
|
616 | 616 | $ echo large8 > large8 |
|
617 | 617 | $ hg add --large large8 |
|
618 | 618 | $ hg ci -Am 'this used to add large8 as normal and commit both' |
|
619 | 619 | Invoking status precommit hook |
|
620 | 620 | A large8 |
|
621 | 621 | Invoking status postcommit hook |
|
622 | 622 | C large8 |
|
623 | 623 | C normal |
|
624 | 624 | C normal3 |
|
625 | 625 | C sub/large4 |
|
626 | 626 | C sub/normal4 |
|
627 | 627 | C sub2/large6 |
|
628 | 628 | C sub2/large7 |
|
629 | 629 | $ rm large8 |
|
630 | 630 | $ hg ci -Am 'this used to not notice the rm' |
|
631 | 631 | removing large8 |
|
632 | 632 | Invoking status precommit hook |
|
633 | 633 | R large8 |
|
634 | 634 | Invoking status postcommit hook |
|
635 | 635 | C normal |
|
636 | 636 | C normal3 |
|
637 | 637 | C sub/large4 |
|
638 | 638 | C sub/normal4 |
|
639 | 639 | C sub2/large6 |
|
640 | 640 | C sub2/large7 |
|
641 | 641 | |
|
642 | 642 | Test that a standin can't be added as a large file |
|
643 | 643 | |
|
644 | 644 | $ touch large |
|
645 | 645 | $ hg add --large large |
|
646 | 646 | $ hg ci -m "add" |
|
647 | 647 | Invoking status precommit hook |
|
648 | 648 | A large |
|
649 | 649 | Invoking status postcommit hook |
|
650 | 650 | C large |
|
651 | 651 | C normal |
|
652 | 652 | C normal3 |
|
653 | 653 | C sub/large4 |
|
654 | 654 | C sub/normal4 |
|
655 | 655 | C sub2/large6 |
|
656 | 656 | C sub2/large7 |
|
657 | 657 | $ hg remove large |
|
658 | 658 | $ touch large |
|
659 | 659 | $ hg addremove --config largefiles.patterns=**large --traceback |
|
660 | 660 | adding large as a largefile |
|
661 | 661 | |
|
662 | 662 | Test that outgoing --large works (with revsets too) |
|
663 | 663 | $ hg outgoing --rev '.^' --large |
|
664 | 664 | comparing with $TESTTMP/a |
|
665 | 665 | searching for changes |
|
666 | 666 | changeset: 8:c02fd3b77ec4 |
|
667 | 667 | user: test |
|
668 | 668 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
669 | 669 | summary: add foo |
|
670 | 670 | |
|
671 | 671 | changeset: 9:289dd08c9bbb |
|
672 | 672 | user: test |
|
673 | 673 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
674 | 674 | summary: used to say nothing changed |
|
675 | 675 | |
|
676 | 676 | changeset: 10:34f23ac6ac12 |
|
677 | 677 | user: test |
|
678 | 678 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
679 | 679 | summary: added |
|
680 | 680 | |
|
681 | 681 | changeset: 12:710c1b2f523c |
|
682 | 682 | parent: 10:34f23ac6ac12 |
|
683 | 683 | user: test |
|
684 | 684 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
685 | 685 | summary: removed large |
|
686 | 686 | |
|
687 | 687 | changeset: 13:0a3e75774479 |
|
688 | 688 | user: test |
|
689 | 689 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
690 | 690 | summary: this used to add large8 as normal and commit both |
|
691 | 691 | |
|
692 | 692 | changeset: 14:84f3d378175c |
|
693 | 693 | user: test |
|
694 | 694 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
695 | 695 | summary: this used to not notice the rm |
|
696 | 696 | |
|
697 | 697 | largefiles to upload (1 entities): |
|
698 | 698 | large8 |
|
699 | 699 | |
|
700 | 700 | $ cd ../a |
|
701 | 701 | |
|
702 | 702 | Clone a largefiles repo. |
|
703 | 703 | |
|
704 | 704 | $ hg clone . ../b |
|
705 | 705 | updating to branch default |
|
706 | 706 | getting changed largefiles |
|
707 | 707 | 3 largefiles updated, 0 removed |
|
708 | 708 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
709 | 709 | $ cd ../b |
|
710 | 710 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
711 | 711 | 7:daea875e9014 add/edit more largefiles |
|
712 | 712 | 6:4355d653f84f edit files yet again |
|
713 | 713 | 5:9d5af5072dbd edit files again |
|
714 | 714 | 4:74c02385b94c move files |
|
715 | 715 | 3:9e8fbc4bce62 copy files |
|
716 | 716 | 2:51a0ae4d5864 remove files |
|
717 | 717 | 1:ce8896473775 edit files |
|
718 | 718 | 0:30d30fe6a5be add files |
|
719 | 719 | $ cat normal3 |
|
720 | 720 | normal33 |
|
721 | 721 | |
|
722 | 722 | Test graph log |
|
723 | 723 | |
|
724 | 724 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' |
|
725 | 725 | @ 7:daea875e9014 add/edit more largefiles |
|
726 | 726 | | |
|
727 | 727 | o 6:4355d653f84f edit files yet again |
|
728 | 728 | | |
|
729 | 729 | o 5:9d5af5072dbd edit files again |
|
730 | 730 | | |
|
731 | 731 | o 4:74c02385b94c move files |
|
732 | 732 | | |
|
733 | 733 | o 3:9e8fbc4bce62 copy files |
|
734 | 734 | | |
|
735 | 735 | o 2:51a0ae4d5864 remove files |
|
736 | 736 | | |
|
737 | 737 | o 1:ce8896473775 edit files |
|
738 | 738 | | |
|
739 | 739 | o 0:30d30fe6a5be add files |
|
740 | 740 | |
|
741 | 741 | |
|
742 | 742 | Test log with --patch |
|
743 | 743 | |
|
744 | 744 | $ hg log --patch -r 6::7 |
|
745 | 745 | changeset: 6:4355d653f84f |
|
746 | 746 | user: test |
|
747 | 747 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
748 | 748 | summary: edit files yet again |
|
749 | 749 | |
|
750 | 750 | diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3 |
|
751 | 751 | --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 |
|
752 | 752 | +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 |
|
753 | 753 | @@ -1,1 +1,1 @@ |
|
754 | 754 | -baaf12afde9d8d67f25dab6dced0d2bf77dba47c |
|
755 | 755 | +7838695e10da2bb75ac1156565f40a2595fa2fa0 |
|
756 | 756 | diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4 |
|
757 | 757 | --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
758 | 758 | +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
759 | 759 | @@ -1,1 +1,1 @@ |
|
760 | 760 | -aeb2210d19f02886dde00dac279729a48471e2f9 |
|
761 | 761 | +971fb41e78fea4f8e0ba5244784239371cb00591 |
|
762 | 762 | diff -r 9d5af5072dbd -r 4355d653f84f normal3 |
|
763 | 763 | --- a/normal3 Thu Jan 01 00:00:00 1970 +0000 |
|
764 | 764 | +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000 |
|
765 | 765 | @@ -1,1 +1,1 @@ |
|
766 | 766 | -normal3 |
|
767 | 767 | +normal33 |
|
768 | 768 | diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4 |
|
769 | 769 | --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 |
|
770 | 770 | +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 |
|
771 | 771 | @@ -1,1 +1,1 @@ |
|
772 | 772 | -normal4 |
|
773 | 773 | +normal44 |
|
774 | 774 | |
|
775 | 775 | changeset: 7:daea875e9014 |
|
776 | 776 | tag: tip |
|
777 | 777 | user: test |
|
778 | 778 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
779 | 779 | summary: add/edit more largefiles |
|
780 | 780 | |
|
781 | 781 | diff -r 4355d653f84f -r daea875e9014 .hglf/large3 |
|
782 | 782 | --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 |
|
783 | 783 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
784 | 784 | @@ -1,1 +0,0 @@ |
|
785 | 785 | -7838695e10da2bb75ac1156565f40a2595fa2fa0 |
|
786 | 786 | diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6 |
|
787 | 787 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
788 | 788 | +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000 |
|
789 | 789 | @@ -0,0 +1,1 @@ |
|
790 | 790 | +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 |
|
791 | 791 | diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7 |
|
792 | 792 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
793 | 793 | +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000 |
|
794 | 794 | @@ -0,0 +1,1 @@ |
|
795 | 795 | +bb3151689acb10f0c3125c560d5e63df914bc1af |
|
796 | 796 | |
|
797 | 797 | |
|
798 | 798 | $ hg log --patch -r 6::7 sub/ |
|
799 | 799 | changeset: 6:4355d653f84f |
|
800 | 800 | user: test |
|
801 | 801 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
802 | 802 | summary: edit files yet again |
|
803 | 803 | |
|
804 | 804 | diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4 |
|
805 | 805 | --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
806 | 806 | +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
807 | 807 | @@ -1,1 +1,1 @@ |
|
808 | 808 | -aeb2210d19f02886dde00dac279729a48471e2f9 |
|
809 | 809 | +971fb41e78fea4f8e0ba5244784239371cb00591 |
|
810 | 810 | diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4 |
|
811 | 811 | --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 |
|
812 | 812 | +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 |
|
813 | 813 | @@ -1,1 +1,1 @@ |
|
814 | 814 | -normal4 |
|
815 | 815 | +normal44 |
|
816 | 816 | |
|
817 | 817 | |
|
818 | 818 | log with both --follow and --patch |
|
819 | 819 | |
|
820 | 820 | $ hg log --follow --patch --limit 2 |
|
821 | 821 | changeset: 7:daea875e9014 |
|
822 | 822 | tag: tip |
|
823 | 823 | user: test |
|
824 | 824 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
825 | 825 | summary: add/edit more largefiles |
|
826 | 826 | |
|
827 | 827 | diff -r 4355d653f84f -r daea875e9014 .hglf/large3 |
|
828 | 828 | --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 |
|
829 | 829 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
830 | 830 | @@ -1,1 +0,0 @@ |
|
831 | 831 | -7838695e10da2bb75ac1156565f40a2595fa2fa0 |
|
832 | 832 | diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6 |
|
833 | 833 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
834 | 834 | +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000 |
|
835 | 835 | @@ -0,0 +1,1 @@ |
|
836 | 836 | +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 |
|
837 | 837 | diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7 |
|
838 | 838 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
839 | 839 | +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000 |
|
840 | 840 | @@ -0,0 +1,1 @@ |
|
841 | 841 | +bb3151689acb10f0c3125c560d5e63df914bc1af |
|
842 | 842 | |
|
843 | 843 | changeset: 6:4355d653f84f |
|
844 | 844 | user: test |
|
845 | 845 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
846 | 846 | summary: edit files yet again |
|
847 | 847 | |
|
848 | 848 | diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3 |
|
849 | 849 | --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 |
|
850 | 850 | +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 |
|
851 | 851 | @@ -1,1 +1,1 @@ |
|
852 | 852 | -baaf12afde9d8d67f25dab6dced0d2bf77dba47c |
|
853 | 853 | +7838695e10da2bb75ac1156565f40a2595fa2fa0 |
|
854 | 854 | diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4 |
|
855 | 855 | --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
856 | 856 | +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
857 | 857 | @@ -1,1 +1,1 @@ |
|
858 | 858 | -aeb2210d19f02886dde00dac279729a48471e2f9 |
|
859 | 859 | +971fb41e78fea4f8e0ba5244784239371cb00591 |
|
860 | 860 | diff -r 9d5af5072dbd -r 4355d653f84f normal3 |
|
861 | 861 | --- a/normal3 Thu Jan 01 00:00:00 1970 +0000 |
|
862 | 862 | +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000 |
|
863 | 863 | @@ -1,1 +1,1 @@ |
|
864 | 864 | -normal3 |
|
865 | 865 | +normal33 |
|
866 | 866 | diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4 |
|
867 | 867 | --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 |
|
868 | 868 | +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 |
|
869 | 869 | @@ -1,1 +1,1 @@ |
|
870 | 870 | -normal4 |
|
871 | 871 | +normal44 |
|
872 | 872 | |
|
873 | 873 | $ hg log --follow --patch sub/large4 |
|
874 | 874 | changeset: 6:4355d653f84f |
|
875 | 875 | user: test |
|
876 | 876 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
877 | 877 | summary: edit files yet again |
|
878 | 878 | |
|
879 | 879 | diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4 |
|
880 | 880 | --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
881 | 881 | +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
882 | 882 | @@ -1,1 +1,1 @@ |
|
883 | 883 | -aeb2210d19f02886dde00dac279729a48471e2f9 |
|
884 | 884 | +971fb41e78fea4f8e0ba5244784239371cb00591 |
|
885 | 885 | |
|
886 | 886 | changeset: 5:9d5af5072dbd |
|
887 | 887 | user: test |
|
888 | 888 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
889 | 889 | summary: edit files again |
|
890 | 890 | |
|
891 | 891 | diff -r 74c02385b94c -r 9d5af5072dbd .hglf/sub/large4 |
|
892 | 892 | --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
893 | 893 | +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
894 | 894 | @@ -1,1 +1,1 @@ |
|
895 | 895 | -eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
896 | 896 | +aeb2210d19f02886dde00dac279729a48471e2f9 |
|
897 | 897 | |
|
898 | 898 | changeset: 4:74c02385b94c |
|
899 | 899 | user: test |
|
900 | 900 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
901 | 901 | summary: move files |
|
902 | 902 | |
|
903 | 903 | diff -r 9e8fbc4bce62 -r 74c02385b94c .hglf/sub/large4 |
|
904 | 904 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
905 | 905 | +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
906 | 906 | @@ -0,0 +1,1 @@ |
|
907 | 907 | +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
908 | 908 | |
|
909 | 909 | changeset: 1:ce8896473775 |
|
910 | 910 | user: test |
|
911 | 911 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
912 | 912 | summary: edit files |
|
913 | 913 | |
|
914 | 914 | diff -r 30d30fe6a5be -r ce8896473775 .hglf/sub/large2 |
|
915 | 915 | --- a/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000 |
|
916 | 916 | +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000 |
|
917 | 917 | @@ -1,1 +1,1 @@ |
|
918 | 918 | -1deebade43c8c498a3c8daddac0244dc55d1331d |
|
919 | 919 | +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
920 | 920 | |
|
921 | 921 | changeset: 0:30d30fe6a5be |
|
922 | 922 | user: test |
|
923 | 923 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
924 | 924 | summary: add files |
|
925 | 925 | |
|
926 | 926 | diff -r 000000000000 -r 30d30fe6a5be .hglf/sub/large2 |
|
927 | 927 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
928 | 928 | +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000 |
|
929 | 929 | @@ -0,0 +1,1 @@ |
|
930 | 930 | +1deebade43c8c498a3c8daddac0244dc55d1331d |
|
931 | 931 | |
|
932 | 932 | $ cat sub/normal4 |
|
933 | 933 | normal44 |
|
934 | 934 | $ cat sub/large4 |
|
935 | 935 | large44 |
|
936 | 936 | $ cat sub2/large6 |
|
937 | 937 | large6 |
|
938 | 938 | $ cat sub2/large7 |
|
939 | 939 | large7 |
|
940 | 940 | $ hg log -qf sub2/large7 |
|
941 | 941 | 7:daea875e9014 |
|
942 | 942 | $ hg log -Gqf sub2/large7 |
|
943 | 943 | @ 7:daea875e9014 |
|
944 | 944 | | |
|
945 | 945 | ~ |
|
946 | 946 | $ cd .. |
|
947 | 947 | |
|
948 | 948 | Test log from outside repo |
|
949 | 949 | |
|
950 | 950 | $ hg log b/sub -T '{rev}:{node|short} {desc|firstline}\n' |
|
951 | 951 | 6:4355d653f84f edit files yet again |
|
952 | 952 | 5:9d5af5072dbd edit files again |
|
953 | 953 | 4:74c02385b94c move files |
|
954 | 954 | 1:ce8896473775 edit files |
|
955 | 955 | 0:30d30fe6a5be add files |
|
956 | 956 | |
|
957 | 957 | Test clone at revision |
|
958 | 958 | |
|
959 | 959 | $ hg clone a -r 3 c |
|
960 | 960 | adding changesets |
|
961 | 961 | adding manifests |
|
962 | 962 | adding file changes |
|
963 | 963 | added 4 changesets with 10 changes to 4 files |
|
964 | 964 | new changesets 30d30fe6a5be:9e8fbc4bce62 |
|
965 | 965 | updating to branch default |
|
966 | 966 | getting changed largefiles |
|
967 | 967 | 2 largefiles updated, 0 removed |
|
968 | 968 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
969 | 969 | $ cd c |
|
970 | 970 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
971 | 971 | 3:9e8fbc4bce62 copy files |
|
972 | 972 | 2:51a0ae4d5864 remove files |
|
973 | 973 | 1:ce8896473775 edit files |
|
974 | 974 | 0:30d30fe6a5be add files |
|
975 | 975 | $ cat normal1 |
|
976 | 976 | normal22 |
|
977 | 977 | $ cat large1 |
|
978 | 978 | large22 |
|
979 | 979 | $ cat sub/normal2 |
|
980 | 980 | normal22 |
|
981 | 981 | $ cat sub/large2 |
|
982 | 982 | large22 |
|
983 | 983 | |
|
984 | 984 | Old revisions of a clone have correct largefiles content (this also |
|
985 | 985 | tests update). |
|
986 | 986 | |
|
987 | 987 | $ hg update -r 1 |
|
988 | 988 | getting changed largefiles |
|
989 | 989 | 1 largefiles updated, 0 removed |
|
990 | 990 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
991 | 991 | $ cat large1 |
|
992 | 992 | large11 |
|
993 | 993 | $ cat sub/large2 |
|
994 | 994 | large22 |
|
995 | 995 | $ cd .. |
|
996 | 996 | |
|
997 | 997 | Test cloning with --all-largefiles flag |
|
998 | 998 | |
|
999 | 999 | $ rm "${USERCACHE}"/* |
|
1000 | 1000 | $ hg clone --all-largefiles a a-backup |
|
1001 | 1001 | updating to branch default |
|
1002 | 1002 | getting changed largefiles |
|
1003 | 1003 | 3 largefiles updated, 0 removed |
|
1004 | 1004 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1005 | 1005 | 8 additional largefiles cached |
|
1006 | 1006 | |
|
1007 | 1007 | $ rm "${USERCACHE}"/* |
|
1008 | 1008 | $ hg clone --all-largefiles -u 0 a a-clone0 |
|
1009 | 1009 | updating to branch default |
|
1010 | 1010 | getting changed largefiles |
|
1011 | 1011 | 2 largefiles updated, 0 removed |
|
1012 | 1012 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1013 | 1013 | 9 additional largefiles cached |
|
1014 | 1014 | $ hg -R a-clone0 sum |
|
1015 | 1015 | parent: 0:30d30fe6a5be |
|
1016 | 1016 | add files |
|
1017 | 1017 | branch: default |
|
1018 | 1018 | commit: (clean) |
|
1019 | 1019 | update: 7 new changesets (update) |
|
1020 | 1020 | phases: 8 draft |
|
1021 | 1021 | |
|
1022 | 1022 | $ rm "${USERCACHE}"/* |
|
1023 | 1023 | $ hg clone --all-largefiles -u 1 a a-clone1 |
|
1024 | 1024 | updating to branch default |
|
1025 | 1025 | getting changed largefiles |
|
1026 | 1026 | 2 largefiles updated, 0 removed |
|
1027 | 1027 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1028 | 1028 | 8 additional largefiles cached |
|
1029 | 1029 | $ hg -R a-clone1 verify --large --lfa --lfc |
|
1030 | 1030 | checking changesets |
|
1031 | 1031 | checking manifests |
|
1032 | 1032 | crosschecking files in changesets and manifests |
|
1033 | 1033 | checking files |
|
1034 | 1034 | 10 files, 8 changesets, 24 total revisions |
|
1035 | 1035 | searching 8 changesets for largefiles |
|
1036 | 1036 | verified contents of 13 revisions of 6 largefiles |
|
1037 | 1037 | $ hg -R a-clone1 sum |
|
1038 | 1038 | parent: 1:ce8896473775 |
|
1039 | 1039 | edit files |
|
1040 | 1040 | branch: default |
|
1041 | 1041 | commit: (clean) |
|
1042 | 1042 | update: 6 new changesets (update) |
|
1043 | 1043 | phases: 8 draft |
|
1044 | 1044 | |
|
1045 | 1045 | $ rm "${USERCACHE}"/* |
|
1046 | 1046 | $ hg clone --all-largefiles -U a a-clone-u |
|
1047 | 1047 | 11 additional largefiles cached |
|
1048 | 1048 | $ hg -R a-clone-u sum |
|
1049 | 1049 | parent: -1:000000000000 (no revision checked out) |
|
1050 | 1050 | branch: default |
|
1051 | 1051 | commit: (clean) |
|
1052 | 1052 | update: 8 new changesets (update) |
|
1053 | 1053 | phases: 8 draft |
|
1054 | 1054 | |
|
1055 | 1055 | Show computed destination directory: |
|
1056 | 1056 | |
|
1057 | 1057 | $ mkdir xyz |
|
1058 | 1058 | $ cd xyz |
|
1059 | 1059 | $ hg clone ../a |
|
1060 | 1060 | destination directory: a |
|
1061 | 1061 | updating to branch default |
|
1062 | 1062 | getting changed largefiles |
|
1063 | 1063 | 3 largefiles updated, 0 removed |
|
1064 | 1064 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1065 | 1065 | $ cd .. |
|
1066 | 1066 | |
|
1067 | 1067 | Clone URL without path: |
|
1068 | 1068 | |
|
1069 | 1069 | $ hg clone file:// |
|
1070 | 1070 | abort: repository / not found! |
|
1071 | 1071 | [255] |
|
1072 | 1072 | |
|
1073 | 1073 | Ensure base clone command argument validation |
|
1074 | 1074 | |
|
1075 | 1075 | $ hg clone -U -u 0 a a-clone-failure |
|
1076 | 1076 | abort: cannot specify both --noupdate and --updaterev |
|
1077 | 1077 | [255] |
|
1078 | 1078 | |
|
1079 | 1079 | $ hg clone --all-largefiles a ssh://localhost/a |
|
1080 | 1080 | abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a |
|
1081 | 1081 | [255] |
|
1082 | 1082 | |
|
1083 | 1083 | Test pulling with --all-largefiles flag. Also test that the largefiles are |
|
1084 | 1084 | downloaded from 'default' instead of 'default-push' when no source is specified |
|
1085 | 1085 | (issue3584) |
|
1086 | 1086 | |
|
1087 | 1087 | $ rm -Rf a-backup |
|
1088 | 1088 | $ hg clone -r 1 a a-backup |
|
1089 | 1089 | adding changesets |
|
1090 | 1090 | adding manifests |
|
1091 | 1091 | adding file changes |
|
1092 | 1092 | added 2 changesets with 8 changes to 4 files |
|
1093 | 1093 | new changesets 30d30fe6a5be:ce8896473775 |
|
1094 | 1094 | updating to branch default |
|
1095 | 1095 | getting changed largefiles |
|
1096 | 1096 | 2 largefiles updated, 0 removed |
|
1097 | 1097 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1098 | 1098 | $ rm "${USERCACHE}"/* |
|
1099 | 1099 | $ cd a-backup |
|
1100 | 1100 | $ hg pull --all-largefiles --config paths.default-push=bogus/path |
|
1101 | 1101 | pulling from $TESTTMP/a |
|
1102 | 1102 | searching for changes |
|
1103 | 1103 | adding changesets |
|
1104 | 1104 | adding manifests |
|
1105 | 1105 | adding file changes |
|
1106 | 1106 | added 6 changesets with 16 changes to 8 files |
|
1107 | 1107 | new changesets 51a0ae4d5864:daea875e9014 |
|
1108 | 1108 | (run 'hg update' to get a working copy) |
|
1109 | 1109 | 6 largefiles cached |
|
1110 | 1110 | |
|
1111 | 1111 | redo pull with --lfrev and check it pulls largefiles for the right revs |
|
1112 | 1112 | |
|
1113 | 1113 | $ hg rollback |
|
1114 | 1114 | repository tip rolled back to revision 1 (undo pull) |
|
1115 | 1115 | $ hg pull -v --lfrev 'heads(pulled())+min(pulled())' |
|
1116 | 1116 | pulling from $TESTTMP/a |
|
1117 | 1117 | searching for changes |
|
1118 | 1118 | all local heads known remotely |
|
1119 | 1119 | 6 changesets found |
|
1120 | 1120 | uncompressed size of bundle content: |
|
1121 | 1121 | 1389 (changelog) |
|
1122 | 1122 | 1599 (manifests) |
|
1123 | 1123 | 254 .hglf/large1 |
|
1124 | 1124 | 564 .hglf/large3 |
|
1125 | 1125 | 572 .hglf/sub/large4 |
|
1126 | 1126 | 182 .hglf/sub2/large6 |
|
1127 | 1127 | 182 .hglf/sub2/large7 |
|
1128 | 1128 | 212 normal1 |
|
1129 | 1129 | 457 normal3 |
|
1130 | 1130 | 465 sub/normal4 |
|
1131 | 1131 | adding changesets |
|
1132 | 1132 | adding manifests |
|
1133 | 1133 | adding file changes |
|
1134 | 1134 | added 6 changesets with 16 changes to 8 files |
|
1135 | 1135 | new changesets 51a0ae4d5864:daea875e9014 |
|
1136 | 1136 | calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles |
|
1137 | 1137 | (run 'hg update' to get a working copy) |
|
1138 | 1138 | pulling largefiles for revision 7 |
|
1139 | 1139 | found 971fb41e78fea4f8e0ba5244784239371cb00591 in store |
|
1140 | 1140 | found 0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 in store |
|
1141 | 1141 | found bb3151689acb10f0c3125c560d5e63df914bc1af in store |
|
1142 | 1142 | pulling largefiles for revision 2 |
|
1143 | 1143 | found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store |
|
1144 | 1144 | 0 largefiles cached |
|
1145 | 1145 | |
|
1146 | 1146 | lfpull |
|
1147 | 1147 | |
|
1148 | 1148 | $ hg lfpull -r : --config largefiles.usercache=usercache-lfpull |
|
1149 | 1149 | 2 largefiles cached |
|
1150 | 1150 | $ hg lfpull -v -r 4+2 --config largefiles.usercache=usercache-lfpull |
|
1151 | 1151 | pulling largefiles for revision 4 |
|
1152 | 1152 | found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store |
|
1153 | 1153 | found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store |
|
1154 | 1154 | pulling largefiles for revision 2 |
|
1155 | 1155 | found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store |
|
1156 | 1156 | 0 largefiles cached |
|
1157 | 1157 | |
|
1158 | 1158 | $ ls usercache-lfpull/* | sort |
|
1159 | 1159 | usercache-lfpull/1deebade43c8c498a3c8daddac0244dc55d1331d |
|
1160 | 1160 | usercache-lfpull/4669e532d5b2c093a78eca010077e708a071bb64 |
|
1161 | 1161 | |
|
1162 | 1162 | $ cd .. |
|
1163 | 1163 | |
|
1164 | 1164 | Rebasing between two repositories does not revert largefiles to old |
|
1165 | 1165 | revisions (this was a very bad bug that took a lot of work to fix). |
|
1166 | 1166 | |
|
1167 | 1167 | $ hg clone a d |
|
1168 | 1168 | updating to branch default |
|
1169 | 1169 | getting changed largefiles |
|
1170 | 1170 | 3 largefiles updated, 0 removed |
|
1171 | 1171 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1172 | 1172 | $ cd b |
|
1173 | 1173 | $ echo large4-modified > sub/large4 |
|
1174 | 1174 | $ echo normal3-modified > normal3 |
|
1175 | 1175 | $ hg commit -m "modify normal file and largefile in repo b" |
|
1176 | 1176 | Invoking status precommit hook |
|
1177 | 1177 | M normal3 |
|
1178 | 1178 | M sub/large4 |
|
1179 | 1179 | $ cd ../d |
|
1180 | 1180 | $ echo large6-modified > sub2/large6 |
|
1181 | 1181 | $ echo normal4-modified > sub/normal4 |
|
1182 | 1182 | $ hg commit -m "modify normal file largefile in repo d" |
|
1183 | 1183 | Invoking status precommit hook |
|
1184 | 1184 | M sub/normal4 |
|
1185 | 1185 | M sub2/large6 |
|
1186 | 1186 | $ cd .. |
|
1187 | 1187 | $ hg clone d e |
|
1188 | 1188 | updating to branch default |
|
1189 | 1189 | getting changed largefiles |
|
1190 | 1190 | 3 largefiles updated, 0 removed |
|
1191 | 1191 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1192 | 1192 | $ cd d |
|
1193 | 1193 | |
|
1194 | 1194 | More rebase testing, but also test that the largefiles are downloaded from |
|
1195 | 1195 | 'default-push' when no source is specified (issue3584). (The largefile from the |
|
1196 | 1196 | pulled revision is however not downloaded but found in the local cache.) |
|
1197 | 1197 | Largefiles are fetched for the new pulled revision, not for existing revisions, |
|
1198 | 1198 | rebased or not. |
|
1199 | 1199 | |
|
1200 | 1200 | $ [ ! -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ] |
|
1201 | 1201 | $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b |
|
1202 | 1202 | pulling from $TESTTMP/b |
|
1203 | 1203 | searching for changes |
|
1204 | 1204 | adding changesets |
|
1205 | 1205 | adding manifests |
|
1206 | 1206 | adding file changes |
|
1207 | 1207 | added 1 changesets with 2 changes to 2 files (+1 heads) |
|
1208 | 1208 | new changesets a381d2c8c80e |
|
1209 | 1209 | rebasing 8:f574fb32bb45 "modify normal file largefile in repo d" |
|
1210 | 1210 | Invoking status precommit hook |
|
1211 | 1211 | M sub/normal4 |
|
1212 | 1212 | M sub2/large6 |
|
1213 | 1213 | saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-dd1d9f80-rebase.hg |
|
1214 | 1214 | 0 largefiles cached |
|
1215 | 1215 | $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ] |
|
1216 | 1216 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
1217 | 1217 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1218 | 1218 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1219 | 1219 | 7:daea875e9014 add/edit more largefiles |
|
1220 | 1220 | 6:4355d653f84f edit files yet again |
|
1221 | 1221 | 5:9d5af5072dbd edit files again |
|
1222 | 1222 | 4:74c02385b94c move files |
|
1223 | 1223 | 3:9e8fbc4bce62 copy files |
|
1224 | 1224 | 2:51a0ae4d5864 remove files |
|
1225 | 1225 | 1:ce8896473775 edit files |
|
1226 | 1226 | 0:30d30fe6a5be add files |
|
1227 | 1227 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' |
|
1228 | 1228 | @ 9:598410d3eb9a modify normal file largefile in repo d |
|
1229 | 1229 | | |
|
1230 | 1230 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1231 | 1231 | | |
|
1232 | 1232 | o 7:daea875e9014 add/edit more largefiles |
|
1233 | 1233 | | |
|
1234 | 1234 | o 6:4355d653f84f edit files yet again |
|
1235 | 1235 | | |
|
1236 | 1236 | o 5:9d5af5072dbd edit files again |
|
1237 | 1237 | | |
|
1238 | 1238 | o 4:74c02385b94c move files |
|
1239 | 1239 | | |
|
1240 | 1240 | o 3:9e8fbc4bce62 copy files |
|
1241 | 1241 | | |
|
1242 | 1242 | o 2:51a0ae4d5864 remove files |
|
1243 | 1243 | | |
|
1244 | 1244 | o 1:ce8896473775 edit files |
|
1245 | 1245 | | |
|
1246 | 1246 | o 0:30d30fe6a5be add files |
|
1247 | 1247 | |
|
1248 | 1248 | $ cat normal3 |
|
1249 | 1249 | normal3-modified |
|
1250 | 1250 | $ cat sub/normal4 |
|
1251 | 1251 | normal4-modified |
|
1252 | 1252 | $ cat sub/large4 |
|
1253 | 1253 | large4-modified |
|
1254 | 1254 | $ cat sub2/large6 |
|
1255 | 1255 | large6-modified |
|
1256 | 1256 | $ cat sub2/large7 |
|
1257 | 1257 | large7 |
|
1258 | 1258 | $ cd ../e |
|
1259 | 1259 | $ hg pull ../b |
|
1260 | 1260 | pulling from ../b |
|
1261 | 1261 | searching for changes |
|
1262 | 1262 | adding changesets |
|
1263 | 1263 | adding manifests |
|
1264 | 1264 | adding file changes |
|
1265 | 1265 | added 1 changesets with 2 changes to 2 files (+1 heads) |
|
1266 | 1266 | new changesets a381d2c8c80e |
|
1267 | 1267 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
1268 | 1268 | $ hg rebase |
|
1269 | 1269 | rebasing 8:f574fb32bb45 "modify normal file largefile in repo d" |
|
1270 | 1270 | Invoking status precommit hook |
|
1271 | 1271 | M sub/normal4 |
|
1272 | 1272 | M sub2/large6 |
|
1273 | 1273 | saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-dd1d9f80-rebase.hg |
|
1274 | 1274 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
1275 | 1275 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1276 | 1276 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1277 | 1277 | 7:daea875e9014 add/edit more largefiles |
|
1278 | 1278 | 6:4355d653f84f edit files yet again |
|
1279 | 1279 | 5:9d5af5072dbd edit files again |
|
1280 | 1280 | 4:74c02385b94c move files |
|
1281 | 1281 | 3:9e8fbc4bce62 copy files |
|
1282 | 1282 | 2:51a0ae4d5864 remove files |
|
1283 | 1283 | 1:ce8896473775 edit files |
|
1284 | 1284 | 0:30d30fe6a5be add files |
|
1285 | 1285 | $ cat normal3 |
|
1286 | 1286 | normal3-modified |
|
1287 | 1287 | $ cat sub/normal4 |
|
1288 | 1288 | normal4-modified |
|
1289 | 1289 | $ cat sub/large4 |
|
1290 | 1290 | large4-modified |
|
1291 | 1291 | $ cat sub2/large6 |
|
1292 | 1292 | large6-modified |
|
1293 | 1293 | $ cat sub2/large7 |
|
1294 | 1294 | large7 |
|
1295 | 1295 | |
|
1296 | 1296 | Log on largefiles |
|
1297 | 1297 | |
|
1298 | 1298 | - same output |
|
1299 | 1299 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4 |
|
1300 | 1300 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1301 | 1301 | 6:4355d653f84f edit files yet again |
|
1302 | 1302 | 5:9d5af5072dbd edit files again |
|
1303 | 1303 | 4:74c02385b94c move files |
|
1304 | 1304 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4 |
|
1305 | 1305 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1306 | 1306 | : |
|
1307 | 1307 | o 6:4355d653f84f edit files yet again |
|
1308 | 1308 | | |
|
1309 | 1309 | o 5:9d5af5072dbd edit files again |
|
1310 | 1310 | | |
|
1311 | 1311 | o 4:74c02385b94c move files |
|
1312 | 1312 | | |
|
1313 | 1313 | ~ |
|
1314 | 1314 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub/large4 |
|
1315 | 1315 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1316 | 1316 | 6:4355d653f84f edit files yet again |
|
1317 | 1317 | 5:9d5af5072dbd edit files again |
|
1318 | 1318 | 4:74c02385b94c move files |
|
1319 | 1319 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4 |
|
1320 | 1320 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1321 | 1321 | : |
|
1322 | 1322 | o 6:4355d653f84f edit files yet again |
|
1323 | 1323 | | |
|
1324 | 1324 | o 5:9d5af5072dbd edit files again |
|
1325 | 1325 | | |
|
1326 | 1326 | o 4:74c02385b94c move files |
|
1327 | 1327 | | |
|
1328 | 1328 | ~ |
|
1329 | 1329 | |
|
1330 | 1330 | - .hglf only matches largefiles, without .hglf it matches 9 bco sub/normal |
|
1331 | 1331 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub |
|
1332 | 1332 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1333 | 1333 | 6:4355d653f84f edit files yet again |
|
1334 | 1334 | 5:9d5af5072dbd edit files again |
|
1335 | 1335 | 4:74c02385b94c move files |
|
1336 | 1336 | 1:ce8896473775 edit files |
|
1337 | 1337 | 0:30d30fe6a5be add files |
|
1338 | 1338 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub |
|
1339 | 1339 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1340 | 1340 | : |
|
1341 | 1341 | o 6:4355d653f84f edit files yet again |
|
1342 | 1342 | | |
|
1343 | 1343 | o 5:9d5af5072dbd edit files again |
|
1344 | 1344 | | |
|
1345 | 1345 | o 4:74c02385b94c move files |
|
1346 | 1346 | : |
|
1347 | 1347 | o 1:ce8896473775 edit files |
|
1348 | 1348 | | |
|
1349 | 1349 | o 0:30d30fe6a5be add files |
|
1350 | 1350 | |
|
1351 | 1351 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub |
|
1352 | 1352 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1353 | 1353 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1354 | 1354 | 6:4355d653f84f edit files yet again |
|
1355 | 1355 | 5:9d5af5072dbd edit files again |
|
1356 | 1356 | 4:74c02385b94c move files |
|
1357 | 1357 | 1:ce8896473775 edit files |
|
1358 | 1358 | 0:30d30fe6a5be add files |
|
1359 | 1359 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' sub |
|
1360 | 1360 | @ 9:598410d3eb9a modify normal file largefile in repo d |
|
1361 | 1361 | | |
|
1362 | 1362 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1363 | 1363 | : |
|
1364 | 1364 | o 6:4355d653f84f edit files yet again |
|
1365 | 1365 | | |
|
1366 | 1366 | o 5:9d5af5072dbd edit files again |
|
1367 | 1367 | | |
|
1368 | 1368 | o 4:74c02385b94c move files |
|
1369 | 1369 | : |
|
1370 | 1370 | o 1:ce8896473775 edit files |
|
1371 | 1371 | | |
|
1372 | 1372 | o 0:30d30fe6a5be add files |
|
1373 | 1373 | |
|
1374 | 1374 | - globbing gives same result |
|
1375 | 1375 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*' |
|
1376 | 1376 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1377 | 1377 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1378 | 1378 | 6:4355d653f84f edit files yet again |
|
1379 | 1379 | 5:9d5af5072dbd edit files again |
|
1380 | 1380 | 4:74c02385b94c move files |
|
1381 | 1381 | 1:ce8896473775 edit files |
|
1382 | 1382 | 0:30d30fe6a5be add files |
|
1383 | 1383 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*' |
|
1384 | 1384 | @ 9:598410d3eb9a modify normal file largefile in repo d |
|
1385 | 1385 | | |
|
1386 | 1386 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1387 | 1387 | : |
|
1388 | 1388 | o 6:4355d653f84f edit files yet again |
|
1389 | 1389 | | |
|
1390 | 1390 | o 5:9d5af5072dbd edit files again |
|
1391 | 1391 | | |
|
1392 | 1392 | o 4:74c02385b94c move files |
|
1393 | 1393 | : |
|
1394 | 1394 | o 1:ce8896473775 edit files |
|
1395 | 1395 | | |
|
1396 | 1396 | o 0:30d30fe6a5be add files |
|
1397 | 1397 | |
|
1398 | 1398 | Rollback on largefiles. |
|
1399 | 1399 | |
|
1400 | 1400 | $ echo large4-modified-again > sub/large4 |
|
1401 | 1401 | $ hg commit -m "Modify large4 again" |
|
1402 | 1402 | Invoking status precommit hook |
|
1403 | 1403 | M sub/large4 |
|
1404 | 1404 | $ hg rollback |
|
1405 | 1405 | repository tip rolled back to revision 9 (undo commit) |
|
1406 | 1406 | working directory now based on revision 9 |
|
1407 | 1407 | $ hg st |
|
1408 | 1408 | M sub/large4 |
|
1409 | 1409 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
1410 | 1410 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1411 | 1411 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1412 | 1412 | 7:daea875e9014 add/edit more largefiles |
|
1413 | 1413 | 6:4355d653f84f edit files yet again |
|
1414 | 1414 | 5:9d5af5072dbd edit files again |
|
1415 | 1415 | 4:74c02385b94c move files |
|
1416 | 1416 | 3:9e8fbc4bce62 copy files |
|
1417 | 1417 | 2:51a0ae4d5864 remove files |
|
1418 | 1418 | 1:ce8896473775 edit files |
|
1419 | 1419 | 0:30d30fe6a5be add files |
|
1420 | 1420 | $ cat sub/large4 |
|
1421 | 1421 | large4-modified-again |
|
1422 | 1422 | |
|
1423 | 1423 | "update --check" refuses to update with uncommitted changes. |
|
1424 | 1424 | $ hg update --check 8 |
|
1425 | 1425 | abort: uncommitted changes |
|
1426 | 1426 | [255] |
|
1427 | 1427 | |
|
1428 | 1428 | "update --clean" leaves correct largefiles in working copy, even when there is |
|
1429 | 1429 | .orig files from revert in .hglf. |
|
1430 | 1430 | |
|
1431 | 1431 | $ echo mistake > sub2/large7 |
|
1432 | 1432 | $ hg revert sub2/large7 |
|
1433 | 1433 | $ cat sub2/large7 |
|
1434 | 1434 | large7 |
|
1435 | 1435 | $ cat sub2/large7.orig |
|
1436 | 1436 | mistake |
|
1437 | 1437 | $ test ! -f .hglf/sub2/large7.orig |
|
1438 | 1438 | |
|
1439 | 1439 | $ hg -q update --clean -r null |
|
1440 | 1440 | $ hg update --clean |
|
1441 | 1441 | getting changed largefiles |
|
1442 | 1442 | 3 largefiles updated, 0 removed |
|
1443 | 1443 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1444 | 1444 | $ cat normal3 |
|
1445 | 1445 | normal3-modified |
|
1446 | 1446 | $ cat sub/normal4 |
|
1447 | 1447 | normal4-modified |
|
1448 | 1448 | $ cat sub/large4 |
|
1449 | 1449 | large4-modified |
|
1450 | 1450 | $ cat sub2/large6 |
|
1451 | 1451 | large6-modified |
|
1452 | 1452 | $ cat sub2/large7 |
|
1453 | 1453 | large7 |
|
1454 | 1454 | $ cat sub2/large7.orig |
|
1455 | 1455 | mistake |
|
1456 | 1456 | $ test ! -f .hglf/sub2/large7.orig |
|
1457 | 1457 | |
|
1458 | 1458 | verify that largefile .orig file no longer is overwritten on every update -C: |
|
1459 | 1459 | $ hg update --clean |
|
1460 | 1460 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1461 | 1461 | $ cat sub2/large7.orig |
|
1462 | 1462 | mistake |
|
1463 | 1463 | $ rm sub2/large7.orig |
|
1464 | 1464 | |
|
1465 | 1465 | Now "update check" is happy. |
|
1466 | 1466 | $ hg update --check 8 |
|
1467 | 1467 | getting changed largefiles |
|
1468 | 1468 | 1 largefiles updated, 0 removed |
|
1469 | 1469 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1470 | 1470 | $ hg update --check |
|
1471 | 1471 | getting changed largefiles |
|
1472 | 1472 | 1 largefiles updated, 0 removed |
|
1473 | 1473 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1474 | 1474 | |
|
1475 | 1475 | Test removing empty largefiles directories on update |
|
1476 | 1476 | $ test -d sub2 && echo "sub2 exists" |
|
1477 | 1477 | sub2 exists |
|
1478 | 1478 | $ hg update -q null |
|
1479 | 1479 | $ test -d sub2 && echo "error: sub2 should not exist anymore" |
|
1480 | 1480 | [1] |
|
1481 | 1481 | $ hg update -q |
|
1482 | 1482 | |
|
1483 | 1483 | Test hg remove removes empty largefiles directories |
|
1484 | 1484 | $ test -d sub2 && echo "sub2 exists" |
|
1485 | 1485 | sub2 exists |
|
1486 | 1486 | $ hg remove sub2/* |
|
1487 | 1487 | $ test -d sub2 && echo "error: sub2 should not exist anymore" |
|
1488 | 1488 | [1] |
|
1489 | 1489 | $ hg revert sub2/large6 sub2/large7 |
|
1490 | 1490 | |
|
1491 | 1491 | "revert" works on largefiles (and normal files too). |
|
1492 | 1492 | $ echo hack3 >> normal3 |
|
1493 | 1493 | $ echo hack4 >> sub/normal4 |
|
1494 | 1494 | $ echo hack4 >> sub/large4 |
|
1495 | 1495 | $ rm sub2/large6 |
|
1496 | 1496 | $ hg revert sub2/large6 |
|
1497 | 1497 | $ hg rm sub2/large6 |
|
1498 | 1498 | $ echo new >> sub2/large8 |
|
1499 | 1499 | $ hg add --large sub2/large8 |
|
1500 | 1500 | # XXX we don't really want to report that we're reverting the standin; |
|
1501 | 1501 | # that's just an implementation detail. But I don't see an obvious fix. ;-( |
|
1502 | 1502 | $ hg revert sub |
|
1503 | 1503 | reverting .hglf/sub/large4 |
|
1504 | 1504 | reverting sub/normal4 |
|
1505 | 1505 | $ hg status |
|
1506 | 1506 | M normal3 |
|
1507 | 1507 | A sub2/large8 |
|
1508 | 1508 | R sub2/large6 |
|
1509 | 1509 | ? sub/large4.orig |
|
1510 | 1510 | ? sub/normal4.orig |
|
1511 | 1511 | $ cat sub/normal4 |
|
1512 | 1512 | normal4-modified |
|
1513 | 1513 | $ cat sub/large4 |
|
1514 | 1514 | large4-modified |
|
1515 | 1515 | $ hg revert -a --no-backup |
|
1516 | 1516 | undeleting .hglf/sub2/large6 |
|
1517 | 1517 | forgetting .hglf/sub2/large8 |
|
1518 | 1518 | reverting normal3 |
|
1519 | 1519 | $ hg status |
|
1520 | 1520 | ? sub/large4.orig |
|
1521 | 1521 | ? sub/normal4.orig |
|
1522 | 1522 | ? sub2/large8 |
|
1523 | 1523 | $ cat normal3 |
|
1524 | 1524 | normal3-modified |
|
1525 | 1525 | $ cat sub2/large6 |
|
1526 | 1526 | large6-modified |
|
1527 | 1527 | $ rm sub/*.orig sub2/large8 |
|
1528 | 1528 | |
|
1529 | 1529 | revert some files to an older revision |
|
1530 | 1530 | $ hg revert --no-backup -r 8 sub2 |
|
1531 | 1531 | reverting .hglf/sub2/large6 |
|
1532 | 1532 | $ cat sub2/large6 |
|
1533 | 1533 | large6 |
|
1534 | 1534 | $ hg revert --no-backup -C -r '.^' sub2 |
|
1535 | 1535 | $ hg revert --no-backup sub2 |
|
1536 | 1536 | reverting .hglf/sub2/large6 |
|
1537 | 1537 | $ hg status |
|
1538 | 1538 | |
|
1539 | 1539 | "verify --large" actually verifies largefiles |
|
1540 | 1540 | |
|
1541 | 1541 | - Where Do We Come From? What Are We? Where Are We Going? |
|
1542 | 1542 | $ pwd |
|
1543 | 1543 | $TESTTMP/e |
|
1544 | 1544 | $ hg paths |
|
1545 | 1545 | default = $TESTTMP/d |
|
1546 | 1546 | |
|
1547 | 1547 | $ hg verify --large |
|
1548 | 1548 | checking changesets |
|
1549 | 1549 | checking manifests |
|
1550 | 1550 | crosschecking files in changesets and manifests |
|
1551 | 1551 | checking files |
|
1552 | 1552 | 10 files, 10 changesets, 28 total revisions |
|
1553 | 1553 | searching 1 changesets for largefiles |
|
1554 | 1554 | verified existence of 3 revisions of 3 largefiles |
|
1555 | 1555 | |
|
1556 | 1556 | - introduce missing blob in local store repo and remote store |
|
1557 | 1557 | and make sure that this is caught: |
|
1558 | 1558 | |
|
1559 | 1559 | $ mv $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 . |
|
1560 | 1560 | $ rm .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 |
|
1561 | 1561 | $ hg verify --large |
|
1562 | 1562 | checking changesets |
|
1563 | 1563 | checking manifests |
|
1564 | 1564 | crosschecking files in changesets and manifests |
|
1565 | 1565 | checking files |
|
1566 | 1566 | 10 files, 10 changesets, 28 total revisions |
|
1567 | 1567 | searching 1 changesets for largefiles |
|
1568 | 1568 | changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 |
|
1569 | 1569 | verified existence of 3 revisions of 3 largefiles |
|
1570 | 1570 | [1] |
|
1571 | 1571 | |
|
1572 | 1572 | - introduce corruption and make sure that it is caught when checking content: |
|
1573 | 1573 | $ echo '5 cents' > $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 |
|
1574 | 1574 | $ hg verify -q --large --lfc |
|
1575 | 1575 | changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 |
|
1576 | 1576 | [1] |
|
1577 | 1577 | |
|
1578 | 1578 | - cleanup |
|
1579 | 1579 | $ cp e166e74c7303192238d60af5a9c4ce9bef0b7928 $TESTTMP/d/.hg/largefiles/ |
|
1580 | 1580 | $ mv e166e74c7303192238d60af5a9c4ce9bef0b7928 .hg/largefiles/ |
|
1581 | 1581 | |
|
1582 | 1582 | - verifying all revisions will fail because we didn't clone all largefiles to d: |
|
1583 | 1583 | $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
1584 | 1584 | $ hg verify -q --lfa --lfc |
|
1585 | 1585 | changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64 |
|
1586 | 1586 | changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d |
|
1587 | 1587 | changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f |
|
1588 | 1588 | changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
1589 | 1589 | changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
1590 | 1590 | changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
1591 | 1591 | changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
1592 | 1592 | changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c |
|
1593 | 1593 | changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9 |
|
1594 | 1594 | changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0 |
|
1595 | 1595 | [1] |
|
1596 | 1596 | |
|
1597 | 1597 | - cleanup |
|
1598 | 1598 | $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
1599 | 1599 | $ rm -f .hglf/sub/*.orig |
|
1600 | 1600 | |
|
1601 | 1601 | Update to revision with missing largefile - and make sure it really is missing |
|
1602 | 1602 | |
|
1603 | 1603 | $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0 |
|
1604 | 1604 | $ hg up -r 6 |
|
1605 | 1605 | getting changed largefiles |
|
1606 | 1606 | large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob) |
|
1607 | 1607 | 1 largefiles updated, 2 removed |
|
1608 | 1608 | 4 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1609 | 1609 | $ rm normal3 |
|
1610 | 1610 | $ echo >> sub/normal4 |
|
1611 | 1611 | $ hg ci -m 'commit with missing files' |
|
1612 | 1612 | Invoking status precommit hook |
|
1613 | 1613 | M sub/normal4 |
|
1614 | 1614 | ! large3 |
|
1615 | 1615 | ! normal3 |
|
1616 | 1616 | created new head |
|
1617 | 1617 | $ hg st |
|
1618 | 1618 | ! large3 |
|
1619 | 1619 | ! normal3 |
|
1620 | 1620 | $ hg up -r. |
|
1621 | 1621 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1622 | 1622 | $ hg st |
|
1623 | 1623 | ! large3 |
|
1624 | 1624 | ! normal3 |
|
1625 | 1625 | $ hg up -Cr. |
|
1626 | 1626 | getting changed largefiles |
|
1627 | 1627 | large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob) |
|
1628 | 1628 | 0 largefiles updated, 0 removed |
|
1629 | 1629 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1630 | 1630 | $ hg st |
|
1631 | 1631 | ! large3 |
|
1632 | 1632 | $ hg rollback |
|
1633 | 1633 | repository tip rolled back to revision 9 (undo commit) |
|
1634 | 1634 | working directory now based on revision 6 |
|
1635 | 1635 | |
|
1636 | 1636 | Merge with revision with missing largefile - and make sure it tries to fetch it. |
|
1637 | 1637 | |
|
1638 | 1638 | $ hg up -Cqr null |
|
1639 | 1639 | $ echo f > f |
|
1640 | 1640 | $ hg ci -Am branch |
|
1641 | 1641 | adding f |
|
1642 | 1642 | Invoking status precommit hook |
|
1643 | 1643 | A f |
|
1644 | 1644 | created new head |
|
1645 | 1645 | $ hg merge -r 6 |
|
1646 | 1646 | getting changed largefiles |
|
1647 | 1647 | large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob) |
|
1648 | 1648 | 1 largefiles updated, 0 removed |
|
1649 | 1649 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1650 | 1650 | (branch merge, don't forget to commit) |
|
1651 | 1651 | |
|
1652 | 1652 | $ hg rollback -q |
|
1653 | 1653 | $ hg up -Cq |
|
1654 | 1654 | |
|
1655 | 1655 | Pulling 0 revisions with --all-largefiles should not fetch for all revisions |
|
1656 | 1656 | |
|
1657 | 1657 | $ hg pull --all-largefiles |
|
1658 | 1658 | pulling from $TESTTMP/d |
|
1659 | 1659 | searching for changes |
|
1660 | 1660 | no changes found |
|
1661 | 1661 | |
|
1662 | 1662 | Merging does not revert to old versions of largefiles and also check |
|
1663 | 1663 | that merging after having pulled from a non-default remote works |
|
1664 | 1664 | correctly. |
|
1665 | 1665 | |
|
1666 | 1666 | $ cd .. |
|
1667 | 1667 | $ hg clone -r 7 e temp |
|
1668 | 1668 | adding changesets |
|
1669 | 1669 | adding manifests |
|
1670 | 1670 | adding file changes |
|
1671 | 1671 | added 8 changesets with 24 changes to 10 files |
|
1672 | 1672 | new changesets 30d30fe6a5be:daea875e9014 |
|
1673 | 1673 | updating to branch default |
|
1674 | 1674 | getting changed largefiles |
|
1675 | 1675 | 3 largefiles updated, 0 removed |
|
1676 | 1676 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1677 | 1677 | $ hg clone temp f |
|
1678 | 1678 | updating to branch default |
|
1679 | 1679 | getting changed largefiles |
|
1680 | 1680 | 3 largefiles updated, 0 removed |
|
1681 | 1681 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1682 | 1682 | # Delete the largefiles in the largefiles system cache so that we have an |
|
1683 | 1683 | # opportunity to test that caching after a pull works. |
|
1684 | 1684 | $ rm "${USERCACHE}"/* |
|
1685 | 1685 | $ cd f |
|
1686 | 1686 | $ echo "large4-merge-test" > sub/large4 |
|
1687 | 1687 | $ hg commit -m "Modify large4 to test merge" |
|
1688 | 1688 | Invoking status precommit hook |
|
1689 | 1689 | M sub/large4 |
|
1690 | 1690 | # Test --cache-largefiles flag |
|
1691 | 1691 | $ hg pull --lfrev 'heads(pulled())' ../e |
|
1692 | 1692 | pulling from ../e |
|
1693 | 1693 | searching for changes |
|
1694 | 1694 | adding changesets |
|
1695 | 1695 | adding manifests |
|
1696 | 1696 | adding file changes |
|
1697 | 1697 | added 2 changesets with 4 changes to 4 files (+1 heads) |
|
1698 | 1698 | new changesets a381d2c8c80e:598410d3eb9a |
|
1699 | 1699 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
1700 | 1700 | 2 largefiles cached |
|
1701 | 1701 | $ hg merge |
|
1702 | 1702 | largefile sub/large4 has a merge conflict |
|
1703 | 1703 | ancestor was 971fb41e78fea4f8e0ba5244784239371cb00591 |
|
1704 | 1704 | keep (l)ocal d846f26643bfa8ec210be40cc93cc6b7ff1128ea or |
|
1705 | 1705 | take (o)ther e166e74c7303192238d60af5a9c4ce9bef0b7928? l |
|
1706 | 1706 | getting changed largefiles |
|
1707 | 1707 | 1 largefiles updated, 0 removed |
|
1708 | 1708 | 3 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1709 | 1709 | (branch merge, don't forget to commit) |
|
1710 | 1710 | $ hg commit -m "Merge repos e and f" |
|
1711 | 1711 | Invoking status precommit hook |
|
1712 | 1712 | M normal3 |
|
1713 | 1713 | M sub/normal4 |
|
1714 | 1714 | M sub2/large6 |
|
1715 | 1715 | $ cat normal3 |
|
1716 | 1716 | normal3-modified |
|
1717 | 1717 | $ cat sub/normal4 |
|
1718 | 1718 | normal4-modified |
|
1719 | 1719 | $ cat sub/large4 |
|
1720 | 1720 | large4-merge-test |
|
1721 | 1721 | $ cat sub2/large6 |
|
1722 | 1722 | large6-modified |
|
1723 | 1723 | $ cat sub2/large7 |
|
1724 | 1724 | large7 |
|
1725 | 1725 | |
|
1726 | 1726 | Test status after merging with a branch that introduces a new largefile: |
|
1727 | 1727 | |
|
1728 | 1728 | $ echo large > large |
|
1729 | 1729 | $ hg add --large large |
|
1730 | 1730 | $ hg commit -m 'add largefile' |
|
1731 | 1731 | Invoking status precommit hook |
|
1732 | 1732 | A large |
|
1733 | 1733 | $ hg update -q ".^" |
|
1734 | 1734 | $ echo change >> normal3 |
|
1735 | 1735 | $ hg commit -m 'some change' |
|
1736 | 1736 | Invoking status precommit hook |
|
1737 | 1737 | M normal3 |
|
1738 | 1738 | created new head |
|
1739 | 1739 | $ hg merge |
|
1740 | 1740 | getting changed largefiles |
|
1741 | 1741 | 1 largefiles updated, 0 removed |
|
1742 | 1742 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1743 | 1743 | (branch merge, don't forget to commit) |
|
1744 | 1744 | $ hg status |
|
1745 | 1745 | M large |
|
1746 | 1746 | |
|
1747 | 1747 | - make sure update of merge with removed largefiles fails as expected |
|
1748 | 1748 | $ hg rm sub2/large6 |
|
1749 | 1749 | $ hg up -r. |
|
1750 | 1750 | abort: outstanding uncommitted merge |
|
1751 | 1751 | [255] |
|
1752 | 1752 | |
|
1753 | 1753 | - revert should be able to revert files introduced in a pending merge |
|
1754 | 1754 | $ hg revert --all -r . |
|
1755 | 1755 | removing .hglf/large |
|
1756 | 1756 | undeleting .hglf/sub2/large6 |
|
1757 | 1757 | |
|
1758 | 1758 | Test that a normal file and a largefile with the same name and path cannot |
|
1759 | 1759 | coexist. |
|
1760 | 1760 | |
|
1761 | 1761 | $ rm sub2/large7 |
|
1762 | 1762 | $ echo "largeasnormal" > sub2/large7 |
|
1763 | 1763 | $ hg add sub2/large7 |
|
1764 | 1764 | sub2/large7 already a largefile |
|
1765 | 1765 | |
|
1766 | 1766 | Test that transplanting a largefile change works correctly. |
|
1767 | 1767 | |
|
1768 | 1768 | $ cd .. |
|
1769 | 1769 | $ hg clone -r 8 d g |
|
1770 | 1770 | adding changesets |
|
1771 | 1771 | adding manifests |
|
1772 | 1772 | adding file changes |
|
1773 | 1773 | added 9 changesets with 26 changes to 10 files |
|
1774 | 1774 | new changesets 30d30fe6a5be:a381d2c8c80e |
|
1775 | 1775 | updating to branch default |
|
1776 | 1776 | getting changed largefiles |
|
1777 | 1777 | 3 largefiles updated, 0 removed |
|
1778 | 1778 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1779 | 1779 | $ cd g |
|
1780 | 1780 | $ hg transplant -s ../d 598410d3eb9a |
|
1781 | 1781 | searching for changes |
|
1782 | 1782 | searching for changes |
|
1783 | 1783 | adding changesets |
|
1784 | 1784 | adding manifests |
|
1785 | 1785 | adding file changes |
|
1786 | 1786 | added 1 changesets with 2 changes to 2 files |
|
1787 | 1787 | new changesets 598410d3eb9a |
|
1788 | 1788 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
1789 | 1789 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1790 | 1790 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1791 | 1791 | 7:daea875e9014 add/edit more largefiles |
|
1792 | 1792 | 6:4355d653f84f edit files yet again |
|
1793 | 1793 | 5:9d5af5072dbd edit files again |
|
1794 | 1794 | 4:74c02385b94c move files |
|
1795 | 1795 | 3:9e8fbc4bce62 copy files |
|
1796 | 1796 | 2:51a0ae4d5864 remove files |
|
1797 | 1797 | 1:ce8896473775 edit files |
|
1798 | 1798 | 0:30d30fe6a5be add files |
|
1799 | 1799 | $ cat normal3 |
|
1800 | 1800 | normal3-modified |
|
1801 | 1801 | $ cat sub/normal4 |
|
1802 | 1802 | normal4-modified |
|
1803 | 1803 | $ cat sub/large4 |
|
1804 | 1804 | large4-modified |
|
1805 | 1805 | $ cat sub2/large6 |
|
1806 | 1806 | large6-modified |
|
1807 | 1807 | $ cat sub2/large7 |
|
1808 | 1808 | large7 |
|
1809 | 1809 | |
|
1810 | 1810 | Cat a largefile |
|
1811 | 1811 | $ hg cat normal3 |
|
1812 | 1812 | normal3-modified |
|
1813 | 1813 | $ hg cat sub/large4 |
|
1814 | 1814 | large4-modified |
|
1815 | 1815 | $ rm "${USERCACHE}"/* |
|
1816 | 1816 | $ hg cat -r a381d2c8c80e -o cat.out sub/large4 |
|
1817 | 1817 | $ cat cat.out |
|
1818 | 1818 | large4-modified |
|
1819 | 1819 | $ rm cat.out |
|
1820 | 1820 | $ hg cat -r a381d2c8c80e normal3 |
|
1821 | 1821 | normal3-modified |
|
1822 | 1822 | $ hg cat -r '.^' normal3 |
|
1823 | 1823 | normal3-modified |
|
1824 | 1824 | $ hg cat -r '.^' sub/large4 doesntexist |
|
1825 | 1825 | large4-modified |
|
1826 | 1826 | doesntexist: no such file in rev a381d2c8c80e |
|
1827 | 1827 | $ hg --cwd sub cat -r '.^' large4 |
|
1828 | 1828 | large4-modified |
|
1829 | 1829 | $ hg --cwd sub cat -r '.^' ../normal3 |
|
1830 | 1830 | normal3-modified |
|
1831 | 1831 | Cat a standin |
|
1832 | 1832 | $ hg cat .hglf/sub/large4 |
|
1833 | 1833 | e166e74c7303192238d60af5a9c4ce9bef0b7928 |
|
1834 | 1834 | $ hg cat .hglf/normal3 |
|
1835 | 1835 | .hglf/normal3: no such file in rev 598410d3eb9a |
|
1836 | 1836 | [1] |
|
1837 | 1837 | |
|
1838 | 1838 | Test that renaming a largefile results in correct output for status |
|
1839 | 1839 | |
|
1840 | 1840 | $ hg rename sub/large4 large4-renamed |
|
1841 | 1841 | $ hg commit -m "test rename output" |
|
1842 | 1842 | Invoking status precommit hook |
|
1843 | 1843 | A large4-renamed |
|
1844 | 1844 | R sub/large4 |
|
1845 | 1845 | $ cat large4-renamed |
|
1846 | 1846 | large4-modified |
|
1847 | 1847 | $ cd sub2 |
|
1848 | 1848 | $ hg rename large6 large6-renamed |
|
1849 | 1849 | $ hg st |
|
1850 | 1850 | A sub2/large6-renamed |
|
1851 | 1851 | R sub2/large6 |
|
1852 | 1852 | $ cd .. |
|
1853 | 1853 | |
|
1854 | 1854 | Test --normal flag |
|
1855 | 1855 | |
|
1856 | 1856 | $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null |
|
1857 | 1857 | $ hg add --normal --large new-largefile |
|
1858 | 1858 | abort: --normal cannot be used with --large |
|
1859 | 1859 | [255] |
|
1860 | 1860 | $ hg add --normal new-largefile |
|
1861 | 1861 | new-largefile: up to 69 MB of RAM may be required to manage this file |
|
1862 | 1862 | (use 'hg revert new-largefile' to cancel the pending addition) |
|
1863 | $ hg revert new-largefile | |
|
1864 | $ hg --config ui.large-file-limit=22M add --normal new-largefile | |
|
1863 | 1865 | |
|
1864 | 1866 | Test explicit commit of switch between normal and largefile - make sure both |
|
1865 | 1867 | the add and the remove is committed. |
|
1866 | 1868 | |
|
1867 | 1869 | $ hg up -qC |
|
1868 | 1870 | $ hg forget normal3 large4-renamed |
|
1869 | 1871 | $ hg add --large normal3 |
|
1870 | 1872 | $ hg add large4-renamed |
|
1871 | 1873 | $ hg commit -m 'swap' normal3 large4-renamed |
|
1872 | 1874 | Invoking status precommit hook |
|
1873 | 1875 | A large4-renamed |
|
1874 | 1876 | A normal3 |
|
1875 | 1877 | ? new-largefile |
|
1876 | 1878 | ? sub2/large6-renamed |
|
1877 | 1879 | $ hg mani |
|
1878 | 1880 | .hglf/normal3 |
|
1879 | 1881 | .hglf/sub2/large6 |
|
1880 | 1882 | .hglf/sub2/large7 |
|
1881 | 1883 | large4-renamed |
|
1882 | 1884 | sub/normal4 |
|
1883 | 1885 | |
|
1884 | 1886 | $ cd .. |
|
1885 | 1887 | |
|
1886 | 1888 | |
|
1887 | 1889 |
General Comments 0
You need to be logged in to leave comments.
Login now