File Annotation
Not logged in
fdbc01df95 2007-10-06       aku: ## -*- tcl -*-
fdbc01df95 2007-10-06       aku: # # ## ### ##### ######## ############# #####################
fdbc01df95 2007-10-06       aku: ## Copyright (c) 2007 Andreas Kupries.
fdbc01df95 2007-10-06       aku: #
fdbc01df95 2007-10-06       aku: # This software is licensed as described in the file LICENSE, which
fdbc01df95 2007-10-06       aku: # you should have received as part of this distribution.
fdbc01df95 2007-10-06       aku: #
fdbc01df95 2007-10-06       aku: # This software consists of voluntary contributions made by many
fdbc01df95 2007-10-06       aku: # individuals.  For exact contribution history, see the revision
fdbc01df95 2007-10-06       aku: # history and logs, available at http://fossil-scm.hwaci.com/fossil
fdbc01df95 2007-10-06       aku: # # ## ### ##### ######## ############# #####################
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: ## Pass II. This pass parses the colected rcs archives and extracts
fdbc01df95 2007-10-06       aku: ## all the information they contain (revisions, and symbols).
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: # # ## ### ##### ######## ############# #####################
fdbc01df95 2007-10-06       aku: ## Requirements
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: package require Tcl 8.4                             ; # Required runtime.
fdbc01df95 2007-10-06       aku: package require snit                                ; # OO system.
fdbc01df95 2007-10-06       aku: package require fileutil::traverse                  ; # Directory traversal.
fdbc01df95 2007-10-06       aku: package require fileutil                            ; # File & path utilities.
fdbc01df95 2007-10-06       aku: package require vc::tools::trouble                  ; # Error reporting.
fdbc01df95 2007-10-06       aku: package require vc::tools::log                      ; # User feedback.
fdbc01df95 2007-10-06       aku: package require vc::fossil::import::cvs::pass       ; # Pass management.
fdbc01df95 2007-10-06       aku: package require vc::fossil::import::cvs::repository ; # Repository management.
8a93ffa9c1 2007-10-06       aku: package require vc::fossil::import::cvs::state      ; # State storage.
8a93ffa9c1 2007-10-06       aku: package require vc::rcs::parser                     ; # Rcs archive data extraction.
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: # # ## ### ##### ######## ############# #####################
fdbc01df95 2007-10-06       aku: ## Register the pass with the management
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: vc::fossil::import::cvs::pass define \
fdbc01df95 2007-10-06       aku:     CollectRev \
fdbc01df95 2007-10-06       aku:     {Collect revisions and symbols} \
fdbc01df95 2007-10-06       aku:     ::vc::fossil::import::cvs::pass::collrev
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: # # ## ### ##### ######## ############# #####################
fdbc01df95 2007-10-06       aku: ##
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: snit::type ::vc::fossil::import::cvs::pass::collrev {
fdbc01df95 2007-10-06       aku:     # # ## ### ##### ######## #############
fdbc01df95 2007-10-06       aku:     ## Public API
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku:     typemethod setup {} {
fdbc01df95 2007-10-06       aku: 	# Define names and structure of the persistent state of this
fdbc01df95 2007-10-06       aku: 	# pass.
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	state reading project
fdbc01df95 2007-10-06       aku: 	state reading file
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	# We deal with per project and per file data, the first
fdbc01df95 2007-10-06       aku: 	# collated from the second.
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	# Per file we have general information, ..., and then
fdbc01df95 2007-10-06       aku: 	# revisions and symbols. The latter can be further separated
fdbc01df95 2007-10-06       aku: 	# into tags and branches. At project level the per-file
fdbc01df95 2007-10-06       aku: 	# symbols information is merged.
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	# File level ...
fdbc01df95 2007-10-06       aku: 	#	Event, Revision, Symbol, Branch, Tag
fdbc01df95 2007-10-06       aku: 	#
fdbc01df95 2007-10-06       aku: 	#	Tag    <- Symbol <- Event
fdbc01df95 2007-10-06       aku: 	#	Branch <- Symbol <- Event
fdbc01df95 2007-10-06       aku: 	#	Revision <- Event
fdbc01df95 2007-10-06       aku: 	#
fdbc01df95 2007-10-06       aku: 	#	Head revision, Principal branch, Comment
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	state writing rcs {
fdbc01df95 2007-10-06       aku: 	    fid       INTEGER  NOT NULL  REFERENCES file,    -- RCS inherit from FILE
fdbc01df95 2007-10-06       aku: 	    head      INTEGER  NOT NULL  REFERENCES revision,
fdbc01df95 2007-10-06       aku: 	    principal INTEGER  NOT NULL  REFERENCES branch,
fdbc01df95 2007-10-06       aku: 	    comment   TEXT     NOT NULL
fdbc01df95 2007-10-06       aku: 	}
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	state writing item {
fdbc01df95 2007-10-06       aku: 	    iid  INTEGER  NOT NULL  PRIMARY KEY AUTOINCREMENT,
fdbc01df95 2007-10-06       aku: 	    type INTEGER  NOT NULL,                 -- enum { tag = 1, branch, revision }
fdbc01df95 2007-10-06       aku: 	    fid  INTEGER  NOT NULL  REFERENCES file  -- File the item belongs to
fdbc01df95 2007-10-06       aku: 	}
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	state writing revision {
fdbc01df95 2007-10-06       aku: 	    iid   INTEGER  NOT NULL  REFERENCES item,   -- REVISION inherit from ITEM
fdbc01df95 2007-10-06       aku: 	    lod   INTEGER  NOT NULL  REFERENCES symbol, -- Line of development
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	    -- The tags and branches belonging to a revision can be
fdbc01df95 2007-10-06       aku: 	    -- determined by selecting on the backreferences in the
fdbc01df95 2007-10-06       aku: 	    -- tag and branch tables.
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	    rev   TEXT     NOT NULL,                     -- revision number
fdbc01df95 2007-10-06       aku: 	    date  INTEGER  NOT NULL,                     -- date of entry, seconds since epoch
fdbc01df95 2007-10-06       aku: 	    state TEXT     NOT NULL,                     -- state of revision
fdbc01df95 2007-10-06       aku: 	    mid   INTEGER  NOT NULL REFERENCES meta,     -- meta data (author, commit message)
fdbc01df95 2007-10-06       aku: 	    next  INTEGER  NOT NULL REFERENCES revision, -- next in chain of revisions.
fdbc01df95 2007-10-06       aku: 	    cs    INTEGER  NOT NULL, -- Revision content as offset and length
fdbc01df95 2007-10-06       aku: 	    cl    INTEGER  NOT NULL  -- into the archive file.
fdbc01df95 2007-10-06       aku: 	}
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	state writing tag {
fdbc01df95 2007-10-06       aku: 	    iid INTEGER  NOT NULL  REFERENCES item,     -- TAG inherit from ITEM
fdbc01df95 2007-10-06       aku: 	    sid INTEGER  NOT NULL  REFERENCES symbol,   -- Symbol capturing the tag
fdbc01df95 2007-10-06       aku: 	    rev INTEGER  NOT NULL  REFERENCES revision -- The revision being tagged.
fdbc01df95 2007-10-06       aku: 	}
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	state writing branch {
fdbc01df95 2007-10-06       aku: 	    iid   INTEGER  NOT NULL  REFERENCES item,     -- BRANCH inherit from ITEM
fdbc01df95 2007-10-06       aku: 	    sid   INTEGER  NOT NULL  REFERENCES symbol,   -- Symbol capturing the branch
fdbc01df95 2007-10-06       aku: 	    root  INTEGER  NOT NULL  REFERENCES revision, -- Revision the branch sprouts from
fdbc01df95 2007-10-06       aku: 	    first INTEGER            REFERENCES revision, -- First revision committed to the branch
fdbc01df95 2007-10-06       aku: 	    bra   TEXT     NOT NULL                       -- branch number
fdbc01df95 2007-10-06       aku: 	}
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	# It is in principle possible to collapse the four tables
fdbc01df95 2007-10-06       aku: 	# above (from item to barnch) into a single table, with
fdbc01df95 2007-10-06       aku: 	# similar columns merged, and unused columns allowing NULL,
fdbc01df95 2007-10-06       aku: 	# the use determined by the type. We may do that if the
fdbc01df95 2007-10-06       aku: 	# performance is not good enough, but for now clarity of
fdbc01df95 2007-10-06       aku: 	# structure over efficiency.
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	# Project level ...
fdbc01df95 2007-10-06       aku: 	#	pLineOfDevelopment, pSymbol, pBranch, pTag, pTrunk
fdbc01df95 2007-10-06       aku: 	#
fdbc01df95 2007-10-06       aku: 	#	pTrunk  <- pLineOfDevelopment
fdbc01df95 2007-10-06       aku: 	#	pBranch <- pSymbol, pLineOfDevelopment
fdbc01df95 2007-10-06       aku: 	#	pTag    <- pSymbol, pLineOfDevelopment
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	state writing symbol {
fdbc01df95 2007-10-06       aku: 	    sid  INTEGER  NOT NULL  PRIMARY KEY AUTOINCREMENT,
fdbc01df95 2007-10-06       aku: 	    pid  INTEGER  NOT NULL  REFERENCES project,  -- Project the symbol belongs to
fdbc01df95 2007-10-06       aku: 	    name TEXT     NOT NULL,
fdbc01df95 2007-10-06       aku: 	    type INTEGER  NOT NULL,                      -- enum { tag = 1, branch, undefined }
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	    tag_count    INTEGER  NOT NULL, -- How often the symbol is used as tag.
fdbc01df95 2007-10-06       aku: 	    branch_count INTEGER  NOT NULL, -- How often the symbol is used as branch
fdbc01df95 2007-10-06       aku: 	    commit_count INTEGER  NOT NULL, -- How often a file was committed on the symbol
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	    UNIQUE (pid, name) -- Symbols are unique within the project
fdbc01df95 2007-10-06       aku: 	}
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	state writing blocker {
fdbc01df95 2007-10-06       aku: 	    sid INTEGER  NOT NULL  REFERENCES symbol, --
fdbc01df95 2007-10-06       aku: 	    bid INTEGER  NOT NULL  REFERENCES symbol, -- Sprouted from sid, blocks it.
fdbc01df95 2007-10-06       aku: 	    UNIQUE (sid, bid)
fdbc01df95 2007-10-06       aku: 	}
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	state writing parent {
fdbc01df95 2007-10-06       aku: 	    sid INTEGER  NOT NULL  REFERENCES symbol, --
fdbc01df95 2007-10-06       aku: 	    pid INTEGER  NOT NULL  REFERENCES symbol, -- Possible parent of sid
fdbc01df95 2007-10-06       aku: 	    UNIQUE (sid, pid)
fdbc01df95 2007-10-06       aku: 	}
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	state writing meta {
fdbc01df95 2007-10-06       aku: 	    mid INTEGER  NOT NULL  PRIMARY KEY  AUTOINCREMENT,
fdbc01df95 2007-10-06       aku: 	    pid INTEGER  NOT NULL  REFERENCES project,  -- project the commit was on
fdbc01df95 2007-10-06       aku: 	    bid INTEGER  NOT NULL  REFERENCES symbol,   -- branch the commit was on
fdbc01df95 2007-10-06       aku: 	    aid INTEGER  NOT NULL  REFERENCES author,
fdbc01df95 2007-10-06       aku: 	    cid INTEGER  NOT NULL  REFERENCES cmessage,
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	    UNIQUE (pid, bid, aid, cid)
fdbc01df95 2007-10-06       aku: 	}
fdbc01df95 2007-10-06       aku: 
8a93ffa9c1 2007-10-06       aku: 	# Author and commit message information is fully global,
8a93ffa9c1 2007-10-06       aku: 	# i.e. per repository.
8a93ffa9c1 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	state writing author {
fdbc01df95 2007-10-06       aku: 	    aid  INTEGER  NOT NULL  PRIMARY KEY  AUTOINCREMENT,
fdbc01df95 2007-10-06       aku: 	    name TEXT     NOT NULL  UNIQUE
fdbc01df95 2007-10-06       aku: 	}
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	state writing cmessage {
fdbc01df95 2007-10-06       aku: 	    cid  INTEGER  NOT NULL  PRIMARY KEY  AUTOINCREMENT,
fdbc01df95 2007-10-06       aku: 	    text TEXT     NOT NULL  UNIQUE
fdbc01df95 2007-10-06       aku: 	}
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	# Consistency constraints.
fdbc01df95 2007-10-06       aku: 	#
fdbc01df95 2007-10-06       aku: 	# Items (Tags, Branches, Revisions) belong to a file to a
fdbc01df95 2007-10-06       aku: 	# project. All refer to other items, and symbols, which again
fdbc01df95 2007-10-06       aku: 	# belong to a project. The projects have to agree with each
fdbc01df95 2007-10-06       aku: 	# other. I.e. items may not refer to items or symbols which
fdbc01df95 2007-10-06       aku: 	# belong to a different project than their own.
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	return
fdbc01df95 2007-10-06       aku:     }
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku:     typemethod run {} {
8a93ffa9c1 2007-10-06       aku: 	set rbase [repository base?]
8a93ffa9c1 2007-10-06       aku: 	foreach project [repository projects] {
8a93ffa9c1 2007-10-06       aku: 	    set base [file join $rbase [$project base]]
8a93ffa9c1 2007-10-06       aku: 	    log write 1 collrev "Processing $base"
8a93ffa9c1 2007-10-06       aku: 
8a93ffa9c1 2007-10-06       aku: 	    foreach file [$project files] {
8a93ffa9c1 2007-10-06       aku: 		set path [$file path]
8a93ffa9c1 2007-10-06       aku: 		log write 2 collrev "Parsing $path"
ec053168a8 2007-10-06       aku: 		parser process [file join $base $path] $file
8a93ffa9c1 2007-10-06       aku: 	    }
8a93ffa9c1 2007-10-06       aku: 	}
8a93ffa9c1 2007-10-06       aku: 
8a93ffa9c1 2007-10-06       aku: 	repository printrevstatistics
8a93ffa9c1 2007-10-06       aku: 	repository persistrev
8a93ffa9c1 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: 	log write 1 collrev "Scan completed"
fdbc01df95 2007-10-06       aku: 	return
fdbc01df95 2007-10-06       aku:     }
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku:     # # ## ### ##### ######## #############
fdbc01df95 2007-10-06       aku:     ## Internal methods
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku:     # # ## ### ##### ######## #############
fdbc01df95 2007-10-06       aku:     ## Configuration
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku:     pragma -hasinstances   no ; # singleton
fdbc01df95 2007-10-06       aku:     pragma -hastypeinfo    no ; # no introspection
fdbc01df95 2007-10-06       aku:     pragma -hastypedestroy no ; # immortal
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku:     # # ## ### ##### ######## #############
fdbc01df95 2007-10-06       aku: }
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: namespace eval ::vc::fossil::import::cvs::pass {
fdbc01df95 2007-10-06       aku:     namespace export collrev
fdbc01df95 2007-10-06       aku:     namespace eval collrev {
ec053168a8 2007-10-06       aku: 	namespace import ::vc::rcs::parser
fdbc01df95 2007-10-06       aku: 	namespace import ::vc::fossil::import::cvs::repository
fdbc01df95 2007-10-06       aku: 	namespace import ::vc::fossil::import::cvs::state
fdbc01df95 2007-10-06       aku: 	namespace import ::vc::tools::trouble
fdbc01df95 2007-10-06       aku: 	namespace import ::vc::tools::log
fdbc01df95 2007-10-06       aku: 	log register collrev
fdbc01df95 2007-10-06       aku:     }
fdbc01df95 2007-10-06       aku: }
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: # # ## ### ##### ######## ############# #####################
fdbc01df95 2007-10-06       aku: ## Ready
fdbc01df95 2007-10-06       aku: 
fdbc01df95 2007-10-06       aku: package provide vc::fossil::import::cvs::pass::collrev 1.0
fdbc01df95 2007-10-06       aku: return