# HG changeset patch # User Pierre-Yves David # Date 1497280415 -7200 # Node ID c0b2c8f25ad97868f3272fa790665c2d46f731d7 # Parent 90ce5f0366ba380d33e427c44e58d6c7a87e4d86 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. diff -r 90ce5f0366ba -r c0b2c8f25ad9 mercurial/profiling.py --- a/mercurial/profiling.py Tue Jun 13 01:23:54 2017 +0530 +++ b/mercurial/profiling.py Mon Jun 12 17:13:35 2017 +0200 @@ -218,4 +218,7 @@ # so we need to escape any % signs. val = val.replace('%', '%%') self._ui.log('profile', val) - self._fp.close() + self._closefp() + + def _closefp(self): + self._fp.close()