D11199: dirstate: deprecate the `add` method

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Jul 19 15:45:30 UTC 2021


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

REVISION SUMMARY
  All users have been migrated.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -819,9 +819,16 @@
 
     def add(self, f):
         '''Mark a file added.'''
-        if not self.pendingparentchange():
+        if self.pendingparentchange():
             util.nouideprecwarn(
-                b"do not use `add` outside of update/merge context."
+                b"do not use `add` inside of update/merge context."
+                b" Use `update_file`",
+                b'6.0',
+                stacklevel=2,
+            )
+        else:
+            util.nouideprecwarn(
+                b"do not use `remove` outside of update/merge context."
                 b" Use `set_tracked`",
                 b'6.0',
                 stacklevel=2,



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


More information about the Mercurial-devel mailing list