Initial upload: GitPulse - Developer Productivity Analyzer CLI tool
Some checks failed
CI / test (push) Has been cancelled
CI / release (push) Has been cancelled

This commit is contained in:
2026-02-04 15:45:36 +00:00
parent ef4a0d71e7
commit 546523fc45

65
src/models/file.rs Normal file
View File

@@ -0,0 +1,65 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FileStats {
pub path: String,
pub lines_added: usize,
pub lines_removed: usize,
pub net_change: i64,
pub commits: usize,
pub last_modified: String,
pub authors: Vec<String>,
pub file_type: String,
pub is_renamed: bool,
pub rename_count: usize,
}
impl Default for FileStats {
fn default() -> Self {
Self {
path: String::new(),
lines_added: 0,
lines_removed: 0,
net_change: 0,
commits: 0,
last_modified: String::new(),
authors: Vec::new(),
file_type: String::new(),
is_renamed: false,
rename_count: 0,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FileChange {
pub path: String,
pub change_type: ChangeType,
pub lines_added: usize,
pub lines_removed: usize,
pub old_path: Option<String>,
pub similarity: Option<f64>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ChangeType {
Added,
Deleted,
Modified,
Renamed,
Copied,
Untracked,
}
impl From<git2::ChangeType> for ChangeType {
fn from(change_type: git2::ChangeType) -> Self {
match change_type {
git2::ChangeType::Addition => ChangeType::Added,
git2::ChangeType::Deletion => ChangeType::Deleted,
git2::ChangeType::Modification => ChangeType::Modified,
git2::ChangeType::Renamed => ChangeType::Renamed,
git2::ChangeType::Copied => ChangeType::Copied,
_ => ChangeType::Untracked,
}
}
}