Return to Snippet

Revision: 24676
at March 8, 2010 10:27 by zachharkey


Initial Code
# The following structure exists:
#
#  originalrepository/
#    project_name/
#      trunk/
#      branches/
#      tags/
#
# I want to move it to its *own* repository and give the following structure:
#
#  newrepositoryname/
#    trunk/
#    branches/
#    tags/
#

export LOCAL='file:/'
export SVN_DIR='/home/bluespark/svn'
export SVN_OLD_REPO='originalrepository'
export SVN_PROJ='project_name'
export SVN_REPO='newrepositoryname'

cd $SVN_DIR

## Create dumps
mkdir $SVN_DIR/dumps
svnadmin dump $SVN_OLD_REPO > dumps/$SVN_OLD_REPO.dump

## Filter the specific project_name out of the dump
svndumpfilter include $SVN_PROJ \
     --drop-empty-revs \
     --preserve-revprops \
     --renumber-revs \
     < dumps/$SVN_OLD_REPO.dump \
     > dumps/$SVN_PROJ.dump

## Create the new repository...
## NOTE: You may need to do this step in the cpanel!!
## Here is how to do it on the comand line:
# svnadmin create $SVN_DIR/$SVN_REPO


## Load the new repository with the contents of the
## filtered dump file.
svnadmin load $SVN_REPO < dumps/$SVN_PROJ.dump


## Move the contens of the project_name to the repo root.
svn mv $LOCAL/$SVN_DIR/$SVN_REPO/$SVN_PROJ/branches \
       $LOCAL/$SVN_DIR/$SVN_REPO/$SVN_PROJ/tags \
       $LOCAL/$SVN_DIR/$SVN_REPO/$SVN_PROJ/trunk \
       $LOCAL/$SVN_DIR/$SVN_REPO/ \
       -m "moved $SVN_PROJ contents to root"

## Delete the old (empty) project directory.
## Note:  you need to make sure the directory 
##        is really empty before deleting!
svn del $SVN_DIR/$SVN_REPO/$SVN_PROJ -m "removed old project directory"

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

Initial Description

                                

Initial Title
Divide and conquer svn repo

Initial Tags

                                

Initial Language
XHTML