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

Yuya Nishihara yuya at
Tue Apr 16 19:29:41 EDT 2019

On Tue, 16 Apr 2019 10:14:53 -0400, Jordi Gutiérrez Hermoso wrote:
> 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:

First, I'm okay to change the output of "hg whatever -r 'wdir()'" if that
makes things more consistent. However, {rev}/{node} keywords should still
return wdirrev/wdirhex since they are valid identifiers whereas "<p1node>+"

>     * If the working directory is clean, the following are equivalent:
>           hg log -r 'wdir()' -T '{rev}:{node}'
>           hg log -r . -T '{rev}:{node}'

Do you mean `hg log -r 'wdir()'` should fall back to '.' if wdir is clean?
I believe it'll be way complicated.

If clean "wdir()" == ".", "hg status --change 'wdir()'" would have to
show the changes in "." as well, which makes no sense.

>     * 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