One day I had to decide which code versioning system should be used. After reading some articles found via Google, generally I had to pick either one that employs centralized or decentralized repository. At that time, I picked one that employs a centralized repository because I had not understood well how a decentralized repository could benefit us. Now I think I have got the feeling on how useful a decentralized repository is.
Basically, the code that I develop and maintain needs to be carried from the development center to the users' place where it will be tested and receive numerous tiny improvements and back to the development center where all of those improvements will be merged into the existing code base. So, my workflow is to checkout the latest revision of the code at the development center and store it in my laptop in two directories: working_copy and fake_original. Anytime there is a logical change in working copy, I generate a diff against fake_original like:
eus@eus-laptop:~/fake_original$ diff -ruN . ../working_copy > ../patch1_reason.txt
and apply the resulting patch to fake_original like:
eus@eus-laptop:~/fake_original$ patch -p0 < ../patch1_reason.txt
so that it can generate the next incremental patch. Back at the office, I revert anything in working_copy directory and do sequential patching and committing like:
eus@eus-laptop:~/working_copy$ svn revert -R . eus@eus-laptop:~/working_copy$ patch -p0 < ../patch1_reason.txt eus@eus-laptop:~/working_copy$ svn commit -m 'reason of patch1'
That workflow is inefficient since it has some duplicated jobs to do although shell script can handle them.
In addition, it loses some handy functionalities that only work when the working copy can connect to the repository, for example, svn log.
I think those problems should have been addressed by a code versioning system employing a decentralized repository in addition to many handy features to work in isolation from the source repository. Anyway I haven't tried any of the available decentralized code versioning system, but I think now I have got the reason to use one of them.
Keywords: why decentralized code versioning system
I have tried it out!
I have used a decentralized repository out since November 2009, and yes, as I have said before, a decentralized repository is just like my thought that I described in the main article above. I started to use Git because a friend of mine, http://github.com/AndreaCrotti/, gave me a nudge in that direction through http://github.com.