{"thread":{"id":"16275","subject":"Newbie questions regarding jgit","startedAt":"2008-11-11T20:44:59Z","lastAt":"2008-11-12T19:29:05Z","messageCount":16,"participants":["Farrukh Najmi","Jonas Fonseca","Shawn O. Pearce","Imran M Yousuf"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"95485","messageId":"4919EECB.7070408@wellfleetsoftware.com","threadId":"16275","inReplyTo":null,"subject":"Newbie questions regarding jgit","fromName":"Farrukh Najmi","fromEmail":"farrukh@wellfleetsoftware.com","sentAt":"2008-11-11T20:44:59Z","receivedAt":"2008-11-11T20:44:59Z","isPatch":false,"sender":{"key":"farrukh@wellfleetsoftware.com","avatar":"https://gravatar.com/avatar/92ea2740412df69f91bfc2c8a6aae915e01802f2bba9d646689e0ee3aa2d7d3f?d=mp&s=160"},"body":"\nHi all,\n\nI am git newbie and looking to use jgit in a servlet endpoint.\n\nWhere can I find a public maven repo for gjit? It seems there is one \nsomewhere because of the following file in src tree:\n\njgit-maven/jgit/pom.xml\n\nFor now I have built the jar using /make_jgit.sh and installed the pom \nmanually using m\n\nmvn install:install-file -DpomFile=jgit-maven/jgit/pom.xml -Dfile=jgit.jar\n\nI have added the following dependency to my maven project's pom.xml:\n\n   <dependency>\n     <groupId>org.spearce</groupId>\n     <artifactId>jgit</artifactId>\n     <version>0.4-SNAPSHOT</version>\n   </dependency>\n\nNow I am wondering where to begin to learn how to do the equivalent of \nthe following commands via the gjit Java API:\n\n    * git add /file/\n    * git rm /file/\n    * git mv /file\n    * Whatever is the git way to get a specific version of a file\n\n\nI am hoping that there aremore docs, samples, tutorials etc. somewhere \nthat I am missing. Thanks for any help you can provide. Some pointers or \ncode fragments would be terrific.\n\n-- \nRegards,\nFarrukh Najmi\n\nWeb: http://www.wellfleetsoftware.com\n"},{"id":"95492","messageId":"4919F55A.3050008@wellfleetsoftware.com","threadId":"16275","inReplyTo":"4919EECB.7070408@wellfleetsoftware.com","subject":"Re: Newbie questions regarding jgit","fromName":"Farrukh Najmi","fromEmail":"farrukh@wellfleetsoftware.com","sentAt":"2008-11-11T21:12:58Z","receivedAt":"2008-11-11T21:12:58Z","isPatch":false,"sender":{"key":"farrukh@wellfleetsoftware.com","avatar":"https://gravatar.com/avatar/92ea2740412df69f91bfc2c8a6aae915e01802f2bba9d646689e0ee3aa2d7d3f?d=mp&s=160"},"body":"\nI should clarify that I am not using eclipse nor am I using any GUI. My \nobjective is to have Java API access to git from within a servlet using \njgit. At present, all I have to go on is javadoc and its not clear where \nto begin if I simply wish to create, read and update files in a git repo \nfrom within the servlet java code.\n\nTIA for your help.\n\nFarrukh Najmi wrote:\n>\n> Hi all,\n>\n> I am git newbie and looking to use jgit in a servlet endpoint.\n>\n> Where can I find a public maven repo for gjit? It seems there is one \n> somewhere because of the following file in src tree:\n>\n> jgit-maven/jgit/pom.xml\n>\n> For now I have built the jar using /make_jgit.sh and installed the pom \n> manually using m\n>\n> mvn install:install-file -DpomFile=jgit-maven/jgit/pom.xml \n> -Dfile=jgit.jar\n>\n> I have added the following dependency to my maven project's pom.xml:\n>\n>   <dependency>\n>     <groupId>org.spearce</groupId>\n>     <artifactId>jgit</artifactId>\n>     <version>0.4-SNAPSHOT</version>\n>   </dependency>\n>\n> Now I am wondering where to begin to learn how to do the equivalent of \n> the following commands via the gjit Java API:\n>\n>    * git add /file/\n>    * git rm /file/\n>    * git mv /file\n>    * Whatever is the git way to get a specific version of a file\n>\n>\n> I am hoping that there aremore docs, samples, tutorials etc. somewhere \n> that I am missing. Thanks for any help you can provide. Some pointers \n> or code fragments would be terrific.\n>\n\n\n-- \nRegards,\nFarrukh Najmi\n\nWeb: http://www.wellfleetsoftware.com\n"},{"id":"95494","messageId":"2c6b72b30811111337v2fe23c75v25251838f721a007@mail.gmail.com","threadId":"16275","inReplyTo":"4919EECB.7070408@wellfleetsoftware.com","subject":"Re: Newbie questions regarding jgit","fromName":"Jonas Fonseca","fromEmail":"jonas.fonseca@gmail.com","sentAt":"2008-11-11T21:37:40Z","receivedAt":"2008-11-11T21:37:40Z","isPatch":false,"sender":{"key":"jonas.fonseca@gmail.com","avatar":"https://gravatar.com/avatar/9b7fa23cce50269e5d164312b6ac5ae818a180f837b38f28f3bdf689dd7f96cd?d=mp&s=160"},"body":"On Tue, Nov 11, 2008 at 21:44, Farrukh Najmi\n<farrukh@wellfleetsoftware.com> wrote:\n> Hi all,\n\nHello,\n\n> I am git newbie and looking to use jgit in a servlet endpoint.\n\nSounds interesting. I have been thinking about how hard it would be to\nwrite a very simpe jgitweb kind of thing and am very interested to\nhear more about your experiences.\n\n> Where can I find a public maven repo for gjit? It seems there is one\n> somewhere because of the following file in src tree:\n\nI would also like to have a public available maven repository for\nJGit. If Shawn or Robin acks, I can look into hosting one in the SVN\narea of the Google Code project page. Given the lack of a real release\ncycle it probably only makes sense to have a snapshot repository.\n\n> Now I am wondering where to begin to learn how to do the equivalent of the\n> following commands via the gjit Java API:\n>\n>   * git add /file/\n>   * git rm /file/\n>   * git mv /file\n>   * Whatever is the git way to get a specific version of a file\n\nJGit currently has two APIs for working with the index, which will\nallow you to add, remove and move data around in the tree. In nbgit I\nended up using GitIndex, which I found easier to figure out. As I\nunderstand it, in the long run you want to use the DirCache API, but\nit is still a work in progress.\n\n> I am hoping that there aremore docs, samples, tutorials etc. somewhere that\n> I am missing. Thanks for any help you can provide. Some pointers or code\n> fragments would be terrific.\n\nI started working on a tutorial for JGit, but didn't get very far so\nit mostly consists of stub pages.\n\n - http://code.google.com/docreader/#p=egit&s=egit&t=JGitTutorial\n\nI have been working on moving the tutorial to maven project before\nstarting to write the more code heavy topics. This would make it\npossible to include code snippets in the tutorial, while also allowing\nto compile and test the examples.\n\n-- \nJonas Fonseca\n"},{"id":"95495","messageId":"20081111214434.GS2932@spearce.org","threadId":"16275","inReplyTo":"2c6b72b30811111337v2fe23c75v25251838f721a007@mail.gmail.com","subject":"Re: Newbie questions regarding jgit","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-11-11T21:44:34Z","receivedAt":"2008-11-11T21:44:34Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Jonas Fonseca <jonas.fonseca@gmail.com> wrote:\n> \n> I would also like to have a public available maven repository for\n> JGit. If Shawn or Robin acks, I can look into hosting one in the SVN\n> area of the Google Code project page. Given the lack of a real release\n> cycle it probably only makes sense to have a snapshot repository.\n\nI have an account on kernel.org and was planning on hosting snapshots\nthere, but I haven't had time to think about setting up a jgit area\nand pushing something into it.  ;-)\n\nWe could also just host it in SVN in Google Code.  I can give\nyou admin rights on the egit project if you want to set it up and\nmaintain it there.  The downside is you need to use svn or git-svn\nto upload files to it, right?\n\n-- \nShawn.\n"},{"id":"95497","messageId":"2c6b72b30811111401i3c995889n54407243a1072599@mail.gmail.com","threadId":"16275","inReplyTo":"20081111214434.GS2932@spearce.org","subject":"Re: Newbie questions regarding jgit","fromName":"Jonas Fonseca","fromEmail":"jonas.fonseca@gmail.com","sentAt":"2008-11-11T22:01:01Z","receivedAt":"2008-11-11T22:01:01Z","isPatch":false,"sender":{"key":"jonas.fonseca@gmail.com","avatar":"https://gravatar.com/avatar/9b7fa23cce50269e5d164312b6ac5ae818a180f837b38f28f3bdf689dd7f96cd?d=mp&s=160"},"body":"On Tue, Nov 11, 2008 at 22:44, Shawn O. Pearce <spearce@spearce.org> wrote:\n> Jonas Fonseca <jonas.fonseca@gmail.com> wrote:\n>> I would also like to have a public available maven repository for\n>> JGit. If Shawn or Robin acks, I can look into hosting one in the SVN\n>> area of the Google Code project page. Given the lack of a real release\n>> cycle it probably only makes sense to have a snapshot repository.\n>\n> I have an account on kernel.org and was planning on hosting snapshots\n> there, but I haven't had time to think about setting up a jgit area\n> and pushing something into it.  ;-)\n\nIf you prefer that ...\n\n> We could also just host it in SVN in Google Code.  I can give\n> you admin rights on the egit project if you want to set it up and\n> maintain it there.  The downside is you need to use svn or git-svn\n> to upload files to it, right?\n\nI don't think admin rights are necessary as long as I have\n\"commit\"/webdav access. And no svn or git-svn interaction should be\nneeded to upload to the maven repository.\n\nTake a look at the distributionManagement section of the\ngoogle-maven-repository:\n\n - http://google-maven-repository.googlecode.com/svn/repository/com/google/google/1/google-1.pom\n\nLooks pretty easy to set up. About maintaining it, I don't mind doing\n\"mvn deploy\" once in a while, but some kind of update policy should\nprobably be worked out in any case.\n\n-- \nJonas Fonseca\n"},{"id":"95502","messageId":"20081111231106.GT2932@spearce.org","threadId":"16275","inReplyTo":"2c6b72b30811111401i3c995889n54407243a1072599@mail.gmail.com","subject":"Re: Newbie questions regarding jgit","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-11-11T23:11:06Z","receivedAt":"2008-11-11T23:11:06Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Jonas Fonseca <jonas.fonseca@gmail.com> wrote:\n> \n> I don't think admin rights are necessary as long as I have\n> \"commit\"/webdav access. And no svn or git-svn interaction should be\n> needed to upload to the maven repository.\n> \n> Take a look at the distributionManagement section of the\n> google-maven-repository:\n> \n>  - http://google-maven-repository.googlecode.com/svn/repository/com/google/google/1/google-1.pom\n> \n> Looks pretty easy to set up. About maintaining it, I don't mind doing\n> \"mvn deploy\" once in a while, but some kind of update policy should\n> probably be worked out in any case.\n\nThen have at it.  It sounds like it would be worthwhile setting up.\n\n-- \nShawn.\n"},{"id":"95508","messageId":"20081111234858.GA17662@diku.dk","threadId":"16275","inReplyTo":"20081111231106.GT2932@spearce.org","subject":"[PATCH] Add maven distribution management info for the new snapshot repository","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2008-11-11T23:48:58Z","receivedAt":"2008-11-11T23:48:58Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Signed-off-by: Jonas Fonseca <fonseca@diku.dk>\n---\n jgit-maven/jgit/pom.xml |    8 ++++++++\n 1 files changed, 8 insertions(+), 0 deletions(-)\n\n Shawn O. Pearce <spearce@spearce.org> wrote Tue, Nov 11, 2008:\n > Jonas Fonseca <jonas.fonseca@gmail.com> wrote:\n > > I don't think admin rights are necessary as long as I have\n > > \"commit\"/webdav access. And no svn or git-svn interaction should be\n > > needed to upload to the maven repository.\n > \n > Then have at it.  It sounds like it would be worthwhile setting up.\n\n Instructions at http://code.google.com/p/egit/wiki/ConfiguringMaven\n\ndiff --git a/jgit-maven/jgit/pom.xml b/jgit-maven/jgit/pom.xml\nindex a123470..c370783 100644\n--- a/jgit-maven/jgit/pom.xml\n+++ b/jgit-maven/jgit/pom.xml\n@@ -185,4 +185,12 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n             <scope>compile</scope>\n         </dependency>\n     </dependencies>\n+    <distributionManagement>\n+        <snapshotRepository>\n+            <id>jgit-maven-snapshot-repository</id>\n+            <name>JGit Maven Snapshot Repository</name>\n+            <url>dav:https://egit.googlecode.com/svn/maven/snapshot-repository/</url>\n+            <uniqueVersion>true</uniqueVersion>\n+        </snapshotRepository>\n+    </distributionManagement>\n </project>\n-- \n1.6.0.3.866.gc189b\n\n-- \nJonas Fonseca\n"},{"id":"95522","messageId":"20081112005838.GU2932@spearce.org","threadId":"16275","inReplyTo":"20081111234858.GA17662@diku.dk","subject":"Re: [PATCH] Add maven distribution management info for the new snapshot repository","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-11-12T00:58:38Z","receivedAt":"2008-11-12T00:58:38Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Jonas Fonseca <fonseca@diku.dk> wrote:\n>  Shawn O. Pearce <spearce@spearce.org> wrote Tue, Nov 11, 2008:\n>  > Jonas Fonseca <jonas.fonseca@gmail.com> wrote:\n>  > > I don't think admin rights are necessary as long as I have\n>  > > \"commit\"/webdav access. And no svn or git-svn interaction should be\n>  > > needed to upload to the maven repository.\n>  > \n>  > Then have at it.  It sounds like it would be worthwhile setting up.\n> \n>  Instructions at http://code.google.com/p/egit/wiki/ConfiguringMaven\n> \n> diff --git a/jgit-maven/jgit/pom.xml b/jgit-maven/jgit/pom.xml\n> index a123470..c370783 100644\n> --- a/jgit-maven/jgit/pom.xml\n> +++ b/jgit-maven/jgit/pom.xml\n> @@ -185,4 +185,12 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n>              <scope>compile</scope>\n>          </dependency>\n>      </dependencies>\n> +    <distributionManagement>\n> +        <snapshotRepository>\n> +            <id>jgit-maven-snapshot-repository</id>\n> +            <name>JGit Maven Snapshot Repository</name>\n> +            <url>dav:https://egit.googlecode.com/svn/maven/snapshot-repository/</url>\n\nShouldn't that be http:// and not https:// ?\n\nThe https interface asked me for a username/password, the\nhttp:// one doesn't.  We want this to be public, don't we?\n\n-- \nShawn.\n"},{"id":"95523","messageId":"20081112010102.GV2932@spearce.org","threadId":"16275","inReplyTo":"20081112005838.GU2932@spearce.org","subject":"Re: [PATCH] Add maven distribution management info for the new snapshot repository","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-11-12T01:01:02Z","receivedAt":"2008-11-12T01:01:02Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n> Jonas Fonseca <fonseca@diku.dk> wrote:\n> > +    <distributionManagement>\n> > +        <snapshotRepository>\n> > +            <id>jgit-maven-snapshot-repository</id>\n> > +            <name>JGit Maven Snapshot Repository</name>\n> > +            <url>dav:https://egit.googlecode.com/svn/maven/snapshot-repository/</url>\n> \n> Shouldn't that be http:// and not https:// ?\n\nOh, wait, never mind me.\n\nI guess this makes sense; https:// for the distribution upload,\nbut the wiki page you added uses plain http:// for download.\n\nPatch applied.\n \n-- \nShawn.\n"},{"id":"95525","messageId":"7bfdc29a0811111824v759e4afbu399b79b3dab068dd@mail.gmail.com","threadId":"16275","inReplyTo":"20081111231106.GT2932@spearce.org","subject":"Re: Newbie questions regarding jgit","fromName":"Imran M Yousuf","fromEmail":"imyousuf@gmail.com","sentAt":"2008-11-12T02:24:46Z","receivedAt":"2008-11-12T02:24:46Z","isPatch":false,"sender":{"key":"imyousuf@gmail.com","avatar":"https://gravatar.com/avatar/fda3c870262849d03c7b9c4d288842e128d6d80769fa7bc2d22731b7597928be?d=mp&s=160"},"body":"On Wed, Nov 12, 2008 at 5:11 AM, Shawn O. Pearce <spearce@spearce.org> wrote:\n> Jonas Fonseca <jonas.fonseca@gmail.com> wrote:\n>>\n>> I don't think admin rights are necessary as long as I have\n>> \"commit\"/webdav access. And no svn or git-svn interaction should be\n>> needed to upload to the maven repository.\n>>\n>> Take a look at the distributionManagement section of the\n>> google-maven-repository:\n>>\n>>  - http://google-maven-repository.googlecode.com/svn/repository/com/google/google/1/google-1.pom\n>>\n>> Looks pretty easy to set up. About maintaining it, I don't mind doing\n>> \"mvn deploy\" once in a while, but some kind of update policy should\n>> probably be worked out in any case.\n>\n> Then have at it.  It sounds like it would be worthwhile setting up.\n>\n\nThis idea is cool!\n\n> --\n> Shawn.\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n\n\n\n-- \nImran M Yousuf\nEntrepreneur & Software Engineer\nSmart IT Engineering\nDhaka, Bangladesh\nEmail: imran@smartitengineering.com\nBlog: http://imyousuf-tech.blogs.smartitengineering.com/\nMobile: +880-1711402557\n"},{"id":"95557","messageId":"491AD149.8040905@wellfleetsoftware.com","threadId":"16275","inReplyTo":"2c6b72b30811111401i3c995889n54407243a1072599@mail.gmail.com","subject":"Re: Newbie questions regarding jgit","fromName":"Farrukh Najmi","fromEmail":"farrukh@wellfleetsoftware.com","sentAt":"2008-11-12T12:51:21Z","receivedAt":"2008-11-12T12:51:21Z","isPatch":false,"sender":{"key":"farrukh@wellfleetsoftware.com","avatar":"https://gravatar.com/avatar/92ea2740412df69f91bfc2c8a6aae915e01802f2bba9d646689e0ee3aa2d7d3f?d=mp&s=160"},"body":"\nThe jgit team, rocks! You guys are  simply awesome in your \nresponsiveness. Thanks for a great project.\n\nPlease let me know if I can help with any maven related issues. Here is \na couple of\nlinks I use to evangelize use of maven in OS projects:\n\nWhy Maven Rocks:\n<http://farrukhnajmi.blogspot.com/2008/02/why-maven-rocks-in-beginning-there-was.html>\n\nWhy Maven - Wiki Page:\n<http://ebxmlrr.wiki.sourceforge.net/whymaven>\n\nHere are the main resources I use as reference for maven:\n\nMaven Official Docs:\n<http://maven.apache.org/guides/index.html>\n\nBetter Builds With Maven:\n<http://www.topazproject.org/trac/attachment/wiki/MavenInfo/BetterBuildsWithMaven.pdf?format=raw>\n\nI think it is great that the project supports maven at least partially \ntoday.\nI would suggest the project consider maven for all its \nbuild/configuration management at some point in future.\nIt takes a little learning curve initially (most for dev team members \nnot users) but pays off handsomely very quickly.\n\nJonas Fonseca wrote:\n...\n> On Tue, Nov 11, 2008 at 22:44, Shawn O. Pearce <spearce@spearce.org> wrote:\n>   \n>> Jonas Fonseca <jonas.fonseca@gmail.com> wrote:\n>>     \n>>> I would also like to have a public available maven repository for\n>>> JGit. If Shawn or Robin acks, I can look into hosting one in the SVN\n>>> area of the Google Code project page. Given the lack of a real release\n>>> cycle it probably only makes sense to have a snapshot repository.\n>>>       \n...\n\n-- \nRegards,\nFarrukh Najmi\n\nWeb: http://www.wellfleetsoftware.com\n"},{"id":"95561","messageId":"491AE2BD.7080103@wellfleetsoftware.com","threadId":"16275","inReplyTo":"2c6b72b30811111337v2fe23c75v25251838f721a007@mail.gmail.com","subject":"Re: Newbie questions regarding jgit","fromName":"Farrukh Najmi","fromEmail":"farrukh@wellfleetsoftware.com","sentAt":"2008-11-12T14:05:49Z","receivedAt":"2008-11-12T14:05:49Z","isPatch":false,"sender":{"key":"farrukh@wellfleetsoftware.com","avatar":"https://gravatar.com/avatar/92ea2740412df69f91bfc2c8a6aae915e01802f2bba9d646689e0ee3aa2d7d3f?d=mp&s=160"},"body":"Jonas Fonseca wrote:\n...\n>   \n>> Now I am wondering where to begin to learn how to do the equivalent of the\n>> following commands via the gjit Java API:\n>>\n>>   * git add /file/\n>>   * git rm /file/\n>>   * git mv /file\n>>   * Whatever is the git way to get a specific version of a file\n>>     \n>\n> JGit currently has two APIs for working with the index, which will\n> allow you to add, remove and move data around in the tree. In nbgit I\n> ended up using GitIndex, which I found easier to figure out. As I\n> understand it, in the long run you want to use the DirCache API, but\n> it is still a work in progress.\n>   \n\nI am happy to use GitIndex now and switch to DirCache API later when it \nis ready.\nCan I please get some pseudo-code fragments on how to do the use cases I \nidentified above?\nThe javadoc is still not obvious to me.\n>   \n>> I am hoping that there aremore docs, samples, tutorials etc. somewhere that\n>> I am missing. Thanks for any help you can provide. Some pointers or code\n>> fragments would be terrific.\n>>     \n>\n> I started working on a tutorial for JGit, but didn't get very far so\n> it mostly consists of stub pages.\n>\n>  - http://code.google.com/docreader/#p=egit&s=egit&t=JGitTutorial\n>\n> I have been working on moving the tutorial to maven project before\n> starting to write the more code heavy topics. This would make it\n> possible to include code snippets in the tutorial, while also allowing\n> to compile and test the examples.\n>   \n\nThe wiki is an awesome resource even in its current state. Thank you.\nI would be glad to help contribute improvements to wiki if you give me\nwrite privilege. What I could do is take the help I get from the list and\nthen update wiki carefully as appropriate if you want me to help.\n\nThanks again to all of you for helping get me bootstrapped with gjit and \ngit.\n\n-- \nRegards,\nFarrukh Najmi\n\nWeb: http://www.wellfleetsoftware.com\n"},{"id":"95565","messageId":"491AE91C.4020402@wellfleetsoftware.com","threadId":"16275","inReplyTo":"491AE2BD.7080103@wellfleetsoftware.com","subject":"Re: Newbie questions regarding jgit","fromName":"Farrukh Najmi","fromEmail":"farrukh@wellfleetsoftware.com","sentAt":"2008-11-12T14:33:00Z","receivedAt":"2008-11-12T14:33:00Z","isPatch":false,"sender":{"key":"farrukh@wellfleetsoftware.com","avatar":"https://gravatar.com/avatar/92ea2740412df69f91bfc2c8a6aae915e01802f2bba9d646689e0ee3aa2d7d3f?d=mp&s=160"},"body":"\nBTW, the context for what I am doing is as follows. I am implementing \nOASIS ebXML Registry/Repository (RegRep) 4 specs:\n\n<http://www.oasis-open.org/committees/download.php/29972>\n\nI would like to use git for the Repository part of the RegRep while a \nrelational database will hold the registry part which contains extensive \nmetadata about repository files. Later I will also evaluate if I can \nsomehow use git for the Registry part so I can leverage versioning \nfeatures of git. I would still need to have the Registry content \nduplicated in relational database to support querying of the metadata. \nThe standard eventually needs to support CheckIn/Checkout and I think a \ndistributed VCS like git would be very helpful in an implementation.\n\nFor those unfamiliar with RegRep as a technology think of it as \nproviding added value on top of a generic VCS, database or Content \nManagement system.\n\nFor my immediate needs, I need to implement a GitRepository class with \ntwo methods using gjit as shown below. I would appreciate any guidance \nand pseudo-code examples on how to implement these methods. Please keep \nin mind that I am just getting to know git itself and gjit was key to my \nconsidering git over Mercurial and other distributed VCSs.\n\npublic class GitRepositoryManager {\n\n    Repository gitRepo;\n\n    ...\n\n    /**\n     * Gets the content of specified file in git Repo.\n     *\n     * @parameter relativePath the relative path in jitRepo for  desired \nfile to get\n     * @parameter versionName the versionName for the desired file. It \nwill be unmarshalled from String to ObjectId.\n     * @return the content of the desired file version packaged as a \nDataHandler.\n     */\n    public DataHandler get(String relativePath, String versionName) \nthrows RepositoryException {\n        DataHandler dh = null;\n\n        ...\n       \n        return dh;\n    }\n\n    /**\n     * Creates a new version of specified version of file in git Repo.\n     *\n     * @parameter relativePath the relative path in jitRepo for  desired \nfile to get\n     * @parameter versionName the versionName for the desired file. It \nwill be unmarshalled from String to ObjectId.\n     * @parameter content the content of the new version for specified \nfile packaged as a DataHandler.\n     */\n    public void update(String relativePath, String versionName, \nDataHandler content) throws RepositoryException {\n        ...\n    }\n\n}\n\nFarrukh Najmi wrote:\n> Jonas Fonseca wrote:\n> ...\n>>  \n>>> Now I am wondering where to begin to learn how to do the equivalent \n>>> of the\n>>> following commands via the gjit Java API:\n>>>\n>>>   * git add /file/\n>>>   * git rm /file/\n>>>   * git mv /file\n>>>   * Whatever is the git way to get a specific version of a file\n>>>     \n>>\n>> JGit currently has two APIs for working with the index, which will\n>> allow you to add, remove and move data around in the tree. In nbgit I\n>> ended up using GitIndex, which I found easier to figure out. As I\n>> understand it, in the long run you want to use the DirCache API, but\n>> it is still a work in progress.\n>>   \n>\n> I am happy to use GitIndex now and switch to DirCache API later when \n> it is ready.\n> Can I please get some pseudo-code fragments on how to do the use cases \n> I identified above?\n> The javadoc is still not obvious to me.\n>>  \n>>> I am hoping that there aremore docs, samples, tutorials etc. \n>>> somewhere that\n>>> I am missing. Thanks for any help you can provide. Some pointers or \n>>> code\n>>> fragments would be terrific.\n>>>     \n>>\n>> I started working on a tutorial for JGit, but didn't get very far so\n>> it mostly consists of stub pages.\n>>\n>>  - http://code.google.com/docreader/#p=egit&s=egit&t=JGitTutorial\n>>\n>> I have been working on moving the tutorial to maven project before\n>> starting to write the more code heavy topics. This would make it\n>> possible to include code snippets in the tutorial, while also allowing\n>> to compile and test the examples.\n>>   \n>\n> The wiki is an awesome resource even in its current state. Thank you.\n> I would be glad to help contribute improvements to wiki if you give me\n> write privilege. What I could do is take the help I get from the list and\n> then update wiki carefully as appropriate if you want me to help.\n>\n> Thanks again to all of you for helping get me bootstrapped with gjit \n> and git.\n>\n\n\n-- \nRegards,\nFarrukh Najmi\n\nWeb: http://www.wellfleetsoftware.com\n"},{"id":"95597","messageId":"491B18C4.2070000@wellfleetsoftware.com","threadId":"16275","inReplyTo":"491AE91C.4020402@wellfleetsoftware.com","subject":"Re: Newbie questions regarding jgit","fromName":"Farrukh Najmi","fromEmail":"farrukh@wellfleetsoftware.com","sentAt":"2008-11-12T17:56:20Z","receivedAt":"2008-11-12T17:56:20Z","isPatch":false,"sender":{"key":"farrukh@wellfleetsoftware.com","avatar":"https://gravatar.com/avatar/92ea2740412df69f91bfc2c8a6aae915e01802f2bba9d646689e0ee3aa2d7d3f?d=mp&s=160"},"body":"\nSo far I have figured out how to get the treeWalk for the path filter as \nshown below.\nNow I am lost as to how to get the blob associated with the treeWalk. \nTIA for your help.\n\n   /**\n    * Gets the content of specified file in git Repo.\n    *\n    * @parameter relativePath the relative path in jitRepo for  desired \nfile to get\n    * @parameter versionName the versionName for the desired file. It \nwill be unmarshalled from String to ObjectId.\n    * @return the content of the desired file version packaged as a \nDataHandler.\n    */\n   public DataHandler get(String relativePath, String versionName) \nthrows RepositoryException {\n            ObjectId retrieveStart = repository.resolve(versionName);\n            RevWalk revWalk = new RevWalk(repository);\n            RevCommit entry = revWalk.parseCommit(retrieveStart);\n            RevTree revTree = entry.getTree();\n\n            TreeWalk treeWalk = TreeWalk.forPath(repository, \nrelativePath, revTree);\n\n            //Not sure how to get the blob next\n   }\n\nFarrukh Najmi wrote:\n....\n> For my immediate needs, I need to implement a GitRepository class with \n> two methods using gjit as shown below. I would appreciate any guidance \n> and pseudo-code examples on how to implement these methods. Please \n> keep in mind that I am just getting to know git itself and gjit was \n> key to my considering git over Mercurial and other distributed VCSs.\n>\n> public class GitRepositoryManager {\n>\n>    Repository gitRepo;\n>\n>    ...\n>\n>    /**\n>     * Gets the content of specified file in git Repo.\n>     *\n>     * @parameter relativePath the relative path in jitRepo for  \n> desired file to get\n>     * @parameter versionName the versionName for the desired file. It \n> will be unmarshalled from String to ObjectId.\n>     * @return the content of the desired file version packaged as a \n> DataHandler.\n>     */\n>    public DataHandler get(String relativePath, String versionName) \n> throws RepositoryException {\n>        DataHandler dh = null;\n>\n>        ...\n>              return dh;\n>    }\n>\n>    /**\n>     * Creates a new version of specified version of file in git Repo.\n>     *\n>     * @parameter relativePath the relative path in jitRepo for  \n> desired file to get\n>     * @parameter versionName the versionName for the desired file. It \n> will be unmarshalled from String to ObjectId.\n>     * @parameter content the content of the new version for specified \n> file packaged as a DataHandler.\n>     */\n>    public void update(String relativePath, String versionName, \n> DataHandler content) throws RepositoryException {\n>        ...\n>    }\n>\n> }\n>\n> Farrukh Najmi wrote:\n>> Jonas Fonseca wrote:\n>> ...\n>>>  \n>>>> Now I am wondering where to begin to learn how to do the equivalent \n>>>> of the\n>>>> following commands via the gjit Java API:\n>>>>\n>>>>   * git add /file/\n>>>>   * git rm /file/\n>>>>   * git mv /file\n>>>>   * Whatever is the git way to get a specific version of a file\n>>>>     \n>>>\n>>> JGit currently has two APIs for working with the index, which will\n>>> allow you to add, remove and move data around in the tree. In nbgit I\n>>> ended up using GitIndex, which I found easier to figure out. As I\n>>> understand it, in the long run you want to use the DirCache API, but\n>>> it is still a work in progress.\n>>>   \n>>\n>> I am happy to use GitIndex now and switch to DirCache API later when \n>> it is ready.\n>> Can I please get some pseudo-code fragments on how to do the use \n>> cases I identified above?\n>> The javadoc is still not obvious to me.\n>>>  \n>>>> I am hoping that there aremore docs, samples, tutorials etc. \n>>>> somewhere that\n>>>> I am missing. Thanks for any help you can provide. Some pointers or \n>>>> code\n>>>> fragments would be terrific.\n>>>>     \n>>>\n>>> I started working on a tutorial for JGit, but didn't get very far so\n>>> it mostly consists of stub pages.\n>>>\n>>>  - http://code.google.com/docreader/#p=egit&s=egit&t=JGitTutorial\n>>>\n>>> I have been working on moving the tutorial to maven project before\n>>> starting to write the more code heavy topics. This would make it\n>>> possible to include code snippets in the tutorial, while also allowing\n>>> to compile and test the examples.\n>>>   \n>>\n>> The wiki is an awesome resource even in its current state. Thank you.\n>> I would be glad to help contribute improvements to wiki if you give me\n>> write privilege. What I could do is take the help I get from the list \n>> and\n>> then update wiki carefully as appropriate if you want me to help.\n>>\n>> Thanks again to all of you for helping get me bootstrapped with gjit \n>> and git.\n>>\n>\n>\n\n\n-- \nRegards,\nFarrukh Najmi\n\nWeb: http://www.wellfleetsoftware.com\n"},{"id":"95613","messageId":"2c6b72b30811121030k73ed42d4q5bea76e2f8198656@mail.gmail.com","threadId":"16275","inReplyTo":"491B18C4.2070000@wellfleetsoftware.com","subject":"Re: Newbie questions regarding jgit","fromName":"Jonas Fonseca","fromEmail":"jonas.fonseca@gmail.com","sentAt":"2008-11-12T18:30:39Z","receivedAt":"2008-11-12T18:30:39Z","isPatch":false,"sender":{"key":"jonas.fonseca@gmail.com","avatar":"https://gravatar.com/avatar/9b7fa23cce50269e5d164312b6ac5ae818a180f837b38f28f3bdf689dd7f96cd?d=mp&s=160"},"body":"On Wed, Nov 12, 2008 at 18:56, Farrukh Najmi\n<farrukh@wellfleetsoftware.com> wrote:\n> So far I have figured out how to get the treeWalk for the path filter as\n> shown below.\n> Now I am lost as to how to get the blob associated with the treeWalk. TIA\n> for your help.\n\nFor ideas take a look at how the NetBeans git plugin accomplishes some\nof the most common git tasks take a look at the GitCommand.java file.\nIt contains code for adding and removing files, committing updates to\nthe index. There is also some code trying to get \"git-status\"\ninformation, but it is not very smart or clean. Something equivalent\nto \"git cat-file\" (getting the blob data) can be seen at line 120:\n\n - http://github.com/myabc/nbgit/tree/master/src/org/nbgit/util/GitCommand.java#L120\n\nSorry, I should have suggested this earlier.\n\n-- \nJonas Fonseca\n"},{"id":"95618","messageId":"20081112192905.GW2932@spearce.org","threadId":"16275","inReplyTo":"491B18C4.2070000@wellfleetsoftware.com","subject":"Re: Newbie questions regarding jgit","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-11-12T19:29:05Z","receivedAt":"2008-11-12T19:29:05Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Farrukh Najmi <farrukh@wellfleetsoftware.com> wrote:\n>\n> So far I have figured out how to get the treeWalk for the path filter as  \n> shown below.\n> Now I am lost as to how to get the blob associated with the treeWalk.  \n> TIA for your help.\n>\n>   /**\n>    * Gets the content of specified file in git Repo.\n>    *\n>    * @parameter relativePath the relative path in jitRepo for  desired  \n> file to get\n>    * @parameter versionName the versionName for the desired file. It  \n> will be unmarshalled from String to ObjectId.\n>    * @return the content of the desired file version packaged as a  \n> DataHandler.\n>    */\n>   public DataHandler get(String relativePath, String versionName) throws \n> RepositoryException {\n>            ObjectId retrieveStart = repository.resolve(versionName);\n>            RevWalk revWalk = new RevWalk(repository);\n>            RevCommit entry = revWalk.parseCommit(retrieveStart);\n>            RevTree revTree = entry.getTree();\n>\n>            TreeWalk treeWalk = TreeWalk.forPath(repository,  \n> relativePath, revTree);\n>\n>            //Not sure how to get the blob next\n\n\tif (treeWalk.next()) {\n\t\t// Path exists\n\t\tif (treeWalk.getFileMode(0).getObjectType() == Constants.OBJ_BLOB) {\n\t\t\tObjectId blob = treeWalk.getObjectId(0);\n\t\t} else {\n\t\t\t// Not a blob, its something else (tree, gitlink)\n\t\t}\n\t} else {\n\t\t// Path not found\n\t}\n\n-- \nShawn.\n"}]}