refactor(git): rename reset as push
All checks were successful
Rust / build (push) Successful in 2m2s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful

This commit is contained in:
Paul Campbell 2024-05-16 14:45:25 +01:00
parent 8107411935
commit 446300e786
8 changed files with 17 additions and 15 deletions

View file

@ -60,7 +60,7 @@ bytes = "1.6"
ulid = "1.1"
warp = "0.3"
# error handling
# boilerplate
derive_more = { version = "1.0.0-beta.6", features = [
"as_ref",
"constructor",
@ -68,6 +68,8 @@ derive_more = { version = "1.0.0-beta.6", features = [
"deref",
"from",
] }
# error handling
terrors = "0.3"
# file watcher

View file

@ -4,9 +4,9 @@ pub mod fetch;
mod generation;
mod git_ref;
mod git_remote;
pub mod push;
mod repo_details;
pub mod repository;
pub mod reset;
pub mod validate;
pub use commit::Commit;
@ -14,7 +14,7 @@ pub use fetch::fetch;
pub use generation::Generation;
pub use git_ref::GitRef;
pub use git_remote::GitRemote;
pub use push::push;
pub use repo_details::RepoDetails;
pub use repository::Repository;
pub use reset::reset;
pub use validate::validate;

View file

@ -22,7 +22,7 @@ impl std::fmt::Display for Force {
// TODO: (#72) reimplement using `gix`
#[tracing::instrument(skip_all, fields(branch = %branch_name, to = %to_commit, force = %force))]
pub fn reset(
pub fn push(
repository: &Repository,
repo_details: &RepoDetails,
branch_name: BranchName,

View file

@ -36,7 +36,7 @@ pub async fn advance_next(
&repository,
repo_config.branches().next(),
commit.into(),
git::reset::Force::No,
git::push::Force::No,
) {
warn!(?err, "Failed")
}
@ -91,7 +91,7 @@ pub async fn advance_main(
&repository,
repo_config.branches().main(),
next.into(),
git::reset::Force::No,
git::push::Force::No,
) {
warn!(?err, "Failed")
};

View file

@ -77,7 +77,7 @@ pub async fn validate_positions(
repository,
repo_config.branches().next(),
main.into(),
git::reset::Force::From(next.clone().into()),
git::push::Force::From(next.clone().into()),
) {
warn!(?err, "Failed to reset next to main");
return Err(Error::FailedToResetBranch {
@ -103,7 +103,7 @@ pub async fn validate_positions(
repository,
repo_config.branches().next(),
main.into(),
git::reset::Force::From(next.clone().into()),
git::push::Force::From(next.clone().into()),
) {
warn!(?err, "Failed to reset next to main");
return Err(Error::FailedToResetBranch {

View file

@ -74,10 +74,10 @@ impl super::ForgeLike for ForgeJoEnv {
repository: &git::Repository,
branch_name: BranchName,
to_commit: GitRef,
force: git::reset::Force,
) -> git::reset::Result {
force: git::push::Force,
) -> git::push::Result {
git::fetch(repository, &self.repo_details)?;
git::reset(
git::push(
repository,
&self.repo_details,
branch_name,

View file

@ -44,8 +44,8 @@ impl super::ForgeLike for MockForgeEnv {
_repository: &Repository,
_branch_name: BranchName,
_to_commit: GitRef,
_force: git::reset::Force,
) -> git::reset::Result {
_force: git::push::Force,
) -> git::push::Result {
todo!()
}

View file

@ -50,8 +50,8 @@ pub trait ForgeLike {
repository: &Repository,
branch_name: BranchName,
to_commit: GitRef,
force: git::reset::Force,
) -> git::reset::Result;
force: git::push::Force,
) -> git::push::Result;
/// Checks the results of any (e.g. CI) status checks for the commit.
async fn commit_status(&self, commit: &git::Commit) -> CommitStatus;