Re: jgit as a jira plugin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 29-Oct-08, at 7:08 PM, Shawn O. Pearce wrote:
"J. Longman" <longman@xxxxxxxxxxx> wrote:
2) I'd like to find out the jgit way to achieve the equivalent of 'svn
update'.  I understand that fetch can do this but being new to git, I
don't really understand quite what I need yet. The goal is to have git
the latest commits from the origin before indexing.
Use a Transport instance to execute a default fetch (no args) on say
the "remote" origin.  That will download the objects to the local
database, but it won't update a working directory.  But I'm not sure
you would care about the working directory in the backend of Jira.

Basically I stole the pgm.Fetch code:

Transport tn = Transport.open(repository, "origin");
final FetchResult r;
List<RefSpec> toget = new ArrayList<RefSpec>();
try {
	r = tn.fetch(new TextProgressMonitor(), toget);
} finally {
	tn.close();
}

Can I assume that this enough to update the database? If so I think I'm doing what you're suggesting. After this (and not shown) is some logging code taken from Fetch, which results in the following:

From /Users/longman/workspace2/work/../masterRepo/
    131dcf5..078d43f  master     -> origin/master

but there doesn't appear to be any specific mention of the incoming changes.

Thanks for jgit - it took me a day or two to wrap my head around getting
the list of files changed in a commit but otherwise its great to have
something that can be integrated into jira.
Yea, about that, we wanted to write more tutorials on the API...  ;-)


Well, the egit does provide some examples, just there's another API involved which can be confusing. The code in the jira git plugin the key classes are GitManagerImpl and RevisionIndexer, but the RevisionIndexer has some Lucene (text search engine) API mixed-in. Plus I'm still even learning about git much less the jgit api so I can't vouch for quality or correctness ;-). I could snip some code out and send it to you off-list for inclusion in the wiki maybe.

later, j

--
J. Longman
longman@xxxxxxxxxxx

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material.  If you have received this in error, please contact the sender
and delete this communication and any copy immediately.  Thank you.


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux