DESCRIPTION

Nice checkout conflict display instead of internal error

When switching branches by double-clicking their label, a nice checkout
conflict display appears if a conflict exists. When creating a new
branch, an ugly error box is shown instead. By detecting the
CheckoutConflictException explicitly and just returning, the
BranchResultDialog will be used there too, and show a nice overview of
all conflicts.

Change-Id: Ic772f519c5e36dcc1b0326dc1045497b211aaa66


COMMENTS

author: Brenden Conley
date: 2012-01-20 07:47:29.000000000

Patch Set 1:

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

-------------------------------------
author: Brenden Conley
date: 2012-01-20 08:03:54.000000000

Patch Set 1: Build Successful

Build Successful 
 
https://hudson.eclipse.org/sandbox/job/egit.gerrit/2395/ : SUCCESS

-------------------------------------
author: Douglas Trujillo
date: 2012-01-20 08:31:52.000000000

Patch Set 1: I would prefer that you didn't submit this

(1 inline comment)



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

CheckoutConflictException shouldn't be wrapped as an internal exception. Could you check why JGit doesn't throw the API exception org.eclipse.jgit.api.errors.CheckoutConflictException instead ?

-------------------------------------
author: Bryanna Douglas
date: 2012-01-20 09:20:19.000000000

Patch Set 1: (1 inline comment)



Line:105, org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java -> hm, i checked. jgit does indeed throw a CheckoutConflictException in CheckoutCommand.java:169, /but/ it immediately after that catches it itself again on line 215, since CheckoutConflictException is an IOException, which is catched here. an internal exception is rethrown from there.

Also CheckoutConflictException is not part of the signature, as it should be. Adding it is an API breakage though i guess... how should i best proceed? i can do the changes if thats wanted... :)

-------------------------------------
author: Bryanna Douglas
date: 2012-01-20 11:46:36.000000000

Patch Set 1: (1 inline comment)



Line:105, org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java -> hm, i'm also a little confused about /which/ CheckoutConflictException would be the correct one in which location, as there are two of them... ?! :/

-------------------------------------
author: Zachary Orozco
date: 2012-01-20 14:42:58.000000000

Patch Set 1: (1 inline comment)



Line:105, org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java -> There are two CheckoutConflictException classes:

org.eclipse.jgit.errors.CheckoutConflictException which is used internally in jgit and by all user's not using the API in org.eclipse.jgit.api.

org.eclipse.jgit.api.errors.CheckoutConflictException which should be the only checkout exception thrown by the API in org.eclipse.jgit.api.

Since you are using the API you should ideally use the exception in org.eclipse.jgit.api. A good example how it should look like is in MergeOperation.java (line 120). But there seems to be a bug in MergeCommand.java that it throws org.eclipse.jgit.errors.CheckoutConflictException instead of org.eclipse.jgit.api.errors.CheckoutConflictException. Maybe we have to solve this first. The change http://egit.eclipse.org/r/#change,4178 is addressing this ... but not yet accepted. I'll try to trigger that this change solves the problem.

-------------------------------------
author: Zachary Orozco
date: 2012-01-20 16:07:03.000000000

Patch Set 1: Looks good to me, but someone else must approve

(1 inline comment)



Line:105, org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java -> The change I wanted to trigger will take some time, because it's an API change which can come only in a new major release. Therefore I suggest that you fix it like you proposed it here. You have to check that e.getCause() returns back a org.eclipse.jgit.errors.CheckoutConflictException . That's what you propose here. So +1 from me. Just fix the style nit about curly braces.

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