Mercurial > hg
view contrib/wix/README.txt @ 27142:060f83d219b9
extensions: refuse to load extensions if minimum hg version not met
As the author of several 3rd party extensions, I frequently see bug
reports from users attempting to run my extension with an old version
of Mercurial that I no longer support in my extension. Oftentimes, the
extension will import just fine. But as soon as we run extsetup(),
reposetup(), or get into the guts of a wrapped function, we encounter
an exception and abort. Today, Mercurial will print a message about
extensions that don't have a "testedwith" declaring explicit
compatibility with the current version.
The existing mechanism is a good start. But it isn't as robust as I
would like. Specifically, Mercurial assumes compatibility by default.
This means extension authors must perform compatibility checking in
their extsetup() or we wait and see if we encounter an abort at
runtime. And, compatibility checking can involve a lot of code and
lots of error checking. It's a lot of effort for extension authors.
Oftentimes, extension authors know which versions of Mercurial there
extension works on and more importantly where it is broken.
This patch introduces a magic "minimumhgversion" attribute in
extensions. When found, the extension loading mechanism will compare
the declared version against the current Mercurial version. If the
extension explicitly states we require a newer Mercurial version, a
warning is printed and the extension isn't loaded beyond importing
the Python module. This causes a graceful failure while alerting
the user of the compatibility issue.
I would be receptive to the idea of making the failure more fatal.
However, care would need to be taken to not criple every hg command.
e.g. the user may use `hg config` to fix the hgrc and if we aborted
trying to run that, the user would effectively be locked out of `hg`!
A potential future improvement to this functionality would be to catch
ImportError for the extension/module and parse the source code for
"minimumhgversion = 'XXX'" and do similar checking. This way we could
give more information about why the extension failed to load.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 24 Nov 2015 15:16:25 -0800 |
parents | 98166640b356 |
children | 765f836a9484 |
line wrap: on
line source
WiX installer source files ========================== The files in this folder are used by the thg-winbuild [1] package building architecture to create a Mercurial MSI installer. These files are versioned within the Mercurial source tree because the WXS files must kept up to date with distribution changes within their branch. In other words, the default branch WXS files are expected to diverge from the stable branch WXS files. Storing them within the same repository is the only sane way to keep the source tree and the installer in sync. The MSI installer builder uses only the mercurial.ini file from the contrib/win32 folder, the contents of which have been historically used to create an InnoSetup based installer. The rest of the files there are ignored. The MSI packages built by thg-winbuild require elevated (admin) privileges to be installed due to the installation of MSVC CRT libraries under the C:\WINDOWS\WinSxS folder. Thus the InnoSetup installers may still be useful to some users. To build your own MSI packages, clone the thg-winbuild [1] repository and follow the README.txt [2] instructions closely. There are fewer prerequisites for a WiX [3] installer than an InnoSetup installer, but they are more specific. Direct questions or comments to Steve Borho <steve@borho.org> [1] http://bitbucket.org/tortoisehg/thg-winbuild [2] http://bitbucket.org/tortoisehg/thg-winbuild/src/tip/README.txt [3] http://wix.sourceforge.net/