Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Checks if path is under version control and returns its root path.
"""
(ret, output) = run_cmd(['git', 'rev-parse', '--show-toplevel'],
cwd=path, fail=False, liveupdate=False)
if ret == 0:
return output.strip()
(ret, output) = run_cmd(['hg', 'root'],
cwd=path, fail=False, liveupdate=False)
if ret == 0:
return output.strip()
return path if fallback else None
class RepoImpl(Repo):
"""
Provides a generic implementation for a Repo.
"""
async def fetch_async(self):
"""
Starts asynchronous repository fetch.
"""
if self.operations_disabled:
return 0
if not os.path.exists(self.path):
os.makedirs(os.path.dirname(self.path), exist_ok=True)
sdir = os.path.join(get_context().kas_repo_ref_dir or '',
self.qualified_name)
logging.debug('Looking for repo ref dir in %s', sdir)