Fix deprecation warnings from latest JGit update

- FS is no longer required for LockFile constructor.
 - TestRepository#getClock was renamed getDate.
 - Replace usages of RefDatabase#getRef with either exactRef, when we
   know we can bypass the full lookup path, or findRef, where the
   input is user-provided and we might need to add an implicit prefix.

Change-Id: I6309b91ccf99ffaa724be273ddae0d9857b825f9
This commit is contained in:
Dave Borowitz
2016-01-06 10:34:50 -05:00
parent bb5c68c4b9
commit f83c424b4b
25 changed files with 44 additions and 48 deletions

View File

@@ -21,7 +21,6 @@ import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gwtorm.schema.java.JavaSchemaModel;
import org.eclipse.jgit.internal.storage.file.LockFile;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.IO;
import org.kohsuke.args4j.Option;
@@ -39,7 +38,7 @@ public class ProtoGen extends AbstractProgram {
@Override
public int run() throws Exception {
LockFile lock = new LockFile(file.getAbsoluteFile(), FS.DETECTED);
LockFile lock = new LockFile(file.getAbsoluteFile());
if (!lock.lock()) {
throw die("Cannot lock " + file);
}

View File

@@ -27,7 +27,6 @@ import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.eclipse.jgit.internal.storage.file.LockFile;
import org.eclipse.jgit.util.FS;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -96,7 +95,7 @@ class InitContainer implements InitStep {
try (InputStream in = Files.newInputStream(myWar)) {
Files.createDirectories(siteWar.getParent());
LockFile lf = new LockFile(siteWar.toFile(), FS.DETECTED);
LockFile lf = new LockFile(siteWar.toFile());
if (!lf.lock()) {
throw new IOException("Cannot lock " + siteWar);
}

View File

@@ -21,7 +21,6 @@ import com.google.gerrit.common.Die;
import org.eclipse.jgit.internal.storage.file.LockFile;
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.SystemReader;
import java.io.ByteArrayInputStream;
@@ -162,7 +161,7 @@ public class InitUtil {
}
Files.createDirectories(dst.getParent());
LockFile lf = new LockFile(dst.toFile(), FS.DETECTED);
LockFile lf = new LockFile(dst.toFile());
if (!lf.lock()) {
throw new IOException("Cannot lock " + dst);
}