DESCRIPTION

Added 'Replace With HEAD' menu option

Bug: 326638
Change-Id: I859d5c0ff40aadacd017c39fcc03437571f00216
Signed-off-by: Carla Osborn <Isabella xxx@xxx.xxx


COMMENTS

author: Carla Osborn
date: 2011-02-16 13:50:46.000000000

Uploaded patch set 3.

-------------------------------------
author: Carla Osborn
date: 2011-02-16 13:54:31.000000000

Patch Set 3:

@Mathias: You're right. NPE is fixed now.

-------------------------------------
author: Douglas Trujillo
date: 2011-02-16 23:45:45.000000000

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

(11 inline comments)

found that "Replace with HEAD" doesn't properly handle the staged content:
- "Replace with HEAD" on a new file which has been added and afterwards changed again (file content in HEAD doesn't exist, staged content and working tree content are different) has no effect but c git's "git checkout -- <path>" will replace the working tree content with index content in that case
- "Replace with HEAD" on a tracked file which has staged changes and also more changes in the working tree replaces the working tree with the version from HEAD but doesn't replace the index with the version from HEAD (check this with "Compare with Index", Compare with HEAD"), c git's "git checkout -- <path>" also replaces the index with the HEAD version

Line:31, org.eclipse.egit.ui/plugin.properties -> improve key name and value:

ReplaceWithHead_label=HEAD revision

- this yields the menu entry "Replace with > HEAD revision"
- this looks better than "Replace with > From HEAD revision"

Line:11, org.eclipse.egit.ui/plugin.xml -> don't unnecessarily touch whitespace (also more occurrences below)

you should use the formatter settings coming with the project

Line:170, org.eclipse.egit.ui/plugin.xml -> improve id to 
"...ReplaceResourcesWithHeadAction"

Line:26, org.eclipse.egit.core/src/org/eclipse/egit/core/op/ReplaceFromIndexOperation.java -> this is not precise, you are replacing the changes in the working tree with the staged file contents

Line:29, org.eclipse.egit.core/src/org/eclipse/egit/core/op/ReplaceFromIndexOperation.java -> class should be named ReplaceWithIndexOperation

Line:33, org.eclipse.egit.core/src/org/eclipse/egit/core/op/ReplaceFromHEADOperation.java -> I would prefer if this class would be named "ReplaceWithHeadOperation" as that's what this operation is supposed to do

Line:48, org.eclipse.egit.core/src/org/eclipse/egit/core/op/ReplaceFromHEADOperation.java -> this line looks a bit wide, do you use the proper formatting settings ?

Line:52, org.eclipse.egit.core/src/org/eclipse/egit/core/op/ReplaceFromHEADOperation.java -> style nit: one before the comment is sufficient

Line:67, org.eclipse.egit.core/src/org/eclipse/egit/core/op/ReplaceFromHEADOperation.java -> typo: s/Let' //

Line:70, org.eclipse.egit.core/src/org/eclipse/egit/core/op/ReplaceFromHEADOperation.java -> string should be externalized

Line:16, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CheckoutResourcesFromHEADAction.java -> use camel case for class names

-------------------------------------
author: Douglas Trujillo
date: 2011-02-16 23:47:29.000000000

Patch Set 3:

also tests are missing here

-------------------------------------
author: Carla Osborn
date: 2011-02-17 17:31:01.000000000

Patch Set 3:

Matthias,
For the approach you described, I think the 'Relpace with HEAD' is not a correct description. In first case there's even no content in HEAD.
What do you think about calling the action for example 'Checkout resources' and putting into Team menu?

I have implemented clearing staged version, but after that file appears with '>' sign, however file content is exactly same as in HEAD. Could you give me some hint of how to fix it? Seems I need some refresh statement...

-------------------------------------
author: Carla Osborn
date: 2011-02-18 11:57:36.000000000

Patch Set 3:

Found the problem! it was a wrong file length in index

-------------------------------------
author: Malia Sampson
date: 2011-02-28 23:32:27.000000000

Patch Set 3:

Can you rebase this patch Ilya?

I want to get it in for 0.12

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