59 lines
916 B
Bash
59 lines
916 B
Bash
#!/bin/sh
|
|
|
|
clean() {
|
|
rm -rf ${1}.fi ${1}.fo ${1}.lift ${1}.map ${1}.opts
|
|
}
|
|
git_export() {
|
|
(cd ${1}-mirror ; repotool export) >${2}.git
|
|
}
|
|
|
|
git_mirror() {
|
|
repotool mirror ${1} ${2}-mirror
|
|
}
|
|
|
|
prepare() {
|
|
touch ${1}.opts
|
|
touch ${1}.map
|
|
touch ${1}.lift
|
|
}
|
|
|
|
svn_import() {
|
|
reposurgeon "script ${2}.opts" \
|
|
"read <${2}.git" \
|
|
"authors read <${2}.map" \
|
|
"sourcetype git" \
|
|
"prefer git" \
|
|
"script ${2}.lift" \
|
|
"legacy write >${2}.fo" \
|
|
"write >${2}.fi"
|
|
|
|
reposurgeon "read <${2}.fi" \
|
|
"prefer svn" \
|
|
"rebuild ${repo_name}-svn"
|
|
|
|
}
|
|
|
|
print_usage() {
|
|
printf "usage: %s [export dir file] [mirror url repo_name] [migrate repo_name]\n" "$0"
|
|
printf "this program requires reposurgeon 3.41\n"
|
|
exit 1
|
|
}
|
|
|
|
case $1 in
|
|
export)
|
|
git_export $2 $3
|
|
;;
|
|
mirror)
|
|
git_mirror $2 $3
|
|
;;
|
|
migrate)
|
|
prepare $2
|
|
svn_import $2
|
|
clean $2
|
|
;;
|
|
*)
|
|
print_usage
|
|
;;
|
|
esac
|
|
|