Checked out but removed error while merging activities - clearcase

I wish to merge an activity with my activity, the former activity has new directories and new elements.
I am getting the following error on issuing a merge with the following command
ct findmerge activityname#/vob/** -fcsets -nc -merge
The errors are as follows in 2 cases
Case1: No new elements created directly the merge command
Errors
/vob/**/Build.mk [checkedout but removed]
/vob/**/file1 [checkedout but removed]
/vob/**/file2 [checkedout but removed]
/vob/**/file3 [checkedout but but removed]
cleartool: Error: Checked out version, but could not copy data to "/vob/siren/oam/sdh/pkg/Build.mk" in view: Permission denied.
Correct the condition, then uncheckout and re-checkout the element.
Case2: I created the elements and the directory structure still the same error
Note: There are no errors for the elements which already exist in the vob

Try again your findmerge activity (as described here), but this time, without using cleartool setview (meaning without using a path starting with /vob, the mounting point for the dynamic view set by cleartool setview).
Always use the full path of the destination dynamic view (the one where the merge occur): as I told you in your previous question, cleartool setview is nothing but trouble.
Use:
cd /view/yourDestinationView/vobs/siren
ct findmerge activityname#/vob/** -fcsets -nc -merge

Related

Cleartool findmerge error

I'm running this command :
cd into view directory
cd into the relevant folder
cleartool findmerge rvnDataPathEgressProcessor.cpp##\main\RavenAppMain_Integ\RavenApp1.5\RavenApp1.5.0.0_Integ\RavenApp1.6.0.0_Integ_OBS\RavenApp1.5.2.0_Integ\RavenApp1.5.5.0_Integ\14 -fversion rvnDataPathEgressProcessor.cpp##\main\RavenAppMain_Integ\RavenApp1.5\RavenApp1.5.0.0_Integ\RavenApp1.6.0.0_Integ_OBS\RavenApp1.5.2.0_Integ\RavenApp1.5.5.0_Integ\aviv.sharon_RavenApp1.5.5.0\15 -print -whynot
I'm getting this error:
cleartool: Warning: A version selector is required, not a pathname:
"rvnDataPathEgressProcessor.cpp##\main\RavenAppMain_In
teg\RavenApp1.5\RavenApp1.5.0.0_Integ\RavenApp1.6.0.0_Integ_OBS\RavenApp1.5.2.0_Integ\RavenApp1.5.5.0_Integ\aviv.sharon_Ra
venApp1.5.5.0\15".
No merge "rvnDataPathEgressProcessor.cpp" [no version "rvnDataPathEgressProcessor.cpp##\main\RavenAppMain_Integ\RavenApp1.
5\RavenApp1.5.0.0_Integ\RavenApp1.6.0.0_Integ_OBS\RavenApp1.5.2.0_Integ\RavenApp1.5.5.0_Integ\aviv.sharon_RavenApp1.5.5.0\
Any idea how to fix this?
A cleartool findmerge requires pname:
One or more file, directory versions, or both; only the specified file versions and the subtrees under the specified directory versions are considered.
If rvnDataPathEgressProcessor.cpp##\main\RavenAppMain_Integ\RavenApp1.5\RavenApp1.5.0.0_Integ\RavenApp1.6.0.0_Integ_OBS\RavenApp1.5.2.0_Integ\RavenApp1.5.5.0_Integ\aviv.sharon_RavenApp1.5.5.0 is not an existing extended pathname, there is no version to be found, and that would explain the error message.
Try finding a view which already select the destination version, and do a:
cleartool descr -l rvnDataPathEgressProcessor.cpp
That would give you the exact and full extended pathname.
The OP reports the second argument should be the version only, without the file:
\main\RavenAppMain_Integ\RavenApp1.5\RavenApp1.5.0.0_Integ\RavenApp1.6.0.0_Inte‌​g_OBS\RavenApp1.5.2.0_Integ\RavenApp1.5.5.0_Integ\aviv.sharon_RavenApp1.5.5.0\15 without the rvnDataPathEgressProcessor.cpp##.

Clearcase Element existence

I want to check with a batch file if a certain element is already existent in Clearcase, or if I still have to add it.
How can I put this into a conditional statement?
Like:
if cleartool exists myFileName do myaction
else doOtherAction
You need to build a function which returns true or false depending on the element full name being part of the ClearCase view elements or not.
Then you can call that function from your if... else... statement.
Here are various commands that your function could use in order to determine if a file is a ClearCase element (meaning already added to source control) or not:
You can start by using the result of cleartool ls -l: if its output includes view-private object, it isn't added to source control yet.
cmd-context ls -long
version Makefile##\main\3 Rule: element * \main\LATEST
view private object bug.report
version cm_add.c##\main\0 Rule: element * \main\LATEST
derived object (unshared) hello##2007-03-24T11:32.418
version hello.h##\main\CHECKEDOUT from \main\2
Rule: element * CHECKEDOUT
Here 'bug.report' isn't added yet.
See more at "About view-private objects".
I already recommended that approach for a previous question using C#: "c# How to determine if a file is in ClearCase?".
Another approach is to use cleartool describe, which would trigger an error if the element described is a private one.
As mentioned in the technote "How to list view-private files in a view in Rational ClearCase", the command cleartool lsprivate works only in dynamic views, not in snapshot views.
For snapshot view, you can use: cleartool ls -r -view_only
Another approach is to use cleartool find, as in "Clearcase: How do I check if an element has a version on the trunk that was created after I branched off from the trunk?"
The following DOS batch file will add a file to ClearCase if it's not in there yet. Works in both dynamic and snapshot views.
#ECHO OFF
cleartool ls -l %1 | FIND "view private object"
IF %ERRORLEVEL% == 1 GOTO END
cleartool co -nc .
cleartool mkelem -nc -ci %1
cleartool ci -nc .
:END
You may want to add suitable comments instead of using the -nc switch.

Clearcase: "No such file or Directory" error during labeling

I am trying to label all the elements within a branch of a view, but some of the elements do not get labeled and instead give me a "No such file or Directory" error. I can see the files that generated the error in my command window, but they are highlighted in red. It seems like these files are not there and are thus generating the error. How can I remove these "files" from the view so that the labeling can continue and not generate errors?
Say that bolded words represent red highlighting. This is what I see:
file1 file2 directory1 directory2
Here is how my code is structured in my shell script:
cleartool mkview -tag $VIEWNAME ... (etc.)
cleartool setcs -tag $VIEWNAME configSpec.txt
cd /projectDirectory
labelname=`date "+%b-%d-%y"`
cleartool mklbtype -nc $labelname
cleartool mklabel -recurse $labelname /projectDirectory
The script starts recursing through the file tree from the projectDirectory. When it encounters file1 or directory1, I get the "No such file or directory" error. Otherwise, for file2 and directory2, the labeling occurs properly.
So, my question is this: How can I use the mklabel command or some other method to label all the files that are not highlighted in red?
You must first know the exact status of the "files in red"
For that, go in a shell to their parent folder, and type:
cleartool ls
That will give you their status (eclipsed?, private? other?), which will explain why the label cannot proceed.
Possible causes:
the files are symlinks
the files have spaces in their names (that shouldn't be the case here: cleartool mklabel should support that case)
the files are in the lost+found folder (solution: exclude that folder from your view with a -none selection rule)
Note: if an element isn't selected (no version selected and Rule: -none), then a recurse mklabel is supposed to generate that error message, but that won't prevent the label to be set on the other elements version.
So that error message should be safely ignored.

How to avoid repeat check outs on already checked out files or directories?

I have some files and directories out of which few are already checked out and few are not.
To check out those uncheck out files I am running recursive checkout:
ct co -nc ./*
Which gives below message for already checkout files or directory:
cleartool: Error: Element "abc/xyz" is already checked out to view "pqr".
Is there any way I can avoid performing ct co on already checked out files or directories?
First, you can check if you have the same issue when applying my old method "How do I perform a recursive checkout using ClearCase?".
cleartool find somedir -type f -exec "cleartool checkout -c \"Reason for massive checkout\" \"%CLEARCASE_PN%\""
(which is mirrored by the IBM technote swg21122520)
The other option is to:
first find checked out files (see "How to find all checkedout files with ClearCase cleartool?", without the -cview option, in order to list checked out files in all views)
redirect that find into a file
Then you can replace the -exec directive above in order, for each \"%CLEARCASE_PN%\" found, to:
check if it is listed in the checked out files found in the previous point
if it is not, proceed with the checkout.
In short: a two-step process.

How to find clearcase symlinks?

Currently, I have to wait for a symlink error when updating a clearcase view. I then take the name for the broken symlink and search for it specifically.
is there a way to find all broken symlinks, without necessarily knowing the name?
how to find one at a time:
cleartool> cd C:\cc_view\view_name\source_app
cleartool> find -all -type l -name "missing.link.name" -nxname -print
You shouldn't need a -all in your find query.
Broken symlink in a snapshot view update are element which are visible:
cleartool find . -type l -name "missing.link.name" -nxname -print
You can execute that command in a DOS session ("cleartool find", instead of a cleartool one "cleartool> find"): that allows you to redirect the result in a text file and parse the result.
The IBM article "How to find broken (orphaned) Symlinks" can also help.
Cause
User renamed the target, so the symbolic link is pointing to a non existing target.
After the rename of the versioned target file (a.doc -> a.docx, done by ClearCase Explorer) I get the update error, that the symlink a.doc does not exist.
Unable to resolve symlink "filename.doc". The symlink target will not be loaded.
Where can I find the link itself (in which folder is it located?)?
How can I solve the rename (?) of the symlink?
Answer
To find and remove the symlink:
Use a dynamic view (snapshot views cannot load the missing links).
Run M:\viewtag\vobtag>cleartool find . -kind slink -print
Refer to the following technote for information about how to remove the symlinks as found in the output of the above command: "Unable to resolve VOB symlink":
A cleartool ls from the command prompt will show:
virt.46e5e94ff9024144ab0fe9ed432ce6e6 --> ../virt
virt.5043bcc7c8f44439938d634bd5ba9ac2 --> ..virt [not loaded]
The above symbolic link is to a resource outside of ClearCase, which renders the hyperlink invalid for use in UCM.
Resolving the problem
Remove the broken (dangling) link from the VOB to clear the error, using the cleartool rmname command.
Example:
cleartool rmname virt.46e5e94ff9024144ab0fe9ed432ce6e6
Using cleartool rmname allows you to preserve the symbolic link, but remove references
to it from future directory versions.
Symbolic links can be permanently removed using cleartool rmelem, refer to technote 1148781 for more details.

Resources