Fossil SCM

The basic work of setting up and linking revisions, tags, and branches is complete.

aku 2007-10-13 05:39 trunk
Commit cb70cf4ad69d891a24b9499cfbbd75f132954ba1
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -19,10 +19,12 @@
1919
package require Tcl 8.4 ; # Required runtime.
2020
package require snit ; # OO system.
2121
package require struct::set ; # Set operations.
2222
package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions.
2323
package require vc::fossil::import::cvs::file::sym ; # CVS per file symbols.
24
+package require vc::tools::trouble ; # Error reporting.
25
+package require vc::tools::misc ; # Text formatting
2426
2527
# # ## ### ##### ######## ############# #####################
2628
##
2729
2830
snit::type ::vc::fossil::import::cvs::file {
@@ -97,11 +99,11 @@
9799
method admindone {} {
98100
# We do nothing at the boundary of admin and revision data
99101
}
100102
101103
method def {revnr date author state next branches} {
102
- $self LookForUnlabeledBranches $branches
104
+ $self RecordBranchCommits $branches
103105
$myproject author $author
104106
105107
if {[info exists myrev($revnr)]} {
106108
trouble fatal "File $mypath contains duplicate definitions for revision $revnr."
107109
return
@@ -112,10 +114,20 @@
112114
RecordBasicDependencies $revnr $next
113115
return
114116
}
115117
116118
method defdone {} {
119
+ # This is all done after the revision tree has been extracted
120
+ # from the file, before the commit mesages and delta texts are
121
+ # processed.
122
+
123
+ ProcessPrimaryDependencies
124
+ ProcessBranchDependencies
125
+ SortBranches
126
+ ProcessTagDependencies
127
+ DetermineTheRootRevision
128
+ return
117129
}
118130
119131
method setdesc {d} {# ignore}
120132
121133
method extend {revnr commitmsg deltarange} {
@@ -146,11 +158,11 @@
146158
147159
$rev setcommitmsg $cm
148160
$rev settext $deltarange
149161
150162
if {![rev istrunkrevnr $revnr]} {
151
- $rev setbranch [[$self Rev2Branch $revnr] name]
163
+ $rev setbranchname [[$self Rev2Branch $revnr] name]
152164
}
153165
154166
# If this is revision 1.1, we have to determine whether the
155167
# file seems to have been created through 'cvs add' instead of
156168
# 'cvs import'. This can be done by looking at the un-
@@ -174,43 +186,68 @@
174186
method done {} {}
175187
176188
# # ## ### ##### ######## #############
177189
## State
178190
179
- variable mypath {} ; # Path of rcs archive
180
- variable myproject {} ; # Project object the file belongs to.
181
- variable myrev -array {} ; # All revisions and their connections.
182
- variable myrevisions {} ; # Same as myrev, but a list, giving us the order
183
- # ; # of revisions.
191
+ variable mypath {} ; # Path of our rcs archive.
192
+ variable myproject {} ; # Reference to the project object
193
+ # the file belongs to.
194
+ variable myrev -array {} ; # Maps revision number to the
195
+ # associated revision object.
196
+ variable myrevisions {} ; # Same as myrev, but a list,
197
+ # giving us the order of
198
+ # revisions.
184199
variable myhead {} ; # Head revision (revision number)
185
- variable myprincipal {} ; # Principal branch (branch number)
186
- # ; # Contrary to the name this is the default branch.
187
- variable mydependencies {} ; # Dictionary parent -> child, dependency recorder.
188
- variable myimported 0 ; # Boolean flag. Set iff rev 1.1 of the file seemingly
189
- # ; # was imported instead of added normally.
190
- variable myroot {} ; # Revision number of the root revision. Usually '1.1'.
191
- # ; # Can be a different number, because of 'cvsadmin -o'.
192
- variable mybranches -array {} ; # branch number -> symbol object handling the branch
193
- variable mytags -array {} ; # revision number -> list of symbol object for the tags
194
- # ; # associated with the revision.
195
- variable mysymbols {} ; # Set of symbol names found in this file.
200
+ variable myprincipal {} ; # Principal branch (branch number).
201
+ # Contrary to the name this is the
202
+ # default branch.
203
+ variable mydependencies {} ; # Dictionary parent -> child,
204
+ # records primary dependencies.
205
+ variable myimported 0 ; # Boolean flag. Set if and only if
206
+ # rev 1.1 of the file seemingly
207
+ # was imported instead of added
208
+ # normally.
209
+ variable myroot {} ; # Reference to the revision object
210
+ # holding the root revision. Its
211
+ # number usually is '1.1'. Can be
212
+ # a different number, because of
213
+ # gaps created via 'cvsadmin -o'.
214
+ variable mybranches -array {} ; # Maps branch number to the symbol
215
+ # object handling the branch.
216
+ variable mytags -array {} ; # Maps revision number to the list
217
+ # of symbol objects for the tags
218
+ # associated with the revision.
219
+ variable mysymbols {} ; # Set of the symbol names found in
220
+ # this file.
221
+
222
+ variable mybranchcnt 0 ; # Counter for branches, to record their
223
+ # order of definition. This also defines
224
+ # their order of creation, which is the
225
+ # reverse of definition. I.e. a smaller
226
+ # number means 'Defined earlier', means
227
+ # 'Created later'.
196228
197229
### TODO ###
198230
### File flag - executable,
199231
### RCS mode info (kb, kkb, ...)
200232
201233
# # ## ### ##### ######## #############
202234
## Internal methods
203235
204
- method LookForUnlabeledBranches {branches} {
236
+ method RecordBranchCommits {branches} {
205237
foreach branchrevnr $branches {
206238
if {[catch {
207239
set branch [$self Rev2Branch $branchrevnr]
208240
}]} {
209241
set branch [$self AddUnlabeledBranch [rev 2branchnr $branchrevnr]]
210242
}
211
- # TODO $branch child $branchrevnr - when add-unlabeled has sensible return value
243
+
244
+ # Record the commit, just as revision number for
245
+ # now. ProcesBranchDependencies will extend that ito a
246
+ # proper object reference.
247
+
248
+ $branch setchildrevnr $branchrevnr
212249
}
213250
return
214251
}
215252
216253
method Rev2Branch {revnr} {
@@ -229,10 +266,11 @@
229266
log write 1 file "In '$mypath': Branch '$branchnr' named '[$mybranches($branchnr) name]'"
230267
log write 1 file "Cannot have second name '$name', ignoring it"
231268
return
232269
}
233270
set branch [sym %AUTO% branch $branchnr [$myproject getsymbol $name]]
271
+ $branch setposition [incr mybranchcnt]
234272
set mybranches($branchnr) $branch
235273
return $branch
236274
}
237275
238276
method AddTag {name revnr} {
@@ -271,10 +309,101 @@
271309
lappend mydependencies $revnr $next
272310
}
273311
return
274312
}
275313
314
+ proc ProcessPrimaryDependencies {} {
315
+ upvar 1 mydependencies mydependencies myrev myrev
316
+
317
+ foreach {parentrevnr childrevnr} $mydependencies {
318
+ set parent $myrev($parentrevnr)
319
+ set child $myrev($childrevnr)
320
+ $parent setchild $child
321
+ $child setparent $parent
322
+ }
323
+ return
324
+ }
325
+
326
+ proc ProcessBranchDependencies {} {
327
+ upvar 1 mybranches mybranches myrev myrev
328
+
329
+ foreach {branchnr branch} [array get mybranches] {
330
+ set revnr [$branch parentrevnr]
331
+
332
+ if {![info exists myrev($revnr)]} {
333
+ log write 1 file "In '$mypath': The branch '[$branch name]' references"
334
+ log write 1 file "the bogus revision '$revnr' and will be ignored."
335
+ $branch destroy
336
+ unset mybranches($branchnr)
337
+ } else {
338
+ set rev $myrev($revnr)
339
+ $rev addbranch $branch
340
+
341
+ # If revisions were committed on the branch we store a
342
+ # reference to the branch there, and further declare
343
+ # the first child's parent to be branch's parent, and
344
+ # list this child in the parent revision.
345
+
346
+ if {[$branch haschild]} {
347
+ set childrevnr [$branch childrevnr]
348
+ set child $myrev($childrevnr)
349
+
350
+ $child setparentbranch $branch
351
+ $child setparent $rev
352
+ $rev addchildonbranch $child
353
+ }
354
+ }
355
+ }
356
+ return
357
+ }
358
+
359
+ proc SortBranches {} {
360
+ upvar 1 myrev myrev
361
+
362
+ foreach {revnr rev} [array get myrev] {
363
+ $rev sortbranches
364
+ }
365
+ return
366
+ }
367
+
368
+ proc ProcessTagDependencies {} {
369
+ upvar 1 mytags mytags myrev myrev
370
+
371
+ foreach {revnr taglist} [array get mytags] {
372
+ if {![info exists myrev($revnr)]} {
373
+ set n [llength $taglist]
374
+ log write 1 file "In '$mypath': The following [nsp $n tag] reference"
375
+ log write 1 file "the bogus revision '$revnr' and will be ignored."
376
+ foreach tag $taglist {
377
+ log write 1 file " [$tag name]"
378
+ $tag destroy
379
+ }
380
+ unset mytags($revnr)
381
+ } else {
382
+ set rev $myrev($revnr)
383
+ foreach tag $taglist { $rev addtag $tag }
384
+ }
385
+ }
386
+ return
387
+ }
388
+
389
+ proc DetermineTheRootRevision {} {
390
+ upvar 1 myrev myrev myroot myroot
391
+
392
+ # The root is the one revision which has no parent. By
393
+ # checking all revisions we ensure that we can detect and
394
+ # report the case of multiple roots. Without that we could
395
+ # simply take one revision and follow the parent links to
396
+ # their root (sic!).
397
+
398
+ foreach {revnr rev} [array get myrev] {
399
+ if {[$rev hasparent]} continue
400
+ if {$myroot ne ""} { trouble internal "Multiple root revisions found" }
401
+ set myroot $rev
402
+ }
403
+ return
404
+ }
276405
277406
# # ## ### ##### ######## #############
278407
## Configuration
279408
280409
pragma -hastypeinfo no ; # no type introspection
@@ -287,15 +416,17 @@
287416
288417
namespace eval ::vc::fossil::import::cvs {
289418
namespace export file
290419
namespace eval file {
291420
# Import not required, already a child namespace.
292
- # namespace import vc::fossil::import::cvs::file::rev
293
- # namespace import vc::fossil::import::cvs::file::sym
421
+ # namespace import ::vc::fossil::import::cvs::file::rev
422
+ # namespace import ::vc::fossil::import::cvs::file::sym
423
+ namespace import ::vc::tools::misc::*
424
+ namespace import ::vc::tools::trouble
294425
}
295426
}
296427
297428
# # ## ### ##### ######## ############# #####################
298429
## Ready
299430
300431
package provide vc::fossil::import::cvs::file 1.0
301432
return
302433
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -19,10 +19,12 @@
19 package require Tcl 8.4 ; # Required runtime.
20 package require snit ; # OO system.
21 package require struct::set ; # Set operations.
22 package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions.
23 package require vc::fossil::import::cvs::file::sym ; # CVS per file symbols.
 
 
24
25 # # ## ### ##### ######## ############# #####################
26 ##
27
28 snit::type ::vc::fossil::import::cvs::file {
@@ -97,11 +99,11 @@
97 method admindone {} {
98 # We do nothing at the boundary of admin and revision data
99 }
100
101 method def {revnr date author state next branches} {
102 $self LookForUnlabeledBranches $branches
103 $myproject author $author
104
105 if {[info exists myrev($revnr)]} {
106 trouble fatal "File $mypath contains duplicate definitions for revision $revnr."
107 return
@@ -112,10 +114,20 @@
112 RecordBasicDependencies $revnr $next
113 return
114 }
115
116 method defdone {} {
 
 
 
 
 
 
 
 
 
 
117 }
118
119 method setdesc {d} {# ignore}
120
121 method extend {revnr commitmsg deltarange} {
@@ -146,11 +158,11 @@
146
147 $rev setcommitmsg $cm
148 $rev settext $deltarange
149
150 if {![rev istrunkrevnr $revnr]} {
151 $rev setbranch [[$self Rev2Branch $revnr] name]
152 }
153
154 # If this is revision 1.1, we have to determine whether the
155 # file seems to have been created through 'cvs add' instead of
156 # 'cvs import'. This can be done by looking at the un-
@@ -174,43 +186,68 @@
174 method done {} {}
175
176 # # ## ### ##### ######## #############
177 ## State
178
179 variable mypath {} ; # Path of rcs archive
180 variable myproject {} ; # Project object the file belongs to.
181 variable myrev -array {} ; # All revisions and their connections.
182 variable myrevisions {} ; # Same as myrev, but a list, giving us the order
183 # ; # of revisions.
 
 
 
184 variable myhead {} ; # Head revision (revision number)
185 variable myprincipal {} ; # Principal branch (branch number)
186 # ; # Contrary to the name this is the default branch.
187 variable mydependencies {} ; # Dictionary parent -> child, dependency recorder.
188 variable myimported 0 ; # Boolean flag. Set iff rev 1.1 of the file seemingly
189 # ; # was imported instead of added normally.
190 variable myroot {} ; # Revision number of the root revision. Usually '1.1'.
191 # ; # Can be a different number, because of 'cvsadmin -o'.
192 variable mybranches -array {} ; # branch number -> symbol object handling the branch
193 variable mytags -array {} ; # revision number -> list of symbol object for the tags
194 # ; # associated with the revision.
195 variable mysymbols {} ; # Set of symbol names found in this file.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
197 ### TODO ###
198 ### File flag - executable,
199 ### RCS mode info (kb, kkb, ...)
200
201 # # ## ### ##### ######## #############
202 ## Internal methods
203
204 method LookForUnlabeledBranches {branches} {
205 foreach branchrevnr $branches {
206 if {[catch {
207 set branch [$self Rev2Branch $branchrevnr]
208 }]} {
209 set branch [$self AddUnlabeledBranch [rev 2branchnr $branchrevnr]]
210 }
211 # TODO $branch child $branchrevnr - when add-unlabeled has sensible return value
 
 
 
 
 
212 }
213 return
214 }
215
216 method Rev2Branch {revnr} {
@@ -229,10 +266,11 @@
229 log write 1 file "In '$mypath': Branch '$branchnr' named '[$mybranches($branchnr) name]'"
230 log write 1 file "Cannot have second name '$name', ignoring it"
231 return
232 }
233 set branch [sym %AUTO% branch $branchnr [$myproject getsymbol $name]]
 
234 set mybranches($branchnr) $branch
235 return $branch
236 }
237
238 method AddTag {name revnr} {
@@ -271,10 +309,101 @@
271 lappend mydependencies $revnr $next
272 }
273 return
274 }
275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
277 # # ## ### ##### ######## #############
278 ## Configuration
279
280 pragma -hastypeinfo no ; # no type introspection
@@ -287,15 +416,17 @@
287
288 namespace eval ::vc::fossil::import::cvs {
289 namespace export file
290 namespace eval file {
291 # Import not required, already a child namespace.
292 # namespace import vc::fossil::import::cvs::file::rev
293 # namespace import vc::fossil::import::cvs::file::sym
 
 
294 }
295 }
296
297 # # ## ### ##### ######## ############# #####################
298 ## Ready
299
300 package provide vc::fossil::import::cvs::file 1.0
301 return
302
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -19,10 +19,12 @@
19 package require Tcl 8.4 ; # Required runtime.
20 package require snit ; # OO system.
21 package require struct::set ; # Set operations.
22 package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions.
23 package require vc::fossil::import::cvs::file::sym ; # CVS per file symbols.
24 package require vc::tools::trouble ; # Error reporting.
25 package require vc::tools::misc ; # Text formatting
26
27 # # ## ### ##### ######## ############# #####################
28 ##
29
30 snit::type ::vc::fossil::import::cvs::file {
@@ -97,11 +99,11 @@
99 method admindone {} {
100 # We do nothing at the boundary of admin and revision data
101 }
102
103 method def {revnr date author state next branches} {
104 $self RecordBranchCommits $branches
105 $myproject author $author
106
107 if {[info exists myrev($revnr)]} {
108 trouble fatal "File $mypath contains duplicate definitions for revision $revnr."
109 return
@@ -112,10 +114,20 @@
114 RecordBasicDependencies $revnr $next
115 return
116 }
117
118 method defdone {} {
119 # This is all done after the revision tree has been extracted
120 # from the file, before the commit mesages and delta texts are
121 # processed.
122
123 ProcessPrimaryDependencies
124 ProcessBranchDependencies
125 SortBranches
126 ProcessTagDependencies
127 DetermineTheRootRevision
128 return
129 }
130
131 method setdesc {d} {# ignore}
132
133 method extend {revnr commitmsg deltarange} {
@@ -146,11 +158,11 @@
158
159 $rev setcommitmsg $cm
160 $rev settext $deltarange
161
162 if {![rev istrunkrevnr $revnr]} {
163 $rev setbranchname [[$self Rev2Branch $revnr] name]
164 }
165
166 # If this is revision 1.1, we have to determine whether the
167 # file seems to have been created through 'cvs add' instead of
168 # 'cvs import'. This can be done by looking at the un-
@@ -174,43 +186,68 @@
186 method done {} {}
187
188 # # ## ### ##### ######## #############
189 ## State
190
191 variable mypath {} ; # Path of our rcs archive.
192 variable myproject {} ; # Reference to the project object
193 # the file belongs to.
194 variable myrev -array {} ; # Maps revision number to the
195 # associated revision object.
196 variable myrevisions {} ; # Same as myrev, but a list,
197 # giving us the order of
198 # revisions.
199 variable myhead {} ; # Head revision (revision number)
200 variable myprincipal {} ; # Principal branch (branch number).
201 # Contrary to the name this is the
202 # default branch.
203 variable mydependencies {} ; # Dictionary parent -> child,
204 # records primary dependencies.
205 variable myimported 0 ; # Boolean flag. Set if and only if
206 # rev 1.1 of the file seemingly
207 # was imported instead of added
208 # normally.
209 variable myroot {} ; # Reference to the revision object
210 # holding the root revision. Its
211 # number usually is '1.1'. Can be
212 # a different number, because of
213 # gaps created via 'cvsadmin -o'.
214 variable mybranches -array {} ; # Maps branch number to the symbol
215 # object handling the branch.
216 variable mytags -array {} ; # Maps revision number to the list
217 # of symbol objects for the tags
218 # associated with the revision.
219 variable mysymbols {} ; # Set of the symbol names found in
220 # this file.
221
222 variable mybranchcnt 0 ; # Counter for branches, to record their
223 # order of definition. This also defines
224 # their order of creation, which is the
225 # reverse of definition. I.e. a smaller
226 # number means 'Defined earlier', means
227 # 'Created later'.
228
229 ### TODO ###
230 ### File flag - executable,
231 ### RCS mode info (kb, kkb, ...)
232
233 # # ## ### ##### ######## #############
234 ## Internal methods
235
236 method RecordBranchCommits {branches} {
237 foreach branchrevnr $branches {
238 if {[catch {
239 set branch [$self Rev2Branch $branchrevnr]
240 }]} {
241 set branch [$self AddUnlabeledBranch [rev 2branchnr $branchrevnr]]
242 }
243
244 # Record the commit, just as revision number for
245 # now. ProcesBranchDependencies will extend that ito a
246 # proper object reference.
247
248 $branch setchildrevnr $branchrevnr
249 }
250 return
251 }
252
253 method Rev2Branch {revnr} {
@@ -229,10 +266,11 @@
266 log write 1 file "In '$mypath': Branch '$branchnr' named '[$mybranches($branchnr) name]'"
267 log write 1 file "Cannot have second name '$name', ignoring it"
268 return
269 }
270 set branch [sym %AUTO% branch $branchnr [$myproject getsymbol $name]]
271 $branch setposition [incr mybranchcnt]
272 set mybranches($branchnr) $branch
273 return $branch
274 }
275
276 method AddTag {name revnr} {
@@ -271,10 +309,101 @@
309 lappend mydependencies $revnr $next
310 }
311 return
312 }
313
314 proc ProcessPrimaryDependencies {} {
315 upvar 1 mydependencies mydependencies myrev myrev
316
317 foreach {parentrevnr childrevnr} $mydependencies {
318 set parent $myrev($parentrevnr)
319 set child $myrev($childrevnr)
320 $parent setchild $child
321 $child setparent $parent
322 }
323 return
324 }
325
326 proc ProcessBranchDependencies {} {
327 upvar 1 mybranches mybranches myrev myrev
328
329 foreach {branchnr branch} [array get mybranches] {
330 set revnr [$branch parentrevnr]
331
332 if {![info exists myrev($revnr)]} {
333 log write 1 file "In '$mypath': The branch '[$branch name]' references"
334 log write 1 file "the bogus revision '$revnr' and will be ignored."
335 $branch destroy
336 unset mybranches($branchnr)
337 } else {
338 set rev $myrev($revnr)
339 $rev addbranch $branch
340
341 # If revisions were committed on the branch we store a
342 # reference to the branch there, and further declare
343 # the first child's parent to be branch's parent, and
344 # list this child in the parent revision.
345
346 if {[$branch haschild]} {
347 set childrevnr [$branch childrevnr]
348 set child $myrev($childrevnr)
349
350 $child setparentbranch $branch
351 $child setparent $rev
352 $rev addchildonbranch $child
353 }
354 }
355 }
356 return
357 }
358
359 proc SortBranches {} {
360 upvar 1 myrev myrev
361
362 foreach {revnr rev} [array get myrev] {
363 $rev sortbranches
364 }
365 return
366 }
367
368 proc ProcessTagDependencies {} {
369 upvar 1 mytags mytags myrev myrev
370
371 foreach {revnr taglist} [array get mytags] {
372 if {![info exists myrev($revnr)]} {
373 set n [llength $taglist]
374 log write 1 file "In '$mypath': The following [nsp $n tag] reference"
375 log write 1 file "the bogus revision '$revnr' and will be ignored."
376 foreach tag $taglist {
377 log write 1 file " [$tag name]"
378 $tag destroy
379 }
380 unset mytags($revnr)
381 } else {
382 set rev $myrev($revnr)
383 foreach tag $taglist { $rev addtag $tag }
384 }
385 }
386 return
387 }
388
389 proc DetermineTheRootRevision {} {
390 upvar 1 myrev myrev myroot myroot
391
392 # The root is the one revision which has no parent. By
393 # checking all revisions we ensure that we can detect and
394 # report the case of multiple roots. Without that we could
395 # simply take one revision and follow the parent links to
396 # their root (sic!).
397
398 foreach {revnr rev} [array get myrev] {
399 if {[$rev hasparent]} continue
400 if {$myroot ne ""} { trouble internal "Multiple root revisions found" }
401 set myroot $rev
402 }
403 return
404 }
405
406 # # ## ### ##### ######## #############
407 ## Configuration
408
409 pragma -hastypeinfo no ; # no type introspection
@@ -287,15 +416,17 @@
416
417 namespace eval ::vc::fossil::import::cvs {
418 namespace export file
419 namespace eval file {
420 # Import not required, already a child namespace.
421 # namespace import ::vc::fossil::import::cvs::file::rev
422 # namespace import ::vc::fossil::import::cvs::file::sym
423 namespace import ::vc::tools::misc::*
424 namespace import ::vc::tools::trouble
425 }
426 }
427
428 # # ## ### ##### ######## ############# #####################
429 ## Ready
430
431 package provide vc::fossil::import::cvs::file 1.0
432 return
433
--- tools/cvs2fossil/lib/c2f_frev.tcl
+++ tools/cvs2fossil/lib/c2f_frev.tcl
@@ -24,42 +24,116 @@
2424
snit::type ::vc::fossil::import::cvs::file::rev {
2525
# # ## ### ##### ######## #############
2626
## Public API
2727
2828
constructor {revnr date author state thefile} {
29
- set myrevnr $revnr
30
- set mydate $date
31
- set myauthor $author
32
- set mystate $state
33
- set myfile $thefile
29
+ set myrevnr $revnr
30
+ set mydate $date
31
+ set myorigdate $date
32
+ set myauthor $author
33
+ set mystate $state
34
+ set myfile $thefile
3435
return
3536
}
37
+
38
+ # Basic pieces ________________________
3639
3740
method hascommitmsg {} { return $myhascm }
3841
39
- method setcommitmsg {cm} {
40
- set mycommitmsg $cm
41
- set myhascm 1
42
+ method setcommitmsg {cm} { set mycommitmsg $cm ; set myhascm 1 ; return }
43
+ method settext {text} { set mytext $text ; return }
44
+ method setbranchname {name} { set mybranchname $name ; return }
45
+
46
+ method revnr {} { return $myrevnr }
47
+
48
+ # Basic parent/child linkage __________
49
+
50
+ method hasparent {} { return [expr {$myparent ne ""}] }
51
+ method haschild {} { return [expr {$mychild ne ""}] }
52
+
53
+ method setparent {parent} {
54
+ if {$myparent ne ""} { trouble internal "Parent already defined" }
55
+ set myparent $parent
56
+ return
57
+ }
58
+
59
+ method setchild {child} {
60
+ if {$mychild ne ""} { trouble internal "Child already defined" }
61
+ set mychild $child
62
+ return
63
+ }
64
+
65
+ method parent {} { return $myparent }
66
+ method child {} { return $mychild }
67
+
68
+ # Branch linkage ______________________
69
+
70
+ method setparentbranch {branch} {
71
+ if {$myparentbranch ne ""} { trouble internal "Branch parent already defined" }
72
+ set myparentbranch $branch
73
+ return
74
+ }
75
+
76
+ method addbranch {branch} {
77
+ lappend mybranches $branch
78
+ #sorted in ascending order by branch number?
79
+ return
80
+ }
81
+
82
+ method addchildonbranch {child} {
83
+ lappend mybranchchildren $child
4284
return
4385
}
4486
45
- method settext {text} {
46
- set mytext $text
87
+ # Tag linkage _________________________
88
+
89
+ method addtag {tag} {
90
+ lappend mytags $tag
4791
return
4892
}
4993
50
- method setbranch {branchnr} {
51
- set mybranchnr $branchnr
94
+ method sortbranches {} {
95
+ if {![llength $mybranches]} return
96
+
97
+ # Sort the branches spawned by this revision in creation
98
+ # order. To help in this our file gave all branches a position
99
+ # id, in order of their definition by the RCS archive.
100
+ #
101
+ # The creation order is (apparently) the reverse of the
102
+ # definition order. (If a branch is created then deleted, a
103
+ # later branch can be assigned the recycled branch number;
104
+ # therefore branch numbers are not an indication of creation
105
+ # order.)
106
+
107
+ set tmp {}
108
+ foreach branch $mybranches {
109
+ lappend tmp [list $branch [$branch position]]
110
+ }
111
+
112
+ set mybranches {}
113
+ foreach item [lsort -index 1 -decreasing $tmp] {
114
+ struct::list assign $item -> branch position
115
+ lappend mybranches $branch
116
+ }
52117
return
53118
}
54119
55120
# # ## ### ##### ######## #############
56121
## Type API
57122
58123
typemethod istrunkrevnr {revnr} {
59124
return [expr {[llength [split $revnr .]] == 2}]
60125
}
126
+
127
+ typemethod isbranchrevnr {revnr _ bv} {
128
+ if {[regexp $mybranchpattern $revnr -> head tail]} {
129
+ upvar 1 $bv branchnr
130
+ set branchnr ${head}$tail
131
+ return 1
132
+ }
133
+ return 0
134
+ }
61135
62136
typemethod 2branchnr {revnr} {
63137
# Input is a branch revision number, i.e. a revision number
64138
# with an even number of components; for example '2.9.2.1'
65139
# (never '2.9.2' nor '2.9.0.2'). The return value is the
@@ -70,17 +144,13 @@
70144
return ""
71145
}
72146
return [join [lrange [split $revnr .] 0 end-1] .]
73147
}
74148
75
- typemethod isbranchrevnr {revnr _ bv} {
76
- if {[regexp $mybranchpattern $revnr -> head tail]} {
77
- upvar 1 $bv branchnr
78
- set branchnr ${head}$tail
79
- return 1
80
- }
81
- return 0
149
+ typemethod 2branchparentrevnr {branchnr} {
150
+ # Chop the last segment off
151
+ return [join [lrange [split $branchnr .] 0 end-1] .]
82152
}
83153
84154
# # ## ### ##### ######## #############
85155
## State
86156
@@ -89,22 +159,61 @@
89159
# CVS then sticks an extra 0 in here; RCS does not.
90160
# And the last digit group.
91161
92162
variable myrevnr {} ; # Revision number of the revision.
93163
variable mydate {} ; # Timestamp of the revision, seconds since epoch
164
+ variable myorigdate {} ; # Original unmodified timestamp.
94165
variable mystate {} ; # State of the revision.
95166
variable myfile {} ; # Ref to the file object the revision belongs to.
96167
variable myhascm 0 ; # Bool flag, set when the commit msg was set.
97168
variable mytext {} ; # Range of the (delta) text for this revision in the file.
98169
99170
# The meta data block used later to group revisions into changesets.
100171
# The project name factors into this as well, but is not stored
101172
# here. The name is acessible via myfile's project.
102173
103
- variable myauthor {} ; # Name of the user who committed the revision.
104
- variable mycommitmsg {} ; # The message entered as part of the commit.
105
- variable mybranchnr {} ; # The number of the branch the commit was done on.
174
+ variable myauthor {} ; # Name of the user who committed the revision.
175
+ variable mycommitmsg {} ; # The message entered as part of the commit.
176
+ variable mybranchname {} ; # The name of the branch the revision was committed on.
177
+
178
+ # Basic parent/child linkage (lines of development)
179
+
180
+ variable myparent {} ; # Ref to parent revision object. Link required because of
181
+ # ; # 'cvsadmin -o', which can create arbitrary gaps in the
182
+ # ; # numbering sequence. This is in the same line of development
183
+ # ; # Note: For the first revision on a branch the revision
184
+ # ; # it was spawned from is the parent. Only the root revision
185
+ # ; # of myfile's revision tree has nothing set here.
186
+ # ; #
187
+
188
+ variable mychild {} ; # Ref to the primary child revision object, i.e. the next
189
+ # ; # revision in the same line of development.
190
+
191
+ # Branch linkage ____________________
192
+
193
+ variable mybranches {} ; # List of the branches (objs) spawned by this revision.
194
+ variable myparentbranch {} ; # For the first revision on a branch the relevant
195
+ # ; # branch object. This also allows us to determine if
196
+ # ; # myparent is in the same LOD, or the revision the
197
+ # ; # branch spawned from.
198
+
199
+ # List of the revision objects of the first commits on any
200
+ # branches spawned by this revision on which commits occurred.
201
+ # This dependency is kept explicitly because otherwise a
202
+ # revision-only topological sort would miss the dependency that
203
+ # exists via -> mybranches.
204
+
205
+ variable mybranchchildren {} ; # List of the revisions (objs) which are the first
206
+ # ; # commits on any of the branches spawned from this
207
+ # ; # revision. The dependency is kept explicitly to
208
+ # ; # ensure that a revision-only topological sort will
209
+ # ; # not miss it, as it otherwise exists only via
210
+ # ; # mybranches.
211
+
212
+ # Tag linkage ________________________
213
+
214
+ variable mytags {} ; # List of tags (objs) associated with this revision.
106215
107216
# # ## ### ##### ######## #############
108217
## Internal methods
109218
110219
# # ## ### ##### ######## #############
111220
--- tools/cvs2fossil/lib/c2f_frev.tcl
+++ tools/cvs2fossil/lib/c2f_frev.tcl
@@ -24,42 +24,116 @@
24 snit::type ::vc::fossil::import::cvs::file::rev {
25 # # ## ### ##### ######## #############
26 ## Public API
27
28 constructor {revnr date author state thefile} {
29 set myrevnr $revnr
30 set mydate $date
31 set myauthor $author
32 set mystate $state
33 set myfile $thefile
 
34 return
35 }
 
 
36
37 method hascommitmsg {} { return $myhascm }
38
39 method setcommitmsg {cm} {
40 set mycommitmsg $cm
41 set myhascm 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42 return
43 }
44
45 method settext {text} {
46 set mytext $text
 
 
47 return
48 }
49
50 method setbranch {branchnr} {
51 set mybranchnr $branchnr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52 return
53 }
54
55 # # ## ### ##### ######## #############
56 ## Type API
57
58 typemethod istrunkrevnr {revnr} {
59 return [expr {[llength [split $revnr .]] == 2}]
60 }
 
 
 
 
 
 
 
 
 
61
62 typemethod 2branchnr {revnr} {
63 # Input is a branch revision number, i.e. a revision number
64 # with an even number of components; for example '2.9.2.1'
65 # (never '2.9.2' nor '2.9.0.2'). The return value is the
@@ -70,17 +144,13 @@
70 return ""
71 }
72 return [join [lrange [split $revnr .] 0 end-1] .]
73 }
74
75 typemethod isbranchrevnr {revnr _ bv} {
76 if {[regexp $mybranchpattern $revnr -> head tail]} {
77 upvar 1 $bv branchnr
78 set branchnr ${head}$tail
79 return 1
80 }
81 return 0
82 }
83
84 # # ## ### ##### ######## #############
85 ## State
86
@@ -89,22 +159,61 @@
89 # CVS then sticks an extra 0 in here; RCS does not.
90 # And the last digit group.
91
92 variable myrevnr {} ; # Revision number of the revision.
93 variable mydate {} ; # Timestamp of the revision, seconds since epoch
 
94 variable mystate {} ; # State of the revision.
95 variable myfile {} ; # Ref to the file object the revision belongs to.
96 variable myhascm 0 ; # Bool flag, set when the commit msg was set.
97 variable mytext {} ; # Range of the (delta) text for this revision in the file.
98
99 # The meta data block used later to group revisions into changesets.
100 # The project name factors into this as well, but is not stored
101 # here. The name is acessible via myfile's project.
102
103 variable myauthor {} ; # Name of the user who committed the revision.
104 variable mycommitmsg {} ; # The message entered as part of the commit.
105 variable mybranchnr {} ; # The number of the branch the commit was done on.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
107 # # ## ### ##### ######## #############
108 ## Internal methods
109
110 # # ## ### ##### ######## #############
111
--- tools/cvs2fossil/lib/c2f_frev.tcl
+++ tools/cvs2fossil/lib/c2f_frev.tcl
@@ -24,42 +24,116 @@
24 snit::type ::vc::fossil::import::cvs::file::rev {
25 # # ## ### ##### ######## #############
26 ## Public API
27
28 constructor {revnr date author state thefile} {
29 set myrevnr $revnr
30 set mydate $date
31 set myorigdate $date
32 set myauthor $author
33 set mystate $state
34 set myfile $thefile
35 return
36 }
37
38 # Basic pieces ________________________
39
40 method hascommitmsg {} { return $myhascm }
41
42 method setcommitmsg {cm} { set mycommitmsg $cm ; set myhascm 1 ; return }
43 method settext {text} { set mytext $text ; return }
44 method setbranchname {name} { set mybranchname $name ; return }
45
46 method revnr {} { return $myrevnr }
47
48 # Basic parent/child linkage __________
49
50 method hasparent {} { return [expr {$myparent ne ""}] }
51 method haschild {} { return [expr {$mychild ne ""}] }
52
53 method setparent {parent} {
54 if {$myparent ne ""} { trouble internal "Parent already defined" }
55 set myparent $parent
56 return
57 }
58
59 method setchild {child} {
60 if {$mychild ne ""} { trouble internal "Child already defined" }
61 set mychild $child
62 return
63 }
64
65 method parent {} { return $myparent }
66 method child {} { return $mychild }
67
68 # Branch linkage ______________________
69
70 method setparentbranch {branch} {
71 if {$myparentbranch ne ""} { trouble internal "Branch parent already defined" }
72 set myparentbranch $branch
73 return
74 }
75
76 method addbranch {branch} {
77 lappend mybranches $branch
78 #sorted in ascending order by branch number?
79 return
80 }
81
82 method addchildonbranch {child} {
83 lappend mybranchchildren $child
84 return
85 }
86
87 # Tag linkage _________________________
88
89 method addtag {tag} {
90 lappend mytags $tag
91 return
92 }
93
94 method sortbranches {} {
95 if {![llength $mybranches]} return
96
97 # Sort the branches spawned by this revision in creation
98 # order. To help in this our file gave all branches a position
99 # id, in order of their definition by the RCS archive.
100 #
101 # The creation order is (apparently) the reverse of the
102 # definition order. (If a branch is created then deleted, a
103 # later branch can be assigned the recycled branch number;
104 # therefore branch numbers are not an indication of creation
105 # order.)
106
107 set tmp {}
108 foreach branch $mybranches {
109 lappend tmp [list $branch [$branch position]]
110 }
111
112 set mybranches {}
113 foreach item [lsort -index 1 -decreasing $tmp] {
114 struct::list assign $item -> branch position
115 lappend mybranches $branch
116 }
117 return
118 }
119
120 # # ## ### ##### ######## #############
121 ## Type API
122
123 typemethod istrunkrevnr {revnr} {
124 return [expr {[llength [split $revnr .]] == 2}]
125 }
126
127 typemethod isbranchrevnr {revnr _ bv} {
128 if {[regexp $mybranchpattern $revnr -> head tail]} {
129 upvar 1 $bv branchnr
130 set branchnr ${head}$tail
131 return 1
132 }
133 return 0
134 }
135
136 typemethod 2branchnr {revnr} {
137 # Input is a branch revision number, i.e. a revision number
138 # with an even number of components; for example '2.9.2.1'
139 # (never '2.9.2' nor '2.9.0.2'). The return value is the
@@ -70,17 +144,13 @@
144 return ""
145 }
146 return [join [lrange [split $revnr .] 0 end-1] .]
147 }
148
149 typemethod 2branchparentrevnr {branchnr} {
150 # Chop the last segment off
151 return [join [lrange [split $branchnr .] 0 end-1] .]
 
 
 
 
152 }
153
154 # # ## ### ##### ######## #############
155 ## State
156
@@ -89,22 +159,61 @@
159 # CVS then sticks an extra 0 in here; RCS does not.
160 # And the last digit group.
161
162 variable myrevnr {} ; # Revision number of the revision.
163 variable mydate {} ; # Timestamp of the revision, seconds since epoch
164 variable myorigdate {} ; # Original unmodified timestamp.
165 variable mystate {} ; # State of the revision.
166 variable myfile {} ; # Ref to the file object the revision belongs to.
167 variable myhascm 0 ; # Bool flag, set when the commit msg was set.
168 variable mytext {} ; # Range of the (delta) text for this revision in the file.
169
170 # The meta data block used later to group revisions into changesets.
171 # The project name factors into this as well, but is not stored
172 # here. The name is acessible via myfile's project.
173
174 variable myauthor {} ; # Name of the user who committed the revision.
175 variable mycommitmsg {} ; # The message entered as part of the commit.
176 variable mybranchname {} ; # The name of the branch the revision was committed on.
177
178 # Basic parent/child linkage (lines of development)
179
180 variable myparent {} ; # Ref to parent revision object. Link required because of
181 # ; # 'cvsadmin -o', which can create arbitrary gaps in the
182 # ; # numbering sequence. This is in the same line of development
183 # ; # Note: For the first revision on a branch the revision
184 # ; # it was spawned from is the parent. Only the root revision
185 # ; # of myfile's revision tree has nothing set here.
186 # ; #
187
188 variable mychild {} ; # Ref to the primary child revision object, i.e. the next
189 # ; # revision in the same line of development.
190
191 # Branch linkage ____________________
192
193 variable mybranches {} ; # List of the branches (objs) spawned by this revision.
194 variable myparentbranch {} ; # For the first revision on a branch the relevant
195 # ; # branch object. This also allows us to determine if
196 # ; # myparent is in the same LOD, or the revision the
197 # ; # branch spawned from.
198
199 # List of the revision objects of the first commits on any
200 # branches spawned by this revision on which commits occurred.
201 # This dependency is kept explicitly because otherwise a
202 # revision-only topological sort would miss the dependency that
203 # exists via -> mybranches.
204
205 variable mybranchchildren {} ; # List of the revisions (objs) which are the first
206 # ; # commits on any of the branches spawned from this
207 # ; # revision. The dependency is kept explicitly to
208 # ; # ensure that a revision-only topological sort will
209 # ; # not miss it, as it otherwise exists only via
210 # ; # mybranches.
211
212 # Tag linkage ________________________
213
214 variable mytags {} ; # List of tags (objs) associated with this revision.
215
216 # # ## ### ##### ######## #############
217 ## Internal methods
218
219 # # ## ### ##### ######## #############
220
--- tools/cvs2fossil/lib/c2f_fsym.tcl
+++ tools/cvs2fossil/lib/c2f_fsym.tcl
@@ -15,10 +15,12 @@
1515
# # ## ### ##### ######## ############# #####################
1616
## Requirements
1717
1818
package require Tcl 8.4 ; # Required runtime.
1919
package require snit ; # OO system.
20
+package require vc::tools::trouble ; # Error reporting.
21
+package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions.
2022
2123
# # ## ### ##### ######## ############# #####################
2224
##
2325
2426
snit::type ::vc::fossil::import::cvs::file::sym {
@@ -27,24 +29,86 @@
2729
2830
constructor {symtype nr symbol} {
2931
set mytype $symtype
3032
set mynr $nr
3133
set mysymbol $symbol
34
+
35
+ switch -exact -- $mytype {
36
+ branch { SetupBranch }
37
+ tag { }
38
+ default { trouble internal "Bad symbol type '$mytype'" }
39
+ }
40
+ return
41
+ }
42
+
43
+ # Symbol acessor methods.
44
+
45
+ delegate method name to mysymbol
46
+
47
+ # Branch acessor methods.
48
+
49
+ method setchildrevnr {revnr} {
50
+ if {$mybranchchildrevnr ne ""} { trouble internal "Child already defined" }
51
+ set mybranchchildrevnr $revnr
3252
return
3353
}
3454
35
- delegate method name to mysymbol
55
+ method setposition {n} { set mybranchposition $n }
56
+
57
+ method branchnr {} { return $mynr }
58
+ method parentrevnr {} { return $mybranchparentrevnr }
59
+ method childrevnr {} { return $mybranchchildrevnr }
60
+
61
+ method haschild {} { return [expr {$mybranchchildrevnr ne ""}] }
62
+ method child {} { return $mybranchchild }
63
+
64
+ method position {} { return $mybranchposition }
65
+
66
+ # Tag acessor methods.
67
+
68
+ method tagrevnr {} { return $mynr }
3669
3770
# # ## ### ##### ######## #############
3871
## State
72
+
73
+ ## Basic, all symbols _________________
3974
4075
variable mytype {} ; # Symbol type, 'tag', or 'branch'.
41
- variable mynr {} ; # Revision number of a 'tag', branch number of a 'branch'.
42
- variable mysymbol {} ; # Ref to symbol object at project level.
76
+ variable mynr {} ; # Revision number of a 'tag', branch number
77
+ # of a 'branch'.
78
+ variable mysymbol {} ; # Reference to the symbol object of this
79
+ # symbol at the project level.
80
+
81
+ ## Branch symbols _____________________
82
+
83
+ variable mybranchparentrevnr {} ; # The number of the parent
84
+ # revision, derived from our
85
+ # branch number (mynr).
86
+ variable mybranchparent {} ; # Reference to the revision
87
+ # (object) which spawns the
88
+ # branch.
89
+ variable mybranchchildrevnr {} ; # Number of the first revision
90
+ # committed on this branch.
91
+ variable mybranchchild {} ; # Reference to the revision
92
+ # (object) first committed on
93
+ # this branch.
94
+ variable mybranchposition {} ; # Relative id of the branch in
95
+ # the file, to sort into
96
+ # creation order.
97
+
98
+ ## Tag symbols ________________________
99
+
100
+ # ... nothing special ... (only mynr, see basic)
43101
44102
# # ## ### ##### ######## #############
45103
## Internal methods
104
+
105
+ proc SetupBranch {} {
106
+ upvar 1 mybranchparentrevnr mybranchparentrevnr mynr mynr
107
+ set mybranchparentrevnr [rev 2branchparentrevnr $mynr]
108
+ return
109
+ }
46110
47111
# # ## ### ##### ######## #############
48112
## Configuration
49113
50114
pragma -hastypeinfo no ; # no type introspection
@@ -54,12 +118,16 @@
54118
# # ## ### ##### ######## #############
55119
}
56120
57121
namespace eval ::vc::fossil::import::cvs::file {
58122
namespace export sym
123
+ namespace eval sym {
124
+ namespace import ::vc::fossil::import::cvs::file::rev
125
+ namespace import ::vc::tools::trouble
126
+ }
59127
}
60128
61129
# # ## ### ##### ######## ############# #####################
62130
## Ready
63131
64132
package provide vc::fossil::import::cvs::file::sym 1.0
65133
return
66134
--- tools/cvs2fossil/lib/c2f_fsym.tcl
+++ tools/cvs2fossil/lib/c2f_fsym.tcl
@@ -15,10 +15,12 @@
15 # # ## ### ##### ######## ############# #####################
16 ## Requirements
17
18 package require Tcl 8.4 ; # Required runtime.
19 package require snit ; # OO system.
 
 
20
21 # # ## ### ##### ######## ############# #####################
22 ##
23
24 snit::type ::vc::fossil::import::cvs::file::sym {
@@ -27,24 +29,86 @@
27
28 constructor {symtype nr symbol} {
29 set mytype $symtype
30 set mynr $nr
31 set mysymbol $symbol
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32 return
33 }
34
35 delegate method name to mysymbol
 
 
 
 
 
 
 
 
 
 
 
 
 
36
37 # # ## ### ##### ######## #############
38 ## State
 
 
39
40 variable mytype {} ; # Symbol type, 'tag', or 'branch'.
41 variable mynr {} ; # Revision number of a 'tag', branch number of a 'branch'.
42 variable mysymbol {} ; # Ref to symbol object at project level.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
44 # # ## ### ##### ######## #############
45 ## Internal methods
 
 
 
 
 
 
46
47 # # ## ### ##### ######## #############
48 ## Configuration
49
50 pragma -hastypeinfo no ; # no type introspection
@@ -54,12 +118,16 @@
54 # # ## ### ##### ######## #############
55 }
56
57 namespace eval ::vc::fossil::import::cvs::file {
58 namespace export sym
 
 
 
 
59 }
60
61 # # ## ### ##### ######## ############# #####################
62 ## Ready
63
64 package provide vc::fossil::import::cvs::file::sym 1.0
65 return
66
--- tools/cvs2fossil/lib/c2f_fsym.tcl
+++ tools/cvs2fossil/lib/c2f_fsym.tcl
@@ -15,10 +15,12 @@
15 # # ## ### ##### ######## ############# #####################
16 ## Requirements
17
18 package require Tcl 8.4 ; # Required runtime.
19 package require snit ; # OO system.
20 package require vc::tools::trouble ; # Error reporting.
21 package require vc::fossil::import::cvs::file::rev ; # CVS per file revisions.
22
23 # # ## ### ##### ######## ############# #####################
24 ##
25
26 snit::type ::vc::fossil::import::cvs::file::sym {
@@ -27,24 +29,86 @@
29
30 constructor {symtype nr symbol} {
31 set mytype $symtype
32 set mynr $nr
33 set mysymbol $symbol
34
35 switch -exact -- $mytype {
36 branch { SetupBranch }
37 tag { }
38 default { trouble internal "Bad symbol type '$mytype'" }
39 }
40 return
41 }
42
43 # Symbol acessor methods.
44
45 delegate method name to mysymbol
46
47 # Branch acessor methods.
48
49 method setchildrevnr {revnr} {
50 if {$mybranchchildrevnr ne ""} { trouble internal "Child already defined" }
51 set mybranchchildrevnr $revnr
52 return
53 }
54
55 method setposition {n} { set mybranchposition $n }
56
57 method branchnr {} { return $mynr }
58 method parentrevnr {} { return $mybranchparentrevnr }
59 method childrevnr {} { return $mybranchchildrevnr }
60
61 method haschild {} { return [expr {$mybranchchildrevnr ne ""}] }
62 method child {} { return $mybranchchild }
63
64 method position {} { return $mybranchposition }
65
66 # Tag acessor methods.
67
68 method tagrevnr {} { return $mynr }
69
70 # # ## ### ##### ######## #############
71 ## State
72
73 ## Basic, all symbols _________________
74
75 variable mytype {} ; # Symbol type, 'tag', or 'branch'.
76 variable mynr {} ; # Revision number of a 'tag', branch number
77 # of a 'branch'.
78 variable mysymbol {} ; # Reference to the symbol object of this
79 # symbol at the project level.
80
81 ## Branch symbols _____________________
82
83 variable mybranchparentrevnr {} ; # The number of the parent
84 # revision, derived from our
85 # branch number (mynr).
86 variable mybranchparent {} ; # Reference to the revision
87 # (object) which spawns the
88 # branch.
89 variable mybranchchildrevnr {} ; # Number of the first revision
90 # committed on this branch.
91 variable mybranchchild {} ; # Reference to the revision
92 # (object) first committed on
93 # this branch.
94 variable mybranchposition {} ; # Relative id of the branch in
95 # the file, to sort into
96 # creation order.
97
98 ## Tag symbols ________________________
99
100 # ... nothing special ... (only mynr, see basic)
101
102 # # ## ### ##### ######## #############
103 ## Internal methods
104
105 proc SetupBranch {} {
106 upvar 1 mybranchparentrevnr mybranchparentrevnr mynr mynr
107 set mybranchparentrevnr [rev 2branchparentrevnr $mynr]
108 return
109 }
110
111 # # ## ### ##### ######## #############
112 ## Configuration
113
114 pragma -hastypeinfo no ; # no type introspection
@@ -54,12 +118,16 @@
118 # # ## ### ##### ######## #############
119 }
120
121 namespace eval ::vc::fossil::import::cvs::file {
122 namespace export sym
123 namespace eval sym {
124 namespace import ::vc::fossil::import::cvs::file::rev
125 namespace import ::vc::tools::trouble
126 }
127 }
128
129 # # ## ### ##### ######## ############# #####################
130 ## Ready
131
132 package provide vc::fossil::import::cvs::file::sym 1.0
133 return
134

Keyboard Shortcuts

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