Move the git repo into a subdirectory
And fix the import of recipes (needs to have full path passed in).
This commit is contained in:
parent
e4695bd580
commit
ff47432f10
@ -200,15 +200,16 @@ def open_or_create_repo(path):
|
|||||||
:rtype: Git.Repository
|
:rtype: Git.Repository
|
||||||
:raises: Can raise errors from Ggit
|
:raises: Can raise errors from Ggit
|
||||||
|
|
||||||
A bare git repo will be created in at the specified path.
|
A bare git repo will be created in the git directory of the specified path.
|
||||||
If a repo already exists it will be opened and returned instead of
|
If a repo already exists it will be opened and returned instead of
|
||||||
creating a new one.
|
creating a new one.
|
||||||
"""
|
"""
|
||||||
Git.init()
|
Git.init()
|
||||||
if os.path.exists(joinpaths(path, "HEAD")):
|
git_path = joinpaths(path, "git")
|
||||||
return Git.Repository.open(gfile(path))
|
if os.path.exists(joinpaths(git_path, "HEAD")):
|
||||||
|
return Git.Repository.open(gfile(git_path))
|
||||||
|
|
||||||
repo = Git.Repository.init_repository(gfile(path), True)
|
repo = Git.Repository.init_repository(gfile(git_path), True)
|
||||||
|
|
||||||
# Make an initial empty commit
|
# Make an initial empty commit
|
||||||
sig = Git.Signature.new_now("bdcs-api-server", "user-email")
|
sig = Git.Signature.new_now("bdcs-api-server", "user-email")
|
||||||
@ -445,7 +446,7 @@ def commit_recipe_directory(repo, branch, directory):
|
|||||||
for f in new_files:
|
for f in new_files:
|
||||||
# Skip files with errors, but try the others
|
# Skip files with errors, but try the others
|
||||||
try:
|
try:
|
||||||
commit_recipe_file(repo, branch, f)
|
commit_recipe_file(repo, branch, joinpaths(directory, f))
|
||||||
except (RecipeFileError, toml.TomlError):
|
except (RecipeFileError, toml.TomlError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -105,6 +105,7 @@ class GitRecipesTest(unittest.TestCase):
|
|||||||
self.repo = recipes.open_or_create_repo(self.repo_dir)
|
self.repo = recipes.open_or_create_repo(self.repo_dir)
|
||||||
|
|
||||||
self.results_path = "./tests/pylorax/results/"
|
self.results_path = "./tests/pylorax/results/"
|
||||||
|
self.examples_path = "./tests/pylorax/recipes/"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(self):
|
def tearDownClass(self):
|
||||||
@ -143,7 +144,7 @@ class GitRecipesTest(unittest.TestCase):
|
|||||||
def test_05_commit_toml_dir(self):
|
def test_05_commit_toml_dir(self):
|
||||||
"""Test committing a directory of TOML files"""
|
"""Test committing a directory of TOML files"""
|
||||||
# It worked if it doesn't raise errors
|
# It worked if it doesn't raise errors
|
||||||
recipes.commit_recipe_directory(self.repo, "master", self.results_path)
|
recipes.commit_recipe_directory(self.repo, "master", self.examples_path)
|
||||||
|
|
||||||
def test_06_read_recipe(self):
|
def test_06_read_recipe(self):
|
||||||
"""Test reading a recipe from a commit"""
|
"""Test reading a recipe from a commit"""
|
||||||
|
Loading…
Reference in New Issue
Block a user