contrib/perf.py
changeset 38977 a1f694779b2f
parent 38969 1601afbb573c
child 39114 222aba766015
equal deleted inserted replaced
38976:f7228c907ef4 38977:a1f694779b2f
   661     and pull requests).
   661     and pull requests).
   662 
   662 
   663     By default, all revisions are added to the changegroup.
   663     By default, all revisions are added to the changegroup.
   664     """
   664     """
   665     cl = repo.changelog
   665     cl = repo.changelog
   666     revs = [cl.lookup(r) for r in repo.revs(rev or 'all()')]
   666     nodes = [cl.lookup(r) for r in repo.revs(rev or 'all()')]
   667     bundler = changegroup.getbundler(version, repo)
   667     bundler = changegroup.getbundler(version, repo)
   668 
   668 
   669     def lookup(node):
   669     def d():
   670         # The real bundler reads the revision in order to access the
   670         state, chunks = bundler._generatechangelog(cl, nodes)
   671         # manifest node and files list. Do that here.
   671         for chunk in chunks:
   672         cl.read(node)
       
   673         return node
       
   674 
       
   675     def d():
       
   676         for chunk in bundler.group(revs, cl, lookup):
       
   677             pass
   672             pass
   678 
   673 
   679     timer, fm = gettimer(ui, opts)
   674     timer, fm = gettimer(ui, opts)
   680     timer(d)
   675 
       
   676     # Terminal printing can interfere with timing. So disable it.
       
   677     with ui.configoverride({('progress', 'disable'): True}):
       
   678         timer(d)
       
   679 
   681     fm.end()
   680     fm.end()
   682 
   681 
   683 @command('perfdirs', formatteropts)
   682 @command('perfdirs', formatteropts)
   684 def perfdirs(ui, repo, **opts):
   683 def perfdirs(ui, repo, **opts):
   685     timer, fm = gettimer(ui, opts)
   684     timer, fm = gettimer(ui, opts)