Check-in [a5476aed27]
Not logged in
Overview

SHA1 Hash:a5476aed2741947407eed9ea34a57e1d11889a6c
Date: 2007-09-20 03:51:49
User: aku
Comment:Modified sorting of timeline entries for the same second to properly split files and file versions from each other, and to have newer revisions later. Further added a storage for error messages to be repeated when the importer exist. First user is the code reporting corrupted archive files detected during a checkout.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/lib/cvs.tcl from [f05415a767] to [9bc6bc7e05].

@@ -6,10 +6,11 @@
 
 package require Tcl 8.4
 package require fileutil              ; # Tcllib (traverse directory hierarchy)
 package require vc::rcs::parser       ; # Handling the RCS archive files.
 package require vc::tools::log        ; # User feedback
+package require vc::tools::trouble    ; # Error handling
 package require vc::cvs::cmd          ; # Access to cvs application.
 package require vc::cvs::ws::files    ; # Scan CVS repository for relevant files.
 package require vc::cvs::ws::timeline ; # Manage timeline of all changes.
 package require vc::cvs::ws::csets    ; # Manage the changesets found in the timeline
 package require struct::tree
@@ -17,10 +18,12 @@
 namespace eval ::vc::cvs::ws {
     vc::tools::log::system cvs
     namespace import ::vc::tools::log::write
     namespace import ::vc::rcs::parser::process
     namespace import ::vc::cvs::cmd::dova
+
+    namespace eval trouble { namespace import ::vc::tools::trouble::* }
 }
 
 # -----------------------------------------------------------------------------
 # API
 
@@ -354,11 +357,11 @@
 	    # problem, but otherwise ignore it. As a consequence the
 	    # destination repository will not contain the full history
 	    # of the named file. By ignoring the problem we however
 	    # get as much as is possible.
 
-	    write 0 cvs "EE Corrupted archive file. Inaccessible revision."
+	    trouble::add "$f: Corrupted archive file. Inaccessible revision $r."
 	    return
 	}
 	return -code error $msg
     }
     return

Modified tools/lib/cvs_timeline.tcl from [0ce8e923d5] to [09c55e80b2].

@@ -30,16 +30,18 @@
     variable timeline
 
     ::foreach date [lsort -dict [array names timeline]] {
 	# file revision operation author commitmsg
 	# 0    1        2         3      4/end
-	#               b         c      a
+	# d    e        b         c      a
 
-	set entries [lsort -index 3 \
-			 [lsort -index 2 \
-			      [lsort -index end \
-				   $timeline($date)]]]
+	set entries [lsort -index 1 \
+			 [lsort -index 0 \
+			      [lsort -index 3 \
+				   [lsort -index 2 \
+					[lsort -index end \
+					     $timeline($date)]]]]]
 	#puts [join $entries \n]
 
 	::foreach entry $entries {
 	    lassign $entry file revision operation author cmsg
 	    set code [catch {uplevel 1 $script} res]

Modified tools/lib/pkgIndex.tcl from [afaa2715fa] to [48d829569b].

@@ -9,5 +9,6 @@
 package ifneeded vc::fossil::ws            1.0 [list source [file join $dir fossil.tcl]]
 package ifneeded vc::fossil::import::cvs   1.0 [list source [file join $dir importcvs.tcl]]
 package ifneeded vc::fossil::import::stats 1.0 [list source [file join $dir import_statistics.tcl]]
 package ifneeded vc::fossil::import::map   1.0 [list source [file join $dir import_map.tcl]]
 package ifneeded vc::tools::log            1.0 [list source [file join $dir log.tcl]]
+package ifneeded vc::tools::trouble        1.0 [list source [file join $dir trouble.tcl]]

Added tools/lib/trouble.tcl version [a4a0b8a72b]

@@ -1,1 +1,57 @@
+# -----------------------------------------------------------------------------
+# Tool packages. Error reporting.
+
+# -----------------------------------------------------------------------------
+# Requirements
+
+package require Tcl 8.4
+package require vc::tools::log
+
+namespace eval ::vc::tools::trouble {
+    ::vc::tools::log::system trouble
+    namespace import ::vc::tools::log::write
+}
+
+# -----------------------------------------------------------------------------
+# API
+
+# vc::tools::trouble::add message - Report error (shown in general
+#                                   log), and remember for re-display at exit.
+
+# -----------------------------------------------------------------------------
+# API Implementation
+
+proc ::vc::tools::trouble::add {text} {
+    variable messages
+    lappend  messages $text
+    write trouble 0   $text
+    return
+}
+
+# -----------------------------------------------------------------------------
+# Internals. Hook into the application exit, show the remembered messages, then
+# pass through the regular command.
+
+rename ::exit vc::tools::trouble::EXIT
+proc   ::exit {{status 0}} {
+    variable ::vc::tools::trouble::messages
+    foreach m $messages {
+	write trouble 0 $m
+    }
+    ::vc::tools::trouble::EXIT $status
+    # Not reached.
+    return
+}
+
+namespace eval ::vc::tools::trouble {
+    # List of the remembered error messages to be shown at exit
+    variable messages {}
+
+    namespace export add
+}
+
+# -----------------------------------------------------------------------------
+# Ready
 
+package provide vc::tools::trouble 1.0
+return