dirstate-item: use `any_tracked` instead of `state` to apply patches
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 29 Sep 2021 15:40:13 +0200
changeset 48099 e0d566f3ffce
parent 48098 ba79d99ec1ae
child 48100 571dd808c6c8
dirstate-item: use `any_tracked` instead of `state` to apply patches Differential Revision: https://phab.mercurial-scm.org/D11536
mercurial/patch.py
--- a/mercurial/patch.py	Wed Sep 29 15:39:33 2021 +0200
+++ b/mercurial/patch.py	Wed Sep 29 15:40:13 2021 +0200
@@ -550,7 +550,9 @@
         self.copied = []
 
     def _checkknown(self, fname):
-        if self.repo.dirstate[fname] == b'?' and self.exists(fname):
+        if not self.repo.dirstate.get_entry(fname).any_tracked and self.exists(
+            fname
+        ):
             raise PatchError(_(b'cannot patch %s: file is not tracked') % fname)
 
     def setfile(self, fname, data, mode, copysource):