contrib/perf.py
changeset 49414 3c5d0f879404
parent 49413 b380583ad2f5
child 49438 44d4fd09982f
equal deleted inserted replaced
49413:b380583ad2f5 49414:3c5d0f879404
  2588         with ready:
  2588         with ready:
  2589             ready.notify_all()
  2589             ready.notify_all()
  2590 
  2590 
  2591 
  2591 
  2592 @command(
  2592 @command(
       
  2593     b'perf::unbundle',
       
  2594     formatteropts,
       
  2595     b'BUNDLE_FILE',
       
  2596 )
       
  2597 def perf_unbundle(ui, repo, fname, **opts):
       
  2598     """benchmark application of a bundle in a repository.
       
  2599 
       
  2600     This does not include the final transaction processing"""
       
  2601     from mercurial import exchange
       
  2602     from mercurial import bundle2
       
  2603 
       
  2604     with repo.lock():
       
  2605         bundle = [None, None]
       
  2606         try:
       
  2607             with open(fname, mode="rb") as f:
       
  2608 
       
  2609                 def setup():
       
  2610                     gen, tr = bundle
       
  2611                     if tr is not None:
       
  2612                         tr.abort()
       
  2613                     bundle[:] = [None, None]
       
  2614                     f.seek(0)
       
  2615                     bundle[0] = exchange.readbundle(ui, f, fname)
       
  2616                     bundle[1] = repo.transaction(b'perf::unbundle')
       
  2617 
       
  2618                 def apply():
       
  2619                     gen, tr = bundle
       
  2620                     bundle2.applybundle(
       
  2621                         repo,
       
  2622                         gen,
       
  2623                         tr,
       
  2624                         source=b'perf::unbundle',
       
  2625                         url=fname,
       
  2626                     )
       
  2627 
       
  2628                 timer, fm = gettimer(ui, opts)
       
  2629                 timer(apply, setup=setup)
       
  2630                 fm.end()
       
  2631         finally:
       
  2632             gen, tr = bundle
       
  2633             if tr is not None:
       
  2634                 tr.abort()
       
  2635 
       
  2636 
       
  2637 @command(
  2593     b'perf::unidiff|perfunidiff',
  2638     b'perf::unidiff|perfunidiff',
  2594     revlogopts
  2639     revlogopts
  2595     + formatteropts
  2640     + formatteropts
  2596     + [
  2641     + [
  2597         (
  2642         (