Created
October 9, 2013 15:49
-
-
Save matiasgarciaisaia/6903416 to your computer and use it in GitHub Desktop.
Revisions
-
matiasgarciaisaia created this gist
Oct 9, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ #!/bin/bash function abort() { echo "ERROR: $1" echo "" echo "USAGE: $0 /path/to/hg/repo /path/to/new/repo" exit 1 } [ $# -eq 2 ] || abort "Invalid parameters count" [ -d $1 ] || abort "$1 should be an existing hg repository" [ -d $1/.hg ] || abort "$1 should be an existing hg repository ($1/.hg must be a directory)" [ -d $2 ] && abort "$2 should not exist" SOURCE=$(cd "$1" && pwd) mkdir -p "$2" && cd "$2" TARGET=$(pwd) git clone git://repo.or.cz/fast-export.git "$TARGET" rm -rf .git .gitignore git init ./hg-fast-export.sh -r "$SOURCE" for branch in $(cd "$SOURCE" && hg branches --closed | grep \(closed\) | cut -f1 -d' ') do git checkout "$branch" && git tag "$branch" && git checkout master && git branch -D "$branch" done git reset . && git checkout . && git clean -f