Category Archives: svn

checkout svn project without svn files

if you have already checkout project using “svn co” command, please go here.

Otherwise, retrieve project using:

==> Please note that myproj, in this case, isn’t a working copy !

import many versions of project to svn repository

I have traditionally versionning my project by copying my project folder, rename the copy and continue work on it.

Now, I have several versions of my project in different folders: myproj_v1, myproj_v2, …
I want to import my project version by version. So, I’ll have change log.

To import like so (e.g. to, we have to type following commands:
1. copy first version in different folder

2. import to svn

3. rsync the second version

4. force add unversionned elements

5. commit second version

==> repeat steps 3, 4, 5 to continue with next versions folders

checkout single file from svn repo

svn co doesn’t permit checkout files but directories.
use rather :

svn export https://svn.repo/path/to/file/witr.png /tmp/witr.png

another alternative for text files

svn cat https://svn.repo/path/to/file/witr.txt > /tmp/witr.txt

get last 10 log of several svn projects

We have 10 projects checked out from svn repo:
… etc

get last 10 log of several svn projects with shell comand line :

svn first user commit

print users who commits frst commit for each class in project :
> find -name “*.java” -exec svn log -l1 -r1:HEAD {} ; | grep “|” | awk ‘{print $3}’

print java class name and user who leaves first commit of that class
(user /path_to_java_file/ :

> find -name “*.java” | while read line; do user=$(svn log -l1 -r1:HEAD $line | grep “|” | awk ‘{print $3}’); echo $user $line; done;

be notified of all svn changes

If you want like me have been notified of all svn changes, the following script I wrote for you.

Prerequisite :

  • svn installed
  • svn well configured for user executing script


export SVN_UPDATES_HOME=/mnt/scripts/svnUpdates
export SVN_UPDATES_LAST=$SVN_UPDATES_HOME/tmp/svnUpdatesLast.txt
export SVN_UPDATES_TMP=$SVN_UPDATES_HOME/tmp/svnUpdates.txt
export SVN_UPDATES_DIFF_TMP=$SVN_UPDATES_HOME/tmp/svnUpdatesDiff.txt

if [[ -s $SVN_UPDATES_LAST ]]
  echo “copy last svn log to tmp”

for log in 1 2 3
  echo “svn log – try:$log”
  svn log -v -l5 -rHEAD:1 > $SVN_UPDATES_LAST
  if [[ -s $SVN_UPDATES_LAST ]]
    echo “svn logged successfully in try:$log”

if [[ -s $SVN_UPDATES_LAST ]]
  echo “proceed to diff last with tmp”
  diff $SVN_UPDATES_LAST $SVN_UPDATES_TMP | grep -E “^<" | sed s/^.// > $SVN_UPDATES_DIFF_TMP
  diffsCount=$(wc -l $SVN_UPDATES_DIFF_TMP | awk {‘print $1’})
  if [ $diffsCount -gt 0 ]
      “diffs found: send notification”
      datetime=$(date “+%Y%m%d-%H%M%S”)
      cp $SVN_UPDATES_DIFF_TMP $logFile
      ### put here the way you want be notified (mail, jabber, …)
      ### echo “==== svn updated cf. $logFile ====” | sendxmpp
      ### cat $logFile | sendxmpp

Here I choose to be notified by message sent from jabber server from my account to my account.
Prerequisite : sendxmpp installed : apt-get install sendxmpp

echo “==== svn updated cf. $logFile ====” | sendxmpp
cat $logFile | sendxmpp

Finally, schedule the script in your crontab (executed each minute recommanded)

* * * * * /mnt/scripts/svnUpdates/

June 21, 2012

shell: svn log -v –xml > logFile.log
shell: java -jar statsvn.jar logFile.log
see more options
details for ant task in my Drive