Mercurial > hgrepos > DevTools > mercurial-extensions
changeset 326:26e617693ae8
FIX: kwarchive and revinfo do not run on versions prior to Mercurial 4.3 after testing this with unit-tests
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 04 Mar 2019 23:12:13 +0100 |
| parents | 5c4178772a64 |
| children | 56f2020b8b9e |
| files | extensions/kwarchive.py extensions/revinfo.py |
| diffstat | 2 files changed, 15 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/extensions/kwarchive.py Thu Feb 21 00:13:56 2019 +0100 +++ b/extensions/kwarchive.py Mon Mar 04 23:12:13 2019 +0100 @@ -95,7 +95,7 @@ from mercurial import (archival, config, cmdutil, error, match, subrepo, pycompat, scmutil, templatefilters, templatekw, util, node, demandimport) -try: +with demandimport.deactivated(): _reenable_demandimport = False if demandimport.isenabled(): demandimport.disable() @@ -117,9 +117,6 @@ from mercurial.utils import dateutil as _dateutil except ImportError: _dateutil = util -finally: - if _reenable_demandimport: - demandimport.enable() testedwith = "4.3.1 4.3.2 4.4.1 4.4.2 4.5.2 4.6.1 4.8.1 4.9" @@ -138,7 +135,7 @@ cmdtable = {} -if registrar: +if registrar and hasattr(registrar, "command"): command = registrar.command(cmdtable) else: command = cmdutil.command(cmdtable)
--- a/extensions/revinfo.py Thu Feb 21 00:13:56 2019 +0100 +++ b/extensions/revinfo.py Mon Mar 04 23:12:13 2019 +0100 @@ -20,22 +20,28 @@ from mercurial.i18n import _ -from mercurial import cmdutil, scmutil, util, error, archival, pycompat -try: - from mercurial import registrar -except ImportError: - registrar = None +from mercurial import (cmdutil, scmutil, util, error, archival, pycompat, + demandimport) +with demandimport.deactivated(): + _reenable_demandimport = False + if demandimport.isenabled(): + demandimport.disable() + _reenable_demandimport = True + try: + from mercurial import registrar + except ImportError: + registrar = None cmdtable = {} -if registrar: +if registrar and hasattr(registrar, "command"): command = registrar.command(cmdtable) else: command = cmdutil.command(cmdtable) -testedwith = "3.5 3.5.1 3.5.2 4.3.1 4.3.2 4.4.1 4.4.2 4.5.2 4.6.1 4.8.1 4.9" +testedwith = "4.3.1 4.3.2 4.4.1 4.4.2 4.5.2 4.6.1 4.8.1 4.9" def getversion():
