Mercurial > hg-stable
changeset 20755:cfd03c069e08
cmdutil: changed code in getgraphlogrevs not to use getitem
__getitem__ is a method that is not implemented lazily on many of the new
classes and it can be easily replaced with a structure that takes advantage of
the new lazy implementations instead.
author | Lucas Moscovicz <lmoscovicz@fb.com> |
---|---|
date | Fri, 14 Mar 2014 08:43:52 -0700 |
parents | f15ff553b762 |
children | e7833e63bb42 |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Tue Feb 18 11:35:03 2014 -0800 +++ b/mercurial/cmdutil.py Fri Mar 14 08:43:52 2014 -0700 @@ -1661,7 +1661,12 @@ revs = matcher(repo, revs) revs.sort(reverse=True) if limit is not None: - revs = revs[:limit] + limitedrevs = revset.baseset() + for idx, rev in enumerate(revs): + if idx >= limit: + break + limitedrevs.append(rev) + revs = limitedrevs return revs, expr, filematcher