chiark / gitweb /
found
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 29 Apr 2014 19:39:03 +0000 (20:39 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 29 Apr 2014 19:39:03 +0000 (20:39 +0100)
convert [new file with mode: 0755]
convert~ [new file with mode: 0755]
old-msg-filter-stuff [new file with mode: 0644]
old-tree-filter [new file with mode: 0644]

diff --git a/convert b/convert
new file mode 100755 (executable)
index 0000000..2bcace4
--- /dev/null
+++ b/convert
@@ -0,0 +1,117 @@
+#!/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 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
+       ensurenotag branchpoint-$desc
+}
+
+graftmergein logcallbackfn 741a795cdaa539b48f83afbc0ac8e471543b9bf6
+graftmergein 1999-05-09-gplvslgpl e7cf3a99e5829bf53a9f36e08769787a78261045
+
+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=cvs-to-git-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."
+
+git branch -d origin
+git tag cvs-to-git-conversion
+
+cat >$tmp/msg-filter <<'FEND'
+perl -ne '
+               $out .= $_;
+       END {
+               if ($out =~ m/^\@\@/s &&
+                   $out =~ m/^(?:\+ )?[^\@ ].*\w.*$/m) {
+                       print $&, "\n\n" or die $!;
+               }
+               print $out or die $!;
+       }
+'
+FEND
+chmod +x $tmp/msg-filter
+
+git-filter-branch --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 -u $tmp/adjust 'refs/*:refs/*'
+git checkout master
diff --git a/convert~ b/convert~
new file mode 100755 (executable)
index 0000000..7171ac7
--- /dev/null
+++ b/convert~
@@ -0,0 +1,135 @@
+#!/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
diff --git a/old-msg-filter-stuff b/old-msg-filter-stuff
new file mode 100644 (file)
index 0000000..ab6381c
--- /dev/null
@@ -0,0 +1 @@
+# (?!-)(?!\+\s+\w)
diff --git a/old-tree-filter b/old-tree-filter
new file mode 100644 (file)
index 0000000..d503dfd
--- /dev/null
@@ -0,0 +1,23 @@
+cat >$tmp/tree-filter <<'FEND'
+       set -e
+       if test -f GPL-vs-LGPL.dont; 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 adopt this version.  The licence exceptions in this file
+therefore DO NOT APPLY to any version of adns (unless the contrary is
+clearly stated at some point in the future by me).
+
+I.e. this file is just a draft.  That includes all the versions you
+may find in version control systems (eg CVS or git), and particularly
+those in work-in-progress or abandoned branches, or old revisions.
+
+  - Ian Jackson, 29th April 2014.
+
+END
+               mv -f GPL-vs-LGPL.new GPL-vs-LGPL
+       fi
+       set +e
+FEND
+chmod +x $tmp/tree-filter
+
+ --tree-filter $tmp/tree-filter