Log repo.* config variables in git trace2 logger.
Bug: [google internal] b/181758736
Testing:
- Unit tests
- Verified repo git trace2 logs had expected data
Change-Id: I9af8a574377bd91115f085808c1271e9dee16a36
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/299182
Tested-by: Ian Kasprzak <iankaz@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Raman Tenneti <rtenneti@google.com>
diff --git a/git_trace2_event_log.py b/git_trace2_event_log.py
index fe34092..8c33d80 100644
--- a/git_trace2_event_log.py
+++ b/git_trace2_event_log.py
@@ -132,6 +132,21 @@
exit_event['code'] = result
self._log.append(exit_event)
+ def DefParamRepoEvents(self, config):
+ """Append a 'def_param' event for each repo.* config key to the current log.
+
+ Args:
+ config: Repo configuration dictionary
+ """
+ # Only output the repo.* config parameters.
+ repo_config = {k: v for k, v in config.items() if k.startswith('repo.')}
+
+ for param, value in repo_config.items():
+ def_param_event = self._CreateEventDict('def_param')
+ def_param_event['param'] = param
+ def_param_event['value'] = value
+ self._log.append(def_param_event)
+
def _GetEventTargetPath(self):
"""Get the 'trace2.eventtarget' path from git configuration.