Jump to content


Photo
- - - - -

[Discuss] ClearCase API


  • Please log in to reply
1 reply to this topic

#1 dannyt

dannyt

    Extremely Active

  • Premium Member
  • 397 posts
  • Location:Devon UK
  • Version:LabVIEW 2011
  • Since:2007

Posted 13 June 2011 - 01:38 PM

Posted Image

Name: ClearCase API
Submitter: dannyt
Submitted: 13 Jun 2011
File Updated: 15 Jun 2011
Category: *Uncertified*
LabVIEW Version: 2010
License Type: BSD (Most common)

ClearCase API v1.0.0

Copyright © 2011, Danny Thomson
All rights reserved.

Author: Danny Thomson
LAVA Name: Dannyt
Contact Info: Contact via PM on lavag.org

LabVIEW Versions:
LabVIEW 2010

Dependencies:
oglib_string v2.6-1
oglib_file v3.0.1-1

Description:
The API provides an interface to communicate with the CleaCase source control tool.
This API is not meant as a integrated ClearCase provider in LabVIEW.

Installation and instructions:
Installation is performed by VIPM, after which a palette is created in the user.lib palette.
sourcecode can be found here BitBucket


Examples:
No examples are included

Known Issues:
This package only supports Windows ClearCase clients and only supports Base ClearCase no UCM is supported at present.

Acknowledgements:
Thanks to Ton Plomp for inspiration with his Mecurail API

Version History:
v1.0.0: Initial release of the code.

License:
BSD (Most common)

Support:
If you have any problems with this code or want to suggest features:
please go to lavag.org and Navigate to LAVA > Resources > Code Repository (UnCertified) and
search for the "" support page.

Distribution:
This code was downloaded from the LAVA Code Repository found at lavag.org


Some Details of functions provided
=================================

Supports Windows only, though most of the Cleartool commands and options are the same on Unix

Assumes default instilation of ClearCase working with Dynamic Views

If ClearCase is NOT installed in default location then you can manually alter install location in ClearToolPath.vi

Two types of methods

1) VI using ClearCase Cleartool command line all named *_ct.vi
2) VI using the ClearCase Automation Library (CAL) all named *_cal.vi


No interface currently provided for UCM ClearCase operations


Add.vi
========
This VI will add an element or directory to Clearcase ie create a new ClearCase Object.

NOTES
1 The Parent Object (directory) must be a ClearCase Object
2 The Parent object will automatcially be checkedout if it is not already checkedout
3 By default both the parent dir and the added object will be left checkedout
4 If adding a file, the file must already exist
5 If adding a directory , the directory must NOT exist, remember to set Directoy? to true

A creation comment can be added Comment.

Copyright 2011 - Danny Thomson
No waranty included

BranchInfo.vi
=============
This Vi checks if the Branch Name passed in exists in the VOB specified by a Valid VOB Object and if it does it will return the following information.

branch exist? true / false
locked state? True (locked) False (unlocked)
branch description Branch creation comment
obsloete? True (locked & obsolete) false (just locked)

Note only the supplied VOB is checked branch could exist in other VOBs

uses Cleartool command describe -type brtype with formating options

Copyright 2011 - Danny Thomson
No waranty included

CheckIn.vi
====================
This VI will attempt to checkoutin a ClearCase Object (file or folder).

uses ClearTool --- uncheck/out | unco [ –kee/p | –rm ] { –cact [ pname ... ] | pname ... }

–kee/p
Preserves the contents of the checked-out version under a file-name of the form element-name.keep (or, to prevent name collisions, element-name.keep.1, element-name.keep.2, and so on).
–rm
Does not preserve the contents of the checked-out version. Thus, any edits that had been made to the checked-out version are lost.

NOTE. Error -2904 if files in not checked out

Copyright 2011 - Danny Thomson
No waranty included

CheckOut.vi
=================
This VI will attempt to checkout a ClearCase object (FIle or Folder).

INPUTS
----------
FileName & Path itme to be checked out can be file or floder
Checkout comment A checkout comment
checkout Type see below
CC Branch A optional branch to checkout on e.g \main \main\dev\ats\111 see below

uses ClearTool

checkout | co [ –res/erved ] [–unr/eserved [ –nma/ ster ] ]
[ –out dest-pname | –nda/ ta ] [ –pti/me ]

[ –bra/nch branch-pname | –ver/sion ] [ –nwa/rn ]

[ –c/omment comment | –cfi/le comment-file-pname | –cq/uery | –cqe/ach

| –nc/omment ][ –q/uery | –nq/uery |–use/hijack ] pname ...


–res/erved
Reserves the branch: no user in another view can perform a reserved checkout of the same branch (but any number of unreserved checkouts can be performed); no new versions can be created on the branch until your checkout is changed to unreserved with unreserve or resolved with checkin or uncheckout. If you specify both –reserved and –unreserved, this command performs a reserved checkout if possible; otherwise, an unreserved checkout.
–unr/eserved [ –nma/ster ]
Leaves the branch unreserved; other users, in other views, can check out the same version (but at most one of the checkouts can be reserved).


CC BRANCH
Default - blank. View Config specifications rules will be applied.
This allows a specific branch to be used to be used to checkout the file. NOTE branch must in this case MUST be the full branch path ie \main\dev-ats-456 not the branch type dev-ats-456. If CC Branch is used the CC warning messages are suppresed as they WILL occurs, but do not indicated we have have a problem, the branch used MUST EXISTS for the objects being checked out

Copyright 2011 - Danny Thomson
No waranty included

CreateBranchType.vi
===================
This VI will create a new ClearCase Branch Type

