It's all about the answers!

Ask a question

How to maintain folder structure while selectively loading folders within SCM Component in RTC


Radha Nagaraja (1558) | asked Oct 21 '13, 6:18 a.m.
retagged Dec 03 '13, 11:21 a.m. by David Lafreniere (4.8k7)
Maintain folder structure while selectively loading folders within SCM Component in RTC
Example: I have a structure as mentioned below and want to load specific folders

Component1
  |_ F1
       |_SF1
       |_SF2
           |_SF3
       |_SF4
  |_ F2
       |_SF5
       |_SF6

I want to load only folders SF3 and SF5 with the parent folders are part of the directory structure into workspace.
Component1
  |_ F1
       |_SF2
           |_SF3
  |_ F2
       |_SF5

Can this be done using the load options?

Thanks,
Radha

Accepted answer


permanent link
David Lafreniere (4.8k7) | answered Dec 03 '13, 2:25 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
Hi Radha

Here are the steps to do what you want.
1. Create an empty project in Eclipse corresponding to the root Eclipse projects that contain the files/folder you want to load. In your example, create an empty project named "F1" and "F2" in Eclipse. This step would be needed if you want to have the sparsely loaded files/directories tracked in Eclipse (so they appear shared, and so that changes are automatically picked up without requiring a manual refresh in the Pending Changes view). If you don't care if they are tracked in Eclipse, and plan on modifying them outside of Eclipse, you can skip this step.

For example, see the screenshot below. The Repository Files view on a component shows the current layout, however I only want to load fileA1.txt and fileA2.txt and I want to keep the parent folder hierarchy (this is similar to your request). Notice how I have an empty Eclipse project called "ProjectA" showing in the Package Explorer view.


2. From the repository files view, click on the folder or file you want, and select the "Load As" context menu action on each folder or file you want to sparsely load. The Local Path will, by default, include the full parent folder hierarchy. If you are on an older version of RTC in which this is not done by default, you can manually type in the parent folder hierarchy that you would like to have.
The screenshot below shows me trying to load as on fileA1.txt

I will repeat this step for fileB2.txt and in the screenshot below we can see I have loaded the files that I wanted, and they are tracked/shared in Eclipse with RTC and that they contain the same parent folder hierarchy that is actually in the component.


3. Once that is all done, you can capture 'how' you loaded everything in a load rule file so that in the future you can simply load from a load rule file instead of re-doing the steps above.
Navigate to "Window" --> "Preferences" --> "Team " --> "Jazz Source Control" --> "Sandboxes". Click on the sandbox that represents your eclipse workspace (or which ever sandbox you just loaded everything into) and select the "Generate Load Rules...". In the dialog you can choose where you want to save the load rule file and click "Generate".

4. With the saved load rule file, you can check it into a repository workspace (and deliver it to a stream) if it represents a similar way that you would like other people on your team to load their component, or you can just keep it around locally to use for yourself.

5. If you happen to discard / delete everything, and want to load everything as you just did, you can now select the "Load" context menu action on a component, and select the "Load from a load rule file" option on the first page of the Load Wizard. In the next page, you can choose where the load rule file was saved (whether it be locally, or if it was checked into the repository workspace that you are trying to load). This will load everything the same way you did before without requiring steps 2 and 3 above. (Note: If you still want the loaded files to be tracked in Eclipse, you will have to do step 1 by having an Eclipse project already in Eclipse).

Geoffrey Clemm selected this answer as the correct answer

3 other answers



permanent link
Rishi Theivendran (6) | answered Mar 03 '14, 3:13 p.m.
This can be achieved by using itemLoadRule or parentLoadRule. See an example of both below.

<?xml version="1.0" encoding="UTF-8"?>
<scm:sourceControlLoadRule xmlns:scm="http://com.ibm.team.scm" version="1">
    <itemLoadRule>
        <component name="Component1"/>
        <item repositoryPath="/Component1/F1/SF2/SF3"/>
        <sandboxRelativePath includeRepositoryPath="true"/>
    </itemLoadRule>
    <parentLoadRule>
        <component name="Component1"/>
        <parentFolder repositoryPath="/Component1/F2"/>
        <exclude>
            <filter name="SF6"/>
        </exclude>
        <sandboxRelativePath includeRepositoryPath="true"/>
    </parentLoadRule>
</scm:sourceControlLoadRule>

permanent link
Simon Eickel (1.1k75457) | answered Oct 22 '13, 2:51 a.m.
Hi Radha,
Load rules can be used even when the component is not loaded. You just have to define where the load rule stays.

This means you don't need a "first instance" to load before using the load rule. You can directly load with a load rule even if you don't have the structure on your disc before.

You could use the "load - browse" option graphically, but with this option you won't be able to just to load some parts of a parent folder when you need the parent folder on your disc, too.

Hope this helps,
Simon

permanent link
Piotr Aniola (3.7k11738) | answered Oct 21 '13, 6:24 a.m.
edited Oct 21 '13, 6:26 a.m.
You have to include the following in your load rules:
<sandboxRelativePath includeRepositoryPath=true/>  (under itemLoadRule Element).

Please see the following article for details:
https://jazz.net/wiki/bin/view/Main/SCMLoadRuleFormat

Please note this has been implemented in RTC 4.0 https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=85020

Comments
Radha Nagaraja commented Oct 21 '13, 9:39 a.m. | edited Oct 21 '13, 9:39 a.m.

Thanks for the answer Aniola.
It helps when sharing the load rules once the component is loaded.
But I'm looking more on the aspect of being able to load the structure in the first instance itself.  Is there such a possibility ?


Piotr Aniola commented Oct 21 '13, 10:00 a.m.

I'm not sure if I understand correctly. This mechanism should allow you to load any part of a component, while preserving the original folder structure. If it doesn't please elaborate on your use case.


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.