Add branch name parameter

This commit is contained in:
HungryHobo
2013-01-01 15:56:53 +00:00
parent e37e41f486
commit 36a7922338

View File

@ -6,6 +6,9 @@
### Monotone doesn't handle suspend certs correctly when doing
### a git_export, so they must be killed locally before exporting.
###
### This script takes the branch name as an optional argument.
### It defaults to i2p.i2p.
###
### By duck and zzz May 2011
###
@ -14,11 +17,17 @@ cd $(dirname "$0")
MTN=mtn
MTN_VERSION=`$MTN --version | cut -d' ' -f2`
echo "Pulling latest from mtn"
if [ $# -lt 1 ]; then
BRANCH=i2p.i2p
else
BRANCH=$1
fi
echo "Pulling branch $BRANCH from mtn"
# Try up to 10 times
COUNT=0
while [ $COUNT -lt 10 ]; do
$MTN --db i2p.mtn pull 127.0.0.1:8998 i2p.i2p --key=
$MTN --db i2p.mtn pull 127.0.0.1:8998 $BRANCH --key=
if [ $? -eq 0 ]; then
break
fi
@ -30,28 +39,30 @@ if [ $COUNT -ge 10 ]; then
fi
echo
echo "Killing bad revs"
if [[ $MTN_VERSION == 1* ]]; then
# mtn 1.0 syntax
$MTN --db i2p.mtn local kill_rev 18c652e0722c4e4408b28036306e5fb600f63472
$MTN --db i2p.mtn local kill_rev 7d2f18d277a34eb2772fa9380449c7fdb4dcafcf
else
# mtn 0.48 syntax
$MTN --db i2p.mtn db kill_rev_locally 18c652e0722c4e4408b28036306e5fb600f63472
$MTN --db i2p.mtn db kill_rev_locally 7d2f18d277a34eb2772fa9380449c7fdb4dcafcf
if [ $BRANCH = "i2p.i2p" ]; then
# echo "Killing bad revs"
if [[ $MTN_VERSION == 1* ]]; then
# mtn 1.0 syntax
$MTN --db i2p.mtn local kill_rev 18c652e0722c4e4408b28036306e5fb600f63472
$MTN --db i2p.mtn local kill_rev 7d2f18d277a34eb2772fa9380449c7fdb4dcafcf
else
# mtn 0.48 syntax
$MTN --db i2p.mtn db kill_rev_locally 18c652e0722c4e4408b28036306e5fb600f63472
$MTN --db i2p.mtn db kill_rev_locally 7d2f18d277a34eb2772fa9380449c7fdb4dcafcf
fi
echo
fi
echo
if [[ $MTN_VERSION == 1* ]]; then
# mtn 1.0 syntax
HEADS=`$MTN --db i2p.mtn head --no-standard-rcfiles --ignore-suspend-certs -b i2p.i2p 2> /dev/null | wc -l`
HEADS=`$MTN --db i2p.mtn head --no-standard-rcfiles --ignore-suspend-certs -b $BRANCH 2> /dev/null | wc -l`
else
# mtn 0.48 syntax
HEADS=`$MTN --db i2p.mtn head --ignore-suspend-certs -b i2p.i2p 2> /dev/null | wc -l`
HEADS=`$MTN --db i2p.mtn head --ignore-suspend-certs -b $BRANCH 2> /dev/null | wc -l`
fi
if [ $HEADS -gt 1 ]; then
echo "Heads:"
$MTN --db i2p.mtn head --ignore-suspend-certs -b i2p.i2p
$MTN --db i2p.mtn head --ignore-suspend-certs -b $BRANCH
echo Multiple heads, aborting!
exit
fi
@ -60,13 +71,17 @@ echo "Exporting to git format"
$MTN --db i2p.mtn git_export > i2p.git_export
echo
rm -rf i2p.git
mkdir i2p.git
cd i2p.git
git init
echo "Importing into git"
git fast-import < ../i2p.git_export
echo "Pushing to github"
git checkout i2p.i2p
git push origin i2p.i2p
echo "Pushing branch $BRANCH to github"
git checkout $BRANCH
git remote add origin git@github.com:i2p/${BRANCH}.git
git push origin HEAD:master
cd ..