reviewboard: use demandimport.deactivated; r?smacleod
This is the proper way to temporarily deactivate demandimport, as it
will restore the previous state instead of assuming it was enabled to
begin with.
--- a/hgext/reviewboard/server.py
+++ b/hgext/reviewboard/server.py
@@ -37,23 +37,22 @@ from mercurial.i18n import _
from mercurial.node import (
hex,
nullid,
)
OUR_DIR = os.path.normpath(os.path.dirname(__file__))
execfile(os.path.join(OUR_DIR, '..', 'bootstrap.py'))
-demandimport.disable()
-try:
- import hgrb.proto
-except ImportError:
- sys.path.insert(0, OUR_DIR)
- import hgrb.proto
-demandimport.enable()
+with demandimport.deactivated():
+ try:
+ import hgrb.proto
+ except ImportError:
+ sys.path.insert(0, OUR_DIR)
+ import hgrb.proto
testedwith = '3.3 3.4 3.5 3.6'
cmdtable = {}
command = cmdutil.command(cmdtable)
# Capabilities the server requires in clients.