Clearcase error adding file - clearcase

I cannot add a new file to the VOB. I tried both UI context menu on windows as well as cleartool command line utility.
cleartool> checkout .
Checkout comments for ".":
Created branch "BRANCH_NAME" from "." version "\main\BASE_BRANCH_NAME\1".
Checked out "." from version "\main\BASE_BRANCH_NAME\BRANCH_NAME\0".
cleartool> mkelem -ci -nc NewFile.h
Created element "NewFile.h" (type "text_file").
cleartool: Error: Unable to check out "NewFile.h".
cleartool> uncheckout .
describe -l . shows me that the folder has rwx permissions. What am I doing wrong? Why I can't add file?

As mentioned in this thread (and already commented):
You'll need a rule that selects /main/0 or /main/LATEST
/main/0 is the placeholder version created for any new element added to source control.
See for instance "how to create a branch in ClearCase" or "How best to branch in Clearcase?" for an example of a config spec allowing to add to source control in a branch.
element * CHECKEDOUT
element * .../aBranch/LATEST
element * STARTING_LABEL -mkbranch aBranch
# selection rule for new "added to source control" file
element * /main/0 -mkbranch aBranch
element * /main/LATEST

Related

How to set view element baseline from command line or script in UCM ClearCase?

How can I select an element with a specific baseline in a UCM ClearCase snapshot view config spec from a script?
I'm writing a script which will create a snapshot view of a given stream and should select a specific baseline version of the stream contents. I would prefer to set the element baseline in the same manner I'm setting the load rules but can't find a way to do that.
Here's what I'm doing so far:
...
cleartool mkview -snapshot -tag ${cc_view} -ptime -stream ${cc_stream}#\\myVob -vws ${cc_dir}/${cc_view}.vws ${cc_dir}/${cc_view} || die "Failed to create view. Exiting."
cd ${cc_dir}/${cc_view}
# Set the element baselines
cleartool edcs -overwrite
cleartool update -overwrite -add_loadrules ${components} || die "Failed to update view. Exiting."
...
Another issue might be that I can't set the element version in the config spec in the custom block - I have to do it in the component selection rules instead! Overwriting UCM's "Component selection rules" section feels a bit dangerous. I do this in the edcs phase:
ucm
identity UCM.Stream <...id...>
# ONLY EDIT THIS CONFIG SPEC IN THE INDICATED "CUSTOM" AREAS
# This config spec was automatically generated by the UCM stream
# "myStream" at 2017-06-01T07:43:33+02:00.
# Select checked out versions
element * CHECKEDOUT
# Component selection rules...
element "[ee5a<...id...>=\MYCOMPONENT]/..." my-component-1.0 -nocheckout
end ucm
#UCMCustomElemBegin - DO NOT REMOVE - ADD CUSTOM ELEMENT RULES AFTER THIS LINE
#UCMCustomElemEnd - DO NOT REMOVE - END CUSTOM ELEMENT RULES
# Non-included component backstop rule: no checkouts
element * /main/0 -ucm -nocheckout
#UCMCustomLoadBegin - DO NOT REMOVE - ADD CUSTOM LOAD RULES AFTER THIS LINE
load \MYCOMPONENT
Related questions:
UCM: How to create dynamic view (base clearcase) on arbitrary incremental baseline
Snapshot from old baseline
As VonC suggested I moved to base CC:
...
cleartool mkview -snapshot -tag ${cc_view} -ptime -vws ${cc_dir}/${cc_view}.vws ${cc_dir}/${cc_view} || die "Failed to create view. Exiting."
cd ${cc_dir}/${cc_view}
cat << EOF > config_spec
element * CHECKEDOUT
element * ${baseline} -nocheckout
element * /main/LATEST
EOF
cleartool setcs -force -overwrite config_spec || die "Failed to set config spec. Exiting."
cleartool update -overwrite -add_loadrules ${components} || die "Failed to update view. Exiting."
...
First, that will only work if the baseline is full.
If it is an incremental one, you have the risk of selecting an element with a label (associated to the baseline) which is not set on the parent folder, making that element inaccessible.
Second, that kind of custom selection is best done with a non-UCM base ClearCase snapshot view into which you have:
the same load rules as your UCM snapshot view
but a simpler set of selection rules:
element * yourBaselineId
element * /main/LATEST

