It's all about the answers!

Ask a question

RTC Workspace replace-components works inconsistently


Eliyah Smith (11) | asked Jun 10 '10, 1:11 p.m.
I am encountering problems using the scm workspace replace-component command, it runs but doesn't always replace the components in target workspace or stream with the latest changes from the parent stream.

Since RTC produces no logs when the replace-component command is run, and it doesn't even tell you whether it failed or succeeded on any given component (only lists components it finds that don't originate from the target stream you're updating from), I really have no way of knowing why this occurs, nor can I reproduce it. Sometimes it works fine, other times there are changes that are over 4 - 24 hours old that don't get updated in the target stream.

Does anyone have any experience using the scm workspace replace-component command and getting it to consistently update all components? Also if there was a way to get logging out of the command that would help to identity when it fails to properly update components, that would also help.

Thanks,
Eliyah

9 answers



permanent link
Shashikant Padur (4.3k27) | answered Jun 15 '10, 5:19 a.m.
JAZZ DEVELOPER
I haven't encountered this problem but then I haven't used this command often either.

Usually when the command succeeds without any exception/error it implies that the operation has completed successfully. If it helps, we could list the components that were replaced successfully using a verbose (-v) option. Please open a new workitem.

I am encountering problems using the scm workspace replace-component command, it runs but doesn't always replace the components in target workspace or stream with the latest changes from the parent stream.

Since RTC produces no logs when the replace-component command is run, and it doesn't even tell you whether it failed or succeeded on any given component (only lists components it finds that don't originate from the target stream you're updating from), I really have no way of knowing why this occurs, nor can I reproduce it. Sometimes it works fine, other times there are changes that are over 4 - 24 hours old that don't get updated in the target stream.

Does anyone have any experience using the scm workspace replace-component command and getting it to consistently update all components? Also if there was a way to get logging out of the command that would help to identity when it fails to properly update components, that would also help.

Thanks,
Eliyah

permanent link
Rahul Pawar (7121) | answered Oct 07 '10, 3:07 a.m.
Hi

The replace-components is probably not meant for replacing the workspace code with the latest in a Stream. This is how we do things:

To replace your repository workspace with the latest code available in the stream, use the following:

scm login -r https://JazzHost:9443/jazz/ -u myUser -P myPass -n myRepository

scm accept -r myRepository -s "mySourceStream" -t "myTargetRepositoryWorkspace"


To replace your repository workspace with a BASELINE available in the source stream, use the following:

scm login -r https://JazzHost:9443/jazz/ -u myUser -P myPass -n myRepository

scm workspace replace-components --all --overwrite-uncommitted --baseline "myBaseline1" "myTargetRepositoryWorkspace" stream "mySourceStream" -r myRepository


To load your repository workspace updated above on your local machine, use the following:

scm load -r myRepository "myTargetRepositoryWorkspace" -d C:\Temp\Path_1 --force


To logout,use
scm logout -r myRepository


Hope this helps!
Thanks
Rahul

permanent link
Narayanan Potti (27037679) | answered Oct 19 '10, 11:20 a.m.
Hi

Details on my RTC environment:

Jazz Team Server 1.0.0.2 iFix 2 (I20100331-2220)
Rational Team Concert - 2.0.0.2 iFix 2 (I20100331-2220)

I created a build stream and the build workspace that flows from it. Build stream has 5 components which have been added from their parent streams. I need to get the latest code delvered to the components in their parent streams. I opened the stream, used "Replace With" button, selected "Component in another repository workspace or stream" and selected the parent stream. I noticed it doesn't always replace the components in the build stream with the latest changes from the parent stream. The builds fail when the workspace doesn't get the latest delivered code on alll the components.

It works fine with certain components, for other components there are changes delivered 2 days back that don't get updated in the build stream.

Is this a known problem ? Any help would be greatly appreciated.

Thank You
NP
Hi

The replace-components is probably not meant for replacing the workspace code with the latest in a Stream. This is how we do things:

To replace your repository workspace with the latest code available in the stream, use the following:

scm login -r https://JazzHost:9443/jazz/ -u myUser -P myPass -n myRepository

scm accept -r myRepository -s "mySourceStream" -t "myTargetRepositoryWorkspace"


To replace your repository workspace with a BASELINE available in the source stream, use the following:

scm login -r https://JazzHost:9443/jazz/ -u myUser -P myPass -n myRepository

scm workspace replace-components --all --overwrite-uncommitted --baseline "myBaseline1" "myTargetRepositoryWorkspace" stream "mySourceStream" -r myRepository


To load your repository workspace updated above on your local machine, use the following:

scm load -r myRepository "myTargetRepositoryWorkspace" -d C:\Temp\Path_1 --force


