Divide and conquer svn repo


/ Published in: XHTML
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # The following structure exists:
  2. #
  3. # originalrepository/
  4. # project_name/
  5. # trunk/
  6. # branches/
  7. # tags/
  8. #
  9. # I want to move it to its *own* repository and give the following structure:
  10. #
  11. # newrepositoryname/
  12. # trunk/
  13. # branches/
  14. # tags/
  15. #
  16.  
  17. export LOCAL='file:/'
  18. export SVN_DIR='/home/bluespark/svn'
  19. export SVN_OLD_REPO='originalrepository'
  20. export SVN_PROJ='project_name'
  21. export SVN_REPO='newrepositoryname'
  22.  
  23. cd $SVN_DIR
  24.  
  25. ## Create dumps
  26. mkdir $SVN_DIR/dumps
  27. svnadmin dump $SVN_OLD_REPO > dumps/$SVN_OLD_REPO.dump
  28.  
  29. ## Filter the specific project_name out of the dump
  30. svndumpfilter include $SVN_PROJ \
  31. --drop-empty-revs \
  32. --preserve-revprops \
  33. --renumber-revs \
  34. < dumps/$SVN_OLD_REPO.dump \
  35. > dumps/$SVN_PROJ.dump
  36.  
  37. ## Create the new repository...
  38. ## NOTE: You may need to do this step in the cpanel!!
  39. ## Here is how to do it on the comand line:
  40. # svnadmin create $SVN_DIR/$SVN_REPO
  41.  
  42.  
  43. ## Load the new repository with the contents of the
  44. ## filtered dump file.
  45. svnadmin load $SVN_REPO < dumps/$SVN_PROJ.dump
  46.  
  47.  
  48. ## Move the contens of the project_name to the repo root.
  49. svn mv $LOCAL/$SVN_DIR/$SVN_REPO/$SVN_PROJ/branches \
  50. $LOCAL/$SVN_DIR/$SVN_REPO/$SVN_PROJ/tags \
  51. $LOCAL/$SVN_DIR/$SVN_REPO/$SVN_PROJ/trunk \
  52. $LOCAL/$SVN_DIR/$SVN_REPO/ \
  53. -m "moved $SVN_PROJ contents to root"
  54.  
  55. ## Delete the old (empty) project directory.
  56. ## Note: you need to make sure the directory
  57. ## is really empty before deleting!
  58. svn del $SVN_DIR/$SVN_REPO/$SVN_PROJ -m "removed old project directory"

URL: http://snipt.net/jrguitar21/divide-and-conquer-svn-repo/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.