Check-in [492531e3a8]
Not logged in
Overview

SHA1 Hash:492531e3a86fcc4fb8ac3c56b2efddd2ad244aa4
Date: 2007-09-04 22:00:31
User: aku
Comment:Importer extended to allow capture of exact fossil commit command
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/import-cvs.tcl from [1bdf863b65] to [123e6be7b4].

@@ -89,16 +89,23 @@
 
 
 # -----------------------------------------------------------------------------
 
 proc commandline {} {
-    global argv cvs fossil nosign log
+    global argv cvs fossil nosign log debugcommit
 
     set nosign 0
+    set debugcommit 0
+
     while {[string match "-*" [set opt [lindex $argv 0]]]} {
 	if {$opt eq "--nosign"} {
 	    set nosign 1
+	    set argv [lrange $argv 1 end]
+	    continue
+	}
+	if {$opt eq "--debugcommit"} {
+	    set debugcommit 1
 	    set argv [lrange $argv 1 end]
 	    continue
 	}
 	usage
     }
@@ -114,10 +121,12 @@
     } elseif {[file exists $fossil]} {
 	usage "Fossil destination repository exists already."
     }
 
     set log [open ${fossil}.log w]
+
+    fossil::debugcommit $debugcommit
     return
 }
 
 proc usage {{text {}}} {
     global argv0

Modified tools/lib/fossil.tcl from [64ed240c1f] to [4a2de34bc9].

@@ -45,16 +45,30 @@
     # 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      {}
 }
 
+proc ::fossil::debugcommit {flag} {
+    variable debugcommit $flag
+    if {$debugcommit} {
+	variable dcfile [file normalize cvs2fossil_commit.tcl]
+    }
+    return
+}
 
 proc ::fossil::commit {appname nosign meta ignore} {
     variable fossil
     variable lastuuid
+    variable debugcommit
+    variable dcfile
 
     # Commit the current state of the workspace. Scan for new and
     # removed files and issue the appropriate fossil add/rm commands
     # before actually comitting.
 
@@ -97,16 +111,22 @@
     set message [join [list \
 			   "-- 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]
+    }
+
+    if {$debugcommit} {
+	fileutil::writeFile $dcfile "\#!tclsh\n$cmd\n"
+    }
+
     if {[catch {
-	if {$nosign} {
-	    exec $fossil commit -m $message --nosign
-	} else {
-	    exec $fossil commit -m $message
-	}
+	eval $cmd
     } line]} {
 	if {![string match "*nothing has changed*" $line]} {
 	    return -code error $line
 	}