Skip to content

Instantly share code, notes, and snippets.

@arjan
Created February 15, 2011 19:21
Show Gist options
  • Save arjan/828055 to your computer and use it in GitHub Desktop.
Save arjan/828055 to your computer and use it in GitHub Desktop.
convert zotonic repo to separate hg module
#!/bin/bash
GOOGLE_USERNAME="username"
GOOGLE_PASSWORD="xxx"
# note git-z is zotonic checkout in git
if [ "$1" = "" ]; then
echo "$0 <module>"
exit 1
fi
MODULE=$1
if [ ! -e "git-z/modules/$MODULE" ]; then
echo "Module $MODULE does not exist"
exit 1
fi
cp -r git-z git-$MODULE
cd git-$MODULE
git reset --hard
git filter-branch --prune-empty --subdirectory-filter modules/$MODULE -- --all
for tag in `git tag`; do
git tag -d $tag
done
for branch in "release-0.3.x release-0.4.x release-0.5.x release-0.6.x"; do
git branch -D $branch
done
rm -rf .git/refs/original
for remote in origin hg AlainODea xyn; do
echo $remote
git remote rm $remote
done
cd ..
hg convert -d hg git-$MODULE $MODULE
rm -rf git-$MODULE
cd $MODULE
hg update
MODULEDASHED=`echo $MODULE|sed 's/_/-/g'`
DEST="https://$GOOGLE_USERNAME:$GOOGLE_PASSWORD@$MODULEDASHED.zotonic-modules.googlecode.com/hg/"
echo "[paths]" >> .hg/hgrc
echo "default = $DEST" >> .hg/hgrc
echo "default-push = $DEST" >> .hg/hgrc
hg push
echo "Done. Module left in $MODULE."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment