BlenderBIM operator to delete a Git remote (#3096)

This commit is contained in:
Bruno Postle
2023-06-10 11:08:49 +01:00
parent e2b52e7ed9
commit 0d67c43e16
5 changed files with 32 additions and 2 deletions
@@ -25,6 +25,7 @@ classes = (
operator.CloneRepo,
operator.CommitChanges,
operator.CreateRepo,
operator.DeleteRemote,
operator.DeleteTag,
operator.DiscardUncommitted,
operator.DisplayRevision,
@@ -303,6 +303,23 @@ class Fetch(bpy.types.Operator):
return {"FINISHED"}
class DeleteRemote(bpy.types.Operator):
"""Delete the selected remote"""
bl_label = "Delete Remote"
bl_idname = "ifcgit.delete_remote"
bl_options = {"REGISTER"}
def execute(self, context):
props = context.scene.IfcGitProperties
repo = IfcGitData.data["repo"]
core.delete_remote(tool.IfcGit, repo)
bpy.ops.ifcgit.refresh()
refresh()
return {"FINISHED"}
class ObjectLog(bpy.types.Operator):
"""Displays Git log of selected object"""
@@ -120,8 +120,6 @@ class IFCGIT_PT_panel(bpy.types.Panel):
row = column.row()
row.operator("ifcgit.switch_revision", icon="CURRENT_FILE")
# TODO operator to tag selected
row = column.row()
row.operator("ifcgit.merge", icon="EXPERIMENTAL", text="")
@@ -168,6 +166,7 @@ class IFCGIT_PT_panel(bpy.types.Panel):
row.prop(props, "select_remote", text="Select remote")
urls = IfcGitData.data["remote_urls"]
row.label(text=urls[props.select_remote])
row.operator("ifcgit.delete_remote", text="", icon="PANEL_CLOSE")
row = layout.row()
row.operator("ifcgit.push", icon="EXPERIMENTAL")
row.operator("ifcgit.fetch", icon="IMPORT")
+4
View File
@@ -42,6 +42,10 @@ def delete_tag(ifcgit, repo, tag_name):
ifcgit.delete_tag(repo, tag_name)
def delete_remote(ifcgit, repo):
ifcgit.delete_remote(repo)
def refresh_revision_list(ifcgit, repo, ifc):
ifcgit.refresh_revision_list(ifc.get_path())
+9
View File
@@ -102,6 +102,15 @@ class IfcGit:
if tag_name in repo.tags:
repo.delete_tag(tag_name)
@classmethod
def delete_remote(cls, repo):
props = bpy.context.scene.IfcGitProperties
remote_name = props.select_remote
if remote_name in repo.remotes:
repo.delete_remote(remote_name)
if repo.remotes:
props.select_remote = repo.remotes[0].name
@classmethod
def create_new_branch(cls):
props = bpy.context.scene.IfcGitProperties