mercurial/extensions.py
changeset 27142 060f83d219b9
parent 27116 0214cc0a0e97
child 27637 b502138f5faa
equal deleted inserted replaced
27141:a4e3dec3010e 27142:060f83d219b9
    99             ui.debug('could not import hgext.%s (%s): trying %s\n'
    99             ui.debug('could not import hgext.%s (%s): trying %s\n'
   100                      % (name, err, name))
   100                      % (name, err, name))
   101             if ui.debugflag:
   101             if ui.debugflag:
   102                 ui.traceback()
   102                 ui.traceback()
   103             mod = importh(name)
   103             mod = importh(name)
       
   104 
       
   105     # Before we do anything with the extension, check against minimum stated
       
   106     # compatibility. This gives extension authors a mechanism to have their
       
   107     # extensions short circuit when loaded with a known incompatible version
       
   108     # of Mercurial.
       
   109     minver = getattr(mod, 'minimumhgversion', None)
       
   110     if minver and util.versiontuple(minver, 2) > util.versiontuple(n=2):
       
   111         ui.warn(_('(third party extension %s requires version %s or newer '
       
   112                   'of Mercurial; disabling)\n') % (shortname, minver))
       
   113         return
       
   114 
   104     _extensions[shortname] = mod
   115     _extensions[shortname] = mod
   105     _order.append(shortname)
   116     _order.append(shortname)
   106     for fn in _aftercallbacks.get(shortname, []):
   117     for fn in _aftercallbacks.get(shortname, []):
   107         fn(loaded=True)
   118         fn(loaded=True)
   108     return mod
   119     return mod