in multisite environment, how to find out which site has clearcase view uuid?

$ cleartool rmstream stream:tiger#/vobs/forest
Remove stream
"stream:tiger#/vobs/forest"? [no] yes
cleartool: Error: No tag in region for view "d6ca911d.229a41bb.942b.fd:ed:f2:bb:5c:f8".
cleartool: Error: Unable to remove stream "stream:tiger#/vobs/forest".
how to find out which site has clearcase view uuid d6ca911d.229a41bb.942b.fd:ed:f2:bb:5c:f8?
The IBM technote swg21127922 does list a MultiSite environment and the view existing at a different replica site as a possible cause for this error message.
It might not be mandatory to switch to the site referencing that view to move forward though.
The steps described to resolve the issue involve removing the view by its uuid in the pvob of the stream.
I used that technique (rmview --uuid) before in "Removal of clearcase views involves any housekeeping?".
For instance:
cleartool lsstream -l stream_name#\pvob.
The output will include:
views:
98573bec.d7e34570.a71c.e8:ab:7c:50:d4:02
Then:
ct desc -l vob:\ford_pvob
The output include:
VOB holds objects from the following views:
f15eagle:d:\ClearCase_Storage\views\RATIONAL\evchan\evchan_proj1_2.vws [uuid 98573bec.d7e34570.a71c.e8:ab:7c:50:d4:02]
You will need change directory (cd) into the PVOB
Example:
W:\>cd ford_pvob
W:\ford_pvob>
Remove the view reference from the PVOB using, cleartool rmview -uuid uuid_number
Note: By adding the -all switch, you will ensure to remove the view reference from the PVOB and any UCM Component VOBs that may also have a reference from this view; cleartool rmview -all -uuid uuid_number.
In this particular example, the -all was not required since we are only removing the view reference from the PVOB.
Example:
W:\ford_pvob>ct rmview -uuid 98573bec.d7e34570.a71c.e8:ab:7c:50:d4:02
Removed references to view "f15eagle:d:\ClearCase_Storage\views\RATIONAL\evchan\evchan_proj1_2.vws" from VOB "\ford_pvob".
Now the stream can be removed, using cleartool rmstream stream_name#\pvob
Example:
W:\ford_pvob>ct rmstream evchan_proj1_2#\ford_pvob
Remove stream "evchan_proj1_2#\ford_pvob"? [no] y
Removed stream "evchan_proj1_2#\ford_pvob" .

text_file_delta failed create_version operation in clearcase

Continuing my previous post: Provide version to independent files in clearcase. Now I able to execute clear case import command but with some errors. Following are some errors occurred while import:
clearfsimport: Error: Could not checkin "E:\CC_Work\FromCC\santosh_view57\Temp_TEST\AspNET\Scripts\WebForms\MSAjax\MicrosoftAjax.js".
clearfsimport: Warning: Trouble importing element "E:\CC_Work\FromCC\santosh_view57\Temp_TEST\AspNET\Scripts\WebForms\MSAjax\MicrosoftAjax.js".
Creating element "E:\CC_Work\FromCC\santosh_view57\Temp_TEST\AspNET\Scripts\WebForms\MSAjax\MicrosoftAjaxApplicationServices.js".
Created branch "TEST_TEMP" from "E:\CC_Work\FromCC\santosh_view57\Temp_TEST\AspNET\Scripts\WebForms\MSAjax\MicrosoftAjaxApplicationServices.js" version "\main\0".
clearfsimport: Error: Type manager "text_file_delta" failed create_version operation.
Following is my import command:
clearfsimport -rec -nset -comment "Commit test" F:\abc\ASPNET* E:\CC_Work\FromCC\santosh_view57\Temp_TEST\ASPNET
And config spec is following:
element * CHECKEDOUT
element * .../TEST_TEMP/LATEST
element * /main/LATEST -mkbranch TEST_TEMP
element * /main/LATEST
load \Temp_TEST
Same file is able to check out and check in using "ClearCase Expoler" GUI.
You might need to change the type manager associated to js files, as their content could not always be compatible with what a text_file_delta manager expects.
See "Type manager text_file_delta failed create_version operation" for concrete examples.
This technote lists the limitations which makes a text file fail:
Type manager size limitation - File too large
Text files that contain binary data - Contains a '\000'
Line exceeding 8000 bytes
Corrupt source container - not the highest on its branch
I have seen issue with the first 3.
If you have to change its type, see this technote.

