Overview
SHA1 Hash: | b504674c5fa3d043d0458e01a888100d5a613c78 |
---|---|
Date: | 2007-09-15 03:18:31 |
User: | aku |
Comment: | 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. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified tools/lib/cvs.tcl from [5855edb7f0] to [a015f1382f].
@@ -320,11 +320,11 @@ } } } # Provide metadata about the changeset the backend may wish to have - return [list $u $cm $s] + return [list $u $s $cm] } namespace eval ::vc::cvs::ws { # Workspace where checkouts happen # Current working directory to go back to after the import. @@ -374,16 +374,10 @@ } proc ::vc::cvs::ws::ncsets {} { variable ncs return $ncs -} - -proc ::vc::cvs::ws::uuid {c uuid} { - variable rtree - $rtree set $c uuid $uuid - return } # ----------------------------------------------------------------------------- # Internal helper commands: Changeset inspection and construction. @@ -476,13 +470,13 @@ return } namespace eval ::vc::cvs::ws { namespace export at scan csets rtree workspace wsignore wsclear wssetup \ - foreach_cset root ntrunk ncsets uuid + foreach_cset root ntrunk ncsets } # ----------------------------------------------------------------------------- # Ready package provide vc::cvs::ws 1.0 return
Added tools/lib/import_map.tcl version [44f7107846]
@@ -1,1 +1,50 @@ +# ----------------------------------------------------------------------------- +# Management of the mapping between cvs changesets and fossil uuids. + +# ----------------------------------------------------------------------------- +# Requirements + +package require Tcl 8.4 +package require vc::tools::log ; # User feedback + +namespace eval ::vc::fossil::import::map { + vc::tools::log::system map + namespace import ::vc::tools::log::write +} + +# ----------------------------------------------------------------------------- +# API + +# vc::fossil::import::map +# set cset uuid - Associate changeset with uuid +# get cset -> uuid - Retrieve uuid for changeset. + +# ----------------------------------------------------------------------------- +# API Implementation - Functionality + +proc ::vc::fossil::import::map::set {cset uuid} { + variable map + ::set map($cset) $uuid + write 2 map "== $uuid" + return +} + +proc ::vc::fossil::import::map::get {cset} { + variable map + return $map($cset) +} + +# ----------------------------------------------------------------------------- + +namespace eval ::vc::fossil::import::map { + variable map ; # Map from csets to uuids + array set map {} ; # + + namespace export get set +} + +# ----------------------------------------------------------------------------- +# Ready +package provide vc::fossil::import::map 1.0 +return
Modified tools/lib/import_statistics.tcl from [561c79f2a3] to [aa215e83ab].
@@ -23,44 +23,46 @@ # # ----------------------------------------------------------------------------- # API Implementation - Functionality -proc ::vc::fossil::import::stats::init {n m} { +proc ::vc::fossil::import::stats::setup {n m} { + variable run_format %[string length $n]s + variable max_format %[string length $m]s variable total_csets $n variable total_running 0 variable total_seconds 0.0 - - variable ntfmt %[string length $n]s - variable nmfmt %[string length $m]s return } proc ::vc::fossil::import::stats::done {} { variable total_csets variable total_seconds write 0 stats "========= [string repeat = 61]" write 0 stats "Imported $total_csets [expr {($total_csets == 1) ? "changeset" : "changesets"}]" - write 0 stats "Within [F $tot] seconds (avg [F [Avg]] seconds/changeset)" + write 0 stats "Within [F $total_seconds] seconds (avg [F [Avg]] seconds/changeset)" return } proc ::vc::fossil::import::stats::csbegin {cset} { - variable nmfmt - variable ntfmt - write 0 stats "ChangeSet [format $nmfmt $cset] @ [format $ntfmt $total_running]/$total_csets ([F6 [expr {$total_running*100.0/$total_csets}]]%)" + variable max_format + variable run_format + variable total_running + variable total_csets + + write 0 stats "ChangeSet [format $max_format $cset] @ [format $run_format $total_running]/$total_csets ([F6 [expr {$total_running*100.0/$total_csets}]]%)" return } proc ::vc::fossil::import::stats::csend {seconds} { variable total_csets variable total_seconds variable total_running incr total_running - set total_seconds [expr {$total_seconds + $sec}] + set total_seconds [expr {$total_seconds + $seconds}] set avg [Avg] set end [expr {$total_csets * $avg}] set rem [expr {$end - $total_seconds}] @@ -95,13 +97,19 @@ } # ----------------------------------------------------------------------------- namespace eval ::vc::fossil::import::stats { - namespace export setup done begin add + variable total_csets 0 ; # Number of changesets to expect to be imported + variable total_running 0 ; # Number of changesets which have been imported so far + variable total_seconds 0 ; # Current runtime in seconds + variable max_format %s ; # Format to print changeset id, based on the largest id. + variable run_format %s ; # Format to print the number of imported csets. + + namespace export setup done csbegin csend } # ----------------------------------------------------------------------------- # Ready package provide vc::fossil::import::stats 1.0 return
Modified tools/lib/importcvs.tcl from [77cdacb9e5] to [4409d3ed45].
@@ -5,19 +5,21 @@ # Requirements package require Tcl 8.4 package require vc::cvs::ws ; # Frontend, reading from source repository package require vc::fossil::ws ; # Backend, writing to destination repository. -package require vc::tools::log ; # User feedback -package require vc::fossil::import::stats ; # Import Statistics +package require vc::tools::log ; # User feedback. +package require vc::fossil::import::stats ; # Management for the Import Statistics. +package require vc::fossil::import::map ; # Management of the cset <-> uuid mapping. namespace eval ::vc::fossil::import::cvs { vc::tools::log::system import namespace import ::vc::tools::log::write namespace eval cvs { namespace import ::vc::cvs::ws::* } namespace eval fossil { namespace import ::vc::fossil::ws::* } namespace eval stats { namespace import ::vc::fossil::import::stats::* } + namespace eval map { namespace import ::vc::fossil::import::map::* } fossil::configure -appname cvs2fossil fossil::configure -ignore ::vc::cvs::ws::wsignore } @@ -64,42 +66,52 @@ cvs::rtree ; # Build revision tree (trunk only right now). write 0 import {Begin conversion} write 0 import {Setting up workspaces} + #B map::set {} {} cvs::workspace ; # cd's to workspace fossil::begin [pwd] ; # Uses cwd as workspace to connect to. stats::setup [cvs::ntrunk] [cvs::ncsets] cvs::foreach_cset cset [cvs::root] { - OneChangeSet $cset + Import1 $cset } stats::done cvs::wsclear - fossil::close $dst + fossil::done $dst write 0 import Ok. return } # ----------------------------------------------------------------------------- # Internal operations - Import a single changeset. -proc ::vc::fossil::import::cvs::OneChangeSet {cset} { +proc ::vc::fossil::import::cvs::Import1 {cset} { stats::csbegin $cset - set microseconds [lindex [time { - foreach {user message timestamp} [cvs::wssetup $cset] break - foreach {uuid ad rm ch} [fossil::commit $cset $user $timestamp $message] break - } 1] 0] - set seconds [expr {$microseconds/1e6}] - - cvs::uuid $cset $uuid - write 2 import "== $uuid +${ad}-${rm}*${ch}" + set microseconds [lindex [time {ImportCS $cset} 1] 0] + set seconds [expr {$microseconds/1e6}] stats::csend $seconds + return +} + +proc ::vc::fossil::import::cvs::ImportCS {cset} { + #B fossil::setup [map::get [cvs::parentOf $cset]] + lassign [cvs::wssetup $cset] user timestamp message + lassign [fossil::commit $cset $user $timestamp $message] uuid ad rm ch + write 2 import "== +${ad}-${rm}*${ch}" + map::set $cset $uuid + return +} + +proc ::vc::fossil::import::cvs::lassign {l args} { + foreach v $args {upvar 1 $v $v} + foreach $args $l break return } # -----------------------------------------------------------------------------
Modified tools/lib/pkgIndex.tcl from [b623451fbf] to [66cbd64e60].
@@ -4,6 +4,7 @@ package ifneeded vc::cvs::ws 1.0 [list source [file join $dir cvs.tcl]] package ifneeded vc::fossil::cmd 1.0 [list source [file join $dir fossil_cmd.tcl]] package ifneeded vc::fossil::ws 1.0 [list source [file join $dir fossil.tcl]] package ifneeded vc::fossil::import::cvs 1.0 [list source [file join $dir importcvs.tcl]] package ifneeded vc::fossil::import::stats 1.0 [list source [file join $dir import_statistics.tcl]] +package ifneeded vc::fossil::import::map 1.0 [list source [file join $dir import_map.tcl]] package ifneeded vc::tools::log 1.0 [list source [file join $dir log.tcl]]