Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Extracting information of remote repository
Extracting information of remote repository [message #1384896] Mon, 02 June 2014 20:57 Go to next message
Dol Bik is currently offline Dol BikFriend
Messages: 9
Registered: April 2014
Junior Member
I'm trying to extract some information like name, size, last modified, etc. from remote repositories using JGit.
Let's take a random GitHub repository. There would be something like build, src, test etc. with some description and the last modified date.
How can I get these information with JGit?
I'm not sure if I have to clone, to build or to do something else with the repository.
I'm using JGit for Eclipse, do I also need EGit?

I've found some old tutorials, but they don't work with the newest version of JGit (for example the imports are incorrect).

Could anybody please provide me with a working code snippet?
Re: Extracting information of remote repository [message #1385042 is a reply to message #1384896] Tue, 03 June 2014 21:58 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
For which objects are you trying to extract name, size, last modified etc ?
For most details about objects stored in git you need to clone the repository.

I don't understand how jgit should be able to provide any information about
the build of your project.
Re: Extracting information of remote repository [message #1385108 is a reply to message #1385042] Wed, 04 June 2014 11:45 Go to previous messageGo to next message
Dol Bik is currently offline Dol BikFriend
Messages: 9
Registered: April 2014
Junior Member
Let's take for example github.com/jquery/jquery. You can find there information like:

tjvantoll authored Friday at 10:13 PM
timmywil committed Monday at 10:43 PM

build	Release: ensure Sizzle is the latest tag	12 days ago
src	Wrap: Declare a dependency on the manipulation module	2 days ago
test	Ajax: Support usage without jQuery.event	2 days ago
[...]

I need information like these. Are there methods like getAuthor(), getLastCommit(), etc?
If not, is there another framework which can provide me with these information from Git?

[Updated on: Wed, 04 June 2014 11:49]

Report message to a moderator

Re: Extracting information of remote repository [message #1385442 is a reply to message #1385108] Fri, 06 June 2014 12:59 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
Dol Bik wrote on Wed, 04 June 2014 07:45
Let's take for example github.com/jquery/jquery. You can find there information like:

tjvantoll authored Friday at 10:13 PM
timmywil committed Monday at 10:43 PM

build	Release: ensure Sizzle is the latest tag	12 days ago
src	Wrap: Declare a dependency on the manipulation module	2 days ago
test	Ajax: Support usage without jQuery.event	2 days ago
[...]

I need information like these. Are there methods like getAuthor(), getLastCommit(), etc?
If not, is there another framework which can provide me with these information from Git?


on which exact page do you see this information, looking at
https://github.com/jquery/jquery
I can't see that
Re: Extracting information of remote repository [message #1385499 is a reply to message #1385442] Sat, 07 June 2014 14:20 Go to previous messageGo to next message
Dol Bik is currently offline Dol BikFriend
Messages: 9
Registered: April 2014
Junior Member
It's right there on this particular page:

index.php/fa/18227/0/
  • Attachment: jgit.png
    (Size: 42.96KB, Downloaded 325 times)

[Updated on: Sat, 07 June 2014 14:20]

Report message to a moderator

Re: Extracting information of remote repository [message #1385506 is a reply to message #1384896] Sat, 07 June 2014 20:54 Go to previous message
Robin Rosenberg is currently offline Robin RosenbergFriend
Messages: 332
Registered: July 2009
Senior Member
Dol Bik skrev 2014-06-02 22.57:
> I'm trying to extract some information like name, size, last modified, etc. from remote repositories using JGit.
> Let's take a random GitHub repository. There would be something like build, src, test etc. with some description and the last modified date.
> How can I get these information with JGit?
> I'm not sure if I have to clone, to build or to do something else with the repository.

Yes, you need to clone the repo in order to get at the kind of information you want.

> I'm using JGit for Eclipse, do I also need EGit?
>
> I've found some old tutorials, but they don't work with the newest version of JGit (for example the imports are incorrect).

org.spearce was renamed to org.eclipse, that might solve some problems. That was almost five years ago, so those tutorials
are pretty old and there are much better APIs nowadays. You should try to stick with the org.eclipse.jgit.api package as
much as possible.

> Could anybody please provide me with a working code snippet?

We don't have much tutorials on JGit, except what's been written by third parties, but there's a lot of code in the
form of unit tests, the pgm package and of course EGit.

-- robin
Previous Topic:Team->Share Project->Git sometimes doesn't create .gitignore in project root
Next Topic:resources being false dirty
Goto Forum:
  


Current Time: Fri Mar 29 14:45:52 GMT 2024

Powered by FUDForum. Page generated in 0.01787 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top