To logout,use
scm logout -r myRepository


Hope this helps!
Thanks
Rahul

permanent link
Narayanan Potti (27037679) | answered Oct 21 '10, 3:45 p.m.
Hi

The problem I am having is not that Replace With for the components in build stream is not working. The problem is I have do Replace With each time I execute a build. If it's done manually it won't work for automated builds. Do I need to plug in scm commands in the ANT script for replacing the components ? If so can someone please give the actual scm commands I need to use ?

Any help is greatly appreciated.

Thank You
NP


Hi

Details on my RTC environment:

Jazz Team Server 1.0.0.2 iFix 2 (I20100331-2220)
Rational Team Concert - 2.0.0.2 iFix 2 (I20100331-2220)

I created a build stream and the build workspace that flows from it. Build stream has 5 components which have been added from their parent streams. I need to get the latest code delvered to the components in their parent streams. I opened the stream, used "Replace With" button, selected "Component in another repository workspace or stream" and selected the parent stream. I noticed it doesn't always replace the components in the build stream with the latest changes from the parent stream. The builds fail when the workspace doesn't get the latest delivered code on alll the components.

It works fine with certain components, for other components there are changes delivered 2 days back that don't get updated in the build stream.

Is this a known problem ? Any help would be greatly appreciated.

Thank You
NP
Hi

The replace-components is probably not meant for replacing the workspace code with the latest in a Stream. This is how we do things:

To replace your repository workspace with the latest code available in the stream, use the following:

scm login -r https://JazzHost:9443/jazz/ -u myUser -P myPass -n myRepository

scm accept -r myRepository -s "mySourceStream" -t "myTargetRepositoryWorkspace"


To replace your repository workspace with a BASELINE available in the source stream, use the following:

scm login -r https://JazzHost:9443/jazz/ -u myUser -P myPass -n myRepository

scm workspace replace-components --all --overwrite-uncommitted --baseline "myBaseline1" "myTargetRepositoryWorkspace" stream "mySourceStream" -r myRepository


To load your repository workspace updated above on your local machine, use the following:

scm load -r myRepository "myTargetRepositoryWorkspace" -d C:\Temp\Path_1 --force


To logout,use
scm logout -r myRepository


Hope this helps!
Thanks
Rahul

permanent link
Rahul Pawar (7121) | answered Oct 22 '10, 8:46 a.m.
Hi Narayan

Well, I cant say that I understood the problem completely, but let me try to help a little. Replace component will need to be done each time you make a build. As an example, let me explain my scenario.
I have a Stream (ST), my repository workspace (RW) and my local workspace on laptop (LW)

1. Development lead creates Baseline on his RW and then deliver it to ST.
2. During build the Build Coordinator takes this Baseline name and repalces the 'build' RW with the Baseline.
3. The 'replaced' RW is then loaded onto the LW.

All of these commands have been automated in an ANT script using the <exec> task. For example,


<!-- Target to get the latest code from repository -->
<target name="fetchworkspace" description="Target to get the latest code from repository">
<echo message="Target to get the latest code from repository..." />
<echo/>
<echo message="********** rtc.url = ${rtc.url}" />
<echo message="********** rtc.user = ${rtc.user}" />
<echo message="********** rtc.workspace = ${rtc.workspace}" />
<echo message="********** rtc.stream = ${rtc.stream}" />
<echo message="********** rtc.scm.dir = ${rtc.scm.dir}" />
<echo/>


<if>
<or>
<not><isset property="rtcpassword" /></not>
<equals arg1="${rtcpassword}" arg2="" />
</or>
<then>
<echo message="The program cannot run without entering the RTC password!"/>
<fail message="The program cannot run without entering the RTC password!"/>
</then>
</if>


<echo message="Trying to Login to Repository. Please wait..." />
<echo/>
<exec executable="${rtc.scm.dir}/scm.exe" outputproperty="rtc.login.result">
<arg value="--non-interactive"/>
<arg line="login" />
<arg line="-r ${rtc.url}" />
<arg line="-u ${rtc.user}" />
<arg line="-P '${rtcpassword}'" />
<arg line="-n "${rtc.nickname}"" />
</exec>
<echo message="rtc.login.result = ${rtc.login.result}"/>

<if>
<contains string="${rtc.login.result}" substring="Could not log in" casesensitive="false"/>
<then>
<echo message="================================================================="/>
<echo message="${rtc.login.result}"/>
<echo message="================================================================="/>
<fail message="${rtc.login.result}"/>
</then>
</if>



<if>
<and>
<isset property="rtc.baseline" />
<not><equals arg1="${rtc.baseline}" arg2="" /></not>
</and>
<then>
<echo/><echo message="Trying to fetch BASELINE by the name, ${rtc.baseline}" /><echo/>
<exec executable="${rtc.scm.dir}/scm.exe" outputproperty="rtc.exec.result">
<arg value="--non-interactive"/>
<arg line="workspace replace-components --all --overwrite-uncommitted" />
<arg line="--baseline "${rtc.baseline}" "${rtc.workspace}"" />
<arg line="stream "${rtc.stream}"" />
<arg line="-r '${rtc.nickname}'" />
</exec>

<echo message="rtc.exec.result = ${rtc.exec.result}"/>

<if>
<contains string="${rtc.exec.result}" substring="could not be resolved" casesensitive="false"/>
<then>
<var name="errormsg" value="THE BASELINE "${rtc.baseline}" WAS NOT FOUND IN RTC !!!" />
<echo message="================================================================="/>
<echo message="${errormsg}"/>
<echo message="================================================================="/>
<antcall target="rtclogout" />
<fail message="${errormsg}"/>
</then>
<else>
<echo message="Repository Workspace REPLACED with Baseline "${rtc.baseline}"..." /><echo/>
</else>
</if>

</then>
<else>
<!-- Fetch the latest changes in the stream into the repository workspace -->
<echo/>
<echo message="ACCEPTing the Pending changes in Repository workspace. Please wait..." /><echo/>
<exec executable="${rtc.scm.dir}/scm.exe">
<arg value="--non-interactive"/>
<arg line="accept" />
<arg line="-r ${rtc.nickname}" />
<arg line="-t "${rtc.workspace}"" />
</exec>
<echo message="Pending changes (if any) have been successfully accepted..." /><echo/>
</else>
</if>


<echo message="Now LOADing the workspace on local file system..." /><echo/>

<exec executable="${rtc.scm.dir}/scm.exe">
<arg value="--non-interactive"/>
<arg line="load "${rtc.workspace}"" />
<arg line="-r '${rtc.nickname}'" />
<arg line="-d '${sourcecode.path}'" />
<arg line="--force" />
</exec>

<echo/><echo message="Workspace changes (if any) have been successfully loaded on local filesystem at," />
<echo message="${sourcecode.path}" />
<echo/>

<antcall target="rtclogout" />

</target>


<!-- Target to logout from repository -->
<target name="rtclogout" description="Target to logout from repository">
<echo message="Trying to Logout from the Repository." />
<echo/>
<exec executable="${rtc.scm.dir}/scm.exe">
<arg value="--non-interactive"/>
<arg line="logout" />
<arg line="-r "${rtc.nickname}"" />
</exec>

</target>

permanent link
Narayanan Potti (27037679) | answered Oct 22 '10, 11:15 a.m.
Hi Rahul

This is exactly what I was looking for ! Thanks a lot for replying and giving the actual commands I can use in my ANT script. I'll test the commands with my ANT script.

I had understood it wrong and Thanks again !

NP

Hi Narayan

Well, I cant say that I understood the problem completely, but let me try to help a little. Replace component will need to be done each time you make a build. As an example, let me explain my scenario.
I have a Stream (ST), my repository workspace (RW) and my local workspace on laptop (LW)

1. Development lead creates Baseline on his RW and then deliver it to ST.
2. During build the Build Coordinator takes this Baseline name and repalces the 'build' RW with the Baseline.
3. The 'replaced' RW is then loaded onto the LW.

All of these commands have been automated in an ANT script using the <exec> task. For example,


<Target>
<target>
<echo>
<echo>
<echo>
<echo>
<echo>
<echo>
<echo>
<echo>


<if>
<or>
<not><isset></not>
<equals>
</or>
<then>
<echo>
<fail>
</then>
</if>


<echo>
<echo>
<exec>
<arg>
<arg>
<arg>
<arg>
<arg>
<arg>
</exec>
<echo>

<if>
<contains>
<then>
<echo>
<echo>
<echo>
<fail>
</then>
</if>



<if>
<and>
<isset>
<not><equals></not>
</and>
<then>
<echo><echo><echo>
<exec>
<arg>
<arg>
<arg>
<arg>
<arg>
</exec>

<echo>

<if>
<contains>
<then>
<var>
<echo>
<echo>
<echo>
<antcall>
<fail>
</then>
<else>
<echo><echo>
</else>
</if>

</then>
<else>
<Fetch>
<echo>
<echo><echo>
<exec>
<arg>
<arg>
<arg>
<arg>
</exec>
<echo><echo>
</else>
</if>


<echo><echo>

<exec>
<arg>
<arg>
<arg>
<arg>
<arg>
</exec>

<echo><echo>
<echo>
<echo>

<antcall>

</target>


