Fossil

Diff
Login

Differences From Artifact [ac4b426bcc]:

To Artifact [2bc22e9971]:


18
19
20
21
22
23
24

25
26
27
28
29
30
31
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32







+







## Requirements

package require Tcl 8.4                          ; # Required runtime.
package require snit                             ; # OO system.
package require vc::tools::trouble               ; # Error reporting.
package require vc::tools::log                   ; # User feedback.
package require vc::tools::misc                  ; # Text formatting.
package require vc::tools::id                    ; # Indexing and id generation.
package require vc::fossil::import::cvs::project ; # CVS projects.
package require vc::fossil::import::cvs::state   ; # State storage.
package require struct::list                     ; # List operations.
package require fileutil                         ; # File operations.

# # ## ### ##### ######## ############# #####################
## 
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
86

87
88
89
90
91
92
93
94
95

96
97
98
99
100
101
102
103
104
105

106
107
108
109
110

111
112
113
114
115
116



117
118
119
120
121
122
123
72
73
74
75
76
77
78

79








80









81










82





83






84
85
86
87
88
89
90
91
92
93







-
+
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
+
-
-
-
-
-
-
+
+
+







	    if {![IsProjectBase $mybase/$pp $mybase/CVSROOT msg]} {
		trouble fatal $msg
	    }
	}
	return
    }

    typemethod defauthor {a} {
    typemethod defauthor   {a}               { $myauthor put $a }
	if {![info exists myauthor($a)]} {
	    set myauthor($a) [incr myauthorcnt]
	    log write 7 repository "author '$a' =  $myauthor($a)"
	}
	return $myauthor($a)
    }

    typemethod defcmessage {cm} {
    typemethod defcmessage {cm}              { $mycmsg   put $cm }
	if {![info exists mycmsg($cm)]} {
	    set mycmsg($cm) [set cid [incr mycmsgcnt]]
	    set mycmsginv($cid) $cm
	    log write 7 repository "cmessage '$cm' =  $cid"
	}
	return $mycmsg($cm)
    }

    typemethod defsymbol {pid name} {
    typemethod defsymbol   {pid name}        { $mysymbol put [list $pid $name] }
	set key [list $pid $name]
	if {![info exists mysymbol($key)]} {
	    set mysymbol($key) [incr mysymbolcnt]
	    log write 7 repository "symbol ($key) =  $mysymbol($key)"
	}
	return $mysymbol($key)
    }

    typemethod defmeta {pid bid aid cid} {
	set key [list $pid $bid $aid $cid]
    typemethod defmeta     {pid bid aid cid} { $mymeta   put [list $pid $bid $aid $cid] }
	if {![info exists mymeta($key)]} {
	    set mymeta($key) [set mid [incr mymetacnt]]
	    set mymetainv($mid) $key
	    log write 7 repository "meta ($key) =  $mymeta($key)"
	}

	return $mymeta($key)
    }

    typemethod commitmessageof {metaid} {
	struct::list assign $mymetainv($metaid) pid bid aid cid
	return $mycmsginv($cid)
    typemethod commitmessageof {mid} {
	struct::list assign [$mymeta keyof $mid] pid bid aid cid
	return [$mycmsg keyof $cid]
    }

    # pass I results
    typemethod printstatistics {} {
	set prlist [TheProjects]
	set npr [llength $prlist]

213
214
215
216
217
218
219
220

221
222
223

224
225
226
227

228
229
230
231
232

233
234
235
236
237
238
239
240
241
242








243
244
245
246
247
248
249
183
184
185
186
187
188
189

190
191


192
193



194
195
196



197
198
199
200

201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221







-
+

-
-
+

-
-
-
+


-
-
-
+



-






+
+
+
+
+
+
+
+







    ## State

    typevariable mybase           {} ; # Base path to CVS repository.
    typevariable myprojpaths      {} ; # List of paths to all declared
				       # projects, relative to mybase.
    typevariable myprojects       {} ; # List of objects for all
				       # declared projects.
    typevariable myauthor  -array {} ; # Names of all authors found,
    typevariable myauthor         {} ; # Names of all authors found,
				       # maps to their ids.
    typevariable myauthorcnt      0  ; # Counter for author ids.
    typevariable mycmsg    -array {} ; # All commit messages found,
    typevariable mycmsg           {} ; # All commit messages found,
				       # maps to their ids.
    typevariable mycmsginv -array {} ; # Inverted index, keyed by id.
    typevariable mycmsgcnt        0  ; # Counter for message ids.
    typevariable mymeta    -array {} ; # Maps all meta data tuples
    typevariable mymeta           {} ; # Maps all meta data tuples
				       # (project, branch, author,
				       # cmessage) to their ids.
    typevariable mymetainv -array {} ; # Inverted index, keyed by id.
    typevariable mymetacnt        0  ; # Counter for meta ids.
    typevariable mysymbol -array  {} ; # Map symbols identified by
    typevariable mysymbol         {} ; # Map symbols identified by
				       # project and name to their
				       # id. This information is not
				       # saved directly.
    typevariable mysymbolcnt      0  ; # Counter for symbol ids.
    typevariable mytrunkonly      0  ; # Boolean flag. Set by option
				       # processing when the user
				       # requested a trunk-only import

    # # ## ### ##### ######## #############
    ## Internal methods

    typeconstructor {
	set myauthor [vc::tools::id %AUTO%]
	set mycmsg   [vc::tools::id %AUTO%]
	set mymeta   [vc::tools::id %AUTO%]
	set mysymbol [vc::tools::id %AUTO%]
	return
    }

    proc .BaseLength {p} {
	return [string length [$p printbase]]
    }

    proc .NFileLength {p} {
	return [string length [llength [$p filenames]]]
350
351
352
353
354
355
356

357
358
359
360
361
362
363
364
365
366
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339







+











namespace eval ::vc::fossil::import::cvs {
    namespace export repository
    namespace eval repository {
	namespace import ::vc::fossil::import::cvs::project
	namespace import ::vc::fossil::import::cvs::state
	namespace import ::vc::tools::misc::*
	namespace import ::vc::tools::id
	namespace import ::vc::tools::trouble
	namespace import ::vc::tools::log
	log register repository
    }
}

# # ## ### ##### ######## ############# #####################
## Ready

return