[PATCH 3 of 5] contrib: add an utility module to parse test scripts

Yuya Nishihara yuya at tcha.org
Tue Oct 9 08:02:04 EDT 2018


On Tue, 09 Oct 2018 02:34:38 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1534994754 -32400
> #      Thu Aug 23 12:25:54 2018 +0900
> # Node ID 92d0e6f411c72800b59adafccf50ac0b0d15ba17
> # Parent  ecf28733d6b95c39068d7f593c0b9a98a068509f
> # Available At https://bitbucket.org/foozy/mercurial-wip
> #              hg pull https://bitbucket.org/foozy/mercurial-wip -r 92d0e6f411c7
> # EXP-Topic contrib-improve-import-checker
> contrib: add an utility module to parse test scripts

I just quickly scanned this, but felt comfortable how things are organized.

> +    def opentext(f):
> +        return open(f, 'rb')

Nit: want which? text or binary?

> +    commands = {}
> +    def command(name, desc):
> +        def wrap(func):
> +            commands[name] = (desc, func)
> +        return wrap

We could use argparse to model a subcommand parser.


More information about the Mercurial-devel mailing list