Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions patchoulene/src/patchoulene/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,16 @@ def do_diff_commits(
if p not in db:
break

merged_bases = [
m for m in db[p].get("merged", []) if base_is_contained_in(m, base2)
]
if merged_bases:
merged.add((p, merged_bases[0]))
continue

if db[p].get("replacement", None) is None:
break
# Only consider merged if no replacements
merged_bases = [
m for m in db[p].get("merged", []) if base_is_contained_in(m, base2)
]
if merged_bases:
merged.add((p, merged_bases[0]))
continue
else:
break
elif isinstance(db[p]["replacement"], list):
remaining.update(db[p]["replacement"])
else:
Expand Down Expand Up @@ -205,7 +206,8 @@ def do_diff_commits(
print(f' {prefix} "{clean_subject(c.message)}"')
print(f" - {primary}")
for g in gs:
print(f" + [{patch_num[g]}] {g}")
kind = "~" if g in cs1 else "+"
print(f" {kind} [{patch_num[g]}] {g}")
for m, base in ms:
print(f" in {base} ({m})")
else:
Expand All @@ -226,7 +228,8 @@ def do_diff_commits(
continue
if primary in replaces:
print(f' [{patch_num[primary]}] Replacement "{clean_subject(c.message)}"')
print(f" + {primary}")
kind = "~" if primary in cs1 else "+"
print(f" {kind} {primary}")
for r in sorted(replaces[primary], key=lambda r: patch_num[r]):
print(f" - [{patch_num[r]}] {r}")
else:
Expand Down Expand Up @@ -295,6 +298,10 @@ def msg_merged(commit: GitCommit, primary: str) -> str:
primary = upstream[0]
clean = clean_subject(c.message)

# Don't bother if upstream commit has replacement, to avoid cycles.
if db.get(primary, {}).get("replacement", None) is not None:
continue

possible_matches = set(pid for pid in upstream[1:] if pid in db)
possible_matches |= set(by_subject.get(clean, []))
possible_matches -= {primary}
Expand Down