ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <>
Subject Re: Enhance move, copy with @overwrite-if-filesmatch = false
Date Fri, 16 Mar 2007 14:09:43 GMT
Guntis Ozols wrote:
> Guntis Ozols wrote:
>>> I think move and copy tasks should be enhanced with
>>> overwrite-if-filesmatch boolean attribute.
>>> If set to false and source and target files match,
>>> target file modification time should be left unchanged.
>>> This way, long rebuilds triggered by small files can be avoided.
>>> What do you think? Will somebody else need it, not just me?
>>> I can implement this.
> Steve Loughran wrote:
>> I'd file this under WORKSFORME.
>> If you actually want a byte-for-byte comparision, copy a <fileset> with
>> a nested <different> selector. Note that this gets very slow when there
>> are lots of files to copy that havent changed, because ant still has to
>> read every single byte to make sure.
> This attribute BELONGS to copy.
> It represents the most basic relation between files.

1. If we added an attribute for one selector, we'd inevitably add them 
for more, then we have to deal with the problem of multiple options set, 
write the tests for them, etc, etc. Whereas putting it in the fileset 
hands off the problem to the bit of code best set up to deal with it.

2. its not basic. <copy> has a default mode of dependency checking, an 
option of forcing a copy. Saying "do a slow per-byte check" on the far 
end file is not something you want by default.

> Yes, I actually want byte-for-byte comparison, reasons above.
> Please compare:
>     <move overwrite-if-filesmatch="false"
>           file="long-dirname/long-filename-latest.xml"
>         tofile="long-dirname/long-filename.xml"/>
> with (tested on 1.7):
>     <copy todir="long-dirname">
>       <fileset file="long-dirname/long-filename-latest.xml">
>         <different targetdir="long-dirname">
>           <mapper type="glob" from="*-latest.xml" to="*.xml"/>
>         </different>
>       </fileset>
>       <globmapper from="*-latest.xml" to="*.xml"/>
>     </copy>
>     <delete file="long-dirname/long-filename-latest.xml"/>

yes its verbose, but think how short the <presetdef> will be.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message