707c46955a33e417b9eadf1697d260b524526998
kuhn
  Tue Nov 27 17:22:25 2012 -0800
fixed to combine dual occurances of same person: e.g.,  kent and Jim Kent
diff --git src/utils/qa/whoMadeIt.csh src/utils/qa/whoMadeIt.csh
index e5445bd..1584def 100755
--- src/utils/qa/whoMadeIt.csh
+++ src/utils/qa/whoMadeIt.csh
@@ -2,65 +2,99 @@
 source `which qaConfig.csh`
 
 ################################
 #  
 #  02-22-07
 #  Robert Kuhn
 #
 #  gets info about who wrote the lines in a program
 #
 ################################
 
 set program=""
 set location=""
 set size=""
 
+# set up equivalence to remove split contributions under two names
+set names=( 'Ann Zweig' 'Brian Raney' 'Brooke Rhead' 'Jim Kent' 'Andy Pohl'\
+  'Larry Meyer' 'Mark Diekhans' 'Kate Rosenbloom' 'Hiram Clawson' 'Tim Dreszer' \
+  'Galt Barber' 'Belinda Giardine' 'Angie Hinrichs' 'Robert Baertsch' )
+set alias=( ann braney rhead kent aamp \
+  larrym markd kate hiram tdreszer  \
+  galt giardine angie baertsch )
+# set names=( 'Jim Kent' )
+# set alias=( kent )
+set aliases=`echo $alias | wc -w`
+
 if ( $#argv != 1 ) then
   echo
   echo "  gets info about who wrote the lines in a program."
+  echo "  expects your source tree in your ~/kent directory."
   echo
   echo "    usage:  program"
   echo
   exit
 else
   set program=$argv[1]
 endif
 
 if ( "$HOST" != "hgwdev" ) then
  echo "\n error: you must run this script on dev!\n"
  exit 1
 endif
 
 cd ~/kent
 set location=`find . -name $program`
 echo
 
 # find out if input location is a directory
 # and prepend the path to each filename
 # omitting dot oh files
-git blame $location >& /dev/null
-if ( $status == 128 ) then
+if ( `file $location | awk '{print $NF}'` == "directory" ) then
   set full=""
   set files=`ls $location | egrep -v '.o$'`
   foreach file ( $files )
-    set full="`echo $full` $location/$file"
+    set full="$full $location/$file"
   end
-  set location=`echo $full`
+  set location="$full"
 endif
 
 foreach file ( $location )
   echo $file
   git blame $file | awk -F'(' '{print $2}' \
     | awk -F'20' '{print $1}' | sort \
     | uniq -c | sort -k2 -nr >& xxOutFilexx
   set size=`cat xxOutFilexx | awk '{total+=$1} END {print total}'`
-  cat xxOutFilexx
+
+  set i=$aliases
+  mv xxOutFilexx tmp$i
+
+  while ( $i > 0 )
+    set first=`cat tmp$i | egrep "$alias[$i]" | awk '{print $1}'`
+    set secon=`cat tmp$i | egrep "$names[$i]" | awk '{print $1}'`
+    set sum=`echo $first $secon | awk '{print $1+$2}'`
+
+    if ( $sum > $first ) then
+      cat tmp$i | grep -v "${first} $alias[$i]" \
+        | sed "/$names[$i]/ s/$secon/$sum/" \
+        | sort -k1,1 -nr > temp
+    else
+      cat tmp$i | sed "s/$alias[$i]/$names[$i]/" > temp
+    endif
+
+    rm -f tmp$i
+    @ i = $i - 1
+    mv temp tmp$i
+  end
+  mv tmp0 xxOutFilexx
+
+  cat xxOutFilexx | awk '{print $1, $2, $3}' | sed "s/ /_/" \
+    | awk -F"_" '{printf("%7s %-10s\n", $1, $2 )}'
   if ( `wc -l xxOutFilexx | awk '{print $1}'` > 1 ) then
     echo "-----" "-----" | awk '{printf("%7s %-10s\n", $1, $2)}'
     echo $size "total" | awk '{printf("%7s %-10s\n", $1, $2)}'
   endif 
   rm xxOutFilexx
   echo
 end
-
 echo
-
+exit