Bitbucket was born as a Mercurial hosting, and now the service is being stripped of Hg by Atlassian. Atlassian warned that it will just remove the repos. It doesn't seem to care to archive them. That's why you are here.
To use the script, you will need to edit REMOTE
variable to point to your remote Mercurial repository. When your run the script, it will download hg-git
, clone and convert your repo, and drop you into the shell in newly converted git
repository, which you can immediately git push
to GitHub, GitLab or another hosting of your choice.
#!/bin/bash
set -x
REMOTE=ssh://hg@bitbucket.org/rainforce/pyrobot
NAME="$(basename $REMOTE)"
mkdir /tmp/"$NAME"
cd /tmp/"$NAME"
hg clone https://foss.heptapod.net/mercurial/hg-git
hg clone "$REMOTE"
mkdir "$NAME"-git
(cd "$NAME"-git &&
git init)
(cd "$NAME" &&
hg bookmarks hg &&
hg --config extensions.hggit=../hg-git/hggit push ../"$NAME"-git)
(cd "$NAME"-git &&
git checkout -b master hg &&
$SHELL)
Top comments (0)