mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
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>
This commit is contained in:
parent
6cf74643e9
commit
618a2ede75
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user