Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[misc] Fix the changelog generator to only count current branch commits #4126

Merged
merged 1 commit into from
Jan 25, 2022
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
11 changes: 4 additions & 7 deletions misc/make_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def load_pr_tags():
return details


def main(ver='master', repo_dir='.'):
def main(ver=None, repo_dir='.'):
g = Repo(repo_dir)
commits_with_tags = set([tag.commit for tag in g.tags])
commits = list(g.iter_commits(ver, max_count=200))
Expand All @@ -33,11 +33,8 @@ def format(c):

for i, c in enumerate(commits):
s = format(c)
if c in commits_with_tags:
if i == 0:
continue
Comment on lines -37 to -38
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure why it skips the first tagged commit, but it should be included in the changelog. For example:

change 1  [v0.8.10]
change 2
change 3
change 4  [v0.8.9]

The resulted changelog should be

change 1
change 2
change 3

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it was used to skipping version bump commits? @strongoier
but yea it's okay to keep them in the full changelog as well.

Copy link
Collaborator Author

@frostming frostming Jan 25, 2022

Choose a reason for hiding this comment

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

If that is the case we can make the parsing more explicit: only keep commits with tags, or other mechanisms to exclude specific commits(PRs) from the changelog.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really remember that because that code was there before I made changes. But it seems that our changelog doesn't miss any commit.

else:
break
if c in commits_with_tags and i > 0:
break

tags = []
while s[0] == '[':
Expand Down Expand Up @@ -78,7 +75,7 @@ def format(c):


if __name__ == '__main__':
ver = sys.argv[1] if len(sys.argv) > 1 else 'master'
ver = sys.argv[1] if len(sys.argv) > 1 else None
repo = sys.argv[2] if len(sys.argv) > 2 else '.'
save = sys.argv[3] if len(sys.argv) > 3 else False
res = main(ver, repo)
Expand Down