Add tag_recipe_commit helper function
And change tests to use it so that both it and tag_file_commit are used.
This commit is contained in:
parent
3f4140d5d3
commit
7f1adf120c
@ -498,6 +498,23 @@ def commit_recipe_directory(repo, branch, directory):
|
||||
except (RecipeFileError, toml.TomlError):
|
||||
pass
|
||||
|
||||
def tag_recipe_commit(repo, branch, recipe_name):
|
||||
"""Tag a file's most recent commit
|
||||
|
||||
:param repo: Open repository
|
||||
:type repo: Git.Repository
|
||||
:param branch: Branch name
|
||||
:type branch: str
|
||||
:param recipe_name: Recipe name to tag
|
||||
:type recipe_name: str
|
||||
:returns: Tag id or None if it failed.
|
||||
:rtype: Git.OId
|
||||
:raises: Can raise errors from Ggit
|
||||
|
||||
Uses tag_file_commit()
|
||||
"""
|
||||
return tag_file_commit(repo, branch, recipe_filename(recipe_name))
|
||||
|
||||
def tag_file_commit(repo, branch, filename):
|
||||
"""Tag a file's most recent commit
|
||||
|
||||
|
@ -165,7 +165,7 @@ class GitRecipesTest(unittest.TestCase):
|
||||
result = recipes.tag_file_commit(self.repo, "master", "not-a-file")
|
||||
self.assertEqual(result, None)
|
||||
|
||||
result = recipes.tag_file_commit(self.repo, "master", "http-server.toml")
|
||||
result = recipes.tag_recipe_commit(self.repo, "master", "http-server")
|
||||
self.assertNotEqual(result, None)
|
||||
|
||||
commits = recipes.list_commits(self.repo, "master", "http-server.toml")
|
||||
@ -199,7 +199,7 @@ class GitRecipesTest(unittest.TestCase):
|
||||
self.assertNotEqual(oid, None)
|
||||
|
||||
# Tag the new commit
|
||||
result = recipes.tag_file_commit(self.repo, "master", "http-server.toml")
|
||||
result = recipes.tag_recipe_commit(self.repo, "master", "http-server")
|
||||
self.assertNotEqual(result, None)
|
||||
|
||||
commits = recipes.list_commits(self.repo, "master", "http-server.toml")
|
||||
|
Loading…
Reference in New Issue
Block a user