mercurial/revset.py
changeset 15819 33ca11b010e2
parent 15791 a814f8fcc65a
child 15837 cd956049fc14
equal deleted inserted replaced
15818:57241845a4bb 15819:33ca11b010e2
     4 #
     4 #
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 import re
     8 import re
     9 import parser, util, error, discovery, hbisect
     9 import parser, util, error, discovery, hbisect, phases
    10 import node as nodemod
    10 import node as nodemod
    11 import bookmarks as bookmarksmod
    11 import bookmarks as bookmarksmod
    12 import match as matchmod
    12 import match as matchmod
    13 from i18n import _
    13 from i18n import _
    14 import encoding
    14 import encoding
   393     if not args:
   393     if not args:
   394         return []
   394         return []
   395     s = set(repo.changelog.descendants(*args)) | set(args)
   395     s = set(repo.changelog.descendants(*args)) | set(args)
   396     return [r for r in subset if r in s]
   396     return [r for r in subset if r in s]
   397 
   397 
       
   398 def draft(repo, subset, x):
       
   399     """``draft()``
       
   400     Changeset in draft phase."""
       
   401     getargs(x, 0, 0, _("draft takes no arguments"))
       
   402     return [r for r in subset if repo._phaserev[r] == phases.draft]
       
   403 
   398 def filelog(repo, subset, x):
   404 def filelog(repo, subset, x):
   399     """``filelog(pattern)``
   405     """``filelog(pattern)``
   400     Changesets connected to the specified filelog.
   406     Changesets connected to the specified filelog.
   401     """
   407     """
   402 
   408 
   723     try:
   729     try:
   724         return getset(repo, subset, x)
   730         return getset(repo, subset, x)
   725     except error.RepoLookupError:
   731     except error.RepoLookupError:
   726         return []
   732         return []
   727 
   733 
       
   734 def public(repo, subset, x):
       
   735     """``public()``
       
   736     Changeset in public phase."""
       
   737     getargs(x, 0, 0, _("public takes no arguments"))
       
   738     return [r for r in subset if repo._phaserev[r] == phases.public]
       
   739 
   728 def removes(repo, subset, x):
   740 def removes(repo, subset, x):
   729     """``removes(pattern)``
   741     """``removes(pattern)``
   730     Changesets which remove files matching pattern.
   742     Changesets which remove files matching pattern.
   731     """
   743     """
   732     # i18n: "removes" is a keyword
   744     # i18n: "removes" is a keyword
   760     Changesets with no parent changeset in set.
   772     Changesets with no parent changeset in set.
   761     """
   773     """
   762     s = getset(repo, subset, x)
   774     s = getset(repo, subset, x)
   763     cs = set(children(repo, subset, x))
   775     cs = set(children(repo, subset, x))
   764     return [r for r in s if r not in cs]
   776     return [r for r in s if r not in cs]
       
   777 
       
   778 def secret(repo, subset, x):
       
   779     """``secret()``
       
   780     Changeset in secret phase."""
       
   781     getargs(x, 0, 0, _("secret takes no arguments"))
       
   782     return [r for r in subset if repo._phaserev[r] == phases.secret]
   765 
   783 
   766 def sort(repo, subset, x):
   784 def sort(repo, subset, x):
   767     """``sort(set[, [-]key...])``
   785     """``sort(set[, [-]key...])``
   768     Sort set by keys. The default sort order is ascending, specify a key
   786     Sort set by keys. The default sort order is ascending, specify a key
   769     as ``-key`` to sort in descending order.
   787     as ``-key`` to sort in descending order.
   859     "closed": closed,
   877     "closed": closed,
   860     "contains": contains,
   878     "contains": contains,
   861     "date": date,
   879     "date": date,
   862     "desc": desc,
   880     "desc": desc,
   863     "descendants": descendants,
   881     "descendants": descendants,
       
   882     "draft": draft,
   864     "file": hasfile,
   883     "file": hasfile,
   865     "filelog": filelog,
   884     "filelog": filelog,
   866     "first": first,
   885     "first": first,
   867     "follow": follow,
   886     "follow": follow,
   868     "grep": grep,
   887     "grep": grep,
   879     "outgoing": outgoing,
   898     "outgoing": outgoing,
   880     "p1": p1,
   899     "p1": p1,
   881     "p2": p2,
   900     "p2": p2,
   882     "parents": parents,
   901     "parents": parents,
   883     "present": present,
   902     "present": present,
       
   903     "public": public,
   884     "removes": removes,
   904     "removes": removes,
   885     "rev": rev,
   905     "rev": rev,
   886     "reverse": reverse,
   906     "reverse": reverse,
   887     "roots": roots,
   907     "roots": roots,
   888     "sort": sort,
   908     "sort": sort,
       
   909     "secret": secret,
   889     "tag": tag,
   910     "tag": tag,
   890     "tagged": tagged,
   911     "tagged": tagged,
   891     "user": user,
   912     "user": user,
   892 }
   913 }
   893 
   914