Diff
Not logged in

Differences From:

File tools/lib/fossil.tcl part of check-in [00228d1547] - Continuing namespace changes, cvs frontend. by aku on 2007-09-13 06:22:29. [view]

To:

File tools/lib/fossil.tcl part of check-in [cdf5e6d8b7] - Encapsulated access to the fossil and cvs applications in their own packages. by aku on 2007-09-13 06:59:24. [view]

@@ -4,13 +4,16 @@
 # -----------------------------------------------------------------------------
 # Requirements
 
 package require Tcl 8.4
-package require vc::tools::log ; # User feedback
+package require vc::tools::log  ; # User feedback
+package require vc::fossil::cmd ; # Access to fossil application.
 
 namespace eval ::vc::fossil::ws {
     vc::tools::log::system fossil
     namespace import ::vc::tools::log::write
+    namespace import ::vc::fossil::cmd::do
+    namespace import ::vc::fossil::cmd::dova
 }
 
 # -----------------------------------------------------------------------------
 # API
@@ -18,13 +21,12 @@
 # Define repository file, and connect to workspace in CWD.
 
 proc ::vc::fossil::ws::new {} {
     variable fr     [file normalize [fileutil::tempfile import2_fsl_rp_]]
-    variable fossil
 
     # pwd = workspace
-    exec $fossil new  $fr ; # create and
-    exec $fossil open $fr ; # connect
+    dova new  $fr ; # create and
+    dova open $fr ; # connect
 
     write 0 fossil "Repository: $fr"
 
     return $fr
@@ -41,11 +43,8 @@
 namespace eval ::vc::fossil::ws {
     # Repository file
     variable fr {}
 
-    # Fossil application
-    variable fossil [auto_execok fossil]
-
     # Debug the commit command (write a Tcl script containing the
     # exact command used). And the file the data goes to.
     variable debugcommit 0
     variable dcfile      {}
@@ -59,9 +58,8 @@
     return
 }
 
 proc ::vc::fossil::ws::commit {break appname nosign meta ignore} {
-    variable fossil
     variable lastuuid
     variable debugcommit
     variable dcfile
 
@@ -76,14 +74,14 @@
     set added   0
     set removed 0
     set changed 0
 
-    foreach line [split [exec $fossil changes] \n] {
+    foreach line [split [dova changes] \n] {
 	regsub {^\s*EDITED\s*} $line {} path
 	if {[IGNORE $ignore $path]} continue
 
 	if {![file exists $path]} {
-	    exec $fossil rm $path
+	    dova rm $path
 	    incr removed
 	    write 2 fossil "-  $path"
 	} else {
 	    incr changed
@@ -92,11 +90,11 @@
     }
 
     # Now look for unregistered added files.
 
-    foreach path [split [exec $fossil extra] \n] {
+    foreach path [split [dova extra] \n] {
 	if {[IGNORE $ignore $path]} continue
-	exec $fossil add $path
+	dova add $path
 	incr added
 	write 2 fossil "+  $path"
     }
 
@@ -109,23 +107,20 @@
 			   "-- Originally by $user @ $tstamp" \
 			   "-- Imported by $appname" \
 			   $message] \n]
 
-    if {$nosign} {
-	set cmd [list exec $fossil commit -m $message --nosign]
-    } else {
-	set cmd [list exec $fossil commit -m $message]
-    }
+    set cmd [list commit -m $message]
+    if {$nosign} { lappend cmd --nosign }
 
     if {$debugcommit} {
-	fileutil::writeFile $dcfile "\#!tclsh\n$cmd\n"
+	fileutil::writeFile $dcfile "$cmd\n"
     }
 
     # Stop, do not actually commit.
     if {$break} return
 
     if {[catch {
-	eval $cmd
+	do $cmd
     } line]} {
 	if {![string match "*nothing has changed*" $line]} {
 	    return -code error $line
 	}