Inter-Planetary Version Control (System)
IMPORTANT: this project is not active and further development is not considered at this time, but it may serve as inspiration for future implementations.
IPVC is a distributed version control system similar to git, but built on IPFS (Inter-Planetary File System). It is suitable for any kind of data, not only human readable content. It is also particularly suitable for versioning large files. The underlying concepts are heavily influenced by git and gitless.
IPFS with its content addressable Merkle-DAGs is the perfect technology for hosting repositories of data as well as commit graphs.
While there is a git remote helper for ipfs that translates the git file formats to traversable hash links, there is currently no way of getting interoperability for large files since IPFS has a maximum block size of ~4 Mb and git stores files as single blobs. While a workaround may be available in the future we can therefore not currently recreate compatible hashes using ipld.
NOTE: not recommended right now, not regularly updated and contains bugs.
pip install ipvc
Note: Python >=3.6 and go-ipfs is required to run IPVC
Initialize a repository
$ ipvc repo init
Successfully created repository
Create and add a file to the staging area
$ echo "hello world" > myfile.txt
$ ipvc stage add myfile.txt
Changes:
+ QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o
See what you've added to stage so far (status)
$ ipvc stage
Staged:
+ myfile.txt QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o
Commit the staged changes
$ ipvc stage commit "My first commit"
See the commit history
$ ipvc branch history
* 2018-03-17T14:43:22.254582 My first commit
Make a change to myfile.txt
$ echo "dont panic" > myfile.txt
$ ipvc stage add myfile.txt
Changes:
QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o --> QmbG1mR6m7KeJ3z2MB3t85VXxHUhD65kw3Yw3hGzStyEcW
See what changed
$ ipvc stage diff
---
+++
@@ -1,2 +1,2 @@
-hello world
+dont panic
Commit the change
$ ipvc stage commit "Update my file"
Go back to the previous commit by creating a new branch
$ ipvc branch create --from-commit @head~ my_new_branch
$ ipvc branch
my_new_branch
NOTE: usage is incomplete as many important commands are not yet implemented
Note: commands not yet implemented are "commented" out
ipvc repo init [<name>]
ipvc repo mv <path1> [<path2>]
ipvc repo # alias for ls
ipvc repo rm [<path>]
ipvc repo ls # list all repos in ipvc
ipvc repo mv [<from>] <to> # move a repository
ipvc repo id [<key>] # get/set id for repository
ipvc repo name [<name>] # get/set name for repository
ipvc repo publish # publish the repo to IPNS
ipvc repo unpublish # unpublish the repo from IPNS
ipvc repo clone [--as-name <name>] <PeerID> <peer-repo> # clone a repo as name
//ipvc repo remote <PeerID> <peer-repo> # show/set remote destination of repo
ipvc branch # status
ipvc branch create [--from-commit <hash>] <name>
ipvc branch checkout <name>
ipvc branch history # git log
ipvc branch show <refpath> # shows content of refpath
ipvc branch ls # list branches
ipvc branch merge [--abort] [--resolve [<message>]] [--no-ff] <branch> # analagous to git merge
ipvc branch replay [--abort] [--resume] <branch> # analagous to git rebase
//ipvc branch rm <branch name>
//ipvc branch mv [<from>] <to>
//ipvc branch reset [<path>] # reset workspace at path
//ipvc branch rewrite # analagous to git rebase -i
//ipvc branch fetch # download the latest remote of this branch
//ipvc branch pull # fetch and merge
ipvc branch publish [<branch>] # publish branch to IPNS
ipvc branch unpublish
ipvc stage # status
ipvc stage add <path>
ipvc stage remove <path>
ipvc stage commit <msg>
ipvc stage diff # alias for ipvc diff stage workspace, equivalent to git diff --cached
//ipvc stage uncommit
ipvc diff [--files] [<to-refpath>] [<from-refpath>] # defaults to @workspace -> @stage, equivalent to git diff
ipvc id # list
ipvc id list [--unused] # List all local and remote ids
ipvc id create <key> # Creates a new key/id
ipvc id get [--key <key>] # Show identity used for repo or key
ipvc id set [--name <name>] [--email <email>] [--desc <desc>] [--img <img_hash>] <key> # Create identity for ipfs key / repo
//ipvc id resolve [--peer_id <peer_id>] [--name <name>] # Resolve remote ids from IPNS
bundle
subfolder which contains the reference to the actual file hierarchy and metadata which contains the timestamps and permissions of the files (this is not currently stored in the IPFS files ipld format)In no particular order of importance
git add -p
There are two levels of tests, in pytest, and a command line test.
To run pytest, run
python3 -m pytest -s -x in the ipvc folder
Integration tests recorded in the CLI itself can be run separately by
python3 -m pytest -x -s ipvc/tests/test_integration.py [--name
] For more information, read test_integration.py
Make sure that ipfs is running on standard port.
Notes for maintainers on how to release ipvc as a package on PyPI
Version numbers can't be reused, so if there are problems then the version number has to be bumped. Because of this, the version numbers used on test end-point are not the same as in normal end-point. Therefore, it's best to test using a fake version number, and only commit and release when there are no problems on test.