Add rebase button to the change screen
This change adds a rebase button along with the rest of the action buttons in the change page. When pressing the button, the most recent patch set will be rebased onto the tip of the destination branch or the latest patchset of the change we depend upon. A new patch set containing the rebased commit will be produced and added to the change. Content-merging is always used, regardless of the project setting for use of content merges. This change started long ago as a draft by Magnus Bäck and the very nifty rebase trick (rebasing without the need for a working index) is his. Since then a lot has happen and I would like to discuss a bit around the design choices I made along the way: Design choices -------------- * Currently all users that can upload new patch sets to a change are also allowed to see the rebase-button. In the future, I plan to add a rebase capability to Gerrit, so the right to rebase other users' changes could be limited to include only certain powerusers (depending on project and refs). I prepared by adding the canRebase() to ChangeDetail and ChangeControl instead of just linking directly to canAddPatchSet(). * The emailing is subclassed from ReplacePatchSetSender which I think makes sense. * I lifted some code from ReceiveCommits, which allows me to move votes to new patch sets, to ApprovalsUtil.java. Some refactoring could be made in ReceiveCommits to make use of that code, but I would prefer to do it in a later and separate change due to the importance and complexity of ReceiveCommits. * As long as user has the correct access rights to execute a rebase within Gerrit, the button will be visible and enabled. I chose not to do any automagic merge-testing before showing the actual Rebase button. This approach was chosen since it contributes to cleaner code and better performance. We do not really want to execute merge tests just because the user is looking on the change-screen, especially since a rebase operation is not issued that often. * Of course, the rebase can fail for various reasons, and there are decent error messages explaining why the rebase was not allowed to be executed. * The new GerritWidgetCallback was introduced. Parts in gerrit-gwtui can and should be refactored to make use of this callback. Bug: issue 1035 Change-Id: I7eba96dfa769690eddce43fe9ea3c6cd39fe01a0
This commit is contained in:

committed by
Gustaf Lundh

parent
0ae1044fcb
commit
06e41266a2
@@ -321,6 +321,8 @@ public class ChangeScreen extends Screen
|
||||
}
|
||||
|
||||
dependenciesPanel.setOpen(depsOpen);
|
||||
|
||||
dependenciesPanel.getHeader().clear();
|
||||
if (outdated > 0) {
|
||||
dependenciesPanel.getHeader().add(new InlineLabel(
|
||||
Util.M.outdatedHeader(outdated)));
|
||||
|
Reference in New Issue
Block a user