How to get unique changeset using cleartool command? - clearcase

I am trying to get the changeset of an activity.
"cleartool lsactivity -l Build-Activity.1278"
I have used the above command . But the problem is if a same file has more than one checkin ,it shows all of them and also it shows check-in made in child stream as well as in Integration stream.
I just need to see the files affected by this activities in integration stream. I don't want each version details.
How to format and get the only file list in integration stream with only the latest version?

cleartool lsact should only show version done in a stream, since an activity is always linked to an UCM stream.
You could use fmt_ccase to display only the versions:
cleartool describe -fmt "%[versions]CQp" activity-title#\aPVob
And process the output to remove the ##/main/... part (the extended path) in order to leave only the element. Then pipe the result to the command 'uniq' in order to eliminate duplicates.
For example, for each version listed, you can do a cleartool descr -fmt "%En" /a/version##/main/... in order to get the element name.
cleartool lsact -fmt

Related

How to get list of activities included in new ClearCase baseline from commandline?

When making baseline manually, it shows the "Make Baseline" dialog with list of activities to include in new baseline.
How to get that list from commandline (from cleartool or other tool, in Windows and Linux)?
The closest would be described in the technote "Activities delivered since the last baseline"
When working in a UCM project, it is often useful to determine the activities delivered to an integration stream since the last baseline was applied.
The cleartool diffbl command can accomplish this.
However, cleartool diffbl must be run against each modifiable component that the project uses.
The command syntax is:
cleartool diffbl -activities baseline:<baseline> stream:<integration_stream>
That means you must determine that latest most recent baseline of a component on a given stream first.
As mentioned by the OP in the comments, the diffbl works with the most recent baseline:
either the one listed first by lsbl
or the foundation baseline if it is more recent.
cleartool lsbl -stream integration_stream -component user1_comp#/vobstore/pvob
Then make the diffbl in order to list the activities which are candidate for the next baseline.
The cleartool lsbl -stream ... -component ... seems to return the last baseline created in this stream.
But cleartool diffbl -activities baseline:... stream:... prints some useless junk if that baseline is not last in stream (this might happen if stream was rebased, and no new baseline was created since then; the last baseline becomes the foundation baseline).
So cleartool diffbl needs foundation baseline if it's newer than last baseline created in the stream. In this case it correctly outputs list of activities.

How to find activities of a modified files in Clearcase

I have a file test.cpp somebody added a few lines of code i don't know when but i'm assuming it was in a specific range of time that i know.I want to find the activity that was used to deliever this changes, i found a lot of versions of this element in the version tree of this element, but all the activities that i was able to see were as a result of a rebase, i need to find the source activity that was in charge of adding this few lines of code.
Is there any way to do that ?
For each deliver activity (that you can see in the version tree), you can list the contributing activities with
cleartool lsact -contrib activity:anact#/apvob # on unix #/vobs/apvob
See "Finding which developer activities were delivered in a specific delivery"
Then you need to describe each activity found, to see if your file is in it.
cleartool descr -l activity:anact#/avob
Obviously, you also can use a cleartool annotate, in order to see the versions in that file: see "How to use ClearCase Annotate".
If you see one line which interest you, check its version n# 'x' and use cleartool descr -l file#/main/.../x to find its corresponding activity.

How to find the list of files changed after latest baseline in UCM?

I have to verify whether any elements are changed in a component vob after the last baseline in applied.
I was trying to find the cleartool command for that but i got upto "finding the list of files changed after a particular date " .
Is there any way to get the list of files changed after the last baseline applied?
One of the fastest way would be simply to try and make a baseline(!)
If nothing has changed, by default, ClearCase UCM will refuse to make one.
If one has change:
a/ You can compare the newly created baseline with its previous to get the list of versions modified:
cleartool diffbl -pred -ver newBaseline#\aPVob
b/ You can delete that newly created baseline if your intention was not to create one right away.
Another relatively fast way (since adding/removing a baseline can take time on a large component, or where there are already a lot of baselines) is:
"Find files in Clearcase view newer than a specific date?"
If you have the date of the last baseline, you can launch a search for newer version:
cleartool find <vobtag>/<component_root_dir> -element "{created_since(target-data-time)}" -print
To get the latest baseline, see "List the latest baseline of a component in a UCM stream one by one".
The date can then be obtain with an fmt_ccase directive:
cleartool describe -fmt "%d" aBaselineName#/aPVob
The best,simplest and easiest way to do that is by creating a view in that baseline and then give a cleartool rebase -recommended .Once you do this just give cleartool lspriv -co This will give you list of all the files that have been modified after your baseline in which you created the view.

clearcase query results into winmerge

I can compare two files in Winmerge by triggering a comparison on the command line with a command similar to:
WinMergeU C:\file1.txt C:\file2.txt
I can query a list of files with particular properties in clearcase with a clearcase query similar to:
Y:\VOB_A>cleartool find . -type l -exec "cleartool describe -fmt "%n %[slink_text]Tp\n\n\" \"%CLEARCASE_PN%\""
.\Directory\createsymlink.txt -->..\..\VOB_B\SymlinkFolder\createsymlink.txt
What I want is to generate a set of clearcase query results that can then be used as input to winmerge (ie generate a bunch of diff commands on checkins fulfilling a certain criteria like user or day).
How can I write a clearcase query to get a list of file elements (referable in clearcase ie winmerge could open the path to the version on a dynamic view), and get their corresponding previous version of the file?
The bit to format this to winmerge I imagine would look somewhat like this:
... describe -fmt "WinMergeU ...
One, you would need to generate the right full extended pathname for each file (one being the result of your query, one being the previous version of the one found by said query)
Two, you need to do so in a dynamic view (in order to access to any version though the extended path name of the file.
Once your query gives you a version, you can ask, with a cleartool descr -fmt "%PSn" (see fmt_ccase man page), for the previous version and add that to your result file.
Trying to do it all in one pass (find + predecessor version + WinMerge call) seems too complicated.

What clearcase command I should use to to get who checked in last?

I am new to ClearCase, and I need to get who check-in a particular file last (ie: latest version).
I know the absolute path for the file.
What command do you recommend for me to access the user (ie the creator of the LATEST version) for that file?
Try:
cleartool descr -l /path/to/file
If your view already select the latest version, that is enough.
You can also use fmt_ccase to isolate only the information you need:
cleartool descr -fmt "%u" /path/to/file
If you view doesn't select the LATEST version (which you can check by doing a cleartool ls in the parent directory, and looking at the selection rule displayed there), you can use the extended path name to deduce its LATEST path:
cleartool descr -fmt "%u" /path/to/file##/main/branch/subBranch/LATEST
See more at "clearcase latest version of a file on a particular branch", in order to find the exact extended path you want.

Resources