Created
April 2, 2010 16:03
-
-
Save namelessjon/353308 to your computer and use it in GitHub Desktop.
script to merge two dispirate bits of history for dm adapters
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/bash -e | |
repo_combine () { | |
ADAPTER=$1 | |
if [ ! -d dm-more ]; then | |
echo "Cloning solnic's adapter" | |
git clone git://github.com/solnic/dm-more.git | |
cd dm-more | |
git fetch | |
git checkout -b adapters_import origin/adapters_import | |
cd .. | |
fi | |
echo "Spliting '$ADAPTER' from 'dm-more'" | |
DIR=dm-$ADAPTER-adapter | |
git clone --no-hardlinks dm-more $DIR | |
cd $DIR | |
git filter-branch --prune-empty --subdirectory-filter adapters/$DIR -- --all | |
git reset --hard | |
git gc --aggressive | |
git prune | |
echo "Done with the split! Now for the fun part!" | |
cd .. | |
echo "cloning DM's repo" | |
git clone git@github.com:datamapper/$DIR.git $DIR-core | |
echo "Magic!" | |
cd $DIR-core | |
mkdir -p lib/${ADAPTER}_adapter | |
git mv ${ADAPTER}_adapter.rb lib/${ADAPTER}_adapter/adapter.rb | |
git commit -m "Moving adapter file to the right subdirectory" | |
echo "Merge solnic's commits into ours" | |
git remote add solnic ../$DIR | |
git fetch solnic | |
git merge -s recursive -X theirs solnic/adapters_import --no-commit | |
echo "Now have a look at the tree in $DIR-core" | |
echo "If it looks good, commit the merge!" | |
cd - | |
} | |
for repo in "$@"; | |
do | |
repo_combine $repo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment