Email: bknpk@hotmail.com Phone: +972-54-7649119


V

 

This page shows how to recursively do a svn log on all files and creating a filtered log file.

  1. In order to find new files I use svn log. In this case, I needed to recursively do it on all files somewhere in the middle of the svn tree.

  2. Only the revision and file name are the only information, that I needed. I also wanted them to be written into a log file. One line per entry, to facilitate farther script processing.
    In my case filtering results was easy as all unwanted entries were marked with revision r2.
    Sometimes it easier to run a script, to process and manipulate text, from within vim / gvim. So I marked the area in vim and run:

    :'a,'b !grep -v " r2 "

    To extract based only on date:
    :'a,'b !grep -v "Sun, 23 Sep 2012"

  3. The script was recently improved. On large SVN data base, looking on all files, may take very long time to finish. So it would be nice to be able to restrict the search.
    This script shows a way to handle input parameters to a bash script.

  4. The script is simple as shown:

    1. #!/bin/bash

    2. date > ~/restricted/my_svn_log.txt

    3. #save the input arguments array
    4. arr=("$@")
    5. arg=${#arr[*]}

    6. if [ "$arg" -eq "0" ] ; then
    7.   #if no argument just run on all files (may take long time to finish)
    8.   for f in `find -L . -type f | grep -v "\.svn" | grep -v "\.swp"`; do printf '%s ' $f >> ~/restricted/my_svn_log.txt; svn log $f | grep "^r[0-9]" | head -1 >> ~/restricted/my_svn_log.txt; done
    9. else
    10.   #arr of suffixes to search in SVN
    11.   #invocation examples:
    12.   #~/bin/svn_file.unx
    13.   for suf in "${arr[@]}" ; do
    14.     #use printf instead of echo in order not to have \n at print end
    15.     echo "working on *."${suf}
    16.     for f in `find -L . -name "*.${suf}"`; do printf '%s ' $f >> ~/restricted/my_svn_log.txt; svn log $f | grep "^r[0-9]" | head -1 >> ~/restricted/my_svn_log.txt; done
    17.   done
    18. fi


    19. #later filtered on the resulting file
    20. #'a,'b !grep -v " r2 "


  5. If the script is to be run multiple times concurrently, say on different directories, then the following change is a nice option, which makes use of the $$ to add the process ID to file name:
    Replace line 3 with:
    fn="/home/krengelp/restricted/my_svn_log_"$$".txt"
    echo $fn
    eval "date > "$fn

    Replace every other
    "~/restricted/my_svn_log.txt" with $fn.

  ...


Home

some memory VHDL models

A simple c-code program to read a memory array from verilog RTL, using VPI.






Search This Site


Feedback This Site




new pages on this site