Fossil SCM
Fixed problems with the untested statistics module. Moved cset <-> uuid map out of cvs to control layer, separate package. Currently not really useful, will be needed when handling cvs branches. Moved some user feedback around, and the import control too.
Commit
b504674c5fa3d043d0458e01a888100d5a613c78
Parent
18251642f3b24b7…
5 files changed
+2
-8
+50
+18
-10
+25
-13
+1
+2
-8
| --- tools/lib/cvs.tcl | ||
| +++ tools/lib/cvs.tcl | ||
| @@ -320,11 +320,11 @@ | ||
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | # Provide metadata about the changeset the backend may wish to have |
| 325 | - return [list $u $cm $s] | |
| 325 | + return [list $u $s $cm] | |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | namespace eval ::vc::cvs::ws { |
| 329 | 329 | # Workspace where checkouts happen |
| 330 | 330 | # Current working directory to go back to after the import. |
| @@ -376,16 +376,10 @@ | ||
| 376 | 376 | proc ::vc::cvs::ws::ncsets {} { |
| 377 | 377 | variable ncs |
| 378 | 378 | return $ncs |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | -proc ::vc::cvs::ws::uuid {c uuid} { | |
| 382 | - variable rtree | |
| 383 | - $rtree set $c uuid $uuid | |
| 384 | - return | |
| 385 | -} | |
| 386 | - | |
| 387 | 381 | # ----------------------------------------------------------------------------- |
| 388 | 382 | # Internal helper commands: Changeset inspection and construction. |
| 389 | 383 | |
| 390 | 384 | proc ::vc::cvs::ws::CSClear {} { |
| 391 | 385 | upvar 1 start start end end cm cm user user files files lastd lastd |
| @@ -476,13 +470,13 @@ | ||
| 476 | 470 | return |
| 477 | 471 | } |
| 478 | 472 | |
| 479 | 473 | namespace eval ::vc::cvs::ws { |
| 480 | 474 | namespace export at scan csets rtree workspace wsignore wsclear wssetup \ |
| 481 | - foreach_cset root ntrunk ncsets uuid | |
| 475 | + foreach_cset root ntrunk ncsets | |
| 482 | 476 | } |
| 483 | 477 | |
| 484 | 478 | # ----------------------------------------------------------------------------- |
| 485 | 479 | # Ready |
| 486 | 480 | |
| 487 | 481 | package provide vc::cvs::ws 1.0 |
| 488 | 482 | return |
| 489 | 483 | |
| 490 | 484 | ADDED tools/lib/import_map.tcl |
| --- tools/lib/cvs.tcl | |
| +++ tools/lib/cvs.tcl | |
| @@ -320,11 +320,11 @@ | |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | # Provide metadata about the changeset the backend may wish to have |
| 325 | return [list $u $cm $s] |
| 326 | } |
| 327 | |
| 328 | namespace eval ::vc::cvs::ws { |
| 329 | # Workspace where checkouts happen |
| 330 | # Current working directory to go back to after the import. |
| @@ -376,16 +376,10 @@ | |
| 376 | proc ::vc::cvs::ws::ncsets {} { |
| 377 | variable ncs |
| 378 | return $ncs |
| 379 | } |
| 380 | |
| 381 | proc ::vc::cvs::ws::uuid {c uuid} { |
| 382 | variable rtree |
| 383 | $rtree set $c uuid $uuid |
| 384 | return |
| 385 | } |
| 386 | |
| 387 | # ----------------------------------------------------------------------------- |
| 388 | # Internal helper commands: Changeset inspection and construction. |
| 389 | |
| 390 | proc ::vc::cvs::ws::CSClear {} { |
| 391 | upvar 1 start start end end cm cm user user files files lastd lastd |
| @@ -476,13 +470,13 @@ | |
| 476 | return |
| 477 | } |
| 478 | |
| 479 | namespace eval ::vc::cvs::ws { |
| 480 | namespace export at scan csets rtree workspace wsignore wsclear wssetup \ |
| 481 | foreach_cset root ntrunk ncsets uuid |
| 482 | } |
| 483 | |
| 484 | # ----------------------------------------------------------------------------- |
| 485 | # Ready |
| 486 | |
| 487 | package provide vc::cvs::ws 1.0 |
| 488 | return |
| 489 | |
| 490 | DDED tools/lib/import_map.tcl |
| --- tools/lib/cvs.tcl | |
| +++ tools/lib/cvs.tcl | |
| @@ -320,11 +320,11 @@ | |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | # Provide metadata about the changeset the backend may wish to have |
| 325 | return [list $u $s $cm] |
| 326 | } |
| 327 | |
| 328 | namespace eval ::vc::cvs::ws { |
| 329 | # Workspace where checkouts happen |
| 330 | # Current working directory to go back to after the import. |
| @@ -376,16 +376,10 @@ | |
| 376 | proc ::vc::cvs::ws::ncsets {} { |
| 377 | variable ncs |
| 378 | return $ncs |
| 379 | } |
| 380 | |
| 381 | # ----------------------------------------------------------------------------- |
| 382 | # Internal helper commands: Changeset inspection and construction. |
| 383 | |
| 384 | proc ::vc::cvs::ws::CSClear {} { |
| 385 | upvar 1 start start end end cm cm user user files files lastd lastd |
| @@ -476,13 +470,13 @@ | |
| 470 | return |
| 471 | } |
| 472 | |
| 473 | namespace eval ::vc::cvs::ws { |
| 474 | namespace export at scan csets rtree workspace wsignore wsclear wssetup \ |
| 475 | foreach_cset root ntrunk ncsets |
| 476 | } |
| 477 | |
| 478 | # ----------------------------------------------------------------------------- |
| 479 | # Ready |
| 480 | |
| 481 | package provide vc::cvs::ws 1.0 |
| 482 | return |
| 483 | |
| 484 | DDED tools/lib/import_map.tcl |
+50
| --- a/tools/lib/import_map.tcl | ||
| +++ b/tools/lib/import_map.tcl | ||
| @@ -0,0 +1,50 @@ | ||
| 1 | +# ----------------------------------------------------------------------------- | |
| 2 | +# Management of the mapping between cvs changesets and fossil uuids. | |
| 3 | + | |
| 4 | +# ----------------------------------------------------------------------------- | |
| 5 | +# Requirements | |
| 6 | + | |
| 7 | +package require Tcl 8.4 | |
| 8 | +package require vc::tools::log ; # User feedback | |
| 9 | + | |
| 10 | +namespace eval ::vc::fossil::import::map { | |
| 11 | + vc::tools::log::system map | |
| 12 | + namespace import ::vc::tools::log::write | |
| 13 | +} | |
| 14 | + | |
| 15 | +# ----------------------------------------------------------------------------- | |
| 16 | +# API | |
| 17 | + | |
| 18 | +# vc::fossil::import::map | |
| 19 | +# set cset uuid - Associate changeset with uuid | |
| 20 | +# get cset -> uuid - Retrieve uuid for changeset. | |
| 21 | + | |
| 22 | +# ----------------------------------------------------------------------------- | |
| 23 | +# API Implementation - Functionality | |
| 24 | + | |
| 25 | +proc ::vc::fossil::import::map::set {cset uuid} { | |
| 26 | + variable map | |
| 27 | + ::set map($cset) $uuid | |
| 28 | + write 2 map "== $uuid" | |
| 29 | + return | |
| 30 | +} | |
| 31 | + | |
| 32 | +proc ::vc::fossil::import::map::get {cset} { | |
| 33 | + variable map | |
| 34 | + return $map($cset) | |
| 35 | +} | |
| 36 | + | |
| 37 | +# ----------------------------------------------------------------------------- | |
| 38 | + | |
| 39 | +namespace eval ::vc::fossil::import::map { | |
| 40 | + variable map ; # Map from csets to uuids | |
| 41 | + array set map {} ; # | |
| 42 | + | |
| 43 | + namespace export get set | |
| 44 | +} | |
| 45 | + | |
| 46 | +# ----------------------------------------------------------------------------- | |
| 47 | +# Ready | |
| 48 | + | |
| 49 | +package provide vc::fossil::import::map 1.0 | |
| 50 | +return |
| --- a/tools/lib/import_map.tcl | |
| +++ b/tools/lib/import_map.tcl | |
| @@ -0,0 +1,50 @@ | |
| --- a/tools/lib/import_map.tcl | |
| +++ b/tools/lib/import_map.tcl | |
| @@ -0,0 +1,50 @@ | |
| 1 | # ----------------------------------------------------------------------------- |
| 2 | # Management of the mapping between cvs changesets and fossil uuids. |
| 3 | |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | # Requirements |
| 6 | |
| 7 | package require Tcl 8.4 |
| 8 | package require vc::tools::log ; # User feedback |
| 9 | |
| 10 | namespace eval ::vc::fossil::import::map { |
| 11 | vc::tools::log::system map |
| 12 | namespace import ::vc::tools::log::write |
| 13 | } |
| 14 | |
| 15 | # ----------------------------------------------------------------------------- |
| 16 | # API |
| 17 | |
| 18 | # vc::fossil::import::map |
| 19 | # set cset uuid - Associate changeset with uuid |
| 20 | # get cset -> uuid - Retrieve uuid for changeset. |
| 21 | |
| 22 | # ----------------------------------------------------------------------------- |
| 23 | # API Implementation - Functionality |
| 24 | |
| 25 | proc ::vc::fossil::import::map::set {cset uuid} { |
| 26 | variable map |
| 27 | ::set map($cset) $uuid |
| 28 | write 2 map "== $uuid" |
| 29 | return |
| 30 | } |
| 31 | |
| 32 | proc ::vc::fossil::import::map::get {cset} { |
| 33 | variable map |
| 34 | return $map($cset) |
| 35 | } |
| 36 | |
| 37 | # ----------------------------------------------------------------------------- |
| 38 | |
| 39 | namespace eval ::vc::fossil::import::map { |
| 40 | variable map ; # Map from csets to uuids |
| 41 | array set map {} ; # |
| 42 | |
| 43 | namespace export get set |
| 44 | } |
| 45 | |
| 46 | # ----------------------------------------------------------------------------- |
| 47 | # Ready |
| 48 | |
| 49 | package provide vc::fossil::import::map 1.0 |
| 50 | return |
+18
-10
| --- tools/lib/import_statistics.tcl | ||
| +++ tools/lib/import_statistics.tcl | ||
| @@ -23,44 +23,46 @@ | ||
| 23 | 23 | # |
| 24 | 24 | |
| 25 | 25 | # ----------------------------------------------------------------------------- |
| 26 | 26 | # API Implementation - Functionality |
| 27 | 27 | |
| 28 | -proc ::vc::fossil::import::stats::init {n m} { | |
| 28 | +proc ::vc::fossil::import::stats::setup {n m} { | |
| 29 | + variable run_format %[string length $n]s | |
| 30 | + variable max_format %[string length $m]s | |
| 29 | 31 | variable total_csets $n |
| 30 | 32 | variable total_running 0 |
| 31 | 33 | variable total_seconds 0.0 |
| 32 | - | |
| 33 | - variable ntfmt %[string length $n]s | |
| 34 | - variable nmfmt %[string length $m]s | |
| 35 | 34 | return |
| 36 | 35 | } |
| 37 | 36 | |
| 38 | 37 | proc ::vc::fossil::import::stats::done {} { |
| 39 | 38 | variable total_csets |
| 40 | 39 | variable total_seconds |
| 41 | 40 | |
| 42 | 41 | write 0 stats "========= [string repeat = 61]" |
| 43 | 42 | write 0 stats "Imported $total_csets [expr {($total_csets == 1) ? "changeset" : "changesets"}]" |
| 44 | - write 0 stats "Within [F $tot] seconds (avg [F [Avg]] seconds/changeset)" | |
| 43 | + write 0 stats "Within [F $total_seconds] seconds (avg [F [Avg]] seconds/changeset)" | |
| 45 | 44 | return |
| 46 | 45 | } |
| 47 | 46 | |
| 48 | 47 | proc ::vc::fossil::import::stats::csbegin {cset} { |
| 49 | - variable nmfmt | |
| 50 | - variable ntfmt | |
| 51 | - write 0 stats "ChangeSet [format $nmfmt $cset] @ [format $ntfmt $total_running]/$total_csets ([F6 [expr {$total_running*100.0/$total_csets}]]%)" | |
| 48 | + variable max_format | |
| 49 | + variable run_format | |
| 50 | + variable total_running | |
| 51 | + variable total_csets | |
| 52 | + | |
| 53 | + write 0 stats "ChangeSet [format $max_format $cset] @ [format $run_format $total_running]/$total_csets ([F6 [expr {$total_running*100.0/$total_csets}]]%)" | |
| 52 | 54 | return |
| 53 | 55 | } |
| 54 | 56 | |
| 55 | 57 | proc ::vc::fossil::import::stats::csend {seconds} { |
| 56 | 58 | variable total_csets |
| 57 | 59 | variable total_seconds |
| 58 | 60 | variable total_running |
| 59 | 61 | |
| 60 | 62 | incr total_running |
| 61 | - set total_seconds [expr {$total_seconds + $sec}] | |
| 63 | + set total_seconds [expr {$total_seconds + $seconds}] | |
| 62 | 64 | |
| 63 | 65 | set avg [Avg] |
| 64 | 66 | set end [expr {$total_csets * $avg}] |
| 65 | 67 | set rem [expr {$end - $total_seconds}] |
| 66 | 68 | |
| @@ -95,13 +97,19 @@ | ||
| 95 | 97 | } |
| 96 | 98 | |
| 97 | 99 | # ----------------------------------------------------------------------------- |
| 98 | 100 | |
| 99 | 101 | namespace eval ::vc::fossil::import::stats { |
| 100 | - namespace export setup done begin add | |
| 102 | + variable total_csets 0 ; # Number of changesets to expect to be imported | |
| 103 | + variable total_running 0 ; # Number of changesets which have been imported so far | |
| 104 | + variable total_seconds 0 ; # Current runtime in seconds | |
| 105 | + variable max_format %s ; # Format to print changeset id, based on the largest id. | |
| 106 | + variable run_format %s ; # Format to print the number of imported csets. | |
| 107 | + | |
| 108 | + namespace export setup done csbegin csend | |
| 101 | 109 | } |
| 102 | 110 | |
| 103 | 111 | # ----------------------------------------------------------------------------- |
| 104 | 112 | # Ready |
| 105 | 113 | |
| 106 | 114 | package provide vc::fossil::import::stats 1.0 |
| 107 | 115 | return |
| 108 | 116 |
| --- tools/lib/import_statistics.tcl | |
| +++ tools/lib/import_statistics.tcl | |
| @@ -23,44 +23,46 @@ | |
| 23 | # |
| 24 | |
| 25 | # ----------------------------------------------------------------------------- |
| 26 | # API Implementation - Functionality |
| 27 | |
| 28 | proc ::vc::fossil::import::stats::init {n m} { |
| 29 | variable total_csets $n |
| 30 | variable total_running 0 |
| 31 | variable total_seconds 0.0 |
| 32 | |
| 33 | variable ntfmt %[string length $n]s |
| 34 | variable nmfmt %[string length $m]s |
| 35 | return |
| 36 | } |
| 37 | |
| 38 | proc ::vc::fossil::import::stats::done {} { |
| 39 | variable total_csets |
| 40 | variable total_seconds |
| 41 | |
| 42 | write 0 stats "========= [string repeat = 61]" |
| 43 | write 0 stats "Imported $total_csets [expr {($total_csets == 1) ? "changeset" : "changesets"}]" |
| 44 | write 0 stats "Within [F $tot] seconds (avg [F [Avg]] seconds/changeset)" |
| 45 | return |
| 46 | } |
| 47 | |
| 48 | proc ::vc::fossil::import::stats::csbegin {cset} { |
| 49 | variable nmfmt |
| 50 | variable ntfmt |
| 51 | write 0 stats "ChangeSet [format $nmfmt $cset] @ [format $ntfmt $total_running]/$total_csets ([F6 [expr {$total_running*100.0/$total_csets}]]%)" |
| 52 | return |
| 53 | } |
| 54 | |
| 55 | proc ::vc::fossil::import::stats::csend {seconds} { |
| 56 | variable total_csets |
| 57 | variable total_seconds |
| 58 | variable total_running |
| 59 | |
| 60 | incr total_running |
| 61 | set total_seconds [expr {$total_seconds + $sec}] |
| 62 | |
| 63 | set avg [Avg] |
| 64 | set end [expr {$total_csets * $avg}] |
| 65 | set rem [expr {$end - $total_seconds}] |
| 66 | |
| @@ -95,13 +97,19 @@ | |
| 95 | } |
| 96 | |
| 97 | # ----------------------------------------------------------------------------- |
| 98 | |
| 99 | namespace eval ::vc::fossil::import::stats { |
| 100 | namespace export setup done begin add |
| 101 | } |
| 102 | |
| 103 | # ----------------------------------------------------------------------------- |
| 104 | # Ready |
| 105 | |
| 106 | package provide vc::fossil::import::stats 1.0 |
| 107 | return |
| 108 |
| --- tools/lib/import_statistics.tcl | |
| +++ tools/lib/import_statistics.tcl | |
| @@ -23,44 +23,46 @@ | |
| 23 | # |
| 24 | |
| 25 | # ----------------------------------------------------------------------------- |
| 26 | # API Implementation - Functionality |
| 27 | |
| 28 | proc ::vc::fossil::import::stats::setup {n m} { |
| 29 | variable run_format %[string length $n]s |
| 30 | variable max_format %[string length $m]s |
| 31 | variable total_csets $n |
| 32 | variable total_running 0 |
| 33 | variable total_seconds 0.0 |
| 34 | return |
| 35 | } |
| 36 | |
| 37 | proc ::vc::fossil::import::stats::done {} { |
| 38 | variable total_csets |
| 39 | variable total_seconds |
| 40 | |
| 41 | write 0 stats "========= [string repeat = 61]" |
| 42 | write 0 stats "Imported $total_csets [expr {($total_csets == 1) ? "changeset" : "changesets"}]" |
| 43 | write 0 stats "Within [F $total_seconds] seconds (avg [F [Avg]] seconds/changeset)" |
| 44 | return |
| 45 | } |
| 46 | |
| 47 | proc ::vc::fossil::import::stats::csbegin {cset} { |
| 48 | variable max_format |
| 49 | variable run_format |
| 50 | variable total_running |
| 51 | variable total_csets |
| 52 | |
| 53 | write 0 stats "ChangeSet [format $max_format $cset] @ [format $run_format $total_running]/$total_csets ([F6 [expr {$total_running*100.0/$total_csets}]]%)" |
| 54 | return |
| 55 | } |
| 56 | |
| 57 | proc ::vc::fossil::import::stats::csend {seconds} { |
| 58 | variable total_csets |
| 59 | variable total_seconds |
| 60 | variable total_running |
| 61 | |
| 62 | incr total_running |
| 63 | set total_seconds [expr {$total_seconds + $seconds}] |
| 64 | |
| 65 | set avg [Avg] |
| 66 | set end [expr {$total_csets * $avg}] |
| 67 | set rem [expr {$end - $total_seconds}] |
| 68 | |
| @@ -95,13 +97,19 @@ | |
| 97 | } |
| 98 | |
| 99 | # ----------------------------------------------------------------------------- |
| 100 | |
| 101 | namespace eval ::vc::fossil::import::stats { |
| 102 | variable total_csets 0 ; # Number of changesets to expect to be imported |
| 103 | variable total_running 0 ; # Number of changesets which have been imported so far |
| 104 | variable total_seconds 0 ; # Current runtime in seconds |
| 105 | variable max_format %s ; # Format to print changeset id, based on the largest id. |
| 106 | variable run_format %s ; # Format to print the number of imported csets. |
| 107 | |
| 108 | namespace export setup done csbegin csend |
| 109 | } |
| 110 | |
| 111 | # ----------------------------------------------------------------------------- |
| 112 | # Ready |
| 113 | |
| 114 | package provide vc::fossil::import::stats 1.0 |
| 115 | return |
| 116 |
+25
-13
| --- tools/lib/importcvs.tcl | ||
| +++ tools/lib/importcvs.tcl | ||
| @@ -5,19 +5,21 @@ | ||
| 5 | 5 | # Requirements |
| 6 | 6 | |
| 7 | 7 | package require Tcl 8.4 |
| 8 | 8 | package require vc::cvs::ws ; # Frontend, reading from source repository |
| 9 | 9 | package require vc::fossil::ws ; # Backend, writing to destination repository. |
| 10 | -package require vc::tools::log ; # User feedback | |
| 11 | -package require vc::fossil::import::stats ; # Import Statistics | |
| 10 | +package require vc::tools::log ; # User feedback. | |
| 11 | +package require vc::fossil::import::stats ; # Management for the Import Statistics. | |
| 12 | +package require vc::fossil::import::map ; # Management of the cset <-> uuid mapping. | |
| 12 | 13 | |
| 13 | 14 | namespace eval ::vc::fossil::import::cvs { |
| 14 | 15 | vc::tools::log::system import |
| 15 | 16 | namespace import ::vc::tools::log::write |
| 16 | 17 | namespace eval cvs { namespace import ::vc::cvs::ws::* } |
| 17 | 18 | namespace eval fossil { namespace import ::vc::fossil::ws::* } |
| 18 | 19 | namespace eval stats { namespace import ::vc::fossil::import::stats::* } |
| 20 | + namespace eval map { namespace import ::vc::fossil::import::map::* } | |
| 19 | 21 | |
| 20 | 22 | fossil::configure -appname cvs2fossil |
| 21 | 23 | fossil::configure -ignore ::vc::cvs::ws::wsignore |
| 22 | 24 | } |
| 23 | 25 | |
| @@ -64,44 +66,54 @@ | ||
| 64 | 66 | cvs::rtree ; # Build revision tree (trunk only right now). |
| 65 | 67 | |
| 66 | 68 | write 0 import {Begin conversion} |
| 67 | 69 | write 0 import {Setting up workspaces} |
| 68 | 70 | |
| 71 | + #B map::set {} {} | |
| 69 | 72 | cvs::workspace ; # cd's to workspace |
| 70 | 73 | fossil::begin [pwd] ; # Uses cwd as workspace to connect to. |
| 71 | 74 | stats::setup [cvs::ntrunk] [cvs::ncsets] |
| 72 | 75 | |
| 73 | 76 | cvs::foreach_cset cset [cvs::root] { |
| 74 | - OneChangeSet $cset | |
| 77 | + Import1 $cset | |
| 75 | 78 | } |
| 76 | 79 | |
| 77 | 80 | stats::done |
| 78 | 81 | cvs::wsclear |
| 79 | - fossil::close $dst | |
| 82 | + fossil::done $dst | |
| 80 | 83 | |
| 81 | 84 | write 0 import Ok. |
| 82 | 85 | return |
| 83 | 86 | } |
| 84 | 87 | |
| 85 | 88 | # ----------------------------------------------------------------------------- |
| 86 | 89 | # Internal operations - Import a single changeset. |
| 87 | 90 | |
| 88 | -proc ::vc::fossil::import::cvs::OneChangeSet {cset} { | |
| 91 | +proc ::vc::fossil::import::cvs::Import1 {cset} { | |
| 89 | 92 | stats::csbegin $cset |
| 90 | 93 | |
| 91 | - set microseconds [lindex [time { | |
| 92 | - foreach {user message timestamp} [cvs::wssetup $cset] break | |
| 93 | - foreach {uuid ad rm ch} [fossil::commit $cset $user $timestamp $message] break | |
| 94 | - } 1] 0] | |
| 95 | - set seconds [expr {$microseconds/1e6}] | |
| 96 | - | |
| 97 | - cvs::uuid $cset $uuid | |
| 98 | - write 2 import "== $uuid +${ad}-${rm}*${ch}" | |
| 94 | + set microseconds [lindex [time {ImportCS $cset} 1] 0] | |
| 95 | + set seconds [expr {$microseconds/1e6}] | |
| 99 | 96 | |
| 100 | 97 | stats::csend $seconds |
| 101 | 98 | return |
| 102 | 99 | } |
| 100 | + | |
| 101 | +proc ::vc::fossil::import::cvs::ImportCS {cset} { | |
| 102 | + #B fossil::setup [map::get [cvs::parentOf $cset]] | |
| 103 | + lassign [cvs::wssetup $cset] user timestamp message | |
| 104 | + lassign [fossil::commit $cset $user $timestamp $message] uuid ad rm ch | |
| 105 | + write 2 import "== +${ad}-${rm}*${ch}" | |
| 106 | + map::set $cset $uuid | |
| 107 | + return | |
| 108 | +} | |
| 109 | + | |
| 110 | +proc ::vc::fossil::import::cvs::lassign {l args} { | |
| 111 | + foreach v $args {upvar 1 $v $v} | |
| 112 | + foreach $args $l break | |
| 113 | + return | |
| 114 | +} | |
| 103 | 115 | |
| 104 | 116 | # ----------------------------------------------------------------------------- |
| 105 | 117 | |
| 106 | 118 | namespace eval ::vc::fossil::import::cvs { |
| 107 | 119 | namespace export run configure |
| 108 | 120 |
| --- tools/lib/importcvs.tcl | |
| +++ tools/lib/importcvs.tcl | |
| @@ -5,19 +5,21 @@ | |
| 5 | # Requirements |
| 6 | |
| 7 | package require Tcl 8.4 |
| 8 | package require vc::cvs::ws ; # Frontend, reading from source repository |
| 9 | package require vc::fossil::ws ; # Backend, writing to destination repository. |
| 10 | package require vc::tools::log ; # User feedback |
| 11 | package require vc::fossil::import::stats ; # Import Statistics |
| 12 | |
| 13 | namespace eval ::vc::fossil::import::cvs { |
| 14 | vc::tools::log::system import |
| 15 | namespace import ::vc::tools::log::write |
| 16 | namespace eval cvs { namespace import ::vc::cvs::ws::* } |
| 17 | namespace eval fossil { namespace import ::vc::fossil::ws::* } |
| 18 | namespace eval stats { namespace import ::vc::fossil::import::stats::* } |
| 19 | |
| 20 | fossil::configure -appname cvs2fossil |
| 21 | fossil::configure -ignore ::vc::cvs::ws::wsignore |
| 22 | } |
| 23 | |
| @@ -64,44 +66,54 @@ | |
| 64 | cvs::rtree ; # Build revision tree (trunk only right now). |
| 65 | |
| 66 | write 0 import {Begin conversion} |
| 67 | write 0 import {Setting up workspaces} |
| 68 | |
| 69 | cvs::workspace ; # cd's to workspace |
| 70 | fossil::begin [pwd] ; # Uses cwd as workspace to connect to. |
| 71 | stats::setup [cvs::ntrunk] [cvs::ncsets] |
| 72 | |
| 73 | cvs::foreach_cset cset [cvs::root] { |
| 74 | OneChangeSet $cset |
| 75 | } |
| 76 | |
| 77 | stats::done |
| 78 | cvs::wsclear |
| 79 | fossil::close $dst |
| 80 | |
| 81 | write 0 import Ok. |
| 82 | return |
| 83 | } |
| 84 | |
| 85 | # ----------------------------------------------------------------------------- |
| 86 | # Internal operations - Import a single changeset. |
| 87 | |
| 88 | proc ::vc::fossil::import::cvs::OneChangeSet {cset} { |
| 89 | stats::csbegin $cset |
| 90 | |
| 91 | set microseconds [lindex [time { |
| 92 | foreach {user message timestamp} [cvs::wssetup $cset] break |
| 93 | foreach {uuid ad rm ch} [fossil::commit $cset $user $timestamp $message] break |
| 94 | } 1] 0] |
| 95 | set seconds [expr {$microseconds/1e6}] |
| 96 | |
| 97 | cvs::uuid $cset $uuid |
| 98 | write 2 import "== $uuid +${ad}-${rm}*${ch}" |
| 99 | |
| 100 | stats::csend $seconds |
| 101 | return |
| 102 | } |
| 103 | |
| 104 | # ----------------------------------------------------------------------------- |
| 105 | |
| 106 | namespace eval ::vc::fossil::import::cvs { |
| 107 | namespace export run configure |
| 108 |
| --- tools/lib/importcvs.tcl | |
| +++ tools/lib/importcvs.tcl | |
| @@ -5,19 +5,21 @@ | |
| 5 | # Requirements |
| 6 | |
| 7 | package require Tcl 8.4 |
| 8 | package require vc::cvs::ws ; # Frontend, reading from source repository |
| 9 | package require vc::fossil::ws ; # Backend, writing to destination repository. |
| 10 | package require vc::tools::log ; # User feedback. |
| 11 | package require vc::fossil::import::stats ; # Management for the Import Statistics. |
| 12 | package require vc::fossil::import::map ; # Management of the cset <-> uuid mapping. |
| 13 | |
| 14 | namespace eval ::vc::fossil::import::cvs { |
| 15 | vc::tools::log::system import |
| 16 | namespace import ::vc::tools::log::write |
| 17 | namespace eval cvs { namespace import ::vc::cvs::ws::* } |
| 18 | namespace eval fossil { namespace import ::vc::fossil::ws::* } |
| 19 | namespace eval stats { namespace import ::vc::fossil::import::stats::* } |
| 20 | namespace eval map { namespace import ::vc::fossil::import::map::* } |
| 21 | |
| 22 | fossil::configure -appname cvs2fossil |
| 23 | fossil::configure -ignore ::vc::cvs::ws::wsignore |
| 24 | } |
| 25 | |
| @@ -64,44 +66,54 @@ | |
| 66 | cvs::rtree ; # Build revision tree (trunk only right now). |
| 67 | |
| 68 | write 0 import {Begin conversion} |
| 69 | write 0 import {Setting up workspaces} |
| 70 | |
| 71 | #B map::set {} {} |
| 72 | cvs::workspace ; # cd's to workspace |
| 73 | fossil::begin [pwd] ; # Uses cwd as workspace to connect to. |
| 74 | stats::setup [cvs::ntrunk] [cvs::ncsets] |
| 75 | |
| 76 | cvs::foreach_cset cset [cvs::root] { |
| 77 | Import1 $cset |
| 78 | } |
| 79 | |
| 80 | stats::done |
| 81 | cvs::wsclear |
| 82 | fossil::done $dst |
| 83 | |
| 84 | write 0 import Ok. |
| 85 | return |
| 86 | } |
| 87 | |
| 88 | # ----------------------------------------------------------------------------- |
| 89 | # Internal operations - Import a single changeset. |
| 90 | |
| 91 | proc ::vc::fossil::import::cvs::Import1 {cset} { |
| 92 | stats::csbegin $cset |
| 93 | |
| 94 | set microseconds [lindex [time {ImportCS $cset} 1] 0] |
| 95 | set seconds [expr {$microseconds/1e6}] |
| 96 | |
| 97 | stats::csend $seconds |
| 98 | return |
| 99 | } |
| 100 | |
| 101 | proc ::vc::fossil::import::cvs::ImportCS {cset} { |
| 102 | #B fossil::setup [map::get [cvs::parentOf $cset]] |
| 103 | lassign [cvs::wssetup $cset] user timestamp message |
| 104 | lassign [fossil::commit $cset $user $timestamp $message] uuid ad rm ch |
| 105 | write 2 import "== +${ad}-${rm}*${ch}" |
| 106 | map::set $cset $uuid |
| 107 | return |
| 108 | } |
| 109 | |
| 110 | proc ::vc::fossil::import::cvs::lassign {l args} { |
| 111 | foreach v $args {upvar 1 $v $v} |
| 112 | foreach $args $l break |
| 113 | return |
| 114 | } |
| 115 | |
| 116 | # ----------------------------------------------------------------------------- |
| 117 | |
| 118 | namespace eval ::vc::fossil::import::cvs { |
| 119 | namespace export run configure |
| 120 |
| --- tools/lib/pkgIndex.tcl | ||
| +++ tools/lib/pkgIndex.tcl | ||
| @@ -4,6 +4,7 @@ | ||
| 4 | 4 | package ifneeded vc::cvs::ws 1.0 [list source [file join $dir cvs.tcl]] |
| 5 | 5 | package ifneeded vc::fossil::cmd 1.0 [list source [file join $dir fossil_cmd.tcl]] |
| 6 | 6 | package ifneeded vc::fossil::ws 1.0 [list source [file join $dir fossil.tcl]] |
| 7 | 7 | package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir importcvs.tcl]] |
| 8 | 8 | package ifneeded vc::fossil::import::stats 1.0 [list source [file join $dir import_statistics.tcl]] |
| 9 | +package ifneeded vc::fossil::import::map 1.0 [list source [file join $dir import_map.tcl]] | |
| 9 | 10 | package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]] |
| 10 | 11 |
| --- tools/lib/pkgIndex.tcl | |
| +++ tools/lib/pkgIndex.tcl | |
| @@ -4,6 +4,7 @@ | |
| 4 | package ifneeded vc::cvs::ws 1.0 [list source [file join $dir cvs.tcl]] |
| 5 | package ifneeded vc::fossil::cmd 1.0 [list source [file join $dir fossil_cmd.tcl]] |
| 6 | package ifneeded vc::fossil::ws 1.0 [list source [file join $dir fossil.tcl]] |
| 7 | package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir importcvs.tcl]] |
| 8 | package ifneeded vc::fossil::import::stats 1.0 [list source [file join $dir import_statistics.tcl]] |
| 9 | package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]] |
| 10 |
| --- tools/lib/pkgIndex.tcl | |
| +++ tools/lib/pkgIndex.tcl | |
| @@ -4,6 +4,7 @@ | |
| 4 | package ifneeded vc::cvs::ws 1.0 [list source [file join $dir cvs.tcl]] |
| 5 | package ifneeded vc::fossil::cmd 1.0 [list source [file join $dir fossil_cmd.tcl]] |
| 6 | package ifneeded vc::fossil::ws 1.0 [list source [file join $dir fossil.tcl]] |
| 7 | package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir importcvs.tcl]] |
| 8 | package ifneeded vc::fossil::import::stats 1.0 [list source [file join $dir import_statistics.tcl]] |
| 9 | package ifneeded vc::fossil::import::map 1.0 [list source [file join $dir import_map.tcl]] |
| 10 | package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]] |
| 11 |