comparison mercurial/profiling.py @ 32807:54b356d65079

profile: indent part of '__enter__' We are about to introduce a try except. We start with adding the indent to make the next patch clearer.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 12 Jun 2017 17:20:48 +0200
parents 3a4c677cbd6e
children 336700745a5c
comparison
equal deleted inserted replaced
32806:3a4c677cbd6e 32807:54b356d65079
186 % profiler) 186 % profiler)
187 profiler = 'stat' 187 profiler = 'stat'
188 188
189 self._output = self._ui.config('profiling', 'output') 189 self._output = self._ui.config('profiling', 'output')
190 190
191 if self._output == 'blackbox': 191 if True:
192 self._fp = util.stringio() 192 if self._output == 'blackbox':
193 elif self._output: 193 self._fp = util.stringio()
194 path = self._ui.expandpath(self._output) 194 elif self._output:
195 self._fp = open(path, 'wb') 195 path = self._ui.expandpath(self._output)
196 else: 196 self._fp = open(path, 'wb')
197 self._fpdoclose = False 197 else:
198 self._fp = self._ui.ferr 198 self._fpdoclose = False
199 199 self._fp = self._ui.ferr
200 if proffn is not None: 200
201 pass 201 if proffn is not None:
202 elif profiler == 'ls': 202 pass
203 proffn = lsprofile 203 elif profiler == 'ls':
204 elif profiler == 'flame': 204 proffn = lsprofile
205 proffn = flameprofile 205 elif profiler == 'flame':
206 else: 206 proffn = flameprofile
207 proffn = statprofile 207 else:
208 208 proffn = statprofile
209 self._profiler = proffn(self._ui, self._fp) 209
210 self._profiler.__enter__() 210 self._profiler = proffn(self._ui, self._fp)
211 self._profiler.__enter__()
211 212
212 def __exit__(self, exception_type, exception_value, traceback): 213 def __exit__(self, exception_type, exception_value, traceback):
213 if self._profiler is None: 214 if self._profiler is None:
214 return 215 return
215 self._profiler.__exit__(exception_type, exception_value, traceback) 216 self._profiler.__exit__(exception_type, exception_value, traceback)