Thursday, January 24, 2008

what has changed for a rebase?

Some new developers came to ask the question: "I did a rebase. But I could not see any rebase activities. Did the rebase successful? If so, what's changed after the rebase?"

These are valid questions. In fact, they are very good questions. Normally after a rebase, you will notice that there is a new activity with a title like "rebase ...". These activities contain the change set for the rebase operation. However, sometimes, the rebase operation does not generate the "rebase..." activity. That's when people come up with the questions.

A rebase operation changes the foundation baseline of the stream from the previous recommend baseline of the parent stream to the current one. If you do not change any file in the delta of the two baselines, i.e, you do not touch the same files as the recommended baseline, you will not get a rebase activity. However, your view will reflect the new version of the elements. When you check out the files in the future, they will be branched out from the new versions. If you have changed the files in the delta, ClearCase will do the merge for you, and you will see the rebase activity. From the version tree, a merge arrow will be drawn from the recommended version to your version.

Wednesday, January 23, 2008

Dynamic View == Always up-to-date?

You may think that a dynamic view of a stream will always reflect the LATEST version of elements in the stream. Well, you may be wrong.

If you find out that you are still looking at an older version in a view, while there are newer versions of the element in the stream, don't be surprise. This can happen. One possible reason is that the stream has more than one views. When you use one of the views to rebase the stream from its parent stream, the config spec (yes, a UCM view still has a config spec) has changed, while the other views still refer to the old foundation baseline.

....
element "[39730511c62311d9847000018376dd1b=\MidTier]/..." CBFE14.5_2008_01_14 -mkbranch CBFE14.5_LinkRemoval
....

To synchronize the view with the stream, you can click the "synchronize with stream" button in the view property page, or run "cleartool setcs -stream" in command line.

Wednesday, January 16, 2008

The ClearCase Eraser -- Versions Recorded in UCM Baseline

ClearCase UCM brings in more dependencies for the elements and ClearCase objects. It becomes harder to remove anything from ClearCase. Here in this blog shows how to remove a version that is "recorded in UCM baseline".

Before deleting the activity, we have to remove all the versions in the activity, -- if we do not want to move the versions to another activity.

$ cleartool lsact -l rebase.CBFE14.5_base.20071204.174114@/vobs/CBFEProjects
activity "rebase.CBFE14.5_base.20071204.174114"
04-Dec-07.17:39:26 by Qin (qinl.cbfedev@CBAD4-XCIDH3)
"Integration activity created by rebase on 12/4/2007 5:41:14 PM.
"
owner: qinl
group: cbfedev
stream: CBFE14.5_base.old@/vobs/CBFEProjects
title: rebase CBFE14.5_base on 12/4/2007 5:41:14 PM.
change set versions:
/vobs/MidTier/BaseUtil/src/com/cibc/evo/logging/CbfeDefaultLogger.java@@/main/Mainline_i/CBFE14.5_base/2
/vobs/MidTier/BaseUtil/src/.classpath@@/main/Mainline_i/CBFE14.5_i/CBFE14.5_base/2
/vobs/MidTier/BaseUtil/src/.project@@/main/Mainline_i/CBFE14.5_i/CBFE14.5_base/2

$ cleartool rmver -xbranch -xlabel -xattr -xhlink /vobs/MidTier/BaseUtil/src/com/cibc/evo/logging/CbfeDefaultLogger.java@@/main/Mainline_i/CBFE14.5_base/2
cleartool: Error: Cannot remove versions which are recorded in UCM baseline.
cleartool: Error: No versions of "/vobs/MidTier/BaseUtil/src/com/cibc/evo/logging/CbfeDefaultLogger.java" to remove.


$ cleartool lsbl -stream CBFE14.5_base.old@/vobs/CBFEProjects
04-Dec-07.13:23:05 CBFE14.5_2007_12_4.8538 HZ18 "CBFE14.5_2007_12_4"
stream: CBFE14.5_base.old@/vobs/CBFEProjects
component: MidTier@/vobs/CBFEProjects

$ cleartool rmbl CBFE14.5_2007_12_4.8538@/vobs/CBFEProjects
Remove baseline "CBFE14.5_2007_12_4.8538@/vobs/CBFEProjects"? [no] y
cleartool: Error: Cannot remove baseline that has been delivered.
cleartool: Error: Unable to remove baseline "CBFE14.5_2007_12_4.8538@/vobs/CBFEProjects".


$ cleartool desc -l baseline:CBFE14.5_2007_12_4.8538@/vobs/CBFEProjects
baseline "CBFE14.5_2007_12_4.8538"
created 04-Dec-07.13:23:05 by Zhao (HZ18.cbfedev@CBAD3-XCIDVQ)
"DOMDAM_base_class@\CBFEProjects"
owner: hz18
group: cbfedev
component: MidTier@/vobs/CBFEProjects
label status: Incrementally Labeled
change sets:
deliver.CBFE14.5_base_hz18.20071204.132426@/vobs/CBFEProjects
promotion level: INITIAL
depends on:
Attributes:
PromotionLevel = "INITIAL"
Hyperlinks:
BaselineLbtype@13505@/vobs/CBFEProjects -> lbtype:CBFE14.5_2007_12_4.8538@/vobs/MidTier
Integrate@13511@/vobs/CBFEProjects -> anyactivity:timeline071202.075859@/vobs/CBFEProjects

$ cleartool rmhlink Integrate@13511@/vobs/CBFEProjects
cleartool: Warning: Hyperlinks of type "hltype:Integrate@/vobs/CBFEProjects" are used to implement UCM and should not be directly manipulated unless directed by customer support.
cleartool: Warning: Hyperlinks of type "hltype:Integrate@/vobs/CBFEProjects" are used to implement UCM and should not be directly manipulated unless directed by customer support.
Removed hyperlink "Integrate@13511@/vobs/CBFEProjects".


$ cleartool rmbl CBFE14.5_2007_12_4.8538@/vobs/CBFEProjects
Remove baseline "CBFE14.5_2007_12_4.8538@/vobs/CBFEProjects"? [no] y
cleartool: Warning: Searching PVOBs for baselines that depend upon baseline "CBFE14.5_2007_12_4.8538". This may take a few minutes...

Removed baseline "CBFE14.5_2007_12_4.8538@/vobs/CBFEProjects".

$ cleartool rmver -xbranch -xlabel -xattr -xhlink /vobs/MidTier/BaseUtil/src/com/cibc/evo/logging/CbfeDefaultLogger.java@@/main/Mainline_i/CBFE14.5_base/2
Removing these versions of "/vobs/MidTier/BaseUtil/src/com/cibc/evo/logging/CbfeDefaultLogger.java":
/main/Mainline_i/CBFE14.5_base/2 (has: hyperlinks)
Remove versions? [no] y
Removed versions of "/vobs/MidTier/BaseUtil/src/com/cibc/evo/logging/CbfeDefaultLogger.java".

$ cleartool rmact rebase.CBFE14.5_base.20071204.174114@/vobs/CBFEProjects
Remove activity "activity:rebase.CBFE14.5_base.20071204.174114@/vobs/CBFEProjects"? [no] y
Removed activity "rebase.CBFE14.5_base.20071204.174114@/vobs/CBFEProjects".

Monday, January 14, 2008

The ClearCase Eraser -- Delivered Baseline

Needless to say that, to remove a stream from ClearCase, the stream must be "clean", no views, no activities, no baselines, etc. In my previous blog, I have demonstrated how to remove an activity that has change set. Today, I am going to show you how to remove a baseline that has been delivered.

Try to remove a stream with baseline on it. Got errors.
$ cleartool rmstream CBFE14.5_base_hz18@/vobs/CBFEProjects
Remove stream "CBFE14.5_base_hz18@/vobs/CBFEProjects"? [no] y
cleartool: Error: Cannot remove stream that has baselines.
cleartool: Error: Unable to remove stream "CBFE14.5_base_hz18@/vobs/CBFEProjects".

Check which baselines are on the stream.
$ cleartool lsbl -stream CBFE14.5_base_hz18@/vobs/CBFEProjects
2007-12-04T13:22:38-05 deliverbl.CBFE14.5_base_hz18.20071204.132426 HZ18 "deliverbl.CBFE14.5_base_hz18.20071204.132426"
stream: CBFE14.5_base_hz18@/vobs/CBFEProjects
component: MidTier@/vobs/CBFEProjects

Try to remove the baseline. Got errors.
$ cleartool rmbl deliverbl.CBFE14.5_base_hz18.20071204.132426@/vobs/CBFEProjects
Remove baseline "deliverbl.CBFE14.5_base_hz18.20071204.132426@/vobs/CBFEProjects"? [no] y
cleartool: Error: Cannot remove baseline that has been delivered.
cleartool: Error: Unable to remove baseline "deliverbl.CBFE14.5_base_hz18.20071204.132426@/vobs/CBFEProjects".

$ cleartool desc -l baseline:deliverbl.CBFE14.5_base_hz18.20071204.132426@/vobs/CBFEProjects
baseline "deliverbl.CBFE14.5_base_hz18.20071204.132426"
created 2007-12-04T13:22:38-05 by Zhao (HZ18.cbfedev@CBAD3-XCIDVQ)
"Baseline created by deliver on 12/4/2007 1:24:26 PM.
"
owner: hz18
group: cbfedev
stream: CBFE14.5_base_hz18@/vobs/CBFEProjects
component: MidTier@/vobs/CBFEProjects
label status: Not Labeled
change sets:
promotion level: INITIAL
depends on:
Attributes:
PromotionLevel = "INITIAL"
Hyperlinks:
Integrate@13500@/vobs/CBFEProjects -> anyactivity:timeline071204.132453@/vobs/CBFEProjects


The hyperlink looks suspecious.
$ cleartool rmhlink Integrate@13500@/vobs/CBFEProjects
cleartool: Warning: Hyperlinks of type "hltype:Integrate@/vobs/CBFEProjects" are used to implement UCM and should not be directly manipulated unless directed by customer support.
cleartool: Warning: Hyperlinks of type "hltype:Integrate@/vobs/CBFEProjects" are used to implement UCM and should not be directly manipulated unless directed by customer support.
Removed hyperlink "Integrate@13500@/vobs/CBFEProjects".


Oops, there is a warning message. However when you see the warning, it is already too late. The hyperlink removed. Now you can try to remove the baseline.
$ cleartool rmbl deliverbl.CBFE14.5_base_hz18.20071204.132426@/vobs/CBFEProjects
Remove baseline "deliverbl.CBFE14.5_base_hz18.20071204.132426@/vobs/CBFEProjects"? [no] y
cleartool: Warning: Searching PVOBs for baselines that depend upon baseline "deliverbl.CBFE14.5_base_hz18.20071204.132426". This may take a few minutes...

Removed baseline "deliverbl.CBFE14.5_base_hz18.20071204.132426@/vobs/CBFEProjects".


Now the stream is "clean" to be removed.
$ cleartool rmstream CBFE14.5_base_hz18@/vobs/CBFEProjects
Remove stream "CBFE14.5_base_hz18@/vobs/CBFEProjects"? [no] y
Removed stream "CBFE14.5_base_hz18@/vobs/CBFEProjects".

Wednesday, January 9, 2008

How to run mktrigger in post_mkstream trigger

As we know that mktrigger must be fired in a view context. However, sometimes we need to run mktrigger even though there is no view yet. For example, in my post_mkstream trigger, I want to attach a no_mkactivity trigger to the newly created stream.

cleartool mktrtype -ucm -postop mkstream -nc -execu "cleartool mktrigger no_mkactivity stream:\$CLEARCASE_STREAM" -execw "cleartool mktrigger no_mkactivity stream:%CLEARCASE_STREAM%" post_mkstream

However, when a developer joins the project to create his development stream my_dev_str, the post_mkstream trigger reports "unable to determine view for my_dev_str: no such file or direcotry". That's because he does not have any view yet. Even if he has a view, the view may not be started, or the current directory may not be under the view root.


Workaround.
Create a view that is available to everyone. Set to the view before call mktrigger in post_mkstream trigger.

cleartool mktrtype -ucm -postop mkstream -nc -execw "ccperl \\\\scm\\admin\\post_mkstream.pl" -execu "/ccstore/admin/post_mkstream_unix.pl" post_mkstream


A simplified version of the post_mkstream.pl script.

#!/usr/bin/perl

$stream = $ENV{"CLEARCASE_STREAM"};

$rst = `cleartool mount \\CBFEProjects`;
$rst = `cleartool startview ccadmin_view`;
chdir "m:\\ccadmin_view\\CBFEProjects";
$rst = `cleartool mktrigger no_mkactivity@\\CBFEProjects stream:$stream`;
$rst = `cleartool endview ccadmin_view`;
exit 0;


Tuesday, January 8, 2008

The ClearCase Eraser -- Activity

In ClearCase, it is not recommended to delete anything from the source control. And UCM makes it extremely hard to remove an UCM object once it is been modified.

The following steps guide you through to remove an activity with change set.

First get the list of versions in the change set.
$ cleartool lsact -l DOMDAM_base_class
activity "DOMDAM_base_class"
04-Dec-07.11:00:59 by Cheung (dc81.Domain Users@CBAD1-XCILPE)
owner: hz18
group: unknown
stream: CBFE14.5_base_hz18@/vobs/CBFEProjects
title: CBFE14.5: DOMDAM base class
change set versions:
/vobs/MidTier/Srv/src/com/cccc/evo/dom@@/main/Mainline_i/CBFE14.5_base_hz18/2
/vobs/MidTier/Srv/src/com/cccc/evo/dom@@/main/Mainline_i/CBFE14.5_base_hz18/2/AbstractQuery.java/main/CBFE14.5_base_hz18/1
/vobs/MidTier/Srv/src/com/cccc/evo/dom@@/main/Mainline_i/CBFE14.5_base_hz18/1
/vobs/MidTier/Srv/src/com/cccc/evo/dom@@/main/Mainline_i/CBFE14.5_base_hz18/1/Query.java/main/CBFE14.5_base_hz18/1
/vobs/MidTier/Srv/src/com/cccc/evo/dal/cache/CacheManagerImpl.java@@/main/CBFE14.5_base_hz18/2
/vobs/MidTier/Srv/src/com/cccc/evo/dal/cache/CacheManagerImpl.java@@/main/CBFE14.5_base_hz18/1
/vobs/CBFE-lib/non-cccc@@/main/Mainline_i/CBFE14.5_base_hz18/1/xmlbeans-2.2.0/main/CBFE14.5_base_hz18/1
/vobs/CBFE-lib/non-cccc@@/main/Mainline_i/CBFE14.5_base_hz18/1

For each version in the change set, do the following command with the options to remove it with its reference.
$ cleartool rmver -xbranch -xlabel -xattr -xhlink /vobs/MidTier/BaseUtil/src/.project@@/main/Mainline_i/CBFE14.5_i/CBFE14.5_base_hz18/1

During the rever operation, some elements may be moved t lost+found if it is no longer being referenced.
cleartool: Warning: Object "xmlbeans-2.2.0" no longer referenced.
cleartool: Warning: Moving object to vob lost+found directory as "xmlbeans-2.2.0.e650a507ad794c789fed652fcf875fcb".

