Show More
@@ -430,7 +430,12 b' class matchctx(object):' | |||||
430 | def filter(self, files): |
|
430 | def filter(self, files): | |
431 | return [f for f in files if f in self.subset] |
|
431 | return [f for f in files if f in self.subset] | |
432 | def existing(self): |
|
432 | def existing(self): | |
433 | return (f for f in self.subset if f in self.ctx) |
|
433 | if self._status is not None: | |
|
434 | removed = set(self._status[3]) | |||
|
435 | else: | |||
|
436 | removed = set() | |||
|
437 | return (f for f in self.subset | |||
|
438 | if f in self.ctx and f not in removed) | |||
434 | def narrow(self, files): |
|
439 | def narrow(self, files): | |
435 | return matchctx(self.ctx, self.filter(files), self._status) |
|
440 | return matchctx(self.ctx, self.filter(files), self._status) | |
436 |
|
441 | |||
@@ -444,14 +449,26 b' def _intree(funcs, tree):' | |||||
444 | return True |
|
449 | return True | |
445 | return False |
|
450 | return False | |
446 |
|
451 | |||
|
452 | # filesets using matchctx.existing() | |||
|
453 | _existingcallers = [ | |||
|
454 | 'binary', | |||
|
455 | 'exec', | |||
|
456 | 'grep', | |||
|
457 | 'size', | |||
|
458 | 'symlink', | |||
|
459 | ] | |||
|
460 | ||||
447 | def getfileset(ctx, expr): |
|
461 | def getfileset(ctx, expr): | |
448 | tree, pos = parse(expr) |
|
462 | tree, pos = parse(expr) | |
449 | if (pos != len(expr)): |
|
463 | if (pos != len(expr)): | |
450 | raise error.ParseError(_("invalid token"), pos) |
|
464 | raise error.ParseError(_("invalid token"), pos) | |
451 |
|
465 | |||
452 | # do we need status info? |
|
466 | # do we need status info? | |
453 | if _intree(['modified', 'added', 'removed', 'deleted', |
|
467 | if (_intree(['modified', 'added', 'removed', 'deleted', | |
454 |
'unknown', 'ignored', 'clean'], tree) |
|
468 | 'unknown', 'ignored', 'clean'], tree) or | |
|
469 | # Using matchctx.existing() on a workingctx requires us to check | |||
|
470 | # for deleted files. | |||
|
471 | (ctx.rev() is None and _intree(_existingcallers, tree))): | |||
455 | unknown = _intree(['unknown'], tree) |
|
472 | unknown = _intree(['unknown'], tree) | |
456 | ignored = _intree(['ignored'], tree) |
|
473 | ignored = _intree(['ignored'], tree) | |
457 |
|
474 |
General Comments 0
You need to be logged in to leave comments.
Login now