Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 11th, 2012  |  syntax: None  |  size: 0.91 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/sh
  2. #
  3.  
  4. if [ "$1" = "" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
  5.        
  6.         echo "git > svn mirror script by CeBe <mail@cebe.cc>"
  7.         echo ""
  8.         echo "usage: $0 svnurl [giturl]"
  9.         echo ""
  10.         echo "   svnurl  base url to svn repo, NOT url to trunk! must end with /"
  11.         echo "   giturl  url of git repo to push code to. this repo should be empty"
  12.         echo "           if not specified, you have to push repo in ./mirror yourself"
  13.         echo ""
  14.         echo "requires git, svn, php and svn2git (https://github.com/nirvdrum/svn2git)"
  15.         echo ""
  16.         exit 1;
  17. fi
  18.  
  19. # create empty tmp dir
  20. if [ -d ./tmp ] ; then
  21.         rm -rf ./tmp
  22. fi
  23. mkdir ./tmp
  24. cd ./tmp
  25.  
  26. svn checkout $1 svn
  27.  
  28. # generate authors file
  29.  
  30. touch authors.txt
  31. cd svn
  32.  
  33. php ../../authors.php > ../authors.txt
  34.  
  35. cd ../../
  36. mkdir mirror
  37. cd mirror
  38. svn2git $1 -m -v --authors ../tmp/authors.txt
  39.  
  40. if ! [ "$2" = "" ] ; then
  41.         git remote add gitmirror $2
  42.         git push -u --all gitmirror
  43.         git push --tags gitmirror
  44. fi
  45.  
  46. cd ..