After all the version removed, run lsact again. There may be new items listed in the change set.
$ cleartool lsact -l DOMDAM_base_class
activity "DOMDAM_base_class"
04-Dec-07.11:00:59 by Cheung (dc81.Domain Users@CBAD1-XCILPE)
owner: hz18
group: unknown
stream: CBFE14.5_base_hz18@/vobs/CBFEProjects
title: CBFE14.5: DOMDAM base class
change set versions:
/vobs/CBFE-lib/lost+found/xmlbeans-2.2.0.e650a507ad794c789fed652fcf875fcb@@/main/CBFE14.5_base_hz18/1

repeat the rmver and lsact until the change set is empty.

The activity can be removed now.
$ cleartool rmact -force "DOMDAM_base_class"
Removed activity "DOMDAM_base_class".

Friday, January 4, 2008

Follow up: new version, still blue screen

Our Trend version upgraded to 8.550.1001. And most of developers upgraded ClearCase client to 7.0.0.1.

No reported issue yet. Just mark the url for reference.
http://www-1.ibm.com/support/docview.wss?rs=984&context=SSSH27&dc=DB520&dc=DB560&uid=swg21289223&loc=en_US&cs=UTF-8&lang=en&rss=ct984rational

Trend® Micro Scan Engine 8.550.1001
ClearCase version:

7.0, 7.0.0.1, 7.0.1, 2003.06.00, 2003.06.01, 2003.06.10, 2003.06.12, 2003.06.13, 2003.06.14, 2003.06.15, 2003.06.16

To resolve the issue:

1. Change the following registry key by adding the new value below:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TmPreFilter\Parameters
DWORD: DevObjStackCheck
Value: 1


2. Restart the machine.

RE:
http://doublepaddle.blogspot.com/2007/07/clearcase-check-out-from-dyn-view-leds.html

Follow up: "Permission denied" during merge

Surprisingly soon, I encountered the same situation when delivery between two streams. Same condition, same error message. I canceled the delivery and tried another approach.

This time, instead of merging the Srv directory using ccadmin account on UNIX, I renamed the src.jtest folder to src.ctest foler first before I started the merge again. Everything worked fine, no complain about the permision, no error message. The only window popped up was to manually merge the Srv directory.I think this is a bug of ClearCase when merging a directory with renamed elements.


Wednesday, January 2, 2008

"Permission denied" during merge

M:\qinl_CBFE14.2_i\MidTier>cleartool merge -to Srv -version \main\CBFE14.0_i\1 \main\CBFE14.2_i\LATEST
********************************
<<<>>> directory 2: M:\qinl_CBFE14.2_i\MidTier\Srv@@\main\CBFE14.0_i\1
>>> directory 3: M:\qinl_CBFE14.2_i\MidTier\Srv@@\main\CBFE14.2_i\0
>>> directory 4: Srv
********************************
-----------[ directory 1 ]-------------|---------[ added directory 2 ]---------
-| runEMMAServer\ --09-06T15:53 vs217
*** Automatic: Applying ADDITION from directory 2
-------[ renamed directory 1 ]---------|-------[ renamed to directory 2 ]------
src.jtest\ 2006-06-12 yw17 | src.ctest\ 2006-06-12 yw17
merge: Error: An unexpected error has occurred.
merge: Error: Unable to remove "c:\li\tmp\tmp15600": Permission denied.

When delivering, the GUI showed "unexpected error" and prevented the delivery from proceed. Try it command line, the error message provided more information, but not much meaningful. All the involved elements are belonging to the same group as the user IDs, which have 777 access to them.

The error message is reproducable using different user IDs (thus different views) and machines. But using the ccadmin account in a UNIX box, the merge can proceed.

Examining the Srv directory more closely, I found out that, in the source, the src.jtest folder was renamed to src.jtest folder, and a new src.jtest folder was added as a new element; while in the target, the src.jtest folder has not been renamed yet. I believe it is the evil twin that caused the issue.

May be I should try to rename the src.jtest to src.ctest in the target manually before the merge. However, I have worked around the issue using the ccadmin id. Maybe next time.