diff options
16 files changed, 209 insertions, 105 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/EolAwareOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/EolAwareOutputStream.java index 1ddac18e56..e44970abff 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/EolAwareOutputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/EolAwareOutputStream.java @@ -79,12 +79,14 @@ class EolAwareOutputStream extends OutputStream { return bol; } + /** {@inheritDoc} */ @Override public void write(int val) throws IOException { out.write(val); bol = (val == '\n'); } + /** {@inheritDoc} */ @Override public void write(byte[] buf, int pos, int cnt) throws IOException { if (cnt > 0) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java index 04c65effb8..dd42e43841 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java @@ -57,14 +57,15 @@ import org.eclipse.jgit.merge.MergeChunk.ConflictState; /** * Provides the merge algorithm which does a three-way merge on content provided - * as RawText. By default {@link HistogramDiff} is used as diff algorithm. + * as RawText. By default {@link org.eclipse.jgit.diff.HistogramDiff} is used as + * diff algorithm. */ public final class MergeAlgorithm { private final DiffAlgorithm diffAlg; /** - * Creates a new MergeAlgorithm which uses {@link HistogramDiff} as diff - * algorithm + * Creates a new MergeAlgorithm which uses + * {@link org.eclipse.jgit.diff.HistogramDiff} as diff algorithm */ public MergeAlgorithm() { this(new HistogramDiff()); @@ -88,8 +89,6 @@ public final class MergeAlgorithm { /** * Does the three way merge between a common base and two sequences. * - * @param <S> - * type of sequence. * @param cmp comparison method for this execution. * @param base the common base sequence * @param ours the first sequence to be merged diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeChunk.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeChunk.java index 72857ffb30..3867eea443 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeChunk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeChunk.java @@ -97,7 +97,8 @@ public class MergeChunk { * merge result. All elements between begin (including begin) and * this element are added. * @param conflictState - * the state of this chunk. See {@link ConflictState} + * the state of this chunk. See + * {@link org.eclipse.jgit.merge.MergeChunk.ConflictState} */ protected MergeChunk(int sequenceIndex, int begin, int end, ConflictState conflictState) { @@ -108,7 +109,9 @@ public class MergeChunk { } /** - * @return the index of the sequence to which sequence this chunks belongs + * Get the index of the sequence to which this sequence chunks belongs to. + * + * @return the index of the sequence to which this sequence chunks belongs * to. Same as in {@link org.eclipse.jgit.merge.MergeResult#add} */ public int getSequenceIndex() { @@ -116,6 +119,9 @@ public class MergeChunk { } /** + * Get the first element from the specified sequence which should be + * included in the merge result. + * * @return the first element from the specified sequence which should be * included in the merge result. Indexes start with 0. */ @@ -124,17 +130,22 @@ public class MergeChunk { } /** - * @return the end of the range of this chunk. The element this index - * points to is the first element which not added to the merge - * result. All elements between begin (including begin) and this - * element are added. + * Get the end of the range of this chunk. + * + * @return the end of the range of this chunk. The element this index points + * to is the first element which not added to the merge result. All + * elements between begin (including begin) and this element are + * added. */ public int getEnd() { return end; } /** - * @return the state of this chunk. See {@link ConflictState} + * Get the state of this chunk. + * + * @return the state of this chunk. See + * {@link org.eclipse.jgit.merge.MergeChunk.ConflictState} */ public ConflictState getConflictState() { return conflictState; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeConfig.java index d059391826..cdbe3cd26c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeConfig.java @@ -58,7 +58,10 @@ import org.eclipse.jgit.lib.Repository; public class MergeConfig { /** + * Get merge configuration for the current branch of the repository + * * @param repo + * a {@link org.eclipse.jgit.lib.Repository} object. * @return merge configuration for the current branch of the repository */ public static MergeConfig getConfigForCurrentBranch(Repository repo) { @@ -74,10 +77,14 @@ public class MergeConfig { } /** + * Get a parser for use with + * {@link org.eclipse.jgit.lib.Config#get(SectionParser)} + * * @param branch * short branch name to get the configuration for, as returned - * e.g. by {@link Repository#getBranch()} - * @return a parser for use with {@link Config#get(SectionParser)} + * e.g. by {@link org.eclipse.jgit.lib.Repository#getBranch()} + * @return a parser for use with + * {@link org.eclipse.jgit.lib.Config#get(SectionParser)} */ public static final SectionParser<MergeConfig> getParser( final String branch) { @@ -104,6 +111,8 @@ public class MergeConfig { } /** + * Get the fast forward mode configured for this branch + * * @return the fast forward mode configured for this branch */ public FastForwardMode getFastForwardMode() { @@ -111,6 +120,9 @@ public class MergeConfig { } /** + * Whether merges into this branch are configured to be squash merges, false + * otherwise + * * @return true if merges into this branch are configured to be squash * merges, false otherwise */ @@ -119,8 +131,10 @@ public class MergeConfig { } /** - * @return false if --no-commit is configured for this branch, true - * otherwise (event if --squash is configured) + * Whether {@code --no-commit} option is not set. + * + * @return {@code false} if --no-commit is configured for this branch, + * {@code true} otherwise (even if --squash is configured) */ public boolean isCommit() { return commit; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java index 43876a6227..036917e62a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java @@ -55,11 +55,12 @@ import org.eclipse.jgit.diff.RawText; */ public class MergeFormatter { /** - * Formats the results of a merge of {@link RawText} objects in a Git - * conformant way. This method also assumes that the {@link RawText} objects - * being merged are line oriented files which use LF as delimiter. This - * method will also use LF to separate chunks and conflict metadata, - * therefore it fits only to texts that are LF-separated lines. + * Formats the results of a merge of {@link org.eclipse.jgit.diff.RawText} + * objects in a Git conformant way. This method also assumes that the + * {@link org.eclipse.jgit.diff.RawText} objects being merged are line + * oriented files which use LF as delimiter. This method will also use LF to + * separate chunks and conflict metadata, therefore it fits only to texts + * that are LF-separated lines. * * @param out * the outputstream where to write the textual presentation @@ -67,13 +68,13 @@ public class MergeFormatter { * the merge result which should be presented * @param seqName * When a conflict is reported each conflicting range will get a - * name. This name is following the "<<<<<<< " or ">>>>>>> " - * conflict markers. The names for the sequences are given in - * this list + * name. This name is following the "<<<<<<< + * " or ">>>>>>> " conflict markers. The + * names for the sequences are given in this list * @param charsetName * the name of the characterSet used when writing conflict * metadata - * @throws IOException + * @throws java.io.IOException */ public void formatMerge(OutputStream out, MergeResult<RawText> res, List<String> seqName, String charsetName) throws IOException { @@ -81,13 +82,14 @@ public class MergeFormatter { } /** - * Formats the results of a merge of exactly two {@link RawText} objects in - * a Git conformant way. This convenience method accepts the names for the - * three sequences (base and the two merged sequences) as explicit - * parameters and doesn't require the caller to specify a List + * Formats the results of a merge of exactly two + * {@link org.eclipse.jgit.diff.RawText} objects in a Git conformant way. + * This convenience method accepts the names for the three sequences (base + * and the two merged sequences) as explicit parameters and doesn't require + * the caller to specify a List * * @param out - * the {@link OutputStream} where to write the textual + * the {@link java.io.OutputStream} where to write the textual * presentation * @param res * the merge result which should be presented @@ -100,7 +102,7 @@ public class MergeFormatter { * @param charsetName * the name of the characterSet used when writing conflict * metadata - * @throws IOException + * @throws java.io.IOException */ @SuppressWarnings("unchecked") public void formatMerge(OutputStream out, MergeResult res, String baseName, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeResult.java index ff3c8ab172..062d86f8a2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeResult.java @@ -51,14 +51,14 @@ import org.eclipse.jgit.merge.MergeChunk.ConflictState; import org.eclipse.jgit.util.IntList; /** - * The result of merging a number of {@link Sequence} objects. These sequences - * have one common predecessor sequence. The result of a merge is a list of - * MergeChunks. Each MergeChunk contains either a range (a subsequence) from - * one of the merged sequences, a range from the common predecessor or a - * conflicting range from one of the merged sequences. A conflict will be - * reported as multiple chunks, one for each conflicting range. The first chunk - * for a conflict is marked specially to distinguish the border between two - * consecutive conflicts. + * The result of merging a number of {@link org.eclipse.jgit.diff.Sequence} + * objects. These sequences have one common predecessor sequence. The result of + * a merge is a list of MergeChunks. Each MergeChunk contains either a range (a + * subsequence) from one of the merged sequences, a range from the common + * predecessor or a conflicting range from one of the merged sequences. A + * conflict will be reported as multiple chunks, one for each conflicting range. + * The first chunk for a conflict is marked specially to distinguish the border + * between two consecutive conflicts. * <p> * This class does not know anything about how to present the merge result to * the end-user. MergeFormatters have to be used to construct something human @@ -80,7 +80,8 @@ public class MergeResult<S extends Sequence> implements Iterable<MergeChunk> { * @param sequences * contains the common predecessor sequence at position 0 * followed by the merged sequences. This list should not be - * modified anymore during the lifetime of this {@link MergeResult}. + * modified anymore during the lifetime of this + * {@link org.eclipse.jgit.merge.MergeResult}. */ public MergeResult(List<S> sequences) { this.sequences = sequences; @@ -129,10 +130,7 @@ public class MergeResult<S extends Sequence> implements Iterable<MergeChunk> { static final ConflictState[] states = ConflictState.values(); - /** - * @return an iterator over the MergeChunks. The iterator does not support - * the remove operation - */ + /** {@inheritDoc} */ @Override public Iterator<MergeChunk> iterator() { return new Iterator<MergeChunk>() { @@ -160,6 +158,8 @@ public class MergeResult<S extends Sequence> implements Iterable<MergeChunk> { } /** + * Whether this merge result contains conflicts + * * @return true if this merge result contains conflicts */ public boolean containsConflicts() { @@ -173,6 +173,8 @@ public class MergeResult<S extends Sequence> implements Iterable<MergeChunk> { * markers!) as new conflict-free content * * @param containsConflicts + * whether this merge should be seen as containing a conflict or + * not. * @since 3.5 */ protected void setContainsConflicts(boolean containsConflicts) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java index af3d5ca078..520ea6e74a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java @@ -97,7 +97,7 @@ public abstract class MergeStrategy { * * @param imp * the strategy to register. - * @throws IllegalArgumentException + * @throws java.lang.IllegalArgumentException * a strategy by the same name has already been registered. */ public static void register(final MergeStrategy imp) { @@ -111,7 +111,7 @@ public abstract class MergeStrategy { * name the strategy can be looked up under. * @param imp * the strategy to register. - * @throws IllegalArgumentException + * @throws java.lang.IllegalArgumentException * a strategy by the same name has already been registered. */ public static synchronized void register(final String name, @@ -146,7 +146,11 @@ public abstract class MergeStrategy { return r; } - /** @return default name of this strategy implementation. */ + /** + * Get default name of this strategy implementation. + * + * @return default name of this strategy implementation. + */ public abstract String getName(); /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java index 0c4488c984..cd19d696a8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java @@ -68,7 +68,8 @@ import org.eclipse.jgit.treewalk.AbstractTreeIterator; import org.eclipse.jgit.treewalk.CanonicalTreeParser; /** - * Instance of a specific {@link MergeStrategy} for a single {@link Repository}. + * Instance of a specific {@link org.eclipse.jgit.merge.MergeStrategy} for a + * single {@link org.eclipse.jgit.lib.Repository}. */ public abstract class Merger { /** @@ -138,6 +139,8 @@ public abstract class Merger { } /** + * Get the repository this merger operates on. + * * @return the repository this merger operates on. */ @Nullable @@ -146,8 +149,10 @@ public abstract class Merger { } /** + * Get non-null repository instance + * * @return non-null repository instance - * @throws NullPointerException + * @throws java.lang.NullPointerException * if the merger was constructed without a repository. * @since 4.8 */ @@ -159,8 +164,11 @@ public abstract class Merger { } /** - * @return an object writer to create objects, writing objects to {@link - * #getRepository()} (if a repository was provided). + * Get an object writer to create objects, writing objects to + * {@link #getRepository()} + * + * @return an object writer to create objects, writing objects to + * {@link #getRepository()} (if a repository was provided). */ public ObjectInserter getObjectInserter() { return inserter; @@ -203,7 +211,7 @@ public abstract class Merger { * @throws IncorrectObjectTypeException * one of the input objects is not a commit, but the strategy * requires it to be a commit. - * @throws IOException + * @throws java.io.IOException * one or more sources could not be read, or outputs could not * be written to the Repository. */ @@ -231,7 +239,7 @@ public abstract class Merger { * @throws IncorrectObjectTypeException * one of the input objects is not a commit, but the strategy * requires it to be a commit. - * @throws IOException + * @throws java.io.IOException * one or more sources could not be read, or outputs could not * be written to the Repository. */ @@ -267,6 +275,8 @@ public abstract class Merger { } /** + * Get the ID of the commit that was used as merge base for merging + * * @return the ID of the commit that was used as merge base for merging, or * null if no merge base was used or it was set manually * @since 3.2 @@ -281,9 +291,9 @@ public abstract class Merger { * @param b * the second commit in {@link #sourceObjects}. * @return the merge base of two commits - * @throws IncorrectObjectTypeException + * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException * one of the input objects is not a commit. - * @throws IOException + * @throws java.io.IOException * objects are missing or multiple merge bases were found. * @since 3.0 */ @@ -313,9 +323,9 @@ public abstract class Merger { * @param treeId * the tree to scan; must be a tree (not a treeish). * @return an iterator for the tree. - * @throws IncorrectObjectTypeException + * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException * the input object is not a tree. - * @throws IOException + * @throws java.io.IOException * the tree object is not found or cannot be read. */ protected AbstractTreeIterator openTree(final AnyObjectId treeId) @@ -336,13 +346,15 @@ public abstract class Merger { * @throws IncorrectObjectTypeException * one of the input objects is not a commit, but the strategy * requires it to be a commit. - * @throws IOException + * @throws java.io.IOException * one or more sources could not be read, or outputs could not * be written to the Repository. */ protected abstract boolean mergeImpl() throws IOException; /** + * Get resulting tree. + * * @return resulting tree, if {@link #merge(AnyObjectId[])} returned true. */ public abstract ObjectId getResultTreeId(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java index 1375cd3ea2..a621a0500a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java @@ -83,6 +83,7 @@ import org.eclipse.jgit.treewalk.WorkingTreeIterator; * - uses "Lists" instead of Arrays for chained types * * - recursively merges the merge bases together to compute a usable base + * * @since 3.0 */ public class RecursiveMerger extends ResolveMerger { @@ -97,7 +98,9 @@ public class RecursiveMerger extends ResolveMerger { * inCore * * @param local + * a {@link org.eclipse.jgit.lib.Repository} object. * @param inCore + * a boolean. */ protected RecursiveMerger(Repository local, boolean inCore) { super(local, inCore); @@ -106,7 +109,7 @@ public class RecursiveMerger extends ResolveMerger { /** * Normal recursive merge, implies not inCore * - * @param local + * @param local a {@link org.eclipse.jgit.lib.Repository} object. */ protected RecursiveMerger(Repository local) { this(local, false); @@ -116,7 +119,9 @@ public class RecursiveMerger extends ResolveMerger { * Normal recursive merge, implies inCore. * * @param inserter + * an {@link org.eclipse.jgit.lib.ObjectInserter} object. * @param config + * the repository configuration * @since 4.8 */ protected RecursiveMerger(ObjectInserter inserter, Config config) { @@ -124,12 +129,11 @@ public class RecursiveMerger extends ResolveMerger { } /** + * {@inheritDoc} + * <p> * Get a single base commit for two given commits. If the two source commits * have more than one base commit recursively merge the base commits * together until you end up with a single base commit. - * - * @throws IOException - * @throws IncorrectObjectTypeException */ @Override protected RevCommit getBaseCommit(RevCommit a, RevCommit b) @@ -151,7 +155,7 @@ public class RecursiveMerger extends ResolveMerger { * @return the merge base of two commits. If a criss-cross merge required a * synthetic merge base this commit is visible only the merger's * RevWalk and will not be in the repository. - * @throws IOException + * @throws java.io.IOException * @throws IncorrectObjectTypeException * one of the input objects is not a commit. * @throws NoMergeBaseException diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java index 83b836302e..5646529ddc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java @@ -299,8 +299,12 @@ public class ResolveMerger extends ThreeWayMerger { } /** + * Constructor for ResolveMerger. + * * @param local + * the {@link org.eclipse.jgit.lib.Repository}. * @param inCore + * a boolean. */ protected ResolveMerger(Repository local, boolean inCore) { super(local); @@ -319,15 +323,22 @@ public class ResolveMerger extends ThreeWayMerger { } /** + * Constructor for ResolveMerger. + * * @param local + * the {@link org.eclipse.jgit.lib.Repository}. */ protected ResolveMerger(Repository local) { this(local, false); } /** + * Constructor for ResolveMerger. + * * @param inserter + * an {@link org.eclipse.jgit.lib.ObjectInserter} object. * @param config + * the repository configuration * @since 4.8 */ protected ResolveMerger(ObjectInserter inserter, Config config) { @@ -339,6 +350,7 @@ public class ResolveMerger extends ThreeWayMerger { dircache = DirCache.newInCore(); } + /** {@inheritDoc} */ @Override protected boolean mergeImpl() throws IOException { if (implicitDirCache) @@ -379,9 +391,9 @@ public class ResolveMerger extends ThreeWayMerger { * contained only stage 0. In case if inCore operation just clear the * history of modified files. * - * @throws IOException - * @throws CorruptObjectException - * @throws NoWorkTreeException + * @throws java.io.IOException + * @throws org.eclipse.jgit.errors.CorruptObjectException + * @throws org.eclipse.jgit.errors.NoWorkTreeException * @since 3.4 */ protected void cleanUp() throws NoWorkTreeException, @@ -482,16 +494,15 @@ public class ResolveMerger extends ThreeWayMerger { * the file in the working tree * @param ignoreConflicts * see - * {@link ResolveMerger#mergeTrees(AbstractTreeIterator, RevTree, RevTree, boolean)} + * {@link org.eclipse.jgit.merge.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 + * @throws org.eclipse.jgit.errors.MissingObjectException + * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException + * @throws org.eclipse.jgit.errors.CorruptObjectException + * @throws java.io.IOException * @since 3.5 - * @deprecated */ @Deprecated protected boolean processEntry(CanonicalTreeParser base, @@ -538,16 +549,16 @@ public class ResolveMerger extends ThreeWayMerger { * the file in the working tree * @param ignoreConflicts * see - * {@link ResolveMerger#mergeTrees(AbstractTreeIterator, RevTree, RevTree, boolean)} + * {@link org.eclipse.jgit.merge.ResolveMerger#mergeTrees(AbstractTreeIterator, RevTree, RevTree, boolean)} * @param attributes * the attributes defined for this entry * @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 + * @throws org.eclipse.jgit.errors.MissingObjectException + * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException + * @throws org.eclipse.jgit.errors.CorruptObjectException + * @throws java.io.IOException * @since 4.9 */ protected boolean processEntry(CanonicalTreeParser base, @@ -977,12 +988,15 @@ public class ResolveMerger extends ThreeWayMerger { return FileMode.GITLINK.equals(mode); } + /** {@inheritDoc} */ @Override public ObjectId getResultTreeId() { return (resultTree == null) ? null : resultTree.toObjectId(); } /** + * Set the names of the commits as they would appear in conflict markers + * * @param commitNames * the names of the commits as they would appear in conflict * markers @@ -992,6 +1006,8 @@ public class ResolveMerger extends ThreeWayMerger { } /** + * Get the names of the commits as they would appear in conflict markers. + * * @return the names of the commits as they would appear in conflict * markers. */ @@ -1000,17 +1016,22 @@ public class ResolveMerger extends ThreeWayMerger { } /** - * @return the paths with conflicts. This is a subset of the files listed - * by {@link #getModifiedFiles()} + * Get the paths with conflicts. This is a subset of the files listed by + * {@link #getModifiedFiles()} + * + * @return the paths with conflicts. This is a subset of the files listed by + * {@link #getModifiedFiles()} */ public List<String> getUnmergedPaths() { return unmergedPaths; } /** - * @return the paths of files which have been modified by this merge. A - * file will be modified if a content-merge works on this path or if - * the merge algorithm decides to take the theirs-version. This is a + * Get the paths of files which have been modified by this merge. + * + * @return the paths of files which have been modified by this merge. A file + * will be modified if a content-merge works on this path or if the + * merge algorithm decides to take the theirs-version. This is a * superset of the files listed by {@link #getUnmergedPaths()}. */ public List<String> getModifiedFiles() { @@ -1018,6 +1039,10 @@ public class ResolveMerger extends ThreeWayMerger { } /** + * Get a map which maps the paths of files which have to be checked out + * because the merge created new fully-merged content for this file into the + * index. + * * @return a map which maps the paths of files which have to be checked out * because the merge created new fully-merged content for this file * into the index. This means: the merge wrote a new stage 0 entry @@ -1028,6 +1053,8 @@ public class ResolveMerger extends ThreeWayMerger { } /** + * Get the mergeResults + * * @return the mergeResults */ public Map<String, MergeResult<? extends Sequence>> getMergeResults() { @@ -1035,6 +1062,9 @@ public class ResolveMerger extends ThreeWayMerger { } /** + * Get list of paths causing this merge to fail (not stopped because of a + * conflict). + * * @return lists paths causing this merge to fail (not stopped because of a * conflict). <code>null</code> is returned if this merge didn't * fail. @@ -1059,10 +1089,10 @@ public class ResolveMerger extends ThreeWayMerger { * not set explicitly and if this merger doesn't work in-core, this merger * will implicitly get and lock a default DirCache. If the DirCache is * explicitly set the caller is responsible to lock it in advance. Finally - * the merger will call {@link DirCache#commit()} which requires that the - * DirCache is locked. If the {@link #mergeImpl()} returns without throwing - * an exception the lock will be released. In case of exceptions the caller - * is responsible to release the lock. + * the merger will call {@link org.eclipse.jgit.dircache.DirCache#commit()} + * which requires that the DirCache is locked. If the {@link #mergeImpl()} + * returns without throwing an exception the lock will be released. In case + * of exceptions the caller is responsible to release the lock. * * @param dc * the DirCache to set @@ -1092,8 +1122,12 @@ public class ResolveMerger extends ThreeWayMerger { * The resolve conflict way of three way merging * * @param baseTree + * a {@link org.eclipse.jgit.treewalk.AbstractTreeIterator} + * object. * @param headTree + * a {@link org.eclipse.jgit.revwalk.RevTree} object. * @param mergeTree + * a {@link org.eclipse.jgit.revwalk.RevTree} object. * @param ignoreConflicts * Controls what to do in case a content-merge is done and a * conflict is detected. The default setting for this should be @@ -1110,11 +1144,11 @@ public class ResolveMerger extends ThreeWayMerger { * other stages are filled. Means: there is no conflict on that * path but the new content (including conflict markers) is * stored as successful merge result. This is needed in the - * context of {@link RecursiveMerger} where when determining - * merge bases we don't want to deal with content-merge - * conflicts. + * context of {@link org.eclipse.jgit.merge.RecursiveMerger} + * where when determining merge bases we don't want to deal with + * content-merge conflicts. * @return whether the trees merged cleanly - * @throws IOException + * @throws java.io.IOException * @since 3.5 */ protected boolean mergeTrees(AbstractTreeIterator baseTree, @@ -1177,9 +1211,9 @@ public class ResolveMerger extends ThreeWayMerger { * The walk to iterate over. * @param ignoreConflicts * see - * {@link ResolveMerger#mergeTrees(AbstractTreeIterator, RevTree, RevTree, boolean)} + * {@link org.eclipse.jgit.merge.ResolveMerger#mergeTrees(AbstractTreeIterator, RevTree, RevTree, boolean)} * @return Whether the trees merged cleanly. - * @throws IOException + * @throws java.io.IOException * @since 3.5 */ protected boolean mergeTreeWalk(TreeWalk treeWalk, boolean ignoreConflicts) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyOneSided.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyOneSided.java index 2224dbc448..979685c409 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyOneSided.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyOneSided.java @@ -76,21 +76,25 @@ public class StrategyOneSided extends MergeStrategy { treeIndex = index; } + /** {@inheritDoc} */ @Override public String getName() { return strategyName; } + /** {@inheritDoc} */ @Override public Merger newMerger(final Repository db) { return new OneSide(db, treeIndex); } + /** {@inheritDoc} */ @Override public Merger newMerger(final Repository db, boolean inCore) { return new OneSide(db, treeIndex); } + /** {@inheritDoc} */ @Override public Merger newMerger(final ObjectInserter inserter, final Config config) { return new OneSide(inserter, treeIndex); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyRecursive.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyRecursive.java index 56128dd93e..716b136d60 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyRecursive.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyRecursive.java @@ -54,21 +54,25 @@ import org.eclipse.jgit.lib.Repository; */ public class StrategyRecursive extends StrategyResolve { + /** {@inheritDoc} */ @Override public ThreeWayMerger newMerger(Repository db) { return new RecursiveMerger(db, false); } + /** {@inheritDoc} */ @Override public ThreeWayMerger newMerger(Repository db, boolean inCore) { return new RecursiveMerger(db, inCore); } + /** {@inheritDoc} */ @Override public ThreeWayMerger newMerger(ObjectInserter inserter, Config config) { return new RecursiveMerger(inserter, config); } + /** {@inheritDoc} */ @Override public String getName() { return "recursive"; //$NON-NLS-1$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyResolve.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyResolve.java index 17044b53ae..e836719633 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyResolve.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategyResolve.java @@ -52,24 +52,25 @@ import org.eclipse.jgit.lib.Repository; */ public class StrategyResolve extends ThreeWayMergeStrategy { + /** {@inheritDoc} */ @Override public ThreeWayMerger newMerger(Repository db) { return new ResolveMerger(db, false); } + /** {@inheritDoc} */ @Override public ThreeWayMerger newMerger(Repository db, boolean inCore) { return new ResolveMerger(db, inCore); } - /** - * @since 4.8 - */ + /** {@inheritDoc} */ @Override public ThreeWayMerger newMerger(ObjectInserter inserter, Config config) { return new ResolveMerger(inserter, config); } + /** {@inheritDoc} */ @Override public String getName() { return "resolve"; //$NON-NLS-1$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java index cd427bd8fb..5739d58b39 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java @@ -69,30 +69,33 @@ import org.eclipse.jgit.treewalk.NameConflictTreeWalk; * file contents. */ public class StrategySimpleTwoWayInCore extends ThreeWayMergeStrategy { - /** Create a new instance of the strategy. */ + /** + * Create a new instance of the strategy. + */ protected StrategySimpleTwoWayInCore() { // } + /** {@inheritDoc} */ @Override public String getName() { return "simple-two-way-in-core"; //$NON-NLS-1$ } + /** {@inheritDoc} */ @Override public ThreeWayMerger newMerger(final Repository db) { return new InCoreMerger(db); } + /** {@inheritDoc} */ @Override public ThreeWayMerger newMerger(Repository db, boolean inCore) { // This class is always inCore, so ignore the parameter return newMerger(db); } - /** - * @since 4.8 - */ + /** {@inheritDoc} */ @Override public ThreeWayMerger newMerger(ObjectInserter inserter, Config config) { return new InCoreMerger(inserter); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ThreeWayMergeStrategy.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ThreeWayMergeStrategy.java index c71590bb13..7d185ec0d5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ThreeWayMergeStrategy.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ThreeWayMergeStrategy.java @@ -45,11 +45,15 @@ package org.eclipse.jgit.merge; import org.eclipse.jgit.lib.Repository; -/** A merge strategy to merge 2 trees, using a common base ancestor tree. */ +/** + * A merge strategy to merge 2 trees, using a common base ancestor tree. + */ public abstract class ThreeWayMergeStrategy extends MergeStrategy { + /** {@inheritDoc} */ @Override public abstract ThreeWayMerger newMerger(Repository db); + /** {@inheritDoc} */ @Override public abstract ThreeWayMerger newMerger(Repository db, boolean inCore); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ThreeWayMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ThreeWayMerger.java index b3ef0fb3e4..3f28820092 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ThreeWayMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ThreeWayMerger.java @@ -57,7 +57,9 @@ import org.eclipse.jgit.revwalk.RevTree; import org.eclipse.jgit.treewalk.AbstractTreeIterator; import org.eclipse.jgit.treewalk.EmptyTreeIterator; -/** A merge of 2 trees, using a common base ancestor tree. */ +/** + * A merge of 2 trees, using a common base ancestor tree. + */ public abstract class ThreeWayMerger extends Merger { private RevTree baseTree; @@ -103,11 +105,11 @@ public abstract class ThreeWayMerger extends Merger { * common base treeish; null to automatically compute the common * base from the input commits during * {@link #merge(AnyObjectId...)}. - * @throws IncorrectObjectTypeException + * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException * the object is not a treeish. - * @throws MissingObjectException + * @throws org.eclipse.jgit.errors.MissingObjectException * the object does not exist. - * @throws IOException + * @throws java.io.IOException * the object could not be read. */ public void setBase(final AnyObjectId id) throws MissingObjectException, @@ -119,6 +121,7 @@ public abstract class ThreeWayMerger extends Merger { } } + /** {@inheritDoc} */ @Override public boolean merge(final AnyObjectId... tips) throws IOException { if (tips.length != 2) @@ -126,6 +129,7 @@ public abstract class ThreeWayMerger extends Merger { return super.merge(tips); } + /** {@inheritDoc} */ @Override public ObjectId getBaseCommitId() { return baseCommitId; @@ -136,7 +140,7 @@ public abstract class ThreeWayMerger extends Merger { * * @return an iterator over the caller-specified merge base, or the natural * merge base of the two input commits. - * @throws IOException + * @throws java.io.IOException */ protected AbstractTreeIterator mergeBase() throws IOException { if (baseTree != null) |