#![doc = include_str!("../README.md")]
#![warn(missing_docs)]
#[cfg(not(any(feature = "backend-gix", feature = "backend-git2")))]
compile_error!("rpo requires at least one backend feature: backend-gix or backend-git2");
use std::path::PathBuf;
#[derive(thiserror::Error, Debug)]
pub enum RpoError {
#[error("path {} is not a git repository", path.display())]
NotARepo {
path: PathBuf,
},
#[error("backend error: {0}")]
Backend(String),
#[error("revision {rev} not found")]
RevisionNotFound {
rev: String,
},
#[error("invalid glob pattern {pattern}: {source}")]
InvalidGlob {
pattern: String,
#[source]
source: globset::Error,
},
#[error("invalid mailmap at line {line}: {reason}")]
InvalidMailmap {
line: usize,
reason: String,
},
#[error("blame failed for {} at {rev}: {reason}", path.display())]
BlameFailed {
path: PathBuf,
rev: String,
reason: String,
},
#[error("polars error: {0}")]
Polars(#[from] polars::error::PolarsError),
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("sink error: {0}")]
Sink(String),
}
mod analyzer;
mod backend;
mod blame;
pub mod bus_factor;
mod filters;
mod frames;
mod identity;
pub mod options;
pub mod reports;
mod sinks;
mod walk;
pub use analyzer::{Builder, RepoAnalyzer};
pub use backend::{
BlameHunk, ChangeKind, Commit, CommitId, DefaultBackend, FileChange, GitBackend, Signature,
WalkOptions,
};
pub use identity::IdentityMap;
pub use options::{ActivityOptions, Aggregate, Aggregation, FileSelection, Identify};
#[cfg(feature = "sink-duckdb")]
pub use sinks::{DuckDbSink, DuckDbWriteMode};
pub use sinks::{FrameSink, ParquetDirSink, ParquetSink};
pub struct Progress {
pub phase: Phase,
pub completed: u64,
pub total: u64,
}
pub enum Phase {
WalkingCommits,
Blaming {
snapshot: String,
},
}
#[derive(Clone, Debug)]
pub enum SnapshotSelector {
Head,
AtRevs(Vec<String>),
Tags,
EveryNCommits(usize),
Daily,
Weekly,
Monthly,
AllCommits,
}
pub struct SkippedFile {
pub snapshot_sha: String,
pub path: std::path::PathBuf,
pub reason: String,
}
pub struct StreamStats {
pub snapshots_written: u64,
pub rows_written: u64,
pub bytes_written: u64,
pub skipped_files: Vec<SkippedFile>,
}
pub struct Analysis {
pub commits: polars::prelude::DataFrame,
pub file_changes: polars::prelude::DataFrame,
pub blame: Option<polars::prelude::DataFrame>,
pub blame_over_time: Option<polars::prelude::DataFrame>,
pub skipped_files: Vec<SkippedFile>,
}