We like subversion. Well, we used to. Now we HATES it.
Repository Planning
Going to be cross-platform? svn propset svn:eol-style native *.cpp! This is critical if you expect svnmerge.py to work at all (and reduces number of unreadable diffs because "the whole file has changed" THEN set the auto properties right: http://svn.haxx.se/users/archive-2003-12/0063.shtml
- Adding/Importing a folder already in svn somewhere else: First, run this shell script to get rid of the previou .svn directories:
find . -name .svn -print -exec rm -rf {} \; .
Then add/import as normal
SVN Diff tools
* svn diff -c r####
- gives us the diff of the changes made in that revision
* sdiff tool to make comparing revisions easier, from Arild Shirazi
function sdiff {
usage() {
printf "usage: sdiff [file | revision]\n"
printf " Shows the log message and latest changes to be committed in a "
printf " svn repository.\n"
printf " file - limit the diff to the file specified, e.g. \"images\"\n"
printf " revision - provide the log and diff for the given revision "
printf "instead of the latest commit, e.g. \"88\" or \"r88\"\n"
}
# Would be nice if this function could terminate larger sdiff function
under_version_control() 2>&1 > /dev/null { svn info "$FILE" }
if [ $# -gt 1 ]; then
echo "error: Too many arguments" >&2
usage && return
elif [ $# -eq 1 ]; then
FILE="$1"
else
FILE='.'
fi
if [ -e "$FILE" ]; then
# sdiff file
if under_version_control; then
else
usage && return
fi
LATEST_REV_STRING="Last Changed Rev: "
REV=$(svn info "$FILE" 2> /dev/null | \
awk "/${LATEST_REV_STRING}/ { print \$NF }" 2> /dev/null)
else
# sdiff rev
REV=$(echo "$1" | sed -e 's/^-r/r/' -e 's/^r//')
FILE='.'
if under_version_control; then
else
usage && return
fi
non_numeric_rev=$(echo "$REV" | sed -e 's/[0-9]//g')
if [ -n "$non_numeric_rev" ]; then
echo "error: cannot find file or revision $1" >&2
usage && return
fi
fi
echo "Index: ${FILE}" # Hack to get 'diff' syntax highlighting in vim
svn log -r${REV} $FILE
svn diff -x-b -c${REV} $FILE
}Usage:
# to see the commit message and all changes with the last commit $ sdiff # to see the commit message and all changes with the last commit for a file $ sdiff lib/lifecycle_handlers/event_handlers/documents.rb # to see the commit message and all changes for a particular version $ sdiff r1000