- #!/bin/ksh93
- #
- # merge Rauchs Subversion tree into our git,
- # one patch at the time
- #
- set -o xtrace
- set -o errexit
- set -o pipefail
- which bunzip2 || exit 1
- which git || exit 1
- which realpath || exit 1
- which svn || exit 1
- which svnadmin || exit 1
- which svnrdump || exit 1
- builtin chmod || exit 1
- builtin mkdir || exit 1
- builtin printf || exit 1
- #builtin rm || exit 1 # broken Debian ksh93 package config, grrr...
- builtin wc || exit 1
- # clean data from previous run
- rm -Rf gitsvnclone1 svnstore
- # squish locale settings, we need the POSIX defaults
- if [[ "${!LC_*}" != '' ]] ; then
- unset "${!LC_@}"
- fi
- unset LANG
- export LANG='POSIX'
- typeset -r infile='rauch_svndump20200128.svndump.bz2'
- compound svninfo
- [[ ! -f "${infile}" ]] && exit 1
- [[ ! -r "${infile}" ]] && exit 1
- # create empty SVN repository
- svnadmin create svnstore
- # add dummy hook to allow property changes for "svnrdump load"
- printf '#!/bin/sh\nexit 0\n' >'svnstore/hooks/pre-revprop-change'
- chmod a+x 'svnstore/hooks/pre-revprop-change'
- bunzip2 -c <"${infile}" | svnrdump load "file://$PWD/svnstore/"
- # get HEAD revision (number) from svn repository
- integer svninfo.revision
- svninfo.cmdout="$(svn info "file://$PWD/svnstore")"
- dummy="${svninfo.cmdout/~(E)Revision:[[:space:]]+([[:digit:]]+)/ }"
- (( svninfo.revision=.sh.match[1] ))
- printf '# Subversion info:\n'
- print -v svninfo
- mkdir 'gitsvnclone1'
- cd 'gitsvnclone1'
- git svn clone "file://$(realpath "$PWD/../svnstore")"
- ls -lad 'svnstore/trunk/projekt/ptxdist/'
- cd 'svnstore/trunk/projekt/ptxdist/'
- git format-patch -$((svninfo.revision+1))
- # remove patch files which are empty
- (for i in *.patch ; do if [[ ! -s "$i" ]] ; then rm -- "$i" ; fi ; done)
- # list remaining patches
- patchlist="$(ls -1 -- *.patch)"
- printf '## Patches:\n%s\n# Number of patches: %d\n' "${patchlist}" "$(wc -l <<<"$patchlist")"
- printf '# DONE!\n'
- # EOF.
SVNrauch2EAGgit patch history migration script, V0.0.1
Posted by Anonymous on Fri 7th Feb 2020 11:42
raw | new post
view followups (newest first): SVNrauch2EAGgit patch history migration script, V0.0.1 by Anonymous
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.