# HG changeset patch # User Anton Shestakov # Date 1583597791 -25200 # Node ID 43feb2380c05e2580cafbe95ad5757ceb8a93b12 # Parent 4230f046ddb964b174f2560aed0fbc4004d29635 evolve: drop pre 4.0 compat for dirstate.parentchange() diff -r 4230f046ddb9 -r 43feb2380c05 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 ### #####################################################################