How to import the files from folder A to folder B with latest version of folder A - clearcase

In clearcase v9.0.1.5, I need to import files from folder A to new folder B with the latest version of A.
Meaning: the ClearCase versions of files in B should be same as that of A:
if file version in A is 4 then after import the version of that file should show as 4 in B.
Is there any possibility to perform this ?

You can easily use clearfsimport to import flat files to a branch in one command.
That will duplicate the files from A to B, versioning them again in B.
But that won't duplicate the version number, which entirely depends on the history of the branch.
You can use cleartool checkin -identical to force an element to increment its version number on its branch.

If folders A and B are in the same VOB, you can hard link the files together, but that will have issues with checkouts in dynamic views. You could also create use symlinks.
If A and B are in separate NON-UCM VOBs,you can use clearexport_ccase and clearimport to copy the elements.
Another option for non UCM VOBs is to use relocate -update to copy the files. This clones the relocated elements completely, down to their OIDs. If A and B will be used in the same audited build, you probably dont want to do this as some directory OIDs may get cloned too, and directory element OIDs are used heavily in build audits.
For UCM component VOBS, you may have to DIY it using scripts. "Cleartool checkin -from" may help here.

Related

How do I check out a specific version of a file in clearcase?

Background
In clearcase, I have a dev version tree for a file that looks like this:
(1)
|
(2)
|
(3)
When I run a certain program, it hangs up on an error that is in version (1) of the file. It will not look at other versions because my program is tied to a certain label. Therefore, I want to make an unreserved checkout of version (1) and fix the error.
Problem
When I run the command ct co -unreserved -nmaster -nc filename, it checks out the file in version 3 not version 1.
Question
How do I checkout version (1) of the file and make changes in that version?
You can checkout a version which is not selected by the config spec of your view, using cleartool checkout
Check out an old version of the file hello.h, using an extended path name to indicate the version. (Before you check in your revised version, you must perform a merge.)
cleartoolt checkout -un -nm -c "attempt fix of old bug" -version hello.h##\main\1
With -nmaster, checks out the branch even if the current replica does not master the branch. Do not use this option if you cannot merge versions of the element.
It would work for files (not directories) in dynamic or snapshot view.

how to merge new folder from a sub branch to the main branch in clearcase?

How can I merge a newly created folder in a sub branch to the main branch?
I went to the version tree and did create merge by drawing.
But it still I cannot see the folder in main branch and the version on main branch is 0.
Can someone help?
Merging only the folder (by drawing a red arrow between the version of the folder and the destination branch) is not enough.
That new folder has been introduced in a parent folder, which needs to be merged as well. That is what would allow you see to see that folder in the destination view.
It is best to go to the parent folder in the destination view (the one set to create version on the destination branch) and do a findmerge from there.
See this cleartool findmerge question.
cd D:\bView\Folder1
cleartool findmerge . -ftag a_view -merge

Not all branches created when migrating from CVS to ClearCase

We are moving our code from CVS to ClearCase in order to consolidate our history in only one vcs system following the guidelines provided here http://www.ibm.com/developerworks/forums/message.jspa?messageID=13728313.
At first glance everything looked fine. All versions of all files appear to have been migrated, all branches and tags from CVS exist in ClearCase.
However not all files have branches created correctly (in my opinion). The example file.bat
has the following history (hope the ascii drawing is understandable).
1.1
1.2 --- SOME_TAG
1.3 --- SOME_OTHER_TAG
|---- BRANCH_1
1.4 --- BRANCH_2
|- 1.4.2.1
|- 1.4.2.2
Now, both SOME_TAG and SOME_OTHER_TAG is created and applied correctly in ClearCase. BRANCH_2 is created from CVS version 1.4 with version 0 on the branch having the same creation date/time as the CVS version 1.4. Which is good. Version 1.4.2.1 and 1.4.2.2 is created as version 1 and 2 respectively on BRANCH_2.
The problem is BRANCH_1 which is not created. As a minimum I would have liked to have the branch possibly only with version 0 on it.
I can see from the output of clearexport_cvs that the issue stems from here. The BRANCH_1 tag is not included in the output from clearexport_cvs command, only SOME_OTHER_TAG.
Any good ideas as how to rectify this? I couldn't find any options or switches on the clearexport_cvs command which seemed to help me.
It is important that we keep the original timestamp from CVS in order to be able to get the correct sourcecode for old builds. We used Parabuild so the only reference to CVS we have per build is similar to this "cvs update -P -A -d -D "2012-12-20 13:31:42 GMT" -r BRANCH_1"
Kind regards
Peter
If the clearexport_cvs doesn't work completely, and since there is no way to export only one branch, It is best to try fixing the import incrementally, and do a clearfsimport on a a dedicated ClearCase branch.
That would allow you to "patch" the history import with a few selected revisions from the CVS repo, but this isn't an automated process (unless you script the update of a CVS workspace, a bit like I did for Subversion).

