dirstate-item: use `any_tracked` instead of `state` to apply patches
Differential Revision: https://phab.mercurial-scm.org/D11536
--- 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):