diff options
| author | Josip Sokcevic <sokcevic@google.com> | 2024-02-21 11:04:03 -0800 |
|---|---|---|
| committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-02-22 20:55:09 +0000 |
| commit | 8896b68926b660a90f37a9a37221c30514c52523 (patch) | |
| tree | 2df46eeda80c4fe740a03886b0f65aaaa0ffc662 | |
| parent | fec8cd6704b8ca7e01ed2de9d8757a2afd35188b (diff) | |
| download | git-repo-8896b68926b660a90f37a9a37221c30514c52523.tar.gz | |
trace: Save trace2 sid in REPO_TRACE file
git-trace2 events contain additional information what git is doing under
the hood, and repo doesn't have visibility into.
Instead of relying on timestamp information to match REPO_TRACE with
git-trace2 events, add SID information into REPO_TRACE.
Change-Id: I37672a3face81858072c7a3ce34ca3379199dab5
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/410280
Tested-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
| -rwxr-xr-x | main.py | 11 |
1 files changed, 7 insertions, 4 deletions
| @@ -270,10 +270,14 @@ class _Repo: | |||
| 270 | self._PrintHelp(short=True) | 270 | self._PrintHelp(short=True) |
| 271 | return 1 | 271 | return 1 |
| 272 | 272 | ||
| 273 | run = lambda: self._RunLong(name, gopts, argv) or 0 | 273 | git_trace2_event_log = EventLog() |
| 274 | run = ( | ||
| 275 | lambda: self._RunLong(name, gopts, argv, git_trace2_event_log) or 0 | ||
| 276 | ) | ||
| 274 | with Trace( | 277 | with Trace( |
| 275 | "starting new command: %s", | 278 | "starting new command: %s [sid=%s]", |
| 276 | ", ".join([name] + argv), | 279 | ", ".join([name] + argv), |
| 280 | git_trace2_event_log.full_sid, | ||
| 277 | first_trace=True, | 281 | first_trace=True, |
| 278 | ): | 282 | ): |
| 279 | if gopts.trace_python: | 283 | if gopts.trace_python: |
| @@ -290,12 +294,11 @@ class _Repo: | |||
| 290 | result = run() | 294 | result = run() |
| 291 | return result | 295 | return result |
| 292 | 296 | ||
| 293 | def _RunLong(self, name, gopts, argv): | 297 | def _RunLong(self, name, gopts, argv, git_trace2_event_log): |
| 294 | """Execute the (longer running) requested subcommand.""" | 298 | """Execute the (longer running) requested subcommand.""" |
| 295 | result = 0 | 299 | result = 0 |
| 296 | SetDefaultColoring(gopts.color) | 300 | SetDefaultColoring(gopts.color) |
| 297 | 301 | ||
| 298 | git_trace2_event_log = EventLog() | ||
| 299 | outer_client = RepoClient(self.repodir) | 302 | outer_client = RepoClient(self.repodir) |
| 300 | repo_client = outer_client | 303 | repo_client = outer_client |
| 301 | if gopts.submanifest_path: | 304 | if gopts.submanifest_path: |
