summaryrefslogtreecommitdiff
path: root/tools/cvs2fossil/lib/c2f_pcsetdeps.tcl
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-09-04 09:05:24 +0200
committercashmere <cashmere@autistici.org>2026-09-04 09:05:24 +0200
commit4f49b16079b27d7ce633619e4cddfdf2bffbc952 (patch)
treec296c1e7f3c3e2f6859c6d3a1b1b208779b89679 /tools/cvs2fossil/lib/c2f_pcsetdeps.tcl
downloadrelic-master.tar.gz
initial commitHEADmaster
Diffstat (limited to 'tools/cvs2fossil/lib/c2f_pcsetdeps.tcl')
-rw-r--r--tools/cvs2fossil/lib/c2f_pcsetdeps.tcl135
1 files changed, 135 insertions, 0 deletions
diff --git a/tools/cvs2fossil/lib/c2f_pcsetdeps.tcl b/tools/cvs2fossil/lib/c2f_pcsetdeps.tcl
new file mode 100644
index 0000000..cef93d6
--- /dev/null
+++ b/tools/cvs2fossil/lib/c2f_pcsetdeps.tcl
@@ -0,0 +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 changesets
+## 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 \
+ {Compute and cache 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