# HG changeset patch # User Matt Mackall # Date 1316280887 18000 # Node ID 0ab1c3a1f3b2eb2715c67b7c7770846f7ef1d1be # Parent d8501bcbb221af6f28ff5dfac685cb9ff21f2b05 revsets: add first alias for last diff -r d8501bcbb221 -r 0ab1c3a1f3b2 mercurial/revset.py --- 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