Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# SVN vs Git performance and ease of use
# --------------------
# the svn version
# these commands based off
function error_mkdir() {
echo "Please give me a base directory to work in. For example: /tmp/stress_test"
exit 1
function error_is_not_working_dir() {
echo "$1 is not a directory."
exit 1
function error_cleanup() {
echo "Please clean up tmp directories under ${working_dir}."
exit 1
if [ ! $1 ]; then
if [ ! -d ${working_dir} ]; then
mkdir ${working_dir}
# sanity check
if [ -d ${svn_repo} ]; then error_cleanup; fi
if [ -d ${working_dir}/svn_stress ]; then error_cleanup; fi
# create a test SVN server
cd ${working_dir}
svnadmin create ${svn_repo_base}
cd ${working_dir}
svn checkout file:///${svn_repo} ${svn_working_base}
cd ${svn_working_base}
# this whole thing below is a negative on SVN
mkdir tags trunk branches
svn add *
svn commit -m "creating svn root" *
# download linux kernel source (79M, ~42,000 files)
if [ ! -f /tmp/linux-3.6.1.tar.bz2 ]; then
wget -O /tmp/linux-3.6.1.tar.bz2 \
cd ${svn_working}/trunk
tar xjf /tmp/linux-3.6.1.tar.bz2
svn status
# ? linux-3.6.1
# it was so slow
# rm -rf arch block crypto Documentation drivers firmware fs \
# include init ipc kernel lib mm net samples security sound tools usr virt
svn add linux-3.6.1
# few seconds
svn commit -m "initial commit" linux-3.6.1
# few minutes
# branching to work on a feature, why do we need a commit message?
svn cp file:///${svn_repo}/trunk \
file:///${svn_repo}/branches/ipod_support \
-m "feature branching kernel to hack on ipod support"
# pull in branch
cd ${svn_working}
svn update
# switching branches will get rid of tags trunk branches directories
svn switch file:///${svn_repo}/branches/ipod_support
# verify branch switch
# svn info | grep URL
echo -e "Linux kernel release 3.x <>\n" > linux-3.6.1/README
echo -e "NOW WITH IPOD SUPPORT" >> linux-3.6.1/README
# svn status
# M linux-3.6.1/README
svn commit -m "hacked on ipod support" linux-3.6.1/README
# Merging with SVN! Oh horrors!
svn switch file:///${svn_repo}/trunk
svn merge --reintegrate file:///${svn_repo}/branches/ipod_support
svn commit -m "merging ipod support into trunk"
svn rm file:///${svn_repo}/branches/ipod_support \
-m "deleting ipod_support branch"
# second branching, no comments below for brevity
svn cp file:///${svn_repo}/trunk \
file:///${svn_repo}/branches/more_hackery \
-m "feature branching kernel for more hackery"
cd ${svn_working}
svn update
svn switch file:///${svn_repo}/branches/more_hackery
echo "it was all you" > linux-3.6.1/CREDITS
svn commit -m "updated credits" linux-3.6.1/CREDITS
svn switch file:///${svn_repo}/trunk
svn merge --reintegrate file:///${svn_repo}/branches/more_hackery
svn commit -m "merging more hackery into trunk"
svn rm file:///${svn_repo}/branches/ipod_support \
-m "deleting ipod_support branch"
# third branching, let's do this thing
svn cp file:///${svn_repo}/trunk \
file:///${svn_repo}/branches/last_diddy \
-m "feature branching kernel for some diddy"
cd ${svn_working}
svn update
svn switch file:///${svn_repo}/branches/last_diddy
echo "free as in freedom" > linux-3.6.1/COPYING
svn commit -m "updated license" linux-3.6.1/COPYING
svn switch file:///${svn_repo}/trunk
svn merge --reintegrate file:///${svn_repo}/branches/last_diddy
svn commit -m "merging more last_diddy into trunk"
svn rm file:///${svn_repo}/branches/last_diddy \
-m "deleting ipod_support branch"
# cd
# rm -rf /${svn_repo}
# rm -rf ${svn_working}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment