Skip to content

Instantly share code, notes, and snippets.

@gilmation
Created October 22, 2010 20:05
Show Gist options
  • Save gilmation/641268 to your computer and use it in GitHub Desktop.
Save gilmation/641268 to your computer and use it in GitHub Desktop.
The script that compares the functions of Subversion and Git using two versions of the symfony project
#!/bin/bash
#
# script for the svn vs git screen cast
function and_wait {
if [[ $# -ne 1 ]]; then
sleep 5
else
sleep $1
fi
echo ""
echo ""
}
# echo commands
set -o verbose
svn checkout http://svn.symfony-project.com/branches/1.4
mkdir 2
cd 2
git clone git://github.com/symfony/symfony.git
cd ..
ls -lart; and_wait
find ./1.4 -name "\.svn" | wc -l; and_wait
find ./2/symfony -name "\.git" | wc -l; and_wait
# ............................
# check network
# ............................
ping -c 1 google.com
# ............................
# svn with network
# ............................
cd 1.4
echo "hello" >> README
# ............................
# svn status with network
# ............................
svn status; and_wait
# ............................
# svn diff with network
# ............................
svn diff README; and_wait
# ............................
# svn commit with network
# ............................
svn commit --non-interactive -m "impossible - permissions"; and_wait
# ............................
# svn log with network
# ............................
svn log --limit 1 README; and_wait
# ............................
# svn revert with network
# ............................
svn revert README; and_wait
cd -
# ............................
# git with network
# ............................
cd 2/symfony
echo "hello" >> README
# ............................
# git status with network
# ............................
git status; and_wait
# ............................
# git diff with network
# ............................
git diff README; and_wait
# ............................
# git commit with network
# ............................
git commit -a -m "possible without repo permissions, added hello"; and_wait
# ............................
# git log with network
# ............................
git log -1 --date=relative README
cd -
# ............................
# Disconnect the Network
# ............................
and_wait 10
# ............................
# check network
# ............................
ping -c 1 google.com
# ............................
# svn without network
# ............................
cd 1.4
echo "hello" >> README
# ............................
# svn status without network
# ............................
svn status; and_wait
# ............................
# svn diff without network
# ............................
svn diff README; and_wait
# ............................
# svn commit without network
# ............................
svn commit --non-interactive -m "impossible - network"; and_wait
# ............................
# svn log without network
# ............................
svn log --limit 1 README; and_wait
# ............................
# svn revert without network
# ............................
svn revert README; and_wait
cd -
# ............................
# git without network
# ............................
cd 2/symfony
echo "hello, again" >> README
# ............................
# git status without network
# ............................
git status; and_wait
# ............................
# git diff without network
# ............................
git diff README; and_wait
# ............................
# git commit without network
# ............................
git commit -a -m "possible without the network, added hello (again)"; and_wait
# ............................
# git log without network
# ............................
git log -2 --date=relative README; and_wait
cd -
# unset verbose
set +o verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment