diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2013-02-04 01:10:26 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2013-05-04 02:01:56 +0200 |
commit | dd3181603e0a42c46299c25cede66fdbd67da518 (patch) | |
tree | d92d9b2ef6560d21e5f5b760371f23fb509b2a94 /org.eclipse.jgit.junit | |
parent | f2d0b50e0a9aff4060f8e2caa6f5b662adf16f81 (diff) | |
download | jgit-dd3181603e0a42c46299c25cede66fdbd67da518.tar.gz jgit-dd3181603e0a42c46299c25cede66fdbd67da518.zip |
Extend the FS class for Java7
The most important difference is that in Java7 we have symbolic links
and for most operations in the work tree we want to operate on the link
itself rather than the link target, which the old File methods generally
do.
We also add support for the hidden attribute, which only makes sense
on Windows and exists, just since there are claims that Files.exists
is faster the File.exists.
A new bundle is only activated when run with a Java7 execution
environment. It is implemented as a fragment.
Tycho currently has no way to conditionally include optional features
based on the java version used to run the build, this means with this
change the jgit packaging build always needs to be run using java 7.
Change-Id: I3d6580d6fa7b22f60d7e54ab236898ed44954ffd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.junit')
-rw-r--r-- | org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java index 9b9fc14f42..397fb6151d 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java @@ -74,6 +74,7 @@ import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.treewalk.FileTreeIterator; +import org.eclipse.jgit.util.FS; import org.eclipse.jgit.util.FileUtils; import org.junit.Before; @@ -375,18 +376,19 @@ public abstract class RepositoryTestCase extends LocalDiskRepositoryTestCase { public static long fsTick(File lastFile) throws InterruptedException, IOException { long sleepTime = 1; - if (lastFile != null && !lastFile.exists()) + FS fs = FS.DETECTED; + if (lastFile != null && !fs.exists(lastFile)) throw new FileNotFoundException(lastFile.getPath()); File tmp = File.createTempFile("FileTreeIteratorWithTimeControl", null); try { - long startTime = (lastFile == null) ? tmp.lastModified() : lastFile - .lastModified(); - long actTime = tmp.lastModified(); + long startTime = (lastFile == null) ? fs.lastModified(tmp) : fs + .lastModified(lastFile); + long actTime = fs.lastModified(tmp); while (actTime <= startTime) { Thread.sleep(sleepTime); sleepTime *= 5; - tmp.setLastModified(System.currentTimeMillis()); - actTime = tmp.lastModified(); + fs.setLastModified(tmp, System.currentTimeMillis()); + actTime = fs.lastModified(tmp); } return actTime; } finally { |