# HG changeset patch # User Ali Gholami Rudi # Date 1200498294 -12600 # Node ID e160f231281594dd51b897861146bf2e111775ef # Parent 3340aa5a64f7fe4ad2b0341951ffcf960a6686d2 demandimport: handling new relative imports Mercurial does not work on python2.6 because __import__ takes an additional argument called level. This patch merely calls the built-in __import__ when level is passed. diff -r 3340aa5a64f7 -r e160f2312815 mercurial/demandimport.py --- a/mercurial/demandimport.py Tue Jan 22 10:45:55 2008 +0100 +++ b/mercurial/demandimport.py Wed Jan 16 19:14:54 2008 +0330 @@ -77,7 +77,7 @@ self._load() setattr(self._module, attr, val) -def _demandimport(name, globals=None, locals=None, fromlist=None): +def _demandimport(name, globals=None, locals=None, fromlist=None, level=None): if not locals or name in ignore or fromlist == ('*',): # these cases we can't really delay return _origimport(name, globals, locals, fromlist) @@ -95,6 +95,9 @@ return locals[base] return _demandmod(name, globals, locals) else: + if level is not None: + # from . import b,c,d or from .a import b,c,d + return _origimport(name, globals, locals, fromlist, level) # from a import b,c,d mod = _origimport(name, globals, locals) # recurse down the module chain