[PATCH RFC] cmdtest: add a new command that checks revset matching

Yuya Nishihara yuya at tcha.org
Tue Feb 19 22:38:24 EST 2019


On Tue, 19 Feb 2019 19:17:03 +0100, Boris FELD wrote:
> On 19/02/2019 13:52, Pulkit Goyal wrote:
> >
> >
> > On Fri, Feb 15, 2019 at 6:11 PM Raphaël Gomès
> > <raphael.gomes at octobus.net <mailto:raphael.gomes at octobus.net>> wrote:
> >
> >     # HG changeset patch
> >     # User Raphaël Gomès <rgomes at octobus.net <mailto:rgomes at octobus.net>>
> >     # Date 1550068454 -3600
> >     #      Wed Feb 13 15:34:14 2019 +0100
> >     # Node ID f850e5c85eeee47df95cd4bcb38b4ade5b5af955
> >     # Parent  91701785c2c56a3ee395038488758ad2e1865265
> >     # EXP-Topic cmd-test
> >     cmdtest: add a new command that checks revset matching
> >
> >     This command is meant to ease scripting that need to check revsets
> >     validity
> >     on a repository. Right now, doing such revset testing requires
> >     abuse of `hg log`
> >     output parsing, and is less than ideal.
> >
> >     It mirrors the `test` shell builtin which is used in almost every
> >     shell script
> >     for branching.
> >
> >     This is a first draft of this command, there is of room for
> >     adjustement and evolution,
> >     like fileset matching or other arguments.
> >
> >
> > You can use the `expectsize()` revset which is recently implemented
> > and pass the size as 0. So if a revset is empty, the operation will
> > succeed and you will get 0 as return value. If there are revs in the
> > revset, it will abort.
> The expectsize revset is less flexible, and provide an ambiguous return
> code when it does not match (same return as an invalid revset). The
> revset seems useful in itself, but having a clear and extensible command
> will make scripting simpler, clearer and less error-prone.

Maybe add some flag to debugrevspec command to disambiguate RepoLookupError
from the other errors?

I don't know what kind of other features the script would need, but
inspecting revset/filset syntax would belong to debugrevspec/fileset commands.


More information about the Mercurial-devel mailing list