#[derive(Clone, Default)]
pub struct RepoStatus {
pub branch: String,
pub ahead: u32,
pub behind: u32,
pub upstream: Option<String>,
pub staged: Vec<FileChange>,
pub unstaged: Vec<FileChange>,
pub untracked: Vec<String>,
pub stashes: Vec<String>,
}
impl RepoStatus {
pub fn dirty_count(&self) -> usize {
self.staged.len() + self.unstaged.len() + self.untracked.len()
}
}
#[derive(Clone)]
pub struct FileChange {
pub code: char,
pub path: String,
}
#[derive(Clone, Default)]
pub struct RepoInfo {
pub remote_url: Option<String>,
pub slug: Option<String>,
pub host: Option<String>,
pub total_commits: u32,
pub age: Option<String>,
pub contributors: Vec<Contributor>,
}
#[derive(Clone)]
pub struct Contributor {
pub name: String,
pub email: String,
pub commits: u32,
}
#[derive(Clone)]
pub struct BranchInfo {
pub name: String,
pub is_head: bool,
pub ahead: u32,
pub behind: u32,
pub subject: String,
pub author: String,
pub when: String, }
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum Checks {
None,
Pending,
Passing,
Failing,
}
#[derive(Clone)]
pub struct PullRequest {
pub number: u64,
pub title: String,
pub author: String,
pub state: String, pub is_draft: bool,
pub review_decision: String, pub reviewers: Vec<String>,
pub head: String, pub additions: u64,
pub deletions: u64,
pub checks: Checks,
pub repo: String,
}
#[derive(Clone)]
pub struct PrDetail {
pub number: u64,
pub title: String,
pub state: String, pub is_draft: bool,
pub author: String,
pub base: String, pub head: String, pub body: String,
pub additions: u64,
pub deletions: u64,
pub changed_files: u64,
pub commits: u64,
pub comments: u64,
pub mergeable: String, pub review_decision: String, pub reviews: Vec<Review>, pub check_runs: Vec<Check>, pub labels: Vec<String>,
pub updated_at: String, }
#[derive(Clone)]
pub struct Review {
pub author: String,
pub state: String, }
#[derive(Clone)]
pub struct Check {
pub name: String,
pub bucket: Checks, }
#[derive(Clone)]
pub struct Issue {
pub number: u64,
pub title: String,
pub author: String,
pub labels: Vec<String>,
pub assignees: Vec<String>,
pub repo: String,
}
#[derive(Clone)]
pub struct Commit {
pub sha: String, pub subject: String,
pub author: String,
pub when: String, pub refs: String, pub graph: String, }
#[derive(Clone, Debug, PartialEq)]
pub struct Worktree {
pub path: std::path::PathBuf,
pub branch: Option<String>,
pub head: String,
pub is_main: bool,
}
#[derive(Clone, Debug, PartialEq)]
pub struct WorktreeMembership {
pub common_dir: std::path::PathBuf,
}