Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347835 - Add "Replace With -> Theirs" in conflicting state of merge and cherry-pick
Summary: Add "Replace With -> Theirs" in conflicting state of merge and cherry-pick
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement with 9 votes (vote)
Target Milestone: 3.6   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 393758 404424 424629 (view as bug list)
Depends on: 391856 390147
Blocks:
  Show dependency tree
 
Reported: 2011-05-31 13:34 EDT by Robin Stocker CLA
Modified: 2015-01-12 19:02 EST (History)
12 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Stocker CLA 2011-05-31 13:34:02 EDT
In the conflicting repository state, the Replace With menu of a file should have an item for replacing with the MERGE_HEAD. The effect would be the same as "git checkout --theirs file".

Any good ideas for the name?
Comment 1 Gunnar Wagenknecht CLA 2011-07-06 14:20:32 EDT
+1. 

That would really help especially when resolving merge conflicts of binary files (eg. DLLs, images, etc.).

I think this would also make a nice action in the Merge Tool.
Comment 2 Matthias Sohn CLA 2011-08-10 08:14:39 EDT
+1, same for "--ours"

how about:

"Replace with MERGE_HEAD"
"Replace with ORIG_HEAD"
Comment 3 Gunnar Wagenknecht CLA 2011-08-10 08:31:47 EDT
(In reply to comment #2)
> "Replace with MERGE_HEAD"
> "Replace with ORIG_HEAD"

I would prefer the friendly names "theirs" and "mine/ours". Those should be immediately be recognized by users not so familiar with all the Git terms. ;)
Comment 4 Matthias Sohn CLA 2011-08-10 08:41:28 EDT
(In reply to comment #3)
> (In reply to comment #2)
> > "Replace with MERGE_HEAD"
> > "Replace with ORIG_HEAD"
> 
> I would prefer the friendly names "theirs" and "mine/ours". Those should be
> immediately be recognized by users not so familiar with all the Git terms. ;)

+1, I see your point
Comment 5 Robin Stocker CLA 2011-08-12 17:50:35 EDT
+1 about the names.

I started implementing this, but hit a dead end with org.eclipse.ui.menus. The problem is that these commands should only be shown when the repository is in a certain state. There seem to be two ways of doing this:

1. Use a dynamic menu (with CompoundContributionItem)
2. Use visibleWhen to link the visibility with the enabled state

Both of these ways require the command to be defined as an org.eclipse.ui.menus extension (not org.eclipse.ui.popupMenus). The problem is how to specify the locationURI of the menuContribution so that the resulting command is in the "Replace With" menu. I tried many things, but the replaceWithMenu could not be used as the ID, the command didn't show up.

In this post, I think Paul Webster says that the locationURI can not refer to IDs defined in org.eclipse.ui.popupMenus (legacy, apparently):

http://www.eclipsezone.com/eclipse/forums/t103764.html#92183897

What kind of works is this:

   <menuContribution
         locationURI="popup:org.eclipse.ui.popup.any?endof=additions">
      <menu
            id="replaceWithMenu"
            label="Replace With">
         <separator
               name="replaceWithGroup"
               visible="true">
         </separator>
         <separator
               name="gitReplaceWithGroup"
               visible="true">
         </separator>
         <command commandId="...ReplaceWithOurs" ...

With this, the standard "Replace With" commands stay where they are. But I don't like that the Replace With menu is "overwritten".

Any advice?
Comment 6 Markus Duft CLA 2012-01-17 10:21:55 EST
i think it would be important to have those actions in /somewhere/, even if it's not the final location where it should end up. maybe there should be a "Merge" submenu containing those actions when repository is in a merge state, with submenus "Resolve using Ours" and "Resolve using Theirs" or something like that. that would offer more control over the menu, as you don't have to reuse things you can't control.
Comment 7 Markus Duft CLA 2012-01-25 02:45:20 EST
robin, could you (even when this is in a different sub-menu) push a change to gerrit, or share your work in any other way? i'd really really need this, as in our repo there are a lot of binary files which cannot be merged without commandline at all then...

i'd even create a special egit version for us only with this change - it's very important!
Comment 8 Robin Stocker CLA 2012-01-25 04:49:28 EST
Ok, I'll see what I can do (unfortunately, I don't have access to that code right now).
Comment 9 Markus Duft CLA 2012-03-06 04:29:43 EST
ping - this would be really a requirement for us!
Comment 10 Markus Duft CLA 2012-09-21 02:41:21 EDT
ping - we're merging binary files every day a couple of times. this is really a pain! /please/ find the change and send it to me if you can.
Comment 11 Robin Stocker CLA 2012-09-22 15:57:31 EDT
I had just worked on the UI side so far, but it turns out some plumbing is necessary, see bug 390147.
Comment 12 Robin Stocker CLA 2012-11-07 08:12:07 EST
*** Bug 393758 has been marked as a duplicate of this bug. ***
Comment 13 Soren Mathiasen CLA 2013-01-18 03:59:08 EST
+1

This missing feature makes egit more or less useless, since the repository can be put in a state where the users are stuck !

It's better to have these buttons present all the time, then not at all.
When pushing the button, check the state of the repository, if it's not in the correct state show an error popup or something.
Comment 14 Massimo Zugno CLA 2013-12-09 07:24:22 EST
+1

This would be a very useful feature.

(In reply to Robin Stocker from comment #11)
> I had just worked on the UI side so far, but it turns out some plumbing is
> necessary, see bug 390147.
It seems #390147 is now fixed, therefore this bug is no more blocked by missing functionality in JGit.
Comment 15 Markus Keller CLA 2014-01-24 09:46:40 EST
*** Bug 424629 has been marked as a duplicate of this bug. ***
Comment 16 Markus Keller CLA 2014-01-24 09:47:37 EST
*** Bug 404424 has been marked as a duplicate of this bug. ***
Comment 17 Robin Stocker CLA 2014-11-30 05:45:52 EST
Pushed change to add a menu to staging view for this (see also parent changes):

https://git.eclipse.org/r/37329
Comment 18 Matthias Sohn CLA 2015-01-12 19:02:52 EST
merged as 804afc6909e835b07b8ce8e22f3d2fa228e13e9f