Diff
Not logged in

Differences From:

File tools/import-cvs.tcl part of check-in [734febe649] - Fix calculating percentage of committed changesets. by aku on 2007-09-05 02:03:31. [view]

To:

File tools/import-cvs.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]

@@ -47,9 +47,9 @@
 
 # -----------------------------------------------------------------------------
 
 proc main {} {
-    global argv tot nto cvs fossil ntrunk
+    global argv tot nto cvs fossil ntrunk stopat
 
     commandline
 
     fossil::feedback Write ; # Setup progress feedback from the libraries
@@ -71,8 +71,9 @@
 
     set ntrunk [cvs::ntrunk]
     cvs::foreach_cset cset [cvs::root] {
 	import $cset
+	if {$stopat == $cset} exit
     }
     cvs::wsclear
 
     Write info "    ========= [string repeat = 61]"
@@ -90,12 +91,13 @@
 
 # -----------------------------------------------------------------------------
 
 proc commandline {} {
-    global argv cvs fossil nosign log debugcommit
+    global argv cvs fossil nosign log debugcommit stopat
 
     set nosign 0
     set debugcommit 0
+    set stopat {}
 
     while {[string match "-*" [set opt [lindex $argv 0]]]} {
 	if {$opt eq "--nosign"} {
 	    set nosign 1
@@ -104,8 +106,13 @@
 	}
 	if {$opt eq "--debugcommit"} {
 	    set debugcommit 1
 	    set argv [lrange $argv 1 end]
+	    continue
+	}
+	if {$opt eq "--stopat"} {
+	    set stopat [lindex $argv 1]
+	    set argv   [lrange $argv 2 end]
 	    continue
 	}
 	usage
     }
@@ -136,14 +143,22 @@
     exit
 }
 
 proc import {cset} {
-    global tot nto nosign ntrunk
+    global tot nto nosign ntrunk stopat
     Write info "    Importing $cset [string repeat = [expr {60 - [string length $cset]}]]"
     Write info "        At $nto/$ntrunk ([format %.2f [expr {$nto*100.0/$ntrunk}]]%)"
 
+    if {$stopat == $cset} {
+	fossil::commit 1 cvs2fossil $nosign \
+	    [cvs::wssetup $cset] \
+	    ::cvs::wsignore
+	Write info "        %% STOP"
+	return
+    }
+
     set usec [lindex [time {
-	foreach {uuid ad rm ch} [fossil::commit cvs2fossil $nosign \
+	foreach {uuid ad rm ch} [fossil::commit 0 cvs2fossil $nosign \
 				     [cvs::wssetup $cset] \
 				     ::cvs::wsignore] break
     } 1] 0]
     cvs::uuid $cset $uuid