darcs2git.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/sh
  2. [ -d _darcs -a -d .git ] || exit 1
  3. TMPDIR=/tmp/darcs2git
  4. [ -d $TMPDIR -a -w $TMPDIR ] || mkdir -p $TMPDIR
  5. DARCS2GIT_XSLT=`dirname $0`/darcs2git.xslt
  6. [ -r $DARCS2GIT_XSLT ] || exit 1
  7. darcs fetch --all --summary --quiet > /dev/null &&
  8. darcs pull --all --quiet --dry-run --xml-output > $TMPDIR/patches.xml
  9. if head -n 1 $TMPDIR/patches.xml | grep "No remote changes to pull in!"
  10. then
  11. echo "No remote changes to pull in!" >&2
  12. exit 0
  13. fi
  14. xsltproc --nonet --novalid --stringparam TMPDIR "$TMPDIR/" $DARCS2GIT_XSLT $TMPDIR/patches.xml > $TMPDIR/doit.sh
  15. sh -x $TMPDIR/doit.sh
  16. exit $?
  17. # Für jeden patch (identifiziert durch seinen hash):
  18. # 1. darcs fetch
  19. # 2. darcs pull --dry-run --xml-output > patches.xml
  20. # 3. xsltproc --nonet --novalid darcs2git.xslt patches.xml > doit.sh
  21. #
  22. # 2. darcs pull - -matches="hash $HASH" --post-hook="$DARCS_FILES und $DARCS_PATCHES_XML wegschreiben"
  23. # 3. git add $DARCS_FILES
  24. # 4. git commit -F "$name\n\n$comment" --author=$author --date=$date $DARCS_FILES
  25. ##### Praeliminiarien: s. darcs2git.init.sh #####
  26. #
  27. ### wikidata ###
  28. # mkdir wikidata
  29. # cd wikidata
  30. ### darcs ###
  31. # darcs initialize
  32. # echo "https://mesh-j-1.free.de/~freifunk/wiki/wikidata" > _darcs/prefs/defaultrepo
  33. # patch _darcs/prefs/boring
  34. 9a10,12
  35. > # wg. git
  36. > \.git$
  37. >
  38. ^D
  39. Hmm... Looks like a normal diff to me...
  40. Patching file _darcs/prefs/boring using Plan A...
  41. Hunk #1 succeeded at 10.
  42. done
  43. ### git ###
  44. # git config --global user.name "FF-DO-Wiki `hostname`"
  45. # git config --global user.email "$USER@`hostname`"
  46. # git init
  47. # echo "_darcs" > .gitignore
  48. # git add .gitignore
  49. # git commit -m "ignore _darcs" .gitignore