[oe-commits] [openembedded-core] 27/50: oeqa.utils.git: introduce GitRepo.rev_parse()

git at git.openembedded.org git at git.openembedded.org
Thu Aug 25 22:04:43 UTC 2016


rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 55726e931536ed0cbd7b80588060b05a3145c934
Author: Markus Lehtonen <markus.lehtonen at linux.intel.com>
AuthorDate: Mon May 16 14:23:43 2016 +0300

    oeqa.utils.git: introduce GitRepo.rev_parse()
    
    Signed-off-by: Markus Lehtonen <markus.lehtonen at linux.intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/lib/oeqa/buildperf/base.py | 2 +-
 meta/lib/oeqa/utils/git.py      | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index 30b8e47..6a8d9fe 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -114,7 +114,7 @@ class BuildPerfTestResult(unittest.TextTestResult):
                      "and OE_BUILDPERFTEST_GIT_BRANCH environment variables")
         else:
             if not rev:
-                rev = self.repo.run_cmd(['rev-parse', 'HEAD'])
+                rev = self.repo.rev_parse('HEAD')
             if not branch:
                 try:
                     # Strip 11 chars, i.e. 'refs/heads' from the beginning
diff --git a/meta/lib/oeqa/utils/git.py b/meta/lib/oeqa/utils/git.py
index 6a2987f..6474654 100644
--- a/meta/lib/oeqa/utils/git.py
+++ b/meta/lib/oeqa/utils/git.py
@@ -38,5 +38,12 @@ class GitRepo(object):
             env.update(env_update)
         return self._run_git_cmd_at(git_args, self.top_dir, env=env)
 
+    def rev_parse(self, revision):
+        """Do git rev-parse"""
+        try:
+            return self.run_cmd(['rev-parse', revision])
+        except GitError:
+            # Revision does not exist
+            return None
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list