refactor(forge): rename gitforge crate as forge
All checks were successful
Rust / build (push) Successful in 1m8s
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

This commit is contained in:
Paul Campbell 2024-05-23 16:04:38 +01:00
parent ebbb655bfc
commit f2af849d0b
21 changed files with 24 additions and 22 deletions

View file

@ -5,7 +5,7 @@ members = [
"crates/server",
"crates/config",
"crates/git",
"crates/gitforge",
"crates/forge",
"crates/repo-actor",
]
@ -23,7 +23,7 @@ expect_used = "warn"
git-next-server = { path = "crates/server" }
git-next-config = { path = "crates/config" }
git-next-git = { path = "crates/git" }
git-next-gitforge = { path = "crates/gitforge" }
git-next-forge = { path = "crates/forge" }
git-next-repo-actor = { path = "crates/repo-actor" }
# CLI parsing

View file

@ -1,5 +1,5 @@
[package]
name = "git-next-gitforge"
name = "git-next-forge"
version = { workspace = true }
edition = { workspace = true }

View file

@ -11,7 +11,7 @@ github = []
[dependencies]
git-next-config = { workspace = true }
git-next-git = { workspace = true }
git-next-gitforge = { workspace = true }
git-next-forge = { workspace = true }
# logging
console-subscriber = { workspace = true }

View file

@ -3,10 +3,11 @@ use std::time::Duration;
use actix::prelude::*;
use git_next_config::RepoConfig;
use git_next_forge as forge;
use git_next_git as git;
use tracing::{info, warn};
use crate::{gitforge, MessageToken, ValidateRepo};
use crate::{MessageToken, ValidateRepo};
// advance next to the next commit towards the head of the dev branch
#[tracing::instrument(fields(next), skip_all)]
@ -14,7 +15,7 @@ pub async fn advance_next(
next: git::Commit,
dev_commit_history: Vec<git::Commit>,
repo_config: RepoConfig,
forge: gitforge::Forge,
forge: forge::Forge,
repository: git::OpenRepository,
addr: Addr<super::RepoActor>,
message_token: MessageToken,
@ -78,7 +79,7 @@ pub fn find_next_commit_on_dev(
pub async fn advance_main(
next: git::Commit,
repo_config: &RepoConfig,
forge: &gitforge::Forge,
forge: &forge::Forge,
repository: &git::OpenRepository,
) {
info!("Advancing main to next");

View file

@ -1,14 +1,15 @@
use actix::prelude::*;
use git_next_forge as forge;
use git_next_git::RepoDetails;
use tracing::{error, info};
use crate::{gitforge, load};
use crate::load;
use super::{LoadedConfig, RepoActor};
/// Loads the [RepoConfig] from the `.git-next.toml` file in the repository
#[tracing::instrument(skip_all, fields(branch = %repo_details.branch))]
pub async fn load(repo_details: RepoDetails, addr: Addr<RepoActor>, forge: gitforge::Forge) {
pub async fn load(repo_details: RepoDetails, addr: Addr<RepoActor>, forge: forge::Forge) {
info!("Loading .git-next.toml from repo");
let repo_config = match load::load(&repo_details, &forge).await {
Ok(repo_config) => repo_config,

View file

@ -12,8 +12,8 @@ use std::time::Duration;
use actix::prelude::*;
use git::OpenRepository;
use git_next_config::{server::Webhook, ForgeType, RepoConfig, RepoConfigSource};
use git_next_forge as forge;
use git_next_git::{self as git, Generation, RepoDetails};
use git_next_gitforge::{self as gitforge, validation};
use kxio::network::Network;
use tracing::{debug, info, warn, Instrument};
@ -37,7 +37,7 @@ pub struct RepoActor {
last_dev_commit: Option<git::Commit>,
repository: Option<OpenRepository>,
net: Network,
forge: gitforge::Forge,
forge: forge::Forge,
}
impl RepoActor {
pub fn new(
@ -49,8 +49,8 @@ impl RepoActor {
) -> Self {
let forge = match details.forge.forge_type() {
#[cfg(feature = "forgejo")]
ForgeType::ForgeJo => gitforge::Forge::new_forgejo(details.clone(), net.clone(), repo),
ForgeType::MockForge => gitforge::Forge::new_mock(),
ForgeType::ForgeJo => forge::Forge::new_forgejo(details.clone(), net.clone(), repo),
ForgeType::MockForge => forge::Forge::new_mock(),
};
debug!(?forge, "new");
Self {
@ -191,7 +191,7 @@ impl Handler<ValidateRepo> for RepoActor {
.branches_validate_positions(repository, repo_config)
.await
{
Ok(validation::Positions {
Ok(forge::validation::Positions {
main,
next,
dev,

View file

@ -1,10 +1,9 @@
use git_next_config::{self as config, BranchName, RepoConfig};
use git_next_forge as forge;
use git_next_git::RepoDetails;
use tracing::error;
use crate::gitforge;
pub async fn load(details: &RepoDetails, forge: &gitforge::Forge) -> Result<RepoConfig, Error> {
pub async fn load(details: &RepoDetails, forge: &forge::Forge) -> Result<RepoConfig, Error> {
let contents = forge
.file_contents_get(&details.branch, ".git-next.toml")
.await?;
@ -15,14 +14,14 @@ pub async fn load(details: &RepoDetails, forge: &gitforge::Forge) -> Result<Repo
#[derive(Debug, derive_more::From, derive_more::Display)]
pub enum Error {
File(gitforge::file::Error),
File(forge::file::Error),
Config(config::server::Error),
Toml(toml::de::Error),
Forge(gitforge::branch::Error),
Forge(forge::branch::Error),
BranchNotFound(BranchName),
}
pub async fn validate(config: RepoConfig, forge: &gitforge::Forge) -> Result<RepoConfig, Error> {
pub async fn validate(config: RepoConfig, forge: &forge::Forge) -> Result<RepoConfig, Error> {
let branches = forge.branches_get_all().await.map_err(|e| {
error!(?e, "Failed to list branches");
Error::Forge(e)

View file

@ -1,6 +1,7 @@
//
use actix::prelude::*;
use git_next_forge as forge;
use git_next_git as git;
use tracing::{info, warn};
@ -11,7 +12,7 @@ use super::AdvanceMainTo;
pub async fn check_next(
next: git::Commit,
addr: Addr<super::RepoActor>,
forge: git_next_gitforge::Forge,
forge: forge::Forge,
message_token: MessageToken,
) {
// get the status - pass, fail, pending (all others map to fail, e.g. error)

View file

@ -11,7 +11,7 @@ github = []
[dependencies]
git-next-config = { workspace = true }
git-next-git = { workspace = true }
git-next-gitforge = { workspace = true }
git-next-forge = { workspace = true }
git-next-repo-actor = { workspace = true }
# logging