changeset 47661:b2082426f03a

dirstate: deprecate the `add` method outside of update/merge context All core users have been updated. Differential Revision: https://phab.mercurial-scm.org/D11114
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 08 Jul 2021 00:35:06 +0200
parents aa2296893168
children 1a79bb8c572c
files mercurial/dirstate.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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):