]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/utils/metadata: Add commit_count to fallback logic
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 23 Feb 2019 15:54:35 +0000 (15:54 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 28 Feb 2019 17:47:03 +0000 (17:47 +0000)
Currently if python3-git isn't installed we can get odd behaviours when the
commit_count is absent. Avoid this set of bugs by adding a fallback here.

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

index b7def77224062a2475556b1ab727fe647d9117ea..70a27569f26dc6a59807069c17eb23aad242b9fb 100644 (file)
@@ -72,8 +72,10 @@ def git_rev_info(path):
             info['commit'] = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=path).decode('utf-8').strip()
         except subprocess.CalledProcessError:
             pass
-        return info
-
+        try:
+            info['commit_count'] = int(subprocess.check_output(["git", "rev-list", "--count", "HEAD"], cwd=path).decode('utf-8').strip())
+        except subprocess.CalledProcessError:
+            pass
     try:
         repo = Repo(path, search_parent_directories=True)
     except (InvalidGitRepositoryError, NoSuchPathError):