found
[adns] / convert~
CommitLineData
1fb08704
IJ
1#!/bin/sh
2set -ex
3base=$HOME/things/Adns/Cvs-Convert
4cd $base
5tmp=$base/tmp
6
7rm -rf converted
8
9if ! test -d $tmp/git-cvsi; then
10 rm -rf tmp
11 mkdir tmp
12 git cvsimport -d `pwd`/cvs-repo -C tmp/git-cvsi.new -k -p --norc adns
13 mv tmp/git-cvsi.new tmp/git-cvsi
14fi
15cd tmp
16
17rsync -aH --delete git-cvsi/. adjust
18cd adjust
19
20abandonbranch () {
21 local oldbranchname=$1
22 local newtagname=$2
23 git tag $newtagname $oldbranchname
24 git branch -D $oldbranchname
25}
26ensurenotag () {
27 local tagname=$1
28 # these two together unconditionally delete the tag if it exists
29 git tag -f $tagname master
30 git tag -d $tagname
31}
32abandondatedbranch () {
33 local date=$1
34 local olddesc=$2
35 local newdesc=$3
36 if [ "x$newdesc" = x ]; then newdesc=$olddesc; fi
37 abandonbranch branch-$date-$olddesc abandon.$date.$newdesc
38 ensurenotag branchpoint-$date-$olddesc master
39}
40
41abandonbranch branch-rrtypenoenum abandon.1998-10-04.rrtypenoenum
42abandondatedbranch 1999-04-10 mthread multithread
43abandondatedbranch 1999-04-11 ipv6
44abandondatedbranch 1999-04-11 pollfds
45
46abandondatedbranch 1999-05-09 gplvslgpl
47
48abandondatedbranch 2000-05-07 ipv6
49abandonbranch branch-0-7-inftodebug abandon.2000-03-26.infotodebug-0.7
50
51graftmergein () {
52 local desc=$1
53 local mergecommit=$2
54 local branchname=branch-$desc
55 mkdir -p .git/info
56 local branchtip=`git rev-parse $branchname~0`
57 local oldparents=`git-log -n1 --pretty=format:%P $mergecommit`
58 cat <<END >>.git/info/grafts
59$2 $oldparents $branchtip
60END
61 git branch -D $branchname
62 ensurenotag mergepoint-$desc
63}
64
65graftmergein logcallbackfn 741a795cdaa539b48f83afbc0ac8e471543b9bf6
66
67xargs git tag -d <<END
68tochiark-1998-11-08
69fromchiark-1998-11-09
70tochiark-1998-11-09-b
71fromchiark-1998-11-14
72tochiark-1998-11-15
73tochiark-1998-11-17
74fromchiark-1998-11-28
75END
76
77git checkout master
78scr=git-to-cvs-conversion-script
79cp $base/convert $scr
80git add $scr
81git commit -m "$scr: record the script
82
83Record the script we used to convert the CVS repo to git"
84git rm $scr
85git commit -m "$scr: delete the script
86
87We have in fact done the conversion and don't need the script any more."
88
89cat >$tmp/msg-filter <<'FEND'
90perl -ne '
91 $out .= $_;
92 END {
93 if ($out =~ m/^\@\@/s &&
94 $out =~ m/^(?!-)(?:\+ )?[^\@ ].*$/m) {
95 print $&, "\n\n" or die $!;
96 }
97 print $out or die $!;
98 }
99'
100FEND
101chmod +x $tmp/msg-filter
102
103cat >$tmp/tree-filter <<'FEND'
104 set -e
105 if test -f GPL-vs-LGPL; then
106 cat <<'END' GPL-vs-LGPL >GPL-vs-LGPL.new
107NB that NO VERSIONS of this file have been released, and I do not
108intend to publish this version. If you get this file from a
109work-in-progress or abandoned branch, old old version, in a version
110control system (eg CVS or git) I definitely do not intend the licence
111exceptions in it to apply - these were all drafts, as you should know
112if you know what retrieving work in progress, old or abandoned
113versions or branches means !
114
115 - Ian Jackson, 29th April 2014.
116
117END
118 mv -f GPL-vs-LGPL.new GPL-vs-LGPL
119 fi
120 set +e
121FEND
122chmod +x $tmp/tree-filter
123
124git-filter-branch --tree-filter $tmp/tree-filter --msg-filter $tmp/msg-filter \
125 `git-show-ref | awk '{print $2}'`
126
127git-show-ref | awk '{print $2}' | grep '^refs/original/' \
128 | xargs -n1 git-update-ref -d
129
130rm -rf $tmp/converted
131mkdir $tmp/converted
132cd $tmp/converted
133git init
134git fetch $tmp/adjust 'refs/*:refs/*'
135git checkout master