Naveen
Naveen

Reputation: 6008

Smallest, toy, Distributed version control system to study

I am interested in writing a toy DVCS.
What is the smallest DVCS around to study ?
(I don't need ssl, ssh, svn compatibility etc... it should just be able to do local repositories)

Upvotes: 2

Views: 380

Answers (4)

dalton
dalton

Reputation: 3696

Have a look at fossil distributed versioning it's only 350kb.

http://www.fossil-scm.org

Upvotes: 2

miku
miku

Reputation: 188004

The initial version of git

commit e83c5163316f89bfbde7d9ab23ca2e25604af290
Author: Linus Torvalds <[email protected]>
Date:   Thu Apr 7 15:13:13 2005 -0700

had 1,064 lines of code (ansic=822,sh=242).

For a chronicle, see:

Initially making a commit looked like this:

$ init-db 
$ edit file 
$ update-cache –-add file 
$ edit file 
$ show-diff 
$ update-cache file 
$ T=$(write-tree) 
$ P=$(cat .dircache/HEAD) 
$ C=$(echo "My commit" | commit-tree $T -p $P) 
$ echo $C >.dircache/HEAD

Upvotes: 2

J&#246;rg W Mittag
J&#246;rg W Mittag

Reputation: 369430

The actual core of Git is rather small. Unfortunately, it's not written in a programming language that is amenable to easy understanding, and it is riddled with performance optimizations that are not relevant to the actual operation.

However, there are several alternative implementations of Git, in particular the Dulwich library, which is written in Python.

There's also Amp, whose goal is to provide unified interfaces to all major distributed version control systems. At the moment, they only implement Mercurial, but Git, Bazaar and Darcs are planned as well. Now, Mercurial is written in Python and Amp in Ruby which are both similarly expressive, so you might think that the difference isn't that big. However, Amp is designed so that you e.g. use the Mercurial commands on a Git repository or Darcs commands with Bazaar semantics on a Mercurial repository, so there is a very clear separation between those layers. And Amp is designed so that even non-programmers can write their own personalized version control system using Amp's building blocks, so the code is extremely simple and straightforward.

Upvotes: 3

Andrey Vlasovskikh
Andrey Vlasovskikh

Reputation: 16838

Darcs is written in Haskell, but it is quite large: 40 KLOC. Mercurial is about 40 KLOC too, but its core is about 20 KLOC.

Upvotes: 1

Related Questions