Is there a way to view the "LATEST-1" version in clearcase - clearcase

Is there any way to reference the previous version of every file in a directory in clearcase in the config specs?
I have read through the documentation here, however there is no mention of how to step back 'n' iterations. I am looking for something such as:
element Path/To/Directory/* /main/LATEST-1
...in that it will step back every file one iteration, instead of, for example, choosing a date/label to go to.
-----UPDATE:-----
I'm just adding this in case it's of use to others - it's not an answer as such but it's how I worked around it:
I was able to capture the previous version number from the response to submitting:
ct descr Path/To/Directory/*
This then reports back the below for each file that you can then read in to capture the LATEST and/or "LATEST-1" versions:
version "/Path/To/Directory/file##/main/5"
created 2015-07-31T08:09:18+02:00 by #############
"Automatically checkout by #############
protected by rolemap: #############
effective access for user #############
Element Protection:
User : #############
Group: #############
Other: #############
element type: #############
predecessor version: /main/4
Labels:
#############
Attributes:
Data_Status = #############

Commands like cleartool diff supports an option which refers to the "previous" version (ct diff -pred).
But the config spec itself only use label, branch or date.
As mentioned by the OP Bendy, a cleartool describe /path/to/element output does include the predecessor version.
Actually, using fmt_ccase, a cleartool descr -fmt "%PSn" should display directly the branch-pathname/version-number of the predecessor version's version ID.

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" .

full clearcase history for gource

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

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

Extending AD Schema - Unable to update due to constraint

I'm adding some attributes from live to staging for testing purposes, I'm using ldifde:
D:\Shared>ldifde -i -v -f attr3.ldf -j .
Connecting to "myDomain.com"
Logging in as current user using SSPI
Importing directory from file "attr3.ldf"
Loading entries
1: CN=myAttribute,CN=Schema,CN=Configuration,DC=myDomain,DC=com
Entry modified successfully.
1 entry modified successfully.
The command has completed successfully
D:\Shared>
But when I try to update it using vbs, I got:
C:\Users\update.vbs(8, 1) Active Directory: The requested operation did not
satisfy one or more constraints associated with the class of the object.
Please notice that other attributes, the original ones, are able to be updated, this issue is only for the ones I'm importing.
So, I wonder if I'm missing some step like link or detach the new attribute after imported.
This is attr3.ldf
#attr3.ldf
#adding my new attribute
dn: CN=myAttribute,CN=Schema,CN=Configuration,DC=myDomain,DC=com
changetype: add
objectClass: top
objectClass: attributeSchema
cn: my-Attribute
distinguishedName: CN=my-Attribute,CN=Schema,CN=Configuration,DC=myDomain,DC=com
instanceType: 4
whenCreated: 20100401175340.0Z
whenChanged: 20100401175341.0Z
uSNCreated: 24154
attributeID: 2.16.840.1.113805.111
attributeSyntax: 2.5.5.12
isSingleValued: TRUE
rangeLower: 0
rangeUpper: 1
uSNChanged: 24163
showInAdvancedViewOnly: TRUE
adminDisplayName: my-Attribute
adminDescription: my-Attribute
oMSyntax: 64
searchFlags: 0
lDAPDisplayName: myAttribute
name: my-Attribute
schemaIDGUID:: tonVW6suWUu1Gev/D1pI9Q==
isMemberOfPartialAttributeSet: TRUE
objectCategory: CN=Attribute-Schema,CN=Schema,CN=Configuration,DC=myDomain,DC=com
#The following attributes were removed because I was getting:
#Add error on entry starting on line 1: Unwilling To Perform
#The server side error is: 0x20e7 The modification was not permitted for security
#reasons.
#The extended server error is:
#000020E7: SvcErr: DSID-03152D2C, problem 5003 (WILL_NOT_PERFORM), data 0
#objectGUID:: eTKYtnXbCE2fPMgc8UIe0w==
#attributeSecurityGUID:: VAGN5Pi80RGHAgDAT7lgUA==
And this is the vbs code,
'update.vbs
Set objUser = GetObject("LDAP://CN=John Lennon,CN=Users,DC=myDomain,DC=com")
objUser.myAttribute="someValue" 'Also tried with integers but not luck
objUser.SetInfo
Thanks,
m0dest0.
Thank you JPBlanc, you are right, I was missing to add the attr to the class and then refresh the schema,
Register the dll, regsvr32 schmmgmt.dll
Open Run and type mmc.exe
Add Active directory schema snap-in
Right click on the class, properties and hit the Add button and so on.
Finally, refresh the schema:
C:\Users>admod -sc refreshschema
AdMod V01.17.00cpp Joe Richards (joe#joeware.net) March 2011
Modifying ROOTDSE...
DN Count: 1
Using server: myServer.myDomain.com:389
Directory: Windows Server 2008 R2
Modifying specified objects...
DN: ROOTDSE...
The command completed successfully
Regards,
Adding an attribute to the Schema is not enought, you must also add the attribute to the user class (in the schma) if you want to use it in a user object. You must modify your LDIF file:
# Define your attribute
# Reload the schema
dn:
changetype: modify
add: schemaUpdateNow
schemaUpdateNow: 1
-
# modify user class
Have a look to your Schema using Microsoft MMC (registering schmmgmt.dll)
If you still have trouble, I can help again tomorow morning.

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