Bug 221661 - Support for rebase in git
Support for rebase in git
Status: RESOLVED FIXED
Product: versioncontrol
Classification: Unclassified
Component: Git
7.3
PC All
: P3 with 1 vote (vote)
: 7.4
Assigned To: Ondrej Vrabec
issues@versioncontrol
: PLAN
Depends on: 226545
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-07 15:41 UTC by j.boesl
Modified: 2013-03-20 12:06 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
git rebase support (141.02 KB, patch)
2013-01-24 22:36 UTC, ymajoros
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description j.boesl 2012-11-07 15:41:46 UTC
Rebasing is a commonly used feature in git. Without this feature you have to use external tools when your vcs is git.
Comment 1 ymajoros 2013-01-14 12:54:31 UTC
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...
Comment 2 Ondrej Vrabec 2013-01-14 13:05:36 UTC
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
Comment 3 ymajoros 2013-01-24 22:36:00 UTC
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).
Comment 4 Ondrej Vrabec 2013-01-30 12:34:51 UTC
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.
Comment 5 ymajoros 2013-01-30 20:32:12 UTC
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?
Comment 6 Ondrej Vrabec 2013-01-30 21:25:27 UTC
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.
Comment 7 ymajoros 2013-01-31 06:29:10 UTC
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.
Comment 8 Ondrej Vrabec 2013-01-31 06:43:18 UTC
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.
Comment 9 Ondrej Vrabec 2013-02-21 12:01:11 UTC
i will try to implement it the same way as for mercurial, probably next week
Comment 10 ymajoros 2013-02-21 13:44:38 UTC
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.
Comment 11 Ondrej Vrabec 2013-02-21 13:49:04 UTC
(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.
Comment 12 Ondrej Vrabec 2013-03-20 12:06:18 UTC
fixed: http://hg.netbeans.org/main-silver/rev/e328d09640be


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo