Check-in [da9295c6f6]
Not logged in
Overview

SHA1 Hash:da9295c6f6966abf518c0d261900bebdcbcfd4fa
Date: 2007-10-12 07:18:27
User: aku
Comment:Continued to flesh out revision and symbol processing. Started on the project level classses.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/cvs2fossil/lib/c2f_file.tcl from [a86b5d4424] to [00ef0cca21].

@@ -18,10 +18,11 @@
 
 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 {
@@ -37,24 +38,10 @@
     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}
@@ -119,11 +106,11 @@
 	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
     }
 
@@ -153,10 +140,14 @@
 	# 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
@@ -231,23 +222,17 @@
 	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 ]
-	#TODO set tag [sym %AUTO% branch $sym $branchnr]
+	set branch [sym %AUTO% branch $branchnr [$myproject getsymbol $name]]
 	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} {
@@ -297,13 +282,14 @@
 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

Modified tools/cvs2fossil/lib/c2f_frev.tcl from [f56084c138] to [867793964e].

@@ -23,30 +23,42 @@
 
 snit::type ::vc::fossil::import::cvs::file::rev {
     # # ## ### ##### ######## #############
     ## Public API
 
-    constructor {date author state thefile} {
+    constructor {revnr date author state thefile} {
+	set myrevnr  $revnr
+	set mydate   $date
+	set myauthor $author
+	set mystate  $state
+	set myfile   $thefile
 	return
     }
 
-    method hascommitmsg {} {
-	# TODO: check that we have the commit message
-	return 0
-    }
+    method hascommitmsg {} { return $myhascm }
 
     method setcommitmsg {cm} {
+	set mycommitmsg $cm
+	set myhascm 1
+	return
     }
 
     method settext {text} {
+	set mytext $text
+	return
+    }
+
+    method setbranch {branchnr} {
+	set mybranchnr $branchnr
+	return
     }
 
     # # ## ### ##### ######## #############
     ## Type API
 
     typemethod istrunkrevnr {revnr} {
-	return [expr {[llength [split $revnr .]] == 1}]
+	return [expr {[llength [split $revnr .]] == 2}]
     }
 
     typemethod 2branchnr {revnr} {
 	# Input is a branch revision number, i.e. a revision number
 	# with an even number of components; for example '2.9.2.1'
@@ -61,11 +73,11 @@
     }
 
     typemethod isbranchrevnr {revnr _ bv} {
 	if {[regexp $mybranchpattern $revnr -> head tail]} {
 	    upvar 1 $bv branchnr
-	    set branchnr ${head}.$tail
+	    set branchnr ${head}$tail
 	    return 1
 	}
 	return 0
     }
 
@@ -75,19 +87,33 @@
     typevariable mybranchpattern {^((?:\d+\.\d+\.)+)(?:0\.)?(\d+)$}
     # First a nonzero even number of digit groups with trailing dot
     # CVS then sticks an extra 0 in here; RCS does not.
     # And the last digit group.
 
+    variable myrevnr     {} ; # Revision number of the revision.
+    variable mydate      {} ; # Timestamp of the revision, seconds since epoch
+    variable mystate     {} ; # State of the revision.
+    variable myfile      {} ; # Ref to the file object the revision belongs to.
+    variable myhascm     0  ; # Bool flag, set when the commit msg was set.
+    variable mytext      {} ; # Range of the (delta) text for this revision in the file.
+
+    # The meta data block used later to group revisions into changesets.
+    # The project name factors into this as well, but is not stored
+    # here. The name is acessible via myfile's project.
+
+    variable myauthor    {} ; # Name of the user who committed the revision.
+    variable mycommitmsg {} ; # The message entered as part of the commit.
+    variable mybranchnr  {} ; # The number of the branch the commit was done on.
+
     # # ## ### ##### ######## #############
     ## Internal methods
 
     # # ## ### ##### ######## #############
     ## Configuration
 
     pragma -hastypeinfo    no  ; # no type introspection
     pragma -hasinfo        no  ; # no object introspection
-    #pragma -hastypemethods no  ; # type is not relevant.
     pragma -simpledispatch yes ; # simple fast dispatch
 
     # # ## ### ##### ######## #############
 }
 

Modified tools/cvs2fossil/lib/c2f_fsym.tcl from [3c4c8aa555] to [d0212d4c6d].

@@ -23,16 +23,25 @@
 
 snit::type ::vc::fossil::import::cvs::file::sym {
     # # ## ### ##### ######## #############
     ## Public API
 
-    constructor {} {
+    constructor {symtype nr symbol} {
+	set mytype   $symtype
+	set mynr     $nr
+	set mysymbol $symbol
 	return
     }
 
+    delegate method name to mysymbol
+
     # # ## ### ##### ######## #############
     ## State
+
+    variable mytype   {} ; # Symbol type, 'tag', or 'branch'.
+    variable mynr     {} ; # Revision number of a 'tag', branch number of a 'branch'.
+    variable mysymbol {} ; # Ref to symbol object at project level.
 
     # # ## ### ##### ######## #############
     ## Internal methods
 
     # # ## ### ##### ######## #############
@@ -39,11 +48,10 @@
     ## Configuration
 
     pragma -hastypeinfo    no  ; # no type introspection
     pragma -hasinfo        no  ; # no object introspection
     pragma -hastypemethods no  ; # type is not relevant.
-    pragma -simpledispatch yes ; # simple fast dispatch
 
     # # ## ### ##### ######## #############
 }
 
 namespace eval ::vc::fossil::import::cvs::file {

Modified tools/cvs2fossil/lib/c2f_project.tcl from [642334e74c] to [28c5638d78].

@@ -13,14 +13,15 @@
 ## Project, part of a CVS repository. Multiple instances are possible.
 
 # # ## ### ##### ######## ############# #####################
 ## Requirements
 
-package require Tcl 8.4                          ; # Required runtime.
-package require snit                             ; # OO system.
-package require vc::fossil::import::cvs::file    ; # CVS archive file.
-package require vc::fossil::import::cvs::state   ; # State storage
+package require Tcl 8.4                               ; # Required runtime.
+package require snit                                  ; # OO system.
+package require vc::fossil::import::cvs::file         ; # CVS archive file.
+package require vc::fossil::import::cvs::state        ; # State storage
+package require vc::fossil::import::cvs::project::sym ; # Per project symbols
 
 # # ## ### ##### ######## ############# #####################
 ##
 
 snit::type ::vc::fossil::import::cvs::project {
@@ -54,10 +55,17 @@
 	return [TheFiles]
     }
 
     delegate method author   to myrepository
     delegate method cmessage to myrepository
+
+    method getsymbol {name} {
+	if {![info exists mysymbols($name)]} {
+	    set mysymbols($name) [sym %AUTO% $name]
+	}
+	return $mysymbols($name)
+    }
 
     # pass I persistence
     method persist {} {
 	state transaction {
 	    # Project data first. Required so that we have its id
@@ -94,14 +102,15 @@
     }
 
     # # ## ### ##### ######## #############
     ## State
 
-    variable mybase         {} ; # Project directory
-    variable myfiles -array {} ; # Maps rcs archive to their user files.
-    variable myfobj         {} ; # File objects for the rcs archives
-    variable myrepository   {} ; # Repository the prject belongs to.
+    variable mybase           {} ; # Project directory
+    variable myfiles   -array {} ; # Maps rcs archive to their user files.
+    variable myfobj           {} ; # File objects for the rcs archives
+    variable myrepository     {} ; # Repository the prject belongs to.
+    variable mysymbols -array {} ; # Map symbol names to project-level symbol objects.
 
     # # ## ### ##### ######## #############
     ## Internal methods
 
     proc TheFiles {} {
@@ -134,13 +143,15 @@
 namespace eval ::vc::fossil::import::cvs {
     namespace export project
     namespace eval project {
 	namespace import ::vc::fossil::import::cvs::file
 	namespace import ::vc::fossil::import::cvs::state
+	# Import not required, already a child namespace.
+	# namespace import ::vc::fossil::import::cvs::project::sym
     }
 }
 
 # # ## ### ##### ######## ############# #####################
 ## Ready
 
 package provide vc::fossil::import::cvs::project 1.0
 return

Modified tools/cvs2fossil/lib/c2f_psym.tcl from [6689e28cf0] to [30d811a682].

@@ -23,16 +23,21 @@
 
 snit::type ::vc::fossil::import::cvs::project::sym {
     # # ## ### ##### ######## #############
     ## Public API
 
-    constructor {} {
+    constructor {name} {
+	set myname $name
 	return
     }
 
+    method name {} { return $myname }
+
     # # ## ### ##### ######## #############
     ## State
+
+    variable myname {}
 
     # # ## ### ##### ######## #############
     ## Internal methods
 
     # # ## ### ##### ######## #############