###NOTES:
- remote path is hardcoded to MY BITBUCKET PATH!!
- create your remote before running this script
- this will export from and push the first repo it finds in cwd
#!/bin/sh | |
if [ $# != 1 ] | |
then | |
echo 'USAGE: f2bitbucket <git repo name>' | |
echo 'Be in a directory with a fossil repo, and ensure that no file or directory named "export" exists.' | |
exit 1 | |
fi | |
FOSSIL_REPO=`ls *.fossil | head -n 1` | |
GIT_REPO=$1 | |
# echo 'fossil: '$FOSSIL_REPO | |
# echo 'git: '$GIT_REPO | |
if [ -e "export" ] | |
then | |
echo 'Unable to create "export" directory. EXISTS' | |
exit 1 | |
fi | |
mkdir export | |
cd export | |
git init $GIT_REPO | |
cd $GIT_REPO | |
fossil export ../../$FOSSIL_REPO | git fast-import | |
git remote add origin ssh://git@bitbucket.org/tifletcher/$GIT_REPO.git | |
git push -u origin --all | |
cd ../.. | |
tree -ad export |