Browse Source

Reintroduce protected method which removal broke EMF Compare

So far we follow OSGi semantic versioning [1] which says the following:

"A change in the second (minor) part of the version signals that the
change is backward compatible with consumers of the API package but not
with the providers of that API. That is, when the API package goes from
version 1.5 to 1.6 it is no longer compatible with a provider of that
API but consumers of that API are backward compatible with that API
package."

The change Ib5fbf17bdaf727bc5d0e106ce88f2620d9f87a6f broke EMF Compare
which subclasses ResolveMerger since we added a new parameter to the
protected ResolveMerger.processEntry() method. According to the above
cited OSGi semantic versioning this is ok, implementers should expect
that they break on minor version changes of the API they implement.

This change reintroduces the old processEntry() method in order to help
avoid breakage for existing EMF Compare versions which expect breakage
also for the implementer case only for major version change (in this
case from JGit 4.x to 5.x).

[1] http://www.osgi.org/wp-content/uploads/SemanticVersioning1.pdf

See: https://dev.eclipse.org/mhonarc/lists/jgit-dev/msg03431.html
Change-Id: I48ba4308dee73925fa32d6c2fd6b5fd89632c571
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
tags/v4.9.1.201712030800-r
Matthias Sohn 6 years ago
parent
commit
abf420302b

+ 12
- 0
org.eclipse.jgit/.settings/.api_filters View File

@@ -35,6 +35,18 @@
<message_argument value="processEntry(CanonicalTreeParser, CanonicalTreeParser, CanonicalTreeParser, DirCacheBuildIterator, WorkingTreeIterator, boolean)"/>
</message_arguments>
</filter>
<filter id="1141899266">
<message_arguments>
<message_argument value="3.5"/>
<message_argument value="4.9"/>
<message_argument value="processEntry(CanonicalTreeParser, CanonicalTreeParser, CanonicalTreeParser, DirCacheBuildIterator, WorkingTreeIterator, boolean)"/>
</message_arguments>
</filter>
<filter id="1143996420">
<message_arguments>
<message_argument value="processEntry(CanonicalTreeParser, CanonicalTreeParser, CanonicalTreeParser, DirCacheBuildIterator, WorkingTreeIterator, boolean)"/>
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/jgit/transport/http/HttpConnection.java" type="org.eclipse.jgit.transport.http.HttpConnection">
<filter id="403767336">

+ 56
- 0
org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java View File

@@ -444,6 +444,62 @@ public class ResolveMerger extends ThreeWayMerger {
return newEntry;
}

/**
* Processes one path and tries to merge taking git attributes in account.
* This method will do all trivial (not content) merges and will also detect
* if a merge will fail. The merge will fail when one of the following is
* true
* <ul>
* <li>the index entry does not match the entry in ours. When merging one
* branch into the current HEAD, ours will point to HEAD and theirs will
* point to the other branch. It is assumed that the index matches the HEAD
* because it will only not match HEAD if it was populated before the merge
* operation. But the merge commit should not accidentally contain
* modifications done before the merge. Check the <a href=
* "http://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html#_3_way_merge"
* >git read-tree</a> documentation for further explanations.</li>
* <li>A conflict was detected and the working-tree file is dirty. When a
* conflict is detected the content-merge algorithm will try to write a
* merged version into the working-tree. If the file is dirty we would
* override unsaved data.</li>
* </ul>
*
* @param base
* the common base for ours and theirs
* @param ours
* the ours side of the merge. When merging a branch into the
* HEAD ours will point to HEAD
* @param theirs
* the theirs side of the merge. When merging a branch into the
* current HEAD theirs will point to the branch which is merged
* into HEAD.
* @param index
* the index entry
* @param work
* the file in the working tree
* @param ignoreConflicts
* see
* {@link ResolveMerger#mergeTrees(AbstractTreeIterator, RevTree, RevTree, boolean)}
* @return <code>false</code> if the merge will fail because the index entry
* didn't match ours or the working-dir file was dirty and a
* conflict occurred
* @throws MissingObjectException
* @throws IncorrectObjectTypeException
* @throws CorruptObjectException
* @throws IOException
* @since 3.5
* @deprecated
*/
@Deprecated
protected boolean processEntry(CanonicalTreeParser base,
CanonicalTreeParser ours, CanonicalTreeParser theirs,
DirCacheBuildIterator index, WorkingTreeIterator work,
boolean ignoreConflicts) throws MissingObjectException,
IncorrectObjectTypeException, CorruptObjectException, IOException {
return processEntry(base, ours, theirs, index, work, ignoreConflicts,
null);
}

/**
* Processes one path and tries to merge taking git attributes in account.
* This method will do all trivial (not content) merges and will also detect

Loading…
Cancel
Save