summaryrefslogtreecommitdiffstats
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.py b/main.py
index e152de4f..a7c3c684 100755
--- a/main.py
+++ b/main.py
@@ -50,6 +50,7 @@ import event_log
50from repo_trace import SetTrace 50from repo_trace import SetTrace
51from git_command import user_agent 51from git_command import user_agent
52from git_config import init_ssh, close_ssh, RepoConfig 52from git_config import init_ssh, close_ssh, RepoConfig
53from git_trace2_event_log import EventLog
53from command import InteractiveCommand 54from command import InteractiveCommand
54from command import MirrorSafeCommand 55from command import MirrorSafeCommand
55from command import GitcAvailableCommand, GitcClientCommand 56from command import GitcAvailableCommand, GitcClientCommand
@@ -130,6 +131,8 @@ global_options.add_option('--version',
130global_options.add_option('--event-log', 131global_options.add_option('--event-log',
131 dest='event_log', action='store', 132 dest='event_log', action='store',
132 help='filename of event log to append timeline to') 133 help='filename of event log to append timeline to')
134global_options.add_option('--git-trace2-event-log', action='store',
135 help='directory to write git trace2 event log to')
133 136
134 137
135class _Repo(object): 138class _Repo(object):
@@ -211,6 +214,7 @@ class _Repo(object):
211 file=sys.stderr) 214 file=sys.stderr)
212 return 1 215 return 1
213 216
217 git_trace2_event_log = EventLog()
214 cmd.repodir = self.repodir 218 cmd.repodir = self.repodir
215 cmd.client = RepoClient(cmd.repodir) 219 cmd.client = RepoClient(cmd.repodir)
216 cmd.manifest = cmd.client.manifest 220 cmd.manifest = cmd.client.manifest
@@ -261,6 +265,8 @@ class _Repo(object):
261 start = time.time() 265 start = time.time()
262 cmd_event = cmd.event_log.Add(name, event_log.TASK_COMMAND, start) 266 cmd_event = cmd.event_log.Add(name, event_log.TASK_COMMAND, start)
263 cmd.event_log.SetParent(cmd_event) 267 cmd.event_log.SetParent(cmd_event)
268 git_trace2_event_log.StartEvent()
269
264 try: 270 try:
265 cmd.ValidateOptions(copts, cargs) 271 cmd.ValidateOptions(copts, cargs)
266 result = cmd.Execute(copts, cargs) 272 result = cmd.Execute(copts, cargs)
@@ -303,10 +309,13 @@ class _Repo(object):
303 309
304 cmd.event_log.FinishEvent(cmd_event, finish, 310 cmd.event_log.FinishEvent(cmd_event, finish,
305 result is None or result == 0) 311 result is None or result == 0)
312 git_trace2_event_log.ExitEvent(result)
313
306 if gopts.event_log: 314 if gopts.event_log:
307 cmd.event_log.Write(os.path.abspath( 315 cmd.event_log.Write(os.path.abspath(
308 os.path.expanduser(gopts.event_log))) 316 os.path.expanduser(gopts.event_log)))
309 317
318 git_trace2_event_log.Write(gopts.git_trace2_event_log)
310 return result 319 return result
311 320
312 321