Shin'ya M. > Initializing repository with 4 items... done
This commit is contained in:
22
COPYING
Normal file
22
COPYING
Normal file
@@ -0,0 +1,22 @@
|
||||
________ ________
|
||||
/_ __/ / / / ____/
|
||||
/ / / /_/ / __/
|
||||
/ / / __ / /___
|
||||
/_/ /_/ /_/_____/
|
||||
|
||||
____ ________________ _ _____ ____ ______
|
||||
/ __ )/ ____/ ____/ __ \ | | / / | / __ \/ ____/
|
||||
/ __ / __/ / __/ / /_/ /____| | /| / / /| | / /_/ / __/
|
||||
/ /_/ / /___/ /___/ _, _/_____/ |/ |/ / ___ |/ _, _/ /___
|
||||
/_____/_____/_____/_/ |_| |__/|__/_/ |_/_/ |_/_____/
|
||||
|
||||
__ _________________ _______ ______
|
||||
/ / / _/ ____/ ____/ | / / ___// ____/
|
||||
/ / / // / / __/ / |/ /\__ \/ __/
|
||||
/ /____/ // /___/ /___/ /| /___/ / /___
|
||||
/_____/___/\____/_____/_/ |_//____/_____/
|
||||
|
||||
Shin'ya Minazuki <shinyoukai@laidback.moe> wrote this file.
|
||||
As long as you retain this notice you can do whatever you want with this stuff.
|
||||
If we meet some day, and you think this stuff is worth it, you can buy me a bottle of sake
|
||||
in return.
|
||||
9
README.md
Normal file
9
README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# repository-conversion-scripts
|
||||
Simple executable files to migrate repositories from one version control system to another.
|
||||
|
||||
Those require a rather old version of [reposurgeon](http://catb.org/~esr/reposurgeon), as the latest one may not work
|
||||
on some systems (such as [NetBSD](https://www.netbsd.org)).
|
||||
|
||||
## Scripts
|
||||
* [Git to Subversion](git2svn) (in [Perl](https://www.perl.org))
|
||||
* [Subversion to Git](svn2git)
|
||||
58
git2svn
Normal file
58
git2svn
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/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
|
||||
|
||||
20
svn2git
Normal file
20
svn2git
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env perl
|
||||
# Convert SVN repositories to Git
|
||||
# Requirements:
|
||||
# - git
|
||||
# - reposurgeon
|
||||
# - svn
|
||||
# - direct access to the subversion server
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
require("./svn2git.conf");
|
||||
|
||||
my $subversion_repo_path;
|
||||
my $git_repo_path;
|
||||
my $repo_name;
|
||||
|
||||
print "Dumping the SVN repository: ($repo_name)\n";
|
||||
system("svnadmin dump $subversion_repo_path > $repo_name.dump") or die "Either svnadmin is not installed or there was a runtime error";
|
||||
print "Converting the repository into Git ($repo_name)\n";
|
||||
system("reposurgeon 'read <$repo_name.dump' 'prefer git' 'rebuild $git_repo_path'") or die "Either reposurgeon is not installed or there was a runtime error";
|
||||
Reference in New Issue
Block a user