{"id":61,"date":"2010-12-22T01:51:25","date_gmt":"2010-12-21T22:51:25","guid":{"rendered":"http:\/\/meekconsulting.com\/?p=61"},"modified":"2010-12-22T01:51:25","modified_gmt":"2010-12-21T22:51:25","slug":"moving-svn-repositories","status":"publish","type":"post","link":"https:\/\/meekconsulting.com\/?p=61","title":{"rendered":"Moving SVN repositories"},"content":{"rendered":"<p>To move a subversion repository just dump the repository.<br \/>\nHere is a little script to dump all \/var\/svn repositories to their own portable  dump.gz file:<\/p>\n<blockquote><p>#!\/usr\/bin\/perl<\/p>\n<p>## backup each repository in \/var\/svn to a file dirname.svn.dmp.gz<br \/>\n## and push to repository<\/p>\n<p>$single = shift;<\/p>\n<p>$DIR = \u201c\/var\/svn\u201d;<br \/>\nopendir(DH,\u201d\/var\/svn\u201d);<\/p>\n<p>while ( $repo = readdir(DH) ) {<br \/>\n        next if $repo =~ \/\\.\/g;<br \/>\n        next unless $repo =~ \/$single\/;<br \/>\n        $cmd = \u201csvnadmin dump $DIR\/$repo | gzip -c > \/repository\/tcg_backup\/$repo.dmp.gz\u201d;<br \/>\n        print \u201c\\n$cmd\u201d;<\/p>\n<p>        system($cmd);<\/p>\n<p>}\n<\/p><\/blockquote>\n<p><strong>Create new repository on new site<\/strong><\/p>\n<blockquote><p>$DIR=\u201d\/var\/svn\u201d;<br \/>\n$TMP=\u201d\/tmp\u201d;<\/p>\n<p>chdir($DIR);<\/p>\n<p>$single = shift;<\/p>\n<p>foreach $repo (@repos) {<\/p>\n<p>        next unless $repo =~ \/$single\/;<\/p>\n<p>        print \u201c\\npulling $repo\u201d;<br \/>\n        $repo =~ \/^(.*)\\.dmp\\.gz\/;<br \/>\n        $name = $1;<\/p>\n<p>        # remove old dump file<br \/>\n        unlink(\u201c$TMP\/$repo\u201d);<\/p>\n<p>        # remove any old repository directory<br \/>\n        $cmd = \u201crm -rf \/var\/svn\/$name\u201d;<br \/>\n        print \u201c\\n$cmd\u201d;<br \/>\n        system($cmd);<\/p>\n<p>        $cmd = \u201ccd $TMP; wget \u2013no-check-certificate https:\/\/10.5.20.103\/repository_pull\/tcg_backup\/$repo\u201d;<br \/>\n        print \u201c\\n$cmd\u201d;<br \/>\n        system($cmd);<\/p>\n<p>        die \u201cCould not get file from repository\u201d unless -s \u201c$TMP\/$repo\u201d;<\/p>\n<p>        $cmd = \u201ccd \/var\/svn; svnadmin create $name\u201d;<br \/>\n        print \u201c\\n$cmd\u201d;<br \/>\n        system($cmd);<\/p>\n<p>        $cmd = \u201ccd \/var\/svn; gunzip < $TMP\/$repo | svnadmin load $name\";\n        print \"\\n$cmd\";\n        system($cmd);\n\n}\n\n$cmd = \"chown -R apache:apache \/var\/svn\";\nprint \"\\n$cmd\";\nsystem($cmd);\n<\/p><\/blockquote>\n<p>SWITCH your existing working copies to point to the new machine with this nifty little svn switch command:<\/p>\n<blockquote><p>\nsvn switch \u2013relocate https:\/\/10.5.20.103\/svn\/cobra\/trunk https:\/\/svn_repo.colum<br \/>\nbiagroup.com\/svn\/cobra\/trunk\n<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>To move a subversion repository just dump the repository. Here is a little script to dump all \/var\/svn repositories to their own portable dump.gz file: #!\/usr\/bin\/perl ## backup each repository in \/var\/svn to a file dirname.svn.dmp.gz ## and push to &hellip; <a href=\"https:\/\/meekconsulting.com\/?p=61\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/61"}],"collection":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=61"}],"version-history":[{"count":1,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/61\/revisions"}],"predecessor-version":[{"id":62,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/61\/revisions\/62"}],"wp:attachment":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}