Help with extension writing

Greg Ward greg-hg at gerg.ca
Wed Apr 14 08:48:19 CDT 2010


On Wed, Apr 14, 2010 at 4:08 AM, Matthew Watson <mattw.watson at gmail.com> wrote:
> We started off just calling the command line, but this resulted in
> lots of calls to hg/python, so we figured an extension would be more
> performant and have access to more information than we can easily get
> from the command line.

And you have finer control over what you pass in to hg and better
ability to parse what you get out.  Python is a much nicer programming
language then the shell, and Python data structures are much richer
than strings.

> We're also trying to make this is low maintenance as possible, so
> trying to stay away from internals that might change over time as much
> as possible (we have no control over what version of mercurial our
> clients will use, but can recommend  versions that our extension will
> work with)

But you *can* specify a minimum version, surely?   I mean, don't make
it 1.5, but you should be able to target (say) 1.2 or 1.3 without much
difficulty.  It does mean you have to test your code with every
version of Mercurial >= your chosen minimum; that's the cost of using
the Python API.  But it forces you to write good tests, which is
obviously in your long-term interest.

Greg


More information about the Mercurial-devel mailing list