-#!/bin/sh
-set -ex
-base=$HOME/things/Adns/Cvs-Convert
-cd $base
-tmp=$base/tmp
-
-rm -rf converted
-
-if ! test -d $tmp/git-cvsi; then
- rm -rf tmp
- mkdir tmp
- git cvsimport -d `pwd`/cvs-repo -C tmp/git-cvsi.new -k -p --norc adns
- mv tmp/git-cvsi.new tmp/git-cvsi
-fi
-cd tmp
-
-rsync -aH --delete git-cvsi/. adjust
-cd adjust
-
-abandonbranch () {
- local oldbranchname=$1
- local newtagname=$2
- git tag $newtagname $oldbranchname
- git branch -D $oldbranchname
-}
-ensurenotag () {
- local tagname=$1
- # these two together unconditionally delete the tag if it exists
- git tag -f $tagname master
- git tag -d $tagname
-}
-abandondatedbranch () {
- local date=$1
- local olddesc=$2
- local newdesc=$3
- if [ "x$newdesc" = x ]; then newdesc=$olddesc; fi
- abandonbranch branch-$date-$olddesc abandon.$date.$newdesc
- ensurenotag branchpoint-$date-$olddesc master
-}
-
-abandonbranch branch-rrtypenoenum abandon.1998-10-04.rrtypenoenum
-abandondatedbranch 1999-04-10 mthread multithread
-abandondatedbranch 1999-04-11 ipv6
-abandondatedbranch 1999-04-11 pollfds
-
-abandondatedbranch 1999-05-09 gplvslgpl
-
-abandondatedbranch 2000-05-07 ipv6
-abandonbranch branch-0-7-inftodebug abandon.2000-03-26.infotodebug-0.7
-
-graftmergein () {
- local desc=$1
- local mergecommit=$2
- local branchname=branch-$desc
- mkdir -p .git/info
- local branchtip=`git rev-parse $branchname~0`
- local oldparents=`git-log -n1 --pretty=format:%P $mergecommit`
- cat <<END >>.git/info/grafts
-$2 $oldparents $branchtip
-END
- git branch -D $branchname
- ensurenotag mergepoint-$desc
-}
-
-graftmergein logcallbackfn 741a795cdaa539b48f83afbc0ac8e471543b9bf6
-
-xargs git tag -d <<END
-tochiark-1998-11-08
-fromchiark-1998-11-09
-tochiark-1998-11-09-b
-fromchiark-1998-11-14
-tochiark-1998-11-15
-tochiark-1998-11-17
-fromchiark-1998-11-28
-END
-
-git checkout master
-scr=git-to-cvs-conversion-script
-cp $base/convert $scr
-git add $scr
-git commit -m "$scr: record the script
-
-Record the script we used to convert the CVS repo to git"
-git rm $scr
-git commit -m "$scr: delete the script
-
-We have in fact done the conversion and don't need the script any more."
-
-cat >$tmp/msg-filter <<'FEND'
-perl -ne '
- $out .= $_;
- END {
- if ($out =~ m/^\@\@/s &&
- $out =~ m/^(?!-)(?:\+ )?[^\@ ].*$/m) {
- print $&, "\n\n" or die $!;
- }
- print $out or die $!;
- }
-'
-FEND
-chmod +x $tmp/msg-filter
-
-cat >$tmp/tree-filter <<'FEND'
- set -e
- if test -f GPL-vs-LGPL; then
- cat <<'END' GPL-vs-LGPL >GPL-vs-LGPL.new
-NB that NO VERSIONS of this file have been released, and I do not
-intend to publish this version. If you get this file from a
-work-in-progress or abandoned branch, old old version, in a version
-control system (eg CVS or git) I definitely do not intend the licence
-exceptions in it to apply - these were all drafts, as you should know
-if you know what retrieving work in progress, old or abandoned
-versions or branches means !
-
- - Ian Jackson, 29th April 2014.
-
-END
- mv -f GPL-vs-LGPL.new GPL-vs-LGPL
- fi
- set +e
-FEND
-chmod +x $tmp/tree-filter
-
-git-filter-branch --tree-filter $tmp/tree-filter --msg-filter $tmp/msg-filter \
- `git-show-ref | awk '{print $2}'`
-
-git-show-ref | awk '{print $2}' | grep '^refs/original/' \
- | xargs -n1 git-update-ref -d
-
-rm -rf $tmp/converted
-mkdir $tmp/converted
-cd $tmp/converted
-git init
-git fetch $tmp/adjust 'refs/*:refs/*'
-git checkout master