Rebasing is a commonly used feature in git. Without this feature you have to use external tools when your vcs is git.
I volunteer for this as well.
Could we just start from merge? I'd use the same dialog as a base.
I guess we then need some simple actions for handling rebase conflicts: continue/abort/skip rebase...
that dialog is independent and used in many NetBeans git actions, so no need to touch merge package. See org.netbeans.modules.git.ui.repository.RevisionDialogController
Created attachment 130610 [details]
git rebase support
Git rebase: initial support.
New 'rebase' option in Team->Git menu (if repository state allows it).
In case of rebase problems, new actions available in same menu: continue/skip/abort rebase.
Modified git client lib (please note I reformatted the code in libs.git/.../GitClient.java ; wasn't my first plan but don't know if it matters).
OV1 - the dialog... What about adding also the option to rebase other branch (than the current one) to some other commit (git rebase upstream branch). You would select both branch and upstream in the dialog and then start a command which would result in client.checkout(branch) and client.rebase(upstream).
OV2 - IMO rebase is a complex command, not easy to comprehend. I vote for some visualization in the dialog of what's going to happen. Something similar to our merge dialog in the Subversion support: http://netbeans.org/kb/docs/ide/subversion.html#merging
You would select different versions of rebase command from a combo box (git rebase upstream, git rebase upstream branch or git rebase --onto base upstream branch when that is implemented in JGit) and a rebase visualization would be displayed in the dialog.
OV3 - does not build, you cannot export org.netbeans.libs.git.jgit.commands.RebaseCommand.Operation. It is visible only in the module scope (libs.git). You have to declare it inside o.n.m.git package (e.g. as GitClient.DiffMode/ResetType)
OV4 - AbstractEndRebaseAction.enable method is wrong, we cannot leave it this way. It accesses I/O (mostly in the EDT) which is not acceptable. So there must be other way to get its status.
OV1/OV2: I think what I did is how it is in Eclipse. It could be better, but it's a simple rebase and it works, vs nothing now. Could we start with this and improve later?
OV3: I guess you're right, had to do some trick to get it working. I'll follow your suggestion.
OV4: I think we have to do this to get the status, but we could do in in another thread, I guess some ProgressSupport. But... how can I do that there? I did some research but was stuck, could you give me some ideas with this one?
OV1/OV2: sure. i just wanted to express my thoughts so we do not forget this.
OV4: right now i do not have the best solution. A submenu could be introduced and it could be populated with rebase actions outside of the EDT. Or add just a single action called Rebase... which could either start a fresh rebase (assuming no rebase has been interrupted earlier) or display another dialog letting you abort/resume/??? a previously interrupted rebase.
0V4: a single rebase action in multiple steps is not possible. If there is a rebase conflict, the user should be able to solve it however he wants: three-way conflict resolution tool, editing, ... When he's finished, he has to abort/skip/continue rebase.
OV4 - sure, that's what i mean. User runs the rebase action for the first time -> the dialog opens and lets him select rebase parameters -> rebase stops because of a merge conflict, user is notified about it -> user resolves the conflict -> he runs the rebase action again -> another dialog is opened notifying about unfinished progress and asks him to abort/continue/skip.
So you have just one entry-point (Rebase... action) that decides what to do next when it's invoked.
i will try to implement it the same way as for mercurial, probably next week
I'm still willing to do it, although I've been quite busy those days. Just tell me if there is some kind of deadline for that, I'll try to do it in time.
(In reply to comment #10)
> I'm still willing to do it, although I've been quite busy those days. Just tell
> me if there is some kind of deadline for that, I'll try to do it in time.
I'm perfectly fine with doing it myself, i have it on my todo list for this release and will implement it (if you do not mind). Rebase is quite complicated and i would like to solve all issues i pointed out here in the issue plus other such as repairing commit/push hooks etc.