Changeset 12678
- Timestamp:
- 07/20/12 17:17:10 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/oecreview/oecreview.sh
r11985 r12678 3 3 4 4 #Some functions 5 function parselog() #{{{16 {7 cat $1 | while read line8 do9 if [ "$line" == "" ]10 then11 #empty line, keep going12 continue13 fi14 if [ "$line" == "------------------------------------------------------------------------" ]15 then16 #print previous log if not empty17 if [ "$RELEASE" != "" ]18 then19 echo "$RELEASE $USER $DATE $TIME"20 fi21 22 #new log coming up!23 NEWLOG=124 LOG=""25 continue26 fi27 28 if [ "$NEWLOG" == "1" ]29 then30 31 #r2714 | morlighe | 2009-12-09 11:48:20 -0800 (Wed, 09 Dec 2009) | 1 line32 RELEASE=$(echo $line | awk '{print $1}')33 USER=$( echo $line | awk '{print $3}')34 DATE=$( echo $line | awk '{print $5}')35 TIME=$( echo $line | awk '{print $6}')36 37 NEWLOG=038 continue39 else40 LOG=$(echo "$LOG $line")41 fi42 done43 } #}}}44 5 function parselogchangedpaths() #{{{1 45 6 { … … 74 35 DATE=$( echo $line | awk '{print $5}') 75 36 TIME=$( echo $line | awk '{print $6}') 76 77 37 NEWLOG=0 78 38 continue … … 114 74 if [ "$NEWLOG" == "1" ] 115 75 then 116 117 76 #r2714 | morlighe | 2009-12-09 11:48:20 -0800 (Wed, 09 Dec 2009) | 1 line 118 77 RELEASE=$(echo $line | awk '{print $1}') … … 120 79 DATE=$( echo $line | awk '{print $5}') 121 80 TIME=$( echo $line | awk '{print $6}') 122 123 81 NEWLOG=0 124 82 continue … … 140 98 } #}}} 141 99 142 #Only keep pdf file generated?143 keeppdf=1;144 145 #today's date146 TODAY=$(todaydate);147 148 100 #Archive location: 149 archiveroot=$ISSM_DIR/oecreview/Archive 150 templatedir=$ISSM_DIR/oecreview/Template 151 trunk=$ISSM_DIR/trunk-jpl 101 CLEAN_DIR="/Users/morlighe/Desktop/issmjpl/svn-sync/issm-clean" 102 ARCHIVE_ROOT=$CLEAN_DIR/oecreview/Archive 103 TEMPLATE_DIR=$CLEAN_DIR/oecreview/Template 104 TRUNK_JPL=$CLEAN_DIR/trunk-jpl 152 105 153 106 #Range 154 107 if test $# -ne 2 155 108 then 156 echo "oecreview.sh needs 2 arguments specifying the svn range on which to apply the review"157 exit 1109 echo "oecreview.sh needs 2 arguments specifying the svn range on which to apply the review" 110 exit 1 158 111 fi 159 160 112 r1=$1; 161 113 r2=$2; 162 114 163 115 #Name of archive directory: 164 archivedir="$archiveroot/$r1-$r2"116 ARCHIVE_DIR="$ARCHIVE_ROOT/$r1-$r2" 165 117 166 118 #Create archive subdirectory for this batch of changes 167 rm -rf $archivedir && mkdir $archivedir 168 169 170 #start log template 171 cat > $archivedir/log.tex << EOF 172 EOF 119 rm -rf $ARCHIVE_DIR && mkdir $ARCHIVE_DIR 173 120 174 121 #create log number 175 echo "$r1-$r2" > $ archivedir/LogNumber.tex122 echo "$r1-$r2" > $ARCHIVE_DIR/LogNumber.tex 176 123 177 124 #create date tex 178 echo $ TODAY > $archivedir/Date.tex125 echo $(todaydate) > $ARCHIVE_DIR/Date.tex 179 126 180 127 #create revision texs 181 echo $r1 > $ archivedir/r1.tex182 echo $r2 > $ archivedir/r2.tex128 echo $r1 > $ARCHIVE_DIR/r1.tex 129 echo $r2 > $ARCHIVE_DIR/r2.tex 183 130 184 131 #copy template 185 cp $ templatedir/docreview.tex $archivedir/ISSM-DocReview-$r1-$r2.tex186 cp $ templatedir/signature.eps $archivedir/187 cat $ templatedir/Makefile | sed "s/name=docreview/name=ISSM-DocReview-$r1-$r2/g" > $archivedir/Makefile132 cp $TEMPLATE_DIR/docreview.tex $ARCHIVE_DIR/ISSM-DocReview-$r1-$r2.tex 133 cp $TEMPLATE_DIR/signature.eps $ARCHIVE_DIR/ 134 cat $TEMPLATE_DIR/Makefile | sed "s/name=docreview/name=ISSM-DocReview-$r1-$r2/g" > $ARCHIVE_DIR/Makefile 188 135 189 counter=0136 COUNTER=0 190 137 for (( i=$r1; i<$r2; i++ )) 191 138 do 139 echo "Dealing with change #$i" 192 140 j=$(($i+1)); 193 141 194 142 #get svn log for this commit 195 log=`svn log -v -r $i:$j $trunk | parselog` 143 echo " => getting log..." 144 rm TEMP 145 svn log -v -r$i $TRUNK_JPL > TEMP 196 146 197 #retrieve info from the log 198 release=`echo $log | awk '{printf("%s\n",$1);}'` 199 user=`echo $log | awk '{printf("%s\n",$2);}'` 200 date=`echo $log | awk '{printf("%s\n",$3);}'` 201 time=`echo $log | awk '{printf("%s\n",$4);}'` 202 203 if test -z $user 147 if [ "$(cat TEMP)" == "------------------------------------------------------------------------" ] 204 148 then 205 #empty user, nothing was changed on the trunk/, skip 149 #empty log, nothing was changed on the trunk-jpl/ (this must be a change in another direcoty), skip 150 echo " => empty log (not affecting trunk-jpl)" 206 151 continue 207 152 fi 153 154 #process log 155 release=$( cat TEMP | sed -n 2p | awk '{print $1}') 156 user=$( cat TEMP | sed -n 2p | awk '{print $2}') 157 date=$( cat TEMP | sed -n 2p | awk '{print $3}') 158 time=$( cat TEMP | sed -n 2p | awk '{print $4}') 208 159 209 counter=$(($counter+1))160 COUNTER=$(($COUNTER+1)) 210 161 211 162 #retrieve files affected 212 changedpath=`svn log -v -r $i:$j $trunk | parselogchangedpaths ` 213 logmessage=`svn log -v -r $i:$j $trunk | parselogmessages ` 163 echo " => getting path" 164 changedpath=$(cat TEMP | parselogchangedpaths) 165 echo " => getting log message" 166 logmessage=$(cat TEMP | parselogmessages) 214 167 215 168 #create diff file 216 svn diff -r $i:$j $trunk > $archivedir/ISSM-$i-$j.diff 169 echo " => getting diff file" 170 svn diff -r $i:$j $TRUNK_JPL > $ARCHIVE_DIR/ISSM-$i-$j.diff 217 171 218 172 #add lines to explain the logs 219 cat $archivedir/log.tex && echo "\\noindent \\textbf{Change \#$counter} with diff file ISSM-$i-$j.diff: \\\\ Function name: \\\\$changedpath \\\\ Export determination: 6. \\\\Rationale: $logmessage \\\\\\\\" >> $archivedir/log.tex 173 echo " => add to $ARCHIVE_DIR/log.tex" 174 cat >> $ARCHIVE_DIR/log.tex << EOF 175 \\noindent \\textbf{Change \#$COUNTER} with diff file ISSM-$i-$j.diff: \\\\ 176 Function name: \\\\ 177 $(echo $changedpath | sed 's/_/\\_/g' )\\\\ 178 Export determination: 6. \\\\ 179 Rationale: $(echo $logmessage | sed 's/_/\\_/g' )\\\\ 180 \\vspace{3em} 181 182 EOF 220 183 done 184 rm TEMP 221 185 222 #Make this latex compatible:223 cat $archivedir/log.tex | sed 's/_/\\_/g' > $archivedir/log.tex.bak224 mv $archivedir/log.tex.bak $archivedir/log.tex225 226 186 #create pdf file 227 cd $ archivedir187 cd $ARCHIVE_DIR 228 188 make 229 189 230 190 #copy pdf file in Archive directory: 231 cp $ archivedir/ISSM-DocReview-$r1-$r2.pdf $archiveroot191 cp $ARCHIVE_DIR/ISSM-DocReview-$r1-$r2.pdf $ARCHIVE_ROOT 232 192 233 #conclude 234 cd $archivedir 235 193 echo "Done! Now call Eric L."
Note:
See TracChangeset
for help on using the changeset viewer.