Shin'ya M. > Updating rcs with 3 items... done
This commit is contained in:
11
README.md
11
README.md
@@ -5,5 +5,12 @@ Those require a rather old version of [reposurgeon](http://catb.org/~esr/reposur
|
|||||||
on some systems (such as [NetBSD](https://www.netbsd.org)).
|
on some systems (such as [NetBSD](https://www.netbsd.org)).
|
||||||
|
|
||||||
## Scripts
|
## Scripts
|
||||||
* [Git to Subversion](git2svn) (in [Perl](https://www.perl.org))
|
|
||||||
* [Subversion to Git](svn2git)
|
### From `git`
|
||||||
|
* [git2fossil](git2fossil)
|
||||||
|
* [git2hg](git2hg)
|
||||||
|
* [git2svn](git2svn)
|
||||||
|
|
||||||
|
### From `svn`
|
||||||
|
* [svn2fossil](svn2fossil)
|
||||||
|
* [svn2git](svn2git)
|
||||||
|
|||||||
17
git2fossil
Normal file
17
git2fossil
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Convert a git repository to fossil
|
||||||
|
|
||||||
|
for i in fossil git; do
|
||||||
|
if ! command -v $i >/dev/null; then
|
||||||
|
echo "$i: command not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
printf "usage: %s repo-name\n" "$0"
|
||||||
|
printf "requires an already cloned repository\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
(cd ${1}; git fast-export --all) | fossil import --git ${1}.fossil
|
||||||
59
git2hg
Normal file
59
git2hg
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Convert git repositories to Mercurial
|
||||||
|
# Extensions required: hg-fastimport
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
hg_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 hg" \
|
||||||
|
"rebuild ${repo_name}-hg"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
printf "usage: %s [export dir file] [mirror url repo_name] [migrate repo_name]\n" "$0"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
export)
|
||||||
|
git_export $2 $3
|
||||||
|
;;
|
||||||
|
mirror)
|
||||||
|
git_mirror $2 $3
|
||||||
|
;;
|
||||||
|
migrate)
|
||||||
|
prepare $2
|
||||||
|
hg_import $2
|
||||||
|
clean $2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
print_usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
13
svn2fossil
Normal file
13
svn2fossil
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# svn2fossil
|
||||||
|
# Convert a svn repository to fossil
|
||||||
|
# Requires direct access to the host
|
||||||
|
for i in fossil svnadmin; do
|
||||||
|
if ! command -v $i >/dev/null; then
|
||||||
|
echo "$i: command not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
svnadmin dump $1 | fossil import --svn $1.fossil
|
||||||
|
|
||||||
Reference in New Issue
Block a user