Check-in [8487172254]
Not logged in
Overview

SHA1 Hash:84871722547960bf0dee1f6402dd62dadc177bc8
Date: 2007-10-06 22:06:05
User: aku
Comment:Broke static dependency cycle repository <- project <- file <- repository, now using dynamic/runtime object references instead. This allows us to keep the nice and readable format for our files, code is readable too.
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 [16136c408c] to [79e054b90e].

@@ -16,11 +16,10 @@
 # # ## ### ##### ######## ############# #####################
 ## Requirements
 
 package require Tcl 8.4                             ; # Required runtime.
 package require snit                                ; # OO system.
-package require vc::fossil::import::cvs::repository ; # Repository management.
 
 # # ## ### ##### ######## ############# #####################
 ##
 
 snit::type ::vc::fossil::import::cvs::file {
@@ -95,18 +94,18 @@
     method setcomment {c} {# ignore}
     method setdesc    {d} {# ignore}
 
     method def {rev date author state next branches} {
 	set myrev($rev) [list $date $author $state $next $branches]
-	repository author $author
+	$myproject author $author
 	return
     }
 
     method extend {rev commitmsg deltarange} {
 	set cm [string trim $commitmsg]
 	lappend myrev($rev) $cm $deltarange
-	repository cmessage $cm
+	$myproject cmessage $cm
 	return
     }
 
     # # ## ### ##### ######## #############
     ## State
@@ -128,15 +127,12 @@
     # # ## ### ##### ######## #############
 }
 
 namespace eval ::vc::fossil::import::cvs {
     namespace export file
-    namespace eval file {
-	namespace import ::vc::fossil::import::cvs::repository
-    }
 }
 
 # # ## ### ##### ######## ############# #####################
 ## Ready
 
 package provide vc::fossil::import::cvs::file 1.0
 return

Modified tools/cvs2fossil/lib/c2f_project.tcl from [2149b5a4de] to [642334e74c].

@@ -25,12 +25,13 @@
 
 snit::type ::vc::fossil::import::cvs::project {
     # # ## ### ##### ######## #############
     ## Public API
 
-    constructor {path} {
-	set mybase $path
+    constructor {path r} {
+	set mybase       $path
+	set myrepository $r
 	return
     }
 
     method base {} { return $mybase }
 
@@ -50,10 +51,13 @@
 
     method files {} {
 	# TODO: Loading from state
 	return [TheFiles]
     }
+
+    delegate method author   to myrepository
+    delegate method cmessage to myrepository
 
     # pass I persistence
     method persist {} {
 	state transaction {
 	    # Project data first. Required so that we have its id
@@ -93,10 +97,11 @@
     ## 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.
 
     # # ## ### ##### ######## #############
     ## Internal methods
 
     proc TheFiles {} {
@@ -120,11 +125,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 {

Modified tools/cvs2fossil/lib/c2f_repository.tcl from [dd183de0b5] to [6ab6c1218d].

@@ -19,13 +19,13 @@
 
 package require Tcl 8.4                          ; # Required runtime.
 package require snit                             ; # OO system.
 package require vc::tools::trouble               ; # Error reporting.
 package require vc::tools::log                   ; # User feedback.
-package require vc::tools::misc                  ; # Text formatting
-# CVS Projects later (see bottom) to handle circular dependency in 'file'.
-package require vc::fossil::import::cvs::state   ; # State storage
+package require vc::tools::misc                  ; # Text formatting.
+package require vc::fossil::import::cvs::project ; # CVS projects.
+package require vc::fossil::import::cvs::state   ; # State storage.
 package require struct::list                     ; # List operations.
 package require fileutil                         ; # File operations.
 
 # # ## ### ##### ######## ############# #####################
 ##
@@ -194,28 +194,28 @@
 	}
 	return 1
     }
 
     proc TheProjects {} {
-	upvar 1 myprojects myprojects myprojpaths myprojpaths mybase mybase
+	upvar 1 myprojects myprojects myprojpaths myprojpaths mybase mybase type type
 
 	if {![llength $myprojects]} {
 	    set myprojects [EmptyProjects $myprojpaths]
 	}
 	return $myprojects
     }
 
     proc EmptyProjects {projpaths} {
-	upvar 1 mybase mybase
+	upvar 1 mybase mybase type type
 	set res {}
 	if {[llength $projpaths]} {
 	    foreach pp $projpaths {
-		lappend res [project %AUTO% $pp]
+		lappend res [project %AUTO% $pp $type]
 	    }
 	} else {
 	    # Base is the single project.
-	    lappend res [project %AUTO% ""]
+	    lappend res [project %AUTO% "" $type]
 	}
 	return $res
     }
 
     proc SaveAuthors {} {
@@ -254,25 +254,19 @@
     # # ## ### ##### ######## #############
 }
 
 namespace eval ::vc::fossil::import::cvs {
     namespace export repository
-}
-
-# CVS projects here to handle circular dependency
-# repository <- project <- file <- repository
-
-package require vc::fossil::import::cvs::project
-
-namespace eval ::vc::fossil::import::cvs::repository {
-    namespace import ::vc::fossil::import::cvs::project
-    namespace import ::vc::fossil::import::cvs::state
-    namespace import ::vc::tools::misc::*
-    namespace import ::vc::tools::trouble
-    namespace import ::vc::tools::log
-    log register repository
+    namespace eval repository {
+	namespace import ::vc::fossil::import::cvs::project
+	namespace import ::vc::fossil::import::cvs::state
+	namespace import ::vc::tools::misc::*
+	namespace import ::vc::tools::trouble
+	namespace import ::vc::tools::log
+	log register repository
+    }
 }
 
 # # ## ### ##### ######## ############# #####################
 ## Ready
 
 return