/** {@inheritDoc} */ public Set<String> getTagNames(String tagPattern) throws GitException, InterruptedException { return proxy.getTagNames(tagPattern); }
/** {@inheritDoc} */ public Set<String> getRemoteTagNames(String tagPattern) throws GitException, InterruptedException { return proxy.getTagNames(tagPattern); }
@Override public Set<String> run(GitClient client, String remoteName) throws IOException, InterruptedException { Set<String> revisions = new HashSet<String>(); if (context.wantBranches()) { for (Branch branch : client.getRemoteBranches()) { revisions.add(branch.getName().replaceFirst( "^" + Pattern.quote(context.remoteName()) + "/", "" )); } } if (context.wantTags()) { revisions.addAll(client.getTagNames("*")); } return revisions; } },
/** * Return a list of "Revisions" - where a revision knows about all the branch names that refer to * a SHA1. * @return list of revisions * @throws IOException on input or output error * @throws GitException on git error * @throws InterruptedException when interrupted */ public Collection<Revision> getAllBranchRevisions() throws GitException, IOException, InterruptedException { Map<ObjectId, Revision> revisions = new HashMap<>(); for (Branch b : git.getRemoteBranches()) { Revision r = revisions.get(b.getSHA1()); if (r == null) { r = new Revision(b.getSHA1()); revisions.put(b.getSHA1(), r); } r.getBranches().add(b); } for (String tag : git.getTagNames(null)) { String tagRef = Constants.R_TAGS + tag; ObjectId objectId = git.revParse(tagRef); Revision r = revisions.get(objectId); if (r == null) { r = new Revision(objectId); revisions.put(objectId, r); } r.getBranches().add(new Branch(tagRef, objectId)); } return revisions.values(); }