[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| [egit-dev] Inconsistent handling of commit with more than one parent | 
Hi,
I've noticed that in many cases egit does not handles correctly commits 
with more than one parent (merge commits). Actually the most of the code 
is in place. I think that with some small changes it is possible to 
achieve much better handling of merge commits. At least in my practice I 
have to review (view the diff of) merge commits and in some case revert 
them and I think maybe there are other that would found the better 
handling of merge commits useful.
* When you open file and select Compare with -> Previous revision if the 
commit is merge commit (so there are more than one previous revisions). 
Also the annotations (blame) work fine - when the line is introduced in 
merge commit - it shows the difference with each parent. In history view 
when you select the merge commit the file is displayed as changed file 
but no diff is shown. Maybe we can display the combined diff or at least 
a list with the diffs to the parents. If 'Compare Mode' is selected and 
you double click on the changed file you'll receive an error message 
that says this is merge commit so you can't open the compare view. Maybe 
instead the choose commit dialog should be shown (the same as for 
compare with previous revision).
Also if you open the merge commit in the Commit Viewer and select the 
Diff tab, an exception is thrown. Maybe instead the combined diff or 
list with the diffs to the parents (as in the annotations/blame) should 
be shown instead.
* If you try to revert merge commit you get the following error:
Cannot revert commit 'b49e28179604cc14a9b5103442e6661e63e8570d' because 
it has 2 parents, only commits with exactly one parent are supported
This exception Is thrown by the RevertCommand. But it's looks like that 
this line that actually gets the parent
    RevCommit srcParent = srcCommit.getParent(0);
At least it looks like it's quite easy to modify the code so it gets the 
n parent, where n is number of the parent (this is the way the c git 
client works). The UI to choose the parent could be the same as the 
select commit dialog for the Compare with -> Previous revision
* When you try to cherry-pick a merge commit nothing happens but the 
following exception is thrown: org.eclipse.team.core.TeamException: 
Cannot cherry-pick commit 'a25fd8622d4be0f610a28db8b23da5df4f263c29' 
because it has 2 parents, only commits with exactly one parent are 
supported. But actually jgit supports cherry-pick. You can set the 
parent number with CherryPickCommand::setMainlineParentNumber. This 
exception is thrown only when the parent number is not set. So maybe the 
message is bit misleading and should be changed with something that says 
this is merge commit so you must set a parent. And the egit should pass 
parent number that chosen by the user. Perhaps with the select commit 
dialog.
What do you guys think? Does any of that makes sense? If it does I could 
spent some time to contribute changes. If this could help of course :)
Cheers,
Plamen Totev