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