Advertisement
BinaryJacob

svn Branch Number xml generator

Jan 18th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.13 KB | None | 0 0
  1. function findBranches {
  2.  
  3. for DIR in $( svn ls $1 )
  4.  
  5. do
  6.  
  7. if [[ ${DIR} == "branches/" ]]
  8.  
  9. then
  10.  
  11. for BRANCH in $( svn ls $1${DIR} )
  12.  
  13. do
  14.  
  15. echo  $1${DIR}${BRANCH}
  16.  
  17. done
  18.  
  19. elif [[ ${DIR} != 'trunk/' && ${DIR} != 'tags/' && ${DIR} == *"/" ] ]
  20.  
  21. then
  22.  
  23. findBranches $1${DIR}
  24.  
  25. fi
  26.  
  27. done
  28.  
  29. }
  30.  
  31. function production {
  32.  
  33. read -p "Enter the release branch number: " branch
  34.  
  35. findBranches http://svn.techgig.com/ecomm-b2c/ > tmp01.txt
  36.  
  37. egrep ${branch} tmp01.txt > tmp02.txt
  38.  
  39. echo -ne "<audit>\n\t<project>AUT</project>\n\t<adminTicket></adminTicket>\n\t<fixVersion>${branch}</fixVersion>\n \t<branches>\n"
  40.  
  41. for x in $(cat tmp02.csv)
  42.  
  43. do
  44. url=$(svn info ${x} | grep "URL" | sed 's/URL: //')
  45. revision=$(svn log -v -r0:HEAD -l1 --stop-on-copy ${x} | grep -o "r[0-9]\{1,5\}" | sed "s/r//")
  46.  
  47. #echo -ne "${url}/${revision}\n" | sed 's/Revision: //'
  48.  
  49. echo -ne "\t\t<branch>\n
  50.          \t\t\t<path>${url}</path>\n
  51.          \t\t\t<startRevision>${revision}</startRevision>\n
  52.          \t\t\t<endRevision></endRevision>\n
  53.          \t\t</branch>\n"
  54. done
  55.  
  56. echo -ne "\t</branches>\n</audit>"
  57.  
  58. }
  59.  
  60.  
  61. production > xmlFile.xml
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement