evolve: drop pre 4.0 compat for dirstate.parentchange()
authorAnton Shestakov <av6@dwimlabs.net>
Sat, 07 Mar 2020 23:16:31 +0700
changeset 5188 43feb2380c05
parent 5187 4230f046ddb9
child 5189 26b47a967a1d
evolve: drop pre 4.0 compat for dirstate.parentchange()
hgext3rd/evolve/__init__.py
--- a/hgext3rd/evolve/__init__.py	Sat Mar 07 22:38:14 2020 +0700
+++ b/hgext3rd/evolve/__init__.py	Sat Mar 07 23:16:31 2020 +0700
@@ -269,7 +269,6 @@
     bookmarks as bookmarksmod,
     cmdutil,
     commands,
-    dirstate,
     error,
     help,
     hg,
@@ -358,29 +357,6 @@
 eh.configitem(b'experimental', b'evolution.allnewcommands', None)
 eh.configitem(b'experimental', b'prunestrip', False)
 
-# pre hg 4.0 compat
-
-if not util.safehasattr(dirstate.dirstate, 'parentchange'):
-    import contextlib
-
-    @contextlib.contextmanager
-    def parentchange(self):
-        '''Context manager for handling dirstate parents.
-
-        If an exception occurs in the scope of the context manager,
-        the incoherent dirstate won't be written when wlock is
-        released.
-        '''
-        self._parentwriters += 1
-        yield
-        # Typically we want the "undo" step of a context manager in a
-        # finally block so it happens even when an exception
-        # occurs. In this case, however, we only want to decrement
-        # parentwriters if the code in the with statement exits
-        # normally, so we don't have a try/finally here on purpose.
-        self._parentwriters -= 1
-    dirstate.dirstate.parentchange = parentchange
-
 #####################################################################
 ### Option configuration                                          ###
 #####################################################################