You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by an...@apache.org on 2003/05/24 15:52:49 UTC

cvs commit: ant/docs/manual/CoreTypes selectors.html

antoine     2003/05/24 06:52:49

  Modified:    src/main/org/apache/tools/ant/types/selectors
                        DifferentSelector.java
               docs/manual/CoreTypes selectors.html
  Log:
  While reviewing this contribution, I saw that the original test in line 120
  of DifferentSelector.java :
          if(sameDate && !ignoreFileTimes) {
              return true;
          }
  was wrong. I changed it to if (!sameDate) {
                               return true;
                              }
  Also, DifferentSelector has no Junit test yet, this should be done.
  PR: 20205
  Submitted by: Jeff Turner (jefft at apache dot org)
  
  Revision  Changes    Path
  1.4       +9 -7      ant/src/main/org/apache/tools/ant/types/selectors/DifferentSelector.java
  
  Index: DifferentSelector.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/DifferentSelector.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DifferentSelector.java	10 Feb 2003 14:14:35 -0000	1.3
  +++ DifferentSelector.java	24 May 2003 13:52:49 -0000	1.4
  @@ -110,14 +110,16 @@
               return true;
           }
   
  -        //same date if dest timestamp is within granularity of the srcfile
  -        boolean sameDate;
  -        sameDate = destfile.lastModified() >= srcfile.lastModified() - granularity
  -            && destfile.lastModified() <= srcfile.lastModified() + granularity;
  +        if (!ignoreFileTimes) {
  +            //same date if dest timestamp is within granularity of the srcfile
  +            boolean sameDate;
  +            sameDate = destfile.lastModified() >= srcfile.lastModified() - granularity
  +                && destfile.lastModified() <= srcfile.lastModified() + granularity;
   
  -        //and when ignoreFileTimes is set we claim the files are now equal
  -        if(sameDate && !ignoreFileTimes) {
  -            return true;
  +            // different dates => different files
  +            if(!sameDate) {
  +                return true;
  +            }
           }
   
           //here do a bulk comparison
  
  
  
  1.11      +1 -1      ant/docs/manual/CoreTypes/selectors.html
  
  Index: selectors.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTypes/selectors.html,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- selectors.html	14 Apr 2003 07:53:07 -0000	1.10
  +++ selectors.html	24 May 2003 13:52:49 -0000	1.11
  @@ -320,7 +320,7 @@
         <tr>
           <td valign="top">ignoreFileTimes</td>
           <td valign="top">Whether to use file times in the comparison or not.
  -        Default is true.
  +        Default is false (time differences are significant).
           </td>
           <td valign="top" align="center">No</td>
         </tr>
  
  
  

Re: Selector tests/DifferentSelector

Posted by Antoine Levy-Lambert <le...@tiscali-dsl.de>.
Thanks very much Bruce.
Antoine
----- Original Message -----
From: "Bruce Atherton" <br...@callenish.com>
To: "Ant Developers List" <de...@ant.apache.org>
Sent: Tuesday, May 27, 2003 5:44 PM
Subject: Re: Selector tests/DifferentSelector


> At 12:03 PM 5/27/2003 +0200, Antoine Levy-Lambert wrote:
> >Hi Steve,
> >do you mean you have difficulties to understand the existing selector
tests.
> >I have had some difficulties there too.
>
> Ok, you guys have guilted me in to cleaning up my previously posted
> description and committing it. Hopefully it will help clarify how to reuse
> the BaseSelectorTest.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>



Re: Selector tests/DifferentSelector

Posted by Bruce Atherton <br...@callenish.com>.
At 12:03 PM 5/27/2003 +0200, Antoine Levy-Lambert wrote:
>Hi Steve,
>do you mean you have difficulties to understand the existing selector tests.
>I have had some difficulties there too.

Ok, you guys have guilted me in to cleaning up my previously posted 
description and committing it. Hopefully it will help clarify how to reuse 
the BaseSelectorTest.



Selector tests/DifferentSelector

Posted by Antoine Levy-Lambert <le...@tiscali-dsl.de>.
Hi Steve,
do you mean you have difficulties to understand the existing selector tests.
I have had some difficulties there too.
I think however that I should be able to add a test for DifferentSelector
following the pattern of the other tests.

Homogeneity in code is always an advantage.

Antoine
----- Original Message -----
From: "Steve Loughran" <st...@iseran.com>
To: "Ant Developers List" <de...@ant.apache.org>
Sent: Tuesday, May 27, 2003 7:25 AM
Subject: Re: cvs commit: ant/docs/manual/CoreTypes selectors.html


>
> ----- Original Message -----
> From: <an...@apache.org>
> To: <an...@apache.org>
> Sent: Saturday, May 24, 2003 06:52
> Subject: cvs commit: ant/docs/manual/CoreTypes selectors.html
> >   Also, DifferentSelector has no Junit test yet, this should be done.
>
> I agree, but was struck by incompetence when I tried to comprehend the
> existing (and very good :) selector tests and think of a way to add the
new
> stuff. Maybe the easier tack is to do it in ant build files using <touch>
> and <echo> to create the files.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>



Re: cvs commit: ant/docs/manual/CoreTypes selectors.html

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: <an...@apache.org>
To: <an...@apache.org>
Sent: Saturday, May 24, 2003 06:52
Subject: cvs commit: ant/docs/manual/CoreTypes selectors.html
>   Also, DifferentSelector has no Junit test yet, this should be done.

I agree, but was struck by incompetence when I tried to comprehend the
existing (and very good :) selector tests and think of a way to add the new
stuff. Maybe the easier tack is to do it in ant build files using <touch>
and <echo> to create the files.