changeset 4254:8e891b4a54e8

compat: drop Mercurial 4.3 support for exthelper The last release email noted plans to drop 4.3 and 4.4 support in the next feature release. I'd like to move this code into core, and dropping this should allow the class to be copied in unmodified.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 10 Nov 2018 23:54:46 -0500
parents 35dac5aadcfc
children 7661706dc14d
files hgext3rd/evolve/exthelper.py
diffstat 1 files changed, 5 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/exthelper.py	Mon Nov 19 01:49:34 2018 +0000
+++ b/hgext3rd/evolve/exthelper.py	Sat Nov 10 23:54:46 2018 -0500
@@ -4,20 +4,13 @@
 
 from mercurial import (
     commands,
+    configitems,
     extensions,
     registrar,
     revset,
     templatekw,
-    util,
 )
 
-configitem = None
-dynamicdefault = None
-if util.safehasattr(registrar, 'configitem'):
-    configitem = registrar.configitem
-    from mercurial import configitems
-    dynamicdefault = configitems.dynamicdefault
-
 class exthelper(object):
     """Helper for modular extension setup
 
@@ -49,20 +42,12 @@
             self.command._doregister = _newdoregister
 
         self.configtable = {}
-        self._configitem = None
-        if configitem is not None:
-            self._configitem = configitem(self.configtable)
-
-    def configitem(self, section, config):
-        """For Mercurial 4.4 and above, register a config item
+        self._configitem = registrar.configitem(self.configtable)
 
-        For now constraint to 'dynamicdefault' until we only support version with the feature.
-        Older version would otherwise not use the declare default.
-
-        For older version no-op fallback for old Mercurial versions
+    def configitem(self, section, config, default=configitems.dynamicdefault):
+        """Register a config item.
         """
-        if self._configitem is not None:
-            self._configitem(section, config, default=dynamicdefault)
+        self._configitem(section, config, default=default)
 
     def merge(self, other):
         self._uicallables.extend(other._uicallables)