# HG changeset patch # User Martin von Zweigbergk # Date 2018-06-11 17:05:23 # Node ID aaed058a03901afcb4e7832b51cabe8e5ba6c021 # Parent fa4a286410a5992e4018cca643ac8e06640c3e16 context: make workingctx.matches() filter our removed files (API) It seems surprising that workingctx.matches() includes files that had been removed in the working copy. The callers don't want that either (besides the `hg locate` that was changed in the previous patch). The only observable difference that I'm aware of is that `hg log -T 'wdir()' -r '{files(...)}'` will no longer include removed files (an improvement, IMO). That matches `hg files` (but does not match the deprecated `hg locate`). Differential Revision: https://phab.mercurial-scm.org/D3711 diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1227,7 +1227,8 @@ class committablectx(basectx): unknown=True, ignored=False)) def matches(self, match): - return sorted(self._repo.dirstate.matches(match)) + ds = self._repo.dirstate + return sorted(f for f in ds.matches(match) if ds[f] != 'r') def ancestors(self): for p in self._parents: diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -4344,6 +4344,12 @@ Test files function 0 + $ hg rm a + $ hg log -r "wdir()" -T "{rev}\n{join(files('*'), '\n')}\n" + 2147483647 + aa + b + $ hg revert a Test relpath function