Show More
@@ -555,15 +555,16 b' methods = {' | |||||
555 | } |
|
555 | } | |
556 |
|
556 | |||
557 | class matchctx(object): |
|
557 | class matchctx(object): | |
558 | def __init__(self, ctx, subset, status=None): |
|
558 | def __init__(self, ctx, subset, status=None, badfn=None): | |
559 | self.ctx = ctx |
|
559 | self.ctx = ctx | |
560 | self.subset = subset |
|
560 | self.subset = subset | |
561 | self._status = status |
|
561 | self._status = status | |
|
562 | self._badfn = badfn | |||
562 | self._existingenabled = False |
|
563 | self._existingenabled = False | |
563 | def status(self): |
|
564 | def status(self): | |
564 | return self._status |
|
565 | return self._status | |
565 | def matcher(self, patterns): |
|
566 | def matcher(self, patterns): | |
566 | return self.ctx.match(patterns) |
|
567 | return self.ctx.match(patterns, badfn=self._badfn) | |
567 | def filter(self, files): |
|
568 | def filter(self, files): | |
568 | return [f for f in files if f in self.subset] |
|
569 | return [f for f in files if f in self.subset] | |
569 | def existing(self): |
|
570 | def existing(self): | |
@@ -578,19 +579,19 b' class matchctx(object):' | |||||
578 | return (f for f in self.subset |
|
579 | return (f for f in self.subset | |
579 | if (f in self.ctx and f not in removed) or f in unknown) |
|
580 | if (f in self.ctx and f not in removed) or f in unknown) | |
580 | def narrow(self, files): |
|
581 | def narrow(self, files): | |
581 | return matchctx(self.ctx, self.filter(files), self._status) |
|
582 | return matchctx(self.ctx, self.filter(files), self._status, self._badfn) | |
582 | def switch(self, ctx, status=None): |
|
583 | def switch(self, ctx, status=None): | |
583 | subset = self.filter(_buildsubset(ctx, status)) |
|
584 | subset = self.filter(_buildsubset(ctx, status)) | |
584 | return matchctx(ctx, subset, status) |
|
585 | return matchctx(ctx, subset, status, self._badfn) | |
585 |
|
586 | |||
586 | class fullmatchctx(matchctx): |
|
587 | class fullmatchctx(matchctx): | |
587 | """A match context where any files in any revisions should be valid""" |
|
588 | """A match context where any files in any revisions should be valid""" | |
588 |
|
589 | |||
589 | def __init__(self, ctx, status=None): |
|
590 | def __init__(self, ctx, status=None, badfn=None): | |
590 | subset = _buildsubset(ctx, status) |
|
591 | subset = _buildsubset(ctx, status) | |
591 | super(fullmatchctx, self).__init__(ctx, subset, status) |
|
592 | super(fullmatchctx, self).__init__(ctx, subset, status, badfn) | |
592 | def switch(self, ctx, status=None): |
|
593 | def switch(self, ctx, status=None): | |
593 | return fullmatchctx(ctx, status) |
|
594 | return fullmatchctx(ctx, status, self._badfn) | |
594 |
|
595 | |||
595 | # filesets using matchctx.switch() |
|
596 | # filesets using matchctx.switch() | |
596 | _switchcallers = [ |
|
597 | _switchcallers = [ | |
@@ -624,7 +625,7 b' def match(ctx, expr, badfn=None):' | |||||
624 | """Create a matcher for a single fileset expression""" |
|
625 | """Create a matcher for a single fileset expression""" | |
625 | repo = ctx.repo() |
|
626 | repo = ctx.repo() | |
626 | tree = parse(expr) |
|
627 | tree = parse(expr) | |
627 | fset = getset(fullmatchctx(ctx, _buildstatus(ctx, tree)), tree) |
|
628 | fset = getset(fullmatchctx(ctx, _buildstatus(ctx, tree), badfn=badfn), tree) | |
628 | return matchmod.predicatematcher(repo.root, repo.getcwd(), |
|
629 | return matchmod.predicatematcher(repo.root, repo.getcwd(), | |
629 | fset.__contains__, |
|
630 | fset.__contains__, | |
630 | predrepr='fileset', badfn=badfn) |
|
631 | predrepr='fileset', badfn=badfn) |
General Comments 0
You need to be logged in to leave comments.
Login now