- Replace rmp-serde with bincode 1.x in Cargo.toml - Update store.rs serialization/deserialization and ID hashing - Rename model.rs helpers from to_msgpack/from_msgpack to to_bytes/from_bytes - Consolidate MsgPack/MsgPackDecode error variants into single Bincode variant - Remove skip_serializing_if on ssh_signature (incompatible with bincode) - Update all documentation to reflect bincode storage format
6.9 KiB
Arc Implementation Plan
This is the implementation plan to implement the 'arc' version control system.
This plan follows a phased implementation, with each phase focusing on a specific part.
Implementation Overview
This is an overview of the foundational rules that make the software.
- Arc should be written from the ground up, with very little reliance on git.
- Arc should be written in the latest version of the Rust toolchain for stability.
- The development enviroment should use a nix flake with direnv for easy setup.
3a. The flake should usenixpkgs-unstable,flake-parts,fenix, andcrane.
3b. Building the project should be done purely throughnix buildand nothing else. - Rather than being snapshot based like Git, Arc should be based on incremental deltas.
- Rather than having to manually stage changes, changes should be automatically tracked.
- The command line interface (CLI) should be ergonomic and easy to understand and use.
- All implemented functionality should have tests written in a file in the
tests/directory. - After every substantial change, the changes should be committed using conventional commits format.
8a. usefeat: <message>for new features,fix: <message>for bug fixes,refactor: <message>for changes.
8b. usedocs: <message>for docs changes,build: <message>for build system changes, etc. - Anything involving remotes should use
libgitorgit2libraries for compatibility. - Deltas should be stored using ZSTD compressed bincode files for easy storage.
- When pushing, pulling, and fetching from remotes, it should be bridged to git.
- Lastly, it should cover 90% of use cases that git has, for full feature support.
- Arc should support optional commit signing via SSH keys.
- Arc uses a bookmark system instead of a branch system.
- Previous commits are immutable and can not be edited.
- Migrating and cloning should preserve commit history.
- Ignore file name should be
.ignoreor.arcignore. - Config and data files should use the YAML format.
- Bookmarks should be treated as branches when pushed to git.
- Tags should be treated as normal git tags when pushed to git.
- Use local config values first, then fallback to global.
- Default bookmark is
main, default remote isorigin. - Aliases defined in config should be expanded at the CLI level before dispatch.
- Tags are immutable.
In order for an implementation phase to be successful, the following has to be met:
- All tests defined in the
tests/folder must succeed vianix develop -c cargo test - Clippy must produce no errors or warnings running via
nix develop -c cargo clippy - Formatting must be consistent and produce no errors with
nix develop -c cargo fmt - The project must successfully build via
nix build,cargo buildis not an option - As a final measure, the implemented functionality must be thorougly evaluated
Command Overview
This is an overview of all the commands that will be implemented:
Any arguments wrapped in [] are considered optional.
Any arguments wrapped in <> are considered required.
Ranges start..end are inclusive and have optional start and end.
arc init [path]- initialize a new arc repositoryarc commit <message>- commit the changes in the worktreearc log [start..end]- show a log of previous commits (or last commit)arc status- show the current changes since last commitarc diff [start..end]- show a diff of changes (or last commit)arc switch <mark|tag>- switch the worktree to a bookmark or tagarc merge <mark|tag>- merge changes from a bookmark or tag into the worktreearc show <mark|tag|commit>- show the details of a bookmark, tag, or commitarc history <file> [start..end]- show who last modified each line of a file in a range (or last commit)arc revert <commit|start..end>- create a commit to revert the changes in a range or commitarc reset [file...]- clean the worktree and reset all current changes to the previous commitarc push [-r remote]- push commits to a git remote using the git bridgearc pull [-r remote]- pull changes from a git remote using the git bridgearc clone [-b branch] <url> [path]- clone a git remote and convert it to a arc repoarc migrate- convert a git repo in the CWD to an arc repoarc help- show a help message of commands using claparc mark add <name> [commit]- set a bookmark at the specified commitarc mark rm <name>- remove a bookmark from the repoarc mark list- list all bookmarks in the repoarc mark rename <name> <new>- rename a bookmark to a new namearc tag add <name> [commit]- set a tag at the specified commitarc tag rm <name>- remove a tag from the repoarc tag list- list all tags in the repoarc stash create <name>- create a named stasharc stash use <name>- switch to a named stasharc stash push- push changes to the current stasharc stash pop- pop changes from the current stasharc stash rm <name>- remove a named stasharc stash list- list the named stashesarc graft <start..end|commit> <--onto bookmark|commit>- cherrypick (rebase) commit(s) into a bookmarkarc config set [-g] <key> <value>- set a config value in the repo or global configarc config get [-g] <key>- get a config value in the repo or global configarc config show [-g]- show the current configuration valuesarc config unset [-g] <key>- unset a value and remove it from the configarc sync [-p]- sync branches (bookmarks) and tags locally (and optionally push local ones remotely)arc remote add <name> <url>- add a remote to the repositoryarc remote rm <name>- remove a remote to the repositoryarc remote list- list the remotes in the repository
Config Format
This is an example configuration format to build on:
user:
name: hanna
email: me@hanna.lol
key: ~/.ssh/id_ed25519
default:
bookmark: main
remote: origin
aliases:
c: commit
p: push
l: pull
Implementation Phases
These are the implementation phases that should be implemented incrementally.
- Project scaffolding - Nix flake, direnv, Rust project structure, CLI skeleton with clap, help
- Core repo structure - init, internal data model (commits, deltas, YAML config), .arcignore
- Tracking & committing - commit, status, diff, auto-change detection, ZSTD + bincode storage
- History & inspection - log, show, history, state reconstruction from delta chains
- Bookmarks & tags - mark commands, tag commands, and switch command
- Undo & modification - revert, reset, graft, three-way merge
- Stash system - stash commands
- Config system - config commands, resolution (rule 21)
- Git bridge & remotes - remote, push, pull, clone, migrate, and sync commands, git2 integration
- Commit signing - Optional SSH key signing (rule 13)
Once all phases have been completed, and conditions pass, the software is finished.