Mercurial > hg-stable
comparison mercurial/revset.py @ 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 | b1c62c754bf8 |
comparison
equal
deleted
inserted
replaced
15116:d8501bcbb221 | 15117:0ab1c3a1f3b2 |
---|---|
405 for fr in fl: | 405 for fr in fl: |
406 s.add(fl.linkrev(fr)) | 406 s.add(fl.linkrev(fr)) |
407 | 407 |
408 return [r for r in subset if r in s] | 408 return [r for r in subset if r in s] |
409 | 409 |
410 def first(repo, subset, x): | |
411 """``first(set, [n])`` | |
412 An alias for limit(). | |
413 """ | |
414 return limit(repo, subset, x) | |
415 | |
410 def follow(repo, subset, x): | 416 def follow(repo, subset, x): |
411 """``follow([file])`` | 417 """``follow([file])`` |
412 An alias for ``::.`` (ancestors of the working copy's first parent). | 418 An alias for ``::.`` (ancestors of the working copy's first parent). |
413 If a filename is specified, the history of the given file is followed, | 419 If a filename is specified, the history of the given file is followed, |
414 including copies. | 420 including copies. |
840 "date": date, | 846 "date": date, |
841 "desc": desc, | 847 "desc": desc, |
842 "descendants": descendants, | 848 "descendants": descendants, |
843 "file": hasfile, | 849 "file": hasfile, |
844 "filelog": filelog, | 850 "filelog": filelog, |
851 "first": first, | |
845 "follow": follow, | 852 "follow": follow, |
846 "grep": grep, | 853 "grep": grep, |
847 "head": head, | 854 "head": head, |
848 "heads": heads, | 855 "heads": heads, |
849 "id": node, | 856 "id": node, |
953 w = 30 # slower | 960 w = 30 # slower |
954 elif f == "contains": | 961 elif f == "contains": |
955 w = 100 # very slow | 962 w = 100 # very slow |
956 elif f == "ancestor": | 963 elif f == "ancestor": |
957 w = 1 * smallbonus | 964 w = 1 * smallbonus |
958 elif f in "reverse limit": | 965 elif f in "reverse limit first": |
959 w = 0 | 966 w = 0 |
960 elif f in "sort": | 967 elif f in "sort": |
961 w = 10 # assume most sorts look at changelog | 968 w = 10 # assume most sorts look at changelog |
962 else: | 969 else: |
963 w = 1 | 970 w = 1 |