Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_psym.tcl part of check-in [7375ebb988] - Formatting change, code alignment. by aku on 2007-10-25 05:14:20. [view]

To:

File tools/cvs2fossil/lib/c2f_psym.tcl part of check-in [1deb3786aa] - Added saving of the fundamental symbol information (project level). by aku on 2007-10-26 05:28:24. [view]

@@ -14,10 +14,11 @@
 
 # # ## ### ##### ######## ############# #####################
 ## Requirements
 
-package require Tcl 8.4                             ; # Required runtime.
-package require snit                                ; # OO system.
+package require Tcl 8.4                                 ; # Required runtime.
+package require snit                                    ; # OO system.
+package require vc::fossil::import::cvs::state          ; # State storage.
 
 # # ## ### ##### ######## ############# #####################
 ##
 
@@ -24,24 +25,49 @@
 snit::type ::vc::fossil::import::cvs::project::sym {
     # # ## ### ##### ######## #############
     ## Public API
 
-    constructor {name id} {
-	set myname $name
-	set myid   $id
+    constructor {name id project} {
+	set myname    $name
+	set myid      $id
+	set myproject $project
 	return
     }
 
     method name {} { return $myname }
     method id   {} { return $myid   }
 
     # # ## ### ##### ######## #############
+
+    method persistrev {} {
+	set pid [$myproject id]
+
+	# TODO: Compute the various counts. All the necessary
+	# TODO: information is already in the database. Actually it
+	# TODO: never was in memory.
+
+	state transaction {
+	    state run {
+		INSERT INTO symbol ( sid,   pid,  name,   type,     tag_count, branch_count, commit_count)
+		VALUES             ($myid, $pid, $myname, $myundef, 0,         0,            0);
+	    }
+	}
+	return
+    }
+
+    # # ## ### ##### ######## #############
     ## State
 
-    variable myname {} ; # The symbol's name
-    variable myid   {} ; # Repository wide numeric id of the symbol.
-			 # This implicitly encodes the project as
-			 # well.
+    variable myproject {} ; # Reference to the project object
+			    # containing the symbol.
+    variable myname    {} ; # The symbol's name
+    variable myid      {} ; # Repository wide numeric id of the
+			    # symbol. This implicitly encodes the
+			    # project as well.
+
+    typevariable mytag    1 ; # Code for symbols which are tags.
+    typevariable mybranch 2 ; # Code for symbols which are branches.
+    typevariable myundef  3 ; # Code for symbols of unknown type.
 
     # # ## ### ##### ######## #############
     ## Internal methods
 
@@ -57,11 +83,14 @@
 }
 
 namespace eval ::vc::fossil::import::cvs::project {
     namespace export sym
+    namespace eval sym {
+	namespace import ::vc::fossil::import::cvs::state
+    }
 }
 
 # # ## ### ##### ######## ############# #####################
 ## Ready
 
 package provide vc::fossil::import::cvs::project::sym 1.0
 return