Versioning of external extensions?

Greg Ward greg-hg at gerg.ca
Wed May 12 02:15:13 UTC 2010


On Tue, May 11, 2010 at 5:26 AM, Jason Harris <jason at jasonfharris.com> wrote:
> Should external extensions be versioned? Ie imagine someone writes an extension myCoolExtension to go along with Mercurial 1.5.
[...]
> Anyway I am sure you have all thought about this. What is planned in this regard, what should external extension writers do? What is best practice etc? Maybe the users should always locate the extensions inside the extensions (hgext) folder so they are paired with that version of Mercurial, and that way when a new version is installed the extension won't be loaded.. automatically?

The first best practice is, write your extension to be compatible with
as wide a range of Mercurial versions as is practical.  In particular,
be damn sure to stay on top of new Mercurial releases and make sure
your extension keeps working.  (That's the price of Mercurial's "no
compatible API" contract.  The benefit of course is that Mercurial
accrues less cruft in its internals.)

The corollary to that is, don't fail until you have to.  If someone
happens to load an extension that does not work with this version of
Mercurial, that should *not* cause an immediate failure.  It should
only fail when the user actually tries to use that extension.  And
then it should die very clearly and obviously, e.g. "foobar extension
requires Mercurial 1.x or greater".

In a nutshell: this is not the GUI author's problem, it's the
extension author's problem.  Your responsibility as a GUI writer is to
not have a cow when some extensions unexpectedly don't work.  Fail
gracefully.

Greg



More information about the Mercurial mailing list