In my current working environment, I make use of eclipsed files extensively for testing purposes. When it comes time to formalize things, I have a script which generates a diff by comparing the file with a backup saved by my eclipse script.
I'd like to be able to work without the backup of the original file; is there any way I can retrieve the current version of the file that I can pass to diff? Even though the file is view-private, I see I can enter foo##/ and see a list of versions, but I'm not sure how to find which version is the latest. Everything I've tried using cleartool ls or describe with the file name tells me that it's not a VOB object (which is true, although cleartool ls does show it as eclipsed, so it must know, somehow, that there is an element there)
Thanks
Eclipsed file means dynamic view.
The simplest solution would to make a second dynamic view based on the same config spec.
Considering how cheap and quick those views are, this isn't an issue.
On that second dynamic view, you can do a
cleartool descr -fmt "%Xn" /path/to/element
In order to get the extended pathname of the file (see fmt_ccase for more on the %Xn syntax).
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 know the filename of a clearcase versioned file. How can i find the latest version of this file on a particular branch ? It should not pick any child branches. Also the parent branch names may not be know always.
Thanks.
If you are using a dynamic view, you can directly access the LATEST version of a given branch by using the extended path:
cat file##/main/branch/subbranch/LATEST
If you don't know the exact branch path (parent branches) this version is stored in, you can modify your dynamic view and add first the selection rule
element /path/to/file .../subbranch/LATEST
That will select the LATEST version of subbranch within the dynamic view.
Or you can do a cleartool find, in order to see the full extended path for that file:
cleartool find . -name "yourFile" -ver "version(.../subbranch/LATEST)
You will be able to cat (or type in Windows) directly the result (which will be the full extended path)
The diea behind the cat or the cleartool find is to be able to use the syntax .../subbranch/LATEST.
That syntax with the three dots means: '.../subbranch' whatever branches followed by /subbranch.
I am running the cleartool subcommand diffbl -versions between two baselines. But the output looks different depending on the view I am running the command from. The difference is in the path name of the elements. For example the same file my_filemane located in /vobs/my_component/my_directory/my_subdirectory/ as seen by two views on two streams my_stream_1 and my_stream_2 shows path names:
/vobs/my_component/my_directory/my_subdirectory/my_filename##/main/my_stream_1/1
/vobs/my_component/my_directory/my_subdirectory##main/my_stream_2/my_stream_1/10/my_filename/main/my_stream_1/1
In the fist case its easy to determine the location of the file, is there was no version control, by taking the substring between /vobs/ and ##. Is there any easy way (a cleartool subcommand maybe) to find the same from the second case?
The difference comes from the visibility of the file within the view from which you are doing the diffbl.
Considering the extended pathname from the second path mentions:
main/my_stream_2/my_stream_1/10
, your best move is to redo said diffbl from a view associated with stream1 in order to get a simpler path for that particular file.
But anyway, since that file has no version in stream2, it will always be displayed with a long and complicated extended pathname.
Because ClearCase updates directory version numbers when files inside are created, our config-spec generating script is failing (details omitted).
So, as an example, given a file such as "/proj/src/scripts/build.sh##/main/branch42/3", how can we determine the latest version of the scripts directory that contains that version of the build.sh file.
Note: we're looking for a unix command-line solution that can be scripted.
If you do a ls /proj/src/scripts##/main/branch42/*/build.sh/main/branch42/3 you should get a list of all versions of the scripts directory that contain version .../3 of build.sh. Then you should be able to pick out the latest of those.
The above is probably not a fool proof approach, so you might try something more like
cleartool find /proj/src/scripts --allversions --nonvisible -name build.sh -version 'brtype(branch42) && version(3)' -print
(I no longer have a clearcase environment to test in, so the above is from memory and is not an accurate command)
Another approach is to:
set a label on the right version of the build.sh script and its directory (you can move that label when needed)
have a second dynamic view always configured to select that label
element * SCRIPT_LABEL
element /proj/... .../branch42/LATEST
That way, you simply read the information you need from that second dynamic view.
I have a Folder in ClearCase that contains a large list of Reports.
I have checked all the Reports out because I need to make a sweeping change.
I have changed a set of the Reports and now want to deploy this set.
I probably should have checked the Report files out one at a time and then deployed each as I finished.
But, since I did not do that, is there a way to inspect the ClearCase folder that contains the List of checked out Reports to see which ones have changed and which ones have not?
You could ask cleartool for a diff with the previous version:
cleartool lsco -r -cvi -fmt "diff -options \"-hea\" -pred \"%n\"\n" | cleartool | grep ">>>"
That would give you the list of currently checked-out modified files.
Note: remove the '-r' option if you only want the check-out files of the current directory (and not its sub-directories)
In ClearCase (or Explorer if you have integration enabled), right-click the base of the tree, and choose "Find Modified Files". This will return a list of ALL files that have been modified, and that are part of the repo (i.e. it will not return list of private files).
If you want to know all files - checked out, modified, and private - the only way I know of is to use cleartool from within the view:
cleartool ls -r
If you want more (or less) info about the files, check the docs for the -fmt option (which doesn't work with ls, but does work with describe), and you can create a command that will give you exactly what you want (it'll take some experimenting until you get the hang of it).
NOTE: "Find Modified Files" is only available within the gui from the base of the view tree; Elsewhere your only option is "Find Checked Out Files" (confusing, to say the least).
You can set up a second view with an identical config spec as the view with the checked out files. Once you have the second view set up you can compare the same directory in each view with a difference tool (like WinDiff). This will list all the files that have been changed.
It's not native to ClearCase but it should give the results you are looking for.
I also found a solution. I selected my ClearCase folder and clicked on "Find Checkouts". This showed my huge list of Report files that were checked out. I then selected them all and selected "Check In". I left the "Check in if identical to previous version" option unchecked. I then selected "OK" to check in. All the modifeid files checked in and the un-modified files remained checked out. This gave me my delta of modified files vs un-modified files.