dirstate: deprecate `dirstate.remove` in all cases
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 16 Jul 2021 14:06:32 +0200
changeset 47701 0e87c90f1cd5
parent 47700 9217ab0ecdb8
child 47702 0149d17da91b
dirstate: deprecate `dirstate.remove` in all cases This will make sure that code will use the newer, more semantic API sooner than later. Differential Revision: https://phab.mercurial-scm.org/D11143
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Mon Jul 19 03:20:28 2021 +0200
+++ b/mercurial/dirstate.py	Fri Jul 16 14:06:32 2021 +0200
@@ -765,7 +765,14 @@
 
     def remove(self, f):
         '''Mark a file removed'''
-        if not self.pendingparentchange():
+        if self.pendingparentchange():
+            util.nouideprecwarn(
+                b"do not use `remove` insde of update/merge context."
+                b" Use `update_file` or `update_file_p1`",
+                b'6.0',
+                stacklevel=2,
+            )
+        else:
             util.nouideprecwarn(
                 b"do not use `remove` outside of update/merge context."
                 b" Use `set_untracked`",