mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
BlenderBIM push Git tags to remote
Shows error message if push fails
This commit is contained in:
@@ -132,7 +132,7 @@ class CommitChanges(bpy.types.Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
|
|
||||||
repo = IfcGitData.data["repo"]
|
repo = IfcGitData.data["repo"]
|
||||||
core.commit_changes(tool.IfcGit, tool.Ifc, repo, context)
|
core.commit_changes(tool.IfcGit, tool.Ifc, repo)
|
||||||
bpy.ops.ifcgit.refresh()
|
bpy.ops.ifcgit.refresh()
|
||||||
refresh()
|
refresh()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
@@ -215,7 +215,7 @@ class DisplayRevision(bpy.types.Operator):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
|
|
||||||
core.colourise_revision(tool.IfcGit, context)
|
core.colourise_revision(tool.IfcGit)
|
||||||
refresh()
|
refresh()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -283,8 +283,7 @@ class Push(bpy.types.Operator):
|
|||||||
|
|
||||||
props = context.scene.IfcGitProperties
|
props = context.scene.IfcGitProperties
|
||||||
repo = IfcGitData.data["repo"]
|
repo = IfcGitData.data["repo"]
|
||||||
remote = repo.remotes[props.select_remote]
|
core.push(tool.IfcGit, repo, props.select_remote, self)
|
||||||
remote.push(refspec=IfcGitData.data["repo"].active_branch.name)
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ class IFCGIT_PT_panel(bpy.types.Panel):
|
|||||||
row.label(text=urls[props.select_remote])
|
row.label(text=urls[props.select_remote])
|
||||||
row.operator("ifcgit.delete_remote", text="", icon="PANEL_CLOSE")
|
row.operator("ifcgit.delete_remote", text="", icon="PANEL_CLOSE")
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.operator("ifcgit.push", icon="EXPERIMENTAL")
|
row.operator("ifcgit.push", icon="EXPORT")
|
||||||
row.operator("ifcgit.fetch", icon="IMPORT")
|
row.operator("ifcgit.fetch", icon="IMPORT")
|
||||||
|
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
@@ -177,7 +177,7 @@ class IFCGIT_PT_panel(bpy.types.Panel):
|
|||||||
row = box.row()
|
row = box.row()
|
||||||
row.prop(props, "remote_url")
|
row.prop(props, "remote_url")
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.operator("ifcgit.add_remote", icon="IMPORT")
|
row.operator("ifcgit.add_remote", icon="ADD")
|
||||||
|
|
||||||
|
|
||||||
class COMMIT_UL_List(bpy.types.UIList):
|
class COMMIT_UL_List(bpy.types.UIList):
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ def discard_uncomitted(ifcgit, ifc):
|
|||||||
ifcgit.load_project(path_ifc)
|
ifcgit.load_project(path_ifc)
|
||||||
|
|
||||||
|
|
||||||
def commit_changes(ifcgit, ifc, repo, context):
|
def commit_changes(ifcgit, ifc, repo):
|
||||||
path_ifc = ifc.get_path()
|
path_ifc = ifc.get_path()
|
||||||
ifcgit.git_commit(path_ifc)
|
ifcgit.git_commit(path_ifc)
|
||||||
|
|
||||||
@@ -50,11 +50,17 @@ def delete_remote(ifcgit, repo):
|
|||||||
ifcgit.delete_remote(repo)
|
ifcgit.delete_remote(repo)
|
||||||
|
|
||||||
|
|
||||||
|
def push(ifcgit, repo, remote_name, operator):
|
||||||
|
error_message = ifcgit.push(repo, remote_name, repo.active_branch.name)
|
||||||
|
if error_message:
|
||||||
|
operator.report({"ERROR"}, error_message)
|
||||||
|
|
||||||
|
|
||||||
def refresh_revision_list(ifcgit, repo, ifc):
|
def refresh_revision_list(ifcgit, repo, ifc):
|
||||||
ifcgit.refresh_revision_list(ifc.get_path())
|
ifcgit.refresh_revision_list(ifc.get_path())
|
||||||
|
|
||||||
|
|
||||||
def colourise_revision(ifcgit, context):
|
def colourise_revision(ifcgit):
|
||||||
|
|
||||||
step_ids = ifcgit.get_revisions_step_ids()
|
step_ids = ifcgit.get_revisions_step_ids()
|
||||||
if not step_ids:
|
if not step_ids:
|
||||||
|
|||||||
@@ -118,6 +118,14 @@ class IfcGit:
|
|||||||
if repo.remotes:
|
if repo.remotes:
|
||||||
props.select_remote = repo.remotes[0].name
|
props.select_remote = repo.remotes[0].name
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def push(cls, repo, remote_name, branch_name):
|
||||||
|
remote = repo.remotes[remote_name]
|
||||||
|
try:
|
||||||
|
remote.push(tags=True, refspec=branch_name).raise_if_error()
|
||||||
|
except git.exc.GitCommandError as exc:
|
||||||
|
return exc.stderr
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_new_branch(cls):
|
def create_new_branch(cls):
|
||||||
props = bpy.context.scene.IfcGitProperties
|
props = bpy.context.scene.IfcGitProperties
|
||||||
|
|||||||
Reference in New Issue
Block a user