You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2008/04/04 00:19:47 UTC
svn commit: r644532 - in /ant/ivy/core/trunk: ./
src/java/org/apache/ivy/core/retrieve/
src/java/org/apache/ivy/core/settings/ src/java/org/apache/ivy/util/
test/java/org/apache/ivy/ant/
Author: maartenc
Date: Thu Apr 3 15:19:46 2008
New Revision: 644532
URL: http://svn.apache.org/viewvc?rev=644532&view=rev
Log:
FIX: ivy:retrieve with sync="true" removes the .svn directory (IVY-763)
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveTest.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=644532&r1=644531&r2=644532&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Apr 3 15:19:46 2008
@@ -77,6 +77,7 @@
- IMPROVEMENT: Change allownomd and skipbuildwithoutivy into a more semantically correct name (IVY-297)
- IMPROVEMENT: Smarter determination if an expression is exact or not for RegexpPatternMatcher and GlobPatternMatcher
+- FIX: ivy:retrieve with sync="true" removes the .svn directory (IVY-763)
- FIX: Ivy silently fails XML errors in ivyrep (IVY-579)
- FIX: Extra Attributes are not available to resolver after resolve if cache was empty (IVY-773)
- FIX: NullPointerException during ResovleEngine.downloadArtifacts. (IVY-592)
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java?rev=644532&r1=644531&r2=644532&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java Thu Apr 3 15:19:46 2008
@@ -150,9 +150,13 @@
if (options.isSync()) {
Message.verbose("\tsyncing...");
- Collection existingArtifacts = FileUtil.listAll(fileRetrieveRoot);
+
+ String[] ignorableFilenames = settings.getIgnorableFilenames();
+ Collection ignoreList = Arrays.asList(ignorableFilenames);
+
+ Collection existingArtifacts = FileUtil.listAll(fileRetrieveRoot, ignoreList);
Collection existingIvys = ivyRetrieveRoot == null ? null : FileUtil
- .listAll(ivyRetrieveRoot);
+ .listAll(ivyRetrieveRoot, ignoreList);
if (fileRetrieveRoot.equals(ivyRetrieveRoot)) {
Collection target = targetArtifactsStructure;
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java?rev=644532&r1=644531&r2=644532&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java Thu Apr 3 15:19:46 2008
@@ -25,5 +25,7 @@
boolean isCheckUpToDate();
IvyVariableContainer getVariables();
+
+ String[] getIgnorableFilenames();
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java?rev=644532&r1=644531&r2=644532&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java Thu Apr 3 15:19:46 2008
@@ -1073,6 +1073,14 @@
}
/**
+ * Returns the file names of the files that should be ignored when
+ * creating a file listing.
+ */
+ public String[] getIgnorableFilenames() {
+ return (String[]) listingIgnore.toArray(new String[listingIgnore.size()]);
+ }
+
+ /**
* Filters the names list by removing all names that should be ignored as defined by the listing
* ignore list
*
@@ -1081,7 +1089,7 @@
public void filterIgnore(Collection names) {
names.removeAll(listingIgnore);
}
-
+
public boolean isCheckUpToDate() {
return checkUpToDate;
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java?rev=644532&r1=644531&r2=644532&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java Thu Apr 3 15:19:46 2008
@@ -304,21 +304,26 @@
*
* @param dir The directory from which all files, including files in subdirectory)
* are extracted.
+ * @param ignore a Collection of filenames which must be excluded from listing
* @return A collectoin containing all the files of the given directory and it's
* subdirectories.
*/
- public static Collection listAll(File dir) {
- return listAll(dir, new ArrayList());
+ public static Collection listAll(File dir, Collection ignore) {
+ return listAll(dir, new ArrayList(), ignore);
}
- private static Collection listAll(File file, Collection list) {
+ private static Collection listAll(File file, Collection list, Collection ignore) {
+ if (ignore.contains(file.getName())) {
+ return list;
+ }
+
if (file.exists()) {
list.add(file);
}
if (file.isDirectory()) {
File[] files = file.listFiles();
for (int i = 0; i < files.length; i++) {
- listAll(files[i], list);
+ listAll(files[i], list, ignore);
}
}
return list;
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveTest.java?rev=644532&r1=644531&r2=644532&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveTest.java Thu Apr 3 15:19:46 2008
@@ -142,6 +142,19 @@
assertFalse(new File("build/test/lib/unknown").exists()); // even conf directory should
// have been deleted
}
+
+ public void testSyncWithIgnoreList() throws Exception {
+ project.setProperty("ivy.dep.file", "test/repositories/1/org6/mod6.2/ivys/ivy-0.4.xml");
+ retrieve.setSync(true);
+
+ new File("build/test/lib/.svn").mkdirs();
+ new File("build/test/lib/.svn/test.txt").createNewFile();
+ assertTrue(new File("build/test/lib/.svn/test.txt").exists());
+
+ retrieve.execute();
+
+ assertTrue(new File("build/test/lib/.svn/test.txt").exists());
+ }
public void testWithAPreviousResolve() throws Exception {
// first we do a resolve in another project