Index: /issm/oecreview/oecreview.sh
===================================================================
--- /issm/oecreview/oecreview.sh	(revision 12677)
+++ /issm/oecreview/oecreview.sh	(revision 12678)
@@ -3,43 +3,4 @@
 
 #Some functions
-function parselog() #{{{1
-{
-cat $1 | while read line
-do
-	if [ "$line" ==  "" ]
-	then
-		#empty line, keep going
-		continue
-	fi
-	if [ "$line" ==  "------------------------------------------------------------------------" ] 
-	then
-		#print previous log if not empty
-		if [ "$RELEASE" != "" ]
-		then
-			echo "$RELEASE $USER  $DATE $TIME"
-		fi
-
-		#new log coming up!
-		NEWLOG=1
-		LOG=""
-		continue
-	fi
-
-	if [ "$NEWLOG" == "1" ] 
-	then
-		
-		#r2714 | morlighe | 2009-12-09 11:48:20 -0800 (Wed, 09 Dec 2009) | 1 line
-		RELEASE=$(echo $line | awk '{print $1}')
-		USER=$(   echo $line | awk '{print $3}')
-		DATE=$(   echo $line | awk '{print $5}')
-		TIME=$(   echo $line | awk '{print $6}')
-
-		NEWLOG=0
-		continue
-	else
-		LOG=$(echo "$LOG $line")
-	fi
-done
-} #}}}
 function parselogchangedpaths() #{{{1
 {
@@ -74,5 +35,4 @@
 		DATE=$(   echo $line | awk '{print $5}')
 		TIME=$(   echo $line | awk '{print $6}')
-
 		NEWLOG=0
 		continue
@@ -114,5 +74,4 @@
 	if [ "$NEWLOG" == "1" ] 
 	then
-		
 		#r2714 | morlighe | 2009-12-09 11:48:20 -0800 (Wed, 09 Dec 2009) | 1 line
 		RELEASE=$(echo $line | awk '{print $1}')
@@ -120,5 +79,4 @@
 		DATE=$(   echo $line | awk '{print $5}')
 		TIME=$(   echo $line | awk '{print $6}')
-
 		NEWLOG=0
 		continue
@@ -140,96 +98,96 @@
 } #}}}
 
-#Only keep pdf file generated? 
-keeppdf=1;
-
-#today's date
-TODAY=$(todaydate);
-
 #Archive location: 
-archiveroot=$ISSM_DIR/oecreview/Archive
-templatedir=$ISSM_DIR/oecreview/Template
-trunk=$ISSM_DIR/trunk-jpl
+CLEAN_DIR="/Users/morlighe/Desktop/issmjpl/svn-sync/issm-clean"
+ARCHIVE_ROOT=$CLEAN_DIR/oecreview/Archive
+TEMPLATE_DIR=$CLEAN_DIR/oecreview/Template
+TRUNK_JPL=$CLEAN_DIR/trunk-jpl
 
 #Range 
 if test $# -ne 2
 then
-echo "oecreview.sh needs 2 arguments specifying the svn range on which to apply the review" 
-exit 1
+	echo "oecreview.sh needs 2 arguments specifying the svn range on which to apply the review" 
+	exit 1
 fi
-
 r1=$1;
 r2=$2;
 
 #Name of archive  directory: 
-archivedir="$archiveroot/$r1-$r2"
+ARCHIVE_DIR="$ARCHIVE_ROOT/$r1-$r2"
 
 #Create archive subdirectory for this batch of changes
-rm -rf  $archivedir &&  mkdir $archivedir
-
-
-#start log template
-cat > $archivedir/log.tex << EOF
-EOF
+rm -rf  $ARCHIVE_DIR &&  mkdir $ARCHIVE_DIR
 
 #create log number
-echo "$r1-$r2"  > $archivedir/LogNumber.tex
+echo "$r1-$r2"  > $ARCHIVE_DIR/LogNumber.tex
 
 #create date tex
-echo $TODAY  > $archivedir/Date.tex
+echo $(todaydate) > $ARCHIVE_DIR/Date.tex
 
 #create revision texs
-echo $r1 > $archivedir/r1.tex
-echo $r2 > $archivedir/r2.tex
+echo $r1 > $ARCHIVE_DIR/r1.tex
+echo $r2 > $ARCHIVE_DIR/r2.tex
 
 #copy template
-cp  $templatedir/docreview.tex $archivedir/ISSM-DocReview-$r1-$r2.tex
-cp  $templatedir/signature.eps $archivedir/
-cat $templatedir/Makefile  | sed "s/name=docreview/name=ISSM-DocReview-$r1-$r2/g" > $archivedir/Makefile
+cp  $TEMPLATE_DIR/docreview.tex $ARCHIVE_DIR/ISSM-DocReview-$r1-$r2.tex
+cp  $TEMPLATE_DIR/signature.eps $ARCHIVE_DIR/
+cat $TEMPLATE_DIR/Makefile  | sed "s/name=docreview/name=ISSM-DocReview-$r1-$r2/g" > $ARCHIVE_DIR/Makefile
 
-counter=0
+COUNTER=0
 for (( i=$r1; i<$r2; i++ ))
 do
+	echo "Dealing with change #$i"
 	j=$(($i+1));
 
 	#get svn log for this commit
-	log=`svn log  -v -r $i:$j  $trunk | parselog`
+	echo " => getting log..."
+	rm TEMP
+	svn log -v -r$i $TRUNK_JPL > TEMP
 
-	#retrieve info from the log
-	release=`echo $log | awk '{printf("%s\n",$1);}'`
-	user=`echo $log | awk '{printf("%s\n",$2);}'`
-	date=`echo $log | awk '{printf("%s\n",$3);}'`
-	time=`echo $log | awk '{printf("%s\n",$4);}'`
-
-	if test -z $user 
+	if [ "$(cat TEMP)" ==  "------------------------------------------------------------------------" ]
 	then 
-		#empty user, nothing was changed on the trunk/, skip
+		#empty log, nothing was changed on the trunk-jpl/ (this must be a change in another direcoty), skip
+		echo " => empty log (not affecting trunk-jpl)"
 		continue 
 	fi
+
+	#process log
+	release=$( cat TEMP | sed -n 2p | awk '{print $1}')
+	user=$(    cat TEMP | sed -n 2p | awk '{print $2}')
+	date=$(    cat TEMP | sed -n 2p | awk '{print $3}')
+	time=$(    cat TEMP | sed -n 2p | awk '{print $4}')
 	
-	counter=$(($counter+1))
+	COUNTER=$(($COUNTER+1))
 
 	#retrieve files affected
-	changedpath=`svn log  -v -r $i:$j  $trunk | parselogchangedpaths `
-	logmessage=`svn log  -v -r $i:$j  $trunk | parselogmessages `
+	echo " => getting path"
+	changedpath=$(cat TEMP | parselogchangedpaths)
+	echo " => getting log message"
+	logmessage=$(cat TEMP | parselogmessages)
 
 	#create diff file
-	svn diff  -r $i:$j  $trunk > $archivedir/ISSM-$i-$j.diff
+	echo " => getting diff file"
+	svn diff -r $i:$j $TRUNK_JPL > $ARCHIVE_DIR/ISSM-$i-$j.diff
 	
 	#add lines to explain the logs
-	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 
+	echo " => add to $ARCHIVE_DIR/log.tex"
+	cat >> $ARCHIVE_DIR/log.tex << EOF
+\\noindent \\textbf{Change \#$COUNTER} with diff file ISSM-$i-$j.diff: \\\\
+Function name: \\\\
+$(echo $changedpath | sed 's/_/\\_/g' )\\\\
+Export determination: 6. \\\\
+Rationale: $(echo $logmessage | sed 's/_/\\_/g' )\\\\
+\\vspace{3em}
+
+EOF
 done
+rm TEMP
 	
-#Make this latex compatible: 
-cat $archivedir/log.tex | sed 's/_/\\_/g' > $archivedir/log.tex.bak
-mv $archivedir/log.tex.bak $archivedir/log.tex
-
 #create pdf file
-cd $archivedir
+cd $ARCHIVE_DIR
 make
 
 #copy pdf file in Archive directory:  
-cp $archivedir/ISSM-DocReview-$r1-$r2.pdf $archiveroot
+cp $ARCHIVE_DIR/ISSM-DocReview-$r1-$r2.pdf $ARCHIVE_ROOT
 
-#conclude
-cd $archivedir
-
+echo "Done! Now call Eric L."
