changeset 47594:0cef28b121a4

context: use `dirstate.set_tracked` in `context.add` This is the new shiny API. Differential Revision: https://phab.mercurial-scm.org/D11014
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 08 Jul 2021 00:58:44 +0200
parents f927ad5a4e2c
children 14e2f4bd5f16
files mercurial/context.py mercurial/dirstate.py
diffstat 2 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Thu Jul 08 03:03:34 2021 +0200
+++ b/mercurial/context.py	Thu Jul 08 00:58:44 2021 +0200
@@ -1701,12 +1701,8 @@
                         % uipath(f)
                     )
                     rejected.append(f)
-                elif ds[f] in b'amn':
+                elif not ds.set_tracked(f):
                     ui.warn(_(b"%s already tracked!\n") % uipath(f))
-                elif ds[f] == b'r':
-                    ds.normallookup(f)
-                else:
-                    ds.add(f)
             return rejected
 
     def forget(self, files, prefix=b""):
--- a/mercurial/dirstate.py	Thu Jul 08 03:03:34 2021 +0200
+++ b/mercurial/dirstate.py	Thu Jul 08 00:58:44 2021 +0200
@@ -85,7 +85,7 @@
 
 def requires_no_parents_change(func):
     def wrap(self, *args, **kwargs):
-        if not self.pendingparentchange():
+        if self.pendingparentchange():
             msg = 'calling `%s` inside of a parentchange context'
             msg %= func.__name__
             raise error.ProgrammingError(msg)