diff 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
line wrap: on
line diff
--- 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()