Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_repository.tcl part of check-in [3bde1a2e2f] - Added new option --trunk-only, state and processing. by aku on 2007-10-17 03:09:58. [view]

To:

File tools/cvs2fossil/lib/c2f_repository.tcl part of check-in [cfe4b269ac] - Added detection of irrelevant trunk revisions for files added to a branch but not the trunk. Repository extended to keep inverted indices for the meta data and commit messages for retrieval of commit messages per meta data, required for the previous. fixed problem with file objects, we kept only the rcs path, and need the user visible path too. by aku on 2007-10-17 04:37:05. [view]

@@ -84,10 +84,11 @@
     }
 
     typemethod defcmessage {cm} {
 	if {![info exists mycmsg($cm)]} {
-	    set mycmsg($cm) [incr mycmsgcnt]
-	    log write 6 repository "cmessage '$cm' =  $mycmsg($cm)"
+	    set mycmsg($cm) [set cid [incr mycmsgcnt]]
+	    set mycmsginv($cid) $cm
+	    log write 6 repository "cmessage '$cm' =  $cid"
 	}
 	return $mycmsg($cm)
     }
 
@@ -102,12 +103,18 @@
 
     typemethod defmeta {pid bid aid cid} {
 	set key [list $pid $bid $aid $cid]
 	if {![info exists mymeta($key)]} {
-	    set mymeta($key) [incr mymetacnt]
+	    set mymeta($key) [set mid [incr mymetacnt]]
+	    set mymetainv($mid) $key
 	    log write 6 repository "meta ($key) =  $mymeta($key)"
 	}
 	return $mymeta($key)
+    }
+
+    typemethod commitmessageof {metaid} {
+	struct::list assign $mymetainv($metaid) pid bid aid cid
+	return $mycmsginv($cid)
     }
 
     # pass I results
     typemethod printstatistics {} {
@@ -204,32 +211,33 @@
 
     # # ## ### ##### ######## #############
     ## 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,
-				      # maps to their ids.
-    typevariable myauthorcnt     0  ; # Counter for author ids.
-    typevariable mycmsg   -array {} ; # All commit messages found,
-				      # maps to their ids.
-    typevariable mycmsgcnt       0  ; # Counter for message ids.
-    typevariable mymeta   -array {} ; # Maps all meta data tuples
-				      # (project, branch, author,
-				      # cmessage) to their ids.
-    typevariable mymetacnt       0  ; # Counter for meta ids.
-    typevariable mysymbol -array {} ; # 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
+    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,
+				       # maps to their ids.
+    typevariable myauthorcnt      0  ; # Counter for author ids.
+    typevariable mycmsg    -array {} ; # 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
+				       # (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
+				       # 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