Hi Ken,

Sounds very cool and useful. Maybe you could make it into a Nant task and 
submit it for consideration to the contrib project. I went a little more low 
tech using a foreach and uptodate tag. Here is what I ended up with. It 
surprisingly works well... not surprisingly it is a bit slow. But, that's ok 
for now. Of course, it doesn't handle deletes... but that is fine... I needed 
this to build a "hotfix" which only includes the newer/added files.

                <foreach item="File" property="filename">
                                <in><items basedir="${ReleaseDir}"><include 
name="**"/></items></in>
                                <do>
                                <property name="filename.tocompare" 
value="${string::replace(filename,path::get-full-path(ReleaseDir),path::get-full-path(ReleaseDir.Rev0))}"
 />
                                <uptodate property="filename.uptodate">
                                                <sourcefiles>
                                                                <include 
name="${filename}" />
                                                </sourcefiles>
                                                <targetfiles>
                                                                <include 
name="${filename.tocompare}" />
                                                </targetfiles>
                                </uptodate>
                                <echo message="File ${filename} has been 
updated" unless="${filename.uptodate}" />
                                <copy todir="${InstallDir.HF}" 
unless="${filename.uptodate}">
                                                <fileset 
basedir="${ReleaseDir}">
                                                                <include 
name="${string::replace(filename,path::get-full-path(ReleaseDir+'\'),'')}" />
                                                </fileset>
                                </copy>
                                </do>
                </foreach>

From: Parrish, Ken [mailto:kparr...@gomez.com]
Sent: Friday, July 31, 2009 5:11 PM
To: Bob Archer; nant-users@lists.sourceforge.net
Subject: RE: creating a diff of two paths...

Bob,

This basic problem was causing us fits for a long time.  I scoured the web for 
directory difference tools that could help.   There are a dozen or more tools 
out there, but none really works the way you want in a source code and/or 
deployment environment (believe it or not)  and can be run from the command 
line (e.g. from Nant).

So, I wrote my own directory differencing tool in .NET.  It's a command line 
program that will generate an XML file which contains a list the differences 
between two directories.  It filters out SVN control files.  Has filters to 
include any combination of  SAME, MODIFIED, DELETED or ADDED files or 
directories.  I then use the output of this tool (via Nant <exec> task) to copy 
selected differences from one location to another, and other used.  The XML 
output is parsed via the <xmllist> task.  The XML output has markers to make 
parsing easier via <xmllist>.

It is used most often to calculate the difference between two checked-out 
versions of the runtime image of a deployable software component and perform 
incremental updates without having to copy 1000's of files (esp. web sites).  
Can also be used to identify new and or deleted files when synchronizing 
directories.

It could be adapted to include and calculate file/directory dates for 
differencing as well.

Ken Parrish
Gomez, Inc.

From: Bob Archer [mailto:bob.arc...@amsi.com]
Sent: Wednesday, July 29, 2009 2:03 PM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] creating a diff of two paths...

I see that in Nant the copy command only copies newer files. What I want to be 
able to do is copy files to a delta folder if they are newer rather than to the 
destination folder.

So, for example given two paths, MyPath/v0 and MyPath/v1 I want to copy all the 
files from MyPath/v1 that are newer than MyPath/v0 to MyPath/v1-Diff. Sort of a 
combination of the uptodate and copy tasks?

The only way I can think to do it now is to loop through each file and use an 
uptodate task in the loop. But, that seems like it would be quite slow.

Any ideas appreciated.

BOb
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to