aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2016-02-15 18:44:24 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2016-02-15 18:44:24 +0900
commite96cb22a43e8e67274e39b3d5fb852a20e9b3a04 (patch)
tree4a1c3d5abb00c3cab957e2f91177b41713e00940
parent979fa19110df0906a82e92e32d7d3ccf7eca3712 (diff)
downloadjgit-e96cb22a43e8e67274e39b3d5fb852a20e9b3a04.tar.gz
jgit-e96cb22a43e8e67274e39b3d5fb852a20e9b3a04.zip
Don't use deprecated LockFile constructor
Change-Id: Ibc3e2f3372e1a65732dd6d3c71cec53fb1aa15e2 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java2
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java4
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/LockFileTest.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java3
12 files changed, 17 insertions, 31 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
index 8439c39c8b..e259156c31 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
@@ -905,7 +905,7 @@ public class TestRepository<R extends Repository> {
private void writeFile(final File p, final byte[] bin) throws IOException,
ObjectWritingException {
- final LockFile lck = new LockFile(p, db.getFS());
+ final LockFile lck = new LockFile(p);
if (!lck.lock())
throw new ObjectWritingException("Can't write " + p);
try {
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
index e2f93f4814..8cfcba9113 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
@@ -235,7 +235,7 @@ class RebuildCommitGraph extends TextBuiltin {
final ObjectId id = db.resolve(Constants.HEAD);
if (!ObjectId.isId(head) && id != null) {
final LockFile lf;
- lf = new LockFile(new File(db.getDirectory(), Constants.HEAD), db.getFS());
+ lf = new LockFile(new File(db.getDirectory(), Constants.HEAD));
if (!lf.lock())
throw new IOException(MessageFormat.format(CLIText.get().cannotLock, Constants.HEAD));
lf.write(id);
@@ -263,7 +263,7 @@ class RebuildCommitGraph extends TextBuiltin {
protected void writeFile(final String name, final byte[] content)
throws IOException {
final File file = new File(db.getDirectory(), name);
- final LockFile lck = new LockFile(file, db.getFS());
+ final LockFile lck = new LockFile(file);
if (!lck.lock())
throw new ObjectWritingException(MessageFormat.format(CLIText.get().cantWrite, file));
try {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java
index fa40458f34..48ea13b98a 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java
@@ -118,7 +118,7 @@ public class GcPackRefsTest extends GcTestCase {
tr.lightweightTag("t1", a);
tr.lightweightTag("t2", a);
LockFile refLock = new LockFile(new File(repo.getDirectory(),
- "refs/tags/t1"), repo.getFS());
+ "refs/tags/t1"));
try {
refLock.lock();
gc.packRefs();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/LockFileTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/LockFileTest.java
index 520721b6aa..f1bc7c8f64 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/LockFileTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/LockFileTest.java
@@ -71,7 +71,7 @@ public class LockFileTest extends RepositoryTestCase {
git.add().addFilepattern("file.txt").call();
assertNotNull(git.commit().setMessage("edit file").call());
- LockFile lf = new LockFile(db.getIndexFile(), db.getFS());
+ LockFile lf = new LockFile(db.getIndexFile());
assertTrue(lf.lock());
try {
git.checkout().setName(commit1.name()).call();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java
index 48434189e4..7adf074216 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java
@@ -581,14 +581,13 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
RefUpdate updateRef = db.updateRef("refs/heads/master");
updateRef.setNewObjectId(pid);
LockFile lockFile1 = new LockFile(new File(db.getDirectory(),
- "refs/heads/master"), db.getFS());
+ "refs/heads/master"));
try {
assertTrue(lockFile1.lock()); // precondition to test
Result update = updateRef.update();
assertEquals(Result.LOCK_FAILURE, update);
assertEquals(opid, db.resolve("refs/heads/master"));
- LockFile lockFile2 = new LockFile(new File(db.getDirectory(),"refs/heads/master"),
- db.getFS());
+ LockFile lockFile2 = new LockFile(new File(db.getDirectory(),"refs/heads/master"));
assertFalse(lockFile2.lock()); // was locked, still is
} finally {
lockFile1.unlock();
@@ -731,8 +730,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
"logs/" + fromName).exists());
// "someone" has branch X locked
- LockFile lockFile = new LockFile(new File(db.getDirectory(), toLock),
- db.getFS());
+ LockFile lockFile = new LockFile(new File(db.getDirectory(), toLock));
try {
assertTrue(lockFile.lock());
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
index ecdfe823a8..b9101c028c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
@@ -344,9 +344,6 @@ public class DirCache {
/** Our active lock (if we hold it); null if we don't have it locked. */
private LockFile myLock;
- /** file system abstraction **/
- private final FS fs;
-
/** Keep track of whether the index has changed or not */
private FileSnapshot snapshot;
@@ -376,7 +373,6 @@ public class DirCache {
*/
public DirCache(final File indexLocation, final FS fs) {
liveFile = indexLocation;
- this.fs = fs;
clear();
}
@@ -611,7 +607,7 @@ public class DirCache {
public boolean lock() throws IOException {
if (liveFile == null)
throw new IOException(JGitText.get().dirCacheDoesNotHaveABackingFile);
- final LockFile tmp = new LockFile(liveFile, fs);
+ final LockFile tmp = new LockFile(liveFile);
if (tmp.lock()) {
tmp.setNeedStatInformation(true);
myLock = tmp;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
index 62d2d6969f..b02efedea3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
@@ -354,7 +354,7 @@ public class FileRepository extends Repository {
ConfigConstants.CONFIG_KEY_WORKTREE, getWorkTree()
.getAbsolutePath());
LockFile dotGitLockFile = new LockFile(new File(workTree,
- Constants.DOT_GIT), getFS());
+ Constants.DOT_GIT));
try {
if (dotGitLockFile.lock()) {
dotGitLockFile.write(Constants.encode(Constants.GITDIR
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java
index b671b03412..a433dec545 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java
@@ -53,7 +53,6 @@ import org.eclipse.jgit.util.FileUtils;
/** Keeps track of a {@link PackFile}'s associated <code>.keep</code> file. */
public class PackLock {
private final File keepFile;
- private final FS fs;
/**
* Create a new lock for a pack file.
@@ -67,7 +66,6 @@ public class PackLock {
final File p = packFile.getParentFile();
final String n = packFile.getName();
keepFile = new File(p, n.substring(0, n.length() - 5) + ".keep"); //$NON-NLS-1$
- this.fs = fs;
}
/**
@@ -84,7 +82,7 @@ public class PackLock {
return false;
if (!msg.endsWith("\n")) //$NON-NLS-1$
msg += "\n"; //$NON-NLS-1$
- final LockFile lf = new LockFile(keepFile, fs);
+ final LockFile lf = new LockFile(keepFile);
if (!lf.lock())
return false;
lf.write(Constants.encode(msg));
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
index 2c8e5f9d11..b8c2fb4a51 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
@@ -588,8 +588,7 @@ public class RefDirectory extends RefDatabase {
// we don't miss an edit made externally.
final PackedRefList packed = getPackedRefs();
if (packed.contains(name)) {
- LockFile lck = new LockFile(packedRefsFile,
- update.getRepository().getFS());
+ LockFile lck = new LockFile(packedRefsFile);
if (!lck.lock())
throw new LockFailedException(packedRefsFile);
try {
@@ -639,7 +638,7 @@ public class RefDirectory extends RefDatabase {
FS fs = parent.getFS();
// Lock the packed refs file and read the content
- LockFile lck = new LockFile(packedRefsFile, fs);
+ LockFile lck = new LockFile(packedRefsFile);
if (!lck.lock())
throw new IOException(MessageFormat.format(
JGitText.get().cannotLock, packedRefsFile));
@@ -670,8 +669,7 @@ public class RefDirectory extends RefDatabase {
File refFile = fileFor(refName);
if (!fs.exists(refFile))
continue;
- LockFile rLck = new LockFile(refFile,
- parent.getFS());
+ LockFile rLck = new LockFile(refFile);
if (!rLck.lock())
continue;
try {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java
index 7858ee1405..0d16f79ea1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java
@@ -79,7 +79,7 @@ class RefDirectoryUpdate extends RefUpdate {
if (deref)
dst = dst.getLeaf();
String name = dst.getName();
- lock = new LockFile(database.fileFor(name), getRepository().getFS());
+ lock = new LockFile(database.fileFor(name));
if (lock.lock()) {
dst = database.getRef(name);
setOldObjectId(dst != null ? dst.getObjectId() : null);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
index 29c7f98411..702fd70765 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
@@ -74,8 +74,6 @@ import org.eclipse.jgit.util.RawParseUtils;
public class FileBasedConfig extends StoredConfig {
private final File configFile;
- private final FS fs;
-
private boolean utf8Bom;
private volatile FileSnapshot snapshot;
@@ -109,7 +107,6 @@ public class FileBasedConfig extends StoredConfig {
public FileBasedConfig(Config base, File cfgLocation, FS fs) {
super(base);
configFile = cfgLocation;
- this.fs = fs;
this.snapshot = FileSnapshot.DIRTY;
this.hash = ObjectId.zeroId();
}
@@ -203,7 +200,7 @@ public class FileBasedConfig extends StoredConfig {
out = Constants.encode(text);
}
- final LockFile lf = new LockFile(getFile(), fs);
+ final LockFile lf = new LockFile(getFile());
if (!lf.lock())
throw new LockFailedException(getFile());
try {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
index c4b3f83048..8cb36c7918 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
@@ -314,8 +314,7 @@ class FetchProcess {
File meta = transport.local.getDirectory();
if (meta == null)
return;
- final LockFile lock = new LockFile(new File(meta, "FETCH_HEAD"), //$NON-NLS-1$
- transport.local.getFS());
+ final LockFile lock = new LockFile(new File(meta, "FETCH_HEAD")); //$NON-NLS-1$
try {
if (lock.lock()) {
final Writer w = new OutputStreamWriter(lock.getOutputStream());