repos: introduce a factory to abstract away from Repo implementation

The user just calls that factory and gets something that is a Repo, in
fact just a GitRepo for now.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
This commit is contained in:
Henning Schild
2018-01-05 16:00:26 +01:00
committed by Daniel Wagner
parent b5b2766b24
commit 3594ad50a0
2 changed files with 34 additions and 25 deletions

View File

@@ -199,16 +199,12 @@ class Config:
name)
url = path
rep = Repo(url=url,
path=path,
layers=layers)
rep = Repo.factory(url=url, path=path, layers=layers)
rep.disable_operations()
else:
path = path or os.path.join(self.kas_work_dir, name)
rep = Repo(url=url,
path=path,
refspec=refspec,
layers=layers)
rep = Repo.factory(url=url, path=path, refspec=refspec,
layers=layers)
repo_dict[repo] = rep
return repo_dict