Summary: | [PATCH] Making file sizes optional in DifferentSelector | ||
---|---|---|---|
Product: | Ant | Reporter: | Georg Boecherer <geborg> |
Component: | Core tasks | Assignee: | Ant Notifications List <notifications> |
Status: | RESOLVED WORKSFORME | ||
Severity: | enhancement | Keywords: | PatchAvailable |
Priority: | P2 | ||
Version: | 1.6.5 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All |
Description
Georg Boecherer
2005-12-05 19:06:40 UTC
uh, in what way does the <present> selector not cover the use case of selecting files by existence only? Matt, you can try it but it won't pass the following test case: you use <different targetdir="..." ignorecontents="true" ignorefiletimes="true" /> and the two files you test for difference are of different size. so <different/> will report them as different, although they both exist. but with my patch and <different targetdir="..." ignorecontents="true" ignorefiletimes="true" ignorefilesizes="true"/> it won't... georg Did you think that, by "<present> selector", I meant the <different> selector in its present form? I meant the entirely different <present> selector, which selects files that do or do not exist elsewhere. You should be able to use: <present targetdir="..." present="srconly"> to select only files that do not exist in the target directory. Matt, thank you, you are absolutely right (I interpreted "<present>" as "present <different>". I looked in the sources, my Ant installation has the <present> selector, but why couldn't I find it when navigating the Ant documentation? So I could have solved my problem with an other selector. I think though that the <different> selector should provide the filesize as optional. greetz,georg I'm really confused. the filesize check encodes the rule "if two files are different sizes, then they are different files". You seem to be looking only for files that are present/absent. For that, use the <present> selector. Steve, you are right, but what about: the file contents check encodes the rule "if two files are different in at least one byte, then they are different files", so why is it optional and filesize is not? perhaps we can reduce my suggestion to this question, for my purpose I'm already happy with the <present> selector. greetz,georg Okay, then the answer to your question is because the capability provided by <different>'s ignorefiletimes and ignorecontents attributes was not available by any other means. Obviously ignorefilesizes="true" would imply ignorecontents="true" as contents would never match while sizes did not. Even assuming both of these to be true, your comparison is now based on time alone, which case is covered by the <depend> selector in much the same way as the case of all three--ignore time, size, and contents--is covered by the <present> selector. Thanks! The main reason for allowing you to ignore the contents in a difference test is because the performance of that is awful on files that actually match. Both the source and dest files need parsing and byte-for-byte comparision, which is slow. Over a network, it is extra slow. so by saying ignore file sizes you are cheating, you are saying 'ignore the file times' -which you ought to do over a network, and 'ignore the file contents'. you are therefore defining different to be 'two files of different sizes are different; if they are the same size, we assume they are the same' once you ignore file sizes you define different as "two files are different only if one exists". Which is what the <present> selector already did at the time of writing. We dont need an extra feature that another selector does, because it only adds complexity, bugreps and test cases. At the same time, I dont want you to feel disappointed that we have rejected your work. There was nothing wrong with the code, and you submitted a patch exactly as we like it. It was just we had a different solution to the problem somewhere else. Please dont be dissuaded from submitting more bugreps or patches, and hassling us to get the patches committed :) |