Changing the wdir() {rev} and {node} output
Jordi Gutiérrez Hermoso
jordigh at octave.org
Tue Apr 16 14:14:53 UTC 2019
While I think it might be okay to keep the iternal values,
https://www.mercurial-scm.org/repo/hg/file/967c098eed33/mercurial/node.py#l39
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 node.py
I think this would be consistent with the existing usage of `hg id`
and `hg log`, the main consumers of `wdir()`.
Thoughts?
More information about the Mercurial-devel
mailing list