comparison mercurial/fileset.py @ 31194:016c63d6658c

fileset: allow to specify a basectx for status This will be used for a predicates that defines the status range of a match.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 03 Mar 2017 14:08:06 +0100
parents 4140d49d2efb
children 6b098ac4542e
comparison
equal deleted inserted replaced
31193:4140d49d2efb 31194:016c63d6658c
564 564
565 def getfileset(ctx, expr): 565 def getfileset(ctx, expr):
566 tree = parse(expr) 566 tree = parse(expr)
567 return getset(fullmatchctx(ctx, _buildstatus(ctx, tree)), tree) 567 return getset(fullmatchctx(ctx, _buildstatus(ctx, tree)), tree)
568 568
569 def _buildstatus(ctx, tree): 569 def _buildstatus(ctx, tree, basectx=None):
570 # do we need status info? 570 # do we need status info?
571
572 # temporaty boolean to simplify the next conditional
573 purewdir = ctx.rev() is None and basectx is None
574
571 if (_intree(_statuscallers, tree) or 575 if (_intree(_statuscallers, tree) or
572 # Using matchctx.existing() on a workingctx requires us to check 576 # Using matchctx.existing() on a workingctx requires us to check
573 # for deleted files. 577 # for deleted files.
574 (ctx.rev() is None and _intree(_existingcallers, tree))): 578 (purewdir and _intree(_existingcallers, tree))):
575 unknown = _intree(['unknown'], tree) 579 unknown = _intree(['unknown'], tree)
576 ignored = _intree(['ignored'], tree) 580 ignored = _intree(['ignored'], tree)
577 581
578 r = ctx.repo() 582 r = ctx.repo()
579 return r.status(ctx.p1(), ctx, 583 if basectx is None:
584 basectx = ctx.p1()
585 return r.status(basectx, ctx,
580 unknown=unknown, ignored=ignored, clean=True) 586 unknown=unknown, ignored=ignored, clean=True)
581 else: 587 else:
582 return None 588 return None
583 589
584 def prettyformat(tree): 590 def prettyformat(tree):