equal
deleted
inserted
replaced
409 relative to the current directory and match against a file or a |
409 relative to the current directory and match against a file or a |
410 directory. |
410 directory. |
411 """ |
411 """ |
412 # i18n: "adds" is a keyword |
412 # i18n: "adds" is a keyword |
413 pat = getstring(x, _(b"adds requires a pattern")) |
413 pat = getstring(x, _(b"adds requires a pattern")) |
414 return checkstatus(repo, subset, pat, 1) |
414 return checkstatus(repo, subset, pat, 'added') |
415 |
415 |
416 |
416 |
417 @predicate(b'ancestor(*changeset)', safe=True, weight=0.5) |
417 @predicate(b'ancestor(*changeset)', safe=True, weight=0.5) |
418 def ancestor(repo, subset, x): |
418 def ancestor(repo, subset, x): |
419 """A greatest common ancestor of the changesets. |
419 """A greatest common ancestor of the changesets. |
679 return subset & bundlerevs |
679 return subset & bundlerevs |
680 |
680 |
681 |
681 |
682 def checkstatus(repo, subset, pat, field): |
682 def checkstatus(repo, subset, pat, field): |
683 """Helper for status-related revsets (adds, removes, modifies). |
683 """Helper for status-related revsets (adds, removes, modifies). |
684 The field parameter says which kind is desired: |
684 The field parameter says which kind is desired. |
685 0: modified |
685 """ |
686 1: added |
|
687 2: removed |
|
688 """ |
|
689 label = {0: 'modified', 1: 'added', 2: 'removed'}[field] |
|
690 hasset = matchmod.patkind(pat) == b'set' |
686 hasset = matchmod.patkind(pat) == b'set' |
691 |
687 |
692 mcache = [None] |
688 mcache = [None] |
693 |
689 |
694 def matches(x): |
690 def matches(x): |
705 if fname not in c.files(): |
701 if fname not in c.files(): |
706 return False |
702 return False |
707 else: |
703 else: |
708 if not any(m(f) for f in c.files()): |
704 if not any(m(f) for f in c.files()): |
709 return False |
705 return False |
710 files = getattr(repo.status(c.p1().node(), c.node()), label) |
706 files = getattr(repo.status(c.p1().node(), c.node()), field) |
711 if fname is not None: |
707 if fname is not None: |
712 if fname in files: |
708 if fname in files: |
713 return True |
709 return True |
714 else: |
710 else: |
715 if any(m(f) for f in files): |
711 if any(m(f) for f in files): |
716 return True |
712 return True |
717 |
713 |
718 return subset.filter(matches, condrepr=(b'<status[%r] %r>', field, pat)) |
714 return subset.filter( |
|
715 matches, condrepr=(b'<status.%s %r>', pycompat.sysbytes(field), pat) |
|
716 ) |
719 |
717 |
720 |
718 |
721 def _children(repo, subset, parentset): |
719 def _children(repo, subset, parentset): |
722 if not parentset: |
720 if not parentset: |
723 return baseset() |
721 return baseset() |
1629 relative to the current directory and match against a file or a |
1627 relative to the current directory and match against a file or a |
1630 directory. |
1628 directory. |
1631 """ |
1629 """ |
1632 # i18n: "modifies" is a keyword |
1630 # i18n: "modifies" is a keyword |
1633 pat = getstring(x, _(b"modifies requires a pattern")) |
1631 pat = getstring(x, _(b"modifies requires a pattern")) |
1634 return checkstatus(repo, subset, pat, 0) |
1632 return checkstatus(repo, subset, pat, 'modified') |
1635 |
1633 |
1636 |
1634 |
1637 @predicate(b'named(namespace)') |
1635 @predicate(b'named(namespace)') |
1638 def named(repo, subset, x): |
1636 def named(repo, subset, x): |
1639 """The changesets in a given namespace. |
1637 """The changesets in a given namespace. |
2088 relative to the current directory and match against a file or a |
2086 relative to the current directory and match against a file or a |
2089 directory. |
2087 directory. |
2090 """ |
2088 """ |
2091 # i18n: "removes" is a keyword |
2089 # i18n: "removes" is a keyword |
2092 pat = getstring(x, _(b"removes requires a pattern")) |
2090 pat = getstring(x, _(b"removes requires a pattern")) |
2093 return checkstatus(repo, subset, pat, 2) |
2091 return checkstatus(repo, subset, pat, 'removed') |
2094 |
2092 |
2095 |
2093 |
2096 @predicate(b'rev(number)', safe=True) |
2094 @predicate(b'rev(number)', safe=True) |
2097 def rev(repo, subset, x): |
2095 def rev(repo, subset, x): |
2098 """Revision with the given numeric identifier.""" |
2096 """Revision with the given numeric identifier.""" |