mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Include commit summary of merged branches (#3096)
Git merges usually transfer the commit history, but when we resolve a conflict with a 'mergetool' (ie. ifcmerge), this history is lost, everything is squashed into a single commit. Now a summary of the merged changes is appended to the merge message.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
|
||||
# allows git import even if git executable isn't found
|
||||
os.environ["GIT_PYTHON_REFRESH"] = "quiet"
|
||||
@@ -421,7 +422,17 @@ class IfcGit:
|
||||
return False
|
||||
|
||||
repo.index.add(path_ifc)
|
||||
props.commit_message = "Merge branch '" + props.display_branch + "' into " + repo.active_branch.name
|
||||
|
||||
message_summary = ""
|
||||
branch_commits = repo.iter_commits(rev=repo.active_branch.name + ".." + props.display_branch)
|
||||
for commit in branch_commits:
|
||||
message_summary += "\n\n" + commit.author.name + " <" + commit.author.email + ">\n"
|
||||
message_summary += time.strftime("%c", time.localtime(commit.committed_date)) + "\n"
|
||||
message_summary += commit.message
|
||||
|
||||
props.commit_message = (
|
||||
"Merge branch '" + props.display_branch + "' into " + repo.active_branch.name + message_summary
|
||||
)
|
||||
props.display_branch = repo.active_branch.name
|
||||
|
||||
cls.load_project(path_ifc)
|
||||
|
||||
Reference in New Issue
Block a user