test-revert: prepare methodical testing of revert cases

We introduce a script to generate revert cases and use it to prepare a test
repo.  See the inline documentation for details.
hg-test-mode: make exit code highlight work again
test-revert: also create a text version of the snapshot

The text version is just a list of existing files with their content. We use a
small custom script for that.

This is going to be very useful for comparing revert results with
revert target content.
test-revert: display the list of all generated cases

This will help to track all existing cases.

(still very simple now)
test-revert: add methodical revert to parent for working directory

Now that we can automatically generate states, we need to actually run
revert on them and check the result. While running such tests we are
checking multiple elements. The output of the `hg revert` command, the
resulting content of file, and the creation of backup file.

The first practical test is using the simple case `hg revert --all`, reverting
all files to working directory parent content.
test-revert: add methodical revert to "base"

We now also test reverting s file to the content of another revision. This is
still done using the `--all` flag.
test-revert: add methodical revert with explicit file path

We now also test reverting file to the working directory parent
content. However this differs from the previously introduced test by using
the explicit path of each "case file" when calling revert. This should
result in the same result regarding file content and backup creation,
but the output of the `hg revert` call should differ.
test-revert: add methodical revert to "base" with explicit file path

We now also test reverting file to another revision's content. However
this differs from previously introduced test by using the explicit path
of each "case file" when calling revert. This should result in the
same result regarding file content and backup creation, but the output
of the `hg revert` call should differ.
merge with stable
test-revert: add case where file is added between "base" and "parent"
test-revert: add case where file is unchanged between "base" and "parent"

This test highlights a minor misbehavior in the message displayed
during an explicit revert with a target revision.
test-revert: add case where the file is removed between "base" and "parent"
test-revert: add case where file exists neither in "base" nor in "parent"
test-revert: add case where wc content is already reverted to base content

This test highlights multiple misbehaviors of revert. We augment the test
comments accordingly.
test-revert: add case where wc content is different from "base" and "parent"

This test highlights a case where backups are not created and the user may
lose data.
test-revert: add case where the file is marked as removed in the wc

Unlike untracked, the file is also missing from the working directory.

This test highlights a small misbehavior in output when reverting to another
revision.
test-revert: add case where file exists but is untracked in working directory

This test highlights a small misbehavior in output when reverting to another
revision not including the untracked file.
test-revert: add case with untracked files with reverted content

This test highlights similar misbehaviors as its parent changesets.
test-revert: add case with untracked files with unique content

This test highlights similar misbehavior as its parent changesets.
test-revert: add case where file is tracked but deleted in working directory