2024-05-23 16:50:36 +01:00
|
|
|
use crate as git;
|
|
|
|
use git_next_config::BranchName;
|
|
|
|
|
|
|
|
pub type Result = core::result::Result<Positions, Error>;
|
|
|
|
|
|
|
|
pub struct Positions {
|
|
|
|
pub main: git::Commit,
|
|
|
|
pub next: git::Commit,
|
|
|
|
pub dev: git::Commit,
|
|
|
|
pub dev_commit_history: Vec<git::Commit>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, derive_more::Display)]
|
|
|
|
pub enum Error {
|
2024-05-25 11:29:08 +01:00
|
|
|
Fetch(git::fetch::Error),
|
|
|
|
|
2024-05-26 07:42:47 +01:00
|
|
|
CommitLog(git::commit::log::Error),
|
|
|
|
|
2024-05-23 16:50:36 +01:00
|
|
|
#[display("Failed to Reset Branch {branch} to {commit}")]
|
|
|
|
FailedToResetBranch {
|
|
|
|
branch: BranchName,
|
|
|
|
commit: git::Commit,
|
|
|
|
},
|
2024-05-25 11:29:08 +01:00
|
|
|
|
2024-05-23 16:50:36 +01:00
|
|
|
BranchReset(BranchName),
|
2024-05-25 11:29:08 +01:00
|
|
|
|
2024-05-23 16:50:36 +01:00
|
|
|
BranchHasNoCommits(BranchName),
|
2024-05-25 11:29:08 +01:00
|
|
|
|
2024-05-23 16:50:36 +01:00
|
|
|
DevBranchNotBasedOn(BranchName),
|
|
|
|
}
|
|
|
|
impl std::error::Error for Error {}
|
2024-05-25 11:29:08 +01:00
|
|
|
|
|
|
|
impl From<git::fetch::Error> for Error {
|
|
|
|
fn from(value: git::fetch::Error) -> Self {
|
|
|
|
Self::Fetch(value)
|
|
|
|
}
|
|
|
|
}
|