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

DRAFT: package changelog #380

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ABWassim
Copy link
Contributor

@ABWassim ABWassim commented Mar 14, 2024

I also chose to remove the get_changelog_at_tag function since it is only used in the context of cog changelog and it only makes a call to get_changelog. The --at and pattern of cog changelog are now processed in the "body" of cog changelog to directly compute the final pattern.

What do you think ? Gonna write tests + doc soon

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Attention: Patch coverage is 22.22222% with 14 lines in your changes are missing coverage. Please review.

Project coverage is 86.17%. Comparing base (5021a13) to head (42c48fe).
Report is 6 commits behind head on main.

❗ Current head 42c48fe differs from pull request most recent head b7b49eb. Consider uploading reports for the commit b7b49eb to get more accurate results

Files Patch % Lines
src/command/changelog.rs 0.00% 10 Missing ⚠️
src/bin/cog/main.rs 50.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #380      +/-   ##
==========================================
- Coverage   86.38%   86.17%   -0.21%     
==========================================
  Files          49       49              
  Lines        7072     7081       +9     
==========================================
- Hits         6109     6102       -7     
- Misses        963      979      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ABWassim
Copy link
Contributor Author

ABWassim commented Apr 19, 2024

Hey @oknozor,

I noticed a weird behavior when a commit contains multiple tags (which can happen when bumping with multiple packages that were updated). Looks like when generating a Changelog for a package, it takes the latest created tag on the commit rather than the one that belongs to the package. It is illustrated by the test I added :

  • Feat commits on the package one.
  • Bump everything with the --auto option -> We get a 0.1.0 and a one-0.1.0 tag.
  • Create a package called two.
  • Commits on package one and two
  • Bump everything with the --auto option -> We get a 0.2.0, a one-0.2.0 and a two-0.1.0 tag.
  • Generated the Changelog for package one
## two-0.1.0 (should be one-0.2.0) - 2024-04-19
#### Features
- one feature - (17ef0a3) - Tom
#### Miscellaneous Chores
- **(version)** 0.2.0 - (2a6c0d2) - Tom

- - -
## one-0.1.0 - 2024-04-19
#### Features
- package one feature - (f270338) - Tom
#### Miscellaneous Chores
- **(version)** 0.1.0 - (9f00137) - Tom

Looks like the issue comes from the revwalk function where each oid is either a commit or the latest created tag on a commit, which doesn't allow us getting every tag of commit so far.

I need to figure out a clean solution for that issue but if you have some idea I'd like to hear it :)

@oknozor
Copy link
Collaborator

oknozor commented Apr 19, 2024

Hey I @ABWassim, I suspected this would be an issue at some point.
I think the solution is to change the layout of the cache:

static REPO_CACHE: Lazy<Arc<Mutex<BTreeMap<String, OidOf>>>> =

Instead of BTreeMap<String, OidOf> we should have BTreeMap<String, Vec<OidOf>> to hold multiple tags for a single commit sha.

Once we have that we should be able to change the resolve_oid_of function (or create a dedicated one) to force the lookup of a specific package tag.

@ABWassim
Copy link
Contributor Author

Hey @oknozor, thanks for the hint ! I'll try my best at it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants