ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guntis Ozols <gunt...@latnet.lv>
Subject Re: Enhance move, copy with @overwrite-if-filesmatch = false
Date Fri, 16 Mar 2007 14:53:41 GMT
Steve Loughran 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.

We are talking from different perspectives (user/developer)...
>From developer perspective, I think not too much special tests are needed.
I think this check should be done just before copying/moving.

> 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.

filesmatch is quite basic.
containsregexp, for example, does not even come close.

I did not propose to change defaults.

> > 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.

Doc says: The <presetdef> task takes ONE nested element as a parameter.
Any ideas how to work around?


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message