full clearcase history for gource - clearcase

I have tried to get the full history of a clearcase vob to parse it and use it with gource to get a visual representation of the changes, but I do not find the right commands to get an easy log history to parse with clearcase2gource python script. I do not use UCM, there are no streams, just plain cleacase.
With this command I get elements with ## in the middle of a path:
cleartool lshistory -fmt "Element: %n| Date: %d| User:%u| Operation: %e| Object:%[type]p| SimpleType: %m| OperationKind: %o\n" -all /vobs/vob_name
With this command I get elements like this (deleted at some point):
Element: /vobs/vob_name/dir1##/main/branch_dev/2/dir2/main/branch_pilot/1/file##/main/branch_pilot/1| Date: 2008-04-15T16:58:28+02:00| User:reeasjp| Operation: create version| Object:compressed_file| SimpleType: version| OperationKind: checkin
That makes more difficult to parse for gource because of several branch names in the middle.
Is there any way to get a full history of all the elements with just plain directories and file names?
Thanks in advance.
NOTE: In the config Spec I have just "/main/LATEST".

The issues are:
clearcase2gource.py processed the extended paths (see "About the version-extended path") found by cleartool lshistory with some hard-coded assumptions.
e = d['Element']
splitElement = e.split("##")
d['FileName'] = splitElement[0]
d['StreamName'] = splitElement[1]
# StreamName starts with /main/ which we aren't interested in.
# Remove the /main/ (slice on 5 because there are 5 chars in /main/)
d['StreamName'] = d['StreamName'][5:]
the cleartool lshistory --all will list history of deleted elements (non-visible anymore in the current ClearCase view), hence the multiple branch names.
The easiest solution would be to:
redirect the cleartool lshistory output to a file, and
then filter out all the extended paths which don't conform to clearcase2gource.py expectation: for instance, just for testing, keep only the ones in a specific branch or in /main only, just to see if that works better.
finally feed that file as input to clearcase2gource.py

Related

in multisite environment, how to find out which site has clearcase view uuid?

$ cleartool rmstream stream:tiger#/vobs/forest
Remove stream
"stream:tiger#/vobs/forest"? [no] yes
cleartool: Error: No tag in region for view "d6ca911d.229a41bb.942b.fd:ed:f2:bb:5c:f8".
cleartool: Error: Unable to remove stream "stream:tiger#/vobs/forest".
how to find out which site has clearcase view uuid d6ca911d.229a41bb.942b.fd:ed:f2:bb:5c:f8?
The IBM technote swg21127922 does list a MultiSite environment and the view existing at a different replica site as a possible cause for this error message.
It might not be mandatory to switch to the site referencing that view to move forward though.
The steps described to resolve the issue involve removing the view by its uuid in the pvob of the stream.
I used that technique (rmview --uuid) before in "Removal of clearcase views involves any housekeeping?".
For instance:
cleartool lsstream -l stream_name#\pvob.
The output will include:
views:
98573bec.d7e34570.a71c.e8:ab:7c:50:d4:02
Then:
ct desc -l vob:\ford_pvob
The output include:
VOB holds objects from the following views:
f15eagle:d:\ClearCase_Storage\views\RATIONAL\evchan\evchan_proj1_2.vws [uuid 98573bec.d7e34570.a71c.e8:ab:7c:50:d4:02]
You will need change directory (cd) into the PVOB
Example:
W:\>cd ford_pvob
W:\ford_pvob>
Remove the view reference from the PVOB using, cleartool rmview -uuid uuid_number
Note: By adding the -all switch, you will ensure to remove the view reference from the PVOB and any UCM Component VOBs that may also have a reference from this view; cleartool rmview -all -uuid uuid_number.
In this particular example, the -all was not required since we are only removing the view reference from the PVOB.
Example:
W:\ford_pvob>ct rmview -uuid 98573bec.d7e34570.a71c.e8:ab:7c:50:d4:02
Removed references to view "f15eagle:d:\ClearCase_Storage\views\RATIONAL\evchan\evchan_proj1_2.vws" from VOB "\ford_pvob".
Now the stream can be removed, using cleartool rmstream stream_name#\pvob
Example:
W:\ford_pvob>ct rmstream evchan_proj1_2#\ford_pvob
Remove stream "evchan_proj1_2#\ford_pvob"? [no] y
Removed stream "evchan_proj1_2#\ford_pvob" .

Get the ClearCase VOB of an activity, stream or stream location with cleartool

I'm trying to write a script to get the vob with the help of cleartool.
I have the activity id, the stream name and the stream location as input. From this I need to get the vob.
cleartool lsvob -short is pretty much what I need, but I only need the vob of the activity and stream.
cleartool describe -cview view-location did also not help.
Does anyone have an idea how to achieve this?
EDIT:
cleartool descr -cact leads to the following:
activity "ActivityID"
created 2014-12-15T13:53:49+01:00 by User
master replica: HES#\vob
owner: dom\owner
group: group
stream: stream#\vob
current view: view name
title: Title
change set versions:
...changes
Attributes:
activity_ok = "yes"
Delivered = "no"
Finished = "no"
Type_Activity = "User"
If you execute a cleartool describe from within the view, it should pick up on the "vob of the activity" (meaning the PVob which is an admin vob of the current UCM root-based component vob that the view is accessing)
cd /path/to/my/view/vobs/MyVob
cleartool descr -cact
cleartool descr -fmt "%Xn" -cact
That should return the name of the currently set activity followed by #/vobs/ThePVob.
ThePVob is the tag you are looking for: it will be the same for all activities in that stream.
Using fmt_ccase, you can limit the output to the fully qualified name of the current activity: activty#\.

