Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 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 | 9c1665f36588 |
children | e7833e63bb42 |
comparison
equal
deleted
inserted
replaced
20754:f15ff553b762 | 20755:cfd03c069e08 |
---|---|
1659 # returns the revision matching A then the revision matching B. Sort | 1659 # returns the revision matching A then the revision matching B. Sort |
1660 # again to fix that. | 1660 # again to fix that. |
1661 revs = matcher(repo, revs) | 1661 revs = matcher(repo, revs) |
1662 revs.sort(reverse=True) | 1662 revs.sort(reverse=True) |
1663 if limit is not None: | 1663 if limit is not None: |
1664 revs = revs[:limit] | 1664 limitedrevs = revset.baseset() |
1665 for idx, rev in enumerate(revs): | |
1666 if idx >= limit: | |
1667 break | |
1668 limitedrevs.append(rev) | |
1669 revs = limitedrevs | |
1665 | 1670 |
1666 return revs, expr, filematcher | 1671 return revs, expr, filematcher |
1667 | 1672 |
1668 def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None, | 1673 def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None, |
1669 filematcher=None): | 1674 filematcher=None): |