Mercurial > public > mercurial-scm > hg-stable
diff mercurial/match.py @ 44012:e685fac56693
match: resolve filesets against the passed `cwd`, not the current one
This allows filesets to be resolved relative to `repo.root`, the same as other
patterns are since f02d3c0eed18. The current example in contrib/ wasn't working
from the tests directory because of this.
Differential Revision: https://phab.mercurial-scm.org/D7570
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 06 Dec 2019 20:40:02 -0500 |
parents | d9d78e70149a |
children | 3bd77c64bc74 |
line wrap: on
line diff
--- a/mercurial/match.py Thu Dec 12 14:28:31 2019 -0800 +++ b/mercurial/match.py Fri Dec 06 20:40:02 2019 -0500 @@ -57,7 +57,7 @@ return m.match -def _expandsets(kindpats, ctx=None, listsubrepos=False, badfn=None): +def _expandsets(cwd, kindpats, ctx=None, listsubrepos=False, badfn=None): '''Returns the kindpats list with the 'set' patterns expanded to matchers''' matchers = [] other = [] @@ -68,11 +68,11 @@ raise error.ProgrammingError( b"fileset expression with no context" ) - matchers.append(ctx.matchfileset(pat, badfn=badfn)) + matchers.append(ctx.matchfileset(cwd, pat, badfn=badfn)) if listsubrepos: for subpath in ctx.substate: - sm = ctx.sub(subpath).matchfileset(pat, badfn=badfn) + sm = ctx.sub(subpath).matchfileset(cwd, pat, badfn=badfn) pm = prefixdirmatcher(subpath, sm, badfn=badfn) matchers.append(pm) @@ -117,11 +117,11 @@ def _buildkindpatsmatcher( - matchercls, root, kindpats, ctx=None, listsubrepos=False, badfn=None + matchercls, root, cwd, kindpats, ctx=None, listsubrepos=False, badfn=None, ): matchers = [] fms, kindpats = _expandsets( - kindpats, ctx=ctx, listsubrepos=listsubrepos, badfn=badfn + cwd, kindpats, ctx=ctx, listsubrepos=listsubrepos, badfn=badfn, ) if kindpats: m = matchercls(root, kindpats, badfn=badfn) @@ -261,6 +261,7 @@ m = _buildkindpatsmatcher( patternmatcher, root, + cwd, kindpats, ctx=ctx, listsubrepos=listsubrepos, @@ -276,6 +277,7 @@ im = _buildkindpatsmatcher( includematcher, root, + cwd, kindpats, ctx=ctx, listsubrepos=listsubrepos, @@ -287,6 +289,7 @@ em = _buildkindpatsmatcher( includematcher, root, + cwd, kindpats, ctx=ctx, listsubrepos=listsubrepos,