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


Java RebaseResult类代码示例

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


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

示例1: createResult

import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
private GitRebaseResult createResult (RebaseResult res) {
    String currHead;
    Repository repository = getRepository();
    File workTree = repository.getWorkTree();
    try {
        currHead = repository.resolve(Constants.HEAD).name();
    } catch (IOException ex) {
        currHead = Constants.HEAD;
    }
    List<File> conflicts;
    if (res.getStatus() == RebaseResult.Status.STOPPED) {
        conflicts = getConflicts(res.getCurrentCommit());
    } else {
        conflicts = Collections.<File>emptyList();
    }
    return getClassFactory().createRebaseResult(res, conflicts, getFailures(res), currHead);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:RebaseCommand.java

示例2: update

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

示例3: process

import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
@Override
public RebaseResponse process(Repository repository, String message) throws GitAPIException, IOException {

    try (Git git = Git.wrap(repository)) {
        git.commit()
                .setMessage(stripCommentLines(message))
                .setAmend(true).setNoVerify(true).call();

        getRebaseFile(repository, MESSAGE_SQUASH).delete();
        getRebaseFile(repository, MESSAGE_FIXUP).delete();

        createFile(repository, MESSAGE, message);

        RebaseResult result = git.rebase()
                .setOperation(RebaseCommand.Operation.SKIP)
                .runInteractively(handler)
                .call();

        return new RebaseResponse(result);
    }
}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:22,代码来源:SquashActionHandler.java

示例4: process

import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
@Override
public RebaseResponse process(Repository repository, String message) throws GitAPIException {
    try (Git git = Git.wrap(repository)) {
        git.commit()
                .setAll(true)
                .setAmend(true)
                .setNoVerify(true)
                .setMessage(message)
                .call();

        RebaseResult result = git.rebase()
                .setOperation(RebaseCommand.Operation.CONTINUE)
                .runInteractively(handler)
                .call();

        // 如果 conflict and edit,amend 后 continue 会返回 NOTHING_TO_COMMIT
        // so skip this commit
        if (result.getStatus().equals(RebaseResult.Status.NOTHING_TO_COMMIT)) {
            result = git.rebase().setOperation(RebaseCommand.Operation.SKIP).call();
        }

        return new RebaseResponse(result);
    }
}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:25,代码来源:EditActionHandler.java

示例5: process

import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
@Override
public RebaseResponse process(Repository repository, String message) throws GitAPIException, IOException {

    try (Git git = Git.wrap(repository)) {
        git.commit()
                .setMessage(message)
                .setAmend(true)
                .setNoVerify(true)
                .call();

        RebaseResult result = git.rebase()
                .setOperation(RebaseCommand.Operation.SKIP)
                .runInteractively(handler)
                .call();

        return new RebaseResponse(result);
    }
}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:19,代码来源:RewordActionHandler.java

示例6: rebase

import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
@Override
public boolean rebase(String upStreamBranchName) {
    
    RebaseCommand command = _git.rebase();
    RebaseResult result = null;
    try {
        command.setUpstream(upStreamBranchName);
        result = command.call();
        // if there are merge conflicts (rebase interactive) - reset the repository
        if (!result.getStatus().isSuccessful()) {
            _git.rebase().setOperation(Operation.ABORT).call();
        }
    } catch (Throwable e) {
        throw new RuntimeException(String.format(
                "Failed to rebase with upstream [%s]",
                upStreamBranchName), e);
    }
    
    return result.getStatus().isSuccessful();
}
 
开发者ID:Verigreen,项目名称:verigreen,代码行数:21,代码来源:JGitOperator.java

示例7: colocarEmSAFE

import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
private void colocarEmSAFE() throws GitAPIException, IOException {
    RebaseResult rebaseResult = git
            .rebase()
            .setStrategy(THEIRS)
            .setOperation(ABORT)
            .call();

    Marker marker = append("git.state", git.getRepository().getRepositoryState().toString())
            .and(append("git.branch", git.getRepository().getBranch()))
            .and(append("pull.rebase.result", rebaseResult.getStatus().toString()));

    log.info(marker, "git rebase em {}", git.getRepository().getBranch());

    Ref resetResult = git.reset().setMode(HARD).setRef(R_HEADS + MASTER).call();

    marker = append("reset.result", resetResult.getName());

    log.info(marker, "git reset --hard em {}", git.getRepository().getBranch());
}
 
开发者ID:servicosgovbr,项目名称:editor-de-servicos,代码行数:20,代码来源:RepositorioGit.java

示例8: applyBefore

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

示例9: GitRebaseResult

import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
GitRebaseResult (RebaseResult result, List<File> rebaseConflicts, List<File> failures, String currentHead) {
    this.rebaseStatus = parseRebaseStatus(result.getStatus());
    this.currentHead = currentHead;
    if (result.getCurrentCommit() == null) {
        this.currentCommit = null;
    } else {
        this.currentCommit = result.getCurrentCommit().getId().getName();
    }
    this.conflicts = rebaseConflicts;
    this.failures = failures;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:GitRebaseResult.java

示例10: parseRebaseStatus

import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
static RebaseStatus parseRebaseStatus (RebaseResult.Status rebaseStatus) {
    switch (rebaseStatus) {
        case EDIT:
            return RebaseStatus.STOPPED;
        case UNCOMMITTED_CHANGES:
            return RebaseStatus.FAILED;
        case INTERACTIVE_PREPARED:
            return RebaseStatus.STOPPED;
        case STASH_APPLY_CONFLICTS:
            return RebaseStatus.CONFLICTS;
            
    }
    return GitRebaseResult.RebaseStatus.valueOf(rebaseStatus.name());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:GitRebaseResult.java

示例11: rebaseOnTargetBranch

import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
private void rebaseOnTargetBranch(Git git, final List<Commit> commits) throws Exception {
    RebaseCommand rebase = git.rebase();
    rebase.setUpstream(request.getTarget().getBranch());
    rebase.setProgressMonitor(new NotificationProgressMonitor(request, notification, progress));
    rebase.runInteractively(new GitUtil.InteractiveRebase(notification, request.getKey(), commits));
    RebaseResult result = rebase.call();
    if(!result.getStatus().isSuccessful()) {
        throw new RuntimeException("Rebase not successful, status " + result.getStatus());
    }
}
 
开发者ID:aslakknutsen,项目名称:github-merge,代码行数:11,代码来源:GitService.java

示例12: synchronize

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

示例13: createRebaseResult

import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
public abstract GitRebaseResult createRebaseResult (RebaseResult rebaseResult, List<File> rebaseConflicts, List<File> failures,
String newHead);
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:3,代码来源:GitClassFactory.java

示例14: createRebaseResult

import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
@Override
public GitRebaseResult createRebaseResult (RebaseResult rebaseResult, List<File> rebaseConflicts, List<File> failures,
        String newHead) {
    return new GitRebaseResult(rebaseResult, rebaseConflicts, failures, newHead);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:GitClassFactoryImpl.java

示例15: testRebaseStatus

import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
public void testRebaseStatus () {
    for (RebaseResult.Status status : RebaseResult.Status.values()) {
        assertNotNull(GitRebaseResult.parseRebaseStatus(status));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:GitEnumsStateTest.java


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