Advertisement
gimmeitorilltell

Security pick script

Apr 6th, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Define a bunch of variables
  4. DIR="`pwd`"
  5. REPOLIST=".repo/project.list"
  6. TMP="$DIR/tmp"
  7. BRANCHFROM="$1"
  8. BRANCHTO="$2"
  9. LOGPATH="$DIR/$BRANCHFROM-$BRANCHTO.log"
  10.  
  11. # Check if aosp or caf
  12. if echo "$DIR" | grep -i "caf" ;
  13. then
  14. SOURCE="caf"
  15. elif echo "$DIR" | grep -i "aosp" ;
  16. then
  17. SOURCE="tags"
  18. fi
  19.  
  20. # define branch or tag
  21. FROM="$SOURCE"/"$BRANCHFROM"
  22. TO="$SOURCE"/"$BRANCHTO"
  23.  
  24. # Log function
  25. function LOG()
  26. {
  27. # Stupid way to skip over empty repos
  28. rm -rf $TMP
  29. git log --no-merges $FROM...$TO > $TMP
  30. if [ -s "$TMP" ] ;
  31. then
  32. # Format
  33. echo "" >> $LOGPATH
  34. echo "#" >> $LOGPATH
  35. echo "##" >> $LOGPATH
  36. echo "$pathline" >> $LOGPATH
  37. echo "##" >> $LOGPATH
  38. echo "#" >> $LOGPATH
  39. echo "" >> $LOGPATH
  40. # Actual log command
  41. git log --no-merges --pretty=oneline $FROM..$TO >> $LOGPATH
  42. fi # End stupid way to skip over empty repos
  43. }
  44.  
  45. # Lets make sure log file is clean
  46. rm -f $LOGPATH
  47.  
  48. # We start
  49. echo "Generating LOG for '$SOURCE' from '$BRANCHFROM' to '$BRANCHTO'"
  50. echo "Start" > $LOGPATH
  51. echo "Git log from '$BRANCHFROM' to '$BRANCHTO'" >> $LOGPATH
  52.  
  53. # Use repo list
  54. cat $REPOLIST |\
  55. # Loop to go through all repos until list is empty
  56. while read pathline; do
  57. pathline=$pathline
  58. cd "$pathline"
  59. LOG
  60. cd "$DIR"
  61. done # End loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement