profiling: move 'fp' closing logic into its own function
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 12 Jun 2017 17:13:35 +0200
changeset 32804 c0b2c8f25ad9
parent 32803 90ce5f0366ba
child 32805 2b0fc56840d0
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.
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()