Support tag creation

ogrepository-fixes
Vadim vtroshchinskiy 2025-06-18 13:27:25 +02:00
parent 5472f4919a
commit 83208084b1
1 changed files with 21 additions and 0 deletions

View File

@ -1213,6 +1213,8 @@ class OpengnsysGitLibrary:
repo.config_writer().add_value("core", "filemode", "false").release()
repo.config_writer().add_value("push", "autoSetupRemote", "true").release()
repo.config_writer().add_value("maintenance", "autoDetach", "false").release()
repo.config_writer().add_value("push", "followTags", "true").release()
def initRepo(self, device, repo_name):
"""
@ -1485,6 +1487,25 @@ class OpengnsysGitLibrary:
self._restore_metadata(path, destructive_only=True)
def tag(self, path = None, device = None, tagName = None, commit = None, message = None):
"""
Create a tag in the repository
"""
if path is None:
path = self.fs.ensure_mounted(device)
self.logger.info("Creating tag %s pointing at %s", tagName, commit)
repo = git.Repo(path)
self._configure_repo(repo)
if tagName in repo.tags:
self.logger.warning("Tag already existed")
return
repo.create_tag(tagName, ref = commit, message = message)
def restoreRepo(self, path):
"""
Restore the repository to the state it had before the non-committed modifications