Fossil SCM

Added progress feedback to the file import, and moved the log output to level 8.

aku 2007-12-06 03:54 trunk
Commit 08f8085700fef9944101ad38f239acfb7ad3b192
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -343,15 +343,18 @@
343343
set ac [open $archive r]
344344
fconfigure $ac -translation binary
345345
346346
# First traverse the expansion graph, this gives us the
347347
# revisions in the order we have to expand them, which we do.
348
+
349
+ set max [llength [$ex nodes]]
350
+ set myimport 0
348351
349352
gtcore datacmd [mymethod ExpandData]
350353
gtcore formatcmd [mymethod ExpandFormat]
351354
gtcore sortcmd [mymethod ExpandSort]
352
- gtcore savecmd [mymethod Expand1 $ac $dir]
355
+ gtcore savecmd [mymethod Expand1 $ac $dir $max]
353356
354357
gtcore traverse $ex ; # The graph is gone after the call
355358
close $ac
356359
357360
# Now traverse the import graph, this builds the instruction
@@ -377,11 +380,13 @@
377380
method ExpandSort {graph candidates} {
378381
# candidates = list(item), item = list(node revnr)
379382
# Sort by node and revnr -> Trunk revisions come first.
380383
return [lsort -index 1 -dict [lsort -index 0 -dict $candidates]]
381384
}
382
- method Expand1 {chan dir graph node} {
385
+ method Expand1 {chan dir max graph node} {
386
+ log progress 3 file $myimport $max ; incr myimport
387
+
383388
set revnr [$graph node get $node revnr]
384389
set fname r$revnr
385390
struct::list assign [$graph node get $node text] offset length
386391
387392
if {$length < 0} {
@@ -392,20 +397,20 @@
392397
}
393398
394399
if {![$graph node keyexists $node __base__]} {
395400
# Full text node. Get the data, decode it, and save.
396401
397
- log write 2 file {Expanding <$revnr>, full text}
402
+ log write 8 file {Expanding <$revnr>, full text}
398403
399404
fileutil::writeFile -translation binary $dir/$fname $data
400405
} else {
401406
# Delta node. __base__ is the name of the file containing
402407
# the baseline. The patch is at the specified location of
403408
# the archive file.
404409
405410
set fbase [$graph node get $node __base__]
406
- log write 2 file {Expanding <$revnr>, is delta of <$fbase>}
411
+ log write 8 file {Expanding <$revnr>, is delta of <$fbase>}
407412
408413
set base [fileutil::cat -translation binary $dir/$fbase]
409414
410415
# Writing the patch to disk is just for better
411416
# debugging. It is not used otherwise.
412417
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -343,15 +343,18 @@
343 set ac [open $archive r]
344 fconfigure $ac -translation binary
345
346 # First traverse the expansion graph, this gives us the
347 # revisions in the order we have to expand them, which we do.
 
 
 
348
349 gtcore datacmd [mymethod ExpandData]
350 gtcore formatcmd [mymethod ExpandFormat]
351 gtcore sortcmd [mymethod ExpandSort]
352 gtcore savecmd [mymethod Expand1 $ac $dir]
353
354 gtcore traverse $ex ; # The graph is gone after the call
355 close $ac
356
357 # Now traverse the import graph, this builds the instruction
@@ -377,11 +380,13 @@
377 method ExpandSort {graph candidates} {
378 # candidates = list(item), item = list(node revnr)
379 # Sort by node and revnr -> Trunk revisions come first.
380 return [lsort -index 1 -dict [lsort -index 0 -dict $candidates]]
381 }
382 method Expand1 {chan dir graph node} {
 
 
383 set revnr [$graph node get $node revnr]
384 set fname r$revnr
385 struct::list assign [$graph node get $node text] offset length
386
387 if {$length < 0} {
@@ -392,20 +397,20 @@
392 }
393
394 if {![$graph node keyexists $node __base__]} {
395 # Full text node. Get the data, decode it, and save.
396
397 log write 2 file {Expanding <$revnr>, full text}
398
399 fileutil::writeFile -translation binary $dir/$fname $data
400 } else {
401 # Delta node. __base__ is the name of the file containing
402 # the baseline. The patch is at the specified location of
403 # the archive file.
404
405 set fbase [$graph node get $node __base__]
406 log write 2 file {Expanding <$revnr>, is delta of <$fbase>}
407
408 set base [fileutil::cat -translation binary $dir/$fbase]
409
410 # Writing the patch to disk is just for better
411 # debugging. It is not used otherwise.
412
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -343,15 +343,18 @@
343 set ac [open $archive r]
344 fconfigure $ac -translation binary
345
346 # First traverse the expansion graph, this gives us the
347 # revisions in the order we have to expand them, which we do.
348
349 set max [llength [$ex nodes]]
350 set myimport 0
351
352 gtcore datacmd [mymethod ExpandData]
353 gtcore formatcmd [mymethod ExpandFormat]
354 gtcore sortcmd [mymethod ExpandSort]
355 gtcore savecmd [mymethod Expand1 $ac $dir $max]
356
357 gtcore traverse $ex ; # The graph is gone after the call
358 close $ac
359
360 # Now traverse the import graph, this builds the instruction
@@ -377,11 +380,13 @@
380 method ExpandSort {graph candidates} {
381 # candidates = list(item), item = list(node revnr)
382 # Sort by node and revnr -> Trunk revisions come first.
383 return [lsort -index 1 -dict [lsort -index 0 -dict $candidates]]
384 }
385 method Expand1 {chan dir max graph node} {
386 log progress 3 file $myimport $max ; incr myimport
387
388 set revnr [$graph node get $node revnr]
389 set fname r$revnr
390 struct::list assign [$graph node get $node text] offset length
391
392 if {$length < 0} {
@@ -392,20 +397,20 @@
397 }
398
399 if {![$graph node keyexists $node __base__]} {
400 # Full text node. Get the data, decode it, and save.
401
402 log write 8 file {Expanding <$revnr>, full text}
403
404 fileutil::writeFile -translation binary $dir/$fname $data
405 } else {
406 # Delta node. __base__ is the name of the file containing
407 # the baseline. The patch is at the specified location of
408 # the archive file.
409
410 set fbase [$graph node get $node __base__]
411 log write 8 file {Expanding <$revnr>, is delta of <$fbase>}
412
413 set base [fileutil::cat -translation binary $dir/$fbase]
414
415 # Writing the patch to disk is just for better
416 # debugging. It is not used otherwise.
417
--- tools/cvs2fossil/lib/c2f_fossil.tcl
+++ tools/cvs2fossil/lib/c2f_fossil.tcl
@@ -58,15 +58,21 @@
5858
# add = list ('A', path)
5959
# delta = list ('D', path, src)
6060
6161
array set id {}
6262
$self InWorkspace
63
+
64
+ set n 0
65
+ set max [llength $map]
66
+
6367
foreach insn $map {
68
+ log progress 3 fossil $n $max ; incr n
69
+
6470
struct::list assign $insn cmd pa pb
6571
switch -exact -- $cmd {
6672
A {
67
- log write 2 fossil {Importing <$pa>,}
73
+ log write 8 fossil {Importing <$pa>,}
6874
6975
# Result = 'inserted as record :FOO:'
7076
# 0 1 2 3
7177
set res [Do test-content-put $pa]
7278
integrity assert {
@@ -73,11 +79,11 @@
7379
[regexp {^inserted as record \d+$} $res]
7480
} {Unable to process unexpected fossil output '$res'}
7581
set id($pa) [lindex $res 3]
7682
}
7783
D {
78
- log write 2 fossil {Compressing <$pa>, as delta of <$pb>}
84
+ log write 8 fossil {Compressing <$pa>, as delta of <$pb>}
7985
8086
Do test-content-deltify $id($pa) $id($pb) 1
8187
}
8288
}
8389
}
8490
--- tools/cvs2fossil/lib/c2f_fossil.tcl
+++ tools/cvs2fossil/lib/c2f_fossil.tcl
@@ -58,15 +58,21 @@
58 # add = list ('A', path)
59 # delta = list ('D', path, src)
60
61 array set id {}
62 $self InWorkspace
 
 
 
 
63 foreach insn $map {
 
 
64 struct::list assign $insn cmd pa pb
65 switch -exact -- $cmd {
66 A {
67 log write 2 fossil {Importing <$pa>,}
68
69 # Result = 'inserted as record :FOO:'
70 # 0 1 2 3
71 set res [Do test-content-put $pa]
72 integrity assert {
@@ -73,11 +79,11 @@
73 [regexp {^inserted as record \d+$} $res]
74 } {Unable to process unexpected fossil output '$res'}
75 set id($pa) [lindex $res 3]
76 }
77 D {
78 log write 2 fossil {Compressing <$pa>, as delta of <$pb>}
79
80 Do test-content-deltify $id($pa) $id($pb) 1
81 }
82 }
83 }
84
--- tools/cvs2fossil/lib/c2f_fossil.tcl
+++ tools/cvs2fossil/lib/c2f_fossil.tcl
@@ -58,15 +58,21 @@
58 # add = list ('A', path)
59 # delta = list ('D', path, src)
60
61 array set id {}
62 $self InWorkspace
63
64 set n 0
65 set max [llength $map]
66
67 foreach insn $map {
68 log progress 3 fossil $n $max ; incr n
69
70 struct::list assign $insn cmd pa pb
71 switch -exact -- $cmd {
72 A {
73 log write 8 fossil {Importing <$pa>,}
74
75 # Result = 'inserted as record :FOO:'
76 # 0 1 2 3
77 set res [Do test-content-put $pa]
78 integrity assert {
@@ -73,11 +79,11 @@
79 [regexp {^inserted as record \d+$} $res]
80 } {Unable to process unexpected fossil output '$res'}
81 set id($pa) [lindex $res 3]
82 }
83 D {
84 log write 8 fossil {Compressing <$pa>, as delta of <$pb>}
85
86 Do test-content-deltify $id($pa) $id($pb) 1
87 }
88 }
89 }
90

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button