[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [egit-dev] EGit PDE - help with EGit/JGit
|
Can you contribute to the code to Gerrit so we can look at it? To
egit-pde? There should be a org.eclipse.egit.relengtools plug-in there
already.
http://wiki.eclipse.org/EGit/Contributor_Guide#Contributing_Patches
On Fri, Oct 29, 2010 at 10:24 AM, Paul Webster
<pwebster@xxxxxxxxxxxxxxxxxxx> wrote:
> This is my attempt to find all tags that can contain a given commit:
>
> public static Set<Ref> getTagsContainingCommit(Repository repo,
> RevCommit latestCommit) throws Exception {
> final Set<Ref> tags = new HashSet<Ref>();
> final RevWalk walk = new RevWalk(repo);
> walk.sort(RevSort.TOPO, true);
> walk.sort(RevSort.COMMIT_TIME_DESC, true);
> for (final Ref ref : repo.getTags().values()) {
> final RevObject obj = walk.parseAny(ref.getObjectId());
> final RevCommit tagCommit;
> if (obj instanceof RevCommit) {
> tagCommit = (RevCommit) obj;
> } else {
> tagCommit = walk.parseCommit(((RevTag) obj).getObject());
> }
> if (walk.isMergedInto(latestCommit, tagCommit)) {
> tags.add(ref);
> }
> }
> return tags;
> }
>
>
> Two things I noticed:
>
> 1) even if they're the same commit, walk.isMergedInto(latestCommit,
> tagCommit) returns false. OK, I can add a
> tagCommit.equals(latestCommit).
>
> 2) walk.isMergedInto(latestCommit, tagCommit) returns false for all of
> my cases, My repo has no branches ATM, instead it's a straight parent
> child walk between b42ad39c90fc57b679154ca33dfb306004dc08a3 and the
> last commit on master, d660f0a07c8ff16c9b46b3d69bc1c271b2cf4aba, which
> has 2 tags and is definitely being parsed into tagCommit.
>
> PW
>
>
> --
> Paul Webster
> Hi floor. Make me a sammich! - GIR
>
--
Cheers,
Chris Aniszczyk
http://aniszczyk.org
+1 860 839 2465