本文整理了Java中org.eclipse.jgit.dircache.DirCache.editor()
方法的一些代码示例,展示了DirCache.editor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DirCache.editor()
方法的具体详情如下:
包路径:org.eclipse.jgit.dircache.DirCache
类名称:DirCache
方法名:editor
DirCache.editor介绍
[英]Create a new editor to recreate this cache.
Callers should add commands to the editor, then use org.eclipse.jgit.dircache.DirCacheEditor#finish() to update this instance.
[中]创建新编辑器以重新创建此缓存。
调用者应该在编辑器中添加命令,然后使用org。日食jgit。迪尔卡奇。DirCacheEditor#finish()更新此实例。
代码示例
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
DirCacheEditor editor = dc.editor();
while (treeWalk.next()) {
String path = treeWalk.getPathString();
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
DirCacheEditor editor = dc.editor();
String certText = pc.cert.toText() + pc.cert.getSignature();
final ObjectId certId = inserter.insert(OBJ_BLOB, certText.getBytes(UTF_8));
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
DirCacheEditor ed = contents.editor();
for (Command cmd : cmdList) {
if (!isValidRef(cmd)) {
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
private void checkoutPathsFromCommit(TreeWalk treeWalk, DirCache dc,
RevCommit commit) throws IOException {
treeWalk.addTree(commit.getTree());
final ObjectReader r = treeWalk.getObjectReader();
DirCacheEditor editor = dc.editor();
while (treeWalk.next()) {
final ObjectId blobId = treeWalk.getObjectId(0);
final FileMode mode = treeWalk.getFileMode(0);
final EolStreamType eolStreamType = treeWalk
.getEolStreamType(CHECKOUT_OP);
final String filterCommand = treeWalk
.getFilterCommand(Constants.ATTR_FILTER_TYPE_SMUDGE);
final String path = treeWalk.getPathString();
editor.add(new PathEdit(path) {
@Override
public void apply(DirCacheEntry ent) {
ent.setObjectId(blobId);
ent.setFileMode(mode);
checkoutPath(ent, r,
new CheckoutMetadata(eolStreamType, filterCommand));
actuallyModifiedPaths.add(path);
}
});
}
editor.commit();
}
代码示例来源:origin: com.beijunyi.parallelgit/parallelgit-utils
public static void deleteDirectory(@Nonnull String path, @Nonnull DirCache cache) {
DirCacheEditor editor = cache.editor();
deleteDirectory(path, editor);
editor.finish();
}
代码示例来源:origin: com.beijunyi.parallelgit/parallelgit-utils
public static void deleteFile(@Nonnull String path, @Nonnull DirCache cache) {
DirCacheEditor editor = cache.editor();
deleteFile(path, editor);
editor.finish();
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
DirCacheEditor editor = cache.editor();
for (PathEdit edit : wtEdits)
editor.add(edit);
代码示例来源:origin: line/centraldogma
private static void applyPathEdit(DirCache dirCache, PathEdit edit) {
final DirCacheEditor e = dirCache.editor();
e.add(edit);
e.finish();
}
代码示例来源:origin: com.beijunyi/parallelgit-utils
public static void deleteFile(String path, DirCache cache) {
DirCacheEditor editor = cache.editor();
deleteFile(path, editor);
editor.finish();
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server
private static void applyPathEdit(DirCache dirCache, PathEdit edit) {
final DirCacheEditor e = dirCache.editor();
e.add(edit);
e.finish();
}
代码示例来源:origin: com.beijunyi/parallelgit-utils
public static void deleteDirectory(String path, DirCache cache) {
DirCacheEditor editor = cache.editor();
deleteDirectory(path, editor);
editor.finish();
}
代码示例来源:origin: com.beijunyi/parallelgit-utils
public static void updateFile(CacheEntryUpdate update, DirCache cache) {
DirCacheEditor editor = cache.editor();
updateFile(update, editor);
editor.finish();
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server-shaded
private static void applyPathEdit(DirCache dirCache, PathEdit edit) {
final DirCacheEditor e = dirCache.editor();
e.add(edit);
e.finish();
}
代码示例来源:origin: beijunyi/ParallelGit
public static void deleteFile(String path, DirCache cache) {
DirCacheEditor editor = cache.editor();
deleteFile(path, editor);
editor.finish();
}
代码示例来源:origin: beijunyi/ParallelGit
public static void deleteDirectory(String path, DirCache cache) {
DirCacheEditor editor = cache.editor();
deleteDirectory(path, editor);
editor.finish();
}
代码示例来源:origin: beijunyi/ParallelGit
public static void updateFile(CacheEntryUpdate update, DirCache cache) {
DirCacheEditor editor = cache.editor();
updateFile(update, editor);
editor.finish();
}
代码示例来源:origin: kiegroup/appformer
public Optional execute() {
final DirCacheEditor editor = DirCache.newInCore().editor();
try {
iterateOverTreeWalk(git,
headId,
(walkPath, hTree) -> {
addToTemporaryInCoreIndex(editor,
new DirCacheEntry(walkPath),
hTree.getEntryObjectId(),
hTree.getEntryFileMode());
});
editor.finish();
} catch (final Exception e) {
throw new RuntimeException(e);
}
return buildTree(editor);
}
}
代码示例来源:origin: org.uberfire/uberfire-nio2-jgit
private void mergeCommit(final Git origin,
final String targetBranchName,
final String sourceBranchName,
final TestFile... testFiles) throws Exception {
final Repository repo = origin.getRepository();
final org.eclipse.jgit.api.Git git = org.eclipse.jgit.api.Git.wrap(repo);
final ObjectId targetId = repo.resolve(targetBranchName);
final ObjectId sourceId = repo.resolve(sourceBranchName);
final DirCache dc = DirCache.newInCore();
final DirCacheEditor editor = dc.editor();
try (ObjectInserter inserter = repo.newObjectInserter()) {
final ObjectId treeId = writeTestFilesToTree(dc, editor, inserter, testFiles);
final ObjectId commitId = writeCommit(inserter, treeId, targetId, sourceId);
updateBranch(targetBranchName, git, commitId);
}
}
代码示例来源:origin: kiegroup/appformer
private void mergeCommit(final Git origin,
final String targetBranchName,
final String sourceBranchName,
final TestFile... testFiles) throws Exception {
final Repository repo = origin.getRepository();
final org.eclipse.jgit.api.Git git = org.eclipse.jgit.api.Git.wrap(repo);
final ObjectId targetId = repo.resolve(targetBranchName);
final ObjectId sourceId = repo.resolve(sourceBranchName);
final DirCache dc = DirCache.newInCore();
final DirCacheEditor editor = dc.editor();
try (ObjectInserter inserter = repo.newObjectInserter()) {
final ObjectId treeId = writeTestFilesToTree(dc, editor, inserter, testFiles);
final ObjectId commitId = writeCommit(inserter, treeId, targetId, sourceId);
updateBranch(targetBranchName, git, commitId);
}
}
代码示例来源:origin: beijunyi/ParallelGit
@Test
public void deleteMultipleTreesTest() {
DirCache cache = setupCache("a/b/c1.txt",
"a/b/c2.txt",
"a/d/c3.txt",
"a/d/c4.txt",
"a/c5.txt",
"a/c6.txt");
DirCacheEditor editor = cache.editor();
CacheUtils.deleteDirectory("a/b", editor);
CacheUtils.deleteDirectory("a/d", editor);
editor.finish();
assertEquals(2, cache.getEntryCount());
assertNotNull(cache.getEntry("a/c5.txt"));
assertNotNull(cache.getEntry("a/c6.txt"));
}