From 1fb08704da2f0d03eed5c3de3357f06d4d9629d8 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 29 Apr 2014 20:39:03 +0100 Subject: [PATCH 1/1] found --- convert | 117 +++++++++++++++++++++++++++++++++++++ convert~ | 135 +++++++++++++++++++++++++++++++++++++++++++ old-msg-filter-stuff | 1 + old-tree-filter | 23 ++++++++ 4 files changed, 276 insertions(+) create mode 100755 convert create mode 100755 convert~ create mode 100644 old-msg-filter-stuff create mode 100644 old-tree-filter diff --git a/convert b/convert new file mode 100755 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 <>.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 <$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 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 <>.git/info/grafts +$2 $oldparents $branchtip +END + git branch -D $branchname + ensurenotag mergepoint-$desc +} + +graftmergein logcallbackfn 741a795cdaa539b48f83afbc0ac8e471543b9bf6 + +xargs git tag -d <$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 index 0000000..ab6381c --- /dev/null +++ b/old-msg-filter-stuff @@ -0,0 +1 @@ +# (?!-)(?!\+\s+\w) diff --git a/old-tree-filter b/old-tree-filter new file mode 100644 index 0000000..d503dfd --- /dev/null +++ b/old-tree-filter @@ -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 -- 2.30.2