How to open a dynamic view in clear case with a given config spects using command prompt?

I have config spects for a view and I need to create a view in Clear Case using command prompt.
Please let me about the commands I can use with some example.
Thanks in Advance!
That would be using:
cleartool mkview
followed by cleartool setcs -tag yourDynView pname, with pname being "a text file whose contents are to become the view's new config spec".
For creating a dynamic view:
cleartool mkview -tag yourDynView \\shared\path\to\viewStorage\yourDynView.vws
That will create a dynamic view with a default config spec:
element * CHECKEDOUT
element * /main/LATEST
You will then be able to replace that config spec with any other config spec stored in a file, with the setcs command.

ClearCase: Copy old versions with Snapshot Views under Windows

Using IBM Rational ClearCase:
- I have only access to Snapshot Views so NO dynamic Views
I want to copy ALL versions from a certain changeset to c:\temp. I have already listed the changeset versions in a file (couple of hundred of versions, I only need the latest one), I do not have a baseline over this older set.
What I now have and does not work:
#!/usr/bin/perl -w
#
# PROGRAM: copytest.pl
$filename = "Design test123.doc";
$view = "D:\\AdminViews\\ABC_R1_READ_2\\ABCD002\\ABC_DESIGN\\BLA Framework\\P0\\";
$version = "\\main\\ABC_R1_READ\\1";
$printhet = 'cleartool find . -name "' . $filename . '" -version version(' . $version. ') -exec "cmd /c copy %CLEARCASE_XPN% D:\temp\%CLEARCASE_PN%"';
system($printhet);
Basically because: http://www-01.ibm.com/support/docview.wss?uid=swg21150317 (XPN)
update: I read In ClearCase, how can I view old version of a file in a static view, from the command line? again and I see that a diff with an empty file is the /hack for having no XPN. ok... but a diff with empty and a doc in the above gives me "0"
I am not sure what this IBM article (you mention in your question) can mean in your situation since it only works for dynamic view (if the view does not directly select the version you need).
And my old answer for accessing an extended path file content in a snapshot view is not trivial to adapt here.
So why not aim at something equivalent but simpler?
Why not create another snapshot view directly within c:\temp (c:\temp\myview_snap), with a config spec along the lines of (you can keep '/' instead of '\'):
element * CHECKEDOUT
element "/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework/P0/..." /main/ABC_R1_READ/1
element -directory "/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework/P0/..." /main/ABC_R1_READ/LATEST
element -directory "/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework/P0/..." /main/LATEST
element "/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework/P0/..." -none
element /ABC_R1_READ_2/ABCD002 /main/ABC_R1_READ/1
element /ABC_R1_READ_2/ABCD002 /main/LATEST
element /ABC_R1_READ_2/ABCD002/ABC_DESIGN /main/ABC_R1_READ/1
element /ABC_R1_READ_2/ABCD002/ABC_DESIGN /main/LATEST
element "/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework" /main/ABC_R1_READ/1
element "/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework" /main/LATEST
element * -none
load /ABC_R1_READ_2
That way, you should select:
any element under /ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework/P0 (P0 included) with the right version
any directory which had not the exact version will try first to load itself as the LATEST on ABC_R1_READ, else as /main/LATEST as fallback (always exists)
if an element (file) has not that version, it won't be selected at all and not loaded.
any parent element (/ABC_R1_READ_2/ABCD002/ABC_DESIGN/BLA Framework), if it has not the right version, will be selected as /main/LATEST (always exist)
any other element (outside of the relevant tree) will be ignored, non-selected
Just tested it: it works fine.
Notes:
"BLA Framework" is a directory with a space in it, so you need to add the double quotes where it is used.
the load rule can just load the vob ABC_R1_READ_2: since the '-none' rules will not select what you don't need, they won't be loaded anyway.

Resources