Posted to tcl by hypnotoad at Tue Aug 29 15:11:08 GMT 2017view raw

  1. #!/bin/bash
  2.  
  3. die(){
  4. echo $1
  5. exit 1
  6. }
  7.  
  8. # parameters:
  9. # 1 - username of admin
  10. # 2 - cvs repository to convert
  11. # 3 - module in cvs to convert
  12. # 4 - name of fossil repo (no extension)
  13. # note: the repository will be created right here!
  14.  
  15. if [ "$4" == "" ] ; \
  16. then
  17. echo "Syntax:"
  18. echo " cvs2fossil username cvsroot module fossil-repo-name"
  19. die "Please make sure you have all three parameters set!"
  20. fi
  21.  
  22. echo "Importing from CVS to git. This will take some time, be patient!"
  23. mkdir $4
  24. cd $4
  25. cvs -d $2 login
  26. chmod -R 777 .
  27. git cvsimport -v -d $2 $3 || die "Unable to import to git"
  28.  
  29. echo "Importing from git to fossil. This will also take some time, sadly"
  30.  
  31. (
  32. git fast-export --full-tree --all | fossil import --git ../$4.fossil || die "Unable to import into fossil"
  33. )
  34.  
  35. echo "Done!."
  36. fossil user new $1 -R ../$4.fossil
  37. fossil user capabilities $1 'v' -R ../$4.fossil