Patchwork D11114: dirstate: deprecate the `add` method outside of update/merge context

login
register
mail settings
Submitter phabricator
Date July 19, 2021, 7:36 a.m.
Message ID <differential-rev-PHID-DREV-y6n6nqtw7e6hjkkxu3ta-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49428/
State Superseded
Headers show

Comments

phabricator - July 19, 2021, 7:36 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  All core users have been updated.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -708,6 +708,13 @@ 
 
     def add(self, f):
         '''Mark a file added.'''
+        if not self.pendingparentchange():
+            util.nouideprecwarn(
+                b"do not use `add` outside of update/merge context."
+                b" Use `set_tracked`",
+                b'6.0',
+                stacklevel=2,
+            )
         self._add(f)
 
     def _add(self, filename):