Mercurial > hg
view mercurial/help/config.txt @ 11989:f853873fc66d
aliases: provide more flexible ways to work with shell alias arguments
This patch changes the functionality of shell aliases to add more powerful
options for working with shell alias arguments.
First: the alias name + arguments to a shell alias are set as an HG_ARGS
environment variable, delimited by spaces. This matches the behavior of hooks.
Second: any occurrences of "$@" (without quotes) are replaced with the
arguments, separated by spaces. This happens *before* the alias gets to the shell.
Third: any positive numeric variables ("$1", "$2", etc) are replaced with the
appropriate argument, indexed from 1. "$0" is replaced with the name of the
alias. Any "extra" numeric variables are replaced with an empty string. This
happens *before* the alias gets to the shell.
These changes allow for more flexible shell aliases:
[alias]
echo = !echo $@
count = !hg log -r "$@" --template='.' | wc -c | sed -e 's/ //g'
qqueuemv = !mv "`hg root`/.hg/patches-$1" "`hg root`/.hg/patches-$2"
In action:
$ hg echo foo
foo
$ hg count 'branch(default)'
901
$ hg count 'branch(stable) and keyword(fixes)'
102
$ hg qqueuemv myfeature somefeature
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Wed, 18 Aug 2010 18:56:44 -0400 |
parents | 534c69494918 |
children | 86b5cc1e8be8 |
line wrap: on
line source
Mercurial reads configuration data from several files, if they exist. Below we list the most specific file first. On Windows, these configuration files are read: - ``<repo>\.hg\hgrc`` - ``%USERPROFILE%\.hgrc`` - ``%USERPROFILE%\mercurial.ini`` - ``%HOME%\.hgrc`` - ``%HOME%\mercurial.ini`` - ``C:\mercurial\mercurial.ini`` (unless regkey or hgrc.d\ or mercurial.ini found) - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (unless hgrc.d\ or mercurial.ini found) - ``<hg.exe-dir>\hgrc.d\*.rc`` (unless mercurial.ini found) - ``<hg.exe-dir>\mercurial.ini`` On Unix, these files are read: - ``<repo>/.hg/hgrc`` - ``$HOME/.hgrc`` - ``/etc/mercurial/hgrc`` - ``/etc/mercurial/hgrc.d/*.rc`` - ``<install-root>/etc/mercurial/hgrc`` - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` If there is a per-repository configuration file which is not owned by the active user, Mercurial will warn you that the file is skipped:: not trusting file <repo>/.hg/hgrc from untrusted user USER, group GROUP If this bothers you, the warning can be silenced (the file would still be ignored) or trust can be established. Use one of the following settings, the syntax is explained below: - ``ui.report_untrusted = False`` - ``trusted.users = USER`` - ``trusted.groups = GROUP`` The configuration files for Mercurial use a simple ini-file format. A configuration file consists of sections, led by a ``[section]`` header and followed by ``name = value`` entries:: [ui] username = Firstname Lastname <firstname.lastname@example.net> verbose = True The above entries will be referred to as ``ui.username`` and ``ui.verbose``, respectively. Please see the hgrc man page for a full description of the possible configuration values: - on Unix-like systems: ``man hgrc`` - online: http://www.selenic.com/mercurial/hgrc.5.html