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