当前位置: 首页>>代码示例>>Java>>正文


Java Git.wrap方法代码示例

本文整理汇总了Java中org.eclipse.jgit.api.Git.wrap方法的典型用法代码示例。如果您正苦于以下问题:Java Git.wrap方法的具体用法?Java Git.wrap怎么用?Java Git.wrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.api.Git的用法示例。


在下文中一共展示了Git.wrap方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: pull

import org.eclipse.jgit.api.Git; //导入方法依赖的package包/类
@SneakyThrows
protected void pull() {
    try (
            Repository db = createRepository();
            Git git = Git.wrap(db);
    ) {
        String branchName = gitProperties.getBranchName();
        try {
            git.checkout().setName(branchName).call();
            git.pull().setCredentialsProvider(createCredentialsProvider()).call();
        } catch (RefNotFoundException e) {
            log.info("Branch {} not found in local repository", branchName);
            git.fetch().setCredentialsProvider(createCredentialsProvider()).call();
            git.checkout()
                    .setCreateBranch(true)
                    .setName(branchName)
                    .setUpstreamMode(TRACK)
                    .setStartPoint(DEFAULT_REMOTE_NAME + "/" + branchName).
                    call();
            git.pull().setCredentialsProvider(createCredentialsProvider()).call();
        }
    }
}
 
开发者ID:xm-online,项目名称:xm-ms-config,代码行数:24,代码来源:JGitRepository.java

示例2: initGitRepo

import org.eclipse.jgit.api.Git; //导入方法依赖的package包/类
@Before
public void initGitRepo() throws Exception {
    gitWorkTree = new File(gitRepoDir.getRoot(), testName.getMethodName()).getAbsoluteFile();
    final Repository gitRepo = new FileRepositoryBuilder().setWorkTree(gitWorkTree).build();
    gitRepo.create();
    git = Git.wrap(gitRepo);
    gitUri = "git+file://" +
             (gitWorkTree.getPath().startsWith(File.separator) ? "" : "/") +
             gitWorkTree.getPath().replace(File.separatorChar, '/') +
             "/.git";

    // Start the master branch with an empty commit.
    git.commit().setMessage("Initial commit").call();
}
 
开发者ID:line,项目名称:centraldogma,代码行数:15,代码来源:GitMirrorTest.java

示例3: checkoutAllBranches

import org.eclipse.jgit.api.Git; //导入方法依赖的package包/类
private void checkoutAllBranches(Repository repository) throws GitAPIException {
    final Git git = Git.wrap(repository);
    for (final Ref ref : git.branchList().setListMode(ListBranchCommand.ListMode.REMOTE).call()) {
        final String refName = ref.getName();
        final String branchName = refName.substring(refName.lastIndexOf('/') + 1);
        try {
            git.checkout().setCreateBranch(true).setName(branchName).setStartPoint("origin/" + branchName).call();
        } catch (RefAlreadyExistsException e) {
            LOGGER.warning("Already exists, so ignoring " + e.getMessage());
        }
    }
}
 
开发者ID:arquillian,项目名称:smart-testing,代码行数:13,代码来源:GitCloner.java

示例4: createNewFileAndPush

import org.eclipse.jgit.api.Git; //导入方法依赖的package包/类
private void createNewFileAndPush(Repository repository, String newFile, String content, String commitMessage)
    throws IOException, GitAPIException {
    final File root = repository.getDirectory().getParentFile();
    Files.write(Paths.get(root.getPath(), newFile), content.getBytes());
    final Git git = Git.wrap(repository);
    git.add().addFilepattern(".").call();
    git.commit().setMessage(commitMessage).call();
    git.push().call();
}
 
开发者ID:arquillian,项目名称:smart-testing,代码行数:10,代码来源:EmbeddedHttpGitServerTest.java

示例5: commitAndPush

import org.eclipse.jgit.api.Git; //导入方法依赖的package包/类
@SneakyThrows
protected void commitAndPush(String commitMsg) {
    try (
            Repository db = createRepository();
            Git git = Git.wrap(db);
    ) {
        git.add().addFilepattern(".").call();
        git.commit().setAll(true).setMessage(commitMsg).call();
        git.push().setCredentialsProvider(createCredentialsProvider()).call();
    }
}
 
开发者ID:xm-online,项目名称:xm-ms-config,代码行数:12,代码来源:JGitRepository.java

示例6: getWorkingFileRepository

import org.eclipse.jgit.api.Git; //导入方法依赖的package包/类
private Git getWorkingFileRepository() throws GitAPIException {
    // Check for existing repo
    if (config.getWorkingFileRepository().getObjectDatabase().exists()) {
        return Git.wrap(config.getWorkingFileRepository());
    }
    // Clone new repo
    return config.configure(pushRepository.clone(Git.cloneRepository())).setBare(true).call();
}
 
开发者ID:berlam,项目名称:github-bucket,代码行数:9,代码来源:Worker.java

示例7: git

import org.eclipse.jgit.api.Git; //导入方法依赖的package包/类
public Git git() {
	return Git.wrap(getRepository()); 
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:4,代码来源:Project.java

示例8: setSubmodule

import org.eclipse.jgit.api.Git; //导入方法依赖的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


注:本文中的org.eclipse.jgit.api.Git.wrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。