/** * 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; }
/** * 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; }
/** * 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 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; }
/** * 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; see {@link RefDatabase#getRefs(String)} * @return {@code this} */ public NameRevCommand addPrefix(String prefix) { checkCallable(); prefixes.add(prefix); 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; }
/** * 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<Ref>(); refs.add(ref); return this; }
/** * Add an object to search for. * * @param id * object ID 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(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 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 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 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; }