Diff
Not logged in

Differences From:

File tools/lib/fossil.tcl part of check-in [8469631cc9] - Extended import app with switch to stop execution just before a specific changeset, to aid in debugging problems. by aku on 2007-09-08 03:48:40. [view]

To:

File tools/lib/fossil.tcl part of check-in [be32ebcb41] - Redid the logging system aka user feedback completely. Verbosity levels, influenced by the new -v switch. Indentations in the output removed, parsing by tools easier, still human readable. Adapted all users of the previous feedback code to use the new system. by aku on 2007-09-08 05:35:02. [view]

@@ -4,10 +4,14 @@
 # -----------------------------------------------------------------------------
 # Requirements
 
 package require Tcl 8.4
-
-namespace eval ::fossil {}
+package require tools::log ; # User feedback
+
+namespace eval ::fossil {
+    tools::log::system fossil
+    namespace import ::tools::log::write
+}
 
 # -----------------------------------------------------------------------------
 # API
 
@@ -20,18 +24,11 @@
     # pwd = workspace
     exec $fossil new  $fr ; # create and
     exec $fossil open $fr ; # connect
 
-    Log info "    Fossil:    $fr"
-
-    return $fr
-}
-
-# Define logging callback command
-
-proc ::fossil::feedback {logcmd} {
-    variable lc $logcmd
-    return
+    write 0 fossil "Repository: $fr"
+
+    return $fr
 }
 
 # Move generated fossil repository to final destination
 
@@ -86,12 +83,12 @@
 
 	if {![file exists $path]} {
 	    exec $fossil rm $path
 	    incr removed
-	    Log info "        ** - $path"
+	    write 2 fossil "-  $path"
 	} else {
 	    incr changed
-	    Log info "        ** * $path"
+	    write 2 fossil "*  $path"
 	}
     }
 
     # Now look for unregistered added files.
@@ -99,9 +96,9 @@
     foreach path [split [exec $fossil extra] \n] {
 	if {[IGNORE $ignore $path]} continue
 	exec $fossil add $path
 	incr added
-	Log info "        ** + $path"
+	write 2 fossil "+  $path"
     }
 
     # Now commit, using the provided meta data, and capture the uuid
     # of the new baseline.
@@ -137,9 +134,9 @@
 	# dead-first revisions of one or more files. For fossil we
 	# re-use the last baseline. TODO: Mark them as branchpoint,
 	# and for what file.
 
-	Log info "        UNCHANGED, keeping last"
+	write 1 fossil "UNCHANGED, keeping last"
 
 	return [list $lastuuid 0 0 0]
     }
 
@@ -154,24 +151,11 @@
 # Internal helper commands
 
 proc ::fossil::IGNORE {ignore path} {
     return [uplevel #0 [linsert $ignore end $path]]
-}
-
-proc ::fossil::Log {level text} {
-    variable lc
-    uplevel #0 [linsert $lc end $level $text]
-    return
-}
-
-proc ::fossil::Nop {args} {}
-
-namespace eval ::fossil {
-    # Logging callback. No logging by default.
-    variable lc ::fossil::Nop
 }
 
 # -----------------------------------------------------------------------------
 # Ready
 
 package provide fossil 1.0
 return