A version control system implemented from scratch in Rust.

Overview

Version Control

Rust

An experiment to write a version control system from scratch in Rust.

CLI Usage

Usage: revtool <COMMAND>

Commands:
  init      initialize a brand new revision
  diff      check the difference between this branch and another
  changes   shows the files and directories which have been changed since the latest snap
  snap      take a new snapshot
  checkout  switch to branch
  branch    print out current branch
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help

How Does It Work?

Under the hood, it is using a content addressed binary object store in .rev/store using the BLAKE3 hash function to identify binary objects using a type called ObjectId. Building on top of that, we have a Directory data type which represents a directory tree structure where each file's name is mapped to it's ObjectId. We store this type directly, encoded as prettified JSON, in the object store as a commitment to a particular configuration or version, then we have a data type called SnapShot which links these together into a directed, acyclic graph with each vertex having a message attached:

pub struct SnapShot {
  message: String,
  directory: ObjectId,
  previous: ObjectId,
}

We then store this type directly in the object store as well, again as prettified JSON. In the .rev/branches directory, we keep a file for each branch with the ObjectId of a particular encoded SnapShot. In .rev/branch, we keep the name of the current branch we're using.

Finally, when we construct a Directory from the current directory, often we don't care about many files, so we have an ignore list in .rev/ignores which configures which paths we ignore.

Contributing

There are a number of issues on the GitHub repository, please feel free to take any and do them.

