Skip to content

Instantly share code, notes, and snippets.

@ferrouswheel
Created November 8, 2015 06:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferrouswheel/56c0b693b3731af0e2a2 to your computer and use it in GitHub Desktop.
Save ferrouswheel/56c0b693b3731af0e2a2 to your computer and use it in GitHub Desktop.
Move a launchpad repository 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
@ferrouswheel
Copy link
Author

This was used for moving @opencog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment