#![cfg_attr(coverage_nightly, coverage(off))]
use crate::models::error::TemplateError;
use anyhow::Result;
use futures::future::join_all;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use tokio::process::Command;
use tokio::sync::{RwLock, Semaphore};
use tracing::{debug, info};
#[derive(Debug, Clone)]
pub struct ParallelGitConfig {
pub max_concurrent_operations: usize,
pub enable_caching: bool,
pub cache_ttl_seconds: u64,
}
impl Default for ParallelGitConfig {
fn default() -> Self {
Self {
max_concurrent_operations: num_cpus::get().min(8),
enable_caching: true,
cache_ttl_seconds: 300, }
}
}
#[derive(Debug, Clone)]
struct CacheEntry {
result: String,
timestamp: std::time::Instant,
}
pub struct ParallelGitExecutor {
config: ParallelGitConfig,
semaphore: Arc<Semaphore>,
cache: Arc<RwLock<rustc_hash::FxHashMap<String, CacheEntry>>>,
project_root: PathBuf,
}
#[derive(Debug, Clone)]
pub struct CommitInfo {
pub hash: String,
pub author: String,
pub date: String,
pub message: String,
}
#[derive(Debug, Clone)]
pub struct DiffStats {
pub file: PathBuf,
pub additions: usize,
pub deletions: usize,
}
include!("parallel_git_operations.rs");
include!("parallel_git_tests.rs");