Fossil SCM

Fleshed out pass II, added skeleton of rcs archive class, started integration of rcs parser.

aku 2007-10-06 18:43 trunk
Commit 8a93ffa9c1aac9943459f1de4b2b31f3ab532278
--- a/tools/cvs2fossil/lib/c2f_file.tcl
+++ b/tools/cvs2fossil/lib/c2f_file.tcl
@@ -0,0 +1,37 @@
1
+setsymbols {dictseek $chan $offs!tools::troubleStubleState
2
+ }
3
+}
4
+desc {d} projectFile flag - jectAll revisions and their connections giving us the order
5
+ ; # of revisions
6
+ ; dependency recordereek $chan $offses ;vision }
7
+ #f {!t$path
8
+ set myproj {!tools::troubleState
9
+ }
10
+}
11
+
12
+seek $chan $!branch
13
+ setsymbolsState
14
+ }
15
+}
16
+
17
+seek $chan $!brancLookForUnlabeledBranchercs archiveProject objectAll revisions and their connections giving us the order
18
+ ; # of revisions
19
+ ; dependency recordereek $chan $offses ;vision number ofUsual$chan $offset start
20
+
21
+ i!tools::troubleStathan $offset start
22
+
23
+ if ools: }seek $chan $offset start
24
+
25
+ if {!t$path
26
+ set myprojectour rcs archiveprojectFillag - executable,fset start
27
+
28
+ if {!tools::troubleState
29
+ }
30
+package r; # OO system}ictseek $chan $offs!tools::troubleStubleState
31
+ }
32
+}
33
+desc {d} setsymbols {dictseek $chan $offs!tools::troubleStubleState
34
+ } $offs!tools::troubleStubleState
35
+ }
36
+}
37
+desc {d} projectFile flag - jectAll revisions and their connectioState
--- a/tools/cvs2fossil/lib/c2f_file.tcl
+++ b/tools/cvs2fossil/lib/c2f_file.tcl
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/tools/cvs2fossil/lib/c2f_file.tcl
+++ b/tools/cvs2fossil/lib/c2f_file.tcl
@@ -0,0 +1,37 @@
1 setsymbols {dictseek $chan $offs!tools::troubleStubleState
2 }
3 }
4 desc {d} projectFile flag - jectAll revisions and their connections giving us the order
5 ; # of revisions
6 ; dependency recordereek $chan $offses ;vision }
7 #f {!t$path
8 set myproj {!tools::troubleState
9 }
10 }
11
12 seek $chan $!branch
13 setsymbolsState
14 }
15 }
16
17 seek $chan $!brancLookForUnlabeledBranchercs archiveProject objectAll revisions and their connections giving us the order
18 ; # of revisions
19 ; dependency recordereek $chan $offses ;vision number ofUsual$chan $offset start
20
21 i!tools::troubleStathan $offset start
22
23 if ools: }seek $chan $offset start
24
25 if {!t$path
26 set myprojectour rcs archiveprojectFillag - executable,fset start
27
28 if {!tools::troubleState
29 }
30 package r; # OO system}ictseek $chan $offs!tools::troubleStubleState
31 }
32 }
33 desc {d} setsymbols {dictseek $chan $offs!tools::troubleStubleState
34 } $offs!tools::troubleStubleState
35 }
36 }
37 desc {d} projectFile flag - jectAll revisions and their connectioState
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -22,11 +22,12 @@
2222
package require fileutil ; # File & path utilities.
2323
package require vc::tools::trouble ; # Error reporting.
2424
package require vc::tools::log ; # User feedback.
2525
package require vc::fossil::import::cvs::pass ; # Pass management.
2626
package require vc::fossil::import::cvs::repository ; # Repository management.
27
-package require vc::fossil::import::cvs::state ; # State storage
27
+package require vc::fossil::import::cvs::state ; # State storage.
28
+package require vc::rcs::parser ; # Rcs archive data extraction.
2829
2930
# # ## ### ##### ######## ############# #####################
3031
## Register the pass with the management
3132
3233
vc::fossil::import::cvs::pass define \
@@ -156,10 +157,13 @@
156157
cid INTEGER NOT NULL REFERENCES cmessage,
157158
158159
UNIQUE (pid, bid, aid, cid)
159160
}
160161
162
+ # Author and commit message information is fully global,
163
+ # i.e. per repository.
164
+
161165
state writing author {
162166
aid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
163167
name TEXT NOT NULL UNIQUE
164168
}
165169
@@ -178,10 +182,25 @@
178182
179183
return
180184
}
181185
182186
typemethod run {} {
187
+ set rbase [repository base?]
188
+ foreach project [repository projects] {
189
+ set base [file join $rbase [$project base]]
190
+ log write 1 collrev "Processing $base"
191
+
192
+ foreach file [$project files] {
193
+ set path [$file path]
194
+ log write 2 collrev "Parsing $path"
195
+ rcs::process [file join $base $path] $file
196
+ }
197
+ }
198
+
199
+ repository printrevstatistics
200
+ repository persistrev
201
+
183202
log write 1 collrev "Scan completed"
184203
return
185204
}
186205
187206
# # ## ### ##### ######## #############
@@ -198,10 +217,13 @@
198217
}
199218
200219
namespace eval ::vc::fossil::import::cvs::pass {
201220
namespace export collrev
202221
namespace eval collrev {
222
+ namespace eval rcs {
223
+ namespace import ::vc::rcs::parser::process
224
+ }
203225
namespace import ::vc::fossil::import::cvs::repository
204226
namespace import ::vc::fossil::import::cvs::state
205227
namespace import ::vc::tools::trouble
206228
namespace import ::vc::tools::log
207229
log register collrev
208230
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -22,11 +22,12 @@
22 package require fileutil ; # File & path utilities.
23 package require vc::tools::trouble ; # Error reporting.
24 package require vc::tools::log ; # User feedback.
25 package require vc::fossil::import::cvs::pass ; # Pass management.
26 package require vc::fossil::import::cvs::repository ; # Repository management.
27 package require vc::fossil::import::cvs::state ; # State storage
 
28
29 # # ## ### ##### ######## ############# #####################
30 ## Register the pass with the management
31
32 vc::fossil::import::cvs::pass define \
@@ -156,10 +157,13 @@
156 cid INTEGER NOT NULL REFERENCES cmessage,
157
158 UNIQUE (pid, bid, aid, cid)
159 }
160
 
 
 
161 state writing author {
162 aid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
163 name TEXT NOT NULL UNIQUE
164 }
165
@@ -178,10 +182,25 @@
178
179 return
180 }
181
182 typemethod run {} {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183 log write 1 collrev "Scan completed"
184 return
185 }
186
187 # # ## ### ##### ######## #############
@@ -198,10 +217,13 @@
198 }
199
200 namespace eval ::vc::fossil::import::cvs::pass {
201 namespace export collrev
202 namespace eval collrev {
 
 
 
203 namespace import ::vc::fossil::import::cvs::repository
204 namespace import ::vc::fossil::import::cvs::state
205 namespace import ::vc::tools::trouble
206 namespace import ::vc::tools::log
207 log register collrev
208
--- tools/cvs2fossil/lib/c2f_pcollrev.tcl
+++ tools/cvs2fossil/lib/c2f_pcollrev.tcl
@@ -22,11 +22,12 @@
22 package require fileutil ; # File & path utilities.
23 package require vc::tools::trouble ; # Error reporting.
24 package require vc::tools::log ; # User feedback.
25 package require vc::fossil::import::cvs::pass ; # Pass management.
26 package require vc::fossil::import::cvs::repository ; # Repository management.
27 package require vc::fossil::import::cvs::state ; # State storage.
28 package require vc::rcs::parser ; # Rcs archive data extraction.
29
30 # # ## ### ##### ######## ############# #####################
31 ## Register the pass with the management
32
33 vc::fossil::import::cvs::pass define \
@@ -156,10 +157,13 @@
157 cid INTEGER NOT NULL REFERENCES cmessage,
158
159 UNIQUE (pid, bid, aid, cid)
160 }
161
162 # Author and commit message information is fully global,
163 # i.e. per repository.
164
165 state writing author {
166 aid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
167 name TEXT NOT NULL UNIQUE
168 }
169
@@ -178,10 +182,25 @@
182
183 return
184 }
185
186 typemethod run {} {
187 set rbase [repository base?]
188 foreach project [repository projects] {
189 set base [file join $rbase [$project base]]
190 log write 1 collrev "Processing $base"
191
192 foreach file [$project files] {
193 set path [$file path]
194 log write 2 collrev "Parsing $path"
195 rcs::process [file join $base $path] $file
196 }
197 }
198
199 repository printrevstatistics
200 repository persistrev
201
202 log write 1 collrev "Scan completed"
203 return
204 }
205
206 # # ## ### ##### ######## #############
@@ -198,10 +217,13 @@
217 }
218
219 namespace eval ::vc::fossil::import::cvs::pass {
220 namespace export collrev
221 namespace eval collrev {
222 namespace eval rcs {
223 namespace import ::vc::rcs::parser::process
224 }
225 namespace import ::vc::fossil::import::cvs::repository
226 namespace import ::vc::fossil::import::cvs::state
227 namespace import ::vc::tools::trouble
228 namespace import ::vc::tools::log
229 log register collrev
230
--- tools/cvs2fossil/lib/c2f_project.tcl
+++ tools/cvs2fossil/lib/c2f_project.tcl
@@ -15,10 +15,11 @@
1515
# # ## ### ##### ######## ############# #####################
1616
## Requirements
1717
1818
package require Tcl 8.4 ; # Required runtime.
1919
package require snit ; # OO system.
20
+package require vc::fossil::import::cvs::file ; # CVS archive file.
2021
package require vc::fossil::import::cvs::state ; # State storage
2122
2223
# # ## ### ##### ######## ############# #####################
2324
##
2425
@@ -41,13 +42,22 @@
4142
method add {rcs usr} {
4243
set myfiles($rcs) $usr
4344
return
4445
}
4546
46
- method files {} {
47
+ method filenames {} {
4748
return [array names myfiles]
4849
}
50
+
51
+ method files {} {
52
+ # TODO: Loading from state
53
+ set res {}
54
+ foreach f [array names myfiles] {
55
+ lappend res [file %AUTO% $f $self]
56
+ }
57
+ return $res
58
+ }
4959
5060
method persist {} {
5161
state transaction {
5262
# Project data first. Required so that we have its id
5363
# ready for the files.
@@ -73,11 +83,11 @@
7383
7484
# # ## ### ##### ######## #############
7585
## State
7686
7787
variable mybase {} ; # Project directory
78
- variable myfiles -array {} ; # Maps rcss archive to their user files.
88
+ variable myfiles -array {} ; # Maps rcs archive to their user files.
7989
8090
# # ## ### ##### ######## #############
8191
## Internal methods
8292
8393
pragma -hastypeinfo no ; # no type introspection
@@ -89,14 +99,15 @@
8999
}
90100
91101
namespace eval ::vc::fossil::import::cvs {
92102
namespace export project
93103
namespace eval project {
104
+ namespace import ::vc::fossil::import::cvs::file
94105
namespace import ::vc::fossil::import::cvs::state
95106
}
96107
}
97108
98109
# # ## ### ##### ######## ############# #####################
99110
## Ready
100111
101112
package provide vc::fossil::import::cvs::project 1.0
102113
return
103114
--- tools/cvs2fossil/lib/c2f_project.tcl
+++ tools/cvs2fossil/lib/c2f_project.tcl
@@ -15,10 +15,11 @@
15 # # ## ### ##### ######## ############# #####################
16 ## Requirements
17
18 package require Tcl 8.4 ; # Required runtime.
19 package require snit ; # OO system.
 
20 package require vc::fossil::import::cvs::state ; # State storage
21
22 # # ## ### ##### ######## ############# #####################
23 ##
24
@@ -41,13 +42,22 @@
41 method add {rcs usr} {
42 set myfiles($rcs) $usr
43 return
44 }
45
46 method files {} {
47 return [array names myfiles]
48 }
 
 
 
 
 
 
 
 
 
49
50 method persist {} {
51 state transaction {
52 # Project data first. Required so that we have its id
53 # ready for the files.
@@ -73,11 +83,11 @@
73
74 # # ## ### ##### ######## #############
75 ## State
76
77 variable mybase {} ; # Project directory
78 variable myfiles -array {} ; # Maps rcss archive to their user files.
79
80 # # ## ### ##### ######## #############
81 ## Internal methods
82
83 pragma -hastypeinfo no ; # no type introspection
@@ -89,14 +99,15 @@
89 }
90
91 namespace eval ::vc::fossil::import::cvs {
92 namespace export project
93 namespace eval project {
 
94 namespace import ::vc::fossil::import::cvs::state
95 }
96 }
97
98 # # ## ### ##### ######## ############# #####################
99 ## Ready
100
101 package provide vc::fossil::import::cvs::project 1.0
102 return
103
--- tools/cvs2fossil/lib/c2f_project.tcl
+++ tools/cvs2fossil/lib/c2f_project.tcl
@@ -15,10 +15,11 @@
15 # # ## ### ##### ######## ############# #####################
16 ## Requirements
17
18 package require Tcl 8.4 ; # Required runtime.
19 package require snit ; # OO system.
20 package require vc::fossil::import::cvs::file ; # CVS archive file.
21 package require vc::fossil::import::cvs::state ; # State storage
22
23 # # ## ### ##### ######## ############# #####################
24 ##
25
@@ -41,13 +42,22 @@
42 method add {rcs usr} {
43 set myfiles($rcs) $usr
44 return
45 }
46
47 method filenames {} {
48 return [array names myfiles]
49 }
50
51 method files {} {
52 # TODO: Loading from state
53 set res {}
54 foreach f [array names myfiles] {
55 lappend res [file %AUTO% $f $self]
56 }
57 return $res
58 }
59
60 method persist {} {
61 state transaction {
62 # Project data first. Required so that we have its id
63 # ready for the files.
@@ -73,11 +83,11 @@
83
84 # # ## ### ##### ######## #############
85 ## State
86
87 variable mybase {} ; # Project directory
88 variable myfiles -array {} ; # Maps rcs archive to their user files.
89
90 # # ## ### ##### ######## #############
91 ## Internal methods
92
93 pragma -hastypeinfo no ; # no type introspection
@@ -89,14 +99,15 @@
99 }
100
101 namespace eval ::vc::fossil::import::cvs {
102 namespace export project
103 namespace eval project {
104 namespace import ::vc::fossil::import::cvs::file
105 namespace import ::vc::fossil::import::cvs::state
106 }
107 }
108
109 # # ## ### ##### ######## ############# #####################
110 ## Ready
111
112 package provide vc::fossil::import::cvs::project 1.0
113 return
114
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -91,11 +91,11 @@
9191
set nfmt %s
9292
}
9393
9494
set keep {}
9595
foreach p $prlist {
96
- set nfiles [llength [$p files]]
96
+ set nfiles [llength [$p filenames]]
9797
set line "Project [format $bfmt \"[$p printbase]\"] : [format $nfmt $nfiles] [sp $nfiles file]"
9898
if {$nfiles < 1} {
9999
append line ", dropped"
100100
} else {
101101
lappend keep $p
@@ -137,11 +137,11 @@
137137
proc .BaseLength {p} {
138138
return [string length [$p printbase]]
139139
}
140140
141141
proc .NFileLength {p} {
142
- return [string length [llength [$p files]]]
142
+ return [string length [llength [$p filenames]]]
143143
}
144144
145145
proc IsRepositoryBase {path mv} {
146146
upvar 1 $mv msg mybase mybase
147147
if {![fileutil::test $mybase edr msg {CVS Repository}]} {return 0}
148148
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -91,11 +91,11 @@
91 set nfmt %s
92 }
93
94 set keep {}
95 foreach p $prlist {
96 set nfiles [llength [$p files]]
97 set line "Project [format $bfmt \"[$p printbase]\"] : [format $nfmt $nfiles] [sp $nfiles file]"
98 if {$nfiles < 1} {
99 append line ", dropped"
100 } else {
101 lappend keep $p
@@ -137,11 +137,11 @@
137 proc .BaseLength {p} {
138 return [string length [$p printbase]]
139 }
140
141 proc .NFileLength {p} {
142 return [string length [llength [$p files]]]
143 }
144
145 proc IsRepositoryBase {path mv} {
146 upvar 1 $mv msg mybase mybase
147 if {![fileutil::test $mybase edr msg {CVS Repository}]} {return 0}
148
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -91,11 +91,11 @@
91 set nfmt %s
92 }
93
94 set keep {}
95 foreach p $prlist {
96 set nfiles [llength [$p filenames]]
97 set line "Project [format $bfmt \"[$p printbase]\"] : [format $nfmt $nfiles] [sp $nfiles file]"
98 if {$nfiles < 1} {
99 append line ", dropped"
100 } else {
101 lappend keep $p
@@ -137,11 +137,11 @@
137 proc .BaseLength {p} {
138 return [string length [$p printbase]]
139 }
140
141 proc .NFileLength {p} {
142 return [string length [llength [$p filenames]]]
143 }
144
145 proc IsRepositoryBase {path mv} {
146 upvar 1 $mv msg mybase mybase
147 if {![fileutil::test $mybase edr msg {CVS Repository}]} {return 0}
148
--- tools/cvs2fossil/lib/pkgIndex.tcl
+++ tools/cvs2fossil/lib/pkgIndex.tcl
@@ -2,10 +2,11 @@
22
## Package management.
33
## Index of the local packages required by cvs2fossil
44
# # ## ### ##### ######## ############# #####################
55
if {![package vsatisfies [package require Tcl] 8.4]} return
66
package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir cvs2fossil.tcl]]
7
+package ifneeded vc::fossil::import::cvs::file 1.0 [list source [file join $dir c2f_file.tcl]]
78
package ifneeded vc::fossil::import::cvs::option 1.0 [list source [file join $dir c2f_option.tcl]]
89
package ifneeded vc::fossil::import::cvs::pass 1.0 [list source [file join $dir c2f_pass.tcl]]
910
package ifneeded vc::fossil::import::cvs::pass::collar 1.0 [list source [file join $dir c2f_pcollar.tcl]]
1011
package ifneeded vc::fossil::import::cvs::pass::collrev 1.0 [list source [file join $dir c2f_pcollrev.tcl]]
1112
package ifneeded vc::fossil::import::cvs::project 1.0 [list source [file join $dir c2f_project.tcl]]
1213
--- tools/cvs2fossil/lib/pkgIndex.tcl
+++ tools/cvs2fossil/lib/pkgIndex.tcl
@@ -2,10 +2,11 @@
2 ## Package management.
3 ## Index of the local packages required by cvs2fossil
4 # # ## ### ##### ######## ############# #####################
5 if {![package vsatisfies [package require Tcl] 8.4]} return
6 package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir cvs2fossil.tcl]]
 
7 package ifneeded vc::fossil::import::cvs::option 1.0 [list source [file join $dir c2f_option.tcl]]
8 package ifneeded vc::fossil::import::cvs::pass 1.0 [list source [file join $dir c2f_pass.tcl]]
9 package ifneeded vc::fossil::import::cvs::pass::collar 1.0 [list source [file join $dir c2f_pcollar.tcl]]
10 package ifneeded vc::fossil::import::cvs::pass::collrev 1.0 [list source [file join $dir c2f_pcollrev.tcl]]
11 package ifneeded vc::fossil::import::cvs::project 1.0 [list source [file join $dir c2f_project.tcl]]
12
--- tools/cvs2fossil/lib/pkgIndex.tcl
+++ tools/cvs2fossil/lib/pkgIndex.tcl
@@ -2,10 +2,11 @@
2 ## Package management.
3 ## Index of the local packages required by cvs2fossil
4 # # ## ### ##### ######## ############# #####################
5 if {![package vsatisfies [package require Tcl] 8.4]} return
6 package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir cvs2fossil.tcl]]
7 package ifneeded vc::fossil::import::cvs::file 1.0 [list source [file join $dir c2f_file.tcl]]
8 package ifneeded vc::fossil::import::cvs::option 1.0 [list source [file join $dir c2f_option.tcl]]
9 package ifneeded vc::fossil::import::cvs::pass 1.0 [list source [file join $dir c2f_pass.tcl]]
10 package ifneeded vc::fossil::import::cvs::pass::collar 1.0 [list source [file join $dir c2f_pcollar.tcl]]
11 package ifneeded vc::fossil::import::cvs::pass::collrev 1.0 [list source [file join $dir c2f_pcollrev.tcl]]
12 package ifneeded vc::fossil::import::cvs::project 1.0 [list source [file join $dir c2f_project.tcl]]
13
--- tools/cvs2fossil/lib/rcsparser.tcl
+++ tools/cvs2fossil/lib/rcsparser.tcl
@@ -14,12 +14,12 @@
1414
package require Tcl 8.4
1515
package require fileutil ; # Tcllib (cat)
1616
package require vc::tools::log ; # User feedback
1717
1818
namespace eval ::vc::rcs::parser {
19
- vc::tools::log::system rcs
20
- namespace import ::vc::tools::log::*
19
+ namespace import ::vc::tools::log
20
+ log register rcs
2121
}
2222
2323
# -----------------------------------------------------------------------------
2424
# API
2525
2626
--- tools/cvs2fossil/lib/rcsparser.tcl
+++ tools/cvs2fossil/lib/rcsparser.tcl
@@ -14,12 +14,12 @@
14 package require Tcl 8.4
15 package require fileutil ; # Tcllib (cat)
16 package require vc::tools::log ; # User feedback
17
18 namespace eval ::vc::rcs::parser {
19 vc::tools::log::system rcs
20 namespace import ::vc::tools::log::*
21 }
22
23 # -----------------------------------------------------------------------------
24 # API
25
26
--- tools/cvs2fossil/lib/rcsparser.tcl
+++ tools/cvs2fossil/lib/rcsparser.tcl
@@ -14,12 +14,12 @@
14 package require Tcl 8.4
15 package require fileutil ; # Tcllib (cat)
16 package require vc::tools::log ; # User feedback
17
18 namespace eval ::vc::rcs::parser {
19 namespace import ::vc::tools::log
20 log register rcs
21 }
22
23 # -----------------------------------------------------------------------------
24 # API
25
26

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button