[PATCH 1 of 2] commands: add "di" alias for "diff"
Jun Wu
quark at fb.com
Sat Nov 5 19:54:05 UTC 2016
Half a year ago, at fb, we shipped a pair of aliases "disableevolve",
"enableevolve". And we got a serious complaint soon after:
hg: command 'di' is ambiguous:
diff disableevolve
Why?????? Can we kill this disableevolve thing? So many extra keystrokes
plus retraining my brain
Therefore I'm very sensitive about this. I think we should always make sure
"d" = "diff" (although the complaint was only about "di").
It might be a good idea to add a "namepriority" option to commands, so
higher namepriority command wins a conflict without cluttering the help
text.
Excerpts from Gregory Szorc's message of 2016-11-05 11:26:11 -0700:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1478369272 25200
> # Sat Nov 05 11:07:52 2016 -0700
> # Node ID 4bce42e7330311b58ecd38a4acbcd2d2dd1351ba
> # Parent f01367faa792635ad2f7a6b175ae3252292b5121
> commands: add "di" alias for "diff"
>
> In preparation of introducing `hg display`, we register "di" as an
> alias for "diff" so `hg di` isn't ambiguous. This will preserve
> backwards compatibility for anyone using `hg di` today.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -3786,7 +3786,7 @@ def debugwireargs(ui, repopath, *vals, *
> if res1 != res2:
> ui.warn("%s\n" % res2)
>
> - at command('^diff',
> + at command('^diff|di',
> [('r', 'rev', [], _('revision'), _('REV')),
> ('c', 'change', '', _('change made by revision'), _('REV'))
> ] + diffopts + diffopts2 + walkopts + subrepoopts,
> diff --git a/tests/test-help.t b/tests/test-help.t
> --- a/tests/test-help.t
> +++ b/tests/test-help.t
> @@ -296,7 +296,7 @@ Test short command list with verbose opt
> show changeset information by line for each file
> clone make a copy of an existing repository
> commit, ci commit the specified files or all outstanding changes
> - diff diff repository (or selected files)
> + diff, di diff repository (or selected files)
> export dump the header and diffs for one or more changesets
> forget forget the specified files on the next commit
> init create a new repository in the given directory
> @@ -504,6 +504,8 @@ Test command without options
> $ hg help diff
> hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
>
> + aliases: di
> +
> diff repository (or selected files)
>
> Show differences between revisions for the specified files.
More information about the Mercurial-devel
mailing list