[PATCH 1 of 2] commands: add "di" alias for "diff"

Gregory Szorc gregory.szorc at gmail.com
Sat Nov 5 14:26:11 EDT 2016

# 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