/** * List the origin remote references and return all remote references that * are missing locally or have a different remote object id than the local * reference. * * @param repository * @return non-null but possibly empty collection of {@link RefDiff} */ public static Collection<RefDiff> diffOriginRefs(final Repository repository) { return diffRemoteRefs(repository, DEFAULT_REMOTE_NAME); }
/** * Get note refs from repository to use during commit walks. * * @param repository * non-null * @return non-null array of ref names */ protected String[] getNoteRefs(final Repository repository) { Collection<String> refs = RepositoryUtils.getNoteRefs(repository); return refs.toArray(new String[refs.size()]); }
/** * Get all the note references in the given repository. * * @param repository * @return non-null but possibly empty array of note references */ public static Collection<String> getNoteRefs(final Repository repository) { if (repository == null) throw new IllegalArgumentException( Assert.formatNotNull("Repository")); final Collection<Ref> refs = getRefs(repository, R_NOTES); final List<String> notes = new ArrayList<String>(refs.size()); for (Ref ref : refs) notes.add(ref.getName()); return notes; }
public List<String> call(Git git, GitContext context) throws Exception { Collection<String> branches = RepositoryUtils.getBranches(git.getRepository()); List<String> answer = new ArrayList<String>(); for (String branch : branches) { String name = branch; String prefix = "refs/heads/"; if (name.startsWith(prefix)) { name = name.substring(prefix.length()); if (!name.equals(GitHelpers.MASTER_BRANCH)) { answer.add(name); } } } versions.clear(); versions.addAll(answer); return answer; } };
final Collection<Ref> remoteRefs = lsRemote.call(); final List<RefDiff> diffs = new ArrayList<RefDiff>(); if (hasRemote(repository, remote)) { final String refPrefix = R_REMOTES + remote + "/"; for (Ref remoteRef : remoteRefs) {
/** * Get all the local and remote tracking branch references in the given * repository. * * @param repository * @return non-null but possibly array of branch reference names */ public static Collection<String> getBranches(final Repository repository) { if (repository == null) throw new IllegalArgumentException( Assert.formatNotNull("Repository")); final List<String> branches = new ArrayList<String>(); for (Ref ref : getRefs(repository, R_HEADS)) branches.add(ref.getName()); for (Ref ref : getRefs(repository, R_REMOTES)) branches.add(ref.getName()); return branches; }
public List<String> call(Git git, GitContext context) throws Exception { Collection<String> branches = RepositoryUtils.getBranches(git.getRepository()); List<String> answer = new ArrayList<String>(); for (String branch : branches) { String name = branch; String prefix = "refs/heads/"; if (name.startsWith(prefix)) { name = name.substring(prefix.length()); if (!name.equals(GitHelpers.MASTER_BRANCH) && !name.startsWith("patch-") && !name.startsWith("patches-") && !name.equals(HISTORY_BRANCH) && !name.equals(ADMIN_HISTORY_BRANCH)) { answer.add(name); } } } versions.clear(); versions.addAll(answer); if (answer.size() > 0) { LOGGER.info("Initial versions cached"); initialVersionsAvailable.countDown(); } return answer; } };
/** * Get note refs from repository to use during commit walks. * * @param repository * non-null * @return non-null array of ref names */ protected String[] getNoteRefs(final Repository repository) { Collection<String> refs = RepositoryUtils.getNoteRefs(repository); return refs.toArray(new String[refs.size()]); }