您的位置:首页 > 移动开发 > Objective-C

How to copy all view private files and Derived objects between views

2008-06-24 17:01 656 查看
Problem

When creating new views in an IBM Rational ClearCase environment, it is sometimes desirable to copy another view's configuration, including view-private files. This technote illustrates a procedure to accomplish this in both a Microsoft Windows® and a UNIX or Linux environment.

Solution

In order to move view-private files from one view to another, the following types of files must be moved or copied:

Derived Objects (Dynamic views only)

View-private copies of checked-out elements "Other"

view private files

Derived Objects

The best method to move Derived Objects from one dynamic view to another is to promote the DO's from the old view to the VOB and then wink the DO into the new view.

The process is as follows:

1. Start and or set to the old view

Note: Ensure all VOBs referenced by this view are mounted; otherwise, you will receive VOB not Mounted... errors during steps 2 and 3 below.

2. Run the following command to create a list of all DO's in this view for later use. This list is relative to the root of the view, taking the rest of this procedure possible with a minimum of editing required.

Windows:

cleartool lsprivate -do > c:/dolist.txt

UNIX/Linux:

cleartool lsprivate -do > ~/dolist.txt

3. Run cleartool lsprivate -do | view_scrubber -p

This promotes ALL DOs to the VOB.

Another method to use involves winking the files into the new view.

Note: This is strictly optional since any wink-ins needed will be accomplished during the next clearmake or omake build.

1. Start and or set to the old view

2. Run the following command to wink in all DOs created in the initial view:

Windows:

for /F "delims==" %x in (C:/dolist.txt) do cleartool winkin "%x"

UNIX/Linux:

cat ~dolist.txt | xargs -i cleartool winkin {}

VIEW-PRIVATE FILES

There are 2 remaining types of view private files. View-private copies of checked-out files and "other" view private files.

The best means to save the checked-out files is to check those files back in. This is by far the best way to save work in progress.

If, on the other hand, you are working in a shared branch or UCM stream, and checking could impact your colleague's work, run the following commands to undo all checkouts, keeping the checked-out files as view private files with .keep extensions.

Note: Only view private files in directories selected by the config spec will be copied.

1. CD into the old view.

2. CD into each VOB and run this command:

Windows:

for /F %x in ('cleartool lsco -all -cview') do cleartool unco -keep "%x"

UNIX/Linux:

cleartool lsco -all -cview | xargs -i cleartool unco -keep {}

Saving other view private files can be done any number of ways. You can either copy them manually, or use a third-party archive utility to move the files.

On Windows, the process for saving other view private files without using third party tools is:

1. Ensure that a drive is mapped to both the old and new views.

2. CD or set into the old view.

3. Run the following command to list all remaining view private objects:

for /D %x in (*.*) do cleartool ls -view_only -recurse %x >>C:/rest.txt

One option to avoid ".contrib" files created by merge operations (including UCM delivers and merges) is to filter the output in as illustrated below:

cleartool ls -view_only -recurse| find /V ".contrib >> C:/Otherlist.txt"

This will filter out all files that contain the string ".contrib" in their names, potentially narrowing the list of files to review considerably.

4. Edit the file list to include only files you wish to copy, save it as "Filteredlist.txt".

5. Run this command to copy the desired files from the old view to the new one (If X: is the old view and Y: is the new one):

for /F "delims==" %a in (C:/FilteredList.txt) do copy "X:%a" "Y:%a"

On Windows, this operation can be dramatically simplified through the use of third-party archive tools.

For example, the same procedure using the Info-Zip third party toolkit can be done as follows: 1. CD into the old view.

2.Run the following command:

for /D %x in (*.*) do cleartool ls -view_only -recurse %x | zip -m -@ c:/tempzip.zip

3. CD into the new view

4. Run the following command:

unzip c:/tempzip.zip

On UNIX,, archiving all the view-private files in a view can be condensed to a single command line.

That command line is:

tar cvf ~/myfiles.tar `cd /vobs;ls -1|xargs -i cleartool ls -view_only -recurse {}`

To reverse this process in UNIX , set into the new view and run the below command line:

cd /vobs; tar xvf ~/myfiles.tar
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: