##// END OF EJS Templates
revset: remove indirect indexing of status tuple...
Yuya Nishihara -
r45997:9b9071fa default
parent child Browse files
Show More
@@ -411,7 +411,7 b' def adds(repo, subset, x):'
411 411 """
412 412 # i18n: "adds" is a keyword
413 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 417 @predicate(b'ancestor(*changeset)', safe=True, weight=0.5)
@@ -681,12 +681,8 b' def bundle(repo, subset, x):'
681 681
682 682 def checkstatus(repo, subset, pat, field):
683 683 """Helper for status-related revsets (adds, removes, modifies).
684 The field parameter says which kind is desired:
685 0: modified
686 1: added
687 2: removed
684 The field parameter says which kind is desired.
688 685 """
689 label = {0: 'modified', 1: 'added', 2: 'removed'}[field]
690 686 hasset = matchmod.patkind(pat) == b'set'
691 687
692 688 mcache = [None]
@@ -707,7 +703,7 b' def checkstatus(repo, subset, pat, field'
707 703 else:
708 704 if not any(m(f) for f in c.files()):
709 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 707 if fname is not None:
712 708 if fname in files:
713 709 return True
@@ -715,7 +711,9 b' def checkstatus(repo, subset, pat, field'
715 711 if any(m(f) for f in files):
716 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 719 def _children(repo, subset, parentset):
@@ -1631,7 +1629,7 b' def modifies(repo, subset, x):'
1631 1629 """
1632 1630 # i18n: "modifies" is a keyword
1633 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 1635 @predicate(b'named(namespace)')
@@ -2090,7 +2088,7 b' def removes(repo, subset, x):'
2090 2088 """
2091 2089 # i18n: "removes" is a keyword
2092 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 2094 @predicate(b'rev(number)', safe=True)
General Comments 0
You need to be logged in to leave comments. Login now