DESCRIPTION

Add ability to squash commits directly from the history view.

This adds a new menu item Modify > Squash to the context menu
of the history view. It can be used to squash multiple (contiguous)
selected commits into one, prompting for a commit message as well.

An error will be displayed if the selected commits cannot be reached
from the current HEAD commit. This is done so as to avoid the need
to checkout another commit automatically before executing the squash
procedure.

The "Modify" sub-menu is chosen so that new menu items (such as
"Reword" or "Edit") can be added to it rather than the history
context menu directly.

Change-Id: Ib725899074282027d7542c2ac8bc2c5a9a01da72
Signed-off-by: Emmalee Aguilar xxx@xxx.xxx

COMMENTS

author: Brenden Conley
date: 2014-02-06 12:56:29.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/5514/

-------------------------------------
author: Brenden Conley
date: 2014-02-06 13:09:49.000000000

Patch Set 1: Verified+1

Build Successful 

https://hudson.eclipse.org/egit/job/egit.gerrit/5514/ : SUCCESS

-------------------------------------
author: Emmalee Aguilar
date: 2014-02-06 13:11:37.000000000

Patch Set 1:

Please note that the new Modify sub-menu has been suggested by Douglas Trujillo in I060a1684a1d239c6af46e0fac2ee1ca08ae2b4fd.

-------------------------------------
author: Emmalee Aguilar
date: 2014-02-06 13:13:20.000000000

Patch Set 1:

I also plan to submit the Reword feature from I060a1684a1d239c6af46e0fac2ee1ca08ae2b4fd in yet another changeset, but I'll wait until this changeset is done because of the new sub-menu.

-------------------------------------
author: Douglas Trujillo
date: 2014-02-06 22:53:17.000000000

Patch Set 1: Code-Review-1 IP-Clean-1

(8 comments)

nice :-)

- the squash menu entry should be disabled if another rebase/merge/cherry-pick is already in progress
- I think combining the commit messages for squash is already implemented elsewhere and we shouldn't have two implementations for the same problem
- due to its size this change requires an IP review by the legal team hence marking IP-Clean -1

Line:37, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/command/SquashHandler.java -> this looks wrong, probably you copied this from the reword handler

Line:119, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/command/SquashHandler.java -> looks like this is a duplicate of SquashCommitsOperation.sortCommits()

Line:162, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/coretext.properties -> maybe simpler s/Running squash on/Squashing/ ?

Line:74, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/SquashHandler.java -> style nit: trailing whitespace

Line:61, org.eclipse.egit.core/src/org/eclipse/egit/core/op/SquashCommitsOperation.java -> style nit: remove this unnecessary blank line

Line:69, org.eclipse.egit.core/src/org/eclipse/egit/core/op/SquashCommitsOperation.java -> add a blank line here to make the anonymous class stand out (that's what the standard Eclipse formatter does)

Line:89, org.eclipse.egit.core/src/org/eclipse/egit/core/op/SquashCommitsOperation.java -> // shouldn't happen

Line:142, org.eclipse.egit.core/src/org/eclipse/egit/core/op/SquashCommitsOperation.java -> style nit: we don't use braces around single line blocks

-------------------------------------
author: Emmalee Aguilar
date: 2014-02-06 23:04:55.000000000

Patch Set 1:

(1 comment)

I'll see if I can find the squashed commit message code and use that instead.

Regarding the IP review, is there anything I need to do on my end? If so, please advise.

Line:119, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/command/SquashHandler.java -> It is, because the other one is in the core plugin. I think this method should be refactored into a static utility method in the core plugin? Any advice is appreciated, I'd rather follow your lead here on where to put it.

-------------------------------------
author: Douglas Trujillo
date: 2014-02-07 07:51:02.000000000

Patch Set 1:

you don't need to do anything regarding the IP review, I will file the necessary CQ in IPZilla

-------------------------------------
author: Emmalee Aguilar
date: 2014-02-07 11:44:02.000000000

Patch Set 1:

I've moved the commit sorting method to the new class org.eclipse.egit.core.CommitUtil.

As for the commit message formatting, I have switched to the way the RebaseCommand does it. This unfortunately has the negative side effect that the complete squashing procedure cannot be canceled by simply clicking the "Cancel" button in the commit message dialog. This is because interactive rebase is starting right away, prompting for commit messages if it sees the need along the way.

-------------------------------------
