mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 11:18:01 +00:00
Bonsai, bump ifcmerge.exe to working version with deps
Don't leave a broken repo if ifcmerge is misinstalled. Fix bug where only local branches could be merged. Fix gitch where merge commits were not considered relevant.
This commit is contained in:
+1
-1
@@ -64,7 +64,7 @@ PYNUMBER:=3$(PYMINOR)
|
|||||||
PYPI_VERSION:=3.$(PYMINOR)
|
PYPI_VERSION:=3.$(PYMINOR)
|
||||||
endif # def PYVERSION
|
endif # def PYVERSION
|
||||||
|
|
||||||
IFCMERGE_VERSION:=2026-04-02
|
IFCMERGE_VERSION:=2026-04-07
|
||||||
|
|
||||||
ifdef PLATFORM
|
ifdef PLATFORM
|
||||||
SUPPORTED_PLATFORMS := linux macos macosm1 win
|
SUPPORTED_PLATFORMS := linux macos macosm1 win
|
||||||
|
|||||||
@@ -151,8 +151,11 @@ def merge_branch(ifcgit: type[tool.IfcGit], ifc: type[tool.Ifc], operator: bpy.t
|
|||||||
conflicts = ifcgit.git_mergetool(mergetool, path_ifc)
|
conflicts = ifcgit.git_mergetool(mergetool, path_ifc)
|
||||||
if conflicts is not None:
|
if conflicts is not None:
|
||||||
ifcgit.git_merge_abort()
|
ifcgit.git_merge_abort()
|
||||||
ifcgit.store_merge_conflicts(conflicts)
|
if conflicts:
|
||||||
operator.report({"WARNING"}, "Merge failed — see the conflict report in the panel below")
|
ifcgit.store_merge_conflicts(conflicts)
|
||||||
|
operator.report({"WARNING"}, "Merge failed — see the conflict report in the panel below")
|
||||||
|
else:
|
||||||
|
operator.report({"ERROR"}, "Merge tool failed — check that ifcmerge is installed correctly")
|
||||||
return False
|
return False
|
||||||
ifcgit.commit_merge(path_ifc)
|
ifcgit.commit_merge(path_ifc)
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ class IfcGit:
|
|||||||
rev=[props.display_branch],
|
rev=[props.display_branch],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
commits_relevant = list(
|
commits_relevant = set(
|
||||||
git.objects.commit.Commit.iter_items(
|
git.objects.commit.Commit.iter_items(
|
||||||
repo=repo,
|
repo=repo,
|
||||||
rev=[props.display_branch],
|
rev=[props.display_branch],
|
||||||
@@ -225,11 +225,17 @@ class IfcGit:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def is_relevant(commit):
|
||||||
|
if commit in commits_relevant:
|
||||||
|
return True
|
||||||
|
# Merge commits are relevant too
|
||||||
|
return len(commit.parents) > 1 and any(p in commits_relevant for p in commit.parents)
|
||||||
|
|
||||||
for commit in commits:
|
for commit in commits:
|
||||||
|
|
||||||
if props.ifcgit_filter == "tagged" and commit.hexsha not in lookup:
|
if props.ifcgit_filter == "tagged" and commit.hexsha not in lookup:
|
||||||
continue
|
continue
|
||||||
elif props.ifcgit_filter == "relevant" and commit not in commits_relevant:
|
elif props.ifcgit_filter == "relevant" and not is_relevant(commit):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
props.ifcgit_commits.add()
|
props.ifcgit_commits.add()
|
||||||
@@ -239,7 +245,7 @@ class IfcGit:
|
|||||||
list_item.author_name = commit.author.name
|
list_item.author_name = commit.author.name
|
||||||
list_item.author_email = commit.author.email
|
list_item.author_email = commit.author.email
|
||||||
list_item.committed_date = int(commit.committed_date)
|
list_item.committed_date = int(commit.committed_date)
|
||||||
if commit in commits_relevant:
|
if is_relevant(commit):
|
||||||
list_item.relevant = True
|
list_item.relevant = True
|
||||||
if commit.hexsha in lookup:
|
if commit.hexsha in lookup:
|
||||||
for tag in lookup[commit.hexsha]:
|
for tag in lookup[commit.hexsha]:
|
||||||
@@ -589,7 +595,7 @@ class IfcGit:
|
|||||||
"""Attempt a git merge. Returns None on clean merge, 'conflict' on expected
|
"""Attempt a git merge. Returns None on clean merge, 'conflict' on expected
|
||||||
GitCommandError, or 'error' on an unknown GitError."""
|
GitCommandError, or 'error' on an unknown GitError."""
|
||||||
repo = IfcGitRepo.repo
|
repo = IfcGitRepo.repo
|
||||||
branch = repo.branches[branch_name]
|
branch = repo.refs[branch_name]
|
||||||
try:
|
try:
|
||||||
repo.git.merge(branch)
|
repo.git.merge(branch)
|
||||||
return None
|
return None
|
||||||
@@ -603,7 +609,7 @@ class IfcGit:
|
|||||||
"""Attempt a git merge without committing (always leaves a merge state to abort).
|
"""Attempt a git merge without committing (always leaves a merge state to abort).
|
||||||
Returns None on clean merge, 'conflict' on conflict, or 'error' on unknown failure."""
|
Returns None on clean merge, 'conflict' on conflict, or 'error' on unknown failure."""
|
||||||
repo = IfcGitRepo.repo
|
repo = IfcGitRepo.repo
|
||||||
branch = repo.branches[branch_name]
|
branch = repo.refs[branch_name]
|
||||||
try:
|
try:
|
||||||
repo.git.merge(branch, no_commit=True, no_ff=True)
|
repo.git.merge(branch, no_commit=True, no_ff=True)
|
||||||
return None
|
return None
|
||||||
@@ -619,8 +625,8 @@ class IfcGit:
|
|||||||
report_path = path_ifc + ".ifcmerge"
|
report_path = path_ifc + ".ifcmerge"
|
||||||
try:
|
try:
|
||||||
repo.git.mergetool(tool=mergetool)
|
repo.git.mergetool(tool=mergetool)
|
||||||
except git.exc.GitCommandError:
|
except git.exc.GitCommandError as e:
|
||||||
pass
|
print(f"ifcgit: mergetool failed: {e}")
|
||||||
|
|
||||||
conflicts = None
|
conflicts = None
|
||||||
if os.path.exists(report_path):
|
if os.path.exists(report_path):
|
||||||
@@ -636,6 +642,10 @@ class IfcGit:
|
|||||||
os.remove(report_path)
|
os.remove(report_path)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if conflicts is None and repo.index.unmerged_blobs():
|
||||||
|
conflicts = []
|
||||||
|
|
||||||
return conflicts
|
return conflicts
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user