mercurial/cmdutil.py
changeset 25169 7855d1f5f152
parent 25168 4dfd4d3b9b93
child 25228 63a57a2727b6
equal deleted inserted replaced
25168:4dfd4d3b9b93 25169:7855d1f5f152
  2125         # again to fix that.
  2125         # again to fix that.
  2126         revs = matcher(repo, revs)
  2126         revs = matcher(repo, revs)
  2127         if not opts.get('rev'):
  2127         if not opts.get('rev'):
  2128             revs.sort(reverse=True)
  2128             revs.sort(reverse=True)
  2129     if limit is not None:
  2129     if limit is not None:
  2130         count = 0
       
  2131         limitedrevs = []
  2130         limitedrevs = []
  2132         it = iter(revs)
  2131         for idx, r in enumerate(revs):
  2133         while count < limit:
  2132             if limit <= idx:
  2134             try:
       
  2135                 limitedrevs.append(it.next())
       
  2136             except (StopIteration):
       
  2137                 break
  2133                 break
  2138             count += 1
  2134             limitedrevs.append(r)
  2139         revs = revset.baseset(limitedrevs)
  2135         revs = revset.baseset(limitedrevs)
  2140 
  2136 
  2141     return revs, expr, filematcher
  2137     return revs, expr, filematcher
  2142 
  2138 
  2143 def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None,
  2139 def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None,