##// 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 def adds(repo, subset, x):
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)
@@ -681,12 +681,8 def bundle(repo, subset, x):
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
686 1: added
687 2: removed
688 """
685 """
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]
@@ -707,7 +703,7 def checkstatus(repo, subset, pat, field
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
@@ -715,7 +711,9 def checkstatus(repo, subset, pat, field
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):
@@ -1631,7 +1629,7 def modifies(repo, subset, x):
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)')
@@ -2090,7 +2088,7 def removes(repo, subset, x):
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)
General Comments 0
You need to be logged in to leave comments. Login now