home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
ccfile.tcl
< prev
next >
Wrap
Text File
|
1997-09-04
|
6KB
|
234 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)ccfile.tcl /main/titanic/6
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)ccfile.tcl /main/titanic/6 4 Sep 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
require_module_file "vsfile.tcl" vcm
# This class represents a ClearCase file.
Class CCFile : {VSFile} {
constructor
method destructor
method createVSPath
method createUserPath
method existsInVS
method createInVS
method removeFromVS
method renameInVS
method isCheckedOut
method checkOut
method unCheckOut
method checkIn
method createBranch
method destroyBranch
method reserve
method unreserve
method setComment
method getReference
method deleteReference
method setAttribute
method getAttributeValue
}
constructor CCFile {class this name type system} {
set this [VSFile::constructor $class $this $name $type $system]
# Start constructor user section
# End constructor user section
return $this
}
method CCFile::destructor {this} {
# Start destructor user section
# End destructor user section
$this VSFile::destructor
}
method CCFile::createVSPath {this} {
$this VSFile::createVSPath CC
}
method CCFile::createUserPath {this} {
$this VSFile::createUserPath CC
}
method CCFile::existsInVS {this} {
if [file exists [$this path]] {
return 1
}
return 0
}
method CCFile::createInVS {this args} {
if [$this existsInVS] {
return 0
}
set path [$this path]
set dir [path_name directory $path]
set arguments [lindex $args 0]
set comment [lindex $arguments 0]
# create path if necessary
if { ![file isdirectory $dir] } {
if { ![$this createUserPath] } {
return 0
}
}
# check out directory if necessary
if { ![CCSystem::checkOutDirectory $dir \
"Checked out by ObjectTeam for file creation"] } {
return 0
}
# create the element itself
set ccType [[[$this systemVersion] typeMapper] map [$this type]]
set createCommand [CCCommand::createElem $path $ccType $comment]
return [vsCommandHandler execute $createCommand]
}
method CCFile::removeFromVS {this} {
set path [$this path]
set dir [path_name directory $path]
# check out directory if necessary
if { ![CCSystem::checkOutDirectory $dir \
"Checked out by ObjectTeam for file removal"] } {
return 0
}
set removeCommand [CCCommand::removeName $path]
if [vsCommandHandler execute $removeCommand] {
# remove in user environment if remove in ClearCase succeeded
if [file exists $path] {
BasicFS::removeFile $path
}
return 1
}
return 0
}
method CCFile::renameInVS {this oldName} {
set dir [path_name directory [$this path]]
# check out directory if necessary
if { ![CCSystem::checkOutDirectory $dir \
"Checked out by ObjectTeam for file rename"] } {
return 0
}
# construct old path from new path and old name
set fullName [file tail [$this path]]
regsub ^[$this name] $fullName "" extensionPart
set oldPath [path_name concat [path_name directory [$this path]] \
"${oldName}$extensionPart"]
set renameCommand [CCCommand::rename $oldPath [$this path]]
return [vsCommandHandler execute $renameCommand]
}
# Returns whether the file selected in the view
# is checked out i.e. writable. For performance there is no
# check if the file is actually in the vob.
#
method CCFile::isCheckedOut {this} {
return [file writable [$this path]]
}
method CCFile::checkOut {this comment {reserved 1}} {
set checkoutCommand [CCCommand::checkOut [$this path] $comment $reserved]
return [vsCommandHandler execute $checkoutCommand]
}
method CCFile::unCheckOut {this keepPrivate} {
set unCheckOutCommand [CCCommand::unCheckOut [$this path] $keepPrivate]
return [vsCommandHandler execute $unCheckOutCommand]
}
method CCFile::checkIn {this noComment comment} {
set checkInCommand [CCCommand::checkIn [$this path] $noComment $comment]
return [vsCommandHandler execute $checkInCommand]
}
# Create the named branch on this file.
#
method CCFile::createBranch {this type comment} {
set createBranchCommand [CCCommand::createBranch [$this path] $type $comment]
return [vsCommandHandler execute $createBranchCommand]
}
method CCFile::destroyBranch {this branch} {
set destroyBranchCommand [CCCommand::destroyBranch $branch]
return [vsCommandHandler execute $destroyBranchCommand]
}
# Reserve the checkout of this file.
#
method CCFile::reserve {this} {
set reserveCommand [CCCommand::reserve [$this path]]
return [vsCommandHandler execute $reserveCommand]
}
# Unreserve the checkout for this file.
#
method CCFile::unreserve {this} {
set unreserveCommand [CCCommand::unreserve [$this path]]
return [vsCommandHandler execute $unreserveCommand]
}
# Set the file comment to the specified comment.
#
method CCFile::setComment {this comment} {
set setCommentCommand [CCCommand::changeComment [$this path] $comment]
return [vsCommandHandler execute $setCommentCommand]
}
# Returns the version extended pathname to the specified version.
#
method CCFile::getReference {this {version ""}} {
if { $version == "" } {
return [$this path]
}
return "[$this path]\@\@$version"
}
# Does nothing.
#
method CCFile::deleteReference {this path} {
}
# Sets the specified ClearCase attribute to the
# specified value.
#
method CCFile::setAttribute {this name value} {
set setCommand [CCCommand::setAttribute [$this path] $name $value]
return [vsCommandHandler executeSilent $setCommand]
}
# Get the value of the specified ClearCase attribute.
#
method CCFile::getAttributeValue {this name} {
return [CCCommand::getAttributeValue [$this path] $name]
}
# Do not delete this line -- regeneration end marker