diff options
author | Katharina Fey <kookie@spacekookie.de> | 2020-10-31 18:57:39 +0100 |
---|---|---|
committer | Mx Kookie <kookie@spacekookie.de> | 2020-12-21 05:10:08 +0100 |
commit | 9dacf748651ea7139c0e9f3dee9ae66d949bf73f (patch) | |
tree | 7101bc20d5a531218ccd1b4cb9e04c67995f6d0e /apps/servers/octopus/supergit/src/raw | |
parent | 4e09fe2509904ee64d2470ca8d41006d51e4ffd6 (diff) |
Add 'apps/servers/octopus/' from commit '623954d19fdf0dca47db319e5c88ee561aa8d25c'
git-subtree-dir: apps/servers/octopus
git-subtree-mainline: 4e09fe2509904ee64d2470ca8d41006d51e4ffd6
git-subtree-split: 623954d19fdf0dca47db319e5c88ee561aa8d25c
Diffstat (limited to '')
5 files changed, 67 insertions, 0 deletions
diff --git a/apps/servers/octopus/supergit/src/raw/#tree_walk.rs# b/apps/servers/octopus/supergit/src/raw/#tree_walk.rs# new file mode 100644 index 000000000000..a693f624af46 --- /dev/null +++ b/apps/servers/octopus/supergit/src/raw/#tree_walk.rs# @@ -0,0 +1 @@ +//! Walk the file tree for a particular commit
\ No newline at end of file diff --git a/apps/servers/octopus/supergit/src/raw/.#tree_walk.rs b/apps/servers/octopus/supergit/src/raw/.#tree_walk.rs new file mode 120000 index 000000000000..a0d266615930 --- /dev/null +++ b/apps/servers/octopus/supergit/src/raw/.#tree_walk.rs @@ -0,0 +1 @@ +spacekookie@qq.53166
\ No newline at end of file diff --git a/apps/servers/octopus/supergit/src/raw/branch_walk.rs b/apps/servers/octopus/supergit/src/raw/branch_walk.rs new file mode 100644 index 000000000000..d4232c486560 --- /dev/null +++ b/apps/servers/octopus/supergit/src/raw/branch_walk.rs @@ -0,0 +1,19 @@ +//! Walk along a branch parsing commit metadata + +use std::collections::{BTreeMap, BTreeSet}; + +pub struct CommitHistory { + /// The correct order of commit IDs + order: Vec<String>, + /// Map of commit IDs to commit metadata + meta: BTreeMap<String, CommitNode>, +} + +pub struct CommitNode { + id: String, + author: String, + commiter: String, + message: String, + touches: BTreeSet<String>, + time: u64, +} diff --git a/apps/servers/octopus/supergit/src/raw/mod.rs b/apps/servers/octopus/supergit/src/raw/mod.rs new file mode 100644 index 000000000000..7bf6c0a396a4 --- /dev/null +++ b/apps/servers/octopus/supergit/src/raw/mod.rs @@ -0,0 +1,45 @@ +//! Raw representation wrappers for libgit2 + +mod branch_walk; +mod tree_walk; + +use crate::{Branch, BranchCommit}; +use git2::{self, Repository}; + +pub type RawResult<T> = Result<T, RawError>; + +/// An error abstraction for raw git operations +#[derive(Debug)] +pub enum RawError { + AllBad, +} + +impl From<git2::Error> for RawError { + fn from(_: git2::Error) -> Self { + Self::AllBad + } +} + +/// Represent a raw branch +pub struct RawBranch { + name: String, + head: String, +} + +/// Wrap a libgit2 repository to provide an API fascade +pub struct RawRepository { + inner: Repository, +} + +impl RawRepository { + pub fn open(path: &str) -> RawResult<Self> { + Ok(Self { + inner: Repository::open(path)?, + }) + } + + /// Parse branch data from repository + pub fn parse_branches(&self) -> RawResult<Vec<RawBranch>> { + todo!() + } +} diff --git a/apps/servers/octopus/supergit/src/raw/tree_walk.rs b/apps/servers/octopus/supergit/src/raw/tree_walk.rs new file mode 100644 index 000000000000..05337640cd19 --- /dev/null +++ b/apps/servers/octopus/supergit/src/raw/tree_walk.rs @@ -0,0 +1 @@ +//! Walk the file tree for a particular commit |