[PATCH 0 of 2 RFC] Shell alias support
Steve Losh
steve at stevelosh.com
Thu Jul 8 21:23:01 CDT 2010
This is a second version of a patch I sent a day or two ago to add shell
aliases to Mercurial, like so:
[alias]
qempty = !hg qrefresh -X "`hg root`"
This would help get rid of hacky "alias hgsomething='hg something'" aliases in
people's .whateverrc files.
A few issues brought up in IRC:
* There's no guarantee that the 'hg' command in the alias refers to the same
'hg' script that is being used. For example, if you 'make local' and run
"./hg qempty" the qrefresh command inside that alias will be run with the
'hg' on your path, not the local one.
* The second patch (which adds "$@" expansion) simply replaces raw strings --
it doesn't take quoting into account. This might be surprising, but makes the
code much, much cleaner and makes quoting in the alias itself simpler:
whatever is in the definition is exactly what will be passed to the shell.
* If this is something people aren't comfortable with it could be turned into
a 'shellalias' extension instead, but I don't know how that would affect
quoting in the .hgrc file.
* The '!' prefix was chosen because that's what git uses, but could be changed
if desired.
More information about the Mercurial-devel
mailing list