dirstate: use the new `check_invalidated` decorator for `_changing`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 20 Feb 2023 15:52:55 +0100
changeset 50119 de42ba9dd852
parent 50118 65943224c184
child 50120 a7d11833ff48
dirstate: use the new `check_invalidated` decorator for `_changing` WeeeEEeee, less code.
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Tue Feb 21 22:25:20 2023 +0100
+++ b/mercurial/dirstate.py	Mon Feb 20 15:52:55 2023 +0100
@@ -193,13 +193,11 @@
         self._pl
 
     @contextlib.contextmanager
+    @check_invalidated
     def _changing(self, repo, change_type):
         if repo.currentwlock() is None:
             msg = b"trying to change the dirstate without holding the wlock"
             raise error.ProgrammingError(msg)
-        if self._invalidated_context:
-            msg = "trying to use an invalidated dirstate before it has reset"
-            raise error.ProgrammingError(msg)
 
         has_tr = repo.currenttransaction() is not None
         if not has_tr and self._changing_level == 0 and self._dirty: