comparison mercurial/fileset.py @ 31190:2f881e7d1ade

fileset: build initial subset in fullmatchctx class
author Yuya Nishihara <yuya@tcha.org>
date Sat, 24 Jan 2015 18:56:02 +0900
parents 3c32a3fdfd16
children 3c3ab84e6e78
comparison
equal deleted inserted replaced
31189:3c32a3fdfd16 31190:2f881e7d1ade
472 'not': notset, 472 'not': notset,
473 'func': func, 473 'func': func,
474 } 474 }
475 475
476 class matchctx(object): 476 class matchctx(object):
477 def __init__(self, ctx, subset=None, status=None): 477 def __init__(self, ctx, subset, status=None):
478 self.ctx = ctx 478 self.ctx = ctx
479 self.subset = subset 479 self.subset = subset
480 self._status = status 480 self._status = status
481 self._existingenabled = False 481 self._existingenabled = False
482 def status(self): 482 def status(self):
499 return matchctx(self.ctx, self.filter(files), self._status) 499 return matchctx(self.ctx, self.filter(files), self._status)
500 500
501 class fullmatchctx(matchctx): 501 class fullmatchctx(matchctx):
502 """A match context where any files in any revisions should be valid""" 502 """A match context where any files in any revisions should be valid"""
503 503
504 def __init__(self, ctx, subset=None, status=None): 504 def __init__(self, ctx, status=None):
505 subset = _buildsubset(ctx, status)
505 super(fullmatchctx, self).__init__(ctx, subset, status) 506 super(fullmatchctx, self).__init__(ctx, subset, status)
506 507
507 def _intree(funcs, tree): 508 def _intree(funcs, tree):
508 if isinstance(tree, tuple): 509 if isinstance(tree, tuple):
509 if tree[0] == 'func' and tree[1][0] == 'symbol': 510 if tree[0] == 'func' and tree[1][0] == 'symbol':
538 status = r.status(ctx.p1(), ctx, 539 status = r.status(ctx.p1(), ctx,
539 unknown=unknown, ignored=ignored, clean=True) 540 unknown=unknown, ignored=ignored, clean=True)
540 else: 541 else:
541 status = None 542 status = None
542 543
543 subset = _buildsubset(ctx, status) 544 return getset(fullmatchctx(ctx, status), tree)
544 return getset(fullmatchctx(ctx, subset, status), tree)
545 545
546 def prettyformat(tree): 546 def prettyformat(tree):
547 return parser.prettyformat(tree, ('string', 'symbol')) 547 return parser.prettyformat(tree, ('string', 'symbol'))
548 548
549 def loadpredicate(ui, extname, registrarobj): 549 def loadpredicate(ui, extname, registrarobj):