List of usage examples for org.eclipse.jgit.submodule SubmoduleWalk getRepository
public Repository getRepository() throws IOException
From source file:net.polydawn.mdm.MdmModuleRelease.java
License:Open Source License
public static MdmModuleRelease load(Repository parent, SubmoduleWalk generator, Config gitmodulesCfg) throws MdmRepositoryNonexistant, MdmRepositoryIOException, MdmModuleTypeException { try {//from www . j a v a 2 s . com return new MdmModuleRelease(generator.getRepository(), generator.getPath(), parent, gitmodulesCfg, generator.getObjectId()); } catch (IOException e) { throw new MdmRepositoryIOException(false, generator.getPath(), e); } }
From source file:org.gradle.vcs.fixtures.GitFileRepository.java
License:Apache License
/** * Updates any submodules in this repository to the latest in the submodule origin repository *//*from w ww. jav a 2 s . c o m*/ public RevCommit updateSubmodulesToLatest() throws GitAPIException { List<String> submodulePaths = Lists.newArrayList(); try { SubmoduleWalk walker = SubmoduleWalk.forIndex(git.getRepository()); try { while (walker.next()) { Repository submodule = walker.getRepository(); try { submodulePaths.add(walker.getPath()); Git.wrap(submodule).pull().call(); } finally { submodule.close(); } } } finally { walker.close(); } return commit("update submodules", submodulePaths.toArray(new String[submodulePaths.size()])); } catch (IOException e) { throw UncheckedException.throwAsUncheckedException(e); } }
From source file:org.gradle.vcs.git.internal.GitVersionControlSystem.java
License:Apache License
private static void updateSubModules(Git git) throws IOException, GitAPIException { SubmoduleWalk walker = SubmoduleWalk.forIndex(git.getRepository()); try {/*from w ww .j av a 2 s . co m*/ while (walker.next()) { Repository submodule = walker.getRepository(); try { Git submoduleGit = Git.wrap(submodule); submoduleGit.fetch().call(); git.submoduleUpdate().addPath(walker.getPath()).call(); submoduleGit.reset().setMode(ResetCommand.ResetType.HARD).call(); updateSubModules(submoduleGit); } finally { submodule.close(); } } } finally { walker.close(); } }