diff --git a/src/server/config.rs b/src/server/config.rs index d390578..3e6a63d 100644 --- a/src/server/config.rs +++ b/src/server/config.rs @@ -106,10 +106,10 @@ impl Forge { ApiToken(self.token.clone().into()) } - pub fn repos(&self) -> impl Iterator { + pub fn repos(&self) -> impl Iterator { 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, } 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()), diff --git a/src/server/mod.rs b/src/server/mod.rs index 6109df4..57887a6 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -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 { let (forge_name, repo_name, actor) = actor; let span = tracing::info_span!("Forge/Repo", %forge_name, %repo_name);