##// END OF EJS Templates
fileset: exclude deleted files from matchctx.existing()...
Patrick Mezard -
r17365:8a0513bf stable
parent child Browse files
Show More
@@ -430,7 +430,12 b' class matchctx(object):'
430 430 def filter(self, files):
431 431 return [f for f in files if f in self.subset]
432 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 439 def narrow(self, files):
435 440 return matchctx(self.ctx, self.filter(files), self._status)
436 441
@@ -444,14 +449,26 b' def _intree(funcs, tree):'
444 449 return True
445 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 461 def getfileset(ctx, expr):
448 462 tree, pos = parse(expr)
449 463 if (pos != len(expr)):
450 464 raise error.ParseError(_("invalid token"), pos)
451 465
452 466 # do we need status info?
453 if _intree(['modified', 'added', 'removed', 'deleted',
454 'unknown', 'ignored', 'clean'], tree):
467 if (_intree(['modified', 'added', 'removed', 'deleted',
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 472 unknown = _intree(['unknown'], tree)
456 473 ignored = _intree(['ignored'], tree)
457 474
@@ -76,3 +76,8 b' Test files status'
76 76 $ fileset 'copied()'
77 77 c1
78 78
79 Test files properties
80
81 >>> file('bin', 'wb').write('\0a')
82 $ fileset 'binary()'
83
General Comments 0
You need to be logged in to leave comments. Login now