Find all files that are not added to ClearCase - clearcase

I have created some file, in different directories. I couldn't add them when I created, so I need to do it later.
Is there a way to get the list of all the files that are in ClearCase view, that are not actually under source control?

Yes: you can list all your private files with ClearCase, with
cleartool lsprivate (only for dynamic views, not snapshot views)
cleartool ls -rec -view_only
You will need to grep the output for your specific file though.
See "Command to find all view private files in the current directory recursively" for more.

Related

How can I quickly checkin a large number of files in clearcase

I have a large number of files that I am trying to check in. This process needs to be done several times and is time and resource consuming. I am using the follow command to do this:
cleartool lsco -cvi -all -s | awk '{print "cleartool ci -c \"<Name of checkin>\" " <path to vob> | sh
This command does work, but it takes a very long time to run, as each file is checked in individually. Is it possible to checkin all files at once, or perhaps a faster method of checkin in the files individually. Is it possible to use the same concept, but for a mass checkout?
As I mentioned in "What are the basic clearcase concepts every developer should know?", ClearCase remains a file-by-file VCS, meaning each operation (checkout; checkin, merge) is done file by file.
clearfsimport remains one possible "bulk" operation (even though behind the scene, it will still checkout or mkelem for new files, copy, and checkin the files one by one)
That means you can use one view as source folder (clearfsimport will import any folder, ClearCase view or not), and a snapshot view with the same config spec as destination. See "ClearCase, use clearfsimport to perform brute force update" and "How can I use ClearCase to “add to source control …” recursively?".
With the -rmane option, it will even remove files which are no longer present in the source folder. See "Remove unused source code files".

How do I associate a ClearQuest TASK with a cleartool mkelem command?

I am attempting to check in hundreds of new files in Base ClearCase. Due to network and server issues, I am wanting to write a batch script of cleartool commands to add each file to source control. All files will be checked in under a single ClearQuest task.
I have tried selecting all the files and adding all at once via the context menu, but after selecting the ClearQuest task association and choosing "apply to all", I am still having a dialog box pop up for every file, asking me to confirm the association.
I want to write a list of commands like:
cleartool mkelem -c "SCR ... / TASK ... - blah blah" filename.ext
However, I don't know how to associate the change with the TASK, and I don't see any documentation for doing this in Base CC/CQ.
First, don't write a script adding new files throug mkelem: if you can isolate those files in their own folder (or tree of folders) outside a view, then you can import them into a view (snapshot or dynamic) through clearfsimport.
clearfsimport is made for that, and will checkout the parent folder of the files to add, and do the required mkelem for each file for you.
See also "How can I use ClearCase to “add to source control …” recursively?"":
clearfsimport -preview -rec -nset c:\sourceDir\* m:\MyView\MyVob\MyDestinationDirectory
You will need first to use cleartool settask in order to set the ClearQuest task for the destination view used for this import.
See "How to configure base ClearCase to use the Change Management integration with ClearQuest".
As the OP Darthfett adds in the comments:
However, as I am using ClearCase 7.*, there is no settask command.
As a workaround, it looks like using set CQCC_AUTO_ASSOCIATE=<TASK ID> will work (see here)

ClearCase: Is it possible to cancel checkouts not made from your own view?

