Java 类org.eclipse.jgit.api.errors.NotMergedException 实例源码

项目:commitmining-tools    文件:RepositoryFileWalker.java   
/**
 * Switch to the main branch and delete the temporary branch.
 *
 * @throws GitAPIException
 * @throws RefAlreadyExistsException
 * @throws RefNotFoundException
 * @throws InvalidRefNameException
 * @throws CheckoutConflictException
 * @throws NotMergedException
 * @throws CannotDeleteCurrentBranchException
 */
private void switchToMainAndDeleteFrom(final String tempBranch)
        throws GitAPIException, RefAlreadyExistsException,
        RefNotFoundException, InvalidRefNameException,
        CheckoutConflictException, NotMergedException,
        CannotDeleteCurrentBranchException {
    try {
        repository.reset().setMode(ResetType.HARD).call();
    } finally {
        try {
            repository.checkout().setCreateBranch(false)
            .setName(mainBranchName).setForce(true).call();
        } finally {
            try {
                repository.reset().setMode(ResetType.HARD).call();
            } finally {
                repository.branchDelete().setForce(true)
                .setBranchNames(tempBranch).call();
            }
        }
    }
}
项目:rebazer    文件:RebaseService.java   
private void removeAllLocalBranches( final Git repository )
        throws GitAPIException, NotMergedException, CannotDeleteCurrentBranchException {
    final String[] localBranches = repository.branchList() //
            .call().stream() //
            .filter( r -> r.getName() //
                    .startsWith( "refs/heads/" ) ) //
            .map( r -> r.getName() ) //
            .toArray( String[]::new ); //

    repository.branchDelete() //
            .setForce( true ) //
            .setBranchNames( localBranches ) //
            .call(); //
}