Show More
@@ -600,7 +600,8 b' def author(repo, subset, x):' | |||||
600 | # i18n: "author" is a keyword |
|
600 | # i18n: "author" is a keyword | |
601 | n = encoding.lower(getstring(x, _("author requires a string"))) |
|
601 | n = encoding.lower(getstring(x, _("author requires a string"))) | |
602 | kind, pattern, matcher = _substringmatcher(n) |
|
602 | kind, pattern, matcher = _substringmatcher(n) | |
603 |
return subset.filter(lambda x: matcher(encoding.lower(repo[x].user())) |
|
603 | return subset.filter(lambda x: matcher(encoding.lower(repo[x].user())), | |
|
604 | condrepr=('<user %r>', n)) | |||
604 |
|
605 | |||
605 | @predicate('bisect(string)', safe=True) |
|
606 | @predicate('bisect(string)', safe=True) | |
606 | def bisect(repo, subset, x): |
|
607 | def bisect(repo, subset, x): | |
@@ -686,19 +687,22 b' def branch(repo, subset, x):' | |||||
686 | # note: falls through to the revspec case if no branch with |
|
687 | # note: falls through to the revspec case if no branch with | |
687 | # this name exists and pattern kind is not specified explicitly |
|
688 | # this name exists and pattern kind is not specified explicitly | |
688 | if pattern in repo.branchmap(): |
|
689 | if pattern in repo.branchmap(): | |
689 |
return subset.filter(lambda r: matcher(getbi(r)[0]) |
|
690 | return subset.filter(lambda r: matcher(getbi(r)[0]), | |
|
691 | condrepr=('<branch %r>', b)) | |||
690 | if b.startswith('literal:'): |
|
692 | if b.startswith('literal:'): | |
691 | raise error.RepoLookupError(_("branch '%s' does not exist") |
|
693 | raise error.RepoLookupError(_("branch '%s' does not exist") | |
692 | % pattern) |
|
694 | % pattern) | |
693 | else: |
|
695 | else: | |
694 |
return subset.filter(lambda r: matcher(getbi(r)[0]) |
|
696 | return subset.filter(lambda r: matcher(getbi(r)[0]), | |
|
697 | condrepr=('<branch %r>', b)) | |||
695 |
|
698 | |||
696 | s = getset(repo, fullreposet(repo), x) |
|
699 | s = getset(repo, fullreposet(repo), x) | |
697 | b = set() |
|
700 | b = set() | |
698 | for r in s: |
|
701 | for r in s: | |
699 | b.add(getbi(r)[0]) |
|
702 | b.add(getbi(r)[0]) | |
700 | c = s.__contains__ |
|
703 | c = s.__contains__ | |
701 |
return subset.filter(lambda r: c(r) or getbi(r)[0] in b |
|
704 | return subset.filter(lambda r: c(r) or getbi(r)[0] in b, | |
|
705 | condrepr=lambda: '<branch %r>' % sorted(b)) | |||
702 |
|
706 | |||
703 | @predicate('bumped()', safe=True) |
|
707 | @predicate('bumped()', safe=True) | |
704 | def bumped(repo, subset, x): |
|
708 | def bumped(repo, subset, x): | |
@@ -753,7 +757,7 b' def checkstatus(repo, subset, pat, field' | |||||
753 | if m(f): |
|
757 | if m(f): | |
754 | return True |
|
758 | return True | |
755 |
|
759 | |||
756 | return subset.filter(matches) |
|
760 | return subset.filter(matches, condrepr=('<status[%r] %r>', field, pat)) | |
757 |
|
761 | |||
758 | def _children(repo, narrow, parentset): |
|
762 | def _children(repo, narrow, parentset): | |
759 | if not parentset: |
|
763 | if not parentset: | |
@@ -785,7 +789,8 b' def closed(repo, subset, x):' | |||||
785 | """ |
|
789 | """ | |
786 | # i18n: "closed" is a keyword |
|
790 | # i18n: "closed" is a keyword | |
787 | getargs(x, 0, 0, _("closed takes no arguments")) |
|
791 | getargs(x, 0, 0, _("closed takes no arguments")) | |
788 |
return subset.filter(lambda r: repo[r].closesbranch() |
|
792 | return subset.filter(lambda r: repo[r].closesbranch(), | |
|
793 | condrepr='<branch closed>') | |||
789 |
|
794 | |||
790 | @predicate('contains(pattern)') |
|
795 | @predicate('contains(pattern)') | |
791 | def contains(repo, subset, x): |
|
796 | def contains(repo, subset, x): | |
@@ -812,7 +817,7 b' def contains(repo, subset, x):' | |||||
812 | return True |
|
817 | return True | |
813 | return False |
|
818 | return False | |
814 |
|
819 | |||
815 | return subset.filter(matches) |
|
820 | return subset.filter(matches, condrepr=('<contains %r>', pat)) | |
816 |
|
821 | |||
817 | @predicate('converted([id])', safe=True) |
|
822 | @predicate('converted([id])', safe=True) | |
818 | def converted(repo, subset, x): |
|
823 | def converted(repo, subset, x): | |
@@ -834,7 +839,8 b' def converted(repo, subset, x):' | |||||
834 | source = repo[r].extra().get('convert_revision', None) |
|
839 | source = repo[r].extra().get('convert_revision', None) | |
835 | return source is not None and (rev is None or source.startswith(rev)) |
|
840 | return source is not None and (rev is None or source.startswith(rev)) | |
836 |
|
841 | |||
837 |
return subset.filter(lambda r: _matchvalue(r) |
|
842 | return subset.filter(lambda r: _matchvalue(r), | |
|
843 | condrepr=('<converted %r>', rev)) | |||
838 |
|
844 | |||
839 | @predicate('date(interval)', safe=True) |
|
845 | @predicate('date(interval)', safe=True) | |
840 | def date(repo, subset, x): |
|
846 | def date(repo, subset, x): | |
@@ -843,7 +849,8 b' def date(repo, subset, x):' | |||||
843 | # i18n: "date" is a keyword |
|
849 | # i18n: "date" is a keyword | |
844 | ds = getstring(x, _("date requires a string")) |
|
850 | ds = getstring(x, _("date requires a string")) | |
845 | dm = util.matchdate(ds) |
|
851 | dm = util.matchdate(ds) | |
846 |
return subset.filter(lambda x: dm(repo[x].date()[0]) |
|
852 | return subset.filter(lambda x: dm(repo[x].date()[0]), | |
|
853 | condrepr=('<date %r>', ds)) | |||
847 |
|
854 | |||
848 | @predicate('desc(string)', safe=True) |
|
855 | @predicate('desc(string)', safe=True) | |
849 | def desc(repo, subset, x): |
|
856 | def desc(repo, subset, x): | |
@@ -856,7 +863,7 b' def desc(repo, subset, x):' | |||||
856 | c = repo[x] |
|
863 | c = repo[x] | |
857 | return ds in encoding.lower(c.description()) |
|
864 | return ds in encoding.lower(c.description()) | |
858 |
|
865 | |||
859 | return subset.filter(matches) |
|
866 | return subset.filter(matches, condrepr=('<desc %r>', ds)) | |
860 |
|
867 | |||
861 | def _descendants(repo, subset, x, followfirst=False): |
|
868 | def _descendants(repo, subset, x, followfirst=False): | |
862 | roots = getset(repo, fullreposet(repo), x) |
|
869 | roots = getset(repo, fullreposet(repo), x) | |
@@ -931,7 +938,8 b' def destination(repo, subset, x):' | |||||
931 | r = src |
|
938 | r = src | |
932 | src = _getrevsource(repo, r) |
|
939 | src = _getrevsource(repo, r) | |
933 |
|
940 | |||
934 |
return subset.filter(dests.__contains__ |
|
941 | return subset.filter(dests.__contains__, | |
|
942 | condrepr=lambda: '<destination %r>' % sorted(dests)) | |||
935 |
|
943 | |||
936 | @predicate('divergent()', safe=True) |
|
944 | @predicate('divergent()', safe=True) | |
937 | def divergent(repo, subset, x): |
|
945 | def divergent(repo, subset, x): | |
@@ -980,7 +988,8 b' def extra(repo, subset, x):' | |||||
980 | extra = repo[r].extra() |
|
988 | extra = repo[r].extra() | |
981 | return label in extra and (value is None or matcher(extra[label])) |
|
989 | return label in extra and (value is None or matcher(extra[label])) | |
982 |
|
990 | |||
983 |
return subset.filter(lambda r: _matchvalue(r) |
|
991 | return subset.filter(lambda r: _matchvalue(r), | |
|
992 | condrepr=('<extra[%r] %r>', label, value)) | |||
984 |
|
993 | |||
985 | @predicate('filelog(pattern)', safe=True) |
|
994 | @predicate('filelog(pattern)', safe=True) | |
986 | def filelog(repo, subset, x): |
|
995 | def filelog(repo, subset, x): | |
@@ -1118,7 +1127,7 b' def grep(repo, subset, x):' | |||||
1118 | return True |
|
1127 | return True | |
1119 | return False |
|
1128 | return False | |
1120 |
|
1129 | |||
1121 | return subset.filter(matches) |
|
1130 | return subset.filter(matches, condrepr=('<grep %r>', gr.pattern)) | |
1122 |
|
1131 | |||
1123 | @predicate('_matchfiles', safe=True) |
|
1132 | @predicate('_matchfiles', safe=True) | |
1124 | def _matchfiles(repo, subset, x): |
|
1133 | def _matchfiles(repo, subset, x): | |
@@ -1179,7 +1188,10 b' def _matchfiles(repo, subset, x):' | |||||
1179 | return True |
|
1188 | return True | |
1180 | return False |
|
1189 | return False | |
1181 |
|
1190 | |||
1182 |
return subset.filter(matches |
|
1191 | return subset.filter(matches, | |
|
1192 | condrepr=('<matchfiles patterns=%r, include=%r ' | |||
|
1193 | 'exclude=%r, default=%r, rev=%r>', | |||
|
1194 | pats, inc, exc, default, rev)) | |||
1183 |
|
1195 | |||
1184 | @predicate('file(pattern)', safe=True) |
|
1196 | @predicate('file(pattern)', safe=True) | |
1185 | def hasfile(repo, subset, x): |
|
1197 | def hasfile(repo, subset, x): | |
@@ -1240,7 +1252,7 b' def keyword(repo, subset, x):' | |||||
1240 | return any(kw in encoding.lower(t) |
|
1252 | return any(kw in encoding.lower(t) | |
1241 | for t in c.files() + [c.user(), c.description()]) |
|
1253 | for t in c.files() + [c.user(), c.description()]) | |
1242 |
|
1254 | |||
1243 | return subset.filter(matches) |
|
1255 | return subset.filter(matches, condrepr=('<keyword %r>', kw)) | |
1244 |
|
1256 | |||
1245 | @predicate('limit(set[, n[, offset]])', safe=True) |
|
1257 | @predicate('limit(set[, n[, offset]])', safe=True) | |
1246 | def limit(repo, subset, x): |
|
1258 | def limit(repo, subset, x): | |
@@ -1326,7 +1338,8 b' def merge(repo, subset, x):' | |||||
1326 | # i18n: "merge" is a keyword |
|
1338 | # i18n: "merge" is a keyword | |
1327 | getargs(x, 0, 0, _("merge takes no arguments")) |
|
1339 | getargs(x, 0, 0, _("merge takes no arguments")) | |
1328 | cl = repo.changelog |
|
1340 | cl = repo.changelog | |
1329 |
return subset.filter(lambda r: cl.parentrevs(r)[1] != -1 |
|
1341 | return subset.filter(lambda r: cl.parentrevs(r)[1] != -1, | |
|
1342 | condrepr='<merge>') | |||
1330 |
|
1343 | |||
1331 | @predicate('branchpoint()', safe=True) |
|
1344 | @predicate('branchpoint()', safe=True) | |
1332 | def branchpoint(repo, subset, x): |
|
1345 | def branchpoint(repo, subset, x): | |
@@ -1345,7 +1358,8 b' def branchpoint(repo, subset, x):' | |||||
1345 | for p in cl.parentrevs(r): |
|
1358 | for p in cl.parentrevs(r): | |
1346 | if p >= baserev: |
|
1359 | if p >= baserev: | |
1347 | parentscount[p - baserev] += 1 |
|
1360 | parentscount[p - baserev] += 1 | |
1348 |
return subset.filter(lambda r: parentscount[r - baserev] > 1 |
|
1361 | return subset.filter(lambda r: parentscount[r - baserev] > 1, | |
|
1362 | condrepr='<branchpoint>') | |||
1349 |
|
1363 | |||
1350 | @predicate('min(set)', safe=True) |
|
1364 | @predicate('min(set)', safe=True) | |
1351 | def minrev(repo, subset, x): |
|
1365 | def minrev(repo, subset, x): | |
@@ -1602,7 +1616,8 b' def _phase(repo, subset, target):' | |||||
1602 | else: |
|
1616 | else: | |
1603 | phase = repo._phasecache.phase |
|
1617 | phase = repo._phasecache.phase | |
1604 | condition = lambda r: phase(repo, r) == target |
|
1618 | condition = lambda r: phase(repo, r) == target | |
1605 |
return subset.filter(condition, c |
|
1619 | return subset.filter(condition, condrepr=('<phase %r>', target), | |
|
1620 | cache=False) | |||
1606 |
|
1621 | |||
1607 | @predicate('draft()', safe=True) |
|
1622 | @predicate('draft()', safe=True) | |
1608 | def draft(repo, subset, x): |
|
1623 | def draft(repo, subset, x): | |
@@ -1675,7 +1690,8 b' def _notpublic(repo, subset, x):' | |||||
1675 | phase = repo._phasecache.phase |
|
1690 | phase = repo._phasecache.phase | |
1676 | target = phases.public |
|
1691 | target = phases.public | |
1677 | condition = lambda r: phase(repo, r) != target |
|
1692 | condition = lambda r: phase(repo, r) != target | |
1678 |
return subset.filter(condition, c |
|
1693 | return subset.filter(condition, condrepr=('<phase %r>', target), | |
|
1694 | cache=False) | |||
1679 |
|
1695 | |||
1680 | @predicate('public()', safe=True) |
|
1696 | @predicate('public()', safe=True) | |
1681 | def public(repo, subset, x): |
|
1697 | def public(repo, subset, x): | |
@@ -1685,7 +1701,8 b' def public(repo, subset, x):' | |||||
1685 | phase = repo._phasecache.phase |
|
1701 | phase = repo._phasecache.phase | |
1686 | target = phases.public |
|
1702 | target = phases.public | |
1687 | condition = lambda r: phase(repo, r) == target |
|
1703 | condition = lambda r: phase(repo, r) == target | |
1688 |
return subset.filter(condition, c |
|
1704 | return subset.filter(condition, condrepr=('<phase %r>', target), | |
|
1705 | cache=False) | |||
1689 |
|
1706 | |||
1690 | @predicate('remote([id [,path]])', safe=True) |
|
1707 | @predicate('remote([id [,path]])', safe=True) | |
1691 | def remote(repo, subset, x): |
|
1708 | def remote(repo, subset, x): | |
@@ -1860,7 +1877,7 b' def matching(repo, subset, x):' | |||||
1860 | return True |
|
1877 | return True | |
1861 | return False |
|
1878 | return False | |
1862 |
|
1879 | |||
1863 | return subset.filter(matches) |
|
1880 | return subset.filter(matches, condrepr=('<matching%r %r>', fields, revs)) | |
1864 |
|
1881 | |||
1865 | @predicate('reverse(set)', safe=True) |
|
1882 | @predicate('reverse(set)', safe=True) | |
1866 | def reverse(repo, subset, x): |
|
1883 | def reverse(repo, subset, x): | |
@@ -1881,7 +1898,7 b' def roots(repo, subset, x):' | |||||
1881 | if 0 <= p and p in s: |
|
1898 | if 0 <= p and p in s: | |
1882 | return False |
|
1899 | return False | |
1883 | return True |
|
1900 | return True | |
1884 | return subset & s.filter(filter) |
|
1901 | return subset & s.filter(filter, condrepr='<roots>') | |
1885 |
|
1902 | |||
1886 | @predicate('sort(set[, [-]key...])', safe=True) |
|
1903 | @predicate('sort(set[, [-]key...])', safe=True) | |
1887 | def sort(repo, subset, x): |
|
1904 | def sort(repo, subset, x): | |
@@ -1988,7 +2005,7 b' def subrepo(repo, subset, x):' | |||||
1988 |
|
2005 | |||
1989 | return False |
|
2006 | return False | |
1990 |
|
2007 | |||
1991 | return subset.filter(matches) |
|
2008 | return subset.filter(matches, condrepr=('<subrepo %r>', pat)) | |
1992 |
|
2009 | |||
1993 | def _substringmatcher(pattern): |
|
2010 | def _substringmatcher(pattern): | |
1994 | kind, pattern, matcher = util.stringmatcher(pattern) |
|
2011 | kind, pattern, matcher = util.stringmatcher(pattern) |
@@ -545,14 +545,16 b' test ancestors' | |||||
545 | ('string', '\x08issue\\d+')) |
|
545 | ('string', '\x08issue\\d+')) | |
546 | * set: |
|
546 | * set: | |
547 | <filteredset |
|
547 | <filteredset | |
548 |
<fullreposet+ 0:9> |
|
548 | <fullreposet+ 0:9>, | |
|
549 | <grep '\x08issue\\d+'>> | |||
549 | $ try 'grep(r"\bissue\d+")' |
|
550 | $ try 'grep(r"\bissue\d+")' | |
550 | (func |
|
551 | (func | |
551 | ('symbol', 'grep') |
|
552 | ('symbol', 'grep') | |
552 | ('string', '\\bissue\\d+')) |
|
553 | ('string', '\\bissue\\d+')) | |
553 | * set: |
|
554 | * set: | |
554 | <filteredset |
|
555 | <filteredset | |
555 |
<fullreposet+ 0:9> |
|
556 | <fullreposet+ 0:9>, | |
|
557 | <grep '\\bissue\\d+'>> | |||
556 | 6 |
|
558 | 6 | |
557 | $ try 'grep(r"\")' |
|
559 | $ try 'grep(r"\")' | |
558 | hg: parse error at 7: unterminated string |
|
560 | hg: parse error at 7: unterminated string | |
@@ -1593,7 +1595,8 b' aliases:' | |||||
1593 | None) |
|
1595 | None) | |
1594 | * set: |
|
1596 | * set: | |
1595 | <filteredset |
|
1597 | <filteredset | |
1596 |
<fullreposet+ 0:9> |
|
1598 | <fullreposet+ 0:9>, | |
|
1599 | <merge>> | |||
1597 | 6 |
|
1600 | 6 | |
1598 |
|
1601 | |||
1599 | $ HGPLAIN=1 |
|
1602 | $ HGPLAIN=1 | |
@@ -1612,7 +1615,8 b' aliases:' | |||||
1612 | None) |
|
1615 | None) | |
1613 | * set: |
|
1616 | * set: | |
1614 | <filteredset |
|
1617 | <filteredset | |
1615 |
<fullreposet+ 0:9> |
|
1618 | <fullreposet+ 0:9>, | |
|
1619 | <merge>> | |||
1616 | 6 |
|
1620 | 6 | |
1617 |
|
1621 | |||
1618 | $ unset HGPLAIN |
|
1622 | $ unset HGPLAIN | |
@@ -1666,7 +1670,8 b' test alias recursion' | |||||
1666 | * set: |
|
1670 | * set: | |
1667 | <addset+ |
|
1671 | <addset+ | |
1668 | <filteredset |
|
1672 | <filteredset | |
1669 |
<fullreposet+ 0:9> |
|
1673 | <fullreposet+ 0:9>, | |
|
1674 | <merge>>, | |||
1670 | <generatorset+>> |
|
1675 | <generatorset+>> | |
1671 | 6 |
|
1676 | 6 | |
1672 | 7 |
|
1677 | 7 | |
@@ -1830,7 +1835,8 b' far away.' | |||||
1830 | <addset |
|
1835 | <addset | |
1831 | <baseset [9]>, |
|
1836 | <baseset [9]>, | |
1832 | <filteredset |
|
1837 | <filteredset | |
1833 |
<fullreposet+ 0:9> |
|
1838 | <fullreposet+ 0:9>, | |
|
1839 | <desc '$1'>>> | |||
1834 | 9 |
|
1840 | 9 | |
1835 |
|
1841 | |||
1836 | $ try 'd(2:5)' |
|
1842 | $ try 'd(2:5)' |
General Comments 0
You need to be logged in to leave comments.
Login now