# HG changeset patch # User Pierre-Yves David # Date 1632922813 -7200 # Node ID e0d566f3ffce92ff66bae7c3ff2b7cf17f68e2b2 # Parent ba79d99ec1ae391f599432c06ad37e9ae906f70c dirstate-item: use `any_tracked` instead of `state` to apply patches Differential Revision: https://phab.mercurial-scm.org/D11536 diff -r ba79d99ec1ae -r e0d566f3ffce 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):