/** * Add multiple objects to search for. * * @param ids * object IDs to add. * @return {@code this} * @throws org.eclipse.jgit.errors.MissingObjectException * the object supplied is not available from the object * database. * @throws org.eclipse.jgit.api.errors.JGitInternalException * a low-level exception of JGit has occurred. The original * exception can be retrieved by calling * {@link java.lang.Exception#getCause()}. */ public NameRevCommand add(Iterable<ObjectId> ids) throws MissingObjectException, JGitInternalException { for (ObjectId id : ids) add(id); return this; }
/** * Return a command object to find human-readable names of revisions. * * @return a {@link org.eclipse.jgit.api.NameRevCommand}. * @since 3.0 */ public NameRevCommand nameRev() { return new NameRevCommand(repo); }
if (refs != null) { for (Ref ref : refs) addRef(ref, nonCommits, pending); addPrefixes(nonCommits, pending); int cutoff = minCommitTime() - COMMIT_TIME_SLOP; NameRevCommit p = (NameRevCommit) walk.parseCommit(c.getParent(i)); long cost = c.cost + (i > 0 ? mergeCost : 1); if (p.tip == null || compare(c.tip, cost, p.tip, p.cost) < 0) { if (i > 0) { p.tip = c.format().append('^').append(i + 1).toString(); NameRevCommit c = (NameRevCommit) o; if (c.tip != null) result.put(id, simplify(c.format().toString())); } else { String name = nonCommits.get(id); if (name != null) result.put(id, simplify(name)); setCallable(false); return result; } catch (IOException e) {
/** * Add all annotated tags under {@code refs/tags/} to the set that all * results must match. * <p> * Calls {@link #addRef(Ref)}; see that method for a note on matching * priority. * * @return {@code this} * @throws JGitInternalException * a low-level exception of JGit has occurred. The original * exception can be retrieved by calling * {@link java.lang.Exception#getCause()}. */ public NameRevCommand addAnnotatedTags() { checkCallable(); if (refs == null) refs = new ArrayList<>(); try { for (Ref ref : repo.getRefDatabase() .getRefsByPrefix(Constants.R_TAGS)) { ObjectId id = ref.getObjectId(); if (id != null && (walk.parseAny(id) instanceof RevTag)) addRef(ref); } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } return this; }
/** * Add a ref prefix to the set that results must match. * <p> * If an object matches multiple refs equally well, the first matching ref * added with {@link #addRef(Ref)} is preferred, or else the first matching * prefix added by {@link #addPrefix(String)}. * * @param prefix * prefix to add; the prefix must end with a slash * @return {@code this} */ public NameRevCommand addPrefix(String prefix) { checkCallable(); prefixes.add(prefix); return this; }
private void addPrefix(String prefix, Map<ObjectId, String> nonCommits, FIFORevQueue pending) throws IOException { for (Ref ref : repo.getRefDatabase().getRefsByPrefix(prefix)) addRef(ref, nonCommits, pending); }
if (refs != null) { for (Ref ref : refs) addRef(ref, nonCommits, pending); addPrefixes(nonCommits, pending); int cutoff = minCommitTime() - COMMIT_TIME_SLOP; NameRevCommit p = (NameRevCommit) walk.parseCommit(c.getParent(i)); long cost = c.cost + (i > 0 ? mergeCost : 1); if (p.tip == null || compare(c.tip, cost, p.tip, p.cost) < 0) { if (i > 0) { p.tip = c.format().append('^').append(i + 1).toString(); NameRevCommit c = (NameRevCommit) o; if (c.tip != null) result.put(id, simplify(c.format().toString())); } else { String name = nonCommits.get(id); if (name != null) result.put(id, simplify(name)); setCallable(false); return result; } catch (IOException e) {
/** * Add all annotated tags under {@code refs/tags/} to the set that all results * must match. * <p> * Calls {@link #addRef(Ref)}; see that method for a note on matching * priority. * * @return {@code this} * @throws JGitInternalException * a low-level exception of JGit has occurred. The original * exception can be retrieved by calling * {@link Exception#getCause()}. */ public NameRevCommand addAnnotatedTags() { checkCallable(); if (refs == null) refs = new ArrayList<Ref>(); try { for (Ref ref : repo.getRefDatabase().getRefs(Constants.R_TAGS).values()) { ObjectId id = ref.getObjectId(); if (id != null && (walk.parseAny(id) instanceof RevTag)) addRef(ref); } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } return this; }
/** * Add a ref to the set that all results must match. * <p> * If an object matches multiple refs equally well, the first matching ref * added with {@link #addRef(Ref)} is preferred, or else the first matching * prefix added by {@link #addPrefix(String)}. * * @param ref * ref to add. * @return {@code this} */ public NameRevCommand addRef(Ref ref) { checkCallable(); if (refs == null) refs = new ArrayList<>(); refs.add(ref); return this; }
private void addPrefix(String prefix, Map<ObjectId, String> nonCommits, FIFORevQueue pending) throws IOException { for (Ref ref : repo.getRefDatabase().getRefs(prefix).values()) addRef(ref, nonCommits, pending); }
if (refs != null) { for (Ref ref : refs) addRef(ref, nonCommits, pending); addPrefixes(nonCommits, pending); int cutoff = minCommitTime() - COMMIT_TIME_SLOP; NameRevCommit p = (NameRevCommit) walk.parseCommit(c.getParent(i)); long cost = c.cost + (i > 0 ? mergeCost : 1); if (p.tip == null || compare(c.tip, cost, p.tip, p.cost) < 0) { if (i > 0) { p.tip = c.format().append('^').append(i + 1).toString(); NameRevCommit c = (NameRevCommit) o; if (c.tip != null) result.put(id, simplify(c.format().toString())); } else { String name = nonCommits.get(id); if (name != null) result.put(id, simplify(name)); setCallable(false); return result; } catch (IOException e) {
/** * Add all annotated tags under {@code refs/tags/} to the set that all * results must match. * <p> * Calls {@link #addRef(Ref)}; see that method for a note on matching * priority. * * @return {@code this} * @throws JGitInternalException * a low-level exception of JGit has occurred. The original * exception can be retrieved by calling * {@link java.lang.Exception#getCause()}. */ public NameRevCommand addAnnotatedTags() { checkCallable(); if (refs == null) refs = new ArrayList<>(); try { for (Ref ref : repo.getRefDatabase() .getRefsByPrefix(Constants.R_TAGS)) { ObjectId id = ref.getObjectId(); if (id != null && (walk.parseAny(id) instanceof RevTag)) addRef(ref); } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } return this; }
/** * Add an object to search for. * * @param id * object ID to add. * @return {@code this} * @throws org.eclipse.jgit.errors.MissingObjectException * the object supplied is not available from the object * database. * @throws org.eclipse.jgit.api.errors.JGitInternalException * a low-level exception of JGit has occurred. The original * exception can be retrieved by calling * {@link java.lang.Exception#getCause()}. */ public NameRevCommand add(ObjectId id) throws MissingObjectException, JGitInternalException { checkCallable(); try { walk.parseAny(id); } catch (MissingObjectException e) { throw e; } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } revs.add(id.copy()); return this; }
/** * Add multiple objects to search for. * * @param ids * object IDs to add. * @return {@code this} * @throws MissingObjectException * the object supplied is not available from the object * database. * @throws JGitInternalException * a low-level exception of JGit has occurred. The original * exception can be retrieved by calling * {@link Exception#getCause()}. */ public NameRevCommand add(Iterable<ObjectId> ids) throws MissingObjectException, JGitInternalException { for (ObjectId id : ids) add(id); return this; }
/** * Returns a command object to find human-readable names of revisions. * * @return a {@link NameRevCommand}. * @since 3.0 */ public NameRevCommand nameRev() { return new NameRevCommand(repo); }
private void addPrefix(String prefix, Map<ObjectId, String> nonCommits, FIFORevQueue pending) throws IOException { for (Ref ref : repo.getRefDatabase().getRefsByPrefix(prefix)) addRef(ref, nonCommits, pending); }