Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 20447:abb91b74f758
revset: added lazyset implementation to keyword revset
Performance benchmarking:
$ time hg log -qr "first(keyword(changeset))"
0:9117c6561b0b
real 0m3.466s
user 0m3.345s
sys 0m0.072s
$ time ./hg log -qr "first(keyword(changeset))"
0:9117c6561b0b
real 0m0.365s
user 0m0.199s
sys 0m0.083s
author | Lucas Moscovicz <lmoscovicz@fb.com> |
---|---|
date | Wed, 29 Jan 2014 09:04:03 -0800 |
parents | d258486604f4 |
children | 92f6f2db3cf4 |
comparison
equal
deleted
inserted
replaced
20446:d258486604f4 | 20447:abb91b74f758 |
---|---|
919 Search commit message, user name, and names of changed files for | 919 Search commit message, user name, and names of changed files for |
920 string. The match is case-insensitive. | 920 string. The match is case-insensitive. |
921 """ | 921 """ |
922 # i18n: "keyword" is a keyword | 922 # i18n: "keyword" is a keyword |
923 kw = encoding.lower(getstring(x, _("keyword requires a string"))) | 923 kw = encoding.lower(getstring(x, _("keyword requires a string"))) |
924 l = [] | 924 |
925 for r in subset: | 925 def matches(r): |
926 c = repo[r] | 926 c = repo[r] |
927 if util.any(kw in encoding.lower(t) | 927 return util.any(kw in encoding.lower(t) for t in c.files() + [c.user(), |
928 for t in c.files() + [c.user(), c.description()]): | 928 c.description()]) |
929 l.append(r) | 929 |
930 return baseset(l) | 930 return lazyset(subset, matches) |
931 | 931 |
932 def limit(repo, subset, x): | 932 def limit(repo, subset, x): |
933 """``limit(set, [n])`` | 933 """``limit(set, [n])`` |
934 First n members of set, defaulting to 1. | 934 First n members of set, defaulting to 1. |
935 """ | 935 """ |