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


Java PullResult.isSuccessful方法代码示例

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


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

示例1: useLocalGitRepository

import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
protected Git useLocalGitRepository(Path repository) throws IOException {
    Git git;
    git = this.gitOperations.openGitRepository(repository);
    if (this.gitOperations.hasAtLeastOneReference(git.getRepository())) {

        final PullResult pullResult = executePull(git);

        if (!pullResult.isSuccessful()) {
            // Merge conflicts
            throw new IllegalArgumentException(
                "There are merge conflicts into an existing git repo. Provider should not deal with merge conflicts. Correct them or delete the repo and execute again the test.");
        }
    } else {
        throw new IllegalArgumentException(String.format("Git repository %s was not cloned correctly.",
            git.getRepository().getDirectory().getAbsolutePath()));
    }
    return git;
}
 
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:19,代码来源:GitContractsPublisher.java

示例2: doExecute

import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
@Override
public void doExecute() {
        try {
                PullCommand pullCommand = git.pull().setRebase(rebase);

                if (getProgressMonitor() != null) {
                        pullCommand.setProgressMonitor(getProgressMonitor());
                }

                setupCredentials(pullCommand);
                PullResult pullResult = pullCommand.call();

                if (!pullResult.isSuccessful()) {
                        FetchResult fetchResult = pullResult.getFetchResult();
                        GitTaskUtils.validateTrackingRefUpdates(MESSAGE_PULLED_FAILED, fetchResult.getTrackingRefUpdates());
                        MergeStatus mergeStatus = pullResult.getMergeResult().getMergeStatus();

                        if (!mergeStatus.isSuccessful()) {
                                throw new BuildException(String.format(MESSAGE_PULLED_FAILED_WITH_STATUS, mergeStatus.name()));
                        }
                }
        }
        catch (Exception e) {
                throw new GitBuildException(String.format(MESSAGE_PULLED_FAILED_WITH_URI, getUri()), e);
        }
}
 
开发者ID:rimerosolutions,项目名称:ant-git-tasks,代码行数:27,代码来源:PullTask.java

示例3: update

import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
private void update(Git git) throws GitAPIException {
    PullResult pullResult = git.pull().setRebase(true).call();
    RebaseResult rebaseResult = pullResult.getRebaseResult();

    if(!pullResult.isSuccessful()) {
        if(rebaseResult.getStatus() == RebaseResult.Status.CONFLICTS) {
            logger.warn("Git `pull` reported conflicts - will reset and try again next pass!");
            git.reset().setMode(ResetCommand.ResetType.HARD).call();
            return;
        }

        logger.warn("Git `pull` was unsuccessful :(");
        return;
    }

    if(rebaseResult.getStatus() == RebaseResult.Status.UP_TO_DATE) {
        logger.debug("Git `pull` reported that repository is already up-to-date");
        return;
    }

    logger.debug("Git repo is now at commit '{}'", rebaseResult.getCurrentCommit());
}
 
开发者ID:AnomalyXII,项目名称:werewolv.es-tools,代码行数:23,代码来源:BotServiceConfiguration.java

示例4: updateRepository

import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
protected IStatus updateRepository(IProgressMonitor monitor) {
	String repoURL = getPreference(ExamplesPreferenceConstants.REMOTE_LOCATION);
	try {
		java.nio.file.Path storageLocation = getStorageLocation();
		PullResult result = Git.open(storageLocation.toFile()).pull()
				.setProgressMonitor(new EclipseGitProgressTransformer(monitor)).call();
		if (!result.isSuccessful()) {
			return new Status(IStatus.ERROR, ExampleActivator.PLUGIN_ID,
					"Unable to update repository " + repoURL + "!");
		}
	} catch (GitAPIException | IOException e) {
		return new Status(IStatus.ERROR, ExampleActivator.PLUGIN_ID,
				"Unable to update repository " + repoURL + "!");
	}
	return Status.OK_STATUS;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:17,代码来源:GitRepositoryExampleService.java

示例5: applyBefore

import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
public static Boolean applyBefore(final Git git) {
    Boolean result = Boolean.FALSE;
    try {
        PullCommand pc = git.pull().setRemote(REMOTE).setRebase(Boolean.TRUE);
        PullResult pullRes = pc.call();
        RebaseResult rr = pullRes.getRebaseResult();

        if (rr.getStatus().equals(RebaseResult.Status.UP_TO_DATE) || rr.getStatus().equals(RebaseResult.Status.FAST_FORWARD)) {
            result = Boolean.TRUE;
        }
        if (rr.getStatus().equals(RebaseResult.Status.UNCOMMITTED_CHANGES)) {
            PullResult pr = git.pull().call();
            if (pr.isSuccessful()) {
                result = Boolean.TRUE;
            } else {
                result = Boolean.FALSE;
            }
        }
    } catch (Exception e) {
        logger.error(e.getMessage());
    }
    return result;
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:24,代码来源:JGitUtils.java

示例6: pullFromRemote

import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
/**
  * Push git changes from remote git repository
  * 
  * @param git Local git repository
  * @param name Remote Git name
  * @param url Remote Git url
  * @return pull result
  * @throws WsSrvException
  */
public static boolean pullFromRemote(Git git, String name, String url) 
                                                  throws WsSrvException {
	checkRemoteGitConfig(name, url);
	
	try {
     PullResult pres = git.pull().setRemote(name).call();
     
     return pres.isSuccessful();
   } catch (GitAPIException e) {
     //-- 250
    throw new WsSrvException(250, e,
    			"Error pull from remote [" + name + "]");
   }
}
 
开发者ID:osbitools,项目名称:OsBiToolsWs,代码行数:24,代码来源:GitUtils.java

示例7: initializeGit

import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
private Git initializeGit() throws IOException, GitAPIException {
  if (path.isDirectory()) {
    Git git = Git.open(path);
    String current = git.getRepository().getBranch();
    if (branch.equalsIgnoreCase(current)) {
      PullResult pull = git.pull().setRemote(remote).call();
      if (!pull.isSuccessful()) {
        LOGGER.warn("Unable to pull the branch + '" + branch +
            "' from the remote repository '" + remote + "'");
      }
      return git;
    } else {
      git.checkout().
          setName(branch).
          setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).
          setStartPoint(remote + "/" + branch).
          call();
      return git;
    }
  } else {
    return Git.cloneRepository()
        .setURI(url)
        .setBranch(branch)
        .setRemote(remote)
        .setDirectory(path)
        .call();
  }
}
 
开发者ID:cescoffier,项目名称:vertx-configuration-service,代码行数:29,代码来源:GitConfigurationStore.java

示例8: initializeGit

import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
private Git initializeGit() throws IOException, GitAPIException {
  if (path.isDirectory()) {
    Git git = Git.open(path);
    String current = git.getRepository().getBranch();
    if (branch.equalsIgnoreCase(current)) {
      PullResult pull = git.pull().setRemote(remote).call();
      if (!pull.isSuccessful()) {
        LOGGER.warn("Unable to pull the branch + '" + branch +
          "' from the remote repository '" + remote + "'");
      }
      return git;
    } else {
      git.checkout().
        setName(branch).
        setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).
        setStartPoint(remote + "/" + branch).
        call();
      return git;
    }
  } else {
    return Git.cloneRepository()
      .setURI(url)
      .setBranch(branch)
      .setRemote(remote)
      .setDirectory(path)
      .call();
  }
}
 