Uses CAL

Copyright 2011 - Danny Thomson
No waranty included

CreateLabelType.vi
===================
This VI will create a new ClearCase Label Type

NOTE Label Type Names cannot have spaces in them, else they will be invalid

Uses CAL

Copyright 2011 - Danny Thomson
No waranty included

FileInfo.vi
=================
This Vi finds information on the ClearCase element & version matching the input File or Folder

Outputs
----------
View Private File True if item is not a ClearCase Object other outputs are only valid IF this is FALSE

Labels List of Labels applied to this element. Label (0) is latest label
Flags
IsCheckedOut -- True / False
IsLatest -- True / False
General Info
Branch -- associated branch for file
Extended Pathname -- full ClearCase exteneded pathname ie test.vi@@/main/dev-ats-345
identificer -- see above the bit after ther @@
comment -- if checked in checkin comment else shows checkout comment

using CAL

Copyright 2011 - Danny Thomson
No waranty included

FilesOnBranch.vi
=====================
This Vi lists files on the clearcase branch Branch Name provided.

This VI needs a path to a Valid VOB Object to work.

Default is for Output paths to be Absolute Pathnames using the Windows Mapped Drive. This can be change using the Return Path Type input

Output Cluster
- Total Files on branch
- LabVIEW files on branch ie llb, vi, vit, ctl
- Directories on branch
- Other files On branch

uses ClearTool
find pname -all -nxname -visible -version "brtype(%s)" -print

NOTE. This VI does NOT check the branch exists, such a check should be run first CtViewExists.vi

Copyright 2011 - Danny Thomson
No waranty included

GetConfigSpec.vi
=====================
Gets the ClearCase View Configuration Spec for the View specified ViewTag

Uses ClearTool -- catcs -tag

Copyright 2011 - Danny Thomson
No waranty included

GetViewTagAndCSpec
=====================
This Vi will get the ClearCase ViewTag & releated View Configuration Spec
valid for the provide file or folder

Uses ClearCase Automation Libray

Copyright 2011 - Danny Thomson
No waranty included

LabelFiles.vi
==============
This VI will attach a already created Label Type to the version of the current directory selected by your view,
and to the currently selected version of each element in and below the current directory.

Uses CAL

Copyright 2011 - Danny Thomson
No waranty included

ListBranchTypes.vi
===================
This VI will provide a list of all the Branch Types in a VOB
This VI can take a long time if there are many branches in the VOB !!!!!

using CAL

Copyright 2011 - Danny Thomson
No waranty included

ListCheckOuts.vi
=======================
This Vi finds Checkedout files in the VOB selected by the
File Or folder in VOB input

Output
----------
2-D arrray listing checkedout files

Columns are PathName - View checkedout in --- branch checkedout on -- user checkedout to

using CAL

Copyright 2011 - Danny Thomson
No waranty included

ListLabelTypes.vi
=================
This VI will provide a list of all the Label Types in a VOB

This VI can take a long time if there are many Labelss in the VOB !!!!!

using CAL

Copyright 2011 - Danny Thomson
No waranty included

ListPrivateFiles.vi
========================
This Vi lists the view private files in the VOB and View specified

Inputs
-------
Valid VOB Object Specify VOB
ViewTag Specify ViewTag
Include Checkouts ?(F) If True Checkedout files will be included in results else they will be ignored

Default is for Output paths to be Absolute Pathnames using the Windows Mapped Drive. This can be change using the Return Path Type input

Output Cluster
- Total Files on branch
- LabVIEW files on branch ie llb, vi, vit, ctl
- Directories on branch
- Other files On branch

uses ClearTool
cleartool lsp·rivate [ –tag view-tag ] [ –inv·ob vob-selector ] [ –l·ong | –s·hort ]
[ –siz·e ] [ –age ] [ –co ] [ –do ] [ –oth·er ]


NOTE. This VI does NOT check the branch exists, such a check should be run first CtViewExists.vi

Copyright 2011 - Danny Thomson
No waranty included

SetConfigSpec.vi
====================
Set the ClearCase View Configuration Spec for the View specified ViewTag

Input
-------
Filename Text File that supplieds the view config spec

Uses ClearTool -- setcs -force filename.txt

No waranty included

UndoCheckOut.vi
--------------------
This VI will attempt to undo a checkout on ClearCase File.

uses ClearTool --- uncheck/out | unco [ –kee/p | –rm ] { –cact [ pname ... ] | pname ... }

–kee/p
Preserves the contents of the checked-out version under a file-name of the form element-name.keep (or, to prevent name collisions, element-name.keep.1, element-name.keep.2, and so on).
–rm
Does not preserve the contents of the checked-out version. Thus, any edits that had been made to the checked-out version are lost.

NOTE. Error -2904 if files in not checked out

No waranty included

ViewExists.vi
-----------------
This Vi checks that the VIEW specified by the supplied View Tag exists

Using ClearTool --- lsview

No waranty included






Click here to download this file

#2 dannyt

dannyt

    Extremely Active

  • Premium Member
  • 397 posts
  • Location:Devon UK
  • Version:LabVIEW 2011
  • Since:2007

Posted 09 October 2011 - 07:55 PM

Hi

I am not sure if anybody found this package useful or not, but I am sorry to say that due to a change in my circumstance http://lavag.org/top...-circumstances/ I no longer have access to a ClearCase system and there must regrettable say I can no longer support this package.

I am quite prepared to offer help and answer questions for anybody who want to use it. As I have used ClearCase for many years I am sure I could still help extend the package if somebody with a ClearCase system could do some testing

cheers

Dannyt