summaryrefslogtreecommitdiffstats
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/main.py b/main.py
index e629b30f..a22c6a1f 100755
--- a/main.py
+++ b/main.py
@@ -216,6 +216,21 @@ class _Repo(object):
216 self._PrintHelp(short=True) 216 self._PrintHelp(short=True)
217 return 1 217 return 1
218 218
219 run = lambda: self._RunLong(name, gopts, argv) or 0
220 with Trace('starting new command: %s', ', '.join([name] + argv),
221 first_trace=True):
222 if gopts.trace_python:
223 import trace
224 tracer = trace.Trace(count=False, trace=True, timing=True,
225 ignoredirs=set(sys.path[1:]))
226 result = tracer.runfunc(run)
227 else:
228 result = run()
229 return result
230
231 def _RunLong(self, name, gopts, argv):
232 """Execute the (longer running) requested subcommand."""
233 result = 0
219 SetDefaultColoring(gopts.color) 234 SetDefaultColoring(gopts.color)
220 235
221 git_trace2_event_log = EventLog() 236 git_trace2_event_log = EventLog()
@@ -663,15 +678,7 @@ def _Main(argv):
663 if gopts.trace_to_stderr: 678 if gopts.trace_to_stderr:
664 SetTraceToStderr() 679 SetTraceToStderr()
665 680
666 with Trace('starting new command: %s', ', '.join([name] + argv), first_trace=True): 681 result = repo._Run(name, gopts, argv) or 0
667 run = lambda: repo._Run(name, gopts, argv) or 0
668 if gopts.trace_python:
669 import trace
670 tracer = trace.Trace(count=False, trace=True, timing=True,
671 ignoredirs=set(sys.path[1:]))
672 result = tracer.runfunc(run)
673 else:
674 result = run()
675 except KeyboardInterrupt: 682 except KeyboardInterrupt:
676 print('aborted by user', file=sys.stderr) 683 print('aborted by user', file=sys.stderr)
677 result = 1 684 result = 1