Patchwork D11199: dirstate: deprecate the `add` method

login
register
mail settings
Submitter phabricator
Date July 19, 2021, 3:45 p.m.
Message ID <differential-rev-PHID-DREV-allngrukfavzu7t2j422-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49512/
State Superseded
Headers show

Comments

phabricator - July 19, 2021, 3:45 p.m.
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




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

Patch

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,