Can the project manager force cancellation of checkouts of files/directories made in any view/stream/project? How?
A ClearCase administrator can force all files of a given view to be considered as "not checked out" (which is the equivalent of canceling their checkout status), with cleartool rmview:
cleartool rmview -force -uuid (uuid_of_the_view) -vob \aVob
You can get the uuid by grepping the user in the output of:
cleartool descr -l vob:\aVob
See technote "Removing checked-out references of a view from a VOB".
It will work for any view (snapshot or dynamic views, base ClearCase or UCM views)
I would recommend limiting that command to a specific vob.
Anyway, that doesn't concern the Project manager unless he/she is also a ClearCase administrator (ie, he/she is in the same group than the ClearCase administrators group on Windows, or if he/she is root on Unix)
Regarding a cleartool unco (which you can attempt on a dynamic view only), keep in mind if will only work for:
Version creator
Element owner
VOB owner
root (UNIX and Linux)
Member of the ClearCase administrators group (ClearCase on Windows)
Local administrator of the ClearCase LT server host (ClearCase LT on Windows)
So, unless your project manager has created the Vob in which those checked out files are managed, he/she won't be able to undo checkout them.
As commented below, all checkout files of the associated vob \avob are no longer considered checked out (their status is reset, not their modified content, which is untouched).
In order to restore those checked out files, a user can:
for a snapshot view, list hijacked files (as in this technote)
for a dynamic view list eclipsed files (see technote on eclipsed files)
Each filename found can be piped to a clearcase checkout command.
So restoring the checked out files is fairly easy for a given view and vob.
You can't if it was checked out in a snapshot view. You may be able to if it was checked out in a dynamic view. You can use Find Checkouts to find checked out files and attempt to undo the checkouts from there.
Ideally, if it is a view that is accessible by someone with higher privilege, e.g. Clearcase administrator who possesses the VOB owner account, it is best to ask him to perform the checkin (if you are sure the file can be checked in) or a saving of the checkedout file followed by a "cleartool unco".
If it is not the case, the command
cleartool rmview -force -uuid (uuid_of_the_view) -vob <vob-tag-where-checkout-is>
should do the trick as mentionned previously by VonC.
However, be aware that this command cancel ALL the checkout in .
So if you have say :
\avob\file1.c
\avob\file2.c
Say both files are checkedout by the same view of the same user and you want to uncheckout only file1.c. The "cleartool rmview" command described above cancels ALL the checkout in the VOB. So file2.c will also be uncheckedout.
The good news is that the checkedout version will not be lost as they will stay locally in the absent user's view. He will be able to access them once he is back.
There is still another strategy how to handle other persons checkouts as an administrator. Gain access to the users snapshot view. If the computer is reachable, mount the snapshot location and use it as yours. In this case you may even checkin these checkouts as you see the changed files. Is the computer is unreachable, you can construct a new view.dat with the view UUID and populate your view with a cleartool update command for the critial files and directories. Changes in directory versions you will see and be able to checkin, file element changes are not reachable, so you have always to unco file versions.

How to find out where the loaded files of ClearCase views?

We use both ClearCase UCM and base. One of the open questions we have is, how to find out where the loaded files of snapshot views are reside, by a given path of view storage directory?
e.g. We have a view located in C:\views\myview.vws
Sometimes the equivalent loaded files are in C:\views\myview directory, but sometimes not. I'm looking for a way to find where it is.
I tried to find it out by cleartool lsview -l and cleartool desc - does not help.
The Windows registry does not provide this answer as either (AFAIK).
I confirm there is not information where a snapshot view (UCM or not) actually resides.
You need to realize that by simply copying the .view.dat (hidden) file that you can see at the root directory of any of your snapshot view, you will make the destination directory (in which you copy the .view.dat file) the root of your snapshot view.
Copy it to three different directories, and you have the same snapshot view replicated three times!
Copy it to C:\Windows\System32, and that directory becomes a snapshot view root directory!
You best bet is to search for those .view.dat (or view.dat on Windows): those files contains the uid (unique id) of the view, allowing you to reconcile that with what you see within the view storage.

merge of directories in clearcase

I merged directories in two different views using clearcase. The directories can have difference in the no. of files and subdirectories.
After merge The listing of files merged on merge manager doesnot match with no. of files
checkedout on to-clearcase view.
ie. lsco on the merged-to view and
No. of files checked out on merge manager(I didn't checkout any files prior to merge operation)
It depends on the history of the two versions of a directory being merged from one branch to another:
if one version has removed files (i.e. has less files than the other version)
if said version is merged onto the other,
the resulting version will have less files than initially shown in the view.
That could be because:
that view is not the one used for the merge
that view is the correct one, but with an eclipsed or hijacked content (privates files replacing versioned files)
In any case, what would help in the mentioned view is:
a 'cleartool ls' in the directory merged
a 'cleartool ls' in the parent directory of the directory merged.
The output of those two commands would help to confirm the exact status of the files merged within that directory, as well as the status of the directory itself.

Resources