repos: Remove environ parameter from get_root_path()

This is just the default, namely the environment from the global
context.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2018-08-24 19:18:01 +02:00 committed by Daniel Wagner
parent 86dc584284
commit 0c66b24a12

View File

@ -100,8 +100,7 @@ class Repo:
if url is None: if url is None:
# No version control operation on repository # No version control operation on repository
if path is None: if path is None:
path = Repo.get_root_path(os.path.dirname(config.filename), path = Repo.get_root_path(os.path.dirname(config.filename))
config.context.environ)
logging.info('Using %s as root for repository %s', path, logging.info('Using %s as root for repository %s', path,
name) name)
@ -124,19 +123,17 @@ class Repo:
raise NotImplementedError('Repo typ "%s" not supported.' % typ) raise NotImplementedError('Repo typ "%s" not supported.' % typ)
@staticmethod @staticmethod
def get_root_path(path, environ): def get_root_path(path):
""" """
Check if path is a version control repo and return its root path. Check if path is a version control repo and return its root path.
""" """
(ret, output) = run_cmd(['git', 'rev-parse', '--show-toplevel'], (ret, output) = run_cmd(['git', 'rev-parse', '--show-toplevel'],
cwd=path, env=environ, fail=False, cwd=path, fail=False, liveupdate=False)
liveupdate=False)
if ret == 0: if ret == 0:
return output.strip() return output.strip()
(ret, output) = run_cmd(['hg', 'root'], (ret, output) = run_cmd(['hg', 'root'],
cwd=path, env=environ, fail=False, cwd=path, fail=False, liveupdate=False)
liveupdate=False)
if ret == 0: if ret == 0:
return output.strip() return output.strip()