How to get the contributing activity details on integration stream? - clearcase

I need help in knowing how to get the details of when a particular contributing activity is delivered to integration stream.
I used to use diffbl -activity baseline1 baseline2 in cleartool to get the list of activities made from one baseline to another baseline.
Now the new need is that i need to get the date time of when some of the activities listed as an output of diffbl are delivered.
I tried using lsact, describe but i am getting the "Activity not found" error.
Probably because the activity I am querying at is a contributing activity.
Could somebody know how to get the date time of when a contributing activity is delivered or how to customize the output of "diffbl -activity baseline1 baseline2" to get the activity date time details as well?.

When I look at the cleartool diffbl man page, I don't see any formatting option.
That means you need to parse the result of that command, feeding each activity to a cleartool describe -fmt, using one of the fmt_ccase option to display what you want.
This thread gives you an idea of the process to follow, but it is in bash (unix), to be adapted for windows if you need it:
for act in $(ct diffbl -act bl1#/vobs/apvob bl2#/vobs/apvob | grep ">>" | grep -v "deliver." | cut -f2 -d " "); do echo "Activity: $act"; cleartool desc -fmt "%d\n" activity:$act; echo; done
In multiple line for readibility:
for act in $(ct diffbl -act bl1#/vobs/apvob bl2#/vobs/apvob
| grep ">>"
| grep -v "deliver."
| cut -f2 -d " ");
do
echo "Activity: $act"; cleartool desc -fmt "%d\n" activity:$act; echo;
done
Note that by excluding "deliver." activities, we are focusing only on contributing activities, as explained in "How to find files asssociated with a ClearCase UCM activity?".
The OP Lax reports having successfully managed to extract the names of the activities, with a:
desc -fmt "%Nd\n" "activity:myActivityId"
(#\pvob being already part of the result of the diffbl command. Lax is just parsing the activityid from the diffbl results and putting it to desc command)
He adds:
I am needing this in the context of C#, so parsing is just like parsing any other string: I am using a regex to seperate the output to my interested activities. ex:
Regex.Matches(diffBlOutput, "myInterestedPattern");
And for each match in regex result, I get the activity with
RegexMatch.Groups["activity"].ToString()
activityid is actually a substring of this string as the result is always "activtyid activityName" so, substring(0,result.indexOf(' ')); gets me the activity id.

Related

How to obtain previous baseline from stream

I can retrieve latest baseline which is always recommended in my case using following command
"cleartool desc -fmt \"%[rec_bls]CXp\" stream:".$SourceStream."\#\\".$pvob
I want to retrieve second latest baseline.Is it possible to obtain previous baseline from a given stream using cleartool command? previous applied baseline on any given component will also works.I need this to get difference between two streams from different projects which can be done by following command.
"cleartool diffbl -elements baseline:".$LastComponentBaseline." stream:".$CurrentStream;
You can start by looking at the output of cleartool lsbl: it does list (for a given stream and/or component).
Combined with fmt_ccase, you can grep the recommended baseline you know, and the line before, since lsbl lists baselines from the oldest to the newest
cleartool lsbl -fmt "%[component]Xp %n" -stream aStream#\aVob | grep -B 1 -E "yourComponent.*yourBaseline"
You need to grep for the right component name (displayed by the %[component]Xp format), as lsbl (on a stream) would list all baselines of all components.

Clearcase: List all comments messages in stream

I have read this and run the below command :
cleartool lsact -r -in stream:aStream#\aPVob -fmt "%n %c"
After running this I got :
SOLNSxxxx Created automatically as a result of 'Work on' action in ClearQuest
I didn't get this as I am expecting the comment message against every activity and files checked-in in activity with commit message.
And will this change anything in clearquest too ?
Please let me know.
as I am expecting the comment message against every activity and files checked-in in activity with commit message.
No, that would return the name and comment of the activity only, not of its change set versions.
See "How to find files associated with a ClearCase UCM activity?": for each version return, you would need to apply a cleartool descr -fmt "%n %c"
Try (not tested)
cleartool describe -fmt "%[versions]CQp" activity-title#\aPVob |\
xargs cleartool descr -fmt "%n %c"
If the first describe list all versions on one line, use:
cleartool describe -fmt "%versionsCp\n" activity:<your activity>#<your pVOB> | perl -pe 's/\,\s?/\n/g'
# or
cleartool describe -fmt "%[versions]CQp\n" activity:<your activity>#<your pVOB> | perl -pe 's/\,\s?/\n/g'

ClearCase UCM: Branch created of file that is not part of an activity. What happened?

I have somehow created a branch of a file in clearcase UCM that is not part of an activity. I have no idea how to reproduce this, but my stream is showing many files with this symptom. How can I find these files, remove them, and prevent it from happening again in the future?
Here is an example of one such file, names redacted to protect the innocent:
xxxxxxxxxxx.cpp##/main/xxx-integration/xxxxxx-xxxxxxxx/0 Rule: .../xxx-xxxxxxx/LATEST
A ct lsact -long | grep <filename> returns no results.
Update:
I used a find command to track down all the files that are on the branch given (and redacted) above, though I still do not understand the issue.
Per VonC's answer, where is what I ended up doing:
cleartool find . -type f -version "version(.../xxx/LATEST)&&version(.../xxx/0)" -print | tee ~/tmp/files2
I then read through the list of files generated to make sure they made sense, then I verified they were not attached to an activity and removed the versions:
cat ~/tmp/files2 | while read
do
if [ -z "$(ct describe -fmt "%[activity]p" $REPLY)" ]
then
ct rmbranch -f ${REPLY%/0}
fi
done
That can happen ig those file were checkout in a base ClearCase view, ie a non-UCM view, withg a simple config spec:
element * .../xxx-integration/LATEST -mkbranch xxxxxx-xxxxxxxx
You can use a find command similar to "How can I find all elements on a branch with version LATEST that has no label applied?".
The difference is: for each version found, you need to describe it in order to check if there is an activity attached to it or not (with a fmt_ccase):
cleartool describe -fmt "%[activity]p" "$CLEARCASE_XPN"

File churn in CVS

I'm looking to find the number of times that each file has changed on a particular branch in our cvs repository. I'm particularly looking for all the files which have changed the most. A "top 40" list would be good enough.
This was added as an edit by the original asker, I have converted it to a community wiki answer because it should be an answer, not an edit.
In this case, the branch has been in use for about 6 months. If I set to the latest in that branch ("cvs -z9 co -r r80m-1 ..."), it looks like the last number of the revision is the number of changes in the current branch -- if the file has been changed in the past 180 days, then it's on this branch. I'm using linux, so I eventually did it this way:
for file in `find . \! \( -name CVS -prune \) -type f -mtime -180`
do
cvs status "$file" | grep Working.revision | gawk -v FNAME=$file '{ print FNAME gensub(/(\.)([0-9]*)$/, "\\1\\2 churn:\\2 ", 1) }' >> cvs_churn.txt
done
sort -k3 -t: -n cvs_churn.txt | uniq
So, for each line in "cvs status" output like:
Working revision: 1.2.34
The gawk command changes it to:
./path/file.c Working revision: 1.2.34 churn:34
and I can then sort on ":34".
This works, but it's pretty crude. I'm hoping others may be able to answer with better approaches.
I've seen in some other questions eg: Free CVS reporting tools people have mentioned statCVS. It sounds interesting (more than I need, but some of the other info might also be useful). However, it says it only works on the "default" branch. The documentation was a little unclear -- can I set to the branch of interest, and use it for this?

How to filter the baselines(UCM) alone from describe command?

As we are having many components , I am trying to describe all the baselines using following command
cleartool describe -l baseline:Baseline_2.1.0.13#\My_PVOB
It provides output like follows
"Build 13"
master replica: My_PVOB#\My_PVOB
owner: Admin
group: ABC
stream:Components_Integration#\My_PVOB
component: Baselines#\My_PVOB
label status: No Versions to Label
change sets:
promotion level: INITIAL
depends on:
Baseline_2.1.0.13.8206#\My_PVOB (Comp1#\My_PVOB)
Baseline_2.1.0.13.433#\My_PVOB (Comp2#\My_PVOB)
Baseline_2.1.0.13.423#\My_PVOB (Comp3#\My_PVOB)
Baseline_2.1.0.13.3763#\My_PVOB (Comp4#\My_PVOB)
Actually i want to get contents only below depends on: ( Want to get Just following contents)
Baseline_2.1.0.13.8206#\My_PVOB (Comp1#\My_PVOB)
Baseline_2.1.0.13.433#\My_PVOB (Comp2#\My_PVOB)
Baseline_2.1.0.13.423#\My_PVOB (Comp3#\My_PVOB)
Baseline_2.1.0.13.3763#\My_PVOB (Comp4#\My_PVOB)
How to omit the remaining information?
From the fmt_ccase man page:
%[depends_on]Cp
(UCM baselines) The baselines that the composite baseline directly depends on
So for a composite baseline:
cleartool descr -fmt "%[depends_on]Cp" baseline:aBaseline#\apvob
could do the trick, except it will print only the dependent baselines on one line, each name separated by space, and without their associated component name.
So you need to parse that output, and for each baseline name, do a:
cleartool descr -fmt "%[component]Xp" baseline:aBaseline#\apvob
(Or, if your naming convention for baselines allows for it, a simple:
cleartool describe -l baseline:Baseline_2.1.0.13#\My_PVOB | grep Baseline_
would be easier!)
Actually, the OP samselvaprabu took the last proposition to grep what he needed from the initial output. His grep is better than my proposal, because it doesn't depend on the Baseline naming convention, but on the PVob name of said baselines:
I am using windows so your last(simple) command gave me the idea.
Following command works in Dos
cleartool describe -l baseline:Baseline_2.1.0.13#\My_PVOB | find "#\My_PVOB)"
Read "fmt_ccase" manual, you'll find it over there:
cleartool man fmt_ccase

Resources