mercurial/revset.py
changeset 17469 fb72eec7efd8
parent 17424 e7cfe3587ea4
child 17537 31f32a96e1e3
equal deleted inserted replaced
17460:a306837f8c87 17469:fb72eec7efd8
    10 import node
    10 import node
    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
       
    15 import obsolete as obsmod
    15 
    16 
    16 def _revancestors(repo, revs, followfirst):
    17 def _revancestors(repo, revs, followfirst):
    17     """Like revlog.ancestors(), but supports followfirst."""
    18     """Like revlog.ancestors(), but supports followfirst."""
    18     cut = followfirst and 1 or None
    19     cut = followfirst and 1 or None
    19     cl = repo.changelog
    20     cl = repo.changelog
   619     """``extinct()``
   620     """``extinct()``
   620     Obsolete changesets with obsolete descendants only.
   621     Obsolete changesets with obsolete descendants only.
   621     """
   622     """
   622     # i18n: "extinct" is a keyword
   623     # i18n: "extinct" is a keyword
   623     getargs(x, 0, 0, _("extinct takes no arguments"))
   624     getargs(x, 0, 0, _("extinct takes no arguments"))
   624     extinctset = set(repo.revs('(obsolete()::) - (::(not obsolete()))'))
   625     extincts = obsmod.getobscache(repo, 'extinct')
   625     return [r for r in subset if r in extinctset]
   626     return [r for r in subset if r in extincts]
   626 
   627 
   627 def extra(repo, subset, x):
   628 def extra(repo, subset, x):
   628     """``extra(label, [value])``
   629     """``extra(label, [value])``
   629     Changesets with the given label in the extra metadata, with the given
   630     Changesets with the given label in the extra metadata, with the given
   630     optional value.
   631     optional value.
   957 def obsolete(repo, subset, x):
   958 def obsolete(repo, subset, x):
   958     """``obsolete()``
   959     """``obsolete()``
   959     Mutable changeset with a newer version."""
   960     Mutable changeset with a newer version."""
   960     # i18n: "obsolete" is a keyword
   961     # i18n: "obsolete" is a keyword
   961     getargs(x, 0, 0, _("obsolete takes no arguments"))
   962     getargs(x, 0, 0, _("obsolete takes no arguments"))
   962     return [r for r in subset if repo[r].obsolete()]
   963     obsoletes = obsmod.getobscache(repo, 'obsolete')
       
   964     return [r for r in subset if r in obsoletes]
   963 
   965 
   964 def origin(repo, subset, x):
   966 def origin(repo, subset, x):
   965     """``origin([set])``
   967     """``origin([set])``
   966     Changesets that were specified as a source for the grafts, transplants or
   968     Changesets that were specified as a source for the grafts, transplants or
   967     rebases that created the given revisions.  Omitting the optional set is the
   969     rebases that created the given revisions.  Omitting the optional set is the
  1435     """``unstable()``
  1437     """``unstable()``
  1436     Non-obsolete changesets with obsolete ancestors.
  1438     Non-obsolete changesets with obsolete ancestors.
  1437     """
  1439     """
  1438     # i18n: "unstable" is a keyword
  1440     # i18n: "unstable" is a keyword
  1439     getargs(x, 0, 0, _("unstable takes no arguments"))
  1441     getargs(x, 0, 0, _("unstable takes no arguments"))
  1440     unstableset = set(repo.revs('(obsolete()::) - obsolete()'))
  1442     unstables = obsmod.getobscache(repo, 'unstable')
  1441     return [r for r in subset if r in unstableset]
  1443     return [r for r in subset if r in unstables]
  1442 
  1444 
  1443 
  1445 
  1444 def user(repo, subset, x):
  1446 def user(repo, subset, x):
  1445     """``user(string)``
  1447     """``user(string)``
  1446     User name contains string. The match is case-insensitive.
  1448     User name contains string. The match is case-insensitive.