comparison mercurial/revset.py @ 20611:6490f8385391

revset: changed revset code to use filter method Revset methods now use the filter code to apply a condition.
author Lucas Moscovicz <lmoscovicz@fb.com>
date Thu, 06 Feb 2014 09:28:41 -0800
parents 34bb07e70c68
children 60c308b932eb
comparison
equal deleted inserted replaced
20610:34bb07e70c68 20611:6490f8385391
242 242
243 def dagrange(repo, subset, x, y): 243 def dagrange(repo, subset, x, y):
244 r = spanset(repo) 244 r = spanset(repo)
245 xs = _revsbetween(repo, getset(repo, r, x), getset(repo, r, y)) 245 xs = _revsbetween(repo, getset(repo, r, x), getset(repo, r, y))
246 s = subset.set() 246 s = subset.set()
247 return baseset([r for r in xs if r in s]) 247 return xs.filter(lambda r: r in s)
248 248
249 def andset(repo, subset, x, y): 249 def andset(repo, subset, x, y):
250 return getset(repo, getset(repo, subset, x), y) 250 return getset(repo, getset(repo, subset, x), y)
251 251
252 def orset(repo, subset, x, y): 252 def orset(repo, subset, x, y):
310 def _ancestors(repo, subset, x, followfirst=False): 310 def _ancestors(repo, subset, x, followfirst=False):
311 args = getset(repo, spanset(repo), x) 311 args = getset(repo, spanset(repo), x)
312 if not args: 312 if not args:
313 return baseset([]) 313 return baseset([])
314 s = set(_revancestors(repo, args, followfirst)) | set(args) 314 s = set(_revancestors(repo, args, followfirst)) | set(args)
315 return baseset([r for r in subset if r in s]) 315 return subset.filter(lambda r: r in s)
316 316
317 def ancestors(repo, subset, x): 317 def ancestors(repo, subset, x):
318 """``ancestors(set)`` 318 """``ancestors(set)``
319 Changesets that are ancestors of a changeset in set. 319 Changesets that are ancestors of a changeset in set.
320 """ 320 """
338 cl = repo.changelog 338 cl = repo.changelog
339 for r in getset(repo, baseset(cl), x): 339 for r in getset(repo, baseset(cl), x):
340 for i in range(n): 340 for i in range(n):
341 r = cl.parentrevs(r)[0] 341 r = cl.parentrevs(r)[0]
342 ps.add(r) 342 ps.add(r)
343 return baseset([r for r in subset if r in ps]) 343 return subset.filter(lambda r: r in ps)
344 344
345 def author(repo, subset, x): 345 def author(repo, subset, x):
346 """``author(string)`` 346 """``author(string)``
347 Alias for ``user(string)``. 347 Alias for ``user(string)``.
348 """ 348 """
349 # i18n: "author" is a keyword 349 # i18n: "author" is a keyword
350 n = encoding.lower(getstring(x, _("author requires a string"))) 350 n = encoding.lower(getstring(x, _("author requires a string")))
351 kind, pattern, matcher = _substringmatcher(n) 351 kind, pattern, matcher = _substringmatcher(n)
352 return lazyset(subset, lambda x: matcher(encoding.lower(repo[x].user()))) 352 return subset.filter(lambda x: matcher(encoding.lower(repo[x].user())))
353 353
354 def bisect(repo, subset, x): 354 def bisect(repo, subset, x):
355 """``bisect(string)`` 355 """``bisect(string)``
356 Changesets marked in the specified bisect status: 356 Changesets marked in the specified bisect status:
357 357
364 - ``current`` : the cset currently being bisected 364 - ``current`` : the cset currently being bisected
365 """ 365 """
366 # i18n: "bisect" is a keyword 366 # i18n: "bisect" is a keyword
367 status = getstring(x, _("bisect requires a string")).lower() 367 status = getstring(x, _("bisect requires a string")).lower()
368 state = set(hbisect.get(repo, status)) 368 state = set(hbisect.get(repo, status))
369 return baseset([r for r in subset if r in state]) 369 return subset.filter(lambda r: r in state)
370 370
371 # Backward-compatibility 371 # Backward-compatibility
372 # - no help entry so that we do not advertise it any more 372 # - no help entry so that we do not advertise it any more
373 def bisected(repo, subset, x): 373 def bisected(repo, subset, x):
374 return bisect(repo, subset, x) 374 return bisect(repo, subset, x)
391 if kind == 'literal': 391 if kind == 'literal':
392 bmrev = repo._bookmarks.get(bm, None) 392 bmrev = repo._bookmarks.get(bm, None)
393 if not bmrev: 393 if not bmrev:
394 raise util.Abort(_("bookmark '%s' does not exist") % bm) 394 raise util.Abort(_("bookmark '%s' does not exist") % bm)
395 bmrev = repo[bmrev].rev() 395 bmrev = repo[bmrev].rev()
396 return lazyset(subset, lambda r: r == bmrev) 396 return subset.filter(lambda r: r == bmrev)
397 else: 397 else:
398 matchrevs = set() 398 matchrevs = set()
399 for name, bmrev in repo._bookmarks.iteritems(): 399 for name, bmrev in repo._bookmarks.iteritems():
400 if matcher(name): 400 if matcher(name):
401 matchrevs.add(bmrev) 401 matchrevs.add(bmrev)
407 bmrevs.add(repo[bmrev].rev()) 407 bmrevs.add(repo[bmrev].rev())
408 return subset & bmrevs 408 return subset & bmrevs
409 409
410 bms = set([repo[r].rev() 410 bms = set([repo[r].rev()
411 for r in repo._bookmarks.values()]) 411 for r in repo._bookmarks.values()])
412 return lazyset(subset, lambda r: r in bms) 412 return subset.filter(lambda r: r in bms)
413 413
414 def branch(repo, subset, x): 414 def branch(repo, subset, x):
415 """``branch(string or set)`` 415 """``branch(string or set)``
416 All changesets belonging to the given branch or the branches of the given 416 All changesets belonging to the given branch or the branches of the given
417 changesets. 417 changesets.
429 kind, pattern, matcher = _stringmatcher(b) 429 kind, pattern, matcher = _stringmatcher(b)
430 if kind == 'literal': 430 if kind == 'literal':
431 # note: falls through to the revspec case if no branch with 431 # note: falls through to the revspec case if no branch with
432 # this name exists 432 # this name exists
433 if pattern in repo.branchmap(): 433 if pattern in repo.branchmap():
434 return lazyset(subset, lambda r: matcher(repo[r].branch())) 434 return subset.filter(lambda r: matcher(repo[r].branch()))
435 else: 435 else:
436 return lazyset(subset, lambda r: matcher(repo[r].branch())) 436 return subset.filter(lambda r: matcher(repo[r].branch()))
437 437
438 s = getset(repo, spanset(repo), x) 438 s = getset(repo, spanset(repo), x)
439 b = set() 439 b = set()
440 for r in s: 440 for r in s:
441 b.add(repo[r].branch()) 441 b.add(repo[r].branch())
442 s = s.set() 442 s = s.set()
443 return lazyset(subset, lambda r: r in s or repo[r].branch() in b) 443 return subset.filter(lambda r: r in s or repo[r].branch() in b)
444 444
445 def bumped(repo, subset, x): 445 def bumped(repo, subset, x):
446 """``bumped()`` 446 """``bumped()``
447 Mutable changesets marked as successors of public changesets. 447 Mutable changesets marked as successors of public changesets.
448 448
492 else: 492 else:
493 for f in files: 493 for f in files:
494 if m(f): 494 if m(f):
495 return True 495 return True
496 496
497 return lazyset(subset, matches) 497 return subset.filter(matches)
498 498
499 def _children(repo, narrow, parentset): 499 def _children(repo, narrow, parentset):
500 cs = set() 500 cs = set()
501 if not parentset: 501 if not parentset:
502 return baseset(cs) 502 return baseset(cs)
522 """``closed()`` 522 """``closed()``
523 Changeset is closed. 523 Changeset is closed.
524 """ 524 """
525 # i18n: "closed" is a keyword 525 # i18n: "closed" is a keyword
526 getargs(x, 0, 0, _("closed takes no arguments")) 526 getargs(x, 0, 0, _("closed takes no arguments"))
527 return lazyset(subset, lambda r: repo[r].closesbranch()) 527 return subset.filter(lambda r: repo[r].closesbranch())
528 528
529 def contains(repo, subset, x): 529 def contains(repo, subset, x):
530 """``contains(pattern)`` 530 """``contains(pattern)``
531 Revision contains a file matching pattern. See :hg:`help patterns` 531 Revision contains a file matching pattern. See :hg:`help patterns`
532 for information about file patterns. 532 for information about file patterns.
549 for f in c.manifest(): 549 for f in c.manifest():
550 if m(f): 550 if m(f):
551 return True 551 return True
552 return False 552 return False
553 553
554 return lazyset(subset, matches) 554 return subset.filter(matches)
555 555
556 def converted(repo, subset, x): 556 def converted(repo, subset, x):
557 """``converted([id])`` 557 """``converted([id])``
558 Changesets converted from the given identifier in the old repository if 558 Changesets converted from the given identifier in the old repository if
559 present, or all converted changesets if no identifier is specified. 559 present, or all converted changesets if no identifier is specified.
571 571
572 def _matchvalue(r): 572 def _matchvalue(r):
573 source = repo[r].extra().get('convert_revision', None) 573 source = repo[r].extra().get('convert_revision', None)
574 return source is not None and (rev is None or source.startswith(rev)) 574 return source is not None and (rev is None or source.startswith(rev))
575 575
576 return lazyset(subset, lambda r: _matchvalue(r)) 576 return subset.filter(lambda r: _matchvalue(r))
577 577
578 def date(repo, subset, x): 578 def date(repo, subset, x):
579 """``date(interval)`` 579 """``date(interval)``
580 Changesets within the interval, see :hg:`help dates`. 580 Changesets within the interval, see :hg:`help dates`.
581 """ 581 """
582 # i18n: "date" is a keyword 582 # i18n: "date" is a keyword
583 ds = getstring(x, _("date requires a string")) 583 ds = getstring(x, _("date requires a string"))
584 dm = util.matchdate(ds) 584 dm = util.matchdate(ds)
585 return lazyset(subset, lambda x: dm(repo[x].date()[0])) 585 return subset.filter(lambda x: dm(repo[x].date()[0]))
586 586
587 def desc(repo, subset, x): 587 def desc(repo, subset, x):
588 """``desc(string)`` 588 """``desc(string)``
589 Search commit message for string. The match is case-insensitive. 589 Search commit message for string. The match is case-insensitive.
590 """ 590 """
593 593
594 def matches(x): 594 def matches(x):
595 c = repo[x] 595 c = repo[x]
596 return ds in encoding.lower(c.description()) 596 return ds in encoding.lower(c.description())
597 597
598 return lazyset(subset, matches) 598 return subset.filter(matches)
599 599
600 def _descendants(repo, subset, x, followfirst=False): 600 def _descendants(repo, subset, x, followfirst=False):
601 args = getset(repo, spanset(repo), x) 601 args = getset(repo, spanset(repo), x)
602 if not args: 602 if not args:
603 return baseset([]) 603 return baseset([])
655 break 655 break
656 656
657 r = src 657 r = src
658 src = _getrevsource(repo, r) 658 src = _getrevsource(repo, r)
659 659
660 return baseset([r for r in subset if r in dests]) 660 return subset.filter(lambda r: r in dests)
661 661
662 def divergent(repo, subset, x): 662 def divergent(repo, subset, x):
663 """``divergent()`` 663 """``divergent()``
664 Final successors of changesets with an alternative set of final successors. 664 Final successors of changesets with an alternative set of final successors.
665 """ 665 """
666 # i18n: "divergent" is a keyword 666 # i18n: "divergent" is a keyword
667 getargs(x, 0, 0, _("divergent takes no arguments")) 667 getargs(x, 0, 0, _("divergent takes no arguments"))
668 divergent = obsmod.getrevs(repo, 'divergent') 668 divergent = obsmod.getrevs(repo, 'divergent')
669 return baseset([r for r in subset if r in divergent]) 669 return subset.filter(lambda r: r in divergent)
670 670
671 def draft(repo, subset, x): 671 def draft(repo, subset, x):
672 """``draft()`` 672 """``draft()``
673 Changeset in draft phase.""" 673 Changeset in draft phase."""
674 # i18n: "draft" is a keyword 674 # i18n: "draft" is a keyword
675 getargs(x, 0, 0, _("draft takes no arguments")) 675 getargs(x, 0, 0, _("draft takes no arguments"))
676 pc = repo._phasecache 676 pc = repo._phasecache
677 return lazyset(subset, lambda r: pc.phase(repo, r) == phases.draft) 677 return subset.filter(lambda r: pc.phase(repo, r) == phases.draft)
678 678
679 def extinct(repo, subset, x): 679 def extinct(repo, subset, x):
680 """``extinct()`` 680 """``extinct()``
681 Obsolete changesets with obsolete descendants only. 681 Obsolete changesets with obsolete descendants only.
682 """ 682 """
708 708
709 def _matchvalue(r): 709 def _matchvalue(r):
710 extra = repo[r].extra() 710 extra = repo[r].extra()
711 return label in extra and (value is None or matcher(extra[label])) 711 return label in extra and (value is None or matcher(extra[label]))
712 712
713 return lazyset(subset, lambda r: _matchvalue(r)) 713 return subset.filter(lambda r: _matchvalue(r))
714 714
715 def filelog(repo, subset, x): 715 def filelog(repo, subset, x):
716 """``filelog(pattern)`` 716 """``filelog(pattern)``
717 Changesets connected to the specified filelog. 717 Changesets connected to the specified filelog.
718 718
740 if m(f): 740 if m(f):
741 fl = repo.file(f) 741 fl = repo.file(f)
742 for fr in fl: 742 for fr in fl:
743 s.add(fl.linkrev(fr)) 743 s.add(fl.linkrev(fr))
744 744
745 return baseset([r for r in subset if r in s]) 745 return subset.filter(lambda r: r in s)
746 746
747 def first(repo, subset, x): 747 def first(repo, subset, x):
748 """``first(set, [n])`` 748 """``first(set, [n])``
749 An alias for limit(). 749 An alias for limit().
750 """ 750 """
763 else: 763 else:
764 return baseset([]) 764 return baseset([])
765 else: 765 else:
766 s = set(_revancestors(repo, [c.rev()], followfirst)) | set([c.rev()]) 766 s = set(_revancestors(repo, [c.rev()], followfirst)) | set([c.rev()])
767 767
768 return baseset([r for r in subset if r in s]) 768 return subset.filter(lambda r: r in s)
769 769
770 def follow(repo, subset, x): 770 def follow(repo, subset, x):
771 """``follow([file])`` 771 """``follow([file])``
772 An alias for ``::.`` (ancestors of the working copy's first parent). 772 An alias for ``::.`` (ancestors of the working copy's first parent).
773 If a filename is specified, the history of the given file is followed, 773 If a filename is specified, the history of the given file is followed,
806 for e in c.files() + [c.user(), c.description()]: 806 for e in c.files() + [c.user(), c.description()]:
807 if gr.search(e): 807 if gr.search(e):
808 return True 808 return True
809 return False 809 return False
810 810
811 return lazyset(subset, matches) 811 return subset.filter(matches)
812 812
813 def _matchfiles(repo, subset, x): 813 def _matchfiles(repo, subset, x):
814 # _matchfiles takes a revset list of prefixed arguments: 814 # _matchfiles takes a revset list of prefixed arguments:
815 # 815 #
816 # [p:foo, i:bar, x:baz] 816 # [p:foo, i:bar, x:baz]
870 for f in c.files(): 870 for f in c.files():
871 if m(f): 871 if m(f):
872 return True 872 return True
873 return False 873 return False
874 874
875 return lazyset(subset, matches) 875 return subset.filter(matches)
876 876
877 def hasfile(repo, subset, x): 877 def hasfile(repo, subset, x):
878 """``file(pattern)`` 878 """``file(pattern)``
879 Changesets affecting files matched by pattern. 879 Changesets affecting files matched by pattern.
880 880
894 # i18n: "head" is a keyword 894 # i18n: "head" is a keyword
895 getargs(x, 0, 0, _("head takes no arguments")) 895 getargs(x, 0, 0, _("head takes no arguments"))
896 hs = set() 896 hs = set()
897 for b, ls in repo.branchmap().iteritems(): 897 for b, ls in repo.branchmap().iteritems():
898 hs.update(repo[h].rev() for h in ls) 898 hs.update(repo[h].rev() for h in ls)
899 return baseset([r for r in subset if r in hs]) 899 return subset.filter(lambda r: r in hs)
900 900
901 def heads(repo, subset, x): 901 def heads(repo, subset, x):
902 """``heads(set)`` 902 """``heads(set)``
903 Members of set with no children in set. 903 Members of set with no children in set.
904 """ 904 """
926 def matches(r): 926 def matches(r):
927 c = repo[r] 927 c = repo[r]
928 return util.any(kw in encoding.lower(t) for t in c.files() + [c.user(), 928 return util.any(kw in encoding.lower(t) for t in c.files() + [c.user(),
929 c.description()]) 929 c.description()])
930 930
931 return lazyset(subset, matches) 931 return subset.filter(matches)
932 932
933 def limit(repo, subset, x): 933 def limit(repo, subset, x):
934 """``limit(set, [n])`` 934 """``limit(set, [n])``
935 First n members of set, defaulting to 1. 935 First n members of set, defaulting to 1.
936 """ 936 """
1001 Changeset is a merge changeset. 1001 Changeset is a merge changeset.
1002 """ 1002 """
1003 # i18n: "merge" is a keyword 1003 # i18n: "merge" is a keyword
1004 getargs(x, 0, 0, _("merge takes no arguments")) 1004 getargs(x, 0, 0, _("merge takes no arguments"))
1005 cl = repo.changelog 1005 cl = repo.changelog
1006 return lazyset(subset, lambda r: cl.parentrevs(r)[1] != -1) 1006 return subset.filter(lambda r: cl.parentrevs(r)[1] != -1)
1007 1007
1008 def branchpoint(repo, subset, x): 1008 def branchpoint(repo, subset, x):
1009 """``branchpoint()`` 1009 """``branchpoint()``
1010 Changesets with more than one child. 1010 Changesets with more than one child.
1011 """ 1011 """
1018 parentscount = [0]*(len(repo) - baserev) 1018 parentscount = [0]*(len(repo) - baserev)
1019 for r in cl.revs(start=baserev + 1): 1019 for r in cl.revs(start=baserev + 1):
1020 for p in cl.parentrevs(r): 1020 for p in cl.parentrevs(r):
1021 if p >= baserev: 1021 if p >= baserev:
1022 parentscount[p - baserev] += 1 1022 parentscount[p - baserev] += 1
1023 return baseset([r for r in subset if (parentscount[r - baserev] > 1)]) 1023 return subset.filter(lambda r: parentscount[r - baserev] > 1)
1024 1024
1025 def minrev(repo, subset, x): 1025 def minrev(repo, subset, x):
1026 """``min(set)`` 1026 """``min(set)``
1027 Changeset with lowest revision number in set. 1027 Changeset with lowest revision number in set.
1028 """ 1028 """
1069 rn = None 1069 rn = None
1070 pm = repo.changelog._partialmatch(n) 1070 pm = repo.changelog._partialmatch(n)
1071 if pm is not None: 1071 if pm is not None:
1072 rn = repo.changelog.rev(pm) 1072 rn = repo.changelog.rev(pm)
1073 1073
1074 return baseset([r for r in subset if r == rn]) 1074 return subset.filter(lambda r: r == rn)
1075 1075
1076 def obsolete(repo, subset, x): 1076 def obsolete(repo, subset, x):
1077 """``obsolete()`` 1077 """``obsolete()``
1078 Mutable changeset with a newer version.""" 1078 Mutable changeset with a newer version."""
1079 # i18n: "obsolete" is a keyword 1079 # i18n: "obsolete" is a keyword
1105 if prev is None: 1105 if prev is None:
1106 return src 1106 return src
1107 src = prev 1107 src = prev
1108 1108
1109 o = set([_firstsrc(r) for r in args]) 1109 o = set([_firstsrc(r) for r in args])
1110 return baseset([r for r in subset if r in o]) 1110 return subset.filter(lambda r: r in o)
1111 1111
1112 def outgoing(repo, subset, x): 1112 def outgoing(repo, subset, x):
1113 """``outgoing([path])`` 1113 """``outgoing([path])``
1114 Changesets not found in the specified destination repository, or the 1114 Changesets not found in the specified destination repository, or the
1115 default push location. 1115 default push location.
1128 repo.ui.pushbuffer() 1128 repo.ui.pushbuffer()
1129 outgoing = discovery.findcommonoutgoing(repo, other, onlyheads=revs) 1129 outgoing = discovery.findcommonoutgoing(repo, other, onlyheads=revs)
1130 repo.ui.popbuffer() 1130 repo.ui.popbuffer()
1131 cl = repo.changelog 1131 cl = repo.changelog
1132 o = set([cl.rev(r) for r in outgoing.missing]) 1132 o = set([cl.rev(r) for r in outgoing.missing])
1133 return baseset([r for r in subset if r in o]) 1133 return subset.filter(lambda r: r in o)
1134 1134
1135 def p1(repo, subset, x): 1135 def p1(repo, subset, x):
1136 """``p1([set])`` 1136 """``p1([set])``
1137 First parent of changesets in set, or the working directory. 1137 First parent of changesets in set, or the working directory.
1138 """ 1138 """
1139 if x is None: 1139 if x is None:
1140 p = repo[x].p1().rev() 1140 p = repo[x].p1().rev()
1141 return baseset([r for r in subset if r == p]) 1141 return subset.filter(lambda r: r == p)
1142 1142
1143 ps = set() 1143 ps = set()
1144 cl = repo.changelog 1144 cl = repo.changelog
1145 for r in getset(repo, spanset(repo), x): 1145 for r in getset(repo, spanset(repo), x):
1146 ps.add(cl.parentrevs(r)[0]) 1146 ps.add(cl.parentrevs(r)[0])
1152 """ 1152 """
1153 if x is None: 1153 if x is None:
1154 ps = repo[x].parents() 1154 ps = repo[x].parents()
1155 try: 1155 try:
1156 p = ps[1].rev() 1156 p = ps[1].rev()
1157 return baseset([r for r in subset if r == p]) 1157 return subset.filter(lambda r: r == p)
1158 except IndexError: 1158 except IndexError:
1159 return baseset([]) 1159 return baseset([])
1160 1160
1161 ps = set() 1161 ps = set()
1162 cl = repo.changelog 1162 cl = repo.changelog
1221 """``public()`` 1221 """``public()``
1222 Changeset in public phase.""" 1222 Changeset in public phase."""
1223 # i18n: "public" is a keyword 1223 # i18n: "public" is a keyword
1224 getargs(x, 0, 0, _("public takes no arguments")) 1224 getargs(x, 0, 0, _("public takes no arguments"))
1225 pc = repo._phasecache 1225 pc = repo._phasecache
1226 return lazyset(subset, lambda r: pc.phase(repo, r) == phases.public) 1226 return subset.filter(lambda r: pc.phase(repo, r) == phases.public)
1227 1227
1228 def remote(repo, subset, x): 1228 def remote(repo, subset, x):
1229 """``remote([id [,path]])`` 1229 """``remote([id [,path]])``
1230 Local revision that corresponds to the given identifier in a 1230 Local revision that corresponds to the given identifier in a
1231 remote repository, if present. Here, the '.' identifier is a 1231 remote repository, if present. Here, the '.' identifier is a
1282 # i18n: "rev" is a keyword 1282 # i18n: "rev" is a keyword
1283 l = int(getstring(l[0], _("rev requires a number"))) 1283 l = int(getstring(l[0], _("rev requires a number")))
1284 except (TypeError, ValueError): 1284 except (TypeError, ValueError):
1285 # i18n: "rev" is a keyword 1285 # i18n: "rev" is a keyword
1286 raise error.ParseError(_("rev expects a number")) 1286 raise error.ParseError(_("rev expects a number"))
1287 return baseset([r for r in subset if r == l]) 1287 return subset.filter(lambda r: r == l)
1288 1288
1289 def matching(repo, subset, x): 1289 def matching(repo, subset, x):
1290 """``matching(revision [, field])`` 1290 """``matching(revision [, field])``
1291 Changesets in which a given set of fields match the set of fields in the 1291 Changesets in which a given set of fields match the set of fields in the
1292 selected revision or set. 1292 selected revision or set.
1394 match = False 1394 match = False
1395 if match: 1395 if match:
1396 return True 1396 return True
1397 return False 1397 return False
1398 1398
1399 return lazyset(subset, matches) 1399 return subset.filter(matches)
1400 1400
1401 def reverse(repo, subset, x): 1401 def reverse(repo, subset, x):
1402 """``reverse(set)`` 1402 """``reverse(set)``
1403 Reverse order of set. 1403 Reverse order of set.
1404 """ 1404 """
1419 """``secret()`` 1419 """``secret()``
1420 Changeset in secret phase.""" 1420 Changeset in secret phase."""
1421 # i18n: "secret" is a keyword 1421 # i18n: "secret" is a keyword
1422 getargs(x, 0, 0, _("secret takes no arguments")) 1422 getargs(x, 0, 0, _("secret takes no arguments"))
1423 pc = repo._phasecache 1423 pc = repo._phasecache
1424 return lazyset(subset, lambda x: pc.phase(repo, x) == phases.secret) 1424 return subset.filter(lambda x: pc.phase(repo, x) == phases.secret)
1425 1425
1426 def sort(repo, subset, x): 1426 def sort(repo, subset, x):
1427 """``sort(set[, [-]key...])`` 1427 """``sort(set[, [-]key...])``
1428 Sort set by keys. The default sort order is ascending, specify a key 1428 Sort set by keys. The default sort order is ascending, specify a key
1429 as ``-key`` to sort in descending order. 1429 as ``-key`` to sort in descending order.