D7570: match: resolve filesets against the passed `cwd`, not the current one

Yuya Nishihara yuya at tcha.org
Fri Dec 6 23:19:51 EST 2019


>              if listsubrepos:
>                  for subpath in ctx.substate:
> -                    sm = ctx.sub(subpath).matchfileset(pat, badfn=badfn)
> +                    sm = ctx.sub(subpath).matchfileset(
> +                        pat, badfn=badfn, cwd=cwd
> +                    )

Might have to adjust cwd since it may be relative to the parent's repo.root.

>  class matchctx(object):
> -    def __init__(self, basectx, ctx, badfn=None):
> +    def __init__(self, basectx, ctx, badfn=None, cwd=None):
>          self._basectx = basectx
>          self.ctx = ctx
>          self._badfn = badfn
>          self._match = None
>          self._status = None
> +        self.cwd = cwd
>  
>      def narrowed(self, match):
>          """Create matchctx for a sub-tree narrowed by the given matcher"""

Perhaps self.cwd would have to be copied to the matchctx objects created
by itself.

One option to detect this kind of bugs is to remove the default parameters.


More information about the Mercurial-devel mailing list