Skip to content

Commit 18b41b8

Browse files
committed
Preserve this beautiful CSS2 conversion script for posterity.
1 parent 3e5acd8 commit 18b41b8

1 file changed

Lines changed: 156 additions & 0 deletions

File tree

bin/css2-cvs2hg

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
#!/bin/bash
2+
3+
4+
# NOTE: This conversion has been made and merge.
5+
# This "one-shot" script is not required anymore,
6+
# it is only kept here for historical interest.
7+
8+
9+
# This script imports 3301 revisions of CSS 2,
10+
# dated from 1997-07-21 to 2014-01-17,
11+
# from a zip archive of W3C's CVS repository into a Mercurial bundle file.
12+
#
13+
# This bundle can be imported into a clone of CSSWG's repository
14+
# (https://dvcs.w3.org/hg/csswg/) to add a 'css2' subdirectory
15+
# with all its change history:
16+
#
17+
# hg unbundle path/to/css2.hg-bundle
18+
# hg merge
19+
# hg commit -m 'Import CSS 2 from CVS, with change history'
20+
21+
# This script requires cvs2svn and hg convert
22+
# http://cvs2svn.tigris.org/
23+
# http://mercurial.selenic.com/wiki/ConvertExtension
24+
#
25+
# It expects to be in the same directory as a 'css2.zip' file
26+
# containing the 'css2-src' directory of W3C's internal CVS repository,
27+
# which itself consists of a bunch of '*,v' files.
28+
#
29+
# It will go through a multiple-step conversion, creating temporary files
30+
# in the 'tmp' subdirectory, to finally produce a ~10 MB 'css2.hg-bundle' file.
31+
32+
33+
set -e
34+
35+
cd $(dirname $0)
36+
37+
rm -rf tmp
38+
39+
mkdir -p tmp/cvs/CVSROOT
40+
41+
# Exclude:
42+
# css2-src/css2.tgz,v
43+
# css2-src/css2.ps,v
44+
# css2-src/css2.ps.gz,v
45+
# css2-src/css2.pdf,v
46+
# css2-src/css2.zip,v
47+
# css2-src/css2.txt,v
48+
# But not:
49+
# css2-src/css2.html,v
50+
unzip -q css2.zip 'css2-src/*' -x 'css2-src/css2.[^h]*' -d tmp/cvs
51+
52+
# We want the final result at http://dev.w3.org/csswg/css2/
53+
mv tmp/cvs/css2-src tmp/cvs/css2
54+
55+
# Try some surgery on a broken RCS file.
56+
# We may end up with incorrect earlier versions of bin/mkidx
57+
# but at least cvs2svn doesn't abort in the middle of the conversion
58+
patch -p 1 <<-'EOF'
59+
--- a/tmp/cvs/css2/bin/mkidx,v
60+
+++ b/tmp/cvs/css2/bin/mkidx,v
61+
@@ -509,20 +509,19 @@
62+
# class="tocline*" directs out patched html2ps to omit the bullet
63+
d85 2
64+
a86 3
65+
print OUTPUT "\n$indent[$j]<li class=\"tocline0\">$subs[$j]";
66+
if ($j < $#subs) {
67+
print OUTPUT "\n$indent[$j]<ul class=\"index\">";
68+
d88 1
69+
d90 1
70+
-d109 2
71+
-a110 2
72+
+d106 1
73+
+a106 1
74+
print OUTPUT "\n</ul>\n";
75+
-
76+
@
77+
78+
79+
2.9
80+
log
81+
@Bug: lowercase & uppercase were considered different
82+
@
83+
text
84+
@@ -851,21 +850,21 @@
85+
a91 7
86+
$buf .= "</dl>\n";
87+
88+
# Print out the full buffer
89+
open(OUTPUT, "> $indexf");
90+
print OUTPUT "<DIV class=\"noprint\"> ";
91+
foreach $letter (@@letters) {
92+
print OUTPUT " <a href=\"#$letter\">" . uc($letter) . "</a> ";
93+
-d93 2
94+
-a94 2
95+
+d93 1
96+
+a93 2
97+
print OUTPUT "</DIV>";
98+
print OUTPUT $buf;
99+
-a95 2
100+
+a93 2
101+
102+
103+
@
104+
105+
106+
1.11
107+
log
108+
@Updated to be like HTML
109+
@@ -1011,17 +1010,17 @@
110+
a85 1
111+
print OUTPUT "\n<dd> $cmt";
112+
d109 1
113+
a109 1
114+
print OUTPUT "$pre$content$post";
115+
d112 10
116+
a121 1
117+
print OUTPUT "</dl>\n";
118+
-d123 3
119+
+d123 1
120+
@
121+
122+
123+
1.5
124+
log
125+
@Fixed bug
126+
@
127+
text
128+
EOF
129+
130+
# Prefix all commit messages with "[css2] "
131+
find tmp/cvs -name '*,v' | xargs sed -i -r '/^log$/{
132+
N
133+
s/^(log\n@+)/\1\[css2\] /
134+
}'
135+
136+
cvs2svn --encoding latin1 --retain-conflicting-attic-files --trunk-only \
137+
--tmpdir=tmp/cvs2svn --svnrepos tmp/svn tmp/cvs
138+
139+
cat > tmp/authormap.txt <<-'EOF'
140+
bbos=Bert Bos <bert@w3.org>
141+
ijacobs=Ian Jacobs <ij@w3.org>
142+
ian=Ian Jacobs <ij@w3.org>
143+
howcome=Håkon Wium Lie <howcome@opera.com>
144+
fantasai=Elika Etemad <fantasai.cvs@inkedblade.net>
145+
clilley=Chris Lilley <chris@w3.org>
146+
ihickson=Ian Hickson <ian@hixie.ch>
147+
lehors=Arnaud Le Hors <lehors@w3.org>
148+
ot=Olivier Thereaux <ot@w3.org>
149+
ted=Ted Guild <ted@w3.org>
150+
mmielke=Markus Mielke <mmielke@microsoft.com>
151+
dbaron=L. David Baron <dbaron@dbaron.org>
152+
EOF
153+
154+
hg convert --authormap tmp/authormap.txt --datesort tmp/svn tmp/hg
155+
156+
hg --repository tmp/hg bundle --all css2.hg-bundle

0 commit comments

Comments
 (0)