Examples of GitRepositoryException


Examples of com.github.koraktor.mavanagaiata.git.GitRepositoryException

    protected void testError(String errorMessage) {
        try {
            this.mojo.repository = mock(JGitRepository.class, new Answer() {
                public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
                    throw new GitRepositoryException("");
                }
            });
            this.mojo.run();
            fail("No exception thrown.");
        } catch(Exception e) {
View Full Code Here

Examples of com.github.koraktor.mavanagaiata.git.GitRepositoryException

        assertThat(this.mojo.init(), is(true));
    }

    @Test
    public void testInitError() throws Exception {
        GitRepositoryException exception = new GitRepositoryException("");
        doThrow(exception).when(this.mojo).initRepository();

        try {
            this.mojo.init();
            fail("No exception thrown.");
View Full Code Here

Examples of com.github.koraktor.mavanagaiata.git.GitRepositoryException

    @Test
    public void testInitErrorSkipNoGit() throws Exception {
        this.mojo.skipNoGit = true;

        doThrow(new GitRepositoryException("")).when(this.mojo).initRepository();

        assertThat(this.mojo.init(), is(false));
    }
View Full Code Here

Examples of com.github.koraktor.mavanagaiata.git.GitRepositoryException

            throws GitRepositoryException {
        FileRepositoryBuilder repositoryBuilder = new FileRepositoryBuilder();
        repositoryBuilder.readEnvironment();

        if (gitDir == null && workTree == null) {
            throw new GitRepositoryException("Neither worktree nor GIT_DIR is set.");
        } else {
            if (workTree != null && !workTree.exists()) {
                throw new GitRepositoryException("The worktree " + workTree + " does not exist");
            }
            if (gitDir != null && !gitDir.exists()) {
                throw new GitRepositoryException("The GIT_DIR " + gitDir + " does not exist");
            }
        }

        repositoryBuilder.setWorkTree(workTree);
        if (gitDir != null) {
            repositoryBuilder.setGitDir(gitDir);
        } else {
            repositoryBuilder.findGitDir(workTree);

            if (repositoryBuilder.getGitDir() == null) {
                throw new GitRepositoryException(workTree + " is not inside a Git repository. Please specify the GIT_DIR separately.");
            }
        }

        try {
            this.repository = repositoryBuilder.build();
        } catch (IOException e) {
            throw new GitRepositoryException("Could not initialize repository", e);
        }

        this.commitCache = new HashMap<ObjectId, RevCommit>();
    }
View Full Code Here

Examples of com.github.koraktor.mavanagaiata.git.GitRepositoryException

    public void check() throws GitRepositoryException {
        if (!this.repository.getObjectDatabase().exists()) {
            File path = (this.repository.isBare()) ?
                this.repository.getDirectory() : this.repository.getWorkTree();
            throw new GitRepositoryException(path.getAbsolutePath() + " is not a Git repository.");
        }
    }
View Full Code Here

Examples of com.github.koraktor.mavanagaiata.git.GitRepositoryException

            for (RevCommit currentCommit : commits) {
                try {
                    revWalk.parseHeaders(currentCommit);
                } catch (IOException e) {
                    throw new GitRepositoryException("Unable to parse headers of commit " + currentCommit.getName(), e);
                }

                if (currentCommit.has(seenFlag)) {
                    continue;
                }
View Full Code Here

Examples of com.github.koraktor.mavanagaiata.git.GitRepositoryException

        try {
            RevCommit rawCommit = ((JGitCommit) commit).commit;
            return this.repository.getObjectDatabase().newReader()
                    .abbreviate(rawCommit).name();
        } catch (IOException e) {
            throw new GitRepositoryException(
                String.format("Commit \"%s\" could not be abbreviated.", this.getHeadObject().getName()),
                e);
        }
    }
View Full Code Here

Examples of com.github.koraktor.mavanagaiata.git.GitRepositoryException

    public String getBranch() throws GitRepositoryException {
        try {
            return this.repository.getBranch();
        } catch (IOException e) {
            throw new GitRepositoryException("Current branch could not be read.", e);
        }
    }
View Full Code Here

Examples of com.github.koraktor.mavanagaiata.git.GitRepositoryException

                    indexDiff.getMissing().isEmpty() &&
                    indexDiff.getModified().isEmpty() &&
                    indexDiff.getConflicting().isEmpty());

        } catch (IOException e) {
            throw new GitRepositoryException("Could not create repository diff.", e);
        }
    }
View Full Code Here

Examples of com.github.koraktor.mavanagaiata.git.GitRepositoryException

            RevCommit commit;
            while((commit = revWalk.next()) != null) {
                action.execute(new JGitCommit(commit));
            }
        } catch (IOException e) {
            throw new GitRepositoryException("", e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.