I have checked out a file say "a.c" in my activity branch which is having version 3 from main line in clearcase and I did some changes to that file.
Now I want to do check in of that file on the main line but the latest version of that file in main line is now 7.
I want to put my changes to that file and hence it will create the version 8 of that file.
So how can I do check in so that I can merge my changes to the latest version of file. In other words I am having 3rd version of a file and I want to give my changes to the latest version of the file
Even before the delivery, a simple checking should trigger the merge, in an UCM dynamic or snapshot view.
If there is any conflict, the cleartool mergetool will popup then.
That is what this technote details:
To merge the latest version with your checkout
When you first check in (on Windows systems, issue the Check In command for) a non-latest version of an element, one of the following actions occur:
On the UNIX system and Linux, you see a message that the version you checked out is not the latest on the branch, and the checkin is prevented.
Enter a command in the following format:
cleartool merge -graphical -to file-or-directory-in-your-view \
file-or-directory-name##/main/LATEST
Using the -graphical option starts the Diff Merge or, if you merge XML versions, the XML Diff Merge tool.
The argument on -to specifies your checked out element.
The other argument is a version-extended pathname that specifies the latest version on the branch on which you are working (see the pathnames_ccase reference page for a complete description of syntax).
After the merge completes, save the results and check in the version by entering the cleartool checkin command from the view.
On Windows systems, a window opens and asks whether you want to merge the file now. If you choose to merge, an automatic merge is attempted. If your input is needed to complete the merge, the Diff Merge or XML Diff Merge tool starts. After the merge completes, you are prompted to check in the element.
It sounds like you are using a Base ClearCase branch to do your work. You have a few options in that case. You can, and should, check the work in on your private branch and then do your merge operation...
Options include, but aren't limited to:
Use the manual cleartool merge command.
Run "cleartool lsvtree -gra {file}" or use the "version tree" clearcase context menu item to bring up the version tree. Right click on the current version and you will get an option to merge to any other version...
If you're using view profiles and are done using the private branch, there is a "finish private branch" option in the ClearCase home base.
If you checked out unreserved on the same branch as has been updated, you can use the vtree browser or the command prompt to merge your changes forward and check them in.
Related
I'm trying to use CCRC API in order to get pervious versions for a specific file and compare with the checkout file.
I know ClearCase can use get command. But how it works in CCRC API?
Does anybody have some example how to retrieve this version without changing the config spec?
Thanks,
Crispy
rcleartool has seen new commands with CC8.0.0.3 and CC8.0.4, but is still missing a 'get' command except for the very latest ClearTeam version (8.0.1: see the rcleartool list of commands).
I said as much in "How do I retreive previous or old version in CCRC 7.1.2".
With CCRC 8 (aka ClearTeam Explorer) supporting dynamic view, you can try and use version-extended path (or rcleartool get), but if you are talking about CCRC, you are likely to be with a ClearCase 7.2.x instead of 8.x.
A separate dedicated web view, with a config spec you can change remains for now your safest as in "available right now") option.
I'm writing code to compare my checkout file(some code is modified) with the latest version in clearcase. So I have to get the content of the previous version to compare with my checkout file.
That seems more a job for rcleartool diff -pred
-pre/decessor
Effectively converts the first pname argument into two names:
(1) the predecessor version of pname in the version tree;
(2) pname itself.
If pname specifies a checked-out version, the predecessor is the version from which it was checked out.
Once you label file versions in a release, ideally you want to protect that code from inadvertant removal (please read everything before commenting). It is too easy to delete the code.
I know I can lock the label but the file versions attached to the label don't get automatically locked (you would have to create a perl script to do that?). You can lock an element but not an element version. Furthermore, once you lock an element, you can't check it out!!!!! STUPID. This stops future development! All I want to do is protect the code I developed (without copying it elsewhere for archive). A repository should protect the code you develop.
Of course, there is the protect command but that doesn't work in snapshot / web views.
Again, ideally you would want to lock all the element-versions in a release but still be able to continue development. The lack of this feature seems to be a gross oversight.
Any ideas? (if you have any perl scripts, please post)
It is too easy to delete the code.
It shouldn't be: the only way you will be removing that labelled version from a ClearCase VOB is through destructive commands like cleartool rmelem or cleartool rmver.
All you need to do is to have a (preop) trigger in place denying those commands for everybody (except a ClearCase admin).
Something along the lines of:
cleartool mktrtype -nc -all -ele -pre rmelem -nusers $nusers -exec \"$perl_cmd -e exit(1)\" NO_RMELEM\aim"
I would still recommend to lock the label anyway, in order to make sure it isn't moved to another version.
As in:
ct lock -nusers vobadm lbtype:FOO_LABEL#vob:/vobs/admin
But again, if rmver is denied, your (labelled) code is safe.
Actually, the OP was talking about rmname (the DEL) in ClearCase Explorer.
The fear is that if a file is deleted, and a label is moved, then one could ignore for a long time the deletion.
BUT a label should never be moved:
the label from a ClearCase UCM baseline is immutable (you cannot move it)
a label in base ClearCase should always be locked
I'm having a tough time with ClearCase. I'm working with a dynamic view.
Somehow, I got two files that are eclipsed. I compared the folder in my version (with the eclipsed files) with every version on my branch and every version on the main branch. The original files are nowhere to be found.
I searched for the files in Windows Explorer and found them in the lost+found directory (with a 32 character extension). This directory appears to be invisible because I can't see it in either Windows Explorer or ClearCase.
I opened a DOS window and ran cleartool. I removed the files (I had fun typing it all, plus the 32 character extension at the DOS prompt). I could not find a way to delete them from either Clearcase Home Base or ClearCase Explorer.
I thought this would solve my problem, since there are no more files with the same names anywhere on my computer.
I deleted the eclipsed files and created them again in Qt Creator. But when I opened ClearCase Explorer again, there they were - eclipsed! I cannot figure out where the evil twins are. I tried finding the eclipsed files by using cleartool. Nothing. I've tried many approaches I've found online - none work.
I tried stopping and starting the view. I deleted the eclipsed files again, closed Qt Creator and then opened Qt Creator again and recreated them. I tried many other things suggested - none made any difference.
If I'm eclipsing existing files, where are they? I'm starting to think that the real evil one here is the parent - ClearCase!
Eclipsed doesn't mean evil twins (the fact that you add multiple times a file does though).
When you add to source control a file, ClearCase will:
checkout the parent directory
access the file in order to create a temporary one (called 'afile.mkelem')
create the file in the ClearCase vob
check in the parent directory
I usually see repeated eclipsed file when ClearCase isn't able to access the content of a file, because another process prevents it.
Try adding those files after closing the Qt editor.
The OP Rob Moore mentions having solved the issue with:
I changed the view to main/LATEST, and the file showed up.
I went to the tree view of that file and noticed that I had a branch there with one version.
I compared my branch version with the main/LATEST and they were the same, so I deleted my branch and put my label on the main/LATEST version
So it is possible that, as soon as the element was added, it wasn't properly selected by the config spec (being a new version on a branch which wasn't part of the config spec), and its state reverted to "eclipsed".
I am having a folder where lot of files and subfolders , adding it to source control via UI is consuming much time.
How to add all the files (including files inside subfolder) to source control using cleartool?
(I am using clearcase UCM)
As mentioned in "How can I use ClearCase to “add to source control …” recursively?", clearfsimport is the way to go.
However, clearfsimport will take a source an import it in your view, so:
it is best to keep the source outside your view (to avoid confusion when ClearCase tries to add the source file in the destination which is the same directory)
you must "clean out" the source directories first (because the clearfsimport command will import... all the files under the root directory you mention)
See "Creating a new subdirectory structure in ClearCase?" as an example: you can preview the result of an import first.
Please user clearfsimport or if you are working with eclipse or Intellij then there are plugins from sourceforge (eclipse) which has a options to share entire project at once to CLearcase , Below are the plugin details.
https://sourceforge.net/projects/eclipse-ccase/
Note : Clearcase has a limitation that if there is a text file with more than 8000 characters in single line , There is error at run time using clearfimport utility, This can be solved by writing your own bash script to do recursive checkin by handling the exception case . Hope it helps .
I saw another comment from a similar clearcase question that suggested typing in '*' in the topmost directory required, select all, rc->cc->add to source control.
Why do I get these .MKELEM files? How do I get rid of them?
I found some docs that said they are temp files created by ClearCase GUI when adding files to source control. But sometimes, they don't go away.
ADDITIONAL INFORMATION: I "get access denied" trying to delete or rename the .MKELEM. They seem to get created when I add new files to clearcase.
As mentioned in the mkelem tip page:
During the element-creation process, the view-private file is renamed to prevent a name collision that would affect other Rational® ClearCase® tools (for example, triggers on the mkelem operation). If this renaming fails, you see a warning message.
If a new element is checked out, mkelem temporarily renames the view-private file, using a .mkelem (or possibly, .mkelem.n) suffix. After the new element is created and checked out, mkelem restores the original name. This action produces the intended effect: the data formerly in a view-private file is now accessible through an element with the same name.
If mkelem does not complete correctly, your view-private file may be left under the .mkelem file name
The fact that a .mkelem stays can be, like LeopardSkinPillBoxHat mentions in his answer, because of a file blocked due to a process.
It can also happens:
in ClearCase view incorrectly protected (where ClearCase can checkout the new element, creating a version 0, but cannot check that element in.
alt text http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m1/topic/com.ibm.rational.clearcase.dev.doc/topics/cc_dev/images/creating_element.gif
when a trigger prevents the checkin part of the new element creation
when the view actually exclude CHECKEDOUT versions! (no 'element * CHECKEDOUT' rule...)
on Solaris 10, due to an incorrect format in one of the ClearCase jvm config file. (ClearCase 7.1)
when add to source control is used on Windows in views mapped to a mount point (Mount points are persistent directories that point to disk volumes), only in old ClearCase 2002 or 2003.
See also the Under the hood: What happens when you add to source control article.
The .mkelem files are temporary files generated by ClearCase when adding a file to source control. If the file gets added succesfully, they are usually deleted. If something goes wrong during the process (e.g. it cannot create the branch specified in your config spec), the .mkelem file may be left behind.
I'm guessing that a process or service somewhere has a lock on the file. Rebooting should fix the problem. Or try using something like Process Explorer to see what may have locked the file.
Also, from this page:
.mkelem
Files being added to source control
from the GUI will use this extension
during an "Add to Source Control"
operation.
If you see this file in your view
during the mkelem process, that is OK.
If you still see the file after the
mkelem operation is complete, that is
not ok. You will likely need to rename
the file (remove the .mkelem
extension) and add it to source
control again. This can be seen when
your antivirus software is scanning
the mvfs. Refer to technote 1149511
Support Policy for Anti-Virus and
ClearCase for further information.
You may try the following from command prompt:
ct ls -l {filename}.mkelem
This will show the links,
then please try the following to link the actual file:
ct ln -c "scm:relink" {link} {actual filename}