Skip to content

Instantly share code, notes, and snippets.

@ferrouswheel
Created October 16, 2012 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferrouswheel/3902246 to your computer and use it in GitHub Desktop.
Save ferrouswheel/3902246 to your computer and use it in GitHub Desktop.
Script to move Opencog from Launchpad to Github
#!/bin/bash
# Destination must exist as empty repo on github
GIT_REPO="git@github.com:opencog/opencog.git"
TEMP_PATH=~/src/opencog_bzr_to_git
echo "Using $TEMP_PATH as working dir"
BRANCHES=(trunk UnityEmbodiment)
mkdir -p ${TEMP_PATH}
cd ${TEMP_PATH}
for branch in $BRANCHES; do
echo bzr branch lp:~opencog-dev/opencog/${branch}
#bzr branch lp:~opencog-dev/opencog/${branch}
done
# We presume that the branches are not called opencog, and make that the name
# of the git repo
mkdir -p opencog
cd opencog
git init
git remote add origin ${GIT_REPO}
# We assume the first branch listed is the "master" branch for git
echo "Migrating trunk -> master"
bzr fast-export --export-marks=marks.bzr --plain ../trunk | \
git fast-import --export-marks=marks.git
git push -u origin master
# The rest have their commit history based off of that.
for branch in "${BRANCHES[@]:1}"; do
echo "Migrating branch ${branch}"
bzr fast-export --import-marks=marks.bzr -b ${branch} --plain ../${branch} | \
git fast-import --import-marks=marks.git
git branch ${branch}
git push -u origin ${branch}
done
# Add marks to repo
git checkout master
git add marks.git
git add marks.bzr
git commit -m "Add bzr-to-git mark files to repo so other people can convert"
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment