Avatar of gram77
gram77
Flag for India asked on

copy contents of one branch into another branch in unix clearcase

I have created 2 new branch types

ct mkbrtype dev_branch1

and

ct mkbrtype dev_branch2

I have checkedin code into dev_branch1
 
How do i copy contents of dev_branch1 into dev_branch2, including all versions of files, everything
Version Control

Avatar of undefined
Last Comment
gram77

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
DavidCol

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
gram77

ASKER
We checkin code into mydev_branch1 and merge it to mydev_branch2

However, i want to work in a dummy branch type mydev_branch3 and merge it to dummy dev branch type mydev_branch4

when i have finished working on mydev_branch3 i want to copy checkedin code into mydev_branch1
and merge mydev_branch1 into mydev_branch2. This way i won't have many versions created of a file.

basically copy contents of mydev_branch1 into mydev_branch3

mydev_branch1 and mydev_branch3 are not related.
DavidCol

This really seems like a strange way to work..! I don't understand why you want to limit the number of versions. Why are you not delivering / merging the contents of you development stream onto an integration stream / release branch.

When you say
mydev_branch1 and mydev_branch3 are not related
does that mean that they are in different VOBs.

clearfsimport wouild be one way to update mydev_branch3 with the contents of mydev_branch1.

David.
gram77

ASKER
does that mean that they are in different VOBs.>> no they are under same VOB.

also please provide example of using clearfsimport. will it copy all elements from elementtype into another elementtype?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
DavidCol

If the two branches are in the same vob and have a common ancestor then the best way to do this is with merge and findmerge I think.

To update the contents of folder A with the contents of folder B using clearfsimport the commands would be something like:

cd <root folder of destination>
clearfsimport -rec -rmname <list of files and folders in source folder> .

Open in new window


You may need to look at the man page for clearfsimport to be sure that I've gotten the syntax correct. A graphical representation of your streaming diagram may help.

Obviously try all this out in a test VOB first and make sure you have backups etc...

David.
gram77

ASKER
Here is an excellent material on Clearfsimport.

seems this is a very powerfull tool!

A lot of folks use rational Clear Case LT explorer on Windows to checkin and checkout files. A few who hate to transfer files around will install their Clear Case client on Unix and work with
"cleartool checkout"
"cleartool checkin"
you can take it to the next step. A huge working directory , you ve worked on several scripts - to checkout and check in each one of them can be cumbersome.

"Clearfsimport" is a powerful utility - you can simply do a Recursive Filesystem compare between your VOB and your working directory--->all the rest is taken care of. ClearfsImport will determine what files are newelements(add them to src control), what has changed and update the changed files without the need to checkout and checkin files.
Works great----especially if you work on a lot of code , you don't want to spend an entire day figuring out what to checkin and checkout.

syntax for clearfsimport:
cd to your VOB dir(note you should be in your VOB dir while running clearfsimport)
clearfsimport -preview -recurse -follow -nsetevent your_working_dir .
(the above command will give you a preview of what is going to happen)

clearfsimport -recurse -follow -nsetevent your_working_dir .
will get your VOB in sync with your working dir.
gram77

ASKER
Celarfsimport as described above does not do a vob element to vob element transfer, it updates the vob with contents of your working directory.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
gram77

ASKER
I would rather go with the clearfsimport script, better equipped to import multiple times the same set of files, and automatically:

add new files,
make new version of existing files previously imported (but modified in the source set of files re-imported)
remove files already imported but no longer present in the source set of files.
make a clear log of all operations made during the import process.

So if your 'zip-file delivery needs to be updated on a regularly basis, clearfsimport is the way to go, but with the following options:

clearfsimport -preview -rec -nset c:\sourceDir\* m:\MyView\MyVob\MyDestinationDirectory
gram77

ASKER
The clearfsimport command reads the specified file system source objects and places them in the target VOB. This command uses magic files to determine which element type to use for each element created (see the cc.magic reference page). The source and target directories may not be the same; to create an element from a view-private object that already resides in the target directory, use mkelem.
Examples:
1.Preview a VOB—/vobs/projectx/src—that is to be populated with the contents of /usr/src/projectx. Recursively descend all directories encountered and follow UNIX or Linux symbolic links to the target objects.
clearfsimport –preview –follow –recurse /usr/src/projectx
/vobs/projectx/src
2.Convert a .txt file to an element and place it in the VOB lli_vob1.
D:\lli_work>clearfsimport Reqpro_setup.txt M:\lli_nt_view\lli_vob1
Validating directory "M:\lli_nt_view\lli_vob1".
Creating element "M:\lli_nt_view\lli_vob1\Reqpro_setup.txt".
version "\main\1".
Closing directories.
Checked in version "main\1" of directory "M:\lli_nt_view\lli_vob1"
gram77

ASKER
well, you made me stumble on a very useful utility, but this does not transfer vob-to-vob, but file system to vob
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck