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.pur...@linuxfoundation.org>
---
 meta/lib/oeqa/utils/metadata.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/meta/lib/oeqa/utils/metadata.py b/meta/lib/oeqa/utils/metadata.py
index 15ec190c4ab..b320df67e0b 100644
--- a/meta/lib/oeqa/utils/metadata.py
+++ b/meta/lib/oeqa/utils/metadata.py
@@ -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:
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#211051): 
https://lists.openembedded.org/g/openembedded-core/message/211051
Mute This Topic: https://lists.openembedded.org/mt/111087645/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to