Copy ClearCase element with its history - clearcase

Is it possible to copy a clearcase element with its full history of merges/versions/labels and other meta data? I have tried clearfsimport but it seams it only copies one version not the full element history.

clearsimport won't copy history, only import and create one version in a VOB.
Saving everything is generally at the VOB level (like "Moving VOBs").
Moving one element from one vob to another is called relocate.
But copying doesn't seen to exist.
The easiest way is to manage that element in a branch, which allows you to isolate changes from the main branch, while working on the same element.
Note: Brian Cowan adds in the comments:
Relocate with -update will clone elements from one location to another without deleting them from the source VOB.
I would not recommend this if both the source and destination VOBs are to be used in the same audited builds as it WILL confuse build audits

Related

Clearcase 7.1.2, VOB Splitting

We have a current set up of VOB such that source code and documents reside in the same VOB.
To reduce the VOB download time we now want to move the documents to a new VOB, so that only the code part remain in the old VOB.
Since there are lot of folders and files, its not possible to manually relocate each file/folder.
To do this, we need to write a script which will detect file types by their extension and move file types such as .doc,.pdf, .txt to the new VOB.
VOB server is Windows Windows 2008 R2 Enterprise edition.
I'm a novice!
Can someone help me out with the script?
Thanks
Nush
The process would involve cleartool relocate: see "Relocating elements to another VOB".
The best practice is to:
group all the right elements you want to relocate in one folder (cleartool move)
remocate that folder
It is best if what you want to split is cleanly group is one folder structure.
Note that relocate wouldn't work if you are using ClearCase UCM though.
See this article:
The reason for this restriction is immutable baselines: if an element has ever been in a baseline, it can never be moved to another place; the baseline needs to know where to look for it. So a UCM element really can't be relocated.

UCM: How to create dynamic view (base clearcase) on arbitrary incremental baseline

Currently we use ClearCase UCM.. I am trying to evaluate possibility of using git in our project. I decided to create large repo with past three years changes from an integration stream. The pvob has 12 vobs under it. For purpose of evaluation(creating a worst case), I am putting all changes into single repository.
I want to create a base clearcase view and then adjust its spec for every baseline on the pvob. This will then synched to git repository.
Question in short: How can I create a base clearcase view given a pvob base line and keep changing its config spec to match every baseline?
(academic note : A picture of what I am trying to achieve.. )
(Approach discussed in ClearCase UCM: Is it possible to have a temporary view on any given baseline? is kind of work around in my case. I guess I can avoid the step of creating many temporary streams- not sure how!)
I am putting all changes into single repository.
This isn't the right granularity for a git repo.
Having done multiple ClearCase to Git migration, the right scale usually is one UCM component equals one Git repo.
How can I create a base clearcase view given a pvob base line and keep changing its config spec to match every baseline?
You don't have to create a base ClearCase view.
You can create a sub-stream to the Int stream, and manage the baselines you want to see there.
(cleartool rebase -bas xxx#\YourPVob)
You can then use an UCM view to that sub-stream as a source for your git import.
If that approach isn't possible (as I explained in my previous answer you mention, because for instance all baselines haven't been created in the same parent stream), then you can create a base ClearCase view and modify its config spec in order to select the baseline complete ids:
element * BaselineId1
element * BaselineId2
...
(A dynamic view here is more useful to tweak the config spec.
Once the config spec is set, you can update a snapshot view with the same config spec, and appropriate load rules, to use it as a source for your git import).
You need to make sure those baselines are:
full baselines (you can promote an incremental one to a full one)
referenced with their id (not their title, which is their visible name).
See also "Display Current Baseline with Cleartool":
cleartool describe -l baseline:aBaseline#\aPVob
cleartool descr -fmt "%[found_bls]CXp" stream:myStream#\myPVob
The second command would give you all baselines in a stream.
In both cases, you would see the baseline ids in addition of their names.
I have mention the ClearCase to Git migration aspect in :
"Migration from UCM ClearCase to GIT"
"How to integrate ClearCase development history into Git?"
"Save history from ClearCase to Git?"
"How to bridge git to ClearCase?"
"Sync GIT and ClearCase"
A good trick is to use:
git --git-dir=/path/to/git/repo/.git --work-tree=/path/to/ClearCase/view add .
That allows you to consider the ClearCase view as the working tree of your git repo (which is the destination of your import).
I generally don't try to import all baselines from all streams because it is too complex too soon (in order to get the sequence of those histories right).
I just get a few baselines from the main stream, import them and go from there (keeping the ClearCase referential as a read-only archive source for history research).

Moving elements in clearcase to be "merge" able

Ours is a typical implementation of clearcase UCM :
I have 2 UCM projects each of which represent a release for us. proj2 being created from a stable baseline from proj1
proj1 and proj2 work in parallel and sometimes same elements in both get changed simultaneously. So files a.java lies in both projects and is being worked upon by developers at both. A weekly merge activity happens where downstream gets the latest from upstream project and merges are reconciled.This is my easy life.
As a part of restructuring code, team with proj2 has started moving elements (files mostly) to other places. When I say other places this could mean within the component or to a different component VOB. This has never happened before.
The actual problem:
When an inter-project merge happens, the destination branch version of element a.java could have been moved to a different location/folder. How do I ensure clearcase still merges it with the version coming from upstream project. Is using the cleartool move command enough for clearcase to know and merge at the right place ? For inter-VOB movements, will cleartool relocate command do the same for me. I am in a tightly controlled environment else would have created a sandbox and tested it myself.
I am banking #VonC or #Tamir :)
When I say other places this could mean within the component or to a different component VOB
Note that with UCM, you cannot move elements to another component without re-creating completely said element (new history).
-For inter-vob component refactoring:
I would rather mirror the refactoring in proj1 (in a special Stream) and then attempt an inter-project merge from that stream, rather than hoping that a merge from an old directory structure to a new refactored directory structure goes well.
For outer-vob component refactoring (new history)
A manual merge is safer in that case.

Clearcase: Move a file from base VOB to a UCM VOB

How would I go about moving elements between base and a UCM VOB?
First: a base VOB can also be an UCM VOB (i.e. it can have non-UCM directories, and UCM component)
When I define a new component, I always do it in a special branch, in order to allow developers to go on and modifying version in their legacy non-UCM views, while reorganizing the directories and defining an UCM component:
Since the root directory of that UCM component is in a special branch, nobody sees anything until they define their own UCM view referencing that component.
The key factor you need to be aware of is that, once a UCM component is defined, you won't be able to move its elements outside said component:
you cannot move them within the same VOB as the one where you define your UCM component( I am speaking here of a component define within the VOB, not of a "VOB component" where the all VOB is a component!)
you cannot move them from the component to another VOB
One scenario I am aware of is the necessity too split an UCM component in two, relocating some of its code elsewhere (either in the same VOB or in another).
In that case, the only solution is to list the baseline of the source components, and clearfsimport the part you need to another directory elsewhere.
See the "clearfsimport to new stream" SO question for more on that clearfsimport process)
If you add some precisions about your current scenario, I will complete this answer with possible solutions.
Doesn't seem to be possible from Base To UCM..not in a clean way anyways

How can I export latest sources from ClearCase without creating any private areas or anything (like with svn export command)?

Is it possible?
Exporting sources from ClearCase?
The surest way is a snapshot view on a dedicated workstation: since a snapshot view has its storage (the equivalent of the .svn directories) outside the said view, that means the resulting directory is clean.
Then you can take this tree, compress it and transfer it whenever you want, (like a workstation without any VCS)
Use a snapshot view. Update the config spec in such a way that it selects the latest version of all elements from the main branch.
Copy the folder recursively to another folder say c:\svntemp
Import the contents in c:\svntemp\ in to SVN.
For each branch that you have you need to follow this procedure

Resources