]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa.utils.git: implement GitRepo.get_current_branch()
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Mon, 16 May 2016 11:36:27 +0000 (14:36 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 25 Aug 2016 21:59:56 +0000 (22:59 +0100)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/buildperf/base.py
meta/lib/oeqa/utils/git.py

index 6a8d9feb02282468a40d1b877ee1deda47168617..adc3da3e2cf4d3c8cd538c4eb6a14f58d0392902 100644 (file)
@@ -116,12 +116,9 @@ class BuildPerfTestResult(unittest.TextTestResult):
             if not rev:
                 rev = self.repo.rev_parse('HEAD')
             if not branch:
-                try:
-                    # Strip 11 chars, i.e. 'refs/heads' from the beginning
-                    branch = self.repo.run_cmd(['symbolic-ref', 'HEAD'])[11:]
-                except GitError:
+                branch = self.repo.get_current_branch()
+                if not branch:
                     log.debug('Currently on detached HEAD')
-                    branch = None
         return str(rev), str(branch)
 
     def addSuccess(self, test):
index 647465467de590c287f0bc44e396b23fcf538b36..0fc8112321e956c021a2d4d9c88acc699db8e583 100644 (file)
@@ -46,4 +46,12 @@ class GitRepo(object):
             # Revision does not exist
             return None
 
+    def get_current_branch(self):
+        """Get current branch"""
+        try:
+            # Strip 11 chars, i.e. 'refs/heads' from the beginning
+            return self.run_cmd(['symbolic-ref', 'HEAD'])[11:]
+        except GitError:
+            return None
+