Skip to main content

commits_imply

Function commits_imply 

Source
pub fn commits_imply(
    last: Option<&str>,
    declared: &str,
    bump: Bump,
) -> Option<String>
Expand description

The version the commit subjects imply: the last release raised by their bump — from the declared version only when nothing was released. Evidence, never the answer on its own.

It raises the last release and not the declared version, because a declared version already raised for the window must not be raised again by the same commits.

use majordomus_cli::release::version::{commits_imply, Bump};
// released 0.10.0, already declared 0.11.0, only features since: 0.11.0, not 0.12.0
assert_eq!(commits_imply(Some("0.10.0"), "0.11.0", Bump::Minor).as_deref(), Some("0.11.0"));
// nothing released: the declared version is the only base there is
assert_eq!(commits_imply(None, "0.3.0", Bump::Patch).as_deref(), Some("0.3.1"));