{"thread":{"id":"17166","subject":"jgit merge question","startedAt":"2009-01-14T07:55:14Z","lastAt":"2009-01-15T04:01:08Z","messageCount":7,"participants":["David Birchfield","Johannes Schindelin","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"100377","messageId":"4EDE3D74-CEA3-473C-ADD1-03B79AAB9EDF@asu.edu","threadId":"17166","inReplyTo":"S1760244AbZANHqN/20090114074613Z+1959@vger.kernel.org","subject":"jgit merge question","fromName":"David Birchfield","fromEmail":"dbirchfield@asu.edu","sentAt":"2009-01-14T07:55:14Z","receivedAt":"2009-01-14T07:55:14Z","isPatch":false,"sender":{"key":"dbirchfield@asu.edu","avatar":null},"body":"Hi all,\n\nMy apologies in advance for the newbie question, and I hope this is  \nthe correct forum - please let me know if there is a better place.\n\nI have been working with the JGit library and with the pgm files and  \nother documentation I have been able to implement most of the basic  \nfunctions that I need for my testing application - including fetch.   \nThis is great!  However, I have not been able to successfully  \nimplement the merge function with JGit.  There is some reference to  \nthis in the mail archive, but I cannot find any of the merge code that  \nis referenced in the distribution.  I have tried to pull from  \npgm.MergeBase.java, but that hasn't been successful.\n\nMy question:\nIs there any sort of tutorial or reference code snippet that  \nimplements merge?  Or is there a trick to getting the MergeBase code  \nto achieve a basic merge?\n\nThanks in advance!\n\nBest,\nDavid\n"},{"id":"100389","messageId":"alpine.DEB.1.00.0901141124460.3586@pacific.mpi-cbg.de","threadId":"17166","inReplyTo":"4EDE3D74-CEA3-473C-ADD1-03B79AAB9EDF@asu.edu","subject":"Re: jgit merge question","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-14T10:26:26Z","receivedAt":"2009-01-14T10:26:26Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 14 Jan 2009, David Birchfield wrote:\n\n> I have been working with the JGit library and with the pgm files and \n> other documentation I have been able to implement most of the basic \n> functions that I need for my testing application - including fetch.  \n> This is great!  However, I have not been able to successfully implement \n> the merge function with JGit. There is some reference to this in the \n> mail archive, but I cannot find any of the merge code that is referenced \n> in the distribution.\n\nYou mean\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/100524/focus=100589\n\n?\n\nYes, it has not been implemented, basically because it needs a diff \nimplementation, and I constantly run out of time working on it.  I have \nsomething that works, but needs lots of improvements to be usable \n(basically, it has to avoid deep recursion depths).\n\nCiao,\nDscho\n"},{"id":"100419","messageId":"20090114153034.GZ10179@spearce.org","threadId":"17166","inReplyTo":"alpine.DEB.1.00.0901141124460.3586@pacific.mpi-cbg.de","subject":"Re: jgit merge question","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-01-14T15:30:34Z","receivedAt":"2009-01-14T15:30:34Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> On Wed, 14 Jan 2009, David Birchfield wrote:\n> \n> > I have been working with the JGit library and with the pgm files and \n> > other documentation I have been able to implement most of the basic \n> > functions that I need for my testing application - including fetch.  \n> > This is great!\n\nI'm glad JGit has been useful for you.\n\n> > However, I have not been able to successfully implement \n> > the merge function with JGit. There is some reference to this in the \n> > mail archive, but I cannot find any of the merge code that is referenced \n> > in the distribution.\n\nDavid is probably talking about the 8 patch series I proposed to add a\ncrude merge API to JGit.  The patches are available here, based on the\ncurrent JGit master:\n\n  http://android.git.kernel.org/?p=tools/egit.git;a=shortlog;h=refs/heads/for-gerrit2\n  git://android.git.kernel.org/tools/egit.git for-gerrit2\n\nas I'm still highly dependent upon this in Gerrit2, but I haven't\nbeen able to fix enough bugs and add enough unit tests to make\nRobin happy with accepting them into the library.  I plan to get\nback to that as soon as Gerrit2 is live for Android.\n\nThat API is a very, very crude merge API.  I don't like coding\nwith it from the application level.  It doesn't give Gerrit2\nenough error information when it fails, and that means any other\napplication will also be unhappy with it.\n\nIt also has at least one bug, but at least its a conservative bug\n(it won't merge subtrees sometimes and aborts even though they\nshould have merged clean).  Its also missing a huge block of code\nabout head simplification; that block is in Gerrit2 application\ncode rather than down in the library (that was a mistake in design).\n\nSo basically, yea, I've proposed something, but there are some very\ngood reasons why there isn't merge support yet in JGit.\n\n> http://thread.gmane.org/gmane.comp.version-control.git/100524/focus=100589\n\nYea, we also need the diff implementation so we can do file-level\nmerges.  That merge API above only does path-level merges.  If a\nfile is modified on both sides, the merge API I use in Gerrit2\njust aborts.  That typically isn't what a human who is trying to\nuse Git for development wants.\n \n> Yes, it has not been implemented, basically because it needs a diff \n> implementation, and I constantly run out of time working on it.  I have \n> something that works, but needs lots of improvements to be usable \n> (basically, it has to avoid deep recursion depths).\n\nWhat's a little stack space between friends?  ;-)\n\n-- \nShawn.\n"},{"id":"100504","messageId":"AB447EEF7BAAB7489B29A4F3F788D02C01CDD792@EX07.asurite.ad.asu.edu","threadId":"17166","inReplyTo":"20090114153034.GZ10179@spearce.org","subject":"RE: jgit merge question","fromName":"David Birchfield","fromEmail":"dbirchfield@asu.edu","sentAt":"2009-01-14T22:03:42Z","receivedAt":"2009-01-14T22:03:42Z","isPatch":false,"sender":{"key":"dbirchfield@asu.edu","avatar":null},"body":"Great - thanks so much for this feedback and link.  My merge needs are straightforward, so hopefully this will suit the need!\n\nI have pulled the latest jgit updates and downloaded the four .java files that are referenced in your link.  I have added these to the directory structure for jgit in the following new folder: org.spearce.jgit/src/org/spearce/jgit/merge/\n\nHowever, when I try to now make_jgit.sh I am getting a series of errors (pasted below) that appear to stem from not having the same underlying files.  Is it possible that I am not getting the most recent jgit release files?  Or am I misunderstanding how you expect these Merge files to be used?\n\nThanks again,\nDavid\n\n<errors>\nEntering org.spearce.jgit ...\n./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:45: cannot find symbol\nsymbol  : class UnmergedPathException\nlocation: package org.spearce.jgit.errors\nimport org.spearce.jgit.errors.UnmergedPathException;\n                               ^\n./org/spearce/jgit/merge/Merger.java:184: cannot find symbol\nsymbol  : constructor CanonicalTreeParser(<nulltype>,org.spearce.jgit.lib.Repository,org.spearce.jgit.revwalk.RevTree,org.spearce.jgit.lib.WindowCursor)\nlocation: class org.spearce.jgit.treewalk.CanonicalTreeParser\n\t\t\treturn new CanonicalTreeParser(null, db, base.getTree(), curs);\n                               ^\n./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:98: cannot find symbol\nsymbol  : method newInCore()\nlocation: class org.spearce.jgit.dircache.DirCache\n\t\t\tcache = DirCache.newInCore();\n                                        ^\n./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:123: cannot find symbol\nsymbol  : variable STAGE_0\nlocation: class org.spearce.jgit.dircache.DirCacheEntry\n\t\t\t\t\tadd(T_THEIRS, DirCacheEntry.STAGE_0);\n                                                                   ^\n./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:125: cannot find symbol\nsymbol  : variable STAGE_0\nlocation: class org.spearce.jgit.dircache.DirCacheEntry\n\t\t\t\t\tadd(T_OURS, DirCacheEntry.STAGE_0);\n                                                                 ^\n./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:137: cannot find symbol\nsymbol  : method writeTree(org.spearce.jgit.lib.ObjectWriter)\nlocation: class org.spearce.jgit.dircache.DirCache\n\t\t\t\tresultTree = cache.writeTree(getObjectWriter());\n                                                  ^\n./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:139: cannot find symbol\nsymbol  : class UnmergedPathException\nlocation: class org.spearce.jgit.merge.StrategySimpleTwoWayInCore.InCoreMerger\n\t\t\t} catch (UnmergedPathException upe) {\n                                 ^\n./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:147: cannot find symbol\nsymbol  : method getRawPath()\nlocation: class org.spearce.jgit.treewalk.NameConflictTreeWalk\n\t\t\t\tbuilder.addTree(tw.getRawPath(), db, tw.getObjectId(1));\n                                                  ^\n./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:149: cannot find symbol\nsymbol  : variable STAGE_0\nlocation: class org.spearce.jgit.dircache.DirCacheEntry\n\t\t\t\tadd(T_OURS, DirCacheEntry.STAGE_0);\n                                                         ^\n./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:153: cannot find symbol\nsymbol  : variable STAGE_1\nlocation: class org.spearce.jgit.dircache.DirCacheEntry\n\t\t\tadd(T_BASE, DirCacheEntry.STAGE_1);\n                                                 ^\n./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:154: cannot find symbol\nsymbol  : variable STAGE_2\nlocation: class org.spearce.jgit.dircache.DirCacheEntry\n\t\t\tadd(T_OURS, DirCacheEntry.STAGE_2);\n                                                 ^\n./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:155: cannot find symbol\nsymbol  : variable STAGE_3\nlocation: class org.spearce.jgit.dircache.DirCacheEntry\n\t\t\tadd(T_THEIRS, DirCacheEntry.STAGE_3);\n                                                   ^\n./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:163: cannot find symbol\nsymbol  : method getRawPath()\nlocation: class org.spearce.jgit.treewalk.NameConflictTreeWalk\n\t\t\t\te = new DirCacheEntry(tw.getRawPath(), stage);\n                                                        ^\n./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:163: internal error; cannot instantiate org.spearce.jgit.dircache.DirCacheEntry.<init> at org.spearce.jgit.dircache.DirCacheEntry to ()\n\t\t\t\te = new DirCacheEntry(tw.getRawPath(), stage);\n                                    ^\n\n</errors\n\n\n\n\n-----Original Message-----\n\nDavid is probably talking about the 8 patch series I proposed to add a\ncrude merge API to JGit.  The patches are available here, based on the\ncurrent JGit master:\n\n  http://android.git.kernel.org/?p=tools/egit.git;a=shortlog;h=refs/heads/for-gerrit2\n  git://android.git.kernel.org/tools/egit.git for-gerrit2\n"},{"id":"100507","messageId":"20090114231222.GB10179@spearce.org","threadId":"17166","inReplyTo":"AB447EEF7BAAB7489B29A4F3F788D02C01CDD792@EX07.asurite.ad.asu.edu","subject":"Re: jgit merge question","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-01-14T23:12:22Z","receivedAt":"2009-01-14T23:12:22Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"David Birchfield <dbirchfield@asu.edu> wrote:\n> Great - thanks so much for this feedback and link.  My merge\n> needs are straightforward, so hopefully this will suit the need!\n> \n> I have pulled the latest jgit updates and downloaded the four\n> .java files that are referenced in your link.  I have added these\n> to the directory structure for jgit in the following new folder:\n> org.spearce.jgit/src/org/spearce/jgit/merge/\n\nInstead of copying 4 files, why don't you actually fetch the 8\ncommits and merge them into your local repository?  You are getting\nbuild errors because you didn't get an exception type in the errors\ndirectory, and at least two existing classes had new methods added\nto them in order to support the merge API.\n\n-- \nShawn.\n"},{"id":"100540","messageId":"7F1F22DF-7E4F-4888-A404-2A68F663989A@asu.edu","threadId":"17166","inReplyTo":"20090114231222.GB10179@spearce.org","subject":"Re: jgit merge question","fromName":"David Birchfield","fromEmail":"dbirchfield@asu.edu","sentAt":"2009-01-15T03:47:17Z","receivedAt":"2009-01-15T03:47:17Z","isPatch":false,"sender":{"key":"dbirchfield@asu.edu","avatar":null},"body":"thanks again for your help, and really sorry for the newbie questions.\n\nhow do I grab those 8 commits?\n\nI did originally use git clone on this uri: git:// \nandroid.git.kernel.org/tools/egit.git - but I don't see the  \nmodifications there.\n\nthanks again,\ndavid\n\n\nOn Jan 14, 2009, at 4:12 PM, Shawn O. Pearce wrote:\n\n>>\n>\n> Instead of copying 4 files, why don't you actually fetch the 8\n> commits and merge them into your local repository?  You are getting\n> build errors because you didn't get an exception type in the errors\n> directory, and at least two existing classes had new methods added\n> to them in order to support the merge API.\n>\n> -- \n> Shawn.\n"},{"id":"100542","messageId":"20090115040108.GD10179@spearce.org","threadId":"17166","inReplyTo":"7F1F22DF-7E4F-4888-A404-2A68F663989A@asu.edu","subject":"Re: jgit merge question","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-01-15T04:01:08Z","receivedAt":"2009-01-15T04:01:08Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"David Birchfield <dbirchfield@asu.edu> wrote:\n> thanks again for your help, and really sorry for the newbie questions.\n>\n> how do I grab those 8 commits?\n>\n> I did originally use git clone on this uri: git:// \n> android.git.kernel.org/tools/egit.git - but I don't see the  \n> modifications there.\n\nThey are in a side branch:\n\n  git pull git://android.git.kernel.org/tools/egit.git for-gerrit2\n\n-- \nShawn.\n"}]}