chore(config): Rename type RepoName
as RepoAlias
Closes kemitix/git-next#39
This commit is contained in:
parent
0105631e3a
commit
b21b80881e
2 changed files with 11 additions and 11 deletions
|
@ -106,10 +106,10 @@ impl Forge {
|
||||||
ApiToken(self.token.clone().into())
|
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
|
self.repos
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(name, repo)| (RepoName(name.clone()), repo))
|
.map(|(name, repo)| (RepoAlias(name.clone()), repo))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl Display for Forge {
|
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`
|
/// This is the alias for the repo within `git-next-server.toml`
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct RepoName(pub String);
|
pub struct RepoAlias(pub String);
|
||||||
impl Display for RepoName {
|
impl Display for RepoAlias {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{}", self.0)
|
write!(f, "{}", self.0)
|
||||||
}
|
}
|
||||||
|
@ -264,14 +264,14 @@ impl Display for BranchName {
|
||||||
/// The derived information about a repo, used to interact with it
|
/// The derived information about a repo, used to interact with it
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct RepoDetails {
|
pub struct RepoDetails {
|
||||||
pub name: RepoName,
|
pub name: RepoAlias,
|
||||||
pub repo: RepoPath,
|
pub repo: RepoPath,
|
||||||
pub branch: BranchName,
|
pub branch: BranchName,
|
||||||
pub forge: ForgeDetails,
|
pub forge: ForgeDetails,
|
||||||
pub config: Option<RepoConfig>,
|
pub config: Option<RepoConfig>,
|
||||||
}
|
}
|
||||||
impl RepoDetails {
|
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 {
|
Self {
|
||||||
name: name.clone(),
|
name: name.clone(),
|
||||||
repo: RepoPath(repo.repo.clone()),
|
repo: RepoPath(repo.repo.clone()),
|
||||||
|
|
|
@ -14,7 +14,7 @@ use tracing::{error, info, level_filters::LevelFilter};
|
||||||
use crate::{
|
use crate::{
|
||||||
filesystem::FileSystem,
|
filesystem::FileSystem,
|
||||||
server::{
|
server::{
|
||||||
config::{Forge, ForgeName, RepoName},
|
config::{Forge, ForgeName, RepoAlias},
|
||||||
git::Git,
|
git::Git,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -69,7 +69,7 @@ fn create_forge_repos(
|
||||||
forge_name: ForgeName,
|
forge_name: ForgeName,
|
||||||
net: &Network,
|
net: &Network,
|
||||||
git: &Git,
|
git: &Git,
|
||||||
) -> Vec<(ForgeName, RepoName, RepoActor)> {
|
) -> Vec<(ForgeName, RepoAlias, RepoActor)> {
|
||||||
let forge = forge.clone();
|
let forge = forge.clone();
|
||||||
let span = tracing::info_span!("Forge", %forge_name, %forge);
|
let span = tracing::info_span!("Forge", %forge_name, %forge);
|
||||||
let _guard = span.enter();
|
let _guard = span.enter();
|
||||||
|
@ -85,7 +85,7 @@ fn create_actor(
|
||||||
forge: config::Forge,
|
forge: config::Forge,
|
||||||
net: &Network,
|
net: &Network,
|
||||||
git: &Git,
|
git: &Git,
|
||||||
) -> impl Fn((RepoName, &Repo)) -> (ForgeName, RepoName, RepoActor) {
|
) -> impl Fn((RepoAlias, &Repo)) -> (ForgeName, RepoAlias, RepoActor) {
|
||||||
let net = net.clone();
|
let net = net.clone();
|
||||||
let git = git.clone();
|
let git = git.clone();
|
||||||
move |(repo_name, repo)| {
|
move |(repo_name, repo)| {
|
||||||
|
@ -103,7 +103,7 @@ fn create_actor(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start_actor(
|
fn start_actor(
|
||||||
actor: (ForgeName, RepoName, actors::repo::RepoActor),
|
actor: (ForgeName, RepoAlias, actors::repo::RepoActor),
|
||||||
) -> Addr<actors::repo::RepoActor> {
|
) -> Addr<actors::repo::RepoActor> {
|
||||||
let (forge_name, repo_name, actor) = actor;
|
let (forge_name, repo_name, actor) = actor;
|
||||||
let span = tracing::info_span!("Forge/Repo", %forge_name, %repo_name);
|
let span = tracing::info_span!("Forge/Repo", %forge_name, %repo_name);
|
||||||
|
|
Loading…
Reference in a new issue