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