It's all about the answers!

Ask a question

How to write load rule to recursively ignore certain file types


Karthikeyan Baskaran (45813) | asked Jun 10 '14, 6:32 a.m.
This is my component structure in my RTC workspace:

Component-A
|-- Root-Folder
    |-- Sub-Folder-1
         |-- File2.c
         |-- File2.doc
    |-- Sub-Folder-2
         |-- Sub-Folder-3
              |-- File3.c
              |-- File3.doc
    |-- File1.c
    |-- File1.doc

My requirement is to filter out all *.doc files and load only all *.c files into my sandbox like this:

My Sandbox path
|-- Root-Folder
    |-- Sub-Folder-1
         |-- File2.c
    |-- Sub-Folder-2
         |-- Sub-Folder-3
              |-- File3.c
    |-- File1.c

Learning from article: https://jazz.net/library/article/1015 I tried below load rules

1. using Exclude filter
------------------------------
<scm:sourceControlLoadRule version="1" xmlns:scm="http://com.ibm.team.scm">
    <excludeFilter>
        <filter name=".doc"/>
    </excludeFilter>
</scm:sourceControlLoadRule>

=> Error: Error parsing load rule: cvc-complex-type.2.4.b: The content of element 'scm:sourceControlLoadRule' is not complete. One of '{parentLoadRule, itemLoadRule}' is expected.
=> Why this error occurs ? It is not mentioned in the article 1015 that excludeFilter is dependent on parentLoadRule/itemLoadRule

2. using parentLoadRule and include filter
------------------------------------------------------------
<scm:sourceControlLoadRule version="1" xmlns:scm="http://com.ibm.team.scm">
    <parentLoadRule>
        <component name="Component-A"/>
        <parentFolder repositoryPath="/"/>
        <include>
            <filter pattern="*.c"/>
        </include>
    </parentLoadRule>
</scm:sourceControlLoadRule>

=> Error: There are no qualifying items under / in component Component-A to be loaded into sandbox
=> Why am I not able to use "/" as repositoryPath as shown in article 1015 ?

3. using parentLoadRule and include filter and setting repositoryPath
------------------------------------------------------------------------------------------
<scm:sourceControlLoadRule version="1" xmlns:scm="http://com.ibm.team.scm">
    <parentLoadRule>
        <component name="Component-A"/>
        <parentFolder repositoryPath="Root-Folder"/>
        <include>
            <filter pattern="*.c"/>
        </include>
    </parentLoadRule>
</scm:sourceControlLoadRule>

=> Status of sandbox after loading using this load rule:

My Sandbox path
|-- File1.c

=> This load rule just loads "File1.c" directly into my sandbox (It doesn't even create the "Root-Folder" inside my sandbox). Also, it is not recursive. File2.c, File3.c and their corresponding folder structure is not created inside my sandbox.

Could you please advice on how I could modify the above rule(s) to realize my requirement ? (I'm using RTC 4.0.6)

Thanks in advance.

Comments
Karthikeyan Baskaran commented Jun 10 '14, 7:42 a.m. | edited Jun 10 '14, 7:43 a.m.
  1. using parentLoadRule,include filter, repositoryPath and sandboxRelativePath

    <scm:sourceControlLoadRule version="1" xmlns:scm="http://com.ibm.team.scm">;
    <parentLoadRule>
    <component name="Component-A"/>
         <parentFolder repositoryPath="Root-Folder"/>        
            <include>
                <filter pattern="*.c"/>
            </include>
            <sandboxRelativePath includeRepositoryPath="true"/>
        </parentLoadRule>
    </scm:sourceControlLoadRule>

    => Status of sandbox after loading using this load rule:
    My Sandbox path
    |-- Root-Folder
         |-- File1.c

    => Now "Root-Folder" gets created in my sandbox and only the File1.c is loaded inside it.
    => Only problem that has to be solved now is to find out how to load recursive

One answer



permanent link
Lily Wang (4.9k714) | answered Jun 10 '14, 8:40 a.m.
The "load recursively with a file pattern" is not supported by load rules yet.
Please see discussion https://jazz.net/forum/questions/154830/how-to-write-load-rule-to-recursively-ignore-certain-file-types and the work item https://jazz.net/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/44004

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.