##// END OF EJS Templates
merge with stable
Matt Mackall -
r24542:9fbda55c merge default
parent child Browse files
Show More
@@ -1,952 +1,955
1 # dirstate.py - working directory tracking for mercurial
1 # dirstate.py - working directory tracking for mercurial
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-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 node import nullid
8 from node import nullid
9 from i18n import _
9 from i18n import _
10 import scmutil, util, ignore, osutil, parsers, encoding, pathutil
10 import scmutil, util, ignore, osutil, parsers, encoding, pathutil
11 import os, stat, errno
11 import os, stat, errno
12
12
13 propertycache = util.propertycache
13 propertycache = util.propertycache
14 filecache = scmutil.filecache
14 filecache = scmutil.filecache
15 _rangemask = 0x7fffffff
15 _rangemask = 0x7fffffff
16
16
17 dirstatetuple = parsers.dirstatetuple
17 dirstatetuple = parsers.dirstatetuple
18
18
19 class repocache(filecache):
19 class repocache(filecache):
20 """filecache for files in .hg/"""
20 """filecache for files in .hg/"""
21 def join(self, obj, fname):
21 def join(self, obj, fname):
22 return obj._opener.join(fname)
22 return obj._opener.join(fname)
23
23
24 class rootcache(filecache):
24 class rootcache(filecache):
25 """filecache for files in the repository root"""
25 """filecache for files in the repository root"""
26 def join(self, obj, fname):
26 def join(self, obj, fname):
27 return obj._join(fname)
27 return obj._join(fname)
28
28
29 class dirstate(object):
29 class dirstate(object):
30
30
31 def __init__(self, opener, ui, root, validate):
31 def __init__(self, opener, ui, root, validate):
32 '''Create a new dirstate object.
32 '''Create a new dirstate object.
33
33
34 opener is an open()-like callable that can be used to open the
34 opener is an open()-like callable that can be used to open the
35 dirstate file; root is the root of the directory tracked by
35 dirstate file; root is the root of the directory tracked by
36 the dirstate.
36 the dirstate.
37 '''
37 '''
38 self._opener = opener
38 self._opener = opener
39 self._validate = validate
39 self._validate = validate
40 self._root = root
40 self._root = root
41 # ntpath.join(root, '') of Python 2.7.9 does not add sep if root is
41 # ntpath.join(root, '') of Python 2.7.9 does not add sep if root is
42 # UNC path pointing to root share (issue4557)
42 # UNC path pointing to root share (issue4557)
43 if root.endswith(os.sep):
43 if root.endswith(os.sep):
44 self._rootdir = root
44 self._rootdir = root
45 else:
45 else:
46 self._rootdir = root + os.sep
46 self._rootdir = root + os.sep
47 self._dirty = False
47 self._dirty = False
48 self._dirtypl = False
48 self._dirtypl = False
49 self._lastnormaltime = 0
49 self._lastnormaltime = 0
50 self._ui = ui
50 self._ui = ui
51 self._filecache = {}
51 self._filecache = {}
52 self._parentwriters = 0
52 self._parentwriters = 0
53
53
54 def beginparentchange(self):
54 def beginparentchange(self):
55 '''Marks the beginning of a set of changes that involve changing
55 '''Marks the beginning of a set of changes that involve changing
56 the dirstate parents. If there is an exception during this time,
56 the dirstate parents. If there is an exception during this time,
57 the dirstate will not be written when the wlock is released. This
57 the dirstate will not be written when the wlock is released. This
58 prevents writing an incoherent dirstate where the parent doesn't
58 prevents writing an incoherent dirstate where the parent doesn't
59 match the contents.
59 match the contents.
60 '''
60 '''
61 self._parentwriters += 1
61 self._parentwriters += 1
62
62
63 def endparentchange(self):
63 def endparentchange(self):
64 '''Marks the end of a set of changes that involve changing the
64 '''Marks the end of a set of changes that involve changing the
65 dirstate parents. Once all parent changes have been marked done,
65 dirstate parents. Once all parent changes have been marked done,
66 the wlock will be free to write the dirstate on release.
66 the wlock will be free to write the dirstate on release.
67 '''
67 '''
68 if self._parentwriters > 0:
68 if self._parentwriters > 0:
69 self._parentwriters -= 1
69 self._parentwriters -= 1
70
70
71 def pendingparentchange(self):
71 def pendingparentchange(self):
72 '''Returns true if the dirstate is in the middle of a set of changes
72 '''Returns true if the dirstate is in the middle of a set of changes
73 that modify the dirstate parent.
73 that modify the dirstate parent.
74 '''
74 '''
75 return self._parentwriters > 0
75 return self._parentwriters > 0
76
76
77 @propertycache
77 @propertycache
78 def _map(self):
78 def _map(self):
79 '''Return the dirstate contents as a map from filename to
79 '''Return the dirstate contents as a map from filename to
80 (state, mode, size, time).'''
80 (state, mode, size, time).'''
81 self._read()
81 self._read()
82 return self._map
82 return self._map
83
83
84 @propertycache
84 @propertycache
85 def _copymap(self):
85 def _copymap(self):
86 self._read()
86 self._read()
87 return self._copymap
87 return self._copymap
88
88
89 @propertycache
89 @propertycache
90 def _filefoldmap(self):
90 def _filefoldmap(self):
91 f = {}
91 f = {}
92 normcase = util.normcase
92 normcase = util.normcase
93 for name, s in self._map.iteritems():
93 for name, s in self._map.iteritems():
94 if s[0] != 'r':
94 if s[0] != 'r':
95 f[normcase(name)] = name
95 f[normcase(name)] = name
96 f['.'] = '.' # prevents useless util.fspath() invocation
96 f['.'] = '.' # prevents useless util.fspath() invocation
97 return f
97 return f
98
98
99 @propertycache
99 @propertycache
100 def _dirfoldmap(self):
100 def _dirfoldmap(self):
101 f = {}
101 f = {}
102 normcase = util.normcase
102 normcase = util.normcase
103 for name in self._dirs:
103 for name in self._dirs:
104 f[normcase(name)] = name
104 f[normcase(name)] = name
105 return f
105 return f
106
106
107 @repocache('branch')
107 @repocache('branch')
108 def _branch(self):
108 def _branch(self):
109 try:
109 try:
110 return self._opener.read("branch").strip() or "default"
110 return self._opener.read("branch").strip() or "default"
111 except IOError, inst:
111 except IOError, inst:
112 if inst.errno != errno.ENOENT:
112 if inst.errno != errno.ENOENT:
113 raise
113 raise
114 return "default"
114 return "default"
115
115
116 @propertycache
116 @propertycache
117 def _pl(self):
117 def _pl(self):
118 try:
118 try:
119 fp = self._opener("dirstate")
119 fp = self._opener("dirstate")
120 st = fp.read(40)
120 st = fp.read(40)
121 fp.close()
121 fp.close()
122 l = len(st)
122 l = len(st)
123 if l == 40:
123 if l == 40:
124 return st[:20], st[20:40]
124 return st[:20], st[20:40]
125 elif l > 0 and l < 40:
125 elif l > 0 and l < 40:
126 raise util.Abort(_('working directory state appears damaged!'))
126 raise util.Abort(_('working directory state appears damaged!'))
127 except IOError, err:
127 except IOError, err:
128 if err.errno != errno.ENOENT:
128 if err.errno != errno.ENOENT:
129 raise
129 raise
130 return [nullid, nullid]
130 return [nullid, nullid]
131
131
132 @propertycache
132 @propertycache
133 def _dirs(self):
133 def _dirs(self):
134 return scmutil.dirs(self._map, 'r')
134 return scmutil.dirs(self._map, 'r')
135
135
136 def dirs(self):
136 def dirs(self):
137 return self._dirs
137 return self._dirs
138
138
139 @rootcache('.hgignore')
139 @rootcache('.hgignore')
140 def _ignore(self):
140 def _ignore(self):
141 files = [self._join('.hgignore')]
141 files = [self._join('.hgignore')]
142 for name, path in self._ui.configitems("ui"):
142 for name, path in self._ui.configitems("ui"):
143 if name == 'ignore' or name.startswith('ignore.'):
143 if name == 'ignore' or name.startswith('ignore.'):
144 # we need to use os.path.join here rather than self._join
144 # we need to use os.path.join here rather than self._join
145 # because path is arbitrary and user-specified
145 # because path is arbitrary and user-specified
146 files.append(os.path.join(self._rootdir, util.expandpath(path)))
146 files.append(os.path.join(self._rootdir, util.expandpath(path)))
147 return ignore.ignore(self._root, files, self._ui.warn)
147 return ignore.ignore(self._root, files, self._ui.warn)
148
148
149 @propertycache
149 @propertycache
150 def _slash(self):
150 def _slash(self):
151 return self._ui.configbool('ui', 'slash') and os.sep != '/'
151 return self._ui.configbool('ui', 'slash') and os.sep != '/'
152
152
153 @propertycache
153 @propertycache
154 def _checklink(self):
154 def _checklink(self):
155 return util.checklink(self._root)
155 return util.checklink(self._root)
156
156
157 @propertycache
157 @propertycache
158 def _checkexec(self):
158 def _checkexec(self):
159 return util.checkexec(self._root)
159 return util.checkexec(self._root)
160
160
161 @propertycache
161 @propertycache
162 def _checkcase(self):
162 def _checkcase(self):
163 return not util.checkcase(self._join('.hg'))
163 return not util.checkcase(self._join('.hg'))
164
164
165 def _join(self, f):
165 def _join(self, f):
166 # much faster than os.path.join()
166 # much faster than os.path.join()
167 # it's safe because f is always a relative path
167 # it's safe because f is always a relative path
168 return self._rootdir + f
168 return self._rootdir + f
169
169
170 def flagfunc(self, buildfallback):
170 def flagfunc(self, buildfallback):
171 if self._checklink and self._checkexec:
171 if self._checklink and self._checkexec:
172 def f(x):
172 def f(x):
173 try:
173 try:
174 st = os.lstat(self._join(x))
174 st = os.lstat(self._join(x))
175 if util.statislink(st):
175 if util.statislink(st):
176 return 'l'
176 return 'l'
177 if util.statisexec(st):
177 if util.statisexec(st):
178 return 'x'
178 return 'x'
179 except OSError:
179 except OSError:
180 pass
180 pass
181 return ''
181 return ''
182 return f
182 return f
183
183
184 fallback = buildfallback()
184 fallback = buildfallback()
185 if self._checklink:
185 if self._checklink:
186 def f(x):
186 def f(x):
187 if os.path.islink(self._join(x)):
187 if os.path.islink(self._join(x)):
188 return 'l'
188 return 'l'
189 if 'x' in fallback(x):
189 if 'x' in fallback(x):
190 return 'x'
190 return 'x'
191 return ''
191 return ''
192 return f
192 return f
193 if self._checkexec:
193 if self._checkexec:
194 def f(x):
194 def f(x):
195 if 'l' in fallback(x):
195 if 'l' in fallback(x):
196 return 'l'
196 return 'l'
197 if util.isexec(self._join(x)):
197 if util.isexec(self._join(x)):
198 return 'x'
198 return 'x'
199 return ''
199 return ''
200 return f
200 return f
201 else:
201 else:
202 return fallback
202 return fallback
203
203
204 @propertycache
204 @propertycache
205 def _cwd(self):
205 def _cwd(self):
206 return os.getcwd()
206 return os.getcwd()
207
207
208 def getcwd(self):
208 def getcwd(self):
209 cwd = self._cwd
209 cwd = self._cwd
210 if cwd == self._root:
210 if cwd == self._root:
211 return ''
211 return ''
212 # self._root ends with a path separator if self._root is '/' or 'C:\'
212 # self._root ends with a path separator if self._root is '/' or 'C:\'
213 rootsep = self._root
213 rootsep = self._root
214 if not util.endswithsep(rootsep):
214 if not util.endswithsep(rootsep):
215 rootsep += os.sep
215 rootsep += os.sep
216 if cwd.startswith(rootsep):
216 if cwd.startswith(rootsep):
217 return cwd[len(rootsep):]
217 return cwd[len(rootsep):]
218 else:
218 else:
219 # we're outside the repo. return an absolute path.
219 # we're outside the repo. return an absolute path.
220 return cwd
220 return cwd
221
221
222 def pathto(self, f, cwd=None):
222 def pathto(self, f, cwd=None):
223 if cwd is None:
223 if cwd is None:
224 cwd = self.getcwd()
224 cwd = self.getcwd()
225 path = util.pathto(self._root, cwd, f)
225 path = util.pathto(self._root, cwd, f)
226 if self._slash:
226 if self._slash:
227 return util.pconvert(path)
227 return util.pconvert(path)
228 return path
228 return path
229
229
230 def __getitem__(self, key):
230 def __getitem__(self, key):
231 '''Return the current state of key (a filename) in the dirstate.
231 '''Return the current state of key (a filename) in the dirstate.
232
232
233 States are:
233 States are:
234 n normal
234 n normal
235 m needs merging
235 m needs merging
236 r marked for removal
236 r marked for removal
237 a marked for addition
237 a marked for addition
238 ? not tracked
238 ? not tracked
239 '''
239 '''
240 return self._map.get(key, ("?",))[0]
240 return self._map.get(key, ("?",))[0]
241
241
242 def __contains__(self, key):
242 def __contains__(self, key):
243 return key in self._map
243 return key in self._map
244
244
245 def __iter__(self):
245 def __iter__(self):
246 for x in sorted(self._map):
246 for x in sorted(self._map):
247 yield x
247 yield x
248
248
249 def iteritems(self):
249 def iteritems(self):
250 return self._map.iteritems()
250 return self._map.iteritems()
251
251
252 def parents(self):
252 def parents(self):
253 return [self._validate(p) for p in self._pl]
253 return [self._validate(p) for p in self._pl]
254
254
255 def p1(self):
255 def p1(self):
256 return self._validate(self._pl[0])
256 return self._validate(self._pl[0])
257
257
258 def p2(self):
258 def p2(self):
259 return self._validate(self._pl[1])
259 return self._validate(self._pl[1])
260
260
261 def branch(self):
261 def branch(self):
262 return encoding.tolocal(self._branch)
262 return encoding.tolocal(self._branch)
263
263
264 def setparents(self, p1, p2=nullid):
264 def setparents(self, p1, p2=nullid):
265 """Set dirstate parents to p1 and p2.
265 """Set dirstate parents to p1 and p2.
266
266
267 When moving from two parents to one, 'm' merged entries a
267 When moving from two parents to one, 'm' merged entries a
268 adjusted to normal and previous copy records discarded and
268 adjusted to normal and previous copy records discarded and
269 returned by the call.
269 returned by the call.
270
270
271 See localrepo.setparents()
271 See localrepo.setparents()
272 """
272 """
273 if self._parentwriters == 0:
273 if self._parentwriters == 0:
274 raise ValueError("cannot set dirstate parent without "
274 raise ValueError("cannot set dirstate parent without "
275 "calling dirstate.beginparentchange")
275 "calling dirstate.beginparentchange")
276
276
277 self._dirty = self._dirtypl = True
277 self._dirty = self._dirtypl = True
278 oldp2 = self._pl[1]
278 oldp2 = self._pl[1]
279 self._pl = p1, p2
279 self._pl = p1, p2
280 copies = {}
280 copies = {}
281 if oldp2 != nullid and p2 == nullid:
281 if oldp2 != nullid and p2 == nullid:
282 for f, s in self._map.iteritems():
282 for f, s in self._map.iteritems():
283 # Discard 'm' markers when moving away from a merge state
283 # Discard 'm' markers when moving away from a merge state
284 if s[0] == 'm':
284 if s[0] == 'm':
285 if f in self._copymap:
285 if f in self._copymap:
286 copies[f] = self._copymap[f]
286 copies[f] = self._copymap[f]
287 self.normallookup(f)
287 self.normallookup(f)
288 # Also fix up otherparent markers
288 # Also fix up otherparent markers
289 elif s[0] == 'n' and s[2] == -2:
289 elif s[0] == 'n' and s[2] == -2:
290 if f in self._copymap:
290 if f in self._copymap:
291 copies[f] = self._copymap[f]
291 copies[f] = self._copymap[f]
292 self.add(f)
292 self.add(f)
293 return copies
293 return copies
294
294
295 def setbranch(self, branch):
295 def setbranch(self, branch):
296 self._branch = encoding.fromlocal(branch)
296 self._branch = encoding.fromlocal(branch)
297 f = self._opener('branch', 'w', atomictemp=True)
297 f = self._opener('branch', 'w', atomictemp=True)
298 try:
298 try:
299 f.write(self._branch + '\n')
299 f.write(self._branch + '\n')
300 f.close()
300 f.close()
301
301
302 # make sure filecache has the correct stat info for _branch after
302 # make sure filecache has the correct stat info for _branch after
303 # replacing the underlying file
303 # replacing the underlying file
304 ce = self._filecache['_branch']
304 ce = self._filecache['_branch']
305 if ce:
305 if ce:
306 ce.refresh()
306 ce.refresh()
307 except: # re-raises
307 except: # re-raises
308 f.discard()
308 f.discard()
309 raise
309 raise
310
310
311 def _read(self):
311 def _read(self):
312 self._map = {}
312 self._map = {}
313 self._copymap = {}
313 self._copymap = {}
314 try:
314 try:
315 st = self._opener.read("dirstate")
315 st = self._opener.read("dirstate")
316 except IOError, err:
316 except IOError, err:
317 if err.errno != errno.ENOENT:
317 if err.errno != errno.ENOENT:
318 raise
318 raise
319 return
319 return
320 if not st:
320 if not st:
321 return
321 return
322
322
323 # Python's garbage collector triggers a GC each time a certain number
323 # Python's garbage collector triggers a GC each time a certain number
324 # of container objects (the number being defined by
324 # of container objects (the number being defined by
325 # gc.get_threshold()) are allocated. parse_dirstate creates a tuple
325 # gc.get_threshold()) are allocated. parse_dirstate creates a tuple
326 # for each file in the dirstate. The C version then immediately marks
326 # for each file in the dirstate. The C version then immediately marks
327 # them as not to be tracked by the collector. However, this has no
327 # them as not to be tracked by the collector. However, this has no
328 # effect on when GCs are triggered, only on what objects the GC looks
328 # effect on when GCs are triggered, only on what objects the GC looks
329 # into. This means that O(number of files) GCs are unavoidable.
329 # into. This means that O(number of files) GCs are unavoidable.
330 # Depending on when in the process's lifetime the dirstate is parsed,
330 # Depending on when in the process's lifetime the dirstate is parsed,
331 # this can get very expensive. As a workaround, disable GC while
331 # this can get very expensive. As a workaround, disable GC while
332 # parsing the dirstate.
332 # parsing the dirstate.
333 #
333 #
334 # (we cannot decorate the function directly since it is in a C module)
334 # (we cannot decorate the function directly since it is in a C module)
335 parse_dirstate = util.nogc(parsers.parse_dirstate)
335 parse_dirstate = util.nogc(parsers.parse_dirstate)
336 p = parse_dirstate(self._map, self._copymap, st)
336 p = parse_dirstate(self._map, self._copymap, st)
337 if not self._dirtypl:
337 if not self._dirtypl:
338 self._pl = p
338 self._pl = p
339
339
340 def invalidate(self):
340 def invalidate(self):
341 for a in ("_map", "_copymap", "_filefoldmap", "_dirfoldmap", "_branch",
341 for a in ("_map", "_copymap", "_filefoldmap", "_dirfoldmap", "_branch",
342 "_pl", "_dirs", "_ignore"):
342 "_pl", "_dirs", "_ignore"):
343 if a in self.__dict__:
343 if a in self.__dict__:
344 delattr(self, a)
344 delattr(self, a)
345 self._lastnormaltime = 0
345 self._lastnormaltime = 0
346 self._dirty = False
346 self._dirty = False
347 self._parentwriters = 0
347 self._parentwriters = 0
348
348
349 def copy(self, source, dest):
349 def copy(self, source, dest):
350 """Mark dest as a copy of source. Unmark dest if source is None."""
350 """Mark dest as a copy of source. Unmark dest if source is None."""
351 if source == dest:
351 if source == dest:
352 return
352 return
353 self._dirty = True
353 self._dirty = True
354 if source is not None:
354 if source is not None:
355 self._copymap[dest] = source
355 self._copymap[dest] = source
356 elif dest in self._copymap:
356 elif dest in self._copymap:
357 del self._copymap[dest]
357 del self._copymap[dest]
358
358
359 def copied(self, file):
359 def copied(self, file):
360 return self._copymap.get(file, None)
360 return self._copymap.get(file, None)
361
361
362 def copies(self):
362 def copies(self):
363 return self._copymap
363 return self._copymap
364
364
365 def _droppath(self, f):
365 def _droppath(self, f):
366 if self[f] not in "?r" and "_dirs" in self.__dict__:
366 if self[f] not in "?r" and "_dirs" in self.__dict__:
367 self._dirs.delpath(f)
367 self._dirs.delpath(f)
368
368
369 def _addpath(self, f, state, mode, size, mtime):
369 def _addpath(self, f, state, mode, size, mtime):
370 oldstate = self[f]
370 oldstate = self[f]
371 if state == 'a' or oldstate == 'r':
371 if state == 'a' or oldstate == 'r':
372 scmutil.checkfilename(f)
372 scmutil.checkfilename(f)
373 if f in self._dirs:
373 if f in self._dirs:
374 raise util.Abort(_('directory %r already in dirstate') % f)
374 raise util.Abort(_('directory %r already in dirstate') % f)
375 # shadows
375 # shadows
376 for d in scmutil.finddirs(f):
376 for d in scmutil.finddirs(f):
377 if d in self._dirs:
377 if d in self._dirs:
378 break
378 break
379 if d in self._map and self[d] != 'r':
379 if d in self._map and self[d] != 'r':
380 raise util.Abort(
380 raise util.Abort(
381 _('file %r in dirstate clashes with %r') % (d, f))
381 _('file %r in dirstate clashes with %r') % (d, f))
382 if oldstate in "?r" and "_dirs" in self.__dict__:
382 if oldstate in "?r" and "_dirs" in self.__dict__:
383 self._dirs.addpath(f)
383 self._dirs.addpath(f)
384 self._dirty = True
384 self._dirty = True
385 self._map[f] = dirstatetuple(state, mode, size, mtime)
385 self._map[f] = dirstatetuple(state, mode, size, mtime)
386
386
387 def normal(self, f):
387 def normal(self, f):
388 '''Mark a file normal and clean.'''
388 '''Mark a file normal and clean.'''
389 s = os.lstat(self._join(f))
389 s = os.lstat(self._join(f))
390 mtime = int(s.st_mtime)
390 mtime = int(s.st_mtime)
391 self._addpath(f, 'n', s.st_mode,
391 self._addpath(f, 'n', s.st_mode,
392 s.st_size & _rangemask, mtime & _rangemask)
392 s.st_size & _rangemask, mtime & _rangemask)
393 if f in self._copymap:
393 if f in self._copymap:
394 del self._copymap[f]
394 del self._copymap[f]
395 if mtime > self._lastnormaltime:
395 if mtime > self._lastnormaltime:
396 # Remember the most recent modification timeslot for status(),
396 # Remember the most recent modification timeslot for status(),
397 # to make sure we won't miss future size-preserving file content
397 # to make sure we won't miss future size-preserving file content
398 # modifications that happen within the same timeslot.
398 # modifications that happen within the same timeslot.
399 self._lastnormaltime = mtime
399 self._lastnormaltime = mtime
400
400
401 def normallookup(self, f):
401 def normallookup(self, f):
402 '''Mark a file normal, but possibly dirty.'''
402 '''Mark a file normal, but possibly dirty.'''
403 if self._pl[1] != nullid and f in self._map:
403 if self._pl[1] != nullid and f in self._map:
404 # if there is a merge going on and the file was either
404 # if there is a merge going on and the file was either
405 # in state 'm' (-1) or coming from other parent (-2) before
405 # in state 'm' (-1) or coming from other parent (-2) before
406 # being removed, restore that state.
406 # being removed, restore that state.
407 entry = self._map[f]
407 entry = self._map[f]
408 if entry[0] == 'r' and entry[2] in (-1, -2):
408 if entry[0] == 'r' and entry[2] in (-1, -2):
409 source = self._copymap.get(f)
409 source = self._copymap.get(f)
410 if entry[2] == -1:
410 if entry[2] == -1:
411 self.merge(f)
411 self.merge(f)
412 elif entry[2] == -2:
412 elif entry[2] == -2:
413 self.otherparent(f)
413 self.otherparent(f)
414 if source:
414 if source:
415 self.copy(source, f)
415 self.copy(source, f)
416 return
416 return
417 if entry[0] == 'm' or entry[0] == 'n' and entry[2] == -2:
417 if entry[0] == 'm' or entry[0] == 'n' and entry[2] == -2:
418 return
418 return
419 self._addpath(f, 'n', 0, -1, -1)
419 self._addpath(f, 'n', 0, -1, -1)
420 if f in self._copymap:
420 if f in self._copymap:
421 del self._copymap[f]
421 del self._copymap[f]
422
422
423 def otherparent(self, f):
423 def otherparent(self, f):
424 '''Mark as coming from the other parent, always dirty.'''
424 '''Mark as coming from the other parent, always dirty.'''
425 if self._pl[1] == nullid:
425 if self._pl[1] == nullid:
426 raise util.Abort(_("setting %r to other parent "
426 raise util.Abort(_("setting %r to other parent "
427 "only allowed in merges") % f)
427 "only allowed in merges") % f)
428 if f in self and self[f] == 'n':
428 if f in self and self[f] == 'n':
429 # merge-like
429 # merge-like
430 self._addpath(f, 'm', 0, -2, -1)
430 self._addpath(f, 'm', 0, -2, -1)
431 else:
431 else:
432 # add-like
432 # add-like
433 self._addpath(f, 'n', 0, -2, -1)
433 self._addpath(f, 'n', 0, -2, -1)
434
434
435 if f in self._copymap:
435 if f in self._copymap:
436 del self._copymap[f]
436 del self._copymap[f]
437
437
438 def add(self, f):
438 def add(self, f):
439 '''Mark a file added.'''
439 '''Mark a file added.'''
440 self._addpath(f, 'a', 0, -1, -1)
440 self._addpath(f, 'a', 0, -1, -1)
441 if f in self._copymap:
441 if f in self._copymap:
442 del self._copymap[f]
442 del self._copymap[f]
443
443
444 def remove(self, f):
444 def remove(self, f):
445 '''Mark a file removed.'''
445 '''Mark a file removed.'''
446 self._dirty = True
446 self._dirty = True
447 self._droppath(f)
447 self._droppath(f)
448 size = 0
448 size = 0
449 if self._pl[1] != nullid and f in self._map:
449 if self._pl[1] != nullid and f in self._map:
450 # backup the previous state
450 # backup the previous state
451 entry = self._map[f]
451 entry = self._map[f]
452 if entry[0] == 'm': # merge
452 if entry[0] == 'm': # merge
453 size = -1
453 size = -1
454 elif entry[0] == 'n' and entry[2] == -2: # other parent
454 elif entry[0] == 'n' and entry[2] == -2: # other parent
455 size = -2
455 size = -2
456 self._map[f] = dirstatetuple('r', 0, size, 0)
456 self._map[f] = dirstatetuple('r', 0, size, 0)
457 if size == 0 and f in self._copymap:
457 if size == 0 and f in self._copymap:
458 del self._copymap[f]
458 del self._copymap[f]
459
459
460 def merge(self, f):
460 def merge(self, f):
461 '''Mark a file merged.'''
461 '''Mark a file merged.'''
462 if self._pl[1] == nullid:
462 if self._pl[1] == nullid:
463 return self.normallookup(f)
463 return self.normallookup(f)
464 return self.otherparent(f)
464 return self.otherparent(f)
465
465
466 def drop(self, f):
466 def drop(self, f):
467 '''Drop a file from the dirstate'''
467 '''Drop a file from the dirstate'''
468 if f in self._map:
468 if f in self._map:
469 self._dirty = True
469 self._dirty = True
470 self._droppath(f)
470 self._droppath(f)
471 del self._map[f]
471 del self._map[f]
472
472
473 def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
473 def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
474 if exists is None:
474 if exists is None:
475 exists = os.path.lexists(os.path.join(self._root, path))
475 exists = os.path.lexists(os.path.join(self._root, path))
476 if not exists:
476 if not exists:
477 # Maybe a path component exists
477 # Maybe a path component exists
478 if not ignoremissing and '/' in path:
478 if not ignoremissing and '/' in path:
479 d, f = path.rsplit('/', 1)
479 d, f = path.rsplit('/', 1)
480 d = self._normalize(d, False, ignoremissing, None)
480 d = self._normalize(d, False, ignoremissing, None)
481 folded = d + "/" + f
481 folded = d + "/" + f
482 else:
482 else:
483 # No path components, preserve original case
483 # No path components, preserve original case
484 folded = path
484 folded = path
485 else:
485 else:
486 # recursively normalize leading directory components
486 # recursively normalize leading directory components
487 # against dirstate
487 # against dirstate
488 if '/' in normed:
488 if '/' in normed:
489 d, f = normed.rsplit('/', 1)
489 d, f = normed.rsplit('/', 1)
490 d = self._normalize(d, False, ignoremissing, True)
490 d = self._normalize(d, False, ignoremissing, True)
491 r = self._root + "/" + d
491 r = self._root + "/" + d
492 folded = d + "/" + util.fspath(f, r)
492 folded = d + "/" + util.fspath(f, r)
493 else:
493 else:
494 folded = util.fspath(normed, self._root)
494 folded = util.fspath(normed, self._root)
495 storemap[normed] = folded
495 storemap[normed] = folded
496
496
497 return folded
497 return folded
498
498
499 def _normalizefile(self, path, isknown, ignoremissing=False, exists=None):
499 def _normalizefile(self, path, isknown, ignoremissing=False, exists=None):
500 normed = util.normcase(path)
500 normed = util.normcase(path)
501 folded = self._filefoldmap.get(normed, None)
501 folded = self._filefoldmap.get(normed, None)
502 if folded is None:
502 if folded is None:
503 if isknown:
503 if isknown:
504 folded = path
504 folded = path
505 else:
505 else:
506 folded = self._discoverpath(path, normed, ignoremissing, exists,
506 folded = self._discoverpath(path, normed, ignoremissing, exists,
507 self._filefoldmap)
507 self._filefoldmap)
508 return folded
508 return folded
509
509
510 def _normalize(self, path, isknown, ignoremissing=False, exists=None):
510 def _normalize(self, path, isknown, ignoremissing=False, exists=None):
511 normed = util.normcase(path)
511 normed = util.normcase(path)
512 folded = self._filefoldmap.get(normed,
512 folded = self._filefoldmap.get(normed,
513 self._dirfoldmap.get(normed, None))
513 self._dirfoldmap.get(normed, None))
514 if folded is None:
514 if folded is None:
515 if isknown:
515 if isknown:
516 folded = path
516 folded = path
517 else:
517 else:
518 # store discovered result in dirfoldmap so that future
518 # store discovered result in dirfoldmap so that future
519 # normalizefile calls don't start matching directories
519 # normalizefile calls don't start matching directories
520 folded = self._discoverpath(path, normed, ignoremissing, exists,
520 folded = self._discoverpath(path, normed, ignoremissing, exists,
521 self._dirfoldmap)
521 self._dirfoldmap)
522 return folded
522 return folded
523
523
524 def normalize(self, path, isknown=False, ignoremissing=False):
524 def normalize(self, path, isknown=False, ignoremissing=False):
525 '''
525 '''
526 normalize the case of a pathname when on a casefolding filesystem
526 normalize the case of a pathname when on a casefolding filesystem
527
527
528 isknown specifies whether the filename came from walking the
528 isknown specifies whether the filename came from walking the
529 disk, to avoid extra filesystem access.
529 disk, to avoid extra filesystem access.
530
530
531 If ignoremissing is True, missing path are returned
531 If ignoremissing is True, missing path are returned
532 unchanged. Otherwise, we try harder to normalize possibly
532 unchanged. Otherwise, we try harder to normalize possibly
533 existing path components.
533 existing path components.
534
534
535 The normalized case is determined based on the following precedence:
535 The normalized case is determined based on the following precedence:
536
536
537 - version of name already stored in the dirstate
537 - version of name already stored in the dirstate
538 - version of name stored on disk
538 - version of name stored on disk
539 - version provided via command arguments
539 - version provided via command arguments
540 '''
540 '''
541
541
542 if self._checkcase:
542 if self._checkcase:
543 return self._normalize(path, isknown, ignoremissing)
543 return self._normalize(path, isknown, ignoremissing)
544 return path
544 return path
545
545
546 def clear(self):
546 def clear(self):
547 self._map = {}
547 self._map = {}
548 if "_dirs" in self.__dict__:
548 if "_dirs" in self.__dict__:
549 delattr(self, "_dirs")
549 delattr(self, "_dirs")
550 self._copymap = {}
550 self._copymap = {}
551 self._pl = [nullid, nullid]
551 self._pl = [nullid, nullid]
552 self._lastnormaltime = 0
552 self._lastnormaltime = 0
553 self._dirty = True
553 self._dirty = True
554
554
555 def rebuild(self, parent, allfiles, changedfiles=None):
555 def rebuild(self, parent, allfiles, changedfiles=None):
556 changedfiles = changedfiles or allfiles
556 changedfiles = changedfiles or allfiles
557 oldmap = self._map
557 oldmap = self._map
558 self.clear()
558 self.clear()
559 for f in allfiles:
559 for f in allfiles:
560 if f not in changedfiles:
560 if f not in changedfiles:
561 self._map[f] = oldmap[f]
561 self._map[f] = oldmap[f]
562 else:
562 else:
563 if 'x' in allfiles.flags(f):
563 if 'x' in allfiles.flags(f):
564 self._map[f] = dirstatetuple('n', 0777, -1, 0)
564 self._map[f] = dirstatetuple('n', 0777, -1, 0)
565 else:
565 else:
566 self._map[f] = dirstatetuple('n', 0666, -1, 0)
566 self._map[f] = dirstatetuple('n', 0666, -1, 0)
567 self._pl = (parent, nullid)
567 self._pl = (parent, nullid)
568 self._dirty = True
568 self._dirty = True
569
569
570 def write(self):
570 def write(self):
571 if not self._dirty:
571 if not self._dirty:
572 return
572 return
573
573
574 # enough 'delaywrite' prevents 'pack_dirstate' from dropping
574 # enough 'delaywrite' prevents 'pack_dirstate' from dropping
575 # timestamp of each entries in dirstate, because of 'now > mtime'
575 # timestamp of each entries in dirstate, because of 'now > mtime'
576 delaywrite = self._ui.configint('debug', 'dirstate.delaywrite', 0)
576 delaywrite = self._ui.configint('debug', 'dirstate.delaywrite', 0)
577 if delaywrite > 0:
577 if delaywrite > 0:
578 import time # to avoid useless import
578 import time # to avoid useless import
579 time.sleep(delaywrite)
579 time.sleep(delaywrite)
580
580
581 st = self._opener("dirstate", "w", atomictemp=True)
581 st = self._opener("dirstate", "w", atomictemp=True)
582 # use the modification time of the newly created temporary file as the
582 # use the modification time of the newly created temporary file as the
583 # filesystem's notion of 'now'
583 # filesystem's notion of 'now'
584 now = util.fstat(st).st_mtime
584 now = util.fstat(st).st_mtime
585 st.write(parsers.pack_dirstate(self._map, self._copymap, self._pl, now))
585 st.write(parsers.pack_dirstate(self._map, self._copymap, self._pl, now))
586 st.close()
586 st.close()
587 self._lastnormaltime = 0
587 self._lastnormaltime = 0
588 self._dirty = self._dirtypl = False
588 self._dirty = self._dirtypl = False
589
589
590 def _dirignore(self, f):
590 def _dirignore(self, f):
591 if f == '.':
591 if f == '.':
592 return False
592 return False
593 if self._ignore(f):
593 if self._ignore(f):
594 return True
594 return True
595 for p in scmutil.finddirs(f):
595 for p in scmutil.finddirs(f):
596 if self._ignore(p):
596 if self._ignore(p):
597 return True
597 return True
598 return False
598 return False
599
599
600 def _walkexplicit(self, match, subrepos):
600 def _walkexplicit(self, match, subrepos):
601 '''Get stat data about the files explicitly specified by match.
601 '''Get stat data about the files explicitly specified by match.
602
602
603 Return a triple (results, dirsfound, dirsnotfound).
603 Return a triple (results, dirsfound, dirsnotfound).
604 - results is a mapping from filename to stat result. It also contains
604 - results is a mapping from filename to stat result. It also contains
605 listings mapping subrepos and .hg to None.
605 listings mapping subrepos and .hg to None.
606 - dirsfound is a list of files found to be directories.
606 - dirsfound is a list of files found to be directories.
607 - dirsnotfound is a list of files that the dirstate thinks are
607 - dirsnotfound is a list of files that the dirstate thinks are
608 directories and that were not found.'''
608 directories and that were not found.'''
609
609
610 def badtype(mode):
610 def badtype(mode):
611 kind = _('unknown')
611 kind = _('unknown')
612 if stat.S_ISCHR(mode):
612 if stat.S_ISCHR(mode):
613 kind = _('character device')
613 kind = _('character device')
614 elif stat.S_ISBLK(mode):
614 elif stat.S_ISBLK(mode):
615 kind = _('block device')
615 kind = _('block device')
616 elif stat.S_ISFIFO(mode):
616 elif stat.S_ISFIFO(mode):
617 kind = _('fifo')
617 kind = _('fifo')
618 elif stat.S_ISSOCK(mode):
618 elif stat.S_ISSOCK(mode):
619 kind = _('socket')
619 kind = _('socket')
620 elif stat.S_ISDIR(mode):
620 elif stat.S_ISDIR(mode):
621 kind = _('directory')
621 kind = _('directory')
622 return _('unsupported file type (type is %s)') % kind
622 return _('unsupported file type (type is %s)') % kind
623
623
624 matchedir = match.explicitdir
624 matchedir = match.explicitdir
625 badfn = match.bad
625 badfn = match.bad
626 dmap = self._map
626 dmap = self._map
627 lstat = os.lstat
627 lstat = os.lstat
628 getkind = stat.S_IFMT
628 getkind = stat.S_IFMT
629 dirkind = stat.S_IFDIR
629 dirkind = stat.S_IFDIR
630 regkind = stat.S_IFREG
630 regkind = stat.S_IFREG
631 lnkkind = stat.S_IFLNK
631 lnkkind = stat.S_IFLNK
632 join = self._join
632 join = self._join
633 dirsfound = []
633 dirsfound = []
634 foundadd = dirsfound.append
634 foundadd = dirsfound.append
635 dirsnotfound = []
635 dirsnotfound = []
636 notfoundadd = dirsnotfound.append
636 notfoundadd = dirsnotfound.append
637
637
638 if not match.isexact() and self._checkcase:
638 if not match.isexact() and self._checkcase:
639 normalize = self._normalize
639 normalize = self._normalize
640 else:
640 else:
641 normalize = None
641 normalize = None
642
642
643 files = sorted(match.files())
643 files = sorted(match.files())
644 subrepos.sort()
644 subrepos.sort()
645 i, j = 0, 0
645 i, j = 0, 0
646 while i < len(files) and j < len(subrepos):
646 while i < len(files) and j < len(subrepos):
647 subpath = subrepos[j] + "/"
647 subpath = subrepos[j] + "/"
648 if files[i] < subpath:
648 if files[i] < subpath:
649 i += 1
649 i += 1
650 continue
650 continue
651 while i < len(files) and files[i].startswith(subpath):
651 while i < len(files) and files[i].startswith(subpath):
652 del files[i]
652 del files[i]
653 j += 1
653 j += 1
654
654
655 if not files or '.' in files:
655 if not files or '.' in files:
656 files = ['.']
656 files = ['.']
657 results = dict.fromkeys(subrepos)
657 results = dict.fromkeys(subrepos)
658 results['.hg'] = None
658 results['.hg'] = None
659
659
660 alldirs = None
660 alldirs = None
661 for ff in files:
661 for ff in files:
662 # constructing the foldmap is expensive, so don't do it for the
662 # constructing the foldmap is expensive, so don't do it for the
663 # common case where files is ['.']
663 # common case where files is ['.']
664 if normalize and ff != '.':
664 if normalize and ff != '.':
665 nf = normalize(ff, False, True)
665 nf = normalize(ff, False, True)
666 else:
666 else:
667 nf = ff
667 nf = ff
668 if nf in results:
668 if nf in results:
669 continue
669 continue
670
670
671 try:
671 try:
672 st = lstat(join(nf))
672 st = lstat(join(nf))
673 kind = getkind(st.st_mode)
673 kind = getkind(st.st_mode)
674 if kind == dirkind:
674 if kind == dirkind:
675 if nf in dmap:
675 if nf in dmap:
676 # file replaced by dir on disk but still in dirstate
676 # file replaced by dir on disk but still in dirstate
677 results[nf] = None
677 results[nf] = None
678 if matchedir:
678 if matchedir:
679 matchedir(nf)
679 matchedir(nf)
680 foundadd(nf)
680 foundadd((nf, ff))
681 elif kind == regkind or kind == lnkkind:
681 elif kind == regkind or kind == lnkkind:
682 results[nf] = st
682 results[nf] = st
683 else:
683 else:
684 badfn(ff, badtype(kind))
684 badfn(ff, badtype(kind))
685 if nf in dmap:
685 if nf in dmap:
686 results[nf] = None
686 results[nf] = None
687 except OSError, inst: # nf not found on disk - it is dirstate only
687 except OSError, inst: # nf not found on disk - it is dirstate only
688 if nf in dmap: # does it exactly match a missing file?
688 if nf in dmap: # does it exactly match a missing file?
689 results[nf] = None
689 results[nf] = None
690 else: # does it match a missing directory?
690 else: # does it match a missing directory?
691 if alldirs is None:
691 if alldirs is None:
692 alldirs = scmutil.dirs(dmap)
692 alldirs = scmutil.dirs(dmap)
693 if nf in alldirs:
693 if nf in alldirs:
694 if matchedir:
694 if matchedir:
695 matchedir(nf)
695 matchedir(nf)
696 notfoundadd(nf)
696 notfoundadd(nf)
697 else:
697 else:
698 badfn(ff, inst.strerror)
698 badfn(ff, inst.strerror)
699
699
700 return results, dirsfound, dirsnotfound
700 return results, dirsfound, dirsnotfound
701
701
702 def walk(self, match, subrepos, unknown, ignored, full=True):
702 def walk(self, match, subrepos, unknown, ignored, full=True):
703 '''
703 '''
704 Walk recursively through the directory tree, finding all files
704 Walk recursively through the directory tree, finding all files
705 matched by match.
705 matched by match.
706
706
707 If full is False, maybe skip some known-clean files.
707 If full is False, maybe skip some known-clean files.
708
708
709 Return a dict mapping filename to stat-like object (either
709 Return a dict mapping filename to stat-like object (either
710 mercurial.osutil.stat instance or return value of os.stat()).
710 mercurial.osutil.stat instance or return value of os.stat()).
711
711
712 '''
712 '''
713 # full is a flag that extensions that hook into walk can use -- this
713 # full is a flag that extensions that hook into walk can use -- this
714 # implementation doesn't use it at all. This satisfies the contract
714 # implementation doesn't use it at all. This satisfies the contract
715 # because we only guarantee a "maybe".
715 # because we only guarantee a "maybe".
716
716
717 if ignored:
717 if ignored:
718 ignore = util.never
718 ignore = util.never
719 dirignore = util.never
719 dirignore = util.never
720 elif unknown:
720 elif unknown:
721 ignore = self._ignore
721 ignore = self._ignore
722 dirignore = self._dirignore
722 dirignore = self._dirignore
723 else:
723 else:
724 # if not unknown and not ignored, drop dir recursion and step 2
724 # if not unknown and not ignored, drop dir recursion and step 2
725 ignore = util.always
725 ignore = util.always
726 dirignore = util.always
726 dirignore = util.always
727
727
728 matchfn = match.matchfn
728 matchfn = match.matchfn
729 matchalways = match.always()
729 matchalways = match.always()
730 matchtdir = match.traversedir
730 matchtdir = match.traversedir
731 dmap = self._map
731 dmap = self._map
732 listdir = osutil.listdir
732 listdir = osutil.listdir
733 lstat = os.lstat
733 lstat = os.lstat
734 dirkind = stat.S_IFDIR
734 dirkind = stat.S_IFDIR
735 regkind = stat.S_IFREG
735 regkind = stat.S_IFREG
736 lnkkind = stat.S_IFLNK
736 lnkkind = stat.S_IFLNK
737 join = self._join
737 join = self._join
738
738
739 exact = skipstep3 = False
739 exact = skipstep3 = False
740 if match.isexact(): # match.exact
740 if match.isexact(): # match.exact
741 exact = True
741 exact = True
742 dirignore = util.always # skip step 2
742 dirignore = util.always # skip step 2
743 elif match.files() and not match.anypats(): # match.match, no patterns
743 elif match.files() and not match.anypats(): # match.match, no patterns
744 skipstep3 = True
744 skipstep3 = True
745
745
746 if not exact and self._checkcase:
746 if not exact and self._checkcase:
747 normalizefile = self._normalizefile
747 normalizefile = self._normalizefile
748 skipstep3 = False
748 skipstep3 = False
749 else:
749 else:
750 normalizefile = None
750 normalizefile = None
751
751
752 # step 1: find all explicit files
752 # step 1: find all explicit files
753 results, work, dirsnotfound = self._walkexplicit(match, subrepos)
753 results, work, dirsnotfound = self._walkexplicit(match, subrepos)
754
754
755 skipstep3 = skipstep3 and not (work or dirsnotfound)
755 skipstep3 = skipstep3 and not (work or dirsnotfound)
756 work = [d for d in work if not dirignore(d)]
756 work = [d for d in work if not dirignore(d[0])]
757 wadd = work.append
757 wadd = work.append
758
758
759 # step 2: visit subdirectories
759 # step 2: visit subdirectories
760 while work:
760 while work:
761 nd = work.pop()
761 nd, d = work.pop()
762 skip = None
762 skip = None
763 if nd == '.':
763 if nd == '.':
764 nd = ''
764 nd = ''
765 d = ''
765 else:
766 else:
766 skip = '.hg'
767 skip = '.hg'
767 try:
768 try:
768 entries = listdir(join(nd), stat=True, skip=skip)
769 entries = listdir(join(nd), stat=True, skip=skip)
769 except OSError, inst:
770 except OSError, inst:
770 if inst.errno in (errno.EACCES, errno.ENOENT):
771 if inst.errno in (errno.EACCES, errno.ENOENT):
771 match.bad(self.pathto(nd), inst.strerror)
772 match.bad(self.pathto(nd), inst.strerror)
772 continue
773 continue
773 raise
774 raise
774 for f, kind, st in entries:
775 for f, kind, st in entries:
775 if normalizefile:
776 if normalizefile:
776 # even though f might be a directory, we're only interested
777 # even though f might be a directory, we're only interested
777 # in comparing it to files currently in the dmap --
778 # in comparing it to files currently in the dmap --
778 # therefore normalizefile is enough
779 # therefore normalizefile is enough
780 f = d and (d + "/" + f) or f
779 nf = normalizefile(nd and (nd + "/" + f) or f, True, True)
781 nf = normalizefile(nd and (nd + "/" + f) or f, True, True)
780 else:
782 else:
781 nf = nd and (nd + "/" + f) or f
783 nf = nd and (nd + "/" + f) or f
784 f = nf
782 if nf not in results:
785 if nf not in results:
783 if kind == dirkind:
786 if kind == dirkind:
784 if not ignore(nf):
787 if not ignore(nf):
785 if matchtdir:
788 if matchtdir:
786 matchtdir(nf)
789 matchtdir(nf)
787 wadd(nf)
790 wadd((nf, f))
788 if nf in dmap and (matchalways or matchfn(nf)):
791 if nf in dmap and (matchalways or matchfn(nf)):
789 results[nf] = None
792 results[nf] = None
790 elif kind == regkind or kind == lnkkind:
793 elif kind == regkind or kind == lnkkind:
791 if nf in dmap:
794 if nf in dmap:
792 if matchalways or matchfn(nf):
795 if matchalways or matchfn(nf):
793 results[nf] = st
796 results[nf] = st
794 elif (matchalways or matchfn(nf)) and not ignore(nf):
797 elif (matchalways or matchfn(f)) and not ignore(nf):
795 results[nf] = st
798 results[nf] = st
796 elif nf in dmap and (matchalways or matchfn(nf)):
799 elif nf in dmap and (matchalways or matchfn(nf)):
797 results[nf] = None
800 results[nf] = None
798
801
799 for s in subrepos:
802 for s in subrepos:
800 del results[s]
803 del results[s]
801 del results['.hg']
804 del results['.hg']
802
805
803 # step 3: visit remaining files from dmap
806 # step 3: visit remaining files from dmap
804 if not skipstep3 and not exact:
807 if not skipstep3 and not exact:
805 # If a dmap file is not in results yet, it was either
808 # If a dmap file is not in results yet, it was either
806 # a) not matching matchfn b) ignored, c) missing, or d) under a
809 # a) not matching matchfn b) ignored, c) missing, or d) under a
807 # symlink directory.
810 # symlink directory.
808 if not results and matchalways:
811 if not results and matchalways:
809 visit = dmap.keys()
812 visit = dmap.keys()
810 else:
813 else:
811 visit = [f for f in dmap if f not in results and matchfn(f)]
814 visit = [f for f in dmap if f not in results and matchfn(f)]
812 visit.sort()
815 visit.sort()
813
816
814 if unknown:
817 if unknown:
815 # unknown == True means we walked all dirs under the roots
818 # unknown == True means we walked all dirs under the roots
816 # that wasn't ignored, and everything that matched was stat'ed
819 # that wasn't ignored, and everything that matched was stat'ed
817 # and is already in results.
820 # and is already in results.
818 # The rest must thus be ignored or under a symlink.
821 # The rest must thus be ignored or under a symlink.
819 audit_path = pathutil.pathauditor(self._root)
822 audit_path = pathutil.pathauditor(self._root)
820
823
821 for nf in iter(visit):
824 for nf in iter(visit):
822 # Report ignored items in the dmap as long as they are not
825 # Report ignored items in the dmap as long as they are not
823 # under a symlink directory.
826 # under a symlink directory.
824 if audit_path.check(nf):
827 if audit_path.check(nf):
825 try:
828 try:
826 results[nf] = lstat(join(nf))
829 results[nf] = lstat(join(nf))
827 # file was just ignored, no links, and exists
830 # file was just ignored, no links, and exists
828 except OSError:
831 except OSError:
829 # file doesn't exist
832 # file doesn't exist
830 results[nf] = None
833 results[nf] = None
831 else:
834 else:
832 # It's either missing or under a symlink directory
835 # It's either missing or under a symlink directory
833 # which we in this case report as missing
836 # which we in this case report as missing
834 results[nf] = None
837 results[nf] = None
835 else:
838 else:
836 # We may not have walked the full directory tree above,
839 # We may not have walked the full directory tree above,
837 # so stat and check everything we missed.
840 # so stat and check everything we missed.
838 nf = iter(visit).next
841 nf = iter(visit).next
839 for st in util.statfiles([join(i) for i in visit]):
842 for st in util.statfiles([join(i) for i in visit]):
840 results[nf()] = st
843 results[nf()] = st
841 return results
844 return results
842
845
843 def status(self, match, subrepos, ignored, clean, unknown):
846 def status(self, match, subrepos, ignored, clean, unknown):
844 '''Determine the status of the working copy relative to the
847 '''Determine the status of the working copy relative to the
845 dirstate and return a pair of (unsure, status), where status is of type
848 dirstate and return a pair of (unsure, status), where status is of type
846 scmutil.status and:
849 scmutil.status and:
847
850
848 unsure:
851 unsure:
849 files that might have been modified since the dirstate was
852 files that might have been modified since the dirstate was
850 written, but need to be read to be sure (size is the same
853 written, but need to be read to be sure (size is the same
851 but mtime differs)
854 but mtime differs)
852 status.modified:
855 status.modified:
853 files that have definitely been modified since the dirstate
856 files that have definitely been modified since the dirstate
854 was written (different size or mode)
857 was written (different size or mode)
855 status.clean:
858 status.clean:
856 files that have definitely not been modified since the
859 files that have definitely not been modified since the
857 dirstate was written
860 dirstate was written
858 '''
861 '''
859 listignored, listclean, listunknown = ignored, clean, unknown
862 listignored, listclean, listunknown = ignored, clean, unknown
860 lookup, modified, added, unknown, ignored = [], [], [], [], []
863 lookup, modified, added, unknown, ignored = [], [], [], [], []
861 removed, deleted, clean = [], [], []
864 removed, deleted, clean = [], [], []
862
865
863 dmap = self._map
866 dmap = self._map
864 ladd = lookup.append # aka "unsure"
867 ladd = lookup.append # aka "unsure"
865 madd = modified.append
868 madd = modified.append
866 aadd = added.append
869 aadd = added.append
867 uadd = unknown.append
870 uadd = unknown.append
868 iadd = ignored.append
871 iadd = ignored.append
869 radd = removed.append
872 radd = removed.append
870 dadd = deleted.append
873 dadd = deleted.append
871 cadd = clean.append
874 cadd = clean.append
872 mexact = match.exact
875 mexact = match.exact
873 dirignore = self._dirignore
876 dirignore = self._dirignore
874 checkexec = self._checkexec
877 checkexec = self._checkexec
875 copymap = self._copymap
878 copymap = self._copymap
876 lastnormaltime = self._lastnormaltime
879 lastnormaltime = self._lastnormaltime
877
880
878 # We need to do full walks when either
881 # We need to do full walks when either
879 # - we're listing all clean files, or
882 # - we're listing all clean files, or
880 # - match.traversedir does something, because match.traversedir should
883 # - match.traversedir does something, because match.traversedir should
881 # be called for every dir in the working dir
884 # be called for every dir in the working dir
882 full = listclean or match.traversedir is not None
885 full = listclean or match.traversedir is not None
883 for fn, st in self.walk(match, subrepos, listunknown, listignored,
886 for fn, st in self.walk(match, subrepos, listunknown, listignored,
884 full=full).iteritems():
887 full=full).iteritems():
885 if fn not in dmap:
888 if fn not in dmap:
886 if (listignored or mexact(fn)) and dirignore(fn):
889 if (listignored or mexact(fn)) and dirignore(fn):
887 if listignored:
890 if listignored:
888 iadd(fn)
891 iadd(fn)
889 else:
892 else:
890 uadd(fn)
893 uadd(fn)
891 continue
894 continue
892
895
893 # This is equivalent to 'state, mode, size, time = dmap[fn]' but not
896 # This is equivalent to 'state, mode, size, time = dmap[fn]' but not
894 # written like that for performance reasons. dmap[fn] is not a
897 # written like that for performance reasons. dmap[fn] is not a
895 # Python tuple in compiled builds. The CPython UNPACK_SEQUENCE
898 # Python tuple in compiled builds. The CPython UNPACK_SEQUENCE
896 # opcode has fast paths when the value to be unpacked is a tuple or
899 # opcode has fast paths when the value to be unpacked is a tuple or
897 # a list, but falls back to creating a full-fledged iterator in
900 # a list, but falls back to creating a full-fledged iterator in
898 # general. That is much slower than simply accessing and storing the
901 # general. That is much slower than simply accessing and storing the
899 # tuple members one by one.
902 # tuple members one by one.
900 t = dmap[fn]
903 t = dmap[fn]
901 state = t[0]
904 state = t[0]
902 mode = t[1]
905 mode = t[1]
903 size = t[2]
906 size = t[2]
904 time = t[3]
907 time = t[3]
905
908
906 if not st and state in "nma":
909 if not st and state in "nma":
907 dadd(fn)
910 dadd(fn)
908 elif state == 'n':
911 elif state == 'n':
909 mtime = int(st.st_mtime)
912 mtime = int(st.st_mtime)
910 if (size >= 0 and
913 if (size >= 0 and
911 ((size != st.st_size and size != st.st_size & _rangemask)
914 ((size != st.st_size and size != st.st_size & _rangemask)
912 or ((mode ^ st.st_mode) & 0100 and checkexec))
915 or ((mode ^ st.st_mode) & 0100 and checkexec))
913 or size == -2 # other parent
916 or size == -2 # other parent
914 or fn in copymap):
917 or fn in copymap):
915 madd(fn)
918 madd(fn)
916 elif time != mtime and time != mtime & _rangemask:
919 elif time != mtime and time != mtime & _rangemask:
917 ladd(fn)
920 ladd(fn)
918 elif mtime == lastnormaltime:
921 elif mtime == lastnormaltime:
919 # fn may have just been marked as normal and it may have
922 # fn may have just been marked as normal and it may have
920 # changed in the same second without changing its size.
923 # changed in the same second without changing its size.
921 # This can happen if we quickly do multiple commits.
924 # This can happen if we quickly do multiple commits.
922 # Force lookup, so we don't miss such a racy file change.
925 # Force lookup, so we don't miss such a racy file change.
923 ladd(fn)
926 ladd(fn)
924 elif listclean:
927 elif listclean:
925 cadd(fn)
928 cadd(fn)
926 elif state == 'm':
929 elif state == 'm':
927 madd(fn)
930 madd(fn)
928 elif state == 'a':
931 elif state == 'a':
929 aadd(fn)
932 aadd(fn)
930 elif state == 'r':
933 elif state == 'r':
931 radd(fn)
934 radd(fn)
932
935
933 return (lookup, scmutil.status(modified, added, removed, deleted,
936 return (lookup, scmutil.status(modified, added, removed, deleted,
934 unknown, ignored, clean))
937 unknown, ignored, clean))
935
938
936 def matches(self, match):
939 def matches(self, match):
937 '''
940 '''
938 return files in the dirstate (in whatever state) filtered by match
941 return files in the dirstate (in whatever state) filtered by match
939 '''
942 '''
940 dmap = self._map
943 dmap = self._map
941 if match.always():
944 if match.always():
942 return dmap.keys()
945 return dmap.keys()
943 files = match.files()
946 files = match.files()
944 if match.isexact():
947 if match.isexact():
945 # fast path -- filter the other way around, since typically files is
948 # fast path -- filter the other way around, since typically files is
946 # much smaller than dmap
949 # much smaller than dmap
947 return [f for f in files if f in dmap]
950 return [f for f in files if f in dmap]
948 if not match.anypats() and util.all(fn in dmap for fn in files):
951 if not match.anypats() and util.all(fn in dmap for fn in files):
949 # fast path -- all the values are known to be files, so just return
952 # fast path -- all the values are known to be files, so just return
950 # that
953 # that
951 return list(files)
954 return list(files)
952 return [f for f in dmap if match(f)]
955 return [f for f in dmap if match(f)]
@@ -1,1746 +1,1746
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 The configuration files use a simple ini-file format. A configuration
4 The configuration files use a simple ini-file format. A configuration
5 file consists of sections, led by a ``[section]`` header and followed
5 file consists of sections, led by a ``[section]`` header and followed
6 by ``name = value`` entries::
6 by ``name = value`` entries::
7
7
8 [ui]
8 [ui]
9 username = Firstname Lastname <firstname.lastname@example.net>
9 username = Firstname Lastname <firstname.lastname@example.net>
10 verbose = True
10 verbose = True
11
11
12 The above entries will be referred to as ``ui.username`` and
12 The above entries will be referred to as ``ui.username`` and
13 ``ui.verbose``, respectively. See the Syntax section below.
13 ``ui.verbose``, respectively. See the Syntax section below.
14
14
15 Files
15 Files
16 =====
16 =====
17
17
18 Mercurial reads configuration data from several files, if they exist.
18 Mercurial reads configuration data from several files, if they exist.
19 These files do not exist by default and you will have to create the
19 These files do not exist by default and you will have to create the
20 appropriate configuration files yourself: global configuration like
20 appropriate configuration files yourself: global configuration like
21 the username setting is typically put into
21 the username setting is typically put into
22 ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local
22 ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local
23 configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
23 configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
24
24
25 The names of these files depend on the system on which Mercurial is
25 The names of these files depend on the system on which Mercurial is
26 installed. ``*.rc`` files from a single directory are read in
26 installed. ``*.rc`` files from a single directory are read in
27 alphabetical order, later ones overriding earlier ones. Where multiple
27 alphabetical order, later ones overriding earlier ones. Where multiple
28 paths are given below, settings from earlier paths override later
28 paths are given below, settings from earlier paths override later
29 ones.
29 ones.
30
30
31 .. container:: verbose.unix
31 .. container:: verbose.unix
32
32
33 On Unix, the following files are consulted:
33 On Unix, the following files are consulted:
34
34
35 - ``<repo>/.hg/hgrc`` (per-repository)
35 - ``<repo>/.hg/hgrc`` (per-repository)
36 - ``$HOME/.hgrc`` (per-user)
36 - ``$HOME/.hgrc`` (per-user)
37 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
37 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
38 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
38 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
39 - ``/etc/mercurial/hgrc`` (per-system)
39 - ``/etc/mercurial/hgrc`` (per-system)
40 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
40 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
41 - ``<internal>/default.d/*.rc`` (defaults)
41 - ``<internal>/default.d/*.rc`` (defaults)
42
42
43 .. container:: verbose.windows
43 .. container:: verbose.windows
44
44
45 On Windows, the following files are consulted:
45 On Windows, the following files are consulted:
46
46
47 - ``<repo>/.hg/hgrc`` (per-repository)
47 - ``<repo>/.hg/hgrc`` (per-repository)
48 - ``%USERPROFILE%\.hgrc`` (per-user)
48 - ``%USERPROFILE%\.hgrc`` (per-user)
49 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
49 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
50 - ``%HOME%\.hgrc`` (per-user)
50 - ``%HOME%\.hgrc`` (per-user)
51 - ``%HOME%\Mercurial.ini`` (per-user)
51 - ``%HOME%\Mercurial.ini`` (per-user)
52 - ``<install-dir>\Mercurial.ini`` (per-installation)
52 - ``<install-dir>\Mercurial.ini`` (per-installation)
53 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
53 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
54 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
54 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
55 - ``<internal>/default.d/*.rc`` (defaults)
55 - ``<internal>/default.d/*.rc`` (defaults)
56
56
57 .. note::
57 .. note::
58
58
59 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
59 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
60 is used when running 32-bit Python on 64-bit Windows.
60 is used when running 32-bit Python on 64-bit Windows.
61
61
62 .. container:: verbose.plan9
62 .. container:: verbose.plan9
63
63
64 On Plan9, the following files are consulted:
64 On Plan9, the following files are consulted:
65
65
66 - ``<repo>/.hg/hgrc`` (per-repository)
66 - ``<repo>/.hg/hgrc`` (per-repository)
67 - ``$home/lib/hgrc`` (per-user)
67 - ``$home/lib/hgrc`` (per-user)
68 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
68 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
69 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
69 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
70 - ``/lib/mercurial/hgrc`` (per-system)
70 - ``/lib/mercurial/hgrc`` (per-system)
71 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
71 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
72 - ``<internal>/default.d/*.rc`` (defaults)
72 - ``<internal>/default.d/*.rc`` (defaults)
73
73
74 Per-repository configuration options only apply in a
74 Per-repository configuration options only apply in a
75 particular repository. This file is not version-controlled, and
75 particular repository. This file is not version-controlled, and
76 will not get transferred during a "clone" operation. Options in
76 will not get transferred during a "clone" operation. Options in
77 this file override options in all other configuration files. On
77 this file override options in all other configuration files. On
78 Plan 9 and Unix, most of this file will be ignored if it doesn't
78 Plan 9 and Unix, most of this file will be ignored if it doesn't
79 belong to a trusted user or to a trusted group. See the documentation
79 belong to a trusted user or to a trusted group. See the documentation
80 for the ``[trusted]`` section below for more details.
80 for the ``[trusted]`` section below for more details.
81
81
82 Per-user configuration file(s) are for the user running Mercurial. On
82 Per-user configuration file(s) are for the user running Mercurial. On
83 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
83 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
84 files apply to all Mercurial commands executed by this user in any
84 files apply to all Mercurial commands executed by this user in any
85 directory. Options in these files override per-system and per-installation
85 directory. Options in these files override per-system and per-installation
86 options.
86 options.
87
87
88 Per-installation configuration files are searched for in the
88 Per-installation configuration files are searched for in the
89 directory where Mercurial is installed. ``<install-root>`` is the
89 directory where Mercurial is installed. ``<install-root>`` is the
90 parent directory of the **hg** executable (or symlink) being run. For
90 parent directory of the **hg** executable (or symlink) being run. For
91 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
91 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
92 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
92 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
93 to all Mercurial commands executed by any user in any directory.
93 to all Mercurial commands executed by any user in any directory.
94
94
95 Per-installation configuration files are for the system on
95 Per-installation configuration files are for the system on
96 which Mercurial is running. Options in these files apply to all
96 which Mercurial is running. Options in these files apply to all
97 Mercurial commands executed by any user in any directory. Registry
97 Mercurial commands executed by any user in any directory. Registry
98 keys contain PATH-like strings, every part of which must reference
98 keys contain PATH-like strings, every part of which must reference
99 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
99 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
100 be read. Mercurial checks each of these locations in the specified
100 be read. Mercurial checks each of these locations in the specified
101 order until one or more configuration files are detected.
101 order until one or more configuration files are detected.
102
102
103 Per-system configuration files are for the system on which Mercurial
103 Per-system configuration files are for the system on which Mercurial
104 is running. Options in these files apply to all Mercurial commands
104 is running. Options in these files apply to all Mercurial commands
105 executed by any user in any directory. Options in these files
105 executed by any user in any directory. Options in these files
106 override per-installation options.
106 override per-installation options.
107
107
108 Mercurial comes with some default configuration. The default configuration
108 Mercurial comes with some default configuration. The default configuration
109 files are installed with Mercurial and will be overwritten on upgrades. Default
109 files are installed with Mercurial and will be overwritten on upgrades. Default
110 configuration files should never be edited by users or administrators but can
110 configuration files should never be edited by users or administrators but can
111 be overridden in other configuration files. So far the directory only contains
111 be overridden in other configuration files. So far the directory only contains
112 merge tool configuration but packagers can also put other default configuration
112 merge tool configuration but packagers can also put other default configuration
113 there.
113 there.
114
114
115 Syntax
115 Syntax
116 ======
116 ======
117
117
118 A configuration file consists of sections, led by a ``[section]`` header
118 A configuration file consists of sections, led by a ``[section]`` header
119 and followed by ``name = value`` entries (sometimes called
119 and followed by ``name = value`` entries (sometimes called
120 ``configuration keys``)::
120 ``configuration keys``)::
121
121
122 [spam]
122 [spam]
123 eggs=ham
123 eggs=ham
124 green=
124 green=
125 eggs
125 eggs
126
126
127 Each line contains one entry. If the lines that follow are indented,
127 Each line contains one entry. If the lines that follow are indented,
128 they are treated as continuations of that entry. Leading whitespace is
128 they are treated as continuations of that entry. Leading whitespace is
129 removed from values. Empty lines are skipped. Lines beginning with
129 removed from values. Empty lines are skipped. Lines beginning with
130 ``#`` or ``;`` are ignored and may be used to provide comments.
130 ``#`` or ``;`` are ignored and may be used to provide comments.
131
131
132 Configuration keys can be set multiple times, in which case Mercurial
132 Configuration keys can be set multiple times, in which case Mercurial
133 will use the value that was configured last. As an example::
133 will use the value that was configured last. As an example::
134
134
135 [spam]
135 [spam]
136 eggs=large
136 eggs=large
137 ham=serrano
137 ham=serrano
138 eggs=small
138 eggs=small
139
139
140 This would set the configuration key named ``eggs`` to ``small``.
140 This would set the configuration key named ``eggs`` to ``small``.
141
141
142 It is also possible to define a section multiple times. A section can
142 It is also possible to define a section multiple times. A section can
143 be redefined on the same and/or on different configuration files. For
143 be redefined on the same and/or on different configuration files. For
144 example::
144 example::
145
145
146 [foo]
146 [foo]
147 eggs=large
147 eggs=large
148 ham=serrano
148 ham=serrano
149 eggs=small
149 eggs=small
150
150
151 [bar]
151 [bar]
152 eggs=ham
152 eggs=ham
153 green=
153 green=
154 eggs
154 eggs
155
155
156 [foo]
156 [foo]
157 ham=prosciutto
157 ham=prosciutto
158 eggs=medium
158 eggs=medium
159 bread=toasted
159 bread=toasted
160
160
161 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
161 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
162 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
162 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
163 respectively. As you can see there only thing that matters is the last
163 respectively. As you can see there only thing that matters is the last
164 value that was set for each of the configuration keys.
164 value that was set for each of the configuration keys.
165
165
166 If a configuration key is set multiple times in different
166 If a configuration key is set multiple times in different
167 configuration files the final value will depend on the order in which
167 configuration files the final value will depend on the order in which
168 the different configuration files are read, with settings from earlier
168 the different configuration files are read, with settings from earlier
169 paths overriding later ones as described on the ``Files`` section
169 paths overriding later ones as described on the ``Files`` section
170 above.
170 above.
171
171
172 A line of the form ``%include file`` will include ``file`` into the
172 A line of the form ``%include file`` will include ``file`` into the
173 current configuration file. The inclusion is recursive, which means
173 current configuration file. The inclusion is recursive, which means
174 that included files can include other files. Filenames are relative to
174 that included files can include other files. Filenames are relative to
175 the configuration file in which the ``%include`` directive is found.
175 the configuration file in which the ``%include`` directive is found.
176 Environment variables and ``~user`` constructs are expanded in
176 Environment variables and ``~user`` constructs are expanded in
177 ``file``. This lets you do something like::
177 ``file``. This lets you do something like::
178
178
179 %include ~/.hgrc.d/$HOST.rc
179 %include ~/.hgrc.d/$HOST.rc
180
180
181 to include a different configuration file on each computer you use.
181 to include a different configuration file on each computer you use.
182
182
183 A line with ``%unset name`` will remove ``name`` from the current
183 A line with ``%unset name`` will remove ``name`` from the current
184 section, if it has been set previously.
184 section, if it has been set previously.
185
185
186 The values are either free-form text strings, lists of text strings,
186 The values are either free-form text strings, lists of text strings,
187 or Boolean values. Boolean values can be set to true using any of "1",
187 or Boolean values. Boolean values can be set to true using any of "1",
188 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
188 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
189 (all case insensitive).
189 (all case insensitive).
190
190
191 List values are separated by whitespace or comma, except when values are
191 List values are separated by whitespace or comma, except when values are
192 placed in double quotation marks::
192 placed in double quotation marks::
193
193
194 allow_read = "John Doe, PhD", brian, betty
194 allow_read = "John Doe, PhD", brian, betty
195
195
196 Quotation marks can be escaped by prefixing them with a backslash. Only
196 Quotation marks can be escaped by prefixing them with a backslash. Only
197 quotation marks at the beginning of a word is counted as a quotation
197 quotation marks at the beginning of a word is counted as a quotation
198 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
198 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
199
199
200 Sections
200 Sections
201 ========
201 ========
202
202
203 This section describes the different sections that may appear in a
203 This section describes the different sections that may appear in a
204 Mercurial configuration file, the purpose of each section, its possible
204 Mercurial configuration file, the purpose of each section, its possible
205 keys, and their possible values.
205 keys, and their possible values.
206
206
207 ``alias``
207 ``alias``
208 ---------
208 ---------
209
209
210 Defines command aliases.
210 Defines command aliases.
211 Aliases allow you to define your own commands in terms of other
211 Aliases allow you to define your own commands in terms of other
212 commands (or aliases), optionally including arguments. Positional
212 commands (or aliases), optionally including arguments. Positional
213 arguments in the form of ``$1``, ``$2``, etc in the alias definition
213 arguments in the form of ``$1``, ``$2``, etc in the alias definition
214 are expanded by Mercurial before execution. Positional arguments not
214 are expanded by Mercurial before execution. Positional arguments not
215 already used by ``$N`` in the definition are put at the end of the
215 already used by ``$N`` in the definition are put at the end of the
216 command to be executed.
216 command to be executed.
217
217
218 Alias definitions consist of lines of the form::
218 Alias definitions consist of lines of the form::
219
219
220 <alias> = <command> [<argument>]...
220 <alias> = <command> [<argument>]...
221
221
222 For example, this definition::
222 For example, this definition::
223
223
224 latest = log --limit 5
224 latest = log --limit 5
225
225
226 creates a new command ``latest`` that shows only the five most recent
226 creates a new command ``latest`` that shows only the five most recent
227 changesets. You can define subsequent aliases using earlier ones::
227 changesets. You can define subsequent aliases using earlier ones::
228
228
229 stable5 = latest -b stable
229 stable5 = latest -b stable
230
230
231 .. note::
231 .. note::
232
232
233 It is possible to create aliases with the same names as
233 It is possible to create aliases with the same names as
234 existing commands, which will then override the original
234 existing commands, which will then override the original
235 definitions. This is almost always a bad idea!
235 definitions. This is almost always a bad idea!
236
236
237 An alias can start with an exclamation point (``!``) to make it a
237 An alias can start with an exclamation point (``!``) to make it a
238 shell alias. A shell alias is executed with the shell and will let you
238 shell alias. A shell alias is executed with the shell and will let you
239 run arbitrary commands. As an example, ::
239 run arbitrary commands. As an example, ::
240
240
241 echo = !echo $@
241 echo = !echo $@
242
242
243 will let you do ``hg echo foo`` to have ``foo`` printed in your
243 will let you do ``hg echo foo`` to have ``foo`` printed in your
244 terminal. A better example might be::
244 terminal. A better example might be::
245
245
246 purge = !$HG status --no-status --unknown -0 | xargs -0 rm
246 purge = !$HG status --no-status --unknown -0 | xargs -0 rm
247
247
248 which will make ``hg purge`` delete all unknown files in the
248 which will make ``hg purge`` delete all unknown files in the
249 repository in the same manner as the purge extension.
249 repository in the same manner as the purge extension.
250
250
251 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
251 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
252 expand to the command arguments. Unmatched arguments are
252 expand to the command arguments. Unmatched arguments are
253 removed. ``$0`` expands to the alias name and ``$@`` expands to all
253 removed. ``$0`` expands to the alias name and ``$@`` expands to all
254 arguments separated by a space. ``"$@"`` (with quotes) expands to all
254 arguments separated by a space. ``"$@"`` (with quotes) expands to all
255 arguments quoted individually and separated by a space. These expansions
255 arguments quoted individually and separated by a space. These expansions
256 happen before the command is passed to the shell.
256 happen before the command is passed to the shell.
257
257
258 Shell aliases are executed in an environment where ``$HG`` expands to
258 Shell aliases are executed in an environment where ``$HG`` expands to
259 the path of the Mercurial that was used to execute the alias. This is
259 the path of the Mercurial that was used to execute the alias. This is
260 useful when you want to call further Mercurial commands in a shell
260 useful when you want to call further Mercurial commands in a shell
261 alias, as was done above for the purge alias. In addition,
261 alias, as was done above for the purge alias. In addition,
262 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
262 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
263 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
263 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
264
264
265 .. note::
265 .. note::
266
266
267 Some global configuration options such as ``-R`` are
267 Some global configuration options such as ``-R`` are
268 processed before shell aliases and will thus not be passed to
268 processed before shell aliases and will thus not be passed to
269 aliases.
269 aliases.
270
270
271
271
272 ``annotate``
272 ``annotate``
273 ------------
273 ------------
274
274
275 Settings used when displaying file annotations. All values are
275 Settings used when displaying file annotations. All values are
276 Booleans and default to False. See ``diff`` section for related
276 Booleans and default to False. See ``diff`` section for related
277 options for the diff command.
277 options for the diff command.
278
278
279 ``ignorews``
279 ``ignorews``
280 Ignore white space when comparing lines.
280 Ignore white space when comparing lines.
281
281
282 ``ignorewsamount``
282 ``ignorewsamount``
283 Ignore changes in the amount of white space.
283 Ignore changes in the amount of white space.
284
284
285 ``ignoreblanklines``
285 ``ignoreblanklines``
286 Ignore changes whose lines are all blank.
286 Ignore changes whose lines are all blank.
287
287
288
288
289 ``auth``
289 ``auth``
290 --------
290 --------
291
291
292 Authentication credentials for HTTP authentication. This section
292 Authentication credentials for HTTP authentication. This section
293 allows you to store usernames and passwords for use when logging
293 allows you to store usernames and passwords for use when logging
294 *into* HTTP servers. See the ``[web]`` configuration section if
294 *into* HTTP servers. See the ``[web]`` configuration section if
295 you want to configure *who* can login to your HTTP server.
295 you want to configure *who* can login to your HTTP server.
296
296
297 Each line has the following format::
297 Each line has the following format::
298
298
299 <name>.<argument> = <value>
299 <name>.<argument> = <value>
300
300
301 where ``<name>`` is used to group arguments into authentication
301 where ``<name>`` is used to group arguments into authentication
302 entries. Example::
302 entries. Example::
303
303
304 foo.prefix = hg.intevation.org/mercurial
304 foo.prefix = hg.intevation.org/mercurial
305 foo.username = foo
305 foo.username = foo
306 foo.password = bar
306 foo.password = bar
307 foo.schemes = http https
307 foo.schemes = http https
308
308
309 bar.prefix = secure.example.org
309 bar.prefix = secure.example.org
310 bar.key = path/to/file.key
310 bar.key = path/to/file.key
311 bar.cert = path/to/file.cert
311 bar.cert = path/to/file.cert
312 bar.schemes = https
312 bar.schemes = https
313
313
314 Supported arguments:
314 Supported arguments:
315
315
316 ``prefix``
316 ``prefix``
317 Either ``*`` or a URI prefix with or without the scheme part.
317 Either ``*`` or a URI prefix with or without the scheme part.
318 The authentication entry with the longest matching prefix is used
318 The authentication entry with the longest matching prefix is used
319 (where ``*`` matches everything and counts as a match of length
319 (where ``*`` matches everything and counts as a match of length
320 1). If the prefix doesn't include a scheme, the match is performed
320 1). If the prefix doesn't include a scheme, the match is performed
321 against the URI with its scheme stripped as well, and the schemes
321 against the URI with its scheme stripped as well, and the schemes
322 argument, q.v., is then subsequently consulted.
322 argument, q.v., is then subsequently consulted.
323
323
324 ``username``
324 ``username``
325 Optional. Username to authenticate with. If not given, and the
325 Optional. Username to authenticate with. If not given, and the
326 remote site requires basic or digest authentication, the user will
326 remote site requires basic or digest authentication, the user will
327 be prompted for it. Environment variables are expanded in the
327 be prompted for it. Environment variables are expanded in the
328 username letting you do ``foo.username = $USER``. If the URI
328 username letting you do ``foo.username = $USER``. If the URI
329 includes a username, only ``[auth]`` entries with a matching
329 includes a username, only ``[auth]`` entries with a matching
330 username or without a username will be considered.
330 username or without a username will be considered.
331
331
332 ``password``
332 ``password``
333 Optional. Password to authenticate with. If not given, and the
333 Optional. Password to authenticate with. If not given, and the
334 remote site requires basic or digest authentication, the user
334 remote site requires basic or digest authentication, the user
335 will be prompted for it.
335 will be prompted for it.
336
336
337 ``key``
337 ``key``
338 Optional. PEM encoded client certificate key file. Environment
338 Optional. PEM encoded client certificate key file. Environment
339 variables are expanded in the filename.
339 variables are expanded in the filename.
340
340
341 ``cert``
341 ``cert``
342 Optional. PEM encoded client certificate chain file. Environment
342 Optional. PEM encoded client certificate chain file. Environment
343 variables are expanded in the filename.
343 variables are expanded in the filename.
344
344
345 ``schemes``
345 ``schemes``
346 Optional. Space separated list of URI schemes to use this
346 Optional. Space separated list of URI schemes to use this
347 authentication entry with. Only used if the prefix doesn't include
347 authentication entry with. Only used if the prefix doesn't include
348 a scheme. Supported schemes are http and https. They will match
348 a scheme. Supported schemes are http and https. They will match
349 static-http and static-https respectively, as well.
349 static-http and static-https respectively, as well.
350 Default: https.
350 Default: https.
351
351
352 If no suitable authentication entry is found, the user is prompted
352 If no suitable authentication entry is found, the user is prompted
353 for credentials as usual if required by the remote.
353 for credentials as usual if required by the remote.
354
354
355
355
356 ``committemplate``
356 ``committemplate``
357 ------------------
357 ------------------
358
358
359 ``changeset`` configuration in this section is used as the template to
359 ``changeset`` configuration in this section is used as the template to
360 customize the text shown in the editor when committing.
360 customize the text shown in the editor when committing.
361
361
362 In addition to pre-defined template keywords, commit log specific one
362 In addition to pre-defined template keywords, commit log specific one
363 below can be used for customization:
363 below can be used for customization:
364
364
365 ``extramsg``
365 ``extramsg``
366 String: Extra message (typically 'Leave message empty to abort
366 String: Extra message (typically 'Leave message empty to abort
367 commit.'). This may be changed by some commands or extensions.
367 commit.'). This may be changed by some commands or extensions.
368
368
369 For example, the template configuration below shows as same text as
369 For example, the template configuration below shows as same text as
370 one shown by default::
370 one shown by default::
371
371
372 [committemplate]
372 [committemplate]
373 changeset = {desc}\n\n
373 changeset = {desc}\n\n
374 HG: Enter commit message. Lines beginning with 'HG:' are removed.
374 HG: Enter commit message. Lines beginning with 'HG:' are removed.
375 HG: {extramsg}
375 HG: {extramsg}
376 HG: --
376 HG: --
377 HG: user: {author}\n{ifeq(p2rev, "-1", "",
377 HG: user: {author}\n{ifeq(p2rev, "-1", "",
378 "HG: branch merge\n")
378 "HG: branch merge\n")
379 }HG: branch '{branch}'\n{if(currentbookmark,
379 }HG: branch '{branch}'\n{if(currentbookmark,
380 "HG: bookmark '{currentbookmark}'\n") }{subrepos %
380 "HG: bookmark '{currentbookmark}'\n") }{subrepos %
381 "HG: subrepo {subrepo}\n" }{file_adds %
381 "HG: subrepo {subrepo}\n" }{file_adds %
382 "HG: added {file}\n" }{file_mods %
382 "HG: added {file}\n" }{file_mods %
383 "HG: changed {file}\n" }{file_dels %
383 "HG: changed {file}\n" }{file_dels %
384 "HG: removed {file}\n" }{if(files, "",
384 "HG: removed {file}\n" }{if(files, "",
385 "HG: no files changed\n")}
385 "HG: no files changed\n")}
386
386
387 .. note::
387 .. note::
388
388
389 For some problematic encodings (see :hg:`help win32mbcs` for
389 For some problematic encodings (see :hg:`help win32mbcs` for
390 detail), this customization should be configured carefully, to
390 detail), this customization should be configured carefully, to
391 avoid showing broken characters.
391 avoid showing broken characters.
392
392
393 For example, if multibyte character ending with backslash (0x5c) is
393 For example, if multibyte character ending with backslash (0x5c) is
394 followed by ASCII character 'n' in the customized template,
394 followed by ASCII character 'n' in the customized template,
395 sequence of backslash and 'n' is treated as line-feed unexpectedly
395 sequence of backslash and 'n' is treated as line-feed unexpectedly
396 (and multibyte character is broken, too).
396 (and multibyte character is broken, too).
397
397
398 Customized template is used for commands below (``--edit`` may be
398 Customized template is used for commands below (``--edit`` may be
399 required):
399 required):
400
400
401 - :hg:`backout`
401 - :hg:`backout`
402 - :hg:`commit`
402 - :hg:`commit`
403 - :hg:`fetch` (for merge commit only)
403 - :hg:`fetch` (for merge commit only)
404 - :hg:`graft`
404 - :hg:`graft`
405 - :hg:`histedit`
405 - :hg:`histedit`
406 - :hg:`import`
406 - :hg:`import`
407 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
407 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
408 - :hg:`rebase`
408 - :hg:`rebase`
409 - :hg:`shelve`
409 - :hg:`shelve`
410 - :hg:`sign`
410 - :hg:`sign`
411 - :hg:`tag`
411 - :hg:`tag`
412 - :hg:`transplant`
412 - :hg:`transplant`
413
413
414 Configuring items below instead of ``changeset`` allows showing
414 Configuring items below instead of ``changeset`` allows showing
415 customized message only for specific actions, or showing different
415 customized message only for specific actions, or showing different
416 messages for each action.
416 messages for each action.
417
417
418 - ``changeset.backout`` for :hg:`backout`
418 - ``changeset.backout`` for :hg:`backout`
419 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
419 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
420 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
420 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
421 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
421 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
422 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
422 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
423 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
423 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
424 - ``changeset.gpg.sign`` for :hg:`sign`
424 - ``changeset.gpg.sign`` for :hg:`sign`
425 - ``changeset.graft`` for :hg:`graft`
425 - ``changeset.graft`` for :hg:`graft`
426 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
426 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
427 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
427 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
428 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
428 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
429 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
429 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
430 - ``changeset.import.bypass`` for :hg:`import --bypass`
430 - ``changeset.import.bypass`` for :hg:`import --bypass`
431 - ``changeset.import.normal.merge`` for :hg:`import` on merges
431 - ``changeset.import.normal.merge`` for :hg:`import` on merges
432 - ``changeset.import.normal.normal`` for :hg:`import` on other
432 - ``changeset.import.normal.normal`` for :hg:`import` on other
433 - ``changeset.mq.qnew`` for :hg:`qnew`
433 - ``changeset.mq.qnew`` for :hg:`qnew`
434 - ``changeset.mq.qfold`` for :hg:`qfold`
434 - ``changeset.mq.qfold`` for :hg:`qfold`
435 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
435 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
436 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
436 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
437 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
437 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
438 - ``changeset.rebase.normal`` for :hg:`rebase` on other
438 - ``changeset.rebase.normal`` for :hg:`rebase` on other
439 - ``changeset.shelve.shelve`` for :hg:`shelve`
439 - ``changeset.shelve.shelve`` for :hg:`shelve`
440 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
440 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
441 - ``changeset.tag.remove`` for :hg:`tag --remove`
441 - ``changeset.tag.remove`` for :hg:`tag --remove`
442 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
442 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
443 - ``changeset.transplant.normal`` for :hg:`transplant` on other
443 - ``changeset.transplant.normal`` for :hg:`transplant` on other
444
444
445 These dot-separated lists of names are treated as hierarchical ones.
445 These dot-separated lists of names are treated as hierarchical ones.
446 For example, ``changeset.tag.remove`` customizes the commit message
446 For example, ``changeset.tag.remove`` customizes the commit message
447 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
447 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
448 commit message for :hg:`tag` regardless of ``--remove`` option.
448 commit message for :hg:`tag` regardless of ``--remove`` option.
449
449
450 At the external editor invocation for committing, corresponding
450 At the external editor invocation for committing, corresponding
451 dot-separated list of names without ``changeset.`` prefix
451 dot-separated list of names without ``changeset.`` prefix
452 (e.g. ``commit.normal.normal``) is in ``HGEDITFORM`` environment variable.
452 (e.g. ``commit.normal.normal``) is in ``HGEDITFORM`` environment variable.
453
453
454 In this section, items other than ``changeset`` can be referred from
454 In this section, items other than ``changeset`` can be referred from
455 others. For example, the configuration to list committed files up
455 others. For example, the configuration to list committed files up
456 below can be referred as ``{listupfiles}``::
456 below can be referred as ``{listupfiles}``::
457
457
458 [committemplate]
458 [committemplate]
459 listupfiles = {file_adds %
459 listupfiles = {file_adds %
460 "HG: added {file}\n" }{file_mods %
460 "HG: added {file}\n" }{file_mods %
461 "HG: changed {file}\n" }{file_dels %
461 "HG: changed {file}\n" }{file_dels %
462 "HG: removed {file}\n" }{if(files, "",
462 "HG: removed {file}\n" }{if(files, "",
463 "HG: no files changed\n")}
463 "HG: no files changed\n")}
464
464
465 ``decode/encode``
465 ``decode/encode``
466 -----------------
466 -----------------
467
467
468 Filters for transforming files on checkout/checkin. This would
468 Filters for transforming files on checkout/checkin. This would
469 typically be used for newline processing or other
469 typically be used for newline processing or other
470 localization/canonicalization of files.
470 localization/canonicalization of files.
471
471
472 Filters consist of a filter pattern followed by a filter command.
472 Filters consist of a filter pattern followed by a filter command.
473 Filter patterns are globs by default, rooted at the repository root.
473 Filter patterns are globs by default, rooted at the repository root.
474 For example, to match any file ending in ``.txt`` in the root
474 For example, to match any file ending in ``.txt`` in the root
475 directory only, use the pattern ``*.txt``. To match any file ending
475 directory only, use the pattern ``*.txt``. To match any file ending
476 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
476 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
477 For each file only the first matching filter applies.
477 For each file only the first matching filter applies.
478
478
479 The filter command can start with a specifier, either ``pipe:`` or
479 The filter command can start with a specifier, either ``pipe:`` or
480 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
480 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
481
481
482 A ``pipe:`` command must accept data on stdin and return the transformed
482 A ``pipe:`` command must accept data on stdin and return the transformed
483 data on stdout.
483 data on stdout.
484
484
485 Pipe example::
485 Pipe example::
486
486
487 [encode]
487 [encode]
488 # uncompress gzip files on checkin to improve delta compression
488 # uncompress gzip files on checkin to improve delta compression
489 # note: not necessarily a good idea, just an example
489 # note: not necessarily a good idea, just an example
490 *.gz = pipe: gunzip
490 *.gz = pipe: gunzip
491
491
492 [decode]
492 [decode]
493 # recompress gzip files when writing them to the working dir (we
493 # recompress gzip files when writing them to the working dir (we
494 # can safely omit "pipe:", because it's the default)
494 # can safely omit "pipe:", because it's the default)
495 *.gz = gzip
495 *.gz = gzip
496
496
497 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
497 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
498 with the name of a temporary file that contains the data to be
498 with the name of a temporary file that contains the data to be
499 filtered by the command. The string ``OUTFILE`` is replaced with the name
499 filtered by the command. The string ``OUTFILE`` is replaced with the name
500 of an empty temporary file, where the filtered data must be written by
500 of an empty temporary file, where the filtered data must be written by
501 the command.
501 the command.
502
502
503 .. note::
503 .. note::
504
504
505 The tempfile mechanism is recommended for Windows systems,
505 The tempfile mechanism is recommended for Windows systems,
506 where the standard shell I/O redirection operators often have
506 where the standard shell I/O redirection operators often have
507 strange effects and may corrupt the contents of your files.
507 strange effects and may corrupt the contents of your files.
508
508
509 This filter mechanism is used internally by the ``eol`` extension to
509 This filter mechanism is used internally by the ``eol`` extension to
510 translate line ending characters between Windows (CRLF) and Unix (LF)
510 translate line ending characters between Windows (CRLF) and Unix (LF)
511 format. We suggest you use the ``eol`` extension for convenience.
511 format. We suggest you use the ``eol`` extension for convenience.
512
512
513
513
514 ``defaults``
514 ``defaults``
515 ------------
515 ------------
516
516
517 (defaults are deprecated. Don't use them. Use aliases instead)
517 (defaults are deprecated. Don't use them. Use aliases instead)
518
518
519 Use the ``[defaults]`` section to define command defaults, i.e. the
519 Use the ``[defaults]`` section to define command defaults, i.e. the
520 default options/arguments to pass to the specified commands.
520 default options/arguments to pass to the specified commands.
521
521
522 The following example makes :hg:`log` run in verbose mode, and
522 The following example makes :hg:`log` run in verbose mode, and
523 :hg:`status` show only the modified files, by default::
523 :hg:`status` show only the modified files, by default::
524
524
525 [defaults]
525 [defaults]
526 log = -v
526 log = -v
527 status = -m
527 status = -m
528
528
529 The actual commands, instead of their aliases, must be used when
529 The actual commands, instead of their aliases, must be used when
530 defining command defaults. The command defaults will also be applied
530 defining command defaults. The command defaults will also be applied
531 to the aliases of the commands defined.
531 to the aliases of the commands defined.
532
532
533
533
534 ``diff``
534 ``diff``
535 --------
535 --------
536
536
537 Settings used when displaying diffs. Everything except for ``unified``
537 Settings used when displaying diffs. Everything except for ``unified``
538 is a Boolean and defaults to False. See ``annotate`` section for
538 is a Boolean and defaults to False. See ``annotate`` section for
539 related options for the annotate command.
539 related options for the annotate command.
540
540
541 ``git``
541 ``git``
542 Use git extended diff format.
542 Use git extended diff format.
543
543
544 ``nobinary``
544 ``nobinary``
545 Omit git binary patches.
545 Omit git binary patches.
546
546
547 ``nodates``
547 ``nodates``
548 Don't include dates in diff headers.
548 Don't include dates in diff headers.
549
549
550 ``noprefix``
550 ``noprefix``
551 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
551 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
552
552
553 ``showfunc``
553 ``showfunc``
554 Show which function each change is in.
554 Show which function each change is in.
555
555
556 ``ignorews``
556 ``ignorews``
557 Ignore white space when comparing lines.
557 Ignore white space when comparing lines.
558
558
559 ``ignorewsamount``
559 ``ignorewsamount``
560 Ignore changes in the amount of white space.
560 Ignore changes in the amount of white space.
561
561
562 ``ignoreblanklines``
562 ``ignoreblanklines``
563 Ignore changes whose lines are all blank.
563 Ignore changes whose lines are all blank.
564
564
565 ``unified``
565 ``unified``
566 Number of lines of context to show.
566 Number of lines of context to show.
567
567
568 ``email``
568 ``email``
569 ---------
569 ---------
570
570
571 Settings for extensions that send email messages.
571 Settings for extensions that send email messages.
572
572
573 ``from``
573 ``from``
574 Optional. Email address to use in "From" header and SMTP envelope
574 Optional. Email address to use in "From" header and SMTP envelope
575 of outgoing messages.
575 of outgoing messages.
576
576
577 ``to``
577 ``to``
578 Optional. Comma-separated list of recipients' email addresses.
578 Optional. Comma-separated list of recipients' email addresses.
579
579
580 ``cc``
580 ``cc``
581 Optional. Comma-separated list of carbon copy recipients'
581 Optional. Comma-separated list of carbon copy recipients'
582 email addresses.
582 email addresses.
583
583
584 ``bcc``
584 ``bcc``
585 Optional. Comma-separated list of blind carbon copy recipients'
585 Optional. Comma-separated list of blind carbon copy recipients'
586 email addresses.
586 email addresses.
587
587
588 ``method``
588 ``method``
589 Optional. Method to use to send email messages. If value is ``smtp``
589 Optional. Method to use to send email messages. If value is ``smtp``
590 (default), use SMTP (see the ``[smtp]`` section for configuration).
590 (default), use SMTP (see the ``[smtp]`` section for configuration).
591 Otherwise, use as name of program to run that acts like sendmail
591 Otherwise, use as name of program to run that acts like sendmail
592 (takes ``-f`` option for sender, list of recipients on command line,
592 (takes ``-f`` option for sender, list of recipients on command line,
593 message on stdin). Normally, setting this to ``sendmail`` or
593 message on stdin). Normally, setting this to ``sendmail`` or
594 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
594 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
595
595
596 ``charsets``
596 ``charsets``
597 Optional. Comma-separated list of character sets considered
597 Optional. Comma-separated list of character sets considered
598 convenient for recipients. Addresses, headers, and parts not
598 convenient for recipients. Addresses, headers, and parts not
599 containing patches of outgoing messages will be encoded in the
599 containing patches of outgoing messages will be encoded in the
600 first character set to which conversion from local encoding
600 first character set to which conversion from local encoding
601 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
601 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
602 conversion fails, the text in question is sent as is. Defaults to
602 conversion fails, the text in question is sent as is. Defaults to
603 empty (explicit) list.
603 empty (explicit) list.
604
604
605 Order of outgoing email character sets:
605 Order of outgoing email character sets:
606
606
607 1. ``us-ascii``: always first, regardless of settings
607 1. ``us-ascii``: always first, regardless of settings
608 2. ``email.charsets``: in order given by user
608 2. ``email.charsets``: in order given by user
609 3. ``ui.fallbackencoding``: if not in email.charsets
609 3. ``ui.fallbackencoding``: if not in email.charsets
610 4. ``$HGENCODING``: if not in email.charsets
610 4. ``$HGENCODING``: if not in email.charsets
611 5. ``utf-8``: always last, regardless of settings
611 5. ``utf-8``: always last, regardless of settings
612
612
613 Email example::
613 Email example::
614
614
615 [email]
615 [email]
616 from = Joseph User <joe.user@example.com>
616 from = Joseph User <joe.user@example.com>
617 method = /usr/sbin/sendmail
617 method = /usr/sbin/sendmail
618 # charsets for western Europeans
618 # charsets for western Europeans
619 # us-ascii, utf-8 omitted, as they are tried first and last
619 # us-ascii, utf-8 omitted, as they are tried first and last
620 charsets = iso-8859-1, iso-8859-15, windows-1252
620 charsets = iso-8859-1, iso-8859-15, windows-1252
621
621
622
622
623 ``extensions``
623 ``extensions``
624 --------------
624 --------------
625
625
626 Mercurial has an extension mechanism for adding new features. To
626 Mercurial has an extension mechanism for adding new features. To
627 enable an extension, create an entry for it in this section.
627 enable an extension, create an entry for it in this section.
628
628
629 If you know that the extension is already in Python's search path,
629 If you know that the extension is already in Python's search path,
630 you can give the name of the module, followed by ``=``, with nothing
630 you can give the name of the module, followed by ``=``, with nothing
631 after the ``=``.
631 after the ``=``.
632
632
633 Otherwise, give a name that you choose, followed by ``=``, followed by
633 Otherwise, give a name that you choose, followed by ``=``, followed by
634 the path to the ``.py`` file (including the file name extension) that
634 the path to the ``.py`` file (including the file name extension) that
635 defines the extension.
635 defines the extension.
636
636
637 To explicitly disable an extension that is enabled in an hgrc of
637 To explicitly disable an extension that is enabled in an hgrc of
638 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
638 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
639 or ``foo = !`` when path is not supplied.
639 or ``foo = !`` when path is not supplied.
640
640
641 Example for ``~/.hgrc``::
641 Example for ``~/.hgrc``::
642
642
643 [extensions]
643 [extensions]
644 # (the progress extension will get loaded from Mercurial's path)
644 # (the progress extension will get loaded from Mercurial's path)
645 progress =
645 progress =
646 # (this extension will get loaded from the file specified)
646 # (this extension will get loaded from the file specified)
647 myfeature = ~/.hgext/myfeature.py
647 myfeature = ~/.hgext/myfeature.py
648
648
649
649
650 ``format``
650 ``format``
651 ----------
651 ----------
652
652
653 ``usestore``
653 ``usestore``
654 Enable or disable the "store" repository format which improves
654 Enable or disable the "store" repository format which improves
655 compatibility with systems that fold case or otherwise mangle
655 compatibility with systems that fold case or otherwise mangle
656 filenames. Enabled by default. Disabling this option will allow
656 filenames. Enabled by default. Disabling this option will allow
657 you to store longer filenames in some situations at the expense of
657 you to store longer filenames in some situations at the expense of
658 compatibility and ensures that the on-disk format of newly created
658 compatibility and ensures that the on-disk format of newly created
659 repositories will be compatible with Mercurial before version 0.9.4.
659 repositories will be compatible with Mercurial before version 0.9.4.
660
660
661 ``usefncache``
661 ``usefncache``
662 Enable or disable the "fncache" repository format which enhances
662 Enable or disable the "fncache" repository format which enhances
663 the "store" repository format (which has to be enabled to use
663 the "store" repository format (which has to be enabled to use
664 fncache) to allow longer filenames and avoids using Windows
664 fncache) to allow longer filenames and avoids using Windows
665 reserved names, e.g. "nul". Enabled by default. Disabling this
665 reserved names, e.g. "nul". Enabled by default. Disabling this
666 option ensures that the on-disk format of newly created
666 option ensures that the on-disk format of newly created
667 repositories will be compatible with Mercurial before version 1.1.
667 repositories will be compatible with Mercurial before version 1.1.
668
668
669 ``dotencode``
669 ``dotencode``
670 Enable or disable the "dotencode" repository format which enhances
670 Enable or disable the "dotencode" repository format which enhances
671 the "fncache" repository format (which has to be enabled to use
671 the "fncache" repository format (which has to be enabled to use
672 dotencode) to avoid issues with filenames starting with ._ on
672 dotencode) to avoid issues with filenames starting with ._ on
673 Mac OS X and spaces on Windows. Enabled by default. Disabling this
673 Mac OS X and spaces on Windows. Enabled by default. Disabling this
674 option ensures that the on-disk format of newly created
674 option ensures that the on-disk format of newly created
675 repositories will be compatible with Mercurial before version 1.7.
675 repositories will be compatible with Mercurial before version 1.7.
676
676
677 ``graph``
677 ``graph``
678 ---------
678 ---------
679
679
680 Web graph view configuration. This section let you change graph
680 Web graph view configuration. This section let you change graph
681 elements display properties by branches, for instance to make the
681 elements display properties by branches, for instance to make the
682 ``default`` branch stand out.
682 ``default`` branch stand out.
683
683
684 Each line has the following format::
684 Each line has the following format::
685
685
686 <branch>.<argument> = <value>
686 <branch>.<argument> = <value>
687
687
688 where ``<branch>`` is the name of the branch being
688 where ``<branch>`` is the name of the branch being
689 customized. Example::
689 customized. Example::
690
690
691 [graph]
691 [graph]
692 # 2px width
692 # 2px width
693 default.width = 2
693 default.width = 2
694 # red color
694 # red color
695 default.color = FF0000
695 default.color = FF0000
696
696
697 Supported arguments:
697 Supported arguments:
698
698
699 ``width``
699 ``width``
700 Set branch edges width in pixels.
700 Set branch edges width in pixels.
701
701
702 ``color``
702 ``color``
703 Set branch edges color in hexadecimal RGB notation.
703 Set branch edges color in hexadecimal RGB notation.
704
704
705 ``hooks``
705 ``hooks``
706 ---------
706 ---------
707
707
708 Commands or Python functions that get automatically executed by
708 Commands or Python functions that get automatically executed by
709 various actions such as starting or finishing a commit. Multiple
709 various actions such as starting or finishing a commit. Multiple
710 hooks can be run for the same action by appending a suffix to the
710 hooks can be run for the same action by appending a suffix to the
711 action. Overriding a site-wide hook can be done by changing its
711 action. Overriding a site-wide hook can be done by changing its
712 value or setting it to an empty string. Hooks can be prioritized
712 value or setting it to an empty string. Hooks can be prioritized
713 by adding a prefix of ``priority`` to the hook name on a new line
713 by adding a prefix of ``priority`` to the hook name on a new line
714 and setting the priority. The default priority is 0 if
714 and setting the priority. The default priority is 0 if
715 not specified.
715 not specified.
716
716
717 Example ``.hg/hgrc``::
717 Example ``.hg/hgrc``::
718
718
719 [hooks]
719 [hooks]
720 # update working directory after adding changesets
720 # update working directory after adding changesets
721 changegroup.update = hg update
721 changegroup.update = hg update
722 # do not use the site-wide hook
722 # do not use the site-wide hook
723 incoming =
723 incoming =
724 incoming.email = /my/email/hook
724 incoming.email = /my/email/hook
725 incoming.autobuild = /my/build/hook
725 incoming.autobuild = /my/build/hook
726 # force autobuild hook to run before other incoming hooks
726 # force autobuild hook to run before other incoming hooks
727 priority.incoming.autobuild = 1
727 priority.incoming.autobuild = 1
728
728
729 Most hooks are run with environment variables set that give useful
729 Most hooks are run with environment variables set that give useful
730 additional information. For each hook below, the environment
730 additional information. For each hook below, the environment
731 variables it is passed are listed with names of the form ``$HG_foo``.
731 variables it is passed are listed with names of the form ``$HG_foo``.
732
732
733 ``changegroup``
733 ``changegroup``
734 Run after a changegroup has been added via push, pull or unbundle.
734 Run after a changegroup has been added via push, pull or unbundle.
735 ID of the first new changeset is in ``$HG_NODE``. URL from which
735 ID of the first new changeset is in ``$HG_NODE``. URL from which
736 changes came is in ``$HG_URL``.
736 changes came is in ``$HG_URL``.
737
737
738 ``commit``
738 ``commit``
739 Run after a changeset has been created in the local repository. ID
739 Run after a changeset has been created in the local repository. ID
740 of the newly created changeset is in ``$HG_NODE``. Parent changeset
740 of the newly created changeset is in ``$HG_NODE``. Parent changeset
741 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
741 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
742
742
743 ``incoming``
743 ``incoming``
744 Run after a changeset has been pulled, pushed, or unbundled into
744 Run after a changeset has been pulled, pushed, or unbundled into
745 the local repository. The ID of the newly arrived changeset is in
745 the local repository. The ID of the newly arrived changeset is in
746 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
746 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
747
747
748 ``outgoing``
748 ``outgoing``
749 Run after sending changes from local repository to another. ID of
749 Run after sending changes from local repository to another. ID of
750 first changeset sent is in ``$HG_NODE``. Source of operation is in
750 first changeset sent is in ``$HG_NODE``. Source of operation is in
751 ``$HG_SOURCE``; see "preoutgoing" hook for description.
751 ``$HG_SOURCE``; see "preoutgoing" hook for description.
752
752
753 ``post-<command>``
753 ``post-<command>``
754 Run after successful invocations of the associated command. The
754 Run after successful invocations of the associated command. The
755 contents of the command line are passed as ``$HG_ARGS`` and the result
755 contents of the command line are passed as ``$HG_ARGS`` and the result
756 code in ``$HG_RESULT``. Parsed command line arguments are passed as
756 code in ``$HG_RESULT``. Parsed command line arguments are passed as
757 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
757 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
758 the python data internally passed to <command>. ``$HG_OPTS`` is a
758 the python data internally passed to <command>. ``$HG_OPTS`` is a
759 dictionary of options (with unspecified options set to their defaults).
759 dictionary of options (with unspecified options set to their defaults).
760 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
760 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
761
761
762 ``pre-<command>``
762 ``pre-<command>``
763 Run before executing the associated command. The contents of the
763 Run before executing the associated command. The contents of the
764 command line are passed as ``$HG_ARGS``. Parsed command line arguments
764 command line are passed as ``$HG_ARGS``. Parsed command line arguments
765 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
765 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
766 representations of the data internally passed to <command>. ``$HG_OPTS``
766 representations of the data internally passed to <command>. ``$HG_OPTS``
767 is a dictionary of options (with unspecified options set to their
767 is a dictionary of options (with unspecified options set to their
768 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
768 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
769 failure, the command doesn't execute and Mercurial returns the failure
769 failure, the command doesn't execute and Mercurial returns the failure
770 code.
770 code.
771
771
772 ``prechangegroup``
772 ``prechangegroup``
773 Run before a changegroup is added via push, pull or unbundle. Exit
773 Run before a changegroup is added via push, pull or unbundle. Exit
774 status 0 allows the changegroup to proceed. Non-zero status will
774 status 0 allows the changegroup to proceed. Non-zero status will
775 cause the push, pull or unbundle to fail. URL from which changes
775 cause the push, pull or unbundle to fail. URL from which changes
776 will come is in ``$HG_URL``.
776 will come is in ``$HG_URL``.
777
777
778 ``precommit``
778 ``precommit``
779 Run before starting a local commit. Exit status 0 allows the
779 Run before starting a local commit. Exit status 0 allows the
780 commit to proceed. Non-zero status will cause the commit to fail.
780 commit to proceed. Non-zero status will cause the commit to fail.
781 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
781 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
782
782
783 ``prelistkeys``
783 ``prelistkeys``
784 Run before listing pushkeys (like bookmarks) in the
784 Run before listing pushkeys (like bookmarks) in the
785 repository. Non-zero status will cause failure. The key namespace is
785 repository. Non-zero status will cause failure. The key namespace is
786 in ``$HG_NAMESPACE``.
786 in ``$HG_NAMESPACE``.
787
787
788 ``preoutgoing``
788 ``preoutgoing``
789 Run before collecting changes to send from the local repository to
789 Run before collecting changes to send from the local repository to
790 another. Non-zero status will cause failure. This lets you prevent
790 another. Non-zero status will cause failure. This lets you prevent
791 pull over HTTP or SSH. Also prevents against local pull, push
791 pull over HTTP or SSH. Also prevents against local pull, push
792 (outbound) or bundle commands, but not effective, since you can
792 (outbound) or bundle commands, but not effective, since you can
793 just copy files instead then. Source of operation is in
793 just copy files instead then. Source of operation is in
794 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
794 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
795 SSH or HTTP repository. If "push", "pull" or "bundle", operation
795 SSH or HTTP repository. If "push", "pull" or "bundle", operation
796 is happening on behalf of repository on same system.
796 is happening on behalf of repository on same system.
797
797
798 ``prepushkey``
798 ``prepushkey``
799 Run before a pushkey (like a bookmark) is added to the
799 Run before a pushkey (like a bookmark) is added to the
800 repository. Non-zero status will cause the key to be rejected. The
800 repository. Non-zero status will cause the key to be rejected. The
801 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
801 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
802 the old value (if any) is in ``$HG_OLD``, and the new value is in
802 the old value (if any) is in ``$HG_OLD``, and the new value is in
803 ``$HG_NEW``.
803 ``$HG_NEW``.
804
804
805 ``pretag``
805 ``pretag``
806 Run before creating a tag. Exit status 0 allows the tag to be
806 Run before creating a tag. Exit status 0 allows the tag to be
807 created. Non-zero status will cause the tag to fail. ID of
807 created. Non-zero status will cause the tag to fail. ID of
808 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
808 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
809 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
809 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
810
810
811 ``pretxnopen``
811 ``pretxnopen``
812 Run before any new repository transaction is open. The reason for the
812 Run before any new repository transaction is open. The reason for the
813 transaction will be in ``$HG_TXNNAME``. A non-zero status will
813 transaction will be in ``$HG_TXNNAME``. A non-zero status will
814 prevent the transaction from being opened.
814 prevent the transaction from being opened.
815
815
816 ``pretxnclose``
816 ``pretxnclose``
817 Run right before the transaction is actually finalized. Any
817 Run right before the transaction is actually finalized. Any
818 repository change will be visible to the hook program. This lets you
818 repository change will be visible to the hook program. This lets you
819 validate the transaction content or change it. Exit status 0 allows
819 validate the transaction content or change it. Exit status 0 allows
820 the commit to proceed. Non-zero status will cause the transaction to
820 the commit to proceed. Non-zero status will cause the transaction to
821 be rolled back. The reason for the transaction opening will be in
821 be rolled back. The reason for the transaction opening will be in
822 ``$HG_TXNNAME``. The rest of the available data will vary according
822 ``$HG_TXNNAME``. The rest of the available data will vary according
823 the transaction type. New changesets will add
823 the transaction type. New changesets will add
824 ``$HG_NODE`` (id of the first added changeset), ``$HG_URL`` and
824 ``$HG_NODE`` (id of the first added changeset), ``$HG_URL`` and
825 ``$HG_SOURCE`` variables, bookmarks and phases changes will set
825 ``$HG_SOURCE`` variables, bookmarks and phases changes will set
826 ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc.
826 ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc.
827
827
828 ``txnclose``
828 ``txnclose``
829 Run after any repository transaction has been commited. At this
829 Run after any repository transaction has been commited. At this
830 point, the transaction can no longer be rolled back. The hook will run
830 point, the transaction can no longer be rolled back. The hook will run
831 after the lock is released. see ``pretxnclose`` docs for details about
831 after the lock is released. see ``pretxnclose`` docs for details about
832 available variables.
832 available variables.
833
833
834 ``pretxnchangegroup``
834 ``pretxnchangegroup``
835 Run after a changegroup has been added via push, pull or unbundle,
835 Run after a changegroup has been added via push, pull or unbundle,
836 but before the transaction has been committed. Changegroup is
836 but before the transaction has been committed. Changegroup is
837 visible to hook program. This lets you validate incoming changes
837 visible to hook program. This lets you validate incoming changes
838 before accepting them. Passed the ID of the first new changeset in
838 before accepting them. Passed the ID of the first new changeset in
839 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero
839 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero
840 status will cause the transaction to be rolled back and the push,
840 status will cause the transaction to be rolled back and the push,
841 pull or unbundle will fail. URL that was source of changes is in
841 pull or unbundle will fail. URL that was source of changes is in
842 ``$HG_URL``.
842 ``$HG_URL``.
843
843
844 ``pretxncommit``
844 ``pretxncommit``
845 Run after a changeset has been created but the transaction not yet
845 Run after a changeset has been created but the transaction not yet
846 committed. Changeset is visible to hook program. This lets you
846 committed. Changeset is visible to hook program. This lets you
847 validate commit message and changes. Exit status 0 allows the
847 validate commit message and changes. Exit status 0 allows the
848 commit to proceed. Non-zero status will cause the transaction to
848 commit to proceed. Non-zero status will cause the transaction to
849 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
849 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
850 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
850 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
851
851
852 ``preupdate``
852 ``preupdate``
853 Run before updating the working directory. Exit status 0 allows
853 Run before updating the working directory. Exit status 0 allows
854 the update to proceed. Non-zero status will prevent the update.
854 the update to proceed. Non-zero status will prevent the update.
855 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
855 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
856 of second new parent is in ``$HG_PARENT2``.
856 of second new parent is in ``$HG_PARENT2``.
857
857
858 ``listkeys``
858 ``listkeys``
859 Run after listing pushkeys (like bookmarks) in the repository. The
859 Run after listing pushkeys (like bookmarks) in the repository. The
860 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
860 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
861 dictionary containing the keys and values.
861 dictionary containing the keys and values.
862
862
863 ``pushkey``
863 ``pushkey``
864 Run after a pushkey (like a bookmark) is added to the
864 Run after a pushkey (like a bookmark) is added to the
865 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
865 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
866 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
866 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
867 value is in ``$HG_NEW``.
867 value is in ``$HG_NEW``.
868
868
869 ``tag``
869 ``tag``
870 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
870 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
871 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
871 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
872 repository if ``$HG_LOCAL=0``.
872 repository if ``$HG_LOCAL=0``.
873
873
874 ``update``
874 ``update``
875 Run after updating the working directory. Changeset ID of first
875 Run after updating the working directory. Changeset ID of first
876 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
876 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
877 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
877 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
878 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
878 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
879
879
880 .. note::
880 .. note::
881
881
882 It is generally better to use standard hooks rather than the
882 It is generally better to use standard hooks rather than the
883 generic pre- and post- command hooks as they are guaranteed to be
883 generic pre- and post- command hooks as they are guaranteed to be
884 called in the appropriate contexts for influencing transactions.
884 called in the appropriate contexts for influencing transactions.
885 Also, hooks like "commit" will be called in all contexts that
885 Also, hooks like "commit" will be called in all contexts that
886 generate a commit (e.g. tag) and not just the commit command.
886 generate a commit (e.g. tag) and not just the commit command.
887
887
888 .. note::
888 .. note::
889
889
890 Environment variables with empty values may not be passed to
890 Environment variables with empty values may not be passed to
891 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
891 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
892 will have an empty value under Unix-like platforms for non-merge
892 will have an empty value under Unix-like platforms for non-merge
893 changesets, while it will not be available at all under Windows.
893 changesets, while it will not be available at all under Windows.
894
894
895 The syntax for Python hooks is as follows::
895 The syntax for Python hooks is as follows::
896
896
897 hookname = python:modulename.submodule.callable
897 hookname = python:modulename.submodule.callable
898 hookname = python:/path/to/python/module.py:callable
898 hookname = python:/path/to/python/module.py:callable
899
899
900 Python hooks are run within the Mercurial process. Each hook is
900 Python hooks are run within the Mercurial process. Each hook is
901 called with at least three keyword arguments: a ui object (keyword
901 called with at least three keyword arguments: a ui object (keyword
902 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
902 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
903 keyword that tells what kind of hook is used. Arguments listed as
903 keyword that tells what kind of hook is used. Arguments listed as
904 environment variables above are passed as keyword arguments, with no
904 environment variables above are passed as keyword arguments, with no
905 ``HG_`` prefix, and names in lower case.
905 ``HG_`` prefix, and names in lower case.
906
906
907 If a Python hook returns a "true" value or raises an exception, this
907 If a Python hook returns a "true" value or raises an exception, this
908 is treated as a failure.
908 is treated as a failure.
909
909
910
910
911 ``hostfingerprints``
911 ``hostfingerprints``
912 --------------------
912 --------------------
913
913
914 Fingerprints of the certificates of known HTTPS servers.
914 Fingerprints of the certificates of known HTTPS servers.
915 A HTTPS connection to a server with a fingerprint configured here will
915 A HTTPS connection to a server with a fingerprint configured here will
916 only succeed if the servers certificate matches the fingerprint.
916 only succeed if the servers certificate matches the fingerprint.
917 This is very similar to how ssh known hosts works.
917 This is very similar to how ssh known hosts works.
918 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
918 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
919 The CA chain and web.cacerts is not used for servers with a fingerprint.
919 The CA chain and web.cacerts is not used for servers with a fingerprint.
920
920
921 For example::
921 For example::
922
922
923 [hostfingerprints]
923 [hostfingerprints]
924 hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0
924 hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0
925
925
926 This feature is only supported when using Python 2.6 or later.
926 This feature is only supported when using Python 2.6 or later.
927
927
928
928
929 ``http_proxy``
929 ``http_proxy``
930 --------------
930 --------------
931
931
932 Used to access web-based Mercurial repositories through a HTTP
932 Used to access web-based Mercurial repositories through a HTTP
933 proxy.
933 proxy.
934
934
935 ``host``
935 ``host``
936 Host name and (optional) port of the proxy server, for example
936 Host name and (optional) port of the proxy server, for example
937 "myproxy:8000".
937 "myproxy:8000".
938
938
939 ``no``
939 ``no``
940 Optional. Comma-separated list of host names that should bypass
940 Optional. Comma-separated list of host names that should bypass
941 the proxy.
941 the proxy.
942
942
943 ``passwd``
943 ``passwd``
944 Optional. Password to authenticate with at the proxy server.
944 Optional. Password to authenticate with at the proxy server.
945
945
946 ``user``
946 ``user``
947 Optional. User name to authenticate with at the proxy server.
947 Optional. User name to authenticate with at the proxy server.
948
948
949 ``always``
949 ``always``
950 Optional. Always use the proxy, even for localhost and any entries
950 Optional. Always use the proxy, even for localhost and any entries
951 in ``http_proxy.no``. True or False. Default: False.
951 in ``http_proxy.no``. True or False. Default: False.
952
952
953 ``merge-patterns``
953 ``merge-patterns``
954 ------------------
954 ------------------
955
955
956 This section specifies merge tools to associate with particular file
956 This section specifies merge tools to associate with particular file
957 patterns. Tools matched here will take precedence over the default
957 patterns. Tools matched here will take precedence over the default
958 merge tool. Patterns are globs by default, rooted at the repository
958 merge tool. Patterns are globs by default, rooted at the repository
959 root.
959 root.
960
960
961 Example::
961 Example::
962
962
963 [merge-patterns]
963 [merge-patterns]
964 **.c = kdiff3
964 **.c = kdiff3
965 **.jpg = myimgmerge
965 **.jpg = myimgmerge
966
966
967 ``merge-tools``
967 ``merge-tools``
968 ---------------
968 ---------------
969
969
970 This section configures external merge tools to use for file-level
970 This section configures external merge tools to use for file-level
971 merges. This section has likely been preconfigured at install time.
971 merges. This section has likely been preconfigured at install time.
972 Use :hg:`config merge-tools` to check the existing configuration.
972 Use :hg:`config merge-tools` to check the existing configuration.
973 Also see :hg:`help merge-tools` for more details.
973 Also see :hg:`help merge-tools` for more details.
974
974
975 Example ``~/.hgrc``::
975 Example ``~/.hgrc``::
976
976
977 [merge-tools]
977 [merge-tools]
978 # Override stock tool location
978 # Override stock tool location
979 kdiff3.executable = ~/bin/kdiff3
979 kdiff3.executable = ~/bin/kdiff3
980 # Specify command line
980 # Specify command line
981 kdiff3.args = $base $local $other -o $output
981 kdiff3.args = $base $local $other -o $output
982 # Give higher priority
982 # Give higher priority
983 kdiff3.priority = 1
983 kdiff3.priority = 1
984
984
985 # Changing the priority of preconfigured tool
985 # Changing the priority of preconfigured tool
986 vimdiff.priority = 0
986 vimdiff.priority = 0
987
987
988 # Define new tool
988 # Define new tool
989 myHtmlTool.args = -m $local $other $base $output
989 myHtmlTool.args = -m $local $other $base $output
990 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
990 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
991 myHtmlTool.priority = 1
991 myHtmlTool.priority = 1
992
992
993 Supported arguments:
993 Supported arguments:
994
994
995 ``priority``
995 ``priority``
996 The priority in which to evaluate this tool.
996 The priority in which to evaluate this tool.
997 Default: 0.
997 Default: 0.
998
998
999 ``executable``
999 ``executable``
1000 Either just the name of the executable or its pathname. On Windows,
1000 Either just the name of the executable or its pathname. On Windows,
1001 the path can use environment variables with ${ProgramFiles} syntax.
1001 the path can use environment variables with ${ProgramFiles} syntax.
1002 Default: the tool name.
1002 Default: the tool name.
1003
1003
1004 ``args``
1004 ``args``
1005 The arguments to pass to the tool executable. You can refer to the
1005 The arguments to pass to the tool executable. You can refer to the
1006 files being merged as well as the output file through these
1006 files being merged as well as the output file through these
1007 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
1007 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
1008 of ``$local`` and ``$other`` can vary depending on which action is being
1008 of ``$local`` and ``$other`` can vary depending on which action is being
1009 performed. During and update or merge, ``$local`` represents the original
1009 performed. During and update or merge, ``$local`` represents the original
1010 state of the file, while ``$other`` represents the commit you are updating
1010 state of the file, while ``$other`` represents the commit you are updating
1011 to or the commit you are merging with. During a rebase ``$local``
1011 to or the commit you are merging with. During a rebase ``$local``
1012 represents the destination of the rebase, and ``$other`` represents the
1012 represents the destination of the rebase, and ``$other`` represents the
1013 commit being rebased.
1013 commit being rebased.
1014 Default: ``$local $base $other``
1014 Default: ``$local $base $other``
1015
1015
1016 ``premerge``
1016 ``premerge``
1017 Attempt to run internal non-interactive 3-way merge tool before
1017 Attempt to run internal non-interactive 3-way merge tool before
1018 launching external tool. Options are ``true``, ``false``, ``keep`` or
1018 launching external tool. Options are ``true``, ``false``, ``keep`` or
1019 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1019 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1020 premerge fails. The ``keep-merge3`` will do the same but include information
1020 premerge fails. The ``keep-merge3`` will do the same but include information
1021 about the base of the merge in the marker (see internal :merge3 in
1021 about the base of the merge in the marker (see internal :merge3 in
1022 :hg:`help merge-tools`).
1022 :hg:`help merge-tools`).
1023 Default: True
1023 Default: True
1024
1024
1025 ``binary``
1025 ``binary``
1026 This tool can merge binary files. Defaults to False, unless tool
1026 This tool can merge binary files. Defaults to False, unless tool
1027 was selected by file pattern match.
1027 was selected by file pattern match.
1028
1028
1029 ``symlink``
1029 ``symlink``
1030 This tool can merge symlinks. Defaults to False, even if tool was
1030 This tool can merge symlinks. Defaults to False, even if tool was
1031 selected by file pattern match.
1031 selected by file pattern match.
1032
1032
1033 ``check``
1033 ``check``
1034 A list of merge success-checking options:
1034 A list of merge success-checking options:
1035
1035
1036 ``changed``
1036 ``changed``
1037 Ask whether merge was successful when the merged file shows no changes.
1037 Ask whether merge was successful when the merged file shows no changes.
1038 ``conflicts``
1038 ``conflicts``
1039 Check whether there are conflicts even though the tool reported success.
1039 Check whether there are conflicts even though the tool reported success.
1040 ``prompt``
1040 ``prompt``
1041 Always prompt for merge success, regardless of success reported by tool.
1041 Always prompt for merge success, regardless of success reported by tool.
1042
1042
1043 ``fixeol``
1043 ``fixeol``
1044 Attempt to fix up EOL changes caused by the merge tool.
1044 Attempt to fix up EOL changes caused by the merge tool.
1045 Default: False
1045 Default: False
1046
1046
1047 ``gui``
1047 ``gui``
1048 This tool requires a graphical interface to run. Default: False
1048 This tool requires a graphical interface to run. Default: False
1049
1049
1050 ``regkey``
1050 ``regkey``
1051 Windows registry key which describes install location of this
1051 Windows registry key which describes install location of this
1052 tool. Mercurial will search for this key first under
1052 tool. Mercurial will search for this key first under
1053 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1053 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1054 Default: None
1054 Default: None
1055
1055
1056 ``regkeyalt``
1056 ``regkeyalt``
1057 An alternate Windows registry key to try if the first key is not
1057 An alternate Windows registry key to try if the first key is not
1058 found. The alternate key uses the same ``regname`` and ``regappend``
1058 found. The alternate key uses the same ``regname`` and ``regappend``
1059 semantics of the primary key. The most common use for this key
1059 semantics of the primary key. The most common use for this key
1060 is to search for 32bit applications on 64bit operating systems.
1060 is to search for 32bit applications on 64bit operating systems.
1061 Default: None
1061 Default: None
1062
1062
1063 ``regname``
1063 ``regname``
1064 Name of value to read from specified registry key. Defaults to the
1064 Name of value to read from specified registry key. Defaults to the
1065 unnamed (default) value.
1065 unnamed (default) value.
1066
1066
1067 ``regappend``
1067 ``regappend``
1068 String to append to the value read from the registry, typically
1068 String to append to the value read from the registry, typically
1069 the executable name of the tool.
1069 the executable name of the tool.
1070 Default: None
1070 Default: None
1071
1071
1072
1072
1073 ``patch``
1073 ``patch``
1074 ---------
1074 ---------
1075
1075
1076 Settings used when applying patches, for instance through the 'import'
1076 Settings used when applying patches, for instance through the 'import'
1077 command or with Mercurial Queues extension.
1077 command or with Mercurial Queues extension.
1078
1078
1079 ``eol``
1079 ``eol``
1080 When set to 'strict' patch content and patched files end of lines
1080 When set to 'strict' patch content and patched files end of lines
1081 are preserved. When set to ``lf`` or ``crlf``, both files end of
1081 are preserved. When set to ``lf`` or ``crlf``, both files end of
1082 lines are ignored when patching and the result line endings are
1082 lines are ignored when patching and the result line endings are
1083 normalized to either LF (Unix) or CRLF (Windows). When set to
1083 normalized to either LF (Unix) or CRLF (Windows). When set to
1084 ``auto``, end of lines are again ignored while patching but line
1084 ``auto``, end of lines are again ignored while patching but line
1085 endings in patched files are normalized to their original setting
1085 endings in patched files are normalized to their original setting
1086 on a per-file basis. If target file does not exist or has no end
1086 on a per-file basis. If target file does not exist or has no end
1087 of line, patch line endings are preserved.
1087 of line, patch line endings are preserved.
1088 Default: strict.
1088 Default: strict.
1089
1089
1090
1090
1091 ``paths``
1091 ``paths``
1092 ---------
1092 ---------
1093
1093
1094 Assigns symbolic names to repositories. The left side is the
1094 Assigns symbolic names to repositories. The left side is the
1095 symbolic name, and the right gives the directory or URL that is the
1095 symbolic name, and the right gives the directory or URL that is the
1096 location of the repository. Default paths can be declared by setting
1096 location of the repository. Default paths can be declared by setting
1097 the following entries.
1097 the following entries.
1098
1098
1099 ``default``
1099 ``default``
1100 Directory or URL to use when pulling if no source is specified.
1100 Directory or URL to use when pulling if no source is specified.
1101 Default is set to repository from which the current repository was
1101 Default is set to repository from which the current repository was
1102 cloned.
1102 cloned.
1103
1103
1104 ``default-push``
1104 ``default-push``
1105 Optional. Directory or URL to use when pushing if no destination
1105 Optional. Directory or URL to use when pushing if no destination
1106 is specified.
1106 is specified.
1107
1107
1108 Custom paths can be defined by assigning the path to a name that later can be
1108 Custom paths can be defined by assigning the path to a name that later can be
1109 used from the command line. Example::
1109 used from the command line. Example::
1110
1110
1111 [paths]
1111 [paths]
1112 my_path = http://example.com/path
1112 my_path = http://example.com/path
1113
1113
1114 To push to the path defined in ``my_path`` run the command::
1114 To push to the path defined in ``my_path`` run the command::
1115
1115
1116 hg push my_path
1116 hg push my_path
1117
1117
1118
1118
1119 ``phases``
1119 ``phases``
1120 ----------
1120 ----------
1121
1121
1122 Specifies default handling of phases. See :hg:`help phases` for more
1122 Specifies default handling of phases. See :hg:`help phases` for more
1123 information about working with phases.
1123 information about working with phases.
1124
1124
1125 ``publish``
1125 ``publish``
1126 Controls draft phase behavior when working as a server. When true,
1126 Controls draft phase behavior when working as a server. When true,
1127 pushed changesets are set to public in both client and server and
1127 pushed changesets are set to public in both client and server and
1128 pulled or cloned changesets are set to public in the client.
1128 pulled or cloned changesets are set to public in the client.
1129 Default: True
1129 Default: True
1130
1130
1131 ``new-commit``
1131 ``new-commit``
1132 Phase of newly-created commits.
1132 Phase of newly-created commits.
1133 Default: draft
1133 Default: draft
1134
1134
1135 ``checksubrepos``
1135 ``checksubrepos``
1136 Check the phase of the current revision of each subrepository. Allowed
1136 Check the phase of the current revision of each subrepository. Allowed
1137 values are "ignore", "follow" and "abort". For settings other than
1137 values are "ignore", "follow" and "abort". For settings other than
1138 "ignore", the phase of the current revision of each subrepository is
1138 "ignore", the phase of the current revision of each subrepository is
1139 checked before committing the parent repository. If any of those phases is
1139 checked before committing the parent repository. If any of those phases is
1140 greater than the phase of the parent repository (e.g. if a subrepo is in a
1140 greater than the phase of the parent repository (e.g. if a subrepo is in a
1141 "secret" phase while the parent repo is in "draft" phase), the commit is
1141 "secret" phase while the parent repo is in "draft" phase), the commit is
1142 either aborted (if checksubrepos is set to "abort") or the higher phase is
1142 either aborted (if checksubrepos is set to "abort") or the higher phase is
1143 used for the parent repository commit (if set to "follow").
1143 used for the parent repository commit (if set to "follow").
1144 Default: "follow"
1144 Default: "follow"
1145
1145
1146
1146
1147 ``profiling``
1147 ``profiling``
1148 -------------
1148 -------------
1149
1149
1150 Specifies profiling type, format, and file output. Two profilers are
1150 Specifies profiling type, format, and file output. Two profilers are
1151 supported: an instrumenting profiler (named ``ls``), and a sampling
1151 supported: an instrumenting profiler (named ``ls``), and a sampling
1152 profiler (named ``stat``).
1152 profiler (named ``stat``).
1153
1153
1154 In this section description, 'profiling data' stands for the raw data
1154 In this section description, 'profiling data' stands for the raw data
1155 collected during profiling, while 'profiling report' stands for a
1155 collected during profiling, while 'profiling report' stands for a
1156 statistical text report generated from the profiling data. The
1156 statistical text report generated from the profiling data. The
1157 profiling is done using lsprof.
1157 profiling is done using lsprof.
1158
1158
1159 ``type``
1159 ``type``
1160 The type of profiler to use.
1160 The type of profiler to use.
1161 Default: ls.
1161 Default: ls.
1162
1162
1163 ``ls``
1163 ``ls``
1164 Use Python's built-in instrumenting profiler. This profiler
1164 Use Python's built-in instrumenting profiler. This profiler
1165 works on all platforms, but each line number it reports is the
1165 works on all platforms, but each line number it reports is the
1166 first line of a function. This restriction makes it difficult to
1166 first line of a function. This restriction makes it difficult to
1167 identify the expensive parts of a non-trivial function.
1167 identify the expensive parts of a non-trivial function.
1168 ``stat``
1168 ``stat``
1169 Use a third-party statistical profiler, statprof. This profiler
1169 Use a third-party statistical profiler, statprof. This profiler
1170 currently runs only on Unix systems, and is most useful for
1170 currently runs only on Unix systems, and is most useful for
1171 profiling commands that run for longer than about 0.1 seconds.
1171 profiling commands that run for longer than about 0.1 seconds.
1172
1172
1173 ``format``
1173 ``format``
1174 Profiling format. Specific to the ``ls`` instrumenting profiler.
1174 Profiling format. Specific to the ``ls`` instrumenting profiler.
1175 Default: text.
1175 Default: text.
1176
1176
1177 ``text``
1177 ``text``
1178 Generate a profiling report. When saving to a file, it should be
1178 Generate a profiling report. When saving to a file, it should be
1179 noted that only the report is saved, and the profiling data is
1179 noted that only the report is saved, and the profiling data is
1180 not kept.
1180 not kept.
1181 ``kcachegrind``
1181 ``kcachegrind``
1182 Format profiling data for kcachegrind use: when saving to a
1182 Format profiling data for kcachegrind use: when saving to a
1183 file, the generated file can directly be loaded into
1183 file, the generated file can directly be loaded into
1184 kcachegrind.
1184 kcachegrind.
1185
1185
1186 ``frequency``
1186 ``frequency``
1187 Sampling frequency. Specific to the ``stat`` sampling profiler.
1187 Sampling frequency. Specific to the ``stat`` sampling profiler.
1188 Default: 1000.
1188 Default: 1000.
1189
1189
1190 ``output``
1190 ``output``
1191 File path where profiling data or report should be saved. If the
1191 File path where profiling data or report should be saved. If the
1192 file exists, it is replaced. Default: None, data is printed on
1192 file exists, it is replaced. Default: None, data is printed on
1193 stderr
1193 stderr
1194
1194
1195 ``sort``
1195 ``sort``
1196 Sort field. Specific to the ``ls`` instrumenting profiler.
1196 Sort field. Specific to the ``ls`` instrumenting profiler.
1197 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1197 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1198 ``inlinetime``.
1198 ``inlinetime``.
1199 Default: inlinetime.
1199 Default: inlinetime.
1200
1200
1201 ``limit``
1201 ``limit``
1202 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1202 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1203 Default: 30.
1203 Default: 30.
1204
1204
1205 ``nested``
1205 ``nested``
1206 Show at most this number of lines of drill-down info after each main entry.
1206 Show at most this number of lines of drill-down info after each main entry.
1207 This can help explain the difference between Total and Inline.
1207 This can help explain the difference between Total and Inline.
1208 Specific to the ``ls`` instrumenting profiler.
1208 Specific to the ``ls`` instrumenting profiler.
1209 Default: 5.
1209 Default: 5.
1210
1210
1211 ``revsetalias``
1211 ``revsetalias``
1212 ---------------
1212 ---------------
1213
1213
1214 Alias definitions for revsets. See :hg:`help revsets` for details.
1214 Alias definitions for revsets. See :hg:`help revsets` for details.
1215
1215
1216 ``server``
1216 ``server``
1217 ----------
1217 ----------
1218
1218
1219 Controls generic server settings.
1219 Controls generic server settings.
1220
1220
1221 ``uncompressed``
1221 ``uncompressed``
1222 Whether to allow clients to clone a repository using the
1222 Whether to allow clients to clone a repository using the
1223 uncompressed streaming protocol. This transfers about 40% more
1223 uncompressed streaming protocol. This transfers about 40% more
1224 data than a regular clone, but uses less memory and CPU on both
1224 data than a regular clone, but uses less memory and CPU on both
1225 server and client. Over a LAN (100 Mbps or better) or a very fast
1225 server and client. Over a LAN (100 Mbps or better) or a very fast
1226 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1226 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1227 regular clone. Over most WAN connections (anything slower than
1227 regular clone. Over most WAN connections (anything slower than
1228 about 6 Mbps), uncompressed streaming is slower, because of the
1228 about 6 Mbps), uncompressed streaming is slower, because of the
1229 extra data transfer overhead. This mode will also temporarily hold
1229 extra data transfer overhead. This mode will also temporarily hold
1230 the write lock while determining what data to transfer.
1230 the write lock while determining what data to transfer.
1231 Default is True.
1231 Default is True.
1232
1232
1233 ``preferuncompressed``
1233 ``preferuncompressed``
1234 When set, clients will try to use the uncompressed streaming
1234 When set, clients will try to use the uncompressed streaming
1235 protocol. Default is False.
1235 protocol. Default is False.
1236
1236
1237 ``validate``
1237 ``validate``
1238 Whether to validate the completeness of pushed changesets by
1238 Whether to validate the completeness of pushed changesets by
1239 checking that all new file revisions specified in manifests are
1239 checking that all new file revisions specified in manifests are
1240 present. Default is False.
1240 present. Default is False.
1241
1241
1242 ``smtp``
1242 ``smtp``
1243 --------
1243 --------
1244
1244
1245 Configuration for extensions that need to send email messages.
1245 Configuration for extensions that need to send email messages.
1246
1246
1247 ``host``
1247 ``host``
1248 Host name of mail server, e.g. "mail.example.com".
1248 Host name of mail server, e.g. "mail.example.com".
1249
1249
1250 ``port``
1250 ``port``
1251 Optional. Port to connect to on mail server. Default: 465 (if
1251 Optional. Port to connect to on mail server. Default: 465 (if
1252 ``tls`` is smtps) or 25 (otherwise).
1252 ``tls`` is smtps) or 25 (otherwise).
1253
1253
1254 ``tls``
1254 ``tls``
1255 Optional. Method to enable TLS when connecting to mail server: starttls,
1255 Optional. Method to enable TLS when connecting to mail server: starttls,
1256 smtps or none. Default: none.
1256 smtps or none. Default: none.
1257
1257
1258 ``verifycert``
1258 ``verifycert``
1259 Optional. Verification for the certificate of mail server, when
1259 Optional. Verification for the certificate of mail server, when
1260 ``tls`` is starttls or smtps. "strict", "loose" or False. For
1260 ``tls`` is starttls or smtps. "strict", "loose" or False. For
1261 "strict" or "loose", the certificate is verified as same as the
1261 "strict" or "loose", the certificate is verified as same as the
1262 verification for HTTPS connections (see ``[hostfingerprints]`` and
1262 verification for HTTPS connections (see ``[hostfingerprints]`` and
1263 ``[web] cacerts`` also). For "strict", sending email is also
1263 ``[web] cacerts`` also). For "strict", sending email is also
1264 aborted, if there is no configuration for mail server in
1264 aborted, if there is no configuration for mail server in
1265 ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for
1265 ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for
1266 :hg:`email` overwrites this as "loose". Default: "strict".
1266 :hg:`email` overwrites this as "loose". Default: "strict".
1267
1267
1268 ``username``
1268 ``username``
1269 Optional. User name for authenticating with the SMTP server.
1269 Optional. User name for authenticating with the SMTP server.
1270 Default: none.
1270 Default: none.
1271
1271
1272 ``password``
1272 ``password``
1273 Optional. Password for authenticating with the SMTP server. If not
1273 Optional. Password for authenticating with the SMTP server. If not
1274 specified, interactive sessions will prompt the user for a
1274 specified, interactive sessions will prompt the user for a
1275 password; non-interactive sessions will fail. Default: none.
1275 password; non-interactive sessions will fail. Default: none.
1276
1276
1277 ``local_hostname``
1277 ``local_hostname``
1278 Optional. It's the hostname that the sender can use to identify
1278 Optional. It's the hostname that the sender can use to identify
1279 itself to the MTA.
1279 itself to the MTA.
1280
1280
1281
1281
1282 ``subpaths``
1282 ``subpaths``
1283 ------------
1283 ------------
1284
1284
1285 Subrepository source URLs can go stale if a remote server changes name
1285 Subrepository source URLs can go stale if a remote server changes name
1286 or becomes temporarily unavailable. This section lets you define
1286 or becomes temporarily unavailable. This section lets you define
1287 rewrite rules of the form::
1287 rewrite rules of the form::
1288
1288
1289 <pattern> = <replacement>
1289 <pattern> = <replacement>
1290
1290
1291 where ``pattern`` is a regular expression matching a subrepository
1291 where ``pattern`` is a regular expression matching a subrepository
1292 source URL and ``replacement`` is the replacement string used to
1292 source URL and ``replacement`` is the replacement string used to
1293 rewrite it. Groups can be matched in ``pattern`` and referenced in
1293 rewrite it. Groups can be matched in ``pattern`` and referenced in
1294 ``replacements``. For instance::
1294 ``replacements``. For instance::
1295
1295
1296 http://server/(.*)-hg/ = http://hg.server/\1/
1296 http://server/(.*)-hg/ = http://hg.server/\1/
1297
1297
1298 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1298 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1299
1299
1300 Relative subrepository paths are first made absolute, and the
1300 Relative subrepository paths are first made absolute, and the
1301 rewrite rules are then applied on the full (absolute) path. The rules
1301 rewrite rules are then applied on the full (absolute) path. The rules
1302 are applied in definition order.
1302 are applied in definition order.
1303
1303
1304 ``trusted``
1304 ``trusted``
1305 -----------
1305 -----------
1306
1306
1307 Mercurial will not use the settings in the
1307 Mercurial will not use the settings in the
1308 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1308 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1309 user or to a trusted group, as various hgrc features allow arbitrary
1309 user or to a trusted group, as various hgrc features allow arbitrary
1310 commands to be run. This issue is often encountered when configuring
1310 commands to be run. This issue is often encountered when configuring
1311 hooks or extensions for shared repositories or servers. However,
1311 hooks or extensions for shared repositories or servers. However,
1312 the web interface will use some safe settings from the ``[web]``
1312 the web interface will use some safe settings from the ``[web]``
1313 section.
1313 section.
1314
1314
1315 This section specifies what users and groups are trusted. The
1315 This section specifies what users and groups are trusted. The
1316 current user is always trusted. To trust everybody, list a user or a
1316 current user is always trusted. To trust everybody, list a user or a
1317 group with name ``*``. These settings must be placed in an
1317 group with name ``*``. These settings must be placed in an
1318 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1318 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1319 user or service running Mercurial.
1319 user or service running Mercurial.
1320
1320
1321 ``users``
1321 ``users``
1322 Comma-separated list of trusted users.
1322 Comma-separated list of trusted users.
1323
1323
1324 ``groups``
1324 ``groups``
1325 Comma-separated list of trusted groups.
1325 Comma-separated list of trusted groups.
1326
1326
1327
1327
1328 ``ui``
1328 ``ui``
1329 ------
1329 ------
1330
1330
1331 User interface controls.
1331 User interface controls.
1332
1332
1333 ``archivemeta``
1333 ``archivemeta``
1334 Whether to include the .hg_archival.txt file containing meta data
1334 Whether to include the .hg_archival.txt file containing meta data
1335 (hashes for the repository base and for tip) in archives created
1335 (hashes for the repository base and for tip) in archives created
1336 by the :hg:`archive` command or downloaded via hgweb.
1336 by the :hg:`archive` command or downloaded via hgweb.
1337 Default is True.
1337 Default is True.
1338
1338
1339 ``askusername``
1339 ``askusername``
1340 Whether to prompt for a username when committing. If True, and
1340 Whether to prompt for a username when committing. If True, and
1341 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1341 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1342 be prompted to enter a username. If no username is entered, the
1342 be prompted to enter a username. If no username is entered, the
1343 default ``USER@HOST`` is used instead.
1343 default ``USER@HOST`` is used instead.
1344 Default is False.
1344 Default is False.
1345
1345
1346 ``commitsubrepos``
1346 ``commitsubrepos``
1347 Whether to commit modified subrepositories when committing the
1347 Whether to commit modified subrepositories when committing the
1348 parent repository. If False and one subrepository has uncommitted
1348 parent repository. If False and one subrepository has uncommitted
1349 changes, abort the commit.
1349 changes, abort the commit.
1350 Default is False.
1350 Default is False.
1351
1351
1352 ``debug``
1352 ``debug``
1353 Print debugging information. True or False. Default is False.
1353 Print debugging information. True or False. Default is False.
1354
1354
1355 ``editor``
1355 ``editor``
1356 The editor to use during a commit. Default is ``$EDITOR`` or ``vi``.
1356 The editor to use during a commit. Default is ``$EDITOR`` or ``vi``.
1357
1357
1358 ``fallbackencoding``
1358 ``fallbackencoding``
1359 Encoding to try if it's not possible to decode the changelog using
1359 Encoding to try if it's not possible to decode the changelog using
1360 UTF-8. Default is ISO-8859-1.
1360 UTF-8. Default is ISO-8859-1.
1361
1361
1362 ``ignore``
1362 ``ignore``
1363 A file to read per-user ignore patterns from. This file should be
1363 A file to read per-user ignore patterns from. This file should be
1364 in the same format as a repository-wide .hgignore file. Filenames
1364 in the same format as a repository-wide .hgignore file. Filenames
1365 are relative to the repository root. This option supports hook syntax,
1365 are relative to the repository root. This option supports hook syntax,
1366 so if you want to specify multiple ignore files, you can do so by
1366 so if you want to specify multiple ignore files, you can do so by
1367 setting something like ``ignore.other = ~/.hgignore2``. For details
1367 setting something like ``ignore.other = ~/.hgignore2``. For details
1368 of the ignore file format, see the ``hgignore(5)`` man page.
1368 of the ignore file format, see the ``hgignore(5)`` man page.
1369
1369
1370 ``interactive``
1370 ``interactive``
1371 Allow to prompt the user. True or False. Default is True.
1371 Allow to prompt the user. True or False. Default is True.
1372
1372
1373 ``logtemplate``
1373 ``logtemplate``
1374 Template string for commands that print changesets.
1374 Template string for commands that print changesets.
1375
1375
1376 ``merge``
1376 ``merge``
1377 The conflict resolution program to use during a manual merge.
1377 The conflict resolution program to use during a manual merge.
1378 For more information on merge tools see :hg:`help merge-tools`.
1378 For more information on merge tools see :hg:`help merge-tools`.
1379 For configuring merge tools see the ``[merge-tools]`` section.
1379 For configuring merge tools see the ``[merge-tools]`` section.
1380
1380
1381 ``mergemarkers``
1381 ``mergemarkers``
1382 Sets the merge conflict marker label styling. The ``detailed``
1382 Sets the merge conflict marker label styling. The ``detailed``
1383 style uses the ``mergemarkertemplate`` setting to style the labels.
1383 style uses the ``mergemarkertemplate`` setting to style the labels.
1384 The ``basic`` style just uses 'local' and 'other' as the marker label.
1384 The ``basic`` style just uses 'local' and 'other' as the marker label.
1385 One of ``basic`` or ``detailed``.
1385 One of ``basic`` or ``detailed``.
1386 Default is ``basic``.
1386 Default is ``basic``.
1387
1387
1388 ``mergemarkertemplate``
1388 ``mergemarkertemplate``
1389 The template used to print the commit description next to each conflict
1389 The template used to print the commit description next to each conflict
1390 marker during merge conflicts. See :hg:`help templates` for the template
1390 marker during merge conflicts. See :hg:`help templates` for the template
1391 format.
1391 format.
1392 Defaults to showing the hash, tags, branches, bookmarks, author, and
1392 Defaults to showing the hash, tags, branches, bookmarks, author, and
1393 the first line of the commit description.
1393 the first line of the commit description.
1394 You have to pay attention to encodings of managed files, if you
1394 If you use non-ASCII characters in names for tags, branches, bookmarks,
1395 use non-ASCII characters in tags, branches, bookmarks, author
1395 authors, and/or commit descriptions, you must pay attention to encodings of
1396 and/or commit descriptions. At template expansion, non-ASCII
1396 managed files. At template expansion, non-ASCII characters use the encoding
1397 characters use the encoding specified by ``--encoding`` global
1397 specified by the ``--encoding`` global option, ``HGENCODING`` or other
1398 option, ``HGENCODING`` or other locale setting environment
1398 environment variables that govern your locale. If the encoding of the merge
1399 variables. The difference of encoding between merged file and
1399 markers is different from the encoding of the merged files,
1400 conflict markers causes serious problem.
1400 serious problems may occur.
1401
1401
1402 ``portablefilenames``
1402 ``portablefilenames``
1403 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1403 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1404 Default is ``warn``.
1404 Default is ``warn``.
1405 If set to ``warn`` (or ``true``), a warning message is printed on POSIX
1405 If set to ``warn`` (or ``true``), a warning message is printed on POSIX
1406 platforms, if a file with a non-portable filename is added (e.g. a file
1406 platforms, if a file with a non-portable filename is added (e.g. a file
1407 with a name that can't be created on Windows because it contains reserved
1407 with a name that can't be created on Windows because it contains reserved
1408 parts like ``AUX``, reserved characters like ``:``, or would cause a case
1408 parts like ``AUX``, reserved characters like ``:``, or would cause a case
1409 collision with an existing file).
1409 collision with an existing file).
1410 If set to ``ignore`` (or ``false``), no warning is printed.
1410 If set to ``ignore`` (or ``false``), no warning is printed.
1411 If set to ``abort``, the command is aborted.
1411 If set to ``abort``, the command is aborted.
1412 On Windows, this configuration option is ignored and the command aborted.
1412 On Windows, this configuration option is ignored and the command aborted.
1413
1413
1414 ``quiet``
1414 ``quiet``
1415 Reduce the amount of output printed. True or False. Default is False.
1415 Reduce the amount of output printed. True or False. Default is False.
1416
1416
1417 ``remotecmd``
1417 ``remotecmd``
1418 remote command to use for clone/push/pull operations. Default is ``hg``.
1418 remote command to use for clone/push/pull operations. Default is ``hg``.
1419
1419
1420 ``reportoldssl``
1420 ``reportoldssl``
1421 Warn if an SSL certificate is unable to be used due to using Python
1421 Warn if an SSL certificate is unable to be used due to using Python
1422 2.5 or earlier. True or False. Default is True.
1422 2.5 or earlier. True or False. Default is True.
1423
1423
1424 ``report_untrusted``
1424 ``report_untrusted``
1425 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1425 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1426 trusted user or group. True or False. Default is True.
1426 trusted user or group. True or False. Default is True.
1427
1427
1428 ``slash``
1428 ``slash``
1429 Display paths using a slash (``/``) as the path separator. This
1429 Display paths using a slash (``/``) as the path separator. This
1430 only makes a difference on systems where the default path
1430 only makes a difference on systems where the default path
1431 separator is not the slash character (e.g. Windows uses the
1431 separator is not the slash character (e.g. Windows uses the
1432 backslash character (``\``)).
1432 backslash character (``\``)).
1433 Default is False.
1433 Default is False.
1434
1434
1435 ``ssh``
1435 ``ssh``
1436 command to use for SSH connections. Default is ``ssh``.
1436 command to use for SSH connections. Default is ``ssh``.
1437
1437
1438 ``strict``
1438 ``strict``
1439 Require exact command names, instead of allowing unambiguous
1439 Require exact command names, instead of allowing unambiguous
1440 abbreviations. True or False. Default is False.
1440 abbreviations. True or False. Default is False.
1441
1441
1442 ``style``
1442 ``style``
1443 Name of style to use for command output.
1443 Name of style to use for command output.
1444
1444
1445 ``timeout``
1445 ``timeout``
1446 The timeout used when a lock is held (in seconds), a negative value
1446 The timeout used when a lock is held (in seconds), a negative value
1447 means no timeout. Default is 600.
1447 means no timeout. Default is 600.
1448
1448
1449 ``traceback``
1449 ``traceback``
1450 Mercurial always prints a traceback when an unknown exception
1450 Mercurial always prints a traceback when an unknown exception
1451 occurs. Setting this to True will make Mercurial print a traceback
1451 occurs. Setting this to True will make Mercurial print a traceback
1452 on all exceptions, even those recognized by Mercurial (such as
1452 on all exceptions, even those recognized by Mercurial (such as
1453 IOError or MemoryError). Default is False.
1453 IOError or MemoryError). Default is False.
1454
1454
1455 ``username``
1455 ``username``
1456 The committer of a changeset created when running "commit".
1456 The committer of a changeset created when running "commit".
1457 Typically a person's name and email address, e.g. ``Fred Widget
1457 Typically a person's name and email address, e.g. ``Fred Widget
1458 <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If
1458 <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If
1459 the username in hgrc is empty, it has to be specified manually or
1459 the username in hgrc is empty, it has to be specified manually or
1460 in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set
1460 in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set
1461 ``username =`` in the system hgrc). Environment variables in the
1461 ``username =`` in the system hgrc). Environment variables in the
1462 username are expanded.
1462 username are expanded.
1463
1463
1464 ``verbose``
1464 ``verbose``
1465 Increase the amount of output printed. True or False. Default is False.
1465 Increase the amount of output printed. True or False. Default is False.
1466
1466
1467
1467
1468 ``web``
1468 ``web``
1469 -------
1469 -------
1470
1470
1471 Web interface configuration. The settings in this section apply to
1471 Web interface configuration. The settings in this section apply to
1472 both the builtin webserver (started by :hg:`serve`) and the script you
1472 both the builtin webserver (started by :hg:`serve`) and the script you
1473 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1473 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1474 and WSGI).
1474 and WSGI).
1475
1475
1476 The Mercurial webserver does no authentication (it does not prompt for
1476 The Mercurial webserver does no authentication (it does not prompt for
1477 usernames and passwords to validate *who* users are), but it does do
1477 usernames and passwords to validate *who* users are), but it does do
1478 authorization (it grants or denies access for *authenticated users*
1478 authorization (it grants or denies access for *authenticated users*
1479 based on settings in this section). You must either configure your
1479 based on settings in this section). You must either configure your
1480 webserver to do authentication for you, or disable the authorization
1480 webserver to do authentication for you, or disable the authorization
1481 checks.
1481 checks.
1482
1482
1483 For a quick setup in a trusted environment, e.g., a private LAN, where
1483 For a quick setup in a trusted environment, e.g., a private LAN, where
1484 you want it to accept pushes from anybody, you can use the following
1484 you want it to accept pushes from anybody, you can use the following
1485 command line::
1485 command line::
1486
1486
1487 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1487 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1488
1488
1489 Note that this will allow anybody to push anything to the server and
1489 Note that this will allow anybody to push anything to the server and
1490 that this should not be used for public servers.
1490 that this should not be used for public servers.
1491
1491
1492 The full set of options is:
1492 The full set of options is:
1493
1493
1494 ``accesslog``
1494 ``accesslog``
1495 Where to output the access log. Default is stdout.
1495 Where to output the access log. Default is stdout.
1496
1496
1497 ``address``
1497 ``address``
1498 Interface address to bind to. Default is all.
1498 Interface address to bind to. Default is all.
1499
1499
1500 ``allow_archive``
1500 ``allow_archive``
1501 List of archive format (bz2, gz, zip) allowed for downloading.
1501 List of archive format (bz2, gz, zip) allowed for downloading.
1502 Default is empty.
1502 Default is empty.
1503
1503
1504 ``allowbz2``
1504 ``allowbz2``
1505 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1505 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1506 revisions.
1506 revisions.
1507 Default is False.
1507 Default is False.
1508
1508
1509 ``allowgz``
1509 ``allowgz``
1510 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1510 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1511 revisions.
1511 revisions.
1512 Default is False.
1512 Default is False.
1513
1513
1514 ``allowpull``
1514 ``allowpull``
1515 Whether to allow pulling from the repository. Default is True.
1515 Whether to allow pulling from the repository. Default is True.
1516
1516
1517 ``allow_push``
1517 ``allow_push``
1518 Whether to allow pushing to the repository. If empty or not set,
1518 Whether to allow pushing to the repository. If empty or not set,
1519 push is not allowed. If the special value ``*``, any remote user can
1519 push is not allowed. If the special value ``*``, any remote user can
1520 push, including unauthenticated users. Otherwise, the remote user
1520 push, including unauthenticated users. Otherwise, the remote user
1521 must have been authenticated, and the authenticated user name must
1521 must have been authenticated, and the authenticated user name must
1522 be present in this list. The contents of the allow_push list are
1522 be present in this list. The contents of the allow_push list are
1523 examined after the deny_push list.
1523 examined after the deny_push list.
1524
1524
1525 ``allow_read``
1525 ``allow_read``
1526 If the user has not already been denied repository access due to
1526 If the user has not already been denied repository access due to
1527 the contents of deny_read, this list determines whether to grant
1527 the contents of deny_read, this list determines whether to grant
1528 repository access to the user. If this list is not empty, and the
1528 repository access to the user. If this list is not empty, and the
1529 user is unauthenticated or not present in the list, then access is
1529 user is unauthenticated or not present in the list, then access is
1530 denied for the user. If the list is empty or not set, then access
1530 denied for the user. If the list is empty or not set, then access
1531 is permitted to all users by default. Setting allow_read to the
1531 is permitted to all users by default. Setting allow_read to the
1532 special value ``*`` is equivalent to it not being set (i.e. access
1532 special value ``*`` is equivalent to it not being set (i.e. access
1533 is permitted to all users). The contents of the allow_read list are
1533 is permitted to all users). The contents of the allow_read list are
1534 examined after the deny_read list.
1534 examined after the deny_read list.
1535
1535
1536 ``allowzip``
1536 ``allowzip``
1537 (DEPRECATED) Whether to allow .zip downloading of repository
1537 (DEPRECATED) Whether to allow .zip downloading of repository
1538 revisions. Default is False. This feature creates temporary files.
1538 revisions. Default is False. This feature creates temporary files.
1539
1539
1540 ``archivesubrepos``
1540 ``archivesubrepos``
1541 Whether to recurse into subrepositories when archiving. Default is
1541 Whether to recurse into subrepositories when archiving. Default is
1542 False.
1542 False.
1543
1543
1544 ``baseurl``
1544 ``baseurl``
1545 Base URL to use when publishing URLs in other locations, so
1545 Base URL to use when publishing URLs in other locations, so
1546 third-party tools like email notification hooks can construct
1546 third-party tools like email notification hooks can construct
1547 URLs. Example: ``http://hgserver/repos/``.
1547 URLs. Example: ``http://hgserver/repos/``.
1548
1548
1549 ``cacerts``
1549 ``cacerts``
1550 Path to file containing a list of PEM encoded certificate
1550 Path to file containing a list of PEM encoded certificate
1551 authority certificates. Environment variables and ``~user``
1551 authority certificates. Environment variables and ``~user``
1552 constructs are expanded in the filename. If specified on the
1552 constructs are expanded in the filename. If specified on the
1553 client, then it will verify the identity of remote HTTPS servers
1553 client, then it will verify the identity of remote HTTPS servers
1554 with these certificates.
1554 with these certificates.
1555
1555
1556 This feature is only supported when using Python 2.6 or later. If you wish
1556 This feature is only supported when using Python 2.6 or later. If you wish
1557 to use it with earlier versions of Python, install the backported
1557 to use it with earlier versions of Python, install the backported
1558 version of the ssl library that is available from
1558 version of the ssl library that is available from
1559 ``http://pypi.python.org``.
1559 ``http://pypi.python.org``.
1560
1560
1561 To disable SSL verification temporarily, specify ``--insecure`` from
1561 To disable SSL verification temporarily, specify ``--insecure`` from
1562 command line.
1562 command line.
1563
1563
1564 You can use OpenSSL's CA certificate file if your platform has
1564 You can use OpenSSL's CA certificate file if your platform has
1565 one. On most Linux systems this will be
1565 one. On most Linux systems this will be
1566 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
1566 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
1567 generate this file manually. The form must be as follows::
1567 generate this file manually. The form must be as follows::
1568
1568
1569 -----BEGIN CERTIFICATE-----
1569 -----BEGIN CERTIFICATE-----
1570 ... (certificate in base64 PEM encoding) ...
1570 ... (certificate in base64 PEM encoding) ...
1571 -----END CERTIFICATE-----
1571 -----END CERTIFICATE-----
1572 -----BEGIN CERTIFICATE-----
1572 -----BEGIN CERTIFICATE-----
1573 ... (certificate in base64 PEM encoding) ...
1573 ... (certificate in base64 PEM encoding) ...
1574 -----END CERTIFICATE-----
1574 -----END CERTIFICATE-----
1575
1575
1576 ``cache``
1576 ``cache``
1577 Whether to support caching in hgweb. Defaults to True.
1577 Whether to support caching in hgweb. Defaults to True.
1578
1578
1579 ``collapse``
1579 ``collapse``
1580 With ``descend`` enabled, repositories in subdirectories are shown at
1580 With ``descend`` enabled, repositories in subdirectories are shown at
1581 a single level alongside repositories in the current path. With
1581 a single level alongside repositories in the current path. With
1582 ``collapse`` also enabled, repositories residing at a deeper level than
1582 ``collapse`` also enabled, repositories residing at a deeper level than
1583 the current path are grouped behind navigable directory entries that
1583 the current path are grouped behind navigable directory entries that
1584 lead to the locations of these repositories. In effect, this setting
1584 lead to the locations of these repositories. In effect, this setting
1585 collapses each collection of repositories found within a subdirectory
1585 collapses each collection of repositories found within a subdirectory
1586 into a single entry for that subdirectory. Default is False.
1586 into a single entry for that subdirectory. Default is False.
1587
1587
1588 ``comparisoncontext``
1588 ``comparisoncontext``
1589 Number of lines of context to show in side-by-side file comparison. If
1589 Number of lines of context to show in side-by-side file comparison. If
1590 negative or the value ``full``, whole files are shown. Default is 5.
1590 negative or the value ``full``, whole files are shown. Default is 5.
1591 This setting can be overridden by a ``context`` request parameter to the
1591 This setting can be overridden by a ``context`` request parameter to the
1592 ``comparison`` command, taking the same values.
1592 ``comparison`` command, taking the same values.
1593
1593
1594 ``contact``
1594 ``contact``
1595 Name or email address of the person in charge of the repository.
1595 Name or email address of the person in charge of the repository.
1596 Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty.
1596 Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty.
1597
1597
1598 ``deny_push``
1598 ``deny_push``
1599 Whether to deny pushing to the repository. If empty or not set,
1599 Whether to deny pushing to the repository. If empty or not set,
1600 push is not denied. If the special value ``*``, all remote users are
1600 push is not denied. If the special value ``*``, all remote users are
1601 denied push. Otherwise, unauthenticated users are all denied, and
1601 denied push. Otherwise, unauthenticated users are all denied, and
1602 any authenticated user name present in this list is also denied. The
1602 any authenticated user name present in this list is also denied. The
1603 contents of the deny_push list are examined before the allow_push list.
1603 contents of the deny_push list are examined before the allow_push list.
1604
1604
1605 ``deny_read``
1605 ``deny_read``
1606 Whether to deny reading/viewing of the repository. If this list is
1606 Whether to deny reading/viewing of the repository. If this list is
1607 not empty, unauthenticated users are all denied, and any
1607 not empty, unauthenticated users are all denied, and any
1608 authenticated user name present in this list is also denied access to
1608 authenticated user name present in this list is also denied access to
1609 the repository. If set to the special value ``*``, all remote users
1609 the repository. If set to the special value ``*``, all remote users
1610 are denied access (rarely needed ;). If deny_read is empty or not set,
1610 are denied access (rarely needed ;). If deny_read is empty or not set,
1611 the determination of repository access depends on the presence and
1611 the determination of repository access depends on the presence and
1612 content of the allow_read list (see description). If both
1612 content of the allow_read list (see description). If both
1613 deny_read and allow_read are empty or not set, then access is
1613 deny_read and allow_read are empty or not set, then access is
1614 permitted to all users by default. If the repository is being
1614 permitted to all users by default. If the repository is being
1615 served via hgwebdir, denied users will not be able to see it in
1615 served via hgwebdir, denied users will not be able to see it in
1616 the list of repositories. The contents of the deny_read list have
1616 the list of repositories. The contents of the deny_read list have
1617 priority over (are examined before) the contents of the allow_read
1617 priority over (are examined before) the contents of the allow_read
1618 list.
1618 list.
1619
1619
1620 ``descend``
1620 ``descend``
1621 hgwebdir indexes will not descend into subdirectories. Only repositories
1621 hgwebdir indexes will not descend into subdirectories. Only repositories
1622 directly in the current path will be shown (other repositories are still
1622 directly in the current path will be shown (other repositories are still
1623 available from the index corresponding to their containing path).
1623 available from the index corresponding to their containing path).
1624
1624
1625 ``description``
1625 ``description``
1626 Textual description of the repository's purpose or contents.
1626 Textual description of the repository's purpose or contents.
1627 Default is "unknown".
1627 Default is "unknown".
1628
1628
1629 ``encoding``
1629 ``encoding``
1630 Character encoding name. Default is the current locale charset.
1630 Character encoding name. Default is the current locale charset.
1631 Example: "UTF-8"
1631 Example: "UTF-8"
1632
1632
1633 ``errorlog``
1633 ``errorlog``
1634 Where to output the error log. Default is stderr.
1634 Where to output the error log. Default is stderr.
1635
1635
1636 ``guessmime``
1636 ``guessmime``
1637 Control MIME types for raw download of file content.
1637 Control MIME types for raw download of file content.
1638 Set to True to let hgweb guess the content type from the file
1638 Set to True to let hgweb guess the content type from the file
1639 extension. This will serve HTML files as ``text/html`` and might
1639 extension. This will serve HTML files as ``text/html`` and might
1640 allow cross-site scripting attacks when serving untrusted
1640 allow cross-site scripting attacks when serving untrusted
1641 repositories. Default is False.
1641 repositories. Default is False.
1642
1642
1643 ``hidden``
1643 ``hidden``
1644 Whether to hide the repository in the hgwebdir index.
1644 Whether to hide the repository in the hgwebdir index.
1645 Default is False.
1645 Default is False.
1646
1646
1647 ``ipv6``
1647 ``ipv6``
1648 Whether to use IPv6. Default is False.
1648 Whether to use IPv6. Default is False.
1649
1649
1650 ``logoimg``
1650 ``logoimg``
1651 File name of the logo image that some templates display on each page.
1651 File name of the logo image that some templates display on each page.
1652 The file name is relative to ``staticurl``. That is, the full path to
1652 The file name is relative to ``staticurl``. That is, the full path to
1653 the logo image is "staticurl/logoimg".
1653 the logo image is "staticurl/logoimg".
1654 If unset, ``hglogo.png`` will be used.
1654 If unset, ``hglogo.png`` will be used.
1655
1655
1656 ``logourl``
1656 ``logourl``
1657 Base URL to use for logos. If unset, ``http://mercurial.selenic.com/``
1657 Base URL to use for logos. If unset, ``http://mercurial.selenic.com/``
1658 will be used.
1658 will be used.
1659
1659
1660 ``maxchanges``
1660 ``maxchanges``
1661 Maximum number of changes to list on the changelog. Default is 10.
1661 Maximum number of changes to list on the changelog. Default is 10.
1662
1662
1663 ``maxfiles``
1663 ``maxfiles``
1664 Maximum number of files to list per changeset. Default is 10.
1664 Maximum number of files to list per changeset. Default is 10.
1665
1665
1666 ``maxshortchanges``
1666 ``maxshortchanges``
1667 Maximum number of changes to list on the shortlog, graph or filelog
1667 Maximum number of changes to list on the shortlog, graph or filelog
1668 pages. Default is 60.
1668 pages. Default is 60.
1669
1669
1670 ``name``
1670 ``name``
1671 Repository name to use in the web interface. Default is current
1671 Repository name to use in the web interface. Default is current
1672 working directory.
1672 working directory.
1673
1673
1674 ``port``
1674 ``port``
1675 Port to listen on. Default is 8000.
1675 Port to listen on. Default is 8000.
1676
1676
1677 ``prefix``
1677 ``prefix``
1678 Prefix path to serve from. Default is '' (server root).
1678 Prefix path to serve from. Default is '' (server root).
1679
1679
1680 ``push_ssl``
1680 ``push_ssl``
1681 Whether to require that inbound pushes be transported over SSL to
1681 Whether to require that inbound pushes be transported over SSL to
1682 prevent password sniffing. Default is True.
1682 prevent password sniffing. Default is True.
1683
1683
1684 ``staticurl``
1684 ``staticurl``
1685 Base URL to use for static files. If unset, static files (e.g. the
1685 Base URL to use for static files. If unset, static files (e.g. the
1686 hgicon.png favicon) will be served by the CGI script itself. Use
1686 hgicon.png favicon) will be served by the CGI script itself. Use
1687 this setting to serve them directly with the HTTP server.
1687 this setting to serve them directly with the HTTP server.
1688 Example: ``http://hgserver/static/``.
1688 Example: ``http://hgserver/static/``.
1689
1689
1690 ``stripes``
1690 ``stripes``
1691 How many lines a "zebra stripe" should span in multi-line output.
1691 How many lines a "zebra stripe" should span in multi-line output.
1692 Default is 1; set to 0 to disable.
1692 Default is 1; set to 0 to disable.
1693
1693
1694 ``style``
1694 ``style``
1695 Which template map style to use. The available options are the names of
1695 Which template map style to use. The available options are the names of
1696 subdirectories in the HTML templates path. Default is ``paper``.
1696 subdirectories in the HTML templates path. Default is ``paper``.
1697 Example: ``monoblue``
1697 Example: ``monoblue``
1698
1698
1699 ``templates``
1699 ``templates``
1700 Where to find the HTML templates. The default path to the HTML templates
1700 Where to find the HTML templates. The default path to the HTML templates
1701 can be obtained from ``hg debuginstall``.
1701 can be obtained from ``hg debuginstall``.
1702
1702
1703 ``websub``
1703 ``websub``
1704 ----------
1704 ----------
1705
1705
1706 Web substitution filter definition. You can use this section to
1706 Web substitution filter definition. You can use this section to
1707 define a set of regular expression substitution patterns which
1707 define a set of regular expression substitution patterns which
1708 let you automatically modify the hgweb server output.
1708 let you automatically modify the hgweb server output.
1709
1709
1710 The default hgweb templates only apply these substitution patterns
1710 The default hgweb templates only apply these substitution patterns
1711 on the revision description fields. You can apply them anywhere
1711 on the revision description fields. You can apply them anywhere
1712 you want when you create your own templates by adding calls to the
1712 you want when you create your own templates by adding calls to the
1713 "websub" filter (usually after calling the "escape" filter).
1713 "websub" filter (usually after calling the "escape" filter).
1714
1714
1715 This can be used, for example, to convert issue references to links
1715 This can be used, for example, to convert issue references to links
1716 to your issue tracker, or to convert "markdown-like" syntax into
1716 to your issue tracker, or to convert "markdown-like" syntax into
1717 HTML (see the examples below).
1717 HTML (see the examples below).
1718
1718
1719 Each entry in this section names a substitution filter.
1719 Each entry in this section names a substitution filter.
1720 The value of each entry defines the substitution expression itself.
1720 The value of each entry defines the substitution expression itself.
1721 The websub expressions follow the old interhg extension syntax,
1721 The websub expressions follow the old interhg extension syntax,
1722 which in turn imitates the Unix sed replacement syntax::
1722 which in turn imitates the Unix sed replacement syntax::
1723
1723
1724 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
1724 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
1725
1725
1726 You can use any separator other than "/". The final "i" is optional
1726 You can use any separator other than "/". The final "i" is optional
1727 and indicates that the search must be case insensitive.
1727 and indicates that the search must be case insensitive.
1728
1728
1729 Examples::
1729 Examples::
1730
1730
1731 [websub]
1731 [websub]
1732 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
1732 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
1733 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
1733 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
1734 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
1734 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
1735
1735
1736 ``worker``
1736 ``worker``
1737 ----------
1737 ----------
1738
1738
1739 Parallel master/worker configuration. We currently perform working
1739 Parallel master/worker configuration. We currently perform working
1740 directory updates in parallel on Unix-like systems, which greatly
1740 directory updates in parallel on Unix-like systems, which greatly
1741 helps performance.
1741 helps performance.
1742
1742
1743 ``numcpus``
1743 ``numcpus``
1744 Number of CPUs to use for parallel operations. Default is 4 or the
1744 Number of CPUs to use for parallel operations. Default is 4 or the
1745 number of CPUs on the system, whichever is larger. A zero or
1745 number of CPUs on the system, whichever is larger. A zero or
1746 negative value is treated as ``use the default``.
1746 negative value is treated as ``use the default``.
@@ -1,172 +1,184
1 $ hg init a
1 $ hg init a
2 $ cd a
2 $ cd a
3 $ echo a > a
3 $ echo a > a
4 $ hg add -n
4 $ hg add -n
5 adding a
5 adding a
6 $ hg st
6 $ hg st
7 ? a
7 ? a
8 $ hg add
8 $ hg add
9 adding a
9 adding a
10 $ hg st
10 $ hg st
11 A a
11 A a
12 $ hg forget a
12 $ hg forget a
13 $ hg add
13 $ hg add
14 adding a
14 adding a
15 $ hg st
15 $ hg st
16 A a
16 A a
17
17
18 $ echo b > b
18 $ echo b > b
19 $ hg add -n b
19 $ hg add -n b
20 $ hg st
20 $ hg st
21 A a
21 A a
22 ? b
22 ? b
23 $ hg add b
23 $ hg add b
24 $ hg st
24 $ hg st
25 A a
25 A a
26 A b
26 A b
27
27
28 should fail
28 should fail
29
29
30 $ hg add b
30 $ hg add b
31 b already tracked!
31 b already tracked!
32 $ hg st
32 $ hg st
33 A a
33 A a
34 A b
34 A b
35
35
36 #if no-windows
36 #if no-windows
37 $ echo foo > con.xml
37 $ echo foo > con.xml
38 $ hg --config ui.portablefilenames=jump add con.xml
38 $ hg --config ui.portablefilenames=jump add con.xml
39 abort: ui.portablefilenames value is invalid ('jump')
39 abort: ui.portablefilenames value is invalid ('jump')
40 [255]
40 [255]
41 $ hg --config ui.portablefilenames=abort add con.xml
41 $ hg --config ui.portablefilenames=abort add con.xml
42 abort: filename contains 'con', which is reserved on Windows: 'con.xml'
42 abort: filename contains 'con', which is reserved on Windows: 'con.xml'
43 [255]
43 [255]
44 $ hg st
44 $ hg st
45 A a
45 A a
46 A b
46 A b
47 ? con.xml
47 ? con.xml
48 $ hg add con.xml
48 $ hg add con.xml
49 warning: filename contains 'con', which is reserved on Windows: 'con.xml'
49 warning: filename contains 'con', which is reserved on Windows: 'con.xml'
50 $ hg st
50 $ hg st
51 A a
51 A a
52 A b
52 A b
53 A con.xml
53 A con.xml
54 $ hg forget con.xml
54 $ hg forget con.xml
55 $ rm con.xml
55 $ rm con.xml
56 #endif
56 #endif
57
57
58 #if eol-in-paths
58 #if eol-in-paths
59 $ echo bla > 'hello:world'
59 $ echo bla > 'hello:world'
60 $ hg --config ui.portablefilenames=abort add
60 $ hg --config ui.portablefilenames=abort add
61 adding hello:world
61 adding hello:world
62 abort: filename contains ':', which is reserved on Windows: 'hello:world'
62 abort: filename contains ':', which is reserved on Windows: 'hello:world'
63 [255]
63 [255]
64 $ hg st
64 $ hg st
65 A a
65 A a
66 A b
66 A b
67 ? hello:world
67 ? hello:world
68 $ hg --config ui.portablefilenames=ignore add
68 $ hg --config ui.portablefilenames=ignore add
69 adding hello:world
69 adding hello:world
70 $ hg st
70 $ hg st
71 A a
71 A a
72 A b
72 A b
73 A hello:world
73 A hello:world
74 #endif
74 #endif
75
75
76 $ hg ci -m 0 --traceback
76 $ hg ci -m 0 --traceback
77
77
78 should fail
78 should fail
79
79
80 $ hg add a
80 $ hg add a
81 a already tracked!
81 a already tracked!
82
82
83 $ echo aa > a
83 $ echo aa > a
84 $ hg ci -m 1
84 $ hg ci -m 1
85 $ hg up 0
85 $ hg up 0
86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
87 $ echo aaa > a
87 $ echo aaa > a
88 $ hg ci -m 2
88 $ hg ci -m 2
89 created new head
89 created new head
90
90
91 $ hg merge
91 $ hg merge
92 merging a
92 merging a
93 warning: conflicts during merge.
93 warning: conflicts during merge.
94 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
94 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
95 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
95 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
96 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
96 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
97 [1]
97 [1]
98 $ hg st
98 $ hg st
99 M a
99 M a
100 ? a.orig
100 ? a.orig
101
101
102 should fail
102 should fail
103
103
104 $ hg add a
104 $ hg add a
105 a already tracked!
105 a already tracked!
106 $ hg st
106 $ hg st
107 M a
107 M a
108 ? a.orig
108 ? a.orig
109 $ hg resolve -m a
109 $ hg resolve -m a
110 (no more unresolved files)
110 (no more unresolved files)
111 $ hg ci -m merge
111 $ hg ci -m merge
112
112
113 Issue683: peculiarity with hg revert of an removed then added file
113 Issue683: peculiarity with hg revert of an removed then added file
114
114
115 $ hg forget a
115 $ hg forget a
116 $ hg add a
116 $ hg add a
117 $ hg st
117 $ hg st
118 ? a.orig
118 ? a.orig
119 $ hg rm a
119 $ hg rm a
120 $ hg st
120 $ hg st
121 R a
121 R a
122 ? a.orig
122 ? a.orig
123 $ echo a > a
123 $ echo a > a
124 $ hg add a
124 $ hg add a
125 $ hg st
125 $ hg st
126 M a
126 M a
127 ? a.orig
127 ? a.orig
128
128
129 Forgotten file can be added back (as either clean or modified)
129 Forgotten file can be added back (as either clean or modified)
130
130
131 $ hg forget b
131 $ hg forget b
132 $ hg add b
132 $ hg add b
133 $ hg st -A b
133 $ hg st -A b
134 C b
134 C b
135 $ hg forget b
135 $ hg forget b
136 $ echo modified > b
136 $ echo modified > b
137 $ hg add b
137 $ hg add b
138 $ hg st -A b
138 $ hg st -A b
139 M b
139 M b
140 $ hg revert -qC b
140 $ hg revert -qC b
141
141
142 $ hg add c && echo "unexpected addition of missing file"
142 $ hg add c && echo "unexpected addition of missing file"
143 c: * (glob)
143 c: * (glob)
144 [1]
144 [1]
145 $ echo c > c
145 $ echo c > c
146 $ hg add d c && echo "unexpected addition of missing file"
146 $ hg add d c && echo "unexpected addition of missing file"
147 d: * (glob)
147 d: * (glob)
148 [1]
148 [1]
149 $ hg st
149 $ hg st
150 M a
150 M a
151 A c
151 A c
152 ? a.orig
152 ? a.orig
153 $ hg up -C
153 $ hg up -C
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155
155
156 forget and get should have the right order: added but missing dir should be
156 forget and get should have the right order: added but missing dir should be
157 forgotten before file with same name is added
157 forgotten before file with same name is added
158
158
159 $ echo file d > d
159 $ echo file d > d
160 $ hg add d
160 $ hg add d
161 $ hg ci -md
161 $ hg ci -md
162 $ hg rm d
162 $ hg rm d
163 $ mkdir d
163 $ mkdir d
164 $ echo a > d/a
164 $ echo a > d/a
165 $ hg add d/a
165 $ hg add d/a
166 $ rm -r d
166 $ rm -r d
167 $ hg up -C
167 $ hg up -C
168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
169 $ cat d
169 $ cat d
170 file d
170 file d
171
171
172 Test that adding a directory doesn't require case matching (issue4578)
173 #if icasefs
174 $ mkdir -p CapsDir1/CapsDir
175 $ echo abc > CapsDir1/CapsDir/AbC.txt
176 $ mkdir CapsDir1/CapsDir/SubDir
177 $ echo def > CapsDir1/CapsDir/SubDir/Def.txt
178
179 $ hg add -v capsdir1/capsdir
180 adding CapsDir1/CapsDir/AbC.txt (glob)
181 adding CapsDir1/CapsDir/SubDir/Def.txt (glob)
182 #endif
183
172 $ cd ..
184 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now