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
--- 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):