How to recover checked out file in Clearcase? - clearcase

Let's say there is a file called myfile.java. I checked it out and I was working on it. Before checking it in, I have lost my hard drive and I had to get a new hard drive.
Next time that I want to check out the file, it says that I can not check out. It was already checked out in the old view which has gone. I have to mention that I am using the option "re-use development stream option".
Is there anything I can do to be able to checkout the file once again?

You can completely unregister your old view in the vob of that file: that will remove the "checkout" status associated to that file.
cleartool mount \myVob
cd m:\mynewView\myVob
cleartool rmview -force -uuid old_view_uuid
To find the uuid of your old view, try a:
cleartool descr -l vob:\myVob
And look for a view storage path including your old view name in it.

Related

How to delete a view tag with special characters in ClearCase

I have a view, for some reason, it was named with a special character: "0x7f", at least I think so..
For example:
MyView123456 -> MyView'0x7f'123456
I can only found this view by
ct lsview #list all views.
And I found this "0x7f" when dump the outputs to a file.
And using vim.
Now I'm trying to delete this view totally.
I can unregistered and delete the view itself by -uuid.
But I cannot delete the view tag.
And I also found wildcard '*' seems not working.
Does anyone know how to delete this view tag?
P.s. I'm under Linux, and no GUI.
Try first if dome of the workaround described in "Removing ClearCase objects whose name begins with a hyphen", when using cleartool rmtag:
cleartool rmtag -- MyView*
Note the use of '--' in order to separate the command from its parameters
The wildcard being expanded by your shell, try and use it instead in the cleartool interractive session:
cleartool
> rmtag -- MyView*
In Linux shell, see if a single quote is enough:
cleartool rmtag -- MyView'0x7f'123456
# or
cleartool rmtag -- 'MyView0x7f123456'
I was able to create and remove a view with binary data in the tag using Perl. You have to use the OCTAL value of 177 in the strings.
I created my view using this command line:
perl -e '`cleartool mkview -tag myview\177tag /net/bullwinkle/export/vobstg/binarytag.vws`'
And I successfully removed that view tag using this command line:
perl -e '`cleartool rmview -tag myview\177tag`'
If the view was unique enough, you could also use (on Unix) or at least try:
cleartool rmview -tag `cleartool lsview 'myview*123456'`
There is another mechanism, if all else fails: you can edit the vob_tag registry file. This would require an outage as the registry file is loaded into the registry server's memory on clearcase startup and only re/written after that point.
The process is:
Stop ClearCase on the registry server
CD to /var/adm/rational/clearcase/rgy (Unix) or {CC Install dir}\var\rgy (Windows)
Back up the vob_tag file.
load the vob_tag file in an editor. (vi/gedit on unix, but I'd use notepad++ on windows)
locate the problem view tag (you may need to search on the global path or some other component of the name).
Make note of the path to the view.
Delete the line.
Start ClearCase on the registry server
unregister the view or retag it with an easier-to-access tag.

checked out file not visible in clearcase view?

I created this new clearcase element and checked out but when I try to check in, it is giving an error saying "no such file or directory". I can see this file checked out in an activity so how can I get this file check in?
Thanks.
The easiest way to debug this is through a shell
cd /path/to/parent/directory/of/the/file
cleartool ls
Look for the version and selection rule for that file.
Check also the config spec of your view
cleartool catcs
# or
cleartool edcs
See if the config spec does start with a:
element * CHECKEDOUT
For a "checked out but removed" status, you can refer to "How to recover a file from “Checkout but removed” state?".
The idea is to "undo checkout" a dummy file (same name, but empty), in order to recover it as before any local change.
There is no easy way to recover the local changes done while that file was ched out and present (except for some file recovery tool like Recuva, but it is a long shot).

Delete file from ClearCase checked out on another branch

I am trying to delete a file in ClearCase. When I attempt to delete it I get a message that the element has checkouts. When I do a version tree on the file I see that the file is checked out by another user, in another view, on a different branch.
How do I delete this file? In addition why doesn't ClearCase let me delete this file?
You can delete it through the command line and cleartool, by forcing its delete (option which isn't available with the GUI)
cleartool rmname -force theFile
Don't forget to checkout the parent directory first, then to checkin that same parent directory, in order for everyone to see that you have dereferenced that file within said directory.
See cleartool rmname:
–f/orce:
Forces the removal of the name when there is at least one checkout of the element.
When used with –nco, suppresses the prompt for confirmation.
That will work even when you had this before:
, as explained in the technote "About cleartool rmname and checkouts".

Finding Changed files in a ClearCase folder

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.

ClearCase - file system path to element path

Given a file system path such as "D:\pkirkham_view\VOB\Folder" or "U:\VOB\Folder\", is there a mechanism to get the path which would work in the config-spec to to load that folder "/VOB/Folder/" ?
Either CAL or cleartool commands would be fine. This is to run on client machines with ClearCase LT installed.
(I haven't found anything usable in CCElement.get_PathInView() or the various cleartool ls commands I've tried)
There is no native command, but the only load rule you need is based on a vob name.
So you need a script able to:
1/ remove everything including the name of the view
(which you can obtain with a '<aPathTo>\VOB\Folder\;cleartool cleartool lsview -s -cview)
D:\pkirkham_view\VOB\Folder => \VOB\Folder
U:\VOB\Folder\ => \VOB\Folder
2/ Build your load rule accordingly:
load \VOB\Folder
3/ Append that load rule to your config spec (if you are already within the view):
cleartool catcs > aConfisgpec.txt
echo "load \VOB\Folder" >> aConfisgpec.txt
cleartool setcs aConfisgpec.txt
The OP comments:
So, if I create a snapshot view whose tag name is 'pkirkham_testing_view' on path 'D:\thursday', how is that a substring extract?
That is a good point, since one can name the root directory with any name.
I would recommend naming that directory with the tag of the view.
But that is not the case, you need to determine the root directory of a snapshot view:
start in 'D:\whatever\path\VOB\Folder',
try a cleartool lsview -cview:
if it respond correctly, cd .., and repeat 2.
When it exit with an error, remove the substring of that directory from the initial path. What remains will be your load rule.

Resources