##// END OF EJS Templates
dispatch: add support for statprof as a profiler...
Bryan O'Sullivan -
r16392:ee3f423d default
parent child Browse files
Show More
@@ -1,741 +1,775 b''
1 # dispatch.py - command dispatching for mercurial
1 # dispatch.py - command dispatching 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 i18n import _
8 from i18n import _
9 import os, sys, atexit, signal, pdb, socket, errno, shlex, time, traceback, re
9 import os, sys, atexit, signal, pdb, socket, errno, shlex, time, traceback, re
10 import util, commands, hg, fancyopts, extensions, hook, error
10 import util, commands, hg, fancyopts, extensions, hook, error
11 import cmdutil, encoding
11 import cmdutil, encoding
12 import ui as uimod
12 import ui as uimod
13
13
14 class request(object):
14 class request(object):
15 def __init__(self, args, ui=None, repo=None, fin=None, fout=None, ferr=None):
15 def __init__(self, args, ui=None, repo=None, fin=None, fout=None, ferr=None):
16 self.args = args
16 self.args = args
17 self.ui = ui
17 self.ui = ui
18 self.repo = repo
18 self.repo = repo
19
19
20 # input/output/error streams
20 # input/output/error streams
21 self.fin = fin
21 self.fin = fin
22 self.fout = fout
22 self.fout = fout
23 self.ferr = ferr
23 self.ferr = ferr
24
24
25 def run():
25 def run():
26 "run the command in sys.argv"
26 "run the command in sys.argv"
27 sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
27 sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
28
28
29 def dispatch(req):
29 def dispatch(req):
30 "run the command specified in req.args"
30 "run the command specified in req.args"
31 if req.ferr:
31 if req.ferr:
32 ferr = req.ferr
32 ferr = req.ferr
33 elif req.ui:
33 elif req.ui:
34 ferr = req.ui.ferr
34 ferr = req.ui.ferr
35 else:
35 else:
36 ferr = sys.stderr
36 ferr = sys.stderr
37
37
38 try:
38 try:
39 if not req.ui:
39 if not req.ui:
40 req.ui = uimod.ui()
40 req.ui = uimod.ui()
41 if '--traceback' in req.args:
41 if '--traceback' in req.args:
42 req.ui.setconfig('ui', 'traceback', 'on')
42 req.ui.setconfig('ui', 'traceback', 'on')
43
43
44 # set ui streams from the request
44 # set ui streams from the request
45 if req.fin:
45 if req.fin:
46 req.ui.fin = req.fin
46 req.ui.fin = req.fin
47 if req.fout:
47 if req.fout:
48 req.ui.fout = req.fout
48 req.ui.fout = req.fout
49 if req.ferr:
49 if req.ferr:
50 req.ui.ferr = req.ferr
50 req.ui.ferr = req.ferr
51 except util.Abort, inst:
51 except util.Abort, inst:
52 ferr.write(_("abort: %s\n") % inst)
52 ferr.write(_("abort: %s\n") % inst)
53 if inst.hint:
53 if inst.hint:
54 ferr.write(_("(%s)\n") % inst.hint)
54 ferr.write(_("(%s)\n") % inst.hint)
55 return -1
55 return -1
56 except error.ParseError, inst:
56 except error.ParseError, inst:
57 if len(inst.args) > 1:
57 if len(inst.args) > 1:
58 ferr.write(_("hg: parse error at %s: %s\n") %
58 ferr.write(_("hg: parse error at %s: %s\n") %
59 (inst.args[1], inst.args[0]))
59 (inst.args[1], inst.args[0]))
60 else:
60 else:
61 ferr.write(_("hg: parse error: %s\n") % inst.args[0])
61 ferr.write(_("hg: parse error: %s\n") % inst.args[0])
62 return -1
62 return -1
63
63
64 return _runcatch(req)
64 return _runcatch(req)
65
65
66 def _runcatch(req):
66 def _runcatch(req):
67 def catchterm(*args):
67 def catchterm(*args):
68 raise error.SignalInterrupt
68 raise error.SignalInterrupt
69
69
70 ui = req.ui
70 ui = req.ui
71 try:
71 try:
72 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM':
72 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM':
73 num = getattr(signal, name, None)
73 num = getattr(signal, name, None)
74 if num:
74 if num:
75 signal.signal(num, catchterm)
75 signal.signal(num, catchterm)
76 except ValueError:
76 except ValueError:
77 pass # happens if called in a thread
77 pass # happens if called in a thread
78
78
79 try:
79 try:
80 try:
80 try:
81 # enter the debugger before command execution
81 # enter the debugger before command execution
82 if '--debugger' in req.args:
82 if '--debugger' in req.args:
83 ui.warn(_("entering debugger - "
83 ui.warn(_("entering debugger - "
84 "type c to continue starting hg or h for help\n"))
84 "type c to continue starting hg or h for help\n"))
85 pdb.set_trace()
85 pdb.set_trace()
86 try:
86 try:
87 return _dispatch(req)
87 return _dispatch(req)
88 finally:
88 finally:
89 ui.flush()
89 ui.flush()
90 except:
90 except:
91 # enter the debugger when we hit an exception
91 # enter the debugger when we hit an exception
92 if '--debugger' in req.args:
92 if '--debugger' in req.args:
93 traceback.print_exc()
93 traceback.print_exc()
94 pdb.post_mortem(sys.exc_info()[2])
94 pdb.post_mortem(sys.exc_info()[2])
95 ui.traceback()
95 ui.traceback()
96 raise
96 raise
97
97
98 # Global exception handling, alphabetically
98 # Global exception handling, alphabetically
99 # Mercurial-specific first, followed by built-in and library exceptions
99 # Mercurial-specific first, followed by built-in and library exceptions
100 except error.AmbiguousCommand, inst:
100 except error.AmbiguousCommand, inst:
101 ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") %
101 ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") %
102 (inst.args[0], " ".join(inst.args[1])))
102 (inst.args[0], " ".join(inst.args[1])))
103 except error.ParseError, inst:
103 except error.ParseError, inst:
104 if len(inst.args) > 1:
104 if len(inst.args) > 1:
105 ui.warn(_("hg: parse error at %s: %s\n") %
105 ui.warn(_("hg: parse error at %s: %s\n") %
106 (inst.args[1], inst.args[0]))
106 (inst.args[1], inst.args[0]))
107 else:
107 else:
108 ui.warn(_("hg: parse error: %s\n") % inst.args[0])
108 ui.warn(_("hg: parse error: %s\n") % inst.args[0])
109 return -1
109 return -1
110 except error.LockHeld, inst:
110 except error.LockHeld, inst:
111 if inst.errno == errno.ETIMEDOUT:
111 if inst.errno == errno.ETIMEDOUT:
112 reason = _('timed out waiting for lock held by %s') % inst.locker
112 reason = _('timed out waiting for lock held by %s') % inst.locker
113 else:
113 else:
114 reason = _('lock held by %s') % inst.locker
114 reason = _('lock held by %s') % inst.locker
115 ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason))
115 ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason))
116 except error.LockUnavailable, inst:
116 except error.LockUnavailable, inst:
117 ui.warn(_("abort: could not lock %s: %s\n") %
117 ui.warn(_("abort: could not lock %s: %s\n") %
118 (inst.desc or inst.filename, inst.strerror))
118 (inst.desc or inst.filename, inst.strerror))
119 except error.CommandError, inst:
119 except error.CommandError, inst:
120 if inst.args[0]:
120 if inst.args[0]:
121 ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))
121 ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))
122 commands.help_(ui, inst.args[0], full=False, command=True)
122 commands.help_(ui, inst.args[0], full=False, command=True)
123 else:
123 else:
124 ui.warn(_("hg: %s\n") % inst.args[1])
124 ui.warn(_("hg: %s\n") % inst.args[1])
125 commands.help_(ui, 'shortlist')
125 commands.help_(ui, 'shortlist')
126 except error.OutOfBandError, inst:
126 except error.OutOfBandError, inst:
127 ui.warn(_("abort: remote error:\n"))
127 ui.warn(_("abort: remote error:\n"))
128 ui.warn(''.join(inst.args))
128 ui.warn(''.join(inst.args))
129 except error.RepoError, inst:
129 except error.RepoError, inst:
130 ui.warn(_("abort: %s!\n") % inst)
130 ui.warn(_("abort: %s!\n") % inst)
131 if inst.hint:
131 if inst.hint:
132 ui.warn(_("(%s)\n") % inst.hint)
132 ui.warn(_("(%s)\n") % inst.hint)
133 except error.ResponseError, inst:
133 except error.ResponseError, inst:
134 ui.warn(_("abort: %s") % inst.args[0])
134 ui.warn(_("abort: %s") % inst.args[0])
135 if not isinstance(inst.args[1], basestring):
135 if not isinstance(inst.args[1], basestring):
136 ui.warn(" %r\n" % (inst.args[1],))
136 ui.warn(" %r\n" % (inst.args[1],))
137 elif not inst.args[1]:
137 elif not inst.args[1]:
138 ui.warn(_(" empty string\n"))
138 ui.warn(_(" empty string\n"))
139 else:
139 else:
140 ui.warn("\n%r\n" % util.ellipsis(inst.args[1]))
140 ui.warn("\n%r\n" % util.ellipsis(inst.args[1]))
141 except error.RevlogError, inst:
141 except error.RevlogError, inst:
142 ui.warn(_("abort: %s!\n") % inst)
142 ui.warn(_("abort: %s!\n") % inst)
143 except error.SignalInterrupt:
143 except error.SignalInterrupt:
144 ui.warn(_("killed!\n"))
144 ui.warn(_("killed!\n"))
145 except error.UnknownCommand, inst:
145 except error.UnknownCommand, inst:
146 ui.warn(_("hg: unknown command '%s'\n") % inst.args[0])
146 ui.warn(_("hg: unknown command '%s'\n") % inst.args[0])
147 try:
147 try:
148 # check if the command is in a disabled extension
148 # check if the command is in a disabled extension
149 # (but don't check for extensions themselves)
149 # (but don't check for extensions themselves)
150 commands.help_(ui, inst.args[0], unknowncmd=True)
150 commands.help_(ui, inst.args[0], unknowncmd=True)
151 except error.UnknownCommand:
151 except error.UnknownCommand:
152 commands.help_(ui, 'shortlist')
152 commands.help_(ui, 'shortlist')
153 except util.Abort, inst:
153 except util.Abort, inst:
154 ui.warn(_("abort: %s\n") % inst)
154 ui.warn(_("abort: %s\n") % inst)
155 if inst.hint:
155 if inst.hint:
156 ui.warn(_("(%s)\n") % inst.hint)
156 ui.warn(_("(%s)\n") % inst.hint)
157 except ImportError, inst:
157 except ImportError, inst:
158 ui.warn(_("abort: %s!\n") % inst)
158 ui.warn(_("abort: %s!\n") % inst)
159 m = str(inst).split()[-1]
159 m = str(inst).split()[-1]
160 if m in "mpatch bdiff".split():
160 if m in "mpatch bdiff".split():
161 ui.warn(_("(did you forget to compile extensions?)\n"))
161 ui.warn(_("(did you forget to compile extensions?)\n"))
162 elif m in "zlib".split():
162 elif m in "zlib".split():
163 ui.warn(_("(is your Python install correct?)\n"))
163 ui.warn(_("(is your Python install correct?)\n"))
164 except IOError, inst:
164 except IOError, inst:
165 if util.safehasattr(inst, "code"):
165 if util.safehasattr(inst, "code"):
166 ui.warn(_("abort: %s\n") % inst)
166 ui.warn(_("abort: %s\n") % inst)
167 elif util.safehasattr(inst, "reason"):
167 elif util.safehasattr(inst, "reason"):
168 try: # usually it is in the form (errno, strerror)
168 try: # usually it is in the form (errno, strerror)
169 reason = inst.reason.args[1]
169 reason = inst.reason.args[1]
170 except (AttributeError, IndexError):
170 except (AttributeError, IndexError):
171 # it might be anything, for example a string
171 # it might be anything, for example a string
172 reason = inst.reason
172 reason = inst.reason
173 ui.warn(_("abort: error: %s\n") % reason)
173 ui.warn(_("abort: error: %s\n") % reason)
174 elif util.safehasattr(inst, "args") and inst.args[0] == errno.EPIPE:
174 elif util.safehasattr(inst, "args") and inst.args[0] == errno.EPIPE:
175 if ui.debugflag:
175 if ui.debugflag:
176 ui.warn(_("broken pipe\n"))
176 ui.warn(_("broken pipe\n"))
177 elif getattr(inst, "strerror", None):
177 elif getattr(inst, "strerror", None):
178 if getattr(inst, "filename", None):
178 if getattr(inst, "filename", None):
179 ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
179 ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
180 else:
180 else:
181 ui.warn(_("abort: %s\n") % inst.strerror)
181 ui.warn(_("abort: %s\n") % inst.strerror)
182 else:
182 else:
183 raise
183 raise
184 except OSError, inst:
184 except OSError, inst:
185 if getattr(inst, "filename", None):
185 if getattr(inst, "filename", None):
186 ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
186 ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
187 else:
187 else:
188 ui.warn(_("abort: %s\n") % inst.strerror)
188 ui.warn(_("abort: %s\n") % inst.strerror)
189 except KeyboardInterrupt:
189 except KeyboardInterrupt:
190 try:
190 try:
191 ui.warn(_("interrupted!\n"))
191 ui.warn(_("interrupted!\n"))
192 except IOError, inst:
192 except IOError, inst:
193 if inst.errno == errno.EPIPE:
193 if inst.errno == errno.EPIPE:
194 if ui.debugflag:
194 if ui.debugflag:
195 ui.warn(_("\nbroken pipe\n"))
195 ui.warn(_("\nbroken pipe\n"))
196 else:
196 else:
197 raise
197 raise
198 except MemoryError:
198 except MemoryError:
199 ui.warn(_("abort: out of memory\n"))
199 ui.warn(_("abort: out of memory\n"))
200 except SystemExit, inst:
200 except SystemExit, inst:
201 # Commands shouldn't sys.exit directly, but give a return code.
201 # Commands shouldn't sys.exit directly, but give a return code.
202 # Just in case catch this and and pass exit code to caller.
202 # Just in case catch this and and pass exit code to caller.
203 return inst.code
203 return inst.code
204 except socket.error, inst:
204 except socket.error, inst:
205 ui.warn(_("abort: %s\n") % inst.args[-1])
205 ui.warn(_("abort: %s\n") % inst.args[-1])
206 except:
206 except:
207 ui.warn(_("** unknown exception encountered,"
207 ui.warn(_("** unknown exception encountered,"
208 " please report by visiting\n"))
208 " please report by visiting\n"))
209 ui.warn(_("** http://mercurial.selenic.com/wiki/BugTracker\n"))
209 ui.warn(_("** http://mercurial.selenic.com/wiki/BugTracker\n"))
210 ui.warn(_("** Python %s\n") % sys.version.replace('\n', ''))
210 ui.warn(_("** Python %s\n") % sys.version.replace('\n', ''))
211 ui.warn(_("** Mercurial Distributed SCM (version %s)\n")
211 ui.warn(_("** Mercurial Distributed SCM (version %s)\n")
212 % util.version())
212 % util.version())
213 ui.warn(_("** Extensions loaded: %s\n")
213 ui.warn(_("** Extensions loaded: %s\n")
214 % ", ".join([x[0] for x in extensions.extensions()]))
214 % ", ".join([x[0] for x in extensions.extensions()]))
215 raise
215 raise
216
216
217 return -1
217 return -1
218
218
219 def aliasargs(fn, givenargs):
219 def aliasargs(fn, givenargs):
220 args = getattr(fn, 'args', [])
220 args = getattr(fn, 'args', [])
221 if args:
221 if args:
222 cmd = ' '.join(map(util.shellquote, args))
222 cmd = ' '.join(map(util.shellquote, args))
223
223
224 nums = []
224 nums = []
225 def replacer(m):
225 def replacer(m):
226 num = int(m.group(1)) - 1
226 num = int(m.group(1)) - 1
227 nums.append(num)
227 nums.append(num)
228 if num < len(givenargs):
228 if num < len(givenargs):
229 return givenargs[num]
229 return givenargs[num]
230 raise util.Abort(_('too few arguments for command alias'))
230 raise util.Abort(_('too few arguments for command alias'))
231 cmd = re.sub(r'\$(\d+|\$)', replacer, cmd)
231 cmd = re.sub(r'\$(\d+|\$)', replacer, cmd)
232 givenargs = [x for i, x in enumerate(givenargs)
232 givenargs = [x for i, x in enumerate(givenargs)
233 if i not in nums]
233 if i not in nums]
234 args = shlex.split(cmd)
234 args = shlex.split(cmd)
235 return args + givenargs
235 return args + givenargs
236
236
237 class cmdalias(object):
237 class cmdalias(object):
238 def __init__(self, name, definition, cmdtable):
238 def __init__(self, name, definition, cmdtable):
239 self.name = self.cmd = name
239 self.name = self.cmd = name
240 self.cmdname = ''
240 self.cmdname = ''
241 self.definition = definition
241 self.definition = definition
242 self.args = []
242 self.args = []
243 self.opts = []
243 self.opts = []
244 self.help = ''
244 self.help = ''
245 self.norepo = True
245 self.norepo = True
246 self.badalias = False
246 self.badalias = False
247
247
248 try:
248 try:
249 aliases, entry = cmdutil.findcmd(self.name, cmdtable)
249 aliases, entry = cmdutil.findcmd(self.name, cmdtable)
250 for alias, e in cmdtable.iteritems():
250 for alias, e in cmdtable.iteritems():
251 if e is entry:
251 if e is entry:
252 self.cmd = alias
252 self.cmd = alias
253 break
253 break
254 self.shadows = True
254 self.shadows = True
255 except error.UnknownCommand:
255 except error.UnknownCommand:
256 self.shadows = False
256 self.shadows = False
257
257
258 if not self.definition:
258 if not self.definition:
259 def fn(ui, *args):
259 def fn(ui, *args):
260 ui.warn(_("no definition for alias '%s'\n") % self.name)
260 ui.warn(_("no definition for alias '%s'\n") % self.name)
261 return 1
261 return 1
262 self.fn = fn
262 self.fn = fn
263 self.badalias = True
263 self.badalias = True
264 return
264 return
265
265
266 if self.definition.startswith('!'):
266 if self.definition.startswith('!'):
267 self.shell = True
267 self.shell = True
268 def fn(ui, *args):
268 def fn(ui, *args):
269 env = {'HG_ARGS': ' '.join((self.name,) + args)}
269 env = {'HG_ARGS': ' '.join((self.name,) + args)}
270 def _checkvar(m):
270 def _checkvar(m):
271 if m.groups()[0] == '$':
271 if m.groups()[0] == '$':
272 return m.group()
272 return m.group()
273 elif int(m.groups()[0]) <= len(args):
273 elif int(m.groups()[0]) <= len(args):
274 return m.group()
274 return m.group()
275 else:
275 else:
276 ui.debug("No argument found for substitution "
276 ui.debug("No argument found for substitution "
277 "of %i variable in alias '%s' definition."
277 "of %i variable in alias '%s' definition."
278 % (int(m.groups()[0]), self.name))
278 % (int(m.groups()[0]), self.name))
279 return ''
279 return ''
280 cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:])
280 cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:])
281 replace = dict((str(i + 1), arg) for i, arg in enumerate(args))
281 replace = dict((str(i + 1), arg) for i, arg in enumerate(args))
282 replace['0'] = self.name
282 replace['0'] = self.name
283 replace['@'] = ' '.join(args)
283 replace['@'] = ' '.join(args)
284 cmd = util.interpolate(r'\$', replace, cmd, escape_prefix=True)
284 cmd = util.interpolate(r'\$', replace, cmd, escape_prefix=True)
285 return util.system(cmd, environ=env, out=ui.fout)
285 return util.system(cmd, environ=env, out=ui.fout)
286 self.fn = fn
286 self.fn = fn
287 return
287 return
288
288
289 args = shlex.split(self.definition)
289 args = shlex.split(self.definition)
290 self.cmdname = cmd = args.pop(0)
290 self.cmdname = cmd = args.pop(0)
291 args = map(util.expandpath, args)
291 args = map(util.expandpath, args)
292
292
293 for invalidarg in ("--cwd", "-R", "--repository", "--repo"):
293 for invalidarg in ("--cwd", "-R", "--repository", "--repo"):
294 if _earlygetopt([invalidarg], args):
294 if _earlygetopt([invalidarg], args):
295 def fn(ui, *args):
295 def fn(ui, *args):
296 ui.warn(_("error in definition for alias '%s': %s may only "
296 ui.warn(_("error in definition for alias '%s': %s may only "
297 "be given on the command line\n")
297 "be given on the command line\n")
298 % (self.name, invalidarg))
298 % (self.name, invalidarg))
299 return 1
299 return 1
300
300
301 self.fn = fn
301 self.fn = fn
302 self.badalias = True
302 self.badalias = True
303 return
303 return
304
304
305 try:
305 try:
306 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
306 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
307 if len(tableentry) > 2:
307 if len(tableentry) > 2:
308 self.fn, self.opts, self.help = tableentry
308 self.fn, self.opts, self.help = tableentry
309 else:
309 else:
310 self.fn, self.opts = tableentry
310 self.fn, self.opts = tableentry
311
311
312 self.args = aliasargs(self.fn, args)
312 self.args = aliasargs(self.fn, args)
313 if cmd not in commands.norepo.split(' '):
313 if cmd not in commands.norepo.split(' '):
314 self.norepo = False
314 self.norepo = False
315 if self.help.startswith("hg " + cmd):
315 if self.help.startswith("hg " + cmd):
316 # drop prefix in old-style help lines so hg shows the alias
316 # drop prefix in old-style help lines so hg shows the alias
317 self.help = self.help[4 + len(cmd):]
317 self.help = self.help[4 + len(cmd):]
318 self.__doc__ = self.fn.__doc__
318 self.__doc__ = self.fn.__doc__
319
319
320 except error.UnknownCommand:
320 except error.UnknownCommand:
321 def fn(ui, *args):
321 def fn(ui, *args):
322 ui.warn(_("alias '%s' resolves to unknown command '%s'\n") \
322 ui.warn(_("alias '%s' resolves to unknown command '%s'\n") \
323 % (self.name, cmd))
323 % (self.name, cmd))
324 try:
324 try:
325 # check if the command is in a disabled extension
325 # check if the command is in a disabled extension
326 commands.help_(ui, cmd, unknowncmd=True)
326 commands.help_(ui, cmd, unknowncmd=True)
327 except error.UnknownCommand:
327 except error.UnknownCommand:
328 pass
328 pass
329 return 1
329 return 1
330 self.fn = fn
330 self.fn = fn
331 self.badalias = True
331 self.badalias = True
332 except error.AmbiguousCommand:
332 except error.AmbiguousCommand:
333 def fn(ui, *args):
333 def fn(ui, *args):
334 ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \
334 ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \
335 % (self.name, cmd))
335 % (self.name, cmd))
336 return 1
336 return 1
337 self.fn = fn
337 self.fn = fn
338 self.badalias = True
338 self.badalias = True
339
339
340 def __call__(self, ui, *args, **opts):
340 def __call__(self, ui, *args, **opts):
341 if self.shadows:
341 if self.shadows:
342 ui.debug("alias '%s' shadows command '%s'\n" %
342 ui.debug("alias '%s' shadows command '%s'\n" %
343 (self.name, self.cmdname))
343 (self.name, self.cmdname))
344
344
345 if util.safehasattr(self, 'shell'):
345 if util.safehasattr(self, 'shell'):
346 return self.fn(ui, *args, **opts)
346 return self.fn(ui, *args, **opts)
347 else:
347 else:
348 try:
348 try:
349 util.checksignature(self.fn)(ui, *args, **opts)
349 util.checksignature(self.fn)(ui, *args, **opts)
350 except error.SignatureError:
350 except error.SignatureError:
351 args = ' '.join([self.cmdname] + self.args)
351 args = ' '.join([self.cmdname] + self.args)
352 ui.debug("alias '%s' expands to '%s'\n" % (self.name, args))
352 ui.debug("alias '%s' expands to '%s'\n" % (self.name, args))
353 raise
353 raise
354
354
355 def addaliases(ui, cmdtable):
355 def addaliases(ui, cmdtable):
356 # aliases are processed after extensions have been loaded, so they
356 # aliases are processed after extensions have been loaded, so they
357 # may use extension commands. Aliases can also use other alias definitions,
357 # may use extension commands. Aliases can also use other alias definitions,
358 # but only if they have been defined prior to the current definition.
358 # but only if they have been defined prior to the current definition.
359 for alias, definition in ui.configitems('alias'):
359 for alias, definition in ui.configitems('alias'):
360 aliasdef = cmdalias(alias, definition, cmdtable)
360 aliasdef = cmdalias(alias, definition, cmdtable)
361
361
362 try:
362 try:
363 olddef = cmdtable[aliasdef.cmd][0]
363 olddef = cmdtable[aliasdef.cmd][0]
364 if olddef.definition == aliasdef.definition:
364 if olddef.definition == aliasdef.definition:
365 continue
365 continue
366 except (KeyError, AttributeError):
366 except (KeyError, AttributeError):
367 # definition might not exist or it might not be a cmdalias
367 # definition might not exist or it might not be a cmdalias
368 pass
368 pass
369
369
370 cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help)
370 cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help)
371 if aliasdef.norepo:
371 if aliasdef.norepo:
372 commands.norepo += ' %s' % alias
372 commands.norepo += ' %s' % alias
373
373
374 def _parse(ui, args):
374 def _parse(ui, args):
375 options = {}
375 options = {}
376 cmdoptions = {}
376 cmdoptions = {}
377
377
378 try:
378 try:
379 args = fancyopts.fancyopts(args, commands.globalopts, options)
379 args = fancyopts.fancyopts(args, commands.globalopts, options)
380 except fancyopts.getopt.GetoptError, inst:
380 except fancyopts.getopt.GetoptError, inst:
381 raise error.CommandError(None, inst)
381 raise error.CommandError(None, inst)
382
382
383 if args:
383 if args:
384 cmd, args = args[0], args[1:]
384 cmd, args = args[0], args[1:]
385 aliases, entry = cmdutil.findcmd(cmd, commands.table,
385 aliases, entry = cmdutil.findcmd(cmd, commands.table,
386 ui.config("ui", "strict"))
386 ui.config("ui", "strict"))
387 cmd = aliases[0]
387 cmd = aliases[0]
388 args = aliasargs(entry[0], args)
388 args = aliasargs(entry[0], args)
389 defaults = ui.config("defaults", cmd)
389 defaults = ui.config("defaults", cmd)
390 if defaults:
390 if defaults:
391 args = map(util.expandpath, shlex.split(defaults)) + args
391 args = map(util.expandpath, shlex.split(defaults)) + args
392 c = list(entry[1])
392 c = list(entry[1])
393 else:
393 else:
394 cmd = None
394 cmd = None
395 c = []
395 c = []
396
396
397 # combine global options into local
397 # combine global options into local
398 for o in commands.globalopts:
398 for o in commands.globalopts:
399 c.append((o[0], o[1], options[o[1]], o[3]))
399 c.append((o[0], o[1], options[o[1]], o[3]))
400
400
401 try:
401 try:
402 args = fancyopts.fancyopts(args, c, cmdoptions, True)
402 args = fancyopts.fancyopts(args, c, cmdoptions, True)
403 except fancyopts.getopt.GetoptError, inst:
403 except fancyopts.getopt.GetoptError, inst:
404 raise error.CommandError(cmd, inst)
404 raise error.CommandError(cmd, inst)
405
405
406 # separate global options back out
406 # separate global options back out
407 for o in commands.globalopts:
407 for o in commands.globalopts:
408 n = o[1]
408 n = o[1]
409 options[n] = cmdoptions[n]
409 options[n] = cmdoptions[n]
410 del cmdoptions[n]
410 del cmdoptions[n]
411
411
412 return (cmd, cmd and entry[0] or None, args, options, cmdoptions)
412 return (cmd, cmd and entry[0] or None, args, options, cmdoptions)
413
413
414 def _parseconfig(ui, config):
414 def _parseconfig(ui, config):
415 """parse the --config options from the command line"""
415 """parse the --config options from the command line"""
416 configs = []
416 configs = []
417
417
418 for cfg in config:
418 for cfg in config:
419 try:
419 try:
420 name, value = cfg.split('=', 1)
420 name, value = cfg.split('=', 1)
421 section, name = name.split('.', 1)
421 section, name = name.split('.', 1)
422 if not section or not name:
422 if not section or not name:
423 raise IndexError
423 raise IndexError
424 ui.setconfig(section, name, value)
424 ui.setconfig(section, name, value)
425 configs.append((section, name, value))
425 configs.append((section, name, value))
426 except (IndexError, ValueError):
426 except (IndexError, ValueError):
427 raise util.Abort(_('malformed --config option: %r '
427 raise util.Abort(_('malformed --config option: %r '
428 '(use --config section.name=value)') % cfg)
428 '(use --config section.name=value)') % cfg)
429
429
430 return configs
430 return configs
431
431
432 def _earlygetopt(aliases, args):
432 def _earlygetopt(aliases, args):
433 """Return list of values for an option (or aliases).
433 """Return list of values for an option (or aliases).
434
434
435 The values are listed in the order they appear in args.
435 The values are listed in the order they appear in args.
436 The options and values are removed from args.
436 The options and values are removed from args.
437 """
437 """
438 try:
438 try:
439 argcount = args.index("--")
439 argcount = args.index("--")
440 except ValueError:
440 except ValueError:
441 argcount = len(args)
441 argcount = len(args)
442 shortopts = [opt for opt in aliases if len(opt) == 2]
442 shortopts = [opt for opt in aliases if len(opt) == 2]
443 values = []
443 values = []
444 pos = 0
444 pos = 0
445 while pos < argcount:
445 while pos < argcount:
446 if args[pos] in aliases:
446 if args[pos] in aliases:
447 if pos + 1 >= argcount:
447 if pos + 1 >= argcount:
448 # ignore and let getopt report an error if there is no value
448 # ignore and let getopt report an error if there is no value
449 break
449 break
450 del args[pos]
450 del args[pos]
451 values.append(args.pop(pos))
451 values.append(args.pop(pos))
452 argcount -= 2
452 argcount -= 2
453 elif args[pos][:2] in shortopts:
453 elif args[pos][:2] in shortopts:
454 # short option can have no following space, e.g. hg log -Rfoo
454 # short option can have no following space, e.g. hg log -Rfoo
455 values.append(args.pop(pos)[2:])
455 values.append(args.pop(pos)[2:])
456 argcount -= 1
456 argcount -= 1
457 else:
457 else:
458 pos += 1
458 pos += 1
459 return values
459 return values
460
460
461 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
461 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
462 # run pre-hook, and abort if it fails
462 # run pre-hook, and abort if it fails
463 ret = hook.hook(lui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs),
463 ret = hook.hook(lui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs),
464 pats=cmdpats, opts=cmdoptions)
464 pats=cmdpats, opts=cmdoptions)
465 if ret:
465 if ret:
466 return ret
466 return ret
467 ret = _runcommand(ui, options, cmd, d)
467 ret = _runcommand(ui, options, cmd, d)
468 # run post-hook, passing command result
468 # run post-hook, passing command result
469 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
469 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
470 result=ret, pats=cmdpats, opts=cmdoptions)
470 result=ret, pats=cmdpats, opts=cmdoptions)
471 return ret
471 return ret
472
472
473 def _getlocal(ui, rpath):
473 def _getlocal(ui, rpath):
474 """Return (path, local ui object) for the given target path.
474 """Return (path, local ui object) for the given target path.
475
475
476 Takes paths in [cwd]/.hg/hgrc into account."
476 Takes paths in [cwd]/.hg/hgrc into account."
477 """
477 """
478 try:
478 try:
479 wd = os.getcwd()
479 wd = os.getcwd()
480 except OSError, e:
480 except OSError, e:
481 raise util.Abort(_("error getting current working directory: %s") %
481 raise util.Abort(_("error getting current working directory: %s") %
482 e.strerror)
482 e.strerror)
483 path = cmdutil.findrepo(wd) or ""
483 path = cmdutil.findrepo(wd) or ""
484 if not path:
484 if not path:
485 lui = ui
485 lui = ui
486 else:
486 else:
487 lui = ui.copy()
487 lui = ui.copy()
488 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
488 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
489
489
490 if rpath and rpath[-1]:
490 if rpath and rpath[-1]:
491 path = lui.expandpath(rpath[-1])
491 path = lui.expandpath(rpath[-1])
492 lui = ui.copy()
492 lui = ui.copy()
493 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
493 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
494
494
495 return path, lui
495 return path, lui
496
496
497 def _checkshellalias(lui, ui, args):
497 def _checkshellalias(lui, ui, args):
498 norepo = commands.norepo
498 norepo = commands.norepo
499 options = {}
499 options = {}
500
500
501 try:
501 try:
502 args = fancyopts.fancyopts(args, commands.globalopts, options)
502 args = fancyopts.fancyopts(args, commands.globalopts, options)
503 except fancyopts.getopt.GetoptError:
503 except fancyopts.getopt.GetoptError:
504 return
504 return
505
505
506 if not args:
506 if not args:
507 return
507 return
508
508
509 cmdtable = commands.table.copy()
509 cmdtable = commands.table.copy()
510 addaliases(lui, cmdtable)
510 addaliases(lui, cmdtable)
511
511
512 cmd = args[0]
512 cmd = args[0]
513 try:
513 try:
514 aliases, entry = cmdutil.findcmd(cmd, cmdtable, lui.config("ui", "strict"))
514 aliases, entry = cmdutil.findcmd(cmd, cmdtable, lui.config("ui", "strict"))
515 except (error.AmbiguousCommand, error.UnknownCommand):
515 except (error.AmbiguousCommand, error.UnknownCommand):
516 commands.norepo = norepo
516 commands.norepo = norepo
517 return
517 return
518
518
519 cmd = aliases[0]
519 cmd = aliases[0]
520 fn = entry[0]
520 fn = entry[0]
521
521
522 if cmd and util.safehasattr(fn, 'shell'):
522 if cmd and util.safehasattr(fn, 'shell'):
523 d = lambda: fn(ui, *args[1:])
523 d = lambda: fn(ui, *args[1:])
524 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {})
524 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {})
525
525
526 commands.norepo = norepo
526 commands.norepo = norepo
527
527
528 _loaded = set()
528 _loaded = set()
529 def _dispatch(req):
529 def _dispatch(req):
530 args = req.args
530 args = req.args
531 ui = req.ui
531 ui = req.ui
532
532
533 # read --config before doing anything else
533 # read --config before doing anything else
534 # (e.g. to change trust settings for reading .hg/hgrc)
534 # (e.g. to change trust settings for reading .hg/hgrc)
535 cfgs = _parseconfig(ui, _earlygetopt(['--config'], args))
535 cfgs = _parseconfig(ui, _earlygetopt(['--config'], args))
536
536
537 # check for cwd
537 # check for cwd
538 cwd = _earlygetopt(['--cwd'], args)
538 cwd = _earlygetopt(['--cwd'], args)
539 if cwd:
539 if cwd:
540 os.chdir(cwd[-1])
540 os.chdir(cwd[-1])
541
541
542 rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
542 rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
543 path, lui = _getlocal(ui, rpath)
543 path, lui = _getlocal(ui, rpath)
544
544
545 # Now that we're operating in the right directory/repository with
545 # Now that we're operating in the right directory/repository with
546 # the right config settings, check for shell aliases
546 # the right config settings, check for shell aliases
547 shellaliasfn = _checkshellalias(lui, ui, args)
547 shellaliasfn = _checkshellalias(lui, ui, args)
548 if shellaliasfn:
548 if shellaliasfn:
549 return shellaliasfn()
549 return shellaliasfn()
550
550
551 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
551 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
552 # reposetup. Programs like TortoiseHg will call _dispatch several
552 # reposetup. Programs like TortoiseHg will call _dispatch several
553 # times so we keep track of configured extensions in _loaded.
553 # times so we keep track of configured extensions in _loaded.
554 extensions.loadall(lui)
554 extensions.loadall(lui)
555 exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded]
555 exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded]
556 # Propagate any changes to lui.__class__ by extensions
556 # Propagate any changes to lui.__class__ by extensions
557 ui.__class__ = lui.__class__
557 ui.__class__ = lui.__class__
558
558
559 # (uisetup and extsetup are handled in extensions.loadall)
559 # (uisetup and extsetup are handled in extensions.loadall)
560
560
561 for name, module in exts:
561 for name, module in exts:
562 cmdtable = getattr(module, 'cmdtable', {})
562 cmdtable = getattr(module, 'cmdtable', {})
563 overrides = [cmd for cmd in cmdtable if cmd in commands.table]
563 overrides = [cmd for cmd in cmdtable if cmd in commands.table]
564 if overrides:
564 if overrides:
565 ui.warn(_("extension '%s' overrides commands: %s\n")
565 ui.warn(_("extension '%s' overrides commands: %s\n")
566 % (name, " ".join(overrides)))
566 % (name, " ".join(overrides)))
567 commands.table.update(cmdtable)
567 commands.table.update(cmdtable)
568 _loaded.add(name)
568 _loaded.add(name)
569
569
570 # (reposetup is handled in hg.repository)
570 # (reposetup is handled in hg.repository)
571
571
572 addaliases(lui, commands.table)
572 addaliases(lui, commands.table)
573
573
574 # check for fallback encoding
574 # check for fallback encoding
575 fallback = lui.config('ui', 'fallbackencoding')
575 fallback = lui.config('ui', 'fallbackencoding')
576 if fallback:
576 if fallback:
577 encoding.fallbackencoding = fallback
577 encoding.fallbackencoding = fallback
578
578
579 fullargs = args
579 fullargs = args
580 cmd, func, args, options, cmdoptions = _parse(lui, args)
580 cmd, func, args, options, cmdoptions = _parse(lui, args)
581
581
582 if options["config"]:
582 if options["config"]:
583 raise util.Abort(_("option --config may not be abbreviated!"))
583 raise util.Abort(_("option --config may not be abbreviated!"))
584 if options["cwd"]:
584 if options["cwd"]:
585 raise util.Abort(_("option --cwd may not be abbreviated!"))
585 raise util.Abort(_("option --cwd may not be abbreviated!"))
586 if options["repository"]:
586 if options["repository"]:
587 raise util.Abort(_(
587 raise util.Abort(_(
588 "option -R has to be separated from other options (e.g. not -qR) "
588 "option -R has to be separated from other options (e.g. not -qR) "
589 "and --repository may only be abbreviated as --repo!"))
589 "and --repository may only be abbreviated as --repo!"))
590
590
591 if options["encoding"]:
591 if options["encoding"]:
592 encoding.encoding = options["encoding"]
592 encoding.encoding = options["encoding"]
593 if options["encodingmode"]:
593 if options["encodingmode"]:
594 encoding.encodingmode = options["encodingmode"]
594 encoding.encodingmode = options["encodingmode"]
595 if options["time"]:
595 if options["time"]:
596 def get_times():
596 def get_times():
597 t = os.times()
597 t = os.times()
598 if t[4] == 0.0: # Windows leaves this as zero, so use time.clock()
598 if t[4] == 0.0: # Windows leaves this as zero, so use time.clock()
599 t = (t[0], t[1], t[2], t[3], time.clock())
599 t = (t[0], t[1], t[2], t[3], time.clock())
600 return t
600 return t
601 s = get_times()
601 s = get_times()
602 def print_time():
602 def print_time():
603 t = get_times()
603 t = get_times()
604 ui.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
604 ui.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
605 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
605 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
606 atexit.register(print_time)
606 atexit.register(print_time)
607
607
608 uis = set([ui, lui])
608 uis = set([ui, lui])
609
609
610 if req.repo:
610 if req.repo:
611 uis.add(req.repo.ui)
611 uis.add(req.repo.ui)
612
612
613 # copy configs that were passed on the cmdline (--config) to the repo ui
613 # copy configs that were passed on the cmdline (--config) to the repo ui
614 for cfg in cfgs:
614 for cfg in cfgs:
615 req.repo.ui.setconfig(*cfg)
615 req.repo.ui.setconfig(*cfg)
616
616
617 if options['verbose'] or options['debug'] or options['quiet']:
617 if options['verbose'] or options['debug'] or options['quiet']:
618 for opt in ('verbose', 'debug', 'quiet'):
618 for opt in ('verbose', 'debug', 'quiet'):
619 val = str(bool(options[opt]))
619 val = str(bool(options[opt]))
620 for ui_ in uis:
620 for ui_ in uis:
621 ui_.setconfig('ui', opt, val)
621 ui_.setconfig('ui', opt, val)
622
622
623 if options['traceback']:
623 if options['traceback']:
624 for ui_ in uis:
624 for ui_ in uis:
625 ui_.setconfig('ui', 'traceback', 'on')
625 ui_.setconfig('ui', 'traceback', 'on')
626
626
627 if options['noninteractive']:
627 if options['noninteractive']:
628 for ui_ in uis:
628 for ui_ in uis:
629 ui_.setconfig('ui', 'interactive', 'off')
629 ui_.setconfig('ui', 'interactive', 'off')
630
630
631 if cmdoptions.get('insecure', False):
631 if cmdoptions.get('insecure', False):
632 for ui_ in uis:
632 for ui_ in uis:
633 ui_.setconfig('web', 'cacerts', '')
633 ui_.setconfig('web', 'cacerts', '')
634
634
635 if options['version']:
635 if options['version']:
636 return commands.version_(ui)
636 return commands.version_(ui)
637 if options['help']:
637 if options['help']:
638 return commands.help_(ui, cmd)
638 return commands.help_(ui, cmd)
639 elif not cmd:
639 elif not cmd:
640 return commands.help_(ui, 'shortlist')
640 return commands.help_(ui, 'shortlist')
641
641
642 repo = None
642 repo = None
643 cmdpats = args[:]
643 cmdpats = args[:]
644 if cmd not in commands.norepo.split():
644 if cmd not in commands.norepo.split():
645 # use the repo from the request only if we don't have -R
645 # use the repo from the request only if we don't have -R
646 if not rpath and not cwd:
646 if not rpath and not cwd:
647 repo = req.repo
647 repo = req.repo
648
648
649 if repo:
649 if repo:
650 # set the descriptors of the repo ui to those of ui
650 # set the descriptors of the repo ui to those of ui
651 repo.ui.fin = ui.fin
651 repo.ui.fin = ui.fin
652 repo.ui.fout = ui.fout
652 repo.ui.fout = ui.fout
653 repo.ui.ferr = ui.ferr
653 repo.ui.ferr = ui.ferr
654 else:
654 else:
655 try:
655 try:
656 repo = hg.repository(ui, path=path)
656 repo = hg.repository(ui, path=path)
657 if not repo.local():
657 if not repo.local():
658 raise util.Abort(_("repository '%s' is not local") % path)
658 raise util.Abort(_("repository '%s' is not local") % path)
659 repo.ui.setconfig("bundle", "mainreporoot", repo.root)
659 repo.ui.setconfig("bundle", "mainreporoot", repo.root)
660 except error.RequirementError:
660 except error.RequirementError:
661 raise
661 raise
662 except error.RepoError:
662 except error.RepoError:
663 if cmd not in commands.optionalrepo.split():
663 if cmd not in commands.optionalrepo.split():
664 if args and not path: # try to infer -R from command args
664 if args and not path: # try to infer -R from command args
665 repos = map(cmdutil.findrepo, args)
665 repos = map(cmdutil.findrepo, args)
666 guess = repos[0]
666 guess = repos[0]
667 if guess and repos.count(guess) == len(repos):
667 if guess and repos.count(guess) == len(repos):
668 req.args = ['--repository', guess] + fullargs
668 req.args = ['--repository', guess] + fullargs
669 return _dispatch(req)
669 return _dispatch(req)
670 if not path:
670 if not path:
671 raise error.RepoError(_("no repository found in '%s'"
671 raise error.RepoError(_("no repository found in '%s'"
672 " (.hg not found)") % os.getcwd())
672 " (.hg not found)") % os.getcwd())
673 raise
673 raise
674 if repo:
674 if repo:
675 ui = repo.ui
675 ui = repo.ui
676 args.insert(0, repo)
676 args.insert(0, repo)
677 elif rpath:
677 elif rpath:
678 ui.warn(_("warning: --repository ignored\n"))
678 ui.warn(_("warning: --repository ignored\n"))
679
679
680 msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
680 msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
681 ui.log("command", msg + "\n")
681 ui.log("command", msg + "\n")
682 d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
682 d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
683 try:
683 try:
684 return runcommand(lui, repo, cmd, fullargs, ui, options, d,
684 return runcommand(lui, repo, cmd, fullargs, ui, options, d,
685 cmdpats, cmdoptions)
685 cmdpats, cmdoptions)
686 finally:
686 finally:
687 if repo and repo != req.repo:
687 if repo and repo != req.repo:
688 repo.close()
688 repo.close()
689
689
690 def _runcommand(ui, options, cmd, cmdfunc):
690 def lsprofile(ui, func, fp):
691 def checkargs():
692 try:
693 return cmdfunc()
694 except error.SignatureError:
695 raise error.CommandError(cmd, _("invalid arguments"))
696
697 if options['profile']:
698 format = ui.config('profiling', 'format', default='text')
691 format = ui.config('profiling', 'format', default='text')
699 field = ui.config('profiling', 'sort', default='inlinetime')
692 field = ui.config('profiling', 'sort', default='inlinetime')
700 climit = ui.configint('profiling', 'nested', default=5)
693 climit = ui.configint('profiling', 'nested', default=5)
701
694
702 if not format in ['text', 'kcachegrind']:
695 if not format in ['text', 'kcachegrind']:
703 ui.warn(_("unrecognized profiling format '%s'"
696 ui.warn(_("unrecognized profiling format '%s'"
704 " - Ignored\n") % format)
697 " - Ignored\n") % format)
705 format = 'text'
698 format = 'text'
706
699
707 output = ui.config('profiling', 'output')
708
709 if output:
710 path = ui.expandpath(output)
711 ostream = open(path, 'wb')
712 else:
713 ostream = sys.stderr
714
715 try:
700 try:
716 from mercurial import lsprof
701 from mercurial import lsprof
717 except ImportError:
702 except ImportError:
718 raise util.Abort(_(
703 raise util.Abort(_(
719 'lsprof not available - install from '
704 'lsprof not available - install from '
720 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))
705 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))
721 p = lsprof.Profiler()
706 p = lsprof.Profiler()
722 p.enable(subcalls=True)
707 p.enable(subcalls=True)
723 try:
708 try:
724 return checkargs()
709 return func()
725 finally:
710 finally:
726 p.disable()
711 p.disable()
727
712
728 if format == 'kcachegrind':
713 if format == 'kcachegrind':
729 import lsprofcalltree
714 import lsprofcalltree
730 calltree = lsprofcalltree.KCacheGrind(p)
715 calltree = lsprofcalltree.KCacheGrind(p)
731 calltree.output(ostream)
716 calltree.output(fp)
732 else:
717 else:
733 # format == 'text'
718 # format == 'text'
734 stats = lsprof.Stats(p.getstats())
719 stats = lsprof.Stats(p.getstats())
735 stats.sort(field)
720 stats.sort(field)
736 stats.pprint(limit=30, file=ostream, climit=climit)
721 stats.pprint(limit=30, file=fp, climit=climit)
722
723 def statprofile(ui, func, fp):
724 try:
725 import statprof
726 except ImportError:
727 raise util.Abort(_(
728 'statprof not available - install using "easy_install statprof"'))
729
730 freq = ui.configint('profiling', 'freq', default=1000)
731 if freq > 0:
732 statprof.reset(freq)
733 else:
734 ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq)
735
736 statprof.start()
737 try:
738 return func()
739 finally:
740 statprof.stop()
741 statprof.display(fp)
742
743 def _runcommand(ui, options, cmd, cmdfunc):
744 def checkargs():
745 try:
746 return cmdfunc()
747 except error.SignatureError:
748 raise error.CommandError(cmd, _("invalid arguments"))
749
750 if options['profile']:
751 profiler = os.getenv('HGPROF')
752 if profiler is None:
753 profiler = ui.config('profiling', 'type', default='ls')
754 if profiler not in ('ls', 'stat'):
755 ui.warn(_("unrecognized profiler '%s' - ignored\n") % profiler)
756 profiler = 'ls'
757
758 output = ui.config('profiling', 'output')
737
759
738 if output:
760 if output:
739 ostream.close()
761 path = ui.expandpath(output)
762 fp = open(path, 'wb')
763 else:
764 fp = sys.stderr
765
766 try:
767 if profiler == 'ls':
768 return lsprofile(ui, checkargs, fp)
769 else:
770 return statprofile(ui, checkargs, fp)
771 finally:
772 if output:
773 fp.close()
740 else:
774 else:
741 return checkargs()
775 return checkargs()
@@ -1,1392 +1,1413 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 | (All) ``<repo>/.hg/hgrc``
31 | (All) ``<repo>/.hg/hgrc``
32
32
33 Per-repository configuration options that only apply in a
33 Per-repository configuration options that only apply in a
34 particular repository. This file is not version-controlled, and
34 particular repository. This file is not version-controlled, and
35 will not get transferred during a "clone" operation. Options in
35 will not get transferred during a "clone" operation. Options in
36 this file override options in all other configuration files. On
36 this file override options in all other configuration files. On
37 Plan 9 and Unix, most of this file will be ignored if it doesn't
37 Plan 9 and Unix, most of this file will be ignored if it doesn't
38 belong to a trusted user or to a trusted group. See the documentation
38 belong to a trusted user or to a trusted group. See the documentation
39 for the ``[trusted]`` section below for more details.
39 for the ``[trusted]`` section below for more details.
40
40
41 | (Plan 9) ``$home/lib/hgrc``
41 | (Plan 9) ``$home/lib/hgrc``
42 | (Unix) ``$HOME/.hgrc``
42 | (Unix) ``$HOME/.hgrc``
43 | (Windows) ``%USERPROFILE%\.hgrc``
43 | (Windows) ``%USERPROFILE%\.hgrc``
44 | (Windows) ``%USERPROFILE%\Mercurial.ini``
44 | (Windows) ``%USERPROFILE%\Mercurial.ini``
45 | (Windows) ``%HOME%\.hgrc``
45 | (Windows) ``%HOME%\.hgrc``
46 | (Windows) ``%HOME%\Mercurial.ini``
46 | (Windows) ``%HOME%\Mercurial.ini``
47
47
48 Per-user configuration file(s), for the user running Mercurial. On
48 Per-user configuration file(s), for the user running Mercurial. On
49 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
49 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
50 files apply to all Mercurial commands executed by this user in any
50 files apply to all Mercurial commands executed by this user in any
51 directory. Options in these files override per-system and per-installation
51 directory. Options in these files override per-system and per-installation
52 options.
52 options.
53
53
54 | (Plan 9) ``/lib/mercurial/hgrc``
54 | (Plan 9) ``/lib/mercurial/hgrc``
55 | (Plan 9) ``/lib/mercurial/hgrc.d/*.rc``
55 | (Plan 9) ``/lib/mercurial/hgrc.d/*.rc``
56 | (Unix) ``/etc/mercurial/hgrc``
56 | (Unix) ``/etc/mercurial/hgrc``
57 | (Unix) ``/etc/mercurial/hgrc.d/*.rc``
57 | (Unix) ``/etc/mercurial/hgrc.d/*.rc``
58
58
59 Per-system configuration files, for the system on which Mercurial
59 Per-system configuration files, for the system on which Mercurial
60 is running. Options in these files apply to all Mercurial commands
60 is running. Options in these files apply to all Mercurial commands
61 executed by any user in any directory. Options in these files
61 executed by any user in any directory. Options in these files
62 override per-installation options.
62 override per-installation options.
63
63
64 | (Plan 9) ``<install-root>/lib/mercurial/hgrc``
64 | (Plan 9) ``<install-root>/lib/mercurial/hgrc``
65 | (Plan 9) ``<install-root>/lib/mercurial/hgrc.d/*.rc``
65 | (Plan 9) ``<install-root>/lib/mercurial/hgrc.d/*.rc``
66 | (Unix) ``<install-root>/etc/mercurial/hgrc``
66 | (Unix) ``<install-root>/etc/mercurial/hgrc``
67 | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc``
67 | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc``
68
68
69 Per-installation configuration files, searched for in the
69 Per-installation configuration files, searched for in the
70 directory where Mercurial is installed. ``<install-root>`` is the
70 directory where Mercurial is installed. ``<install-root>`` is the
71 parent directory of the **hg** executable (or symlink) being run. For
71 parent directory of the **hg** executable (or symlink) being run. For
72 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
72 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
73 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
73 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
74 to all Mercurial commands executed by any user in any directory.
74 to all Mercurial commands executed by any user in any directory.
75
75
76 | (Windows) ``<install-dir>\Mercurial.ini`` **or**
76 | (Windows) ``<install-dir>\Mercurial.ini`` **or**
77 | (Windows) ``<install-dir>\hgrc.d\*.rc`` **or**
77 | (Windows) ``<install-dir>\hgrc.d\*.rc`` **or**
78 | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial``
78 | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial``
79
79
80 Per-installation/system configuration files, for the system on
80 Per-installation/system configuration files, for the system on
81 which Mercurial is running. Options in these files apply to all
81 which Mercurial is running. Options in these files apply to all
82 Mercurial commands executed by any user in any directory. Registry
82 Mercurial commands executed by any user in any directory. Registry
83 keys contain PATH-like strings, every part of which must reference
83 keys contain PATH-like strings, every part of which must reference
84 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
84 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
85 be read. Mercurial checks each of these locations in the specified
85 be read. Mercurial checks each of these locations in the specified
86 order until one or more configuration files are detected. If the
86 order until one or more configuration files are detected. If the
87 pywin32 extensions are not installed, Mercurial will only look for
87 pywin32 extensions are not installed, Mercurial will only look for
88 site-wide configuration in ``C:\Mercurial\Mercurial.ini``.
88 site-wide configuration in ``C:\Mercurial\Mercurial.ini``.
89
89
90 Syntax
90 Syntax
91 ------
91 ------
92
92
93 A configuration file consists of sections, led by a ``[section]`` header
93 A configuration file consists of sections, led by a ``[section]`` header
94 and followed by ``name = value`` entries (sometimes called
94 and followed by ``name = value`` entries (sometimes called
95 ``configuration keys``)::
95 ``configuration keys``)::
96
96
97 [spam]
97 [spam]
98 eggs=ham
98 eggs=ham
99 green=
99 green=
100 eggs
100 eggs
101
101
102 Each line contains one entry. If the lines that follow are indented,
102 Each line contains one entry. If the lines that follow are indented,
103 they are treated as continuations of that entry. Leading whitespace is
103 they are treated as continuations of that entry. Leading whitespace is
104 removed from values. Empty lines are skipped. Lines beginning with
104 removed from values. Empty lines are skipped. Lines beginning with
105 ``#`` or ``;`` are ignored and may be used to provide comments.
105 ``#`` or ``;`` are ignored and may be used to provide comments.
106
106
107 Configuration keys can be set multiple times, in which case Mercurial
107 Configuration keys can be set multiple times, in which case Mercurial
108 will use the value that was configured last. As an example::
108 will use the value that was configured last. As an example::
109
109
110 [spam]
110 [spam]
111 eggs=large
111 eggs=large
112 ham=serrano
112 ham=serrano
113 eggs=small
113 eggs=small
114
114
115 This would set the configuration key named ``eggs`` to ``small``.
115 This would set the configuration key named ``eggs`` to ``small``.
116
116
117 It is also possible to define a section multiple times. A section can
117 It is also possible to define a section multiple times. A section can
118 be redefined on the same and/or on different configuration files. For
118 be redefined on the same and/or on different configuration files. For
119 example::
119 example::
120
120
121 [foo]
121 [foo]
122 eggs=large
122 eggs=large
123 ham=serrano
123 ham=serrano
124 eggs=small
124 eggs=small
125
125
126 [bar]
126 [bar]
127 eggs=ham
127 eggs=ham
128 green=
128 green=
129 eggs
129 eggs
130
130
131 [foo]
131 [foo]
132 ham=prosciutto
132 ham=prosciutto
133 eggs=medium
133 eggs=medium
134 bread=toasted
134 bread=toasted
135
135
136 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
136 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
137 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
137 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
138 respectively. As you can see there only thing that matters is the last
138 respectively. As you can see there only thing that matters is the last
139 value that was set for each of the configuration keys.
139 value that was set for each of the configuration keys.
140
140
141 If a configuration key is set multiple times in different
141 If a configuration key is set multiple times in different
142 configuration files the final value will depend on the order in which
142 configuration files the final value will depend on the order in which
143 the different configuration files are read, with settings from earlier
143 the different configuration files are read, with settings from earlier
144 paths overriding later ones as described on the ``Files`` section
144 paths overriding later ones as described on the ``Files`` section
145 above.
145 above.
146
146
147 A line of the form ``%include file`` will include ``file`` into the
147 A line of the form ``%include file`` will include ``file`` into the
148 current configuration file. The inclusion is recursive, which means
148 current configuration file. The inclusion is recursive, which means
149 that included files can include other files. Filenames are relative to
149 that included files can include other files. Filenames are relative to
150 the configuration file in which the ``%include`` directive is found.
150 the configuration file in which the ``%include`` directive is found.
151 Environment variables and ``~user`` constructs are expanded in
151 Environment variables and ``~user`` constructs are expanded in
152 ``file``. This lets you do something like::
152 ``file``. This lets you do something like::
153
153
154 %include ~/.hgrc.d/$HOST.rc
154 %include ~/.hgrc.d/$HOST.rc
155
155
156 to include a different configuration file on each computer you use.
156 to include a different configuration file on each computer you use.
157
157
158 A line with ``%unset name`` will remove ``name`` from the current
158 A line with ``%unset name`` will remove ``name`` from the current
159 section, if it has been set previously.
159 section, if it has been set previously.
160
160
161 The values are either free-form text strings, lists of text strings,
161 The values are either free-form text strings, lists of text strings,
162 or Boolean values. Boolean values can be set to true using any of "1",
162 or Boolean values. Boolean values can be set to true using any of "1",
163 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
163 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
164 (all case insensitive).
164 (all case insensitive).
165
165
166 List values are separated by whitespace or comma, except when values are
166 List values are separated by whitespace or comma, except when values are
167 placed in double quotation marks::
167 placed in double quotation marks::
168
168
169 allow_read = "John Doe, PhD", brian, betty
169 allow_read = "John Doe, PhD", brian, betty
170
170
171 Quotation marks can be escaped by prefixing them with a backslash. Only
171 Quotation marks can be escaped by prefixing them with a backslash. Only
172 quotation marks at the beginning of a word is counted as a quotation
172 quotation marks at the beginning of a word is counted as a quotation
173 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
173 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
174
174
175 Sections
175 Sections
176 --------
176 --------
177
177
178 This section describes the different sections that may appear in a
178 This section describes the different sections that may appear in a
179 Mercurial configuration file, the purpose of each section, its possible
179 Mercurial configuration file, the purpose of each section, its possible
180 keys, and their possible values.
180 keys, and their possible values.
181
181
182 ``alias``
182 ``alias``
183 """""""""
183 """""""""
184
184
185 Defines command aliases.
185 Defines command aliases.
186 Aliases allow you to define your own commands in terms of other
186 Aliases allow you to define your own commands in terms of other
187 commands (or aliases), optionally including arguments. Positional
187 commands (or aliases), optionally including arguments. Positional
188 arguments in the form of ``$1``, ``$2``, etc in the alias definition
188 arguments in the form of ``$1``, ``$2``, etc in the alias definition
189 are expanded by Mercurial before execution. Positional arguments not
189 are expanded by Mercurial before execution. Positional arguments not
190 already used by ``$N`` in the definition are put at the end of the
190 already used by ``$N`` in the definition are put at the end of the
191 command to be executed.
191 command to be executed.
192
192
193 Alias definitions consist of lines of the form::
193 Alias definitions consist of lines of the form::
194
194
195 <alias> = <command> [<argument>]...
195 <alias> = <command> [<argument>]...
196
196
197 For example, this definition::
197 For example, this definition::
198
198
199 latest = log --limit 5
199 latest = log --limit 5
200
200
201 creates a new command ``latest`` that shows only the five most recent
201 creates a new command ``latest`` that shows only the five most recent
202 changesets. You can define subsequent aliases using earlier ones::
202 changesets. You can define subsequent aliases using earlier ones::
203
203
204 stable5 = latest -b stable
204 stable5 = latest -b stable
205
205
206 .. note:: It is possible to create aliases with the same names as
206 .. note:: It is possible to create aliases with the same names as
207 existing commands, which will then override the original
207 existing commands, which will then override the original
208 definitions. This is almost always a bad idea!
208 definitions. This is almost always a bad idea!
209
209
210 An alias can start with an exclamation point (``!``) to make it a
210 An alias can start with an exclamation point (``!``) to make it a
211 shell alias. A shell alias is executed with the shell and will let you
211 shell alias. A shell alias is executed with the shell and will let you
212 run arbitrary commands. As an example, ::
212 run arbitrary commands. As an example, ::
213
213
214 echo = !echo
214 echo = !echo
215
215
216 will let you do ``hg echo foo`` to have ``foo`` printed in your
216 will let you do ``hg echo foo`` to have ``foo`` printed in your
217 terminal. A better example might be::
217 terminal. A better example might be::
218
218
219 purge = !$HG status --no-status --unknown -0 | xargs -0 rm
219 purge = !$HG status --no-status --unknown -0 | xargs -0 rm
220
220
221 which will make ``hg purge`` delete all unknown files in the
221 which will make ``hg purge`` delete all unknown files in the
222 repository in the same manner as the purge extension.
222 repository in the same manner as the purge extension.
223
223
224 Shell aliases are executed in an environment where ``$HG`` expand to
224 Shell aliases are executed in an environment where ``$HG`` expand to
225 the path of the Mercurial that was used to execute the alias. This is
225 the path of the Mercurial that was used to execute the alias. This is
226 useful when you want to call further Mercurial commands in a shell
226 useful when you want to call further Mercurial commands in a shell
227 alias, as was done above for the purge alias. In addition,
227 alias, as was done above for the purge alias. In addition,
228 ``$HG_ARGS`` expand to the arguments given to Mercurial. In the ``hg
228 ``$HG_ARGS`` expand to the arguments given to Mercurial. In the ``hg
229 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
229 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
230
230
231 .. note:: Some global configuration options such as ``-R`` are
231 .. note:: Some global configuration options such as ``-R`` are
232 processed before shell aliases and will thus not be passed to
232 processed before shell aliases and will thus not be passed to
233 aliases.
233 aliases.
234
234
235
235
236 ``annotate``
236 ``annotate``
237 """"""""""""
237 """"""""""""
238
238
239 Settings used when displaying file annotations. All values are
239 Settings used when displaying file annotations. All values are
240 Booleans and default to False. See ``diff`` section for related
240 Booleans and default to False. See ``diff`` section for related
241 options for the diff command.
241 options for the diff command.
242
242
243 ``ignorews``
243 ``ignorews``
244 Ignore white space when comparing lines.
244 Ignore white space when comparing lines.
245
245
246 ``ignorewsamount``
246 ``ignorewsamount``
247 Ignore changes in the amount of white space.
247 Ignore changes in the amount of white space.
248
248
249 ``ignoreblanklines``
249 ``ignoreblanklines``
250 Ignore changes whose lines are all blank.
250 Ignore changes whose lines are all blank.
251
251
252
252
253 ``auth``
253 ``auth``
254 """"""""
254 """"""""
255
255
256 Authentication credentials for HTTP authentication. This section
256 Authentication credentials for HTTP authentication. This section
257 allows you to store usernames and passwords for use when logging
257 allows you to store usernames and passwords for use when logging
258 *into* HTTP servers. See the ``[web]`` configuration section if
258 *into* HTTP servers. See the ``[web]`` configuration section if
259 you want to configure *who* can login to your HTTP server.
259 you want to configure *who* can login to your HTTP server.
260
260
261 Each line has the following format::
261 Each line has the following format::
262
262
263 <name>.<argument> = <value>
263 <name>.<argument> = <value>
264
264
265 where ``<name>`` is used to group arguments into authentication
265 where ``<name>`` is used to group arguments into authentication
266 entries. Example::
266 entries. Example::
267
267
268 foo.prefix = hg.intevation.org/mercurial
268 foo.prefix = hg.intevation.org/mercurial
269 foo.username = foo
269 foo.username = foo
270 foo.password = bar
270 foo.password = bar
271 foo.schemes = http https
271 foo.schemes = http https
272
272
273 bar.prefix = secure.example.org
273 bar.prefix = secure.example.org
274 bar.key = path/to/file.key
274 bar.key = path/to/file.key
275 bar.cert = path/to/file.cert
275 bar.cert = path/to/file.cert
276 bar.schemes = https
276 bar.schemes = https
277
277
278 Supported arguments:
278 Supported arguments:
279
279
280 ``prefix``
280 ``prefix``
281 Either ``*`` or a URI prefix with or without the scheme part.
281 Either ``*`` or a URI prefix with or without the scheme part.
282 The authentication entry with the longest matching prefix is used
282 The authentication entry with the longest matching prefix is used
283 (where ``*`` matches everything and counts as a match of length
283 (where ``*`` matches everything and counts as a match of length
284 1). If the prefix doesn't include a scheme, the match is performed
284 1). If the prefix doesn't include a scheme, the match is performed
285 against the URI with its scheme stripped as well, and the schemes
285 against the URI with its scheme stripped as well, and the schemes
286 argument, q.v., is then subsequently consulted.
286 argument, q.v., is then subsequently consulted.
287
287
288 ``username``
288 ``username``
289 Optional. Username to authenticate with. If not given, and the
289 Optional. Username to authenticate with. If not given, and the
290 remote site requires basic or digest authentication, the user will
290 remote site requires basic or digest authentication, the user will
291 be prompted for it. Environment variables are expanded in the
291 be prompted for it. Environment variables are expanded in the
292 username letting you do ``foo.username = $USER``. If the URI
292 username letting you do ``foo.username = $USER``. If the URI
293 includes a username, only ``[auth]`` entries with a matching
293 includes a username, only ``[auth]`` entries with a matching
294 username or without a username will be considered.
294 username or without a username will be considered.
295
295
296 ``password``
296 ``password``
297 Optional. Password to authenticate with. If not given, and the
297 Optional. Password to authenticate with. If not given, and the
298 remote site requires basic or digest authentication, the user
298 remote site requires basic or digest authentication, the user
299 will be prompted for it.
299 will be prompted for it.
300
300
301 ``key``
301 ``key``
302 Optional. PEM encoded client certificate key file. Environment
302 Optional. PEM encoded client certificate key file. Environment
303 variables are expanded in the filename.
303 variables are expanded in the filename.
304
304
305 ``cert``
305 ``cert``
306 Optional. PEM encoded client certificate chain file. Environment
306 Optional. PEM encoded client certificate chain file. Environment
307 variables are expanded in the filename.
307 variables are expanded in the filename.
308
308
309 ``schemes``
309 ``schemes``
310 Optional. Space separated list of URI schemes to use this
310 Optional. Space separated list of URI schemes to use this
311 authentication entry with. Only used if the prefix doesn't include
311 authentication entry with. Only used if the prefix doesn't include
312 a scheme. Supported schemes are http and https. They will match
312 a scheme. Supported schemes are http and https. They will match
313 static-http and static-https respectively, as well.
313 static-http and static-https respectively, as well.
314 Default: https.
314 Default: https.
315
315
316 If no suitable authentication entry is found, the user is prompted
316 If no suitable authentication entry is found, the user is prompted
317 for credentials as usual if required by the remote.
317 for credentials as usual if required by the remote.
318
318
319
319
320 ``decode/encode``
320 ``decode/encode``
321 """""""""""""""""
321 """""""""""""""""
322
322
323 Filters for transforming files on checkout/checkin. This would
323 Filters for transforming files on checkout/checkin. This would
324 typically be used for newline processing or other
324 typically be used for newline processing or other
325 localization/canonicalization of files.
325 localization/canonicalization of files.
326
326
327 Filters consist of a filter pattern followed by a filter command.
327 Filters consist of a filter pattern followed by a filter command.
328 Filter patterns are globs by default, rooted at the repository root.
328 Filter patterns are globs by default, rooted at the repository root.
329 For example, to match any file ending in ``.txt`` in the root
329 For example, to match any file ending in ``.txt`` in the root
330 directory only, use the pattern ``*.txt``. To match any file ending
330 directory only, use the pattern ``*.txt``. To match any file ending
331 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
331 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
332 For each file only the first matching filter applies.
332 For each file only the first matching filter applies.
333
333
334 The filter command can start with a specifier, either ``pipe:`` or
334 The filter command can start with a specifier, either ``pipe:`` or
335 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
335 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
336
336
337 A ``pipe:`` command must accept data on stdin and return the transformed
337 A ``pipe:`` command must accept data on stdin and return the transformed
338 data on stdout.
338 data on stdout.
339
339
340 Pipe example::
340 Pipe example::
341
341
342 [encode]
342 [encode]
343 # uncompress gzip files on checkin to improve delta compression
343 # uncompress gzip files on checkin to improve delta compression
344 # note: not necessarily a good idea, just an example
344 # note: not necessarily a good idea, just an example
345 *.gz = pipe: gunzip
345 *.gz = pipe: gunzip
346
346
347 [decode]
347 [decode]
348 # recompress gzip files when writing them to the working dir (we
348 # recompress gzip files when writing them to the working dir (we
349 # can safely omit "pipe:", because it's the default)
349 # can safely omit "pipe:", because it's the default)
350 *.gz = gzip
350 *.gz = gzip
351
351
352 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
352 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
353 with the name of a temporary file that contains the data to be
353 with the name of a temporary file that contains the data to be
354 filtered by the command. The string ``OUTFILE`` is replaced with the name
354 filtered by the command. The string ``OUTFILE`` is replaced with the name
355 of an empty temporary file, where the filtered data must be written by
355 of an empty temporary file, where the filtered data must be written by
356 the command.
356 the command.
357
357
358 .. note:: The tempfile mechanism is recommended for Windows systems,
358 .. note:: The tempfile mechanism is recommended for Windows systems,
359 where the standard shell I/O redirection operators often have
359 where the standard shell I/O redirection operators often have
360 strange effects and may corrupt the contents of your files.
360 strange effects and may corrupt the contents of your files.
361
361
362 This filter mechanism is used internally by the ``eol`` extension to
362 This filter mechanism is used internally by the ``eol`` extension to
363 translate line ending characters between Windows (CRLF) and Unix (LF)
363 translate line ending characters between Windows (CRLF) and Unix (LF)
364 format. We suggest you use the ``eol`` extension for convenience.
364 format. We suggest you use the ``eol`` extension for convenience.
365
365
366
366
367 ``defaults``
367 ``defaults``
368 """"""""""""
368 """"""""""""
369
369
370 (defaults are deprecated. Don't use them. Use aliases instead)
370 (defaults are deprecated. Don't use them. Use aliases instead)
371
371
372 Use the ``[defaults]`` section to define command defaults, i.e. the
372 Use the ``[defaults]`` section to define command defaults, i.e. the
373 default options/arguments to pass to the specified commands.
373 default options/arguments to pass to the specified commands.
374
374
375 The following example makes :hg:`log` run in verbose mode, and
375 The following example makes :hg:`log` run in verbose mode, and
376 :hg:`status` show only the modified files, by default::
376 :hg:`status` show only the modified files, by default::
377
377
378 [defaults]
378 [defaults]
379 log = -v
379 log = -v
380 status = -m
380 status = -m
381
381
382 The actual commands, instead of their aliases, must be used when
382 The actual commands, instead of their aliases, must be used when
383 defining command defaults. The command defaults will also be applied
383 defining command defaults. The command defaults will also be applied
384 to the aliases of the commands defined.
384 to the aliases of the commands defined.
385
385
386
386
387 ``diff``
387 ``diff``
388 """"""""
388 """"""""
389
389
390 Settings used when displaying diffs. Everything except for ``unified``
390 Settings used when displaying diffs. Everything except for ``unified``
391 is a Boolean and defaults to False. See ``annotate`` section for
391 is a Boolean and defaults to False. See ``annotate`` section for
392 related options for the annotate command.
392 related options for the annotate command.
393
393
394 ``git``
394 ``git``
395 Use git extended diff format.
395 Use git extended diff format.
396
396
397 ``nodates``
397 ``nodates``
398 Don't include dates in diff headers.
398 Don't include dates in diff headers.
399
399
400 ``showfunc``
400 ``showfunc``
401 Show which function each change is in.
401 Show which function each change is in.
402
402
403 ``ignorews``
403 ``ignorews``
404 Ignore white space when comparing lines.
404 Ignore white space when comparing lines.
405
405
406 ``ignorewsamount``
406 ``ignorewsamount``
407 Ignore changes in the amount of white space.
407 Ignore changes in the amount of white space.
408
408
409 ``ignoreblanklines``
409 ``ignoreblanklines``
410 Ignore changes whose lines are all blank.
410 Ignore changes whose lines are all blank.
411
411
412 ``unified``
412 ``unified``
413 Number of lines of context to show.
413 Number of lines of context to show.
414
414
415 ``email``
415 ``email``
416 """""""""
416 """""""""
417
417
418 Settings for extensions that send email messages.
418 Settings for extensions that send email messages.
419
419
420 ``from``
420 ``from``
421 Optional. Email address to use in "From" header and SMTP envelope
421 Optional. Email address to use in "From" header and SMTP envelope
422 of outgoing messages.
422 of outgoing messages.
423
423
424 ``to``
424 ``to``
425 Optional. Comma-separated list of recipients' email addresses.
425 Optional. Comma-separated list of recipients' email addresses.
426
426
427 ``cc``
427 ``cc``
428 Optional. Comma-separated list of carbon copy recipients'
428 Optional. Comma-separated list of carbon copy recipients'
429 email addresses.
429 email addresses.
430
430
431 ``bcc``
431 ``bcc``
432 Optional. Comma-separated list of blind carbon copy recipients'
432 Optional. Comma-separated list of blind carbon copy recipients'
433 email addresses.
433 email addresses.
434
434
435 ``method``
435 ``method``
436 Optional. Method to use to send email messages. If value is ``smtp``
436 Optional. Method to use to send email messages. If value is ``smtp``
437 (default), use SMTP (see the ``[smtp]`` section for configuration).
437 (default), use SMTP (see the ``[smtp]`` section for configuration).
438 Otherwise, use as name of program to run that acts like sendmail
438 Otherwise, use as name of program to run that acts like sendmail
439 (takes ``-f`` option for sender, list of recipients on command line,
439 (takes ``-f`` option for sender, list of recipients on command line,
440 message on stdin). Normally, setting this to ``sendmail`` or
440 message on stdin). Normally, setting this to ``sendmail`` or
441 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
441 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
442
442
443 ``charsets``
443 ``charsets``
444 Optional. Comma-separated list of character sets considered
444 Optional. Comma-separated list of character sets considered
445 convenient for recipients. Addresses, headers, and parts not
445 convenient for recipients. Addresses, headers, and parts not
446 containing patches of outgoing messages will be encoded in the
446 containing patches of outgoing messages will be encoded in the
447 first character set to which conversion from local encoding
447 first character set to which conversion from local encoding
448 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
448 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
449 conversion fails, the text in question is sent as is. Defaults to
449 conversion fails, the text in question is sent as is. Defaults to
450 empty (explicit) list.
450 empty (explicit) list.
451
451
452 Order of outgoing email character sets:
452 Order of outgoing email character sets:
453
453
454 1. ``us-ascii``: always first, regardless of settings
454 1. ``us-ascii``: always first, regardless of settings
455 2. ``email.charsets``: in order given by user
455 2. ``email.charsets``: in order given by user
456 3. ``ui.fallbackencoding``: if not in email.charsets
456 3. ``ui.fallbackencoding``: if not in email.charsets
457 4. ``$HGENCODING``: if not in email.charsets
457 4. ``$HGENCODING``: if not in email.charsets
458 5. ``utf-8``: always last, regardless of settings
458 5. ``utf-8``: always last, regardless of settings
459
459
460 Email example::
460 Email example::
461
461
462 [email]
462 [email]
463 from = Joseph User <joe.user@example.com>
463 from = Joseph User <joe.user@example.com>
464 method = /usr/sbin/sendmail
464 method = /usr/sbin/sendmail
465 # charsets for western Europeans
465 # charsets for western Europeans
466 # us-ascii, utf-8 omitted, as they are tried first and last
466 # us-ascii, utf-8 omitted, as they are tried first and last
467 charsets = iso-8859-1, iso-8859-15, windows-1252
467 charsets = iso-8859-1, iso-8859-15, windows-1252
468
468
469
469
470 ``extensions``
470 ``extensions``
471 """"""""""""""
471 """"""""""""""
472
472
473 Mercurial has an extension mechanism for adding new features. To
473 Mercurial has an extension mechanism for adding new features. To
474 enable an extension, create an entry for it in this section.
474 enable an extension, create an entry for it in this section.
475
475
476 If you know that the extension is already in Python's search path,
476 If you know that the extension is already in Python's search path,
477 you can give the name of the module, followed by ``=``, with nothing
477 you can give the name of the module, followed by ``=``, with nothing
478 after the ``=``.
478 after the ``=``.
479
479
480 Otherwise, give a name that you choose, followed by ``=``, followed by
480 Otherwise, give a name that you choose, followed by ``=``, followed by
481 the path to the ``.py`` file (including the file name extension) that
481 the path to the ``.py`` file (including the file name extension) that
482 defines the extension.
482 defines the extension.
483
483
484 To explicitly disable an extension that is enabled in an hgrc of
484 To explicitly disable an extension that is enabled in an hgrc of
485 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
485 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
486 or ``foo = !`` when path is not supplied.
486 or ``foo = !`` when path is not supplied.
487
487
488 Example for ``~/.hgrc``::
488 Example for ``~/.hgrc``::
489
489
490 [extensions]
490 [extensions]
491 # (the mq extension will get loaded from Mercurial's path)
491 # (the mq extension will get loaded from Mercurial's path)
492 mq =
492 mq =
493 # (this extension will get loaded from the file specified)
493 # (this extension will get loaded from the file specified)
494 myfeature = ~/.hgext/myfeature.py
494 myfeature = ~/.hgext/myfeature.py
495
495
496
496
497 ``format``
497 ``format``
498 """"""""""
498 """"""""""
499
499
500 ``usestore``
500 ``usestore``
501 Enable or disable the "store" repository format which improves
501 Enable or disable the "store" repository format which improves
502 compatibility with systems that fold case or otherwise mangle
502 compatibility with systems that fold case or otherwise mangle
503 filenames. Enabled by default. Disabling this option will allow
503 filenames. Enabled by default. Disabling this option will allow
504 you to store longer filenames in some situations at the expense of
504 you to store longer filenames in some situations at the expense of
505 compatibility and ensures that the on-disk format of newly created
505 compatibility and ensures that the on-disk format of newly created
506 repositories will be compatible with Mercurial before version 0.9.4.
506 repositories will be compatible with Mercurial before version 0.9.4.
507
507
508 ``usefncache``
508 ``usefncache``
509 Enable or disable the "fncache" repository format which enhances
509 Enable or disable the "fncache" repository format which enhances
510 the "store" repository format (which has to be enabled to use
510 the "store" repository format (which has to be enabled to use
511 fncache) to allow longer filenames and avoids using Windows
511 fncache) to allow longer filenames and avoids using Windows
512 reserved names, e.g. "nul". Enabled by default. Disabling this
512 reserved names, e.g. "nul". Enabled by default. Disabling this
513 option ensures that the on-disk format of newly created
513 option ensures that the on-disk format of newly created
514 repositories will be compatible with Mercurial before version 1.1.
514 repositories will be compatible with Mercurial before version 1.1.
515
515
516 ``dotencode``
516 ``dotencode``
517 Enable or disable the "dotencode" repository format which enhances
517 Enable or disable the "dotencode" repository format which enhances
518 the "fncache" repository format (which has to be enabled to use
518 the "fncache" repository format (which has to be enabled to use
519 dotencode) to avoid issues with filenames starting with ._ on
519 dotencode) to avoid issues with filenames starting with ._ on
520 Mac OS X and spaces on Windows. Enabled by default. Disabling this
520 Mac OS X and spaces on Windows. Enabled by default. Disabling this
521 option ensures that the on-disk format of newly created
521 option ensures that the on-disk format of newly created
522 repositories will be compatible with Mercurial before version 1.7.
522 repositories will be compatible with Mercurial before version 1.7.
523
523
524 ``graph``
524 ``graph``
525 """""""""
525 """""""""
526
526
527 Web graph view configuration. This section let you change graph
527 Web graph view configuration. This section let you change graph
528 elements display properties by branches, for instance to make the
528 elements display properties by branches, for instance to make the
529 ``default`` branch stand out.
529 ``default`` branch stand out.
530
530
531 Each line has the following format::
531 Each line has the following format::
532
532
533 <branch>.<argument> = <value>
533 <branch>.<argument> = <value>
534
534
535 where ``<branch>`` is the name of the branch being
535 where ``<branch>`` is the name of the branch being
536 customized. Example::
536 customized. Example::
537
537
538 [graph]
538 [graph]
539 # 2px width
539 # 2px width
540 default.width = 2
540 default.width = 2
541 # red color
541 # red color
542 default.color = FF0000
542 default.color = FF0000
543
543
544 Supported arguments:
544 Supported arguments:
545
545
546 ``width``
546 ``width``
547 Set branch edges width in pixels.
547 Set branch edges width in pixels.
548
548
549 ``color``
549 ``color``
550 Set branch edges color in hexadecimal RGB notation.
550 Set branch edges color in hexadecimal RGB notation.
551
551
552 ``hooks``
552 ``hooks``
553 """""""""
553 """""""""
554
554
555 Commands or Python functions that get automatically executed by
555 Commands or Python functions that get automatically executed by
556 various actions such as starting or finishing a commit. Multiple
556 various actions such as starting or finishing a commit. Multiple
557 hooks can be run for the same action by appending a suffix to the
557 hooks can be run for the same action by appending a suffix to the
558 action. Overriding a site-wide hook can be done by changing its
558 action. Overriding a site-wide hook can be done by changing its
559 value or setting it to an empty string. Hooks can be prioritized
559 value or setting it to an empty string. Hooks can be prioritized
560 by adding a prefix of ``priority`` to the hook name on a new line
560 by adding a prefix of ``priority`` to the hook name on a new line
561 and setting the priority. The default priority is 0 if
561 and setting the priority. The default priority is 0 if
562 not specified.
562 not specified.
563
563
564 Example ``.hg/hgrc``::
564 Example ``.hg/hgrc``::
565
565
566 [hooks]
566 [hooks]
567 # update working directory after adding changesets
567 # update working directory after adding changesets
568 changegroup.update = hg update
568 changegroup.update = hg update
569 # do not use the site-wide hook
569 # do not use the site-wide hook
570 incoming =
570 incoming =
571 incoming.email = /my/email/hook
571 incoming.email = /my/email/hook
572 incoming.autobuild = /my/build/hook
572 incoming.autobuild = /my/build/hook
573 # force autobuild hook to run before other incoming hooks
573 # force autobuild hook to run before other incoming hooks
574 priority.incoming.autobuild = 1
574 priority.incoming.autobuild = 1
575
575
576 Most hooks are run with environment variables set that give useful
576 Most hooks are run with environment variables set that give useful
577 additional information. For each hook below, the environment
577 additional information. For each hook below, the environment
578 variables it is passed are listed with names of the form ``$HG_foo``.
578 variables it is passed are listed with names of the form ``$HG_foo``.
579
579
580 ``changegroup``
580 ``changegroup``
581 Run after a changegroup has been added via push, pull or unbundle.
581 Run after a changegroup has been added via push, pull or unbundle.
582 ID of the first new changeset is in ``$HG_NODE``. URL from which
582 ID of the first new changeset is in ``$HG_NODE``. URL from which
583 changes came is in ``$HG_URL``.
583 changes came is in ``$HG_URL``.
584
584
585 ``commit``
585 ``commit``
586 Run after a changeset has been created in the local repository. ID
586 Run after a changeset has been created in the local repository. ID
587 of the newly created changeset is in ``$HG_NODE``. Parent changeset
587 of the newly created changeset is in ``$HG_NODE``. Parent changeset
588 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
588 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
589
589
590 ``incoming``
590 ``incoming``
591 Run after a changeset has been pulled, pushed, or unbundled into
591 Run after a changeset has been pulled, pushed, or unbundled into
592 the local repository. The ID of the newly arrived changeset is in
592 the local repository. The ID of the newly arrived changeset is in
593 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
593 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
594
594
595 ``outgoing``
595 ``outgoing``
596 Run after sending changes from local repository to another. ID of
596 Run after sending changes from local repository to another. ID of
597 first changeset sent is in ``$HG_NODE``. Source of operation is in
597 first changeset sent is in ``$HG_NODE``. Source of operation is in
598 ``$HG_SOURCE``; see "preoutgoing" hook for description.
598 ``$HG_SOURCE``; see "preoutgoing" hook for description.
599
599
600 ``post-<command>``
600 ``post-<command>``
601 Run after successful invocations of the associated command. The
601 Run after successful invocations of the associated command. The
602 contents of the command line are passed as ``$HG_ARGS`` and the result
602 contents of the command line are passed as ``$HG_ARGS`` and the result
603 code in ``$HG_RESULT``. Parsed command line arguments are passed as
603 code in ``$HG_RESULT``. Parsed command line arguments are passed as
604 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
604 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
605 the python data internally passed to <command>. ``$HG_OPTS`` is a
605 the python data internally passed to <command>. ``$HG_OPTS`` is a
606 dictionary of options (with unspecified options set to their defaults).
606 dictionary of options (with unspecified options set to their defaults).
607 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
607 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
608
608
609 ``pre-<command>``
609 ``pre-<command>``
610 Run before executing the associated command. The contents of the
610 Run before executing the associated command. The contents of the
611 command line are passed as ``$HG_ARGS``. Parsed command line arguments
611 command line are passed as ``$HG_ARGS``. Parsed command line arguments
612 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
612 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
613 representations of the data internally passed to <command>. ``$HG_OPTS``
613 representations of the data internally passed to <command>. ``$HG_OPTS``
614 is a dictionary of options (with unspecified options set to their
614 is a dictionary of options (with unspecified options set to their
615 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
615 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
616 failure, the command doesn't execute and Mercurial returns the failure
616 failure, the command doesn't execute and Mercurial returns the failure
617 code.
617 code.
618
618
619 ``prechangegroup``
619 ``prechangegroup``
620 Run before a changegroup is added via push, pull or unbundle. Exit
620 Run before a changegroup is added via push, pull or unbundle. Exit
621 status 0 allows the changegroup to proceed. Non-zero status will
621 status 0 allows the changegroup to proceed. Non-zero status will
622 cause the push, pull or unbundle to fail. URL from which changes
622 cause the push, pull or unbundle to fail. URL from which changes
623 will come is in ``$HG_URL``.
623 will come is in ``$HG_URL``.
624
624
625 ``precommit``
625 ``precommit``
626 Run before starting a local commit. Exit status 0 allows the
626 Run before starting a local commit. Exit status 0 allows the
627 commit to proceed. Non-zero status will cause the commit to fail.
627 commit to proceed. Non-zero status will cause the commit to fail.
628 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
628 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
629
629
630 ``prelistkeys``
630 ``prelistkeys``
631 Run before listing pushkeys (like bookmarks) in the
631 Run before listing pushkeys (like bookmarks) in the
632 repository. Non-zero status will cause failure. The key namespace is
632 repository. Non-zero status will cause failure. The key namespace is
633 in ``$HG_NAMESPACE``.
633 in ``$HG_NAMESPACE``.
634
634
635 ``preoutgoing``
635 ``preoutgoing``
636 Run before collecting changes to send from the local repository to
636 Run before collecting changes to send from the local repository to
637 another. Non-zero status will cause failure. This lets you prevent
637 another. Non-zero status will cause failure. This lets you prevent
638 pull over HTTP or SSH. Also prevents against local pull, push
638 pull over HTTP or SSH. Also prevents against local pull, push
639 (outbound) or bundle commands, but not effective, since you can
639 (outbound) or bundle commands, but not effective, since you can
640 just copy files instead then. Source of operation is in
640 just copy files instead then. Source of operation is in
641 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
641 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
642 SSH or HTTP repository. If "push", "pull" or "bundle", operation
642 SSH or HTTP repository. If "push", "pull" or "bundle", operation
643 is happening on behalf of repository on same system.
643 is happening on behalf of repository on same system.
644
644
645 ``prepushkey``
645 ``prepushkey``
646 Run before a pushkey (like a bookmark) is added to the
646 Run before a pushkey (like a bookmark) is added to the
647 repository. Non-zero status will cause the key to be rejected. The
647 repository. Non-zero status will cause the key to be rejected. The
648 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
648 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
649 the old value (if any) is in ``$HG_OLD``, and the new value is in
649 the old value (if any) is in ``$HG_OLD``, and the new value is in
650 ``$HG_NEW``.
650 ``$HG_NEW``.
651
651
652 ``pretag``
652 ``pretag``
653 Run before creating a tag. Exit status 0 allows the tag to be
653 Run before creating a tag. Exit status 0 allows the tag to be
654 created. Non-zero status will cause the tag to fail. ID of
654 created. Non-zero status will cause the tag to fail. ID of
655 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
655 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
656 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
656 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
657
657
658 ``pretxnchangegroup``
658 ``pretxnchangegroup``
659 Run after a changegroup has been added via push, pull or unbundle,
659 Run after a changegroup has been added via push, pull or unbundle,
660 but before the transaction has been committed. Changegroup is
660 but before the transaction has been committed. Changegroup is
661 visible to hook program. This lets you validate incoming changes
661 visible to hook program. This lets you validate incoming changes
662 before accepting them. Passed the ID of the first new changeset in
662 before accepting them. Passed the ID of the first new changeset in
663 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero
663 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero
664 status will cause the transaction to be rolled back and the push,
664 status will cause the transaction to be rolled back and the push,
665 pull or unbundle will fail. URL that was source of changes is in
665 pull or unbundle will fail. URL that was source of changes is in
666 ``$HG_URL``.
666 ``$HG_URL``.
667
667
668 ``pretxncommit``
668 ``pretxncommit``
669 Run after a changeset has been created but the transaction not yet
669 Run after a changeset has been created but the transaction not yet
670 committed. Changeset is visible to hook program. This lets you
670 committed. Changeset is visible to hook program. This lets you
671 validate commit message and changes. Exit status 0 allows the
671 validate commit message and changes. Exit status 0 allows the
672 commit to proceed. Non-zero status will cause the transaction to
672 commit to proceed. Non-zero status will cause the transaction to
673 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
673 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
674 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
674 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
675
675
676 ``preupdate``
676 ``preupdate``
677 Run before updating the working directory. Exit status 0 allows
677 Run before updating the working directory. Exit status 0 allows
678 the update to proceed. Non-zero status will prevent the update.
678 the update to proceed. Non-zero status will prevent the update.
679 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
679 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
680 of second new parent is in ``$HG_PARENT2``.
680 of second new parent is in ``$HG_PARENT2``.
681
681
682 ``listkeys``
682 ``listkeys``
683 Run after listing pushkeys (like bookmarks) in the repository. The
683 Run after listing pushkeys (like bookmarks) in the repository. The
684 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
684 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
685 dictionary containing the keys and values.
685 dictionary containing the keys and values.
686
686
687 ``pushkey``
687 ``pushkey``
688 Run after a pushkey (like a bookmark) is added to the
688 Run after a pushkey (like a bookmark) is added to the
689 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
689 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
690 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
690 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
691 value is in ``$HG_NEW``.
691 value is in ``$HG_NEW``.
692
692
693 ``tag``
693 ``tag``
694 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
694 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
695 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
695 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
696 repository if ``$HG_LOCAL=0``.
696 repository if ``$HG_LOCAL=0``.
697
697
698 ``update``
698 ``update``
699 Run after updating the working directory. Changeset ID of first
699 Run after updating the working directory. Changeset ID of first
700 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
700 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
701 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
701 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
702 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
702 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
703
703
704 .. note:: It is generally better to use standard hooks rather than the
704 .. note:: It is generally better to use standard hooks rather than the
705 generic pre- and post- command hooks as they are guaranteed to be
705 generic pre- and post- command hooks as they are guaranteed to be
706 called in the appropriate contexts for influencing transactions.
706 called in the appropriate contexts for influencing transactions.
707 Also, hooks like "commit" will be called in all contexts that
707 Also, hooks like "commit" will be called in all contexts that
708 generate a commit (e.g. tag) and not just the commit command.
708 generate a commit (e.g. tag) and not just the commit command.
709
709
710 .. note:: Environment variables with empty values may not be passed to
710 .. note:: Environment variables with empty values may not be passed to
711 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
711 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
712 will have an empty value under Unix-like platforms for non-merge
712 will have an empty value under Unix-like platforms for non-merge
713 changesets, while it will not be available at all under Windows.
713 changesets, while it will not be available at all under Windows.
714
714
715 The syntax for Python hooks is as follows::
715 The syntax for Python hooks is as follows::
716
716
717 hookname = python:modulename.submodule.callable
717 hookname = python:modulename.submodule.callable
718 hookname = python:/path/to/python/module.py:callable
718 hookname = python:/path/to/python/module.py:callable
719
719
720 Python hooks are run within the Mercurial process. Each hook is
720 Python hooks are run within the Mercurial process. Each hook is
721 called with at least three keyword arguments: a ui object (keyword
721 called with at least three keyword arguments: a ui object (keyword
722 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
722 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
723 keyword that tells what kind of hook is used. Arguments listed as
723 keyword that tells what kind of hook is used. Arguments listed as
724 environment variables above are passed as keyword arguments, with no
724 environment variables above are passed as keyword arguments, with no
725 ``HG_`` prefix, and names in lower case.
725 ``HG_`` prefix, and names in lower case.
726
726
727 If a Python hook returns a "true" value or raises an exception, this
727 If a Python hook returns a "true" value or raises an exception, this
728 is treated as a failure.
728 is treated as a failure.
729
729
730
730
731 ``hostfingerprints``
731 ``hostfingerprints``
732 """"""""""""""""""""
732 """"""""""""""""""""
733
733
734 Fingerprints of the certificates of known HTTPS servers.
734 Fingerprints of the certificates of known HTTPS servers.
735 A HTTPS connection to a server with a fingerprint configured here will
735 A HTTPS connection to a server with a fingerprint configured here will
736 only succeed if the servers certificate matches the fingerprint.
736 only succeed if the servers certificate matches the fingerprint.
737 This is very similar to how ssh known hosts works.
737 This is very similar to how ssh known hosts works.
738 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
738 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
739 The CA chain and web.cacerts is not used for servers with a fingerprint.
739 The CA chain and web.cacerts is not used for servers with a fingerprint.
740
740
741 For example::
741 For example::
742
742
743 [hostfingerprints]
743 [hostfingerprints]
744 hg.intevation.org = 38:76:52:7c:87:26:9a:8f:4a:f8:d3:de:08:45:3b:ea:d6:4b:ee:cc
744 hg.intevation.org = 38:76:52:7c:87:26:9a:8f:4a:f8:d3:de:08:45:3b:ea:d6:4b:ee:cc
745
745
746 This feature is only supported when using Python 2.6 or later.
746 This feature is only supported when using Python 2.6 or later.
747
747
748
748
749 ``http_proxy``
749 ``http_proxy``
750 """"""""""""""
750 """"""""""""""
751
751
752 Used to access web-based Mercurial repositories through a HTTP
752 Used to access web-based Mercurial repositories through a HTTP
753 proxy.
753 proxy.
754
754
755 ``host``
755 ``host``
756 Host name and (optional) port of the proxy server, for example
756 Host name and (optional) port of the proxy server, for example
757 "myproxy:8000".
757 "myproxy:8000".
758
758
759 ``no``
759 ``no``
760 Optional. Comma-separated list of host names that should bypass
760 Optional. Comma-separated list of host names that should bypass
761 the proxy.
761 the proxy.
762
762
763 ``passwd``
763 ``passwd``
764 Optional. Password to authenticate with at the proxy server.
764 Optional. Password to authenticate with at the proxy server.
765
765
766 ``user``
766 ``user``
767 Optional. User name to authenticate with at the proxy server.
767 Optional. User name to authenticate with at the proxy server.
768
768
769 ``always``
769 ``always``
770 Optional. Always use the proxy, even for localhost and any entries
770 Optional. Always use the proxy, even for localhost and any entries
771 in ``http_proxy.no``. True or False. Default: False.
771 in ``http_proxy.no``. True or False. Default: False.
772
772
773 ``merge-patterns``
773 ``merge-patterns``
774 """"""""""""""""""
774 """"""""""""""""""
775
775
776 This section specifies merge tools to associate with particular file
776 This section specifies merge tools to associate with particular file
777 patterns. Tools matched here will take precedence over the default
777 patterns. Tools matched here will take precedence over the default
778 merge tool. Patterns are globs by default, rooted at the repository
778 merge tool. Patterns are globs by default, rooted at the repository
779 root.
779 root.
780
780
781 Example::
781 Example::
782
782
783 [merge-patterns]
783 [merge-patterns]
784 **.c = kdiff3
784 **.c = kdiff3
785 **.jpg = myimgmerge
785 **.jpg = myimgmerge
786
786
787 ``merge-tools``
787 ``merge-tools``
788 """""""""""""""
788 """""""""""""""
789
789
790 This section configures external merge tools to use for file-level
790 This section configures external merge tools to use for file-level
791 merges.
791 merges.
792
792
793 Example ``~/.hgrc``::
793 Example ``~/.hgrc``::
794
794
795 [merge-tools]
795 [merge-tools]
796 # Override stock tool location
796 # Override stock tool location
797 kdiff3.executable = ~/bin/kdiff3
797 kdiff3.executable = ~/bin/kdiff3
798 # Specify command line
798 # Specify command line
799 kdiff3.args = $base $local $other -o $output
799 kdiff3.args = $base $local $other -o $output
800 # Give higher priority
800 # Give higher priority
801 kdiff3.priority = 1
801 kdiff3.priority = 1
802
802
803 # Define new tool
803 # Define new tool
804 myHtmlTool.args = -m $local $other $base $output
804 myHtmlTool.args = -m $local $other $base $output
805 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
805 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
806 myHtmlTool.priority = 1
806 myHtmlTool.priority = 1
807
807
808 Supported arguments:
808 Supported arguments:
809
809
810 ``priority``
810 ``priority``
811 The priority in which to evaluate this tool.
811 The priority in which to evaluate this tool.
812 Default: 0.
812 Default: 0.
813
813
814 ``executable``
814 ``executable``
815 Either just the name of the executable or its pathname. On Windows,
815 Either just the name of the executable or its pathname. On Windows,
816 the path can use environment variables with ${ProgramFiles} syntax.
816 the path can use environment variables with ${ProgramFiles} syntax.
817 Default: the tool name.
817 Default: the tool name.
818
818
819 ``args``
819 ``args``
820 The arguments to pass to the tool executable. You can refer to the
820 The arguments to pass to the tool executable. You can refer to the
821 files being merged as well as the output file through these
821 files being merged as well as the output file through these
822 variables: ``$base``, ``$local``, ``$other``, ``$output``.
822 variables: ``$base``, ``$local``, ``$other``, ``$output``.
823 Default: ``$local $base $other``
823 Default: ``$local $base $other``
824
824
825 ``premerge``
825 ``premerge``
826 Attempt to run internal non-interactive 3-way merge tool before
826 Attempt to run internal non-interactive 3-way merge tool before
827 launching external tool. Options are ``true``, ``false``, or ``keep``
827 launching external tool. Options are ``true``, ``false``, or ``keep``
828 to leave markers in the file if the premerge fails.
828 to leave markers in the file if the premerge fails.
829 Default: True
829 Default: True
830
830
831 ``binary``
831 ``binary``
832 This tool can merge binary files. Defaults to False, unless tool
832 This tool can merge binary files. Defaults to False, unless tool
833 was selected by file pattern match.
833 was selected by file pattern match.
834
834
835 ``symlink``
835 ``symlink``
836 This tool can merge symlinks. Defaults to False, even if tool was
836 This tool can merge symlinks. Defaults to False, even if tool was
837 selected by file pattern match.
837 selected by file pattern match.
838
838
839 ``check``
839 ``check``
840 A list of merge success-checking options:
840 A list of merge success-checking options:
841
841
842 ``changed``
842 ``changed``
843 Ask whether merge was successful when the merged file shows no changes.
843 Ask whether merge was successful when the merged file shows no changes.
844 ``conflicts``
844 ``conflicts``
845 Check whether there are conflicts even though the tool reported success.
845 Check whether there are conflicts even though the tool reported success.
846 ``prompt``
846 ``prompt``
847 Always prompt for merge success, regardless of success reported by tool.
847 Always prompt for merge success, regardless of success reported by tool.
848
848
849 ``checkchanged``
849 ``checkchanged``
850 True is equivalent to ``check = changed``.
850 True is equivalent to ``check = changed``.
851 Default: False
851 Default: False
852
852
853 ``checkconflicts``
853 ``checkconflicts``
854 True is equivalent to ``check = conflicts``.
854 True is equivalent to ``check = conflicts``.
855 Default: False
855 Default: False
856
856
857 ``fixeol``
857 ``fixeol``
858 Attempt to fix up EOL changes caused by the merge tool.
858 Attempt to fix up EOL changes caused by the merge tool.
859 Default: False
859 Default: False
860
860
861 ``gui``
861 ``gui``
862 This tool requires a graphical interface to run. Default: False
862 This tool requires a graphical interface to run. Default: False
863
863
864 ``regkey``
864 ``regkey``
865 Windows registry key which describes install location of this
865 Windows registry key which describes install location of this
866 tool. Mercurial will search for this key first under
866 tool. Mercurial will search for this key first under
867 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
867 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
868 Default: None
868 Default: None
869
869
870 ``regkeyalt``
870 ``regkeyalt``
871 An alternate Windows registry key to try if the first key is not
871 An alternate Windows registry key to try if the first key is not
872 found. The alternate key uses the same ``regname`` and ``regappend``
872 found. The alternate key uses the same ``regname`` and ``regappend``
873 semantics of the primary key. The most common use for this key
873 semantics of the primary key. The most common use for this key
874 is to search for 32bit applications on 64bit operating systems.
874 is to search for 32bit applications on 64bit operating systems.
875 Default: None
875 Default: None
876
876
877 ``regname``
877 ``regname``
878 Name of value to read from specified registry key. Defaults to the
878 Name of value to read from specified registry key. Defaults to the
879 unnamed (default) value.
879 unnamed (default) value.
880
880
881 ``regappend``
881 ``regappend``
882 String to append to the value read from the registry, typically
882 String to append to the value read from the registry, typically
883 the executable name of the tool.
883 the executable name of the tool.
884 Default: None
884 Default: None
885
885
886
886
887 ``patch``
887 ``patch``
888 """""""""
888 """""""""
889
889
890 Settings used when applying patches, for instance through the 'import'
890 Settings used when applying patches, for instance through the 'import'
891 command or with Mercurial Queues extension.
891 command or with Mercurial Queues extension.
892
892
893 ``eol``
893 ``eol``
894 When set to 'strict' patch content and patched files end of lines
894 When set to 'strict' patch content and patched files end of lines
895 are preserved. When set to ``lf`` or ``crlf``, both files end of
895 are preserved. When set to ``lf`` or ``crlf``, both files end of
896 lines are ignored when patching and the result line endings are
896 lines are ignored when patching and the result line endings are
897 normalized to either LF (Unix) or CRLF (Windows). When set to
897 normalized to either LF (Unix) or CRLF (Windows). When set to
898 ``auto``, end of lines are again ignored while patching but line
898 ``auto``, end of lines are again ignored while patching but line
899 endings in patched files are normalized to their original setting
899 endings in patched files are normalized to their original setting
900 on a per-file basis. If target file does not exist or has no end
900 on a per-file basis. If target file does not exist or has no end
901 of line, patch line endings are preserved.
901 of line, patch line endings are preserved.
902 Default: strict.
902 Default: strict.
903
903
904
904
905 ``paths``
905 ``paths``
906 """""""""
906 """""""""
907
907
908 Assigns symbolic names to repositories. The left side is the
908 Assigns symbolic names to repositories. The left side is the
909 symbolic name, and the right gives the directory or URL that is the
909 symbolic name, and the right gives the directory or URL that is the
910 location of the repository. Default paths can be declared by setting
910 location of the repository. Default paths can be declared by setting
911 the following entries.
911 the following entries.
912
912
913 ``default``
913 ``default``
914 Directory or URL to use when pulling if no source is specified.
914 Directory or URL to use when pulling if no source is specified.
915 Default is set to repository from which the current repository was
915 Default is set to repository from which the current repository was
916 cloned.
916 cloned.
917
917
918 ``default-push``
918 ``default-push``
919 Optional. Directory or URL to use when pushing if no destination
919 Optional. Directory or URL to use when pushing if no destination
920 is specified.
920 is specified.
921
921
922 ``phases``
922 ``phases``
923 """"""""""
923 """"""""""
924
924
925 Specifies default handling of phases. See :hg:`help phases` for more
925 Specifies default handling of phases. See :hg:`help phases` for more
926 information about working with phases.
926 information about working with phases.
927
927
928 ``publish``
928 ``publish``
929 Controls draft phase behavior when working as a server. When true,
929 Controls draft phase behavior when working as a server. When true,
930 pushed changesets are set to public in both client and server and
930 pushed changesets are set to public in both client and server and
931 pulled or cloned changesets are set to public in the client.
931 pulled or cloned changesets are set to public in the client.
932 Default: True
932 Default: True
933
933
934 ``new-commit``
934 ``new-commit``
935 Phase of newly-created commits.
935 Phase of newly-created commits.
936 Default: draft
936 Default: draft
937
937
938 ``profiling``
938 ``profiling``
939 """""""""""""
939 """""""""""""
940
940
941 Specifies profiling format and file output. In this section
941 Specifies profiling type, format, and file output. Two profilers are
942 description, 'profiling data' stands for the raw data collected
942 supported: an instrumenting profiler (named ``ls``), and a sampling
943 during profiling, while 'profiling report' stands for a statistical
943 profiler (named ``stat``).
944 text report generated from the profiling data. The profiling is done
944
945 using lsprof.
945 In this section description, 'profiling data' stands for the raw data
946 collected during profiling, while 'profiling report' stands for a
947 statistical text report generated from the profiling data. The
948 profiling is done using lsprof.
949
950 ``type``
951 The type of profiler to use.
952 Default: ls.
953
954 ``ls``
955 Use Python's built-in instrumenting profiler. This profiler
956 works on all platforms, but each line number it reports is the
957 first line of a function. This restriction makes it difficult to
958 identify the expensive parts of a non-trivial function.
959 ``stat``
960 Use a third-party statistical profiler, statprof. This profiler
961 currently runs only on Unix systems, and is most useful for
962 profiling commands that run for longer than about 0.1 seconds.
946
963
947 ``format``
964 ``format``
948 Profiling format.
965 Profiling format. Specific to the ``ls`` instrumenting profiler.
949 Default: text.
966 Default: text.
950
967
951 ``text``
968 ``text``
952 Generate a profiling report. When saving to a file, it should be
969 Generate a profiling report. When saving to a file, it should be
953 noted that only the report is saved, and the profiling data is
970 noted that only the report is saved, and the profiling data is
954 not kept.
971 not kept.
955 ``kcachegrind``
972 ``kcachegrind``
956 Format profiling data for kcachegrind use: when saving to a
973 Format profiling data for kcachegrind use: when saving to a
957 file, the generated file can directly be loaded into
974 file, the generated file can directly be loaded into
958 kcachegrind.
975 kcachegrind.
959
976
977 ``frequency``
978 Sampling frequency. Specific to the ``stat`` sampling profiler.
979 Default: 1000.
980
960 ``output``
981 ``output``
961 File path where profiling data or report should be saved. If the
982 File path where profiling data or report should be saved. If the
962 file exists, it is replaced. Default: None, data is printed on
983 file exists, it is replaced. Default: None, data is printed on
963 stderr
984 stderr
964
985
965 ``revsetalias``
986 ``revsetalias``
966 """""""""""""""
987 """""""""""""""
967
988
968 Alias definitions for revsets. See :hg:`help revsets` for details.
989 Alias definitions for revsets. See :hg:`help revsets` for details.
969
990
970 ``server``
991 ``server``
971 """"""""""
992 """"""""""
972
993
973 Controls generic server settings.
994 Controls generic server settings.
974
995
975 ``uncompressed``
996 ``uncompressed``
976 Whether to allow clients to clone a repository using the
997 Whether to allow clients to clone a repository using the
977 uncompressed streaming protocol. This transfers about 40% more
998 uncompressed streaming protocol. This transfers about 40% more
978 data than a regular clone, but uses less memory and CPU on both
999 data than a regular clone, but uses less memory and CPU on both
979 server and client. Over a LAN (100 Mbps or better) or a very fast
1000 server and client. Over a LAN (100 Mbps or better) or a very fast
980 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1001 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
981 regular clone. Over most WAN connections (anything slower than
1002 regular clone. Over most WAN connections (anything slower than
982 about 6 Mbps), uncompressed streaming is slower, because of the
1003 about 6 Mbps), uncompressed streaming is slower, because of the
983 extra data transfer overhead. This mode will also temporarily hold
1004 extra data transfer overhead. This mode will also temporarily hold
984 the write lock while determining what data to transfer.
1005 the write lock while determining what data to transfer.
985 Default is True.
1006 Default is True.
986
1007
987 ``preferuncompressed``
1008 ``preferuncompressed``
988 When set, clients will try to use the uncompressed streaming
1009 When set, clients will try to use the uncompressed streaming
989 protocol. Default is False.
1010 protocol. Default is False.
990
1011
991 ``validate``
1012 ``validate``
992 Whether to validate the completeness of pushed changesets by
1013 Whether to validate the completeness of pushed changesets by
993 checking that all new file revisions specified in manifests are
1014 checking that all new file revisions specified in manifests are
994 present. Default is False.
1015 present. Default is False.
995
1016
996 ``smtp``
1017 ``smtp``
997 """"""""
1018 """"""""
998
1019
999 Configuration for extensions that need to send email messages.
1020 Configuration for extensions that need to send email messages.
1000
1021
1001 ``host``
1022 ``host``
1002 Host name of mail server, e.g. "mail.example.com".
1023 Host name of mail server, e.g. "mail.example.com".
1003
1024
1004 ``port``
1025 ``port``
1005 Optional. Port to connect to on mail server. Default: 25.
1026 Optional. Port to connect to on mail server. Default: 25.
1006
1027
1007 ``tls``
1028 ``tls``
1008 Optional. Method to enable TLS when connecting to mail server: starttls,
1029 Optional. Method to enable TLS when connecting to mail server: starttls,
1009 smtps or none. Default: none.
1030 smtps or none. Default: none.
1010
1031
1011 ``username``
1032 ``username``
1012 Optional. User name for authenticating with the SMTP server.
1033 Optional. User name for authenticating with the SMTP server.
1013 Default: none.
1034 Default: none.
1014
1035
1015 ``password``
1036 ``password``
1016 Optional. Password for authenticating with the SMTP server. If not
1037 Optional. Password for authenticating with the SMTP server. If not
1017 specified, interactive sessions will prompt the user for a
1038 specified, interactive sessions will prompt the user for a
1018 password; non-interactive sessions will fail. Default: none.
1039 password; non-interactive sessions will fail. Default: none.
1019
1040
1020 ``local_hostname``
1041 ``local_hostname``
1021 Optional. It's the hostname that the sender can use to identify
1042 Optional. It's the hostname that the sender can use to identify
1022 itself to the MTA.
1043 itself to the MTA.
1023
1044
1024
1045
1025 ``subpaths``
1046 ``subpaths``
1026 """"""""""""
1047 """"""""""""
1027
1048
1028 Defines subrepositories source locations rewriting rules of the form::
1049 Defines subrepositories source locations rewriting rules of the form::
1029
1050
1030 <pattern> = <replacement>
1051 <pattern> = <replacement>
1031
1052
1032 Where ``pattern`` is a regular expression matching the source and
1053 Where ``pattern`` is a regular expression matching the source and
1033 ``replacement`` is the replacement string used to rewrite it. Groups
1054 ``replacement`` is the replacement string used to rewrite it. Groups
1034 can be matched in ``pattern`` and referenced in ``replacements``. For
1055 can be matched in ``pattern`` and referenced in ``replacements``. For
1035 instance::
1056 instance::
1036
1057
1037 http://server/(.*)-hg/ = http://hg.server/\1/
1058 http://server/(.*)-hg/ = http://hg.server/\1/
1038
1059
1039 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1060 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1040
1061
1041 All patterns are applied in definition order.
1062 All patterns are applied in definition order.
1042
1063
1043 ``trusted``
1064 ``trusted``
1044 """""""""""
1065 """""""""""
1045
1066
1046 Mercurial will not use the settings in the
1067 Mercurial will not use the settings in the
1047 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1068 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1048 user or to a trusted group, as various hgrc features allow arbitrary
1069 user or to a trusted group, as various hgrc features allow arbitrary
1049 commands to be run. This issue is often encountered when configuring
1070 commands to be run. This issue is often encountered when configuring
1050 hooks or extensions for shared repositories or servers. However,
1071 hooks or extensions for shared repositories or servers. However,
1051 the web interface will use some safe settings from the ``[web]``
1072 the web interface will use some safe settings from the ``[web]``
1052 section.
1073 section.
1053
1074
1054 This section specifies what users and groups are trusted. The
1075 This section specifies what users and groups are trusted. The
1055 current user is always trusted. To trust everybody, list a user or a
1076 current user is always trusted. To trust everybody, list a user or a
1056 group with name ``*``. These settings must be placed in an
1077 group with name ``*``. These settings must be placed in an
1057 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1078 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1058 user or service running Mercurial.
1079 user or service running Mercurial.
1059
1080
1060 ``users``
1081 ``users``
1061 Comma-separated list of trusted users.
1082 Comma-separated list of trusted users.
1062
1083
1063 ``groups``
1084 ``groups``
1064 Comma-separated list of trusted groups.
1085 Comma-separated list of trusted groups.
1065
1086
1066
1087
1067 ``ui``
1088 ``ui``
1068 """"""
1089 """"""
1069
1090
1070 User interface controls.
1091 User interface controls.
1071
1092
1072 ``archivemeta``
1093 ``archivemeta``
1073 Whether to include the .hg_archival.txt file containing meta data
1094 Whether to include the .hg_archival.txt file containing meta data
1074 (hashes for the repository base and for tip) in archives created
1095 (hashes for the repository base and for tip) in archives created
1075 by the :hg:`archive` command or downloaded via hgweb.
1096 by the :hg:`archive` command or downloaded via hgweb.
1076 Default is True.
1097 Default is True.
1077
1098
1078 ``askusername``
1099 ``askusername``
1079 Whether to prompt for a username when committing. If True, and
1100 Whether to prompt for a username when committing. If True, and
1080 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1101 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1081 be prompted to enter a username. If no username is entered, the
1102 be prompted to enter a username. If no username is entered, the
1082 default ``USER@HOST`` is used instead.
1103 default ``USER@HOST`` is used instead.
1083 Default is False.
1104 Default is False.
1084
1105
1085 ``commitsubrepos``
1106 ``commitsubrepos``
1086 Whether to commit modified subrepositories when committing the
1107 Whether to commit modified subrepositories when committing the
1087 parent repository. If False and one subrepository has uncommitted
1108 parent repository. If False and one subrepository has uncommitted
1088 changes, abort the commit.
1109 changes, abort the commit.
1089 Default is False.
1110 Default is False.
1090
1111
1091 ``debug``
1112 ``debug``
1092 Print debugging information. True or False. Default is False.
1113 Print debugging information. True or False. Default is False.
1093
1114
1094 ``editor``
1115 ``editor``
1095 The editor to use during a commit. Default is ``$EDITOR`` or ``vi``.
1116 The editor to use during a commit. Default is ``$EDITOR`` or ``vi``.
1096
1117
1097 ``fallbackencoding``
1118 ``fallbackencoding``
1098 Encoding to try if it's not possible to decode the changelog using
1119 Encoding to try if it's not possible to decode the changelog using
1099 UTF-8. Default is ISO-8859-1.
1120 UTF-8. Default is ISO-8859-1.
1100
1121
1101 ``ignore``
1122 ``ignore``
1102 A file to read per-user ignore patterns from. This file should be
1123 A file to read per-user ignore patterns from. This file should be
1103 in the same format as a repository-wide .hgignore file. This
1124 in the same format as a repository-wide .hgignore file. This
1104 option supports hook syntax, so if you want to specify multiple
1125 option supports hook syntax, so if you want to specify multiple
1105 ignore files, you can do so by setting something like
1126 ignore files, you can do so by setting something like
1106 ``ignore.other = ~/.hgignore2``. For details of the ignore file
1127 ``ignore.other = ~/.hgignore2``. For details of the ignore file
1107 format, see the ``hgignore(5)`` man page.
1128 format, see the ``hgignore(5)`` man page.
1108
1129
1109 ``interactive``
1130 ``interactive``
1110 Allow to prompt the user. True or False. Default is True.
1131 Allow to prompt the user. True or False. Default is True.
1111
1132
1112 ``logtemplate``
1133 ``logtemplate``
1113 Template string for commands that print changesets.
1134 Template string for commands that print changesets.
1114
1135
1115 ``merge``
1136 ``merge``
1116 The conflict resolution program to use during a manual merge.
1137 The conflict resolution program to use during a manual merge.
1117 For more information on merge tools see :hg:`help merge-tools`.
1138 For more information on merge tools see :hg:`help merge-tools`.
1118 For configuring merge tools see the ``[merge-tools]`` section.
1139 For configuring merge tools see the ``[merge-tools]`` section.
1119
1140
1120 ``portablefilenames``
1141 ``portablefilenames``
1121 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1142 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1122 Default is ``warn``.
1143 Default is ``warn``.
1123 If set to ``warn`` (or ``true``), a warning message is printed on POSIX
1144 If set to ``warn`` (or ``true``), a warning message is printed on POSIX
1124 platforms, if a file with a non-portable filename is added (e.g. a file
1145 platforms, if a file with a non-portable filename is added (e.g. a file
1125 with a name that can't be created on Windows because it contains reserved
1146 with a name that can't be created on Windows because it contains reserved
1126 parts like ``AUX``, reserved characters like ``:``, or would cause a case
1147 parts like ``AUX``, reserved characters like ``:``, or would cause a case
1127 collision with an existing file).
1148 collision with an existing file).
1128 If set to ``ignore`` (or ``false``), no warning is printed.
1149 If set to ``ignore`` (or ``false``), no warning is printed.
1129 If set to ``abort``, the command is aborted.
1150 If set to ``abort``, the command is aborted.
1130 On Windows, this configuration option is ignored and the command aborted.
1151 On Windows, this configuration option is ignored and the command aborted.
1131
1152
1132 ``quiet``
1153 ``quiet``
1133 Reduce the amount of output printed. True or False. Default is False.
1154 Reduce the amount of output printed. True or False. Default is False.
1134
1155
1135 ``remotecmd``
1156 ``remotecmd``
1136 remote command to use for clone/push/pull operations. Default is ``hg``.
1157 remote command to use for clone/push/pull operations. Default is ``hg``.
1137
1158
1138 ``reportoldssl``
1159 ``reportoldssl``
1139 Warn if an SSL certificate is unable to be due to using Python
1160 Warn if an SSL certificate is unable to be due to using Python
1140 2.5 or earlier. True or False. Default is True.
1161 2.5 or earlier. True or False. Default is True.
1141
1162
1142 ``report_untrusted``
1163 ``report_untrusted``
1143 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1164 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1144 trusted user or group. True or False. Default is True.
1165 trusted user or group. True or False. Default is True.
1145
1166
1146 ``slash``
1167 ``slash``
1147 Display paths using a slash (``/``) as the path separator. This
1168 Display paths using a slash (``/``) as the path separator. This
1148 only makes a difference on systems where the default path
1169 only makes a difference on systems where the default path
1149 separator is not the slash character (e.g. Windows uses the
1170 separator is not the slash character (e.g. Windows uses the
1150 backslash character (``\``)).
1171 backslash character (``\``)).
1151 Default is False.
1172 Default is False.
1152
1173
1153 ``ssh``
1174 ``ssh``
1154 command to use for SSH connections. Default is ``ssh``.
1175 command to use for SSH connections. Default is ``ssh``.
1155
1176
1156 ``strict``
1177 ``strict``
1157 Require exact command names, instead of allowing unambiguous
1178 Require exact command names, instead of allowing unambiguous
1158 abbreviations. True or False. Default is False.
1179 abbreviations. True or False. Default is False.
1159
1180
1160 ``style``
1181 ``style``
1161 Name of style to use for command output.
1182 Name of style to use for command output.
1162
1183
1163 ``timeout``
1184 ``timeout``
1164 The timeout used when a lock is held (in seconds), a negative value
1185 The timeout used when a lock is held (in seconds), a negative value
1165 means no timeout. Default is 600.
1186 means no timeout. Default is 600.
1166
1187
1167 ``traceback``
1188 ``traceback``
1168 Mercurial always prints a traceback when an unknown exception
1189 Mercurial always prints a traceback when an unknown exception
1169 occurs. Setting this to True will make Mercurial print a traceback
1190 occurs. Setting this to True will make Mercurial print a traceback
1170 on all exceptions, even those recognized by Mercurial (such as
1191 on all exceptions, even those recognized by Mercurial (such as
1171 IOError or MemoryError). Default is False.
1192 IOError or MemoryError). Default is False.
1172
1193
1173 ``username``
1194 ``username``
1174 The committer of a changeset created when running "commit".
1195 The committer of a changeset created when running "commit".
1175 Typically a person's name and email address, e.g. ``Fred Widget
1196 Typically a person's name and email address, e.g. ``Fred Widget
1176 <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If
1197 <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If
1177 the username in hgrc is empty, it has to be specified manually or
1198 the username in hgrc is empty, it has to be specified manually or
1178 in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set
1199 in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set
1179 ``username =`` in the system hgrc). Environment variables in the
1200 ``username =`` in the system hgrc). Environment variables in the
1180 username are expanded.
1201 username are expanded.
1181
1202
1182 ``verbose``
1203 ``verbose``
1183 Increase the amount of output printed. True or False. Default is False.
1204 Increase the amount of output printed. True or False. Default is False.
1184
1205
1185
1206
1186 ``web``
1207 ``web``
1187 """""""
1208 """""""
1188
1209
1189 Web interface configuration. The settings in this section apply to
1210 Web interface configuration. The settings in this section apply to
1190 both the builtin webserver (started by :hg:`serve`) and the script you
1211 both the builtin webserver (started by :hg:`serve`) and the script you
1191 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1212 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1192 and WSGI).
1213 and WSGI).
1193
1214
1194 The Mercurial webserver does no authentication (it does not prompt for
1215 The Mercurial webserver does no authentication (it does not prompt for
1195 usernames and passwords to validate *who* users are), but it does do
1216 usernames and passwords to validate *who* users are), but it does do
1196 authorization (it grants or denies access for *authenticated users*
1217 authorization (it grants or denies access for *authenticated users*
1197 based on settings in this section). You must either configure your
1218 based on settings in this section). You must either configure your
1198 webserver to do authentication for you, or disable the authorization
1219 webserver to do authentication for you, or disable the authorization
1199 checks.
1220 checks.
1200
1221
1201 For a quick setup in a trusted environment, e.g., a private LAN, where
1222 For a quick setup in a trusted environment, e.g., a private LAN, where
1202 you want it to accept pushes from anybody, you can use the following
1223 you want it to accept pushes from anybody, you can use the following
1203 command line::
1224 command line::
1204
1225
1205 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1226 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1206
1227
1207 Note that this will allow anybody to push anything to the server and
1228 Note that this will allow anybody to push anything to the server and
1208 that this should not be used for public servers.
1229 that this should not be used for public servers.
1209
1230
1210 The full set of options is:
1231 The full set of options is:
1211
1232
1212 ``accesslog``
1233 ``accesslog``
1213 Where to output the access log. Default is stdout.
1234 Where to output the access log. Default is stdout.
1214
1235
1215 ``address``
1236 ``address``
1216 Interface address to bind to. Default is all.
1237 Interface address to bind to. Default is all.
1217
1238
1218 ``allow_archive``
1239 ``allow_archive``
1219 List of archive format (bz2, gz, zip) allowed for downloading.
1240 List of archive format (bz2, gz, zip) allowed for downloading.
1220 Default is empty.
1241 Default is empty.
1221
1242
1222 ``allowbz2``
1243 ``allowbz2``
1223 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1244 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1224 revisions.
1245 revisions.
1225 Default is False.
1246 Default is False.
1226
1247
1227 ``allowgz``
1248 ``allowgz``
1228 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1249 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1229 revisions.
1250 revisions.
1230 Default is False.
1251 Default is False.
1231
1252
1232 ``allowpull``
1253 ``allowpull``
1233 Whether to allow pulling from the repository. Default is True.
1254 Whether to allow pulling from the repository. Default is True.
1234
1255
1235 ``allow_push``
1256 ``allow_push``
1236 Whether to allow pushing to the repository. If empty or not set,
1257 Whether to allow pushing to the repository. If empty or not set,
1237 push is not allowed. If the special value ``*``, any remote user can
1258 push is not allowed. If the special value ``*``, any remote user can
1238 push, including unauthenticated users. Otherwise, the remote user
1259 push, including unauthenticated users. Otherwise, the remote user
1239 must have been authenticated, and the authenticated user name must
1260 must have been authenticated, and the authenticated user name must
1240 be present in this list. The contents of the allow_push list are
1261 be present in this list. The contents of the allow_push list are
1241 examined after the deny_push list.
1262 examined after the deny_push list.
1242
1263
1243 ``guessmime``
1264 ``guessmime``
1244 Control MIME types for raw download of file content.
1265 Control MIME types for raw download of file content.
1245 Set to True to let hgweb guess the content type from the file
1266 Set to True to let hgweb guess the content type from the file
1246 extension. This will serve HTML files as ``text/html`` and might
1267 extension. This will serve HTML files as ``text/html`` and might
1247 allow cross-site scripting attacks when serving untrusted
1268 allow cross-site scripting attacks when serving untrusted
1248 repositories. Default is False.
1269 repositories. Default is False.
1249
1270
1250 ``allow_read``
1271 ``allow_read``
1251 If the user has not already been denied repository access due to
1272 If the user has not already been denied repository access due to
1252 the contents of deny_read, this list determines whether to grant
1273 the contents of deny_read, this list determines whether to grant
1253 repository access to the user. If this list is not empty, and the
1274 repository access to the user. If this list is not empty, and the
1254 user is unauthenticated or not present in the list, then access is
1275 user is unauthenticated or not present in the list, then access is
1255 denied for the user. If the list is empty or not set, then access
1276 denied for the user. If the list is empty or not set, then access
1256 is permitted to all users by default. Setting allow_read to the
1277 is permitted to all users by default. Setting allow_read to the
1257 special value ``*`` is equivalent to it not being set (i.e. access
1278 special value ``*`` is equivalent to it not being set (i.e. access
1258 is permitted to all users). The contents of the allow_read list are
1279 is permitted to all users). The contents of the allow_read list are
1259 examined after the deny_read list.
1280 examined after the deny_read list.
1260
1281
1261 ``allowzip``
1282 ``allowzip``
1262 (DEPRECATED) Whether to allow .zip downloading of repository
1283 (DEPRECATED) Whether to allow .zip downloading of repository
1263 revisions. Default is False. This feature creates temporary files.
1284 revisions. Default is False. This feature creates temporary files.
1264
1285
1265 ``baseurl``
1286 ``baseurl``
1266 Base URL to use when publishing URLs in other locations, so
1287 Base URL to use when publishing URLs in other locations, so
1267 third-party tools like email notification hooks can construct
1288 third-party tools like email notification hooks can construct
1268 URLs. Example: ``http://hgserver/repos/``.
1289 URLs. Example: ``http://hgserver/repos/``.
1269
1290
1270 ``cacerts``
1291 ``cacerts``
1271 Path to file containing a list of PEM encoded certificate
1292 Path to file containing a list of PEM encoded certificate
1272 authority certificates. Environment variables and ``~user``
1293 authority certificates. Environment variables and ``~user``
1273 constructs are expanded in the filename. If specified on the
1294 constructs are expanded in the filename. If specified on the
1274 client, then it will verify the identity of remote HTTPS servers
1295 client, then it will verify the identity of remote HTTPS servers
1275 with these certificates. The form must be as follows::
1296 with these certificates. The form must be as follows::
1276
1297
1277 -----BEGIN CERTIFICATE-----
1298 -----BEGIN CERTIFICATE-----
1278 ... (certificate in base64 PEM encoding) ...
1299 ... (certificate in base64 PEM encoding) ...
1279 -----END CERTIFICATE-----
1300 -----END CERTIFICATE-----
1280 -----BEGIN CERTIFICATE-----
1301 -----BEGIN CERTIFICATE-----
1281 ... (certificate in base64 PEM encoding) ...
1302 ... (certificate in base64 PEM encoding) ...
1282 -----END CERTIFICATE-----
1303 -----END CERTIFICATE-----
1283
1304
1284 This feature is only supported when using Python 2.6 or later. If you wish
1305 This feature is only supported when using Python 2.6 or later. If you wish
1285 to use it with earlier versions of Python, install the backported
1306 to use it with earlier versions of Python, install the backported
1286 version of the ssl library that is available from
1307 version of the ssl library that is available from
1287 ``http://pypi.python.org``.
1308 ``http://pypi.python.org``.
1288
1309
1289 You can use OpenSSL's CA certificate file if your platform has one.
1310 You can use OpenSSL's CA certificate file if your platform has one.
1290 On most Linux systems this will be ``/etc/ssl/certs/ca-certificates.crt``.
1311 On most Linux systems this will be ``/etc/ssl/certs/ca-certificates.crt``.
1291 Otherwise you will have to generate this file manually.
1312 Otherwise you will have to generate this file manually.
1292
1313
1293 To disable SSL verification temporarily, specify ``--insecure`` from
1314 To disable SSL verification temporarily, specify ``--insecure`` from
1294 command line.
1315 command line.
1295
1316
1296 ``cache``
1317 ``cache``
1297 Whether to support caching in hgweb. Defaults to True.
1318 Whether to support caching in hgweb. Defaults to True.
1298
1319
1299 ``contact``
1320 ``contact``
1300 Name or email address of the person in charge of the repository.
1321 Name or email address of the person in charge of the repository.
1301 Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty.
1322 Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty.
1302
1323
1303 ``deny_push``
1324 ``deny_push``
1304 Whether to deny pushing to the repository. If empty or not set,
1325 Whether to deny pushing to the repository. If empty or not set,
1305 push is not denied. If the special value ``*``, all remote users are
1326 push is not denied. If the special value ``*``, all remote users are
1306 denied push. Otherwise, unauthenticated users are all denied, and
1327 denied push. Otherwise, unauthenticated users are all denied, and
1307 any authenticated user name present in this list is also denied. The
1328 any authenticated user name present in this list is also denied. The
1308 contents of the deny_push list are examined before the allow_push list.
1329 contents of the deny_push list are examined before the allow_push list.
1309
1330
1310 ``deny_read``
1331 ``deny_read``
1311 Whether to deny reading/viewing of the repository. If this list is
1332 Whether to deny reading/viewing of the repository. If this list is
1312 not empty, unauthenticated users are all denied, and any
1333 not empty, unauthenticated users are all denied, and any
1313 authenticated user name present in this list is also denied access to
1334 authenticated user name present in this list is also denied access to
1314 the repository. If set to the special value ``*``, all remote users
1335 the repository. If set to the special value ``*``, all remote users
1315 are denied access (rarely needed ;). If deny_read is empty or not set,
1336 are denied access (rarely needed ;). If deny_read is empty or not set,
1316 the determination of repository access depends on the presence and
1337 the determination of repository access depends on the presence and
1317 content of the allow_read list (see description). If both
1338 content of the allow_read list (see description). If both
1318 deny_read and allow_read are empty or not set, then access is
1339 deny_read and allow_read are empty or not set, then access is
1319 permitted to all users by default. If the repository is being
1340 permitted to all users by default. If the repository is being
1320 served via hgwebdir, denied users will not be able to see it in
1341 served via hgwebdir, denied users will not be able to see it in
1321 the list of repositories. The contents of the deny_read list have
1342 the list of repositories. The contents of the deny_read list have
1322 priority over (are examined before) the contents of the allow_read
1343 priority over (are examined before) the contents of the allow_read
1323 list.
1344 list.
1324
1345
1325 ``descend``
1346 ``descend``
1326 hgwebdir indexes will not descend into subdirectories. Only repositories
1347 hgwebdir indexes will not descend into subdirectories. Only repositories
1327 directly in the current path will be shown (other repositories are still
1348 directly in the current path will be shown (other repositories are still
1328 available from the index corresponding to their containing path).
1349 available from the index corresponding to their containing path).
1329
1350
1330 ``description``
1351 ``description``
1331 Textual description of the repository's purpose or contents.
1352 Textual description of the repository's purpose or contents.
1332 Default is "unknown".
1353 Default is "unknown".
1333
1354
1334 ``encoding``
1355 ``encoding``
1335 Character encoding name. Default is the current locale charset.
1356 Character encoding name. Default is the current locale charset.
1336 Example: "UTF-8"
1357 Example: "UTF-8"
1337
1358
1338 ``errorlog``
1359 ``errorlog``
1339 Where to output the error log. Default is stderr.
1360 Where to output the error log. Default is stderr.
1340
1361
1341 ``hidden``
1362 ``hidden``
1342 Whether to hide the repository in the hgwebdir index.
1363 Whether to hide the repository in the hgwebdir index.
1343 Default is False.
1364 Default is False.
1344
1365
1345 ``ipv6``
1366 ``ipv6``
1346 Whether to use IPv6. Default is False.
1367 Whether to use IPv6. Default is False.
1347
1368
1348 ``logoimg``
1369 ``logoimg``
1349 File name of the logo image that some templates display on each page.
1370 File name of the logo image that some templates display on each page.
1350 The file name is relative to ``staticurl``. That is, the full path to
1371 The file name is relative to ``staticurl``. That is, the full path to
1351 the logo image is "staticurl/logoimg".
1372 the logo image is "staticurl/logoimg".
1352 If unset, ``hglogo.png`` will be used.
1373 If unset, ``hglogo.png`` will be used.
1353
1374
1354 ``logourl``
1375 ``logourl``
1355 Base URL to use for logos. If unset, ``http://mercurial.selenic.com/``
1376 Base URL to use for logos. If unset, ``http://mercurial.selenic.com/``
1356 will be used.
1377 will be used.
1357
1378
1358 ``name``
1379 ``name``
1359 Repository name to use in the web interface. Default is current
1380 Repository name to use in the web interface. Default is current
1360 working directory.
1381 working directory.
1361
1382
1362 ``maxchanges``
1383 ``maxchanges``
1363 Maximum number of changes to list on the changelog. Default is 10.
1384 Maximum number of changes to list on the changelog. Default is 10.
1364
1385
1365 ``maxfiles``
1386 ``maxfiles``
1366 Maximum number of files to list per changeset. Default is 10.
1387 Maximum number of files to list per changeset. Default is 10.
1367
1388
1368 ``port``
1389 ``port``
1369 Port to listen on. Default is 8000.
1390 Port to listen on. Default is 8000.
1370
1391
1371 ``prefix``
1392 ``prefix``
1372 Prefix path to serve from. Default is '' (server root).
1393 Prefix path to serve from. Default is '' (server root).
1373
1394
1374 ``push_ssl``
1395 ``push_ssl``
1375 Whether to require that inbound pushes be transported over SSL to
1396 Whether to require that inbound pushes be transported over SSL to
1376 prevent password sniffing. Default is True.
1397 prevent password sniffing. Default is True.
1377
1398
1378 ``staticurl``
1399 ``staticurl``
1379 Base URL to use for static files. If unset, static files (e.g. the
1400 Base URL to use for static files. If unset, static files (e.g. the
1380 hgicon.png favicon) will be served by the CGI script itself. Use
1401 hgicon.png favicon) will be served by the CGI script itself. Use
1381 this setting to serve them directly with the HTTP server.
1402 this setting to serve them directly with the HTTP server.
1382 Example: ``http://hgserver/static/``.
1403 Example: ``http://hgserver/static/``.
1383
1404
1384 ``stripes``
1405 ``stripes``
1385 How many lines a "zebra stripe" should span in multiline output.
1406 How many lines a "zebra stripe" should span in multiline output.
1386 Default is 1; set to 0 to disable.
1407 Default is 1; set to 0 to disable.
1387
1408
1388 ``style``
1409 ``style``
1389 Which template map style to use.
1410 Which template map style to use.
1390
1411
1391 ``templates``
1412 ``templates``
1392 Where to find the HTML templates. Default is install path.
1413 Where to find the HTML templates. Default is install path.
General Comments 0
You need to be logged in to leave comments. Login now