Skip to content

Instantly share code, notes, and snippets.

@sohmc
Created December 22, 2019 15:45
Show Gist options
  • Select an option

  • Save sohmc/cf39c48856e474694e919ab69ce98623 to your computer and use it in GitHub Desktop.

Select an option

Save sohmc/cf39c48856e474694e919ab69ce98623 to your computer and use it in GitHub Desktop.
Convert hg repositories to git.
#!/bin/bash
if [[ -z $REPO ]]; then
read -p "Please provide the hg clone URL: " REPO
fi
echo "Cloning repository ${REPO}..."
hg clone ${REPO} ./gitify
cd ./gitify
echo "Creating Bookmarks"
hg bookmark -r default master
echo "Changing default path to github"
sed -ri 's/ssh:\/\/[email protected]\/(.*)/git+ssh:\/\/[email protected]\/\1.git/' . hg/hgrc
echo "Pushing to github..."
hg push
echo "Removing directory..."
cd ..
rm -rf ./gitify
@sohmc
Copy link
Author

sohmc commented Dec 22, 2019

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