Skip to content

CFE-4659: Adds changelog-generator to cfengine-cli#137

Open
SimonThalvorsen wants to merge 1 commit into
cfengine:mainfrom
SimonThalvorsen:CFE-4659
Open

CFE-4659: Adds changelog-generator to cfengine-cli#137
SimonThalvorsen wants to merge 1 commit into
cfengine:mainfrom
SimonThalvorsen:CFE-4659

Conversation

@SimonThalvorsen
Copy link
Copy Markdown
Contributor

No description provided.

@SimonThalvorsen SimonThalvorsen force-pushed the CFE-4659 branch 2 times, most recently from 76266ae to 2272521 Compare May 28, 2026 12:28
Comment thread src/cfengine_cli/changelog.py
Comment thread src/cfengine_cli/changelog.py Outdated
@olehermanse olehermanse requested a review from larsewi May 28, 2026 12:42
Comment thread src/cfengine_cli/changelog.py
Copy link
Copy Markdown
Contributor

@larsewi larsewi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GJ 🚀 Some smaller comments



# ---------------------------------------------------------------------------
# Fetch and merge depndacy upgrades / reverts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Fetch and merge depndacy upgrades / reverts
# Fetch and merge dependency upgrades / reverts

Comment on lines +51 to +53
print(
f"Warning: repo path not found, skipping: {repo_path}", file=sys.stderr
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the logging module. Also, should we perhaps fail here? This way we don't end up with half done changelogs?

)
continue

os.chdir(repo_path)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of changing directory, you can consider using the git -C /path/to/workdir ... option

Comment on lines +58 to +61
proc = subprocess.Popen(
["git", "log", "--no-merges", "--reverse", "--pretty=format:%s"] + git_args,
stdout=subprocess.PIPE,
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason why you are using subprocess.Popen() over the more high-level subprocess.run()?


m = re.match(REVERT_RE, subject)
if m:
dep, frm, to = m.group(1), m.group(2), m.group(3)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid abbreviations

Suggested change
dep, frm, to = m.group(1), m.group(2), m.group(3)
dep, from, to = m.group(1), m.group(2), m.group(3)

Comment on lines +117 to +122
repo_path = os.path.join(original_dir, repo)
if not os.path.isdir(repo_path):
print(
f"Warning: repo path not found, skipping: {repo_path}", file=sys.stderr
)
continue
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is repeated from above. Maybe it deserves a function to make it more DRY?

Comment on lines +186 to +187
elif re.match(r"^Commit[ .]*$", subject, re.IGNORECASE):
log_entry_commit = True
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also seen people use Changelog: body. Maybe we should add it as alias to commit?

# ---------------------------------------------------------------------------
# Git-log parser
# ---------------------------------------------------------------------------
def parse_git_log(repos, git_args):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is huge. Maybe it would make sense to split it up a bit?

# ---------------------------------------------------------------------------
# Repostuff
# ---------------------------------------------------------------------------
REPO_SETS = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a dictionary of lists, not a set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants