radicle-surf

A code surfing library for VCS file systems 🏄‍♀️🏄‍♂️

Welcome to radicle-surf!

radicle-surf is a system to describe a file-system in a VCS world. We have the concept of files and directories, but these objects can change over time while people iterate on them. Thus, it is a file-system within history and we, the user, are viewing the file-system at a particular snapshot. Alongside this, we will wish to take two snapshots and view their differences.

Let's start surfing (and apologies for the unwraps):

```rust use radiclesurf::vcs::git::{GitBrowser, GitRepository}; use radiclesurf::file_system::{Label, Path, SystemType};

// We're going to point to this repo. let repo = GitRepository::new(".").unwrap();

// Here we initialise a new Broswer for a the git repo. let browser = GitBrowser::new(&repo).unwrap();

// Get the snapshot of the directory for our current // HEAD of history. let directory = browser.get_directory().unwrap();

// Let's get a Path to this file let thisfile = Path::withroot(&["src".into(), "lib.rs".into()]);

// And assert that we can find it! assert!(directory.findfile(&thisfile).is_some());

let mut rootcontents = directory.listdirectory(); root_contents.sort();

asserteq!(rootcontents, vec![ SystemType::directory(".buildkite".into()), SystemType::directory(".docker".into()), SystemType::directory(".git".into()), SystemType::file(".gitignore".into()), SystemType::file("Cargo.toml".into()), SystemType::file("README.md".into()), SystemType::directory("data".into()), SystemType::directory("docs".into()), SystemType::directory("src".into()), ]);

let src = directory.finddirectory(&Path::withroot(&["src".into()])).unwrap(); let mut srccontents = src.listdirectory(); src_contents.sort();

asserteq!(srccontents, vec![ SystemType::directory("diff".into()), SystemType::directory("file_system".into()), SystemType::file("lib.rs".into()), SystemType::directory("vcs".into()), ]); ```