[Commented On] D11014: context: use `dirstate.set_tracked` in `context.add`

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Thu Jul 15 16:05:19 UTC 2021


baymax added a comment.
baymax updated this revision to Diff 29250.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11014?vs=29159&id=29250

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11014/new/

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

AFFECTED FILES
  mercurial/context.py
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -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)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -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""):



To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210715/8e9e9f56/attachment-0002.html>


More information about the Mercurial-patches mailing list