Mercurial > hg
comparison mercurial/hgweb/hgweb_mod.py @ 32788:eede022fc142
profile: drop maybeprofile
It seems sufficiently simple to use "profile(enabled=X)" to not justify having
a dedicated context manager just to read the config.
(I do not have a too strong opinion about this).
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 09 Jun 2017 12:29:29 +0100 |
parents | bd3cb917761a |
children | c8f212cb0c83 |
comparison
equal
deleted
inserted
replaced
32787:545f69cd6042 | 32788:eede022fc142 |
---|---|
309 | 309 |
310 This is typically only called by Mercurial. External consumers | 310 This is typically only called by Mercurial. External consumers |
311 should be using instances of this class as the WSGI application. | 311 should be using instances of this class as the WSGI application. |
312 """ | 312 """ |
313 with self._obtainrepo() as repo: | 313 with self._obtainrepo() as repo: |
314 with profiling.maybeprofile(repo.ui): | 314 profile = repo.ui.configbool('profiling', 'enabled') |
315 with profiling.profile(repo.ui, enabled=profile): | |
315 for r in self._runwsgi(req, repo): | 316 for r in self._runwsgi(req, repo): |
316 yield r | 317 yield r |
317 | 318 |
318 def _runwsgi(self, req, repo): | 319 def _runwsgi(self, req, repo): |
319 rctx = requestcontext(self, repo) | 320 rctx = requestcontext(self, repo) |