[FIXED HUDSON-6332] for 1.357

Add setOverwrite(true) for local->local copy in FilePath.copyRecursiveTo().
This makes it consistent with master/slave copy (either direction),
and also avoids returning 0 if all files already have current/newer timestamp
which some code (javadoc publishing, copyartifact plugin) would interpret as
copy failure or no matching files found.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@30450 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
mindless committed 2010-04-27 23:53:41 +00:00
1 parent 5c339d5040
commit 5ad11a0dbc
2 files changed
+18

No files matched your search

@@ -61,6 +61,23 @@ public class FilePathTest extends ChannelTestCase {
}
}
public void testRepeatCopyRecursiveTo() throws Exception {
// local->local copy used to return 0 if all files were "up to date"
// should return number of files processed, whether or not they were copied or already current
File tmp = Util.createTempDir(), src = new File(tmp, "src"), dst = new File(tmp, "dst");
try {
assertTrue(src.mkdir());
assertTrue(dst.mkdir());
File f = File.createTempFile("foo", ".tmp", src);
FilePath fp = new FilePath(src);
assertEquals(1, fp.copyRecursiveTo(new FilePath(dst)));
// copy again should still report 1
assertEquals(1, fp.copyRecursiveTo(new FilePath(dst)));
} finally {
Util.deleteRecursive(tmp);
}
}
public void testArchiveBug4039() throws Exception {
File tmp = Util.createTempDir();
try {