contrib/perf.py
changeset 51436 827b89714a8d
parent 51413 8fc92193a2cf
child 51437 d1fb42a71676
equal deleted inserted replaced
51435:ad1066534237 51436:827b89714a8d
  3005             ready.notify_all()
  3005             ready.notify_all()
  3006 
  3006 
  3007 
  3007 
  3008 @command(
  3008 @command(
  3009     b'perf::unbundle',
  3009     b'perf::unbundle',
  3010     formatteropts,
  3010     [
       
  3011         (b'', b'as-push', None, b'pretend the bundle comes from a push'),
       
  3012     ]
       
  3013     + formatteropts,
  3011     b'BUNDLE_FILE',
  3014     b'BUNDLE_FILE',
  3012 )
  3015 )
  3013 def perf_unbundle(ui, repo, fname, **opts):
  3016 def perf_unbundle(ui, repo, fname, **opts):
  3014     """benchmark application of a bundle in a repository.
  3017     """benchmark application of a bundle in a repository.
  3015 
  3018 
  3016     This does not include the final transaction processing"""
  3019     This does not include the final transaction processing
       
  3020 
       
  3021     The --as-push option make the unbundle operation appears like it comes from
       
  3022     a client push. It change some aspect of the processing and associated
       
  3023     performance profile.
       
  3024     """
  3017 
  3025 
  3018     from mercurial import exchange
  3026     from mercurial import exchange
  3019     from mercurial import bundle2
  3027     from mercurial import bundle2
  3020     from mercurial import transaction
  3028     from mercurial import transaction
  3021 
  3029 
  3032     # a changeset that is a close descendant of 18415fc918a1, the changeset
  3040     # a changeset that is a close descendant of 18415fc918a1, the changeset
  3033     # that conclude the fix run for the bug introduced in 63edc384d3b7.
  3041     # that conclude the fix run for the bug introduced in 63edc384d3b7.
  3034     args = getargspec(error.Abort.__init__).args
  3042     args = getargspec(error.Abort.__init__).args
  3035     post_18415fc918a1 = "detailed_exit_code" in args
  3043     post_18415fc918a1 = "detailed_exit_code" in args
  3036 
  3044 
       
  3045     unbundle_source = b'perf::unbundle'
       
  3046     if opts[b'as_push']:
       
  3047         unbundle_source = b'push'
       
  3048 
  3037     old_max_inline = None
  3049     old_max_inline = None
  3038     try:
  3050     try:
  3039         if not (pre_63edc384d3b7 or post_18415fc918a1):
  3051         if not (pre_63edc384d3b7 or post_18415fc918a1):
  3040             # disable inlining
  3052             # disable inlining
  3041             old_max_inline = mercurial.revlog._maxinline
  3053             old_max_inline = mercurial.revlog._maxinline
  3067                         gen, tr = bundle
  3079                         gen, tr = bundle
  3068                         bundle2.applybundle(
  3080                         bundle2.applybundle(
  3069                             repo,
  3081                             repo,
  3070                             gen,
  3082                             gen,
  3071                             tr,
  3083                             tr,
  3072                             source=b'perf::unbundle',
  3084                             source=unbundle_source,
  3073                             url=fname,
  3085                             url=fname,
  3074                         )
  3086                         )
  3075 
  3087 
  3076                     timer, fm = gettimer(ui, opts)
  3088                     timer, fm = gettimer(ui, opts)
  3077                     timer(apply, setup=setup)
  3089                     timer(apply, setup=setup)