Mercurial > public > mercurial-scm > hg
comparison mercurial/profiling.py @ 32804:c0b2c8f25ad9
profiling: move 'fp' closing logic into its own function
We are about to make the logic more robust and reuse it in more place, we start
by isolating what we have.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 12 Jun 2017 17:13:35 +0200 |
parents | eede022fc142 |
children | 2b0fc56840d0 |
comparison
equal
deleted
inserted
replaced
32803:90ce5f0366ba | 32804:c0b2c8f25ad9 |
---|---|
216 val = 'Profile:\n%s' % self._fp.getvalue() | 216 val = 'Profile:\n%s' % self._fp.getvalue() |
217 # ui.log treats the input as a format string, | 217 # ui.log treats the input as a format string, |
218 # so we need to escape any % signs. | 218 # so we need to escape any % signs. |
219 val = val.replace('%', '%%') | 219 val = val.replace('%', '%%') |
220 self._ui.log('profile', val) | 220 self._ui.log('profile', val) |
221 self._fp.close() | 221 self._closefp() |
222 | |
223 def _closefp(self): | |
224 self._fp.close() |