-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
base: main
Are you sure you want to change the base?
Conversation
bc17cdb
to
42c48fe
Compare
Codecov ReportAttention: Patch coverage is
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. |
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 :
Looks like the issue comes from the I need to figure out a clean solution for that issue but if you have some idea I'd like to hear it :) |
a94ac05
to
b7b49eb
Compare
Hey I @ABWassim, I suspected this would be an issue at some point. cocogitto/src/git/rev/cache.rs Line 9 in 23e4310
Instead of Once we have that we should be able to change the |
Hey @oknozor, thanks for the hint ! I'll try my best at it |
b7b49eb
to
b5f59b4
Compare
Hey @oknozor :) Finally have some more time to work on this. I changed the layout of the cache like you said and proceeded to change the implementation of If a tag exists on the HEAD commit (let's say In the context of that test, we would need I still left some messy debug with good old |
Hello @ABWassim,
This is context dependent. When generating a changelog, we don't want to use
I think the only use for In other word I think your current PR would do the job for now :) That said I think there is another possible approach. We could change the That would mean a few addition to the #[derive(Debug, PartialEq, Eq, Clone)]
pub enum OidOf {
Tag(Tags),
Head(Oid),
Other(Oid),
FirstCommit(Oid),
}
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct Tags {
inner: Vec<Tag>,
}
impl Tags {
/// Try to find a specific package name tag. The caller probably want to take the first one.
fn filter_package(&self, package: &str) -> impl Iterator<Item=&Tag> {
self.inner.iter()
.filter(|t| t.package.as_ref().map(|p| p == package).unwrap_or_default())
}
/// Try to find a all package tag.
fn packages(&self) -> impl Iterator<Item=&Tag> {
self.inner.iter()
.filter(|t| t.package.is_some()))
}
/// Try to find non package tag.
fn global(&self) -> impl Iterator<Item=&Tag> {
// probably requires to filter on the configured prefix
self.inner.iter()
.filter(|t| t.package.is_none()))
}
// etc
} You probably want to change your PR to target that branch, since it splits cog into many package you will need to adapt a lot of your code I am afraid. |
Hey @oknozor, Again thanks for your help. I'll try changing the |
I also chose to remove the
get_changelog_at_tag
function since it is only used in the context ofcog changelog
and it only makes a call toget_changelog
. The--at
andpattern
ofcog changelog
are now processed in the "body" ofcog changelog
to directly compute the final pattern.What do you think ? Gonna write tests + doc soon