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

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Fri Dec 6 23:56:49 EST 2019


yuja added a comment.


  >   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.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7570/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7570

To: mharbison72, #hg-reviewers
Cc: yuja, martinvonz, mercurial-devel


More information about the Mercurial-devel mailing list