Skip to main content

CommitBuilder

Struct CommitBuilder 

Source
pub struct CommitBuilder(/* private fields */);
Expand description

A builder for creating commits in a working tree.

This struct provides a fluent interface for setting the parameters of a commit and then creating it.

Implementations§

Source§

impl CommitBuilder

Source

pub fn committer(self, committer: &str) -> Self

Set the committer for this commit.

§Parameters
  • committer - The committer’s name and email.
§Returns

Self for method chaining.

Source

pub fn message(self, message: &str) -> Self

Set the commit message.

§Parameters
  • message - The commit message.
§Returns

Self for method chaining.

Source

pub fn specific_files(self, specific_files: &[&Path]) -> Self

Specify which files to include in this commit.

§Parameters
  • specific_files - The paths of files to include in this commit.
§Returns

Self for method chaining.

Source

pub fn allow_pointless(self, allow_pointless: bool) -> Self

Allow pointless commits.

§Parameters
  • allow_pointless - Whether to allow commits that don’t change any files.
§Returns

Self for method chaining.

Source

pub fn reporter(self, reporter: &dyn PyCommitReporter) -> Self

Set a reporter for this commit.

§Parameters
  • reporter - The commit reporter to use.
§Returns

Self for method chaining.

Source

pub fn timestamp(self, timestamp: f64) -> Self

Set the timestamp for this commit.

§Parameters
  • timestamp - The timestamp for the commit.
§Returns

Self for method chaining.

Source

pub fn set_revprop(self, key: &str, value: &str) -> Result<Self, Error>

Set a revision property for this commit.

Revision properties are key-value pairs that can be attached to commits to store additional metadata beyond the standard commit fields.

§Parameters
  • key - The property key (name).
  • value - The property value as a string.
§Returns

Self for method chaining, or an error if the operation failed.

Source

pub fn commit(self) -> Result<RevisionId, Error>

Create the commit.

§Returns

The revision ID of the new commit, or an error if the commit could not be created.

Trait Implementations§

Source§

impl From<GenericWorkingTree> for CommitBuilder

Source§

fn from(wt: GenericWorkingTree) -> Self

Create a new CommitBuilder from a WorkingTree.

§Parameters
  • wt - The working tree to create commits in.
§Returns

A new CommitBuilder instance.

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, 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> Ungil for T
where T: Send,