Created
August 21, 2011 18:41
-
-
Save tedkulp/1160974 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
function initialize { | |
#git svn init http://svn.cmsmadesimple.org/svn/cmsmadesimple --stdlayout allcms | |
git svn init file:///Users/tedkulp/tmp/cms-svn --stdlayout allcms | |
git svn init http://svn.cmsmadesimple.org/svn/newsmodule --stdlayout News | |
git svn init http://svn.cmsmadesimple.org/svn/search --stdlayout Search | |
git svn init http://svn.cmsmadesimple.org/svn/filemanager --stdlayout FileManager | |
git svn init http://svn.cmsmadesimple.org/svn/menumanager --stdlayout MenuManager | |
git svn init http://svn.cmsmadesimple.org/svn/microtiny MicroTiny | |
git svn init http://svn.cmsmadesimple.org/svn/thememanager ThemeManager | |
git svn init http://svn.cmsmadesimple.org/svn/cmsprinting CMSPrinting | |
# Seed the big cmsms repo | |
cd ~/tmp/allcms | |
git svn fetch --no-follow-parent --authors-file=/Users/tedkulp/tmp/authors.txt --revision 3422:7300 | |
# Remove a duplicated tag name (effs up svn2git later) | |
git branch -d -r tags/1.2beta2 | |
} | |
function reset_tags { | |
for i in `git tag -l` | |
do | |
git tag -d $i | |
done | |
} | |
function reset_branches { | |
for i in `(git branch | grep -v "master" | grep -v "*")` | |
do | |
git branch -D $i | |
done | |
} | |
function update_module { | |
git reset --hard | |
git checkout master | |
git svn fetch --no-follow-parent --authors-file=/Users/tedkulp/tmp/authors.txt | |
reset_tags | |
reset_branches | |
svn2git --noclone | |
} | |
function reset_module_branches { | |
git checkout remotes/$1 -f | |
git branch -D master | |
git branch -D $1 | |
git checkout -b $1 remotes/$1 | |
} | |
function subtree_merge { | |
cd ~/tmp/allcms | |
git remote add -f $1 ~/tmp/$1 | |
git merge -s ours --no-commit $1/$2 | |
git read-tree --prefix=modules/$1 -u $1/$2 | |
git commit -m "Merge $1 module as subtree" | |
git pull -s subtree $1 $2 | |
git remote rm $1 | |
} | |
# Initialize | |
# Comment the next line out if this is an update | |
#initialize | |
# Update the synced svn clone | |
cd ~/tmp/cms-svn | |
svnsync sync file:///Users/tedkulp/tmp/cms-svn | |
# Update any new commits | |
cd ~/tmp/allcms | |
git reset --hard | |
git checkout master | |
git svn fetch --no-follow-parent --authors-file=/Users/tedkulp/tmp/authors.txt --revision 7345:HEAD | |
# Remove all the branches except for master | |
reset_branches | |
# Remove all tags | |
reset_tags | |
# Create the tags | |
svn2git --noclone --strip-tag-prefix=version- -v | |
# Reset everything and get 1.10.x to mater | |
git checkout remotes/1.10.x -f | |
git branch -D master | |
git checkout -b old-trunk remotes/trunk | |
git checkout -b master remotes/1.10.x | |
git clean -f | |
# News | |
cd ~/tmp/News | |
update_module | |
git checkout 1.10.x | |
git clean -f | |
reset_module_branches 1.10.x | |
subtree_merge News 1.10.x | |
# Search | |
cd ~/tmp/Search | |
update_module | |
git checkout master | |
git clean -f | |
reset_module_branches 1.10.x | |
subtree_merge Search 1.10.x | |
# CMSPrinting | |
cd ~/tmp/CMSPrinting | |
update_module | |
git checkout git-svn | |
git clean -f | |
reset_module_branches git-svn | |
subtree_merge CMSPrinting git-svn | |
# FileManager | |
cd ~/tmp/FileManager | |
update_module | |
git checkout 1.x | |
git clean -f | |
reset_module_branches 1.x | |
subtree_merge FileManager 1.x | |
# MenuManager | |
cd ~/tmp/MenuManager | |
update_module | |
git checkout 1.10.x | |
git clean -f | |
reset_module_branches 1.10.x | |
subtree_merge MenuManager 1.10.x | |
# MicroTiny | |
cd ~/tmp/MicroTiny | |
update_module | |
git checkout git-svn | |
git clean -f | |
reset_module_branches git-svn | |
subtree_merge MicroTiny git-svn | |
# ThemeManager | |
cd ~/tmp/ThemeManager | |
update_module | |
git checkout git-svn | |
git clean -f | |
reset_module_branches git-svn | |
subtree_merge ThemeManager git-svn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment