private ObjectId getStartPointObjectId() throws AmbiguousObjectException, RefNotFoundException, IOException { if (startCommit != null) return startCommit.getId(); String startPointOrHead = (startPoint != null) ? startPoint : Constants.HEAD; ObjectId result = repo.resolve(startPointOrHead); if (result == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, startPointOrHead)); return result; }
private Ref getHead() throws IOException, RefNotFoundException { Ref head = repo.exactRef(Constants.HEAD); if (head == null || head.getObjectId() == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, Constants.HEAD)); return head; }
private ObjectId getStartPointObjectId() throws AmbiguousObjectException, RefNotFoundException, IOException { if (startCommit != null) return startCommit.getId(); String startPointOrHead = getStartPointOrHead(); ObjectId result = repo.resolve(startPointOrHead); if (result == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, startPointOrHead)); return result; }
/** * Sets the commit to be described. * * @param rev * Commit ID, tag, branch, ref, etc. See * {@link org.eclipse.jgit.lib.Repository#resolve(String)} for * allowed syntax. * @return {@code this} * @throws IncorrectObjectTypeException * the supplied id is not a commit or an annotated tag. * @throws org.eclipse.jgit.api.errors.RefNotFoundException * the given rev didn't resolve to any object. * @throws java.io.IOException * a pack file or loose object could not be read. */ public DescribeCommand setTarget(String rev) throws IOException, RefNotFoundException { ObjectId id = repo.resolve(rev); if (id == null) throw new RefNotFoundException(MessageFormat.format(JGitText.get().refNotResolved, rev)); return setTarget(id); }
/** * Set the upstream branch * * @param upstream * the name of the upstream branch * @return {@code this} * @throws org.eclipse.jgit.api.errors.RefNotFoundException */ public RebaseCommand setUpstream(String upstream) throws RefNotFoundException { try { ObjectId upstreamId = repo.resolve(upstream); if (upstreamId == null) throw new RefNotFoundException(MessageFormat.format(JGitText .get().refNotResolved, upstream)); upstreamCommit = walk.parseCommit(repo.resolve(upstream)); upstreamCommitName = upstream; return this; } catch (IOException ioe) { throw new JGitInternalException(ioe.getMessage(), ioe); } }
private Collection<Ref> filterRefs(Collection<Ref> refs) throws RefNotFoundException, IOException { if (containsCommitish == null) return refs; try (RevWalk walk = new RevWalk(repo)) { ObjectId resolved = repo.resolve(containsCommitish); if (resolved == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, containsCommitish)); RevCommit containsCommit = walk.parseCommit(resolved); return RevWalkUtils.findBranchesReachableFrom(containsCommit, walk, refs); } }
/** * {@inheritDoc} * <p> * Run the reflog command */ @Override public Collection<ReflogEntry> call() throws GitAPIException, InvalidRefNameException { checkCallable(); try { ReflogReader reader = repo.getReflogReader(ref); if (reader == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, ref)); return reader.getReverseEntries(); } catch (IOException e) { throw new InvalidRefNameException(MessageFormat.format( JGitText.get().cannotRead, ref), e); } }
/** * Check if we can fast-forward and returns the new head if it is possible * * @param newCommit * a {@link org.eclipse.jgit.revwalk.RevCommit} object to check * if we can fast-forward to. * @return the new head, or null * @throws java.io.IOException * @throws org.eclipse.jgit.api.errors.GitAPIException */ public RevCommit tryFastForward(RevCommit newCommit) throws IOException, GitAPIException { Ref head = getHead(); ObjectId headId = head.getObjectId(); if (headId == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, Constants.HEAD)); RevCommit headCommit = walk.lookupCommit(headId); if (walk.isMergedInto(newCommit, headCommit)) return newCommit; String headName = getHeadName(head); return tryFastForward(headName, headCommit, newCommit); }
Ref ref = repo.findRef(oldName); if (ref == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, oldName)); if (ref.getName().startsWith(Constants.R_TAGS)) throw new RefNotFoundException(MessageFormat.format( JGitText.get().renameBranchFailedBecauseTag, oldName));
ReflogReader reader = repo.getReflogReader(R_STASH); if (reader == null) { throw new RefNotFoundException(MessageFormat .format(JGitText.get().refNotResolved, stashRef));
branch = repo.resolve(name); if (branch == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, name));
throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, Constants.HEAD));
commitToMerge = repo.resolve(remoteBranchName); if (commitToMerge == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, remoteBranchName)); } catch (IOException e) {
private Ref getHead() throws IOException, RefNotFoundException { Ref head = repo.exactRef(Constants.HEAD); if (head == null || head.getObjectId() == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, Constants.HEAD)); return head; }
private ObjectId getStartPointObjectId() throws AmbiguousObjectException, RefNotFoundException, IOException { if (startCommit != null) return startCommit.getId(); String startPointOrHead = (startPoint != null) ? startPoint : Constants.HEAD; ObjectId result = repo.resolve(startPointOrHead); if (result == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, startPointOrHead)); return result; }
private Ref getHead() throws IOException, RefNotFoundException { Ref head = repo.exactRef(Constants.HEAD); if (head == null || head.getObjectId() == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, Constants.HEAD)); return head; }
private ObjectId getStartPointObjectId() throws AmbiguousObjectException, RefNotFoundException, IOException { if (startCommit != null) return startCommit.getId(); String startPointOrHead = (startPoint != null) ? startPoint : Constants.HEAD; ObjectId result = repo.resolve(startPointOrHead); if (result == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, startPointOrHead)); return result; }
private ObjectId getStartPointObjectId() throws AmbiguousObjectException, RefNotFoundException, IOException { if (startCommit != null) return startCommit.getId(); String startPointOrHead = getStartPointOrHead(); ObjectId result = repo.resolve(startPointOrHead); if (result == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, startPointOrHead)); return result; }
private ObjectId getStartPointObjectId() throws AmbiguousObjectException, RefNotFoundException, IOException { if (startCommit != null) return startCommit.getId(); String startPointOrHead = getStartPointOrHead(); ObjectId result = repo.resolve(startPointOrHead); if (result == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, startPointOrHead)); return result; }
private Collection<Ref> filterRefs(Collection<Ref> refs) throws RefNotFoundException, IOException { if (containsCommitish == null) return refs; try (RevWalk walk = new RevWalk(repo)) { ObjectId resolved = repo.resolve(containsCommitish); if (resolved == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, containsCommitish)); RevCommit containsCommit = walk.parseCommit(resolved); return RevWalkUtils.findBranchesReachableFrom(containsCommit, walk, refs); } }