You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Guntis Ozols <gu...@latnet.lv> on 2007/03/15 17:20:09 UTC
Enhance move, copy with @overwrite-if-filesmatch = false
Hi!
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.
Guntis
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: Enhance move, copy with @overwrite-if-filesmatch = false
Posted by Guntis Ozols <gu...@latnet.lv>.
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
Re: Enhance move, copy with @overwrite-if-filesmatch = false
Posted by Steve Loughran <st...@apache.org>.
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.
-steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: Enhance move, copy with @overwrite-if-filesmatch = false
Posted by Guntis Ozols <gu...@latnet.lv>.
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.
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"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: Enhance move, copy with @overwrite-if-filesmatch = false
Posted by Steve Loughran <st...@apache.org>.
Guntis Ozols wrote:
> Hi!
>
> 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.
I'd file this under WORKSFORME.
<copy> doesnt copy the files if the source and dest times are the same.
If you are finding problems, then perhaps you are copying ot a remote
machine whose clock is not in sync.
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.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org