D11143: dirstate: deprecate `dirstate.remove` in all cases

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Jul 19 10:43:29 UTC 2021


marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will make sure that code will use the newer, more semantic API sooner than
  later.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11143

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -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.1',
+                stacklevel=2,
+            )
+        else:
             util.nouideprecwarn(
                 b"do not use `remove` outside of update/merge context."
                 b" Use `set_untracked`",



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list