@Nonnull public DirCacheEntry getEntry() { if(entry == null) throw new NoSuchCacheEntryException(path); return entry; }
public static void validate(RefUpdate.Result result) { switch(result) { case REJECTED_CURRENT_BRANCH: throw new RefUpdateRejectedCurrentBranchException(result.name()); case REJECTED: throw new RefUpdateRejectedException(result.name()); case LOCK_FAILURE: throw new RefUpdateLockFailureException(result.name()); case IO_FAILURE: throw new RefUpdateIOFailureException(result.name()); } }
@Nonnull public static DirCache forRevision(@Nonnull String revision, @Nonnull Repository repo) throws IOException { AnyObjectId revisionId = repo.resolve(revision); if(revisionId == null) throw new NoSuchRevisionException(revision); return forRevision(revisionId, repo); }
@Nonnull public static Ref createTag(@Nonnull AnyObjectId tagId, @Nonnull String name, @Nonnull Repository repo) throws IOException { String refName = RefUtils.ensureTagRefName(name); if(tagExists(name, repo)) throw new TagAlreadyExistsException(refName); RefUpdate update = repo.updateRef(refName); update.setNewObjectId(tagId); update.setRefLogMessage("tagged " + name, false); RefUpdateValidator.validate(update.update()); return repo.getRef(refName); }
@Nonnull public static AnyObjectId getBranchHeadCommit(@Nonnull String name, @Nonnull Repository repo) throws IOException { String refName = RefUtils.ensureBranchRefName(name); AnyObjectId ret = repo.resolve(refName); if(ret == null) throw new NoSuchBranchException(refName); return ret; }
private static void createBranch(String name, AnyObjectId startPoint, Repository repo, String startPointName) throws IOException { String branchRef = fullBranchName(name); if(branchExists(branchRef, repo)) throw new BranchAlreadyExistsException(branchRef); setBranchHead(name, startPoint, repo, makeRefLogMessage("branch", "Created from " + startPointName), false); }
@Nonnull public static RevCommit getCommit(String id, Repository repo) throws IOException { ObjectId commitId = repo.resolve(id); if(commitId == null) throw new NoSuchCommitException(id); return getCommit(commitId, repo); }
public static void validate(RefUpdate.Result result) { switch(result) { case REJECTED_CURRENT_BRANCH: throw new RefUpdateRejectedCurrentBranchException(result.name()); case REJECTED: throw new RefUpdateRejectedException(result.name()); case LOCK_FAILURE: throw new RefUpdateLockFailureException(result.name()); case IO_FAILURE: throw new RefUpdateIOFailureException(result.name()); } }
@Nonnull private static Ref linkTag(String name, AnyObjectId tag, Repository repo) throws IOException { String refName = RefUtils.fullTagRef(name); if(tagExists(name, repo)) throw new TagAlreadyExistsException(refName); RefUpdate update = repo.updateRef(refName); update.setNewObjectId(tag); update.setRefLogMessage("tagged " + name, false); RefUpdateValidator.validate(update.update()); return repo.exactRef(refName); }
@Nonnull public static Ref getBranchRef(String name, Repository repo) throws IOException { Ref ret = repo.exactRef(fullBranchName(name)); if(ret == null) throw new NoSuchBranchException(name); return ret; }
@Nonnull public DirCacheEntry getEntry() { if(entry == null) throw new NoSuchCacheEntryException(path); return entry; }
private static void createBranch(String name, AnyObjectId startPoint, Repository repo, String startPointName) throws IOException { String branchRef = fullBranchName(name); if(branchExists(branchRef, repo)) throw new BranchAlreadyExistsException(branchRef); setBranchHead(name, startPoint, repo, makeRefLogMessage("branch", "Created from " + startPointName), false); }
@Nonnull public static DirCache forRevision(String revision, Repository repo) throws IOException { AnyObjectId revisionId = repo.resolve(revision); if(revisionId == null) throw new NoSuchCommitException(revision); return forRevision(revisionId, repo); }
public static void validate(@Nonnull RefUpdate.Result result) { switch(result) { case REJECTED_CURRENT_BRANCH: throw new RefUpdateRejectedCurrentBranchException(result.name()); case REJECTED: throw new RefUpdateRejectedException(result.name()); case LOCK_FAILURE: throw new RefUpdateLockFailureException(result.name()); case IO_FAILURE: throw new RefUpdateIOFailureException(result.name()); } }
@Nonnull private static Ref linkTag(String name, AnyObjectId tag, Repository repo) throws IOException { String refName = RefUtils.fullTagRef(name); if(tagExists(name, repo)) throw new TagAlreadyExistsException(refName); RefUpdate update = repo.updateRef(refName); update.setNewObjectId(tag); update.setRefLogMessage("tagged " + name, false); RefUpdateValidator.validate(update.update()); return repo.exactRef(refName); }
@Nonnull public static List<RevCommit> getBranchHistory(@Nonnull String name, @Nonnull Repository repo) throws IOException { String branchRef = RefUtils.ensureBranchRefName(name); RevCommit head = CommitUtils.getCommit(branchRef, repo); if(head == null) throw new NoSuchBranchException(branchRef); return CommitUtils.getCommitHistory(head, repo); }
@Nonnull public DirCacheEntry getEntry() { if(entry == null) throw new NoSuchCacheEntryException(path); return entry; }
@Nonnull public static DirCache forRevision(String revision, Repository repo) throws IOException { AnyObjectId revisionId = repo.resolve(revision); if(revisionId == null) throw new NoSuchCommitException(revision); return forRevision(revisionId, repo); }
@Nonnull private static DirCacheEntry ensureEntry(String path, DirCache cache) { DirCacheEntry entry = getEntry(path, cache); if(entry == null) throw new NoSuchCacheEntryException("/" + normalizeNodePath(path)); return entry; }
@Nonnull private static DirCacheEntry ensureEntry(String path, DirCache cache) { DirCacheEntry entry = getEntry(path, cache); if(entry == null) throw new NoSuchCacheEntryException("/" + normalizeNodePath(path)); return entry; }