1

Scenario:

  • SVN Repo #1 with application code base
  • SVN Repo #2 with previously compiled milestones

I need an ANT build script which can do the following:

  1. Export the code base from SVN repo #1 (done)
  2. Compile the exported code base (done)
  3. Check out the code base from SVN repo #2 (done)
  4. Compare the compiled/exported code base from SVN repo #1 to the working copy from SVN repo #2 a. If any files have been added in SVN repo #1, they need to be added to the working copy b. If any files have been updated in SVN repo #1, they overwrite what is in the working copy c. If any files have been removed from SVN repo #2, they need to be deleted from the working copy
  5. Check in the updated code base into SVN repo #2

Step #4 is where I am running into issues. I believe I can accomplish 4a and 4b by just copying the compiled/exported code base from SVN repo #1 over the working copy that has been checked out from SVN repo #2. I am not sure how do do the diff between the two code bases to determine which files need to be deleted from the SVN repo #2 working copy though. I know I can use SVNANT delete to remove the files, but how do I build the fileset?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Jeff
  • 227
  • 1
  • 4
  • 13

1 Answers1

1

I did similar tasks. In my cases ant code looks like that:

...
<svn.sync to="${svn_folder}" from="${deploy_directory_path}" />
...
<svn svnkit="true" javahl="false">
    <add dir="${svn_folder}" force="true" recurse="true" />
    <!--add>
        <svnFileSet dir="${svn_folder}">
            <svnUnversioned/>
        </svnFileSet>
    </add-->
    <delete>
        <svnFileSet dir="${svn_folder}">
            <svnMissing/>
        </svnFileSet>
    </delete>
</svn>
<svn verbose="true" username="${svn.username}" password="${svn.password}" svnkit="true">
    <commit dir="${svn_folder}" message="${version}"/>
</svn>

where

<macrodef name="svn.sync">
    <attribute name="to" />
    <attribute name="from" />
    <sequential>
        <mkdir dir="@{to}" />
        <sync todir="@{to}" includeemptydirs="true">
            <fileset dir="@{from}" />
            <fileset dir="@{to}" defaultexcludes="no">
                <include name="**/.svn/**/*" />
                <include name="**/.svn/**/*.*" />
            </fileset>
        </sync>
    </sequential>
</macrodef>
FoxyBOA
  • 5,788
  • 8
  • 48
  • 82