Skip to content

Instantly share code, notes, and snippets.

@jesperronn
Created April 15, 2015 20:39
Show Gist options
  • Save jesperronn/174cea58433d2f06968f to your computer and use it in GitHub Desktop.
Save jesperronn/174cea58433d2f06968f to your computer and use it in GitHub Desktop.
SVN manipulate history
#!/usr/bin/env bash
# set -x
# script here will create new subversion repository (file based).
# then it will make 10 commits
# Then we will manipulate the commit dates of the ten commits
START_FOLDER=$(pwd)
REPO=repo02
WD=working2
HOOKFILE=$REPO/hooks/pre-revprop-change
# svn repository
svnadmin create $REPO
echo '#!/usr/bin/env bash' > $HOOKFILE
echo 'exit 0' >> $HOOKFILE
chmod +x $HOOKFILE
#checkout a working copy
cd "$START_FOLDER"
svn checkout "file://$START_FOLDER/$REPO" "$WD"
cd "$START_FOLDER"
cd "$WD"
touch README.txt
svn add README.txt
for i in 1 2 3 4 5 6 7 8 9 10
do
echo "line $i" >> README.txt
svn ci -m "commit number $i (originally created $(date +"%Y-%m-%d %T"))"
done
svn update
svn log
#!/usr/bin/env bash
#
# We have 10 commits in a repository. Lets set commit dates to May 1st, 1981-1990
#
# set -x
START_FOLDER=$(pwd)
WD=working2
cd "$START_FOLDER"
cd "$WD"
for i in 1 2 3 4 5 6 7 8 9 10
do
YEAR=$(echo "1980 + $i" | bc )
svn propset --revprop -r $i svn:date "$YEAR-05-01T10:00:00.000000Z"
done
svn update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment