Fossil

Diff
Login

Differences From Artifact [a86b5d4424]:

To Artifact [00ef0cca21]:


16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43














44
45
46
47
48
49
50







+




















-
-
-
-
-
-
-
-
-
-
-
-
-
-







# # ## ### ##### ######## ############# #####################
## Requirements

package require Tcl 8.4                             ; # Required runtime.
package require snit                                ; # OO system.
package require struct::set                         ; # Set operations.
package require vc::fossil::import::cvs::file::rev  ; # CVS per file revisions.
package require vc::fossil::import::cvs::file::sym  ; # CVS per file symbols.

# # ## ### ##### ######## ############# #####################
## 

snit::type ::vc::fossil::import::cvs::file {
    # # ## ### ##### ######## #############
    ## Public API

    constructor {path project} {
	set mypath    $path
	set myproject $project
	return
    }

    method path    {} { return $mypath }
    method project {} { return $myproject }

    # # ## ### ##### ######## #############
    ## Methods required for the class to be a sink of the rcs parser

    method begin     {} {}
    method done      {} {}
    method admindone {} {}

    method sethead            {h} {}
    method setprincipalbranch {b} {}

    method deftag     {s r} {}
    method setcomment {c}   {}
    method setdesc    {d}   {}

    method def    {rev date author state next branches} {}
    method extend {rev commitmsg deltarange} {}

    #method begin {} {puts begin}
    #method sethead {h} {puts head=$h}
    #method setprincipalbranch {b} {puts pb=$b}
    #method deftag {s r} {puts $s=$r}
    #method setcomment {c} {puts comment=$c}
    #method admindone {} {puts admindone}
    #method def {rev date author state next branches} {puts "def $rev $date $author $state $next $branches"}
117
118
119
120
121
122
123
124

125
126
127
128
129
130
131
104
105
106
107
108
109
110

111
112
113
114
115
116
117
118







-
+







	$myproject author $author

	if {[info exists myrev($revnr)]} {
	    trouble fatal "File $mypath contains duplicate definitions for revision $revnr."
	    return
	}

	set myrev($revnr) [rev %AUTO% $date $author $state $self]
	set myrev($revnr) [rev %AUTO% $revnr $date $author $state $self]

	RecordBasicDependencies $revnr $next
	return
    }

    method extend {revnr commitmsg deltarange} {
	set cm [string trim $commitmsg]
151
152
153
154
155
156
157




158
159
160
161
162
163
164
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155







+
+
+
+







	}

	# Extend the revision with the new information. The revision
	# object uses this to complete its meta data set.

	$rev setcommitmsg $cm
	$rev settext  $deltarange

	if {![rev istrunkrevnr $revnr]} {
	    $rev setbranch [[$self Rev2Branch $revnr] name]
	}

	# If this is revision 1.1, we have to determine whether the
	# file seems to have been created through 'cvs add' instead of
	# 'cvs import'. This can be done by looking at the un-
	# adulterated commit message, as CVS uses a hardwired magic
	# message for the latter, i.e. "Initial revision\n", no
	# period.  (This fact also helps us when the time comes to
229
230
231
232
233
234
235
236
237
238

239
240
241
242
243
244
245
246
247
248

249
250
251
252
253
254
255
220
221
222
223
224
225
226



227

228
229
230
231
232




233
234
235
236
237
238
239
240







-
-
-
+
-





-
-
-
-
+








    method AddBranch {name branchnr} {
	if {[info exists mybranches($branchnr)]} {
	    log write 1 file "In '$mypath': Branch '$branchnr' named '[$mybranches($branchnr) name]'"
	    log write 1 file "Cannot have second name '$name', ignoring it"
	    return
	}
	set sym ""
	set branch ""
	#TODO set sym [$myproject getsymbol $name ]
	set branch [sym %AUTO% branch $branchnr [$myproject getsymbol $name]]
	#TODO set tag [sym %AUTO% branch $sym $branchnr]
	set mybranches($branchnr) $branch
	return $branch
    }

    method AddTag {name revnr} {
	set sym ""
	set tag ""
	#TODO set sym [$myproject getsymbol $name ]
	#TODO set tag [sym %AUTO% tag $sym $revnr]
	set tag [sym %AUTO% tag $revnr [$myproject getsymbol $name]]
	lappend mytags($revnr) $tag
	return $tag
    }

    proc RecordBasicDependencies {revnr next} {
	# Handle the revision dependencies. Record them for now, do
	# nothing with them yet.
295
296
297
298
299
300
301

302
303
304
305
306
307
308
309
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295







+








}

namespace eval ::vc::fossil::import::cvs {
    namespace export file
    namespace eval file {
	# Import not required, already a child namespace.
	# namespace import vc::fossil::import::cvs::file::rev
	# namespace import vc::fossil::import::cvs::file::sym
    }
}

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

package provide vc::fossil::import::cvs::file 1.0
return