File Annotation
Not logged in
84de38d73f 2007-10-10       aku: ## -*- tcl -*-
84de38d73f 2007-10-10       aku: # # ## ### ##### ######## ############# #####################
84de38d73f 2007-10-10       aku: ## Copyright (c) 2007 Andreas Kupries.
84de38d73f 2007-10-10       aku: #
84de38d73f 2007-10-10       aku: # This software is licensed as described in the file LICENSE, which
84de38d73f 2007-10-10       aku: # you should have received as part of this distribution.
84de38d73f 2007-10-10       aku: #
84de38d73f 2007-10-10       aku: # This software consists of voluntary contributions made by many
84de38d73f 2007-10-10       aku: # individuals.  For exact contribution history, see the revision
84de38d73f 2007-10-10       aku: # history and logs, available at http://fossil-scm.hwaci.com/fossil
84de38d73f 2007-10-10       aku: # # ## ### ##### ######## ############# #####################
84de38d73f 2007-10-10       aku: 
84de38d73f 2007-10-10       aku: ## Symbols (Tags, Branches) per file.
84de38d73f 2007-10-10       aku: 
84de38d73f 2007-10-10       aku: # # ## ### ##### ######## ############# #####################
84de38d73f 2007-10-10       aku: ## Requirements
84de38d73f 2007-10-10       aku: 
84de38d73f 2007-10-10       aku: package require Tcl 8.4                             ; # Required runtime.
84de38d73f 2007-10-10       aku: package require snit                                ; # OO system.
cb70cf4ad6 2007-10-13       aku: package require vc::tools::trouble                  ; # Error reporting.
cb70cf4ad6 2007-10-13       aku: package require vc::fossil::import::cvs::file::rev  ; # CVS per file revisions.
84de38d73f 2007-10-10       aku: 
84de38d73f 2007-10-10       aku: # # ## ### ##### ######## ############# #####################
84de38d73f 2007-10-10       aku: ##
84de38d73f 2007-10-10       aku: 
84de38d73f 2007-10-10       aku: snit::type ::vc::fossil::import::cvs::file::sym {
84de38d73f 2007-10-10       aku:     # # ## ### ##### ######## #############
84de38d73f 2007-10-10       aku:     ## Public API
84de38d73f 2007-10-10       aku: 
da9295c6f6 2007-10-12       aku:     constructor {symtype nr symbol} {
da9295c6f6 2007-10-12       aku: 	set mytype   $symtype
da9295c6f6 2007-10-12       aku: 	set mynr     $nr
da9295c6f6 2007-10-12       aku: 	set mysymbol $symbol
cb70cf4ad6 2007-10-13       aku: 
cb70cf4ad6 2007-10-13       aku: 	switch -exact -- $mytype {
cb70cf4ad6 2007-10-13       aku: 	    branch  { SetupBranch }
cb70cf4ad6 2007-10-13       aku: 	    tag     { }
cb70cf4ad6 2007-10-13       aku: 	    default { trouble internal "Bad symbol type '$mytype'" }
cb70cf4ad6 2007-10-13       aku: 	}
da9295c6f6 2007-10-12       aku: 	return
da9295c6f6 2007-10-12       aku:     }
cb70cf4ad6 2007-10-13       aku: 
cb70cf4ad6 2007-10-13       aku:     # Symbol acessor methods.
da9295c6f6 2007-10-12       aku: 
da9295c6f6 2007-10-12       aku:     delegate method name to mysymbol
67c24820c7 2007-10-14       aku:     delegate method id   to mysymbol
67c24820c7 2007-10-14       aku: 
09af24fc7c 2007-10-17       aku:     method istrunk {} { return 0 }
cb70cf4ad6 2007-10-13       aku: 
cb70cf4ad6 2007-10-13       aku:     # Branch acessor methods.
cb70cf4ad6 2007-10-13       aku: 
cb70cf4ad6 2007-10-13       aku:     method setchildrevnr  {revnr} {
cb70cf4ad6 2007-10-13       aku: 	if {$mybranchchildrevnr ne ""} { trouble internal "Child already defined" }
cb70cf4ad6 2007-10-13       aku: 	set mybranchchildrevnr $revnr
cb70cf4ad6 2007-10-13       aku: 	return
cb70cf4ad6 2007-10-13       aku:     }
cb70cf4ad6 2007-10-13       aku: 
e5441b908d 2007-10-15       aku:     method setposition {n}   { set mybranchposition $n ; return }
e5441b908d 2007-10-15       aku:     method setparent   {rev} { set mybranchparent $rev ; return }
177a0cc55c 2007-10-17       aku:     method setchild    {rev} { set mybranchchild  $rev ; return }
cb70cf4ad6 2007-10-13       aku: 
cb70cf4ad6 2007-10-13       aku:     method branchnr    {} { return $mynr }
cb70cf4ad6 2007-10-13       aku:     method parentrevnr {} { return $mybranchparentrevnr }
cb70cf4ad6 2007-10-13       aku:     method childrevnr  {} { return $mybranchchildrevnr }
cb70cf4ad6 2007-10-13       aku:     method haschild    {} { return [expr {$mybranchchildrevnr ne ""}] }
177a0cc55c 2007-10-17       aku:     method parent      {} { return $mybranchparent }
cb70cf4ad6 2007-10-13       aku:     method child       {} { return $mybranchchild }
e5441b908d 2007-10-15       aku:     method position    {} { return $mybranchposition }
177a0cc55c 2007-10-17       aku: 
cb70cf4ad6 2007-10-13       aku: 
cb70cf4ad6 2007-10-13       aku:     # Tag acessor methods.
cb70cf4ad6 2007-10-13       aku: 
e5441b908d 2007-10-15       aku:     method tagrevnr  {}    { return $mynr }
e5441b908d 2007-10-15       aku:     method settagrev {rev} {set mytagrev $rev ; return }
e5441b908d 2007-10-15       aku: 
e5441b908d 2007-10-15       aku:     # Derived information
e5441b908d 2007-10-15       aku: 
e5441b908d 2007-10-15       aku:     method lod {} { return $mylod }
e5441b908d 2007-10-15       aku: 
e5441b908d 2007-10-15       aku:     method setlod {lod} {
e5441b908d 2007-10-15       aku: 	set mylod $lod
177a0cc55c 2007-10-17       aku: 	$self checklod
177a0cc55c 2007-10-17       aku: 	return
177a0cc55c 2007-10-17       aku:     }
177a0cc55c 2007-10-17       aku: 
177a0cc55c 2007-10-17       aku:     method checklod {} {
177a0cc55c 2007-10-17       aku: 	# Consistency check. The symbol's line-of-development has to
177a0cc55c 2007-10-17       aku: 	# be same as the line-of-development of its source (parent
177a0cc55c 2007-10-17       aku: 	# revision of a branch, revision of a tag itself).
e5441b908d 2007-10-15       aku: 
e5441b908d 2007-10-15       aku: 	switch -exact -- $mytype {
e5441b908d 2007-10-15       aku: 	    branch  { set slod [$mybranchparent lod] }
e5441b908d 2007-10-15       aku: 	    tag     { set slod [$mytagrev       lod] }
e5441b908d 2007-10-15       aku: 	}
e5441b908d 2007-10-15       aku: 
e5441b908d 2007-10-15       aku: 	if {$mylod ne $slod} {
177a0cc55c 2007-10-17       aku: 	    trouble fatal "For $mytype [$mysymbol name]: LOD conflict with source, '[$mylod name]' vs. '[$slod name]'"
e5441b908d 2007-10-15       aku: 	    return
e5441b908d 2007-10-15       aku: 	}
84de38d73f 2007-10-10       aku: 	return
84de38d73f 2007-10-10       aku:     }
84de38d73f 2007-10-10       aku: 
84de38d73f 2007-10-10       aku:     # # ## ### ##### ######## #############
84de38d73f 2007-10-10       aku:     ## State
84de38d73f 2007-10-10       aku: 
cb70cf4ad6 2007-10-13       aku:     ## Basic, all symbols _________________
cb70cf4ad6 2007-10-13       aku: 
da9295c6f6 2007-10-12       aku:     variable mytype   {} ; # Symbol type, 'tag', or 'branch'.
cb70cf4ad6 2007-10-13       aku:     variable mynr     {} ; # Revision number of a 'tag', branch number
cb70cf4ad6 2007-10-13       aku: 			   # of a 'branch'.
cb70cf4ad6 2007-10-13       aku:     variable mysymbol {} ; # Reference to the symbol object of this
cb70cf4ad6 2007-10-13       aku: 			   # symbol at the project level.
e5441b908d 2007-10-15       aku:     variable mylod    {} ; # Reference to the line-of-development
e5441b908d 2007-10-15       aku: 			   # object the symbol belongs to. An
e5441b908d 2007-10-15       aku: 			   # alternative idiom would be to call it the
e5441b908d 2007-10-15       aku: 			   # branch the symbol is on. This reference
177a0cc55c 2007-10-17       aku: 			   # is to a project-level object (symbol or
177a0cc55c 2007-10-17       aku: 			   # trunk).
cb70cf4ad6 2007-10-13       aku: 
cb70cf4ad6 2007-10-13       aku:     ## Branch symbols _____________________
cb70cf4ad6 2007-10-13       aku: 
cb70cf4ad6 2007-10-13       aku:     variable mybranchparentrevnr {} ; # The number of the parent
cb70cf4ad6 2007-10-13       aku: 				      # revision, derived from our
cb70cf4ad6 2007-10-13       aku: 				      # branch number (mynr).
cb70cf4ad6 2007-10-13       aku:     variable mybranchparent      {} ; # Reference to the revision
cb70cf4ad6 2007-10-13       aku: 				      # (object) which spawns the
cb70cf4ad6 2007-10-13       aku: 				      # branch.
cb70cf4ad6 2007-10-13       aku:     variable mybranchchildrevnr  {} ; # Number of the first revision
cb70cf4ad6 2007-10-13       aku: 				      # committed on this branch.
cb70cf4ad6 2007-10-13       aku:     variable mybranchchild       {} ; # Reference to the revision
cb70cf4ad6 2007-10-13       aku: 				      # (object) first committed on
cb70cf4ad6 2007-10-13       aku: 				      # this branch.
cb70cf4ad6 2007-10-13       aku:     variable mybranchposition    {} ; # Relative id of the branch in
cb70cf4ad6 2007-10-13       aku: 				      # the file, to sort into
cb70cf4ad6 2007-10-13       aku: 				      # creation order.
cb70cf4ad6 2007-10-13       aku: 
cb70cf4ad6 2007-10-13       aku:     ## Tag symbols ________________________
e5441b908d 2007-10-15       aku: 
e5441b908d 2007-10-15       aku:     variable mytagrev {} ; # Reference to the revision object the tag
e5441b908d 2007-10-15       aku: 			   # is on, identified by 'mynr'.
cb70cf4ad6 2007-10-13       aku: 
cb70cf4ad6 2007-10-13       aku:     # ... nothing special ... (only mynr, see basic)
da9295c6f6 2007-10-12       aku: 
84de38d73f 2007-10-10       aku:     # # ## ### ##### ######## #############
84de38d73f 2007-10-10       aku:     ## Internal methods
cb70cf4ad6 2007-10-13       aku: 
cb70cf4ad6 2007-10-13       aku:     proc SetupBranch {} {
cb70cf4ad6 2007-10-13       aku: 	upvar 1 mybranchparentrevnr mybranchparentrevnr mynr mynr
cb70cf4ad6 2007-10-13       aku: 	set mybranchparentrevnr [rev 2branchparentrevnr  $mynr]
cb70cf4ad6 2007-10-13       aku: 	return
cb70cf4ad6 2007-10-13       aku:     }
84de38d73f 2007-10-10       aku: 
84de38d73f 2007-10-10       aku:     # # ## ### ##### ######## #############
84de38d73f 2007-10-10       aku:     ## Configuration
84de38d73f 2007-10-10       aku: 
84de38d73f 2007-10-10       aku:     pragma -hastypeinfo    no  ; # no type introspection
84de38d73f 2007-10-10       aku:     pragma -hasinfo        no  ; # no object introspection
84de38d73f 2007-10-10       aku:     pragma -hastypemethods no  ; # type is not relevant.
84de38d73f 2007-10-10       aku: 
84de38d73f 2007-10-10       aku:     # # ## ### ##### ######## #############
84de38d73f 2007-10-10       aku: }
84de38d73f 2007-10-10       aku: 
84de38d73f 2007-10-10       aku: namespace eval ::vc::fossil::import::cvs::file {
84de38d73f 2007-10-10       aku:     namespace export sym
cb70cf4ad6 2007-10-13       aku:     namespace eval sym {
cb70cf4ad6 2007-10-13       aku: 	namespace import ::vc::fossil::import::cvs::file::rev
cb70cf4ad6 2007-10-13       aku: 	namespace import ::vc::tools::trouble
cb70cf4ad6 2007-10-13       aku:     }
84de38d73f 2007-10-10       aku: }
84de38d73f 2007-10-10       aku: 
84de38d73f 2007-10-10       aku: # # ## ### ##### ######## ############# #####################
84de38d73f 2007-10-10       aku: ## Ready
84de38d73f 2007-10-10       aku: 
84de38d73f 2007-10-10       aku: package provide vc::fossil::import::cvs::file::sym 1.0
84de38d73f 2007-10-10       aku: return