Compare commits
2 commits
7aea70f5ee
...
e51f09ccb3
Author | SHA1 | Date | |
---|---|---|---|
e51f09ccb3 | |||
4351fba73a |
18 changed files with 167 additions and 122 deletions
|
@ -7,6 +7,7 @@ members = [
|
||||||
"crates/git",
|
"crates/git",
|
||||||
"crates/forge",
|
"crates/forge",
|
||||||
"crates/forge-forgejo",
|
"crates/forge-forgejo",
|
||||||
|
"crates/forge-github",
|
||||||
"crates/repo-actor",
|
"crates/repo-actor",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@ git-next-config = { path = "crates/config" }
|
||||||
git-next-git = { path = "crates/git" }
|
git-next-git = { path = "crates/git" }
|
||||||
git-next-forge = { path = "crates/forge" }
|
git-next-forge = { path = "crates/forge" }
|
||||||
git-next-forge-forgejo = { path = "crates/forge-forgejo" }
|
git-next-forge-forgejo = { path = "crates/forge-forgejo" }
|
||||||
|
git-next-forge-github = { path = "crates/forge-github" }
|
||||||
git-next-repo-actor = { path = "crates/repo-actor" }
|
git-next-repo-actor = { path = "crates/repo-actor" }
|
||||||
|
|
||||||
# CLI parsing
|
# CLI parsing
|
||||||
|
|
|
@ -4,7 +4,7 @@ version = { workspace = true }
|
||||||
edition = { workspace = true }
|
edition = { workspace = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["forgejo"]
|
default = ["forgejo", "github"]
|
||||||
forgejo = []
|
forgejo = []
|
||||||
github = []
|
github = []
|
||||||
|
|
||||||
|
|
|
@ -4,26 +4,20 @@ mod file;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use git::validation::repo::validate_repo;
|
|
||||||
use git_next_config as config;
|
use git_next_config as config;
|
||||||
use git_next_git as git;
|
use git_next_git as git;
|
||||||
|
|
||||||
use kxio::network::{self, Network};
|
use kxio::network::{self, Network};
|
||||||
use tracing::{error, info, warn};
|
use tracing::{error, warn};
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct ForgeJo {
|
pub struct ForgeJo {
|
||||||
repo_details: git::RepoDetails,
|
repo_details: git::RepoDetails,
|
||||||
net: Network,
|
net: Network,
|
||||||
repo: git::Repository,
|
|
||||||
}
|
}
|
||||||
impl ForgeJo {
|
impl ForgeJo {
|
||||||
pub const fn new(repo_details: git::RepoDetails, net: Network, repo: git::Repository) -> Self {
|
pub const fn new(repo_details: git::RepoDetails, net: Network) -> Self {
|
||||||
Self {
|
Self { repo_details, net }
|
||||||
repo_details,
|
|
||||||
net,
|
|
||||||
repo,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
|
@ -41,6 +35,7 @@ impl git::ForgeLike for ForgeJo {
|
||||||
branch: &config::BranchName,
|
branch: &config::BranchName,
|
||||||
file_path: &str,
|
file_path: &str,
|
||||||
) -> Result<String, git::file::Error> {
|
) -> Result<String, git::file::Error> {
|
||||||
|
// TODO: get from local cloned repo
|
||||||
file::contents_get(&self.repo_details, &self.net, branch, file_path).await
|
file::contents_get(&self.repo_details, &self.net, branch, file_path).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,22 +82,6 @@ impl git::ForgeLike for ForgeJo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repo_clone(
|
|
||||||
&self,
|
|
||||||
gitdir: config::GitDir,
|
|
||||||
) -> Result<git::OpenRepository, git::repository::Error> {
|
|
||||||
let repository = if !gitdir.exists() {
|
|
||||||
info!("Local copy not found - cloning...");
|
|
||||||
self.repo.git_clone(&self.repo_details)?
|
|
||||||
} else {
|
|
||||||
self.repo.open(&gitdir)?
|
|
||||||
};
|
|
||||||
info!("Validating...");
|
|
||||||
validate_repo(&repository, &self.repo_details)
|
|
||||||
.map_err(|e| git::repository::Error::Validation(e.to_string()))?;
|
|
||||||
Ok(repository)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, serde::Deserialize)]
|
#[derive(Debug, serde::Deserialize)]
|
||||||
|
|
|
@ -23,8 +23,7 @@ mod branch {
|
||||||
let repo_details = given_repo_details(fs.base(), 1);
|
let repo_details = given_repo_details(fs.base(), 1);
|
||||||
|
|
||||||
let net = Network::from(net);
|
let net = Network::from(net);
|
||||||
let (repo, _reality) = git::repository::mock();
|
let forge = forgejo::ForgeJo::new(repo_details, net.clone());
|
||||||
let forge = forgejo::ForgeJo::new(repo_details, net.clone(), repo);
|
|
||||||
|
|
||||||
//when
|
//when
|
||||||
let_assert!(Ok(branches) = forge.branches_get_all().await);
|
let_assert!(Ok(branches) = forge.branches_get_all().await);
|
||||||
|
|
59
crates/forge-github/Cargo.toml
Normal file
59
crates/forge-github/Cargo.toml
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
[package]
|
||||||
|
name = "git-next-forge-github"
|
||||||
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
git-next-config = { workspace = true }
|
||||||
|
git-next-git = { workspace = true }
|
||||||
|
|
||||||
|
# logging
|
||||||
|
console-subscriber = { workspace = true }
|
||||||
|
tracing = { workspace = true }
|
||||||
|
tracing-subscriber = { workspace = true }
|
||||||
|
|
||||||
|
# base64 decoding
|
||||||
|
base64 = { workspace = true }
|
||||||
|
|
||||||
|
# git
|
||||||
|
async-trait = { workspace = true }
|
||||||
|
|
||||||
|
# fs/network
|
||||||
|
kxio = { workspace = true }
|
||||||
|
|
||||||
|
# TOML parsing
|
||||||
|
serde = { workspace = true }
|
||||||
|
serde_json = { workspace = true }
|
||||||
|
toml = { workspace = true }
|
||||||
|
|
||||||
|
# Secrets and Password
|
||||||
|
secrecy = { workspace = true }
|
||||||
|
|
||||||
|
# Conventional Commit check
|
||||||
|
git-conventional = { workspace = true }
|
||||||
|
|
||||||
|
# Webhooks
|
||||||
|
bytes = { workspace = true }
|
||||||
|
ulid = { workspace = true }
|
||||||
|
warp = { workspace = true }
|
||||||
|
|
||||||
|
# boilerplate
|
||||||
|
derive_more = { workspace = true }
|
||||||
|
|
||||||
|
# file watcher
|
||||||
|
inotify = { workspace = true }
|
||||||
|
|
||||||
|
# # Actors
|
||||||
|
# actix = { workspace = true }
|
||||||
|
# actix-rt = { workspace = true }
|
||||||
|
tokio = { workspace = true }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
# Testing
|
||||||
|
assert2 = { workspace = true }
|
||||||
|
|
||||||
|
[lints.clippy]
|
||||||
|
nursery = { level = "warn", priority = -1 }
|
||||||
|
# pedantic = "warn"
|
||||||
|
unwrap_used = "warn"
|
||||||
|
expect_used = "warn"
|
39
crates/forge-github/src/lib.rs
Normal file
39
crates/forge-github/src/lib.rs
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
//
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
use derive_more::Constructor;
|
||||||
|
use git_next_config as config;
|
||||||
|
use git_next_git as git;
|
||||||
|
|
||||||
|
use kxio::network::Network;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests;
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Constructor)]
|
||||||
|
pub struct Github {
|
||||||
|
net: Network,
|
||||||
|
}
|
||||||
|
#[async_trait::async_trait]
|
||||||
|
impl git_next_git::ForgeLike for Github {
|
||||||
|
fn name(&self) -> String {
|
||||||
|
"github".to_string()
|
||||||
|
}
|
||||||
|
async fn branches_get_all(&self) -> Result<Vec<config::BranchName>, git::branch::Error> {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the contents of the file.
|
||||||
|
async fn file_contents_get(
|
||||||
|
&self,
|
||||||
|
_branch_name: &config::BranchName,
|
||||||
|
_file_path: &str,
|
||||||
|
) -> Result<String, git::file::Error> {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Checks the results of any (e.g. CI) status checks for the commit.
|
||||||
|
async fn commit_status(&self, _commit: &git::Commit) -> git::commit::Status {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
}
|
8
crates/forge-github/src/tests/mod.rs
Normal file
8
crates/forge-github/src/tests/mod.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use git_next_git::ForgeLike as _;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_name() {
|
||||||
|
let net = kxio::network::Network::new_mock();
|
||||||
|
let forge = crate::Github::new(net);
|
||||||
|
assert_eq!(forge.name(), "github");
|
||||||
|
}
|
|
@ -4,14 +4,15 @@ version = { workspace = true }
|
||||||
edition = { workspace = true }
|
edition = { workspace = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["forgejo"]
|
default = ["forgejo", "github"]
|
||||||
forgejo = ["git-next-forge-forgejo"]
|
forgejo = ["git-next-forge-forgejo"]
|
||||||
github = []
|
github = ["git-next-forge-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-forge-forgejo = { workspace = true, optional = true }
|
git-next-forge-forgejo = { workspace = true, optional = true }
|
||||||
|
git-next-forge-github = { workspace = true, optional = true }
|
||||||
|
|
||||||
# logging
|
# logging
|
||||||
console-subscriber = { workspace = true }
|
console-subscriber = { workspace = true }
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
use crate::network::Network;
|
|
||||||
|
|
||||||
struct Github;
|
|
||||||
pub(super) struct GithubEnv {
|
|
||||||
net: Network,
|
|
||||||
}
|
|
||||||
impl GithubEnv {
|
|
||||||
pub(crate) const fn new(net: Network) -> GithubEnv {
|
|
||||||
Self { net }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[async_trait::async_trait]
|
|
||||||
impl super::ForgeLike for GithubEnv {
|
|
||||||
fn name(&self) -> String {
|
|
||||||
"github".to_string()
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn branches_get_all(&self) -> Vec<super::Branch> {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +1,34 @@
|
||||||
#![allow(dead_code)]
|
//
|
||||||
|
|
||||||
use git_next_forge_forgejo as forgejo;
|
use git_next_forge_forgejo as forgejo;
|
||||||
|
use git_next_forge_github as github;
|
||||||
use git_next_git as git;
|
use git_next_git as git;
|
||||||
use kxio::network::Network;
|
use kxio::network::Network;
|
||||||
|
|
||||||
#[cfg(feature = "github")]
|
|
||||||
mod github;
|
|
||||||
|
|
||||||
mod mock_forge;
|
mod mock_forge;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum Forge {
|
pub enum Forge {
|
||||||
Mock(mock_forge::MockForgeEnv),
|
Mock(mock_forge::MockForge),
|
||||||
#[allow(clippy::enum_variant_names)]
|
|
||||||
#[cfg(feature = "forgejo")]
|
#[cfg(feature = "forgejo")]
|
||||||
ForgeJo(forgejo::ForgeJo),
|
ForgeJo(git_next_forge_forgejo::ForgeJo),
|
||||||
|
|
||||||
#[cfg(feature = "github")]
|
#[cfg(feature = "github")]
|
||||||
Github(github::GithubEnv),
|
Github(git_next_forge_github::Github),
|
||||||
}
|
}
|
||||||
impl Forge {
|
impl Forge {
|
||||||
pub const fn new_mock() -> Self {
|
pub const fn new_mock() -> Self {
|
||||||
Self::Mock(mock_forge::MockForgeEnv::new())
|
Self::Mock(mock_forge::MockForge::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "forgejo")]
|
#[cfg(feature = "forgejo")]
|
||||||
pub const fn new_forgejo(
|
pub const fn new_forgejo(repo_details: git::RepoDetails, net: Network) -> Self {
|
||||||
repo_details: git::RepoDetails,
|
Self::ForgeJo(forgejo::ForgeJo::new(repo_details, net))
|
||||||
net: Network,
|
|
||||||
repo: git::Repository,
|
|
||||||
) -> Self {
|
|
||||||
Self::ForgeJo(forgejo::ForgeJo::new(repo_details, net, repo))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "github")]
|
#[cfg(feature = "github")]
|
||||||
pub const fn new_github(net: Network) -> Self {
|
pub const fn new_github(net: Network) -> Self {
|
||||||
Self::Github(github::GithubEnv::new(net))
|
Self::Github(github::Github::new(net))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl std::ops::Deref for Forge {
|
impl std::ops::Deref for Forge {
|
||||||
|
@ -43,7 +39,7 @@ impl std::ops::Deref for Forge {
|
||||||
#[cfg(feature = "forgejo")]
|
#[cfg(feature = "forgejo")]
|
||||||
Self::ForgeJo(env) => env,
|
Self::ForgeJo(env) => env,
|
||||||
#[cfg(feature = "github")]
|
#[cfg(feature = "github")]
|
||||||
Forge::Github(env) => env,
|
Self::Github(env) => env,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,15 @@
|
||||||
//
|
//
|
||||||
#![cfg(not(tarpaulin_include))]
|
#![cfg(not(tarpaulin_include))]
|
||||||
|
|
||||||
use git::OpenRepository;
|
use derive_more::Constructor;
|
||||||
use git_next_config as config;
|
use git_next_config as config;
|
||||||
use git_next_git as git;
|
use git_next_git as git;
|
||||||
|
|
||||||
struct MockForge;
|
#[derive(Clone, Debug, Constructor)]
|
||||||
#[derive(Clone, Debug)]
|
pub struct MockForge;
|
||||||
pub struct MockForgeEnv;
|
|
||||||
impl MockForgeEnv {
|
|
||||||
pub(crate) const fn new() -> Self {
|
|
||||||
Self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl git::ForgeLike for MockForgeEnv {
|
impl git::ForgeLike for MockForge {
|
||||||
fn name(&self) -> String {
|
fn name(&self) -> String {
|
||||||
"mock".to_string()
|
"mock".to_string()
|
||||||
}
|
}
|
||||||
|
@ -34,11 +29,4 @@ impl git::ForgeLike for MockForgeEnv {
|
||||||
async fn commit_status(&self, _commit: &git::Commit) -> git::commit::Status {
|
async fn commit_status(&self, _commit: &git::Commit) -> git::commit::Status {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repo_clone(
|
|
||||||
&self,
|
|
||||||
_gitdir: config::GitDir,
|
|
||||||
) -> Result<OpenRepository, git::repository::Error> {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_name() {
|
|
||||||
let net = Network::new_mock();
|
|
||||||
let forge = Forge::new_github(net);
|
|
||||||
assert_eq!(forge.name(), "github");
|
|
||||||
}
|
|
|
@ -4,9 +4,6 @@ use super::*;
|
||||||
use git_next_config as config;
|
use git_next_config as config;
|
||||||
use git_next_git as git;
|
use git_next_git as git;
|
||||||
|
|
||||||
#[cfg(feature = "github")]
|
|
||||||
mod github;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mock_name() {
|
fn test_mock_name() {
|
||||||
let forge = Forge::new_mock();
|
let forge = Forge::new_mock();
|
||||||
|
@ -19,7 +16,6 @@ fn test_forgejo_name() {
|
||||||
panic!("fs")
|
panic!("fs")
|
||||||
};
|
};
|
||||||
let net = Network::new_mock();
|
let net = Network::new_mock();
|
||||||
let (repo, _reality) = git::repository::mock();
|
|
||||||
let repo_details = git::common::repo_details(
|
let repo_details = git::common::repo_details(
|
||||||
1,
|
1,
|
||||||
git::Generation::new(),
|
git::Generation::new(),
|
||||||
|
@ -30,6 +26,6 @@ fn test_forgejo_name() {
|
||||||
)),
|
)),
|
||||||
config::GitDir::new(fs.base()),
|
config::GitDir::new(fs.base()),
|
||||||
);
|
);
|
||||||
let forge = Forge::new_forgejo(repo_details, net, repo);
|
let forge = Forge::new_forgejo(repo_details, net);
|
||||||
assert_eq!(forge.name(), "forgejo");
|
assert_eq!(forge.name(), "forgejo");
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,4 @@ pub trait ForgeLike {
|
||||||
|
|
||||||
/// Checks the results of any (e.g. CI) status checks for the commit.
|
/// Checks the results of any (e.g. CI) status checks for the commit.
|
||||||
async fn commit_status(&self, commit: &git::Commit) -> git::commit::Status;
|
async fn commit_status(&self, commit: &git::Commit) -> git::commit::Status;
|
||||||
|
|
||||||
/// Clones a repo to disk.
|
|
||||||
fn repo_clone(
|
|
||||||
&self,
|
|
||||||
gitdir: config::GitDir,
|
|
||||||
) -> Result<git::OpenRepository, git::repository::Error>;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,12 @@ mod real;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
|
use git_next_config as config;
|
||||||
use git_next_config::GitDir;
|
use git_next_config::GitDir;
|
||||||
|
|
||||||
pub use open::OpenRepository;
|
pub use open::OpenRepository;
|
||||||
|
|
||||||
use crate::repository::mock::MockRepository;
|
use crate::{repository::mock::MockRepository, validation::repo::validate_repo};
|
||||||
|
|
||||||
use super::RepoDetails;
|
use super::RepoDetails;
|
||||||
|
|
||||||
|
@ -27,6 +28,23 @@ pub fn mock() -> (Repository, MockRepository) {
|
||||||
(Repository::Mock(mock_repository.clone()), mock_repository)
|
(Repository::Mock(mock_repository.clone()), mock_repository)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Opens a repository, cloning if necessary
|
||||||
|
pub fn open(
|
||||||
|
repository: &Repository,
|
||||||
|
repo_details: &RepoDetails,
|
||||||
|
gitdir: config::GitDir,
|
||||||
|
) -> Result<OpenRepository> {
|
||||||
|
let repository = if !gitdir.exists() {
|
||||||
|
// info!("Local copy not found - cloning...");
|
||||||
|
repository.git_clone(repo_details)?
|
||||||
|
} else {
|
||||||
|
repository.open(&gitdir)?
|
||||||
|
};
|
||||||
|
// info!("Validating...");
|
||||||
|
validate_repo(&repository, repo_details).map_err(|e| Error::Validation(e.to_string()))?;
|
||||||
|
Ok(repository)
|
||||||
|
}
|
||||||
|
|
||||||
pub trait RepositoryLike {
|
pub trait RepositoryLike {
|
||||||
fn open(&self, gitdir: &GitDir) -> Result<OpenRepository>;
|
fn open(&self, gitdir: &GitDir) -> Result<OpenRepository>;
|
||||||
fn git_clone(&self, repo_details: &RepoDetails) -> Result<OpenRepository>;
|
fn git_clone(&self, repo_details: &RepoDetails) -> Result<OpenRepository>;
|
||||||
|
|
|
@ -4,7 +4,7 @@ version = { workspace = true }
|
||||||
edition = { workspace = true }
|
edition = { workspace = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["forgejo"]
|
default = ["forgejo", "github"]
|
||||||
forgejo = []
|
forgejo = []
|
||||||
github = []
|
github = []
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,8 @@ pub struct RepoActor {
|
||||||
last_main_commit: Option<git::Commit>,
|
last_main_commit: Option<git::Commit>,
|
||||||
last_next_commit: Option<git::Commit>,
|
last_next_commit: Option<git::Commit>,
|
||||||
last_dev_commit: Option<git::Commit>,
|
last_dev_commit: Option<git::Commit>,
|
||||||
repository: Option<git::OpenRepository>,
|
repository: git::Repository,
|
||||||
|
open_repository: Option<git::OpenRepository>,
|
||||||
net: Network,
|
net: Network,
|
||||||
forge: forge::Forge,
|
forge: forge::Forge,
|
||||||
}
|
}
|
||||||
|
@ -45,9 +46,7 @@ impl RepoActor {
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let forge = match details.forge.forge_type() {
|
let forge = match details.forge.forge_type() {
|
||||||
#[cfg(feature = "forgejo")]
|
#[cfg(feature = "forgejo")]
|
||||||
config::ForgeType::ForgeJo => {
|
config::ForgeType::ForgeJo => forge::Forge::new_forgejo(details.clone(), net.clone()),
|
||||||
forge::Forge::new_forgejo(details.clone(), net.clone(), repo)
|
|
||||||
}
|
|
||||||
config::ForgeType::MockForge => forge::Forge::new_mock(),
|
config::ForgeType::MockForge => forge::Forge::new_mock(),
|
||||||
};
|
};
|
||||||
debug!(?forge, "new");
|
debug!(?forge, "new");
|
||||||
|
@ -61,7 +60,8 @@ impl RepoActor {
|
||||||
last_main_commit: None,
|
last_main_commit: None,
|
||||||
last_next_commit: None,
|
last_next_commit: None,
|
||||||
last_dev_commit: None,
|
last_dev_commit: None,
|
||||||
repository: None,
|
repository: repo,
|
||||||
|
open_repository: None,
|
||||||
net,
|
net,
|
||||||
forge,
|
forge,
|
||||||
}
|
}
|
||||||
|
@ -96,9 +96,9 @@ impl Handler<CloneRepo> for RepoActor {
|
||||||
#[tracing::instrument(name = "RepoActor::CloneRepo", skip_all, fields(repo = %self.repo_details, gitdir = %self.repo_details.gitdir))]
|
#[tracing::instrument(name = "RepoActor::CloneRepo", skip_all, fields(repo = %self.repo_details, gitdir = %self.repo_details.gitdir))]
|
||||||
fn handle(&mut self, _msg: CloneRepo, ctx: &mut Self::Context) -> Self::Result {
|
fn handle(&mut self, _msg: CloneRepo, ctx: &mut Self::Context) -> Self::Result {
|
||||||
let gitdir = self.repo_details.gitdir.clone();
|
let gitdir = self.repo_details.gitdir.clone();
|
||||||
match self.forge.repo_clone(gitdir) {
|
match git::repository::open(&self.repository, &self.repo_details, gitdir) {
|
||||||
Ok(repository) => {
|
Ok(repository) => {
|
||||||
self.repository.replace(repository);
|
self.open_repository.replace(repository);
|
||||||
if self.repo_details.repo_config.is_none() {
|
if self.repo_details.repo_config.is_none() {
|
||||||
ctx.address().do_send(LoadConfigFromRepo);
|
ctx.address().do_send(LoadConfigFromRepo);
|
||||||
} else {
|
} else {
|
||||||
|
@ -179,7 +179,7 @@ impl Handler<ValidateRepo> for RepoActor {
|
||||||
.wait(ctx);
|
.wait(ctx);
|
||||||
}
|
}
|
||||||
if let (Some(repository), Some(repo_config)) = (
|
if let (Some(repository), Some(repo_config)) = (
|
||||||
self.repository.clone(),
|
self.open_repository.clone(),
|
||||||
self.repo_details.repo_config.clone(),
|
self.repo_details.repo_config.clone(),
|
||||||
) {
|
) {
|
||||||
let repo_details = self.repo_details.clone();
|
let repo_details = self.repo_details.clone();
|
||||||
|
@ -241,7 +241,7 @@ impl Handler<StartMonitoring> for RepoActor {
|
||||||
.into_actor(self)
|
.into_actor(self)
|
||||||
.wait(ctx);
|
.wait(ctx);
|
||||||
} else if dev_ahead_of_next {
|
} else if dev_ahead_of_next {
|
||||||
if let Some(repository) = self.repository.clone() {
|
if let Some(repository) = self.open_repository.clone() {
|
||||||
branch::advance_next(
|
branch::advance_next(
|
||||||
msg.next,
|
msg.next,
|
||||||
msg.dev_commit_history,
|
msg.dev_commit_history,
|
||||||
|
@ -282,7 +282,7 @@ impl Handler<AdvanceMainTo> for RepoActor {
|
||||||
warn!("No config loaded");
|
warn!("No config loaded");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
let Some(repository) = self.repository.clone() else {
|
let Some(repository) = self.open_repository.clone() else {
|
||||||
warn!("No repository opened");
|
warn!("No repository opened");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,11 +3,6 @@ name = "git-next-server"
|
||||||
version = { workspace = true }
|
version = { workspace = true }
|
||||||
edition = { workspace = true }
|
edition = { workspace = true }
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["forgejo"]
|
|
||||||
forgejo = []
|
|
||||||
github = []
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
git-next-config = { workspace = true }
|
git-next-config = { workspace = true }
|
||||||
git-next-git = { workspace = true }
|
git-next-git = { workspace = true }
|
||||||
|
|
Loading…
Reference in a new issue