From 835a34bdb911e15e228cb760043d3f737dd56c84 Mon Sep 17 00:00:00 2001 From: Ian Kasprzak Date: Fri, 5 Mar 2021 11:04:49 -0800 Subject: 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 Reviewed-by: Mike Frysinger Reviewed-by: Raman Tenneti --- git_trace2_event_log.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'git_trace2_event_log.py') diff --git a/git_trace2_event_log.py b/git_trace2_event_log.py index fe34092a..8c33d80b 100644 --- a/git_trace2_event_log.py +++ b/git_trace2_event_log.py @@ -132,6 +132,21 @@ class EventLog(object): 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. -- cgit v1.2.3-54-g00ecf