pub struct Commit<'a> {Show 17 fields
pub id: String,
pub message: String,
pub conv: Option<Commit<'a>>,
pub group: Option<String>,
pub default_scope: Option<String>,
pub scope: Option<String>,
pub links: Vec<Link>,
pub author: Signature,
pub committer: Signature,
pub merge_commit: bool,
pub extra: Option<Value>,
pub remote: Option<RemoteContributor>,
pub github: RemoteContributor,
pub gitlab: RemoteContributor,
pub gitea: RemoteContributor,
pub bitbucket: RemoteContributor,
pub raw_message: Option<String>,
}
Expand description
Common commit object that is parsed from a repository.
Fields§
§id: String
Commit ID.
message: String
Commit message including title, description and summary.
conv: Option<Commit<'a>>
Conventional commit.
group: Option<String>
Commit group based on a commit parser or its conventional type.
default_scope: Option<String>
Default commit scope based on (inherited from) conventional type or a commit parser.
scope: Option<String>
Commit scope for overriding the default one.
links: Vec<Link>
A list of links found in the commit
Commit author.
committer: Signature
Committer.
merge_commit: bool
Whether if the commit has two or more parents.
extra: Option<Value>
Arbitrary data to be used with the --from-context
CLI option.
remote: Option<RemoteContributor>
Remote metadata of the commit.
github: RemoteContributor
remote
field insteadgithub
only.GitHub metadata of the commit.
gitlab: RemoteContributor
remote
field insteadgitlab
only.GitLab metadata of the commit.
gitea: RemoteContributor
remote
field insteadgitea
only.Gitea metadata of the commit.
bitbucket: RemoteContributor
remote
field insteadbitbucket
only.Bitbucket metadata of the commit.
raw_message: Option<String>
Raw message of the normal commit, works as a placeholder for converting normal commit into conventional commit.
Despite the name, it is not actually a raw message.
In fact, it is pre-processed by Commit::preprocess
, and only be
generated when serializing into context
the first time.
Implementations§
Source§impl Commit<'_>
impl Commit<'_>
Sourcepub fn raw_message(&self) -> &str
pub fn raw_message(&self) -> &str
Get raw message for converting into conventional commit.
Sourcepub fn process(&self, config: &GitConfig) -> Result<Self>
pub fn process(&self, config: &GitConfig) -> Result<Self>
Processes the commit.
- converts commit to a conventional commit
- sets the group for the commit
- extracts links and generates URLs
Sourcepub fn into_conventional(self) -> Result<Self>
pub fn into_conventional(self) -> Result<Self>
Returns the commit with its conventional type set.
Sourcepub fn preprocess(self, preprocessors: &[TextProcessor]) -> Result<Self>
pub fn preprocess(self, preprocessors: &[TextProcessor]) -> Result<Self>
Preprocesses the commit using TextProcessor
s.
Modifies the commit message
using regex or custom OS command.
Sourcepub fn parse(
self,
parsers: &[CommitParser],
protect_breaking: bool,
filter: bool,
) -> Result<Self>
pub fn parse( self, parsers: &[CommitParser], protect_breaking: bool, filter: bool, ) -> Result<Self>
Parses the commit using CommitParser
s.
Sourcepub fn parse_links(self, parsers: &[LinkParser]) -> Result<Self>
pub fn parse_links(self, parsers: &[LinkParser]) -> Result<Self>
Parses the commit using LinkParser
s.
Sets the links
of the commit.
Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Commit<'a>
impl<'de, 'a> Deserialize<'de> for Commit<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<'a> StructuralPartialEq for Commit<'a>
Auto Trait Implementations§
impl<'a> Freeze for Commit<'a>
impl<'a> RefUnwindSafe for Commit<'a>
impl<'a> Send for Commit<'a>
impl<'a> Sync for Commit<'a>
impl<'a> Unpin for Commit<'a>
impl<'a> UnwindSafe for Commit<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more