A part of my daily routine when arriving at the office in the morning is a quick overview of the code changes since the previous day. It’s not a full blown code review, I only rapidly look at the most important parts of the code base, but I make a point of doing it every day. It allows me to stay informed and notice if something is wildly going in the wrong direction.
This is something I do every day, so it has to be quick and simple. I don’t want to have to open three windows, ctrl-select and right click all over the place. Especially since, like I said, it’s the morning, meaning my neurons are still not talking to each other much yet. I need something dead simple.
Here is a short command line shell script I wrote for doing just that: show me the changes since the previous working day. It uses date with some fancy options to figure weekdays, as well as colordiff and less for comfortable reading. Just launch it from the terminal, and there you have all the changes ready to be scrolled. Feel free to use it if you find it useful.
#!/bin/sh
argn=$#
if [ $argn -lt 1 ]
then
echo "Usage: $0 <paths>"
exit 1
fi
(
dateRequest="yesterday"
startDate=`date --date="$dateRequest" +"%F"`
startDay=`date --date="$dateRequest" +"%u"`
if [ $startDay -gt 5 ]
then
dateRequest="last Friday"
startDate=`date --date="$dateRequest" +"%F"`
startDay=`date --date="$dateRequest" +"%u"`
fi
echo "Changes since $startDate:";echo;echo
for d in $@
do
echo "$d"
svn log -r{"$startDate"}:HEAD "$d"
svn diff -r{"$startDate"}:HEAD "$d" -x --ignore-space-change | colordiff
done
) | less -R