import java.net.URISyntaxException;
import java.net.URL;
-import org.eclipse.jgit.internal.storage.file.FileRepository;
+import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.RawParseUtils;
return JGitTestUtil.class.getClassLoader();
}
- public static File writeTrashFile(final FileRepository db,
+ public static File writeTrashFile(final Repository db,
final String name, final String data) throws IOException {
File path = new File(db.getWorkTree(), name);
write(path, data);
return path;
}
- public static File writeTrashFile(final FileRepository db,
+ public static File writeTrashFile(final Repository db,
final String subdir,
final String name, final String data) throws IOException {
File path = new File(db.getWorkTree() + "/" + subdir, name);
return new String(body, 0, body.length, "UTF-8");
}
- public static String read(final FileRepository db, final String name)
+ public static String read(final Repository db, final String name)
throws IOException {
File file = new File(db.getWorkTree(), name);
return read(file);
}
- public static void deleteTrashFile(final FileRepository db,
+ public static void deleteTrashFile(final Repository db,
final String name) throws IOException {
File path = new File(db.getWorkTree(), name);
FileUtils.delete(path);
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.util.FileUtils;
builder.setWorkTree(dir);
builder.setMustExist(true);
- FileRepository repo2 = builder.build();
+ Repository repo2 = builder.build();
assertEquals(repo1.getDirectory(), repo2.getDirectory());
assertEquals(dir, repo2.getWorkTree());
FileRepositoryBuilder builder = new FileRepositoryBuilder();
builder.setWorkTree(dir);
builder.setMustExist(true);
- FileRepository repo2 = builder.build();
+ Repository repo2 = builder.build();
assertEquals(repo1.getDirectory(), repo2.getDirectory());
assertEquals(dir, repo2.getWorkTree());
builder.findGitDir(dir);
assertEquals(repo1.getDirectory(), builder.getGitDir());
builder.setMustExist(true);
- FileRepository repo2 = builder.build();
+ Repository repo2 = builder.build();
assertEquals(repo1.getDirectory(), repo2.getDirectory());
assertEquals(dir, repo2.getWorkTree());
@Test
public void testNotBare_CreateRepositoryFromWorkDirOnly() throws Exception {
File workdir = getFile("workdir", "repo");
- FileRepository repo = new FileRepositoryBuilder().setWorkTree(workdir).build();
+ Repository repo = new FileRepositoryBuilder().setWorkTree(workdir)
+ .build();
assertFalse(repo.isBare());
assertWorkdirPath(repo, "workdir", "repo");
assertGitdirPath(repo, "workdir", "repo", Constants.DOT_GIT);
public void testWorkdirIsDotGit_CreateRepositoryFromWorkDirOnly()
throws Exception {
File workdir = getFile("workdir", "repo");
- FileRepository repo = new FileRepositoryBuilder().setWorkTree(workdir).build();
+ Repository repo = new FileRepositoryBuilder().setWorkTree(workdir)
+ .build();
assertGitdirPath(repo, "workdir", "repo", Constants.DOT_GIT);
}
File gitDir = getFile("workdir", "repoWithConfig");
File workTree = getFile("workdir", "treeRoot");
setWorkTree(gitDir, workTree);
- FileRepository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
+ Repository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
assertFalse(repo.isBare());
assertWorkdirPath(repo, "workdir", "treeRoot");
assertGitdirPath(repo, "workdir", "repoWithConfig");
throws Exception {
File gitDir = getFile("workdir", "repoWithConfig");
setBare(gitDir, true);
- FileRepository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
+ Repository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
assertTrue(repo.isBare());
}
throws Exception {
File gitDir = getFile("workdir", "repoWithBareConfigTrue", "child");
setBare(gitDir, false);
- FileRepository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
+ Repository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
assertWorkdirPath(repo, "workdir", "repoWithBareConfigTrue");
}
throws Exception {
File gitDir = getFile("workdir", "repoWithBareConfigFalse", "child");
setBare(gitDir, false);
- FileRepository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
+ Repository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
assertFalse(repo.isBare());
assertWorkdirPath(repo, "workdir", "repoWithBareConfigFalse");
assertGitdirPath(repo, "workdir", "repoWithBareConfigFalse", "child");
repo1initial.close();
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = new FileRepositoryBuilder().setGitDir(theDir)
- .build();
+ FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setGitDir(theDir).build();
assertEqualsPath(theDir, r.getDirectory());
assertEqualsPath(repo1Parent, r.getWorkTree());
assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
repo1initial.close();
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = new FileRepositoryBuilder().setGitDir(theDir)
- .setWorkTree(repo1Parent.getParentFile()).build();
+ FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setGitDir(theDir).setWorkTree(repo1Parent.getParentFile())
+ .build();
assertEqualsPath(theDir, r.getDirectory());
assertEqualsPath(repo1Parent.getParentFile(), r.getWorkTree());
assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
repo1initial.close();
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = new FileRepositoryBuilder().setWorkTree(repo1Parent)
- .build();
+ FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setWorkTree(repo1Parent).build();
assertEqualsPath(theDir, r.getDirectory());
assertEqualsPath(repo1Parent, r.getWorkTree());
assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
repo1initial.close();
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = new FileRepositoryBuilder().setGitDir(theDir)
- .build();
+ FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setGitDir(theDir).build();
assertEqualsPath(theDir, r.getDirectory());
assertEqualsPath(workdir, r.getWorkTree());
assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
repo1initial.close();
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = new FileRepositoryBuilder().setGitDir(theDir)
- .build();
+ FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setGitDir(theDir).build();
assertEqualsPath(theDir, r.getDirectory());
assertEqualsPath(workdir, r.getWorkTree());
assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
repo1initial.close();
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = new FileRepositoryBuilder() //
+ FileRepository r = (FileRepository) new FileRepositoryBuilder() //
.setGitDir(theDir).setObjectDirectory(objDir) //
.addAlternateObjectDirectory(altObjDir) //
.setIndexFile(indexFile) //
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.lib.BaseRepositoryBuilder;
+import org.eclipse.jgit.lib.Repository;
/**
* Constructs a {@link FileRepository}.
* </pre>
*/
public class FileRepositoryBuilder extends
- BaseRepositoryBuilder<FileRepositoryBuilder, FileRepository> {
+ BaseRepositoryBuilder<FileRepositoryBuilder, Repository> {
/**
* Create a repository matching the configuration in this builder.
* <p>
* the builder's parameters.
*/
@Override
- public FileRepository build() throws IOException {
+ public Repository build() throws IOException {
FileRepository repo = new FileRepository(setup());
if (isMustExist() && !repo.getObjectDatabase().exists())
throw new RepositoryNotFoundException(getGitDir());