本文整理汇总了Java中org.eclipse.jgit.submodule.SubmoduleWalk类的典型用法代码示例。如果您正苦于以下问题:Java SubmoduleWalk类的具体用法?Java SubmoduleWalk怎么用?Java SubmoduleWalk使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SubmoduleWalk类属于org.eclipse.jgit.submodule包,在下文中一共展示了SubmoduleWalk类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: backup
import org.eclipse.jgit.submodule.SubmoduleWalk; //导入依赖的package包/类
public synchronized void backup() throws Exception {
repo.add().setUpdate(false).addFilepattern(".").call();
Status status = repo.status().setIgnoreSubmodules(SubmoduleWalk.IgnoreSubmoduleMode.ALL).call();
log.debug("status.getUncommittedChanges() = " + status.getUncommittedChanges());
if (!status.getUncommittedChanges().isEmpty()) {
for (String missingPath : status.getMissing()) {
repo.rm().addFilepattern(missingPath).call();
}
log.info("Changes detected in the following files: " + status.getUncommittedChanges());
repo.commit()
.setMessage("Backing up data dir")
.setAuthor("AppRunner BackupService", "[email protected]")
.call();
Iterable<PushResult> pushResults = repo.push().call();
for (PushResult pushResult : pushResults) {
log.info("Result of pushing to remote: " + pushResult.getRemoteUpdates());
}
} else {
log.info("No changes to back up");
}
}
开发者ID:danielflower,项目名称:app-runner,代码行数:24,代码来源:BackupService.java
示例2: cleanAllUnversionedFiles
import org.eclipse.jgit.submodule.SubmoduleWalk; //导入依赖的package包/类
@Override
public void cleanAllUnversionedFiles() {
Repository repository = null;
try {
repository = getRepository(workingDir);
Git git = new Git(repository);
SubmoduleWalk walk = SubmoduleWalk.forIndex(repository);
while (walk.next()) {
cleanSubmoduleOfAllUnversionedFiles(walk);
}
CleanCommand clean = git.clean().setCleanDirectories(true);
clean.call();
} catch (Exception e) {
throw new RuntimeException("clean failed", e);
} finally {
if (repository != null) {
repository.close();
}
}
}
开发者ID:gocd,项目名称:go-plugins,代码行数:23,代码来源:JGitHelper.java
示例3: checkoutAllModifiedFilesInSubmodules
import org.eclipse.jgit.submodule.SubmoduleWalk; //导入依赖的package包/类
@Override
public void checkoutAllModifiedFilesInSubmodules() {
Repository repository = null;
try {
repository = getRepository(workingDir);
SubmoduleWalk walk = SubmoduleWalk.forIndex(repository);
while (walk.next()) {
checkoutSubmodule(walk);
}
} catch (Exception e) {
throw new RuntimeException("checkout all sub-modules failed", e);
} finally {
if (repository != null) {
repository.close();
}
}
}
开发者ID:gocd,项目名称:go-plugins,代码行数:19,代码来源:JGitHelper.java
示例4: getSubModuleCommitCount
import org.eclipse.jgit.submodule.SubmoduleWalk; //导入依赖的package包/类
@Override
public int getSubModuleCommitCount(String subModuleFolder) {
Repository repository = null;
Repository subModuleRepository = null;
int count = 0;
try {
repository = getRepository(workingDir);
subModuleRepository = SubmoduleWalk.getSubmoduleRepository(repository, subModuleFolder);
Git git = new Git(subModuleRepository);
Iterable<RevCommit> log = git.log().call();
for (RevCommit commit : log) {
count++;
}
} catch (Exception e) {
throw new RuntimeException("sub-module commit count failed", e);
} finally {
if (repository != null) {
repository.close();
}
if (subModuleRepository != null) {
subModuleRepository.close();
}
}
return count;
}
开发者ID:gocd,项目名称:go-plugins,代码行数:26,代码来源:JGitHelper.java
示例5: getSubmodules
import org.eclipse.jgit.submodule.SubmoduleWalk; //导入依赖的package包/类
/** {@inheritDoc} */
public List<IndexEntry> getSubmodules(String treeIsh) throws GitException {
try (Repository repo = getRepository();
ObjectReader or = repo.newObjectReader();
RevWalk w = new RevWalk(or)) {
List<IndexEntry> r = new ArrayList<>();
RevTree t = w.parseTree(repo.resolve(treeIsh));
SubmoduleWalk walk = new SubmoduleWalk(repo);
walk.setTree(t);
walk.setRootTree(t);
while (walk.next()) {
r.add(new IndexEntry(walk));
}
return r;
} catch (IOException e) {
throw new GitException(e);
}
}
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:21,代码来源:JGitAPIImpl.java
示例6: cleanSubmoduleOfAllUnversionedFiles
import org.eclipse.jgit.submodule.SubmoduleWalk; //导入依赖的package包/类
private void cleanSubmoduleOfAllUnversionedFiles(SubmoduleWalk walk) {
Repository submoduleRepository = null;
try {
submoduleRepository = walk.getRepository();
CleanCommand clean = Git.wrap(submoduleRepository).clean().setCleanDirectories(true);
clean.call();
} catch (Exception e) {
throw new RuntimeException("sub-module clean failed", e);
} finally {
if (submoduleRepository != null) {
submoduleRepository.close();
}
}
}
开发者ID:gocd,项目名称:go-plugins,代码行数:15,代码来源:JGitHelper.java
示例7: checkoutSubmodule
import org.eclipse.jgit.submodule.SubmoduleWalk; //导入依赖的package包/类
private void checkoutSubmodule(SubmoduleWalk walk) {
Repository submoduleRepository = null;
try {
submoduleRepository = walk.getRepository();
CheckoutCommand checkout = Git.wrap(submoduleRepository).checkout();
checkout.call();
} catch (Exception e) {
throw new RuntimeException("sub-module checkout failed", e);
} finally {
if (submoduleRepository != null) {
submoduleRepository.close();
}
}
}
开发者ID:gocd,项目名称:go-plugins,代码行数:15,代码来源:JGitHelper.java
示例8: showGitlink
import org.eclipse.jgit.submodule.SubmoduleWalk; //导入依赖的package包/类
private void showGitlink(HttpServletRequest req, HttpServletResponse res, RevWalk rw,
TreeWalk tw, RevTree root, List<Boolean> hasSingleTree) throws IOException {
GitilesView view = ViewFilter.getView(req);
SubmoduleWalk sw = SubmoduleWalk.forPath(ServletUtils.getRepository(req), root,
view.getPathPart());
String modulesUrl;
String remoteUrl = null;
try {
modulesUrl = sw.getModulesUrl();
if (modulesUrl != null && (modulesUrl.startsWith("./") || modulesUrl.startsWith("../"))) {
String moduleRepo = Paths.simplifyPathUpToRoot(modulesUrl, view.getRepositoryName());
if (moduleRepo != null) {
modulesUrl = urls.getBaseGitUrl(req) + moduleRepo;
}
} else {
remoteUrl = sw.getRemoteUrl();
}
} catch (ConfigInvalidException e) {
throw new IOException(e);
} finally {
sw.release();
}
Map<String, Object> data = Maps.newHashMap();
data.put("sha", ObjectId.toString(tw.getObjectId(0)));
data.put("remoteUrl", remoteUrl != null ? remoteUrl : modulesUrl);
// TODO(dborowitz): Guess when we can put commit SHAs in the URL.
String httpUrl = resolveHttpUrl(remoteUrl);
if (httpUrl != null) {
data.put("httpUrl", httpUrl);
}
// TODO(sop): Allow caching links by SHA-1 when no S cookie is sent.
renderHtml(req, res, "gitiles.pathDetail", ImmutableMap.of(
"title", view.getPathPart(),
"type", FileType.GITLINK.toString(),
"data", data));
}
开发者ID:afrojer,项目名称:gitiles,代码行数:41,代码来源:PathServlet.java
示例9: setSubmodule
import org.eclipse.jgit.submodule.SubmoduleWalk; //导入依赖的package包/类
/**
* Sets the given submodule as the current repository
*
* @param submodule
* - the name of the submodule
* @throws IOException
* @throws GitAPIException
*/
public void setSubmodule(String submodule) throws IOException {
Repository parentRepository = git.getRepository();
Repository submoduleRepository = SubmoduleWalk.getSubmoduleRepository(parentRepository, submodule);
git = Git.wrap(submoduleRepository);
fireRepositoryChanged();
}
开发者ID:oxygenxml,项目名称:oxygen-git-plugin,代码行数:16,代码来源:GitAccess.java
示例10: IndexEntry
import org.eclipse.jgit.submodule.SubmoduleWalk; //导入依赖的package包/类
/**
* Populates an {@link hudson.plugins.git.IndexEntry} from the current node that {@link org.eclipse.jgit.submodule.SubmoduleWalk} is pointing to.
*
* @param walk a {@link org.eclipse.jgit.submodule.SubmoduleWalk} object.
*/
public IndexEntry(SubmoduleWalk walk) {
this("160000","commit",walk.getObjectId().name(),walk.getPath());
}
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:9,代码来源:IndexEntry.java
注:本文中的org.eclipse.jgit.submodule.SubmoduleWalk类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论