Comments
  • `revtool snap` panics

    `revtool snap` panics

    Code/rust/foo
    ❯ revtool init
    
    Code/rust/foo
    ❯ echo "💩" >> poo.txt
    
    Code/rust/foo
    ❯ revtool changes
    {
      "deleted": [],
      "added": {
        "poo.txt": {
          "File": "9c7ecb3d4acb554df052dbaf031d51987a0ba8970dd858d157bb40aabf9ce948"
        }
      },
      "modified": {}
    
    Code/rust/foo
    ❯ revtool snap --message "Added poo.txt"
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("expected value", line: 1, column: 1)', app/main.rs:53:77
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    I think https://github.com/SamuelSchlesinger/version-control/blob/19b9675920cd93fdb472b1b69fb0de6bc4557de7/app/main.rs#L154 might need to use the same read_to_string as the Changes branch https://github.com/SamuelSchlesinger/version-control/blob/19b9675920cd93fdb472b1b69fb0de6bc4557de7/app/main.rs#L130-L136

    I can make that change if that sounds right?

    opened by ptrfrncsmrph 1
  • Implement merge commits

    Implement merge commits

    Currently, all commits can technically have more than one previous commit, but when you run revtool snap it only adds the one from the branch. We need a command like: revtool merge <branch> which will try to bring in the changes from that branch into this one. revtool rebase <branch> would be a nice to have as well.

    enhancement 
    opened by SamuelSchlesinger 2
  • Separate ObjectID/ObjectStore into own library

    Separate ObjectID/ObjectStore into own library

    These are independently useful and someone should be able to depend on them without using this version control system. Maybe Directory belongs in there too? Probably not SnapShot.

    enhancement help wanted good first issue 
    opened by SamuelSchlesinger 0
  • Write ObjectIDs to branch files directly as hex rather than through serge

    Write ObjectIDs to branch files directly as hex rather than through serge

    Currently, the ObjectIDs in the files within branches/* are stored as "", but we should simply store them as , ditching the quotations for user sanity and scriptability.

    enhancement good first issue 
    opened by SamuelSchlesinger 0
  • Prettier directory diffs

    Prettier directory diffs

    Currently, the directory diffs are displayed in prettified JSON and we include the hashes which is totally useless as a reader. Make it prettier and less useless!

    enhancement help wanted good first issue 
    opened by SamuelSchlesinger 2
Owner
Samuel Schlesinger
Working on Google Chrome in the Privacy Sandbox initiative
Samuel Schlesinger
Fast KubeJS script manager. Includes version control and compatibility with KJSPKG packages.

CarbonJS A KubeJS script manager Features ?? Super fast ⚙️ Version control ?? Constantly new scripts being added ✅ Easy to use ?? Compatibility with K

Krzysztof Poręba 3 May 9, 2023
Programming language that compiles into Scratch blocks (SB3).

Claw Hello, and welcome to my cool project! I've spent... at least a month on this, and it's still not finished! Feel free to check it out though. :D

BD103 3 Dec 21, 2022
REC2 (Rusty External Command and Control) is client and server tool allowing auditor to execute command from VirusTotal and Mastodon APIs written in Rust. 🦀

Information: REC2 is an old personal project (early 2023) that I didn't continue development on. It's part of a list of projects that helped me to lea

Quentin Texier (g0h4n) 104 Oct 7, 2023
A simple program that provides DBus interface to control display temperature and brightness under wayland without flickering

wl-gammarelay-rs Like wl-gammarelay, but written in rust, runs on a single thread, has three times less SLOC and uses DBus (for simplicity). Dbus inte

Max Verevkin 33 Nov 23, 2022
A simple tui to view & control docker containers

oxker A simple tui to view & control docker containers Built in Rust, making heavy use of tui-rs & Bollard Download & install See releases download &

Jack Wills 119 Dec 28, 2022
A tool to control the fan speed by monitoring the temperature of CPU via IPMI.

ipmi-fan-control A tool to control the fan speed by monitoring the temperature of CPU via IPMI. Why Our Dell R730 server's iDRAC is not works as expec

yinheli 9 Dec 29, 2022
A simple interactive OSC (Open Sound Control) debugger for terminal

oscd, a simple interactive OSC debugger for the terminal by using nom as a lexer/parser, oscd offers auto type casting and support sending multiple osc arguments.

Karnpapon Boonput 5 Oct 19, 2022
A command line tool to control the power state of Valve Base Stations 2.0.

lighthousectl A command line tool to control the power state of Valve Base Stations 2.0. Usage Scan All Base Stations It scans endlessly. You can stop

KOBA789 11 Aug 9, 2022
A bit like tee, a bit like script, but all with a fake tty. Lets you remote control and watch a process

teetty teetty is a wrapper binary to execute a command in a pty while providing remote control facilities. This allows logging the stdout of a process

Armin Ronacher 259 Jan 3, 2023
A GUI Fan control utility for Linux.

TuxTempMaster For now I'm gonna use this README to write the status of the project Important note This program is not gonna do any black magic. If you

Obscurely 12 Dec 23, 2022
A validations framework for doing quality control in studios.

Untitled Checks Framework Overview This framework is designed to provide a system to write checks for studio work. This includes validating assets (ri

Scott Wilson 8 Jan 28, 2023
EVA ICS v4 is a new-generation Industrial-IoT platform for Industry-4.0 automated control systems.

EVA ICS v4 EVA ICS® v4 is a new-generation Industrial-IoT platform for Industry-4.0 automated control systems. The world-first and only Enterprise aut

EVA ICS 25 Feb 1, 2023
job control from anywhere!

job-security - job control from anywhere! job-security is a tool that lets you put your running programs into background, then bring them to the foreg

Yuxuan Shui 15 Apr 23, 2023
A money tracker: Your income and expenses at your control

NixBucks A simple budgeting app Install If you are on Linux, you can download the Appimage from the latest release (click here). Otherwise, you can in

Marcos Gutiérrez Alonso 3 Sep 25, 2023
A file server that supports static serving, uploading, searching, accessing control, webdav...

Dufs Dufs is a distinctive utility file server that supports static serving, uploading, searching, accessing control, webdav... Features Serve static

null 3.6k Oct 30, 2023
Sero is a web server that allows you to easily host your static sites without pain. The idea was inspired by surge.sh but gives you full control.

sero Lightning-fast, static web publishing with zero configuration and full control ?? Table Of Contents ?? Table Of Contents ?? Tools ❓ About The Pro

Dmitry Miasnenko 6 Nov 13, 2023
First project in rust which will be to make an accounts system & Leaderboard/Score system

rust-backend this is my first project in rust which will be to make a backend for compsci project it will include: Accounts, Player Achievements (if I

NaughtyDog6000 2 Jul 13, 2023
A more intuitive version of du in rust

A more intuitive version of du in rust

andy.boot 3k Sep 20, 2021
Vyper-Compiler Version Manager in Rust

Vyper Compiler Version Manager in Rust Install $ cargo install --git https://github.com/storming0x/vvm-rs --locked vvm-rs Install from source $ git c

Storming0x 26 Dec 15, 2022