Check-in [060513f2a9]
Not logged in
Overview

SHA1 Hash:060513f2a9d9794936741279999fb6266b03032f
Date: 2007-12-02 23:45:09
User: aku
Comment:Actually put the code for the new pass into the repository.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Added tools/cvs2fossil/lib/c2f_pcsetdeps.tcl version [5249ff2f88]

@@ -1,1 +1,135 @@
+## -*- tcl -*-
+# # ## ### ##### ######## ############# #####################
+## Copyright (c) 2007 Andreas Kupries.
+#
+# This software is licensed as described in the file LICENSE, which
+# you should have received as part of this distribution.
+#
+# This software consists of voluntary contributions made by many
+# individuals.  For exact contribution history, see the revision
+# history and logs, available at http://fossil-scm.hwaci.com/fossil
+# # ## ### ##### ######## ############# #####################
+
+## Pass VI. This pass computes the dependencies between the changeset
+## from the file level dependencies and stores them in the state for
+## use by the cycle breaker and topological sorting passes.
+
+# # ## ### ##### ######## ############# #####################
+## Requirements
+
+package require Tcl 8.4                               ; # Required runtime.
+package require snit                                  ; # OO system.
+package require vc::tools::misc                       ; # Text formatting.
+package require vc::tools::log                        ; # User feedback.
+package require vc::fossil::import::cvs::state        ; # State storage.
+package require vc::fossil::import::cvs::project::rev ; # Project level changesets
+
+# # ## ### ##### ######## ############# #####################
+## Register the pass with the management
+
+vc::fossil::import::cvs::pass define \
+    CsetDeps \
+    {ChangeSet Dependencies} \
+    ::vc::fossil::import::cvs::pass::csetdeps
+
+# # ## ### ##### ######## ############# #####################
+##
+
+snit::type ::vc::fossil::import::cvs::pass::csetdeps {
+    # # ## ### ##### ######## #############
+    ## Public API
+
+    typemethod setup {} {
+	# Define the names and structure of the persistent state of
+	# this pass.
+
+	state use project
+	state use file
+	state use revision
+	state use revisionbranchchildren
+	state use branch
+	state use tag
+	state use symbol
+	state use preferedparent
+	state use changeset
+	state use csitem
+
+	# A table listing for each changeset the set of successor
+	# changesets. The predecessor information is implied.
+
+	state extend cssuccessor {
+	    cid  INTEGER  NOT NULL  REFERENCES changeset,
+	    nid  INTEGER  NOT NULL  REFERENCES changeset,
+	    UNIQUE (cid,nid)
+	} {cid nid}
+	# Index on both columns for fast forward and back retrieval.
+	return
+    }
+
+    typemethod load {} {
+	# Pass manager interface. Executed to load data computed by
+	# this pass into memory when this pass is skipped instead of
+	# executed.
+
+	state use cssuccessor
+	return
+    }
+
+    typemethod run {} {
+	# Pass manager interface. Executed to perform the
+	# functionality of the pass.
+
+	set n   0
+	set max [llength [project::rev all]]
+
+	foreach cset [project::rev all] {
+	    log progress 2 csetdeps $n $max
+	    # NOTE: Consider to commit only every N calls.
+	    state transaction {
+		$cset determinesuccessors
+	    }
+	    incr n
+	}
+	return
+    }
+
+    typemethod discard {} {
+	# Pass manager interface. Executed for all passes after the
+	# run passes, to remove all data of this pass from the state,
+	# as being out of date.
+
+	state discard cssuccessor
+	return
+    }
+
+    # # ## ### ##### ######## #############
+    ## Internal methods
+
+    # # ## ### ##### ######## #############
+    ## Configuration
+
+    pragma -hasinstances   no ; # singleton
+    pragma -hastypeinfo    no ; # no introspection
+    pragma -hastypedestroy no ; # immortal
+
+    # # ## ### ##### ######## #############
+}
+
+namespace eval ::vc::fossil::import::cvs::pass {
+    namespace export csetdeps
+    namespace eval csetdeps {
+	namespace import ::vc::fossil::import::cvs::state
+	namespace eval project {
+	    namespace import ::vc::fossil::import::cvs::project::rev
+	}
+	namespace import ::vc::tools::misc::*
+	namespace import ::vc::tools::log
+	log register csetdeps
+    }
+}
+
+# # ## ### ##### ######## ############# #####################
+## Ready
 
+package provide vc::fossil::import::cvs::pass::csetdeps 1.0
+return