chore(config): Rename type RepoName as RepoAlias
All checks were successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful

Closes kemitix/git-next#39
This commit is contained in:
Paul Campbell 2024-04-13 11:45:58 +01:00
parent 0105631e3a
commit b21b80881e
2 changed files with 11 additions and 11 deletions

View file

@ -106,10 +106,10 @@ impl Forge {
ApiToken(self.token.clone().into())
}
pub fn repos(&self) -> impl Iterator<Item = (RepoName, &Repo)> {
pub fn repos(&self) -> impl Iterator<Item = (RepoAlias, &Repo)> {
self.repos
.iter()
.map(|(name, repo)| (RepoName(name.clone()), repo))
.map(|(name, repo)| (RepoAlias(name.clone()), repo))
}
}
impl Display for Forge {
@ -231,11 +231,11 @@ impl From<(&ForgeName, &Forge)> for ForgeDetails {
}
}
/// The name of a repo // TODO: (#39) rename as RepoAlias
/// The alias of a repo
/// This is the alias for the repo within `git-next-server.toml`
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RepoName(pub String);
impl Display for RepoName {
pub struct RepoAlias(pub String);
impl Display for RepoAlias {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
@ -264,14 +264,14 @@ impl Display for BranchName {
/// The derived information about a repo, used to interact with it
#[derive(Clone, Debug)]
pub struct RepoDetails {
pub name: RepoName,
pub name: RepoAlias,
pub repo: RepoPath,
pub branch: BranchName,
pub forge: ForgeDetails,
pub config: Option<RepoConfig>,
}
impl RepoDetails {
pub fn new(name: &RepoName, repo: &Repo, forge_name: &ForgeName, forge: &Forge) -> Self {
pub fn new(name: &RepoAlias, repo: &Repo, forge_name: &ForgeName, forge: &Forge) -> Self {
Self {
name: name.clone(),
repo: RepoPath(repo.repo.clone()),

View file

@ -14,7 +14,7 @@ use tracing::{error, info, level_filters::LevelFilter};
use crate::{
filesystem::FileSystem,
server::{
config::{Forge, ForgeName, RepoName},
config::{Forge, ForgeName, RepoAlias},
git::Git,
},
};
@ -69,7 +69,7 @@ fn create_forge_repos(
forge_name: ForgeName,
net: &Network,
git: &Git,
) -> Vec<(ForgeName, RepoName, RepoActor)> {
) -> Vec<(ForgeName, RepoAlias, RepoActor)> {
let forge = forge.clone();
let span = tracing::info_span!("Forge", %forge_name, %forge);
let _guard = span.enter();
@ -85,7 +85,7 @@ fn create_actor(
forge: config::Forge,
net: &Network,
git: &Git,
) -> impl Fn((RepoName, &Repo)) -> (ForgeName, RepoName, RepoActor) {
) -> impl Fn((RepoAlias, &Repo)) -> (ForgeName, RepoAlias, RepoActor) {
let net = net.clone();
let git = git.clone();
move |(repo_name, repo)| {
@ -103,7 +103,7 @@ fn create_actor(
}
fn start_actor(
actor: (ForgeName, RepoName, actors::repo::RepoActor),
actor: (ForgeName, RepoAlias, actors::repo::RepoActor),
) -> Addr<actors::repo::RepoActor> {
let (forge_name, repo_name, actor) = actor;
let span = tracing::info_span!("Forge/Repo", %forge_name, %repo_name);