aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock340
-rw-r--r--fake-readme.md4
-rw-r--r--supergit/Cargo.toml3
-rw-r--r--supergit/src/bin/test.rs16
-rw-r--r--supergit/src/lib.rs19
-rw-r--r--supergit/src/raw/branch_walk.rs18
-rw-r--r--supergit/src/raw/mod.rs25
7 files changed, 408 insertions, 17 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 426ee05..42f0f4d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -391,6 +391,106 @@ dependencies = [
]
[[package]]
+name = "async-channel"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "59740d83946db6a5af71ae25ddf9562c2b176b2ca42cf99a455f09f4a220d6b9"
+dependencies = [
+ "concurrent-queue",
+ "event-listener",
+ "futures-core",
+]
+
+[[package]]
+name = "async-executor"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d373d78ded7d0b3fa8039375718cde0aace493f2e34fb60f51cbf567562ca801"
+dependencies = [
+ "async-task",
+ "concurrent-queue",
+ "fastrand",
+ "futures-lite",
+ "once_cell",
+ "vec-arena",
+]
+
+[[package]]
+name = "async-global-executor"
+version = "1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "124ac8c265e407641c3362b8f4d39cdb4e243885b71eef087be27199790f5a3a"
+dependencies = [
+ "async-executor",
+ "async-io",
+ "futures-lite",
+ "num_cpus",
+ "once_cell",
+]
+
+[[package]]
+name = "async-io"
+version = "1.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d54bc4c1c7292475efb2253227dbcfad8fe1ca4c02bc62c510cc2f3da5c4704e"
+dependencies = [
+ "concurrent-queue",
+ "fastrand",
+ "futures-lite",
+ "libc",
+ "log",
+ "nb-connect",
+ "once_cell",
+ "parking",
+ "polling",
+ "vec-arena",
+ "waker-fn",
+ "winapi 0.3.9",
+]
+
+[[package]]
+name = "async-mutex"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e"
+dependencies = [
+ "event-listener",
+]
+
+[[package]]
+name = "async-std"
+version = "1.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a9fa76751505e8df1c7a77762f60486f60c71bbd9b8557f4da6ad47d083732ed"
+dependencies = [
+ "async-global-executor",
+ "async-io",
+ "async-mutex",
+ "blocking",
+ "crossbeam-utils",
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-lite",
+ "gloo-timers",
+ "kv-log-macro",
+ "log",
+ "memchr",
+ "num_cpus",
+ "once_cell",
+ "pin-project-lite",
+ "pin-utils",
+ "slab",
+ "wasm-bindgen-futures",
+]
+
+[[package]]
+name = "async-task"
+version = "4.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0"
+
+[[package]]
name = "async-trait"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -402,6 +502,12 @@ dependencies = [
]
[[package]]
+name = "atomic-waker"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a"
+
+[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -468,6 +574,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
+name = "blocking"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9"
+dependencies = [
+ "async-channel",
+ "async-task",
+ "atomic-waker",
+ "fastrand",
+ "futures-lite",
+ "once_cell",
+]
+
+[[package]]
name = "brotli-sys"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -488,6 +608,12 @@ dependencies = [
]
[[package]]
+name = "bumpalo"
+version = "3.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
+
+[[package]]
name = "byteorder"
version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -509,6 +635,12 @@ dependencies = [
]
[[package]]
+name = "cache-padded"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba"
+
+[[package]]
name = "cc"
version = "1.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -552,6 +684,15 @@ dependencies = [
]
[[package]]
+name = "concurrent-queue"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
+dependencies = [
+ "cache-padded",
+]
+
+[[package]]
name = "copyless"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -567,6 +708,17 @@ dependencies = [
]
[[package]]
+name = "crossbeam-utils"
+version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
+dependencies = [
+ "autocfg",
+ "cfg-if 0.1.10",
+ "lazy_static",
+]
+
+[[package]]
name = "derive_more"
version = "0.99.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -624,6 +776,12 @@ dependencies = [
]
[[package]]
+name = "event-listener"
+version = "2.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59"
+
+[[package]]
name = "failure"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -646,6 +804,15 @@ dependencies = [
]
[[package]]
+name = "fastrand"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca5faf057445ce5c9d4329e382b2ce7ca38550ef3b73a5348362d5f24e0c7fe3"
+dependencies = [
+ "instant",
+]
+
+[[package]]
name = "flate2"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -728,6 +895,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e1798854a4727ff944a7b12aa999f58ce7aa81db80d2dfaaf2ba06f065ddd2b"
[[package]]
+name = "futures-lite"
+version = "1.11.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e6c079abfac3ab269e2927ec048dabc89d009ebfdda6b8ee86624f30c689658"
+dependencies = [
+ "fastrand",
+ "futures-core",
+ "futures-io",
+ "memchr",
+ "parking",
+ "pin-project-lite",
+ "waker-fn",
+]
+
+[[package]]
name = "futures-macro"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -816,6 +998,19 @@ dependencies = [
]
[[package]]
+name = "gloo-timers"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "js-sys",
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
name = "h2"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -969,6 +1164,15 @@ dependencies = [
]
[[package]]
+name = "js-sys"
+version = "0.3.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8"
+dependencies = [
+ "wasm-bindgen",
+]
+
+[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -979,6 +1183,15 @@ dependencies = [
]
[[package]]
+name = "kv-log-macro"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f"
+dependencies = [
+ "log",
+]
+
+[[package]]
name = "language-tags"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1167,6 +1380,16 @@ dependencies = [
]
[[package]]
+name = "nb-connect"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8123a81538e457d44b933a02faf885d3fe8408806b23fa700e8f01c6c3a98998"
+dependencies = [
+ "libc",
+ "winapi 0.3.9",
+]
+
+[[package]]
name = "net2"
version = "0.2.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1248,6 +1471,12 @@ dependencies = [
]
[[package]]
+name = "parking"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
+
+[[package]]
name = "parking_lot"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1344,6 +1573,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
[[package]]
+name = "polling"
+version = "2.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2a7bc6b2a29e632e45451c941832803a18cce6781db04de8a04696cdca8bde4"
+dependencies = [
+ "cfg-if 0.1.10",
+ "libc",
+ "log",
+ "wepoll-sys",
+ "winapi 0.3.9",
+]
+
+[[package]]
name = "ppv-lite86"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1583,6 +1825,7 @@ dependencies = [
name = "supergit"
version = "0.1.0"
dependencies = [
+ "async-std",
"git2",
]
@@ -1885,6 +2128,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c"
[[package]]
+name = "vec-arena"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d"
+
+[[package]]
name = "version_check"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1897,6 +2146,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
[[package]]
+name = "waker-fn"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
+
+[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1909,6 +2164,82 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
+name = "wasm-bindgen"
+version = "0.2.68"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42"
+dependencies = [
+ "cfg-if 0.1.10",
+ "wasm-bindgen-macro",
+]
+
+[[package]]
+name = "wasm-bindgen-backend"
+version = "0.2.68"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68"
+dependencies = [
+ "bumpalo",
+ "lazy_static",
+ "log",
+ "proc-macro2 1.0.24",
+ "quote 1.0.7",
+ "syn 1.0.48",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-futures"
+version = "0.4.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da"
+dependencies = [
+ "cfg-if 0.1.10",
+ "js-sys",
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "wasm-bindgen-macro"
+version = "0.2.68"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038"
+dependencies = [
+ "quote 1.0.7",
+ "wasm-bindgen-macro-support",
+]
+
+[[package]]
+name = "wasm-bindgen-macro-support"
+version = "0.2.68"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe"
+dependencies = [
+ "proc-macro2 1.0.24",
+ "quote 1.0.7",
+ "syn 1.0.48",
+ "wasm-bindgen-backend",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-shared"
+version = "0.2.68"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307"
+
+[[package]]
+name = "web-sys"
+version = "0.3.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
name = "webgit"
version = "0.2.0"
dependencies = [
@@ -1922,6 +2253,15 @@ dependencies = [
]
[[package]]
+name = "wepoll-sys"
+version = "3.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fcb14dea929042224824779fbc82d9fab8d2e6d3cbc0ac404de8edf489e77ff"
+dependencies = [
+ "cc",
+]
+
+[[package]]
name = "widestring"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/fake-readme.md b/fake-readme.md
index 4f5eda8..d851cd6 100644
--- a/fake-readme.md
+++ b/fake-readme.md
@@ -1,4 +1,4 @@
-# This is a heading y'all
+# spacekookie's project monorepo
**Welcome to my personal code and project monorepo archive!**
@@ -22,5 +22,5 @@ this repo, or by looking at the log page on a project.
## Self hosted
-The software that is hosting this code archive is called [`octopus`]()
+The software that is hosting this code archive is called [`octopus`](./)
and included in this repository.
diff --git a/supergit/Cargo.toml b/supergit/Cargo.toml
index 7fdb253..029503e 100644
--- a/supergit/Cargo.toml
+++ b/supergit/Cargo.toml
@@ -6,4 +6,5 @@ authors = ["Mx Kookie <kookie@spacekookie.de>"]
edition = "2018"
[dependencies]
-git2 = "0.11" \ No newline at end of file
+git2 = "0.11"
+async-std = { version = "1.0", features = ["unstable"] } \ No newline at end of file
diff --git a/supergit/src/bin/test.rs b/supergit/src/bin/test.rs
new file mode 100644
index 0000000..166047e
--- /dev/null
+++ b/supergit/src/bin/test.rs
@@ -0,0 +1,16 @@
+//! A test binary to use during development
+
+use supergit::raw::RawRepository;
+
+fn main() {
+ let path = match std::env::args().nth(1) {
+ Some(p) => p,
+ None => {
+ eprintln!("USAGE: supergit-test <path>");
+ std::process::exit(2);
+ }
+ };
+
+ let rr = RawRepository::open(path.as_str()).unwrap();
+
+}
diff --git a/supergit/src/lib.rs b/supergit/src/lib.rs
index e209fac..887ccc0 100644
--- a/supergit/src/lib.rs
+++ b/supergit/src/lib.rs
@@ -1,5 +1,13 @@
//! Strongly typed git repository explorer library
//!
+//! This library exposes a read-only view into a git repository. To
+//! get started, open an existing bare repo, and then call `sync()` to
+//! build a cache of it. Every time you want your view of the repo to
+//! update, call `sync()` again. If you want the sync operation to be
+//! blocking, call `sync_blocking()` instead.
+//!
+//!
+
mod branch;
pub use branch::{Branch, BranchCommit};
@@ -10,15 +18,20 @@ pub use commit::{CommitId, Commit};
mod diff;
pub use diff::Diff;
-pub(crate) mod raw;
+pub mod raw;
use std::sync::atomic::{AtomicUsize, Ordering};
+use async_std::sync::{Arc, RwLock};
+
+use raw::RawRepository;
/// Represents a git repository with lazy data loading
-pub struct Repository {}
+pub struct Repository {
+ raw: RawRepository,
+}
impl Repository {
- pub fn open(path: &std::path::Path) -> Self {
+ pub fn open(path: &std::path::Path) -> Arc<Self> {
todo!()
}
diff --git a/supergit/src/raw/branch_walk.rs b/supergit/src/raw/branch_walk.rs
index dfc7485..d4232c4 100644
--- a/supergit/src/raw/branch_walk.rs
+++ b/supergit/src/raw/branch_walk.rs
@@ -1 +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/supergit/src/raw/mod.rs b/supergit/src/raw/mod.rs
index 98602ca..7bf6c0a 100644
--- a/supergit/src/raw/mod.rs
+++ b/supergit/src/raw/mod.rs
@@ -3,13 +3,14 @@
mod branch_walk;
mod tree_walk;
+use crate::{Branch, BranchCommit};
use git2::{self, Repository};
-pub(crate) type RawResult<T> = Result<T, RawError>;
+pub type RawResult<T> = Result<T, RawError>;
/// An error abstraction for raw git operations
#[derive(Debug)]
-pub(crate) enum RawError {
+pub enum RawError {
AllBad,
}
@@ -19,24 +20,26 @@ impl From<git2::Error> for RawError {
}
}
+/// Represent a raw branch
+pub struct RawBranch {
+ name: String,
+ head: String,
+}
+
/// Wrap a libgit2 repository to provide an API fascade
-pub(crate) struct RawRepository {
+pub struct RawRepository {
inner: Repository,
}
impl RawRepository {
- pub(crate) fn open(path: &str) -> RawResult<Self> {
+ pub fn open(path: &str) -> RawResult<Self> {
Ok(Self {
inner: Repository::open(path)?,
})
}
- /// Sync the backing storage with the backing git repo
- ///
- /// This function can be invoked manually, but should be invoked
- /// basically every time your program expects changes to have
- /// happened. Polling this function is not recommended.
- pub(crate) fn update(&self) -> RawResult<()> {
- Ok(())
+ /// Parse branch data from repository
+ pub fn parse_branches(&self) -> RawResult<Vec<RawBranch>> {
+ todo!()
}
}