Skip to content

Instantly share code, notes, and snippets.

@tifletcher
Last active December 16, 2015 07:38
Show Gist options
  • Save tifletcher/5399728 to your computer and use it in GitHub Desktop.
Save tifletcher/5399728 to your computer and use it in GitHub Desktop.
Quick Export: (local) fossil -> (remote) git

fossil2bitbucket.sh

###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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment