dirstate: deprecate the `add` method outside of update/merge context
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 08 Jul 2021 00:35:06 +0200
changeset 47661 b2082426f03a
parent 47660 aa2296893168
child 47662 1a79bb8c572c
dirstate: deprecate the `add` method outside of update/merge context All core users have been updated. Differential Revision: https://phab.mercurial-scm.org/D11114
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Mon Jul 19 22:19:36 2021 +0200
+++ b/mercurial/dirstate.py	Thu Jul 08 00:35:06 2021 +0200
@@ -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):