Skip to contentSkip to conversation

scripts/patchreview: Add commit to stored json data

PATCH New Richard Purdie 1 participant 2 messages May 23, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 scripts/patchreview: Add commit to stored json data

Save commit data when writing to the json file so the results can be copared/extended later.

---
 scripts/contrib/patchreview.py | 1 +
 1 file changed, 1 insertion(+)
scripts/contrib/patchreview.py +1 -0
index dc417b4c55b4..002991c559cf 100755
@@ -222,6 +222,7 @@ if __name__ == "__main__":
         row = collections.Counter()
         row["total"] = len(results)
         row["date"] = subprocess.check_output(["git", "-C", args.directory, "show", "-s", "--pretty=format:%cd", "--date=format:%s"]).decode("utf-8").strip()
+        row["commit"] = subprocess.check_output(["git", "-C", args.directory, "show", "-s", "--pretty=format:%H"]).decode("utf-8").strip()
         for r in results.values():
             if r.upstream_status in status_values:
                 row[r.upstream_status] += 1
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 scripts/patchreview: Make json output human parsable

Sort dict keys in the json output and use tab spacing. This means when commited into git, the diffs are human readable but it is more compact filesize than space indentation.

---
 scripts/contrib/patchreview.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/contrib/patchreview.py +1 -1
index 002991c559cf..85d2169ad131 100755
@@ -232,7 +232,7 @@ if __name__ == "__main__":
                 row['malformed-sob'] += 1
 
         data.append(row)
-        json.dump(data, open(args.json, "w"))
+        json.dump(data, open(args.json, "w"), sort_keys=True, indent="\t")
 
     if args.histogram:
         print()
Signature · 1 line
2.34.1