summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-05-16 14:36:27 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-25 23:03:46 +0100
commit618a2ede75b6b360974b9c74b046f4bf75bd8e17 (patch)
treeba1ad98f3c860af660bb80c95276c58123829d72
parent6cf74643e9b563c6384a0d23e172c8ea294b7210 (diff)
downloadpoky-618a2ede75b6b360974b9c74b046f4bf75bd8e17.tar.gz
oeqa.utils.git: implement GitRepo.get_current_branch()
(From OE-Core rev: dcba2302adab47b398f1ce7d09c38828ea9ae426) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/buildperf/base.py7
-rw-r--r--meta/lib/oeqa/utils/git.py8
2 files changed, 10 insertions, 5 deletions
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index 6a8d9feb02..adc3da3e2c 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -116,12 +116,9 @@ class BuildPerfTestResult(unittest.TextTestResult):
116 if not rev: 116 if not rev:
117 rev = self.repo.rev_parse('HEAD') 117 rev = self.repo.rev_parse('HEAD')
118 if not branch: 118 if not branch:
119 try: 119 branch = self.repo.get_current_branch()
120 # Strip 11 chars, i.e. 'refs/heads' from the beginning 120 if not branch:
121 branch = self.repo.run_cmd(['symbolic-ref', 'HEAD'])[11:]
122 except GitError:
123 log.debug('Currently on detached HEAD') 121 log.debug('Currently on detached HEAD')
124 branch = None
125 return str(rev), str(branch) 122 return str(rev), str(branch)
126 123
127 def addSuccess(self, test): 124 def addSuccess(self, test):
diff --git a/meta/lib/oeqa/utils/git.py b/meta/lib/oeqa/utils/git.py
index 647465467d..0fc8112321 100644
--- a/meta/lib/oeqa/utils/git.py
+++ b/meta/lib/oeqa/utils/git.py
@@ -46,4 +46,12 @@ class GitRepo(object):
46 # Revision does not exist 46 # Revision does not exist
47 return None 47 return None
48 48
49 def get_current_branch(self):
50 """Get current branch"""
51 try:
52 # Strip 11 chars, i.e. 'refs/heads' from the beginning
53 return self.run_cmd(['symbolic-ref', 'HEAD'])[11:]
54 except GitError:
55 return None
56
49 57