changeset 15117:0ab1c3a1f3b2

revsets: add first alias for last
author Matt Mackall <mpm@selenic.com>
date Sat, 17 Sep 2011 12:34:47 -0500
parents d8501bcbb221
children 9a1438f6af5f
files mercurial/revset.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Fri Sep 16 22:57:47 2011 -0500
+++ b/mercurial/revset.py	Sat Sep 17 12:34:47 2011 -0500
@@ -407,6 +407,12 @@
 
     return [r for r in subset if r in s]
 
+def first(repo, subset, x):
+    """``first(set, [n])``
+    An alias for limit().
+    """
+    return limit(repo, subset, x)
+
 def follow(repo, subset, x):
     """``follow([file])``
     An alias for ``::.`` (ancestors of the working copy's first parent).
@@ -842,6 +848,7 @@
     "descendants": descendants,
     "file": hasfile,
     "filelog": filelog,
+    "first": first,
     "follow": follow,
     "grep": grep,
     "head": head,
@@ -955,7 +962,7 @@
             w = 100 # very slow
         elif f == "ancestor":
             w = 1 * smallbonus
-        elif f in "reverse limit":
+        elif f in "reverse limit first":
             w = 0
         elif f in "sort":
             w = 10 # assume most sorts look at changelog