forked from kemitix/git-next
refactor(forge): rename gitforge crate as forge
This commit is contained in:
parent
ebbb655bfc
commit
f2af849d0b
21 changed files with 24 additions and 22 deletions
|
@ -5,7 +5,7 @@ members = [
|
||||||
"crates/server",
|
"crates/server",
|
||||||
"crates/config",
|
"crates/config",
|
||||||
"crates/git",
|
"crates/git",
|
||||||
"crates/gitforge",
|
"crates/forge",
|
||||||
"crates/repo-actor",
|
"crates/repo-actor",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ expect_used = "warn"
|
||||||
git-next-server = { path = "crates/server" }
|
git-next-server = { path = "crates/server" }
|
||||||
git-next-config = { path = "crates/config" }
|
git-next-config = { path = "crates/config" }
|
||||||
git-next-git = { path = "crates/git" }
|
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" }
|
git-next-repo-actor = { path = "crates/repo-actor" }
|
||||||
|
|
||||||
# CLI parsing
|
# CLI parsing
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "git-next-gitforge"
|
name = "git-next-forge"
|
||||||
version = { workspace = true }
|
version = { workspace = true }
|
||||||
edition = { workspace = true }
|
edition = { workspace = true }
|
||||||
|
|
|
@ -11,7 +11,7 @@ github = []
|
||||||
[dependencies]
|
[dependencies]
|
||||||
git-next-config = { workspace = true }
|
git-next-config = { workspace = true }
|
||||||
git-next-git = { workspace = true }
|
git-next-git = { workspace = true }
|
||||||
git-next-gitforge = { workspace = true }
|
git-next-forge = { workspace = true }
|
||||||
|
|
||||||
# logging
|
# logging
|
||||||
console-subscriber = { workspace = true }
|
console-subscriber = { workspace = true }
|
||||||
|
|
|
@ -3,10 +3,11 @@ use std::time::Duration;
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
|
|
||||||
use git_next_config::RepoConfig;
|
use git_next_config::RepoConfig;
|
||||||
|
use git_next_forge as forge;
|
||||||
use git_next_git as git;
|
use git_next_git as git;
|
||||||
use tracing::{info, warn};
|
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
|
// advance next to the next commit towards the head of the dev branch
|
||||||
#[tracing::instrument(fields(next), skip_all)]
|
#[tracing::instrument(fields(next), skip_all)]
|
||||||
|
@ -14,7 +15,7 @@ pub async fn advance_next(
|
||||||
next: git::Commit,
|
next: git::Commit,
|
||||||
dev_commit_history: Vec<git::Commit>,
|
dev_commit_history: Vec<git::Commit>,
|
||||||
repo_config: RepoConfig,
|
repo_config: RepoConfig,
|
||||||
forge: gitforge::Forge,
|
forge: forge::Forge,
|
||||||
repository: git::OpenRepository,
|
repository: git::OpenRepository,
|
||||||
addr: Addr<super::RepoActor>,
|
addr: Addr<super::RepoActor>,
|
||||||
message_token: MessageToken,
|
message_token: MessageToken,
|
||||||
|
@ -78,7 +79,7 @@ pub fn find_next_commit_on_dev(
|
||||||
pub async fn advance_main(
|
pub async fn advance_main(
|
||||||
next: git::Commit,
|
next: git::Commit,
|
||||||
repo_config: &RepoConfig,
|
repo_config: &RepoConfig,
|
||||||
forge: &gitforge::Forge,
|
forge: &forge::Forge,
|
||||||
repository: &git::OpenRepository,
|
repository: &git::OpenRepository,
|
||||||
) {
|
) {
|
||||||
info!("Advancing main to next");
|
info!("Advancing main to next");
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
|
use git_next_forge as forge;
|
||||||
use git_next_git::RepoDetails;
|
use git_next_git::RepoDetails;
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
|
|
||||||
use crate::{gitforge, load};
|
use crate::load;
|
||||||
|
|
||||||
use super::{LoadedConfig, RepoActor};
|
use super::{LoadedConfig, RepoActor};
|
||||||
|
|
||||||
/// Loads the [RepoConfig] from the `.git-next.toml` file in the repository
|
/// Loads the [RepoConfig] from the `.git-next.toml` file in the repository
|
||||||
#[tracing::instrument(skip_all, fields(branch = %repo_details.branch))]
|
#[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");
|
info!("Loading .git-next.toml from repo");
|
||||||
let repo_config = match load::load(&repo_details, &forge).await {
|
let repo_config = match load::load(&repo_details, &forge).await {
|
||||||
Ok(repo_config) => repo_config,
|
Ok(repo_config) => repo_config,
|
||||||
|
|
|
@ -12,8 +12,8 @@ use std::time::Duration;
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
use git::OpenRepository;
|
use git::OpenRepository;
|
||||||
use git_next_config::{server::Webhook, ForgeType, RepoConfig, RepoConfigSource};
|
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_git::{self as git, Generation, RepoDetails};
|
||||||
use git_next_gitforge::{self as gitforge, validation};
|
|
||||||
use kxio::network::Network;
|
use kxio::network::Network;
|
||||||
use tracing::{debug, info, warn, Instrument};
|
use tracing::{debug, info, warn, Instrument};
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ pub struct RepoActor {
|
||||||
last_dev_commit: Option<git::Commit>,
|
last_dev_commit: Option<git::Commit>,
|
||||||
repository: Option<OpenRepository>,
|
repository: Option<OpenRepository>,
|
||||||
net: Network,
|
net: Network,
|
||||||
forge: gitforge::Forge,
|
forge: forge::Forge,
|
||||||
}
|
}
|
||||||
impl RepoActor {
|
impl RepoActor {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
|
@ -49,8 +49,8 @@ impl RepoActor {
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let forge = match details.forge.forge_type() {
|
let forge = match details.forge.forge_type() {
|
||||||
#[cfg(feature = "forgejo")]
|
#[cfg(feature = "forgejo")]
|
||||||
ForgeType::ForgeJo => gitforge::Forge::new_forgejo(details.clone(), net.clone(), repo),
|
ForgeType::ForgeJo => forge::Forge::new_forgejo(details.clone(), net.clone(), repo),
|
||||||
ForgeType::MockForge => gitforge::Forge::new_mock(),
|
ForgeType::MockForge => forge::Forge::new_mock(),
|
||||||
};
|
};
|
||||||
debug!(?forge, "new");
|
debug!(?forge, "new");
|
||||||
Self {
|
Self {
|
||||||
|
@ -191,7 +191,7 @@ impl Handler<ValidateRepo> for RepoActor {
|
||||||
.branches_validate_positions(repository, repo_config)
|
.branches_validate_positions(repository, repo_config)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(validation::Positions {
|
Ok(forge::validation::Positions {
|
||||||
main,
|
main,
|
||||||
next,
|
next,
|
||||||
dev,
|
dev,
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
use git_next_config::{self as config, BranchName, RepoConfig};
|
use git_next_config::{self as config, BranchName, RepoConfig};
|
||||||
|
use git_next_forge as forge;
|
||||||
use git_next_git::RepoDetails;
|
use git_next_git::RepoDetails;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
use crate::gitforge;
|
pub async fn load(details: &RepoDetails, forge: &forge::Forge) -> Result<RepoConfig, Error> {
|
||||||
|
|
||||||
pub async fn load(details: &RepoDetails, forge: &gitforge::Forge) -> Result<RepoConfig, Error> {
|
|
||||||
let contents = forge
|
let contents = forge
|
||||||
.file_contents_get(&details.branch, ".git-next.toml")
|
.file_contents_get(&details.branch, ".git-next.toml")
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -15,14 +14,14 @@ pub async fn load(details: &RepoDetails, forge: &gitforge::Forge) -> Result<Repo
|
||||||
|
|
||||||
#[derive(Debug, derive_more::From, derive_more::Display)]
|
#[derive(Debug, derive_more::From, derive_more::Display)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
File(gitforge::file::Error),
|
File(forge::file::Error),
|
||||||
Config(config::server::Error),
|
Config(config::server::Error),
|
||||||
Toml(toml::de::Error),
|
Toml(toml::de::Error),
|
||||||
Forge(gitforge::branch::Error),
|
Forge(forge::branch::Error),
|
||||||
BranchNotFound(BranchName),
|
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| {
|
let branches = forge.branches_get_all().await.map_err(|e| {
|
||||||
error!(?e, "Failed to list branches");
|
error!(?e, "Failed to list branches");
|
||||||
Error::Forge(e)
|
Error::Forge(e)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
//
|
//
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
|
|
||||||
|
use git_next_forge as forge;
|
||||||
use git_next_git as git;
|
use git_next_git as git;
|
||||||
use tracing::{info, warn};
|
use tracing::{info, warn};
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ use super::AdvanceMainTo;
|
||||||
pub async fn check_next(
|
pub async fn check_next(
|
||||||
next: git::Commit,
|
next: git::Commit,
|
||||||
addr: Addr<super::RepoActor>,
|
addr: Addr<super::RepoActor>,
|
||||||
forge: git_next_gitforge::Forge,
|
forge: forge::Forge,
|
||||||
message_token: MessageToken,
|
message_token: MessageToken,
|
||||||
) {
|
) {
|
||||||
// get the status - pass, fail, pending (all others map to fail, e.g. error)
|
// get the status - pass, fail, pending (all others map to fail, e.g. error)
|
||||||
|
|
|
@ -11,7 +11,7 @@ github = []
|
||||||
[dependencies]
|
[dependencies]
|
||||||
git-next-config = { workspace = true }
|
git-next-config = { workspace = true }
|
||||||
git-next-git = { workspace = true }
|
git-next-git = { workspace = true }
|
||||||
git-next-gitforge = { workspace = true }
|
git-next-forge = { workspace = true }
|
||||||
git-next-repo-actor = { workspace = true }
|
git-next-repo-actor = { workspace = true }
|
||||||
|
|
||||||
# logging
|
# logging
|
||||||
|
|
Loading…
Reference in a new issue