New behavior, new tests, added wizzard and processor

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
2022-08-07 21:44:31 +02:00
parent f4ac509665
commit 1fef7bc404
8 changed files with 203 additions and 118 deletions

View File

@@ -66,7 +66,6 @@ class Cloner:
self._repo = RepoTool(repo_path)
return self.__opened
@property
def __opened(self) -> bool:
if not self._repo:
@@ -221,3 +220,7 @@ class Cloner:
if detector.check_fingerprint():
log.debug(f"Starting detector discovery")
detector.run(callback)
def detector_init(self):
detector = Detector(Path(self.main_repo_path), Path(self._dirs.cache_dir), self._config.cloner_project_name)
detector.initialize_caches()

View File

@@ -97,8 +97,8 @@ class ClonerConfigParser:
self.__invalid_lines.append((line, None))
continue
eq = line.find("=")
key: str = line[0:eq]
val: str = line[eq + 1:]
key: str = line[0:eq].strip()
val: str = line[eq + 1:].strip()
l.debug(f"Found config pair: {key} => '{val}'")
try:
@@ -118,4 +118,3 @@ class ClonerConfigParser:
@property
def invalid_lines(self):
return self.__invalid_lines

View File

@@ -48,23 +48,22 @@ def config_try_override(config_writer: GitConfigParser, section: str, option: st
config_writer.set(section, option, value)
def prepare_git_auth(repo: str, config_dir):
log.debug(f"CFG: Opening repo {repo}")
repo = Repo(repo)
path: str = repo._get_config_path("user")
def prepare_git_auth(config_dir: str):
# create mockup repo
git_config = Path(config_dir).joinpath("git")
config_file = git_config.joinpath("config")
path: str = config_file.as_posix()
log.debug(f"CFG config path: {path}")
path = os.path.dirname(path)
log.debug(f"CFG parent path: {path}")
if not os.path.isdir(path):
if not git_config.is_dir():
log.debug(f"CFG Creating config dir")
os.mkdir(path)
git_config.mkdir()
cred_store: str = os.path.join(path, "git-credentials")
ssh_identity: str = os.path.join(config_dir, "ssh", "identity")
cred_store: str = os.path.join(config_dir, "auth", "git-credentials")
ssh_identity: str = os.path.join(config_dir, "auth", "ssh", "identity")
with repo.config_writer("user") as cfgw:
with GitConfigParser(path, read_only = False) as cfgw:
# github personal token
# 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
if token:
config_try_override(
cfgw,