Skip to content

Commit

Permalink
misc: support dropping commits in changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Aug 20, 2023
1 parent e742d5a commit 1078cec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/generate_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def parse_override_file(file: Path):
for line in file.read_text().splitlines():
line = line.rstrip()

if last_override and last_override[0] == 'reword' and not re.match(r'^(reword|subject|squash|pick)', line):
if last_override and last_override[0] == 'reword' and not re.match(r'^(reword|subject|squash|drop|pick)', line):
if line == '=end':
last_override = None
continue
Expand Down Expand Up @@ -293,6 +293,9 @@ def generate_changelog(from_sha: str, to_sha: str) -> str:
commits: List[Commit] = []
for commit_text in commits_text.splitlines():
short_hash, hash, subject = commit_text.split(' ', 2)
if hash in overrides and overrides[hash][0] == 'drop':
continue

body = subprocess.check_output(
f'git log -1 {hash} --format="%b"', shell=True, encoding='utf-8').strip()
m = re.search(r'end changelog', body, re.IGNORECASE)
Expand Down

0 comments on commit 1078cec

Please sign in to comment.