436 p = mctx.ctx[f].parents() |
437 p = mctx.ctx[f].parents() |
437 if p and p[0].path() != f: |
438 if p and p[0].path() != f: |
438 s.append(f) |
439 s.append(f) |
439 return s |
440 return s |
440 |
441 |
|
442 @predicate('revs(revs, pattern)') |
|
443 def revs(mctx, x): |
|
444 """``revs(set, revspec)`` |
|
445 |
|
446 Evaluate set in the specified revisions. If the revset match multiple revs, |
|
447 this will return file matching pattern in any of the revision. |
|
448 """ |
|
449 # i18n: "revs" is a keyword |
|
450 r, x = getargs(x, 2, 2, _("revs takes two arguments")) |
|
451 # i18n: "revs" is a keyword |
|
452 revspec = getstring(r, _("first argument to revs must be a revision")) |
|
453 repo = mctx.ctx.repo() |
|
454 revs = scmutil.revrange(repo, [revspec]) |
|
455 |
|
456 found = set() |
|
457 result = [] |
|
458 for r in revs: |
|
459 ctx = repo[r] |
|
460 for f in getset(mctx.switch(ctx, _buildstatus(ctx, x)), x): |
|
461 if f not in found: |
|
462 found.add(f) |
|
463 result.append(f) |
|
464 return result |
|
465 |
441 @predicate('subrepo([pattern])') |
466 @predicate('subrepo([pattern])') |
442 def subrepo(mctx, x): |
467 def subrepo(mctx, x): |
443 """Subrepositories whose paths match the given pattern. |
468 """Subrepositories whose paths match the given pattern. |
444 """ |
469 """ |
445 # i18n: "subrepo" is a keyword |
470 # i18n: "subrepo" is a keyword |
510 def switch(self, ctx, status=None): |
535 def switch(self, ctx, status=None): |
511 return fullmatchctx(ctx, status) |
536 return fullmatchctx(ctx, status) |
512 |
537 |
513 # filesets using matchctx.switch() |
538 # filesets using matchctx.switch() |
514 _switchcallers = [ |
539 _switchcallers = [ |
|
540 'revs', |
515 ] |
541 ] |
516 |
542 |
517 def _intree(funcs, tree): |
543 def _intree(funcs, tree): |
518 if isinstance(tree, tuple): |
544 if isinstance(tree, tuple): |
519 if tree[0] == 'func' and tree[1][0] == 'symbol': |
545 if tree[0] == 'func' and tree[1][0] == 'symbol': |