本文整理汇总了Java中org.eclipse.jgit.lib.RepositoryCache.open方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryCache.open方法的具体用法?Java RepositoryCache.open怎么用?Java RepositoryCache.open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.lib.RepositoryCache
的用法示例。
在下文中一共展示了RepositoryCache.open方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRepository
import org.eclipse.jgit.lib.RepositoryCache; //导入方法依赖的package包/类
/**
* Returns the JGit repository for the specified name.
*
* @param repositoryName
* @param logError
* @return repository or null
*/
public Repository getRepository(String repositoryName, boolean logError) {
if (isCollectingGarbage(repositoryName)) {
logger.warn(MessageFormat.format("Rejecting request for {0}, busy collecting garbage!", repositoryName));
return null;
}
File dir = FileKey.resolve(new File(repositoriesFolder, repositoryName), FS.DETECTED);
if (dir == null)
return null;
Repository r = null;
try {
FileKey key = FileKey.exact(dir, FS.DETECTED);
r = RepositoryCache.open(key, true);
} catch (IOException e) {
if (logError) {
logger.error("GitBlit.getRepository(String) failed to find "
+ new File(repositoriesFolder, repositoryName).getAbsolutePath());
}
}
return r;
}
示例2: Init
import org.eclipse.jgit.lib.RepositoryCache; //导入方法依赖的package包/类
/** 초기화 메서드
* @param creatorName
* @param repositoryName
*/
public void Init(String creatorName, String repositoryName) {
try {
this.path = gitPath + creatorName + "/" + repositoryName
+ ".git";
this.localRepo = RepositoryCache.open(RepositoryCache.FileKey
.lenient(new File(this.path), FS.DETECTED), true);
this.git = new Git(localRepo);
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
示例3: createRepository
import org.eclipse.jgit.lib.RepositoryCache; //导入方法依赖的package包/类
private void createRepository(Path directory, Project.NameKey projectName) throws IOException {
String n = projectName.get() + Constants.DOT_GIT_EXT;
FileKey loc = FileKey.exact(directory.resolve(n).toFile(), FS.DETECTED);
try (Repository db = RepositoryCache.open(loc, false)) {
db.create(true /* bare */);
}
}
示例4: createRepository
import org.eclipse.jgit.lib.RepositoryCache; //导入方法依赖的package包/类
private void createRepository(Path directory, String projectName) throws IOException {
String n = projectName + Constants.DOT_GIT_EXT;
FileKey loc = FileKey.exact(directory.resolve(n).toFile(), FS.DETECTED);
try (Repository db = RepositoryCache.open(loc, false)) {
db.create(true /* bare */);
}
}
示例5: openRepoFor
import org.eclipse.jgit.lib.RepositoryCache; //导入方法依赖的package包/类
public static Repository openRepoFor(File gitdir) {
try {
Repository repo = RepositoryCache.open(FileKey.lenient(gitdir, FS.DETECTED), false);
Log.d("REPO", "Opened " + describe(repo));
return repo;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例6: openRepository
import org.eclipse.jgit.lib.RepositoryCache; //导入方法依赖的package包/类
@Override
public Repository openRepository(GitUser user, GitRepository repo, boolean mustExist) throws IOException {
if (user == null) {
if (!repo.isPublicRead()) {
return null;
}
} else {
if (!user.canAccess(repo)) {
return null;
}
}
final CloudKey loc = new CloudKey(repo, this);
return RepositoryCache.open(loc, mustExist);
}