]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
lib/oeqa/metadata: Add commit_time to branch metadata being saved
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 9 Feb 2025 10:49:31 +0000 (10:49 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 9 Feb 2025 22:23:17 +0000 (22:23 +0000)
As well as commit counts, it is helpful to know when metadata dates from. Store
the unix timestamp for commits in a commit_time field alongside the commit count.

This is useful for performance graph analysis and saves having to recompute the
data.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/utils/metadata.py

index 15ec190c4ab113398246d7c7b371740389cd05bb..b320df67e0b39b2498054f2d31df04c7d4b4f5ee 100644 (file)
@@ -76,6 +76,10 @@ def git_rev_info(path):
             info['commit_count'] = int(subprocess.check_output(["git", "rev-list", "--count", "HEAD"], cwd=path).decode('utf-8').strip())
         except subprocess.CalledProcessError:
             pass
+        try:
+            info['commit_time'] = int(subprocess.check_output(["git", "show", "--no-patch", "--format=%ct", "HEAD"], cwd=path).decode('utf-8').strip())
+        except subprocess.CalledProcessError:
+            pass
         return info
     try:
         repo = Repo(path, search_parent_directories=True)
@@ -83,6 +87,7 @@ def git_rev_info(path):
         return info
     info['commit'] = repo.head.commit.hexsha
     info['commit_count'] = repo.head.commit.count()
+    info['commit_time'] = repo.head.commit.committed_date
     try:
         info['branch'] = repo.active_branch.name
     except TypeError: