Bug 3375 - shell alias argument handling does not match the documentation
Summary: shell alias argument handling does not match the documentation
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-17 07:47 UTC by Patrick Mézard
Modified: 2012-05-13 05:10 UTC (History)
2 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Mézard 2012-04-17 07:47 UTC
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.
"""
)
Comment 2 HG Bot 2012-04-26 13:00 UTC
Fixed by http://selenic.com/repo/hg/rev/aa252059a98f
Patrick Mezard <patrick@mezard.eu>
alias: fix shell alias documentation (issue3374)

(please test the fix)
Comment 3 Bugzilla 2012-05-12 09:30 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:30 EDT  ---

This bug was previously known as _bug_ 3374 at http://mercurial.selenic.com/bts/issue3374

Bug Status was UNCONFIRMED but everconfirmed was true
   Setting status to CONFIRMED