A basic version control system written in Haskell based on the Git protocol.
In order to build this project stack
must be installed. Once that is done, build and test project:
$ stack setup
$ stack build
$ stack test
After building, use stack exec hagit
to run, or copy the generated binary to another directory.
Assuming that the hagit
binary is ./hagit
:
$ ./hagit <command> [arguments]
During development use:
$ stack exec hagit <command> [arguments]
Valid commands are:
init
: initializes the project directory required to run otherhagit
commands on it.commit
: stores all of the project's files in a commit, identified by a unique hash and a message.checkout
: restores the project directory to the state of the given commit or branch. If supplied with nonexistent branch name - creates new branch. Potentially merges files content.log
: lists all commits in chronological order with hash, parent's hash, date and message.add
: adds specified files or directory to staging area.remove
: removes specified files or directory from staging area.branch
: lists branches.diff
: diffs files with versions in staging area; output like UNIX diff.status
: prints the current commit hash, and lists any new, deleted or modified in working tree, staging area and last commit.help
: displays help.
Tests can be found in tests folder.
Documentation can be found in docs folder - main page.
cryptohash
: SHA1 hashing for text objectsbytestring
: handling byte strings - needed in compressiondirectory
,filepath
: operations on file system and it's file treecontainers
: Map type for displaying changes inStatus
commandtime
: handling commit's date and timeconduit
: parallel file processingstrict
: strict readFile operationDiff
: as a base for diff and merge operations
Initially based on hvc by Federico T.
Diff code adapted from Data.Algorithm.DiffOutput module (Sterling Clover 2008-2011, Kevin Charter 2011)