##// END OF EJS Templates
ui: make the large file warning limit fully configurable...
Joerg Sonnenberger -
r38619:a936d136 default
parent child Browse files
Show More
@@ -1,1364 +1,1367 b''
1 # configitems.py - centralized declaration of configuration option
1 # configitems.py - centralized declaration of configuration option
2 #
2 #
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import functools
10 import functools
11 import re
11 import re
12
12
13 from . import (
13 from . import (
14 encoding,
14 encoding,
15 error,
15 error,
16 )
16 )
17
17
18 def loadconfigtable(ui, extname, configtable):
18 def loadconfigtable(ui, extname, configtable):
19 """update config item known to the ui with the extension ones"""
19 """update config item known to the ui with the extension ones"""
20 for section, items in sorted(configtable.items()):
20 for section, items in sorted(configtable.items()):
21 knownitems = ui._knownconfig.setdefault(section, itemregister())
21 knownitems = ui._knownconfig.setdefault(section, itemregister())
22 knownkeys = set(knownitems)
22 knownkeys = set(knownitems)
23 newkeys = set(items)
23 newkeys = set(items)
24 for key in sorted(knownkeys & newkeys):
24 for key in sorted(knownkeys & newkeys):
25 msg = "extension '%s' overwrite config item '%s.%s'"
25 msg = "extension '%s' overwrite config item '%s.%s'"
26 msg %= (extname, section, key)
26 msg %= (extname, section, key)
27 ui.develwarn(msg, config='warn-config')
27 ui.develwarn(msg, config='warn-config')
28
28
29 knownitems.update(items)
29 knownitems.update(items)
30
30
31 class configitem(object):
31 class configitem(object):
32 """represent a known config item
32 """represent a known config item
33
33
34 :section: the official config section where to find this item,
34 :section: the official config section where to find this item,
35 :name: the official name within the section,
35 :name: the official name within the section,
36 :default: default value for this item,
36 :default: default value for this item,
37 :alias: optional list of tuples as alternatives,
37 :alias: optional list of tuples as alternatives,
38 :generic: this is a generic definition, match name using regular expression.
38 :generic: this is a generic definition, match name using regular expression.
39 """
39 """
40
40
41 def __init__(self, section, name, default=None, alias=(),
41 def __init__(self, section, name, default=None, alias=(),
42 generic=False, priority=0):
42 generic=False, priority=0):
43 self.section = section
43 self.section = section
44 self.name = name
44 self.name = name
45 self.default = default
45 self.default = default
46 self.alias = list(alias)
46 self.alias = list(alias)
47 self.generic = generic
47 self.generic = generic
48 self.priority = priority
48 self.priority = priority
49 self._re = None
49 self._re = None
50 if generic:
50 if generic:
51 self._re = re.compile(self.name)
51 self._re = re.compile(self.name)
52
52
53 class itemregister(dict):
53 class itemregister(dict):
54 """A specialized dictionary that can handle wild-card selection"""
54 """A specialized dictionary that can handle wild-card selection"""
55
55
56 def __init__(self):
56 def __init__(self):
57 super(itemregister, self).__init__()
57 super(itemregister, self).__init__()
58 self._generics = set()
58 self._generics = set()
59
59
60 def update(self, other):
60 def update(self, other):
61 super(itemregister, self).update(other)
61 super(itemregister, self).update(other)
62 self._generics.update(other._generics)
62 self._generics.update(other._generics)
63
63
64 def __setitem__(self, key, item):
64 def __setitem__(self, key, item):
65 super(itemregister, self).__setitem__(key, item)
65 super(itemregister, self).__setitem__(key, item)
66 if item.generic:
66 if item.generic:
67 self._generics.add(item)
67 self._generics.add(item)
68
68
69 def get(self, key):
69 def get(self, key):
70 baseitem = super(itemregister, self).get(key)
70 baseitem = super(itemregister, self).get(key)
71 if baseitem is not None and not baseitem.generic:
71 if baseitem is not None and not baseitem.generic:
72 return baseitem
72 return baseitem
73
73
74 # search for a matching generic item
74 # search for a matching generic item
75 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
75 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
76 for item in generics:
76 for item in generics:
77 # we use 'match' instead of 'search' to make the matching simpler
77 # we use 'match' instead of 'search' to make the matching simpler
78 # for people unfamiliar with regular expression. Having the match
78 # for people unfamiliar with regular expression. Having the match
79 # rooted to the start of the string will produce less surprising
79 # rooted to the start of the string will produce less surprising
80 # result for user writing simple regex for sub-attribute.
80 # result for user writing simple regex for sub-attribute.
81 #
81 #
82 # For example using "color\..*" match produces an unsurprising
82 # For example using "color\..*" match produces an unsurprising
83 # result, while using search could suddenly match apparently
83 # result, while using search could suddenly match apparently
84 # unrelated configuration that happens to contains "color."
84 # unrelated configuration that happens to contains "color."
85 # anywhere. This is a tradeoff where we favor requiring ".*" on
85 # anywhere. This is a tradeoff where we favor requiring ".*" on
86 # some match to avoid the need to prefix most pattern with "^".
86 # some match to avoid the need to prefix most pattern with "^".
87 # The "^" seems more error prone.
87 # The "^" seems more error prone.
88 if item._re.match(key):
88 if item._re.match(key):
89 return item
89 return item
90
90
91 return None
91 return None
92
92
93 coreitems = {}
93 coreitems = {}
94
94
95 def _register(configtable, *args, **kwargs):
95 def _register(configtable, *args, **kwargs):
96 item = configitem(*args, **kwargs)
96 item = configitem(*args, **kwargs)
97 section = configtable.setdefault(item.section, itemregister())
97 section = configtable.setdefault(item.section, itemregister())
98 if item.name in section:
98 if item.name in section:
99 msg = "duplicated config item registration for '%s.%s'"
99 msg = "duplicated config item registration for '%s.%s'"
100 raise error.ProgrammingError(msg % (item.section, item.name))
100 raise error.ProgrammingError(msg % (item.section, item.name))
101 section[item.name] = item
101 section[item.name] = item
102
102
103 # special value for case where the default is derived from other values
103 # special value for case where the default is derived from other values
104 dynamicdefault = object()
104 dynamicdefault = object()
105
105
106 # Registering actual config items
106 # Registering actual config items
107
107
108 def getitemregister(configtable):
108 def getitemregister(configtable):
109 f = functools.partial(_register, configtable)
109 f = functools.partial(_register, configtable)
110 # export pseudo enum as configitem.*
110 # export pseudo enum as configitem.*
111 f.dynamicdefault = dynamicdefault
111 f.dynamicdefault = dynamicdefault
112 return f
112 return f
113
113
114 coreconfigitem = getitemregister(coreitems)
114 coreconfigitem = getitemregister(coreitems)
115
115
116 coreconfigitem('alias', '.*',
116 coreconfigitem('alias', '.*',
117 default=dynamicdefault,
117 default=dynamicdefault,
118 generic=True,
118 generic=True,
119 )
119 )
120 coreconfigitem('annotate', 'nodates',
120 coreconfigitem('annotate', 'nodates',
121 default=False,
121 default=False,
122 )
122 )
123 coreconfigitem('annotate', 'showfunc',
123 coreconfigitem('annotate', 'showfunc',
124 default=False,
124 default=False,
125 )
125 )
126 coreconfigitem('annotate', 'unified',
126 coreconfigitem('annotate', 'unified',
127 default=None,
127 default=None,
128 )
128 )
129 coreconfigitem('annotate', 'git',
129 coreconfigitem('annotate', 'git',
130 default=False,
130 default=False,
131 )
131 )
132 coreconfigitem('annotate', 'ignorews',
132 coreconfigitem('annotate', 'ignorews',
133 default=False,
133 default=False,
134 )
134 )
135 coreconfigitem('annotate', 'ignorewsamount',
135 coreconfigitem('annotate', 'ignorewsamount',
136 default=False,
136 default=False,
137 )
137 )
138 coreconfigitem('annotate', 'ignoreblanklines',
138 coreconfigitem('annotate', 'ignoreblanklines',
139 default=False,
139 default=False,
140 )
140 )
141 coreconfigitem('annotate', 'ignorewseol',
141 coreconfigitem('annotate', 'ignorewseol',
142 default=False,
142 default=False,
143 )
143 )
144 coreconfigitem('annotate', 'nobinary',
144 coreconfigitem('annotate', 'nobinary',
145 default=False,
145 default=False,
146 )
146 )
147 coreconfigitem('annotate', 'noprefix',
147 coreconfigitem('annotate', 'noprefix',
148 default=False,
148 default=False,
149 )
149 )
150 coreconfigitem('annotate', 'word-diff',
150 coreconfigitem('annotate', 'word-diff',
151 default=False,
151 default=False,
152 )
152 )
153 coreconfigitem('auth', 'cookiefile',
153 coreconfigitem('auth', 'cookiefile',
154 default=None,
154 default=None,
155 )
155 )
156 # bookmarks.pushing: internal hack for discovery
156 # bookmarks.pushing: internal hack for discovery
157 coreconfigitem('bookmarks', 'pushing',
157 coreconfigitem('bookmarks', 'pushing',
158 default=list,
158 default=list,
159 )
159 )
160 # bundle.mainreporoot: internal hack for bundlerepo
160 # bundle.mainreporoot: internal hack for bundlerepo
161 coreconfigitem('bundle', 'mainreporoot',
161 coreconfigitem('bundle', 'mainreporoot',
162 default='',
162 default='',
163 )
163 )
164 # bundle.reorder: experimental config
164 # bundle.reorder: experimental config
165 coreconfigitem('bundle', 'reorder',
165 coreconfigitem('bundle', 'reorder',
166 default='auto',
166 default='auto',
167 )
167 )
168 coreconfigitem('censor', 'policy',
168 coreconfigitem('censor', 'policy',
169 default='abort',
169 default='abort',
170 )
170 )
171 coreconfigitem('chgserver', 'idletimeout',
171 coreconfigitem('chgserver', 'idletimeout',
172 default=3600,
172 default=3600,
173 )
173 )
174 coreconfigitem('chgserver', 'skiphash',
174 coreconfigitem('chgserver', 'skiphash',
175 default=False,
175 default=False,
176 )
176 )
177 coreconfigitem('cmdserver', 'log',
177 coreconfigitem('cmdserver', 'log',
178 default=None,
178 default=None,
179 )
179 )
180 coreconfigitem('color', '.*',
180 coreconfigitem('color', '.*',
181 default=None,
181 default=None,
182 generic=True,
182 generic=True,
183 )
183 )
184 coreconfigitem('color', 'mode',
184 coreconfigitem('color', 'mode',
185 default='auto',
185 default='auto',
186 )
186 )
187 coreconfigitem('color', 'pagermode',
187 coreconfigitem('color', 'pagermode',
188 default=dynamicdefault,
188 default=dynamicdefault,
189 )
189 )
190 coreconfigitem('commands', 'show.aliasprefix',
190 coreconfigitem('commands', 'show.aliasprefix',
191 default=list,
191 default=list,
192 )
192 )
193 coreconfigitem('commands', 'status.relative',
193 coreconfigitem('commands', 'status.relative',
194 default=False,
194 default=False,
195 )
195 )
196 coreconfigitem('commands', 'status.skipstates',
196 coreconfigitem('commands', 'status.skipstates',
197 default=[],
197 default=[],
198 )
198 )
199 coreconfigitem('commands', 'status.terse',
199 coreconfigitem('commands', 'status.terse',
200 default='',
200 default='',
201 )
201 )
202 coreconfigitem('commands', 'status.verbose',
202 coreconfigitem('commands', 'status.verbose',
203 default=False,
203 default=False,
204 )
204 )
205 coreconfigitem('commands', 'update.check',
205 coreconfigitem('commands', 'update.check',
206 default=None,
206 default=None,
207 )
207 )
208 coreconfigitem('commands', 'update.requiredest',
208 coreconfigitem('commands', 'update.requiredest',
209 default=False,
209 default=False,
210 )
210 )
211 coreconfigitem('committemplate', '.*',
211 coreconfigitem('committemplate', '.*',
212 default=None,
212 default=None,
213 generic=True,
213 generic=True,
214 )
214 )
215 coreconfigitem('convert', 'bzr.saverev',
215 coreconfigitem('convert', 'bzr.saverev',
216 default=True,
216 default=True,
217 )
217 )
218 coreconfigitem('convert', 'cvsps.cache',
218 coreconfigitem('convert', 'cvsps.cache',
219 default=True,
219 default=True,
220 )
220 )
221 coreconfigitem('convert', 'cvsps.fuzz',
221 coreconfigitem('convert', 'cvsps.fuzz',
222 default=60,
222 default=60,
223 )
223 )
224 coreconfigitem('convert', 'cvsps.logencoding',
224 coreconfigitem('convert', 'cvsps.logencoding',
225 default=None,
225 default=None,
226 )
226 )
227 coreconfigitem('convert', 'cvsps.mergefrom',
227 coreconfigitem('convert', 'cvsps.mergefrom',
228 default=None,
228 default=None,
229 )
229 )
230 coreconfigitem('convert', 'cvsps.mergeto',
230 coreconfigitem('convert', 'cvsps.mergeto',
231 default=None,
231 default=None,
232 )
232 )
233 coreconfigitem('convert', 'git.committeractions',
233 coreconfigitem('convert', 'git.committeractions',
234 default=lambda: ['messagedifferent'],
234 default=lambda: ['messagedifferent'],
235 )
235 )
236 coreconfigitem('convert', 'git.extrakeys',
236 coreconfigitem('convert', 'git.extrakeys',
237 default=list,
237 default=list,
238 )
238 )
239 coreconfigitem('convert', 'git.findcopiesharder',
239 coreconfigitem('convert', 'git.findcopiesharder',
240 default=False,
240 default=False,
241 )
241 )
242 coreconfigitem('convert', 'git.remoteprefix',
242 coreconfigitem('convert', 'git.remoteprefix',
243 default='remote',
243 default='remote',
244 )
244 )
245 coreconfigitem('convert', 'git.renamelimit',
245 coreconfigitem('convert', 'git.renamelimit',
246 default=400,
246 default=400,
247 )
247 )
248 coreconfigitem('convert', 'git.saverev',
248 coreconfigitem('convert', 'git.saverev',
249 default=True,
249 default=True,
250 )
250 )
251 coreconfigitem('convert', 'git.similarity',
251 coreconfigitem('convert', 'git.similarity',
252 default=50,
252 default=50,
253 )
253 )
254 coreconfigitem('convert', 'git.skipsubmodules',
254 coreconfigitem('convert', 'git.skipsubmodules',
255 default=False,
255 default=False,
256 )
256 )
257 coreconfigitem('convert', 'hg.clonebranches',
257 coreconfigitem('convert', 'hg.clonebranches',
258 default=False,
258 default=False,
259 )
259 )
260 coreconfigitem('convert', 'hg.ignoreerrors',
260 coreconfigitem('convert', 'hg.ignoreerrors',
261 default=False,
261 default=False,
262 )
262 )
263 coreconfigitem('convert', 'hg.revs',
263 coreconfigitem('convert', 'hg.revs',
264 default=None,
264 default=None,
265 )
265 )
266 coreconfigitem('convert', 'hg.saverev',
266 coreconfigitem('convert', 'hg.saverev',
267 default=False,
267 default=False,
268 )
268 )
269 coreconfigitem('convert', 'hg.sourcename',
269 coreconfigitem('convert', 'hg.sourcename',
270 default=None,
270 default=None,
271 )
271 )
272 coreconfigitem('convert', 'hg.startrev',
272 coreconfigitem('convert', 'hg.startrev',
273 default=None,
273 default=None,
274 )
274 )
275 coreconfigitem('convert', 'hg.tagsbranch',
275 coreconfigitem('convert', 'hg.tagsbranch',
276 default='default',
276 default='default',
277 )
277 )
278 coreconfigitem('convert', 'hg.usebranchnames',
278 coreconfigitem('convert', 'hg.usebranchnames',
279 default=True,
279 default=True,
280 )
280 )
281 coreconfigitem('convert', 'ignoreancestorcheck',
281 coreconfigitem('convert', 'ignoreancestorcheck',
282 default=False,
282 default=False,
283 )
283 )
284 coreconfigitem('convert', 'localtimezone',
284 coreconfigitem('convert', 'localtimezone',
285 default=False,
285 default=False,
286 )
286 )
287 coreconfigitem('convert', 'p4.encoding',
287 coreconfigitem('convert', 'p4.encoding',
288 default=dynamicdefault,
288 default=dynamicdefault,
289 )
289 )
290 coreconfigitem('convert', 'p4.startrev',
290 coreconfigitem('convert', 'p4.startrev',
291 default=0,
291 default=0,
292 )
292 )
293 coreconfigitem('convert', 'skiptags',
293 coreconfigitem('convert', 'skiptags',
294 default=False,
294 default=False,
295 )
295 )
296 coreconfigitem('convert', 'svn.debugsvnlog',
296 coreconfigitem('convert', 'svn.debugsvnlog',
297 default=True,
297 default=True,
298 )
298 )
299 coreconfigitem('convert', 'svn.trunk',
299 coreconfigitem('convert', 'svn.trunk',
300 default=None,
300 default=None,
301 )
301 )
302 coreconfigitem('convert', 'svn.tags',
302 coreconfigitem('convert', 'svn.tags',
303 default=None,
303 default=None,
304 )
304 )
305 coreconfigitem('convert', 'svn.branches',
305 coreconfigitem('convert', 'svn.branches',
306 default=None,
306 default=None,
307 )
307 )
308 coreconfigitem('convert', 'svn.startrev',
308 coreconfigitem('convert', 'svn.startrev',
309 default=0,
309 default=0,
310 )
310 )
311 coreconfigitem('debug', 'dirstate.delaywrite',
311 coreconfigitem('debug', 'dirstate.delaywrite',
312 default=0,
312 default=0,
313 )
313 )
314 coreconfigitem('defaults', '.*',
314 coreconfigitem('defaults', '.*',
315 default=None,
315 default=None,
316 generic=True,
316 generic=True,
317 )
317 )
318 coreconfigitem('devel', 'all-warnings',
318 coreconfigitem('devel', 'all-warnings',
319 default=False,
319 default=False,
320 )
320 )
321 coreconfigitem('devel', 'bundle2.debug',
321 coreconfigitem('devel', 'bundle2.debug',
322 default=False,
322 default=False,
323 )
323 )
324 coreconfigitem('devel', 'cache-vfs',
324 coreconfigitem('devel', 'cache-vfs',
325 default=None,
325 default=None,
326 )
326 )
327 coreconfigitem('devel', 'check-locks',
327 coreconfigitem('devel', 'check-locks',
328 default=False,
328 default=False,
329 )
329 )
330 coreconfigitem('devel', 'check-relroot',
330 coreconfigitem('devel', 'check-relroot',
331 default=False,
331 default=False,
332 )
332 )
333 coreconfigitem('devel', 'default-date',
333 coreconfigitem('devel', 'default-date',
334 default=None,
334 default=None,
335 )
335 )
336 coreconfigitem('devel', 'deprec-warn',
336 coreconfigitem('devel', 'deprec-warn',
337 default=False,
337 default=False,
338 )
338 )
339 coreconfigitem('devel', 'disableloaddefaultcerts',
339 coreconfigitem('devel', 'disableloaddefaultcerts',
340 default=False,
340 default=False,
341 )
341 )
342 coreconfigitem('devel', 'warn-empty-changegroup',
342 coreconfigitem('devel', 'warn-empty-changegroup',
343 default=False,
343 default=False,
344 )
344 )
345 coreconfigitem('devel', 'legacy.exchange',
345 coreconfigitem('devel', 'legacy.exchange',
346 default=list,
346 default=list,
347 )
347 )
348 coreconfigitem('devel', 'servercafile',
348 coreconfigitem('devel', 'servercafile',
349 default='',
349 default='',
350 )
350 )
351 coreconfigitem('devel', 'serverexactprotocol',
351 coreconfigitem('devel', 'serverexactprotocol',
352 default='',
352 default='',
353 )
353 )
354 coreconfigitem('devel', 'serverrequirecert',
354 coreconfigitem('devel', 'serverrequirecert',
355 default=False,
355 default=False,
356 )
356 )
357 coreconfigitem('devel', 'strip-obsmarkers',
357 coreconfigitem('devel', 'strip-obsmarkers',
358 default=True,
358 default=True,
359 )
359 )
360 coreconfigitem('devel', 'warn-config',
360 coreconfigitem('devel', 'warn-config',
361 default=None,
361 default=None,
362 )
362 )
363 coreconfigitem('devel', 'warn-config-default',
363 coreconfigitem('devel', 'warn-config-default',
364 default=None,
364 default=None,
365 )
365 )
366 coreconfigitem('devel', 'user.obsmarker',
366 coreconfigitem('devel', 'user.obsmarker',
367 default=None,
367 default=None,
368 )
368 )
369 coreconfigitem('devel', 'warn-config-unknown',
369 coreconfigitem('devel', 'warn-config-unknown',
370 default=None,
370 default=None,
371 )
371 )
372 coreconfigitem('devel', 'debug.peer-request',
372 coreconfigitem('devel', 'debug.peer-request',
373 default=False,
373 default=False,
374 )
374 )
375 coreconfigitem('diff', 'nodates',
375 coreconfigitem('diff', 'nodates',
376 default=False,
376 default=False,
377 )
377 )
378 coreconfigitem('diff', 'showfunc',
378 coreconfigitem('diff', 'showfunc',
379 default=False,
379 default=False,
380 )
380 )
381 coreconfigitem('diff', 'unified',
381 coreconfigitem('diff', 'unified',
382 default=None,
382 default=None,
383 )
383 )
384 coreconfigitem('diff', 'git',
384 coreconfigitem('diff', 'git',
385 default=False,
385 default=False,
386 )
386 )
387 coreconfigitem('diff', 'ignorews',
387 coreconfigitem('diff', 'ignorews',
388 default=False,
388 default=False,
389 )
389 )
390 coreconfigitem('diff', 'ignorewsamount',
390 coreconfigitem('diff', 'ignorewsamount',
391 default=False,
391 default=False,
392 )
392 )
393 coreconfigitem('diff', 'ignoreblanklines',
393 coreconfigitem('diff', 'ignoreblanklines',
394 default=False,
394 default=False,
395 )
395 )
396 coreconfigitem('diff', 'ignorewseol',
396 coreconfigitem('diff', 'ignorewseol',
397 default=False,
397 default=False,
398 )
398 )
399 coreconfigitem('diff', 'nobinary',
399 coreconfigitem('diff', 'nobinary',
400 default=False,
400 default=False,
401 )
401 )
402 coreconfigitem('diff', 'noprefix',
402 coreconfigitem('diff', 'noprefix',
403 default=False,
403 default=False,
404 )
404 )
405 coreconfigitem('diff', 'word-diff',
405 coreconfigitem('diff', 'word-diff',
406 default=False,
406 default=False,
407 )
407 )
408 coreconfigitem('email', 'bcc',
408 coreconfigitem('email', 'bcc',
409 default=None,
409 default=None,
410 )
410 )
411 coreconfigitem('email', 'cc',
411 coreconfigitem('email', 'cc',
412 default=None,
412 default=None,
413 )
413 )
414 coreconfigitem('email', 'charsets',
414 coreconfigitem('email', 'charsets',
415 default=list,
415 default=list,
416 )
416 )
417 coreconfigitem('email', 'from',
417 coreconfigitem('email', 'from',
418 default=None,
418 default=None,
419 )
419 )
420 coreconfigitem('email', 'method',
420 coreconfigitem('email', 'method',
421 default='smtp',
421 default='smtp',
422 )
422 )
423 coreconfigitem('email', 'reply-to',
423 coreconfigitem('email', 'reply-to',
424 default=None,
424 default=None,
425 )
425 )
426 coreconfigitem('email', 'to',
426 coreconfigitem('email', 'to',
427 default=None,
427 default=None,
428 )
428 )
429 coreconfigitem('experimental', 'archivemetatemplate',
429 coreconfigitem('experimental', 'archivemetatemplate',
430 default=dynamicdefault,
430 default=dynamicdefault,
431 )
431 )
432 coreconfigitem('experimental', 'bundle-phases',
432 coreconfigitem('experimental', 'bundle-phases',
433 default=False,
433 default=False,
434 )
434 )
435 coreconfigitem('experimental', 'bundle2-advertise',
435 coreconfigitem('experimental', 'bundle2-advertise',
436 default=True,
436 default=True,
437 )
437 )
438 coreconfigitem('experimental', 'bundle2-output-capture',
438 coreconfigitem('experimental', 'bundle2-output-capture',
439 default=False,
439 default=False,
440 )
440 )
441 coreconfigitem('experimental', 'bundle2.pushback',
441 coreconfigitem('experimental', 'bundle2.pushback',
442 default=False,
442 default=False,
443 )
443 )
444 coreconfigitem('experimental', 'bundle2.stream',
444 coreconfigitem('experimental', 'bundle2.stream',
445 default=False,
445 default=False,
446 )
446 )
447 coreconfigitem('experimental', 'bundle2lazylocking',
447 coreconfigitem('experimental', 'bundle2lazylocking',
448 default=False,
448 default=False,
449 )
449 )
450 coreconfigitem('experimental', 'bundlecomplevel',
450 coreconfigitem('experimental', 'bundlecomplevel',
451 default=None,
451 default=None,
452 )
452 )
453 coreconfigitem('experimental', 'bundlecomplevel.bzip2',
453 coreconfigitem('experimental', 'bundlecomplevel.bzip2',
454 default=None,
454 default=None,
455 )
455 )
456 coreconfigitem('experimental', 'bundlecomplevel.gzip',
456 coreconfigitem('experimental', 'bundlecomplevel.gzip',
457 default=None,
457 default=None,
458 )
458 )
459 coreconfigitem('experimental', 'bundlecomplevel.none',
459 coreconfigitem('experimental', 'bundlecomplevel.none',
460 default=None,
460 default=None,
461 )
461 )
462 coreconfigitem('experimental', 'bundlecomplevel.zstd',
462 coreconfigitem('experimental', 'bundlecomplevel.zstd',
463 default=None,
463 default=None,
464 )
464 )
465 coreconfigitem('experimental', 'changegroup3',
465 coreconfigitem('experimental', 'changegroup3',
466 default=False,
466 default=False,
467 )
467 )
468 coreconfigitem('experimental', 'clientcompressionengines',
468 coreconfigitem('experimental', 'clientcompressionengines',
469 default=list,
469 default=list,
470 )
470 )
471 coreconfigitem('experimental', 'copytrace',
471 coreconfigitem('experimental', 'copytrace',
472 default='on',
472 default='on',
473 )
473 )
474 coreconfigitem('experimental', 'copytrace.movecandidateslimit',
474 coreconfigitem('experimental', 'copytrace.movecandidateslimit',
475 default=100,
475 default=100,
476 )
476 )
477 coreconfigitem('experimental', 'copytrace.sourcecommitlimit',
477 coreconfigitem('experimental', 'copytrace.sourcecommitlimit',
478 default=100,
478 default=100,
479 )
479 )
480 coreconfigitem('experimental', 'crecordtest',
480 coreconfigitem('experimental', 'crecordtest',
481 default=None,
481 default=None,
482 )
482 )
483 coreconfigitem('experimental', 'directaccess',
483 coreconfigitem('experimental', 'directaccess',
484 default=False,
484 default=False,
485 )
485 )
486 coreconfigitem('experimental', 'directaccess.revnums',
486 coreconfigitem('experimental', 'directaccess.revnums',
487 default=False,
487 default=False,
488 )
488 )
489 coreconfigitem('experimental', 'editortmpinhg',
489 coreconfigitem('experimental', 'editortmpinhg',
490 default=False,
490 default=False,
491 )
491 )
492 coreconfigitem('experimental', 'evolution',
492 coreconfigitem('experimental', 'evolution',
493 default=list,
493 default=list,
494 )
494 )
495 coreconfigitem('experimental', 'evolution.allowdivergence',
495 coreconfigitem('experimental', 'evolution.allowdivergence',
496 default=False,
496 default=False,
497 alias=[('experimental', 'allowdivergence')]
497 alias=[('experimental', 'allowdivergence')]
498 )
498 )
499 coreconfigitem('experimental', 'evolution.allowunstable',
499 coreconfigitem('experimental', 'evolution.allowunstable',
500 default=None,
500 default=None,
501 )
501 )
502 coreconfigitem('experimental', 'evolution.createmarkers',
502 coreconfigitem('experimental', 'evolution.createmarkers',
503 default=None,
503 default=None,
504 )
504 )
505 coreconfigitem('experimental', 'evolution.effect-flags',
505 coreconfigitem('experimental', 'evolution.effect-flags',
506 default=True,
506 default=True,
507 alias=[('experimental', 'effect-flags')]
507 alias=[('experimental', 'effect-flags')]
508 )
508 )
509 coreconfigitem('experimental', 'evolution.exchange',
509 coreconfigitem('experimental', 'evolution.exchange',
510 default=None,
510 default=None,
511 )
511 )
512 coreconfigitem('experimental', 'evolution.bundle-obsmarker',
512 coreconfigitem('experimental', 'evolution.bundle-obsmarker',
513 default=False,
513 default=False,
514 )
514 )
515 coreconfigitem('experimental', 'evolution.report-instabilities',
515 coreconfigitem('experimental', 'evolution.report-instabilities',
516 default=True,
516 default=True,
517 )
517 )
518 coreconfigitem('experimental', 'evolution.track-operation',
518 coreconfigitem('experimental', 'evolution.track-operation',
519 default=True,
519 default=True,
520 )
520 )
521 coreconfigitem('experimental', 'maxdeltachainspan',
521 coreconfigitem('experimental', 'maxdeltachainspan',
522 default=-1,
522 default=-1,
523 )
523 )
524 coreconfigitem('experimental', 'mergetempdirprefix',
524 coreconfigitem('experimental', 'mergetempdirprefix',
525 default=None,
525 default=None,
526 )
526 )
527 coreconfigitem('experimental', 'mmapindexthreshold',
527 coreconfigitem('experimental', 'mmapindexthreshold',
528 default=None,
528 default=None,
529 )
529 )
530 coreconfigitem('experimental', 'nonnormalparanoidcheck',
530 coreconfigitem('experimental', 'nonnormalparanoidcheck',
531 default=False,
531 default=False,
532 )
532 )
533 coreconfigitem('experimental', 'exportableenviron',
533 coreconfigitem('experimental', 'exportableenviron',
534 default=list,
534 default=list,
535 )
535 )
536 coreconfigitem('experimental', 'extendedheader.index',
536 coreconfigitem('experimental', 'extendedheader.index',
537 default=None,
537 default=None,
538 )
538 )
539 coreconfigitem('experimental', 'extendedheader.similarity',
539 coreconfigitem('experimental', 'extendedheader.similarity',
540 default=False,
540 default=False,
541 )
541 )
542 coreconfigitem('experimental', 'format.compression',
542 coreconfigitem('experimental', 'format.compression',
543 default='zlib',
543 default='zlib',
544 )
544 )
545 coreconfigitem('experimental', 'graphshorten',
545 coreconfigitem('experimental', 'graphshorten',
546 default=False,
546 default=False,
547 )
547 )
548 coreconfigitem('experimental', 'graphstyle.parent',
548 coreconfigitem('experimental', 'graphstyle.parent',
549 default=dynamicdefault,
549 default=dynamicdefault,
550 )
550 )
551 coreconfigitem('experimental', 'graphstyle.missing',
551 coreconfigitem('experimental', 'graphstyle.missing',
552 default=dynamicdefault,
552 default=dynamicdefault,
553 )
553 )
554 coreconfigitem('experimental', 'graphstyle.grandparent',
554 coreconfigitem('experimental', 'graphstyle.grandparent',
555 default=dynamicdefault,
555 default=dynamicdefault,
556 )
556 )
557 coreconfigitem('experimental', 'hook-track-tags',
557 coreconfigitem('experimental', 'hook-track-tags',
558 default=False,
558 default=False,
559 )
559 )
560 coreconfigitem('experimental', 'httppeer.advertise-v2',
560 coreconfigitem('experimental', 'httppeer.advertise-v2',
561 default=False,
561 default=False,
562 )
562 )
563 coreconfigitem('experimental', 'httppostargs',
563 coreconfigitem('experimental', 'httppostargs',
564 default=False,
564 default=False,
565 )
565 )
566 coreconfigitem('experimental', 'mergedriver',
566 coreconfigitem('experimental', 'mergedriver',
567 default=None,
567 default=None,
568 )
568 )
569 coreconfigitem('experimental', 'nointerrupt', default=False)
569 coreconfigitem('experimental', 'nointerrupt', default=False)
570 coreconfigitem('experimental', 'nointerrupt-interactiveonly', default=True)
570 coreconfigitem('experimental', 'nointerrupt-interactiveonly', default=True)
571
571
572 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
572 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
573 default=False,
573 default=False,
574 )
574 )
575 coreconfigitem('experimental', 'remotenames',
575 coreconfigitem('experimental', 'remotenames',
576 default=False,
576 default=False,
577 )
577 )
578 coreconfigitem('experimental', 'removeemptydirs',
578 coreconfigitem('experimental', 'removeemptydirs',
579 default=True,
579 default=True,
580 )
580 )
581 coreconfigitem('experimental', 'revlogv2',
581 coreconfigitem('experimental', 'revlogv2',
582 default=None,
582 default=None,
583 )
583 )
584 coreconfigitem('experimental', 'single-head-per-branch',
584 coreconfigitem('experimental', 'single-head-per-branch',
585 default=False,
585 default=False,
586 )
586 )
587 coreconfigitem('experimental', 'sshserver.support-v2',
587 coreconfigitem('experimental', 'sshserver.support-v2',
588 default=False,
588 default=False,
589 )
589 )
590 coreconfigitem('experimental', 'spacemovesdown',
590 coreconfigitem('experimental', 'spacemovesdown',
591 default=False,
591 default=False,
592 )
592 )
593 coreconfigitem('experimental', 'sparse-read',
593 coreconfigitem('experimental', 'sparse-read',
594 default=False,
594 default=False,
595 )
595 )
596 coreconfigitem('experimental', 'sparse-read.density-threshold',
596 coreconfigitem('experimental', 'sparse-read.density-threshold',
597 default=0.25,
597 default=0.25,
598 )
598 )
599 coreconfigitem('experimental', 'sparse-read.min-gap-size',
599 coreconfigitem('experimental', 'sparse-read.min-gap-size',
600 default='256K',
600 default='256K',
601 )
601 )
602 coreconfigitem('experimental', 'treemanifest',
602 coreconfigitem('experimental', 'treemanifest',
603 default=False,
603 default=False,
604 )
604 )
605 coreconfigitem('experimental', 'update.atomic-file',
605 coreconfigitem('experimental', 'update.atomic-file',
606 default=False,
606 default=False,
607 )
607 )
608 coreconfigitem('experimental', 'sshpeer.advertise-v2',
608 coreconfigitem('experimental', 'sshpeer.advertise-v2',
609 default=False,
609 default=False,
610 )
610 )
611 coreconfigitem('experimental', 'web.apiserver',
611 coreconfigitem('experimental', 'web.apiserver',
612 default=False,
612 default=False,
613 )
613 )
614 coreconfigitem('experimental', 'web.api.http-v2',
614 coreconfigitem('experimental', 'web.api.http-v2',
615 default=False,
615 default=False,
616 )
616 )
617 coreconfigitem('experimental', 'web.api.debugreflect',
617 coreconfigitem('experimental', 'web.api.debugreflect',
618 default=False,
618 default=False,
619 )
619 )
620 coreconfigitem('experimental', 'xdiff',
620 coreconfigitem('experimental', 'xdiff',
621 default=False,
621 default=False,
622 )
622 )
623 coreconfigitem('extensions', '.*',
623 coreconfigitem('extensions', '.*',
624 default=None,
624 default=None,
625 generic=True,
625 generic=True,
626 )
626 )
627 coreconfigitem('extdata', '.*',
627 coreconfigitem('extdata', '.*',
628 default=None,
628 default=None,
629 generic=True,
629 generic=True,
630 )
630 )
631 coreconfigitem('format', 'aggressivemergedeltas',
631 coreconfigitem('format', 'aggressivemergedeltas',
632 default=False,
632 default=False,
633 )
633 )
634 coreconfigitem('format', 'chunkcachesize',
634 coreconfigitem('format', 'chunkcachesize',
635 default=None,
635 default=None,
636 )
636 )
637 coreconfigitem('format', 'dotencode',
637 coreconfigitem('format', 'dotencode',
638 default=True,
638 default=True,
639 )
639 )
640 coreconfigitem('format', 'generaldelta',
640 coreconfigitem('format', 'generaldelta',
641 default=False,
641 default=False,
642 )
642 )
643 coreconfigitem('format', 'manifestcachesize',
643 coreconfigitem('format', 'manifestcachesize',
644 default=None,
644 default=None,
645 )
645 )
646 coreconfigitem('format', 'maxchainlen',
646 coreconfigitem('format', 'maxchainlen',
647 default=None,
647 default=None,
648 )
648 )
649 coreconfigitem('format', 'obsstore-version',
649 coreconfigitem('format', 'obsstore-version',
650 default=None,
650 default=None,
651 )
651 )
652 coreconfigitem('format', 'usefncache',
652 coreconfigitem('format', 'usefncache',
653 default=True,
653 default=True,
654 )
654 )
655 coreconfigitem('format', 'usegeneraldelta',
655 coreconfigitem('format', 'usegeneraldelta',
656 default=True,
656 default=True,
657 )
657 )
658 coreconfigitem('format', 'usestore',
658 coreconfigitem('format', 'usestore',
659 default=True,
659 default=True,
660 )
660 )
661 coreconfigitem('fsmonitor', 'warn_when_unused',
661 coreconfigitem('fsmonitor', 'warn_when_unused',
662 default=True,
662 default=True,
663 )
663 )
664 coreconfigitem('fsmonitor', 'warn_update_file_count',
664 coreconfigitem('fsmonitor', 'warn_update_file_count',
665 default=50000,
665 default=50000,
666 )
666 )
667 coreconfigitem('hooks', '.*',
667 coreconfigitem('hooks', '.*',
668 default=dynamicdefault,
668 default=dynamicdefault,
669 generic=True,
669 generic=True,
670 )
670 )
671 coreconfigitem('hgweb-paths', '.*',
671 coreconfigitem('hgweb-paths', '.*',
672 default=list,
672 default=list,
673 generic=True,
673 generic=True,
674 )
674 )
675 coreconfigitem('hostfingerprints', '.*',
675 coreconfigitem('hostfingerprints', '.*',
676 default=list,
676 default=list,
677 generic=True,
677 generic=True,
678 )
678 )
679 coreconfigitem('hostsecurity', 'ciphers',
679 coreconfigitem('hostsecurity', 'ciphers',
680 default=None,
680 default=None,
681 )
681 )
682 coreconfigitem('hostsecurity', 'disabletls10warning',
682 coreconfigitem('hostsecurity', 'disabletls10warning',
683 default=False,
683 default=False,
684 )
684 )
685 coreconfigitem('hostsecurity', 'minimumprotocol',
685 coreconfigitem('hostsecurity', 'minimumprotocol',
686 default=dynamicdefault,
686 default=dynamicdefault,
687 )
687 )
688 coreconfigitem('hostsecurity', '.*:minimumprotocol$',
688 coreconfigitem('hostsecurity', '.*:minimumprotocol$',
689 default=dynamicdefault,
689 default=dynamicdefault,
690 generic=True,
690 generic=True,
691 )
691 )
692 coreconfigitem('hostsecurity', '.*:ciphers$',
692 coreconfigitem('hostsecurity', '.*:ciphers$',
693 default=dynamicdefault,
693 default=dynamicdefault,
694 generic=True,
694 generic=True,
695 )
695 )
696 coreconfigitem('hostsecurity', '.*:fingerprints$',
696 coreconfigitem('hostsecurity', '.*:fingerprints$',
697 default=list,
697 default=list,
698 generic=True,
698 generic=True,
699 )
699 )
700 coreconfigitem('hostsecurity', '.*:verifycertsfile$',
700 coreconfigitem('hostsecurity', '.*:verifycertsfile$',
701 default=None,
701 default=None,
702 generic=True,
702 generic=True,
703 )
703 )
704
704
705 coreconfigitem('http_proxy', 'always',
705 coreconfigitem('http_proxy', 'always',
706 default=False,
706 default=False,
707 )
707 )
708 coreconfigitem('http_proxy', 'host',
708 coreconfigitem('http_proxy', 'host',
709 default=None,
709 default=None,
710 )
710 )
711 coreconfigitem('http_proxy', 'no',
711 coreconfigitem('http_proxy', 'no',
712 default=list,
712 default=list,
713 )
713 )
714 coreconfigitem('http_proxy', 'passwd',
714 coreconfigitem('http_proxy', 'passwd',
715 default=None,
715 default=None,
716 )
716 )
717 coreconfigitem('http_proxy', 'user',
717 coreconfigitem('http_proxy', 'user',
718 default=None,
718 default=None,
719 )
719 )
720 coreconfigitem('logtoprocess', 'commandexception',
720 coreconfigitem('logtoprocess', 'commandexception',
721 default=None,
721 default=None,
722 )
722 )
723 coreconfigitem('logtoprocess', 'commandfinish',
723 coreconfigitem('logtoprocess', 'commandfinish',
724 default=None,
724 default=None,
725 )
725 )
726 coreconfigitem('logtoprocess', 'command',
726 coreconfigitem('logtoprocess', 'command',
727 default=None,
727 default=None,
728 )
728 )
729 coreconfigitem('logtoprocess', 'develwarn',
729 coreconfigitem('logtoprocess', 'develwarn',
730 default=None,
730 default=None,
731 )
731 )
732 coreconfigitem('logtoprocess', 'uiblocked',
732 coreconfigitem('logtoprocess', 'uiblocked',
733 default=None,
733 default=None,
734 )
734 )
735 coreconfigitem('merge', 'checkunknown',
735 coreconfigitem('merge', 'checkunknown',
736 default='abort',
736 default='abort',
737 )
737 )
738 coreconfigitem('merge', 'checkignored',
738 coreconfigitem('merge', 'checkignored',
739 default='abort',
739 default='abort',
740 )
740 )
741 coreconfigitem('experimental', 'merge.checkpathconflicts',
741 coreconfigitem('experimental', 'merge.checkpathconflicts',
742 default=False,
742 default=False,
743 )
743 )
744 coreconfigitem('merge', 'followcopies',
744 coreconfigitem('merge', 'followcopies',
745 default=True,
745 default=True,
746 )
746 )
747 coreconfigitem('merge', 'on-failure',
747 coreconfigitem('merge', 'on-failure',
748 default='continue',
748 default='continue',
749 )
749 )
750 coreconfigitem('merge', 'preferancestor',
750 coreconfigitem('merge', 'preferancestor',
751 default=lambda: ['*'],
751 default=lambda: ['*'],
752 )
752 )
753 coreconfigitem('merge-tools', '.*',
753 coreconfigitem('merge-tools', '.*',
754 default=None,
754 default=None,
755 generic=True,
755 generic=True,
756 )
756 )
757 coreconfigitem('merge-tools', br'.*\.args$',
757 coreconfigitem('merge-tools', br'.*\.args$',
758 default="$local $base $other",
758 default="$local $base $other",
759 generic=True,
759 generic=True,
760 priority=-1,
760 priority=-1,
761 )
761 )
762 coreconfigitem('merge-tools', br'.*\.binary$',
762 coreconfigitem('merge-tools', br'.*\.binary$',
763 default=False,
763 default=False,
764 generic=True,
764 generic=True,
765 priority=-1,
765 priority=-1,
766 )
766 )
767 coreconfigitem('merge-tools', br'.*\.check$',
767 coreconfigitem('merge-tools', br'.*\.check$',
768 default=list,
768 default=list,
769 generic=True,
769 generic=True,
770 priority=-1,
770 priority=-1,
771 )
771 )
772 coreconfigitem('merge-tools', br'.*\.checkchanged$',
772 coreconfigitem('merge-tools', br'.*\.checkchanged$',
773 default=False,
773 default=False,
774 generic=True,
774 generic=True,
775 priority=-1,
775 priority=-1,
776 )
776 )
777 coreconfigitem('merge-tools', br'.*\.executable$',
777 coreconfigitem('merge-tools', br'.*\.executable$',
778 default=dynamicdefault,
778 default=dynamicdefault,
779 generic=True,
779 generic=True,
780 priority=-1,
780 priority=-1,
781 )
781 )
782 coreconfigitem('merge-tools', br'.*\.fixeol$',
782 coreconfigitem('merge-tools', br'.*\.fixeol$',
783 default=False,
783 default=False,
784 generic=True,
784 generic=True,
785 priority=-1,
785 priority=-1,
786 )
786 )
787 coreconfigitem('merge-tools', br'.*\.gui$',
787 coreconfigitem('merge-tools', br'.*\.gui$',
788 default=False,
788 default=False,
789 generic=True,
789 generic=True,
790 priority=-1,
790 priority=-1,
791 )
791 )
792 coreconfigitem('merge-tools', br'.*\.mergemarkers$',
792 coreconfigitem('merge-tools', br'.*\.mergemarkers$',
793 default='basic',
793 default='basic',
794 generic=True,
794 generic=True,
795 priority=-1,
795 priority=-1,
796 )
796 )
797 coreconfigitem('merge-tools', br'.*\.mergemarkertemplate$',
797 coreconfigitem('merge-tools', br'.*\.mergemarkertemplate$',
798 default=dynamicdefault, # take from ui.mergemarkertemplate
798 default=dynamicdefault, # take from ui.mergemarkertemplate
799 generic=True,
799 generic=True,
800 priority=-1,
800 priority=-1,
801 )
801 )
802 coreconfigitem('merge-tools', br'.*\.priority$',
802 coreconfigitem('merge-tools', br'.*\.priority$',
803 default=0,
803 default=0,
804 generic=True,
804 generic=True,
805 priority=-1,
805 priority=-1,
806 )
806 )
807 coreconfigitem('merge-tools', br'.*\.premerge$',
807 coreconfigitem('merge-tools', br'.*\.premerge$',
808 default=dynamicdefault,
808 default=dynamicdefault,
809 generic=True,
809 generic=True,
810 priority=-1,
810 priority=-1,
811 )
811 )
812 coreconfigitem('merge-tools', br'.*\.symlink$',
812 coreconfigitem('merge-tools', br'.*\.symlink$',
813 default=False,
813 default=False,
814 generic=True,
814 generic=True,
815 priority=-1,
815 priority=-1,
816 )
816 )
817 coreconfigitem('pager', 'attend-.*',
817 coreconfigitem('pager', 'attend-.*',
818 default=dynamicdefault,
818 default=dynamicdefault,
819 generic=True,
819 generic=True,
820 )
820 )
821 coreconfigitem('pager', 'ignore',
821 coreconfigitem('pager', 'ignore',
822 default=list,
822 default=list,
823 )
823 )
824 coreconfigitem('pager', 'pager',
824 coreconfigitem('pager', 'pager',
825 default=dynamicdefault,
825 default=dynamicdefault,
826 )
826 )
827 coreconfigitem('patch', 'eol',
827 coreconfigitem('patch', 'eol',
828 default='strict',
828 default='strict',
829 )
829 )
830 coreconfigitem('patch', 'fuzz',
830 coreconfigitem('patch', 'fuzz',
831 default=2,
831 default=2,
832 )
832 )
833 coreconfigitem('paths', 'default',
833 coreconfigitem('paths', 'default',
834 default=None,
834 default=None,
835 )
835 )
836 coreconfigitem('paths', 'default-push',
836 coreconfigitem('paths', 'default-push',
837 default=None,
837 default=None,
838 )
838 )
839 coreconfigitem('paths', '.*',
839 coreconfigitem('paths', '.*',
840 default=None,
840 default=None,
841 generic=True,
841 generic=True,
842 )
842 )
843 coreconfigitem('phases', 'checksubrepos',
843 coreconfigitem('phases', 'checksubrepos',
844 default='follow',
844 default='follow',
845 )
845 )
846 coreconfigitem('phases', 'new-commit',
846 coreconfigitem('phases', 'new-commit',
847 default='draft',
847 default='draft',
848 )
848 )
849 coreconfigitem('phases', 'publish',
849 coreconfigitem('phases', 'publish',
850 default=True,
850 default=True,
851 )
851 )
852 coreconfigitem('profiling', 'enabled',
852 coreconfigitem('profiling', 'enabled',
853 default=False,
853 default=False,
854 )
854 )
855 coreconfigitem('profiling', 'format',
855 coreconfigitem('profiling', 'format',
856 default='text',
856 default='text',
857 )
857 )
858 coreconfigitem('profiling', 'freq',
858 coreconfigitem('profiling', 'freq',
859 default=1000,
859 default=1000,
860 )
860 )
861 coreconfigitem('profiling', 'limit',
861 coreconfigitem('profiling', 'limit',
862 default=30,
862 default=30,
863 )
863 )
864 coreconfigitem('profiling', 'nested',
864 coreconfigitem('profiling', 'nested',
865 default=0,
865 default=0,
866 )
866 )
867 coreconfigitem('profiling', 'output',
867 coreconfigitem('profiling', 'output',
868 default=None,
868 default=None,
869 )
869 )
870 coreconfigitem('profiling', 'showmax',
870 coreconfigitem('profiling', 'showmax',
871 default=0.999,
871 default=0.999,
872 )
872 )
873 coreconfigitem('profiling', 'showmin',
873 coreconfigitem('profiling', 'showmin',
874 default=dynamicdefault,
874 default=dynamicdefault,
875 )
875 )
876 coreconfigitem('profiling', 'sort',
876 coreconfigitem('profiling', 'sort',
877 default='inlinetime',
877 default='inlinetime',
878 )
878 )
879 coreconfigitem('profiling', 'statformat',
879 coreconfigitem('profiling', 'statformat',
880 default='hotpath',
880 default='hotpath',
881 )
881 )
882 coreconfigitem('profiling', 'time-track',
882 coreconfigitem('profiling', 'time-track',
883 default='cpu',
883 default='cpu',
884 )
884 )
885 coreconfigitem('profiling', 'type',
885 coreconfigitem('profiling', 'type',
886 default='stat',
886 default='stat',
887 )
887 )
888 coreconfigitem('progress', 'assume-tty',
888 coreconfigitem('progress', 'assume-tty',
889 default=False,
889 default=False,
890 )
890 )
891 coreconfigitem('progress', 'changedelay',
891 coreconfigitem('progress', 'changedelay',
892 default=1,
892 default=1,
893 )
893 )
894 coreconfigitem('progress', 'clear-complete',
894 coreconfigitem('progress', 'clear-complete',
895 default=True,
895 default=True,
896 )
896 )
897 coreconfigitem('progress', 'debug',
897 coreconfigitem('progress', 'debug',
898 default=False,
898 default=False,
899 )
899 )
900 coreconfigitem('progress', 'delay',
900 coreconfigitem('progress', 'delay',
901 default=3,
901 default=3,
902 )
902 )
903 coreconfigitem('progress', 'disable',
903 coreconfigitem('progress', 'disable',
904 default=False,
904 default=False,
905 )
905 )
906 coreconfigitem('progress', 'estimateinterval',
906 coreconfigitem('progress', 'estimateinterval',
907 default=60.0,
907 default=60.0,
908 )
908 )
909 coreconfigitem('progress', 'format',
909 coreconfigitem('progress', 'format',
910 default=lambda: ['topic', 'bar', 'number', 'estimate'],
910 default=lambda: ['topic', 'bar', 'number', 'estimate'],
911 )
911 )
912 coreconfigitem('progress', 'refresh',
912 coreconfigitem('progress', 'refresh',
913 default=0.1,
913 default=0.1,
914 )
914 )
915 coreconfigitem('progress', 'width',
915 coreconfigitem('progress', 'width',
916 default=dynamicdefault,
916 default=dynamicdefault,
917 )
917 )
918 coreconfigitem('push', 'pushvars.server',
918 coreconfigitem('push', 'pushvars.server',
919 default=False,
919 default=False,
920 )
920 )
921 coreconfigitem('server', 'bookmarks-pushkey-compat',
921 coreconfigitem('server', 'bookmarks-pushkey-compat',
922 default=True,
922 default=True,
923 )
923 )
924 coreconfigitem('server', 'bundle1',
924 coreconfigitem('server', 'bundle1',
925 default=True,
925 default=True,
926 )
926 )
927 coreconfigitem('server', 'bundle1gd',
927 coreconfigitem('server', 'bundle1gd',
928 default=None,
928 default=None,
929 )
929 )
930 coreconfigitem('server', 'bundle1.pull',
930 coreconfigitem('server', 'bundle1.pull',
931 default=None,
931 default=None,
932 )
932 )
933 coreconfigitem('server', 'bundle1gd.pull',
933 coreconfigitem('server', 'bundle1gd.pull',
934 default=None,
934 default=None,
935 )
935 )
936 coreconfigitem('server', 'bundle1.push',
936 coreconfigitem('server', 'bundle1.push',
937 default=None,
937 default=None,
938 )
938 )
939 coreconfigitem('server', 'bundle1gd.push',
939 coreconfigitem('server', 'bundle1gd.push',
940 default=None,
940 default=None,
941 )
941 )
942 coreconfigitem('server', 'compressionengines',
942 coreconfigitem('server', 'compressionengines',
943 default=list,
943 default=list,
944 )
944 )
945 coreconfigitem('server', 'concurrent-push-mode',
945 coreconfigitem('server', 'concurrent-push-mode',
946 default='strict',
946 default='strict',
947 )
947 )
948 coreconfigitem('server', 'disablefullbundle',
948 coreconfigitem('server', 'disablefullbundle',
949 default=False,
949 default=False,
950 )
950 )
951 coreconfigitem('server', 'maxhttpheaderlen',
951 coreconfigitem('server', 'maxhttpheaderlen',
952 default=1024,
952 default=1024,
953 )
953 )
954 coreconfigitem('server', 'pullbundle',
954 coreconfigitem('server', 'pullbundle',
955 default=False,
955 default=False,
956 )
956 )
957 coreconfigitem('server', 'preferuncompressed',
957 coreconfigitem('server', 'preferuncompressed',
958 default=False,
958 default=False,
959 )
959 )
960 coreconfigitem('server', 'streamunbundle',
960 coreconfigitem('server', 'streamunbundle',
961 default=False,
961 default=False,
962 )
962 )
963 coreconfigitem('server', 'uncompressed',
963 coreconfigitem('server', 'uncompressed',
964 default=True,
964 default=True,
965 )
965 )
966 coreconfigitem('server', 'uncompressedallowsecret',
966 coreconfigitem('server', 'uncompressedallowsecret',
967 default=False,
967 default=False,
968 )
968 )
969 coreconfigitem('server', 'validate',
969 coreconfigitem('server', 'validate',
970 default=False,
970 default=False,
971 )
971 )
972 coreconfigitem('server', 'zliblevel',
972 coreconfigitem('server', 'zliblevel',
973 default=-1,
973 default=-1,
974 )
974 )
975 coreconfigitem('server', 'zstdlevel',
975 coreconfigitem('server', 'zstdlevel',
976 default=3,
976 default=3,
977 )
977 )
978 coreconfigitem('share', 'pool',
978 coreconfigitem('share', 'pool',
979 default=None,
979 default=None,
980 )
980 )
981 coreconfigitem('share', 'poolnaming',
981 coreconfigitem('share', 'poolnaming',
982 default='identity',
982 default='identity',
983 )
983 )
984 coreconfigitem('smtp', 'host',
984 coreconfigitem('smtp', 'host',
985 default=None,
985 default=None,
986 )
986 )
987 coreconfigitem('smtp', 'local_hostname',
987 coreconfigitem('smtp', 'local_hostname',
988 default=None,
988 default=None,
989 )
989 )
990 coreconfigitem('smtp', 'password',
990 coreconfigitem('smtp', 'password',
991 default=None,
991 default=None,
992 )
992 )
993 coreconfigitem('smtp', 'port',
993 coreconfigitem('smtp', 'port',
994 default=dynamicdefault,
994 default=dynamicdefault,
995 )
995 )
996 coreconfigitem('smtp', 'tls',
996 coreconfigitem('smtp', 'tls',
997 default='none',
997 default='none',
998 )
998 )
999 coreconfigitem('smtp', 'username',
999 coreconfigitem('smtp', 'username',
1000 default=None,
1000 default=None,
1001 )
1001 )
1002 coreconfigitem('sparse', 'missingwarning',
1002 coreconfigitem('sparse', 'missingwarning',
1003 default=True,
1003 default=True,
1004 )
1004 )
1005 coreconfigitem('subrepos', 'allowed',
1005 coreconfigitem('subrepos', 'allowed',
1006 default=dynamicdefault, # to make backporting simpler
1006 default=dynamicdefault, # to make backporting simpler
1007 )
1007 )
1008 coreconfigitem('subrepos', 'hg:allowed',
1008 coreconfigitem('subrepos', 'hg:allowed',
1009 default=dynamicdefault,
1009 default=dynamicdefault,
1010 )
1010 )
1011 coreconfigitem('subrepos', 'git:allowed',
1011 coreconfigitem('subrepos', 'git:allowed',
1012 default=dynamicdefault,
1012 default=dynamicdefault,
1013 )
1013 )
1014 coreconfigitem('subrepos', 'svn:allowed',
1014 coreconfigitem('subrepos', 'svn:allowed',
1015 default=dynamicdefault,
1015 default=dynamicdefault,
1016 )
1016 )
1017 coreconfigitem('templates', '.*',
1017 coreconfigitem('templates', '.*',
1018 default=None,
1018 default=None,
1019 generic=True,
1019 generic=True,
1020 )
1020 )
1021 coreconfigitem('trusted', 'groups',
1021 coreconfigitem('trusted', 'groups',
1022 default=list,
1022 default=list,
1023 )
1023 )
1024 coreconfigitem('trusted', 'users',
1024 coreconfigitem('trusted', 'users',
1025 default=list,
1025 default=list,
1026 )
1026 )
1027 coreconfigitem('ui', '_usedassubrepo',
1027 coreconfigitem('ui', '_usedassubrepo',
1028 default=False,
1028 default=False,
1029 )
1029 )
1030 coreconfigitem('ui', 'allowemptycommit',
1030 coreconfigitem('ui', 'allowemptycommit',
1031 default=False,
1031 default=False,
1032 )
1032 )
1033 coreconfigitem('ui', 'archivemeta',
1033 coreconfigitem('ui', 'archivemeta',
1034 default=True,
1034 default=True,
1035 )
1035 )
1036 coreconfigitem('ui', 'askusername',
1036 coreconfigitem('ui', 'askusername',
1037 default=False,
1037 default=False,
1038 )
1038 )
1039 coreconfigitem('ui', 'clonebundlefallback',
1039 coreconfigitem('ui', 'clonebundlefallback',
1040 default=False,
1040 default=False,
1041 )
1041 )
1042 coreconfigitem('ui', 'clonebundleprefers',
1042 coreconfigitem('ui', 'clonebundleprefers',
1043 default=list,
1043 default=list,
1044 )
1044 )
1045 coreconfigitem('ui', 'clonebundles',
1045 coreconfigitem('ui', 'clonebundles',
1046 default=True,
1046 default=True,
1047 )
1047 )
1048 coreconfigitem('ui', 'color',
1048 coreconfigitem('ui', 'color',
1049 default='auto',
1049 default='auto',
1050 )
1050 )
1051 coreconfigitem('ui', 'commitsubrepos',
1051 coreconfigitem('ui', 'commitsubrepos',
1052 default=False,
1052 default=False,
1053 )
1053 )
1054 coreconfigitem('ui', 'debug',
1054 coreconfigitem('ui', 'debug',
1055 default=False,
1055 default=False,
1056 )
1056 )
1057 coreconfigitem('ui', 'debugger',
1057 coreconfigitem('ui', 'debugger',
1058 default=None,
1058 default=None,
1059 )
1059 )
1060 coreconfigitem('ui', 'editor',
1060 coreconfigitem('ui', 'editor',
1061 default=dynamicdefault,
1061 default=dynamicdefault,
1062 )
1062 )
1063 coreconfigitem('ui', 'fallbackencoding',
1063 coreconfigitem('ui', 'fallbackencoding',
1064 default=None,
1064 default=None,
1065 )
1065 )
1066 coreconfigitem('ui', 'forcecwd',
1066 coreconfigitem('ui', 'forcecwd',
1067 default=None,
1067 default=None,
1068 )
1068 )
1069 coreconfigitem('ui', 'forcemerge',
1069 coreconfigitem('ui', 'forcemerge',
1070 default=None,
1070 default=None,
1071 )
1071 )
1072 coreconfigitem('ui', 'formatdebug',
1072 coreconfigitem('ui', 'formatdebug',
1073 default=False,
1073 default=False,
1074 )
1074 )
1075 coreconfigitem('ui', 'formatjson',
1075 coreconfigitem('ui', 'formatjson',
1076 default=False,
1076 default=False,
1077 )
1077 )
1078 coreconfigitem('ui', 'formatted',
1078 coreconfigitem('ui', 'formatted',
1079 default=None,
1079 default=None,
1080 )
1080 )
1081 coreconfigitem('ui', 'graphnodetemplate',
1081 coreconfigitem('ui', 'graphnodetemplate',
1082 default=None,
1082 default=None,
1083 )
1083 )
1084 coreconfigitem('ui', 'interactive',
1084 coreconfigitem('ui', 'interactive',
1085 default=None,
1085 default=None,
1086 )
1086 )
1087 coreconfigitem('ui', 'interface',
1087 coreconfigitem('ui', 'interface',
1088 default=None,
1088 default=None,
1089 )
1089 )
1090 coreconfigitem('ui', 'interface.chunkselector',
1090 coreconfigitem('ui', 'interface.chunkselector',
1091 default=None,
1091 default=None,
1092 )
1092 )
1093 coreconfigitem('ui', 'large-file-limit',
1094 default=10000000,
1095 )
1093 coreconfigitem('ui', 'logblockedtimes',
1096 coreconfigitem('ui', 'logblockedtimes',
1094 default=False,
1097 default=False,
1095 )
1098 )
1096 coreconfigitem('ui', 'logtemplate',
1099 coreconfigitem('ui', 'logtemplate',
1097 default=None,
1100 default=None,
1098 )
1101 )
1099 coreconfigitem('ui', 'merge',
1102 coreconfigitem('ui', 'merge',
1100 default=None,
1103 default=None,
1101 )
1104 )
1102 coreconfigitem('ui', 'mergemarkers',
1105 coreconfigitem('ui', 'mergemarkers',
1103 default='basic',
1106 default='basic',
1104 )
1107 )
1105 coreconfigitem('ui', 'mergemarkertemplate',
1108 coreconfigitem('ui', 'mergemarkertemplate',
1106 default=('{node|short} '
1109 default=('{node|short} '
1107 '{ifeq(tags, "tip", "", '
1110 '{ifeq(tags, "tip", "", '
1108 'ifeq(tags, "", "", "{tags} "))}'
1111 'ifeq(tags, "", "", "{tags} "))}'
1109 '{if(bookmarks, "{bookmarks} ")}'
1112 '{if(bookmarks, "{bookmarks} ")}'
1110 '{ifeq(branch, "default", "", "{branch} ")}'
1113 '{ifeq(branch, "default", "", "{branch} ")}'
1111 '- {author|user}: {desc|firstline}')
1114 '- {author|user}: {desc|firstline}')
1112 )
1115 )
1113 coreconfigitem('ui', 'nontty',
1116 coreconfigitem('ui', 'nontty',
1114 default=False,
1117 default=False,
1115 )
1118 )
1116 coreconfigitem('ui', 'origbackuppath',
1119 coreconfigitem('ui', 'origbackuppath',
1117 default=None,
1120 default=None,
1118 )
1121 )
1119 coreconfigitem('ui', 'paginate',
1122 coreconfigitem('ui', 'paginate',
1120 default=True,
1123 default=True,
1121 )
1124 )
1122 coreconfigitem('ui', 'patch',
1125 coreconfigitem('ui', 'patch',
1123 default=None,
1126 default=None,
1124 )
1127 )
1125 coreconfigitem('ui', 'portablefilenames',
1128 coreconfigitem('ui', 'portablefilenames',
1126 default='warn',
1129 default='warn',
1127 )
1130 )
1128 coreconfigitem('ui', 'promptecho',
1131 coreconfigitem('ui', 'promptecho',
1129 default=False,
1132 default=False,
1130 )
1133 )
1131 coreconfigitem('ui', 'quiet',
1134 coreconfigitem('ui', 'quiet',
1132 default=False,
1135 default=False,
1133 )
1136 )
1134 coreconfigitem('ui', 'quietbookmarkmove',
1137 coreconfigitem('ui', 'quietbookmarkmove',
1135 default=False,
1138 default=False,
1136 )
1139 )
1137 coreconfigitem('ui', 'remotecmd',
1140 coreconfigitem('ui', 'remotecmd',
1138 default='hg',
1141 default='hg',
1139 )
1142 )
1140 coreconfigitem('ui', 'report_untrusted',
1143 coreconfigitem('ui', 'report_untrusted',
1141 default=True,
1144 default=True,
1142 )
1145 )
1143 coreconfigitem('ui', 'rollback',
1146 coreconfigitem('ui', 'rollback',
1144 default=True,
1147 default=True,
1145 )
1148 )
1146 coreconfigitem('ui', 'signal-safe-lock',
1149 coreconfigitem('ui', 'signal-safe-lock',
1147 default=True,
1150 default=True,
1148 )
1151 )
1149 coreconfigitem('ui', 'slash',
1152 coreconfigitem('ui', 'slash',
1150 default=False,
1153 default=False,
1151 )
1154 )
1152 coreconfigitem('ui', 'ssh',
1155 coreconfigitem('ui', 'ssh',
1153 default='ssh',
1156 default='ssh',
1154 )
1157 )
1155 coreconfigitem('ui', 'ssherrorhint',
1158 coreconfigitem('ui', 'ssherrorhint',
1156 default=None,
1159 default=None,
1157 )
1160 )
1158 coreconfigitem('ui', 'statuscopies',
1161 coreconfigitem('ui', 'statuscopies',
1159 default=False,
1162 default=False,
1160 )
1163 )
1161 coreconfigitem('ui', 'strict',
1164 coreconfigitem('ui', 'strict',
1162 default=False,
1165 default=False,
1163 )
1166 )
1164 coreconfigitem('ui', 'style',
1167 coreconfigitem('ui', 'style',
1165 default='',
1168 default='',
1166 )
1169 )
1167 coreconfigitem('ui', 'supportcontact',
1170 coreconfigitem('ui', 'supportcontact',
1168 default=None,
1171 default=None,
1169 )
1172 )
1170 coreconfigitem('ui', 'textwidth',
1173 coreconfigitem('ui', 'textwidth',
1171 default=78,
1174 default=78,
1172 )
1175 )
1173 coreconfigitem('ui', 'timeout',
1176 coreconfigitem('ui', 'timeout',
1174 default='600',
1177 default='600',
1175 )
1178 )
1176 coreconfigitem('ui', 'timeout.warn',
1179 coreconfigitem('ui', 'timeout.warn',
1177 default=0,
1180 default=0,
1178 )
1181 )
1179 coreconfigitem('ui', 'traceback',
1182 coreconfigitem('ui', 'traceback',
1180 default=False,
1183 default=False,
1181 )
1184 )
1182 coreconfigitem('ui', 'tweakdefaults',
1185 coreconfigitem('ui', 'tweakdefaults',
1183 default=False,
1186 default=False,
1184 )
1187 )
1185 coreconfigitem('ui', 'username',
1188 coreconfigitem('ui', 'username',
1186 alias=[('ui', 'user')]
1189 alias=[('ui', 'user')]
1187 )
1190 )
1188 coreconfigitem('ui', 'verbose',
1191 coreconfigitem('ui', 'verbose',
1189 default=False,
1192 default=False,
1190 )
1193 )
1191 coreconfigitem('verify', 'skipflags',
1194 coreconfigitem('verify', 'skipflags',
1192 default=None,
1195 default=None,
1193 )
1196 )
1194 coreconfigitem('web', 'allowbz2',
1197 coreconfigitem('web', 'allowbz2',
1195 default=False,
1198 default=False,
1196 )
1199 )
1197 coreconfigitem('web', 'allowgz',
1200 coreconfigitem('web', 'allowgz',
1198 default=False,
1201 default=False,
1199 )
1202 )
1200 coreconfigitem('web', 'allow-pull',
1203 coreconfigitem('web', 'allow-pull',
1201 alias=[('web', 'allowpull')],
1204 alias=[('web', 'allowpull')],
1202 default=True,
1205 default=True,
1203 )
1206 )
1204 coreconfigitem('web', 'allow-push',
1207 coreconfigitem('web', 'allow-push',
1205 alias=[('web', 'allow_push')],
1208 alias=[('web', 'allow_push')],
1206 default=list,
1209 default=list,
1207 )
1210 )
1208 coreconfigitem('web', 'allowzip',
1211 coreconfigitem('web', 'allowzip',
1209 default=False,
1212 default=False,
1210 )
1213 )
1211 coreconfigitem('web', 'archivesubrepos',
1214 coreconfigitem('web', 'archivesubrepos',
1212 default=False,
1215 default=False,
1213 )
1216 )
1214 coreconfigitem('web', 'cache',
1217 coreconfigitem('web', 'cache',
1215 default=True,
1218 default=True,
1216 )
1219 )
1217 coreconfigitem('web', 'contact',
1220 coreconfigitem('web', 'contact',
1218 default=None,
1221 default=None,
1219 )
1222 )
1220 coreconfigitem('web', 'deny_push',
1223 coreconfigitem('web', 'deny_push',
1221 default=list,
1224 default=list,
1222 )
1225 )
1223 coreconfigitem('web', 'guessmime',
1226 coreconfigitem('web', 'guessmime',
1224 default=False,
1227 default=False,
1225 )
1228 )
1226 coreconfigitem('web', 'hidden',
1229 coreconfigitem('web', 'hidden',
1227 default=False,
1230 default=False,
1228 )
1231 )
1229 coreconfigitem('web', 'labels',
1232 coreconfigitem('web', 'labels',
1230 default=list,
1233 default=list,
1231 )
1234 )
1232 coreconfigitem('web', 'logoimg',
1235 coreconfigitem('web', 'logoimg',
1233 default='hglogo.png',
1236 default='hglogo.png',
1234 )
1237 )
1235 coreconfigitem('web', 'logourl',
1238 coreconfigitem('web', 'logourl',
1236 default='https://mercurial-scm.org/',
1239 default='https://mercurial-scm.org/',
1237 )
1240 )
1238 coreconfigitem('web', 'accesslog',
1241 coreconfigitem('web', 'accesslog',
1239 default='-',
1242 default='-',
1240 )
1243 )
1241 coreconfigitem('web', 'address',
1244 coreconfigitem('web', 'address',
1242 default='',
1245 default='',
1243 )
1246 )
1244 coreconfigitem('web', 'allow-archive',
1247 coreconfigitem('web', 'allow-archive',
1245 alias=[('web', 'allow_archive')],
1248 alias=[('web', 'allow_archive')],
1246 default=list,
1249 default=list,
1247 )
1250 )
1248 coreconfigitem('web', 'allow_read',
1251 coreconfigitem('web', 'allow_read',
1249 default=list,
1252 default=list,
1250 )
1253 )
1251 coreconfigitem('web', 'baseurl',
1254 coreconfigitem('web', 'baseurl',
1252 default=None,
1255 default=None,
1253 )
1256 )
1254 coreconfigitem('web', 'cacerts',
1257 coreconfigitem('web', 'cacerts',
1255 default=None,
1258 default=None,
1256 )
1259 )
1257 coreconfigitem('web', 'certificate',
1260 coreconfigitem('web', 'certificate',
1258 default=None,
1261 default=None,
1259 )
1262 )
1260 coreconfigitem('web', 'collapse',
1263 coreconfigitem('web', 'collapse',
1261 default=False,
1264 default=False,
1262 )
1265 )
1263 coreconfigitem('web', 'csp',
1266 coreconfigitem('web', 'csp',
1264 default=None,
1267 default=None,
1265 )
1268 )
1266 coreconfigitem('web', 'deny_read',
1269 coreconfigitem('web', 'deny_read',
1267 default=list,
1270 default=list,
1268 )
1271 )
1269 coreconfigitem('web', 'descend',
1272 coreconfigitem('web', 'descend',
1270 default=True,
1273 default=True,
1271 )
1274 )
1272 coreconfigitem('web', 'description',
1275 coreconfigitem('web', 'description',
1273 default="",
1276 default="",
1274 )
1277 )
1275 coreconfigitem('web', 'encoding',
1278 coreconfigitem('web', 'encoding',
1276 default=lambda: encoding.encoding,
1279 default=lambda: encoding.encoding,
1277 )
1280 )
1278 coreconfigitem('web', 'errorlog',
1281 coreconfigitem('web', 'errorlog',
1279 default='-',
1282 default='-',
1280 )
1283 )
1281 coreconfigitem('web', 'ipv6',
1284 coreconfigitem('web', 'ipv6',
1282 default=False,
1285 default=False,
1283 )
1286 )
1284 coreconfigitem('web', 'maxchanges',
1287 coreconfigitem('web', 'maxchanges',
1285 default=10,
1288 default=10,
1286 )
1289 )
1287 coreconfigitem('web', 'maxfiles',
1290 coreconfigitem('web', 'maxfiles',
1288 default=10,
1291 default=10,
1289 )
1292 )
1290 coreconfigitem('web', 'maxshortchanges',
1293 coreconfigitem('web', 'maxshortchanges',
1291 default=60,
1294 default=60,
1292 )
1295 )
1293 coreconfigitem('web', 'motd',
1296 coreconfigitem('web', 'motd',
1294 default='',
1297 default='',
1295 )
1298 )
1296 coreconfigitem('web', 'name',
1299 coreconfigitem('web', 'name',
1297 default=dynamicdefault,
1300 default=dynamicdefault,
1298 )
1301 )
1299 coreconfigitem('web', 'port',
1302 coreconfigitem('web', 'port',
1300 default=8000,
1303 default=8000,
1301 )
1304 )
1302 coreconfigitem('web', 'prefix',
1305 coreconfigitem('web', 'prefix',
1303 default='',
1306 default='',
1304 )
1307 )
1305 coreconfigitem('web', 'push_ssl',
1308 coreconfigitem('web', 'push_ssl',
1306 default=True,
1309 default=True,
1307 )
1310 )
1308 coreconfigitem('web', 'refreshinterval',
1311 coreconfigitem('web', 'refreshinterval',
1309 default=20,
1312 default=20,
1310 )
1313 )
1311 coreconfigitem('web', 'server-header',
1314 coreconfigitem('web', 'server-header',
1312 default=None,
1315 default=None,
1313 )
1316 )
1314 coreconfigitem('web', 'staticurl',
1317 coreconfigitem('web', 'staticurl',
1315 default=None,
1318 default=None,
1316 )
1319 )
1317 coreconfigitem('web', 'stripes',
1320 coreconfigitem('web', 'stripes',
1318 default=1,
1321 default=1,
1319 )
1322 )
1320 coreconfigitem('web', 'style',
1323 coreconfigitem('web', 'style',
1321 default='paper',
1324 default='paper',
1322 )
1325 )
1323 coreconfigitem('web', 'templates',
1326 coreconfigitem('web', 'templates',
1324 default=None,
1327 default=None,
1325 )
1328 )
1326 coreconfigitem('web', 'view',
1329 coreconfigitem('web', 'view',
1327 default='served',
1330 default='served',
1328 )
1331 )
1329 coreconfigitem('worker', 'backgroundclose',
1332 coreconfigitem('worker', 'backgroundclose',
1330 default=dynamicdefault,
1333 default=dynamicdefault,
1331 )
1334 )
1332 # Windows defaults to a limit of 512 open files. A buffer of 128
1335 # Windows defaults to a limit of 512 open files. A buffer of 128
1333 # should give us enough headway.
1336 # should give us enough headway.
1334 coreconfigitem('worker', 'backgroundclosemaxqueue',
1337 coreconfigitem('worker', 'backgroundclosemaxqueue',
1335 default=384,
1338 default=384,
1336 )
1339 )
1337 coreconfigitem('worker', 'backgroundcloseminfilecount',
1340 coreconfigitem('worker', 'backgroundcloseminfilecount',
1338 default=2048,
1341 default=2048,
1339 )
1342 )
1340 coreconfigitem('worker', 'backgroundclosethreadcount',
1343 coreconfigitem('worker', 'backgroundclosethreadcount',
1341 default=4,
1344 default=4,
1342 )
1345 )
1343 coreconfigitem('worker', 'enabled',
1346 coreconfigitem('worker', 'enabled',
1344 default=True,
1347 default=True,
1345 )
1348 )
1346 coreconfigitem('worker', 'numcpus',
1349 coreconfigitem('worker', 'numcpus',
1347 default=None,
1350 default=None,
1348 )
1351 )
1349
1352
1350 # Rebase related configuration moved to core because other extension are doing
1353 # Rebase related configuration moved to core because other extension are doing
1351 # strange things. For example, shelve import the extensions to reuse some bit
1354 # strange things. For example, shelve import the extensions to reuse some bit
1352 # without formally loading it.
1355 # without formally loading it.
1353 coreconfigitem('commands', 'rebase.requiredest',
1356 coreconfigitem('commands', 'rebase.requiredest',
1354 default=False,
1357 default=False,
1355 )
1358 )
1356 coreconfigitem('experimental', 'rebaseskipobsolete',
1359 coreconfigitem('experimental', 'rebaseskipobsolete',
1357 default=True,
1360 default=True,
1358 )
1361 )
1359 coreconfigitem('rebase', 'singletransaction',
1362 coreconfigitem('rebase', 'singletransaction',
1360 default=False,
1363 default=False,
1361 )
1364 )
1362 coreconfigitem('rebase', 'experimental.inmemory',
1365 coreconfigitem('rebase', 'experimental.inmemory',
1363 default=False,
1366 default=False,
1364 )
1367 )
@@ -1,2544 +1,2545 b''
1 # context.py - changeset and file context objects for mercurial
1 # context.py - changeset and file context objects for mercurial
2 #
2 #
3 # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import errno
10 import errno
11 import filecmp
11 import filecmp
12 import os
12 import os
13 import stat
13 import stat
14
14
15 from .i18n import _
15 from .i18n import _
16 from .node import (
16 from .node import (
17 addednodeid,
17 addednodeid,
18 bin,
18 bin,
19 hex,
19 hex,
20 modifiednodeid,
20 modifiednodeid,
21 nullid,
21 nullid,
22 nullrev,
22 nullrev,
23 short,
23 short,
24 wdirfilenodeids,
24 wdirfilenodeids,
25 wdirid,
25 wdirid,
26 )
26 )
27 from . import (
27 from . import (
28 dagop,
28 dagop,
29 encoding,
29 encoding,
30 error,
30 error,
31 fileset,
31 fileset,
32 match as matchmod,
32 match as matchmod,
33 obsolete as obsmod,
33 obsolete as obsmod,
34 patch,
34 patch,
35 pathutil,
35 pathutil,
36 phases,
36 phases,
37 pycompat,
37 pycompat,
38 repoview,
38 repoview,
39 revlog,
39 revlog,
40 scmutil,
40 scmutil,
41 sparse,
41 sparse,
42 subrepo,
42 subrepo,
43 subrepoutil,
43 subrepoutil,
44 util,
44 util,
45 )
45 )
46 from .utils import (
46 from .utils import (
47 dateutil,
47 dateutil,
48 stringutil,
48 stringutil,
49 )
49 )
50
50
51 propertycache = util.propertycache
51 propertycache = util.propertycache
52
52
53 class basectx(object):
53 class basectx(object):
54 """A basectx object represents the common logic for its children:
54 """A basectx object represents the common logic for its children:
55 changectx: read-only context that is already present in the repo,
55 changectx: read-only context that is already present in the repo,
56 workingctx: a context that represents the working directory and can
56 workingctx: a context that represents the working directory and can
57 be committed,
57 be committed,
58 memctx: a context that represents changes in-memory and can also
58 memctx: a context that represents changes in-memory and can also
59 be committed."""
59 be committed."""
60
60
61 def __init__(self, repo):
61 def __init__(self, repo):
62 self._repo = repo
62 self._repo = repo
63
63
64 def __bytes__(self):
64 def __bytes__(self):
65 return short(self.node())
65 return short(self.node())
66
66
67 __str__ = encoding.strmethod(__bytes__)
67 __str__ = encoding.strmethod(__bytes__)
68
68
69 def __repr__(self):
69 def __repr__(self):
70 return r"<%s %s>" % (type(self).__name__, str(self))
70 return r"<%s %s>" % (type(self).__name__, str(self))
71
71
72 def __eq__(self, other):
72 def __eq__(self, other):
73 try:
73 try:
74 return type(self) == type(other) and self._rev == other._rev
74 return type(self) == type(other) and self._rev == other._rev
75 except AttributeError:
75 except AttributeError:
76 return False
76 return False
77
77
78 def __ne__(self, other):
78 def __ne__(self, other):
79 return not (self == other)
79 return not (self == other)
80
80
81 def __contains__(self, key):
81 def __contains__(self, key):
82 return key in self._manifest
82 return key in self._manifest
83
83
84 def __getitem__(self, key):
84 def __getitem__(self, key):
85 return self.filectx(key)
85 return self.filectx(key)
86
86
87 def __iter__(self):
87 def __iter__(self):
88 return iter(self._manifest)
88 return iter(self._manifest)
89
89
90 def _buildstatusmanifest(self, status):
90 def _buildstatusmanifest(self, status):
91 """Builds a manifest that includes the given status results, if this is
91 """Builds a manifest that includes the given status results, if this is
92 a working copy context. For non-working copy contexts, it just returns
92 a working copy context. For non-working copy contexts, it just returns
93 the normal manifest."""
93 the normal manifest."""
94 return self.manifest()
94 return self.manifest()
95
95
96 def _matchstatus(self, other, match):
96 def _matchstatus(self, other, match):
97 """This internal method provides a way for child objects to override the
97 """This internal method provides a way for child objects to override the
98 match operator.
98 match operator.
99 """
99 """
100 return match
100 return match
101
101
102 def _buildstatus(self, other, s, match, listignored, listclean,
102 def _buildstatus(self, other, s, match, listignored, listclean,
103 listunknown):
103 listunknown):
104 """build a status with respect to another context"""
104 """build a status with respect to another context"""
105 # Load earliest manifest first for caching reasons. More specifically,
105 # Load earliest manifest first for caching reasons. More specifically,
106 # if you have revisions 1000 and 1001, 1001 is probably stored as a
106 # if you have revisions 1000 and 1001, 1001 is probably stored as a
107 # delta against 1000. Thus, if you read 1000 first, we'll reconstruct
107 # delta against 1000. Thus, if you read 1000 first, we'll reconstruct
108 # 1000 and cache it so that when you read 1001, we just need to apply a
108 # 1000 and cache it so that when you read 1001, we just need to apply a
109 # delta to what's in the cache. So that's one full reconstruction + one
109 # delta to what's in the cache. So that's one full reconstruction + one
110 # delta application.
110 # delta application.
111 mf2 = None
111 mf2 = None
112 if self.rev() is not None and self.rev() < other.rev():
112 if self.rev() is not None and self.rev() < other.rev():
113 mf2 = self._buildstatusmanifest(s)
113 mf2 = self._buildstatusmanifest(s)
114 mf1 = other._buildstatusmanifest(s)
114 mf1 = other._buildstatusmanifest(s)
115 if mf2 is None:
115 if mf2 is None:
116 mf2 = self._buildstatusmanifest(s)
116 mf2 = self._buildstatusmanifest(s)
117
117
118 modified, added = [], []
118 modified, added = [], []
119 removed = []
119 removed = []
120 clean = []
120 clean = []
121 deleted, unknown, ignored = s.deleted, s.unknown, s.ignored
121 deleted, unknown, ignored = s.deleted, s.unknown, s.ignored
122 deletedset = set(deleted)
122 deletedset = set(deleted)
123 d = mf1.diff(mf2, match=match, clean=listclean)
123 d = mf1.diff(mf2, match=match, clean=listclean)
124 for fn, value in d.iteritems():
124 for fn, value in d.iteritems():
125 if fn in deletedset:
125 if fn in deletedset:
126 continue
126 continue
127 if value is None:
127 if value is None:
128 clean.append(fn)
128 clean.append(fn)
129 continue
129 continue
130 (node1, flag1), (node2, flag2) = value
130 (node1, flag1), (node2, flag2) = value
131 if node1 is None:
131 if node1 is None:
132 added.append(fn)
132 added.append(fn)
133 elif node2 is None:
133 elif node2 is None:
134 removed.append(fn)
134 removed.append(fn)
135 elif flag1 != flag2:
135 elif flag1 != flag2:
136 modified.append(fn)
136 modified.append(fn)
137 elif node2 not in wdirfilenodeids:
137 elif node2 not in wdirfilenodeids:
138 # When comparing files between two commits, we save time by
138 # When comparing files between two commits, we save time by
139 # not comparing the file contents when the nodeids differ.
139 # not comparing the file contents when the nodeids differ.
140 # Note that this means we incorrectly report a reverted change
140 # Note that this means we incorrectly report a reverted change
141 # to a file as a modification.
141 # to a file as a modification.
142 modified.append(fn)
142 modified.append(fn)
143 elif self[fn].cmp(other[fn]):
143 elif self[fn].cmp(other[fn]):
144 modified.append(fn)
144 modified.append(fn)
145 else:
145 else:
146 clean.append(fn)
146 clean.append(fn)
147
147
148 if removed:
148 if removed:
149 # need to filter files if they are already reported as removed
149 # need to filter files if they are already reported as removed
150 unknown = [fn for fn in unknown if fn not in mf1 and
150 unknown = [fn for fn in unknown if fn not in mf1 and
151 (not match or match(fn))]
151 (not match or match(fn))]
152 ignored = [fn for fn in ignored if fn not in mf1 and
152 ignored = [fn for fn in ignored if fn not in mf1 and
153 (not match or match(fn))]
153 (not match or match(fn))]
154 # if they're deleted, don't report them as removed
154 # if they're deleted, don't report them as removed
155 removed = [fn for fn in removed if fn not in deletedset]
155 removed = [fn for fn in removed if fn not in deletedset]
156
156
157 return scmutil.status(modified, added, removed, deleted, unknown,
157 return scmutil.status(modified, added, removed, deleted, unknown,
158 ignored, clean)
158 ignored, clean)
159
159
160 @propertycache
160 @propertycache
161 def substate(self):
161 def substate(self):
162 return subrepoutil.state(self, self._repo.ui)
162 return subrepoutil.state(self, self._repo.ui)
163
163
164 def subrev(self, subpath):
164 def subrev(self, subpath):
165 return self.substate[subpath][1]
165 return self.substate[subpath][1]
166
166
167 def rev(self):
167 def rev(self):
168 return self._rev
168 return self._rev
169 def node(self):
169 def node(self):
170 return self._node
170 return self._node
171 def hex(self):
171 def hex(self):
172 return hex(self.node())
172 return hex(self.node())
173 def manifest(self):
173 def manifest(self):
174 return self._manifest
174 return self._manifest
175 def manifestctx(self):
175 def manifestctx(self):
176 return self._manifestctx
176 return self._manifestctx
177 def repo(self):
177 def repo(self):
178 return self._repo
178 return self._repo
179 def phasestr(self):
179 def phasestr(self):
180 return phases.phasenames[self.phase()]
180 return phases.phasenames[self.phase()]
181 def mutable(self):
181 def mutable(self):
182 return self.phase() > phases.public
182 return self.phase() > phases.public
183
183
184 def getfileset(self, expr):
184 def getfileset(self, expr):
185 return fileset.getfileset(self, expr)
185 return fileset.getfileset(self, expr)
186
186
187 def obsolete(self):
187 def obsolete(self):
188 """True if the changeset is obsolete"""
188 """True if the changeset is obsolete"""
189 return self.rev() in obsmod.getrevs(self._repo, 'obsolete')
189 return self.rev() in obsmod.getrevs(self._repo, 'obsolete')
190
190
191 def extinct(self):
191 def extinct(self):
192 """True if the changeset is extinct"""
192 """True if the changeset is extinct"""
193 return self.rev() in obsmod.getrevs(self._repo, 'extinct')
193 return self.rev() in obsmod.getrevs(self._repo, 'extinct')
194
194
195 def orphan(self):
195 def orphan(self):
196 """True if the changeset is not obsolete but it's ancestor are"""
196 """True if the changeset is not obsolete but it's ancestor are"""
197 return self.rev() in obsmod.getrevs(self._repo, 'orphan')
197 return self.rev() in obsmod.getrevs(self._repo, 'orphan')
198
198
199 def phasedivergent(self):
199 def phasedivergent(self):
200 """True if the changeset try to be a successor of a public changeset
200 """True if the changeset try to be a successor of a public changeset
201
201
202 Only non-public and non-obsolete changesets may be bumped.
202 Only non-public and non-obsolete changesets may be bumped.
203 """
203 """
204 return self.rev() in obsmod.getrevs(self._repo, 'phasedivergent')
204 return self.rev() in obsmod.getrevs(self._repo, 'phasedivergent')
205
205
206 def contentdivergent(self):
206 def contentdivergent(self):
207 """Is a successors of a changeset with multiple possible successors set
207 """Is a successors of a changeset with multiple possible successors set
208
208
209 Only non-public and non-obsolete changesets may be divergent.
209 Only non-public and non-obsolete changesets may be divergent.
210 """
210 """
211 return self.rev() in obsmod.getrevs(self._repo, 'contentdivergent')
211 return self.rev() in obsmod.getrevs(self._repo, 'contentdivergent')
212
212
213 def isunstable(self):
213 def isunstable(self):
214 """True if the changeset is either unstable, bumped or divergent"""
214 """True if the changeset is either unstable, bumped or divergent"""
215 return self.orphan() or self.phasedivergent() or self.contentdivergent()
215 return self.orphan() or self.phasedivergent() or self.contentdivergent()
216
216
217 def instabilities(self):
217 def instabilities(self):
218 """return the list of instabilities affecting this changeset.
218 """return the list of instabilities affecting this changeset.
219
219
220 Instabilities are returned as strings. possible values are:
220 Instabilities are returned as strings. possible values are:
221 - orphan,
221 - orphan,
222 - phase-divergent,
222 - phase-divergent,
223 - content-divergent.
223 - content-divergent.
224 """
224 """
225 instabilities = []
225 instabilities = []
226 if self.orphan():
226 if self.orphan():
227 instabilities.append('orphan')
227 instabilities.append('orphan')
228 if self.phasedivergent():
228 if self.phasedivergent():
229 instabilities.append('phase-divergent')
229 instabilities.append('phase-divergent')
230 if self.contentdivergent():
230 if self.contentdivergent():
231 instabilities.append('content-divergent')
231 instabilities.append('content-divergent')
232 return instabilities
232 return instabilities
233
233
234 def parents(self):
234 def parents(self):
235 """return contexts for each parent changeset"""
235 """return contexts for each parent changeset"""
236 return self._parents
236 return self._parents
237
237
238 def p1(self):
238 def p1(self):
239 return self._parents[0]
239 return self._parents[0]
240
240
241 def p2(self):
241 def p2(self):
242 parents = self._parents
242 parents = self._parents
243 if len(parents) == 2:
243 if len(parents) == 2:
244 return parents[1]
244 return parents[1]
245 return changectx(self._repo, nullrev)
245 return changectx(self._repo, nullrev)
246
246
247 def _fileinfo(self, path):
247 def _fileinfo(self, path):
248 if r'_manifest' in self.__dict__:
248 if r'_manifest' in self.__dict__:
249 try:
249 try:
250 return self._manifest[path], self._manifest.flags(path)
250 return self._manifest[path], self._manifest.flags(path)
251 except KeyError:
251 except KeyError:
252 raise error.ManifestLookupError(self._node, path,
252 raise error.ManifestLookupError(self._node, path,
253 _('not found in manifest'))
253 _('not found in manifest'))
254 if r'_manifestdelta' in self.__dict__ or path in self.files():
254 if r'_manifestdelta' in self.__dict__ or path in self.files():
255 if path in self._manifestdelta:
255 if path in self._manifestdelta:
256 return (self._manifestdelta[path],
256 return (self._manifestdelta[path],
257 self._manifestdelta.flags(path))
257 self._manifestdelta.flags(path))
258 mfl = self._repo.manifestlog
258 mfl = self._repo.manifestlog
259 try:
259 try:
260 node, flag = mfl[self._changeset.manifest].find(path)
260 node, flag = mfl[self._changeset.manifest].find(path)
261 except KeyError:
261 except KeyError:
262 raise error.ManifestLookupError(self._node, path,
262 raise error.ManifestLookupError(self._node, path,
263 _('not found in manifest'))
263 _('not found in manifest'))
264
264
265 return node, flag
265 return node, flag
266
266
267 def filenode(self, path):
267 def filenode(self, path):
268 return self._fileinfo(path)[0]
268 return self._fileinfo(path)[0]
269
269
270 def flags(self, path):
270 def flags(self, path):
271 try:
271 try:
272 return self._fileinfo(path)[1]
272 return self._fileinfo(path)[1]
273 except error.LookupError:
273 except error.LookupError:
274 return ''
274 return ''
275
275
276 def sub(self, path, allowcreate=True):
276 def sub(self, path, allowcreate=True):
277 '''return a subrepo for the stored revision of path, never wdir()'''
277 '''return a subrepo for the stored revision of path, never wdir()'''
278 return subrepo.subrepo(self, path, allowcreate=allowcreate)
278 return subrepo.subrepo(self, path, allowcreate=allowcreate)
279
279
280 def nullsub(self, path, pctx):
280 def nullsub(self, path, pctx):
281 return subrepo.nullsubrepo(self, path, pctx)
281 return subrepo.nullsubrepo(self, path, pctx)
282
282
283 def workingsub(self, path):
283 def workingsub(self, path):
284 '''return a subrepo for the stored revision, or wdir if this is a wdir
284 '''return a subrepo for the stored revision, or wdir if this is a wdir
285 context.
285 context.
286 '''
286 '''
287 return subrepo.subrepo(self, path, allowwdir=True)
287 return subrepo.subrepo(self, path, allowwdir=True)
288
288
289 def match(self, pats=None, include=None, exclude=None, default='glob',
289 def match(self, pats=None, include=None, exclude=None, default='glob',
290 listsubrepos=False, badfn=None):
290 listsubrepos=False, badfn=None):
291 r = self._repo
291 r = self._repo
292 return matchmod.match(r.root, r.getcwd(), pats,
292 return matchmod.match(r.root, r.getcwd(), pats,
293 include, exclude, default,
293 include, exclude, default,
294 auditor=r.nofsauditor, ctx=self,
294 auditor=r.nofsauditor, ctx=self,
295 listsubrepos=listsubrepos, badfn=badfn)
295 listsubrepos=listsubrepos, badfn=badfn)
296
296
297 def diff(self, ctx2=None, match=None, changes=None, opts=None,
297 def diff(self, ctx2=None, match=None, changes=None, opts=None,
298 losedatafn=None, prefix='', relroot='', copy=None,
298 losedatafn=None, prefix='', relroot='', copy=None,
299 hunksfilterfn=None):
299 hunksfilterfn=None):
300 """Returns a diff generator for the given contexts and matcher"""
300 """Returns a diff generator for the given contexts and matcher"""
301 if ctx2 is None:
301 if ctx2 is None:
302 ctx2 = self.p1()
302 ctx2 = self.p1()
303 if ctx2 is not None:
303 if ctx2 is not None:
304 ctx2 = self._repo[ctx2]
304 ctx2 = self._repo[ctx2]
305 return patch.diff(self._repo, ctx2, self, match=match, changes=changes,
305 return patch.diff(self._repo, ctx2, self, match=match, changes=changes,
306 opts=opts, losedatafn=losedatafn, prefix=prefix,
306 opts=opts, losedatafn=losedatafn, prefix=prefix,
307 relroot=relroot, copy=copy,
307 relroot=relroot, copy=copy,
308 hunksfilterfn=hunksfilterfn)
308 hunksfilterfn=hunksfilterfn)
309
309
310 def dirs(self):
310 def dirs(self):
311 return self._manifest.dirs()
311 return self._manifest.dirs()
312
312
313 def hasdir(self, dir):
313 def hasdir(self, dir):
314 return self._manifest.hasdir(dir)
314 return self._manifest.hasdir(dir)
315
315
316 def status(self, other=None, match=None, listignored=False,
316 def status(self, other=None, match=None, listignored=False,
317 listclean=False, listunknown=False, listsubrepos=False):
317 listclean=False, listunknown=False, listsubrepos=False):
318 """return status of files between two nodes or node and working
318 """return status of files between two nodes or node and working
319 directory.
319 directory.
320
320
321 If other is None, compare this node with working directory.
321 If other is None, compare this node with working directory.
322
322
323 returns (modified, added, removed, deleted, unknown, ignored, clean)
323 returns (modified, added, removed, deleted, unknown, ignored, clean)
324 """
324 """
325
325
326 ctx1 = self
326 ctx1 = self
327 ctx2 = self._repo[other]
327 ctx2 = self._repo[other]
328
328
329 # This next code block is, admittedly, fragile logic that tests for
329 # This next code block is, admittedly, fragile logic that tests for
330 # reversing the contexts and wouldn't need to exist if it weren't for
330 # reversing the contexts and wouldn't need to exist if it weren't for
331 # the fast (and common) code path of comparing the working directory
331 # the fast (and common) code path of comparing the working directory
332 # with its first parent.
332 # with its first parent.
333 #
333 #
334 # What we're aiming for here is the ability to call:
334 # What we're aiming for here is the ability to call:
335 #
335 #
336 # workingctx.status(parentctx)
336 # workingctx.status(parentctx)
337 #
337 #
338 # If we always built the manifest for each context and compared those,
338 # If we always built the manifest for each context and compared those,
339 # then we'd be done. But the special case of the above call means we
339 # then we'd be done. But the special case of the above call means we
340 # just copy the manifest of the parent.
340 # just copy the manifest of the parent.
341 reversed = False
341 reversed = False
342 if (not isinstance(ctx1, changectx)
342 if (not isinstance(ctx1, changectx)
343 and isinstance(ctx2, changectx)):
343 and isinstance(ctx2, changectx)):
344 reversed = True
344 reversed = True
345 ctx1, ctx2 = ctx2, ctx1
345 ctx1, ctx2 = ctx2, ctx1
346
346
347 match = match or matchmod.always(self._repo.root, self._repo.getcwd())
347 match = match or matchmod.always(self._repo.root, self._repo.getcwd())
348 match = ctx2._matchstatus(ctx1, match)
348 match = ctx2._matchstatus(ctx1, match)
349 r = scmutil.status([], [], [], [], [], [], [])
349 r = scmutil.status([], [], [], [], [], [], [])
350 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean,
350 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean,
351 listunknown)
351 listunknown)
352
352
353 if reversed:
353 if reversed:
354 # Reverse added and removed. Clear deleted, unknown and ignored as
354 # Reverse added and removed. Clear deleted, unknown and ignored as
355 # these make no sense to reverse.
355 # these make no sense to reverse.
356 r = scmutil.status(r.modified, r.removed, r.added, [], [], [],
356 r = scmutil.status(r.modified, r.removed, r.added, [], [], [],
357 r.clean)
357 r.clean)
358
358
359 if listsubrepos:
359 if listsubrepos:
360 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
360 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
361 try:
361 try:
362 rev2 = ctx2.subrev(subpath)
362 rev2 = ctx2.subrev(subpath)
363 except KeyError:
363 except KeyError:
364 # A subrepo that existed in node1 was deleted between
364 # A subrepo that existed in node1 was deleted between
365 # node1 and node2 (inclusive). Thus, ctx2's substate
365 # node1 and node2 (inclusive). Thus, ctx2's substate
366 # won't contain that subpath. The best we can do ignore it.
366 # won't contain that subpath. The best we can do ignore it.
367 rev2 = None
367 rev2 = None
368 submatch = matchmod.subdirmatcher(subpath, match)
368 submatch = matchmod.subdirmatcher(subpath, match)
369 s = sub.status(rev2, match=submatch, ignored=listignored,
369 s = sub.status(rev2, match=submatch, ignored=listignored,
370 clean=listclean, unknown=listunknown,
370 clean=listclean, unknown=listunknown,
371 listsubrepos=True)
371 listsubrepos=True)
372 for rfiles, sfiles in zip(r, s):
372 for rfiles, sfiles in zip(r, s):
373 rfiles.extend("%s/%s" % (subpath, f) for f in sfiles)
373 rfiles.extend("%s/%s" % (subpath, f) for f in sfiles)
374
374
375 for l in r:
375 for l in r:
376 l.sort()
376 l.sort()
377
377
378 return r
378 return r
379
379
380 class changectx(basectx):
380 class changectx(basectx):
381 """A changecontext object makes access to data related to a particular
381 """A changecontext object makes access to data related to a particular
382 changeset convenient. It represents a read-only context already present in
382 changeset convenient. It represents a read-only context already present in
383 the repo."""
383 the repo."""
384 def __init__(self, repo, changeid='.'):
384 def __init__(self, repo, changeid='.'):
385 """changeid is a revision number, node, or tag"""
385 """changeid is a revision number, node, or tag"""
386 super(changectx, self).__init__(repo)
386 super(changectx, self).__init__(repo)
387
387
388 try:
388 try:
389 if isinstance(changeid, int):
389 if isinstance(changeid, int):
390 self._node = repo.changelog.node(changeid)
390 self._node = repo.changelog.node(changeid)
391 self._rev = changeid
391 self._rev = changeid
392 return
392 return
393 elif changeid == 'null':
393 elif changeid == 'null':
394 self._node = nullid
394 self._node = nullid
395 self._rev = nullrev
395 self._rev = nullrev
396 return
396 return
397 elif changeid == 'tip':
397 elif changeid == 'tip':
398 self._node = repo.changelog.tip()
398 self._node = repo.changelog.tip()
399 self._rev = repo.changelog.rev(self._node)
399 self._rev = repo.changelog.rev(self._node)
400 return
400 return
401 elif (changeid == '.'
401 elif (changeid == '.'
402 or repo.local() and changeid == repo.dirstate.p1()):
402 or repo.local() and changeid == repo.dirstate.p1()):
403 # this is a hack to delay/avoid loading obsmarkers
403 # this is a hack to delay/avoid loading obsmarkers
404 # when we know that '.' won't be hidden
404 # when we know that '.' won't be hidden
405 self._node = repo.dirstate.p1()
405 self._node = repo.dirstate.p1()
406 self._rev = repo.unfiltered().changelog.rev(self._node)
406 self._rev = repo.unfiltered().changelog.rev(self._node)
407 return
407 return
408 elif len(changeid) == 20:
408 elif len(changeid) == 20:
409 try:
409 try:
410 self._node = changeid
410 self._node = changeid
411 self._rev = repo.changelog.rev(changeid)
411 self._rev = repo.changelog.rev(changeid)
412 return
412 return
413 except error.FilteredLookupError:
413 except error.FilteredLookupError:
414 raise
414 raise
415 except LookupError:
415 except LookupError:
416 # check if it might have come from damaged dirstate
416 # check if it might have come from damaged dirstate
417 #
417 #
418 # XXX we could avoid the unfiltered if we had a recognizable
418 # XXX we could avoid the unfiltered if we had a recognizable
419 # exception for filtered changeset access
419 # exception for filtered changeset access
420 if (repo.local()
420 if (repo.local()
421 and changeid in repo.unfiltered().dirstate.parents()):
421 and changeid in repo.unfiltered().dirstate.parents()):
422 msg = _("working directory has unknown parent '%s'!")
422 msg = _("working directory has unknown parent '%s'!")
423 raise error.Abort(msg % short(changeid))
423 raise error.Abort(msg % short(changeid))
424 changeid = hex(changeid) # for the error message
424 changeid = hex(changeid) # for the error message
425
425
426 elif len(changeid) == 40:
426 elif len(changeid) == 40:
427 try:
427 try:
428 self._node = bin(changeid)
428 self._node = bin(changeid)
429 self._rev = repo.changelog.rev(self._node)
429 self._rev = repo.changelog.rev(self._node)
430 return
430 return
431 except error.FilteredLookupError:
431 except error.FilteredLookupError:
432 raise
432 raise
433 except (TypeError, LookupError):
433 except (TypeError, LookupError):
434 pass
434 pass
435 else:
435 else:
436 raise error.ProgrammingError(
436 raise error.ProgrammingError(
437 "unsupported changeid '%s' of type %s" %
437 "unsupported changeid '%s' of type %s" %
438 (changeid, type(changeid)))
438 (changeid, type(changeid)))
439
439
440 # lookup failed
440 # lookup failed
441 except (error.FilteredIndexError, error.FilteredLookupError):
441 except (error.FilteredIndexError, error.FilteredLookupError):
442 raise error.FilteredRepoLookupError(_("filtered revision '%s'")
442 raise error.FilteredRepoLookupError(_("filtered revision '%s'")
443 % pycompat.bytestr(changeid))
443 % pycompat.bytestr(changeid))
444 except error.FilteredRepoLookupError:
444 except error.FilteredRepoLookupError:
445 raise
445 raise
446 except IndexError:
446 except IndexError:
447 pass
447 pass
448 raise error.RepoLookupError(
448 raise error.RepoLookupError(
449 _("unknown revision '%s'") % changeid)
449 _("unknown revision '%s'") % changeid)
450
450
451 def __hash__(self):
451 def __hash__(self):
452 try:
452 try:
453 return hash(self._rev)
453 return hash(self._rev)
454 except AttributeError:
454 except AttributeError:
455 return id(self)
455 return id(self)
456
456
457 def __nonzero__(self):
457 def __nonzero__(self):
458 return self._rev != nullrev
458 return self._rev != nullrev
459
459
460 __bool__ = __nonzero__
460 __bool__ = __nonzero__
461
461
462 @propertycache
462 @propertycache
463 def _changeset(self):
463 def _changeset(self):
464 return self._repo.changelog.changelogrevision(self.rev())
464 return self._repo.changelog.changelogrevision(self.rev())
465
465
466 @propertycache
466 @propertycache
467 def _manifest(self):
467 def _manifest(self):
468 return self._manifestctx.read()
468 return self._manifestctx.read()
469
469
470 @property
470 @property
471 def _manifestctx(self):
471 def _manifestctx(self):
472 return self._repo.manifestlog[self._changeset.manifest]
472 return self._repo.manifestlog[self._changeset.manifest]
473
473
474 @propertycache
474 @propertycache
475 def _manifestdelta(self):
475 def _manifestdelta(self):
476 return self._manifestctx.readdelta()
476 return self._manifestctx.readdelta()
477
477
478 @propertycache
478 @propertycache
479 def _parents(self):
479 def _parents(self):
480 repo = self._repo
480 repo = self._repo
481 p1, p2 = repo.changelog.parentrevs(self._rev)
481 p1, p2 = repo.changelog.parentrevs(self._rev)
482 if p2 == nullrev:
482 if p2 == nullrev:
483 return [changectx(repo, p1)]
483 return [changectx(repo, p1)]
484 return [changectx(repo, p1), changectx(repo, p2)]
484 return [changectx(repo, p1), changectx(repo, p2)]
485
485
486 def changeset(self):
486 def changeset(self):
487 c = self._changeset
487 c = self._changeset
488 return (
488 return (
489 c.manifest,
489 c.manifest,
490 c.user,
490 c.user,
491 c.date,
491 c.date,
492 c.files,
492 c.files,
493 c.description,
493 c.description,
494 c.extra,
494 c.extra,
495 )
495 )
496 def manifestnode(self):
496 def manifestnode(self):
497 return self._changeset.manifest
497 return self._changeset.manifest
498
498
499 def user(self):
499 def user(self):
500 return self._changeset.user
500 return self._changeset.user
501 def date(self):
501 def date(self):
502 return self._changeset.date
502 return self._changeset.date
503 def files(self):
503 def files(self):
504 return self._changeset.files
504 return self._changeset.files
505 def description(self):
505 def description(self):
506 return self._changeset.description
506 return self._changeset.description
507 def branch(self):
507 def branch(self):
508 return encoding.tolocal(self._changeset.extra.get("branch"))
508 return encoding.tolocal(self._changeset.extra.get("branch"))
509 def closesbranch(self):
509 def closesbranch(self):
510 return 'close' in self._changeset.extra
510 return 'close' in self._changeset.extra
511 def extra(self):
511 def extra(self):
512 """Return a dict of extra information."""
512 """Return a dict of extra information."""
513 return self._changeset.extra
513 return self._changeset.extra
514 def tags(self):
514 def tags(self):
515 """Return a list of byte tag names"""
515 """Return a list of byte tag names"""
516 return self._repo.nodetags(self._node)
516 return self._repo.nodetags(self._node)
517 def bookmarks(self):
517 def bookmarks(self):
518 """Return a list of byte bookmark names."""
518 """Return a list of byte bookmark names."""
519 return self._repo.nodebookmarks(self._node)
519 return self._repo.nodebookmarks(self._node)
520 def phase(self):
520 def phase(self):
521 return self._repo._phasecache.phase(self._repo, self._rev)
521 return self._repo._phasecache.phase(self._repo, self._rev)
522 def hidden(self):
522 def hidden(self):
523 return self._rev in repoview.filterrevs(self._repo, 'visible')
523 return self._rev in repoview.filterrevs(self._repo, 'visible')
524
524
525 def isinmemory(self):
525 def isinmemory(self):
526 return False
526 return False
527
527
528 def children(self):
528 def children(self):
529 """return list of changectx contexts for each child changeset.
529 """return list of changectx contexts for each child changeset.
530
530
531 This returns only the immediate child changesets. Use descendants() to
531 This returns only the immediate child changesets. Use descendants() to
532 recursively walk children.
532 recursively walk children.
533 """
533 """
534 c = self._repo.changelog.children(self._node)
534 c = self._repo.changelog.children(self._node)
535 return [changectx(self._repo, x) for x in c]
535 return [changectx(self._repo, x) for x in c]
536
536
537 def ancestors(self):
537 def ancestors(self):
538 for a in self._repo.changelog.ancestors([self._rev]):
538 for a in self._repo.changelog.ancestors([self._rev]):
539 yield changectx(self._repo, a)
539 yield changectx(self._repo, a)
540
540
541 def descendants(self):
541 def descendants(self):
542 """Recursively yield all children of the changeset.
542 """Recursively yield all children of the changeset.
543
543
544 For just the immediate children, use children()
544 For just the immediate children, use children()
545 """
545 """
546 for d in self._repo.changelog.descendants([self._rev]):
546 for d in self._repo.changelog.descendants([self._rev]):
547 yield changectx(self._repo, d)
547 yield changectx(self._repo, d)
548
548
549 def filectx(self, path, fileid=None, filelog=None):
549 def filectx(self, path, fileid=None, filelog=None):
550 """get a file context from this changeset"""
550 """get a file context from this changeset"""
551 if fileid is None:
551 if fileid is None:
552 fileid = self.filenode(path)
552 fileid = self.filenode(path)
553 return filectx(self._repo, path, fileid=fileid,
553 return filectx(self._repo, path, fileid=fileid,
554 changectx=self, filelog=filelog)
554 changectx=self, filelog=filelog)
555
555
556 def ancestor(self, c2, warn=False):
556 def ancestor(self, c2, warn=False):
557 """return the "best" ancestor context of self and c2
557 """return the "best" ancestor context of self and c2
558
558
559 If there are multiple candidates, it will show a message and check
559 If there are multiple candidates, it will show a message and check
560 merge.preferancestor configuration before falling back to the
560 merge.preferancestor configuration before falling back to the
561 revlog ancestor."""
561 revlog ancestor."""
562 # deal with workingctxs
562 # deal with workingctxs
563 n2 = c2._node
563 n2 = c2._node
564 if n2 is None:
564 if n2 is None:
565 n2 = c2._parents[0]._node
565 n2 = c2._parents[0]._node
566 cahs = self._repo.changelog.commonancestorsheads(self._node, n2)
566 cahs = self._repo.changelog.commonancestorsheads(self._node, n2)
567 if not cahs:
567 if not cahs:
568 anc = nullid
568 anc = nullid
569 elif len(cahs) == 1:
569 elif len(cahs) == 1:
570 anc = cahs[0]
570 anc = cahs[0]
571 else:
571 else:
572 # experimental config: merge.preferancestor
572 # experimental config: merge.preferancestor
573 for r in self._repo.ui.configlist('merge', 'preferancestor'):
573 for r in self._repo.ui.configlist('merge', 'preferancestor'):
574 try:
574 try:
575 ctx = scmutil.revsymbol(self._repo, r)
575 ctx = scmutil.revsymbol(self._repo, r)
576 except error.RepoLookupError:
576 except error.RepoLookupError:
577 continue
577 continue
578 anc = ctx.node()
578 anc = ctx.node()
579 if anc in cahs:
579 if anc in cahs:
580 break
580 break
581 else:
581 else:
582 anc = self._repo.changelog.ancestor(self._node, n2)
582 anc = self._repo.changelog.ancestor(self._node, n2)
583 if warn:
583 if warn:
584 self._repo.ui.status(
584 self._repo.ui.status(
585 (_("note: using %s as ancestor of %s and %s\n") %
585 (_("note: using %s as ancestor of %s and %s\n") %
586 (short(anc), short(self._node), short(n2))) +
586 (short(anc), short(self._node), short(n2))) +
587 ''.join(_(" alternatively, use --config "
587 ''.join(_(" alternatively, use --config "
588 "merge.preferancestor=%s\n") %
588 "merge.preferancestor=%s\n") %
589 short(n) for n in sorted(cahs) if n != anc))
589 short(n) for n in sorted(cahs) if n != anc))
590 return changectx(self._repo, anc)
590 return changectx(self._repo, anc)
591
591
592 def descendant(self, other):
592 def descendant(self, other):
593 """True if other is descendant of this changeset"""
593 """True if other is descendant of this changeset"""
594 return self._repo.changelog.descendant(self._rev, other._rev)
594 return self._repo.changelog.descendant(self._rev, other._rev)
595
595
596 def walk(self, match):
596 def walk(self, match):
597 '''Generates matching file names.'''
597 '''Generates matching file names.'''
598
598
599 # Wrap match.bad method to have message with nodeid
599 # Wrap match.bad method to have message with nodeid
600 def bad(fn, msg):
600 def bad(fn, msg):
601 # The manifest doesn't know about subrepos, so don't complain about
601 # The manifest doesn't know about subrepos, so don't complain about
602 # paths into valid subrepos.
602 # paths into valid subrepos.
603 if any(fn == s or fn.startswith(s + '/')
603 if any(fn == s or fn.startswith(s + '/')
604 for s in self.substate):
604 for s in self.substate):
605 return
605 return
606 match.bad(fn, _('no such file in rev %s') % self)
606 match.bad(fn, _('no such file in rev %s') % self)
607
607
608 m = matchmod.badmatch(match, bad)
608 m = matchmod.badmatch(match, bad)
609 return self._manifest.walk(m)
609 return self._manifest.walk(m)
610
610
611 def matches(self, match):
611 def matches(self, match):
612 return self.walk(match)
612 return self.walk(match)
613
613
614 class basefilectx(object):
614 class basefilectx(object):
615 """A filecontext object represents the common logic for its children:
615 """A filecontext object represents the common logic for its children:
616 filectx: read-only access to a filerevision that is already present
616 filectx: read-only access to a filerevision that is already present
617 in the repo,
617 in the repo,
618 workingfilectx: a filecontext that represents files from the working
618 workingfilectx: a filecontext that represents files from the working
619 directory,
619 directory,
620 memfilectx: a filecontext that represents files in-memory,
620 memfilectx: a filecontext that represents files in-memory,
621 overlayfilectx: duplicate another filecontext with some fields overridden.
621 overlayfilectx: duplicate another filecontext with some fields overridden.
622 """
622 """
623 @propertycache
623 @propertycache
624 def _filelog(self):
624 def _filelog(self):
625 return self._repo.file(self._path)
625 return self._repo.file(self._path)
626
626
627 @propertycache
627 @propertycache
628 def _changeid(self):
628 def _changeid(self):
629 if r'_changeid' in self.__dict__:
629 if r'_changeid' in self.__dict__:
630 return self._changeid
630 return self._changeid
631 elif r'_changectx' in self.__dict__:
631 elif r'_changectx' in self.__dict__:
632 return self._changectx.rev()
632 return self._changectx.rev()
633 elif r'_descendantrev' in self.__dict__:
633 elif r'_descendantrev' in self.__dict__:
634 # this file context was created from a revision with a known
634 # this file context was created from a revision with a known
635 # descendant, we can (lazily) correct for linkrev aliases
635 # descendant, we can (lazily) correct for linkrev aliases
636 return self._adjustlinkrev(self._descendantrev)
636 return self._adjustlinkrev(self._descendantrev)
637 else:
637 else:
638 return self._filelog.linkrev(self._filerev)
638 return self._filelog.linkrev(self._filerev)
639
639
640 @propertycache
640 @propertycache
641 def _filenode(self):
641 def _filenode(self):
642 if r'_fileid' in self.__dict__:
642 if r'_fileid' in self.__dict__:
643 return self._filelog.lookup(self._fileid)
643 return self._filelog.lookup(self._fileid)
644 else:
644 else:
645 return self._changectx.filenode(self._path)
645 return self._changectx.filenode(self._path)
646
646
647 @propertycache
647 @propertycache
648 def _filerev(self):
648 def _filerev(self):
649 return self._filelog.rev(self._filenode)
649 return self._filelog.rev(self._filenode)
650
650
651 @propertycache
651 @propertycache
652 def _repopath(self):
652 def _repopath(self):
653 return self._path
653 return self._path
654
654
655 def __nonzero__(self):
655 def __nonzero__(self):
656 try:
656 try:
657 self._filenode
657 self._filenode
658 return True
658 return True
659 except error.LookupError:
659 except error.LookupError:
660 # file is missing
660 # file is missing
661 return False
661 return False
662
662
663 __bool__ = __nonzero__
663 __bool__ = __nonzero__
664
664
665 def __bytes__(self):
665 def __bytes__(self):
666 try:
666 try:
667 return "%s@%s" % (self.path(), self._changectx)
667 return "%s@%s" % (self.path(), self._changectx)
668 except error.LookupError:
668 except error.LookupError:
669 return "%s@???" % self.path()
669 return "%s@???" % self.path()
670
670
671 __str__ = encoding.strmethod(__bytes__)
671 __str__ = encoding.strmethod(__bytes__)
672
672
673 def __repr__(self):
673 def __repr__(self):
674 return r"<%s %s>" % (type(self).__name__, str(self))
674 return r"<%s %s>" % (type(self).__name__, str(self))
675
675
676 def __hash__(self):
676 def __hash__(self):
677 try:
677 try:
678 return hash((self._path, self._filenode))
678 return hash((self._path, self._filenode))
679 except AttributeError:
679 except AttributeError:
680 return id(self)
680 return id(self)
681
681
682 def __eq__(self, other):
682 def __eq__(self, other):
683 try:
683 try:
684 return (type(self) == type(other) and self._path == other._path
684 return (type(self) == type(other) and self._path == other._path
685 and self._filenode == other._filenode)
685 and self._filenode == other._filenode)
686 except AttributeError:
686 except AttributeError:
687 return False
687 return False
688
688
689 def __ne__(self, other):
689 def __ne__(self, other):
690 return not (self == other)
690 return not (self == other)
691
691
692 def filerev(self):
692 def filerev(self):
693 return self._filerev
693 return self._filerev
694 def filenode(self):
694 def filenode(self):
695 return self._filenode
695 return self._filenode
696 @propertycache
696 @propertycache
697 def _flags(self):
697 def _flags(self):
698 return self._changectx.flags(self._path)
698 return self._changectx.flags(self._path)
699 def flags(self):
699 def flags(self):
700 return self._flags
700 return self._flags
701 def filelog(self):
701 def filelog(self):
702 return self._filelog
702 return self._filelog
703 def rev(self):
703 def rev(self):
704 return self._changeid
704 return self._changeid
705 def linkrev(self):
705 def linkrev(self):
706 return self._filelog.linkrev(self._filerev)
706 return self._filelog.linkrev(self._filerev)
707 def node(self):
707 def node(self):
708 return self._changectx.node()
708 return self._changectx.node()
709 def hex(self):
709 def hex(self):
710 return self._changectx.hex()
710 return self._changectx.hex()
711 def user(self):
711 def user(self):
712 return self._changectx.user()
712 return self._changectx.user()
713 def date(self):
713 def date(self):
714 return self._changectx.date()
714 return self._changectx.date()
715 def files(self):
715 def files(self):
716 return self._changectx.files()
716 return self._changectx.files()
717 def description(self):
717 def description(self):
718 return self._changectx.description()
718 return self._changectx.description()
719 def branch(self):
719 def branch(self):
720 return self._changectx.branch()
720 return self._changectx.branch()
721 def extra(self):
721 def extra(self):
722 return self._changectx.extra()
722 return self._changectx.extra()
723 def phase(self):
723 def phase(self):
724 return self._changectx.phase()
724 return self._changectx.phase()
725 def phasestr(self):
725 def phasestr(self):
726 return self._changectx.phasestr()
726 return self._changectx.phasestr()
727 def obsolete(self):
727 def obsolete(self):
728 return self._changectx.obsolete()
728 return self._changectx.obsolete()
729 def instabilities(self):
729 def instabilities(self):
730 return self._changectx.instabilities()
730 return self._changectx.instabilities()
731 def manifest(self):
731 def manifest(self):
732 return self._changectx.manifest()
732 return self._changectx.manifest()
733 def changectx(self):
733 def changectx(self):
734 return self._changectx
734 return self._changectx
735 def renamed(self):
735 def renamed(self):
736 return self._copied
736 return self._copied
737 def repo(self):
737 def repo(self):
738 return self._repo
738 return self._repo
739 def size(self):
739 def size(self):
740 return len(self.data())
740 return len(self.data())
741
741
742 def path(self):
742 def path(self):
743 return self._path
743 return self._path
744
744
745 def isbinary(self):
745 def isbinary(self):
746 try:
746 try:
747 return stringutil.binary(self.data())
747 return stringutil.binary(self.data())
748 except IOError:
748 except IOError:
749 return False
749 return False
750 def isexec(self):
750 def isexec(self):
751 return 'x' in self.flags()
751 return 'x' in self.flags()
752 def islink(self):
752 def islink(self):
753 return 'l' in self.flags()
753 return 'l' in self.flags()
754
754
755 def isabsent(self):
755 def isabsent(self):
756 """whether this filectx represents a file not in self._changectx
756 """whether this filectx represents a file not in self._changectx
757
757
758 This is mainly for merge code to detect change/delete conflicts. This is
758 This is mainly for merge code to detect change/delete conflicts. This is
759 expected to be True for all subclasses of basectx."""
759 expected to be True for all subclasses of basectx."""
760 return False
760 return False
761
761
762 _customcmp = False
762 _customcmp = False
763 def cmp(self, fctx):
763 def cmp(self, fctx):
764 """compare with other file context
764 """compare with other file context
765
765
766 returns True if different than fctx.
766 returns True if different than fctx.
767 """
767 """
768 if fctx._customcmp:
768 if fctx._customcmp:
769 return fctx.cmp(self)
769 return fctx.cmp(self)
770
770
771 if (fctx._filenode is None
771 if (fctx._filenode is None
772 and (self._repo._encodefilterpats
772 and (self._repo._encodefilterpats
773 # if file data starts with '\1\n', empty metadata block is
773 # if file data starts with '\1\n', empty metadata block is
774 # prepended, which adds 4 bytes to filelog.size().
774 # prepended, which adds 4 bytes to filelog.size().
775 or self.size() - 4 == fctx.size())
775 or self.size() - 4 == fctx.size())
776 or self.size() == fctx.size()):
776 or self.size() == fctx.size()):
777 return self._filelog.cmp(self._filenode, fctx.data())
777 return self._filelog.cmp(self._filenode, fctx.data())
778
778
779 return True
779 return True
780
780
781 def _adjustlinkrev(self, srcrev, inclusive=False):
781 def _adjustlinkrev(self, srcrev, inclusive=False):
782 """return the first ancestor of <srcrev> introducing <fnode>
782 """return the first ancestor of <srcrev> introducing <fnode>
783
783
784 If the linkrev of the file revision does not point to an ancestor of
784 If the linkrev of the file revision does not point to an ancestor of
785 srcrev, we'll walk down the ancestors until we find one introducing
785 srcrev, we'll walk down the ancestors until we find one introducing
786 this file revision.
786 this file revision.
787
787
788 :srcrev: the changeset revision we search ancestors from
788 :srcrev: the changeset revision we search ancestors from
789 :inclusive: if true, the src revision will also be checked
789 :inclusive: if true, the src revision will also be checked
790 """
790 """
791 repo = self._repo
791 repo = self._repo
792 cl = repo.unfiltered().changelog
792 cl = repo.unfiltered().changelog
793 mfl = repo.manifestlog
793 mfl = repo.manifestlog
794 # fetch the linkrev
794 # fetch the linkrev
795 lkr = self.linkrev()
795 lkr = self.linkrev()
796 # hack to reuse ancestor computation when searching for renames
796 # hack to reuse ancestor computation when searching for renames
797 memberanc = getattr(self, '_ancestrycontext', None)
797 memberanc = getattr(self, '_ancestrycontext', None)
798 iteranc = None
798 iteranc = None
799 if srcrev is None:
799 if srcrev is None:
800 # wctx case, used by workingfilectx during mergecopy
800 # wctx case, used by workingfilectx during mergecopy
801 revs = [p.rev() for p in self._repo[None].parents()]
801 revs = [p.rev() for p in self._repo[None].parents()]
802 inclusive = True # we skipped the real (revless) source
802 inclusive = True # we skipped the real (revless) source
803 else:
803 else:
804 revs = [srcrev]
804 revs = [srcrev]
805 if memberanc is None:
805 if memberanc is None:
806 memberanc = iteranc = cl.ancestors(revs, lkr,
806 memberanc = iteranc = cl.ancestors(revs, lkr,
807 inclusive=inclusive)
807 inclusive=inclusive)
808 # check if this linkrev is an ancestor of srcrev
808 # check if this linkrev is an ancestor of srcrev
809 if lkr not in memberanc:
809 if lkr not in memberanc:
810 if iteranc is None:
810 if iteranc is None:
811 iteranc = cl.ancestors(revs, lkr, inclusive=inclusive)
811 iteranc = cl.ancestors(revs, lkr, inclusive=inclusive)
812 fnode = self._filenode
812 fnode = self._filenode
813 path = self._path
813 path = self._path
814 for a in iteranc:
814 for a in iteranc:
815 ac = cl.read(a) # get changeset data (we avoid object creation)
815 ac = cl.read(a) # get changeset data (we avoid object creation)
816 if path in ac[3]: # checking the 'files' field.
816 if path in ac[3]: # checking the 'files' field.
817 # The file has been touched, check if the content is
817 # The file has been touched, check if the content is
818 # similar to the one we search for.
818 # similar to the one we search for.
819 if fnode == mfl[ac[0]].readfast().get(path):
819 if fnode == mfl[ac[0]].readfast().get(path):
820 return a
820 return a
821 # In theory, we should never get out of that loop without a result.
821 # In theory, we should never get out of that loop without a result.
822 # But if manifest uses a buggy file revision (not children of the
822 # But if manifest uses a buggy file revision (not children of the
823 # one it replaces) we could. Such a buggy situation will likely
823 # one it replaces) we could. Such a buggy situation will likely
824 # result is crash somewhere else at to some point.
824 # result is crash somewhere else at to some point.
825 return lkr
825 return lkr
826
826
827 def introrev(self):
827 def introrev(self):
828 """return the rev of the changeset which introduced this file revision
828 """return the rev of the changeset which introduced this file revision
829
829
830 This method is different from linkrev because it take into account the
830 This method is different from linkrev because it take into account the
831 changeset the filectx was created from. It ensures the returned
831 changeset the filectx was created from. It ensures the returned
832 revision is one of its ancestors. This prevents bugs from
832 revision is one of its ancestors. This prevents bugs from
833 'linkrev-shadowing' when a file revision is used by multiple
833 'linkrev-shadowing' when a file revision is used by multiple
834 changesets.
834 changesets.
835 """
835 """
836 lkr = self.linkrev()
836 lkr = self.linkrev()
837 attrs = vars(self)
837 attrs = vars(self)
838 noctx = not (r'_changeid' in attrs or r'_changectx' in attrs)
838 noctx = not (r'_changeid' in attrs or r'_changectx' in attrs)
839 if noctx or self.rev() == lkr:
839 if noctx or self.rev() == lkr:
840 return self.linkrev()
840 return self.linkrev()
841 return self._adjustlinkrev(self.rev(), inclusive=True)
841 return self._adjustlinkrev(self.rev(), inclusive=True)
842
842
843 def introfilectx(self):
843 def introfilectx(self):
844 """Return filectx having identical contents, but pointing to the
844 """Return filectx having identical contents, but pointing to the
845 changeset revision where this filectx was introduced"""
845 changeset revision where this filectx was introduced"""
846 introrev = self.introrev()
846 introrev = self.introrev()
847 if self.rev() == introrev:
847 if self.rev() == introrev:
848 return self
848 return self
849 return self.filectx(self.filenode(), changeid=introrev)
849 return self.filectx(self.filenode(), changeid=introrev)
850
850
851 def _parentfilectx(self, path, fileid, filelog):
851 def _parentfilectx(self, path, fileid, filelog):
852 """create parent filectx keeping ancestry info for _adjustlinkrev()"""
852 """create parent filectx keeping ancestry info for _adjustlinkrev()"""
853 fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog)
853 fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog)
854 if r'_changeid' in vars(self) or r'_changectx' in vars(self):
854 if r'_changeid' in vars(self) or r'_changectx' in vars(self):
855 # If self is associated with a changeset (probably explicitly
855 # If self is associated with a changeset (probably explicitly
856 # fed), ensure the created filectx is associated with a
856 # fed), ensure the created filectx is associated with a
857 # changeset that is an ancestor of self.changectx.
857 # changeset that is an ancestor of self.changectx.
858 # This lets us later use _adjustlinkrev to get a correct link.
858 # This lets us later use _adjustlinkrev to get a correct link.
859 fctx._descendantrev = self.rev()
859 fctx._descendantrev = self.rev()
860 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)
860 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)
861 elif r'_descendantrev' in vars(self):
861 elif r'_descendantrev' in vars(self):
862 # Otherwise propagate _descendantrev if we have one associated.
862 # Otherwise propagate _descendantrev if we have one associated.
863 fctx._descendantrev = self._descendantrev
863 fctx._descendantrev = self._descendantrev
864 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)
864 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)
865 return fctx
865 return fctx
866
866
867 def parents(self):
867 def parents(self):
868 _path = self._path
868 _path = self._path
869 fl = self._filelog
869 fl = self._filelog
870 parents = self._filelog.parents(self._filenode)
870 parents = self._filelog.parents(self._filenode)
871 pl = [(_path, node, fl) for node in parents if node != nullid]
871 pl = [(_path, node, fl) for node in parents if node != nullid]
872
872
873 r = fl.renamed(self._filenode)
873 r = fl.renamed(self._filenode)
874 if r:
874 if r:
875 # - In the simple rename case, both parent are nullid, pl is empty.
875 # - In the simple rename case, both parent are nullid, pl is empty.
876 # - In case of merge, only one of the parent is null id and should
876 # - In case of merge, only one of the parent is null id and should
877 # be replaced with the rename information. This parent is -always-
877 # be replaced with the rename information. This parent is -always-
878 # the first one.
878 # the first one.
879 #
879 #
880 # As null id have always been filtered out in the previous list
880 # As null id have always been filtered out in the previous list
881 # comprehension, inserting to 0 will always result in "replacing
881 # comprehension, inserting to 0 will always result in "replacing
882 # first nullid parent with rename information.
882 # first nullid parent with rename information.
883 pl.insert(0, (r[0], r[1], self._repo.file(r[0])))
883 pl.insert(0, (r[0], r[1], self._repo.file(r[0])))
884
884
885 return [self._parentfilectx(path, fnode, l) for path, fnode, l in pl]
885 return [self._parentfilectx(path, fnode, l) for path, fnode, l in pl]
886
886
887 def p1(self):
887 def p1(self):
888 return self.parents()[0]
888 return self.parents()[0]
889
889
890 def p2(self):
890 def p2(self):
891 p = self.parents()
891 p = self.parents()
892 if len(p) == 2:
892 if len(p) == 2:
893 return p[1]
893 return p[1]
894 return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog)
894 return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog)
895
895
896 def annotate(self, follow=False, skiprevs=None, diffopts=None):
896 def annotate(self, follow=False, skiprevs=None, diffopts=None):
897 """Returns a list of annotateline objects for each line in the file
897 """Returns a list of annotateline objects for each line in the file
898
898
899 - line.fctx is the filectx of the node where that line was last changed
899 - line.fctx is the filectx of the node where that line was last changed
900 - line.lineno is the line number at the first appearance in the managed
900 - line.lineno is the line number at the first appearance in the managed
901 file
901 file
902 - line.text is the data on that line (including newline character)
902 - line.text is the data on that line (including newline character)
903 """
903 """
904 getlog = util.lrucachefunc(lambda x: self._repo.file(x))
904 getlog = util.lrucachefunc(lambda x: self._repo.file(x))
905
905
906 def parents(f):
906 def parents(f):
907 # Cut _descendantrev here to mitigate the penalty of lazy linkrev
907 # Cut _descendantrev here to mitigate the penalty of lazy linkrev
908 # adjustment. Otherwise, p._adjustlinkrev() would walk changelog
908 # adjustment. Otherwise, p._adjustlinkrev() would walk changelog
909 # from the topmost introrev (= srcrev) down to p.linkrev() if it
909 # from the topmost introrev (= srcrev) down to p.linkrev() if it
910 # isn't an ancestor of the srcrev.
910 # isn't an ancestor of the srcrev.
911 f._changeid
911 f._changeid
912 pl = f.parents()
912 pl = f.parents()
913
913
914 # Don't return renamed parents if we aren't following.
914 # Don't return renamed parents if we aren't following.
915 if not follow:
915 if not follow:
916 pl = [p for p in pl if p.path() == f.path()]
916 pl = [p for p in pl if p.path() == f.path()]
917
917
918 # renamed filectx won't have a filelog yet, so set it
918 # renamed filectx won't have a filelog yet, so set it
919 # from the cache to save time
919 # from the cache to save time
920 for p in pl:
920 for p in pl:
921 if not r'_filelog' in p.__dict__:
921 if not r'_filelog' in p.__dict__:
922 p._filelog = getlog(p.path())
922 p._filelog = getlog(p.path())
923
923
924 return pl
924 return pl
925
925
926 # use linkrev to find the first changeset where self appeared
926 # use linkrev to find the first changeset where self appeared
927 base = self.introfilectx()
927 base = self.introfilectx()
928 if getattr(base, '_ancestrycontext', None) is None:
928 if getattr(base, '_ancestrycontext', None) is None:
929 cl = self._repo.changelog
929 cl = self._repo.changelog
930 if base.rev() is None:
930 if base.rev() is None:
931 # wctx is not inclusive, but works because _ancestrycontext
931 # wctx is not inclusive, but works because _ancestrycontext
932 # is used to test filelog revisions
932 # is used to test filelog revisions
933 ac = cl.ancestors([p.rev() for p in base.parents()],
933 ac = cl.ancestors([p.rev() for p in base.parents()],
934 inclusive=True)
934 inclusive=True)
935 else:
935 else:
936 ac = cl.ancestors([base.rev()], inclusive=True)
936 ac = cl.ancestors([base.rev()], inclusive=True)
937 base._ancestrycontext = ac
937 base._ancestrycontext = ac
938
938
939 return dagop.annotate(base, parents, skiprevs=skiprevs,
939 return dagop.annotate(base, parents, skiprevs=skiprevs,
940 diffopts=diffopts)
940 diffopts=diffopts)
941
941
942 def ancestors(self, followfirst=False):
942 def ancestors(self, followfirst=False):
943 visit = {}
943 visit = {}
944 c = self
944 c = self
945 if followfirst:
945 if followfirst:
946 cut = 1
946 cut = 1
947 else:
947 else:
948 cut = None
948 cut = None
949
949
950 while True:
950 while True:
951 for parent in c.parents()[:cut]:
951 for parent in c.parents()[:cut]:
952 visit[(parent.linkrev(), parent.filenode())] = parent
952 visit[(parent.linkrev(), parent.filenode())] = parent
953 if not visit:
953 if not visit:
954 break
954 break
955 c = visit.pop(max(visit))
955 c = visit.pop(max(visit))
956 yield c
956 yield c
957
957
958 def decodeddata(self):
958 def decodeddata(self):
959 """Returns `data()` after running repository decoding filters.
959 """Returns `data()` after running repository decoding filters.
960
960
961 This is often equivalent to how the data would be expressed on disk.
961 This is often equivalent to how the data would be expressed on disk.
962 """
962 """
963 return self._repo.wwritedata(self.path(), self.data())
963 return self._repo.wwritedata(self.path(), self.data())
964
964
965 class filectx(basefilectx):
965 class filectx(basefilectx):
966 """A filecontext object makes access to data related to a particular
966 """A filecontext object makes access to data related to a particular
967 filerevision convenient."""
967 filerevision convenient."""
968 def __init__(self, repo, path, changeid=None, fileid=None,
968 def __init__(self, repo, path, changeid=None, fileid=None,
969 filelog=None, changectx=None):
969 filelog=None, changectx=None):
970 """changeid can be a changeset revision, node, or tag.
970 """changeid can be a changeset revision, node, or tag.
971 fileid can be a file revision or node."""
971 fileid can be a file revision or node."""
972 self._repo = repo
972 self._repo = repo
973 self._path = path
973 self._path = path
974
974
975 assert (changeid is not None
975 assert (changeid is not None
976 or fileid is not None
976 or fileid is not None
977 or changectx is not None), \
977 or changectx is not None), \
978 ("bad args: changeid=%r, fileid=%r, changectx=%r"
978 ("bad args: changeid=%r, fileid=%r, changectx=%r"
979 % (changeid, fileid, changectx))
979 % (changeid, fileid, changectx))
980
980
981 if filelog is not None:
981 if filelog is not None:
982 self._filelog = filelog
982 self._filelog = filelog
983
983
984 if changeid is not None:
984 if changeid is not None:
985 self._changeid = changeid
985 self._changeid = changeid
986 if changectx is not None:
986 if changectx is not None:
987 self._changectx = changectx
987 self._changectx = changectx
988 if fileid is not None:
988 if fileid is not None:
989 self._fileid = fileid
989 self._fileid = fileid
990
990
991 @propertycache
991 @propertycache
992 def _changectx(self):
992 def _changectx(self):
993 try:
993 try:
994 return changectx(self._repo, self._changeid)
994 return changectx(self._repo, self._changeid)
995 except error.FilteredRepoLookupError:
995 except error.FilteredRepoLookupError:
996 # Linkrev may point to any revision in the repository. When the
996 # Linkrev may point to any revision in the repository. When the
997 # repository is filtered this may lead to `filectx` trying to build
997 # repository is filtered this may lead to `filectx` trying to build
998 # `changectx` for filtered revision. In such case we fallback to
998 # `changectx` for filtered revision. In such case we fallback to
999 # creating `changectx` on the unfiltered version of the reposition.
999 # creating `changectx` on the unfiltered version of the reposition.
1000 # This fallback should not be an issue because `changectx` from
1000 # This fallback should not be an issue because `changectx` from
1001 # `filectx` are not used in complex operations that care about
1001 # `filectx` are not used in complex operations that care about
1002 # filtering.
1002 # filtering.
1003 #
1003 #
1004 # This fallback is a cheap and dirty fix that prevent several
1004 # This fallback is a cheap and dirty fix that prevent several
1005 # crashes. It does not ensure the behavior is correct. However the
1005 # crashes. It does not ensure the behavior is correct. However the
1006 # behavior was not correct before filtering either and "incorrect
1006 # behavior was not correct before filtering either and "incorrect
1007 # behavior" is seen as better as "crash"
1007 # behavior" is seen as better as "crash"
1008 #
1008 #
1009 # Linkrevs have several serious troubles with filtering that are
1009 # Linkrevs have several serious troubles with filtering that are
1010 # complicated to solve. Proper handling of the issue here should be
1010 # complicated to solve. Proper handling of the issue here should be
1011 # considered when solving linkrev issue are on the table.
1011 # considered when solving linkrev issue are on the table.
1012 return changectx(self._repo.unfiltered(), self._changeid)
1012 return changectx(self._repo.unfiltered(), self._changeid)
1013
1013
1014 def filectx(self, fileid, changeid=None):
1014 def filectx(self, fileid, changeid=None):
1015 '''opens an arbitrary revision of the file without
1015 '''opens an arbitrary revision of the file without
1016 opening a new filelog'''
1016 opening a new filelog'''
1017 return filectx(self._repo, self._path, fileid=fileid,
1017 return filectx(self._repo, self._path, fileid=fileid,
1018 filelog=self._filelog, changeid=changeid)
1018 filelog=self._filelog, changeid=changeid)
1019
1019
1020 def rawdata(self):
1020 def rawdata(self):
1021 return self._filelog.revision(self._filenode, raw=True)
1021 return self._filelog.revision(self._filenode, raw=True)
1022
1022
1023 def rawflags(self):
1023 def rawflags(self):
1024 """low-level revlog flags"""
1024 """low-level revlog flags"""
1025 return self._filelog.flags(self._filerev)
1025 return self._filelog.flags(self._filerev)
1026
1026
1027 def data(self):
1027 def data(self):
1028 try:
1028 try:
1029 return self._filelog.read(self._filenode)
1029 return self._filelog.read(self._filenode)
1030 except error.CensoredNodeError:
1030 except error.CensoredNodeError:
1031 if self._repo.ui.config("censor", "policy") == "ignore":
1031 if self._repo.ui.config("censor", "policy") == "ignore":
1032 return ""
1032 return ""
1033 raise error.Abort(_("censored node: %s") % short(self._filenode),
1033 raise error.Abort(_("censored node: %s") % short(self._filenode),
1034 hint=_("set censor.policy to ignore errors"))
1034 hint=_("set censor.policy to ignore errors"))
1035
1035
1036 def size(self):
1036 def size(self):
1037 return self._filelog.size(self._filerev)
1037 return self._filelog.size(self._filerev)
1038
1038
1039 @propertycache
1039 @propertycache
1040 def _copied(self):
1040 def _copied(self):
1041 """check if file was actually renamed in this changeset revision
1041 """check if file was actually renamed in this changeset revision
1042
1042
1043 If rename logged in file revision, we report copy for changeset only
1043 If rename logged in file revision, we report copy for changeset only
1044 if file revisions linkrev points back to the changeset in question
1044 if file revisions linkrev points back to the changeset in question
1045 or both changeset parents contain different file revisions.
1045 or both changeset parents contain different file revisions.
1046 """
1046 """
1047
1047
1048 renamed = self._filelog.renamed(self._filenode)
1048 renamed = self._filelog.renamed(self._filenode)
1049 if not renamed:
1049 if not renamed:
1050 return renamed
1050 return renamed
1051
1051
1052 if self.rev() == self.linkrev():
1052 if self.rev() == self.linkrev():
1053 return renamed
1053 return renamed
1054
1054
1055 name = self.path()
1055 name = self.path()
1056 fnode = self._filenode
1056 fnode = self._filenode
1057 for p in self._changectx.parents():
1057 for p in self._changectx.parents():
1058 try:
1058 try:
1059 if fnode == p.filenode(name):
1059 if fnode == p.filenode(name):
1060 return None
1060 return None
1061 except error.LookupError:
1061 except error.LookupError:
1062 pass
1062 pass
1063 return renamed
1063 return renamed
1064
1064
1065 def children(self):
1065 def children(self):
1066 # hard for renames
1066 # hard for renames
1067 c = self._filelog.children(self._filenode)
1067 c = self._filelog.children(self._filenode)
1068 return [filectx(self._repo, self._path, fileid=x,
1068 return [filectx(self._repo, self._path, fileid=x,
1069 filelog=self._filelog) for x in c]
1069 filelog=self._filelog) for x in c]
1070
1070
1071 class committablectx(basectx):
1071 class committablectx(basectx):
1072 """A committablectx object provides common functionality for a context that
1072 """A committablectx object provides common functionality for a context that
1073 wants the ability to commit, e.g. workingctx or memctx."""
1073 wants the ability to commit, e.g. workingctx or memctx."""
1074 def __init__(self, repo, text="", user=None, date=None, extra=None,
1074 def __init__(self, repo, text="", user=None, date=None, extra=None,
1075 changes=None):
1075 changes=None):
1076 super(committablectx, self).__init__(repo)
1076 super(committablectx, self).__init__(repo)
1077 self._rev = None
1077 self._rev = None
1078 self._node = None
1078 self._node = None
1079 self._text = text
1079 self._text = text
1080 if date:
1080 if date:
1081 self._date = dateutil.parsedate(date)
1081 self._date = dateutil.parsedate(date)
1082 if user:
1082 if user:
1083 self._user = user
1083 self._user = user
1084 if changes:
1084 if changes:
1085 self._status = changes
1085 self._status = changes
1086
1086
1087 self._extra = {}
1087 self._extra = {}
1088 if extra:
1088 if extra:
1089 self._extra = extra.copy()
1089 self._extra = extra.copy()
1090 if 'branch' not in self._extra:
1090 if 'branch' not in self._extra:
1091 try:
1091 try:
1092 branch = encoding.fromlocal(self._repo.dirstate.branch())
1092 branch = encoding.fromlocal(self._repo.dirstate.branch())
1093 except UnicodeDecodeError:
1093 except UnicodeDecodeError:
1094 raise error.Abort(_('branch name not in UTF-8!'))
1094 raise error.Abort(_('branch name not in UTF-8!'))
1095 self._extra['branch'] = branch
1095 self._extra['branch'] = branch
1096 if self._extra['branch'] == '':
1096 if self._extra['branch'] == '':
1097 self._extra['branch'] = 'default'
1097 self._extra['branch'] = 'default'
1098
1098
1099 def __bytes__(self):
1099 def __bytes__(self):
1100 return bytes(self._parents[0]) + "+"
1100 return bytes(self._parents[0]) + "+"
1101
1101
1102 __str__ = encoding.strmethod(__bytes__)
1102 __str__ = encoding.strmethod(__bytes__)
1103
1103
1104 def __nonzero__(self):
1104 def __nonzero__(self):
1105 return True
1105 return True
1106
1106
1107 __bool__ = __nonzero__
1107 __bool__ = __nonzero__
1108
1108
1109 def _buildflagfunc(self):
1109 def _buildflagfunc(self):
1110 # Create a fallback function for getting file flags when the
1110 # Create a fallback function for getting file flags when the
1111 # filesystem doesn't support them
1111 # filesystem doesn't support them
1112
1112
1113 copiesget = self._repo.dirstate.copies().get
1113 copiesget = self._repo.dirstate.copies().get
1114 parents = self.parents()
1114 parents = self.parents()
1115 if len(parents) < 2:
1115 if len(parents) < 2:
1116 # when we have one parent, it's easy: copy from parent
1116 # when we have one parent, it's easy: copy from parent
1117 man = parents[0].manifest()
1117 man = parents[0].manifest()
1118 def func(f):
1118 def func(f):
1119 f = copiesget(f, f)
1119 f = copiesget(f, f)
1120 return man.flags(f)
1120 return man.flags(f)
1121 else:
1121 else:
1122 # merges are tricky: we try to reconstruct the unstored
1122 # merges are tricky: we try to reconstruct the unstored
1123 # result from the merge (issue1802)
1123 # result from the merge (issue1802)
1124 p1, p2 = parents
1124 p1, p2 = parents
1125 pa = p1.ancestor(p2)
1125 pa = p1.ancestor(p2)
1126 m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest()
1126 m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest()
1127
1127
1128 def func(f):
1128 def func(f):
1129 f = copiesget(f, f) # may be wrong for merges with copies
1129 f = copiesget(f, f) # may be wrong for merges with copies
1130 fl1, fl2, fla = m1.flags(f), m2.flags(f), ma.flags(f)
1130 fl1, fl2, fla = m1.flags(f), m2.flags(f), ma.flags(f)
1131 if fl1 == fl2:
1131 if fl1 == fl2:
1132 return fl1
1132 return fl1
1133 if fl1 == fla:
1133 if fl1 == fla:
1134 return fl2
1134 return fl2
1135 if fl2 == fla:
1135 if fl2 == fla:
1136 return fl1
1136 return fl1
1137 return '' # punt for conflicts
1137 return '' # punt for conflicts
1138
1138
1139 return func
1139 return func
1140
1140
1141 @propertycache
1141 @propertycache
1142 def _flagfunc(self):
1142 def _flagfunc(self):
1143 return self._repo.dirstate.flagfunc(self._buildflagfunc)
1143 return self._repo.dirstate.flagfunc(self._buildflagfunc)
1144
1144
1145 @propertycache
1145 @propertycache
1146 def _status(self):
1146 def _status(self):
1147 return self._repo.status()
1147 return self._repo.status()
1148
1148
1149 @propertycache
1149 @propertycache
1150 def _user(self):
1150 def _user(self):
1151 return self._repo.ui.username()
1151 return self._repo.ui.username()
1152
1152
1153 @propertycache
1153 @propertycache
1154 def _date(self):
1154 def _date(self):
1155 ui = self._repo.ui
1155 ui = self._repo.ui
1156 date = ui.configdate('devel', 'default-date')
1156 date = ui.configdate('devel', 'default-date')
1157 if date is None:
1157 if date is None:
1158 date = dateutil.makedate()
1158 date = dateutil.makedate()
1159 return date
1159 return date
1160
1160
1161 def subrev(self, subpath):
1161 def subrev(self, subpath):
1162 return None
1162 return None
1163
1163
1164 def manifestnode(self):
1164 def manifestnode(self):
1165 return None
1165 return None
1166 def user(self):
1166 def user(self):
1167 return self._user or self._repo.ui.username()
1167 return self._user or self._repo.ui.username()
1168 def date(self):
1168 def date(self):
1169 return self._date
1169 return self._date
1170 def description(self):
1170 def description(self):
1171 return self._text
1171 return self._text
1172 def files(self):
1172 def files(self):
1173 return sorted(self._status.modified + self._status.added +
1173 return sorted(self._status.modified + self._status.added +
1174 self._status.removed)
1174 self._status.removed)
1175
1175
1176 def modified(self):
1176 def modified(self):
1177 return self._status.modified
1177 return self._status.modified
1178 def added(self):
1178 def added(self):
1179 return self._status.added
1179 return self._status.added
1180 def removed(self):
1180 def removed(self):
1181 return self._status.removed
1181 return self._status.removed
1182 def deleted(self):
1182 def deleted(self):
1183 return self._status.deleted
1183 return self._status.deleted
1184 def branch(self):
1184 def branch(self):
1185 return encoding.tolocal(self._extra['branch'])
1185 return encoding.tolocal(self._extra['branch'])
1186 def closesbranch(self):
1186 def closesbranch(self):
1187 return 'close' in self._extra
1187 return 'close' in self._extra
1188 def extra(self):
1188 def extra(self):
1189 return self._extra
1189 return self._extra
1190
1190
1191 def isinmemory(self):
1191 def isinmemory(self):
1192 return False
1192 return False
1193
1193
1194 def tags(self):
1194 def tags(self):
1195 return []
1195 return []
1196
1196
1197 def bookmarks(self):
1197 def bookmarks(self):
1198 b = []
1198 b = []
1199 for p in self.parents():
1199 for p in self.parents():
1200 b.extend(p.bookmarks())
1200 b.extend(p.bookmarks())
1201 return b
1201 return b
1202
1202
1203 def phase(self):
1203 def phase(self):
1204 phase = phases.draft # default phase to draft
1204 phase = phases.draft # default phase to draft
1205 for p in self.parents():
1205 for p in self.parents():
1206 phase = max(phase, p.phase())
1206 phase = max(phase, p.phase())
1207 return phase
1207 return phase
1208
1208
1209 def hidden(self):
1209 def hidden(self):
1210 return False
1210 return False
1211
1211
1212 def children(self):
1212 def children(self):
1213 return []
1213 return []
1214
1214
1215 def flags(self, path):
1215 def flags(self, path):
1216 if r'_manifest' in self.__dict__:
1216 if r'_manifest' in self.__dict__:
1217 try:
1217 try:
1218 return self._manifest.flags(path)
1218 return self._manifest.flags(path)
1219 except KeyError:
1219 except KeyError:
1220 return ''
1220 return ''
1221
1221
1222 try:
1222 try:
1223 return self._flagfunc(path)
1223 return self._flagfunc(path)
1224 except OSError:
1224 except OSError:
1225 return ''
1225 return ''
1226
1226
1227 def ancestor(self, c2):
1227 def ancestor(self, c2):
1228 """return the "best" ancestor context of self and c2"""
1228 """return the "best" ancestor context of self and c2"""
1229 return self._parents[0].ancestor(c2) # punt on two parents for now
1229 return self._parents[0].ancestor(c2) # punt on two parents for now
1230
1230
1231 def walk(self, match):
1231 def walk(self, match):
1232 '''Generates matching file names.'''
1232 '''Generates matching file names.'''
1233 return sorted(self._repo.dirstate.walk(match,
1233 return sorted(self._repo.dirstate.walk(match,
1234 subrepos=sorted(self.substate),
1234 subrepos=sorted(self.substate),
1235 unknown=True, ignored=False))
1235 unknown=True, ignored=False))
1236
1236
1237 def matches(self, match):
1237 def matches(self, match):
1238 ds = self._repo.dirstate
1238 ds = self._repo.dirstate
1239 return sorted(f for f in ds.matches(match) if ds[f] != 'r')
1239 return sorted(f for f in ds.matches(match) if ds[f] != 'r')
1240
1240
1241 def ancestors(self):
1241 def ancestors(self):
1242 for p in self._parents:
1242 for p in self._parents:
1243 yield p
1243 yield p
1244 for a in self._repo.changelog.ancestors(
1244 for a in self._repo.changelog.ancestors(
1245 [p.rev() for p in self._parents]):
1245 [p.rev() for p in self._parents]):
1246 yield changectx(self._repo, a)
1246 yield changectx(self._repo, a)
1247
1247
1248 def markcommitted(self, node):
1248 def markcommitted(self, node):
1249 """Perform post-commit cleanup necessary after committing this ctx
1249 """Perform post-commit cleanup necessary after committing this ctx
1250
1250
1251 Specifically, this updates backing stores this working context
1251 Specifically, this updates backing stores this working context
1252 wraps to reflect the fact that the changes reflected by this
1252 wraps to reflect the fact that the changes reflected by this
1253 workingctx have been committed. For example, it marks
1253 workingctx have been committed. For example, it marks
1254 modified and added files as normal in the dirstate.
1254 modified and added files as normal in the dirstate.
1255
1255
1256 """
1256 """
1257
1257
1258 with self._repo.dirstate.parentchange():
1258 with self._repo.dirstate.parentchange():
1259 for f in self.modified() + self.added():
1259 for f in self.modified() + self.added():
1260 self._repo.dirstate.normal(f)
1260 self._repo.dirstate.normal(f)
1261 for f in self.removed():
1261 for f in self.removed():
1262 self._repo.dirstate.drop(f)
1262 self._repo.dirstate.drop(f)
1263 self._repo.dirstate.setparents(node)
1263 self._repo.dirstate.setparents(node)
1264
1264
1265 # write changes out explicitly, because nesting wlock at
1265 # write changes out explicitly, because nesting wlock at
1266 # runtime may prevent 'wlock.release()' in 'repo.commit()'
1266 # runtime may prevent 'wlock.release()' in 'repo.commit()'
1267 # from immediately doing so for subsequent changing files
1267 # from immediately doing so for subsequent changing files
1268 self._repo.dirstate.write(self._repo.currenttransaction())
1268 self._repo.dirstate.write(self._repo.currenttransaction())
1269
1269
1270 def dirty(self, missing=False, merge=True, branch=True):
1270 def dirty(self, missing=False, merge=True, branch=True):
1271 return False
1271 return False
1272
1272
1273 class workingctx(committablectx):
1273 class workingctx(committablectx):
1274 """A workingctx object makes access to data related to
1274 """A workingctx object makes access to data related to
1275 the current working directory convenient.
1275 the current working directory convenient.
1276 date - any valid date string or (unixtime, offset), or None.
1276 date - any valid date string or (unixtime, offset), or None.
1277 user - username string, or None.
1277 user - username string, or None.
1278 extra - a dictionary of extra values, or None.
1278 extra - a dictionary of extra values, or None.
1279 changes - a list of file lists as returned by localrepo.status()
1279 changes - a list of file lists as returned by localrepo.status()
1280 or None to use the repository status.
1280 or None to use the repository status.
1281 """
1281 """
1282 def __init__(self, repo, text="", user=None, date=None, extra=None,
1282 def __init__(self, repo, text="", user=None, date=None, extra=None,
1283 changes=None):
1283 changes=None):
1284 super(workingctx, self).__init__(repo, text, user, date, extra, changes)
1284 super(workingctx, self).__init__(repo, text, user, date, extra, changes)
1285
1285
1286 def __iter__(self):
1286 def __iter__(self):
1287 d = self._repo.dirstate
1287 d = self._repo.dirstate
1288 for f in d:
1288 for f in d:
1289 if d[f] != 'r':
1289 if d[f] != 'r':
1290 yield f
1290 yield f
1291
1291
1292 def __contains__(self, key):
1292 def __contains__(self, key):
1293 return self._repo.dirstate[key] not in "?r"
1293 return self._repo.dirstate[key] not in "?r"
1294
1294
1295 def hex(self):
1295 def hex(self):
1296 return hex(wdirid)
1296 return hex(wdirid)
1297
1297
1298 @propertycache
1298 @propertycache
1299 def _parents(self):
1299 def _parents(self):
1300 p = self._repo.dirstate.parents()
1300 p = self._repo.dirstate.parents()
1301 if p[1] == nullid:
1301 if p[1] == nullid:
1302 p = p[:-1]
1302 p = p[:-1]
1303 return [changectx(self._repo, x) for x in p]
1303 return [changectx(self._repo, x) for x in p]
1304
1304
1305 def _fileinfo(self, path):
1305 def _fileinfo(self, path):
1306 # populate __dict__['_manifest'] as workingctx has no _manifestdelta
1306 # populate __dict__['_manifest'] as workingctx has no _manifestdelta
1307 self._manifest
1307 self._manifest
1308 return super(workingctx, self)._fileinfo(path)
1308 return super(workingctx, self)._fileinfo(path)
1309
1309
1310 def filectx(self, path, filelog=None):
1310 def filectx(self, path, filelog=None):
1311 """get a file context from the working directory"""
1311 """get a file context from the working directory"""
1312 return workingfilectx(self._repo, path, workingctx=self,
1312 return workingfilectx(self._repo, path, workingctx=self,
1313 filelog=filelog)
1313 filelog=filelog)
1314
1314
1315 def dirty(self, missing=False, merge=True, branch=True):
1315 def dirty(self, missing=False, merge=True, branch=True):
1316 "check whether a working directory is modified"
1316 "check whether a working directory is modified"
1317 # check subrepos first
1317 # check subrepos first
1318 for s in sorted(self.substate):
1318 for s in sorted(self.substate):
1319 if self.sub(s).dirty(missing=missing):
1319 if self.sub(s).dirty(missing=missing):
1320 return True
1320 return True
1321 # check current working dir
1321 # check current working dir
1322 return ((merge and self.p2()) or
1322 return ((merge and self.p2()) or
1323 (branch and self.branch() != self.p1().branch()) or
1323 (branch and self.branch() != self.p1().branch()) or
1324 self.modified() or self.added() or self.removed() or
1324 self.modified() or self.added() or self.removed() or
1325 (missing and self.deleted()))
1325 (missing and self.deleted()))
1326
1326
1327 def add(self, list, prefix=""):
1327 def add(self, list, prefix=""):
1328 with self._repo.wlock():
1328 with self._repo.wlock():
1329 ui, ds = self._repo.ui, self._repo.dirstate
1329 ui, ds = self._repo.ui, self._repo.dirstate
1330 uipath = lambda f: ds.pathto(pathutil.join(prefix, f))
1330 uipath = lambda f: ds.pathto(pathutil.join(prefix, f))
1331 rejected = []
1331 rejected = []
1332 lstat = self._repo.wvfs.lstat
1332 lstat = self._repo.wvfs.lstat
1333 for f in list:
1333 for f in list:
1334 # ds.pathto() returns an absolute file when this is invoked from
1334 # ds.pathto() returns an absolute file when this is invoked from
1335 # the keyword extension. That gets flagged as non-portable on
1335 # the keyword extension. That gets flagged as non-portable on
1336 # Windows, since it contains the drive letter and colon.
1336 # Windows, since it contains the drive letter and colon.
1337 scmutil.checkportable(ui, os.path.join(prefix, f))
1337 scmutil.checkportable(ui, os.path.join(prefix, f))
1338 try:
1338 try:
1339 st = lstat(f)
1339 st = lstat(f)
1340 except OSError:
1340 except OSError:
1341 ui.warn(_("%s does not exist!\n") % uipath(f))
1341 ui.warn(_("%s does not exist!\n") % uipath(f))
1342 rejected.append(f)
1342 rejected.append(f)
1343 continue
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 ui.warn(_("%s: up to %d MB of RAM may be required "
1346 ui.warn(_("%s: up to %d MB of RAM may be required "
1346 "to manage this file\n"
1347 "to manage this file\n"
1347 "(use 'hg revert %s' to cancel the "
1348 "(use 'hg revert %s' to cancel the "
1348 "pending addition)\n")
1349 "pending addition)\n")
1349 % (f, 3 * st.st_size // 1000000, uipath(f)))
1350 % (f, 3 * st.st_size // 1000000, uipath(f)))
1350 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
1351 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
1351 ui.warn(_("%s not added: only files and symlinks "
1352 ui.warn(_("%s not added: only files and symlinks "
1352 "supported currently\n") % uipath(f))
1353 "supported currently\n") % uipath(f))
1353 rejected.append(f)
1354 rejected.append(f)
1354 elif ds[f] in 'amn':
1355 elif ds[f] in 'amn':
1355 ui.warn(_("%s already tracked!\n") % uipath(f))
1356 ui.warn(_("%s already tracked!\n") % uipath(f))
1356 elif ds[f] == 'r':
1357 elif ds[f] == 'r':
1357 ds.normallookup(f)
1358 ds.normallookup(f)
1358 else:
1359 else:
1359 ds.add(f)
1360 ds.add(f)
1360 return rejected
1361 return rejected
1361
1362
1362 def forget(self, files, prefix=""):
1363 def forget(self, files, prefix=""):
1363 with self._repo.wlock():
1364 with self._repo.wlock():
1364 ds = self._repo.dirstate
1365 ds = self._repo.dirstate
1365 uipath = lambda f: ds.pathto(pathutil.join(prefix, f))
1366 uipath = lambda f: ds.pathto(pathutil.join(prefix, f))
1366 rejected = []
1367 rejected = []
1367 for f in files:
1368 for f in files:
1368 if f not in self._repo.dirstate:
1369 if f not in self._repo.dirstate:
1369 self._repo.ui.warn(_("%s not tracked!\n") % uipath(f))
1370 self._repo.ui.warn(_("%s not tracked!\n") % uipath(f))
1370 rejected.append(f)
1371 rejected.append(f)
1371 elif self._repo.dirstate[f] != 'a':
1372 elif self._repo.dirstate[f] != 'a':
1372 self._repo.dirstate.remove(f)
1373 self._repo.dirstate.remove(f)
1373 else:
1374 else:
1374 self._repo.dirstate.drop(f)
1375 self._repo.dirstate.drop(f)
1375 return rejected
1376 return rejected
1376
1377
1377 def undelete(self, list):
1378 def undelete(self, list):
1378 pctxs = self.parents()
1379 pctxs = self.parents()
1379 with self._repo.wlock():
1380 with self._repo.wlock():
1380 ds = self._repo.dirstate
1381 ds = self._repo.dirstate
1381 for f in list:
1382 for f in list:
1382 if self._repo.dirstate[f] != 'r':
1383 if self._repo.dirstate[f] != 'r':
1383 self._repo.ui.warn(_("%s not removed!\n") % ds.pathto(f))
1384 self._repo.ui.warn(_("%s not removed!\n") % ds.pathto(f))
1384 else:
1385 else:
1385 fctx = f in pctxs[0] and pctxs[0][f] or pctxs[1][f]
1386 fctx = f in pctxs[0] and pctxs[0][f] or pctxs[1][f]
1386 t = fctx.data()
1387 t = fctx.data()
1387 self._repo.wwrite(f, t, fctx.flags())
1388 self._repo.wwrite(f, t, fctx.flags())
1388 self._repo.dirstate.normal(f)
1389 self._repo.dirstate.normal(f)
1389
1390
1390 def copy(self, source, dest):
1391 def copy(self, source, dest):
1391 try:
1392 try:
1392 st = self._repo.wvfs.lstat(dest)
1393 st = self._repo.wvfs.lstat(dest)
1393 except OSError as err:
1394 except OSError as err:
1394 if err.errno != errno.ENOENT:
1395 if err.errno != errno.ENOENT:
1395 raise
1396 raise
1396 self._repo.ui.warn(_("%s does not exist!\n")
1397 self._repo.ui.warn(_("%s does not exist!\n")
1397 % self._repo.dirstate.pathto(dest))
1398 % self._repo.dirstate.pathto(dest))
1398 return
1399 return
1399 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
1400 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
1400 self._repo.ui.warn(_("copy failed: %s is not a file or a "
1401 self._repo.ui.warn(_("copy failed: %s is not a file or a "
1401 "symbolic link\n")
1402 "symbolic link\n")
1402 % self._repo.dirstate.pathto(dest))
1403 % self._repo.dirstate.pathto(dest))
1403 else:
1404 else:
1404 with self._repo.wlock():
1405 with self._repo.wlock():
1405 if self._repo.dirstate[dest] in '?':
1406 if self._repo.dirstate[dest] in '?':
1406 self._repo.dirstate.add(dest)
1407 self._repo.dirstate.add(dest)
1407 elif self._repo.dirstate[dest] in 'r':
1408 elif self._repo.dirstate[dest] in 'r':
1408 self._repo.dirstate.normallookup(dest)
1409 self._repo.dirstate.normallookup(dest)
1409 self._repo.dirstate.copy(source, dest)
1410 self._repo.dirstate.copy(source, dest)
1410
1411
1411 def match(self, pats=None, include=None, exclude=None, default='glob',
1412 def match(self, pats=None, include=None, exclude=None, default='glob',
1412 listsubrepos=False, badfn=None):
1413 listsubrepos=False, badfn=None):
1413 r = self._repo
1414 r = self._repo
1414
1415
1415 # Only a case insensitive filesystem needs magic to translate user input
1416 # Only a case insensitive filesystem needs magic to translate user input
1416 # to actual case in the filesystem.
1417 # to actual case in the filesystem.
1417 icasefs = not util.fscasesensitive(r.root)
1418 icasefs = not util.fscasesensitive(r.root)
1418 return matchmod.match(r.root, r.getcwd(), pats, include, exclude,
1419 return matchmod.match(r.root, r.getcwd(), pats, include, exclude,
1419 default, auditor=r.auditor, ctx=self,
1420 default, auditor=r.auditor, ctx=self,
1420 listsubrepos=listsubrepos, badfn=badfn,
1421 listsubrepos=listsubrepos, badfn=badfn,
1421 icasefs=icasefs)
1422 icasefs=icasefs)
1422
1423
1423 def _filtersuspectsymlink(self, files):
1424 def _filtersuspectsymlink(self, files):
1424 if not files or self._repo.dirstate._checklink:
1425 if not files or self._repo.dirstate._checklink:
1425 return files
1426 return files
1426
1427
1427 # Symlink placeholders may get non-symlink-like contents
1428 # Symlink placeholders may get non-symlink-like contents
1428 # via user error or dereferencing by NFS or Samba servers,
1429 # via user error or dereferencing by NFS or Samba servers,
1429 # so we filter out any placeholders that don't look like a
1430 # so we filter out any placeholders that don't look like a
1430 # symlink
1431 # symlink
1431 sane = []
1432 sane = []
1432 for f in files:
1433 for f in files:
1433 if self.flags(f) == 'l':
1434 if self.flags(f) == 'l':
1434 d = self[f].data()
1435 d = self[f].data()
1435 if (d == '' or len(d) >= 1024 or '\n' in d
1436 if (d == '' or len(d) >= 1024 or '\n' in d
1436 or stringutil.binary(d)):
1437 or stringutil.binary(d)):
1437 self._repo.ui.debug('ignoring suspect symlink placeholder'
1438 self._repo.ui.debug('ignoring suspect symlink placeholder'
1438 ' "%s"\n' % f)
1439 ' "%s"\n' % f)
1439 continue
1440 continue
1440 sane.append(f)
1441 sane.append(f)
1441 return sane
1442 return sane
1442
1443
1443 def _checklookup(self, files):
1444 def _checklookup(self, files):
1444 # check for any possibly clean files
1445 # check for any possibly clean files
1445 if not files:
1446 if not files:
1446 return [], [], []
1447 return [], [], []
1447
1448
1448 modified = []
1449 modified = []
1449 deleted = []
1450 deleted = []
1450 fixup = []
1451 fixup = []
1451 pctx = self._parents[0]
1452 pctx = self._parents[0]
1452 # do a full compare of any files that might have changed
1453 # do a full compare of any files that might have changed
1453 for f in sorted(files):
1454 for f in sorted(files):
1454 try:
1455 try:
1455 # This will return True for a file that got replaced by a
1456 # This will return True for a file that got replaced by a
1456 # directory in the interim, but fixing that is pretty hard.
1457 # directory in the interim, but fixing that is pretty hard.
1457 if (f not in pctx or self.flags(f) != pctx.flags(f)
1458 if (f not in pctx or self.flags(f) != pctx.flags(f)
1458 or pctx[f].cmp(self[f])):
1459 or pctx[f].cmp(self[f])):
1459 modified.append(f)
1460 modified.append(f)
1460 else:
1461 else:
1461 fixup.append(f)
1462 fixup.append(f)
1462 except (IOError, OSError):
1463 except (IOError, OSError):
1463 # A file become inaccessible in between? Mark it as deleted,
1464 # A file become inaccessible in between? Mark it as deleted,
1464 # matching dirstate behavior (issue5584).
1465 # matching dirstate behavior (issue5584).
1465 # The dirstate has more complex behavior around whether a
1466 # The dirstate has more complex behavior around whether a
1466 # missing file matches a directory, etc, but we don't need to
1467 # missing file matches a directory, etc, but we don't need to
1467 # bother with that: if f has made it to this point, we're sure
1468 # bother with that: if f has made it to this point, we're sure
1468 # it's in the dirstate.
1469 # it's in the dirstate.
1469 deleted.append(f)
1470 deleted.append(f)
1470
1471
1471 return modified, deleted, fixup
1472 return modified, deleted, fixup
1472
1473
1473 def _poststatusfixup(self, status, fixup):
1474 def _poststatusfixup(self, status, fixup):
1474 """update dirstate for files that are actually clean"""
1475 """update dirstate for files that are actually clean"""
1475 poststatus = self._repo.postdsstatus()
1476 poststatus = self._repo.postdsstatus()
1476 if fixup or poststatus:
1477 if fixup or poststatus:
1477 try:
1478 try:
1478 oldid = self._repo.dirstate.identity()
1479 oldid = self._repo.dirstate.identity()
1479
1480
1480 # updating the dirstate is optional
1481 # updating the dirstate is optional
1481 # so we don't wait on the lock
1482 # so we don't wait on the lock
1482 # wlock can invalidate the dirstate, so cache normal _after_
1483 # wlock can invalidate the dirstate, so cache normal _after_
1483 # taking the lock
1484 # taking the lock
1484 with self._repo.wlock(False):
1485 with self._repo.wlock(False):
1485 if self._repo.dirstate.identity() == oldid:
1486 if self._repo.dirstate.identity() == oldid:
1486 if fixup:
1487 if fixup:
1487 normal = self._repo.dirstate.normal
1488 normal = self._repo.dirstate.normal
1488 for f in fixup:
1489 for f in fixup:
1489 normal(f)
1490 normal(f)
1490 # write changes out explicitly, because nesting
1491 # write changes out explicitly, because nesting
1491 # wlock at runtime may prevent 'wlock.release()'
1492 # wlock at runtime may prevent 'wlock.release()'
1492 # after this block from doing so for subsequent
1493 # after this block from doing so for subsequent
1493 # changing files
1494 # changing files
1494 tr = self._repo.currenttransaction()
1495 tr = self._repo.currenttransaction()
1495 self._repo.dirstate.write(tr)
1496 self._repo.dirstate.write(tr)
1496
1497
1497 if poststatus:
1498 if poststatus:
1498 for ps in poststatus:
1499 for ps in poststatus:
1499 ps(self, status)
1500 ps(self, status)
1500 else:
1501 else:
1501 # in this case, writing changes out breaks
1502 # in this case, writing changes out breaks
1502 # consistency, because .hg/dirstate was
1503 # consistency, because .hg/dirstate was
1503 # already changed simultaneously after last
1504 # already changed simultaneously after last
1504 # caching (see also issue5584 for detail)
1505 # caching (see also issue5584 for detail)
1505 self._repo.ui.debug('skip updating dirstate: '
1506 self._repo.ui.debug('skip updating dirstate: '
1506 'identity mismatch\n')
1507 'identity mismatch\n')
1507 except error.LockError:
1508 except error.LockError:
1508 pass
1509 pass
1509 finally:
1510 finally:
1510 # Even if the wlock couldn't be grabbed, clear out the list.
1511 # Even if the wlock couldn't be grabbed, clear out the list.
1511 self._repo.clearpostdsstatus()
1512 self._repo.clearpostdsstatus()
1512
1513
1513 def _dirstatestatus(self, match, ignored=False, clean=False, unknown=False):
1514 def _dirstatestatus(self, match, ignored=False, clean=False, unknown=False):
1514 '''Gets the status from the dirstate -- internal use only.'''
1515 '''Gets the status from the dirstate -- internal use only.'''
1515 subrepos = []
1516 subrepos = []
1516 if '.hgsub' in self:
1517 if '.hgsub' in self:
1517 subrepos = sorted(self.substate)
1518 subrepos = sorted(self.substate)
1518 cmp, s = self._repo.dirstate.status(match, subrepos, ignored=ignored,
1519 cmp, s = self._repo.dirstate.status(match, subrepos, ignored=ignored,
1519 clean=clean, unknown=unknown)
1520 clean=clean, unknown=unknown)
1520
1521
1521 # check for any possibly clean files
1522 # check for any possibly clean files
1522 fixup = []
1523 fixup = []
1523 if cmp:
1524 if cmp:
1524 modified2, deleted2, fixup = self._checklookup(cmp)
1525 modified2, deleted2, fixup = self._checklookup(cmp)
1525 s.modified.extend(modified2)
1526 s.modified.extend(modified2)
1526 s.deleted.extend(deleted2)
1527 s.deleted.extend(deleted2)
1527
1528
1528 if fixup and clean:
1529 if fixup and clean:
1529 s.clean.extend(fixup)
1530 s.clean.extend(fixup)
1530
1531
1531 self._poststatusfixup(s, fixup)
1532 self._poststatusfixup(s, fixup)
1532
1533
1533 if match.always():
1534 if match.always():
1534 # cache for performance
1535 # cache for performance
1535 if s.unknown or s.ignored or s.clean:
1536 if s.unknown or s.ignored or s.clean:
1536 # "_status" is cached with list*=False in the normal route
1537 # "_status" is cached with list*=False in the normal route
1537 self._status = scmutil.status(s.modified, s.added, s.removed,
1538 self._status = scmutil.status(s.modified, s.added, s.removed,
1538 s.deleted, [], [], [])
1539 s.deleted, [], [], [])
1539 else:
1540 else:
1540 self._status = s
1541 self._status = s
1541
1542
1542 return s
1543 return s
1543
1544
1544 @propertycache
1545 @propertycache
1545 def _manifest(self):
1546 def _manifest(self):
1546 """generate a manifest corresponding to the values in self._status
1547 """generate a manifest corresponding to the values in self._status
1547
1548
1548 This reuse the file nodeid from parent, but we use special node
1549 This reuse the file nodeid from parent, but we use special node
1549 identifiers for added and modified files. This is used by manifests
1550 identifiers for added and modified files. This is used by manifests
1550 merge to see that files are different and by update logic to avoid
1551 merge to see that files are different and by update logic to avoid
1551 deleting newly added files.
1552 deleting newly added files.
1552 """
1553 """
1553 return self._buildstatusmanifest(self._status)
1554 return self._buildstatusmanifest(self._status)
1554
1555
1555 def _buildstatusmanifest(self, status):
1556 def _buildstatusmanifest(self, status):
1556 """Builds a manifest that includes the given status results."""
1557 """Builds a manifest that includes the given status results."""
1557 parents = self.parents()
1558 parents = self.parents()
1558
1559
1559 man = parents[0].manifest().copy()
1560 man = parents[0].manifest().copy()
1560
1561
1561 ff = self._flagfunc
1562 ff = self._flagfunc
1562 for i, l in ((addednodeid, status.added),
1563 for i, l in ((addednodeid, status.added),
1563 (modifiednodeid, status.modified)):
1564 (modifiednodeid, status.modified)):
1564 for f in l:
1565 for f in l:
1565 man[f] = i
1566 man[f] = i
1566 try:
1567 try:
1567 man.setflag(f, ff(f))
1568 man.setflag(f, ff(f))
1568 except OSError:
1569 except OSError:
1569 pass
1570 pass
1570
1571
1571 for f in status.deleted + status.removed:
1572 for f in status.deleted + status.removed:
1572 if f in man:
1573 if f in man:
1573 del man[f]
1574 del man[f]
1574
1575
1575 return man
1576 return man
1576
1577
1577 def _buildstatus(self, other, s, match, listignored, listclean,
1578 def _buildstatus(self, other, s, match, listignored, listclean,
1578 listunknown):
1579 listunknown):
1579 """build a status with respect to another context
1580 """build a status with respect to another context
1580
1581
1581 This includes logic for maintaining the fast path of status when
1582 This includes logic for maintaining the fast path of status when
1582 comparing the working directory against its parent, which is to skip
1583 comparing the working directory against its parent, which is to skip
1583 building a new manifest if self (working directory) is not comparing
1584 building a new manifest if self (working directory) is not comparing
1584 against its parent (repo['.']).
1585 against its parent (repo['.']).
1585 """
1586 """
1586 s = self._dirstatestatus(match, listignored, listclean, listunknown)
1587 s = self._dirstatestatus(match, listignored, listclean, listunknown)
1587 # Filter out symlinks that, in the case of FAT32 and NTFS filesystems,
1588 # Filter out symlinks that, in the case of FAT32 and NTFS filesystems,
1588 # might have accidentally ended up with the entire contents of the file
1589 # might have accidentally ended up with the entire contents of the file
1589 # they are supposed to be linking to.
1590 # they are supposed to be linking to.
1590 s.modified[:] = self._filtersuspectsymlink(s.modified)
1591 s.modified[:] = self._filtersuspectsymlink(s.modified)
1591 if other != self._repo['.']:
1592 if other != self._repo['.']:
1592 s = super(workingctx, self)._buildstatus(other, s, match,
1593 s = super(workingctx, self)._buildstatus(other, s, match,
1593 listignored, listclean,
1594 listignored, listclean,
1594 listunknown)
1595 listunknown)
1595 return s
1596 return s
1596
1597
1597 def _matchstatus(self, other, match):
1598 def _matchstatus(self, other, match):
1598 """override the match method with a filter for directory patterns
1599 """override the match method with a filter for directory patterns
1599
1600
1600 We use inheritance to customize the match.bad method only in cases of
1601 We use inheritance to customize the match.bad method only in cases of
1601 workingctx since it belongs only to the working directory when
1602 workingctx since it belongs only to the working directory when
1602 comparing against the parent changeset.
1603 comparing against the parent changeset.
1603
1604
1604 If we aren't comparing against the working directory's parent, then we
1605 If we aren't comparing against the working directory's parent, then we
1605 just use the default match object sent to us.
1606 just use the default match object sent to us.
1606 """
1607 """
1607 if other != self._repo['.']:
1608 if other != self._repo['.']:
1608 def bad(f, msg):
1609 def bad(f, msg):
1609 # 'f' may be a directory pattern from 'match.files()',
1610 # 'f' may be a directory pattern from 'match.files()',
1610 # so 'f not in ctx1' is not enough
1611 # so 'f not in ctx1' is not enough
1611 if f not in other and not other.hasdir(f):
1612 if f not in other and not other.hasdir(f):
1612 self._repo.ui.warn('%s: %s\n' %
1613 self._repo.ui.warn('%s: %s\n' %
1613 (self._repo.dirstate.pathto(f), msg))
1614 (self._repo.dirstate.pathto(f), msg))
1614 match.bad = bad
1615 match.bad = bad
1615 return match
1616 return match
1616
1617
1617 def markcommitted(self, node):
1618 def markcommitted(self, node):
1618 super(workingctx, self).markcommitted(node)
1619 super(workingctx, self).markcommitted(node)
1619
1620
1620 sparse.aftercommit(self._repo, node)
1621 sparse.aftercommit(self._repo, node)
1621
1622
1622 class committablefilectx(basefilectx):
1623 class committablefilectx(basefilectx):
1623 """A committablefilectx provides common functionality for a file context
1624 """A committablefilectx provides common functionality for a file context
1624 that wants the ability to commit, e.g. workingfilectx or memfilectx."""
1625 that wants the ability to commit, e.g. workingfilectx or memfilectx."""
1625 def __init__(self, repo, path, filelog=None, ctx=None):
1626 def __init__(self, repo, path, filelog=None, ctx=None):
1626 self._repo = repo
1627 self._repo = repo
1627 self._path = path
1628 self._path = path
1628 self._changeid = None
1629 self._changeid = None
1629 self._filerev = self._filenode = None
1630 self._filerev = self._filenode = None
1630
1631
1631 if filelog is not None:
1632 if filelog is not None:
1632 self._filelog = filelog
1633 self._filelog = filelog
1633 if ctx:
1634 if ctx:
1634 self._changectx = ctx
1635 self._changectx = ctx
1635
1636
1636 def __nonzero__(self):
1637 def __nonzero__(self):
1637 return True
1638 return True
1638
1639
1639 __bool__ = __nonzero__
1640 __bool__ = __nonzero__
1640
1641
1641 def linkrev(self):
1642 def linkrev(self):
1642 # linked to self._changectx no matter if file is modified or not
1643 # linked to self._changectx no matter if file is modified or not
1643 return self.rev()
1644 return self.rev()
1644
1645
1645 def parents(self):
1646 def parents(self):
1646 '''return parent filectxs, following copies if necessary'''
1647 '''return parent filectxs, following copies if necessary'''
1647 def filenode(ctx, path):
1648 def filenode(ctx, path):
1648 return ctx._manifest.get(path, nullid)
1649 return ctx._manifest.get(path, nullid)
1649
1650
1650 path = self._path
1651 path = self._path
1651 fl = self._filelog
1652 fl = self._filelog
1652 pcl = self._changectx._parents
1653 pcl = self._changectx._parents
1653 renamed = self.renamed()
1654 renamed = self.renamed()
1654
1655
1655 if renamed:
1656 if renamed:
1656 pl = [renamed + (None,)]
1657 pl = [renamed + (None,)]
1657 else:
1658 else:
1658 pl = [(path, filenode(pcl[0], path), fl)]
1659 pl = [(path, filenode(pcl[0], path), fl)]
1659
1660
1660 for pc in pcl[1:]:
1661 for pc in pcl[1:]:
1661 pl.append((path, filenode(pc, path), fl))
1662 pl.append((path, filenode(pc, path), fl))
1662
1663
1663 return [self._parentfilectx(p, fileid=n, filelog=l)
1664 return [self._parentfilectx(p, fileid=n, filelog=l)
1664 for p, n, l in pl if n != nullid]
1665 for p, n, l in pl if n != nullid]
1665
1666
1666 def children(self):
1667 def children(self):
1667 return []
1668 return []
1668
1669
1669 class workingfilectx(committablefilectx):
1670 class workingfilectx(committablefilectx):
1670 """A workingfilectx object makes access to data related to a particular
1671 """A workingfilectx object makes access to data related to a particular
1671 file in the working directory convenient."""
1672 file in the working directory convenient."""
1672 def __init__(self, repo, path, filelog=None, workingctx=None):
1673 def __init__(self, repo, path, filelog=None, workingctx=None):
1673 super(workingfilectx, self).__init__(repo, path, filelog, workingctx)
1674 super(workingfilectx, self).__init__(repo, path, filelog, workingctx)
1674
1675
1675 @propertycache
1676 @propertycache
1676 def _changectx(self):
1677 def _changectx(self):
1677 return workingctx(self._repo)
1678 return workingctx(self._repo)
1678
1679
1679 def data(self):
1680 def data(self):
1680 return self._repo.wread(self._path)
1681 return self._repo.wread(self._path)
1681 def renamed(self):
1682 def renamed(self):
1682 rp = self._repo.dirstate.copied(self._path)
1683 rp = self._repo.dirstate.copied(self._path)
1683 if not rp:
1684 if not rp:
1684 return None
1685 return None
1685 return rp, self._changectx._parents[0]._manifest.get(rp, nullid)
1686 return rp, self._changectx._parents[0]._manifest.get(rp, nullid)
1686
1687
1687 def size(self):
1688 def size(self):
1688 return self._repo.wvfs.lstat(self._path).st_size
1689 return self._repo.wvfs.lstat(self._path).st_size
1689 def date(self):
1690 def date(self):
1690 t, tz = self._changectx.date()
1691 t, tz = self._changectx.date()
1691 try:
1692 try:
1692 return (self._repo.wvfs.lstat(self._path)[stat.ST_MTIME], tz)
1693 return (self._repo.wvfs.lstat(self._path)[stat.ST_MTIME], tz)
1693 except OSError as err:
1694 except OSError as err:
1694 if err.errno != errno.ENOENT:
1695 if err.errno != errno.ENOENT:
1695 raise
1696 raise
1696 return (t, tz)
1697 return (t, tz)
1697
1698
1698 def exists(self):
1699 def exists(self):
1699 return self._repo.wvfs.exists(self._path)
1700 return self._repo.wvfs.exists(self._path)
1700
1701
1701 def lexists(self):
1702 def lexists(self):
1702 return self._repo.wvfs.lexists(self._path)
1703 return self._repo.wvfs.lexists(self._path)
1703
1704
1704 def audit(self):
1705 def audit(self):
1705 return self._repo.wvfs.audit(self._path)
1706 return self._repo.wvfs.audit(self._path)
1706
1707
1707 def cmp(self, fctx):
1708 def cmp(self, fctx):
1708 """compare with other file context
1709 """compare with other file context
1709
1710
1710 returns True if different than fctx.
1711 returns True if different than fctx.
1711 """
1712 """
1712 # fctx should be a filectx (not a workingfilectx)
1713 # fctx should be a filectx (not a workingfilectx)
1713 # invert comparison to reuse the same code path
1714 # invert comparison to reuse the same code path
1714 return fctx.cmp(self)
1715 return fctx.cmp(self)
1715
1716
1716 def remove(self, ignoremissing=False):
1717 def remove(self, ignoremissing=False):
1717 """wraps unlink for a repo's working directory"""
1718 """wraps unlink for a repo's working directory"""
1718 rmdir = self._repo.ui.configbool('experimental', 'removeemptydirs')
1719 rmdir = self._repo.ui.configbool('experimental', 'removeemptydirs')
1719 self._repo.wvfs.unlinkpath(self._path, ignoremissing=ignoremissing,
1720 self._repo.wvfs.unlinkpath(self._path, ignoremissing=ignoremissing,
1720 rmdir=rmdir)
1721 rmdir=rmdir)
1721
1722
1722 def write(self, data, flags, backgroundclose=False, **kwargs):
1723 def write(self, data, flags, backgroundclose=False, **kwargs):
1723 """wraps repo.wwrite"""
1724 """wraps repo.wwrite"""
1724 self._repo.wwrite(self._path, data, flags,
1725 self._repo.wwrite(self._path, data, flags,
1725 backgroundclose=backgroundclose,
1726 backgroundclose=backgroundclose,
1726 **kwargs)
1727 **kwargs)
1727
1728
1728 def markcopied(self, src):
1729 def markcopied(self, src):
1729 """marks this file a copy of `src`"""
1730 """marks this file a copy of `src`"""
1730 if self._repo.dirstate[self._path] in "nma":
1731 if self._repo.dirstate[self._path] in "nma":
1731 self._repo.dirstate.copy(src, self._path)
1732 self._repo.dirstate.copy(src, self._path)
1732
1733
1733 def clearunknown(self):
1734 def clearunknown(self):
1734 """Removes conflicting items in the working directory so that
1735 """Removes conflicting items in the working directory so that
1735 ``write()`` can be called successfully.
1736 ``write()`` can be called successfully.
1736 """
1737 """
1737 wvfs = self._repo.wvfs
1738 wvfs = self._repo.wvfs
1738 f = self._path
1739 f = self._path
1739 wvfs.audit(f)
1740 wvfs.audit(f)
1740 if wvfs.isdir(f) and not wvfs.islink(f):
1741 if wvfs.isdir(f) and not wvfs.islink(f):
1741 wvfs.rmtree(f, forcibly=True)
1742 wvfs.rmtree(f, forcibly=True)
1742 if self._repo.ui.configbool('experimental', 'merge.checkpathconflicts'):
1743 if self._repo.ui.configbool('experimental', 'merge.checkpathconflicts'):
1743 for p in reversed(list(util.finddirs(f))):
1744 for p in reversed(list(util.finddirs(f))):
1744 if wvfs.isfileorlink(p):
1745 if wvfs.isfileorlink(p):
1745 wvfs.unlink(p)
1746 wvfs.unlink(p)
1746 break
1747 break
1747
1748
1748 def setflags(self, l, x):
1749 def setflags(self, l, x):
1749 self._repo.wvfs.setflags(self._path, l, x)
1750 self._repo.wvfs.setflags(self._path, l, x)
1750
1751
1751 class overlayworkingctx(committablectx):
1752 class overlayworkingctx(committablectx):
1752 """Wraps another mutable context with a write-back cache that can be
1753 """Wraps another mutable context with a write-back cache that can be
1753 converted into a commit context.
1754 converted into a commit context.
1754
1755
1755 self._cache[path] maps to a dict with keys: {
1756 self._cache[path] maps to a dict with keys: {
1756 'exists': bool?
1757 'exists': bool?
1757 'date': date?
1758 'date': date?
1758 'data': str?
1759 'data': str?
1759 'flags': str?
1760 'flags': str?
1760 'copied': str? (path or None)
1761 'copied': str? (path or None)
1761 }
1762 }
1762 If `exists` is True, `flags` must be non-None and 'date' is non-None. If it
1763 If `exists` is True, `flags` must be non-None and 'date' is non-None. If it
1763 is `False`, the file was deleted.
1764 is `False`, the file was deleted.
1764 """
1765 """
1765
1766
1766 def __init__(self, repo):
1767 def __init__(self, repo):
1767 super(overlayworkingctx, self).__init__(repo)
1768 super(overlayworkingctx, self).__init__(repo)
1768 self.clean()
1769 self.clean()
1769
1770
1770 def setbase(self, wrappedctx):
1771 def setbase(self, wrappedctx):
1771 self._wrappedctx = wrappedctx
1772 self._wrappedctx = wrappedctx
1772 self._parents = [wrappedctx]
1773 self._parents = [wrappedctx]
1773 # Drop old manifest cache as it is now out of date.
1774 # Drop old manifest cache as it is now out of date.
1774 # This is necessary when, e.g., rebasing several nodes with one
1775 # This is necessary when, e.g., rebasing several nodes with one
1775 # ``overlayworkingctx`` (e.g. with --collapse).
1776 # ``overlayworkingctx`` (e.g. with --collapse).
1776 util.clearcachedproperty(self, '_manifest')
1777 util.clearcachedproperty(self, '_manifest')
1777
1778
1778 def data(self, path):
1779 def data(self, path):
1779 if self.isdirty(path):
1780 if self.isdirty(path):
1780 if self._cache[path]['exists']:
1781 if self._cache[path]['exists']:
1781 if self._cache[path]['data']:
1782 if self._cache[path]['data']:
1782 return self._cache[path]['data']
1783 return self._cache[path]['data']
1783 else:
1784 else:
1784 # Must fallback here, too, because we only set flags.
1785 # Must fallback here, too, because we only set flags.
1785 return self._wrappedctx[path].data()
1786 return self._wrappedctx[path].data()
1786 else:
1787 else:
1787 raise error.ProgrammingError("No such file or directory: %s" %
1788 raise error.ProgrammingError("No such file or directory: %s" %
1788 path)
1789 path)
1789 else:
1790 else:
1790 return self._wrappedctx[path].data()
1791 return self._wrappedctx[path].data()
1791
1792
1792 @propertycache
1793 @propertycache
1793 def _manifest(self):
1794 def _manifest(self):
1794 parents = self.parents()
1795 parents = self.parents()
1795 man = parents[0].manifest().copy()
1796 man = parents[0].manifest().copy()
1796
1797
1797 flag = self._flagfunc
1798 flag = self._flagfunc
1798 for path in self.added():
1799 for path in self.added():
1799 man[path] = addednodeid
1800 man[path] = addednodeid
1800 man.setflag(path, flag(path))
1801 man.setflag(path, flag(path))
1801 for path in self.modified():
1802 for path in self.modified():
1802 man[path] = modifiednodeid
1803 man[path] = modifiednodeid
1803 man.setflag(path, flag(path))
1804 man.setflag(path, flag(path))
1804 for path in self.removed():
1805 for path in self.removed():
1805 del man[path]
1806 del man[path]
1806 return man
1807 return man
1807
1808
1808 @propertycache
1809 @propertycache
1809 def _flagfunc(self):
1810 def _flagfunc(self):
1810 def f(path):
1811 def f(path):
1811 return self._cache[path]['flags']
1812 return self._cache[path]['flags']
1812 return f
1813 return f
1813
1814
1814 def files(self):
1815 def files(self):
1815 return sorted(self.added() + self.modified() + self.removed())
1816 return sorted(self.added() + self.modified() + self.removed())
1816
1817
1817 def modified(self):
1818 def modified(self):
1818 return [f for f in self._cache.keys() if self._cache[f]['exists'] and
1819 return [f for f in self._cache.keys() if self._cache[f]['exists'] and
1819 self._existsinparent(f)]
1820 self._existsinparent(f)]
1820
1821
1821 def added(self):
1822 def added(self):
1822 return [f for f in self._cache.keys() if self._cache[f]['exists'] and
1823 return [f for f in self._cache.keys() if self._cache[f]['exists'] and
1823 not self._existsinparent(f)]
1824 not self._existsinparent(f)]
1824
1825
1825 def removed(self):
1826 def removed(self):
1826 return [f for f in self._cache.keys() if
1827 return [f for f in self._cache.keys() if
1827 not self._cache[f]['exists'] and self._existsinparent(f)]
1828 not self._cache[f]['exists'] and self._existsinparent(f)]
1828
1829
1829 def isinmemory(self):
1830 def isinmemory(self):
1830 return True
1831 return True
1831
1832
1832 def filedate(self, path):
1833 def filedate(self, path):
1833 if self.isdirty(path):
1834 if self.isdirty(path):
1834 return self._cache[path]['date']
1835 return self._cache[path]['date']
1835 else:
1836 else:
1836 return self._wrappedctx[path].date()
1837 return self._wrappedctx[path].date()
1837
1838
1838 def markcopied(self, path, origin):
1839 def markcopied(self, path, origin):
1839 if self.isdirty(path):
1840 if self.isdirty(path):
1840 self._cache[path]['copied'] = origin
1841 self._cache[path]['copied'] = origin
1841 else:
1842 else:
1842 raise error.ProgrammingError('markcopied() called on clean context')
1843 raise error.ProgrammingError('markcopied() called on clean context')
1843
1844
1844 def copydata(self, path):
1845 def copydata(self, path):
1845 if self.isdirty(path):
1846 if self.isdirty(path):
1846 return self._cache[path]['copied']
1847 return self._cache[path]['copied']
1847 else:
1848 else:
1848 raise error.ProgrammingError('copydata() called on clean context')
1849 raise error.ProgrammingError('copydata() called on clean context')
1849
1850
1850 def flags(self, path):
1851 def flags(self, path):
1851 if self.isdirty(path):
1852 if self.isdirty(path):
1852 if self._cache[path]['exists']:
1853 if self._cache[path]['exists']:
1853 return self._cache[path]['flags']
1854 return self._cache[path]['flags']
1854 else:
1855 else:
1855 raise error.ProgrammingError("No such file or directory: %s" %
1856 raise error.ProgrammingError("No such file or directory: %s" %
1856 self._path)
1857 self._path)
1857 else:
1858 else:
1858 return self._wrappedctx[path].flags()
1859 return self._wrappedctx[path].flags()
1859
1860
1860 def _existsinparent(self, path):
1861 def _existsinparent(self, path):
1861 try:
1862 try:
1862 # ``commitctx` raises a ``ManifestLookupError`` if a path does not
1863 # ``commitctx` raises a ``ManifestLookupError`` if a path does not
1863 # exist, unlike ``workingctx``, which returns a ``workingfilectx``
1864 # exist, unlike ``workingctx``, which returns a ``workingfilectx``
1864 # with an ``exists()`` function.
1865 # with an ``exists()`` function.
1865 self._wrappedctx[path]
1866 self._wrappedctx[path]
1866 return True
1867 return True
1867 except error.ManifestLookupError:
1868 except error.ManifestLookupError:
1868 return False
1869 return False
1869
1870
1870 def _auditconflicts(self, path):
1871 def _auditconflicts(self, path):
1871 """Replicates conflict checks done by wvfs.write().
1872 """Replicates conflict checks done by wvfs.write().
1872
1873
1873 Since we never write to the filesystem and never call `applyupdates` in
1874 Since we never write to the filesystem and never call `applyupdates` in
1874 IMM, we'll never check that a path is actually writable -- e.g., because
1875 IMM, we'll never check that a path is actually writable -- e.g., because
1875 it adds `a/foo`, but `a` is actually a file in the other commit.
1876 it adds `a/foo`, but `a` is actually a file in the other commit.
1876 """
1877 """
1877 def fail(path, component):
1878 def fail(path, component):
1878 # p1() is the base and we're receiving "writes" for p2()'s
1879 # p1() is the base and we're receiving "writes" for p2()'s
1879 # files.
1880 # files.
1880 if 'l' in self.p1()[component].flags():
1881 if 'l' in self.p1()[component].flags():
1881 raise error.Abort("error: %s conflicts with symlink %s "
1882 raise error.Abort("error: %s conflicts with symlink %s "
1882 "in %s." % (path, component,
1883 "in %s." % (path, component,
1883 self.p1().rev()))
1884 self.p1().rev()))
1884 else:
1885 else:
1885 raise error.Abort("error: '%s' conflicts with file '%s' in "
1886 raise error.Abort("error: '%s' conflicts with file '%s' in "
1886 "%s." % (path, component,
1887 "%s." % (path, component,
1887 self.p1().rev()))
1888 self.p1().rev()))
1888
1889
1889 # Test that each new directory to be created to write this path from p2
1890 # Test that each new directory to be created to write this path from p2
1890 # is not a file in p1.
1891 # is not a file in p1.
1891 components = path.split('/')
1892 components = path.split('/')
1892 for i in xrange(len(components)):
1893 for i in xrange(len(components)):
1893 component = "/".join(components[0:i])
1894 component = "/".join(components[0:i])
1894 if component in self.p1():
1895 if component in self.p1():
1895 fail(path, component)
1896 fail(path, component)
1896
1897
1897 # Test the other direction -- that this path from p2 isn't a directory
1898 # Test the other direction -- that this path from p2 isn't a directory
1898 # in p1 (test that p1 doesn't any paths matching `path/*`).
1899 # in p1 (test that p1 doesn't any paths matching `path/*`).
1899 match = matchmod.match('/', '', [path + '/'], default=b'relpath')
1900 match = matchmod.match('/', '', [path + '/'], default=b'relpath')
1900 matches = self.p1().manifest().matches(match)
1901 matches = self.p1().manifest().matches(match)
1901 if len(matches) > 0:
1902 if len(matches) > 0:
1902 if len(matches) == 1 and matches.keys()[0] == path:
1903 if len(matches) == 1 and matches.keys()[0] == path:
1903 return
1904 return
1904 raise error.Abort("error: file '%s' cannot be written because "
1905 raise error.Abort("error: file '%s' cannot be written because "
1905 " '%s/' is a folder in %s (containing %d "
1906 " '%s/' is a folder in %s (containing %d "
1906 "entries: %s)"
1907 "entries: %s)"
1907 % (path, path, self.p1(), len(matches),
1908 % (path, path, self.p1(), len(matches),
1908 ', '.join(matches.keys())))
1909 ', '.join(matches.keys())))
1909
1910
1910 def write(self, path, data, flags='', **kwargs):
1911 def write(self, path, data, flags='', **kwargs):
1911 if data is None:
1912 if data is None:
1912 raise error.ProgrammingError("data must be non-None")
1913 raise error.ProgrammingError("data must be non-None")
1913 self._auditconflicts(path)
1914 self._auditconflicts(path)
1914 self._markdirty(path, exists=True, data=data, date=dateutil.makedate(),
1915 self._markdirty(path, exists=True, data=data, date=dateutil.makedate(),
1915 flags=flags)
1916 flags=flags)
1916
1917
1917 def setflags(self, path, l, x):
1918 def setflags(self, path, l, x):
1918 self._markdirty(path, exists=True, date=dateutil.makedate(),
1919 self._markdirty(path, exists=True, date=dateutil.makedate(),
1919 flags=(l and 'l' or '') + (x and 'x' or ''))
1920 flags=(l and 'l' or '') + (x and 'x' or ''))
1920
1921
1921 def remove(self, path):
1922 def remove(self, path):
1922 self._markdirty(path, exists=False)
1923 self._markdirty(path, exists=False)
1923
1924
1924 def exists(self, path):
1925 def exists(self, path):
1925 """exists behaves like `lexists`, but needs to follow symlinks and
1926 """exists behaves like `lexists`, but needs to follow symlinks and
1926 return False if they are broken.
1927 return False if they are broken.
1927 """
1928 """
1928 if self.isdirty(path):
1929 if self.isdirty(path):
1929 # If this path exists and is a symlink, "follow" it by calling
1930 # If this path exists and is a symlink, "follow" it by calling
1930 # exists on the destination path.
1931 # exists on the destination path.
1931 if (self._cache[path]['exists'] and
1932 if (self._cache[path]['exists'] and
1932 'l' in self._cache[path]['flags']):
1933 'l' in self._cache[path]['flags']):
1933 return self.exists(self._cache[path]['data'].strip())
1934 return self.exists(self._cache[path]['data'].strip())
1934 else:
1935 else:
1935 return self._cache[path]['exists']
1936 return self._cache[path]['exists']
1936
1937
1937 return self._existsinparent(path)
1938 return self._existsinparent(path)
1938
1939
1939 def lexists(self, path):
1940 def lexists(self, path):
1940 """lexists returns True if the path exists"""
1941 """lexists returns True if the path exists"""
1941 if self.isdirty(path):
1942 if self.isdirty(path):
1942 return self._cache[path]['exists']
1943 return self._cache[path]['exists']
1943
1944
1944 return self._existsinparent(path)
1945 return self._existsinparent(path)
1945
1946
1946 def size(self, path):
1947 def size(self, path):
1947 if self.isdirty(path):
1948 if self.isdirty(path):
1948 if self._cache[path]['exists']:
1949 if self._cache[path]['exists']:
1949 return len(self._cache[path]['data'])
1950 return len(self._cache[path]['data'])
1950 else:
1951 else:
1951 raise error.ProgrammingError("No such file or directory: %s" %
1952 raise error.ProgrammingError("No such file or directory: %s" %
1952 self._path)
1953 self._path)
1953 return self._wrappedctx[path].size()
1954 return self._wrappedctx[path].size()
1954
1955
1955 def tomemctx(self, text, branch=None, extra=None, date=None, parents=None,
1956 def tomemctx(self, text, branch=None, extra=None, date=None, parents=None,
1956 user=None, editor=None):
1957 user=None, editor=None):
1957 """Converts this ``overlayworkingctx`` into a ``memctx`` ready to be
1958 """Converts this ``overlayworkingctx`` into a ``memctx`` ready to be
1958 committed.
1959 committed.
1959
1960
1960 ``text`` is the commit message.
1961 ``text`` is the commit message.
1961 ``parents`` (optional) are rev numbers.
1962 ``parents`` (optional) are rev numbers.
1962 """
1963 """
1963 # Default parents to the wrapped contexts' if not passed.
1964 # Default parents to the wrapped contexts' if not passed.
1964 if parents is None:
1965 if parents is None:
1965 parents = self._wrappedctx.parents()
1966 parents = self._wrappedctx.parents()
1966 if len(parents) == 1:
1967 if len(parents) == 1:
1967 parents = (parents[0], None)
1968 parents = (parents[0], None)
1968
1969
1969 # ``parents`` is passed as rev numbers; convert to ``commitctxs``.
1970 # ``parents`` is passed as rev numbers; convert to ``commitctxs``.
1970 if parents[1] is None:
1971 if parents[1] is None:
1971 parents = (self._repo[parents[0]], None)
1972 parents = (self._repo[parents[0]], None)
1972 else:
1973 else:
1973 parents = (self._repo[parents[0]], self._repo[parents[1]])
1974 parents = (self._repo[parents[0]], self._repo[parents[1]])
1974
1975
1975 files = self._cache.keys()
1976 files = self._cache.keys()
1976 def getfile(repo, memctx, path):
1977 def getfile(repo, memctx, path):
1977 if self._cache[path]['exists']:
1978 if self._cache[path]['exists']:
1978 return memfilectx(repo, memctx, path,
1979 return memfilectx(repo, memctx, path,
1979 self._cache[path]['data'],
1980 self._cache[path]['data'],
1980 'l' in self._cache[path]['flags'],
1981 'l' in self._cache[path]['flags'],
1981 'x' in self._cache[path]['flags'],
1982 'x' in self._cache[path]['flags'],
1982 self._cache[path]['copied'])
1983 self._cache[path]['copied'])
1983 else:
1984 else:
1984 # Returning None, but including the path in `files`, is
1985 # Returning None, but including the path in `files`, is
1985 # necessary for memctx to register a deletion.
1986 # necessary for memctx to register a deletion.
1986 return None
1987 return None
1987 return memctx(self._repo, parents, text, files, getfile, date=date,
1988 return memctx(self._repo, parents, text, files, getfile, date=date,
1988 extra=extra, user=user, branch=branch, editor=editor)
1989 extra=extra, user=user, branch=branch, editor=editor)
1989
1990
1990 def isdirty(self, path):
1991 def isdirty(self, path):
1991 return path in self._cache
1992 return path in self._cache
1992
1993
1993 def isempty(self):
1994 def isempty(self):
1994 # We need to discard any keys that are actually clean before the empty
1995 # We need to discard any keys that are actually clean before the empty
1995 # commit check.
1996 # commit check.
1996 self._compact()
1997 self._compact()
1997 return len(self._cache) == 0
1998 return len(self._cache) == 0
1998
1999
1999 def clean(self):
2000 def clean(self):
2000 self._cache = {}
2001 self._cache = {}
2001
2002
2002 def _compact(self):
2003 def _compact(self):
2003 """Removes keys from the cache that are actually clean, by comparing
2004 """Removes keys from the cache that are actually clean, by comparing
2004 them with the underlying context.
2005 them with the underlying context.
2005
2006
2006 This can occur during the merge process, e.g. by passing --tool :local
2007 This can occur during the merge process, e.g. by passing --tool :local
2007 to resolve a conflict.
2008 to resolve a conflict.
2008 """
2009 """
2009 keys = []
2010 keys = []
2010 for path in self._cache.keys():
2011 for path in self._cache.keys():
2011 cache = self._cache[path]
2012 cache = self._cache[path]
2012 try:
2013 try:
2013 underlying = self._wrappedctx[path]
2014 underlying = self._wrappedctx[path]
2014 if (underlying.data() == cache['data'] and
2015 if (underlying.data() == cache['data'] and
2015 underlying.flags() == cache['flags']):
2016 underlying.flags() == cache['flags']):
2016 keys.append(path)
2017 keys.append(path)
2017 except error.ManifestLookupError:
2018 except error.ManifestLookupError:
2018 # Path not in the underlying manifest (created).
2019 # Path not in the underlying manifest (created).
2019 continue
2020 continue
2020
2021
2021 for path in keys:
2022 for path in keys:
2022 del self._cache[path]
2023 del self._cache[path]
2023 return keys
2024 return keys
2024
2025
2025 def _markdirty(self, path, exists, data=None, date=None, flags=''):
2026 def _markdirty(self, path, exists, data=None, date=None, flags=''):
2026 self._cache[path] = {
2027 self._cache[path] = {
2027 'exists': exists,
2028 'exists': exists,
2028 'data': data,
2029 'data': data,
2029 'date': date,
2030 'date': date,
2030 'flags': flags,
2031 'flags': flags,
2031 'copied': None,
2032 'copied': None,
2032 }
2033 }
2033
2034
2034 def filectx(self, path, filelog=None):
2035 def filectx(self, path, filelog=None):
2035 return overlayworkingfilectx(self._repo, path, parent=self,
2036 return overlayworkingfilectx(self._repo, path, parent=self,
2036 filelog=filelog)
2037 filelog=filelog)
2037
2038
2038 class overlayworkingfilectx(committablefilectx):
2039 class overlayworkingfilectx(committablefilectx):
2039 """Wrap a ``workingfilectx`` but intercepts all writes into an in-memory
2040 """Wrap a ``workingfilectx`` but intercepts all writes into an in-memory
2040 cache, which can be flushed through later by calling ``flush()``."""
2041 cache, which can be flushed through later by calling ``flush()``."""
2041
2042
2042 def __init__(self, repo, path, filelog=None, parent=None):
2043 def __init__(self, repo, path, filelog=None, parent=None):
2043 super(overlayworkingfilectx, self).__init__(repo, path, filelog,
2044 super(overlayworkingfilectx, self).__init__(repo, path, filelog,
2044 parent)
2045 parent)
2045 self._repo = repo
2046 self._repo = repo
2046 self._parent = parent
2047 self._parent = parent
2047 self._path = path
2048 self._path = path
2048
2049
2049 def cmp(self, fctx):
2050 def cmp(self, fctx):
2050 return self.data() != fctx.data()
2051 return self.data() != fctx.data()
2051
2052
2052 def changectx(self):
2053 def changectx(self):
2053 return self._parent
2054 return self._parent
2054
2055
2055 def data(self):
2056 def data(self):
2056 return self._parent.data(self._path)
2057 return self._parent.data(self._path)
2057
2058
2058 def date(self):
2059 def date(self):
2059 return self._parent.filedate(self._path)
2060 return self._parent.filedate(self._path)
2060
2061
2061 def exists(self):
2062 def exists(self):
2062 return self.lexists()
2063 return self.lexists()
2063
2064
2064 def lexists(self):
2065 def lexists(self):
2065 return self._parent.exists(self._path)
2066 return self._parent.exists(self._path)
2066
2067
2067 def renamed(self):
2068 def renamed(self):
2068 path = self._parent.copydata(self._path)
2069 path = self._parent.copydata(self._path)
2069 if not path:
2070 if not path:
2070 return None
2071 return None
2071 return path, self._changectx._parents[0]._manifest.get(path, nullid)
2072 return path, self._changectx._parents[0]._manifest.get(path, nullid)
2072
2073
2073 def size(self):
2074 def size(self):
2074 return self._parent.size(self._path)
2075 return self._parent.size(self._path)
2075
2076
2076 def markcopied(self, origin):
2077 def markcopied(self, origin):
2077 self._parent.markcopied(self._path, origin)
2078 self._parent.markcopied(self._path, origin)
2078
2079
2079 def audit(self):
2080 def audit(self):
2080 pass
2081 pass
2081
2082
2082 def flags(self):
2083 def flags(self):
2083 return self._parent.flags(self._path)
2084 return self._parent.flags(self._path)
2084
2085
2085 def setflags(self, islink, isexec):
2086 def setflags(self, islink, isexec):
2086 return self._parent.setflags(self._path, islink, isexec)
2087 return self._parent.setflags(self._path, islink, isexec)
2087
2088
2088 def write(self, data, flags, backgroundclose=False, **kwargs):
2089 def write(self, data, flags, backgroundclose=False, **kwargs):
2089 return self._parent.write(self._path, data, flags, **kwargs)
2090 return self._parent.write(self._path, data, flags, **kwargs)
2090
2091
2091 def remove(self, ignoremissing=False):
2092 def remove(self, ignoremissing=False):
2092 return self._parent.remove(self._path)
2093 return self._parent.remove(self._path)
2093
2094
2094 def clearunknown(self):
2095 def clearunknown(self):
2095 pass
2096 pass
2096
2097
2097 class workingcommitctx(workingctx):
2098 class workingcommitctx(workingctx):
2098 """A workingcommitctx object makes access to data related to
2099 """A workingcommitctx object makes access to data related to
2099 the revision being committed convenient.
2100 the revision being committed convenient.
2100
2101
2101 This hides changes in the working directory, if they aren't
2102 This hides changes in the working directory, if they aren't
2102 committed in this context.
2103 committed in this context.
2103 """
2104 """
2104 def __init__(self, repo, changes,
2105 def __init__(self, repo, changes,
2105 text="", user=None, date=None, extra=None):
2106 text="", user=None, date=None, extra=None):
2106 super(workingctx, self).__init__(repo, text, user, date, extra,
2107 super(workingctx, self).__init__(repo, text, user, date, extra,
2107 changes)
2108 changes)
2108
2109
2109 def _dirstatestatus(self, match, ignored=False, clean=False, unknown=False):
2110 def _dirstatestatus(self, match, ignored=False, clean=False, unknown=False):
2110 """Return matched files only in ``self._status``
2111 """Return matched files only in ``self._status``
2111
2112
2112 Uncommitted files appear "clean" via this context, even if
2113 Uncommitted files appear "clean" via this context, even if
2113 they aren't actually so in the working directory.
2114 they aren't actually so in the working directory.
2114 """
2115 """
2115 if clean:
2116 if clean:
2116 clean = [f for f in self._manifest if f not in self._changedset]
2117 clean = [f for f in self._manifest if f not in self._changedset]
2117 else:
2118 else:
2118 clean = []
2119 clean = []
2119 return scmutil.status([f for f in self._status.modified if match(f)],
2120 return scmutil.status([f for f in self._status.modified if match(f)],
2120 [f for f in self._status.added if match(f)],
2121 [f for f in self._status.added if match(f)],
2121 [f for f in self._status.removed if match(f)],
2122 [f for f in self._status.removed if match(f)],
2122 [], [], [], clean)
2123 [], [], [], clean)
2123
2124
2124 @propertycache
2125 @propertycache
2125 def _changedset(self):
2126 def _changedset(self):
2126 """Return the set of files changed in this context
2127 """Return the set of files changed in this context
2127 """
2128 """
2128 changed = set(self._status.modified)
2129 changed = set(self._status.modified)
2129 changed.update(self._status.added)
2130 changed.update(self._status.added)
2130 changed.update(self._status.removed)
2131 changed.update(self._status.removed)
2131 return changed
2132 return changed
2132
2133
2133 def makecachingfilectxfn(func):
2134 def makecachingfilectxfn(func):
2134 """Create a filectxfn that caches based on the path.
2135 """Create a filectxfn that caches based on the path.
2135
2136
2136 We can't use util.cachefunc because it uses all arguments as the cache
2137 We can't use util.cachefunc because it uses all arguments as the cache
2137 key and this creates a cycle since the arguments include the repo and
2138 key and this creates a cycle since the arguments include the repo and
2138 memctx.
2139 memctx.
2139 """
2140 """
2140 cache = {}
2141 cache = {}
2141
2142
2142 def getfilectx(repo, memctx, path):
2143 def getfilectx(repo, memctx, path):
2143 if path not in cache:
2144 if path not in cache:
2144 cache[path] = func(repo, memctx, path)
2145 cache[path] = func(repo, memctx, path)
2145 return cache[path]
2146 return cache[path]
2146
2147
2147 return getfilectx
2148 return getfilectx
2148
2149
2149 def memfilefromctx(ctx):
2150 def memfilefromctx(ctx):
2150 """Given a context return a memfilectx for ctx[path]
2151 """Given a context return a memfilectx for ctx[path]
2151
2152
2152 This is a convenience method for building a memctx based on another
2153 This is a convenience method for building a memctx based on another
2153 context.
2154 context.
2154 """
2155 """
2155 def getfilectx(repo, memctx, path):
2156 def getfilectx(repo, memctx, path):
2156 fctx = ctx[path]
2157 fctx = ctx[path]
2157 # this is weird but apparently we only keep track of one parent
2158 # this is weird but apparently we only keep track of one parent
2158 # (why not only store that instead of a tuple?)
2159 # (why not only store that instead of a tuple?)
2159 copied = fctx.renamed()
2160 copied = fctx.renamed()
2160 if copied:
2161 if copied:
2161 copied = copied[0]
2162 copied = copied[0]
2162 return memfilectx(repo, memctx, path, fctx.data(),
2163 return memfilectx(repo, memctx, path, fctx.data(),
2163 islink=fctx.islink(), isexec=fctx.isexec(),
2164 islink=fctx.islink(), isexec=fctx.isexec(),
2164 copied=copied)
2165 copied=copied)
2165
2166
2166 return getfilectx
2167 return getfilectx
2167
2168
2168 def memfilefrompatch(patchstore):
2169 def memfilefrompatch(patchstore):
2169 """Given a patch (e.g. patchstore object) return a memfilectx
2170 """Given a patch (e.g. patchstore object) return a memfilectx
2170
2171
2171 This is a convenience method for building a memctx based on a patchstore.
2172 This is a convenience method for building a memctx based on a patchstore.
2172 """
2173 """
2173 def getfilectx(repo, memctx, path):
2174 def getfilectx(repo, memctx, path):
2174 data, mode, copied = patchstore.getfile(path)
2175 data, mode, copied = patchstore.getfile(path)
2175 if data is None:
2176 if data is None:
2176 return None
2177 return None
2177 islink, isexec = mode
2178 islink, isexec = mode
2178 return memfilectx(repo, memctx, path, data, islink=islink,
2179 return memfilectx(repo, memctx, path, data, islink=islink,
2179 isexec=isexec, copied=copied)
2180 isexec=isexec, copied=copied)
2180
2181
2181 return getfilectx
2182 return getfilectx
2182
2183
2183 class memctx(committablectx):
2184 class memctx(committablectx):
2184 """Use memctx to perform in-memory commits via localrepo.commitctx().
2185 """Use memctx to perform in-memory commits via localrepo.commitctx().
2185
2186
2186 Revision information is supplied at initialization time while
2187 Revision information is supplied at initialization time while
2187 related files data and is made available through a callback
2188 related files data and is made available through a callback
2188 mechanism. 'repo' is the current localrepo, 'parents' is a
2189 mechanism. 'repo' is the current localrepo, 'parents' is a
2189 sequence of two parent revisions identifiers (pass None for every
2190 sequence of two parent revisions identifiers (pass None for every
2190 missing parent), 'text' is the commit message and 'files' lists
2191 missing parent), 'text' is the commit message and 'files' lists
2191 names of files touched by the revision (normalized and relative to
2192 names of files touched by the revision (normalized and relative to
2192 repository root).
2193 repository root).
2193
2194
2194 filectxfn(repo, memctx, path) is a callable receiving the
2195 filectxfn(repo, memctx, path) is a callable receiving the
2195 repository, the current memctx object and the normalized path of
2196 repository, the current memctx object and the normalized path of
2196 requested file, relative to repository root. It is fired by the
2197 requested file, relative to repository root. It is fired by the
2197 commit function for every file in 'files', but calls order is
2198 commit function for every file in 'files', but calls order is
2198 undefined. If the file is available in the revision being
2199 undefined. If the file is available in the revision being
2199 committed (updated or added), filectxfn returns a memfilectx
2200 committed (updated or added), filectxfn returns a memfilectx
2200 object. If the file was removed, filectxfn return None for recent
2201 object. If the file was removed, filectxfn return None for recent
2201 Mercurial. Moved files are represented by marking the source file
2202 Mercurial. Moved files are represented by marking the source file
2202 removed and the new file added with copy information (see
2203 removed and the new file added with copy information (see
2203 memfilectx).
2204 memfilectx).
2204
2205
2205 user receives the committer name and defaults to current
2206 user receives the committer name and defaults to current
2206 repository username, date is the commit date in any format
2207 repository username, date is the commit date in any format
2207 supported by dateutil.parsedate() and defaults to current date, extra
2208 supported by dateutil.parsedate() and defaults to current date, extra
2208 is a dictionary of metadata or is left empty.
2209 is a dictionary of metadata or is left empty.
2209 """
2210 """
2210
2211
2211 # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing files.
2212 # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing files.
2212 # Extensions that need to retain compatibility across Mercurial 3.1 can use
2213 # Extensions that need to retain compatibility across Mercurial 3.1 can use
2213 # this field to determine what to do in filectxfn.
2214 # this field to determine what to do in filectxfn.
2214 _returnnoneformissingfiles = True
2215 _returnnoneformissingfiles = True
2215
2216
2216 def __init__(self, repo, parents, text, files, filectxfn, user=None,
2217 def __init__(self, repo, parents, text, files, filectxfn, user=None,
2217 date=None, extra=None, branch=None, editor=False):
2218 date=None, extra=None, branch=None, editor=False):
2218 super(memctx, self).__init__(repo, text, user, date, extra)
2219 super(memctx, self).__init__(repo, text, user, date, extra)
2219 self._rev = None
2220 self._rev = None
2220 self._node = None
2221 self._node = None
2221 parents = [(p or nullid) for p in parents]
2222 parents = [(p or nullid) for p in parents]
2222 p1, p2 = parents
2223 p1, p2 = parents
2223 self._parents = [self._repo[p] for p in (p1, p2)]
2224 self._parents = [self._repo[p] for p in (p1, p2)]
2224 files = sorted(set(files))
2225 files = sorted(set(files))
2225 self._files = files
2226 self._files = files
2226 if branch is not None:
2227 if branch is not None:
2227 self._extra['branch'] = encoding.fromlocal(branch)
2228 self._extra['branch'] = encoding.fromlocal(branch)
2228 self.substate = {}
2229 self.substate = {}
2229
2230
2230 if isinstance(filectxfn, patch.filestore):
2231 if isinstance(filectxfn, patch.filestore):
2231 filectxfn = memfilefrompatch(filectxfn)
2232 filectxfn = memfilefrompatch(filectxfn)
2232 elif not callable(filectxfn):
2233 elif not callable(filectxfn):
2233 # if store is not callable, wrap it in a function
2234 # if store is not callable, wrap it in a function
2234 filectxfn = memfilefromctx(filectxfn)
2235 filectxfn = memfilefromctx(filectxfn)
2235
2236
2236 # memoizing increases performance for e.g. vcs convert scenarios.
2237 # memoizing increases performance for e.g. vcs convert scenarios.
2237 self._filectxfn = makecachingfilectxfn(filectxfn)
2238 self._filectxfn = makecachingfilectxfn(filectxfn)
2238
2239
2239 if editor:
2240 if editor:
2240 self._text = editor(self._repo, self, [])
2241 self._text = editor(self._repo, self, [])
2241 self._repo.savecommitmessage(self._text)
2242 self._repo.savecommitmessage(self._text)
2242
2243
2243 def filectx(self, path, filelog=None):
2244 def filectx(self, path, filelog=None):
2244 """get a file context from the working directory
2245 """get a file context from the working directory
2245
2246
2246 Returns None if file doesn't exist and should be removed."""
2247 Returns None if file doesn't exist and should be removed."""
2247 return self._filectxfn(self._repo, self, path)
2248 return self._filectxfn(self._repo, self, path)
2248
2249
2249 def commit(self):
2250 def commit(self):
2250 """commit context to the repo"""
2251 """commit context to the repo"""
2251 return self._repo.commitctx(self)
2252 return self._repo.commitctx(self)
2252
2253
2253 @propertycache
2254 @propertycache
2254 def _manifest(self):
2255 def _manifest(self):
2255 """generate a manifest based on the return values of filectxfn"""
2256 """generate a manifest based on the return values of filectxfn"""
2256
2257
2257 # keep this simple for now; just worry about p1
2258 # keep this simple for now; just worry about p1
2258 pctx = self._parents[0]
2259 pctx = self._parents[0]
2259 man = pctx.manifest().copy()
2260 man = pctx.manifest().copy()
2260
2261
2261 for f in self._status.modified:
2262 for f in self._status.modified:
2262 p1node = nullid
2263 p1node = nullid
2263 p2node = nullid
2264 p2node = nullid
2264 p = pctx[f].parents() # if file isn't in pctx, check p2?
2265 p = pctx[f].parents() # if file isn't in pctx, check p2?
2265 if len(p) > 0:
2266 if len(p) > 0:
2266 p1node = p[0].filenode()
2267 p1node = p[0].filenode()
2267 if len(p) > 1:
2268 if len(p) > 1:
2268 p2node = p[1].filenode()
2269 p2node = p[1].filenode()
2269 man[f] = revlog.hash(self[f].data(), p1node, p2node)
2270 man[f] = revlog.hash(self[f].data(), p1node, p2node)
2270
2271
2271 for f in self._status.added:
2272 for f in self._status.added:
2272 man[f] = revlog.hash(self[f].data(), nullid, nullid)
2273 man[f] = revlog.hash(self[f].data(), nullid, nullid)
2273
2274
2274 for f in self._status.removed:
2275 for f in self._status.removed:
2275 if f in man:
2276 if f in man:
2276 del man[f]
2277 del man[f]
2277
2278
2278 return man
2279 return man
2279
2280
2280 @propertycache
2281 @propertycache
2281 def _status(self):
2282 def _status(self):
2282 """Calculate exact status from ``files`` specified at construction
2283 """Calculate exact status from ``files`` specified at construction
2283 """
2284 """
2284 man1 = self.p1().manifest()
2285 man1 = self.p1().manifest()
2285 p2 = self._parents[1]
2286 p2 = self._parents[1]
2286 # "1 < len(self._parents)" can't be used for checking
2287 # "1 < len(self._parents)" can't be used for checking
2287 # existence of the 2nd parent, because "memctx._parents" is
2288 # existence of the 2nd parent, because "memctx._parents" is
2288 # explicitly initialized by the list, of which length is 2.
2289 # explicitly initialized by the list, of which length is 2.
2289 if p2.node() != nullid:
2290 if p2.node() != nullid:
2290 man2 = p2.manifest()
2291 man2 = p2.manifest()
2291 managing = lambda f: f in man1 or f in man2
2292 managing = lambda f: f in man1 or f in man2
2292 else:
2293 else:
2293 managing = lambda f: f in man1
2294 managing = lambda f: f in man1
2294
2295
2295 modified, added, removed = [], [], []
2296 modified, added, removed = [], [], []
2296 for f in self._files:
2297 for f in self._files:
2297 if not managing(f):
2298 if not managing(f):
2298 added.append(f)
2299 added.append(f)
2299 elif self[f]:
2300 elif self[f]:
2300 modified.append(f)
2301 modified.append(f)
2301 else:
2302 else:
2302 removed.append(f)
2303 removed.append(f)
2303
2304
2304 return scmutil.status(modified, added, removed, [], [], [], [])
2305 return scmutil.status(modified, added, removed, [], [], [], [])
2305
2306
2306 class memfilectx(committablefilectx):
2307 class memfilectx(committablefilectx):
2307 """memfilectx represents an in-memory file to commit.
2308 """memfilectx represents an in-memory file to commit.
2308
2309
2309 See memctx and committablefilectx for more details.
2310 See memctx and committablefilectx for more details.
2310 """
2311 """
2311 def __init__(self, repo, changectx, path, data, islink=False,
2312 def __init__(self, repo, changectx, path, data, islink=False,
2312 isexec=False, copied=None):
2313 isexec=False, copied=None):
2313 """
2314 """
2314 path is the normalized file path relative to repository root.
2315 path is the normalized file path relative to repository root.
2315 data is the file content as a string.
2316 data is the file content as a string.
2316 islink is True if the file is a symbolic link.
2317 islink is True if the file is a symbolic link.
2317 isexec is True if the file is executable.
2318 isexec is True if the file is executable.
2318 copied is the source file path if current file was copied in the
2319 copied is the source file path if current file was copied in the
2319 revision being committed, or None."""
2320 revision being committed, or None."""
2320 super(memfilectx, self).__init__(repo, path, None, changectx)
2321 super(memfilectx, self).__init__(repo, path, None, changectx)
2321 self._data = data
2322 self._data = data
2322 self._flags = (islink and 'l' or '') + (isexec and 'x' or '')
2323 self._flags = (islink and 'l' or '') + (isexec and 'x' or '')
2323 self._copied = None
2324 self._copied = None
2324 if copied:
2325 if copied:
2325 self._copied = (copied, nullid)
2326 self._copied = (copied, nullid)
2326
2327
2327 def data(self):
2328 def data(self):
2328 return self._data
2329 return self._data
2329
2330
2330 def remove(self, ignoremissing=False):
2331 def remove(self, ignoremissing=False):
2331 """wraps unlink for a repo's working directory"""
2332 """wraps unlink for a repo's working directory"""
2332 # need to figure out what to do here
2333 # need to figure out what to do here
2333 del self._changectx[self._path]
2334 del self._changectx[self._path]
2334
2335
2335 def write(self, data, flags, **kwargs):
2336 def write(self, data, flags, **kwargs):
2336 """wraps repo.wwrite"""
2337 """wraps repo.wwrite"""
2337 self._data = data
2338 self._data = data
2338
2339
2339 class overlayfilectx(committablefilectx):
2340 class overlayfilectx(committablefilectx):
2340 """Like memfilectx but take an original filectx and optional parameters to
2341 """Like memfilectx but take an original filectx and optional parameters to
2341 override parts of it. This is useful when fctx.data() is expensive (i.e.
2342 override parts of it. This is useful when fctx.data() is expensive (i.e.
2342 flag processor is expensive) and raw data, flags, and filenode could be
2343 flag processor is expensive) and raw data, flags, and filenode could be
2343 reused (ex. rebase or mode-only amend a REVIDX_EXTSTORED file).
2344 reused (ex. rebase or mode-only amend a REVIDX_EXTSTORED file).
2344 """
2345 """
2345
2346
2346 def __init__(self, originalfctx, datafunc=None, path=None, flags=None,
2347 def __init__(self, originalfctx, datafunc=None, path=None, flags=None,
2347 copied=None, ctx=None):
2348 copied=None, ctx=None):
2348 """originalfctx: filecontext to duplicate
2349 """originalfctx: filecontext to duplicate
2349
2350
2350 datafunc: None or a function to override data (file content). It is a
2351 datafunc: None or a function to override data (file content). It is a
2351 function to be lazy. path, flags, copied, ctx: None or overridden value
2352 function to be lazy. path, flags, copied, ctx: None or overridden value
2352
2353
2353 copied could be (path, rev), or False. copied could also be just path,
2354 copied could be (path, rev), or False. copied could also be just path,
2354 and will be converted to (path, nullid). This simplifies some callers.
2355 and will be converted to (path, nullid). This simplifies some callers.
2355 """
2356 """
2356
2357
2357 if path is None:
2358 if path is None:
2358 path = originalfctx.path()
2359 path = originalfctx.path()
2359 if ctx is None:
2360 if ctx is None:
2360 ctx = originalfctx.changectx()
2361 ctx = originalfctx.changectx()
2361 ctxmatch = lambda: True
2362 ctxmatch = lambda: True
2362 else:
2363 else:
2363 ctxmatch = lambda: ctx == originalfctx.changectx()
2364 ctxmatch = lambda: ctx == originalfctx.changectx()
2364
2365
2365 repo = originalfctx.repo()
2366 repo = originalfctx.repo()
2366 flog = originalfctx.filelog()
2367 flog = originalfctx.filelog()
2367 super(overlayfilectx, self).__init__(repo, path, flog, ctx)
2368 super(overlayfilectx, self).__init__(repo, path, flog, ctx)
2368
2369
2369 if copied is None:
2370 if copied is None:
2370 copied = originalfctx.renamed()
2371 copied = originalfctx.renamed()
2371 copiedmatch = lambda: True
2372 copiedmatch = lambda: True
2372 else:
2373 else:
2373 if copied and not isinstance(copied, tuple):
2374 if copied and not isinstance(copied, tuple):
2374 # repo._filecommit will recalculate copyrev so nullid is okay
2375 # repo._filecommit will recalculate copyrev so nullid is okay
2375 copied = (copied, nullid)
2376 copied = (copied, nullid)
2376 copiedmatch = lambda: copied == originalfctx.renamed()
2377 copiedmatch = lambda: copied == originalfctx.renamed()
2377
2378
2378 # When data, copied (could affect data), ctx (could affect filelog
2379 # When data, copied (could affect data), ctx (could affect filelog
2379 # parents) are not overridden, rawdata, rawflags, and filenode may be
2380 # parents) are not overridden, rawdata, rawflags, and filenode may be
2380 # reused (repo._filecommit should double check filelog parents).
2381 # reused (repo._filecommit should double check filelog parents).
2381 #
2382 #
2382 # path, flags are not hashed in filelog (but in manifestlog) so they do
2383 # path, flags are not hashed in filelog (but in manifestlog) so they do
2383 # not affect reusable here.
2384 # not affect reusable here.
2384 #
2385 #
2385 # If ctx or copied is overridden to a same value with originalfctx,
2386 # If ctx or copied is overridden to a same value with originalfctx,
2386 # still consider it's reusable. originalfctx.renamed() may be a bit
2387 # still consider it's reusable. originalfctx.renamed() may be a bit
2387 # expensive so it's not called unless necessary. Assuming datafunc is
2388 # expensive so it's not called unless necessary. Assuming datafunc is
2388 # always expensive, do not call it for this "reusable" test.
2389 # always expensive, do not call it for this "reusable" test.
2389 reusable = datafunc is None and ctxmatch() and copiedmatch()
2390 reusable = datafunc is None and ctxmatch() and copiedmatch()
2390
2391
2391 if datafunc is None:
2392 if datafunc is None:
2392 datafunc = originalfctx.data
2393 datafunc = originalfctx.data
2393 if flags is None:
2394 if flags is None:
2394 flags = originalfctx.flags()
2395 flags = originalfctx.flags()
2395
2396
2396 self._datafunc = datafunc
2397 self._datafunc = datafunc
2397 self._flags = flags
2398 self._flags = flags
2398 self._copied = copied
2399 self._copied = copied
2399
2400
2400 if reusable:
2401 if reusable:
2401 # copy extra fields from originalfctx
2402 # copy extra fields from originalfctx
2402 attrs = ['rawdata', 'rawflags', '_filenode', '_filerev']
2403 attrs = ['rawdata', 'rawflags', '_filenode', '_filerev']
2403 for attr_ in attrs:
2404 for attr_ in attrs:
2404 if util.safehasattr(originalfctx, attr_):
2405 if util.safehasattr(originalfctx, attr_):
2405 setattr(self, attr_, getattr(originalfctx, attr_))
2406 setattr(self, attr_, getattr(originalfctx, attr_))
2406
2407
2407 def data(self):
2408 def data(self):
2408 return self._datafunc()
2409 return self._datafunc()
2409
2410
2410 class metadataonlyctx(committablectx):
2411 class metadataonlyctx(committablectx):
2411 """Like memctx but it's reusing the manifest of different commit.
2412 """Like memctx but it's reusing the manifest of different commit.
2412 Intended to be used by lightweight operations that are creating
2413 Intended to be used by lightweight operations that are creating
2413 metadata-only changes.
2414 metadata-only changes.
2414
2415
2415 Revision information is supplied at initialization time. 'repo' is the
2416 Revision information is supplied at initialization time. 'repo' is the
2416 current localrepo, 'ctx' is original revision which manifest we're reuisng
2417 current localrepo, 'ctx' is original revision which manifest we're reuisng
2417 'parents' is a sequence of two parent revisions identifiers (pass None for
2418 'parents' is a sequence of two parent revisions identifiers (pass None for
2418 every missing parent), 'text' is the commit.
2419 every missing parent), 'text' is the commit.
2419
2420
2420 user receives the committer name and defaults to current repository
2421 user receives the committer name and defaults to current repository
2421 username, date is the commit date in any format supported by
2422 username, date is the commit date in any format supported by
2422 dateutil.parsedate() and defaults to current date, extra is a dictionary of
2423 dateutil.parsedate() and defaults to current date, extra is a dictionary of
2423 metadata or is left empty.
2424 metadata or is left empty.
2424 """
2425 """
2425 def __init__(self, repo, originalctx, parents=None, text=None, user=None,
2426 def __init__(self, repo, originalctx, parents=None, text=None, user=None,
2426 date=None, extra=None, editor=False):
2427 date=None, extra=None, editor=False):
2427 if text is None:
2428 if text is None:
2428 text = originalctx.description()
2429 text = originalctx.description()
2429 super(metadataonlyctx, self).__init__(repo, text, user, date, extra)
2430 super(metadataonlyctx, self).__init__(repo, text, user, date, extra)
2430 self._rev = None
2431 self._rev = None
2431 self._node = None
2432 self._node = None
2432 self._originalctx = originalctx
2433 self._originalctx = originalctx
2433 self._manifestnode = originalctx.manifestnode()
2434 self._manifestnode = originalctx.manifestnode()
2434 if parents is None:
2435 if parents is None:
2435 parents = originalctx.parents()
2436 parents = originalctx.parents()
2436 else:
2437 else:
2437 parents = [repo[p] for p in parents if p is not None]
2438 parents = [repo[p] for p in parents if p is not None]
2438 parents = parents[:]
2439 parents = parents[:]
2439 while len(parents) < 2:
2440 while len(parents) < 2:
2440 parents.append(repo[nullid])
2441 parents.append(repo[nullid])
2441 p1, p2 = self._parents = parents
2442 p1, p2 = self._parents = parents
2442
2443
2443 # sanity check to ensure that the reused manifest parents are
2444 # sanity check to ensure that the reused manifest parents are
2444 # manifests of our commit parents
2445 # manifests of our commit parents
2445 mp1, mp2 = self.manifestctx().parents
2446 mp1, mp2 = self.manifestctx().parents
2446 if p1 != nullid and p1.manifestnode() != mp1:
2447 if p1 != nullid and p1.manifestnode() != mp1:
2447 raise RuntimeError('can\'t reuse the manifest: '
2448 raise RuntimeError('can\'t reuse the manifest: '
2448 'its p1 doesn\'t match the new ctx p1')
2449 'its p1 doesn\'t match the new ctx p1')
2449 if p2 != nullid and p2.manifestnode() != mp2:
2450 if p2 != nullid and p2.manifestnode() != mp2:
2450 raise RuntimeError('can\'t reuse the manifest: '
2451 raise RuntimeError('can\'t reuse the manifest: '
2451 'its p2 doesn\'t match the new ctx p2')
2452 'its p2 doesn\'t match the new ctx p2')
2452
2453
2453 self._files = originalctx.files()
2454 self._files = originalctx.files()
2454 self.substate = {}
2455 self.substate = {}
2455
2456
2456 if editor:
2457 if editor:
2457 self._text = editor(self._repo, self, [])
2458 self._text = editor(self._repo, self, [])
2458 self._repo.savecommitmessage(self._text)
2459 self._repo.savecommitmessage(self._text)
2459
2460
2460 def manifestnode(self):
2461 def manifestnode(self):
2461 return self._manifestnode
2462 return self._manifestnode
2462
2463
2463 @property
2464 @property
2464 def _manifestctx(self):
2465 def _manifestctx(self):
2465 return self._repo.manifestlog[self._manifestnode]
2466 return self._repo.manifestlog[self._manifestnode]
2466
2467
2467 def filectx(self, path, filelog=None):
2468 def filectx(self, path, filelog=None):
2468 return self._originalctx.filectx(path, filelog=filelog)
2469 return self._originalctx.filectx(path, filelog=filelog)
2469
2470
2470 def commit(self):
2471 def commit(self):
2471 """commit context to the repo"""
2472 """commit context to the repo"""
2472 return self._repo.commitctx(self)
2473 return self._repo.commitctx(self)
2473
2474
2474 @property
2475 @property
2475 def _manifest(self):
2476 def _manifest(self):
2476 return self._originalctx.manifest()
2477 return self._originalctx.manifest()
2477
2478
2478 @propertycache
2479 @propertycache
2479 def _status(self):
2480 def _status(self):
2480 """Calculate exact status from ``files`` specified in the ``origctx``
2481 """Calculate exact status from ``files`` specified in the ``origctx``
2481 and parents manifests.
2482 and parents manifests.
2482 """
2483 """
2483 man1 = self.p1().manifest()
2484 man1 = self.p1().manifest()
2484 p2 = self._parents[1]
2485 p2 = self._parents[1]
2485 # "1 < len(self._parents)" can't be used for checking
2486 # "1 < len(self._parents)" can't be used for checking
2486 # existence of the 2nd parent, because "metadataonlyctx._parents" is
2487 # existence of the 2nd parent, because "metadataonlyctx._parents" is
2487 # explicitly initialized by the list, of which length is 2.
2488 # explicitly initialized by the list, of which length is 2.
2488 if p2.node() != nullid:
2489 if p2.node() != nullid:
2489 man2 = p2.manifest()
2490 man2 = p2.manifest()
2490 managing = lambda f: f in man1 or f in man2
2491 managing = lambda f: f in man1 or f in man2
2491 else:
2492 else:
2492 managing = lambda f: f in man1
2493 managing = lambda f: f in man1
2493
2494
2494 modified, added, removed = [], [], []
2495 modified, added, removed = [], [], []
2495 for f in self._files:
2496 for f in self._files:
2496 if not managing(f):
2497 if not managing(f):
2497 added.append(f)
2498 added.append(f)
2498 elif f in self:
2499 elif f in self:
2499 modified.append(f)
2500 modified.append(f)
2500 else:
2501 else:
2501 removed.append(f)
2502 removed.append(f)
2502
2503
2503 return scmutil.status(modified, added, removed, [], [], [], [])
2504 return scmutil.status(modified, added, removed, [], [], [], [])
2504
2505
2505 class arbitraryfilectx(object):
2506 class arbitraryfilectx(object):
2506 """Allows you to use filectx-like functions on a file in an arbitrary
2507 """Allows you to use filectx-like functions on a file in an arbitrary
2507 location on disk, possibly not in the working directory.
2508 location on disk, possibly not in the working directory.
2508 """
2509 """
2509 def __init__(self, path, repo=None):
2510 def __init__(self, path, repo=None):
2510 # Repo is optional because contrib/simplemerge uses this class.
2511 # Repo is optional because contrib/simplemerge uses this class.
2511 self._repo = repo
2512 self._repo = repo
2512 self._path = path
2513 self._path = path
2513
2514
2514 def cmp(self, fctx):
2515 def cmp(self, fctx):
2515 # filecmp follows symlinks whereas `cmp` should not, so skip the fast
2516 # filecmp follows symlinks whereas `cmp` should not, so skip the fast
2516 # path if either side is a symlink.
2517 # path if either side is a symlink.
2517 symlinks = ('l' in self.flags() or 'l' in fctx.flags())
2518 symlinks = ('l' in self.flags() or 'l' in fctx.flags())
2518 if not symlinks and isinstance(fctx, workingfilectx) and self._repo:
2519 if not symlinks and isinstance(fctx, workingfilectx) and self._repo:
2519 # Add a fast-path for merge if both sides are disk-backed.
2520 # Add a fast-path for merge if both sides are disk-backed.
2520 # Note that filecmp uses the opposite return values (True if same)
2521 # Note that filecmp uses the opposite return values (True if same)
2521 # from our cmp functions (True if different).
2522 # from our cmp functions (True if different).
2522 return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path()))
2523 return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path()))
2523 return self.data() != fctx.data()
2524 return self.data() != fctx.data()
2524
2525
2525 def path(self):
2526 def path(self):
2526 return self._path
2527 return self._path
2527
2528
2528 def flags(self):
2529 def flags(self):
2529 return ''
2530 return ''
2530
2531
2531 def data(self):
2532 def data(self):
2532 return util.readfile(self._path)
2533 return util.readfile(self._path)
2533
2534
2534 def decodeddata(self):
2535 def decodeddata(self):
2535 with open(self._path, "rb") as f:
2536 with open(self._path, "rb") as f:
2536 return f.read()
2537 return f.read()
2537
2538
2538 def remove(self):
2539 def remove(self):
2539 util.unlink(self._path)
2540 util.unlink(self._path)
2540
2541
2541 def write(self, data, flags, **kwargs):
2542 def write(self, data, flags, **kwargs):
2542 assert not flags
2543 assert not flags
2543 with open(self._path, "w") as f:
2544 with open(self._path, "w") as f:
2544 f.write(data)
2545 f.write(data)
@@ -1,2653 +1,2658 b''
1 The Mercurial system uses a set of configuration files to control
1 The Mercurial system uses a set of configuration files to control
2 aspects of its behavior.
2 aspects of its behavior.
3
3
4 Troubleshooting
4 Troubleshooting
5 ===============
5 ===============
6
6
7 If you're having problems with your configuration,
7 If you're having problems with your configuration,
8 :hg:`config --debug` can help you understand what is introducing
8 :hg:`config --debug` can help you understand what is introducing
9 a setting into your environment.
9 a setting into your environment.
10
10
11 See :hg:`help config.syntax` and :hg:`help config.files`
11 See :hg:`help config.syntax` and :hg:`help config.files`
12 for information about how and where to override things.
12 for information about how and where to override things.
13
13
14 Structure
14 Structure
15 =========
15 =========
16
16
17 The configuration files use a simple ini-file format. A configuration
17 The configuration files use a simple ini-file format. A configuration
18 file consists of sections, led by a ``[section]`` header and followed
18 file consists of sections, led by a ``[section]`` header and followed
19 by ``name = value`` entries::
19 by ``name = value`` entries::
20
20
21 [ui]
21 [ui]
22 username = Firstname Lastname <firstname.lastname@example.net>
22 username = Firstname Lastname <firstname.lastname@example.net>
23 verbose = True
23 verbose = True
24
24
25 The above entries will be referred to as ``ui.username`` and
25 The above entries will be referred to as ``ui.username`` and
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
27
27
28 Files
28 Files
29 =====
29 =====
30
30
31 Mercurial reads configuration data from several files, if they exist.
31 Mercurial reads configuration data from several files, if they exist.
32 These files do not exist by default and you will have to create the
32 These files do not exist by default and you will have to create the
33 appropriate configuration files yourself:
33 appropriate configuration files yourself:
34
34
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
36
36
37 Global configuration like the username setting is typically put into:
37 Global configuration like the username setting is typically put into:
38
38
39 .. container:: windows
39 .. container:: windows
40
40
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
42
42
43 .. container:: unix.plan9
43 .. container:: unix.plan9
44
44
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
46
46
47 The names of these files depend on the system on which Mercurial is
47 The names of these files depend on the system on which Mercurial is
48 installed. ``*.rc`` files from a single directory are read in
48 installed. ``*.rc`` files from a single directory are read in
49 alphabetical order, later ones overriding earlier ones. Where multiple
49 alphabetical order, later ones overriding earlier ones. Where multiple
50 paths are given below, settings from earlier paths override later
50 paths are given below, settings from earlier paths override later
51 ones.
51 ones.
52
52
53 .. container:: verbose.unix
53 .. container:: verbose.unix
54
54
55 On Unix, the following files are consulted:
55 On Unix, the following files are consulted:
56
56
57 - ``<repo>/.hg/hgrc`` (per-repository)
57 - ``<repo>/.hg/hgrc`` (per-repository)
58 - ``$HOME/.hgrc`` (per-user)
58 - ``$HOME/.hgrc`` (per-user)
59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
62 - ``/etc/mercurial/hgrc`` (per-system)
62 - ``/etc/mercurial/hgrc`` (per-system)
63 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
63 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
64 - ``<internal>/default.d/*.rc`` (defaults)
64 - ``<internal>/default.d/*.rc`` (defaults)
65
65
66 .. container:: verbose.windows
66 .. container:: verbose.windows
67
67
68 On Windows, the following files are consulted:
68 On Windows, the following files are consulted:
69
69
70 - ``<repo>/.hg/hgrc`` (per-repository)
70 - ``<repo>/.hg/hgrc`` (per-repository)
71 - ``%USERPROFILE%\.hgrc`` (per-user)
71 - ``%USERPROFILE%\.hgrc`` (per-user)
72 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
72 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
73 - ``%HOME%\.hgrc`` (per-user)
73 - ``%HOME%\.hgrc`` (per-user)
74 - ``%HOME%\Mercurial.ini`` (per-user)
74 - ``%HOME%\Mercurial.ini`` (per-user)
75 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
75 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
76 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
76 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
77 - ``<install-dir>\Mercurial.ini`` (per-installation)
77 - ``<install-dir>\Mercurial.ini`` (per-installation)
78 - ``<internal>/default.d/*.rc`` (defaults)
78 - ``<internal>/default.d/*.rc`` (defaults)
79
79
80 .. note::
80 .. note::
81
81
82 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
82 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
83 is used when running 32-bit Python on 64-bit Windows.
83 is used when running 32-bit Python on 64-bit Windows.
84
84
85 .. container:: windows
85 .. container:: windows
86
86
87 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
87 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
88
88
89 .. container:: verbose.plan9
89 .. container:: verbose.plan9
90
90
91 On Plan9, the following files are consulted:
91 On Plan9, the following files are consulted:
92
92
93 - ``<repo>/.hg/hgrc`` (per-repository)
93 - ``<repo>/.hg/hgrc`` (per-repository)
94 - ``$home/lib/hgrc`` (per-user)
94 - ``$home/lib/hgrc`` (per-user)
95 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
95 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
96 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
96 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
97 - ``/lib/mercurial/hgrc`` (per-system)
97 - ``/lib/mercurial/hgrc`` (per-system)
98 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
98 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
99 - ``<internal>/default.d/*.rc`` (defaults)
99 - ``<internal>/default.d/*.rc`` (defaults)
100
100
101 Per-repository configuration options only apply in a
101 Per-repository configuration options only apply in a
102 particular repository. This file is not version-controlled, and
102 particular repository. This file is not version-controlled, and
103 will not get transferred during a "clone" operation. Options in
103 will not get transferred during a "clone" operation. Options in
104 this file override options in all other configuration files.
104 this file override options in all other configuration files.
105
105
106 .. container:: unix.plan9
106 .. container:: unix.plan9
107
107
108 On Plan 9 and Unix, most of this file will be ignored if it doesn't
108 On Plan 9 and Unix, most of this file will be ignored if it doesn't
109 belong to a trusted user or to a trusted group. See
109 belong to a trusted user or to a trusted group. See
110 :hg:`help config.trusted` for more details.
110 :hg:`help config.trusted` for more details.
111
111
112 Per-user configuration file(s) are for the user running Mercurial. Options
112 Per-user configuration file(s) are for the user running Mercurial. Options
113 in these files apply to all Mercurial commands executed by this user in any
113 in these files apply to all Mercurial commands executed by this user in any
114 directory. Options in these files override per-system and per-installation
114 directory. Options in these files override per-system and per-installation
115 options.
115 options.
116
116
117 Per-installation configuration files are searched for in the
117 Per-installation configuration files are searched for in the
118 directory where Mercurial is installed. ``<install-root>`` is the
118 directory where Mercurial is installed. ``<install-root>`` is the
119 parent directory of the **hg** executable (or symlink) being run.
119 parent directory of the **hg** executable (or symlink) being run.
120
120
121 .. container:: unix.plan9
121 .. container:: unix.plan9
122
122
123 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
123 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
124 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
124 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
125 files apply to all Mercurial commands executed by any user in any
125 files apply to all Mercurial commands executed by any user in any
126 directory.
126 directory.
127
127
128 Per-installation configuration files are for the system on
128 Per-installation configuration files are for the system on
129 which Mercurial is running. Options in these files apply to all
129 which Mercurial is running. Options in these files apply to all
130 Mercurial commands executed by any user in any directory. Registry
130 Mercurial commands executed by any user in any directory. Registry
131 keys contain PATH-like strings, every part of which must reference
131 keys contain PATH-like strings, every part of which must reference
132 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
132 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
133 be read. Mercurial checks each of these locations in the specified
133 be read. Mercurial checks each of these locations in the specified
134 order until one or more configuration files are detected.
134 order until one or more configuration files are detected.
135
135
136 Per-system configuration files are for the system on which Mercurial
136 Per-system configuration files are for the system on which Mercurial
137 is running. Options in these files apply to all Mercurial commands
137 is running. Options in these files apply to all Mercurial commands
138 executed by any user in any directory. Options in these files
138 executed by any user in any directory. Options in these files
139 override per-installation options.
139 override per-installation options.
140
140
141 Mercurial comes with some default configuration. The default configuration
141 Mercurial comes with some default configuration. The default configuration
142 files are installed with Mercurial and will be overwritten on upgrades. Default
142 files are installed with Mercurial and will be overwritten on upgrades. Default
143 configuration files should never be edited by users or administrators but can
143 configuration files should never be edited by users or administrators but can
144 be overridden in other configuration files. So far the directory only contains
144 be overridden in other configuration files. So far the directory only contains
145 merge tool configuration but packagers can also put other default configuration
145 merge tool configuration but packagers can also put other default configuration
146 there.
146 there.
147
147
148 Syntax
148 Syntax
149 ======
149 ======
150
150
151 A configuration file consists of sections, led by a ``[section]`` header
151 A configuration file consists of sections, led by a ``[section]`` header
152 and followed by ``name = value`` entries (sometimes called
152 and followed by ``name = value`` entries (sometimes called
153 ``configuration keys``)::
153 ``configuration keys``)::
154
154
155 [spam]
155 [spam]
156 eggs=ham
156 eggs=ham
157 green=
157 green=
158 eggs
158 eggs
159
159
160 Each line contains one entry. If the lines that follow are indented,
160 Each line contains one entry. If the lines that follow are indented,
161 they are treated as continuations of that entry. Leading whitespace is
161 they are treated as continuations of that entry. Leading whitespace is
162 removed from values. Empty lines are skipped. Lines beginning with
162 removed from values. Empty lines are skipped. Lines beginning with
163 ``#`` or ``;`` are ignored and may be used to provide comments.
163 ``#`` or ``;`` are ignored and may be used to provide comments.
164
164
165 Configuration keys can be set multiple times, in which case Mercurial
165 Configuration keys can be set multiple times, in which case Mercurial
166 will use the value that was configured last. As an example::
166 will use the value that was configured last. As an example::
167
167
168 [spam]
168 [spam]
169 eggs=large
169 eggs=large
170 ham=serrano
170 ham=serrano
171 eggs=small
171 eggs=small
172
172
173 This would set the configuration key named ``eggs`` to ``small``.
173 This would set the configuration key named ``eggs`` to ``small``.
174
174
175 It is also possible to define a section multiple times. A section can
175 It is also possible to define a section multiple times. A section can
176 be redefined on the same and/or on different configuration files. For
176 be redefined on the same and/or on different configuration files. For
177 example::
177 example::
178
178
179 [foo]
179 [foo]
180 eggs=large
180 eggs=large
181 ham=serrano
181 ham=serrano
182 eggs=small
182 eggs=small
183
183
184 [bar]
184 [bar]
185 eggs=ham
185 eggs=ham
186 green=
186 green=
187 eggs
187 eggs
188
188
189 [foo]
189 [foo]
190 ham=prosciutto
190 ham=prosciutto
191 eggs=medium
191 eggs=medium
192 bread=toasted
192 bread=toasted
193
193
194 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
194 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
195 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
195 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
196 respectively. As you can see there only thing that matters is the last
196 respectively. As you can see there only thing that matters is the last
197 value that was set for each of the configuration keys.
197 value that was set for each of the configuration keys.
198
198
199 If a configuration key is set multiple times in different
199 If a configuration key is set multiple times in different
200 configuration files the final value will depend on the order in which
200 configuration files the final value will depend on the order in which
201 the different configuration files are read, with settings from earlier
201 the different configuration files are read, with settings from earlier
202 paths overriding later ones as described on the ``Files`` section
202 paths overriding later ones as described on the ``Files`` section
203 above.
203 above.
204
204
205 A line of the form ``%include file`` will include ``file`` into the
205 A line of the form ``%include file`` will include ``file`` into the
206 current configuration file. The inclusion is recursive, which means
206 current configuration file. The inclusion is recursive, which means
207 that included files can include other files. Filenames are relative to
207 that included files can include other files. Filenames are relative to
208 the configuration file in which the ``%include`` directive is found.
208 the configuration file in which the ``%include`` directive is found.
209 Environment variables and ``~user`` constructs are expanded in
209 Environment variables and ``~user`` constructs are expanded in
210 ``file``. This lets you do something like::
210 ``file``. This lets you do something like::
211
211
212 %include ~/.hgrc.d/$HOST.rc
212 %include ~/.hgrc.d/$HOST.rc
213
213
214 to include a different configuration file on each computer you use.
214 to include a different configuration file on each computer you use.
215
215
216 A line with ``%unset name`` will remove ``name`` from the current
216 A line with ``%unset name`` will remove ``name`` from the current
217 section, if it has been set previously.
217 section, if it has been set previously.
218
218
219 The values are either free-form text strings, lists of text strings,
219 The values are either free-form text strings, lists of text strings,
220 or Boolean values. Boolean values can be set to true using any of "1",
220 or Boolean values. Boolean values can be set to true using any of "1",
221 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
221 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
222 (all case insensitive).
222 (all case insensitive).
223
223
224 List values are separated by whitespace or comma, except when values are
224 List values are separated by whitespace or comma, except when values are
225 placed in double quotation marks::
225 placed in double quotation marks::
226
226
227 allow_read = "John Doe, PhD", brian, betty
227 allow_read = "John Doe, PhD", brian, betty
228
228
229 Quotation marks can be escaped by prefixing them with a backslash. Only
229 Quotation marks can be escaped by prefixing them with a backslash. Only
230 quotation marks at the beginning of a word is counted as a quotation
230 quotation marks at the beginning of a word is counted as a quotation
231 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
231 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
232
232
233 Sections
233 Sections
234 ========
234 ========
235
235
236 This section describes the different sections that may appear in a
236 This section describes the different sections that may appear in a
237 Mercurial configuration file, the purpose of each section, its possible
237 Mercurial configuration file, the purpose of each section, its possible
238 keys, and their possible values.
238 keys, and their possible values.
239
239
240 ``alias``
240 ``alias``
241 ---------
241 ---------
242
242
243 Defines command aliases.
243 Defines command aliases.
244
244
245 Aliases allow you to define your own commands in terms of other
245 Aliases allow you to define your own commands in terms of other
246 commands (or aliases), optionally including arguments. Positional
246 commands (or aliases), optionally including arguments. Positional
247 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
247 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
248 are expanded by Mercurial before execution. Positional arguments not
248 are expanded by Mercurial before execution. Positional arguments not
249 already used by ``$N`` in the definition are put at the end of the
249 already used by ``$N`` in the definition are put at the end of the
250 command to be executed.
250 command to be executed.
251
251
252 Alias definitions consist of lines of the form::
252 Alias definitions consist of lines of the form::
253
253
254 <alias> = <command> [<argument>]...
254 <alias> = <command> [<argument>]...
255
255
256 For example, this definition::
256 For example, this definition::
257
257
258 latest = log --limit 5
258 latest = log --limit 5
259
259
260 creates a new command ``latest`` that shows only the five most recent
260 creates a new command ``latest`` that shows only the five most recent
261 changesets. You can define subsequent aliases using earlier ones::
261 changesets. You can define subsequent aliases using earlier ones::
262
262
263 stable5 = latest -b stable
263 stable5 = latest -b stable
264
264
265 .. note::
265 .. note::
266
266
267 It is possible to create aliases with the same names as
267 It is possible to create aliases with the same names as
268 existing commands, which will then override the original
268 existing commands, which will then override the original
269 definitions. This is almost always a bad idea!
269 definitions. This is almost always a bad idea!
270
270
271 An alias can start with an exclamation point (``!``) to make it a
271 An alias can start with an exclamation point (``!``) to make it a
272 shell alias. A shell alias is executed with the shell and will let you
272 shell alias. A shell alias is executed with the shell and will let you
273 run arbitrary commands. As an example, ::
273 run arbitrary commands. As an example, ::
274
274
275 echo = !echo $@
275 echo = !echo $@
276
276
277 will let you do ``hg echo foo`` to have ``foo`` printed in your
277 will let you do ``hg echo foo`` to have ``foo`` printed in your
278 terminal. A better example might be::
278 terminal. A better example might be::
279
279
280 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
280 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
281
281
282 which will make ``hg purge`` delete all unknown files in the
282 which will make ``hg purge`` delete all unknown files in the
283 repository in the same manner as the purge extension.
283 repository in the same manner as the purge extension.
284
284
285 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
285 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
286 expand to the command arguments. Unmatched arguments are
286 expand to the command arguments. Unmatched arguments are
287 removed. ``$0`` expands to the alias name and ``$@`` expands to all
287 removed. ``$0`` expands to the alias name and ``$@`` expands to all
288 arguments separated by a space. ``"$@"`` (with quotes) expands to all
288 arguments separated by a space. ``"$@"`` (with quotes) expands to all
289 arguments quoted individually and separated by a space. These expansions
289 arguments quoted individually and separated by a space. These expansions
290 happen before the command is passed to the shell.
290 happen before the command is passed to the shell.
291
291
292 Shell aliases are executed in an environment where ``$HG`` expands to
292 Shell aliases are executed in an environment where ``$HG`` expands to
293 the path of the Mercurial that was used to execute the alias. This is
293 the path of the Mercurial that was used to execute the alias. This is
294 useful when you want to call further Mercurial commands in a shell
294 useful when you want to call further Mercurial commands in a shell
295 alias, as was done above for the purge alias. In addition,
295 alias, as was done above for the purge alias. In addition,
296 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
296 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
297 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
297 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
298
298
299 .. note::
299 .. note::
300
300
301 Some global configuration options such as ``-R`` are
301 Some global configuration options such as ``-R`` are
302 processed before shell aliases and will thus not be passed to
302 processed before shell aliases and will thus not be passed to
303 aliases.
303 aliases.
304
304
305
305
306 ``annotate``
306 ``annotate``
307 ------------
307 ------------
308
308
309 Settings used when displaying file annotations. All values are
309 Settings used when displaying file annotations. All values are
310 Booleans and default to False. See :hg:`help config.diff` for
310 Booleans and default to False. See :hg:`help config.diff` for
311 related options for the diff command.
311 related options for the diff command.
312
312
313 ``ignorews``
313 ``ignorews``
314 Ignore white space when comparing lines.
314 Ignore white space when comparing lines.
315
315
316 ``ignorewseol``
316 ``ignorewseol``
317 Ignore white space at the end of a line when comparing lines.
317 Ignore white space at the end of a line when comparing lines.
318
318
319 ``ignorewsamount``
319 ``ignorewsamount``
320 Ignore changes in the amount of white space.
320 Ignore changes in the amount of white space.
321
321
322 ``ignoreblanklines``
322 ``ignoreblanklines``
323 Ignore changes whose lines are all blank.
323 Ignore changes whose lines are all blank.
324
324
325
325
326 ``auth``
326 ``auth``
327 --------
327 --------
328
328
329 Authentication credentials and other authentication-like configuration
329 Authentication credentials and other authentication-like configuration
330 for HTTP connections. This section allows you to store usernames and
330 for HTTP connections. This section allows you to store usernames and
331 passwords for use when logging *into* HTTP servers. See
331 passwords for use when logging *into* HTTP servers. See
332 :hg:`help config.web` if you want to configure *who* can login to
332 :hg:`help config.web` if you want to configure *who* can login to
333 your HTTP server.
333 your HTTP server.
334
334
335 The following options apply to all hosts.
335 The following options apply to all hosts.
336
336
337 ``cookiefile``
337 ``cookiefile``
338 Path to a file containing HTTP cookie lines. Cookies matching a
338 Path to a file containing HTTP cookie lines. Cookies matching a
339 host will be sent automatically.
339 host will be sent automatically.
340
340
341 The file format uses the Mozilla cookies.txt format, which defines cookies
341 The file format uses the Mozilla cookies.txt format, which defines cookies
342 on their own lines. Each line contains 7 fields delimited by the tab
342 on their own lines. Each line contains 7 fields delimited by the tab
343 character (domain, is_domain_cookie, path, is_secure, expires, name,
343 character (domain, is_domain_cookie, path, is_secure, expires, name,
344 value). For more info, do an Internet search for "Netscape cookies.txt
344 value). For more info, do an Internet search for "Netscape cookies.txt
345 format."
345 format."
346
346
347 Note: the cookies parser does not handle port numbers on domains. You
347 Note: the cookies parser does not handle port numbers on domains. You
348 will need to remove ports from the domain for the cookie to be recognized.
348 will need to remove ports from the domain for the cookie to be recognized.
349 This could result in a cookie being disclosed to an unwanted server.
349 This could result in a cookie being disclosed to an unwanted server.
350
350
351 The cookies file is read-only.
351 The cookies file is read-only.
352
352
353 Other options in this section are grouped by name and have the following
353 Other options in this section are grouped by name and have the following
354 format::
354 format::
355
355
356 <name>.<argument> = <value>
356 <name>.<argument> = <value>
357
357
358 where ``<name>`` is used to group arguments into authentication
358 where ``<name>`` is used to group arguments into authentication
359 entries. Example::
359 entries. Example::
360
360
361 foo.prefix = hg.intevation.de/mercurial
361 foo.prefix = hg.intevation.de/mercurial
362 foo.username = foo
362 foo.username = foo
363 foo.password = bar
363 foo.password = bar
364 foo.schemes = http https
364 foo.schemes = http https
365
365
366 bar.prefix = secure.example.org
366 bar.prefix = secure.example.org
367 bar.key = path/to/file.key
367 bar.key = path/to/file.key
368 bar.cert = path/to/file.cert
368 bar.cert = path/to/file.cert
369 bar.schemes = https
369 bar.schemes = https
370
370
371 Supported arguments:
371 Supported arguments:
372
372
373 ``prefix``
373 ``prefix``
374 Either ``*`` or a URI prefix with or without the scheme part.
374 Either ``*`` or a URI prefix with or without the scheme part.
375 The authentication entry with the longest matching prefix is used
375 The authentication entry with the longest matching prefix is used
376 (where ``*`` matches everything and counts as a match of length
376 (where ``*`` matches everything and counts as a match of length
377 1). If the prefix doesn't include a scheme, the match is performed
377 1). If the prefix doesn't include a scheme, the match is performed
378 against the URI with its scheme stripped as well, and the schemes
378 against the URI with its scheme stripped as well, and the schemes
379 argument, q.v., is then subsequently consulted.
379 argument, q.v., is then subsequently consulted.
380
380
381 ``username``
381 ``username``
382 Optional. Username to authenticate with. If not given, and the
382 Optional. Username to authenticate with. If not given, and the
383 remote site requires basic or digest authentication, the user will
383 remote site requires basic or digest authentication, the user will
384 be prompted for it. Environment variables are expanded in the
384 be prompted for it. Environment variables are expanded in the
385 username letting you do ``foo.username = $USER``. If the URI
385 username letting you do ``foo.username = $USER``. If the URI
386 includes a username, only ``[auth]`` entries with a matching
386 includes a username, only ``[auth]`` entries with a matching
387 username or without a username will be considered.
387 username or without a username will be considered.
388
388
389 ``password``
389 ``password``
390 Optional. Password to authenticate with. If not given, and the
390 Optional. Password to authenticate with. If not given, and the
391 remote site requires basic or digest authentication, the user
391 remote site requires basic or digest authentication, the user
392 will be prompted for it.
392 will be prompted for it.
393
393
394 ``key``
394 ``key``
395 Optional. PEM encoded client certificate key file. Environment
395 Optional. PEM encoded client certificate key file. Environment
396 variables are expanded in the filename.
396 variables are expanded in the filename.
397
397
398 ``cert``
398 ``cert``
399 Optional. PEM encoded client certificate chain file. Environment
399 Optional. PEM encoded client certificate chain file. Environment
400 variables are expanded in the filename.
400 variables are expanded in the filename.
401
401
402 ``schemes``
402 ``schemes``
403 Optional. Space separated list of URI schemes to use this
403 Optional. Space separated list of URI schemes to use this
404 authentication entry with. Only used if the prefix doesn't include
404 authentication entry with. Only used if the prefix doesn't include
405 a scheme. Supported schemes are http and https. They will match
405 a scheme. Supported schemes are http and https. They will match
406 static-http and static-https respectively, as well.
406 static-http and static-https respectively, as well.
407 (default: https)
407 (default: https)
408
408
409 If no suitable authentication entry is found, the user is prompted
409 If no suitable authentication entry is found, the user is prompted
410 for credentials as usual if required by the remote.
410 for credentials as usual if required by the remote.
411
411
412 ``color``
412 ``color``
413 ---------
413 ---------
414
414
415 Configure the Mercurial color mode. For details about how to define your custom
415 Configure the Mercurial color mode. For details about how to define your custom
416 effect and style see :hg:`help color`.
416 effect and style see :hg:`help color`.
417
417
418 ``mode``
418 ``mode``
419 String: control the method used to output color. One of ``auto``, ``ansi``,
419 String: control the method used to output color. One of ``auto``, ``ansi``,
420 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
420 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
421 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
421 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
422 terminal. Any invalid value will disable color.
422 terminal. Any invalid value will disable color.
423
423
424 ``pagermode``
424 ``pagermode``
425 String: optional override of ``color.mode`` used with pager.
425 String: optional override of ``color.mode`` used with pager.
426
426
427 On some systems, terminfo mode may cause problems when using
427 On some systems, terminfo mode may cause problems when using
428 color with ``less -R`` as a pager program. less with the -R option
428 color with ``less -R`` as a pager program. less with the -R option
429 will only display ECMA-48 color codes, and terminfo mode may sometimes
429 will only display ECMA-48 color codes, and terminfo mode may sometimes
430 emit codes that less doesn't understand. You can work around this by
430 emit codes that less doesn't understand. You can work around this by
431 either using ansi mode (or auto mode), or by using less -r (which will
431 either using ansi mode (or auto mode), or by using less -r (which will
432 pass through all terminal control codes, not just color control
432 pass through all terminal control codes, not just color control
433 codes).
433 codes).
434
434
435 On some systems (such as MSYS in Windows), the terminal may support
435 On some systems (such as MSYS in Windows), the terminal may support
436 a different color mode than the pager program.
436 a different color mode than the pager program.
437
437
438 ``commands``
438 ``commands``
439 ------------
439 ------------
440
440
441 ``status.relative``
441 ``status.relative``
442 Make paths in :hg:`status` output relative to the current directory.
442 Make paths in :hg:`status` output relative to the current directory.
443 (default: False)
443 (default: False)
444
444
445 ``status.terse``
445 ``status.terse``
446 Default value for the --terse flag, which condenes status output.
446 Default value for the --terse flag, which condenes status output.
447 (default: empty)
447 (default: empty)
448
448
449 ``update.check``
449 ``update.check``
450 Determines what level of checking :hg:`update` will perform before moving
450 Determines what level of checking :hg:`update` will perform before moving
451 to a destination revision. Valid values are ``abort``, ``none``,
451 to a destination revision. Valid values are ``abort``, ``none``,
452 ``linear``, and ``noconflict``. ``abort`` always fails if the working
452 ``linear``, and ``noconflict``. ``abort`` always fails if the working
453 directory has uncommitted changes. ``none`` performs no checking, and may
453 directory has uncommitted changes. ``none`` performs no checking, and may
454 result in a merge with uncommitted changes. ``linear`` allows any update
454 result in a merge with uncommitted changes. ``linear`` allows any update
455 as long as it follows a straight line in the revision history, and may
455 as long as it follows a straight line in the revision history, and may
456 trigger a merge with uncommitted changes. ``noconflict`` will allow any
456 trigger a merge with uncommitted changes. ``noconflict`` will allow any
457 update which would not trigger a merge with uncommitted changes, if any
457 update which would not trigger a merge with uncommitted changes, if any
458 are present.
458 are present.
459 (default: ``linear``)
459 (default: ``linear``)
460
460
461 ``update.requiredest``
461 ``update.requiredest``
462 Require that the user pass a destination when running :hg:`update`.
462 Require that the user pass a destination when running :hg:`update`.
463 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
463 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
464 will be disallowed.
464 will be disallowed.
465 (default: False)
465 (default: False)
466
466
467 ``committemplate``
467 ``committemplate``
468 ------------------
468 ------------------
469
469
470 ``changeset``
470 ``changeset``
471 String: configuration in this section is used as the template to
471 String: configuration in this section is used as the template to
472 customize the text shown in the editor when committing.
472 customize the text shown in the editor when committing.
473
473
474 In addition to pre-defined template keywords, commit log specific one
474 In addition to pre-defined template keywords, commit log specific one
475 below can be used for customization:
475 below can be used for customization:
476
476
477 ``extramsg``
477 ``extramsg``
478 String: Extra message (typically 'Leave message empty to abort
478 String: Extra message (typically 'Leave message empty to abort
479 commit.'). This may be changed by some commands or extensions.
479 commit.'). This may be changed by some commands or extensions.
480
480
481 For example, the template configuration below shows as same text as
481 For example, the template configuration below shows as same text as
482 one shown by default::
482 one shown by default::
483
483
484 [committemplate]
484 [committemplate]
485 changeset = {desc}\n\n
485 changeset = {desc}\n\n
486 HG: Enter commit message. Lines beginning with 'HG:' are removed.
486 HG: Enter commit message. Lines beginning with 'HG:' are removed.
487 HG: {extramsg}
487 HG: {extramsg}
488 HG: --
488 HG: --
489 HG: user: {author}\n{ifeq(p2rev, "-1", "",
489 HG: user: {author}\n{ifeq(p2rev, "-1", "",
490 "HG: branch merge\n")
490 "HG: branch merge\n")
491 }HG: branch '{branch}'\n{if(activebookmark,
491 }HG: branch '{branch}'\n{if(activebookmark,
492 "HG: bookmark '{activebookmark}'\n") }{subrepos %
492 "HG: bookmark '{activebookmark}'\n") }{subrepos %
493 "HG: subrepo {subrepo}\n" }{file_adds %
493 "HG: subrepo {subrepo}\n" }{file_adds %
494 "HG: added {file}\n" }{file_mods %
494 "HG: added {file}\n" }{file_mods %
495 "HG: changed {file}\n" }{file_dels %
495 "HG: changed {file}\n" }{file_dels %
496 "HG: removed {file}\n" }{if(files, "",
496 "HG: removed {file}\n" }{if(files, "",
497 "HG: no files changed\n")}
497 "HG: no files changed\n")}
498
498
499 ``diff()``
499 ``diff()``
500 String: show the diff (see :hg:`help templates` for detail)
500 String: show the diff (see :hg:`help templates` for detail)
501
501
502 Sometimes it is helpful to show the diff of the changeset in the editor without
502 Sometimes it is helpful to show the diff of the changeset in the editor without
503 having to prefix 'HG: ' to each line so that highlighting works correctly. For
503 having to prefix 'HG: ' to each line so that highlighting works correctly. For
504 this, Mercurial provides a special string which will ignore everything below
504 this, Mercurial provides a special string which will ignore everything below
505 it::
505 it::
506
506
507 HG: ------------------------ >8 ------------------------
507 HG: ------------------------ >8 ------------------------
508
508
509 For example, the template configuration below will show the diff below the
509 For example, the template configuration below will show the diff below the
510 extra message::
510 extra message::
511
511
512 [committemplate]
512 [committemplate]
513 changeset = {desc}\n\n
513 changeset = {desc}\n\n
514 HG: Enter commit message. Lines beginning with 'HG:' are removed.
514 HG: Enter commit message. Lines beginning with 'HG:' are removed.
515 HG: {extramsg}
515 HG: {extramsg}
516 HG: ------------------------ >8 ------------------------
516 HG: ------------------------ >8 ------------------------
517 HG: Do not touch the line above.
517 HG: Do not touch the line above.
518 HG: Everything below will be removed.
518 HG: Everything below will be removed.
519 {diff()}
519 {diff()}
520
520
521 .. note::
521 .. note::
522
522
523 For some problematic encodings (see :hg:`help win32mbcs` for
523 For some problematic encodings (see :hg:`help win32mbcs` for
524 detail), this customization should be configured carefully, to
524 detail), this customization should be configured carefully, to
525 avoid showing broken characters.
525 avoid showing broken characters.
526
526
527 For example, if a multibyte character ending with backslash (0x5c) is
527 For example, if a multibyte character ending with backslash (0x5c) is
528 followed by the ASCII character 'n' in the customized template,
528 followed by the ASCII character 'n' in the customized template,
529 the sequence of backslash and 'n' is treated as line-feed unexpectedly
529 the sequence of backslash and 'n' is treated as line-feed unexpectedly
530 (and the multibyte character is broken, too).
530 (and the multibyte character is broken, too).
531
531
532 Customized template is used for commands below (``--edit`` may be
532 Customized template is used for commands below (``--edit`` may be
533 required):
533 required):
534
534
535 - :hg:`backout`
535 - :hg:`backout`
536 - :hg:`commit`
536 - :hg:`commit`
537 - :hg:`fetch` (for merge commit only)
537 - :hg:`fetch` (for merge commit only)
538 - :hg:`graft`
538 - :hg:`graft`
539 - :hg:`histedit`
539 - :hg:`histedit`
540 - :hg:`import`
540 - :hg:`import`
541 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
541 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
542 - :hg:`rebase`
542 - :hg:`rebase`
543 - :hg:`shelve`
543 - :hg:`shelve`
544 - :hg:`sign`
544 - :hg:`sign`
545 - :hg:`tag`
545 - :hg:`tag`
546 - :hg:`transplant`
546 - :hg:`transplant`
547
547
548 Configuring items below instead of ``changeset`` allows showing
548 Configuring items below instead of ``changeset`` allows showing
549 customized message only for specific actions, or showing different
549 customized message only for specific actions, or showing different
550 messages for each action.
550 messages for each action.
551
551
552 - ``changeset.backout`` for :hg:`backout`
552 - ``changeset.backout`` for :hg:`backout`
553 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
553 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
554 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
554 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
555 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
555 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
556 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
556 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
557 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
557 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
558 - ``changeset.gpg.sign`` for :hg:`sign`
558 - ``changeset.gpg.sign`` for :hg:`sign`
559 - ``changeset.graft`` for :hg:`graft`
559 - ``changeset.graft`` for :hg:`graft`
560 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
560 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
561 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
561 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
562 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
562 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
563 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
563 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
564 - ``changeset.import.bypass`` for :hg:`import --bypass`
564 - ``changeset.import.bypass`` for :hg:`import --bypass`
565 - ``changeset.import.normal.merge`` for :hg:`import` on merges
565 - ``changeset.import.normal.merge`` for :hg:`import` on merges
566 - ``changeset.import.normal.normal`` for :hg:`import` on other
566 - ``changeset.import.normal.normal`` for :hg:`import` on other
567 - ``changeset.mq.qnew`` for :hg:`qnew`
567 - ``changeset.mq.qnew`` for :hg:`qnew`
568 - ``changeset.mq.qfold`` for :hg:`qfold`
568 - ``changeset.mq.qfold`` for :hg:`qfold`
569 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
569 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
570 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
570 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
571 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
571 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
572 - ``changeset.rebase.normal`` for :hg:`rebase` on other
572 - ``changeset.rebase.normal`` for :hg:`rebase` on other
573 - ``changeset.shelve.shelve`` for :hg:`shelve`
573 - ``changeset.shelve.shelve`` for :hg:`shelve`
574 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
574 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
575 - ``changeset.tag.remove`` for :hg:`tag --remove`
575 - ``changeset.tag.remove`` for :hg:`tag --remove`
576 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
576 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
577 - ``changeset.transplant.normal`` for :hg:`transplant` on other
577 - ``changeset.transplant.normal`` for :hg:`transplant` on other
578
578
579 These dot-separated lists of names are treated as hierarchical ones.
579 These dot-separated lists of names are treated as hierarchical ones.
580 For example, ``changeset.tag.remove`` customizes the commit message
580 For example, ``changeset.tag.remove`` customizes the commit message
581 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
581 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
582 commit message for :hg:`tag` regardless of ``--remove`` option.
582 commit message for :hg:`tag` regardless of ``--remove`` option.
583
583
584 When the external editor is invoked for a commit, the corresponding
584 When the external editor is invoked for a commit, the corresponding
585 dot-separated list of names without the ``changeset.`` prefix
585 dot-separated list of names without the ``changeset.`` prefix
586 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
586 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
587 variable.
587 variable.
588
588
589 In this section, items other than ``changeset`` can be referred from
589 In this section, items other than ``changeset`` can be referred from
590 others. For example, the configuration to list committed files up
590 others. For example, the configuration to list committed files up
591 below can be referred as ``{listupfiles}``::
591 below can be referred as ``{listupfiles}``::
592
592
593 [committemplate]
593 [committemplate]
594 listupfiles = {file_adds %
594 listupfiles = {file_adds %
595 "HG: added {file}\n" }{file_mods %
595 "HG: added {file}\n" }{file_mods %
596 "HG: changed {file}\n" }{file_dels %
596 "HG: changed {file}\n" }{file_dels %
597 "HG: removed {file}\n" }{if(files, "",
597 "HG: removed {file}\n" }{if(files, "",
598 "HG: no files changed\n")}
598 "HG: no files changed\n")}
599
599
600 ``decode/encode``
600 ``decode/encode``
601 -----------------
601 -----------------
602
602
603 Filters for transforming files on checkout/checkin. This would
603 Filters for transforming files on checkout/checkin. This would
604 typically be used for newline processing or other
604 typically be used for newline processing or other
605 localization/canonicalization of files.
605 localization/canonicalization of files.
606
606
607 Filters consist of a filter pattern followed by a filter command.
607 Filters consist of a filter pattern followed by a filter command.
608 Filter patterns are globs by default, rooted at the repository root.
608 Filter patterns are globs by default, rooted at the repository root.
609 For example, to match any file ending in ``.txt`` in the root
609 For example, to match any file ending in ``.txt`` in the root
610 directory only, use the pattern ``*.txt``. To match any file ending
610 directory only, use the pattern ``*.txt``. To match any file ending
611 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
611 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
612 For each file only the first matching filter applies.
612 For each file only the first matching filter applies.
613
613
614 The filter command can start with a specifier, either ``pipe:`` or
614 The filter command can start with a specifier, either ``pipe:`` or
615 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
615 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
616
616
617 A ``pipe:`` command must accept data on stdin and return the transformed
617 A ``pipe:`` command must accept data on stdin and return the transformed
618 data on stdout.
618 data on stdout.
619
619
620 Pipe example::
620 Pipe example::
621
621
622 [encode]
622 [encode]
623 # uncompress gzip files on checkin to improve delta compression
623 # uncompress gzip files on checkin to improve delta compression
624 # note: not necessarily a good idea, just an example
624 # note: not necessarily a good idea, just an example
625 *.gz = pipe: gunzip
625 *.gz = pipe: gunzip
626
626
627 [decode]
627 [decode]
628 # recompress gzip files when writing them to the working dir (we
628 # recompress gzip files when writing them to the working dir (we
629 # can safely omit "pipe:", because it's the default)
629 # can safely omit "pipe:", because it's the default)
630 *.gz = gzip
630 *.gz = gzip
631
631
632 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
632 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
633 with the name of a temporary file that contains the data to be
633 with the name of a temporary file that contains the data to be
634 filtered by the command. The string ``OUTFILE`` is replaced with the name
634 filtered by the command. The string ``OUTFILE`` is replaced with the name
635 of an empty temporary file, where the filtered data must be written by
635 of an empty temporary file, where the filtered data must be written by
636 the command.
636 the command.
637
637
638 .. container:: windows
638 .. container:: windows
639
639
640 .. note::
640 .. note::
641
641
642 The tempfile mechanism is recommended for Windows systems,
642 The tempfile mechanism is recommended for Windows systems,
643 where the standard shell I/O redirection operators often have
643 where the standard shell I/O redirection operators often have
644 strange effects and may corrupt the contents of your files.
644 strange effects and may corrupt the contents of your files.
645
645
646 This filter mechanism is used internally by the ``eol`` extension to
646 This filter mechanism is used internally by the ``eol`` extension to
647 translate line ending characters between Windows (CRLF) and Unix (LF)
647 translate line ending characters between Windows (CRLF) and Unix (LF)
648 format. We suggest you use the ``eol`` extension for convenience.
648 format. We suggest you use the ``eol`` extension for convenience.
649
649
650
650
651 ``defaults``
651 ``defaults``
652 ------------
652 ------------
653
653
654 (defaults are deprecated. Don't use them. Use aliases instead.)
654 (defaults are deprecated. Don't use them. Use aliases instead.)
655
655
656 Use the ``[defaults]`` section to define command defaults, i.e. the
656 Use the ``[defaults]`` section to define command defaults, i.e. the
657 default options/arguments to pass to the specified commands.
657 default options/arguments to pass to the specified commands.
658
658
659 The following example makes :hg:`log` run in verbose mode, and
659 The following example makes :hg:`log` run in verbose mode, and
660 :hg:`status` show only the modified files, by default::
660 :hg:`status` show only the modified files, by default::
661
661
662 [defaults]
662 [defaults]
663 log = -v
663 log = -v
664 status = -m
664 status = -m
665
665
666 The actual commands, instead of their aliases, must be used when
666 The actual commands, instead of their aliases, must be used when
667 defining command defaults. The command defaults will also be applied
667 defining command defaults. The command defaults will also be applied
668 to the aliases of the commands defined.
668 to the aliases of the commands defined.
669
669
670
670
671 ``diff``
671 ``diff``
672 --------
672 --------
673
673
674 Settings used when displaying diffs. Everything except for ``unified``
674 Settings used when displaying diffs. Everything except for ``unified``
675 is a Boolean and defaults to False. See :hg:`help config.annotate`
675 is a Boolean and defaults to False. See :hg:`help config.annotate`
676 for related options for the annotate command.
676 for related options for the annotate command.
677
677
678 ``git``
678 ``git``
679 Use git extended diff format.
679 Use git extended diff format.
680
680
681 ``nobinary``
681 ``nobinary``
682 Omit git binary patches.
682 Omit git binary patches.
683
683
684 ``nodates``
684 ``nodates``
685 Don't include dates in diff headers.
685 Don't include dates in diff headers.
686
686
687 ``noprefix``
687 ``noprefix``
688 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
688 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
689
689
690 ``showfunc``
690 ``showfunc``
691 Show which function each change is in.
691 Show which function each change is in.
692
692
693 ``ignorews``
693 ``ignorews``
694 Ignore white space when comparing lines.
694 Ignore white space when comparing lines.
695
695
696 ``ignorewsamount``
696 ``ignorewsamount``
697 Ignore changes in the amount of white space.
697 Ignore changes in the amount of white space.
698
698
699 ``ignoreblanklines``
699 ``ignoreblanklines``
700 Ignore changes whose lines are all blank.
700 Ignore changes whose lines are all blank.
701
701
702 ``unified``
702 ``unified``
703 Number of lines of context to show.
703 Number of lines of context to show.
704
704
705 ``word-diff``
705 ``word-diff``
706 Highlight changed words.
706 Highlight changed words.
707
707
708 ``email``
708 ``email``
709 ---------
709 ---------
710
710
711 Settings for extensions that send email messages.
711 Settings for extensions that send email messages.
712
712
713 ``from``
713 ``from``
714 Optional. Email address to use in "From" header and SMTP envelope
714 Optional. Email address to use in "From" header and SMTP envelope
715 of outgoing messages.
715 of outgoing messages.
716
716
717 ``to``
717 ``to``
718 Optional. Comma-separated list of recipients' email addresses.
718 Optional. Comma-separated list of recipients' email addresses.
719
719
720 ``cc``
720 ``cc``
721 Optional. Comma-separated list of carbon copy recipients'
721 Optional. Comma-separated list of carbon copy recipients'
722 email addresses.
722 email addresses.
723
723
724 ``bcc``
724 ``bcc``
725 Optional. Comma-separated list of blind carbon copy recipients'
725 Optional. Comma-separated list of blind carbon copy recipients'
726 email addresses.
726 email addresses.
727
727
728 ``method``
728 ``method``
729 Optional. Method to use to send email messages. If value is ``smtp``
729 Optional. Method to use to send email messages. If value is ``smtp``
730 (default), use SMTP (see the ``[smtp]`` section for configuration).
730 (default), use SMTP (see the ``[smtp]`` section for configuration).
731 Otherwise, use as name of program to run that acts like sendmail
731 Otherwise, use as name of program to run that acts like sendmail
732 (takes ``-f`` option for sender, list of recipients on command line,
732 (takes ``-f`` option for sender, list of recipients on command line,
733 message on stdin). Normally, setting this to ``sendmail`` or
733 message on stdin). Normally, setting this to ``sendmail`` or
734 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
734 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
735
735
736 ``charsets``
736 ``charsets``
737 Optional. Comma-separated list of character sets considered
737 Optional. Comma-separated list of character sets considered
738 convenient for recipients. Addresses, headers, and parts not
738 convenient for recipients. Addresses, headers, and parts not
739 containing patches of outgoing messages will be encoded in the
739 containing patches of outgoing messages will be encoded in the
740 first character set to which conversion from local encoding
740 first character set to which conversion from local encoding
741 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
741 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
742 conversion fails, the text in question is sent as is.
742 conversion fails, the text in question is sent as is.
743 (default: '')
743 (default: '')
744
744
745 Order of outgoing email character sets:
745 Order of outgoing email character sets:
746
746
747 1. ``us-ascii``: always first, regardless of settings
747 1. ``us-ascii``: always first, regardless of settings
748 2. ``email.charsets``: in order given by user
748 2. ``email.charsets``: in order given by user
749 3. ``ui.fallbackencoding``: if not in email.charsets
749 3. ``ui.fallbackencoding``: if not in email.charsets
750 4. ``$HGENCODING``: if not in email.charsets
750 4. ``$HGENCODING``: if not in email.charsets
751 5. ``utf-8``: always last, regardless of settings
751 5. ``utf-8``: always last, regardless of settings
752
752
753 Email example::
753 Email example::
754
754
755 [email]
755 [email]
756 from = Joseph User <joe.user@example.com>
756 from = Joseph User <joe.user@example.com>
757 method = /usr/sbin/sendmail
757 method = /usr/sbin/sendmail
758 # charsets for western Europeans
758 # charsets for western Europeans
759 # us-ascii, utf-8 omitted, as they are tried first and last
759 # us-ascii, utf-8 omitted, as they are tried first and last
760 charsets = iso-8859-1, iso-8859-15, windows-1252
760 charsets = iso-8859-1, iso-8859-15, windows-1252
761
761
762
762
763 ``extensions``
763 ``extensions``
764 --------------
764 --------------
765
765
766 Mercurial has an extension mechanism for adding new features. To
766 Mercurial has an extension mechanism for adding new features. To
767 enable an extension, create an entry for it in this section.
767 enable an extension, create an entry for it in this section.
768
768
769 If you know that the extension is already in Python's search path,
769 If you know that the extension is already in Python's search path,
770 you can give the name of the module, followed by ``=``, with nothing
770 you can give the name of the module, followed by ``=``, with nothing
771 after the ``=``.
771 after the ``=``.
772
772
773 Otherwise, give a name that you choose, followed by ``=``, followed by
773 Otherwise, give a name that you choose, followed by ``=``, followed by
774 the path to the ``.py`` file (including the file name extension) that
774 the path to the ``.py`` file (including the file name extension) that
775 defines the extension.
775 defines the extension.
776
776
777 To explicitly disable an extension that is enabled in an hgrc of
777 To explicitly disable an extension that is enabled in an hgrc of
778 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
778 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
779 or ``foo = !`` when path is not supplied.
779 or ``foo = !`` when path is not supplied.
780
780
781 Example for ``~/.hgrc``::
781 Example for ``~/.hgrc``::
782
782
783 [extensions]
783 [extensions]
784 # (the churn extension will get loaded from Mercurial's path)
784 # (the churn extension will get loaded from Mercurial's path)
785 churn =
785 churn =
786 # (this extension will get loaded from the file specified)
786 # (this extension will get loaded from the file specified)
787 myfeature = ~/.hgext/myfeature.py
787 myfeature = ~/.hgext/myfeature.py
788
788
789
789
790 ``format``
790 ``format``
791 ----------
791 ----------
792
792
793 ``usegeneraldelta``
793 ``usegeneraldelta``
794 Enable or disable the "generaldelta" repository format which improves
794 Enable or disable the "generaldelta" repository format which improves
795 repository compression by allowing "revlog" to store delta against arbitrary
795 repository compression by allowing "revlog" to store delta against arbitrary
796 revision instead of the previous stored one. This provides significant
796 revision instead of the previous stored one. This provides significant
797 improvement for repositories with branches.
797 improvement for repositories with branches.
798
798
799 Repositories with this on-disk format require Mercurial version 1.9.
799 Repositories with this on-disk format require Mercurial version 1.9.
800
800
801 Enabled by default.
801 Enabled by default.
802
802
803 ``dotencode``
803 ``dotencode``
804 Enable or disable the "dotencode" repository format which enhances
804 Enable or disable the "dotencode" repository format which enhances
805 the "fncache" repository format (which has to be enabled to use
805 the "fncache" repository format (which has to be enabled to use
806 dotencode) to avoid issues with filenames starting with ._ on
806 dotencode) to avoid issues with filenames starting with ._ on
807 Mac OS X and spaces on Windows.
807 Mac OS X and spaces on Windows.
808
808
809 Repositories with this on-disk format require Mercurial version 1.7.
809 Repositories with this on-disk format require Mercurial version 1.7.
810
810
811 Enabled by default.
811 Enabled by default.
812
812
813 ``usefncache``
813 ``usefncache``
814 Enable or disable the "fncache" repository format which enhances
814 Enable or disable the "fncache" repository format which enhances
815 the "store" repository format (which has to be enabled to use
815 the "store" repository format (which has to be enabled to use
816 fncache) to allow longer filenames and avoids using Windows
816 fncache) to allow longer filenames and avoids using Windows
817 reserved names, e.g. "nul".
817 reserved names, e.g. "nul".
818
818
819 Repositories with this on-disk format require Mercurial version 1.1.
819 Repositories with this on-disk format require Mercurial version 1.1.
820
820
821 Enabled by default.
821 Enabled by default.
822
822
823 ``usestore``
823 ``usestore``
824 Enable or disable the "store" repository format which improves
824 Enable or disable the "store" repository format which improves
825 compatibility with systems that fold case or otherwise mangle
825 compatibility with systems that fold case or otherwise mangle
826 filenames. Disabling this option will allow you to store longer filenames
826 filenames. Disabling this option will allow you to store longer filenames
827 in some situations at the expense of compatibility.
827 in some situations at the expense of compatibility.
828
828
829 Repositories with this on-disk format require Mercurial version 0.9.4.
829 Repositories with this on-disk format require Mercurial version 0.9.4.
830
830
831 Enabled by default.
831 Enabled by default.
832
832
833 ``graph``
833 ``graph``
834 ---------
834 ---------
835
835
836 Web graph view configuration. This section let you change graph
836 Web graph view configuration. This section let you change graph
837 elements display properties by branches, for instance to make the
837 elements display properties by branches, for instance to make the
838 ``default`` branch stand out.
838 ``default`` branch stand out.
839
839
840 Each line has the following format::
840 Each line has the following format::
841
841
842 <branch>.<argument> = <value>
842 <branch>.<argument> = <value>
843
843
844 where ``<branch>`` is the name of the branch being
844 where ``<branch>`` is the name of the branch being
845 customized. Example::
845 customized. Example::
846
846
847 [graph]
847 [graph]
848 # 2px width
848 # 2px width
849 default.width = 2
849 default.width = 2
850 # red color
850 # red color
851 default.color = FF0000
851 default.color = FF0000
852
852
853 Supported arguments:
853 Supported arguments:
854
854
855 ``width``
855 ``width``
856 Set branch edges width in pixels.
856 Set branch edges width in pixels.
857
857
858 ``color``
858 ``color``
859 Set branch edges color in hexadecimal RGB notation.
859 Set branch edges color in hexadecimal RGB notation.
860
860
861 ``hooks``
861 ``hooks``
862 ---------
862 ---------
863
863
864 Commands or Python functions that get automatically executed by
864 Commands or Python functions that get automatically executed by
865 various actions such as starting or finishing a commit. Multiple
865 various actions such as starting or finishing a commit. Multiple
866 hooks can be run for the same action by appending a suffix to the
866 hooks can be run for the same action by appending a suffix to the
867 action. Overriding a site-wide hook can be done by changing its
867 action. Overriding a site-wide hook can be done by changing its
868 value or setting it to an empty string. Hooks can be prioritized
868 value or setting it to an empty string. Hooks can be prioritized
869 by adding a prefix of ``priority.`` to the hook name on a new line
869 by adding a prefix of ``priority.`` to the hook name on a new line
870 and setting the priority. The default priority is 0.
870 and setting the priority. The default priority is 0.
871
871
872 Example ``.hg/hgrc``::
872 Example ``.hg/hgrc``::
873
873
874 [hooks]
874 [hooks]
875 # update working directory after adding changesets
875 # update working directory after adding changesets
876 changegroup.update = hg update
876 changegroup.update = hg update
877 # do not use the site-wide hook
877 # do not use the site-wide hook
878 incoming =
878 incoming =
879 incoming.email = /my/email/hook
879 incoming.email = /my/email/hook
880 incoming.autobuild = /my/build/hook
880 incoming.autobuild = /my/build/hook
881 # force autobuild hook to run before other incoming hooks
881 # force autobuild hook to run before other incoming hooks
882 priority.incoming.autobuild = 1
882 priority.incoming.autobuild = 1
883
883
884 Most hooks are run with environment variables set that give useful
884 Most hooks are run with environment variables set that give useful
885 additional information. For each hook below, the environment variables
885 additional information. For each hook below, the environment variables
886 it is passed are listed with names in the form ``$HG_foo``. The
886 it is passed are listed with names in the form ``$HG_foo``. The
887 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
887 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
888 They contain the type of hook which triggered the run and the full name
888 They contain the type of hook which triggered the run and the full name
889 of the hook in the config, respectively. In the example above, this will
889 of the hook in the config, respectively. In the example above, this will
890 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
890 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
891
891
892 .. container:: windows
892 .. container:: windows
893
893
894 Some basic Unix syntax is supported for portability, including ``$VAR``
894 Some basic Unix syntax is supported for portability, including ``$VAR``
895 and ``${VAR}`` style variables. To use a literal ``$``, it must be
895 and ``${VAR}`` style variables. To use a literal ``$``, it must be
896 escaped with a back slash or inside of a strong quote.
896 escaped with a back slash or inside of a strong quote.
897
897
898 ``changegroup``
898 ``changegroup``
899 Run after a changegroup has been added via push, pull or unbundle. The ID of
899 Run after a changegroup has been added via push, pull or unbundle. The ID of
900 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
900 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
901 The URL from which changes came is in ``$HG_URL``.
901 The URL from which changes came is in ``$HG_URL``.
902
902
903 ``commit``
903 ``commit``
904 Run after a changeset has been created in the local repository. The ID
904 Run after a changeset has been created in the local repository. The ID
905 of the newly created changeset is in ``$HG_NODE``. Parent changeset
905 of the newly created changeset is in ``$HG_NODE``. Parent changeset
906 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
906 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
907
907
908 ``incoming``
908 ``incoming``
909 Run after a changeset has been pulled, pushed, or unbundled into
909 Run after a changeset has been pulled, pushed, or unbundled into
910 the local repository. The ID of the newly arrived changeset is in
910 the local repository. The ID of the newly arrived changeset is in
911 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
911 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
912
912
913 ``outgoing``
913 ``outgoing``
914 Run after sending changes from the local repository to another. The ID of
914 Run after sending changes from the local repository to another. The ID of
915 first changeset sent is in ``$HG_NODE``. The source of operation is in
915 first changeset sent is in ``$HG_NODE``. The source of operation is in
916 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
916 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
917
917
918 ``post-<command>``
918 ``post-<command>``
919 Run after successful invocations of the associated command. The
919 Run after successful invocations of the associated command. The
920 contents of the command line are passed as ``$HG_ARGS`` and the result
920 contents of the command line are passed as ``$HG_ARGS`` and the result
921 code in ``$HG_RESULT``. Parsed command line arguments are passed as
921 code in ``$HG_RESULT``. Parsed command line arguments are passed as
922 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
922 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
923 the python data internally passed to <command>. ``$HG_OPTS`` is a
923 the python data internally passed to <command>. ``$HG_OPTS`` is a
924 dictionary of options (with unspecified options set to their defaults).
924 dictionary of options (with unspecified options set to their defaults).
925 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
925 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
926
926
927 ``fail-<command>``
927 ``fail-<command>``
928 Run after a failed invocation of an associated command. The contents
928 Run after a failed invocation of an associated command. The contents
929 of the command line are passed as ``$HG_ARGS``. Parsed command line
929 of the command line are passed as ``$HG_ARGS``. Parsed command line
930 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
930 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
931 string representations of the python data internally passed to
931 string representations of the python data internally passed to
932 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
932 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
933 options set to their defaults). ``$HG_PATS`` is a list of arguments.
933 options set to their defaults). ``$HG_PATS`` is a list of arguments.
934 Hook failure is ignored.
934 Hook failure is ignored.
935
935
936 ``pre-<command>``
936 ``pre-<command>``
937 Run before executing the associated command. The contents of the
937 Run before executing the associated command. The contents of the
938 command line are passed as ``$HG_ARGS``. Parsed command line arguments
938 command line are passed as ``$HG_ARGS``. Parsed command line arguments
939 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
939 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
940 representations of the data internally passed to <command>. ``$HG_OPTS``
940 representations of the data internally passed to <command>. ``$HG_OPTS``
941 is a dictionary of options (with unspecified options set to their
941 is a dictionary of options (with unspecified options set to their
942 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
942 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
943 failure, the command doesn't execute and Mercurial returns the failure
943 failure, the command doesn't execute and Mercurial returns the failure
944 code.
944 code.
945
945
946 ``prechangegroup``
946 ``prechangegroup``
947 Run before a changegroup is added via push, pull or unbundle. Exit
947 Run before a changegroup is added via push, pull or unbundle. Exit
948 status 0 allows the changegroup to proceed. A non-zero status will
948 status 0 allows the changegroup to proceed. A non-zero status will
949 cause the push, pull or unbundle to fail. The URL from which changes
949 cause the push, pull or unbundle to fail. The URL from which changes
950 will come is in ``$HG_URL``.
950 will come is in ``$HG_URL``.
951
951
952 ``precommit``
952 ``precommit``
953 Run before starting a local commit. Exit status 0 allows the
953 Run before starting a local commit. Exit status 0 allows the
954 commit to proceed. A non-zero status will cause the commit to fail.
954 commit to proceed. A non-zero status will cause the commit to fail.
955 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
955 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
956
956
957 ``prelistkeys``
957 ``prelistkeys``
958 Run before listing pushkeys (like bookmarks) in the
958 Run before listing pushkeys (like bookmarks) in the
959 repository. A non-zero status will cause failure. The key namespace is
959 repository. A non-zero status will cause failure. The key namespace is
960 in ``$HG_NAMESPACE``.
960 in ``$HG_NAMESPACE``.
961
961
962 ``preoutgoing``
962 ``preoutgoing``
963 Run before collecting changes to send from the local repository to
963 Run before collecting changes to send from the local repository to
964 another. A non-zero status will cause failure. This lets you prevent
964 another. A non-zero status will cause failure. This lets you prevent
965 pull over HTTP or SSH. It can also prevent propagating commits (via
965 pull over HTTP or SSH. It can also prevent propagating commits (via
966 local pull, push (outbound) or bundle commands), but not completely,
966 local pull, push (outbound) or bundle commands), but not completely,
967 since you can just copy files instead. The source of operation is in
967 since you can just copy files instead. The source of operation is in
968 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
968 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
969 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
969 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
970 is happening on behalf of a repository on same system.
970 is happening on behalf of a repository on same system.
971
971
972 ``prepushkey``
972 ``prepushkey``
973 Run before a pushkey (like a bookmark) is added to the
973 Run before a pushkey (like a bookmark) is added to the
974 repository. A non-zero status will cause the key to be rejected. The
974 repository. A non-zero status will cause the key to be rejected. The
975 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
975 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
976 the old value (if any) is in ``$HG_OLD``, and the new value is in
976 the old value (if any) is in ``$HG_OLD``, and the new value is in
977 ``$HG_NEW``.
977 ``$HG_NEW``.
978
978
979 ``pretag``
979 ``pretag``
980 Run before creating a tag. Exit status 0 allows the tag to be
980 Run before creating a tag. Exit status 0 allows the tag to be
981 created. A non-zero status will cause the tag to fail. The ID of the
981 created. A non-zero status will cause the tag to fail. The ID of the
982 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
982 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
983 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
983 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
984
984
985 ``pretxnopen``
985 ``pretxnopen``
986 Run before any new repository transaction is open. The reason for the
986 Run before any new repository transaction is open. The reason for the
987 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
987 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
988 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
988 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
989 transaction from being opened.
989 transaction from being opened.
990
990
991 ``pretxnclose``
991 ``pretxnclose``
992 Run right before the transaction is actually finalized. Any repository change
992 Run right before the transaction is actually finalized. Any repository change
993 will be visible to the hook program. This lets you validate the transaction
993 will be visible to the hook program. This lets you validate the transaction
994 content or change it. Exit status 0 allows the commit to proceed. A non-zero
994 content or change it. Exit status 0 allows the commit to proceed. A non-zero
995 status will cause the transaction to be rolled back. The reason for the
995 status will cause the transaction to be rolled back. The reason for the
996 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
996 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
997 the transaction will be in ``HG_TXNID``. The rest of the available data will
997 the transaction will be in ``HG_TXNID``. The rest of the available data will
998 vary according the transaction type. New changesets will add ``$HG_NODE``
998 vary according the transaction type. New changesets will add ``$HG_NODE``
999 (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
999 (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
1000 added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
1000 added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
1001 phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
1001 phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
1002 respectively, etc.
1002 respectively, etc.
1003
1003
1004 ``pretxnclose-bookmark``
1004 ``pretxnclose-bookmark``
1005 Run right before a bookmark change is actually finalized. Any repository
1005 Run right before a bookmark change is actually finalized. Any repository
1006 change will be visible to the hook program. This lets you validate the
1006 change will be visible to the hook program. This lets you validate the
1007 transaction content or change it. Exit status 0 allows the commit to
1007 transaction content or change it. Exit status 0 allows the commit to
1008 proceed. A non-zero status will cause the transaction to be rolled back.
1008 proceed. A non-zero status will cause the transaction to be rolled back.
1009 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1009 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1010 bookmark location will be available in ``$HG_NODE`` while the previous
1010 bookmark location will be available in ``$HG_NODE`` while the previous
1011 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1011 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1012 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1012 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1013 will be empty.
1013 will be empty.
1014 In addition, the reason for the transaction opening will be in
1014 In addition, the reason for the transaction opening will be in
1015 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1015 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1016 ``HG_TXNID``.
1016 ``HG_TXNID``.
1017
1017
1018 ``pretxnclose-phase``
1018 ``pretxnclose-phase``
1019 Run right before a phase change is actually finalized. Any repository change
1019 Run right before a phase change is actually finalized. Any repository change
1020 will be visible to the hook program. This lets you validate the transaction
1020 will be visible to the hook program. This lets you validate the transaction
1021 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1021 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1022 status will cause the transaction to be rolled back. The hook is called
1022 status will cause the transaction to be rolled back. The hook is called
1023 multiple times, once for each revision affected by a phase change.
1023 multiple times, once for each revision affected by a phase change.
1024 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1024 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1025 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1025 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1026 will be empty. In addition, the reason for the transaction opening will be in
1026 will be empty. In addition, the reason for the transaction opening will be in
1027 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1027 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1028 ``HG_TXNID``. The hook is also run for newly added revisions. In this case
1028 ``HG_TXNID``. The hook is also run for newly added revisions. In this case
1029 the ``$HG_OLDPHASE`` entry will be empty.
1029 the ``$HG_OLDPHASE`` entry will be empty.
1030
1030
1031 ``txnclose``
1031 ``txnclose``
1032 Run after any repository transaction has been committed. At this
1032 Run after any repository transaction has been committed. At this
1033 point, the transaction can no longer be rolled back. The hook will run
1033 point, the transaction can no longer be rolled back. The hook will run
1034 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1034 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1035 details about available variables.
1035 details about available variables.
1036
1036
1037 ``txnclose-bookmark``
1037 ``txnclose-bookmark``
1038 Run after any bookmark change has been committed. At this point, the
1038 Run after any bookmark change has been committed. At this point, the
1039 transaction can no longer be rolled back. The hook will run after the lock
1039 transaction can no longer be rolled back. The hook will run after the lock
1040 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1040 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1041 about available variables.
1041 about available variables.
1042
1042
1043 ``txnclose-phase``
1043 ``txnclose-phase``
1044 Run after any phase change has been committed. At this point, the
1044 Run after any phase change has been committed. At this point, the
1045 transaction can no longer be rolled back. The hook will run after the lock
1045 transaction can no longer be rolled back. The hook will run after the lock
1046 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1046 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1047 available variables.
1047 available variables.
1048
1048
1049 ``txnabort``
1049 ``txnabort``
1050 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1050 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1051 for details about available variables.
1051 for details about available variables.
1052
1052
1053 ``pretxnchangegroup``
1053 ``pretxnchangegroup``
1054 Run after a changegroup has been added via push, pull or unbundle, but before
1054 Run after a changegroup has been added via push, pull or unbundle, but before
1055 the transaction has been committed. The changegroup is visible to the hook
1055 the transaction has been committed. The changegroup is visible to the hook
1056 program. This allows validation of incoming changes before accepting them.
1056 program. This allows validation of incoming changes before accepting them.
1057 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1057 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1058 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1058 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1059 status will cause the transaction to be rolled back, and the push, pull or
1059 status will cause the transaction to be rolled back, and the push, pull or
1060 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1060 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1061
1061
1062 ``pretxncommit``
1062 ``pretxncommit``
1063 Run after a changeset has been created, but before the transaction is
1063 Run after a changeset has been created, but before the transaction is
1064 committed. The changeset is visible to the hook program. This allows
1064 committed. The changeset is visible to the hook program. This allows
1065 validation of the commit message and changes. Exit status 0 allows the
1065 validation of the commit message and changes. Exit status 0 allows the
1066 commit to proceed. A non-zero status will cause the transaction to
1066 commit to proceed. A non-zero status will cause the transaction to
1067 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1067 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1068 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1068 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1069
1069
1070 ``preupdate``
1070 ``preupdate``
1071 Run before updating the working directory. Exit status 0 allows
1071 Run before updating the working directory. Exit status 0 allows
1072 the update to proceed. A non-zero status will prevent the update.
1072 the update to proceed. A non-zero status will prevent the update.
1073 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1073 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1074 merge, the ID of second new parent is in ``$HG_PARENT2``.
1074 merge, the ID of second new parent is in ``$HG_PARENT2``.
1075
1075
1076 ``listkeys``
1076 ``listkeys``
1077 Run after listing pushkeys (like bookmarks) in the repository. The
1077 Run after listing pushkeys (like bookmarks) in the repository. The
1078 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1078 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1079 dictionary containing the keys and values.
1079 dictionary containing the keys and values.
1080
1080
1081 ``pushkey``
1081 ``pushkey``
1082 Run after a pushkey (like a bookmark) is added to the
1082 Run after a pushkey (like a bookmark) is added to the
1083 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1083 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1084 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1084 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1085 value is in ``$HG_NEW``.
1085 value is in ``$HG_NEW``.
1086
1086
1087 ``tag``
1087 ``tag``
1088 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1088 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1089 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1089 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1090 the repository if ``$HG_LOCAL=0``.
1090 the repository if ``$HG_LOCAL=0``.
1091
1091
1092 ``update``
1092 ``update``
1093 Run after updating the working directory. The changeset ID of first
1093 Run after updating the working directory. The changeset ID of first
1094 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1094 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1095 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1095 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1096 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1096 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1097
1097
1098 .. note::
1098 .. note::
1099
1099
1100 It is generally better to use standard hooks rather than the
1100 It is generally better to use standard hooks rather than the
1101 generic pre- and post- command hooks, as they are guaranteed to be
1101 generic pre- and post- command hooks, as they are guaranteed to be
1102 called in the appropriate contexts for influencing transactions.
1102 called in the appropriate contexts for influencing transactions.
1103 Also, hooks like "commit" will be called in all contexts that
1103 Also, hooks like "commit" will be called in all contexts that
1104 generate a commit (e.g. tag) and not just the commit command.
1104 generate a commit (e.g. tag) and not just the commit command.
1105
1105
1106 .. note::
1106 .. note::
1107
1107
1108 Environment variables with empty values may not be passed to
1108 Environment variables with empty values may not be passed to
1109 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1109 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1110 will have an empty value under Unix-like platforms for non-merge
1110 will have an empty value under Unix-like platforms for non-merge
1111 changesets, while it will not be available at all under Windows.
1111 changesets, while it will not be available at all under Windows.
1112
1112
1113 The syntax for Python hooks is as follows::
1113 The syntax for Python hooks is as follows::
1114
1114
1115 hookname = python:modulename.submodule.callable
1115 hookname = python:modulename.submodule.callable
1116 hookname = python:/path/to/python/module.py:callable
1116 hookname = python:/path/to/python/module.py:callable
1117
1117
1118 Python hooks are run within the Mercurial process. Each hook is
1118 Python hooks are run within the Mercurial process. Each hook is
1119 called with at least three keyword arguments: a ui object (keyword
1119 called with at least three keyword arguments: a ui object (keyword
1120 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1120 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1121 keyword that tells what kind of hook is used. Arguments listed as
1121 keyword that tells what kind of hook is used. Arguments listed as
1122 environment variables above are passed as keyword arguments, with no
1122 environment variables above are passed as keyword arguments, with no
1123 ``HG_`` prefix, and names in lower case.
1123 ``HG_`` prefix, and names in lower case.
1124
1124
1125 If a Python hook returns a "true" value or raises an exception, this
1125 If a Python hook returns a "true" value or raises an exception, this
1126 is treated as a failure.
1126 is treated as a failure.
1127
1127
1128
1128
1129 ``hostfingerprints``
1129 ``hostfingerprints``
1130 --------------------
1130 --------------------
1131
1131
1132 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1132 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1133
1133
1134 Fingerprints of the certificates of known HTTPS servers.
1134 Fingerprints of the certificates of known HTTPS servers.
1135
1135
1136 A HTTPS connection to a server with a fingerprint configured here will
1136 A HTTPS connection to a server with a fingerprint configured here will
1137 only succeed if the servers certificate matches the fingerprint.
1137 only succeed if the servers certificate matches the fingerprint.
1138 This is very similar to how ssh known hosts works.
1138 This is very similar to how ssh known hosts works.
1139
1139
1140 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1140 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1141 Multiple values can be specified (separated by spaces or commas). This can
1141 Multiple values can be specified (separated by spaces or commas). This can
1142 be used to define both old and new fingerprints while a host transitions
1142 be used to define both old and new fingerprints while a host transitions
1143 to a new certificate.
1143 to a new certificate.
1144
1144
1145 The CA chain and web.cacerts is not used for servers with a fingerprint.
1145 The CA chain and web.cacerts is not used for servers with a fingerprint.
1146
1146
1147 For example::
1147 For example::
1148
1148
1149 [hostfingerprints]
1149 [hostfingerprints]
1150 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
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 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
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 ``hostsecurity``
1153 ``hostsecurity``
1154 ----------------
1154 ----------------
1155
1155
1156 Used to specify global and per-host security settings for connecting to
1156 Used to specify global and per-host security settings for connecting to
1157 other machines.
1157 other machines.
1158
1158
1159 The following options control default behavior for all hosts.
1159 The following options control default behavior for all hosts.
1160
1160
1161 ``ciphers``
1161 ``ciphers``
1162 Defines the cryptographic ciphers to use for connections.
1162 Defines the cryptographic ciphers to use for connections.
1163
1163
1164 Value must be a valid OpenSSL Cipher List Format as documented at
1164 Value must be a valid OpenSSL Cipher List Format as documented at
1165 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1165 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1166
1166
1167 This setting is for advanced users only. Setting to incorrect values
1167 This setting is for advanced users only. Setting to incorrect values
1168 can significantly lower connection security or decrease performance.
1168 can significantly lower connection security or decrease performance.
1169 You have been warned.
1169 You have been warned.
1170
1170
1171 This option requires Python 2.7.
1171 This option requires Python 2.7.
1172
1172
1173 ``minimumprotocol``
1173 ``minimumprotocol``
1174 Defines the minimum channel encryption protocol to use.
1174 Defines the minimum channel encryption protocol to use.
1175
1175
1176 By default, the highest version of TLS supported by both client and server
1176 By default, the highest version of TLS supported by both client and server
1177 is used.
1177 is used.
1178
1178
1179 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1179 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1180
1180
1181 When running on an old Python version, only ``tls1.0`` is allowed since
1181 When running on an old Python version, only ``tls1.0`` is allowed since
1182 old versions of Python only support up to TLS 1.0.
1182 old versions of Python only support up to TLS 1.0.
1183
1183
1184 When running a Python that supports modern TLS versions, the default is
1184 When running a Python that supports modern TLS versions, the default is
1185 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1185 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1186 weakens security and should only be used as a feature of last resort if
1186 weakens security and should only be used as a feature of last resort if
1187 a server does not support TLS 1.1+.
1187 a server does not support TLS 1.1+.
1188
1188
1189 Options in the ``[hostsecurity]`` section can have the form
1189 Options in the ``[hostsecurity]`` section can have the form
1190 ``hostname``:``setting``. This allows multiple settings to be defined on a
1190 ``hostname``:``setting``. This allows multiple settings to be defined on a
1191 per-host basis.
1191 per-host basis.
1192
1192
1193 The following per-host settings can be defined.
1193 The following per-host settings can be defined.
1194
1194
1195 ``ciphers``
1195 ``ciphers``
1196 This behaves like ``ciphers`` as described above except it only applies
1196 This behaves like ``ciphers`` as described above except it only applies
1197 to the host on which it is defined.
1197 to the host on which it is defined.
1198
1198
1199 ``fingerprints``
1199 ``fingerprints``
1200 A list of hashes of the DER encoded peer/remote certificate. Values have
1200 A list of hashes of the DER encoded peer/remote certificate. Values have
1201 the form ``algorithm``:``fingerprint``. e.g.
1201 the form ``algorithm``:``fingerprint``. e.g.
1202 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1202 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1203 In addition, colons (``:``) can appear in the fingerprint part.
1203 In addition, colons (``:``) can appear in the fingerprint part.
1204
1204
1205 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1205 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1206 ``sha512``.
1206 ``sha512``.
1207
1207
1208 Use of ``sha256`` or ``sha512`` is preferred.
1208 Use of ``sha256`` or ``sha512`` is preferred.
1209
1209
1210 If a fingerprint is specified, the CA chain is not validated for this
1210 If a fingerprint is specified, the CA chain is not validated for this
1211 host and Mercurial will require the remote certificate to match one
1211 host and Mercurial will require the remote certificate to match one
1212 of the fingerprints specified. This means if the server updates its
1212 of the fingerprints specified. This means if the server updates its
1213 certificate, Mercurial will abort until a new fingerprint is defined.
1213 certificate, Mercurial will abort until a new fingerprint is defined.
1214 This can provide stronger security than traditional CA-based validation
1214 This can provide stronger security than traditional CA-based validation
1215 at the expense of convenience.
1215 at the expense of convenience.
1216
1216
1217 This option takes precedence over ``verifycertsfile``.
1217 This option takes precedence over ``verifycertsfile``.
1218
1218
1219 ``minimumprotocol``
1219 ``minimumprotocol``
1220 This behaves like ``minimumprotocol`` as described above except it
1220 This behaves like ``minimumprotocol`` as described above except it
1221 only applies to the host on which it is defined.
1221 only applies to the host on which it is defined.
1222
1222
1223 ``verifycertsfile``
1223 ``verifycertsfile``
1224 Path to file a containing a list of PEM encoded certificates used to
1224 Path to file a containing a list of PEM encoded certificates used to
1225 verify the server certificate. Environment variables and ``~user``
1225 verify the server certificate. Environment variables and ``~user``
1226 constructs are expanded in the filename.
1226 constructs are expanded in the filename.
1227
1227
1228 The server certificate or the certificate's certificate authority (CA)
1228 The server certificate or the certificate's certificate authority (CA)
1229 must match a certificate from this file or certificate verification
1229 must match a certificate from this file or certificate verification
1230 will fail and connections to the server will be refused.
1230 will fail and connections to the server will be refused.
1231
1231
1232 If defined, only certificates provided by this file will be used:
1232 If defined, only certificates provided by this file will be used:
1233 ``web.cacerts`` and any system/default certificates will not be
1233 ``web.cacerts`` and any system/default certificates will not be
1234 used.
1234 used.
1235
1235
1236 This option has no effect if the per-host ``fingerprints`` option
1236 This option has no effect if the per-host ``fingerprints`` option
1237 is set.
1237 is set.
1238
1238
1239 The format of the file is as follows::
1239 The format of the file is as follows::
1240
1240
1241 -----BEGIN CERTIFICATE-----
1241 -----BEGIN CERTIFICATE-----
1242 ... (certificate in base64 PEM encoding) ...
1242 ... (certificate in base64 PEM encoding) ...
1243 -----END CERTIFICATE-----
1243 -----END CERTIFICATE-----
1244 -----BEGIN CERTIFICATE-----
1244 -----BEGIN CERTIFICATE-----
1245 ... (certificate in base64 PEM encoding) ...
1245 ... (certificate in base64 PEM encoding) ...
1246 -----END CERTIFICATE-----
1246 -----END CERTIFICATE-----
1247
1247
1248 For example::
1248 For example::
1249
1249
1250 [hostsecurity]
1250 [hostsecurity]
1251 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1251 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
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
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 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
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 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1254 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1255
1255
1256 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1256 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1257 when connecting to ``hg.example.com``::
1257 when connecting to ``hg.example.com``::
1258
1258
1259 [hostsecurity]
1259 [hostsecurity]
1260 minimumprotocol = tls1.2
1260 minimumprotocol = tls1.2
1261 hg.example.com:minimumprotocol = tls1.1
1261 hg.example.com:minimumprotocol = tls1.1
1262
1262
1263 ``http_proxy``
1263 ``http_proxy``
1264 --------------
1264 --------------
1265
1265
1266 Used to access web-based Mercurial repositories through a HTTP
1266 Used to access web-based Mercurial repositories through a HTTP
1267 proxy.
1267 proxy.
1268
1268
1269 ``host``
1269 ``host``
1270 Host name and (optional) port of the proxy server, for example
1270 Host name and (optional) port of the proxy server, for example
1271 "myproxy:8000".
1271 "myproxy:8000".
1272
1272
1273 ``no``
1273 ``no``
1274 Optional. Comma-separated list of host names that should bypass
1274 Optional. Comma-separated list of host names that should bypass
1275 the proxy.
1275 the proxy.
1276
1276
1277 ``passwd``
1277 ``passwd``
1278 Optional. Password to authenticate with at the proxy server.
1278 Optional. Password to authenticate with at the proxy server.
1279
1279
1280 ``user``
1280 ``user``
1281 Optional. User name to authenticate with at the proxy server.
1281 Optional. User name to authenticate with at the proxy server.
1282
1282
1283 ``always``
1283 ``always``
1284 Optional. Always use the proxy, even for localhost and any entries
1284 Optional. Always use the proxy, even for localhost and any entries
1285 in ``http_proxy.no``. (default: False)
1285 in ``http_proxy.no``. (default: False)
1286
1286
1287 ``merge``
1287 ``merge``
1288 ---------
1288 ---------
1289
1289
1290 This section specifies behavior during merges and updates.
1290 This section specifies behavior during merges and updates.
1291
1291
1292 ``checkignored``
1292 ``checkignored``
1293 Controls behavior when an ignored file on disk has the same name as a tracked
1293 Controls behavior when an ignored file on disk has the same name as a tracked
1294 file in the changeset being merged or updated to, and has different
1294 file in the changeset being merged or updated to, and has different
1295 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1295 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1296 abort on such files. With ``warn``, warn on such files and back them up as
1296 abort on such files. With ``warn``, warn on such files and back them up as
1297 ``.orig``. With ``ignore``, don't print a warning and back them up as
1297 ``.orig``. With ``ignore``, don't print a warning and back them up as
1298 ``.orig``. (default: ``abort``)
1298 ``.orig``. (default: ``abort``)
1299
1299
1300 ``checkunknown``
1300 ``checkunknown``
1301 Controls behavior when an unknown file that isn't ignored has the same name
1301 Controls behavior when an unknown file that isn't ignored has the same name
1302 as a tracked file in the changeset being merged or updated to, and has
1302 as a tracked file in the changeset being merged or updated to, and has
1303 different contents. Similar to ``merge.checkignored``, except for files that
1303 different contents. Similar to ``merge.checkignored``, except for files that
1304 are not ignored. (default: ``abort``)
1304 are not ignored. (default: ``abort``)
1305
1305
1306 ``on-failure``
1306 ``on-failure``
1307 When set to ``continue`` (the default), the merge process attempts to
1307 When set to ``continue`` (the default), the merge process attempts to
1308 merge all unresolved files using the merge chosen tool, regardless of
1308 merge all unresolved files using the merge chosen tool, regardless of
1309 whether previous file merge attempts during the process succeeded or not.
1309 whether previous file merge attempts during the process succeeded or not.
1310 Setting this to ``prompt`` will prompt after any merge failure continue
1310 Setting this to ``prompt`` will prompt after any merge failure continue
1311 or halt the merge process. Setting this to ``halt`` will automatically
1311 or halt the merge process. Setting this to ``halt`` will automatically
1312 halt the merge process on any merge tool failure. The merge process
1312 halt the merge process on any merge tool failure. The merge process
1313 can be restarted by using the ``resolve`` command. When a merge is
1313 can be restarted by using the ``resolve`` command. When a merge is
1314 halted, the repository is left in a normal ``unresolved`` merge state.
1314 halted, the repository is left in a normal ``unresolved`` merge state.
1315 (default: ``continue``)
1315 (default: ``continue``)
1316
1316
1317 ``merge-patterns``
1317 ``merge-patterns``
1318 ------------------
1318 ------------------
1319
1319
1320 This section specifies merge tools to associate with particular file
1320 This section specifies merge tools to associate with particular file
1321 patterns. Tools matched here will take precedence over the default
1321 patterns. Tools matched here will take precedence over the default
1322 merge tool. Patterns are globs by default, rooted at the repository
1322 merge tool. Patterns are globs by default, rooted at the repository
1323 root.
1323 root.
1324
1324
1325 Example::
1325 Example::
1326
1326
1327 [merge-patterns]
1327 [merge-patterns]
1328 **.c = kdiff3
1328 **.c = kdiff3
1329 **.jpg = myimgmerge
1329 **.jpg = myimgmerge
1330
1330
1331 ``merge-tools``
1331 ``merge-tools``
1332 ---------------
1332 ---------------
1333
1333
1334 This section configures external merge tools to use for file-level
1334 This section configures external merge tools to use for file-level
1335 merges. This section has likely been preconfigured at install time.
1335 merges. This section has likely been preconfigured at install time.
1336 Use :hg:`config merge-tools` to check the existing configuration.
1336 Use :hg:`config merge-tools` to check the existing configuration.
1337 Also see :hg:`help merge-tools` for more details.
1337 Also see :hg:`help merge-tools` for more details.
1338
1338
1339 Example ``~/.hgrc``::
1339 Example ``~/.hgrc``::
1340
1340
1341 [merge-tools]
1341 [merge-tools]
1342 # Override stock tool location
1342 # Override stock tool location
1343 kdiff3.executable = ~/bin/kdiff3
1343 kdiff3.executable = ~/bin/kdiff3
1344 # Specify command line
1344 # Specify command line
1345 kdiff3.args = $base $local $other -o $output
1345 kdiff3.args = $base $local $other -o $output
1346 # Give higher priority
1346 # Give higher priority
1347 kdiff3.priority = 1
1347 kdiff3.priority = 1
1348
1348
1349 # Changing the priority of preconfigured tool
1349 # Changing the priority of preconfigured tool
1350 meld.priority = 0
1350 meld.priority = 0
1351
1351
1352 # Disable a preconfigured tool
1352 # Disable a preconfigured tool
1353 vimdiff.disabled = yes
1353 vimdiff.disabled = yes
1354
1354
1355 # Define new tool
1355 # Define new tool
1356 myHtmlTool.args = -m $local $other $base $output
1356 myHtmlTool.args = -m $local $other $base $output
1357 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1357 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1358 myHtmlTool.priority = 1
1358 myHtmlTool.priority = 1
1359
1359
1360 Supported arguments:
1360 Supported arguments:
1361
1361
1362 ``priority``
1362 ``priority``
1363 The priority in which to evaluate this tool.
1363 The priority in which to evaluate this tool.
1364 (default: 0)
1364 (default: 0)
1365
1365
1366 ``executable``
1366 ``executable``
1367 Either just the name of the executable or its pathname.
1367 Either just the name of the executable or its pathname.
1368
1368
1369 .. container:: windows
1369 .. container:: windows
1370
1370
1371 On Windows, the path can use environment variables with ${ProgramFiles}
1371 On Windows, the path can use environment variables with ${ProgramFiles}
1372 syntax.
1372 syntax.
1373
1373
1374 (default: the tool name)
1374 (default: the tool name)
1375
1375
1376 ``args``
1376 ``args``
1377 The arguments to pass to the tool executable. You can refer to the
1377 The arguments to pass to the tool executable. You can refer to the
1378 files being merged as well as the output file through these
1378 files being merged as well as the output file through these
1379 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1379 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1380
1380
1381 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1381 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1382 being performed. During an update or merge, ``$local`` represents the original
1382 being performed. During an update or merge, ``$local`` represents the original
1383 state of the file, while ``$other`` represents the commit you are updating to or
1383 state of the file, while ``$other`` represents the commit you are updating to or
1384 the commit you are merging with. During a rebase, ``$local`` represents the
1384 the commit you are merging with. During a rebase, ``$local`` represents the
1385 destination of the rebase, and ``$other`` represents the commit being rebased.
1385 destination of the rebase, and ``$other`` represents the commit being rebased.
1386
1386
1387 Some operations define custom labels to assist with identifying the revisions,
1387 Some operations define custom labels to assist with identifying the revisions,
1388 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1388 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1389 labels are not available, these will be ``local``, ``other``, and ``base``,
1389 labels are not available, these will be ``local``, ``other``, and ``base``,
1390 respectively.
1390 respectively.
1391 (default: ``$local $base $other``)
1391 (default: ``$local $base $other``)
1392
1392
1393 ``premerge``
1393 ``premerge``
1394 Attempt to run internal non-interactive 3-way merge tool before
1394 Attempt to run internal non-interactive 3-way merge tool before
1395 launching external tool. Options are ``true``, ``false``, ``keep`` or
1395 launching external tool. Options are ``true``, ``false``, ``keep`` or
1396 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1396 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1397 premerge fails. The ``keep-merge3`` will do the same but include information
1397 premerge fails. The ``keep-merge3`` will do the same but include information
1398 about the base of the merge in the marker (see internal :merge3 in
1398 about the base of the merge in the marker (see internal :merge3 in
1399 :hg:`help merge-tools`).
1399 :hg:`help merge-tools`).
1400 (default: True)
1400 (default: True)
1401
1401
1402 ``binary``
1402 ``binary``
1403 This tool can merge binary files. (default: False, unless tool
1403 This tool can merge binary files. (default: False, unless tool
1404 was selected by file pattern match)
1404 was selected by file pattern match)
1405
1405
1406 ``symlink``
1406 ``symlink``
1407 This tool can merge symlinks. (default: False)
1407 This tool can merge symlinks. (default: False)
1408
1408
1409 ``check``
1409 ``check``
1410 A list of merge success-checking options:
1410 A list of merge success-checking options:
1411
1411
1412 ``changed``
1412 ``changed``
1413 Ask whether merge was successful when the merged file shows no changes.
1413 Ask whether merge was successful when the merged file shows no changes.
1414 ``conflicts``
1414 ``conflicts``
1415 Check whether there are conflicts even though the tool reported success.
1415 Check whether there are conflicts even though the tool reported success.
1416 ``prompt``
1416 ``prompt``
1417 Always prompt for merge success, regardless of success reported by tool.
1417 Always prompt for merge success, regardless of success reported by tool.
1418
1418
1419 ``fixeol``
1419 ``fixeol``
1420 Attempt to fix up EOL changes caused by the merge tool.
1420 Attempt to fix up EOL changes caused by the merge tool.
1421 (default: False)
1421 (default: False)
1422
1422
1423 ``gui``
1423 ``gui``
1424 This tool requires a graphical interface to run. (default: False)
1424 This tool requires a graphical interface to run. (default: False)
1425
1425
1426 ``mergemarkers``
1426 ``mergemarkers``
1427 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1427 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1428 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1428 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1429 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1429 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1430 markers generated during premerge will be ``detailed`` if either this option or
1430 markers generated during premerge will be ``detailed`` if either this option or
1431 the corresponding option in the ``[ui]`` section is ``detailed``.
1431 the corresponding option in the ``[ui]`` section is ``detailed``.
1432 (default: ``basic``)
1432 (default: ``basic``)
1433
1433
1434 ``mergemarkertemplate``
1434 ``mergemarkertemplate``
1435 This setting can be used to override ``mergemarkertemplate`` from the ``[ui]``
1435 This setting can be used to override ``mergemarkertemplate`` from the ``[ui]``
1436 section on a per-tool basis; this applies to the ``$label``-prefixed variables
1436 section on a per-tool basis; this applies to the ``$label``-prefixed variables
1437 and to the conflict markers that are generated if ``premerge`` is ``keep` or
1437 and to the conflict markers that are generated if ``premerge`` is ``keep` or
1438 ``keep-merge3``. See the corresponding variable in ``[ui]`` for more
1438 ``keep-merge3``. See the corresponding variable in ``[ui]`` for more
1439 information.
1439 information.
1440
1440
1441 .. container:: windows
1441 .. container:: windows
1442
1442
1443 ``regkey``
1443 ``regkey``
1444 Windows registry key which describes install location of this
1444 Windows registry key which describes install location of this
1445 tool. Mercurial will search for this key first under
1445 tool. Mercurial will search for this key first under
1446 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1446 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1447 (default: None)
1447 (default: None)
1448
1448
1449 ``regkeyalt``
1449 ``regkeyalt``
1450 An alternate Windows registry key to try if the first key is not
1450 An alternate Windows registry key to try if the first key is not
1451 found. The alternate key uses the same ``regname`` and ``regappend``
1451 found. The alternate key uses the same ``regname`` and ``regappend``
1452 semantics of the primary key. The most common use for this key
1452 semantics of the primary key. The most common use for this key
1453 is to search for 32bit applications on 64bit operating systems.
1453 is to search for 32bit applications on 64bit operating systems.
1454 (default: None)
1454 (default: None)
1455
1455
1456 ``regname``
1456 ``regname``
1457 Name of value to read from specified registry key.
1457 Name of value to read from specified registry key.
1458 (default: the unnamed (default) value)
1458 (default: the unnamed (default) value)
1459
1459
1460 ``regappend``
1460 ``regappend``
1461 String to append to the value read from the registry, typically
1461 String to append to the value read from the registry, typically
1462 the executable name of the tool.
1462 the executable name of the tool.
1463 (default: None)
1463 (default: None)
1464
1464
1465 ``pager``
1465 ``pager``
1466 ---------
1466 ---------
1467
1467
1468 Setting used to control when to paginate and with what external tool. See
1468 Setting used to control when to paginate and with what external tool. See
1469 :hg:`help pager` for details.
1469 :hg:`help pager` for details.
1470
1470
1471 ``pager``
1471 ``pager``
1472 Define the external tool used as pager.
1472 Define the external tool used as pager.
1473
1473
1474 If no pager is set, Mercurial uses the environment variable $PAGER.
1474 If no pager is set, Mercurial uses the environment variable $PAGER.
1475 If neither pager.pager, nor $PAGER is set, a default pager will be
1475 If neither pager.pager, nor $PAGER is set, a default pager will be
1476 used, typically `less` on Unix and `more` on Windows. Example::
1476 used, typically `less` on Unix and `more` on Windows. Example::
1477
1477
1478 [pager]
1478 [pager]
1479 pager = less -FRX
1479 pager = less -FRX
1480
1480
1481 ``ignore``
1481 ``ignore``
1482 List of commands to disable the pager for. Example::
1482 List of commands to disable the pager for. Example::
1483
1483
1484 [pager]
1484 [pager]
1485 ignore = version, help, update
1485 ignore = version, help, update
1486
1486
1487 ``patch``
1487 ``patch``
1488 ---------
1488 ---------
1489
1489
1490 Settings used when applying patches, for instance through the 'import'
1490 Settings used when applying patches, for instance through the 'import'
1491 command or with Mercurial Queues extension.
1491 command or with Mercurial Queues extension.
1492
1492
1493 ``eol``
1493 ``eol``
1494 When set to 'strict' patch content and patched files end of lines
1494 When set to 'strict' patch content and patched files end of lines
1495 are preserved. When set to ``lf`` or ``crlf``, both files end of
1495 are preserved. When set to ``lf`` or ``crlf``, both files end of
1496 lines are ignored when patching and the result line endings are
1496 lines are ignored when patching and the result line endings are
1497 normalized to either LF (Unix) or CRLF (Windows). When set to
1497 normalized to either LF (Unix) or CRLF (Windows). When set to
1498 ``auto``, end of lines are again ignored while patching but line
1498 ``auto``, end of lines are again ignored while patching but line
1499 endings in patched files are normalized to their original setting
1499 endings in patched files are normalized to their original setting
1500 on a per-file basis. If target file does not exist or has no end
1500 on a per-file basis. If target file does not exist or has no end
1501 of line, patch line endings are preserved.
1501 of line, patch line endings are preserved.
1502 (default: strict)
1502 (default: strict)
1503
1503
1504 ``fuzz``
1504 ``fuzz``
1505 The number of lines of 'fuzz' to allow when applying patches. This
1505 The number of lines of 'fuzz' to allow when applying patches. This
1506 controls how much context the patcher is allowed to ignore when
1506 controls how much context the patcher is allowed to ignore when
1507 trying to apply a patch.
1507 trying to apply a patch.
1508 (default: 2)
1508 (default: 2)
1509
1509
1510 ``paths``
1510 ``paths``
1511 ---------
1511 ---------
1512
1512
1513 Assigns symbolic names and behavior to repositories.
1513 Assigns symbolic names and behavior to repositories.
1514
1514
1515 Options are symbolic names defining the URL or directory that is the
1515 Options are symbolic names defining the URL or directory that is the
1516 location of the repository. Example::
1516 location of the repository. Example::
1517
1517
1518 [paths]
1518 [paths]
1519 my_server = https://example.com/my_repo
1519 my_server = https://example.com/my_repo
1520 local_path = /home/me/repo
1520 local_path = /home/me/repo
1521
1521
1522 These symbolic names can be used from the command line. To pull
1522 These symbolic names can be used from the command line. To pull
1523 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1523 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1524 :hg:`push local_path`.
1524 :hg:`push local_path`.
1525
1525
1526 Options containing colons (``:``) denote sub-options that can influence
1526 Options containing colons (``:``) denote sub-options that can influence
1527 behavior for that specific path. Example::
1527 behavior for that specific path. Example::
1528
1528
1529 [paths]
1529 [paths]
1530 my_server = https://example.com/my_path
1530 my_server = https://example.com/my_path
1531 my_server:pushurl = ssh://example.com/my_path
1531 my_server:pushurl = ssh://example.com/my_path
1532
1532
1533 The following sub-options can be defined:
1533 The following sub-options can be defined:
1534
1534
1535 ``pushurl``
1535 ``pushurl``
1536 The URL to use for push operations. If not defined, the location
1536 The URL to use for push operations. If not defined, the location
1537 defined by the path's main entry is used.
1537 defined by the path's main entry is used.
1538
1538
1539 ``pushrev``
1539 ``pushrev``
1540 A revset defining which revisions to push by default.
1540 A revset defining which revisions to push by default.
1541
1541
1542 When :hg:`push` is executed without a ``-r`` argument, the revset
1542 When :hg:`push` is executed without a ``-r`` argument, the revset
1543 defined by this sub-option is evaluated to determine what to push.
1543 defined by this sub-option is evaluated to determine what to push.
1544
1544
1545 For example, a value of ``.`` will push the working directory's
1545 For example, a value of ``.`` will push the working directory's
1546 revision by default.
1546 revision by default.
1547
1547
1548 Revsets specifying bookmarks will not result in the bookmark being
1548 Revsets specifying bookmarks will not result in the bookmark being
1549 pushed.
1549 pushed.
1550
1550
1551 The following special named paths exist:
1551 The following special named paths exist:
1552
1552
1553 ``default``
1553 ``default``
1554 The URL or directory to use when no source or remote is specified.
1554 The URL or directory to use when no source or remote is specified.
1555
1555
1556 :hg:`clone` will automatically define this path to the location the
1556 :hg:`clone` will automatically define this path to the location the
1557 repository was cloned from.
1557 repository was cloned from.
1558
1558
1559 ``default-push``
1559 ``default-push``
1560 (deprecated) The URL or directory for the default :hg:`push` location.
1560 (deprecated) The URL or directory for the default :hg:`push` location.
1561 ``default:pushurl`` should be used instead.
1561 ``default:pushurl`` should be used instead.
1562
1562
1563 ``phases``
1563 ``phases``
1564 ----------
1564 ----------
1565
1565
1566 Specifies default handling of phases. See :hg:`help phases` for more
1566 Specifies default handling of phases. See :hg:`help phases` for more
1567 information about working with phases.
1567 information about working with phases.
1568
1568
1569 ``publish``
1569 ``publish``
1570 Controls draft phase behavior when working as a server. When true,
1570 Controls draft phase behavior when working as a server. When true,
1571 pushed changesets are set to public in both client and server and
1571 pushed changesets are set to public in both client and server and
1572 pulled or cloned changesets are set to public in the client.
1572 pulled or cloned changesets are set to public in the client.
1573 (default: True)
1573 (default: True)
1574
1574
1575 ``new-commit``
1575 ``new-commit``
1576 Phase of newly-created commits.
1576 Phase of newly-created commits.
1577 (default: draft)
1577 (default: draft)
1578
1578
1579 ``checksubrepos``
1579 ``checksubrepos``
1580 Check the phase of the current revision of each subrepository. Allowed
1580 Check the phase of the current revision of each subrepository. Allowed
1581 values are "ignore", "follow" and "abort". For settings other than
1581 values are "ignore", "follow" and "abort". For settings other than
1582 "ignore", the phase of the current revision of each subrepository is
1582 "ignore", the phase of the current revision of each subrepository is
1583 checked before committing the parent repository. If any of those phases is
1583 checked before committing the parent repository. If any of those phases is
1584 greater than the phase of the parent repository (e.g. if a subrepo is in a
1584 greater than the phase of the parent repository (e.g. if a subrepo is in a
1585 "secret" phase while the parent repo is in "draft" phase), the commit is
1585 "secret" phase while the parent repo is in "draft" phase), the commit is
1586 either aborted (if checksubrepos is set to "abort") or the higher phase is
1586 either aborted (if checksubrepos is set to "abort") or the higher phase is
1587 used for the parent repository commit (if set to "follow").
1587 used for the parent repository commit (if set to "follow").
1588 (default: follow)
1588 (default: follow)
1589
1589
1590
1590
1591 ``profiling``
1591 ``profiling``
1592 -------------
1592 -------------
1593
1593
1594 Specifies profiling type, format, and file output. Two profilers are
1594 Specifies profiling type, format, and file output. Two profilers are
1595 supported: an instrumenting profiler (named ``ls``), and a sampling
1595 supported: an instrumenting profiler (named ``ls``), and a sampling
1596 profiler (named ``stat``).
1596 profiler (named ``stat``).
1597
1597
1598 In this section description, 'profiling data' stands for the raw data
1598 In this section description, 'profiling data' stands for the raw data
1599 collected during profiling, while 'profiling report' stands for a
1599 collected during profiling, while 'profiling report' stands for a
1600 statistical text report generated from the profiling data.
1600 statistical text report generated from the profiling data.
1601
1601
1602 ``enabled``
1602 ``enabled``
1603 Enable the profiler.
1603 Enable the profiler.
1604 (default: false)
1604 (default: false)
1605
1605
1606 This is equivalent to passing ``--profile`` on the command line.
1606 This is equivalent to passing ``--profile`` on the command line.
1607
1607
1608 ``type``
1608 ``type``
1609 The type of profiler to use.
1609 The type of profiler to use.
1610 (default: stat)
1610 (default: stat)
1611
1611
1612 ``ls``
1612 ``ls``
1613 Use Python's built-in instrumenting profiler. This profiler
1613 Use Python's built-in instrumenting profiler. This profiler
1614 works on all platforms, but each line number it reports is the
1614 works on all platforms, but each line number it reports is the
1615 first line of a function. This restriction makes it difficult to
1615 first line of a function. This restriction makes it difficult to
1616 identify the expensive parts of a non-trivial function.
1616 identify the expensive parts of a non-trivial function.
1617 ``stat``
1617 ``stat``
1618 Use a statistical profiler, statprof. This profiler is most
1618 Use a statistical profiler, statprof. This profiler is most
1619 useful for profiling commands that run for longer than about 0.1
1619 useful for profiling commands that run for longer than about 0.1
1620 seconds.
1620 seconds.
1621
1621
1622 ``format``
1622 ``format``
1623 Profiling format. Specific to the ``ls`` instrumenting profiler.
1623 Profiling format. Specific to the ``ls`` instrumenting profiler.
1624 (default: text)
1624 (default: text)
1625
1625
1626 ``text``
1626 ``text``
1627 Generate a profiling report. When saving to a file, it should be
1627 Generate a profiling report. When saving to a file, it should be
1628 noted that only the report is saved, and the profiling data is
1628 noted that only the report is saved, and the profiling data is
1629 not kept.
1629 not kept.
1630 ``kcachegrind``
1630 ``kcachegrind``
1631 Format profiling data for kcachegrind use: when saving to a
1631 Format profiling data for kcachegrind use: when saving to a
1632 file, the generated file can directly be loaded into
1632 file, the generated file can directly be loaded into
1633 kcachegrind.
1633 kcachegrind.
1634
1634
1635 ``statformat``
1635 ``statformat``
1636 Profiling format for the ``stat`` profiler.
1636 Profiling format for the ``stat`` profiler.
1637 (default: hotpath)
1637 (default: hotpath)
1638
1638
1639 ``hotpath``
1639 ``hotpath``
1640 Show a tree-based display containing the hot path of execution (where
1640 Show a tree-based display containing the hot path of execution (where
1641 most time was spent).
1641 most time was spent).
1642 ``bymethod``
1642 ``bymethod``
1643 Show a table of methods ordered by how frequently they are active.
1643 Show a table of methods ordered by how frequently they are active.
1644 ``byline``
1644 ``byline``
1645 Show a table of lines in files ordered by how frequently they are active.
1645 Show a table of lines in files ordered by how frequently they are active.
1646 ``json``
1646 ``json``
1647 Render profiling data as JSON.
1647 Render profiling data as JSON.
1648
1648
1649 ``frequency``
1649 ``frequency``
1650 Sampling frequency. Specific to the ``stat`` sampling profiler.
1650 Sampling frequency. Specific to the ``stat`` sampling profiler.
1651 (default: 1000)
1651 (default: 1000)
1652
1652
1653 ``output``
1653 ``output``
1654 File path where profiling data or report should be saved. If the
1654 File path where profiling data or report should be saved. If the
1655 file exists, it is replaced. (default: None, data is printed on
1655 file exists, it is replaced. (default: None, data is printed on
1656 stderr)
1656 stderr)
1657
1657
1658 ``sort``
1658 ``sort``
1659 Sort field. Specific to the ``ls`` instrumenting profiler.
1659 Sort field. Specific to the ``ls`` instrumenting profiler.
1660 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1660 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1661 ``inlinetime``.
1661 ``inlinetime``.
1662 (default: inlinetime)
1662 (default: inlinetime)
1663
1663
1664 ``time-track``
1664 ``time-track``
1665 Control if the stat profiler track ``cpu`` or ``real`` time.
1665 Control if the stat profiler track ``cpu`` or ``real`` time.
1666 (default: ``cpu``)
1666 (default: ``cpu``)
1667
1667
1668 ``limit``
1668 ``limit``
1669 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1669 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1670 (default: 30)
1670 (default: 30)
1671
1671
1672 ``nested``
1672 ``nested``
1673 Show at most this number of lines of drill-down info after each main entry.
1673 Show at most this number of lines of drill-down info after each main entry.
1674 This can help explain the difference between Total and Inline.
1674 This can help explain the difference between Total and Inline.
1675 Specific to the ``ls`` instrumenting profiler.
1675 Specific to the ``ls`` instrumenting profiler.
1676 (default: 0)
1676 (default: 0)
1677
1677
1678 ``showmin``
1678 ``showmin``
1679 Minimum fraction of samples an entry must have for it to be displayed.
1679 Minimum fraction of samples an entry must have for it to be displayed.
1680 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1680 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1681 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1681 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1682
1682
1683 Only used by the ``stat`` profiler.
1683 Only used by the ``stat`` profiler.
1684
1684
1685 For the ``hotpath`` format, default is ``0.05``.
1685 For the ``hotpath`` format, default is ``0.05``.
1686 For the ``chrome`` format, default is ``0.005``.
1686 For the ``chrome`` format, default is ``0.005``.
1687
1687
1688 The option is unused on other formats.
1688 The option is unused on other formats.
1689
1689
1690 ``showmax``
1690 ``showmax``
1691 Maximum fraction of samples an entry can have before it is ignored in
1691 Maximum fraction of samples an entry can have before it is ignored in
1692 display. Values format is the same as ``showmin``.
1692 display. Values format is the same as ``showmin``.
1693
1693
1694 Only used by the ``stat`` profiler.
1694 Only used by the ``stat`` profiler.
1695
1695
1696 For the ``chrome`` format, default is ``0.999``.
1696 For the ``chrome`` format, default is ``0.999``.
1697
1697
1698 The option is unused on other formats.
1698 The option is unused on other formats.
1699
1699
1700 ``progress``
1700 ``progress``
1701 ------------
1701 ------------
1702
1702
1703 Mercurial commands can draw progress bars that are as informative as
1703 Mercurial commands can draw progress bars that are as informative as
1704 possible. Some progress bars only offer indeterminate information, while others
1704 possible. Some progress bars only offer indeterminate information, while others
1705 have a definite end point.
1705 have a definite end point.
1706
1706
1707 ``delay``
1707 ``delay``
1708 Number of seconds (float) before showing the progress bar. (default: 3)
1708 Number of seconds (float) before showing the progress bar. (default: 3)
1709
1709
1710 ``changedelay``
1710 ``changedelay``
1711 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1711 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1712 that value will be used instead. (default: 1)
1712 that value will be used instead. (default: 1)
1713
1713
1714 ``estimateinterval``
1714 ``estimateinterval``
1715 Maximum sampling interval in seconds for speed and estimated time
1715 Maximum sampling interval in seconds for speed and estimated time
1716 calculation. (default: 60)
1716 calculation. (default: 60)
1717
1717
1718 ``refresh``
1718 ``refresh``
1719 Time in seconds between refreshes of the progress bar. (default: 0.1)
1719 Time in seconds between refreshes of the progress bar. (default: 0.1)
1720
1720
1721 ``format``
1721 ``format``
1722 Format of the progress bar.
1722 Format of the progress bar.
1723
1723
1724 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1724 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1725 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1725 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1726 last 20 characters of the item, but this can be changed by adding either
1726 last 20 characters of the item, but this can be changed by adding either
1727 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1727 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1728 first num characters.
1728 first num characters.
1729
1729
1730 (default: topic bar number estimate)
1730 (default: topic bar number estimate)
1731
1731
1732 ``width``
1732 ``width``
1733 If set, the maximum width of the progress information (that is, min(width,
1733 If set, the maximum width of the progress information (that is, min(width,
1734 term width) will be used).
1734 term width) will be used).
1735
1735
1736 ``clear-complete``
1736 ``clear-complete``
1737 Clear the progress bar after it's done. (default: True)
1737 Clear the progress bar after it's done. (default: True)
1738
1738
1739 ``disable``
1739 ``disable``
1740 If true, don't show a progress bar.
1740 If true, don't show a progress bar.
1741
1741
1742 ``assume-tty``
1742 ``assume-tty``
1743 If true, ALWAYS show a progress bar, unless disable is given.
1743 If true, ALWAYS show a progress bar, unless disable is given.
1744
1744
1745 ``rebase``
1745 ``rebase``
1746 ----------
1746 ----------
1747
1747
1748 ``evolution.allowdivergence``
1748 ``evolution.allowdivergence``
1749 Default to False, when True allow creating divergence when performing
1749 Default to False, when True allow creating divergence when performing
1750 rebase of obsolete changesets.
1750 rebase of obsolete changesets.
1751
1751
1752 ``revsetalias``
1752 ``revsetalias``
1753 ---------------
1753 ---------------
1754
1754
1755 Alias definitions for revsets. See :hg:`help revsets` for details.
1755 Alias definitions for revsets. See :hg:`help revsets` for details.
1756
1756
1757 ``server``
1757 ``server``
1758 ----------
1758 ----------
1759
1759
1760 Controls generic server settings.
1760 Controls generic server settings.
1761
1761
1762 ``bookmarks-pushkey-compat``
1762 ``bookmarks-pushkey-compat``
1763 Trigger pushkey hook when being pushed bookmark updates. This config exist
1763 Trigger pushkey hook when being pushed bookmark updates. This config exist
1764 for compatibility purpose (default to True)
1764 for compatibility purpose (default to True)
1765
1765
1766 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
1766 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
1767 movement we recommend you migrate them to ``txnclose-bookmark`` and
1767 movement we recommend you migrate them to ``txnclose-bookmark`` and
1768 ``pretxnclose-bookmark``.
1768 ``pretxnclose-bookmark``.
1769
1769
1770 ``compressionengines``
1770 ``compressionengines``
1771 List of compression engines and their relative priority to advertise
1771 List of compression engines and their relative priority to advertise
1772 to clients.
1772 to clients.
1773
1773
1774 The order of compression engines determines their priority, the first
1774 The order of compression engines determines their priority, the first
1775 having the highest priority. If a compression engine is not listed
1775 having the highest priority. If a compression engine is not listed
1776 here, it won't be advertised to clients.
1776 here, it won't be advertised to clients.
1777
1777
1778 If not set (the default), built-in defaults are used. Run
1778 If not set (the default), built-in defaults are used. Run
1779 :hg:`debuginstall` to list available compression engines and their
1779 :hg:`debuginstall` to list available compression engines and their
1780 default wire protocol priority.
1780 default wire protocol priority.
1781
1781
1782 Older Mercurial clients only support zlib compression and this setting
1782 Older Mercurial clients only support zlib compression and this setting
1783 has no effect for legacy clients.
1783 has no effect for legacy clients.
1784
1784
1785 ``uncompressed``
1785 ``uncompressed``
1786 Whether to allow clients to clone a repository using the
1786 Whether to allow clients to clone a repository using the
1787 uncompressed streaming protocol. This transfers about 40% more
1787 uncompressed streaming protocol. This transfers about 40% more
1788 data than a regular clone, but uses less memory and CPU on both
1788 data than a regular clone, but uses less memory and CPU on both
1789 server and client. Over a LAN (100 Mbps or better) or a very fast
1789 server and client. Over a LAN (100 Mbps or better) or a very fast
1790 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1790 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1791 regular clone. Over most WAN connections (anything slower than
1791 regular clone. Over most WAN connections (anything slower than
1792 about 6 Mbps), uncompressed streaming is slower, because of the
1792 about 6 Mbps), uncompressed streaming is slower, because of the
1793 extra data transfer overhead. This mode will also temporarily hold
1793 extra data transfer overhead. This mode will also temporarily hold
1794 the write lock while determining what data to transfer.
1794 the write lock while determining what data to transfer.
1795 (default: True)
1795 (default: True)
1796
1796
1797 ``uncompressedallowsecret``
1797 ``uncompressedallowsecret``
1798 Whether to allow stream clones when the repository contains secret
1798 Whether to allow stream clones when the repository contains secret
1799 changesets. (default: False)
1799 changesets. (default: False)
1800
1800
1801 ``preferuncompressed``
1801 ``preferuncompressed``
1802 When set, clients will try to use the uncompressed streaming
1802 When set, clients will try to use the uncompressed streaming
1803 protocol. (default: False)
1803 protocol. (default: False)
1804
1804
1805 ``disablefullbundle``
1805 ``disablefullbundle``
1806 When set, servers will refuse attempts to do pull-based clones.
1806 When set, servers will refuse attempts to do pull-based clones.
1807 If this option is set, ``preferuncompressed`` and/or clone bundles
1807 If this option is set, ``preferuncompressed`` and/or clone bundles
1808 are highly recommended. Partial clones will still be allowed.
1808 are highly recommended. Partial clones will still be allowed.
1809 (default: False)
1809 (default: False)
1810
1810
1811 ``streamunbundle``
1811 ``streamunbundle``
1812 When set, servers will apply data sent from the client directly,
1812 When set, servers will apply data sent from the client directly,
1813 otherwise it will be written to a temporary file first. This option
1813 otherwise it will be written to a temporary file first. This option
1814 effectively prevents concurrent pushes.
1814 effectively prevents concurrent pushes.
1815
1815
1816 ``pullbundle``
1816 ``pullbundle``
1817 When set, the server will check pullbundle.manifest for bundles
1817 When set, the server will check pullbundle.manifest for bundles
1818 covering the requested heads and common nodes. The first matching
1818 covering the requested heads and common nodes. The first matching
1819 entry will be streamed to the client.
1819 entry will be streamed to the client.
1820
1820
1821 For HTTP transport, the stream will still use zlib compression
1821 For HTTP transport, the stream will still use zlib compression
1822 for older clients.
1822 for older clients.
1823
1823
1824 ``concurrent-push-mode``
1824 ``concurrent-push-mode``
1825 Level of allowed race condition between two pushing clients.
1825 Level of allowed race condition between two pushing clients.
1826
1826
1827 - 'strict': push is abort if another client touched the repository
1827 - 'strict': push is abort if another client touched the repository
1828 while the push was preparing. (default)
1828 while the push was preparing. (default)
1829 - 'check-related': push is only aborted if it affects head that got also
1829 - 'check-related': push is only aborted if it affects head that got also
1830 affected while the push was preparing.
1830 affected while the push was preparing.
1831
1831
1832 This requires compatible client (version 4.3 and later). Old client will
1832 This requires compatible client (version 4.3 and later). Old client will
1833 use 'strict'.
1833 use 'strict'.
1834
1834
1835 ``validate``
1835 ``validate``
1836 Whether to validate the completeness of pushed changesets by
1836 Whether to validate the completeness of pushed changesets by
1837 checking that all new file revisions specified in manifests are
1837 checking that all new file revisions specified in manifests are
1838 present. (default: False)
1838 present. (default: False)
1839
1839
1840 ``maxhttpheaderlen``
1840 ``maxhttpheaderlen``
1841 Instruct HTTP clients not to send request headers longer than this
1841 Instruct HTTP clients not to send request headers longer than this
1842 many bytes. (default: 1024)
1842 many bytes. (default: 1024)
1843
1843
1844 ``bundle1``
1844 ``bundle1``
1845 Whether to allow clients to push and pull using the legacy bundle1
1845 Whether to allow clients to push and pull using the legacy bundle1
1846 exchange format. (default: True)
1846 exchange format. (default: True)
1847
1847
1848 ``bundle1gd``
1848 ``bundle1gd``
1849 Like ``bundle1`` but only used if the repository is using the
1849 Like ``bundle1`` but only used if the repository is using the
1850 *generaldelta* storage format. (default: True)
1850 *generaldelta* storage format. (default: True)
1851
1851
1852 ``bundle1.push``
1852 ``bundle1.push``
1853 Whether to allow clients to push using the legacy bundle1 exchange
1853 Whether to allow clients to push using the legacy bundle1 exchange
1854 format. (default: True)
1854 format. (default: True)
1855
1855
1856 ``bundle1gd.push``
1856 ``bundle1gd.push``
1857 Like ``bundle1.push`` but only used if the repository is using the
1857 Like ``bundle1.push`` but only used if the repository is using the
1858 *generaldelta* storage format. (default: True)
1858 *generaldelta* storage format. (default: True)
1859
1859
1860 ``bundle1.pull``
1860 ``bundle1.pull``
1861 Whether to allow clients to pull using the legacy bundle1 exchange
1861 Whether to allow clients to pull using the legacy bundle1 exchange
1862 format. (default: True)
1862 format. (default: True)
1863
1863
1864 ``bundle1gd.pull``
1864 ``bundle1gd.pull``
1865 Like ``bundle1.pull`` but only used if the repository is using the
1865 Like ``bundle1.pull`` but only used if the repository is using the
1866 *generaldelta* storage format. (default: True)
1866 *generaldelta* storage format. (default: True)
1867
1867
1868 Large repositories using the *generaldelta* storage format should
1868 Large repositories using the *generaldelta* storage format should
1869 consider setting this option because converting *generaldelta*
1869 consider setting this option because converting *generaldelta*
1870 repositories to the exchange format required by the bundle1 data
1870 repositories to the exchange format required by the bundle1 data
1871 format can consume a lot of CPU.
1871 format can consume a lot of CPU.
1872
1872
1873 ``zliblevel``
1873 ``zliblevel``
1874 Integer between ``-1`` and ``9`` that controls the zlib compression level
1874 Integer between ``-1`` and ``9`` that controls the zlib compression level
1875 for wire protocol commands that send zlib compressed output (notably the
1875 for wire protocol commands that send zlib compressed output (notably the
1876 commands that send repository history data).
1876 commands that send repository history data).
1877
1877
1878 The default (``-1``) uses the default zlib compression level, which is
1878 The default (``-1``) uses the default zlib compression level, which is
1879 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1879 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1880 maximum compression.
1880 maximum compression.
1881
1881
1882 Setting this option allows server operators to make trade-offs between
1882 Setting this option allows server operators to make trade-offs between
1883 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1883 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1884 but sends more bytes to clients.
1884 but sends more bytes to clients.
1885
1885
1886 This option only impacts the HTTP server.
1886 This option only impacts the HTTP server.
1887
1887
1888 ``zstdlevel``
1888 ``zstdlevel``
1889 Integer between ``1`` and ``22`` that controls the zstd compression level
1889 Integer between ``1`` and ``22`` that controls the zstd compression level
1890 for wire protocol commands. ``1`` is the minimal amount of compression and
1890 for wire protocol commands. ``1`` is the minimal amount of compression and
1891 ``22`` is the highest amount of compression.
1891 ``22`` is the highest amount of compression.
1892
1892
1893 The default (``3``) should be significantly faster than zlib while likely
1893 The default (``3``) should be significantly faster than zlib while likely
1894 delivering better compression ratios.
1894 delivering better compression ratios.
1895
1895
1896 This option only impacts the HTTP server.
1896 This option only impacts the HTTP server.
1897
1897
1898 See also ``server.zliblevel``.
1898 See also ``server.zliblevel``.
1899
1899
1900 ``smtp``
1900 ``smtp``
1901 --------
1901 --------
1902
1902
1903 Configuration for extensions that need to send email messages.
1903 Configuration for extensions that need to send email messages.
1904
1904
1905 ``host``
1905 ``host``
1906 Host name of mail server, e.g. "mail.example.com".
1906 Host name of mail server, e.g. "mail.example.com".
1907
1907
1908 ``port``
1908 ``port``
1909 Optional. Port to connect to on mail server. (default: 465 if
1909 Optional. Port to connect to on mail server. (default: 465 if
1910 ``tls`` is smtps; 25 otherwise)
1910 ``tls`` is smtps; 25 otherwise)
1911
1911
1912 ``tls``
1912 ``tls``
1913 Optional. Method to enable TLS when connecting to mail server: starttls,
1913 Optional. Method to enable TLS when connecting to mail server: starttls,
1914 smtps or none. (default: none)
1914 smtps or none. (default: none)
1915
1915
1916 ``username``
1916 ``username``
1917 Optional. User name for authenticating with the SMTP server.
1917 Optional. User name for authenticating with the SMTP server.
1918 (default: None)
1918 (default: None)
1919
1919
1920 ``password``
1920 ``password``
1921 Optional. Password for authenticating with the SMTP server. If not
1921 Optional. Password for authenticating with the SMTP server. If not
1922 specified, interactive sessions will prompt the user for a
1922 specified, interactive sessions will prompt the user for a
1923 password; non-interactive sessions will fail. (default: None)
1923 password; non-interactive sessions will fail. (default: None)
1924
1924
1925 ``local_hostname``
1925 ``local_hostname``
1926 Optional. The hostname that the sender can use to identify
1926 Optional. The hostname that the sender can use to identify
1927 itself to the MTA.
1927 itself to the MTA.
1928
1928
1929
1929
1930 ``subpaths``
1930 ``subpaths``
1931 ------------
1931 ------------
1932
1932
1933 Subrepository source URLs can go stale if a remote server changes name
1933 Subrepository source URLs can go stale if a remote server changes name
1934 or becomes temporarily unavailable. This section lets you define
1934 or becomes temporarily unavailable. This section lets you define
1935 rewrite rules of the form::
1935 rewrite rules of the form::
1936
1936
1937 <pattern> = <replacement>
1937 <pattern> = <replacement>
1938
1938
1939 where ``pattern`` is a regular expression matching a subrepository
1939 where ``pattern`` is a regular expression matching a subrepository
1940 source URL and ``replacement`` is the replacement string used to
1940 source URL and ``replacement`` is the replacement string used to
1941 rewrite it. Groups can be matched in ``pattern`` and referenced in
1941 rewrite it. Groups can be matched in ``pattern`` and referenced in
1942 ``replacements``. For instance::
1942 ``replacements``. For instance::
1943
1943
1944 http://server/(.*)-hg/ = http://hg.server/\1/
1944 http://server/(.*)-hg/ = http://hg.server/\1/
1945
1945
1946 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1946 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1947
1947
1948 Relative subrepository paths are first made absolute, and the
1948 Relative subrepository paths are first made absolute, and the
1949 rewrite rules are then applied on the full (absolute) path. If ``pattern``
1949 rewrite rules are then applied on the full (absolute) path. If ``pattern``
1950 doesn't match the full path, an attempt is made to apply it on the
1950 doesn't match the full path, an attempt is made to apply it on the
1951 relative path alone. The rules are applied in definition order.
1951 relative path alone. The rules are applied in definition order.
1952
1952
1953 ``subrepos``
1953 ``subrepos``
1954 ------------
1954 ------------
1955
1955
1956 This section contains options that control the behavior of the
1956 This section contains options that control the behavior of the
1957 subrepositories feature. See also :hg:`help subrepos`.
1957 subrepositories feature. See also :hg:`help subrepos`.
1958
1958
1959 Security note: auditing in Mercurial is known to be insufficient to
1959 Security note: auditing in Mercurial is known to be insufficient to
1960 prevent clone-time code execution with carefully constructed Git
1960 prevent clone-time code execution with carefully constructed Git
1961 subrepos. It is unknown if a similar detect is present in Subversion
1961 subrepos. It is unknown if a similar detect is present in Subversion
1962 subrepos. Both Git and Subversion subrepos are disabled by default
1962 subrepos. Both Git and Subversion subrepos are disabled by default
1963 out of security concerns. These subrepo types can be enabled using
1963 out of security concerns. These subrepo types can be enabled using
1964 the respective options below.
1964 the respective options below.
1965
1965
1966 ``allowed``
1966 ``allowed``
1967 Whether subrepositories are allowed in the working directory.
1967 Whether subrepositories are allowed in the working directory.
1968
1968
1969 When false, commands involving subrepositories (like :hg:`update`)
1969 When false, commands involving subrepositories (like :hg:`update`)
1970 will fail for all subrepository types.
1970 will fail for all subrepository types.
1971 (default: true)
1971 (default: true)
1972
1972
1973 ``hg:allowed``
1973 ``hg:allowed``
1974 Whether Mercurial subrepositories are allowed in the working
1974 Whether Mercurial subrepositories are allowed in the working
1975 directory. This option only has an effect if ``subrepos.allowed``
1975 directory. This option only has an effect if ``subrepos.allowed``
1976 is true.
1976 is true.
1977 (default: true)
1977 (default: true)
1978
1978
1979 ``git:allowed``
1979 ``git:allowed``
1980 Whether Git subrepositories are allowed in the working directory.
1980 Whether Git subrepositories are allowed in the working directory.
1981 This option only has an effect if ``subrepos.allowed`` is true.
1981 This option only has an effect if ``subrepos.allowed`` is true.
1982
1982
1983 See the security note above before enabling Git subrepos.
1983 See the security note above before enabling Git subrepos.
1984 (default: false)
1984 (default: false)
1985
1985
1986 ``svn:allowed``
1986 ``svn:allowed``
1987 Whether Subversion subrepositories are allowed in the working
1987 Whether Subversion subrepositories are allowed in the working
1988 directory. This option only has an effect if ``subrepos.allowed``
1988 directory. This option only has an effect if ``subrepos.allowed``
1989 is true.
1989 is true.
1990
1990
1991 See the security note above before enabling Subversion subrepos.
1991 See the security note above before enabling Subversion subrepos.
1992 (default: false)
1992 (default: false)
1993
1993
1994 ``templatealias``
1994 ``templatealias``
1995 -----------------
1995 -----------------
1996
1996
1997 Alias definitions for templates. See :hg:`help templates` for details.
1997 Alias definitions for templates. See :hg:`help templates` for details.
1998
1998
1999 ``templates``
1999 ``templates``
2000 -------------
2000 -------------
2001
2001
2002 Use the ``[templates]`` section to define template strings.
2002 Use the ``[templates]`` section to define template strings.
2003 See :hg:`help templates` for details.
2003 See :hg:`help templates` for details.
2004
2004
2005 ``trusted``
2005 ``trusted``
2006 -----------
2006 -----------
2007
2007
2008 Mercurial will not use the settings in the
2008 Mercurial will not use the settings in the
2009 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2009 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2010 user or to a trusted group, as various hgrc features allow arbitrary
2010 user or to a trusted group, as various hgrc features allow arbitrary
2011 commands to be run. This issue is often encountered when configuring
2011 commands to be run. This issue is often encountered when configuring
2012 hooks or extensions for shared repositories or servers. However,
2012 hooks or extensions for shared repositories or servers. However,
2013 the web interface will use some safe settings from the ``[web]``
2013 the web interface will use some safe settings from the ``[web]``
2014 section.
2014 section.
2015
2015
2016 This section specifies what users and groups are trusted. The
2016 This section specifies what users and groups are trusted. The
2017 current user is always trusted. To trust everybody, list a user or a
2017 current user is always trusted. To trust everybody, list a user or a
2018 group with name ``*``. These settings must be placed in an
2018 group with name ``*``. These settings must be placed in an
2019 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2019 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2020 user or service running Mercurial.
2020 user or service running Mercurial.
2021
2021
2022 ``users``
2022 ``users``
2023 Comma-separated list of trusted users.
2023 Comma-separated list of trusted users.
2024
2024
2025 ``groups``
2025 ``groups``
2026 Comma-separated list of trusted groups.
2026 Comma-separated list of trusted groups.
2027
2027
2028
2028
2029 ``ui``
2029 ``ui``
2030 ------
2030 ------
2031
2031
2032 User interface controls.
2032 User interface controls.
2033
2033
2034 ``archivemeta``
2034 ``archivemeta``
2035 Whether to include the .hg_archival.txt file containing meta data
2035 Whether to include the .hg_archival.txt file containing meta data
2036 (hashes for the repository base and for tip) in archives created
2036 (hashes for the repository base and for tip) in archives created
2037 by the :hg:`archive` command or downloaded via hgweb.
2037 by the :hg:`archive` command or downloaded via hgweb.
2038 (default: True)
2038 (default: True)
2039
2039
2040 ``askusername``
2040 ``askusername``
2041 Whether to prompt for a username when committing. If True, and
2041 Whether to prompt for a username when committing. If True, and
2042 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2042 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2043 be prompted to enter a username. If no username is entered, the
2043 be prompted to enter a username. If no username is entered, the
2044 default ``USER@HOST`` is used instead.
2044 default ``USER@HOST`` is used instead.
2045 (default: False)
2045 (default: False)
2046
2046
2047 ``clonebundles``
2047 ``clonebundles``
2048 Whether the "clone bundles" feature is enabled.
2048 Whether the "clone bundles" feature is enabled.
2049
2049
2050 When enabled, :hg:`clone` may download and apply a server-advertised
2050 When enabled, :hg:`clone` may download and apply a server-advertised
2051 bundle file from a URL instead of using the normal exchange mechanism.
2051 bundle file from a URL instead of using the normal exchange mechanism.
2052
2052
2053 This can likely result in faster and more reliable clones.
2053 This can likely result in faster and more reliable clones.
2054
2054
2055 (default: True)
2055 (default: True)
2056
2056
2057 ``clonebundlefallback``
2057 ``clonebundlefallback``
2058 Whether failure to apply an advertised "clone bundle" from a server
2058 Whether failure to apply an advertised "clone bundle" from a server
2059 should result in fallback to a regular clone.
2059 should result in fallback to a regular clone.
2060
2060
2061 This is disabled by default because servers advertising "clone
2061 This is disabled by default because servers advertising "clone
2062 bundles" often do so to reduce server load. If advertised bundles
2062 bundles" often do so to reduce server load. If advertised bundles
2063 start mass failing and clients automatically fall back to a regular
2063 start mass failing and clients automatically fall back to a regular
2064 clone, this would add significant and unexpected load to the server
2064 clone, this would add significant and unexpected load to the server
2065 since the server is expecting clone operations to be offloaded to
2065 since the server is expecting clone operations to be offloaded to
2066 pre-generated bundles. Failing fast (the default behavior) ensures
2066 pre-generated bundles. Failing fast (the default behavior) ensures
2067 clients don't overwhelm the server when "clone bundle" application
2067 clients don't overwhelm the server when "clone bundle" application
2068 fails.
2068 fails.
2069
2069
2070 (default: False)
2070 (default: False)
2071
2071
2072 ``clonebundleprefers``
2072 ``clonebundleprefers``
2073 Defines preferences for which "clone bundles" to use.
2073 Defines preferences for which "clone bundles" to use.
2074
2074
2075 Servers advertising "clone bundles" may advertise multiple available
2075 Servers advertising "clone bundles" may advertise multiple available
2076 bundles. Each bundle may have different attributes, such as the bundle
2076 bundles. Each bundle may have different attributes, such as the bundle
2077 type and compression format. This option is used to prefer a particular
2077 type and compression format. This option is used to prefer a particular
2078 bundle over another.
2078 bundle over another.
2079
2079
2080 The following keys are defined by Mercurial:
2080 The following keys are defined by Mercurial:
2081
2081
2082 BUNDLESPEC
2082 BUNDLESPEC
2083 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2083 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2084 e.g. ``gzip-v2`` or ``bzip2-v1``.
2084 e.g. ``gzip-v2`` or ``bzip2-v1``.
2085
2085
2086 COMPRESSION
2086 COMPRESSION
2087 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2087 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2088
2088
2089 Server operators may define custom keys.
2089 Server operators may define custom keys.
2090
2090
2091 Example values: ``COMPRESSION=bzip2``,
2091 Example values: ``COMPRESSION=bzip2``,
2092 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2092 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2093
2093
2094 By default, the first bundle advertised by the server is used.
2094 By default, the first bundle advertised by the server is used.
2095
2095
2096 ``color``
2096 ``color``
2097 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2097 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2098 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2098 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2099 seems possible. See :hg:`help color` for details.
2099 seems possible. See :hg:`help color` for details.
2100
2100
2101 ``commitsubrepos``
2101 ``commitsubrepos``
2102 Whether to commit modified subrepositories when committing the
2102 Whether to commit modified subrepositories when committing the
2103 parent repository. If False and one subrepository has uncommitted
2103 parent repository. If False and one subrepository has uncommitted
2104 changes, abort the commit.
2104 changes, abort the commit.
2105 (default: False)
2105 (default: False)
2106
2106
2107 ``debug``
2107 ``debug``
2108 Print debugging information. (default: False)
2108 Print debugging information. (default: False)
2109
2109
2110 ``editor``
2110 ``editor``
2111 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2111 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2112
2112
2113 ``fallbackencoding``
2113 ``fallbackencoding``
2114 Encoding to try if it's not possible to decode the changelog using
2114 Encoding to try if it's not possible to decode the changelog using
2115 UTF-8. (default: ISO-8859-1)
2115 UTF-8. (default: ISO-8859-1)
2116
2116
2117 ``graphnodetemplate``
2117 ``graphnodetemplate``
2118 The template used to print changeset nodes in an ASCII revision graph.
2118 The template used to print changeset nodes in an ASCII revision graph.
2119 (default: ``{graphnode}``)
2119 (default: ``{graphnode}``)
2120
2120
2121 ``ignore``
2121 ``ignore``
2122 A file to read per-user ignore patterns from. This file should be
2122 A file to read per-user ignore patterns from. This file should be
2123 in the same format as a repository-wide .hgignore file. Filenames
2123 in the same format as a repository-wide .hgignore file. Filenames
2124 are relative to the repository root. This option supports hook syntax,
2124 are relative to the repository root. This option supports hook syntax,
2125 so if you want to specify multiple ignore files, you can do so by
2125 so if you want to specify multiple ignore files, you can do so by
2126 setting something like ``ignore.other = ~/.hgignore2``. For details
2126 setting something like ``ignore.other = ~/.hgignore2``. For details
2127 of the ignore file format, see the ``hgignore(5)`` man page.
2127 of the ignore file format, see the ``hgignore(5)`` man page.
2128
2128
2129 ``interactive``
2129 ``interactive``
2130 Allow to prompt the user. (default: True)
2130 Allow to prompt the user. (default: True)
2131
2131
2132 ``interface``
2132 ``interface``
2133 Select the default interface for interactive features (default: text).
2133 Select the default interface for interactive features (default: text).
2134 Possible values are 'text' and 'curses'.
2134 Possible values are 'text' and 'curses'.
2135
2135
2136 ``interface.chunkselector``
2136 ``interface.chunkselector``
2137 Select the interface for change recording (e.g. :hg:`commit -i`).
2137 Select the interface for change recording (e.g. :hg:`commit -i`).
2138 Possible values are 'text' and 'curses'.
2138 Possible values are 'text' and 'curses'.
2139 This config overrides the interface specified by ui.interface.
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 ``logtemplate``
2146 ``logtemplate``
2142 Template string for commands that print changesets.
2147 Template string for commands that print changesets.
2143
2148
2144 ``merge``
2149 ``merge``
2145 The conflict resolution program to use during a manual merge.
2150 The conflict resolution program to use during a manual merge.
2146 For more information on merge tools see :hg:`help merge-tools`.
2151 For more information on merge tools see :hg:`help merge-tools`.
2147 For configuring merge tools see the ``[merge-tools]`` section.
2152 For configuring merge tools see the ``[merge-tools]`` section.
2148
2153
2149 ``mergemarkers``
2154 ``mergemarkers``
2150 Sets the merge conflict marker label styling. The ``detailed``
2155 Sets the merge conflict marker label styling. The ``detailed``
2151 style uses the ``mergemarkertemplate`` setting to style the labels.
2156 style uses the ``mergemarkertemplate`` setting to style the labels.
2152 The ``basic`` style just uses 'local' and 'other' as the marker label.
2157 The ``basic`` style just uses 'local' and 'other' as the marker label.
2153 One of ``basic`` or ``detailed``.
2158 One of ``basic`` or ``detailed``.
2154 (default: ``basic``)
2159 (default: ``basic``)
2155
2160
2156 ``mergemarkertemplate``
2161 ``mergemarkertemplate``
2157 The template used to print the commit description next to each conflict
2162 The template used to print the commit description next to each conflict
2158 marker during merge conflicts. See :hg:`help templates` for the template
2163 marker during merge conflicts. See :hg:`help templates` for the template
2159 format.
2164 format.
2160
2165
2161 Defaults to showing the hash, tags, branches, bookmarks, author, and
2166 Defaults to showing the hash, tags, branches, bookmarks, author, and
2162 the first line of the commit description.
2167 the first line of the commit description.
2163
2168
2164 If you use non-ASCII characters in names for tags, branches, bookmarks,
2169 If you use non-ASCII characters in names for tags, branches, bookmarks,
2165 authors, and/or commit descriptions, you must pay attention to encodings of
2170 authors, and/or commit descriptions, you must pay attention to encodings of
2166 managed files. At template expansion, non-ASCII characters use the encoding
2171 managed files. At template expansion, non-ASCII characters use the encoding
2167 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2172 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2168 environment variables that govern your locale. If the encoding of the merge
2173 environment variables that govern your locale. If the encoding of the merge
2169 markers is different from the encoding of the merged files,
2174 markers is different from the encoding of the merged files,
2170 serious problems may occur.
2175 serious problems may occur.
2171
2176
2172 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2177 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2173
2178
2174 ``origbackuppath``
2179 ``origbackuppath``
2175 The path to a directory used to store generated .orig files. If the path is
2180 The path to a directory used to store generated .orig files. If the path is
2176 not a directory, one will be created. If set, files stored in this
2181 not a directory, one will be created. If set, files stored in this
2177 directory have the same name as the original file and do not have a .orig
2182 directory have the same name as the original file and do not have a .orig
2178 suffix.
2183 suffix.
2179
2184
2180 ``paginate``
2185 ``paginate``
2181 Control the pagination of command output (default: True). See :hg:`help pager`
2186 Control the pagination of command output (default: True). See :hg:`help pager`
2182 for details.
2187 for details.
2183
2188
2184 ``patch``
2189 ``patch``
2185 An optional external tool that ``hg import`` and some extensions
2190 An optional external tool that ``hg import`` and some extensions
2186 will use for applying patches. By default Mercurial uses an
2191 will use for applying patches. By default Mercurial uses an
2187 internal patch utility. The external tool must work as the common
2192 internal patch utility. The external tool must work as the common
2188 Unix ``patch`` program. In particular, it must accept a ``-p``
2193 Unix ``patch`` program. In particular, it must accept a ``-p``
2189 argument to strip patch headers, a ``-d`` argument to specify the
2194 argument to strip patch headers, a ``-d`` argument to specify the
2190 current directory, a file name to patch, and a patch file to take
2195 current directory, a file name to patch, and a patch file to take
2191 from stdin.
2196 from stdin.
2192
2197
2193 It is possible to specify a patch tool together with extra
2198 It is possible to specify a patch tool together with extra
2194 arguments. For example, setting this option to ``patch --merge``
2199 arguments. For example, setting this option to ``patch --merge``
2195 will use the ``patch`` program with its 2-way merge option.
2200 will use the ``patch`` program with its 2-way merge option.
2196
2201
2197 ``portablefilenames``
2202 ``portablefilenames``
2198 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2203 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2199 (default: ``warn``)
2204 (default: ``warn``)
2200
2205
2201 ``warn``
2206 ``warn``
2202 Print a warning message on POSIX platforms, if a file with a non-portable
2207 Print a warning message on POSIX platforms, if a file with a non-portable
2203 filename is added (e.g. a file with a name that can't be created on
2208 filename is added (e.g. a file with a name that can't be created on
2204 Windows because it contains reserved parts like ``AUX``, reserved
2209 Windows because it contains reserved parts like ``AUX``, reserved
2205 characters like ``:``, or would cause a case collision with an existing
2210 characters like ``:``, or would cause a case collision with an existing
2206 file).
2211 file).
2207
2212
2208 ``ignore``
2213 ``ignore``
2209 Don't print a warning.
2214 Don't print a warning.
2210
2215
2211 ``abort``
2216 ``abort``
2212 The command is aborted.
2217 The command is aborted.
2213
2218
2214 ``true``
2219 ``true``
2215 Alias for ``warn``.
2220 Alias for ``warn``.
2216
2221
2217 ``false``
2222 ``false``
2218 Alias for ``ignore``.
2223 Alias for ``ignore``.
2219
2224
2220 .. container:: windows
2225 .. container:: windows
2221
2226
2222 On Windows, this configuration option is ignored and the command aborted.
2227 On Windows, this configuration option is ignored and the command aborted.
2223
2228
2224 ``quiet``
2229 ``quiet``
2225 Reduce the amount of output printed.
2230 Reduce the amount of output printed.
2226 (default: False)
2231 (default: False)
2227
2232
2228 ``remotecmd``
2233 ``remotecmd``
2229 Remote command to use for clone/push/pull operations.
2234 Remote command to use for clone/push/pull operations.
2230 (default: ``hg``)
2235 (default: ``hg``)
2231
2236
2232 ``report_untrusted``
2237 ``report_untrusted``
2233 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2238 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2234 trusted user or group.
2239 trusted user or group.
2235 (default: True)
2240 (default: True)
2236
2241
2237 ``slash``
2242 ``slash``
2238 (Deprecated. Use ``slashpath`` template filter instead.)
2243 (Deprecated. Use ``slashpath`` template filter instead.)
2239
2244
2240 Display paths using a slash (``/``) as the path separator. This
2245 Display paths using a slash (``/``) as the path separator. This
2241 only makes a difference on systems where the default path
2246 only makes a difference on systems where the default path
2242 separator is not the slash character (e.g. Windows uses the
2247 separator is not the slash character (e.g. Windows uses the
2243 backslash character (``\``)).
2248 backslash character (``\``)).
2244 (default: False)
2249 (default: False)
2245
2250
2246 ``statuscopies``
2251 ``statuscopies``
2247 Display copies in the status command.
2252 Display copies in the status command.
2248
2253
2249 ``ssh``
2254 ``ssh``
2250 Command to use for SSH connections. (default: ``ssh``)
2255 Command to use for SSH connections. (default: ``ssh``)
2251
2256
2252 ``ssherrorhint``
2257 ``ssherrorhint``
2253 A hint shown to the user in the case of SSH error (e.g.
2258 A hint shown to the user in the case of SSH error (e.g.
2254 ``Please see http://company/internalwiki/ssh.html``)
2259 ``Please see http://company/internalwiki/ssh.html``)
2255
2260
2256 ``strict``
2261 ``strict``
2257 Require exact command names, instead of allowing unambiguous
2262 Require exact command names, instead of allowing unambiguous
2258 abbreviations. (default: False)
2263 abbreviations. (default: False)
2259
2264
2260 ``style``
2265 ``style``
2261 Name of style to use for command output.
2266 Name of style to use for command output.
2262
2267
2263 ``supportcontact``
2268 ``supportcontact``
2264 A URL where users should report a Mercurial traceback. Use this if you are a
2269 A URL where users should report a Mercurial traceback. Use this if you are a
2265 large organisation with its own Mercurial deployment process and crash
2270 large organisation with its own Mercurial deployment process and crash
2266 reports should be addressed to your internal support.
2271 reports should be addressed to your internal support.
2267
2272
2268 ``textwidth``
2273 ``textwidth``
2269 Maximum width of help text. A longer line generated by ``hg help`` or
2274 Maximum width of help text. A longer line generated by ``hg help`` or
2270 ``hg subcommand --help`` will be broken after white space to get this
2275 ``hg subcommand --help`` will be broken after white space to get this
2271 width or the terminal width, whichever comes first.
2276 width or the terminal width, whichever comes first.
2272 A non-positive value will disable this and the terminal width will be
2277 A non-positive value will disable this and the terminal width will be
2273 used. (default: 78)
2278 used. (default: 78)
2274
2279
2275 ``timeout``
2280 ``timeout``
2276 The timeout used when a lock is held (in seconds), a negative value
2281 The timeout used when a lock is held (in seconds), a negative value
2277 means no timeout. (default: 600)
2282 means no timeout. (default: 600)
2278
2283
2279 ``timeout.warn``
2284 ``timeout.warn``
2280 Time (in seconds) before a warning is printed about held lock. A negative
2285 Time (in seconds) before a warning is printed about held lock. A negative
2281 value means no warning. (default: 0)
2286 value means no warning. (default: 0)
2282
2287
2283 ``traceback``
2288 ``traceback``
2284 Mercurial always prints a traceback when an unknown exception
2289 Mercurial always prints a traceback when an unknown exception
2285 occurs. Setting this to True will make Mercurial print a traceback
2290 occurs. Setting this to True will make Mercurial print a traceback
2286 on all exceptions, even those recognized by Mercurial (such as
2291 on all exceptions, even those recognized by Mercurial (such as
2287 IOError or MemoryError). (default: False)
2292 IOError or MemoryError). (default: False)
2288
2293
2289 ``tweakdefaults``
2294 ``tweakdefaults``
2290
2295
2291 By default Mercurial's behavior changes very little from release
2296 By default Mercurial's behavior changes very little from release
2292 to release, but over time the recommended config settings
2297 to release, but over time the recommended config settings
2293 shift. Enable this config to opt in to get automatic tweaks to
2298 shift. Enable this config to opt in to get automatic tweaks to
2294 Mercurial's behavior over time. This config setting will have no
2299 Mercurial's behavior over time. This config setting will have no
2295 effet if ``HGPLAIN` is set or ``HGPLAINEXCEPT`` is set and does
2300 effet if ``HGPLAIN` is set or ``HGPLAINEXCEPT`` is set and does
2296 not include ``tweakdefaults``. (default: False)
2301 not include ``tweakdefaults``. (default: False)
2297
2302
2298 ``username``
2303 ``username``
2299 The committer of a changeset created when running "commit".
2304 The committer of a changeset created when running "commit".
2300 Typically a person's name and email address, e.g. ``Fred Widget
2305 Typically a person's name and email address, e.g. ``Fred Widget
2301 <fred@example.com>``. Environment variables in the
2306 <fred@example.com>``. Environment variables in the
2302 username are expanded.
2307 username are expanded.
2303
2308
2304 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2309 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2305 hgrc is empty, e.g. if the system admin set ``username =`` in the
2310 hgrc is empty, e.g. if the system admin set ``username =`` in the
2306 system hgrc, it has to be specified manually or in a different
2311 system hgrc, it has to be specified manually or in a different
2307 hgrc file)
2312 hgrc file)
2308
2313
2309 ``verbose``
2314 ``verbose``
2310 Increase the amount of output printed. (default: False)
2315 Increase the amount of output printed. (default: False)
2311
2316
2312
2317
2313 ``web``
2318 ``web``
2314 -------
2319 -------
2315
2320
2316 Web interface configuration. The settings in this section apply to
2321 Web interface configuration. The settings in this section apply to
2317 both the builtin webserver (started by :hg:`serve`) and the script you
2322 both the builtin webserver (started by :hg:`serve`) and the script you
2318 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2323 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2319 and WSGI).
2324 and WSGI).
2320
2325
2321 The Mercurial webserver does no authentication (it does not prompt for
2326 The Mercurial webserver does no authentication (it does not prompt for
2322 usernames and passwords to validate *who* users are), but it does do
2327 usernames and passwords to validate *who* users are), but it does do
2323 authorization (it grants or denies access for *authenticated users*
2328 authorization (it grants or denies access for *authenticated users*
2324 based on settings in this section). You must either configure your
2329 based on settings in this section). You must either configure your
2325 webserver to do authentication for you, or disable the authorization
2330 webserver to do authentication for you, or disable the authorization
2326 checks.
2331 checks.
2327
2332
2328 For a quick setup in a trusted environment, e.g., a private LAN, where
2333 For a quick setup in a trusted environment, e.g., a private LAN, where
2329 you want it to accept pushes from anybody, you can use the following
2334 you want it to accept pushes from anybody, you can use the following
2330 command line::
2335 command line::
2331
2336
2332 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2337 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2333
2338
2334 Note that this will allow anybody to push anything to the server and
2339 Note that this will allow anybody to push anything to the server and
2335 that this should not be used for public servers.
2340 that this should not be used for public servers.
2336
2341
2337 The full set of options is:
2342 The full set of options is:
2338
2343
2339 ``accesslog``
2344 ``accesslog``
2340 Where to output the access log. (default: stdout)
2345 Where to output the access log. (default: stdout)
2341
2346
2342 ``address``
2347 ``address``
2343 Interface address to bind to. (default: all)
2348 Interface address to bind to. (default: all)
2344
2349
2345 ``allow-archive``
2350 ``allow-archive``
2346 List of archive format (bz2, gz, zip) allowed for downloading.
2351 List of archive format (bz2, gz, zip) allowed for downloading.
2347 (default: empty)
2352 (default: empty)
2348
2353
2349 ``allowbz2``
2354 ``allowbz2``
2350 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2355 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2351 revisions.
2356 revisions.
2352 (default: False)
2357 (default: False)
2353
2358
2354 ``allowgz``
2359 ``allowgz``
2355 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2360 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2356 revisions.
2361 revisions.
2357 (default: False)
2362 (default: False)
2358
2363
2359 ``allow-pull``
2364 ``allow-pull``
2360 Whether to allow pulling from the repository. (default: True)
2365 Whether to allow pulling from the repository. (default: True)
2361
2366
2362 ``allow-push``
2367 ``allow-push``
2363 Whether to allow pushing to the repository. If empty or not set,
2368 Whether to allow pushing to the repository. If empty or not set,
2364 pushing is not allowed. If the special value ``*``, any remote
2369 pushing is not allowed. If the special value ``*``, any remote
2365 user can push, including unauthenticated users. Otherwise, the
2370 user can push, including unauthenticated users. Otherwise, the
2366 remote user must have been authenticated, and the authenticated
2371 remote user must have been authenticated, and the authenticated
2367 user name must be present in this list. The contents of the
2372 user name must be present in this list. The contents of the
2368 allow-push list are examined after the deny_push list.
2373 allow-push list are examined after the deny_push list.
2369
2374
2370 ``allow_read``
2375 ``allow_read``
2371 If the user has not already been denied repository access due to
2376 If the user has not already been denied repository access due to
2372 the contents of deny_read, this list determines whether to grant
2377 the contents of deny_read, this list determines whether to grant
2373 repository access to the user. If this list is not empty, and the
2378 repository access to the user. If this list is not empty, and the
2374 user is unauthenticated or not present in the list, then access is
2379 user is unauthenticated or not present in the list, then access is
2375 denied for the user. If the list is empty or not set, then access
2380 denied for the user. If the list is empty or not set, then access
2376 is permitted to all users by default. Setting allow_read to the
2381 is permitted to all users by default. Setting allow_read to the
2377 special value ``*`` is equivalent to it not being set (i.e. access
2382 special value ``*`` is equivalent to it not being set (i.e. access
2378 is permitted to all users). The contents of the allow_read list are
2383 is permitted to all users). The contents of the allow_read list are
2379 examined after the deny_read list.
2384 examined after the deny_read list.
2380
2385
2381 ``allowzip``
2386 ``allowzip``
2382 (DEPRECATED) Whether to allow .zip downloading of repository
2387 (DEPRECATED) Whether to allow .zip downloading of repository
2383 revisions. This feature creates temporary files.
2388 revisions. This feature creates temporary files.
2384 (default: False)
2389 (default: False)
2385
2390
2386 ``archivesubrepos``
2391 ``archivesubrepos``
2387 Whether to recurse into subrepositories when archiving.
2392 Whether to recurse into subrepositories when archiving.
2388 (default: False)
2393 (default: False)
2389
2394
2390 ``baseurl``
2395 ``baseurl``
2391 Base URL to use when publishing URLs in other locations, so
2396 Base URL to use when publishing URLs in other locations, so
2392 third-party tools like email notification hooks can construct
2397 third-party tools like email notification hooks can construct
2393 URLs. Example: ``http://hgserver/repos/``.
2398 URLs. Example: ``http://hgserver/repos/``.
2394
2399
2395 ``cacerts``
2400 ``cacerts``
2396 Path to file containing a list of PEM encoded certificate
2401 Path to file containing a list of PEM encoded certificate
2397 authority certificates. Environment variables and ``~user``
2402 authority certificates. Environment variables and ``~user``
2398 constructs are expanded in the filename. If specified on the
2403 constructs are expanded in the filename. If specified on the
2399 client, then it will verify the identity of remote HTTPS servers
2404 client, then it will verify the identity of remote HTTPS servers
2400 with these certificates.
2405 with these certificates.
2401
2406
2402 To disable SSL verification temporarily, specify ``--insecure`` from
2407 To disable SSL verification temporarily, specify ``--insecure`` from
2403 command line.
2408 command line.
2404
2409
2405 You can use OpenSSL's CA certificate file if your platform has
2410 You can use OpenSSL's CA certificate file if your platform has
2406 one. On most Linux systems this will be
2411 one. On most Linux systems this will be
2407 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2412 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2408 generate this file manually. The form must be as follows::
2413 generate this file manually. The form must be as follows::
2409
2414
2410 -----BEGIN CERTIFICATE-----
2415 -----BEGIN CERTIFICATE-----
2411 ... (certificate in base64 PEM encoding) ...
2416 ... (certificate in base64 PEM encoding) ...
2412 -----END CERTIFICATE-----
2417 -----END CERTIFICATE-----
2413 -----BEGIN CERTIFICATE-----
2418 -----BEGIN CERTIFICATE-----
2414 ... (certificate in base64 PEM encoding) ...
2419 ... (certificate in base64 PEM encoding) ...
2415 -----END CERTIFICATE-----
2420 -----END CERTIFICATE-----
2416
2421
2417 ``cache``
2422 ``cache``
2418 Whether to support caching in hgweb. (default: True)
2423 Whether to support caching in hgweb. (default: True)
2419
2424
2420 ``certificate``
2425 ``certificate``
2421 Certificate to use when running :hg:`serve`.
2426 Certificate to use when running :hg:`serve`.
2422
2427
2423 ``collapse``
2428 ``collapse``
2424 With ``descend`` enabled, repositories in subdirectories are shown at
2429 With ``descend`` enabled, repositories in subdirectories are shown at
2425 a single level alongside repositories in the current path. With
2430 a single level alongside repositories in the current path. With
2426 ``collapse`` also enabled, repositories residing at a deeper level than
2431 ``collapse`` also enabled, repositories residing at a deeper level than
2427 the current path are grouped behind navigable directory entries that
2432 the current path are grouped behind navigable directory entries that
2428 lead to the locations of these repositories. In effect, this setting
2433 lead to the locations of these repositories. In effect, this setting
2429 collapses each collection of repositories found within a subdirectory
2434 collapses each collection of repositories found within a subdirectory
2430 into a single entry for that subdirectory. (default: False)
2435 into a single entry for that subdirectory. (default: False)
2431
2436
2432 ``comparisoncontext``
2437 ``comparisoncontext``
2433 Number of lines of context to show in side-by-side file comparison. If
2438 Number of lines of context to show in side-by-side file comparison. If
2434 negative or the value ``full``, whole files are shown. (default: 5)
2439 negative or the value ``full``, whole files are shown. (default: 5)
2435
2440
2436 This setting can be overridden by a ``context`` request parameter to the
2441 This setting can be overridden by a ``context`` request parameter to the
2437 ``comparison`` command, taking the same values.
2442 ``comparison`` command, taking the same values.
2438
2443
2439 ``contact``
2444 ``contact``
2440 Name or email address of the person in charge of the repository.
2445 Name or email address of the person in charge of the repository.
2441 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2446 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2442
2447
2443 ``csp``
2448 ``csp``
2444 Send a ``Content-Security-Policy`` HTTP header with this value.
2449 Send a ``Content-Security-Policy`` HTTP header with this value.
2445
2450
2446 The value may contain a special string ``%nonce%``, which will be replaced
2451 The value may contain a special string ``%nonce%``, which will be replaced
2447 by a randomly-generated one-time use value. If the value contains
2452 by a randomly-generated one-time use value. If the value contains
2448 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2453 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2449 one-time property of the nonce. This nonce will also be inserted into
2454 one-time property of the nonce. This nonce will also be inserted into
2450 ``<script>`` elements containing inline JavaScript.
2455 ``<script>`` elements containing inline JavaScript.
2451
2456
2452 Note: lots of HTML content sent by the server is derived from repository
2457 Note: lots of HTML content sent by the server is derived from repository
2453 data. Please consider the potential for malicious repository data to
2458 data. Please consider the potential for malicious repository data to
2454 "inject" itself into generated HTML content as part of your security
2459 "inject" itself into generated HTML content as part of your security
2455 threat model.
2460 threat model.
2456
2461
2457 ``deny_push``
2462 ``deny_push``
2458 Whether to deny pushing to the repository. If empty or not set,
2463 Whether to deny pushing to the repository. If empty or not set,
2459 push is not denied. If the special value ``*``, all remote users are
2464 push is not denied. If the special value ``*``, all remote users are
2460 denied push. Otherwise, unauthenticated users are all denied, and
2465 denied push. Otherwise, unauthenticated users are all denied, and
2461 any authenticated user name present in this list is also denied. The
2466 any authenticated user name present in this list is also denied. The
2462 contents of the deny_push list are examined before the allow-push list.
2467 contents of the deny_push list are examined before the allow-push list.
2463
2468
2464 ``deny_read``
2469 ``deny_read``
2465 Whether to deny reading/viewing of the repository. If this list is
2470 Whether to deny reading/viewing of the repository. If this list is
2466 not empty, unauthenticated users are all denied, and any
2471 not empty, unauthenticated users are all denied, and any
2467 authenticated user name present in this list is also denied access to
2472 authenticated user name present in this list is also denied access to
2468 the repository. If set to the special value ``*``, all remote users
2473 the repository. If set to the special value ``*``, all remote users
2469 are denied access (rarely needed ;). If deny_read is empty or not set,
2474 are denied access (rarely needed ;). If deny_read is empty or not set,
2470 the determination of repository access depends on the presence and
2475 the determination of repository access depends on the presence and
2471 content of the allow_read list (see description). If both
2476 content of the allow_read list (see description). If both
2472 deny_read and allow_read are empty or not set, then access is
2477 deny_read and allow_read are empty or not set, then access is
2473 permitted to all users by default. If the repository is being
2478 permitted to all users by default. If the repository is being
2474 served via hgwebdir, denied users will not be able to see it in
2479 served via hgwebdir, denied users will not be able to see it in
2475 the list of repositories. The contents of the deny_read list have
2480 the list of repositories. The contents of the deny_read list have
2476 priority over (are examined before) the contents of the allow_read
2481 priority over (are examined before) the contents of the allow_read
2477 list.
2482 list.
2478
2483
2479 ``descend``
2484 ``descend``
2480 hgwebdir indexes will not descend into subdirectories. Only repositories
2485 hgwebdir indexes will not descend into subdirectories. Only repositories
2481 directly in the current path will be shown (other repositories are still
2486 directly in the current path will be shown (other repositories are still
2482 available from the index corresponding to their containing path).
2487 available from the index corresponding to their containing path).
2483
2488
2484 ``description``
2489 ``description``
2485 Textual description of the repository's purpose or contents.
2490 Textual description of the repository's purpose or contents.
2486 (default: "unknown")
2491 (default: "unknown")
2487
2492
2488 ``encoding``
2493 ``encoding``
2489 Character encoding name. (default: the current locale charset)
2494 Character encoding name. (default: the current locale charset)
2490 Example: "UTF-8".
2495 Example: "UTF-8".
2491
2496
2492 ``errorlog``
2497 ``errorlog``
2493 Where to output the error log. (default: stderr)
2498 Where to output the error log. (default: stderr)
2494
2499
2495 ``guessmime``
2500 ``guessmime``
2496 Control MIME types for raw download of file content.
2501 Control MIME types for raw download of file content.
2497 Set to True to let hgweb guess the content type from the file
2502 Set to True to let hgweb guess the content type from the file
2498 extension. This will serve HTML files as ``text/html`` and might
2503 extension. This will serve HTML files as ``text/html`` and might
2499 allow cross-site scripting attacks when serving untrusted
2504 allow cross-site scripting attacks when serving untrusted
2500 repositories. (default: False)
2505 repositories. (default: False)
2501
2506
2502 ``hidden``
2507 ``hidden``
2503 Whether to hide the repository in the hgwebdir index.
2508 Whether to hide the repository in the hgwebdir index.
2504 (default: False)
2509 (default: False)
2505
2510
2506 ``ipv6``
2511 ``ipv6``
2507 Whether to use IPv6. (default: False)
2512 Whether to use IPv6. (default: False)
2508
2513
2509 ``labels``
2514 ``labels``
2510 List of string *labels* associated with the repository.
2515 List of string *labels* associated with the repository.
2511
2516
2512 Labels are exposed as a template keyword and can be used to customize
2517 Labels are exposed as a template keyword and can be used to customize
2513 output. e.g. the ``index`` template can group or filter repositories
2518 output. e.g. the ``index`` template can group or filter repositories
2514 by labels and the ``summary`` template can display additional content
2519 by labels and the ``summary`` template can display additional content
2515 if a specific label is present.
2520 if a specific label is present.
2516
2521
2517 ``logoimg``
2522 ``logoimg``
2518 File name of the logo image that some templates display on each page.
2523 File name of the logo image that some templates display on each page.
2519 The file name is relative to ``staticurl``. That is, the full path to
2524 The file name is relative to ``staticurl``. That is, the full path to
2520 the logo image is "staticurl/logoimg".
2525 the logo image is "staticurl/logoimg".
2521 If unset, ``hglogo.png`` will be used.
2526 If unset, ``hglogo.png`` will be used.
2522
2527
2523 ``logourl``
2528 ``logourl``
2524 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2529 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2525 will be used.
2530 will be used.
2526
2531
2527 ``maxchanges``
2532 ``maxchanges``
2528 Maximum number of changes to list on the changelog. (default: 10)
2533 Maximum number of changes to list on the changelog. (default: 10)
2529
2534
2530 ``maxfiles``
2535 ``maxfiles``
2531 Maximum number of files to list per changeset. (default: 10)
2536 Maximum number of files to list per changeset. (default: 10)
2532
2537
2533 ``maxshortchanges``
2538 ``maxshortchanges``
2534 Maximum number of changes to list on the shortlog, graph or filelog
2539 Maximum number of changes to list on the shortlog, graph or filelog
2535 pages. (default: 60)
2540 pages. (default: 60)
2536
2541
2537 ``name``
2542 ``name``
2538 Repository name to use in the web interface.
2543 Repository name to use in the web interface.
2539 (default: current working directory)
2544 (default: current working directory)
2540
2545
2541 ``port``
2546 ``port``
2542 Port to listen on. (default: 8000)
2547 Port to listen on. (default: 8000)
2543
2548
2544 ``prefix``
2549 ``prefix``
2545 Prefix path to serve from. (default: '' (server root))
2550 Prefix path to serve from. (default: '' (server root))
2546
2551
2547 ``push_ssl``
2552 ``push_ssl``
2548 Whether to require that inbound pushes be transported over SSL to
2553 Whether to require that inbound pushes be transported over SSL to
2549 prevent password sniffing. (default: True)
2554 prevent password sniffing. (default: True)
2550
2555
2551 ``refreshinterval``
2556 ``refreshinterval``
2552 How frequently directory listings re-scan the filesystem for new
2557 How frequently directory listings re-scan the filesystem for new
2553 repositories, in seconds. This is relevant when wildcards are used
2558 repositories, in seconds. This is relevant when wildcards are used
2554 to define paths. Depending on how much filesystem traversal is
2559 to define paths. Depending on how much filesystem traversal is
2555 required, refreshing may negatively impact performance.
2560 required, refreshing may negatively impact performance.
2556
2561
2557 Values less than or equal to 0 always refresh.
2562 Values less than or equal to 0 always refresh.
2558 (default: 20)
2563 (default: 20)
2559
2564
2560 ``server-header``
2565 ``server-header``
2561 Value for HTTP ``Server`` response header.
2566 Value for HTTP ``Server`` response header.
2562
2567
2563 ``staticurl``
2568 ``staticurl``
2564 Base URL to use for static files. If unset, static files (e.g. the
2569 Base URL to use for static files. If unset, static files (e.g. the
2565 hgicon.png favicon) will be served by the CGI script itself. Use
2570 hgicon.png favicon) will be served by the CGI script itself. Use
2566 this setting to serve them directly with the HTTP server.
2571 this setting to serve them directly with the HTTP server.
2567 Example: ``http://hgserver/static/``.
2572 Example: ``http://hgserver/static/``.
2568
2573
2569 ``stripes``
2574 ``stripes``
2570 How many lines a "zebra stripe" should span in multi-line output.
2575 How many lines a "zebra stripe" should span in multi-line output.
2571 Set to 0 to disable. (default: 1)
2576 Set to 0 to disable. (default: 1)
2572
2577
2573 ``style``
2578 ``style``
2574 Which template map style to use. The available options are the names of
2579 Which template map style to use. The available options are the names of
2575 subdirectories in the HTML templates path. (default: ``paper``)
2580 subdirectories in the HTML templates path. (default: ``paper``)
2576 Example: ``monoblue``.
2581 Example: ``monoblue``.
2577
2582
2578 ``templates``
2583 ``templates``
2579 Where to find the HTML templates. The default path to the HTML templates
2584 Where to find the HTML templates. The default path to the HTML templates
2580 can be obtained from ``hg debuginstall``.
2585 can be obtained from ``hg debuginstall``.
2581
2586
2582 ``websub``
2587 ``websub``
2583 ----------
2588 ----------
2584
2589
2585 Web substitution filter definition. You can use this section to
2590 Web substitution filter definition. You can use this section to
2586 define a set of regular expression substitution patterns which
2591 define a set of regular expression substitution patterns which
2587 let you automatically modify the hgweb server output.
2592 let you automatically modify the hgweb server output.
2588
2593
2589 The default hgweb templates only apply these substitution patterns
2594 The default hgweb templates only apply these substitution patterns
2590 on the revision description fields. You can apply them anywhere
2595 on the revision description fields. You can apply them anywhere
2591 you want when you create your own templates by adding calls to the
2596 you want when you create your own templates by adding calls to the
2592 "websub" filter (usually after calling the "escape" filter).
2597 "websub" filter (usually after calling the "escape" filter).
2593
2598
2594 This can be used, for example, to convert issue references to links
2599 This can be used, for example, to convert issue references to links
2595 to your issue tracker, or to convert "markdown-like" syntax into
2600 to your issue tracker, or to convert "markdown-like" syntax into
2596 HTML (see the examples below).
2601 HTML (see the examples below).
2597
2602
2598 Each entry in this section names a substitution filter.
2603 Each entry in this section names a substitution filter.
2599 The value of each entry defines the substitution expression itself.
2604 The value of each entry defines the substitution expression itself.
2600 The websub expressions follow the old interhg extension syntax,
2605 The websub expressions follow the old interhg extension syntax,
2601 which in turn imitates the Unix sed replacement syntax::
2606 which in turn imitates the Unix sed replacement syntax::
2602
2607
2603 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2608 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2604
2609
2605 You can use any separator other than "/". The final "i" is optional
2610 You can use any separator other than "/". The final "i" is optional
2606 and indicates that the search must be case insensitive.
2611 and indicates that the search must be case insensitive.
2607
2612
2608 Examples::
2613 Examples::
2609
2614
2610 [websub]
2615 [websub]
2611 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2616 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2612 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2617 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2613 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2618 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2614
2619
2615 ``worker``
2620 ``worker``
2616 ----------
2621 ----------
2617
2622
2618 Parallel master/worker configuration. We currently perform working
2623 Parallel master/worker configuration. We currently perform working
2619 directory updates in parallel on Unix-like systems, which greatly
2624 directory updates in parallel on Unix-like systems, which greatly
2620 helps performance.
2625 helps performance.
2621
2626
2622 ``enabled``
2627 ``enabled``
2623 Whether to enable workers code to be used.
2628 Whether to enable workers code to be used.
2624 (default: true)
2629 (default: true)
2625
2630
2626 ``numcpus``
2631 ``numcpus``
2627 Number of CPUs to use for parallel operations. A zero or
2632 Number of CPUs to use for parallel operations. A zero or
2628 negative value is treated as ``use the default``.
2633 negative value is treated as ``use the default``.
2629 (default: 4 or the number of CPUs on the system, whichever is larger)
2634 (default: 4 or the number of CPUs on the system, whichever is larger)
2630
2635
2631 ``backgroundclose``
2636 ``backgroundclose``
2632 Whether to enable closing file handles on background threads during certain
2637 Whether to enable closing file handles on background threads during certain
2633 operations. Some platforms aren't very efficient at closing file
2638 operations. Some platforms aren't very efficient at closing file
2634 handles that have been written or appended to. By performing file closing
2639 handles that have been written or appended to. By performing file closing
2635 on background threads, file write rate can increase substantially.
2640 on background threads, file write rate can increase substantially.
2636 (default: true on Windows, false elsewhere)
2641 (default: true on Windows, false elsewhere)
2637
2642
2638 ``backgroundcloseminfilecount``
2643 ``backgroundcloseminfilecount``
2639 Minimum number of files required to trigger background file closing.
2644 Minimum number of files required to trigger background file closing.
2640 Operations not writing this many files won't start background close
2645 Operations not writing this many files won't start background close
2641 threads.
2646 threads.
2642 (default: 2048)
2647 (default: 2048)
2643
2648
2644 ``backgroundclosemaxqueue``
2649 ``backgroundclosemaxqueue``
2645 The maximum number of opened file handles waiting to be closed in the
2650 The maximum number of opened file handles waiting to be closed in the
2646 background. This option only has an effect if ``backgroundclose`` is
2651 background. This option only has an effect if ``backgroundclose`` is
2647 enabled.
2652 enabled.
2648 (default: 384)
2653 (default: 384)
2649
2654
2650 ``backgroundclosethreadcount``
2655 ``backgroundclosethreadcount``
2651 Number of threads to process background file closes. Only relevant if
2656 Number of threads to process background file closes. Only relevant if
2652 ``backgroundclose`` is enabled.
2657 ``backgroundclose`` is enabled.
2653 (default: 4)
2658 (default: 4)
@@ -1,1887 +1,1889 b''
1 This file used to contains all largefile tests.
1 This file used to contains all largefile tests.
2 Do not add any new tests in this file as it his already far too long to run.
2 Do not add any new tests in this file as it his already far too long to run.
3
3
4 It contains all the testing of the basic concepts of large file in a single block.
4 It contains all the testing of the basic concepts of large file in a single block.
5
5
6 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
6 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
7 $ mkdir "${USERCACHE}"
7 $ mkdir "${USERCACHE}"
8 $ cat >> $HGRCPATH <<EOF
8 $ cat >> $HGRCPATH <<EOF
9 > [extensions]
9 > [extensions]
10 > largefiles=
10 > largefiles=
11 > purge=
11 > purge=
12 > rebase=
12 > rebase=
13 > transplant=
13 > transplant=
14 > [phases]
14 > [phases]
15 > publish=False
15 > publish=False
16 > [largefiles]
16 > [largefiles]
17 > minsize=2
17 > minsize=2
18 > patterns=glob:**.dat
18 > patterns=glob:**.dat
19 > usercache=${USERCACHE}
19 > usercache=${USERCACHE}
20 > [hooks]
20 > [hooks]
21 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
21 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
22 > EOF
22 > EOF
23
23
24 Create the repo with a couple of revisions of both large and normal
24 Create the repo with a couple of revisions of both large and normal
25 files.
25 files.
26 Test status and dirstate of largefiles and that summary output is correct.
26 Test status and dirstate of largefiles and that summary output is correct.
27
27
28 $ hg init a
28 $ hg init a
29 $ cd a
29 $ cd a
30 $ mkdir sub
30 $ mkdir sub
31 $ echo normal1 > normal1
31 $ echo normal1 > normal1
32 $ echo normal2 > sub/normal2
32 $ echo normal2 > sub/normal2
33 $ echo large1 > large1
33 $ echo large1 > large1
34 $ echo large2 > sub/large2
34 $ echo large2 > sub/large2
35 $ hg add normal1 sub/normal2
35 $ hg add normal1 sub/normal2
36 $ hg add --large large1 sub/large2
36 $ hg add --large large1 sub/large2
37 $ hg commit -m "add files"
37 $ hg commit -m "add files"
38 Invoking status precommit hook
38 Invoking status precommit hook
39 A large1
39 A large1
40 A normal1
40 A normal1
41 A sub/large2
41 A sub/large2
42 A sub/normal2
42 A sub/normal2
43 $ touch large1 sub/large2
43 $ touch large1 sub/large2
44 $ sleep 1
44 $ sleep 1
45 $ hg st
45 $ hg st
46 $ hg debugstate --nodates
46 $ hg debugstate --nodates
47 n 644 41 set .hglf/large1
47 n 644 41 set .hglf/large1
48 n 644 41 set .hglf/sub/large2
48 n 644 41 set .hglf/sub/large2
49 n 644 8 set normal1
49 n 644 8 set normal1
50 n 644 8 set sub/normal2
50 n 644 8 set sub/normal2
51 $ hg debugstate --large --nodates
51 $ hg debugstate --large --nodates
52 n 644 7 set large1
52 n 644 7 set large1
53 n 644 7 set sub/large2
53 n 644 7 set sub/large2
54 $ echo normal11 > normal1
54 $ echo normal11 > normal1
55 $ echo normal22 > sub/normal2
55 $ echo normal22 > sub/normal2
56 $ echo large11 > large1
56 $ echo large11 > large1
57 $ echo large22 > sub/large2
57 $ echo large22 > sub/large2
58 $ hg commit -m "edit files"
58 $ hg commit -m "edit files"
59 Invoking status precommit hook
59 Invoking status precommit hook
60 M large1
60 M large1
61 M normal1
61 M normal1
62 M sub/large2
62 M sub/large2
63 M sub/normal2
63 M sub/normal2
64 $ hg sum --large
64 $ hg sum --large
65 parent: 1:ce8896473775 tip
65 parent: 1:ce8896473775 tip
66 edit files
66 edit files
67 branch: default
67 branch: default
68 commit: (clean)
68 commit: (clean)
69 update: (current)
69 update: (current)
70 phases: 2 draft
70 phases: 2 draft
71 largefiles: (no remote repo)
71 largefiles: (no remote repo)
72
72
73 Commit preserved largefile contents.
73 Commit preserved largefile contents.
74
74
75 $ cat normal1
75 $ cat normal1
76 normal11
76 normal11
77 $ cat large1
77 $ cat large1
78 large11
78 large11
79 $ cat sub/normal2
79 $ cat sub/normal2
80 normal22
80 normal22
81 $ cat sub/large2
81 $ cat sub/large2
82 large22
82 large22
83
83
84 Test status, subdir and unknown files
84 Test status, subdir and unknown files
85
85
86 $ echo unknown > sub/unknown
86 $ echo unknown > sub/unknown
87 $ hg st --all
87 $ hg st --all
88 ? sub/unknown
88 ? sub/unknown
89 C large1
89 C large1
90 C normal1
90 C normal1
91 C sub/large2
91 C sub/large2
92 C sub/normal2
92 C sub/normal2
93 $ hg st --all sub
93 $ hg st --all sub
94 ? sub/unknown
94 ? sub/unknown
95 C sub/large2
95 C sub/large2
96 C sub/normal2
96 C sub/normal2
97 $ rm sub/unknown
97 $ rm sub/unknown
98
98
99 Test messages and exit codes for remove warning cases
99 Test messages and exit codes for remove warning cases
100
100
101 $ hg remove -A large1
101 $ hg remove -A large1
102 not removing large1: file still exists
102 not removing large1: file still exists
103 [1]
103 [1]
104 $ echo 'modified' > large1
104 $ echo 'modified' > large1
105 $ hg remove large1
105 $ hg remove large1
106 not removing large1: file is modified (use -f to force removal)
106 not removing large1: file is modified (use -f to force removal)
107 [1]
107 [1]
108 $ echo 'new' > normalnew
108 $ echo 'new' > normalnew
109 $ hg add normalnew
109 $ hg add normalnew
110 $ echo 'new' > largenew
110 $ echo 'new' > largenew
111 $ hg add --large normalnew
111 $ hg add --large normalnew
112 normalnew already tracked!
112 normalnew already tracked!
113 $ hg remove normalnew largenew
113 $ hg remove normalnew largenew
114 not removing largenew: file is untracked
114 not removing largenew: file is untracked
115 not removing normalnew: file has been marked for add (use 'hg forget' to undo add)
115 not removing normalnew: file has been marked for add (use 'hg forget' to undo add)
116 [1]
116 [1]
117 $ rm normalnew largenew
117 $ rm normalnew largenew
118 $ hg up -Cq
118 $ hg up -Cq
119
119
120 Remove both largefiles and normal files.
120 Remove both largefiles and normal files.
121
121
122 $ hg remove normal1 large1
122 $ hg remove normal1 large1
123 $ hg status large1
123 $ hg status large1
124 R large1
124 R large1
125 $ hg commit -m "remove files"
125 $ hg commit -m "remove files"
126 Invoking status precommit hook
126 Invoking status precommit hook
127 R large1
127 R large1
128 R normal1
128 R normal1
129 $ ls
129 $ ls
130 sub
130 sub
131 $ echo "testlargefile" > large1-test
131 $ echo "testlargefile" > large1-test
132 $ hg add --large large1-test
132 $ hg add --large large1-test
133 $ hg st
133 $ hg st
134 A large1-test
134 A large1-test
135 $ hg rm large1-test
135 $ hg rm large1-test
136 not removing large1-test: file has been marked for add (use forget to undo)
136 not removing large1-test: file has been marked for add (use forget to undo)
137 [1]
137 [1]
138 $ hg st
138 $ hg st
139 A large1-test
139 A large1-test
140 $ hg forget large1-test
140 $ hg forget large1-test
141 $ hg st
141 $ hg st
142 ? large1-test
142 ? large1-test
143 $ hg remove large1-test
143 $ hg remove large1-test
144 not removing large1-test: file is untracked
144 not removing large1-test: file is untracked
145 [1]
145 [1]
146 $ hg forget large1-test
146 $ hg forget large1-test
147 not removing large1-test: file is already untracked
147 not removing large1-test: file is already untracked
148 [1]
148 [1]
149 $ rm large1-test
149 $ rm large1-test
150
150
151 Copy both largefiles and normal files (testing that status output is correct).
151 Copy both largefiles and normal files (testing that status output is correct).
152
152
153 $ hg cp sub/normal2 normal1
153 $ hg cp sub/normal2 normal1
154 $ hg cp sub/large2 large1
154 $ hg cp sub/large2 large1
155 $ hg commit -m "copy files"
155 $ hg commit -m "copy files"
156 Invoking status precommit hook
156 Invoking status precommit hook
157 A large1
157 A large1
158 A normal1
158 A normal1
159 $ cat normal1
159 $ cat normal1
160 normal22
160 normal22
161 $ cat large1
161 $ cat large1
162 large22
162 large22
163
163
164 Test moving largefiles and verify that normal files are also unaffected.
164 Test moving largefiles and verify that normal files are also unaffected.
165
165
166 $ hg mv normal1 normal3
166 $ hg mv normal1 normal3
167 $ hg mv large1 large3
167 $ hg mv large1 large3
168 $ hg mv sub/normal2 sub/normal4
168 $ hg mv sub/normal2 sub/normal4
169 $ hg mv sub/large2 sub/large4
169 $ hg mv sub/large2 sub/large4
170 $ hg commit -m "move files"
170 $ hg commit -m "move files"
171 Invoking status precommit hook
171 Invoking status precommit hook
172 A large3
172 A large3
173 A normal3
173 A normal3
174 A sub/large4
174 A sub/large4
175 A sub/normal4
175 A sub/normal4
176 R large1
176 R large1
177 R normal1
177 R normal1
178 R sub/large2
178 R sub/large2
179 R sub/normal2
179 R sub/normal2
180 $ cat normal3
180 $ cat normal3
181 normal22
181 normal22
182 $ cat large3
182 $ cat large3
183 large22
183 large22
184 $ cat sub/normal4
184 $ cat sub/normal4
185 normal22
185 normal22
186 $ cat sub/large4
186 $ cat sub/large4
187 large22
187 large22
188
188
189
189
190 #if serve
190 #if serve
191 Test display of largefiles in hgweb
191 Test display of largefiles in hgweb
192
192
193 $ hg serve -d -p $HGPORT --pid-file ../hg.pid
193 $ hg serve -d -p $HGPORT --pid-file ../hg.pid
194 $ cat ../hg.pid >> $DAEMON_PIDS
194 $ cat ../hg.pid >> $DAEMON_PIDS
195 $ get-with-headers.py $LOCALIP:$HGPORT 'file/tip/?style=raw'
195 $ get-with-headers.py $LOCALIP:$HGPORT 'file/tip/?style=raw'
196 200 Script output follows
196 200 Script output follows
197
197
198
198
199 drwxr-xr-x sub
199 drwxr-xr-x sub
200 -rw-r--r-- 41 large3
200 -rw-r--r-- 41 large3
201 -rw-r--r-- 9 normal3
201 -rw-r--r-- 9 normal3
202
202
203
203
204 $ get-with-headers.py $LOCALIP:$HGPORT 'file/tip/sub/?style=raw'
204 $ get-with-headers.py $LOCALIP:$HGPORT 'file/tip/sub/?style=raw'
205 200 Script output follows
205 200 Script output follows
206
206
207
207
208 -rw-r--r-- 41 large4
208 -rw-r--r-- 41 large4
209 -rw-r--r-- 9 normal4
209 -rw-r--r-- 9 normal4
210
210
211
211
212 $ killdaemons.py
212 $ killdaemons.py
213 #endif
213 #endif
214
214
215 Test largefiles can be loaded in hgweb (wrapcommand() shouldn't fail)
215 Test largefiles can be loaded in hgweb (wrapcommand() shouldn't fail)
216
216
217 $ cat <<EOF > "$TESTTMP/hgweb.cgi"
217 $ cat <<EOF > "$TESTTMP/hgweb.cgi"
218 > #!$PYTHON
218 > #!$PYTHON
219 > from mercurial import demandimport; demandimport.enable()
219 > from mercurial import demandimport; demandimport.enable()
220 > from mercurial.hgweb import hgweb
220 > from mercurial.hgweb import hgweb
221 > from mercurial.hgweb import wsgicgi
221 > from mercurial.hgweb import wsgicgi
222 > application = hgweb(b'.', b'test repo')
222 > application = hgweb(b'.', b'test repo')
223 > wsgicgi.launch(application)
223 > wsgicgi.launch(application)
224 > EOF
224 > EOF
225 $ . "$TESTDIR/cgienv"
225 $ . "$TESTDIR/cgienv"
226
226
227 $ SCRIPT_NAME='' \
227 $ SCRIPT_NAME='' \
228 > $PYTHON "$TESTTMP/hgweb.cgi" > /dev/null
228 > $PYTHON "$TESTTMP/hgweb.cgi" > /dev/null
229
229
230 Test archiving the various revisions. These hit corner cases known with
230 Test archiving the various revisions. These hit corner cases known with
231 archiving.
231 archiving.
232
232
233 $ hg archive -r 0 ../archive0
233 $ hg archive -r 0 ../archive0
234 $ hg archive -r 1 ../archive1
234 $ hg archive -r 1 ../archive1
235 $ hg archive -r 2 ../archive2
235 $ hg archive -r 2 ../archive2
236 $ hg archive -r 3 ../archive3
236 $ hg archive -r 3 ../archive3
237 $ hg archive -r 4 ../archive4
237 $ hg archive -r 4 ../archive4
238 $ cd ../archive0
238 $ cd ../archive0
239 $ cat normal1
239 $ cat normal1
240 normal1
240 normal1
241 $ cat large1
241 $ cat large1
242 large1
242 large1
243 $ cat sub/normal2
243 $ cat sub/normal2
244 normal2
244 normal2
245 $ cat sub/large2
245 $ cat sub/large2
246 large2
246 large2
247 $ cd ../archive1
247 $ cd ../archive1
248 $ cat normal1
248 $ cat normal1
249 normal11
249 normal11
250 $ cat large1
250 $ cat large1
251 large11
251 large11
252 $ cat sub/normal2
252 $ cat sub/normal2
253 normal22
253 normal22
254 $ cat sub/large2
254 $ cat sub/large2
255 large22
255 large22
256 $ cd ../archive2
256 $ cd ../archive2
257 $ ls
257 $ ls
258 sub
258 sub
259 $ cat sub/normal2
259 $ cat sub/normal2
260 normal22
260 normal22
261 $ cat sub/large2
261 $ cat sub/large2
262 large22
262 large22
263 $ cd ../archive3
263 $ cd ../archive3
264 $ cat normal1
264 $ cat normal1
265 normal22
265 normal22
266 $ cat large1
266 $ cat large1
267 large22
267 large22
268 $ cat sub/normal2
268 $ cat sub/normal2
269 normal22
269 normal22
270 $ cat sub/large2
270 $ cat sub/large2
271 large22
271 large22
272 $ cd ../archive4
272 $ cd ../archive4
273 $ cat normal3
273 $ cat normal3
274 normal22
274 normal22
275 $ cat large3
275 $ cat large3
276 large22
276 large22
277 $ cat sub/normal4
277 $ cat sub/normal4
278 normal22
278 normal22
279 $ cat sub/large4
279 $ cat sub/large4
280 large22
280 large22
281
281
282 Commit corner case: specify files to commit.
282 Commit corner case: specify files to commit.
283
283
284 $ cd ../a
284 $ cd ../a
285 $ echo normal3 > normal3
285 $ echo normal3 > normal3
286 $ echo large3 > large3
286 $ echo large3 > large3
287 $ echo normal4 > sub/normal4
287 $ echo normal4 > sub/normal4
288 $ echo large4 > sub/large4
288 $ echo large4 > sub/large4
289 $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again"
289 $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again"
290 Invoking status precommit hook
290 Invoking status precommit hook
291 M large3
291 M large3
292 M normal3
292 M normal3
293 M sub/large4
293 M sub/large4
294 M sub/normal4
294 M sub/normal4
295 $ cat normal3
295 $ cat normal3
296 normal3
296 normal3
297 $ cat large3
297 $ cat large3
298 large3
298 large3
299 $ cat sub/normal4
299 $ cat sub/normal4
300 normal4
300 normal4
301 $ cat sub/large4
301 $ cat sub/large4
302 large4
302 large4
303
303
304 One more commit corner case: commit from a subdirectory.
304 One more commit corner case: commit from a subdirectory.
305
305
306 $ cd ../a
306 $ cd ../a
307 $ echo normal33 > normal3
307 $ echo normal33 > normal3
308 $ echo large33 > large3
308 $ echo large33 > large3
309 $ echo normal44 > sub/normal4
309 $ echo normal44 > sub/normal4
310 $ echo large44 > sub/large4
310 $ echo large44 > sub/large4
311 $ cd sub
311 $ cd sub
312 $ hg commit -m "edit files yet again"
312 $ hg commit -m "edit files yet again"
313 Invoking status precommit hook
313 Invoking status precommit hook
314 M large3
314 M large3
315 M normal3
315 M normal3
316 M sub/large4
316 M sub/large4
317 M sub/normal4
317 M sub/normal4
318 $ cat ../normal3
318 $ cat ../normal3
319 normal33
319 normal33
320 $ cat ../large3
320 $ cat ../large3
321 large33
321 large33
322 $ cat normal4
322 $ cat normal4
323 normal44
323 normal44
324 $ cat large4
324 $ cat large4
325 large44
325 large44
326
326
327 Committing standins is not allowed.
327 Committing standins is not allowed.
328
328
329 $ cd ..
329 $ cd ..
330 $ echo large3 > large3
330 $ echo large3 > large3
331 $ hg commit .hglf/large3 -m "try to commit standin"
331 $ hg commit .hglf/large3 -m "try to commit standin"
332 abort: file ".hglf/large3" is a largefile standin
332 abort: file ".hglf/large3" is a largefile standin
333 (commit the largefile itself instead)
333 (commit the largefile itself instead)
334 [255]
334 [255]
335
335
336 Corner cases for adding largefiles.
336 Corner cases for adding largefiles.
337
337
338 $ echo large5 > large5
338 $ echo large5 > large5
339 $ hg add --large large5
339 $ hg add --large large5
340 $ hg add --large large5
340 $ hg add --large large5
341 large5 already a largefile
341 large5 already a largefile
342 $ mkdir sub2
342 $ mkdir sub2
343 $ echo large6 > sub2/large6
343 $ echo large6 > sub2/large6
344 $ echo large7 > sub2/large7
344 $ echo large7 > sub2/large7
345 $ hg add --large sub2
345 $ hg add --large sub2
346 adding sub2/large6 as a largefile
346 adding sub2/large6 as a largefile
347 adding sub2/large7 as a largefile
347 adding sub2/large7 as a largefile
348 $ hg st
348 $ hg st
349 M large3
349 M large3
350 A large5
350 A large5
351 A sub2/large6
351 A sub2/large6
352 A sub2/large7
352 A sub2/large7
353
353
354 Committing directories containing only largefiles.
354 Committing directories containing only largefiles.
355
355
356 $ mkdir -p z/y/x/m
356 $ mkdir -p z/y/x/m
357 $ touch z/y/x/m/large1
357 $ touch z/y/x/m/large1
358 $ touch z/y/x/large2
358 $ touch z/y/x/large2
359 $ hg add --large z/y/x/m/large1 z/y/x/large2
359 $ hg add --large z/y/x/m/large1 z/y/x/large2
360 $ hg commit -m "Subdir with directory only containing largefiles" z
360 $ hg commit -m "Subdir with directory only containing largefiles" z
361 Invoking status precommit hook
361 Invoking status precommit hook
362 M large3
362 M large3
363 A large5
363 A large5
364 A sub2/large6
364 A sub2/large6
365 A sub2/large7
365 A sub2/large7
366 A z/y/x/large2
366 A z/y/x/large2
367 A z/y/x/m/large1
367 A z/y/x/m/large1
368
368
369 (and a bit of log testing)
369 (and a bit of log testing)
370
370
371 $ hg log -T '{rev}\n' z/y/x/m/large1
371 $ hg log -T '{rev}\n' z/y/x/m/large1
372 7
372 7
373 $ hg log -T '{rev}\n' z/y/x/m # with only a largefile
373 $ hg log -T '{rev}\n' z/y/x/m # with only a largefile
374 7
374 7
375
375
376 $ hg rollback --quiet
376 $ hg rollback --quiet
377 $ touch z/y/x/m/normal
377 $ touch z/y/x/m/normal
378 $ hg add z/y/x/m/normal
378 $ hg add z/y/x/m/normal
379 $ hg commit -m "Subdir with mixed contents" z
379 $ hg commit -m "Subdir with mixed contents" z
380 Invoking status precommit hook
380 Invoking status precommit hook
381 M large3
381 M large3
382 A large5
382 A large5
383 A sub2/large6
383 A sub2/large6
384 A sub2/large7
384 A sub2/large7
385 A z/y/x/large2
385 A z/y/x/large2
386 A z/y/x/m/large1
386 A z/y/x/m/large1
387 A z/y/x/m/normal
387 A z/y/x/m/normal
388 $ hg st
388 $ hg st
389 M large3
389 M large3
390 A large5
390 A large5
391 A sub2/large6
391 A sub2/large6
392 A sub2/large7
392 A sub2/large7
393 $ hg rollback --quiet
393 $ hg rollback --quiet
394 $ hg revert z/y/x/large2 z/y/x/m/large1
394 $ hg revert z/y/x/large2 z/y/x/m/large1
395 $ rm z/y/x/large2 z/y/x/m/large1
395 $ rm z/y/x/large2 z/y/x/m/large1
396 $ hg commit -m "Subdir with normal contents" z
396 $ hg commit -m "Subdir with normal contents" z
397 Invoking status precommit hook
397 Invoking status precommit hook
398 M large3
398 M large3
399 A large5
399 A large5
400 A sub2/large6
400 A sub2/large6
401 A sub2/large7
401 A sub2/large7
402 A z/y/x/m/normal
402 A z/y/x/m/normal
403 $ hg st
403 $ hg st
404 M large3
404 M large3
405 A large5
405 A large5
406 A sub2/large6
406 A sub2/large6
407 A sub2/large7
407 A sub2/large7
408 $ hg rollback --quiet
408 $ hg rollback --quiet
409 $ hg revert --quiet z
409 $ hg revert --quiet z
410 $ hg commit -m "Empty subdir" z
410 $ hg commit -m "Empty subdir" z
411 abort: z: no match under directory!
411 abort: z: no match under directory!
412 [255]
412 [255]
413 $ rm -rf z
413 $ rm -rf z
414 $ hg ci -m "standin" .hglf
414 $ hg ci -m "standin" .hglf
415 abort: file ".hglf" is a largefile standin
415 abort: file ".hglf" is a largefile standin
416 (commit the largefile itself instead)
416 (commit the largefile itself instead)
417 [255]
417 [255]
418
418
419 Test "hg status" with combination of 'file pattern' and 'directory
419 Test "hg status" with combination of 'file pattern' and 'directory
420 pattern' for largefiles:
420 pattern' for largefiles:
421
421
422 $ hg status sub2/large6 sub2
422 $ hg status sub2/large6 sub2
423 A sub2/large6
423 A sub2/large6
424 A sub2/large7
424 A sub2/large7
425
425
426 Config settings (pattern **.dat, minsize 2 MB) are respected.
426 Config settings (pattern **.dat, minsize 2 MB) are respected.
427
427
428 $ echo testdata > test.dat
428 $ echo testdata > test.dat
429 $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null
429 $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null
430 $ hg add
430 $ hg add
431 adding reallylarge as a largefile
431 adding reallylarge as a largefile
432 adding test.dat as a largefile
432 adding test.dat as a largefile
433
433
434 Test that minsize and --lfsize handle float values;
434 Test that minsize and --lfsize handle float values;
435 also tests that --lfsize overrides largefiles.minsize.
435 also tests that --lfsize overrides largefiles.minsize.
436 (0.250 MB = 256 kB = 262144 B)
436 (0.250 MB = 256 kB = 262144 B)
437
437
438 $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null
438 $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null
439 $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null
439 $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null
440 $ hg --config largefiles.minsize=.25 add
440 $ hg --config largefiles.minsize=.25 add
441 adding ratherlarge as a largefile
441 adding ratherlarge as a largefile
442 adding medium
442 adding medium
443 $ hg forget medium
443 $ hg forget medium
444 $ hg --config largefiles.minsize=.25 add --lfsize=.125
444 $ hg --config largefiles.minsize=.25 add --lfsize=.125
445 adding medium as a largefile
445 adding medium as a largefile
446 $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null
446 $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null
447 $ hg --config largefiles.minsize=.25 add --lfsize=.125
447 $ hg --config largefiles.minsize=.25 add --lfsize=.125
448 adding notlarge
448 adding notlarge
449 $ hg forget notlarge
449 $ hg forget notlarge
450
450
451 Test forget on largefiles.
451 Test forget on largefiles.
452
452
453 $ hg forget large3 large5 test.dat reallylarge ratherlarge medium
453 $ hg forget large3 large5 test.dat reallylarge ratherlarge medium
454 $ hg commit -m "add/edit more largefiles"
454 $ hg commit -m "add/edit more largefiles"
455 Invoking status precommit hook
455 Invoking status precommit hook
456 A sub2/large6
456 A sub2/large6
457 A sub2/large7
457 A sub2/large7
458 R large3
458 R large3
459 ? large5
459 ? large5
460 ? medium
460 ? medium
461 ? notlarge
461 ? notlarge
462 ? ratherlarge
462 ? ratherlarge
463 ? reallylarge
463 ? reallylarge
464 ? test.dat
464 ? test.dat
465 $ hg st
465 $ hg st
466 ? large3
466 ? large3
467 ? large5
467 ? large5
468 ? medium
468 ? medium
469 ? notlarge
469 ? notlarge
470 ? ratherlarge
470 ? ratherlarge
471 ? reallylarge
471 ? reallylarge
472 ? test.dat
472 ? test.dat
473
473
474 Purge with largefiles: verify that largefiles are still in the working
474 Purge with largefiles: verify that largefiles are still in the working
475 dir after a purge.
475 dir after a purge.
476
476
477 $ hg purge --all
477 $ hg purge --all
478 $ cat sub/large4
478 $ cat sub/large4
479 large44
479 large44
480 $ cat sub2/large6
480 $ cat sub2/large6
481 large6
481 large6
482 $ cat sub2/large7
482 $ cat sub2/large7
483 large7
483 large7
484
484
485 Test addremove: verify that files that should be added as largefiles are added as
485 Test addremove: verify that files that should be added as largefiles are added as
486 such and that already-existing largefiles are not added as normal files by
486 such and that already-existing largefiles are not added as normal files by
487 accident.
487 accident.
488
488
489 $ rm normal3
489 $ rm normal3
490 $ rm sub/large4
490 $ rm sub/large4
491 $ echo "testing addremove with patterns" > testaddremove.dat
491 $ echo "testing addremove with patterns" > testaddremove.dat
492 $ echo "normaladdremove" > normaladdremove
492 $ echo "normaladdremove" > normaladdremove
493 $ hg addremove
493 $ hg addremove
494 removing sub/large4
494 removing sub/large4
495 adding testaddremove.dat as a largefile
495 adding testaddremove.dat as a largefile
496 removing normal3
496 removing normal3
497 adding normaladdremove
497 adding normaladdremove
498
498
499 Test addremove with -R
499 Test addremove with -R
500
500
501 $ hg up -C
501 $ hg up -C
502 getting changed largefiles
502 getting changed largefiles
503 1 largefiles updated, 0 removed
503 1 largefiles updated, 0 removed
504 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
504 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
505 $ rm normal3
505 $ rm normal3
506 $ rm sub/large4
506 $ rm sub/large4
507 $ echo "testing addremove with patterns" > testaddremove.dat
507 $ echo "testing addremove with patterns" > testaddremove.dat
508 $ echo "normaladdremove" > normaladdremove
508 $ echo "normaladdremove" > normaladdremove
509 $ cd ..
509 $ cd ..
510 $ hg -R a -v addremove
510 $ hg -R a -v addremove
511 removing sub/large4
511 removing sub/large4
512 adding testaddremove.dat as a largefile
512 adding testaddremove.dat as a largefile
513 removing normal3
513 removing normal3
514 adding normaladdremove
514 adding normaladdremove
515 $ cd a
515 $ cd a
516
516
517 Test 3364
517 Test 3364
518 $ hg clone . ../addrm
518 $ hg clone . ../addrm
519 updating to branch default
519 updating to branch default
520 getting changed largefiles
520 getting changed largefiles
521 3 largefiles updated, 0 removed
521 3 largefiles updated, 0 removed
522 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
522 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
523 $ cd ../addrm
523 $ cd ../addrm
524 $ cat >> .hg/hgrc <<EOF
524 $ cat >> .hg/hgrc <<EOF
525 > [hooks]
525 > [hooks]
526 > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A"
526 > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A"
527 > EOF
527 > EOF
528 $ touch foo
528 $ touch foo
529 $ hg add --large foo
529 $ hg add --large foo
530 $ hg ci -m "add foo"
530 $ hg ci -m "add foo"
531 Invoking status precommit hook
531 Invoking status precommit hook
532 A foo
532 A foo
533 Invoking status postcommit hook
533 Invoking status postcommit hook
534 C foo
534 C foo
535 C normal3
535 C normal3
536 C sub/large4
536 C sub/large4
537 C sub/normal4
537 C sub/normal4
538 C sub2/large6
538 C sub2/large6
539 C sub2/large7
539 C sub2/large7
540 $ rm foo
540 $ rm foo
541 $ hg st
541 $ hg st
542 ! foo
542 ! foo
543 hmm.. no precommit invoked, but there is a postcommit??
543 hmm.. no precommit invoked, but there is a postcommit??
544 $ hg ci -m "will not checkin"
544 $ hg ci -m "will not checkin"
545 nothing changed (1 missing files, see 'hg status')
545 nothing changed (1 missing files, see 'hg status')
546 Invoking status postcommit hook
546 Invoking status postcommit hook
547 ! foo
547 ! foo
548 C normal3
548 C normal3
549 C sub/large4
549 C sub/large4
550 C sub/normal4
550 C sub/normal4
551 C sub2/large6
551 C sub2/large6
552 C sub2/large7
552 C sub2/large7
553 [1]
553 [1]
554 $ hg addremove
554 $ hg addremove
555 removing foo
555 removing foo
556 $ hg st
556 $ hg st
557 R foo
557 R foo
558 $ hg ci -m "used to say nothing changed"
558 $ hg ci -m "used to say nothing changed"
559 Invoking status precommit hook
559 Invoking status precommit hook
560 R foo
560 R foo
561 Invoking status postcommit hook
561 Invoking status postcommit hook
562 C normal3
562 C normal3
563 C sub/large4
563 C sub/large4
564 C sub/normal4
564 C sub/normal4
565 C sub2/large6
565 C sub2/large6
566 C sub2/large7
566 C sub2/large7
567 $ hg st
567 $ hg st
568
568
569 Test 3507 (both normal files and largefiles were a problem)
569 Test 3507 (both normal files and largefiles were a problem)
570
570
571 $ touch normal
571 $ touch normal
572 $ touch large
572 $ touch large
573 $ hg add normal
573 $ hg add normal
574 $ hg add --large large
574 $ hg add --large large
575 $ hg ci -m "added"
575 $ hg ci -m "added"
576 Invoking status precommit hook
576 Invoking status precommit hook
577 A large
577 A large
578 A normal
578 A normal
579 Invoking status postcommit hook
579 Invoking status postcommit hook
580 C large
580 C large
581 C normal
581 C normal
582 C normal3
582 C normal3
583 C sub/large4
583 C sub/large4
584 C sub/normal4
584 C sub/normal4
585 C sub2/large6
585 C sub2/large6
586 C sub2/large7
586 C sub2/large7
587 $ hg remove normal
587 $ hg remove normal
588 $ hg addremove --traceback
588 $ hg addremove --traceback
589 $ hg ci -m "addremoved normal"
589 $ hg ci -m "addremoved normal"
590 Invoking status precommit hook
590 Invoking status precommit hook
591 R normal
591 R normal
592 Invoking status postcommit hook
592 Invoking status postcommit hook
593 C large
593 C large
594 C normal3
594 C normal3
595 C sub/large4
595 C sub/large4
596 C sub/normal4
596 C sub/normal4
597 C sub2/large6
597 C sub2/large6
598 C sub2/large7
598 C sub2/large7
599 $ hg up -C '.^'
599 $ hg up -C '.^'
600 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
600 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
601 $ hg remove large
601 $ hg remove large
602 $ hg addremove --traceback
602 $ hg addremove --traceback
603 $ hg ci -m "removed large"
603 $ hg ci -m "removed large"
604 Invoking status precommit hook
604 Invoking status precommit hook
605 R large
605 R large
606 created new head
606 created new head
607 Invoking status postcommit hook
607 Invoking status postcommit hook
608 C normal
608 C normal
609 C normal3
609 C normal3
610 C sub/large4
610 C sub/large4
611 C sub/normal4
611 C sub/normal4
612 C sub2/large6
612 C sub2/large6
613 C sub2/large7
613 C sub2/large7
614
614
615 Test commit -A (issue3542)
615 Test commit -A (issue3542)
616 $ echo large8 > large8
616 $ echo large8 > large8
617 $ hg add --large large8
617 $ hg add --large large8
618 $ hg ci -Am 'this used to add large8 as normal and commit both'
618 $ hg ci -Am 'this used to add large8 as normal and commit both'
619 Invoking status precommit hook
619 Invoking status precommit hook
620 A large8
620 A large8
621 Invoking status postcommit hook
621 Invoking status postcommit hook
622 C large8
622 C large8
623 C normal
623 C normal
624 C normal3
624 C normal3
625 C sub/large4
625 C sub/large4
626 C sub/normal4
626 C sub/normal4
627 C sub2/large6
627 C sub2/large6
628 C sub2/large7
628 C sub2/large7
629 $ rm large8
629 $ rm large8
630 $ hg ci -Am 'this used to not notice the rm'
630 $ hg ci -Am 'this used to not notice the rm'
631 removing large8
631 removing large8
632 Invoking status precommit hook
632 Invoking status precommit hook
633 R large8
633 R large8
634 Invoking status postcommit hook
634 Invoking status postcommit hook
635 C normal
635 C normal
636 C normal3
636 C normal3
637 C sub/large4
637 C sub/large4
638 C sub/normal4
638 C sub/normal4
639 C sub2/large6
639 C sub2/large6
640 C sub2/large7
640 C sub2/large7
641
641
642 Test that a standin can't be added as a large file
642 Test that a standin can't be added as a large file
643
643
644 $ touch large
644 $ touch large
645 $ hg add --large large
645 $ hg add --large large
646 $ hg ci -m "add"
646 $ hg ci -m "add"
647 Invoking status precommit hook
647 Invoking status precommit hook
648 A large
648 A large
649 Invoking status postcommit hook
649 Invoking status postcommit hook
650 C large
650 C large
651 C normal
651 C normal
652 C normal3
652 C normal3
653 C sub/large4
653 C sub/large4
654 C sub/normal4
654 C sub/normal4
655 C sub2/large6
655 C sub2/large6
656 C sub2/large7
656 C sub2/large7
657 $ hg remove large
657 $ hg remove large
658 $ touch large
658 $ touch large
659 $ hg addremove --config largefiles.patterns=**large --traceback
659 $ hg addremove --config largefiles.patterns=**large --traceback
660 adding large as a largefile
660 adding large as a largefile
661
661
662 Test that outgoing --large works (with revsets too)
662 Test that outgoing --large works (with revsets too)
663 $ hg outgoing --rev '.^' --large
663 $ hg outgoing --rev '.^' --large
664 comparing with $TESTTMP/a
664 comparing with $TESTTMP/a
665 searching for changes
665 searching for changes
666 changeset: 8:c02fd3b77ec4
666 changeset: 8:c02fd3b77ec4
667 user: test
667 user: test
668 date: Thu Jan 01 00:00:00 1970 +0000
668 date: Thu Jan 01 00:00:00 1970 +0000
669 summary: add foo
669 summary: add foo
670
670
671 changeset: 9:289dd08c9bbb
671 changeset: 9:289dd08c9bbb
672 user: test
672 user: test
673 date: Thu Jan 01 00:00:00 1970 +0000
673 date: Thu Jan 01 00:00:00 1970 +0000
674 summary: used to say nothing changed
674 summary: used to say nothing changed
675
675
676 changeset: 10:34f23ac6ac12
676 changeset: 10:34f23ac6ac12
677 user: test
677 user: test
678 date: Thu Jan 01 00:00:00 1970 +0000
678 date: Thu Jan 01 00:00:00 1970 +0000
679 summary: added
679 summary: added
680
680
681 changeset: 12:710c1b2f523c
681 changeset: 12:710c1b2f523c
682 parent: 10:34f23ac6ac12
682 parent: 10:34f23ac6ac12
683 user: test
683 user: test
684 date: Thu Jan 01 00:00:00 1970 +0000
684 date: Thu Jan 01 00:00:00 1970 +0000
685 summary: removed large
685 summary: removed large
686
686
687 changeset: 13:0a3e75774479
687 changeset: 13:0a3e75774479
688 user: test
688 user: test
689 date: Thu Jan 01 00:00:00 1970 +0000
689 date: Thu Jan 01 00:00:00 1970 +0000
690 summary: this used to add large8 as normal and commit both
690 summary: this used to add large8 as normal and commit both
691
691
692 changeset: 14:84f3d378175c
692 changeset: 14:84f3d378175c
693 user: test
693 user: test
694 date: Thu Jan 01 00:00:00 1970 +0000
694 date: Thu Jan 01 00:00:00 1970 +0000
695 summary: this used to not notice the rm
695 summary: this used to not notice the rm
696
696
697 largefiles to upload (1 entities):
697 largefiles to upload (1 entities):
698 large8
698 large8
699
699
700 $ cd ../a
700 $ cd ../a
701
701
702 Clone a largefiles repo.
702 Clone a largefiles repo.
703
703
704 $ hg clone . ../b
704 $ hg clone . ../b
705 updating to branch default
705 updating to branch default
706 getting changed largefiles
706 getting changed largefiles
707 3 largefiles updated, 0 removed
707 3 largefiles updated, 0 removed
708 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
708 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
709 $ cd ../b
709 $ cd ../b
710 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
710 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
711 7:daea875e9014 add/edit more largefiles
711 7:daea875e9014 add/edit more largefiles
712 6:4355d653f84f edit files yet again
712 6:4355d653f84f edit files yet again
713 5:9d5af5072dbd edit files again
713 5:9d5af5072dbd edit files again
714 4:74c02385b94c move files
714 4:74c02385b94c move files
715 3:9e8fbc4bce62 copy files
715 3:9e8fbc4bce62 copy files
716 2:51a0ae4d5864 remove files
716 2:51a0ae4d5864 remove files
717 1:ce8896473775 edit files
717 1:ce8896473775 edit files
718 0:30d30fe6a5be add files
718 0:30d30fe6a5be add files
719 $ cat normal3
719 $ cat normal3
720 normal33
720 normal33
721
721
722 Test graph log
722 Test graph log
723
723
724 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
724 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
725 @ 7:daea875e9014 add/edit more largefiles
725 @ 7:daea875e9014 add/edit more largefiles
726 |
726 |
727 o 6:4355d653f84f edit files yet again
727 o 6:4355d653f84f edit files yet again
728 |
728 |
729 o 5:9d5af5072dbd edit files again
729 o 5:9d5af5072dbd edit files again
730 |
730 |
731 o 4:74c02385b94c move files
731 o 4:74c02385b94c move files
732 |
732 |
733 o 3:9e8fbc4bce62 copy files
733 o 3:9e8fbc4bce62 copy files
734 |
734 |
735 o 2:51a0ae4d5864 remove files
735 o 2:51a0ae4d5864 remove files
736 |
736 |
737 o 1:ce8896473775 edit files
737 o 1:ce8896473775 edit files
738 |
738 |
739 o 0:30d30fe6a5be add files
739 o 0:30d30fe6a5be add files
740
740
741
741
742 Test log with --patch
742 Test log with --patch
743
743
744 $ hg log --patch -r 6::7
744 $ hg log --patch -r 6::7
745 changeset: 6:4355d653f84f
745 changeset: 6:4355d653f84f
746 user: test
746 user: test
747 date: Thu Jan 01 00:00:00 1970 +0000
747 date: Thu Jan 01 00:00:00 1970 +0000
748 summary: edit files yet again
748 summary: edit files yet again
749
749
750 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3
750 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3
751 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
751 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
752 +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
752 +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
753 @@ -1,1 +1,1 @@
753 @@ -1,1 +1,1 @@
754 -baaf12afde9d8d67f25dab6dced0d2bf77dba47c
754 -baaf12afde9d8d67f25dab6dced0d2bf77dba47c
755 +7838695e10da2bb75ac1156565f40a2595fa2fa0
755 +7838695e10da2bb75ac1156565f40a2595fa2fa0
756 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
756 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
757 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
757 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
758 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
758 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
759 @@ -1,1 +1,1 @@
759 @@ -1,1 +1,1 @@
760 -aeb2210d19f02886dde00dac279729a48471e2f9
760 -aeb2210d19f02886dde00dac279729a48471e2f9
761 +971fb41e78fea4f8e0ba5244784239371cb00591
761 +971fb41e78fea4f8e0ba5244784239371cb00591
762 diff -r 9d5af5072dbd -r 4355d653f84f normal3
762 diff -r 9d5af5072dbd -r 4355d653f84f normal3
763 --- a/normal3 Thu Jan 01 00:00:00 1970 +0000
763 --- a/normal3 Thu Jan 01 00:00:00 1970 +0000
764 +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000
764 +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000
765 @@ -1,1 +1,1 @@
765 @@ -1,1 +1,1 @@
766 -normal3
766 -normal3
767 +normal33
767 +normal33
768 diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4
768 diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4
769 --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
769 --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
770 +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
770 +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
771 @@ -1,1 +1,1 @@
771 @@ -1,1 +1,1 @@
772 -normal4
772 -normal4
773 +normal44
773 +normal44
774
774
775 changeset: 7:daea875e9014
775 changeset: 7:daea875e9014
776 tag: tip
776 tag: tip
777 user: test
777 user: test
778 date: Thu Jan 01 00:00:00 1970 +0000
778 date: Thu Jan 01 00:00:00 1970 +0000
779 summary: add/edit more largefiles
779 summary: add/edit more largefiles
780
780
781 diff -r 4355d653f84f -r daea875e9014 .hglf/large3
781 diff -r 4355d653f84f -r daea875e9014 .hglf/large3
782 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
782 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
783 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
783 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
784 @@ -1,1 +0,0 @@
784 @@ -1,1 +0,0 @@
785 -7838695e10da2bb75ac1156565f40a2595fa2fa0
785 -7838695e10da2bb75ac1156565f40a2595fa2fa0
786 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6
786 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6
787 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
787 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
788 +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000
788 +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000
789 @@ -0,0 +1,1 @@
789 @@ -0,0 +1,1 @@
790 +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30
790 +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30
791 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7
791 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7
792 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
792 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
793 +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000
793 +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000
794 @@ -0,0 +1,1 @@
794 @@ -0,0 +1,1 @@
795 +bb3151689acb10f0c3125c560d5e63df914bc1af
795 +bb3151689acb10f0c3125c560d5e63df914bc1af
796
796
797
797
798 $ hg log --patch -r 6::7 sub/
798 $ hg log --patch -r 6::7 sub/
799 changeset: 6:4355d653f84f
799 changeset: 6:4355d653f84f
800 user: test
800 user: test
801 date: Thu Jan 01 00:00:00 1970 +0000
801 date: Thu Jan 01 00:00:00 1970 +0000
802 summary: edit files yet again
802 summary: edit files yet again
803
803
804 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
804 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
805 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
805 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
806 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
806 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
807 @@ -1,1 +1,1 @@
807 @@ -1,1 +1,1 @@
808 -aeb2210d19f02886dde00dac279729a48471e2f9
808 -aeb2210d19f02886dde00dac279729a48471e2f9
809 +971fb41e78fea4f8e0ba5244784239371cb00591
809 +971fb41e78fea4f8e0ba5244784239371cb00591
810 diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4
810 diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4
811 --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
811 --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
812 +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
812 +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
813 @@ -1,1 +1,1 @@
813 @@ -1,1 +1,1 @@
814 -normal4
814 -normal4
815 +normal44
815 +normal44
816
816
817
817
818 log with both --follow and --patch
818 log with both --follow and --patch
819
819
820 $ hg log --follow --patch --limit 2
820 $ hg log --follow --patch --limit 2
821 changeset: 7:daea875e9014
821 changeset: 7:daea875e9014
822 tag: tip
822 tag: tip
823 user: test
823 user: test
824 date: Thu Jan 01 00:00:00 1970 +0000
824 date: Thu Jan 01 00:00:00 1970 +0000
825 summary: add/edit more largefiles
825 summary: add/edit more largefiles
826
826
827 diff -r 4355d653f84f -r daea875e9014 .hglf/large3
827 diff -r 4355d653f84f -r daea875e9014 .hglf/large3
828 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
828 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
829 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
829 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
830 @@ -1,1 +0,0 @@
830 @@ -1,1 +0,0 @@
831 -7838695e10da2bb75ac1156565f40a2595fa2fa0
831 -7838695e10da2bb75ac1156565f40a2595fa2fa0
832 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6
832 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6
833 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
833 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
834 +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000
834 +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000
835 @@ -0,0 +1,1 @@
835 @@ -0,0 +1,1 @@
836 +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30
836 +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30
837 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7
837 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7
838 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
838 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
839 +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000
839 +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000
840 @@ -0,0 +1,1 @@
840 @@ -0,0 +1,1 @@
841 +bb3151689acb10f0c3125c560d5e63df914bc1af
841 +bb3151689acb10f0c3125c560d5e63df914bc1af
842
842
843 changeset: 6:4355d653f84f
843 changeset: 6:4355d653f84f
844 user: test
844 user: test
845 date: Thu Jan 01 00:00:00 1970 +0000
845 date: Thu Jan 01 00:00:00 1970 +0000
846 summary: edit files yet again
846 summary: edit files yet again
847
847
848 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3
848 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3
849 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
849 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
850 +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
850 +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
851 @@ -1,1 +1,1 @@
851 @@ -1,1 +1,1 @@
852 -baaf12afde9d8d67f25dab6dced0d2bf77dba47c
852 -baaf12afde9d8d67f25dab6dced0d2bf77dba47c
853 +7838695e10da2bb75ac1156565f40a2595fa2fa0
853 +7838695e10da2bb75ac1156565f40a2595fa2fa0
854 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
854 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
855 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
855 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
856 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
856 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
857 @@ -1,1 +1,1 @@
857 @@ -1,1 +1,1 @@
858 -aeb2210d19f02886dde00dac279729a48471e2f9
858 -aeb2210d19f02886dde00dac279729a48471e2f9
859 +971fb41e78fea4f8e0ba5244784239371cb00591
859 +971fb41e78fea4f8e0ba5244784239371cb00591
860 diff -r 9d5af5072dbd -r 4355d653f84f normal3
860 diff -r 9d5af5072dbd -r 4355d653f84f normal3
861 --- a/normal3 Thu Jan 01 00:00:00 1970 +0000
861 --- a/normal3 Thu Jan 01 00:00:00 1970 +0000
862 +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000
862 +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000
863 @@ -1,1 +1,1 @@
863 @@ -1,1 +1,1 @@
864 -normal3
864 -normal3
865 +normal33
865 +normal33
866 diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4
866 diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4
867 --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
867 --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
868 +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
868 +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
869 @@ -1,1 +1,1 @@
869 @@ -1,1 +1,1 @@
870 -normal4
870 -normal4
871 +normal44
871 +normal44
872
872
873 $ hg log --follow --patch sub/large4
873 $ hg log --follow --patch sub/large4
874 changeset: 6:4355d653f84f
874 changeset: 6:4355d653f84f
875 user: test
875 user: test
876 date: Thu Jan 01 00:00:00 1970 +0000
876 date: Thu Jan 01 00:00:00 1970 +0000
877 summary: edit files yet again
877 summary: edit files yet again
878
878
879 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
879 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
880 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
880 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
881 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
881 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
882 @@ -1,1 +1,1 @@
882 @@ -1,1 +1,1 @@
883 -aeb2210d19f02886dde00dac279729a48471e2f9
883 -aeb2210d19f02886dde00dac279729a48471e2f9
884 +971fb41e78fea4f8e0ba5244784239371cb00591
884 +971fb41e78fea4f8e0ba5244784239371cb00591
885
885
886 changeset: 5:9d5af5072dbd
886 changeset: 5:9d5af5072dbd
887 user: test
887 user: test
888 date: Thu Jan 01 00:00:00 1970 +0000
888 date: Thu Jan 01 00:00:00 1970 +0000
889 summary: edit files again
889 summary: edit files again
890
890
891 diff -r 74c02385b94c -r 9d5af5072dbd .hglf/sub/large4
891 diff -r 74c02385b94c -r 9d5af5072dbd .hglf/sub/large4
892 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
892 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
893 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
893 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
894 @@ -1,1 +1,1 @@
894 @@ -1,1 +1,1 @@
895 -eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
895 -eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
896 +aeb2210d19f02886dde00dac279729a48471e2f9
896 +aeb2210d19f02886dde00dac279729a48471e2f9
897
897
898 changeset: 4:74c02385b94c
898 changeset: 4:74c02385b94c
899 user: test
899 user: test
900 date: Thu Jan 01 00:00:00 1970 +0000
900 date: Thu Jan 01 00:00:00 1970 +0000
901 summary: move files
901 summary: move files
902
902
903 diff -r 9e8fbc4bce62 -r 74c02385b94c .hglf/sub/large4
903 diff -r 9e8fbc4bce62 -r 74c02385b94c .hglf/sub/large4
904 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
904 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
905 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
905 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
906 @@ -0,0 +1,1 @@
906 @@ -0,0 +1,1 @@
907 +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
907 +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
908
908
909 changeset: 1:ce8896473775
909 changeset: 1:ce8896473775
910 user: test
910 user: test
911 date: Thu Jan 01 00:00:00 1970 +0000
911 date: Thu Jan 01 00:00:00 1970 +0000
912 summary: edit files
912 summary: edit files
913
913
914 diff -r 30d30fe6a5be -r ce8896473775 .hglf/sub/large2
914 diff -r 30d30fe6a5be -r ce8896473775 .hglf/sub/large2
915 --- a/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000
915 --- a/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000
916 +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000
916 +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000
917 @@ -1,1 +1,1 @@
917 @@ -1,1 +1,1 @@
918 -1deebade43c8c498a3c8daddac0244dc55d1331d
918 -1deebade43c8c498a3c8daddac0244dc55d1331d
919 +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
919 +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
920
920
921 changeset: 0:30d30fe6a5be
921 changeset: 0:30d30fe6a5be
922 user: test
922 user: test
923 date: Thu Jan 01 00:00:00 1970 +0000
923 date: Thu Jan 01 00:00:00 1970 +0000
924 summary: add files
924 summary: add files
925
925
926 diff -r 000000000000 -r 30d30fe6a5be .hglf/sub/large2
926 diff -r 000000000000 -r 30d30fe6a5be .hglf/sub/large2
927 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
927 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
928 +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000
928 +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000
929 @@ -0,0 +1,1 @@
929 @@ -0,0 +1,1 @@
930 +1deebade43c8c498a3c8daddac0244dc55d1331d
930 +1deebade43c8c498a3c8daddac0244dc55d1331d
931
931
932 $ cat sub/normal4
932 $ cat sub/normal4
933 normal44
933 normal44
934 $ cat sub/large4
934 $ cat sub/large4
935 large44
935 large44
936 $ cat sub2/large6
936 $ cat sub2/large6
937 large6
937 large6
938 $ cat sub2/large7
938 $ cat sub2/large7
939 large7
939 large7
940 $ hg log -qf sub2/large7
940 $ hg log -qf sub2/large7
941 7:daea875e9014
941 7:daea875e9014
942 $ hg log -Gqf sub2/large7
942 $ hg log -Gqf sub2/large7
943 @ 7:daea875e9014
943 @ 7:daea875e9014
944 |
944 |
945 ~
945 ~
946 $ cd ..
946 $ cd ..
947
947
948 Test log from outside repo
948 Test log from outside repo
949
949
950 $ hg log b/sub -T '{rev}:{node|short} {desc|firstline}\n'
950 $ hg log b/sub -T '{rev}:{node|short} {desc|firstline}\n'
951 6:4355d653f84f edit files yet again
951 6:4355d653f84f edit files yet again
952 5:9d5af5072dbd edit files again
952 5:9d5af5072dbd edit files again
953 4:74c02385b94c move files
953 4:74c02385b94c move files
954 1:ce8896473775 edit files
954 1:ce8896473775 edit files
955 0:30d30fe6a5be add files
955 0:30d30fe6a5be add files
956
956
957 Test clone at revision
957 Test clone at revision
958
958
959 $ hg clone a -r 3 c
959 $ hg clone a -r 3 c
960 adding changesets
960 adding changesets
961 adding manifests
961 adding manifests
962 adding file changes
962 adding file changes
963 added 4 changesets with 10 changes to 4 files
963 added 4 changesets with 10 changes to 4 files
964 new changesets 30d30fe6a5be:9e8fbc4bce62
964 new changesets 30d30fe6a5be:9e8fbc4bce62
965 updating to branch default
965 updating to branch default
966 getting changed largefiles
966 getting changed largefiles
967 2 largefiles updated, 0 removed
967 2 largefiles updated, 0 removed
968 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
968 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
969 $ cd c
969 $ cd c
970 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
970 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
971 3:9e8fbc4bce62 copy files
971 3:9e8fbc4bce62 copy files
972 2:51a0ae4d5864 remove files
972 2:51a0ae4d5864 remove files
973 1:ce8896473775 edit files
973 1:ce8896473775 edit files
974 0:30d30fe6a5be add files
974 0:30d30fe6a5be add files
975 $ cat normal1
975 $ cat normal1
976 normal22
976 normal22
977 $ cat large1
977 $ cat large1
978 large22
978 large22
979 $ cat sub/normal2
979 $ cat sub/normal2
980 normal22
980 normal22
981 $ cat sub/large2
981 $ cat sub/large2
982 large22
982 large22
983
983
984 Old revisions of a clone have correct largefiles content (this also
984 Old revisions of a clone have correct largefiles content (this also
985 tests update).
985 tests update).
986
986
987 $ hg update -r 1
987 $ hg update -r 1
988 getting changed largefiles
988 getting changed largefiles
989 1 largefiles updated, 0 removed
989 1 largefiles updated, 0 removed
990 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
990 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
991 $ cat large1
991 $ cat large1
992 large11
992 large11
993 $ cat sub/large2
993 $ cat sub/large2
994 large22
994 large22
995 $ cd ..
995 $ cd ..
996
996
997 Test cloning with --all-largefiles flag
997 Test cloning with --all-largefiles flag
998
998
999 $ rm "${USERCACHE}"/*
999 $ rm "${USERCACHE}"/*
1000 $ hg clone --all-largefiles a a-backup
1000 $ hg clone --all-largefiles a a-backup
1001 updating to branch default
1001 updating to branch default
1002 getting changed largefiles
1002 getting changed largefiles
1003 3 largefiles updated, 0 removed
1003 3 largefiles updated, 0 removed
1004 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1004 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1005 8 additional largefiles cached
1005 8 additional largefiles cached
1006
1006
1007 $ rm "${USERCACHE}"/*
1007 $ rm "${USERCACHE}"/*
1008 $ hg clone --all-largefiles -u 0 a a-clone0
1008 $ hg clone --all-largefiles -u 0 a a-clone0
1009 updating to branch default
1009 updating to branch default
1010 getting changed largefiles
1010 getting changed largefiles
1011 2 largefiles updated, 0 removed
1011 2 largefiles updated, 0 removed
1012 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1012 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1013 9 additional largefiles cached
1013 9 additional largefiles cached
1014 $ hg -R a-clone0 sum
1014 $ hg -R a-clone0 sum
1015 parent: 0:30d30fe6a5be
1015 parent: 0:30d30fe6a5be
1016 add files
1016 add files
1017 branch: default
1017 branch: default
1018 commit: (clean)
1018 commit: (clean)
1019 update: 7 new changesets (update)
1019 update: 7 new changesets (update)
1020 phases: 8 draft
1020 phases: 8 draft
1021
1021
1022 $ rm "${USERCACHE}"/*
1022 $ rm "${USERCACHE}"/*
1023 $ hg clone --all-largefiles -u 1 a a-clone1
1023 $ hg clone --all-largefiles -u 1 a a-clone1
1024 updating to branch default
1024 updating to branch default
1025 getting changed largefiles
1025 getting changed largefiles
1026 2 largefiles updated, 0 removed
1026 2 largefiles updated, 0 removed
1027 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1027 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1028 8 additional largefiles cached
1028 8 additional largefiles cached
1029 $ hg -R a-clone1 verify --large --lfa --lfc
1029 $ hg -R a-clone1 verify --large --lfa --lfc
1030 checking changesets
1030 checking changesets
1031 checking manifests
1031 checking manifests
1032 crosschecking files in changesets and manifests
1032 crosschecking files in changesets and manifests
1033 checking files
1033 checking files
1034 10 files, 8 changesets, 24 total revisions
1034 10 files, 8 changesets, 24 total revisions
1035 searching 8 changesets for largefiles
1035 searching 8 changesets for largefiles
1036 verified contents of 13 revisions of 6 largefiles
1036 verified contents of 13 revisions of 6 largefiles
1037 $ hg -R a-clone1 sum
1037 $ hg -R a-clone1 sum
1038 parent: 1:ce8896473775
1038 parent: 1:ce8896473775
1039 edit files
1039 edit files
1040 branch: default
1040 branch: default
1041 commit: (clean)
1041 commit: (clean)
1042 update: 6 new changesets (update)
1042 update: 6 new changesets (update)
1043 phases: 8 draft
1043 phases: 8 draft
1044
1044
1045 $ rm "${USERCACHE}"/*
1045 $ rm "${USERCACHE}"/*
1046 $ hg clone --all-largefiles -U a a-clone-u
1046 $ hg clone --all-largefiles -U a a-clone-u
1047 11 additional largefiles cached
1047 11 additional largefiles cached
1048 $ hg -R a-clone-u sum
1048 $ hg -R a-clone-u sum
1049 parent: -1:000000000000 (no revision checked out)
1049 parent: -1:000000000000 (no revision checked out)
1050 branch: default
1050 branch: default
1051 commit: (clean)
1051 commit: (clean)
1052 update: 8 new changesets (update)
1052 update: 8 new changesets (update)
1053 phases: 8 draft
1053 phases: 8 draft
1054
1054
1055 Show computed destination directory:
1055 Show computed destination directory:
1056
1056
1057 $ mkdir xyz
1057 $ mkdir xyz
1058 $ cd xyz
1058 $ cd xyz
1059 $ hg clone ../a
1059 $ hg clone ../a
1060 destination directory: a
1060 destination directory: a
1061 updating to branch default
1061 updating to branch default
1062 getting changed largefiles
1062 getting changed largefiles
1063 3 largefiles updated, 0 removed
1063 3 largefiles updated, 0 removed
1064 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1064 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1065 $ cd ..
1065 $ cd ..
1066
1066
1067 Clone URL without path:
1067 Clone URL without path:
1068
1068
1069 $ hg clone file://
1069 $ hg clone file://
1070 abort: repository / not found!
1070 abort: repository / not found!
1071 [255]
1071 [255]
1072
1072
1073 Ensure base clone command argument validation
1073 Ensure base clone command argument validation
1074
1074
1075 $ hg clone -U -u 0 a a-clone-failure
1075 $ hg clone -U -u 0 a a-clone-failure
1076 abort: cannot specify both --noupdate and --updaterev
1076 abort: cannot specify both --noupdate and --updaterev
1077 [255]
1077 [255]
1078
1078
1079 $ hg clone --all-largefiles a ssh://localhost/a
1079 $ hg clone --all-largefiles a ssh://localhost/a
1080 abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a
1080 abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a
1081 [255]
1081 [255]
1082
1082
1083 Test pulling with --all-largefiles flag. Also test that the largefiles are
1083 Test pulling with --all-largefiles flag. Also test that the largefiles are
1084 downloaded from 'default' instead of 'default-push' when no source is specified
1084 downloaded from 'default' instead of 'default-push' when no source is specified
1085 (issue3584)
1085 (issue3584)
1086
1086
1087 $ rm -Rf a-backup
1087 $ rm -Rf a-backup
1088 $ hg clone -r 1 a a-backup
1088 $ hg clone -r 1 a a-backup
1089 adding changesets
1089 adding changesets
1090 adding manifests
1090 adding manifests
1091 adding file changes
1091 adding file changes
1092 added 2 changesets with 8 changes to 4 files
1092 added 2 changesets with 8 changes to 4 files
1093 new changesets 30d30fe6a5be:ce8896473775
1093 new changesets 30d30fe6a5be:ce8896473775
1094 updating to branch default
1094 updating to branch default
1095 getting changed largefiles
1095 getting changed largefiles
1096 2 largefiles updated, 0 removed
1096 2 largefiles updated, 0 removed
1097 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1097 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1098 $ rm "${USERCACHE}"/*
1098 $ rm "${USERCACHE}"/*
1099 $ cd a-backup
1099 $ cd a-backup
1100 $ hg pull --all-largefiles --config paths.default-push=bogus/path
1100 $ hg pull --all-largefiles --config paths.default-push=bogus/path
1101 pulling from $TESTTMP/a
1101 pulling from $TESTTMP/a
1102 searching for changes
1102 searching for changes
1103 adding changesets
1103 adding changesets
1104 adding manifests
1104 adding manifests
1105 adding file changes
1105 adding file changes
1106 added 6 changesets with 16 changes to 8 files
1106 added 6 changesets with 16 changes to 8 files
1107 new changesets 51a0ae4d5864:daea875e9014
1107 new changesets 51a0ae4d5864:daea875e9014
1108 (run 'hg update' to get a working copy)
1108 (run 'hg update' to get a working copy)
1109 6 largefiles cached
1109 6 largefiles cached
1110
1110
1111 redo pull with --lfrev and check it pulls largefiles for the right revs
1111 redo pull with --lfrev and check it pulls largefiles for the right revs
1112
1112
1113 $ hg rollback
1113 $ hg rollback
1114 repository tip rolled back to revision 1 (undo pull)
1114 repository tip rolled back to revision 1 (undo pull)
1115 $ hg pull -v --lfrev 'heads(pulled())+min(pulled())'
1115 $ hg pull -v --lfrev 'heads(pulled())+min(pulled())'
1116 pulling from $TESTTMP/a
1116 pulling from $TESTTMP/a
1117 searching for changes
1117 searching for changes
1118 all local heads known remotely
1118 all local heads known remotely
1119 6 changesets found
1119 6 changesets found
1120 uncompressed size of bundle content:
1120 uncompressed size of bundle content:
1121 1389 (changelog)
1121 1389 (changelog)
1122 1599 (manifests)
1122 1599 (manifests)
1123 254 .hglf/large1
1123 254 .hglf/large1
1124 564 .hglf/large3
1124 564 .hglf/large3
1125 572 .hglf/sub/large4
1125 572 .hglf/sub/large4
1126 182 .hglf/sub2/large6
1126 182 .hglf/sub2/large6
1127 182 .hglf/sub2/large7
1127 182 .hglf/sub2/large7
1128 212 normal1
1128 212 normal1
1129 457 normal3
1129 457 normal3
1130 465 sub/normal4
1130 465 sub/normal4
1131 adding changesets
1131 adding changesets
1132 adding manifests
1132 adding manifests
1133 adding file changes
1133 adding file changes
1134 added 6 changesets with 16 changes to 8 files
1134 added 6 changesets with 16 changes to 8 files
1135 new changesets 51a0ae4d5864:daea875e9014
1135 new changesets 51a0ae4d5864:daea875e9014
1136 calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles
1136 calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles
1137 (run 'hg update' to get a working copy)
1137 (run 'hg update' to get a working copy)
1138 pulling largefiles for revision 7
1138 pulling largefiles for revision 7
1139 found 971fb41e78fea4f8e0ba5244784239371cb00591 in store
1139 found 971fb41e78fea4f8e0ba5244784239371cb00591 in store
1140 found 0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 in store
1140 found 0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 in store
1141 found bb3151689acb10f0c3125c560d5e63df914bc1af in store
1141 found bb3151689acb10f0c3125c560d5e63df914bc1af in store
1142 pulling largefiles for revision 2
1142 pulling largefiles for revision 2
1143 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1143 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1144 0 largefiles cached
1144 0 largefiles cached
1145
1145
1146 lfpull
1146 lfpull
1147
1147
1148 $ hg lfpull -r : --config largefiles.usercache=usercache-lfpull
1148 $ hg lfpull -r : --config largefiles.usercache=usercache-lfpull
1149 2 largefiles cached
1149 2 largefiles cached
1150 $ hg lfpull -v -r 4+2 --config largefiles.usercache=usercache-lfpull
1150 $ hg lfpull -v -r 4+2 --config largefiles.usercache=usercache-lfpull
1151 pulling largefiles for revision 4
1151 pulling largefiles for revision 4
1152 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1152 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1153 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1153 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1154 pulling largefiles for revision 2
1154 pulling largefiles for revision 2
1155 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1155 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1156 0 largefiles cached
1156 0 largefiles cached
1157
1157
1158 $ ls usercache-lfpull/* | sort
1158 $ ls usercache-lfpull/* | sort
1159 usercache-lfpull/1deebade43c8c498a3c8daddac0244dc55d1331d
1159 usercache-lfpull/1deebade43c8c498a3c8daddac0244dc55d1331d
1160 usercache-lfpull/4669e532d5b2c093a78eca010077e708a071bb64
1160 usercache-lfpull/4669e532d5b2c093a78eca010077e708a071bb64
1161
1161
1162 $ cd ..
1162 $ cd ..
1163
1163
1164 Rebasing between two repositories does not revert largefiles to old
1164 Rebasing between two repositories does not revert largefiles to old
1165 revisions (this was a very bad bug that took a lot of work to fix).
1165 revisions (this was a very bad bug that took a lot of work to fix).
1166
1166
1167 $ hg clone a d
1167 $ hg clone a d
1168 updating to branch default
1168 updating to branch default
1169 getting changed largefiles
1169 getting changed largefiles
1170 3 largefiles updated, 0 removed
1170 3 largefiles updated, 0 removed
1171 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1171 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1172 $ cd b
1172 $ cd b
1173 $ echo large4-modified > sub/large4
1173 $ echo large4-modified > sub/large4
1174 $ echo normal3-modified > normal3
1174 $ echo normal3-modified > normal3
1175 $ hg commit -m "modify normal file and largefile in repo b"
1175 $ hg commit -m "modify normal file and largefile in repo b"
1176 Invoking status precommit hook
1176 Invoking status precommit hook
1177 M normal3
1177 M normal3
1178 M sub/large4
1178 M sub/large4
1179 $ cd ../d
1179 $ cd ../d
1180 $ echo large6-modified > sub2/large6
1180 $ echo large6-modified > sub2/large6
1181 $ echo normal4-modified > sub/normal4
1181 $ echo normal4-modified > sub/normal4
1182 $ hg commit -m "modify normal file largefile in repo d"
1182 $ hg commit -m "modify normal file largefile in repo d"
1183 Invoking status precommit hook
1183 Invoking status precommit hook
1184 M sub/normal4
1184 M sub/normal4
1185 M sub2/large6
1185 M sub2/large6
1186 $ cd ..
1186 $ cd ..
1187 $ hg clone d e
1187 $ hg clone d e
1188 updating to branch default
1188 updating to branch default
1189 getting changed largefiles
1189 getting changed largefiles
1190 3 largefiles updated, 0 removed
1190 3 largefiles updated, 0 removed
1191 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1191 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1192 $ cd d
1192 $ cd d
1193
1193
1194 More rebase testing, but also test that the largefiles are downloaded from
1194 More rebase testing, but also test that the largefiles are downloaded from
1195 'default-push' when no source is specified (issue3584). (The largefile from the
1195 'default-push' when no source is specified (issue3584). (The largefile from the
1196 pulled revision is however not downloaded but found in the local cache.)
1196 pulled revision is however not downloaded but found in the local cache.)
1197 Largefiles are fetched for the new pulled revision, not for existing revisions,
1197 Largefiles are fetched for the new pulled revision, not for existing revisions,
1198 rebased or not.
1198 rebased or not.
1199
1199
1200 $ [ ! -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
1200 $ [ ! -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
1201 $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b
1201 $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b
1202 pulling from $TESTTMP/b
1202 pulling from $TESTTMP/b
1203 searching for changes
1203 searching for changes
1204 adding changesets
1204 adding changesets
1205 adding manifests
1205 adding manifests
1206 adding file changes
1206 adding file changes
1207 added 1 changesets with 2 changes to 2 files (+1 heads)
1207 added 1 changesets with 2 changes to 2 files (+1 heads)
1208 new changesets a381d2c8c80e
1208 new changesets a381d2c8c80e
1209 rebasing 8:f574fb32bb45 "modify normal file largefile in repo d"
1209 rebasing 8:f574fb32bb45 "modify normal file largefile in repo d"
1210 Invoking status precommit hook
1210 Invoking status precommit hook
1211 M sub/normal4
1211 M sub/normal4
1212 M sub2/large6
1212 M sub2/large6
1213 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-dd1d9f80-rebase.hg
1213 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-dd1d9f80-rebase.hg
1214 0 largefiles cached
1214 0 largefiles cached
1215 $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
1215 $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
1216 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1216 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1217 9:598410d3eb9a modify normal file largefile in repo d
1217 9:598410d3eb9a modify normal file largefile in repo d
1218 8:a381d2c8c80e modify normal file and largefile in repo b
1218 8:a381d2c8c80e modify normal file and largefile in repo b
1219 7:daea875e9014 add/edit more largefiles
1219 7:daea875e9014 add/edit more largefiles
1220 6:4355d653f84f edit files yet again
1220 6:4355d653f84f edit files yet again
1221 5:9d5af5072dbd edit files again
1221 5:9d5af5072dbd edit files again
1222 4:74c02385b94c move files
1222 4:74c02385b94c move files
1223 3:9e8fbc4bce62 copy files
1223 3:9e8fbc4bce62 copy files
1224 2:51a0ae4d5864 remove files
1224 2:51a0ae4d5864 remove files
1225 1:ce8896473775 edit files
1225 1:ce8896473775 edit files
1226 0:30d30fe6a5be add files
1226 0:30d30fe6a5be add files
1227 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
1227 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
1228 @ 9:598410d3eb9a modify normal file largefile in repo d
1228 @ 9:598410d3eb9a modify normal file largefile in repo d
1229 |
1229 |
1230 o 8:a381d2c8c80e modify normal file and largefile in repo b
1230 o 8:a381d2c8c80e modify normal file and largefile in repo b
1231 |
1231 |
1232 o 7:daea875e9014 add/edit more largefiles
1232 o 7:daea875e9014 add/edit more largefiles
1233 |
1233 |
1234 o 6:4355d653f84f edit files yet again
1234 o 6:4355d653f84f edit files yet again
1235 |
1235 |
1236 o 5:9d5af5072dbd edit files again
1236 o 5:9d5af5072dbd edit files again
1237 |
1237 |
1238 o 4:74c02385b94c move files
1238 o 4:74c02385b94c move files
1239 |
1239 |
1240 o 3:9e8fbc4bce62 copy files
1240 o 3:9e8fbc4bce62 copy files
1241 |
1241 |
1242 o 2:51a0ae4d5864 remove files
1242 o 2:51a0ae4d5864 remove files
1243 |
1243 |
1244 o 1:ce8896473775 edit files
1244 o 1:ce8896473775 edit files
1245 |
1245 |
1246 o 0:30d30fe6a5be add files
1246 o 0:30d30fe6a5be add files
1247
1247
1248 $ cat normal3
1248 $ cat normal3
1249 normal3-modified
1249 normal3-modified
1250 $ cat sub/normal4
1250 $ cat sub/normal4
1251 normal4-modified
1251 normal4-modified
1252 $ cat sub/large4
1252 $ cat sub/large4
1253 large4-modified
1253 large4-modified
1254 $ cat sub2/large6
1254 $ cat sub2/large6
1255 large6-modified
1255 large6-modified
1256 $ cat sub2/large7
1256 $ cat sub2/large7
1257 large7
1257 large7
1258 $ cd ../e
1258 $ cd ../e
1259 $ hg pull ../b
1259 $ hg pull ../b
1260 pulling from ../b
1260 pulling from ../b
1261 searching for changes
1261 searching for changes
1262 adding changesets
1262 adding changesets
1263 adding manifests
1263 adding manifests
1264 adding file changes
1264 adding file changes
1265 added 1 changesets with 2 changes to 2 files (+1 heads)
1265 added 1 changesets with 2 changes to 2 files (+1 heads)
1266 new changesets a381d2c8c80e
1266 new changesets a381d2c8c80e
1267 (run 'hg heads' to see heads, 'hg merge' to merge)
1267 (run 'hg heads' to see heads, 'hg merge' to merge)
1268 $ hg rebase
1268 $ hg rebase
1269 rebasing 8:f574fb32bb45 "modify normal file largefile in repo d"
1269 rebasing 8:f574fb32bb45 "modify normal file largefile in repo d"
1270 Invoking status precommit hook
1270 Invoking status precommit hook
1271 M sub/normal4
1271 M sub/normal4
1272 M sub2/large6
1272 M sub2/large6
1273 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-dd1d9f80-rebase.hg
1273 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-dd1d9f80-rebase.hg
1274 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1274 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1275 9:598410d3eb9a modify normal file largefile in repo d
1275 9:598410d3eb9a modify normal file largefile in repo d
1276 8:a381d2c8c80e modify normal file and largefile in repo b
1276 8:a381d2c8c80e modify normal file and largefile in repo b
1277 7:daea875e9014 add/edit more largefiles
1277 7:daea875e9014 add/edit more largefiles
1278 6:4355d653f84f edit files yet again
1278 6:4355d653f84f edit files yet again
1279 5:9d5af5072dbd edit files again
1279 5:9d5af5072dbd edit files again
1280 4:74c02385b94c move files
1280 4:74c02385b94c move files
1281 3:9e8fbc4bce62 copy files
1281 3:9e8fbc4bce62 copy files
1282 2:51a0ae4d5864 remove files
1282 2:51a0ae4d5864 remove files
1283 1:ce8896473775 edit files
1283 1:ce8896473775 edit files
1284 0:30d30fe6a5be add files
1284 0:30d30fe6a5be add files
1285 $ cat normal3
1285 $ cat normal3
1286 normal3-modified
1286 normal3-modified
1287 $ cat sub/normal4
1287 $ cat sub/normal4
1288 normal4-modified
1288 normal4-modified
1289 $ cat sub/large4
1289 $ cat sub/large4
1290 large4-modified
1290 large4-modified
1291 $ cat sub2/large6
1291 $ cat sub2/large6
1292 large6-modified
1292 large6-modified
1293 $ cat sub2/large7
1293 $ cat sub2/large7
1294 large7
1294 large7
1295
1295
1296 Log on largefiles
1296 Log on largefiles
1297
1297
1298 - same output
1298 - same output
1299 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1299 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1300 8:a381d2c8c80e modify normal file and largefile in repo b
1300 8:a381d2c8c80e modify normal file and largefile in repo b
1301 6:4355d653f84f edit files yet again
1301 6:4355d653f84f edit files yet again
1302 5:9d5af5072dbd edit files again
1302 5:9d5af5072dbd edit files again
1303 4:74c02385b94c move files
1303 4:74c02385b94c move files
1304 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1304 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1305 o 8:a381d2c8c80e modify normal file and largefile in repo b
1305 o 8:a381d2c8c80e modify normal file and largefile in repo b
1306 :
1306 :
1307 o 6:4355d653f84f edit files yet again
1307 o 6:4355d653f84f edit files yet again
1308 |
1308 |
1309 o 5:9d5af5072dbd edit files again
1309 o 5:9d5af5072dbd edit files again
1310 |
1310 |
1311 o 4:74c02385b94c move files
1311 o 4:74c02385b94c move files
1312 |
1312 |
1313 ~
1313 ~
1314 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub/large4
1314 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub/large4
1315 8:a381d2c8c80e modify normal file and largefile in repo b
1315 8:a381d2c8c80e modify normal file and largefile in repo b
1316 6:4355d653f84f edit files yet again
1316 6:4355d653f84f edit files yet again
1317 5:9d5af5072dbd edit files again
1317 5:9d5af5072dbd edit files again
1318 4:74c02385b94c move files
1318 4:74c02385b94c move files
1319 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1319 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1320 o 8:a381d2c8c80e modify normal file and largefile in repo b
1320 o 8:a381d2c8c80e modify normal file and largefile in repo b
1321 :
1321 :
1322 o 6:4355d653f84f edit files yet again
1322 o 6:4355d653f84f edit files yet again
1323 |
1323 |
1324 o 5:9d5af5072dbd edit files again
1324 o 5:9d5af5072dbd edit files again
1325 |
1325 |
1326 o 4:74c02385b94c move files
1326 o 4:74c02385b94c move files
1327 |
1327 |
1328 ~
1328 ~
1329
1329
1330 - .hglf only matches largefiles, without .hglf it matches 9 bco sub/normal
1330 - .hglf only matches largefiles, without .hglf it matches 9 bco sub/normal
1331 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1331 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1332 8:a381d2c8c80e modify normal file and largefile in repo b
1332 8:a381d2c8c80e modify normal file and largefile in repo b
1333 6:4355d653f84f edit files yet again
1333 6:4355d653f84f edit files yet again
1334 5:9d5af5072dbd edit files again
1334 5:9d5af5072dbd edit files again
1335 4:74c02385b94c move files
1335 4:74c02385b94c move files
1336 1:ce8896473775 edit files
1336 1:ce8896473775 edit files
1337 0:30d30fe6a5be add files
1337 0:30d30fe6a5be add files
1338 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1338 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1339 o 8:a381d2c8c80e modify normal file and largefile in repo b
1339 o 8:a381d2c8c80e modify normal file and largefile in repo b
1340 :
1340 :
1341 o 6:4355d653f84f edit files yet again
1341 o 6:4355d653f84f edit files yet again
1342 |
1342 |
1343 o 5:9d5af5072dbd edit files again
1343 o 5:9d5af5072dbd edit files again
1344 |
1344 |
1345 o 4:74c02385b94c move files
1345 o 4:74c02385b94c move files
1346 :
1346 :
1347 o 1:ce8896473775 edit files
1347 o 1:ce8896473775 edit files
1348 |
1348 |
1349 o 0:30d30fe6a5be add files
1349 o 0:30d30fe6a5be add files
1350
1350
1351 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub
1351 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub
1352 9:598410d3eb9a modify normal file largefile in repo d
1352 9:598410d3eb9a modify normal file largefile in repo d
1353 8:a381d2c8c80e modify normal file and largefile in repo b
1353 8:a381d2c8c80e modify normal file and largefile in repo b
1354 6:4355d653f84f edit files yet again
1354 6:4355d653f84f edit files yet again
1355 5:9d5af5072dbd edit files again
1355 5:9d5af5072dbd edit files again
1356 4:74c02385b94c move files
1356 4:74c02385b94c move files
1357 1:ce8896473775 edit files
1357 1:ce8896473775 edit files
1358 0:30d30fe6a5be add files
1358 0:30d30fe6a5be add files
1359 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' sub
1359 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' sub
1360 @ 9:598410d3eb9a modify normal file largefile in repo d
1360 @ 9:598410d3eb9a modify normal file largefile in repo d
1361 |
1361 |
1362 o 8:a381d2c8c80e modify normal file and largefile in repo b
1362 o 8:a381d2c8c80e modify normal file and largefile in repo b
1363 :
1363 :
1364 o 6:4355d653f84f edit files yet again
1364 o 6:4355d653f84f edit files yet again
1365 |
1365 |
1366 o 5:9d5af5072dbd edit files again
1366 o 5:9d5af5072dbd edit files again
1367 |
1367 |
1368 o 4:74c02385b94c move files
1368 o 4:74c02385b94c move files
1369 :
1369 :
1370 o 1:ce8896473775 edit files
1370 o 1:ce8896473775 edit files
1371 |
1371 |
1372 o 0:30d30fe6a5be add files
1372 o 0:30d30fe6a5be add files
1373
1373
1374 - globbing gives same result
1374 - globbing gives same result
1375 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1375 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1376 9:598410d3eb9a modify normal file largefile in repo d
1376 9:598410d3eb9a modify normal file largefile in repo d
1377 8:a381d2c8c80e modify normal file and largefile in repo b
1377 8:a381d2c8c80e modify normal file and largefile in repo b
1378 6:4355d653f84f edit files yet again
1378 6:4355d653f84f edit files yet again
1379 5:9d5af5072dbd edit files again
1379 5:9d5af5072dbd edit files again
1380 4:74c02385b94c move files
1380 4:74c02385b94c move files
1381 1:ce8896473775 edit files
1381 1:ce8896473775 edit files
1382 0:30d30fe6a5be add files
1382 0:30d30fe6a5be add files
1383 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1383 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1384 @ 9:598410d3eb9a modify normal file largefile in repo d
1384 @ 9:598410d3eb9a modify normal file largefile in repo d
1385 |
1385 |
1386 o 8:a381d2c8c80e modify normal file and largefile in repo b
1386 o 8:a381d2c8c80e modify normal file and largefile in repo b
1387 :
1387 :
1388 o 6:4355d653f84f edit files yet again
1388 o 6:4355d653f84f edit files yet again
1389 |
1389 |
1390 o 5:9d5af5072dbd edit files again
1390 o 5:9d5af5072dbd edit files again
1391 |
1391 |
1392 o 4:74c02385b94c move files
1392 o 4:74c02385b94c move files
1393 :
1393 :
1394 o 1:ce8896473775 edit files
1394 o 1:ce8896473775 edit files
1395 |
1395 |
1396 o 0:30d30fe6a5be add files
1396 o 0:30d30fe6a5be add files
1397
1397
1398 Rollback on largefiles.
1398 Rollback on largefiles.
1399
1399
1400 $ echo large4-modified-again > sub/large4
1400 $ echo large4-modified-again > sub/large4
1401 $ hg commit -m "Modify large4 again"
1401 $ hg commit -m "Modify large4 again"
1402 Invoking status precommit hook
1402 Invoking status precommit hook
1403 M sub/large4
1403 M sub/large4
1404 $ hg rollback
1404 $ hg rollback
1405 repository tip rolled back to revision 9 (undo commit)
1405 repository tip rolled back to revision 9 (undo commit)
1406 working directory now based on revision 9
1406 working directory now based on revision 9
1407 $ hg st
1407 $ hg st
1408 M sub/large4
1408 M sub/large4
1409 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1409 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1410 9:598410d3eb9a modify normal file largefile in repo d
1410 9:598410d3eb9a modify normal file largefile in repo d
1411 8:a381d2c8c80e modify normal file and largefile in repo b
1411 8:a381d2c8c80e modify normal file and largefile in repo b
1412 7:daea875e9014 add/edit more largefiles
1412 7:daea875e9014 add/edit more largefiles
1413 6:4355d653f84f edit files yet again
1413 6:4355d653f84f edit files yet again
1414 5:9d5af5072dbd edit files again
1414 5:9d5af5072dbd edit files again
1415 4:74c02385b94c move files
1415 4:74c02385b94c move files
1416 3:9e8fbc4bce62 copy files
1416 3:9e8fbc4bce62 copy files
1417 2:51a0ae4d5864 remove files
1417 2:51a0ae4d5864 remove files
1418 1:ce8896473775 edit files
1418 1:ce8896473775 edit files
1419 0:30d30fe6a5be add files
1419 0:30d30fe6a5be add files
1420 $ cat sub/large4
1420 $ cat sub/large4
1421 large4-modified-again
1421 large4-modified-again
1422
1422
1423 "update --check" refuses to update with uncommitted changes.
1423 "update --check" refuses to update with uncommitted changes.
1424 $ hg update --check 8
1424 $ hg update --check 8
1425 abort: uncommitted changes
1425 abort: uncommitted changes
1426 [255]
1426 [255]
1427
1427
1428 "update --clean" leaves correct largefiles in working copy, even when there is
1428 "update --clean" leaves correct largefiles in working copy, even when there is
1429 .orig files from revert in .hglf.
1429 .orig files from revert in .hglf.
1430
1430
1431 $ echo mistake > sub2/large7
1431 $ echo mistake > sub2/large7
1432 $ hg revert sub2/large7
1432 $ hg revert sub2/large7
1433 $ cat sub2/large7
1433 $ cat sub2/large7
1434 large7
1434 large7
1435 $ cat sub2/large7.orig
1435 $ cat sub2/large7.orig
1436 mistake
1436 mistake
1437 $ test ! -f .hglf/sub2/large7.orig
1437 $ test ! -f .hglf/sub2/large7.orig
1438
1438
1439 $ hg -q update --clean -r null
1439 $ hg -q update --clean -r null
1440 $ hg update --clean
1440 $ hg update --clean
1441 getting changed largefiles
1441 getting changed largefiles
1442 3 largefiles updated, 0 removed
1442 3 largefiles updated, 0 removed
1443 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1443 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1444 $ cat normal3
1444 $ cat normal3
1445 normal3-modified
1445 normal3-modified
1446 $ cat sub/normal4
1446 $ cat sub/normal4
1447 normal4-modified
1447 normal4-modified
1448 $ cat sub/large4
1448 $ cat sub/large4
1449 large4-modified
1449 large4-modified
1450 $ cat sub2/large6
1450 $ cat sub2/large6
1451 large6-modified
1451 large6-modified
1452 $ cat sub2/large7
1452 $ cat sub2/large7
1453 large7
1453 large7
1454 $ cat sub2/large7.orig
1454 $ cat sub2/large7.orig
1455 mistake
1455 mistake
1456 $ test ! -f .hglf/sub2/large7.orig
1456 $ test ! -f .hglf/sub2/large7.orig
1457
1457
1458 verify that largefile .orig file no longer is overwritten on every update -C:
1458 verify that largefile .orig file no longer is overwritten on every update -C:
1459 $ hg update --clean
1459 $ hg update --clean
1460 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1460 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1461 $ cat sub2/large7.orig
1461 $ cat sub2/large7.orig
1462 mistake
1462 mistake
1463 $ rm sub2/large7.orig
1463 $ rm sub2/large7.orig
1464
1464
1465 Now "update check" is happy.
1465 Now "update check" is happy.
1466 $ hg update --check 8
1466 $ hg update --check 8
1467 getting changed largefiles
1467 getting changed largefiles
1468 1 largefiles updated, 0 removed
1468 1 largefiles updated, 0 removed
1469 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1469 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1470 $ hg update --check
1470 $ hg update --check
1471 getting changed largefiles
1471 getting changed largefiles
1472 1 largefiles updated, 0 removed
1472 1 largefiles updated, 0 removed
1473 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1473 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1474
1474
1475 Test removing empty largefiles directories on update
1475 Test removing empty largefiles directories on update
1476 $ test -d sub2 && echo "sub2 exists"
1476 $ test -d sub2 && echo "sub2 exists"
1477 sub2 exists
1477 sub2 exists
1478 $ hg update -q null
1478 $ hg update -q null
1479 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1479 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1480 [1]
1480 [1]
1481 $ hg update -q
1481 $ hg update -q
1482
1482
1483 Test hg remove removes empty largefiles directories
1483 Test hg remove removes empty largefiles directories
1484 $ test -d sub2 && echo "sub2 exists"
1484 $ test -d sub2 && echo "sub2 exists"
1485 sub2 exists
1485 sub2 exists
1486 $ hg remove sub2/*
1486 $ hg remove sub2/*
1487 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1487 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1488 [1]
1488 [1]
1489 $ hg revert sub2/large6 sub2/large7
1489 $ hg revert sub2/large6 sub2/large7
1490
1490
1491 "revert" works on largefiles (and normal files too).
1491 "revert" works on largefiles (and normal files too).
1492 $ echo hack3 >> normal3
1492 $ echo hack3 >> normal3
1493 $ echo hack4 >> sub/normal4
1493 $ echo hack4 >> sub/normal4
1494 $ echo hack4 >> sub/large4
1494 $ echo hack4 >> sub/large4
1495 $ rm sub2/large6
1495 $ rm sub2/large6
1496 $ hg revert sub2/large6
1496 $ hg revert sub2/large6
1497 $ hg rm sub2/large6
1497 $ hg rm sub2/large6
1498 $ echo new >> sub2/large8
1498 $ echo new >> sub2/large8
1499 $ hg add --large sub2/large8
1499 $ hg add --large sub2/large8
1500 # XXX we don't really want to report that we're reverting the standin;
1500 # XXX we don't really want to report that we're reverting the standin;
1501 # that's just an implementation detail. But I don't see an obvious fix. ;-(
1501 # that's just an implementation detail. But I don't see an obvious fix. ;-(
1502 $ hg revert sub
1502 $ hg revert sub
1503 reverting .hglf/sub/large4
1503 reverting .hglf/sub/large4
1504 reverting sub/normal4
1504 reverting sub/normal4
1505 $ hg status
1505 $ hg status
1506 M normal3
1506 M normal3
1507 A sub2/large8
1507 A sub2/large8
1508 R sub2/large6
1508 R sub2/large6
1509 ? sub/large4.orig
1509 ? sub/large4.orig
1510 ? sub/normal4.orig
1510 ? sub/normal4.orig
1511 $ cat sub/normal4
1511 $ cat sub/normal4
1512 normal4-modified
1512 normal4-modified
1513 $ cat sub/large4
1513 $ cat sub/large4
1514 large4-modified
1514 large4-modified
1515 $ hg revert -a --no-backup
1515 $ hg revert -a --no-backup
1516 undeleting .hglf/sub2/large6
1516 undeleting .hglf/sub2/large6
1517 forgetting .hglf/sub2/large8
1517 forgetting .hglf/sub2/large8
1518 reverting normal3
1518 reverting normal3
1519 $ hg status
1519 $ hg status
1520 ? sub/large4.orig
1520 ? sub/large4.orig
1521 ? sub/normal4.orig
1521 ? sub/normal4.orig
1522 ? sub2/large8
1522 ? sub2/large8
1523 $ cat normal3
1523 $ cat normal3
1524 normal3-modified
1524 normal3-modified
1525 $ cat sub2/large6
1525 $ cat sub2/large6
1526 large6-modified
1526 large6-modified
1527 $ rm sub/*.orig sub2/large8
1527 $ rm sub/*.orig sub2/large8
1528
1528
1529 revert some files to an older revision
1529 revert some files to an older revision
1530 $ hg revert --no-backup -r 8 sub2
1530 $ hg revert --no-backup -r 8 sub2
1531 reverting .hglf/sub2/large6
1531 reverting .hglf/sub2/large6
1532 $ cat sub2/large6
1532 $ cat sub2/large6
1533 large6
1533 large6
1534 $ hg revert --no-backup -C -r '.^' sub2
1534 $ hg revert --no-backup -C -r '.^' sub2
1535 $ hg revert --no-backup sub2
1535 $ hg revert --no-backup sub2
1536 reverting .hglf/sub2/large6
1536 reverting .hglf/sub2/large6
1537 $ hg status
1537 $ hg status
1538
1538
1539 "verify --large" actually verifies largefiles
1539 "verify --large" actually verifies largefiles
1540
1540
1541 - Where Do We Come From? What Are We? Where Are We Going?
1541 - Where Do We Come From? What Are We? Where Are We Going?
1542 $ pwd
1542 $ pwd
1543 $TESTTMP/e
1543 $TESTTMP/e
1544 $ hg paths
1544 $ hg paths
1545 default = $TESTTMP/d
1545 default = $TESTTMP/d
1546
1546
1547 $ hg verify --large
1547 $ hg verify --large
1548 checking changesets
1548 checking changesets
1549 checking manifests
1549 checking manifests
1550 crosschecking files in changesets and manifests
1550 crosschecking files in changesets and manifests
1551 checking files
1551 checking files
1552 10 files, 10 changesets, 28 total revisions
1552 10 files, 10 changesets, 28 total revisions
1553 searching 1 changesets for largefiles
1553 searching 1 changesets for largefiles
1554 verified existence of 3 revisions of 3 largefiles
1554 verified existence of 3 revisions of 3 largefiles
1555
1555
1556 - introduce missing blob in local store repo and remote store
1556 - introduce missing blob in local store repo and remote store
1557 and make sure that this is caught:
1557 and make sure that this is caught:
1558
1558
1559 $ mv $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 .
1559 $ mv $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 .
1560 $ rm .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1560 $ rm .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1561 $ hg verify --large
1561 $ hg verify --large
1562 checking changesets
1562 checking changesets
1563 checking manifests
1563 checking manifests
1564 crosschecking files in changesets and manifests
1564 crosschecking files in changesets and manifests
1565 checking files
1565 checking files
1566 10 files, 10 changesets, 28 total revisions
1566 10 files, 10 changesets, 28 total revisions
1567 searching 1 changesets for largefiles
1567 searching 1 changesets for largefiles
1568 changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1568 changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1569 verified existence of 3 revisions of 3 largefiles
1569 verified existence of 3 revisions of 3 largefiles
1570 [1]
1570 [1]
1571
1571
1572 - introduce corruption and make sure that it is caught when checking content:
1572 - introduce corruption and make sure that it is caught when checking content:
1573 $ echo '5 cents' > $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1573 $ echo '5 cents' > $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1574 $ hg verify -q --large --lfc
1574 $ hg verify -q --large --lfc
1575 changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1575 changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1576 [1]
1576 [1]
1577
1577
1578 - cleanup
1578 - cleanup
1579 $ cp e166e74c7303192238d60af5a9c4ce9bef0b7928 $TESTTMP/d/.hg/largefiles/
1579 $ cp e166e74c7303192238d60af5a9c4ce9bef0b7928 $TESTTMP/d/.hg/largefiles/
1580 $ mv e166e74c7303192238d60af5a9c4ce9bef0b7928 .hg/largefiles/
1580 $ mv e166e74c7303192238d60af5a9c4ce9bef0b7928 .hg/largefiles/
1581
1581
1582 - verifying all revisions will fail because we didn't clone all largefiles to d:
1582 - verifying all revisions will fail because we didn't clone all largefiles to d:
1583 $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1583 $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1584 $ hg verify -q --lfa --lfc
1584 $ hg verify -q --lfa --lfc
1585 changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64
1585 changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64
1586 changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d
1586 changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d
1587 changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f
1587 changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f
1588 changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1588 changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1589 changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1589 changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1590 changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1590 changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1591 changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1591 changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1592 changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c
1592 changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c
1593 changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9
1593 changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9
1594 changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0
1594 changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0
1595 [1]
1595 [1]
1596
1596
1597 - cleanup
1597 - cleanup
1598 $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1598 $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1599 $ rm -f .hglf/sub/*.orig
1599 $ rm -f .hglf/sub/*.orig
1600
1600
1601 Update to revision with missing largefile - and make sure it really is missing
1601 Update to revision with missing largefile - and make sure it really is missing
1602
1602
1603 $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0
1603 $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0
1604 $ hg up -r 6
1604 $ hg up -r 6
1605 getting changed largefiles
1605 getting changed largefiles
1606 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1606 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1607 1 largefiles updated, 2 removed
1607 1 largefiles updated, 2 removed
1608 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
1608 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
1609 $ rm normal3
1609 $ rm normal3
1610 $ echo >> sub/normal4
1610 $ echo >> sub/normal4
1611 $ hg ci -m 'commit with missing files'
1611 $ hg ci -m 'commit with missing files'
1612 Invoking status precommit hook
1612 Invoking status precommit hook
1613 M sub/normal4
1613 M sub/normal4
1614 ! large3
1614 ! large3
1615 ! normal3
1615 ! normal3
1616 created new head
1616 created new head
1617 $ hg st
1617 $ hg st
1618 ! large3
1618 ! large3
1619 ! normal3
1619 ! normal3
1620 $ hg up -r.
1620 $ hg up -r.
1621 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1621 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1622 $ hg st
1622 $ hg st
1623 ! large3
1623 ! large3
1624 ! normal3
1624 ! normal3
1625 $ hg up -Cr.
1625 $ hg up -Cr.
1626 getting changed largefiles
1626 getting changed largefiles
1627 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1627 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1628 0 largefiles updated, 0 removed
1628 0 largefiles updated, 0 removed
1629 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1629 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1630 $ hg st
1630 $ hg st
1631 ! large3
1631 ! large3
1632 $ hg rollback
1632 $ hg rollback
1633 repository tip rolled back to revision 9 (undo commit)
1633 repository tip rolled back to revision 9 (undo commit)
1634 working directory now based on revision 6
1634 working directory now based on revision 6
1635
1635
1636 Merge with revision with missing largefile - and make sure it tries to fetch it.
1636 Merge with revision with missing largefile - and make sure it tries to fetch it.
1637
1637
1638 $ hg up -Cqr null
1638 $ hg up -Cqr null
1639 $ echo f > f
1639 $ echo f > f
1640 $ hg ci -Am branch
1640 $ hg ci -Am branch
1641 adding f
1641 adding f
1642 Invoking status precommit hook
1642 Invoking status precommit hook
1643 A f
1643 A f
1644 created new head
1644 created new head
1645 $ hg merge -r 6
1645 $ hg merge -r 6
1646 getting changed largefiles
1646 getting changed largefiles
1647 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1647 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1648 1 largefiles updated, 0 removed
1648 1 largefiles updated, 0 removed
1649 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1649 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1650 (branch merge, don't forget to commit)
1650 (branch merge, don't forget to commit)
1651
1651
1652 $ hg rollback -q
1652 $ hg rollback -q
1653 $ hg up -Cq
1653 $ hg up -Cq
1654
1654
1655 Pulling 0 revisions with --all-largefiles should not fetch for all revisions
1655 Pulling 0 revisions with --all-largefiles should not fetch for all revisions
1656
1656
1657 $ hg pull --all-largefiles
1657 $ hg pull --all-largefiles
1658 pulling from $TESTTMP/d
1658 pulling from $TESTTMP/d
1659 searching for changes
1659 searching for changes
1660 no changes found
1660 no changes found
1661
1661
1662 Merging does not revert to old versions of largefiles and also check
1662 Merging does not revert to old versions of largefiles and also check
1663 that merging after having pulled from a non-default remote works
1663 that merging after having pulled from a non-default remote works
1664 correctly.
1664 correctly.
1665
1665
1666 $ cd ..
1666 $ cd ..
1667 $ hg clone -r 7 e temp
1667 $ hg clone -r 7 e temp
1668 adding changesets
1668 adding changesets
1669 adding manifests
1669 adding manifests
1670 adding file changes
1670 adding file changes
1671 added 8 changesets with 24 changes to 10 files
1671 added 8 changesets with 24 changes to 10 files
1672 new changesets 30d30fe6a5be:daea875e9014
1672 new changesets 30d30fe6a5be:daea875e9014
1673 updating to branch default
1673 updating to branch default
1674 getting changed largefiles
1674 getting changed largefiles
1675 3 largefiles updated, 0 removed
1675 3 largefiles updated, 0 removed
1676 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1676 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1677 $ hg clone temp f
1677 $ hg clone temp f
1678 updating to branch default
1678 updating to branch default
1679 getting changed largefiles
1679 getting changed largefiles
1680 3 largefiles updated, 0 removed
1680 3 largefiles updated, 0 removed
1681 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1681 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1682 # Delete the largefiles in the largefiles system cache so that we have an
1682 # Delete the largefiles in the largefiles system cache so that we have an
1683 # opportunity to test that caching after a pull works.
1683 # opportunity to test that caching after a pull works.
1684 $ rm "${USERCACHE}"/*
1684 $ rm "${USERCACHE}"/*
1685 $ cd f
1685 $ cd f
1686 $ echo "large4-merge-test" > sub/large4
1686 $ echo "large4-merge-test" > sub/large4
1687 $ hg commit -m "Modify large4 to test merge"
1687 $ hg commit -m "Modify large4 to test merge"
1688 Invoking status precommit hook
1688 Invoking status precommit hook
1689 M sub/large4
1689 M sub/large4
1690 # Test --cache-largefiles flag
1690 # Test --cache-largefiles flag
1691 $ hg pull --lfrev 'heads(pulled())' ../e
1691 $ hg pull --lfrev 'heads(pulled())' ../e
1692 pulling from ../e
1692 pulling from ../e
1693 searching for changes
1693 searching for changes
1694 adding changesets
1694 adding changesets
1695 adding manifests
1695 adding manifests
1696 adding file changes
1696 adding file changes
1697 added 2 changesets with 4 changes to 4 files (+1 heads)
1697 added 2 changesets with 4 changes to 4 files (+1 heads)
1698 new changesets a381d2c8c80e:598410d3eb9a
1698 new changesets a381d2c8c80e:598410d3eb9a
1699 (run 'hg heads' to see heads, 'hg merge' to merge)
1699 (run 'hg heads' to see heads, 'hg merge' to merge)
1700 2 largefiles cached
1700 2 largefiles cached
1701 $ hg merge
1701 $ hg merge
1702 largefile sub/large4 has a merge conflict
1702 largefile sub/large4 has a merge conflict
1703 ancestor was 971fb41e78fea4f8e0ba5244784239371cb00591
1703 ancestor was 971fb41e78fea4f8e0ba5244784239371cb00591
1704 keep (l)ocal d846f26643bfa8ec210be40cc93cc6b7ff1128ea or
1704 keep (l)ocal d846f26643bfa8ec210be40cc93cc6b7ff1128ea or
1705 take (o)ther e166e74c7303192238d60af5a9c4ce9bef0b7928? l
1705 take (o)ther e166e74c7303192238d60af5a9c4ce9bef0b7928? l
1706 getting changed largefiles
1706 getting changed largefiles
1707 1 largefiles updated, 0 removed
1707 1 largefiles updated, 0 removed
1708 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
1708 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
1709 (branch merge, don't forget to commit)
1709 (branch merge, don't forget to commit)
1710 $ hg commit -m "Merge repos e and f"
1710 $ hg commit -m "Merge repos e and f"
1711 Invoking status precommit hook
1711 Invoking status precommit hook
1712 M normal3
1712 M normal3
1713 M sub/normal4
1713 M sub/normal4
1714 M sub2/large6
1714 M sub2/large6
1715 $ cat normal3
1715 $ cat normal3
1716 normal3-modified
1716 normal3-modified
1717 $ cat sub/normal4
1717 $ cat sub/normal4
1718 normal4-modified
1718 normal4-modified
1719 $ cat sub/large4
1719 $ cat sub/large4
1720 large4-merge-test
1720 large4-merge-test
1721 $ cat sub2/large6
1721 $ cat sub2/large6
1722 large6-modified
1722 large6-modified
1723 $ cat sub2/large7
1723 $ cat sub2/large7
1724 large7
1724 large7
1725
1725
1726 Test status after merging with a branch that introduces a new largefile:
1726 Test status after merging with a branch that introduces a new largefile:
1727
1727
1728 $ echo large > large
1728 $ echo large > large
1729 $ hg add --large large
1729 $ hg add --large large
1730 $ hg commit -m 'add largefile'
1730 $ hg commit -m 'add largefile'
1731 Invoking status precommit hook
1731 Invoking status precommit hook
1732 A large
1732 A large
1733 $ hg update -q ".^"
1733 $ hg update -q ".^"
1734 $ echo change >> normal3
1734 $ echo change >> normal3
1735 $ hg commit -m 'some change'
1735 $ hg commit -m 'some change'
1736 Invoking status precommit hook
1736 Invoking status precommit hook
1737 M normal3
1737 M normal3
1738 created new head
1738 created new head
1739 $ hg merge
1739 $ hg merge
1740 getting changed largefiles
1740 getting changed largefiles
1741 1 largefiles updated, 0 removed
1741 1 largefiles updated, 0 removed
1742 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1742 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1743 (branch merge, don't forget to commit)
1743 (branch merge, don't forget to commit)
1744 $ hg status
1744 $ hg status
1745 M large
1745 M large
1746
1746
1747 - make sure update of merge with removed largefiles fails as expected
1747 - make sure update of merge with removed largefiles fails as expected
1748 $ hg rm sub2/large6
1748 $ hg rm sub2/large6
1749 $ hg up -r.
1749 $ hg up -r.
1750 abort: outstanding uncommitted merge
1750 abort: outstanding uncommitted merge
1751 [255]
1751 [255]
1752
1752
1753 - revert should be able to revert files introduced in a pending merge
1753 - revert should be able to revert files introduced in a pending merge
1754 $ hg revert --all -r .
1754 $ hg revert --all -r .
1755 removing .hglf/large
1755 removing .hglf/large
1756 undeleting .hglf/sub2/large6
1756 undeleting .hglf/sub2/large6
1757
1757
1758 Test that a normal file and a largefile with the same name and path cannot
1758 Test that a normal file and a largefile with the same name and path cannot
1759 coexist.
1759 coexist.
1760
1760
1761 $ rm sub2/large7
1761 $ rm sub2/large7
1762 $ echo "largeasnormal" > sub2/large7
1762 $ echo "largeasnormal" > sub2/large7
1763 $ hg add sub2/large7
1763 $ hg add sub2/large7
1764 sub2/large7 already a largefile
1764 sub2/large7 already a largefile
1765
1765
1766 Test that transplanting a largefile change works correctly.
1766 Test that transplanting a largefile change works correctly.
1767
1767
1768 $ cd ..
1768 $ cd ..
1769 $ hg clone -r 8 d g
1769 $ hg clone -r 8 d g
1770 adding changesets
1770 adding changesets
1771 adding manifests
1771 adding manifests
1772 adding file changes
1772 adding file changes
1773 added 9 changesets with 26 changes to 10 files
1773 added 9 changesets with 26 changes to 10 files
1774 new changesets 30d30fe6a5be:a381d2c8c80e
1774 new changesets 30d30fe6a5be:a381d2c8c80e
1775 updating to branch default
1775 updating to branch default
1776 getting changed largefiles
1776 getting changed largefiles
1777 3 largefiles updated, 0 removed
1777 3 largefiles updated, 0 removed
1778 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1778 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1779 $ cd g
1779 $ cd g
1780 $ hg transplant -s ../d 598410d3eb9a
1780 $ hg transplant -s ../d 598410d3eb9a
1781 searching for changes
1781 searching for changes
1782 searching for changes
1782 searching for changes
1783 adding changesets
1783 adding changesets
1784 adding manifests
1784 adding manifests
1785 adding file changes
1785 adding file changes
1786 added 1 changesets with 2 changes to 2 files
1786 added 1 changesets with 2 changes to 2 files
1787 new changesets 598410d3eb9a
1787 new changesets 598410d3eb9a
1788 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1788 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1789 9:598410d3eb9a modify normal file largefile in repo d
1789 9:598410d3eb9a modify normal file largefile in repo d
1790 8:a381d2c8c80e modify normal file and largefile in repo b
1790 8:a381d2c8c80e modify normal file and largefile in repo b
1791 7:daea875e9014 add/edit more largefiles
1791 7:daea875e9014 add/edit more largefiles
1792 6:4355d653f84f edit files yet again
1792 6:4355d653f84f edit files yet again
1793 5:9d5af5072dbd edit files again
1793 5:9d5af5072dbd edit files again
1794 4:74c02385b94c move files
1794 4:74c02385b94c move files
1795 3:9e8fbc4bce62 copy files
1795 3:9e8fbc4bce62 copy files
1796 2:51a0ae4d5864 remove files
1796 2:51a0ae4d5864 remove files
1797 1:ce8896473775 edit files
1797 1:ce8896473775 edit files
1798 0:30d30fe6a5be add files
1798 0:30d30fe6a5be add files
1799 $ cat normal3
1799 $ cat normal3
1800 normal3-modified
1800 normal3-modified
1801 $ cat sub/normal4
1801 $ cat sub/normal4
1802 normal4-modified
1802 normal4-modified
1803 $ cat sub/large4
1803 $ cat sub/large4
1804 large4-modified
1804 large4-modified
1805 $ cat sub2/large6
1805 $ cat sub2/large6
1806 large6-modified
1806 large6-modified
1807 $ cat sub2/large7
1807 $ cat sub2/large7
1808 large7
1808 large7
1809
1809
1810 Cat a largefile
1810 Cat a largefile
1811 $ hg cat normal3
1811 $ hg cat normal3
1812 normal3-modified
1812 normal3-modified
1813 $ hg cat sub/large4
1813 $ hg cat sub/large4
1814 large4-modified
1814 large4-modified
1815 $ rm "${USERCACHE}"/*
1815 $ rm "${USERCACHE}"/*
1816 $ hg cat -r a381d2c8c80e -o cat.out sub/large4
1816 $ hg cat -r a381d2c8c80e -o cat.out sub/large4
1817 $ cat cat.out
1817 $ cat cat.out
1818 large4-modified
1818 large4-modified
1819 $ rm cat.out
1819 $ rm cat.out
1820 $ hg cat -r a381d2c8c80e normal3
1820 $ hg cat -r a381d2c8c80e normal3
1821 normal3-modified
1821 normal3-modified
1822 $ hg cat -r '.^' normal3
1822 $ hg cat -r '.^' normal3
1823 normal3-modified
1823 normal3-modified
1824 $ hg cat -r '.^' sub/large4 doesntexist
1824 $ hg cat -r '.^' sub/large4 doesntexist
1825 large4-modified
1825 large4-modified
1826 doesntexist: no such file in rev a381d2c8c80e
1826 doesntexist: no such file in rev a381d2c8c80e
1827 $ hg --cwd sub cat -r '.^' large4
1827 $ hg --cwd sub cat -r '.^' large4
1828 large4-modified
1828 large4-modified
1829 $ hg --cwd sub cat -r '.^' ../normal3
1829 $ hg --cwd sub cat -r '.^' ../normal3
1830 normal3-modified
1830 normal3-modified
1831 Cat a standin
1831 Cat a standin
1832 $ hg cat .hglf/sub/large4
1832 $ hg cat .hglf/sub/large4
1833 e166e74c7303192238d60af5a9c4ce9bef0b7928
1833 e166e74c7303192238d60af5a9c4ce9bef0b7928
1834 $ hg cat .hglf/normal3
1834 $ hg cat .hglf/normal3
1835 .hglf/normal3: no such file in rev 598410d3eb9a
1835 .hglf/normal3: no such file in rev 598410d3eb9a
1836 [1]
1836 [1]
1837
1837
1838 Test that renaming a largefile results in correct output for status
1838 Test that renaming a largefile results in correct output for status
1839
1839
1840 $ hg rename sub/large4 large4-renamed
1840 $ hg rename sub/large4 large4-renamed
1841 $ hg commit -m "test rename output"
1841 $ hg commit -m "test rename output"
1842 Invoking status precommit hook
1842 Invoking status precommit hook
1843 A large4-renamed
1843 A large4-renamed
1844 R sub/large4
1844 R sub/large4
1845 $ cat large4-renamed
1845 $ cat large4-renamed
1846 large4-modified
1846 large4-modified
1847 $ cd sub2
1847 $ cd sub2
1848 $ hg rename large6 large6-renamed
1848 $ hg rename large6 large6-renamed
1849 $ hg st
1849 $ hg st
1850 A sub2/large6-renamed
1850 A sub2/large6-renamed
1851 R sub2/large6
1851 R sub2/large6
1852 $ cd ..
1852 $ cd ..
1853
1853
1854 Test --normal flag
1854 Test --normal flag
1855
1855
1856 $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null
1856 $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null
1857 $ hg add --normal --large new-largefile
1857 $ hg add --normal --large new-largefile
1858 abort: --normal cannot be used with --large
1858 abort: --normal cannot be used with --large
1859 [255]
1859 [255]
1860 $ hg add --normal new-largefile
1860 $ hg add --normal new-largefile
1861 new-largefile: up to 69 MB of RAM may be required to manage this file
1861 new-largefile: up to 69 MB of RAM may be required to manage this file
1862 (use 'hg revert new-largefile' to cancel the pending addition)
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 Test explicit commit of switch between normal and largefile - make sure both
1866 Test explicit commit of switch between normal and largefile - make sure both
1865 the add and the remove is committed.
1867 the add and the remove is committed.
1866
1868
1867 $ hg up -qC
1869 $ hg up -qC
1868 $ hg forget normal3 large4-renamed
1870 $ hg forget normal3 large4-renamed
1869 $ hg add --large normal3
1871 $ hg add --large normal3
1870 $ hg add large4-renamed
1872 $ hg add large4-renamed
1871 $ hg commit -m 'swap' normal3 large4-renamed
1873 $ hg commit -m 'swap' normal3 large4-renamed
1872 Invoking status precommit hook
1874 Invoking status precommit hook
1873 A large4-renamed
1875 A large4-renamed
1874 A normal3
1876 A normal3
1875 ? new-largefile
1877 ? new-largefile
1876 ? sub2/large6-renamed
1878 ? sub2/large6-renamed
1877 $ hg mani
1879 $ hg mani
1878 .hglf/normal3
1880 .hglf/normal3
1879 .hglf/sub2/large6
1881 .hglf/sub2/large6
1880 .hglf/sub2/large7
1882 .hglf/sub2/large7
1881 large4-renamed
1883 large4-renamed
1882 sub/normal4
1884 sub/normal4
1883
1885
1884 $ cd ..
1886 $ cd ..
1885
1887
1886
1888
1887
1889
General Comments 0
You need to be logged in to leave comments. Login now