run-tests.py: add RUNTESTDIR to refer `tests` of Mercurial
Before this patch, there is no way to refer files under `tests` or so
of Mercurial source tree, when `run-tests.py` runs in `tests` of third
party tools. In this case, `TESTDIR` refers the latter `tests`.
This prevents third party tools from using useful tools in Mercurial
source tree (e.g. `contrib/check-code.py`).
This patch adds `RUNTESTDIR` environment variable to refer `tests` of
Mercurial source tree, in which `run-tests.py` now running is
placed. For example, tests of third party tools can refer
`contrib/check-code.py` in Mercurial source tree as
`$RUNTESTDIR/../contrib/check-code.py`.
BTW, for similarity with `TESTDIR` referring `test*s*` directory,
newly added environment variable isn't named as `RUNTEST*S*DIR`. In
addition to it, the corresponded local variable is also named as
`runtestdir`.
This is a one of preparations for
issue4677.
run-tests.py: execute hghave by the path relative to run-tests.py
Before this patch, `run-tests.py` executes `hghave` by the path
relative to `TESTDIR` (= cwd of `run-tests.py` running).
This prevents third party tools for Mercurial from running
`run-tests.py`, which is placed in `tests` of Mercurial source tree,
in `tests` of own source tree. In such cases, `TESTDIR` refers the
latter `tests`, and `hghave` doesn't exist in it.
This is a one of preparations for
issue4677.
templatekw: make {latesttag} a hybrid list
This maintains the previous behavior of expanding {latesttag} to a string
containing all of the tags, joined by ':'. But now it also allows list type
operations.
I'm unsure if the plural handling is correct (i.e. it seems like it is usually
"{foos % '{foo}'}"), but I guess we are stuck with this because the singular
form previously existed.
templatekw: allow the caller of showlist() to specify the join() separator
The keyword {latesttag} currently manually joins the list of tags using ':',
which prevents a transparent switch over to a hybrid list.
archive: use {changessincelatesttag} to build the metadata file
This isolates the current magic when dealing with wdir() and only().
templatekw: introduce the changessincelatesttag keyword
Archive is putting a value with the same name in the metadata file, to count all
of the changes not covered by the latest tag, instead of just along the longest
path. It seems that this would be useful to have on the command line as well.
It might be nice for the name to start with 'latesttag' so that it is grouped
with the other tag keywords, but I can't think of a better name.
The initial version of this counted a clean wdir() and '.' as the same value,
and a dirty wdir() as the same value after it is committed. Yuya objected on
the grounds of consistency [1]. Since revsets can be used to conditionally
select a dirty wdir() or '.' when clean, I can build the version string I need
and will defer to him on this.
[1] https://www.selenic.com/pipermail/mercurial-devel/2015-June/071588.html
help: support 'hg help template.somekeyword'
Previously the output was simply 'abort: help section not found'.