<Target>
<target>
<echo>
<echo>
<exec>
<arg>
<arg>
<arg>
</exec>

</target>

permanent link
Narayanan Potti (27037679) | answered Oct 22 '10, 11:54 a.m.
Hi
I have a related question - is there a document or manual where I can find details of all RTC ANT tasks / commands ? I couldn't find it in RTC infocenter. If this is documented it'll be very helpful if someone can send me the links.

Thank You
NP


Hi Rahul

This is exactly what I was looking for ! Thanks a lot for replying and giving the actual commands I can use in my ANT script. I'll test the commands with my ANT script.

I had understood it wrong and Thanks again !

NP

Hi Narayan

Well, I cant say that I understood the problem completely, but let me try to help a little. Replace component will need to be done each time you make a build. As an example, let me explain my scenario.
I have a Stream (ST), my repository workspace (RW) and my local workspace on laptop (LW)

1. Development lead creates Baseline on his RW and then deliver it to ST.
2. During build the Build Coordinator takes this Baseline name and repalces the 'build' RW with the Baseline.
3. The 'replaced' RW is then loaded onto the LW.

All of these commands have been automated in an ANT script using the <exec> task. For example,


<Target>
<target>
<echo>
<echo>
<echo>
<echo>
<echo>
<echo>
<echo>
<echo>


<if>
<or>
<not><isset></not>
<equals>
</or>
<then>
<echo>
<fail>
</then>
</if>


<echo>
<echo>
<exec>
<arg>
<arg>
<arg>
<arg>
<arg>
<arg>
</exec>
<echo>

<if>
<contains>
<then>
<echo>
<echo>
<echo>
<fail>
</then>
</if>



<if>
<and>
<isset>
<not><equals></not>
</and>
<then>
<echo><echo><echo>
<exec>
<arg>
<arg>
<arg>
<arg>
<arg>
</exec>

<echo>

<if>
<contains>
<then>
<var>
<echo>
<echo>
<echo>
<antcall>
<fail>
</then>
<else>
<echo><echo>
</else>
</if>

</then>
<else>
<Fetch>
<echo>
<echo><echo>
<exec>
<arg>
<arg>
<arg>
<arg>
</exec>
<echo><echo>
</else>
</if>


<echo><echo>

<exec>
<arg>
<arg>
<arg>
<arg>
<arg>
</exec>

<echo><echo>
<echo>
<echo>

<antcall>

</target>


<Target>
<target>
<echo>
<echo>
<exec>
<arg>
<arg>
<arg>
</exec>

</target>

permanent link
Rahul Pawar (7121) | answered Oct 26 '10, 4:03 a.m.
Hi

Unfortunately, I could not find a place that is like the authoritative guide for RTC. So we kind of search a lot over Google and do our own RnD. Pasted below are some links that we've refered while creating the script.

http://publib.boulder.ibm.com/infocenter/rtc/v2r0m0/index.jsp?topic=/com.ibm.team.scm.doc/topics/c_scm_cli.html
http://jazz.net/library/article/38
http://publib.boulder.ibm.com/infocenter/rtc/v2r0m0/index.jsp?topic=/com.ibm.team.install.doc/topics/t_install_build_toolkit_zip.html
http://kenai.com/projects/cowley/pages/Home/revisions/5
http://jazz.net/library/article/195/
http://jazz.net/forums/viewtopic.php?p=23142&sid=ba20d2b3d25a6b84a4dbffa7e071a846
http://jazz.net/library/article/192/
http://vectorcomputing.net/think/rational-team-concert/

Also, one approach we've consistenty followed is trying out the RTC 'scm' commands directly (thru windows command prompt) on a POC project and then incorporting it in the Ant script.

To better understand the "replace-components" we had taken the command line help usng the command
scm help workspace
and
scm help workspace replace-components


Hope this helps!
Rahul


Hi
I have a related question - is there a document or manual where I can find details of all RTC ANT tasks / commands ? I couldn't find it in RTC infocenter. If this is documented it'll be very helpful if someone can send me the links.

Thank You
NP



permanent link
Rahul Pawar (7121) | answered Oct 26 '10, 5:28 a.m.
Hi Narayanan

You're most welcome. I'm glad my post is of some help.
One thing i forgot to mention is the Ant script is using AntContrib for <if> tasks. So you will need the AntContrib jar and the build.xml will need to point to the Jar as mentioned below.

<taskdef resource="net/sf/antcontrib/antlib.xml">

<classpath>
<pathelement location="${basedir}/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>

Thanks
Rahul

Hi Rahul

This is exactly what I was looking for ! Thanks a lot for replying and giving the actual commands I can use in my ANT script. I'll test the commands with my ANT script.

I had understood it wrong and Thanks again !

NP

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.