ClearCase: how to list the attributes attached to a branch - clearcase

With the following, I can attach an attribute to a branch:
cleartool mkattr islocked \"true\" brtype:MY_BRANCH_NAME
How can I verify the value of this attribute?
As advised by VonC, I specified the VOB name in my command:
First let ensure the attribute exist and has been registered:
$ ct mkattype -replace -nc -enum \"true\",\"false\" -default \"false\" islocked
Replaced definition of attribute type "islocked".
-
$ ct mkattr -replace islocked \"true\" brtype:MY_BRANCH_NAME#\\myVOB
Created attribute "islocked" on "MY_BRANCH_NAME".
Then we can ask for the attribute's value:
$ ct desc -l brtype:MY_BRANCH_NAME#\\myVOB
branch type "MY_BRANCH_NAME"
created 2016-02-22T13:16:51Z by Nowox
master replica: cpAdmin#\myVOB
request for mastership: allowed for branch type
request for mastership: allowed for all instances
owner: user
group: group
scope: global
constraint: one version per element
Hyperlinks:
GlobalDefinition#78418#\myVOB <- brtype:MY_BRANCH_NAME#\myVOB
Unfortunately I don't see my attribute...
Same issue with this one:
$ ct desc -l -aattr islocked brtype:MY_BRANCH_NAME#\\myVOB
MY_BRANCH_NAME

cleartool describe can help:
cleartool desc -aattr myattribute brtype:MY_BRANCH_NAME
fmt_ccase has also an option to display the value:
clearcase desc -fmt "%Sa" brtype:MY_BRANCH_NAME
As Brian Cowan mentions in the comment, a cleartool descr -l can help ascertain if there is an attribute set and what its value is.
Compare that output with a cleartool descr -l -local to see if the attribute differs, and if the object is a local instance of a global type.
If the attribute has been define in an AdminPVob, check its type (global or local).

I have noticed similar issues on my side with the "cleartool desc" command. You can use the "cleartool dump" command in order to see the value of the attribute.
cleartool dump -l brtype:YOUR-BRANCH#/YOUR-VOB

Related

cleartool format string for displaying hyperlinks

