Changing the wdir() {rev} and {node} output

Jordi Gutiérrez Hermoso jordigh at
Tue Apr 16 10:14:53 EDT 2019

While I think it might be okay to keep the iternal values,

I think it's far too confusing to expose them in the user interface.

A particular inconsistency I see is that we already have a way to show
wdir(), for example. In a way, `hg id -T` is kind of an alias for `hg
log -r 'wdir()' -T ... ` in a way that is not obvious. But trying to
use '{node}' or '{rev}' in `hg id` results in exposing the internal
revision and node magic numbers, which is very confusing behaviour,
since the default behaviour of `hg id` is to show `{p1.rev}+` instead
if there are changes in the wdir.

Another instance in which this happens is `hg annotate -r 'wdir()'`,
which also shows plusses to indicate that the changes are only in the
working directory.

I think we should keep this behaviour throughout, for consistency.
Since `wdir()` is still marked as experimental, we can change its
current behaviour. I propose consistency with `hg id` as follows:

    * If the working directory is clean, the following are equivalent:

          hg log -r 'wdir()' -T '{rev}:{node}'
          hg log -r . -T '{rev}:{node}'

    * Otherwise, if there are changes in the working directory, the
      following are equivalent:

         hg log -r 'wdir()' -T '{rev}:{node}'
         hg log -r '.' -T'{rev}+:{node}+'

In other words, never show in the interface the internal values of
wdir() obtained from

I think this would be consistent with the existing usage of `hg id`
and `hg log`, the main consumers of `wdir()`.


More information about the Mercurial-devel mailing list