diff options
Diffstat (limited to 'main.py')
| -rwxr-xr-x | main.py | 9 |
1 files changed, 9 insertions, 0 deletions
| @@ -50,6 +50,7 @@ import event_log | |||
| 50 | from repo_trace import SetTrace | 50 | from repo_trace import SetTrace |
| 51 | from git_command import user_agent | 51 | from git_command import user_agent |
| 52 | from git_config import init_ssh, close_ssh, RepoConfig | 52 | from git_config import init_ssh, close_ssh, RepoConfig |
| 53 | from git_trace2_event_log import EventLog | ||
| 53 | from command import InteractiveCommand | 54 | from command import InteractiveCommand |
| 54 | from command import MirrorSafeCommand | 55 | from command import MirrorSafeCommand |
| 55 | from command import GitcAvailableCommand, GitcClientCommand | 56 | from command import GitcAvailableCommand, GitcClientCommand |
| @@ -130,6 +131,8 @@ global_options.add_option('--version', | |||
| 130 | global_options.add_option('--event-log', | 131 | global_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') |
| 134 | global_options.add_option('--git-trace2-event-log', action='store', | ||
| 135 | help='directory to write git trace2 event log to') | ||
| 133 | 136 | ||
| 134 | 137 | ||
| 135 | class _Repo(object): | 138 | class _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 | ||
