D7570: match: resolve filesets against the passed `cwd`, not the current one
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Dec 11 01:46:20 EST 2019
martinvonz added a comment.
In D7570#111295 <https://phab.mercurial-scm.org/D7570#111295>, @yuja wrote:
>> 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.
Do you think this patch is making it worse or can we leave it as is for now and let someone who cares about subrepos fix it?
>> 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.
Good idea, I've updated Matt's patch with that suggestion.
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: hooper, yuja, martinvonz, mercurial-devel
More information about the Mercurial-devel
mailing list