Changes

Struct Changes 

Source
pub struct Changes { /* private fields */ }
Expand description

Structure that represents the changes in a git repository

Implementations§

Source§

impl Changes

Source

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}")
Source

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 Debug for Changes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Changes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Format the values in Changes

Example output:

major:
        :boom: Introduce breaking change

minor:
        :sparkles: Add new feature

patch:
        :recycle: Refactor codebase

other:
        :bulb: Add comments
Source§

impl PartialEq for Changes

Source§

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);
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<&Repository> for Changes

Source§

type Error = Box<dyn Error>

The type returned in the event of a conversion error.
Source§

fn try_from(value: &Repository) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,