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" ulid = "1.1"
warp = "0.3" warp = "0.3"
# error handling # boilerplate
derive_more = { version = "1.0.0-beta.6", features = [ derive_more = { version = "1.0.0-beta.6", features = [
"as_ref", "as_ref",
"constructor", "constructor",
@ -68,6 +68,8 @@ derive_more = { version = "1.0.0-beta.6", features = [
"deref", "deref",
"from", "from",
] } ] }
# error handling
terrors = "0.3" terrors = "0.3"
# file watcher # file watcher

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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