[issue3374] shell alias argument handling does not match the documentation

Patrick Mézard bugs at mercurial.selenic.com
Tue Apr 17 08:47:38 CDT 2012


New submission from Patrick Mézard <patrick at mezard.eu>:

hg help configs says:

"""
    An alias can start with an exclamation point ("!") to make it a shell
    alias. A shell alias is executed with the shell and will let you run
    arbitrary commands. As an example,

      echo = !echo

    will let you do "hg echo foo" to have "foo" printed in your terminal.
"""

But that's not really true:

  $ "$TESTDIR/hghave" system-sh || exit 80
  $ cat >> $HGRCPATH <<EOF
  > [alias]
  > echo = !echo
  > EOF
  $ hg init repo
  $ cd repo
  $ hg echo a b c

BTW, test-alias.t defines the alias as:

  echo = !echo '\$@'

Unlike what the documentation suggests, the argument handling of regular and
shell aliases differ in dispatch.cmdalias.__init__(). I feel the
documentation should be fixed rather than the code but I do not know the
original intent.

(The following bit is also incorrect for shell aliases:

"""
Positional arguments not already used by "$N" in the definition are put at
the end of the command to be executed.
"""
)

----------
messages: 19631
nosy: pmezard
priority: bug
status: unread
title: shell alias argument handling does not match the documentation

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue3374>
____________________________________________________


More information about the Mercurial-devel mailing list