How can I checkout a version of a file from another branch with Clearcase Remote Client

I'm using the Clearcase Remote Client 7.1.2 (and I only have it available)
I have a file which has 2 branches, branch1 and branch2. branch1 is configured to be the default branch in config spec. I want to checkout a version of the file from branch2, but there is no such option in Version Tree Browser when I click any version of the file on branch2. I can only checkout the latest version on branch1.
What am I doing wrong? Is there a configuration that will allow me to checkout any version I want?
A (CCRC web-)view is always defined to work at the latest version possible (LATEST) of a specific branch.
The CLI associated with CCRC doesn't include 'get' (presented in the second part of "In ClearCase, how can I view old version of a file in a static view, from the command line?"
If your view isn't an UCM view, you could add a selection rule at the start of your config spec (See CCRC edit config spec):
element /vob/path/to/file .../branch2/x
with x a version number from branch2.
However, I don't remember if you have access to the actual config spec source with CCRC.
You may want to create two views. One whose config spec selects versions in branch1 and another that selects versions in branch2. Use the appropriate view when checking out files.

Subversion svn:externals file override?

I have a repository for one of my projects that has a nested repository using the svn:externals property to update files from an external library. The problem is that I need to comment out one of the function declarations from one of the headers in this library, and carry around the modified header with the root repository.
Is there a way that this could be done, so that when the library is updated, it overrides that specific file with my version of it?
What you want sounds like a "vendor branch" scenario to me.
current repository
root
|-- myproject
|
-- mycode
|
-- library -> svn:externals to a remote svn or your own libraryproject
suggested repository
root
|-- myproject
|
-- mycode
|
-- library -> copied/branched from ^/vendor/library/current (modified at this location as much as you like)
|
-- vendor
|
--library
|
--current
|
--imported-version-1.0
|
--imported-version-1.1
How to create the layout
Create ^/vendor/library/current and DOWNLOAD the original unmodified library code into it.
svn commit ^/vendor/library/current
svn cp ^/vendor/library/current ^/vendor/library/imported-version-1.0 (tag the import)
svn cp ^/vendor/library/current ^/myproject/library (branch the code into your project)
modify ^/myproject/library and commit
How to update the library without losing your modifications
Download the latest original release of the library into ^/vendor/library/current OVERWRITING files.
svn commit ^/vendor/library/current (checks in the difference between the two library releases)
svn cp ^/vendor/library/current ^/vendor/library/imported-version-1.1 (tag the change)
cd /your-local-workspace/myproject/library (will be merge target)
svn merge ^/vendor/library/current (get all CHANGES from the upstream branch and apply them to your modified library)
svn commit
profit
Instead of branching "current" directly into your project you could branch to a "my-modified-libs" directory and make use of it via externals. This would be advised if you have multiple projects that need the same modified version of a library.
Keep in mind that vendor branches will have problems dealing with renames and deletes as those can not be tracked by overwriting. Cross-repository merging is a different and rather young topic for SVN.
If you try it out, give us feedback how it went :)
Christoph
There isn't a built in feature to help you with this.
The general practice way of dealing with this would be: Make a branch of the library you're using then make the changes you need there and use the newly created branch as the external for the root project. In my experience I've found this to be a simple and effective solution to the problem you describe.

Resources