Operator to delete a Git tag (#3096)

This commit is contained in:
Bruno Postle
2023-06-04 11:17:45 +01:00
parent 032f52d434
commit db8f1a9b70
5 changed files with 28 additions and 2 deletions
@@ -25,6 +25,7 @@ classes = (
operator.CloneRepo,
operator.CommitChanges,
operator.CreateRepo,
operator.DeleteTag,
operator.DiscardUncommitted,
operator.DisplayRevision,
operator.DisplayUncommitted,
@@ -161,6 +161,23 @@ class AddTag(bpy.types.Operator):
return {"FINISHED"}
class DeleteTag(bpy.types.Operator):
"""Delete a tag"""
bl_label = "Delete tag"
bl_idname = "ifcgit.delete_tag"
bl_options = {"REGISTER"}
tag_name: bpy.props.StringProperty()
def execute(self, context):
repo = IfcGitData.data["repo"]
core.delete_tag(tool.IfcGit, repo, self.tag_name)
bpy.ops.ifcgit.refresh()
refresh()
return {"FINISHED"}
class RefreshGit(bpy.types.Operator):
"""Refresh revision list"""
@@ -148,11 +148,10 @@ class IFCGIT_PT_panel(bpy.types.Panel):
column = item.column(align=True)
row = column.row()
row.label(text=tag.name)
row.operator("ifcgit.delete_tag", icon="PANEL_CLOSE").tag_name = tag.name
if tag.message:
row = column.row()
row.label(text=tag.message)
# TODO
# item.operator("ifcgit.delete_tag", icon="PANEL_CLOSE")
box = layout.box()
row = box.row()
+4
View File
@@ -38,6 +38,10 @@ def add_tag(ifcgit, repo):
ifcgit.add_tag(repo)
def delete_tag(ifcgit, repo, tag_name):
ifcgit.delete_tag(repo, tag_name)
def refresh_revision_list(ifcgit, repo, ifc):
ifcgit.refresh_revision_list(ifc.get_path())
+5
View File
@@ -97,6 +97,11 @@ class IfcGit:
props.new_tag_name = ""
props.new_tag_message = ""
@classmethod
def delete_tag(cls, repo, tag_name):
if tag_name in repo.tags:
repo.delete_tag(tag_name)
@classmethod
def create_new_branch(cls):
props = bpy.context.scene.IfcGitProperties