本文整理了Java中org.eclipse.jgit.lib.Repository.getObjectDatabase
方法的一些代码示例,展示了Repository.getObjectDatabase
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.getObjectDatabase
方法的具体详情如下:
包路径:org.eclipse.jgit.lib.Repository
类名称:Repository
方法名:getObjectDatabase
[英]Get the object database which stores this repository's data.
[中]获取存储此存储库数据的对象数据库。
代码示例来源:origin: jphp-group/jphp
@Signature
public boolean isExists() throws IOException {
return getWrappedObject().getRepository().getObjectDatabase().exists();
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
RemotePack(WalkRemoteObjectDatabase c, String pn) {
connection = c;
packName = pn;
idxName = packName.substring(0, packName.length() - 5) + ".idx"; //$NON-NLS-1$
String tn = idxName;
if (tn.startsWith("pack-")) //$NON-NLS-1$
tn = tn.substring(5);
if (tn.endsWith(".idx")) //$NON-NLS-1$
tn = tn.substring(0, tn.length() - 4);
if (local.getObjectDatabase() instanceof ObjectDirectory) {
tmpIdx = new File(((ObjectDirectory) local.getObjectDatabase())
.getDirectory(),
"walk-" + tn + ".walkidx"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
/**
* Whether the specified object is stored in this repo or any of the known
* shared repositories.
*
* @param objectId
* a {@link org.eclipse.jgit.lib.AnyObjectId} object.
* @return true if the specified object is stored in this repo or any of the
* known shared repositories.
*/
public boolean hasObject(AnyObjectId objectId) {
try {
return getObjectDatabase().has(objectId);
} catch (IOException e) {
// Legacy API, assume error means "no"
return false;
}
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
/**
* Create a new inserter to create objects in {@link #getObjectDatabase()}.
*
* @return a new inserter to create objects in {@link #getObjectDatabase()}.
*/
@NonNull
public ObjectInserter newObjectInserter() {
return getObjectDatabase().newInserter();
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
/**
* Create a new reader to read objects from {@link #getObjectDatabase()}.
*
* @return a new reader to read objects from {@link #getObjectDatabase()}.
*/
@NonNull
public ObjectReader newObjectReader() {
return getObjectDatabase().newReader();
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
/**
* Open an object from this repository.
* <p>
* This is a one-shot call interface which may be faster than allocating a
* {@link #newObjectReader()} to perform the lookup.
*
* @param objectId
* identity of the object to open.
* @return a {@link org.eclipse.jgit.lib.ObjectLoader} for accessing the
* object.
* @throws org.eclipse.jgit.errors.MissingObjectException
* the object does not exist.
* @throws java.io.IOException
* the object store cannot be accessed.
*/
@NonNull
public ObjectLoader open(AnyObjectId objectId)
throws MissingObjectException, IOException {
return getObjectDatabase().open(objectId);
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
/**
* Invoked when the use count drops to zero during {@link #close()}.
* <p>
* The default implementation closes the object and ref databases.
*/
protected void doClose() {
getObjectDatabase().close();
getRefDatabase().close();
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
/**
* Open an object from this repository.
* <p>
* This is a one-shot call interface which may be faster than allocating a
* {@link #newObjectReader()} to perform the lookup.
*
* @param objectId
* identity of the object to open.
* @param typeHint
* hint about the type of object being requested, e.g.
* {@link org.eclipse.jgit.lib.Constants#OBJ_BLOB};
* {@link org.eclipse.jgit.lib.ObjectReader#OBJ_ANY} if the
* object type is not known, or does not matter to the caller.
* @return a {@link org.eclipse.jgit.lib.ObjectLoader} for accessing the
* object.
* @throws org.eclipse.jgit.errors.MissingObjectException
* the object does not exist.
* @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* typeHint was not OBJ_ANY, and the object's actual type does
* not match typeHint.
* @throws java.io.IOException
* the object store cannot be accessed.
*/
@NonNull
public ObjectLoader open(AnyObjectId objectId, int typeHint)
throws MissingObjectException, IncorrectObjectTypeException,
IOException {
return getObjectDatabase().open(objectId, typeHint);
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
private void checkSubmodules()
throws IOException {
ObjectDatabase odb = db.getObjectDatabase();
if (objectChecker == null) {
return;
}
for (GitmoduleEntry entry : objectChecker.getGitsubmodules()) {
AnyObjectId blobId = entry.getBlobId();
ObjectLoader blob = odb.open(blobId, Constants.OBJ_BLOB);
try {
SubmoduleValidator.assertValidGitModulesFile(
new String(blob.getBytes(), UTF_8));
} catch (LargeObjectException | SubmoduleValidationException e) {
throw new IOException(e);
}
}
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
/**
* Create a repository matching the configuration in this builder.
* <p>
* If an option was not set, the build method will try to default the option
* based on other options. If insufficient information is available, an
* exception is thrown to the caller.
*
* @return a repository matching this configuration. The caller is
* responsible to close the repository instance when it is no longer
* needed.
* @throws java.lang.IllegalArgumentException
* insufficient parameters were set.
* @throws java.io.IOException
* the repository could not be accessed to configure the rest of
* the builder's parameters.
*/
@SuppressWarnings({ "unchecked", "resource" })
public R build() throws IOException {
R repo = (R) new FileRepository(setup());
if (isMustExist() && !repo.getObjectDatabase().exists())
throw new RepositoryNotFoundException(getGitDir());
return repo;
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
CheckoutConflictException, IndexWriteException, CanceledException {
toBeDeleted.clear();
try (ObjectReader objectReader = repo.getObjectDatabase().newReader()) {
if (headCommitTree != null)
preScanTwoTrees();
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
if (!repository.getObjectDatabase().exists())
repository.create(bare);
return new Git(repository, true);
代码示例来源:origin: sonia.jgit/org.eclipse.jgit
/** @return a new inserter to create objects in {@link #getObjectDatabase()} */
@NonNull
public ObjectInserter newObjectInserter() {
return getObjectDatabase().newInserter();
}
代码示例来源:origin: com.madgag/org.eclipse.jgit.http.server
private static File objects(final HttpServletRequest req) {
final Repository db = getRepository(req);
return ((ObjectDirectory) db.getObjectDatabase()).getDirectory();
}
}
代码示例来源:origin: sonia.jgit/org.eclipse.jgit.http.server
private static File objects(final HttpServletRequest req) {
final Repository db = getRepository(req);
return ((ObjectDirectory) db.getObjectDatabase()).getDirectory();
}
}
代码示例来源:origin: sonia.jgit/org.eclipse.jgit
/** @return a new reader to read objects from {@link #getObjectDatabase()} */
@NonNull
public ObjectReader newObjectReader() {
return getObjectDatabase().newReader();
}
代码示例来源:origin: berlam/github-bucket
/**
* Create a new inserter to create objects in {@link #getObjectDatabase()}.
*
* @return a new inserter to create objects in {@link #getObjectDatabase()}.
*/
@NonNull
public ObjectInserter newObjectInserter() {
return getObjectDatabase().newInserter();
}
代码示例来源:origin: org.sonarsource.scm.git/sonar-scm-git-plugin
private static Repository buildRepository(File basedir) {
try {
Repository repo = GitScmProvider.getVerifiedRepositoryBuilder(basedir.toPath()).build();
// SONARSCGIT-2 Force initialization of shallow commits to avoid later concurrent modification issue
repo.getObjectDatabase().newReader().getShallowCommits();
return repo;
} catch (IOException e) {
throw new IllegalStateException("Unable to open Git repository", e);
}
}
代码示例来源:origin: sonia.jgit/org.eclipse.jgit
/**
* Invoked when the use count drops to zero during {@link #close()}.
* <p>
* The default implementation closes the object and ref databases.
*/
protected void doClose() {
getObjectDatabase().close();
getRefDatabase().close();
}
代码示例来源:origin: berlam/github-bucket
/**
* Invoked when the use count drops to zero during {@link #close()}.
* <p>
* The default implementation closes the object and ref databases.
*/
protected void doClose() {
getObjectDatabase().close();
getRefDatabase().close();
}
内容来源于网络,如有侵权,请联系作者删除!