pub struct Changes { /* private fields */ }Expand description
Structure that represents the changes in a git repository
Implementations§
Source§impl Changes
impl Changes
Sourcepub fn from_repo(
repository: &impl RepositoryExtension,
) -> Result<Self, Box<dyn Error>>
pub fn from_repo( repository: &impl RepositoryExtension, ) -> Result<Self, Box<dyn Error>>
Sort the commits from a given repo into major, minor, patch and other
change categories according to their commit intentions.
Commits are fetched since the latest version tag. If there are no version tags yet then all the commits from the repository are fetched.
§Returns
The Changes structure with the sorted commits or error type.
§Example
use git2::Repository;
use cargo_semantic_release::Changes;
let git_repo = Repository::open(".").unwrap();
let changes = Changes::from_repo(&git_repo).expect("error during fetching changes");
println!("changes: {changes}")Sourcepub fn define_action_for_semantic_version(self) -> SemanticVersionAction
pub fn define_action_for_semantic_version(self) -> SemanticVersionAction
Evaluate the changes find in a repository to figure out the semantic version action
§Returns
SemanticVersionAction enum for the suggested semantic version change.
§Example
use git2::Repository;
use cargo_semantic_release::Changes;
let git_repo = Repository::open(".").unwrap();
let action = Changes::from_repo(&git_repo).expect("Error during fetching changes").define_action_for_semantic_version();
println!("suggested change of semantic version: {}", action);Trait Implementations§
Source§impl PartialEq for Changes
impl PartialEq for Changes
Source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Compare two Changes struct to see if they have the same elements.
§Returns
true if the two structure has the same elements regardless they order, false otherwise.
§Example
use git2::AttrValue::True;
use git2::Repository;
use cargo_semantic_release::Changes;
let git_repo = Repository::open(".").unwrap();
let changes_1 = Changes::from_repo(&git_repo).expect("error during fetching changes");
let changes_2 = Changes::from_repo(&git_repo).expect("error during fetching changes");
assert_eq!(changes_1, changes_2);Auto Trait Implementations§
impl Freeze for Changes
impl RefUnwindSafe for Changes
impl Send for Changes
impl Sync for Changes
impl Unpin for Changes
impl UnwindSafe for Changes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more