changeset 50127:d91fc026071c

rollback: remove the dirstateguard usage Thanks to the previous changeset, we no longer needs it. begone !
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 16 Feb 2023 00:14:21 +0100
parents c8f32aa80dca
children a99dcf53eebd
files mercurial/localrepo.py
diffstat 1 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Feb 16 10:00:59 2023 +0100
+++ b/mercurial/localrepo.py	Thu Feb 16 00:14:21 2023 +0100
@@ -42,7 +42,6 @@
     commit,
     context,
     dirstate,
-    dirstateguard,
     discovery,
     encoding,
     error,
@@ -2695,22 +2694,20 @@
                 return False
 
     def rollback(self, dryrun=False, force=False):
-        wlock = lock = dsguard = None
+        wlock = lock = None
         try:
             wlock = self.wlock()
             lock = self.lock()
             if self.svfs.exists(b"undo"):
-                dsguard = dirstateguard.dirstateguard(self, b'rollback')
-
-                return self._rollback(dryrun, force, dsguard)
+                return self._rollback(dryrun, force)
             else:
                 self.ui.warn(_(b"no rollback information available\n"))
                 return 1
         finally:
-            release(dsguard, lock, wlock)
+            release(lock, wlock)
 
     @unfilteredmethod  # Until we get smarter cache management
-    def _rollback(self, dryrun, force, dsguard):
+    def _rollback(self, dryrun, force):
         ui = self.ui
 
         parents = self.dirstate.parents()
@@ -2772,9 +2769,6 @@
         self.invalidate()
 
         if parentgone:
-            # prevent dirstateguard from overwriting already restored one
-            dsguard.close()
-
             narrowspec.restorebackup(self, b'undo.narrowspec')
             narrowspec.restorewcbackup(self, b'undo.narrowspec.dirstate')
             self.dirstate.restorebackup(None, b'undo.dirstate')