开发者ID:vert-x3,项目名称:vertx-config,代码行数:29,代码来源:GitConfigStore.java

示例9: synchronize

import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
protected void synchronize() {
	//
	// Grab our working repository
	//
	Path repoPath = ((XacmlAdminUI)getUI()).getUserGitPath();
	try {
		final Git git = Git.open(repoPath.toFile());
		
		PullResult result = git.pull().call();
		FetchResult fetch = result.getFetchResult();
		MergeResult merge = result.getMergeResult();
		RebaseResult rebase = result.getRebaseResult();
		if (result.isSuccessful()) {
			//
			// TODO add more notification
			//
			this.textAreaResults.setValue("Successful!");
		} else {
			//
			// TODO
			//
			this.textAreaResults.setValue("Failed.");
		}
	} catch (IOException | GitAPIException e) {
		e.printStackTrace();
	}
	this.buttonSynchronize.setCaption("Ok");
}
 
开发者ID:att,项目名称:XACML,代码行数:29,代码来源:GitSynchronizeWindow.java

示例10: synchronize

import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
protected void synchronize() {
	//
	// Grab our working repository
	//
	Path repoPath = ((XacmlAdminUI)getUI()).getUserGitPath();
	try {
		final Git git = Git.open(repoPath.toFile());
		
		PullResult result = git.pull().call();
		// FetchResult fetch = result.getFetchResult();
		// MergeResult merge = result.getMergeResult();
		// RebaseResult rebase = result.getRebaseResult();
		if (result.isSuccessful()) {
			//
			// TODO add more notification
			//
			this.textAreaResults.setValue("Successful!");
		} else {
			//
			// TODO
			//
			this.textAreaResults.setValue("Failed.");
		}
	} catch (IOException | GitAPIException e) {
		e.printStackTrace();
	}
	this.buttonSynchronize.setCaption("Ok");
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:29,代码来源:GitSynchronizeWindow.java

示例11: contemAtualizacoes

import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
@SneakyThrows
public boolean contemAtualizacoes() {
    if (caminhoLocal == null) {
        caminhoLocal = clonarRepositorio(criarDiretorioTemporario());
        caminhoLocal.deleteOnExit();
        return true;

    }

    log.debug("Atualizando repositório de cartas de serviço de {} para {}", urlRepositorio, caminhoLocal);
    try (Git repositorio = Git.open(caminhoLocal)) {
        String oldHead = repositorio.getRepository().getRef(R_HEADS + MASTER).getObjectId().getName();

        PullResult result = repositorio.pull()
                .setProgressMonitor(new LogstashProgressMonitor(log))
                .setStrategy(THEIRS)
                .call();

        if (!result.isSuccessful()) {
            log.error("Erro ao atualizar repositório: {}", result);
            return false;
        }

        String head = repositorio.reset()
                .setMode(HARD)
                .setRef("refs/remotes/origin/master")
                .call()
                .getObjectId()
                .getName();

        if (oldHead.equals(head)) {
            log.info("Repositório de cartas de serviço em {} já está na versão mais recente: {}", caminhoLocal, head);
            return false;

        }

        log.info("Repositório de cartas de serviço em {} atualizado da versão {} para {}", caminhoLocal, oldHead, head);
        return true;
    }
}
 
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:41,代码来源:RepositorioCartasServico.java


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