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.
Related
In our continuous integration we use ClearCase UCM. We occasionally need to access the sources from the recommended baseline (which not necessarily equals the newest baseline). Note: All baselines are full.
I figured out how to access the sources belonging to the recommend baseline manually, by entering cleartool edcs in the command line within the dynamic view and adding the line element * MyRecommendedBaseline below # Select checked out versions, saving and closing the text-file.
Unfortunately I don't know how to do this from a script. One way I could think about is read the contents of the config_spec into a stream, add the line, save it to a new text file and use "cleartool setcs newcs.txt".
But apart from being cumbersome I'm not exactly sure if this is possible. Anyone knows a simple way to do this?
You can script listing the recommended baselines of a given stream: see "How can I list the recommended base line in ClearCase"
On Windows:
cleartool descr -fmt "%[rec_bls]CXp" stream:streamName#\aPVob
On Unix:
cleartool descr -fmt "%[rec_bls]CXp" stream:streamName#/vobs/aPVob
From there, you can generate a new file with simple rules:
element * MyRecommendedBaseline1
element * MyRecommendedBaseline2
...
And you can setcs that file to a dedicate base-CC dynamic view (not an existing UCM view).
As Brian Cowan points out in the comments, this only works because those baselines, as the OP mentions, are full baselines (not incremental or not-labeled, like deliverbl are).
See also "What is the difference between Full baseline and Incremental baseline in Clearcase 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.
I have a file called prog.c in clearcase, for example the user has checked out this file, say the user has checked out the version 3 of the file.
After that, if some other users checked in the same version of file. say the latest version be 6.
How to check the latest version of the file using the CLEARTOOL command?
One way would be a cleartool lsvtree yourFile:
That would display a textual representation of the version tree, allowing you to see if the version you have is the LATEST on a given branch.
But one nice trick I sometime use in snapshot view is: 'cleartool co -nc yourFile'.
if it works, I cleartool unco immediately.
but, if the version isn't the LATEST, the checkout will fail, with a warning asking to update first.
Note that in a dynamic view, the problem is slightly different: one can checkout (unreserved) while other checkout/check-in.
You will know you don't have the LATEST version on the checkin stage: it will complain you must merge with the actual latest version in order to create a "new latest" version which will the the result of the combination (merge) of your work and the later versions.
One way to know where your at, with a checked out version, is to do a:
cleartool descr -pred -fmt "%Sn" MyFile
(see "Change set predecessor using cleartool", and "How to list all my check-ins using ClearCase?")
"%Sn" will give you the branch and version of the file currently checked out.
You can compare that with:
cleartool descr -fmt "%Sn" M:\aDynamicView\Vob\path\to\myFile
If you have a dynamic view with the same config spec and no checkouts, you can use it as "reference view", and see if the branch version in that reference view is the same than the version previous to the one checked out in your local (snap or dyn) view.
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.
I need to retrieve a list of all the files that have been checked-in across baselines along with the owner name. I tried using the cleartool lsact command :
However, this command fetches just for one task and is a bit cumbersome to use. Is there a command which will retrieve all the tasks if I specify two baselines?
Thanks
A command like:
cleartool diffbl -act bl1#\apvob bl2#\apvob
will give you the list of activities which have new versions between baselines bl1 and bl2.
However, to get the list of files (ie elements, as in files or directories, and not versions as in all the updated versions even for a same file), the best way is to:
ensure those baselines are "full" baseline: promote them to full if needed:
cleartool chbl -full bl1#\apvob
cleartool chbl -full bl2#\apvob
(if they were already full, this command won't do anything)
list all elements which have the bl1 and bl2 labels on different versions:
cleartool find -all -element '{lbtype_sub(REL1) && lbtype_sub(REL2)}' ^
-version '{(lbtype(REL1) && ! lbtype(REL2)) || ^
(lbtype(REL2) && !lbtype(REL1))}' -print
See "Find changes between labels".
Note that this last question also mentions the "report builder packaged with ClearCase, which is interesting if you are after a solution involving a GUI and not a CLI (command line):
Again, if those baselines are full, you can use it to list (under Elements/Labels) either "Elements Changed Between Two Labels" or "Versions Changed Between Two Labels" depending on which you need.