* jgit merge question [not found] <S1760244AbZANHqN/20090114074613Z+1959@vger.kernel.org> @ 2009-01-14 7:55 ` David Birchfield 2009-01-14 10:26 ` Johannes Schindelin 0 siblings, 1 reply; 7+ messages in thread From: David Birchfield @ 2009-01-14 7:55 UTC (permalink / raw) To: git Hi all, My apologies in advance for the newbie question, and I hope this is the correct forum - please let me know if there is a better place. I have been working with the JGit library and with the pgm files and other documentation I have been able to implement most of the basic functions that I need for my testing application - including fetch. This is great! However, I have not been able to successfully implement the merge function with JGit. There is some reference to this in the mail archive, but I cannot find any of the merge code that is referenced in the distribution. I have tried to pull from pgm.MergeBase.java, but that hasn't been successful. My question: Is there any sort of tutorial or reference code snippet that implements merge? Or is there a trick to getting the MergeBase code to achieve a basic merge? Thanks in advance! Best, David ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: jgit merge question 2009-01-14 7:55 ` jgit merge question David Birchfield @ 2009-01-14 10:26 ` Johannes Schindelin 2009-01-14 15:30 ` Shawn O. Pearce 0 siblings, 1 reply; 7+ messages in thread From: Johannes Schindelin @ 2009-01-14 10:26 UTC (permalink / raw) To: David Birchfield; +Cc: git Hi, On Wed, 14 Jan 2009, David Birchfield wrote: > I have been working with the JGit library and with the pgm files and > other documentation I have been able to implement most of the basic > functions that I need for my testing application - including fetch. > This is great! However, I have not been able to successfully implement > the merge function with JGit. There is some reference to this in the > mail archive, but I cannot find any of the merge code that is referenced > in the distribution. You mean http://thread.gmane.org/gmane.comp.version-control.git/100524/focus=100589 ? Yes, it has not been implemented, basically because it needs a diff implementation, and I constantly run out of time working on it. I have something that works, but needs lots of improvements to be usable (basically, it has to avoid deep recursion depths). Ciao, Dscho ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: jgit merge question 2009-01-14 10:26 ` Johannes Schindelin @ 2009-01-14 15:30 ` Shawn O. Pearce 2009-01-14 22:03 ` David Birchfield 0 siblings, 1 reply; 7+ messages in thread From: Shawn O. Pearce @ 2009-01-14 15:30 UTC (permalink / raw) To: Johannes Schindelin, David Birchfield; +Cc: git Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote: > On Wed, 14 Jan 2009, David Birchfield wrote: > > > I have been working with the JGit library and with the pgm files and > > other documentation I have been able to implement most of the basic > > functions that I need for my testing application - including fetch. > > This is great! I'm glad JGit has been useful for you. > > However, I have not been able to successfully implement > > the merge function with JGit. There is some reference to this in the > > mail archive, but I cannot find any of the merge code that is referenced > > in the distribution. David is probably talking about the 8 patch series I proposed to add a crude merge API to JGit. The patches are available here, based on the current JGit master: http://android.git.kernel.org/?p=tools/egit.git;a=shortlog;h=refs/heads/for-gerrit2 git://android.git.kernel.org/tools/egit.git for-gerrit2 as I'm still highly dependent upon this in Gerrit2, but I haven't been able to fix enough bugs and add enough unit tests to make Robin happy with accepting them into the library. I plan to get back to that as soon as Gerrit2 is live for Android. That API is a very, very crude merge API. I don't like coding with it from the application level. It doesn't give Gerrit2 enough error information when it fails, and that means any other application will also be unhappy with it. It also has at least one bug, but at least its a conservative bug (it won't merge subtrees sometimes and aborts even though they should have merged clean). Its also missing a huge block of code about head simplification; that block is in Gerrit2 application code rather than down in the library (that was a mistake in design). So basically, yea, I've proposed something, but there are some very good reasons why there isn't merge support yet in JGit. > http://thread.gmane.org/gmane.comp.version-control.git/100524/focus=100589 Yea, we also need the diff implementation so we can do file-level merges. That merge API above only does path-level merges. If a file is modified on both sides, the merge API I use in Gerrit2 just aborts. That typically isn't what a human who is trying to use Git for development wants. > Yes, it has not been implemented, basically because it needs a diff > implementation, and I constantly run out of time working on it. I have > something that works, but needs lots of improvements to be usable > (basically, it has to avoid deep recursion depths). What's a little stack space between friends? ;-) -- Shawn. ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: jgit merge question 2009-01-14 15:30 ` Shawn O. Pearce @ 2009-01-14 22:03 ` David Birchfield 2009-01-14 23:12 ` Shawn O. Pearce 0 siblings, 1 reply; 7+ messages in thread From: David Birchfield @ 2009-01-14 22:03 UTC (permalink / raw) To: git Great - thanks so much for this feedback and link. My merge needs are straightforward, so hopefully this will suit the need! I 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/ However, 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? Thanks again, David <errors> Entering org.spearce.jgit ... ./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:45: cannot find symbol symbol : class UnmergedPathException location: package org.spearce.jgit.errors import org.spearce.jgit.errors.UnmergedPathException; ^ ./org/spearce/jgit/merge/Merger.java:184: cannot find symbol symbol : constructor CanonicalTreeParser(<nulltype>,org.spearce.jgit.lib.Repository,org.spearce.jgit.revwalk.RevTree,org.spearce.jgit.lib.WindowCursor) location: class org.spearce.jgit.treewalk.CanonicalTreeParser return new CanonicalTreeParser(null, db, base.getTree(), curs); ^ ./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:98: cannot find symbol symbol : method newInCore() location: class org.spearce.jgit.dircache.DirCache cache = DirCache.newInCore(); ^ ./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:123: cannot find symbol symbol : variable STAGE_0 location: class org.spearce.jgit.dircache.DirCacheEntry add(T_THEIRS, DirCacheEntry.STAGE_0); ^ ./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:125: cannot find symbol symbol : variable STAGE_0 location: class org.spearce.jgit.dircache.DirCacheEntry add(T_OURS, DirCacheEntry.STAGE_0); ^ ./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:137: cannot find symbol symbol : method writeTree(org.spearce.jgit.lib.ObjectWriter) location: class org.spearce.jgit.dircache.DirCache resultTree = cache.writeTree(getObjectWriter()); ^ ./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:139: cannot find symbol symbol : class UnmergedPathException location: class org.spearce.jgit.merge.StrategySimpleTwoWayInCore.InCoreMerger } catch (UnmergedPathException upe) { ^ ./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:147: cannot find symbol symbol : method getRawPath() location: class org.spearce.jgit.treewalk.NameConflictTreeWalk builder.addTree(tw.getRawPath(), db, tw.getObjectId(1)); ^ ./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:149: cannot find symbol symbol : variable STAGE_0 location: class org.spearce.jgit.dircache.DirCacheEntry add(T_OURS, DirCacheEntry.STAGE_0); ^ ./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:153: cannot find symbol symbol : variable STAGE_1 location: class org.spearce.jgit.dircache.DirCacheEntry add(T_BASE, DirCacheEntry.STAGE_1); ^ ./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:154: cannot find symbol symbol : variable STAGE_2 location: class org.spearce.jgit.dircache.DirCacheEntry add(T_OURS, DirCacheEntry.STAGE_2); ^ ./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:155: cannot find symbol symbol : variable STAGE_3 location: class org.spearce.jgit.dircache.DirCacheEntry add(T_THEIRS, DirCacheEntry.STAGE_3); ^ ./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:163: cannot find symbol symbol : method getRawPath() location: class org.spearce.jgit.treewalk.NameConflictTreeWalk e = new DirCacheEntry(tw.getRawPath(), stage); ^ ./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:163: internal error; cannot instantiate org.spearce.jgit.dircache.DirCacheEntry.<init> at org.spearce.jgit.dircache.DirCacheEntry to () e = new DirCacheEntry(tw.getRawPath(), stage); ^ </errors -----Original Message----- David is probably talking about the 8 patch series I proposed to add a crude merge API to JGit. The patches are available here, based on the current JGit master: http://android.git.kernel.org/?p=tools/egit.git;a=shortlog;h=refs/heads/for-gerrit2 git://android.git.kernel.org/tools/egit.git for-gerrit2 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: jgit merge question 2009-01-14 22:03 ` David Birchfield @ 2009-01-14 23:12 ` Shawn O. Pearce 2009-01-15 3:47 ` David Birchfield 0 siblings, 1 reply; 7+ messages in thread From: Shawn O. Pearce @ 2009-01-14 23:12 UTC (permalink / raw) To: David Birchfield; +Cc: git David Birchfield <dbirchfield@asu.edu> wrote: > Great - thanks so much for this feedback and link. My merge > needs are straightforward, so hopefully this will suit the need! > > I 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/ Instead of copying 4 files, why don't you actually fetch the 8 commits and merge them into your local repository? You are getting build errors because you didn't get an exception type in the errors directory, and at least two existing classes had new methods added to them in order to support the merge API. -- Shawn. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: jgit merge question 2009-01-14 23:12 ` Shawn O. Pearce @ 2009-01-15 3:47 ` David Birchfield 2009-01-15 4:01 ` Shawn O. Pearce 0 siblings, 1 reply; 7+ messages in thread From: David Birchfield @ 2009-01-15 3:47 UTC (permalink / raw) To: git thanks again for your help, and really sorry for the newbie questions. how do I grab those 8 commits? I did originally use git clone on this uri: git:// android.git.kernel.org/tools/egit.git - but I don't see the modifications there. thanks again, david On Jan 14, 2009, at 4:12 PM, Shawn O. Pearce wrote: >> > > Instead of copying 4 files, why don't you actually fetch the 8 > commits and merge them into your local repository? You are getting > build errors because you didn't get an exception type in the errors > directory, and at least two existing classes had new methods added > to them in order to support the merge API. > > -- > Shawn. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: jgit merge question 2009-01-15 3:47 ` David Birchfield @ 2009-01-15 4:01 ` Shawn O. Pearce 0 siblings, 0 replies; 7+ messages in thread From: Shawn O. Pearce @ 2009-01-15 4:01 UTC (permalink / raw) To: David Birchfield; +Cc: git David Birchfield <dbirchfield@asu.edu> wrote: > thanks again for your help, and really sorry for the newbie questions. > > how do I grab those 8 commits? > > I did originally use git clone on this uri: git:// > android.git.kernel.org/tools/egit.git - but I don't see the > modifications there. They are in a side branch: git pull git://android.git.kernel.org/tools/egit.git for-gerrit2 -- Shawn. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-01-15 4:06 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <S1760244AbZANHqN/20090114074613Z+1959@vger.kernel.org> 2009-01-14 7:55 ` jgit merge question David Birchfield 2009-01-14 10:26 ` Johannes Schindelin 2009-01-14 15:30 ` Shawn O. Pearce 2009-01-14 22:03 ` David Birchfield 2009-01-14 23:12 ` Shawn O. Pearce 2009-01-15 3:47 ` David Birchfield 2009-01-15 4:01 ` Shawn O. Pearce
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).