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

Boris FELD boris.feld at octobus.net
Tue Feb 19 13:17:03 EST 2019


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20190219/8bbc150f/attachment.html>


More information about the Mercurial-devel mailing list