pastebin - collaborative debugging tool
eckelmann.kpaste.net RSS


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

  1. #!/bin/ksh93
  2.  
  3. #
  4. # merge Rauchs Subversion tree into our git,
  5. # one patch at the time
  6. #
  7.  
  8. set -o xtrace
  9. set -o errexit
  10. set -o pipefail
  11.  
  12. which bunzip2   || exit 1
  13. which git       || exit 1
  14. which realpath  || exit 1
  15. which svn       || exit 1
  16. which svnadmin  || exit 1
  17. which svnrdump  || exit 1
  18.  
  19.  
  20. builtin chmod   || exit 1
  21. builtin mkdir   || exit 1
  22. builtin printf  || exit 1
  23. #builtin rm     || exit 1 # broken Debian ksh93 package config, grrr...
  24. builtin wc      || exit 1
  25.  
  26.  
  27. # clean data from previous run
  28. rm -Rf gitsvnclone1 svnstore
  29.  
  30.  
  31. # squish locale settings, we need the POSIX defaults
  32. if [[ "${!LC_*}" != '' ]] ; then
  33.         unset "${!LC_@}"
  34. fi
  35. unset LANG
  36. export LANG='POSIX'
  37.  
  38. typeset -r infile='rauch_svndump20200128.svndump.bz2'
  39.  
  40. compound svninfo
  41.  
  42. [[ ! -f "${infile}" ]] && exit 1
  43. [[ ! -r "${infile}" ]] && exit 1
  44.  
  45. # create empty SVN repository
  46. svnadmin create svnstore
  47. # add dummy hook to allow property changes for "svnrdump load"
  48. printf '#!/bin/sh\nexit 0\n' >'svnstore/hooks/pre-revprop-change'
  49. chmod a+x 'svnstore/hooks/pre-revprop-change'
  50.  
  51. bunzip2 -c <"${infile}" | svnrdump load "file://$PWD/svnstore/"
  52.  
  53. # get HEAD revision (number) from svn repository
  54. integer svninfo.revision
  55. svninfo.cmdout="$(svn info "file://$PWD/svnstore")"
  56. dummy="${svninfo.cmdout/~(E)Revision:[[:space:]]+([[:digit:]]+)/ }"
  57. (( svninfo.revision=.sh.match[1] ))
  58.  
  59. printf '# Subversion info:\n'
  60. print -v svninfo
  61.  
  62. mkdir 'gitsvnclone1'
  63. cd 'gitsvnclone1'
  64. git svn clone "file://$(realpath "$PWD/../svnstore")"
  65.  
  66. ls -lad 'svnstore/trunk/projekt/ptxdist/'
  67.  
  68.  
  69. cd 'svnstore/trunk/projekt/ptxdist/'
  70. git format-patch -$((svninfo.revision+1))
  71.  
  72. # remove patch files which are empty
  73. (for i in *.patch ; do if [[ ! -s "$i" ]] ; then rm -- "$i" ; fi ; done)
  74.  
  75. # list remaining patches
  76. patchlist="$(ls -1 -- *.patch)"
  77. printf '## Patches:\n%s\n# Number of patches: %d\n' "${patchlist}" "$(wc -l <<<"$patchlist")"
  78.  
  79. printf '# DONE!\n'
  80. # EOF.

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at