[issue2993] hg choosing alias instead of full command

Matt Austin bugs at mercurial.selenic.com
Thu Sep 8 14:02:09 CDT 2011


New submission from Matt Austin <maustin126 at gmail.com>:

Observed with Mercurial 1.9.1

If the user has specified an alias that is the prefix of a command, then the
prefix alias is used, even when the entire command is specified. (e.g. if
the user specifies an alias for 'id', then whatever the alias for id is will
be used even when the full command 'identify' is used).

[maustin at yakko ~]$ python --version
Python 2.7.1
[maustin at yakko ~]$ rpm -q python
python-2.7.1-7.fc15.x86_64
[maustin at yakko ~]$ hg --version
Mercurial Distributed SCM (version 1.9.1)
(see http://mercurial.selenic.com for more information)

Copyright (C) 2005-2011 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[maustin at yakko ~]$ rpm -q mercurial
mercurial-1.9.1-1.fc15.x86_64
[maustin at yakko ~]$ hg init tmp
[maustin at yakko ~]$ cd tmp
[maustin at yakko tmp]$ hg id
000000000000 tip
[maustin at yakko tmp]$ cat > .hg/hgrc <<EOF
> [alias]
> id=identify -nibt
> EOF
[maustin at yakko tmp]$ hg id
000000000000 -1 default tip
[maustin at yakko tmp]$ hg identify
000000000000 -1 default tip
[maustin at yakko tmp]$ hg --config alias.id=identify identify
000000000000 tip
[maustin at yakko tmp]$ hg --config alias.id='identify -nibt' identify
000000000000 -1 default tip
[maustin at yakko ~]$ hg --config alias.id=log identify -n 2> /dev/null
hg identify [OPTION]... [FILE]

alias for: hg log
options:

 -f --follow               follow changeset history, or file history across
                           copies and renames
    --follow-first         only follow the first parent of merge changesets
 -d --date DATE            show revisions matching date spec
 -C --copies               show copied files
 -k --keyword TEXT [+]     do case-insensitive search for a given text
 -r --rev REV [+]          show the specified revision or range
    --removed              include revisions where files were removed
 -m --only-merges          show only merges
 -u --user USER [+]        revisions committed by user
 -b --branch BRANCH [+]    show changesets within the given named branch
 -P --prune REV [+]        do not display revision or any of its ancestors
 -h --hidden               show hidden changesets
 -p --patch                show patch
 -g --git                  use git extended diff format
 -l --limit NUM            limit number of changes displayed
 -M --no-merges            do not show merges
    --stat                 output diffstat-style summary of changes
    --style STYLE          display using template map file
    --template TEMPLATE    display with template
 -I --include PATTERN [+]  include names matching the given patterns
 -X --exclude PATTERN [+]  exclude names matching the given patterns

[+] marked option can be specified multiple times

use "hg help identify" to show the full help text
[maustin at yakko ~]$ hg --config alias.id=log identify -n
hg identify: option -n not recognized
hg identify [OPTION]... [FILE]

alias for: hg log

options:

 -f --follow               follow changeset history, or file history across
                           copies and renames
    --follow-first         only follow the first parent of merge changesets
 -d --date DATE            show revisions matching date spec
 -C --copies               show copied files
 -k --keyword TEXT [+]     do case-insensitive search for a given text
 -r --rev REV [+]          show the specified revision or range
    --removed              include revisions where files were removed
 -m --only-merges          show only merges
 -u --user USER [+]        revisions committed by user
 -b --branch BRANCH [+]    show changesets within the given named branch
 -P --prune REV [+]        do not display revision or any of its ancestors
 -h --hidden               show hidden changesets
 -p --patch                show patch
 -g --git                  use git extended diff format
 -l --limit NUM            limit number of changes displayed
 -M --no-merges            do not show merges
    --stat                 output diffstat-style summary of changes
    --style STYLE          display using template map file
    --template TEMPLATE    display with template
 -I --include PATTERN [+]  include names matching the given patterns
 -X --exclude PATTERN [+]  exclude names matching the given patterns

[+] marked option can be specified multiple times

use "hg help identify" to show the full help text

----------
messages: 17331
nosy: maafy6
priority: bug
status: unread
title: hg choosing alias instead of full command

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


More information about the Mercurial-devel mailing list