Is there a cleartool describe format string or any other command that will print only the hyperlinks from an object? Like:
cleartool describe -long -ahlink -all vob:\MyVOB
but without the leading information.
When I run the formatted describe, as long as you're not dealing with > 150K of hyperlink data per version, you get the hyperlinks:
[brian#bullwinkle bcowan-testvob1]$ cleartool desc -fmt "%n\t%[hlink:TextType]p\n" .##/main/0
.##/main/0 "TextType#2#/vobs/bcowan-testvob1" -> "foobar"
And without the filter (another element):
[brian#bullwinkle bc-linuxtest]$ cleartool desc -fmt "%n\t%[hlink]p\n" /view/bc-linuxtest/vobs/bc-linuxtest/.##/main/foo/2
/view/bc-linuxtest/vobs/bc-linuxtest/.##/main/foo/2 "Merge#2#/vobs/bc-linuxtest" <- "/view/bc-linuxtest/vobs/bc-linuxtest/.##/main/18"

How to retrieve the list of files modified in same branch for different component in clear case

I need to retrieve the list of changes or activity in same branch for different component(or Project group). Say I am committing the changes for two components ABC & xyz in same branch. And whenever I create build I apply the label abc.00.date & xyz.00.date respectively. Now major CQ's are of abc so whenever I make build for xyz and apply lable, label attach to abc chnages and when I compare the baseline with comapre tool, it shows the chnages of abc project also.
My requirement is to get the changes between label of xyz.00.date group ONLY as there is numerous lables of two groups in same branch.
I need to retrieve the list of changes or activity in same branch for different component
The main command remains cleartool lsactivity, as illustrated here:
foreach act ( `cleartool lsact -in astream#/vobs/avob` )
set changeset = `cleartool lsact -fmt "%[versions]p" $act`
echo $changeset | tr ' ' '\n' >> $tmpoutput
end
For the difference between baselines, use cleartool diffbl, as in "Why does Clearcase diffbl include activities from my development stream when I diff integration stream baselines?"
cleartool diffbl -nmerge -act bl1 bl2
That will give you a list of activities that you can feed to the foreach loop above, modified as:
foreach act ( `cleartool diffbl -nmerge -act bl1 bl2` )
On Windows, those unix commands are available with the installation of Gnu On Windows: uncompress, and add GoW\bin to your %PATH%.

Counting number of checkins per user in clearcase

I would like to get the number of total checkins per user within a certain time frame. This is the kind of result I am looking for:
User: xxxxx Count: 432
User: yyyyy Count: 22
etc
I can use find to list all checkins done by a user, but I am only interested in the count!
Edit: Finding number of checkins per one (known) user at a time would also be ok!
Edit: I also need to filter on a certain filetype, e.g. *.java !
Basically, you need to experiment with cleartool find, using directives from the query language such has:
created_since: For instance, this limit a query for the month of May:
cleartool find . –version "{brtype(main_dev) && created_since(30-Apr) && (! created_since(31-May)) }" -print
-user (login-name) : this limit for a period, for a given user
cleartool find . -user user1 -element "{created_since(date1) && !created_since(date2)}" -print
So basically, you need to process the result of a find query, in order to sort it by user, and by filename extension.
The only native tool (so without counting external non-free third-party tool) would be to experiment with the ClearCase Report Builder (or "Report Wizard"), and see if you can set the right filters.
(mentioned in "ClearCase list of files with given label type applied").

How to import a groups members using 'ldifde'?

I have two domains. One production. One testing. There is no trust between the two.
I can import all user objects and group objects successfully using ldifde commands. When I attempt to also include group members in my export/import I can't seem to successfully import.
Here are the variations I have tried:
Attempt 1:
file format:
dn: CN=Group-name,OU=Groups,OU=Managed,DC=dev,DC=net
changetype: add
member: CN=USER1,OU=Users,OU=Managed,DC=dev,DC=net
member: CN=USER2,OU=Users,OU=Managed,DC=dev,DC=net
ldifde command used:
ldifde -i -k -f groupexp12072012-test.ldf -v
output:
Connecting to "DC"
Logging in as current user using SSPI
Importing directory from file "groupexp12072012-test.ldf"
Loading entries
1: CN=Group-name,OU=Groups,OU=Managed,DC=dev,DC=net
Add error on line 1: Object Class Violation
The server side error is "The object class attribute must be specified."
0 entries modified successfully.
An error has occurred in the program
No log files were written. In order to generate a log file, please
specify the log file path via the -j option.
Attempt 2:
Added in the correct objectClass to my ldifde import file:
file format:
dn: CN=Group-name,OU=Groups,OU=Managed,DC=dev,DC=net
changetype: add
objectClass: top
objectClass: group
member: CN=USER1,OU=Users,OU=Managed,DC=dev,DC=net
member: CN=USER2,OU=Users,OU=Managed,DC=dev,DC=net
ldifde command used:
ldifde -i -k -f groupexp12072012-test.ldf -v
output:
Connecting to "DC"
Logging in as current user using SSPI
Importing directory from file "groupexp12072012-test.ldf"
Loading entries
1: CN=Group-name,OU=Groups,OU=Managed,DC=dev,DC=net
Entry already exists, entry skipped
0 entries modified successfully.
The command has completed successfully
Attempt 3:
Deleted the existing group object and used the same command and format as "Attempt 2":
Connecting to "DC"
Logging in as current user using SSPI
Importing directory from file "groupexp12072012-test.ldf"
Loading entries
1: CN=Group-name,OU=Groups,OU=Managed,DC=dev,DC=net
Object does not exist, entry skipped
0 entries modified successfully.
So I'm stuck. Apparently 'ldifde' can be used to import group members - all my colleagues say it has never worked but I stumble upon MS articles that say otherwise;
http://social.technet.microsoft.com/Forums/nl/winserverDS/thread/089a3f3b-617f-4c66-a3fc-be543d97a612
Then I stumble on "5. LDIFDE doesn’t support changing Group Membership. You can use CSVDE or ADDUSERS.exe or DStools for Windows 2003 Editions." here:
http://support.microsoft.com/kb/555634
Am I going crazy for no reason - will I ever succeed using 'ldifde'?
edit: Yes, I was going crazy for no reason. One of my targeted users was actually in a different OU I was specifying for 'ldifde'. Because of this, 'ldifde' would just give up and not add any members to the group.
Here is a way to add users to an existing group (ldifde -i -k -f AddGrpMember.ldf -v
):
dn: CN=MonGrpSec,OU=MonOu,DC=dom,DC=fr
changeType: Modify
add: member
member: CN=jblanc,OU=MonOu,DC=dom,DC=fr
member: CN=Jean Paul Blanc,OU=MonOu,DC=dom,DC=fr
-
Here is a way to create a new group with members (ldifde -i -k -f NewGrpWithMember.ldf -v
):
dn: CN=NewGrpSec,OU=MonOu,DC=dom,DC=fr
changeType: Add
objectClass: top
objectClass: group
CN: NewGrpSec
member: CN=jblanc,OU=MonOu,DC=dom,DC=fr
member: CN=Jean Paul Blanc,OU=MonOu,DC=dom,DC=fr
ldifde import of group members fails if the group members do not exist, or the dn in the file does not match the dn of the target group.
For a few important groups in my test domain, I word to replace "member:" with the entire header to modify a group. That way any individual group member doesn't halt the rest of the group members from importing.
Simple find and replace
find: member:
replace with: -^p^pdn:CN=[groupname],OU=[ou name],OU=Domain Users,DC=TEST,DC=ORG^pchangetype: modify^padd:member^pmember:
Basically, add a "-" followed by a blank line, and then the header lines.

How to get the recent baselines of a project in clearcase

Can we get the list of baselines of a project in clearcase within in a certain time period, say, last 6 months.
The cleartool lsbl command usually lists baselines:
per streams
from the oldest to the most recent
If you can restrict your search to one stream (ct lsbl -stream ...), you need to list everything and then filter the result.
You can use the fmt option to display only the name of the baseline and its date.
cleartool lsbl -fmt "%d %n\" -stream...
You would get results like:
2007-01-10T12:41:45+01:00 MYBL_20070110.1263
2007-01-25T16:33:13+01:00 MYBL_20070125.3901
2007-01-26T12:25:23+01:00 MYBL_20070126.7020
2007-01-31T12:21:44+01:00 MYBL_20070131.7277
2007-02-01T16:54:21+01:00 MYBL_20070201.7671
From there, you can filter and/or sort the results.

Resources