DESCRIPTION

Improve DiscardChangesAction

Currently DiscardChangesAction (Trigger: Replace With->File in Git 
Index) runs in the UI thread. This might block the UI. Furthermore 
the discard operation is located in the action.
Now DiscardChangesAction uses a Job to execute. The discard operation
was moved in a new class DiscardChangesOperation.

Signed-off-by: Marlie Beasley xxx@xxx.xxx

COMMENTS

author: Jaylon Avila
date: 2010-05-05 17:08:27.000000000

Patch Set 1: No score

Thanks for splitting this up, Jens! :) The progress monitoring should be corrected and I'm curious to hear your thoughts on the resource locking.

Line:49, org.eclipse.egit.core/src/org/eclipse/egit/core/op/DiscardChangesOperation.java -> Please convert the monitor to a SubMonitor and then split up appropriate work units. As is we just pass the original monitor to the discardChange(*) method which implies that the monitor may be marked as completed on just one iteration which leads to incorrect progress reporting. :(

Line:67, org.eclipse.egit.core/src/org/eclipse/egit/core/op/DiscardChangesOperation.java -> Why do we need to lock the whole tree if we're solely dealing with IFiles?

Line:93, org.eclipse.egit.core/src/org/eclipse/egit/core/op/DiscardChangesOperation.java -> Multiple files may be in the same repository. Would it be better to check out all the entries and then just doing one write operation against the index?

If one checkout succeeds and another fails, we'd still want to write the "partially modified" index though, I think?

Line:119, org.eclipse.egit.core/src/org/eclipse/egit/core/op/DiscardChangesOperation.java -> Move this line down. We don't need to instantiate a new object if it's not an IContainer.

Line:52, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/DiscardChangesAction.java -> We should set a scheduling rule for the job based on the resources.

-------------------------------------
author: Marlie Beasley
date: 2010-05-06 15:31:48.000000000

MISMATCHED INLINE COMMENT
Line:49, org.eclipse.egit.core/src/org/eclipse/egit/core/op/DiscardChangesOperation.java -> Done

-------------------------------------
author: Marlie Beasley
date: 2010-05-06 15:31:48.000000000

MISMATCHED INLINE COMMENT
Line:67, org.eclipse.egit.core/src/org/eclipse/egit/core/op/DiscardChangesOperation.java -> Done

-------------------------------------
author: Marlie Beasley
date: 2010-05-06 15:31:48.000000000

MISMATCHED INLINE COMMENT
Line:93, org.eclipse.egit.core/src/org/eclipse/egit/core/op/DiscardChangesOperation.java -> Done

-------------------------------------
author: Marlie Beasley
date: 2010-05-06 15:31:48.000000000

MISMATCHED INLINE COMMENT
Line:119, org.eclipse.egit.core/src/org/eclipse/egit/core/op/DiscardChangesOperation.java -> Done

-------------------------------------
author: Marlie Beasley
date: 2010-05-06 15:31:48.000000000

MISMATCHED INLINE COMMENT
Line:52, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/DiscardChangesAction.java -> Done

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