From 956f7363d100abe6c1f58b36d7aea59b9e41cd04 Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Mon, 27 Sep 2021 10:55:44 -0700 Subject: superproject: Log argv parameter of syncstate as 'data-json'. Fixed: "we need to make a special case for logging the argv; it should probably be a "data-json" event so that we log this directly as an array rather than an encoded string. Tested: $ repo_dev sync Verified event logged for argv is "data-json". $./run_tests Bug: [google internal] b/201102002 Change-Id: I18ccec79c73c8dc931cb8afc472b2361db8aea4c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/319055 Reviewed-by: Josh Steadmon Reviewed-by: Xin Li Tested-by: Raman Tenneti --- git_trace2_event_log.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'git_trace2_event_log.py') diff --git a/git_trace2_event_log.py b/git_trace2_event_log.py index 92c4cc6b..0d4f23f4 100644 --- a/git_trace2_event_log.py +++ b/git_trace2_event_log.py @@ -167,6 +167,10 @@ class EventLog(object): repo_config = {k: v for k, v in config.items() if k.startswith('repo.')} self.LogConfigEvents(repo_config, 'def_param') + def GetDataEventName(self, key): + """Returns the 'data-json' if the key is argv else returns 'data'.""" + return 'data-json' if key.endswith('sys.argv') else 'data' + def LogDataConfigEvents(self, config, prefix): """Append a 'data' event for each config key/value in |config| to the current log. @@ -178,7 +182,7 @@ class EventLog(object): prefix: Prefix for each key that is logged. """ for key, value in config.items(): - event = self._CreateEventDict('data') + event = self._CreateEventDict(self.GetDataEventName(key)) event['key'] = f'{prefix}/{key}' event['value'] = value self._log.append(event) -- cgit v1.2.3-54-g00ecf