I am trying to programatically determine if a VOB is mounted in clearcase.
Specifically, I want to run a command and parse the output.
However, I can't seem to find this information in cleartool describe.
cleartool lsvob \theVob
should be enough
If there is a star (*): it is mounted
* \thevob
If there is not: it is not yet mounted.
See command lsvob.
:_
By default, lsvob lists all VOBs registered in the current network region, whether or not they are mounted (active).
The default output line can include up to six fields, as shown in this example:
* /vobs/src /net/host2/usr/vobstore/src_vob public (ucmvob, replicated)
The output fields report:
Whether the VOB is mounted (*)
The VOB tag
The VOB storage directory path name
Whether the VOB is public or private (see the mkvob reference page)
Whether the VOB is a UCM project VOB (ucmvob)
Whether the VOB is replicated (replicated)
I've found if you have a view already running, a simple "if exists" \view\\VOB works. Sometimes (if for example you're trying to use the CAL, things can be a tad slow at times)
I.E.
Perl
if (-d "\\view\onaclov\TESTVOB")
{
#do something now
}
Batch
if not exists \\view\onaclov\TESTVOB <insert mount command here>
The above will check for a particular folder, if it doesn't exist, you can do a mount vob command.
VB.NET
If System.Io.Directory.Exists("\\view\onaclov\TESTVOB") then
'Blah
end if
Just some additional insight. (you don't always have to use the Clearcase/Quest tools to do what you need)
Related
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.
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).
I have two streams
Int
|--> Dev
I want to make sure Dev has everything similar to Int stream word to word.
I have already rebased Dev stream from Int stream, but I know its not going to make it exact replica of Int.
I know I should be using "clearfsimport" command but I could not understand whats the syntax for it.
Please help me with the command using below assumptions, I am on solaris and will be using cleartool command line interface
project vob directory - /vobs/HowDoI
Stream name -> HowdoI_Int
Int View name -> HowDoI_int_View
Dev Stream name -> HowDoI_Dev
Dev View name -> HowDoI_Dev
See "How can I use ClearCase to “add to source control …” recursively?" for an example of clearfsimport syntax.
In your case, assuming both views are started, and the vob is mounted:
clearfsimport -preview -rec -rmname -nset /view/HowDoI_int_View/vobs/HowDoI /view/HowDoI_dev_View/vobs/HowDoI
Remove the -preview when you think the command does what you think it should.
Note the -rmname option in order to get a mirror image from Int to Dev:
Any element present in Dev which are not present in Int will be rmname from Dev, leaving it exactly as Int (meaning without extra elements)
Error: Must be set to an activity in a UCM view.
That means you must set an activity first in the destination view (the one in which you are importing files):
cd /view/HowDoI_dev_View/vobs/HowDoI
cleartool mkact import_deom_int
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).
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.