repos: also move version control call out of config.py
Signed-off-by: Henning Schild <henning.schild@siemens.com>
This commit is contained in:
committed by
Daniel Wagner
parent
941fa38a2d
commit
b5b2766b24
17
kas/repos.py
17
kas/repos.py
@@ -155,3 +155,20 @@ class Repo:
|
||||
run_cmd(['git', 'checkout', '-q',
|
||||
'{refspec}'.format(refspec=self.refspec)],
|
||||
cwd=self.path)
|
||||
|
||||
@staticmethod
|
||||
def get_root_path(path, environ):
|
||||
"""
|
||||
Check if path is a version control repo and return its root path.
|
||||
"""
|
||||
(ret, output) = run_cmd(['git',
|
||||
'rev-parse',
|
||||
'--show-toplevel'],
|
||||
cwd=path,
|
||||
env=environ,
|
||||
fail=False,
|
||||
liveupdate=False)
|
||||
if ret == 0:
|
||||
return output.strip()
|
||||
|
||||
return path
|
||||
|
Reference in New Issue
Block a user