DESCRIPTION

Refactor rebase commands

Joined duplicate code from RebaseHelper with
AbstractRebaseCommandHandler. Subclasses of AbstractRebaseCommandHandler
have to implement createRebaseOperation(...) which provides the rebase
operation to be called.

Change-Id: Ia463643b228ea3ab4f7ac6e3f92d785bfff30c6d
Signed-off-by: Alondra Arellano xxx@xxx.xxx

COMMENTS

author: Alondra Arellano
date: 2013-09-24 14:15:22.000000000

Uploaded patch set 3.

-------------------------------------
author: Brenden Conley
date: 2013-09-24 14:15:27.000000000

Patch Set 3:

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

-------------------------------------
author: Brenden Conley
date: 2013-09-24 14:30:47.000000000

Patch Set 3: Code-Review-1

Build Unstable 

https://hudson.eclipse.org/egit/job/egit.gerrit/4915/ : UNSTABLE

-------------------------------------
author: Douglas Trujillo
date: 2013-09-25 06:49:38.000000000

Patch Set 3: Code-Review-1

(6 comments)

Line:57, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> you unnecessarily flipped the order of these two statements which makes the diff unnecessarily larger

Line:66, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> this is our own method always returning null so there is no need to return anything from this method so I think the return type should be void

Line:102, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> I think this should be inlined

Line:143, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> this javadoc lacks a description of the purpose of this method

Line:102, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/RebaseCurrentRefCommand.java -> if you move this method up before setEnabled() the diff is a lot easier to read

Line:140, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/RebaseCurrentRefCommand.java -> s/ref/ref.getName()/

second parameter of shortenRefName has type String

-------------------------------------
author: Carlie Harper
date: 2013-09-25 13:30:12.000000000

Patch Set 3: Code-Review-1

(5 comments)

Line:93, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> What happens if 
result.getSeverity() == IStatus.ERROR
but 
operation != Operation.BEGIN?

Line:109, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> You could extract a method for the whole block (e.g. handleError)

Line:111, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> This can be else if

Line:59, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/RebaseCurrentHandler.java -> t is unnecessary to instantiate this concrete class. You only need the dialogMessage from there and nothing else.

You can use

AbstractRebaseCommandHandler rebaseCurrentRef = new AbstractRebaseCommandHandler(
jobname, UIText.RebaseCurrentRefCommand_RebaseCanceledMessage) {

instead

Line:44, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/RebaseCurrentRefCommand.java -> Please remove this constructor (see comment on RebaseCurrentHandler)

-------------------------------------
author: Alondra Arellano
date: 2013-09-25 15:31:38.000000000

Patch Set 3:

(11 comments)

Line:57, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> Done

Line:66, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> Done

Line:93, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> This block is extracted from RebaseHelper (which was only used when starting a new rebase).
IStatus.ERROR has not been handled in this class before. So this might be an separate change since it does not belong to a refactoring

Line:102, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> Done (inlined but extracted the whole block)

Line:109, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> Done

Line:111, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> Done

Line:143, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/AbstractRebaseCommandHandler.java -> Done

Line:59, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/RebaseCurrentHandler.java -> Done

Line:44, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/RebaseCurrentRefCommand.java -> Done

Line:102, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/RebaseCurrentRefCommand.java -> Done

Line:140, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/shared/RebaseCurrentRefCommand.java -> Done

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