How to receive e-mail notification on CPM completion using IBM Rational UCM Clearcase

I want to receive an e-mail notification on completion of every CPM. I am using IBM rational Clearcase(UCM).Please let me know if there is any script to do this?
Thanks
Sooraj
What is CPM? The Core Protection Module of Tivoli?
Anyway, you can setup post-operation trigger for email notification, as commented in the Ten Best Script page.
A complete example can be seen in ClearCase Help pages "E-mail notification postoperation trigger script".
It setup includes, for an UCM deliver operation:
creates a postoperation trigger type that fires when a developer finishes a deliver operation, as represented by the deliver_complete opkind.
The mktrtype command uses the -stream option to indicate that the trigger type applies only to deliver operations that target the specified integration stream.
# This is a Perl script to set up the triggertype
# for e-mail notification on deliver.
use Config;
# define platform-dependent arguments.
my $PVOBTAG;
if ($Config{'osname'} eq 'MSWin32') {
$PVOBTAG = '\cyclone_pvob';
$WCMD = '-execwin "ccperl \\\\pluto\disk1\ucmtrig_examples\ex2\ex2_postop.pl"';
}
else {
$PVOBTAG = '/pvobs/cyclone_pvob';
$WCMD = '-execwin "ccperl \\\\\\pluto\disk1\ucmtrig_examples\ex2\ex2_postop.pl"';
}
my $STREAM = "stream:P1_int\#$PVOBTAG";
my $TRTYPE = "trtype:ex2_postop\#$PVOBTAG";
my $UCMD = '-execunix "Perl /net/pluto/disk1/ucmtrig_examples/ex2/ex2_postop.pl"';
print 'cleartool mktrtype -ucmobject -all -postop deliver_complete $WCMD $UCMD -stream $STREAM -nc $TRTYPE';
The key part is:
cleartool mktrtype -ucmobject -all -postop deliver_complete

How to open a dynamic view in clear case with a given config spects using command prompt?

I have config spects for a view and I need to create a view in Clear Case using command prompt.
Please let me about the commands I can use with some example.
Thanks in Advance!
That would be using:
cleartool mkview
followed by cleartool setcs -tag yourDynView pname, with pname being "a text file whose contents are to become the view's new config spec".
For creating a dynamic view:
cleartool mkview -tag yourDynView \\shared\path\to\viewStorage\yourDynView.vws
That will create a dynamic view with a default config spec:
element * CHECKEDOUT
element * /main/LATEST
You will then be able to replace that config spec with any other config spec stored in a file, with the setcs command.

ClearCase: Copy old versions with Snapshot Views under Windows

Using IBM Rational ClearCase:
- I have only access to Snapshot Views so NO dynamic Views
I want to copy ALL versions from a certain changeset to c:\temp. I have already listed the changeset versions in a file (couple of hundred of versions, I only need the latest one), I do not have a baseline over this older set.
What I now have and does not work:
#!/usr/bin/perl -w
#
# PROGRAM: copytest.pl
$filename = "Design test123.doc";
$view = "D:\\AdminViews\\ABC_R1_READ_2\\ABCD002\\ABC_DESIGN\\BLA Framework\\P0\\";
$version = "\\main\\ABC_R1_READ\\1";
$printhet = 'cleartool find . -name "' . $filename . '" -version version(' . $version. ') -exec "cmd /c copy %CLEARCASE_XPN% D:\temp\%CLEARCASE_PN%"';
system($printhet);
Basically because: http://www-01.ibm.com/support/docview.wss?uid=swg21150317 (XPN)
update: I read In ClearCase, how can I view old version of a file in a static view, from the command line? again and I see that a diff with an empty file is the /hack for having no XPN. ok... but a diff with empty and a doc in the above gives me "0"
I am not sure what this IBM article (you mention in your question) can mean in your situation since it only works for dynamic view (if the view does not directly select the version you need).
And my old answer for accessing an extended path file content in a snapshot view is not trivial to adapt here.
So why not aim at something equivalent but simpler?
Why not create another snapshot view directly within c:\temp (c:\temp\myview_snap), with a config spec along the lines of (you can keep '/' instead of '\'):
element * CHECKEDOUT
element "/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework/P0/..." /main/ABC_R1_READ/1
element -directory "/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework/P0/..." /main/ABC_R1_READ/LATEST
element -directory "/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework/P0/..." /main/LATEST
element "/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework/P0/..." -none
element /ABC_R1_READ_2/ABCD002 /main/ABC_R1_READ/1
element /ABC_R1_READ_2/ABCD002 /main/LATEST
element /ABC_R1_READ_2/ABCD002/ABC_DESIGN /main/ABC_R1_READ/1
element /ABC_R1_READ_2/ABCD002/ABC_DESIGN /main/LATEST
element "/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework" /main/ABC_R1_READ/1
element "/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework" /main/LATEST
element * -none
load /ABC_R1_READ_2
That way, you should select:
any element under /ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework/P0 (P0 included) with the right version
any directory which had not the exact version will try first to load itself as the LATEST on ABC_R1_READ, else as /main/LATEST as fallback (always exists)
if an element (file) has not that version, it won't be selected at all and not loaded.
any parent element (/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework), if it has not the right version, will be selected as /main/LATEST (always exist)
any other element (outside of the relevant tree) will be ignored, non-selected
Just tested it: it works fine.
Notes:
"BLA Framework" is a directory with a space in it, so you need to add the double quotes where it is used.
the load rule can just load the vob ABC_R1_READ_2: since the '-none' rules will not select what you don't need, they won't be loaded anyway.

Resources