home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
ccsysvdbob.tcl
< prev
next >
Wrap
Text File
|
1997-06-06
|
16KB
|
615 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)ccsysvdbob.tcl /main/hindenburg/10
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)ccsysvdbob.tcl /main/hindenburg/10 6 Jun 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
require_module_file "newccfiled.tcl" clearcase
require_module_file "ccsetconfi.tcl" clearcase
require_module_file "cccreatebr.tcl" clearcase
require_module_file "ccdestroyb.tcl" clearcase
require_module_file "ccunchecko.tcl" clearcase
require_module_file "cccheckout.tcl" clearcase
require_module_file "cccheckind.tcl" clearcase
require_module_file "ccnewbranch.tcl" clearcas
require_module_file "ccremovebr.tcl" clearcase
require_module_file "ccchangeco.tcl" clearcase
require_module_file "vssysdialo.tcl" clearcase
require_module_file "yesnodialo.tcl" vcm
require platform.tcl
# End user added include file section
require_module_file "ccsystem.tcl" clearcase
require_module_file "vssysvdbob.tcl" vcm
# This class represents a system with ClearCase files in the browser.
Class CCSysVDbObj : {CCSystem VSSysVDbObj} {
constructor
method destructor
method promoter
method promoteFile
method path
method localFileVersions
method copy
method addCCFile
method vsFiles
method fileList
method checkOutFiles
method checkInFiles
method checkInDirectories
method unCheckOutFiles
method createBranch
method destroyBranch
method createBranchType
method destroyBranchType
method listCheckOuts
method unreserveFiles
method reserveFiles
method changeFileComment
method showView
method changeView
method showConfigSpec
method changeConfigSpec
method setConfigSpec
method configClearmake
method startClearCase
method initializeVCMVars
# Used to hold information about files in this system:
# path to Status, Version and Rule. Used for performance reasons.
#
attribute ccFileInfoDict
}
global CCSysVDbObj::triedViewStart
set CCSysVDbObj::triedViewStart 0
constructor CCSysVDbObj {class this name i_name} {
set this [CCSystem::constructor $class $this $name]
set this [VSSysVDbObj::constructor $class $this $i_name]
# Start constructor user section
# End constructor user section
return $this
}
method CCSysVDbObj::destructor {this} {
# Start destructor user section
# End destructor user section
$this CCSystem::destructor
$this VSSysVDbObj::destructor
}
# Reuse associations of VSSysVDbObj.
#
proc CCSysVDbObj::associations {} {
return [VSSysVDbObj::associations]
}
# Reuse childTypes of VSSysVDbObj.
#
proc CCSysVDbObj::childTypes {assoc} {
return [VSSysVDbObj::childTypes $assoc]
}
# Reuse controlledLists of VSSysVDbObj.
#
proc CCSysVDbObj::controlledLists {} {
return [VSSysVDbObj::controlledLists]
}
# Reuse info properties of VSSysVDbObj.
#
proc CCSysVDbObj::infoProperties {} {
return [VSSysVDbObj::infoProperties]
}
method CCSysVDbObj::promoter {this} {
$this ccFileInfoDict [Dictionary new]
# determine view
set view [m4_var get M4_ccase_view]
if { $view == "" } {
set view [CCCommand::getWorkingView]
if { $view != "" } {
m4_var set M4_ccase_view $view
}
} else {
# start view if necessary, make sure to try only once
if { ![CCCommand::viewIsActive $view] } {
global CCSysVDbObj::triedViewStart
if { !${CCSysVDbObj::triedViewStart} } {
set CCSysVDbObj::triedViewStart 1
wmtkmessage "Starting view $view..."
CCCommand::startView $view
wmtkmessage ""
}
}
}
$this VSSysVDbObj::promoter
}
# Promotes file to a CCFileUiObj.
#
method CCSysVDbObj::promoteFile {this file} {
CCFileUiObj promote $file
}
# Redefine to call path of CCSystem.
#
method CCSysVDbObj::path {this} {
return [$this CCSystem::path]
}
# Resolve ambiguity: call localFileVersions of CCSystem.
#
method CCSysVDbObj::localFileVersions {this} {
return [$this CCSystem::localFileVersions]
}
# Call copy of VSSysVdbObj.
#
method CCSysVDbObj::copy {this args} {
eval $this VSSysVDbObj::copy $args
}
# Pop up dialog for specifying a new ClearCase file.
#
method CCSysVDbObj::addCCFile {this} {
set box .main.newCCFile
if { ![isCommand $box] } {
NewCCFileDialog new $box
}
$box popUp
}
# Redefinition to perform system initialization and cache updates.
#
method CCSysVDbObj::vsFiles {this} {
# read custom files for this system
if { ![$this initializedCustomization] } {
$this initializeCustomization
}
$this initializeVCMVars
# sanity check for view
if { [m4_var get M4_ccase_view] == "" } {
wmtkwarning "No view set or specified in M4_ccase_view\nPlease use Change View in the ClearCase menu to select a view"
return
}
set files [$this CCSystem::vsFiles]
$this updateFileInfo $files
return $files
}
# Returns a list of ClearCase controlled files in the
# directories specified by pathList and
# fills ccFileInfoDict with additional info about the files.
#
method CCSysVDbObj::fileList {this pathList} {
# refresh ccFileInfoDict
foreach name [[$this ccFileInfoDict] names] {
[$this ccFileInfoDict] unset $name
}
CCCommand::longListing $pathList [$this ccFileInfoDict]
set fileList {}
foreach fileName [[$this ccFileInfoDict] names] {
lappend fileList [path_name file $fileName]
}
return $fileList
}
# Pops up checkout dialog to specify comments and checks out the selected files.
# Reserved indicates the type of checkout requested.
#
method CCSysVDbObj::checkOutFiles {this reserved} {
if { ![isCommand .main.checkout] } {
CCCheckOutDialog new .main.checkout
}
.main.checkout reserved $reserved
.main.checkout popUp
}
# Pops up dialog to specify comments for selected files. A check button
# allows reuse of the checkout comments.
#
method CCSysVDbObj::checkInFiles {this} {
if [isCommand .main.checkin] {
set newSelection [.main selectedObjSet]
set oldSelection [.main.checkin selectedFiles]
if { [llength $oldSelection] != [llength $newSelection] } {
.main.checkin.col delete
.main.checkin delete
}
}
if { ![isCommand .main.checkin] } {
CCCheckInDialog new .main.checkin
}
.main.checkin popUp
}
# Collects directories in system path that
# are checked out, lists them for confirmation
# and checks them in.
#
method CCSysVDbObj::checkInDirectories {this} {
# get paths
set pathList {}
foreach file [$this CCSystem::vsFiles] {
set filePath [path_name directory [$file path]]
set existsInList 0
foreach path $pathList {
if { [file_split $path] == [file_split $filePath] } {
set existsInList 1
}
}
if !$existsInList {
lappend pathList $filePath
}
}
# get checked out directories
set checkedOutList {}
while { [llength $pathList] > 0 } {
set newPaths {}
foreach path $pathList {
if [CCCommand::isCheckedOut $path] {
lappend newPaths [path_name directory $path]
lappend checkedOutList $path
}
}
set pathList $newPaths
}
if { ![llength $checkedOutList] } {
wmtkinfo "The directories of this system are checked in"
return
}
if { ![isCommand .main.checkindirectories] } {
require_module_file "ccdircheck.tcl" clearcase
CCDirCheckInDialog new .main.checkindirectories
}
.main.checkindirectories directories $checkedOutList
.main.checkindirectories popUp
}
# Pops up dialog to ask whether a private copies must be kept and
# removes the checkouts of the files.
#
method CCSysVDbObj::unCheckOutFiles {this} {
if { ![isCommand .main.uncheckout] } {
CCUncheckOutDialog new .main.uncheckout
}
.main.uncheckout popUp
}
# Pops up a dialog that allows selection of a branch and specification of a comment.
#
method CCSysVDbObj::createBranch {this} {
set branches [CCCommand::getBranchTypes [$this path]]
if { $branches == "" } {
vsCommandHandler error "There are no branches to select from"
return
}
if { ![isCommand .main.createbranch] } {
CCCreateBranchDialog new .main.createbranch
}
.main.createbranch branches $branches
.main.createbranch popUp
}
# Pops up confirmation dialog and removes branch if requested.
#
method CCSysVDbObj::destroyBranch {this} {
set selectedFile [lindex [.main selectedObjSet] 0]
set extendedPath "[$selectedFile path]\@\@[$selectedFile getInfo Version]"
# strip version number to get branch name
regsub {[\\\/][0-9]+} $extendedPath "" branch
if { ![isCommand .main.destroybranch] } {
CCDestroyBranchDialog new .main.destroybranch
}
set warning [CCCommand::getRemoveBranchWarning $branch]
if { $warning == "" } {
return
}
.main.destroybranch message $warning
.main.destroybranch branch $branch
.main.destroybranch popUp
}
# Pops up dialog to specify branch name and creation comments.
# Branch is created in vob indicated by system path.
#
method CCSysVDbObj::createBranchType {this} {
if { ![isCommand .main.createbranchtype] } {
CCNewBranchDialog new .main.createbranchtype
}
.main.createbranchtype vobPath [$this path]
.main.createbranchtype popUp
}
# Pops up list of branches and destroy selected branches.
#
method CCSysVDbObj::destroyBranchType {this} {
set branches [CCCommand::getBranchTypes [$this path]]
if { $branches == "" } {
vsCommandHandler error "There are no branches to select from"
return
}
if { ![isCommand .main.destroybranchtype] } {
CCRemoveBranchTypeDialog new .main.destroybranchtype
}
.main.destroybranchtype vobPath [$this path]
.main.destroybranchtype branches $branches
.main.destroybranchtype popUp
}
# Pops up an information dialog with the checkouts of all selected files.
#
method CCSysVDbObj::listCheckOuts {this} {
set selectedFilePath [[lindex [.main selectedObjSet] 0] path]
set checkOutCommand [CCCommand::listCheckout $selectedFilePath]
if { ![vsCommandHandler executeSilent $checkOutCommand] } {
return
}
set checkOuts "[$checkOutCommand output]"
if { $checkOuts == "" } {
set checkOuts "None"
}
set message "Checkouts of $selectedFilePath:\n\n$checkOuts"
wmtkinfo "$message"
}
# Changes the checkout status of the files from reserved to unreserved.
#
method CCSysVDbObj::unreserveFiles {this} {
if { ![isCommand .main.unreserve] } {
VSSysDialog new .main.unreserve
.main.unreserve vsMethod { $file unreserve }
}
.main.unreserve selectedFiles [.main selectedObjSet]
.main.unreserve processFiles
}
# Changes the checkout status of the files from unreserved to reserved.
#
method CCSysVDbObj::reserveFiles {this} {
if { ![isCommand .main.reserve] } {
VSSysDialog new .main.reserve
.main.reserve vsMethod { $file reserve }
}
.main.reserve selectedFiles [.main selectedObjSet]
.main.reserve processFiles
}
# Pops up a dialog with the old comment of the file and allows edit.
#
method CCSysVDbObj::changeFileComment {this} {
if { ![isCommand .main.changecomment] } {
CCChangeCommentDialog new .main.changecomment
}
.main.changecomment popUp
}
# Show the current view in an information dialog.
#
method CCSysVDbObj::showView {this} {
set view [m4_var get M4_ccase_view]
if { $view == "" } {
set view "None"
}
InfoDialog new .main.viewinfo \
-title "Current view" \
-message "$view" \
-okPressed { %this delete }
.main.viewinfo delHelpButton
.main.viewinfo popUp
}
# Shows a list with active views and allows selection of a view or specification of a different one.
# Sets the view if possible.
#
method CCSysVDbObj::changeView {this} {
set views [CCCommand::getActiveViews]
set currentView [m4_var get M4_ccase_view]
$this updatePath
interface TemplateDialog .main.activeviews {
title "Change View"
modal 1
DropDwnComboBox viewlist {
}
}
.main.activeviews.viewlist config \
-entrySet $views \
-text $currentView
.main.activeviews okPressed {
set selectedView [string trim [%this.viewlist text]]
# check if specified view was one of the active views
set viewOk 0
if { [lsearch [%this.viewlist entrySet] $selectedView] != -1 } {
set viewOk 1
} else {
# specified view was not active, try to start it
if [CCCommand::startView $selectedView] {
set viewOk 1
}
}
if { $viewOk } {
m4_var set M4_ccase_view $selectedView
.main updateView
}
%this delete
}
.main.activeviews delHelpButton
.main.activeviews popUp
}
# Shows the config spec of the current view.
#
method CCSysVDbObj::showConfigSpec {this} {
set view [m4_var get M4_ccase_view]
if { $view == "" } {
vsCommandHandler error "No view specified"
return
}
set configSpec [CCCommand::getConfigSpec $view]
# error handling is done by getConfigSpec so return if
# the config spec is empty
if { $configSpec == "" } {
return
}
InfoDialog new .main.configspec \
-title "Config spec" \
-message $configSpec \
-okPressed { %this delete }
.main.configspec delHelpButton
.main.configspec popUp
}
# Allows edit of the config spec of the current view and sets it after confirmation.
#
method CCSysVDbObj::changeConfigSpec {this} {
set view [m4_var get M4_ccase_view]
if { $view== "" } {
vsCommandHandler error "No view specified"
return
}
# get config spec, copy to temporary file and start editor
set currentConfigSpec [CCCommand::getConfigSpec $view]
set tmpFile [args_file {}]
BasicFS::writeFile $tmpFile $currentConfigSpec
.main startM4Command editor "$tmpFile" \
"$this setConfigSpec [list $tmpFile]" "$tmpFile"
}
# Sets the config spec of the current view to the
# the specified file.
#
method CCSysVDbObj::setConfigSpec {this configSpecFile} {
# callback from config spec editor
set view [m4_var get M4_ccase_view]
# this dialog asks confirmation and sets config spec
CCSetConfigSpecDialog new .main.setconfigspec \
-view $view \
-file $configSpecFile
.main.setconfigspec popUp
}
method CCSysVDbObj::configClearmake {this} {
interface EntryDialog .main.configclearmake {
title "Configure Clearmake"
message "Default Clearmake options:"
modal 1
}
.main.configclearmake entry [m4_var get M4_cmake_options]
.main.configclearmake okPressed {
set options [%this entry]
# set make command: clearmake for unix, omake for Windows
if $win95 {
set makeCommand "omake $options"
} else {
set makeCommand "clearmake $options"
}
[[ClientContext::global] currentConfig] \
setProperty makeCommand $makeCommand
m4_var set M4_cmake_options $options
}
.main.configclearmake delHelpButton
.main.configclearmake popUp
}
# Starts the graphical clearcase environment in the system path.
#
method CCSysVDbObj::startClearCase {this} {
if $win95 {
set command "wclearcase"
} else {
set command "xclearcase"
}
set command "$command -file [quoteIf [$this path]]"
system "$command &"
}
# Not needed for ClearCase.
#
method CCSysVDbObj::initializeVCMVars {this} {
#empty
}
# Do not delete this line -- regeneration end marker