git-next/crates/config/src/repo_branches.rs
Paul Campbell 4d352f005d
All checks were successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
refactor(server,config,git): extract modules config and git from server
2024-05-12 10:49:33 +01:00

34 lines
905 B
Rust

use crate::BranchName;
/// Mapped from `.git-next.toml` file at `branches`
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize)]
pub struct RepoBranches {
pub main: String,
pub next: String,
pub dev: String,
}
impl RepoBranches {
pub fn new(main: impl Into<String>, next: impl Into<String>, dev: impl Into<String>) -> Self {
Self {
main: main.into(),
next: next.into(),
dev: dev.into(),
}
}
pub fn main(&self) -> BranchName {
BranchName(self.main.clone())
}
pub fn next(&self) -> BranchName {
BranchName(self.next.clone())
}
pub fn dev(&self) -> BranchName {
BranchName(self.dev.clone())
}
}
impl std::fmt::Display for RepoBranches {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{},{},{}", self.main, self.next, self.dev)
}
}