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 <steadmon@google.com>
Reviewed-by: Xin Li <delphij@google.com>
Tested-by: Raman Tenneti <rtenneti@google.com>
diff --git a/git_trace2_event_log.py b/git_trace2_event_log.py
index 92c4cc6..0d4f23f 100644
--- a/git_trace2_event_log.py
+++ b/git_trace2_event_log.py
@@ -167,6 +167,10 @@
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 @@
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)