Mercurial > hg-stable
changeset 46241:012e25abc603
command: automatically create alias for command using '-' in names
As discussed during the "5.6 Sprint" ignoring dash in command name open the way
to using them more. We can now move existing command to more readable (dash
using) names without breaking any compatibility.
Differential Revision: https://phab.mercurial-scm.org/D9515
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 20 Nov 2020 08:02:25 +0100 |
parents | a42502e9ae6d |
children | cb12658bf0e1 |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Mon Dec 28 01:05:09 2020 +0100 +++ b/mercurial/cmdutil.py Fri Nov 20 08:02:25 2020 +0100 @@ -359,7 +359,17 @@ def parsealiases(cmd): - return cmd.split(b"|") + base_aliases = cmd.split(b"|") + all_aliases = set(base_aliases) + extra_aliases = [] + for alias in base_aliases: + if b'-' in alias: + folded_alias = alias.replace(b'-', b'') + if folded_alias not in all_aliases: + all_aliases.add(folded_alias) + extra_aliases.append(folded_alias) + base_aliases.extend(extra_aliases) + return base_aliases def setupwrapcolorwrite(ui):