Tuesday, July 8, 2014

Bash script to iterate through RCS versions of a file and output each difference

 1 #!/bin/bash
 2 
 3 file=$1
 4 top_num=10
 5 
 6 
 7 if [[ ! -f ${file} ]]; then
 8    echo "Need valid file to Check RCS Against"
 9    exit
10 fi
11 
12 
13 revisions=( $(rlog ${file} | grep '^revision' | sed
14 's/revision /r/' | cat | awk '{print $1}' | head -n
15 ${top_num}) )
16 
17 echo "number of revisions: " ${#revisions[@]}
18 
19 for (( i = 0; i < ${#revisions[@]}; i++ )); do
20    if [[ ${i} == 0 ]]; then continue; fi
21    echo
22    echo
23    echo
24    echo
25    echo
26    echo "================================================="
27    echo "================================================="
28    echo "${revisions[${i}-1]} -> ${revisions[${i}]}
29    ${file}"
30    echo "================================================="
31    echo "================================================="
32    rcsdiff -zLT -u -${revisions[${i}-1]}
33    -${revisions[${i}]} ${file}
34 done
You can select, copy and paste the code below

No comments:

Post a Comment