Diff
Not logged in

Differences From:

File tools/cvs2fossil/lib/c2f_frev.tcl part of check-in [b679ca3356] - Code cleanup. Removed trailing whitespace across the board. by aku on 2007-11-25 07:54:09. [view]

To:

File tools/cvs2fossil/lib/c2f_frev.tcl part of check-in [47d52d1efd] - Added convenience method for assertions and used it in place of the existing if/trouble internal constructions. Changed API of 'log write' so that we can defer substituation of the message to when the write actually happen, and converted all places which would be hit by double-substitution. The remaining 'log write' calls will be converted incrementally. by aku on 2007-11-28 05:39:49. [view]

@@ -18,8 +18,9 @@
 package require Tcl 8.4                             ; # Required runtime.
 package require snit                                ; # OO system.
 package require vc::tools::misc                     ; # Text formatting
 package require vc::fossil::import::cvs::state      ; # State storage.
+package require vc::fossil::import::cvs::integrity  ; # State integrity checks.
 
 # # ## ### ##### ######## ############# #####################
 ##
 
@@ -120,9 +121,9 @@
     method hasparent {} { return [expr {$myparent ne ""}] }
     method haschild  {} { return [expr {$mychild  ne ""}] }
 
     method setparent {parent} {
-	if {$myparent ne ""} { trouble internal "Parent already defined" }
+	integrity assert {$myparent eq ""} {Parent already defined}
 	set myparent $parent
 	return
     }
 
@@ -129,9 +130,9 @@
     method cutfromparent {} { set myparent "" ; return }
     method cutfromchild  {} { set mychild  "" ; return }
 
     method setchild {child} {
-	if {$mychild ne ""} { trouble internal "Child already defined" }
+	integrity assert {$mychild eq ""} {Child already defined}
 	set mychild $child
 	return
     }
 
@@ -143,9 +144,9 @@
 
     # Branch linkage ______________________
 
     method setparentbranch {branch} {
-	if {$myparentbranch ne ""} { trouble internal "Branch parent already defined" }
+	integrity assert {$myparentbranch eq ""} {Branch parent already defined}
 	set myparentbranch $branch
 	return
     }
 
@@ -520,8 +521,9 @@
     namespace export rev
     namespace eval rev {
 	namespace import ::vc::tools::misc::*
 	namespace import ::vc::fossil::import::cvs::state
+	namespace import ::vc::fossil::import::cvs::integrity
     }
 }
 
 # # ## ### ##### ######## ############# #####################