Browse Source

Fix javadoc in org.eclipse.jgit dircache package

Change-Id: Ib485eb217ac6be70519816f8cc0396931043a3d1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.10
Matthias Sohn 7 years ago
parent
commit
c281692c06
  1. 9
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/BaseDirCacheEditor.java
  2. 54
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
  3. 16
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuildIterator.java
  4. 8
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java
  5. 55
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
  6. 16
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java
  7. 39
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
  8. 24
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheIterator.java
  9. 21
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheTree.java
  10. 3
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/InvalidPathException.java

9
org.eclipse.jgit/src/org/eclipse/jgit/dircache/BaseDirCacheEditor.java vendored

@ -91,6 +91,8 @@ abstract class BaseDirCacheEditor {
} }
/** /**
* Get the {@code DirCache}
*
* @return the cache we will update on {@link #finish()}. * @return the cache we will update on {@link #finish()}.
*/ */
public DirCache getDirCache() { public DirCache getDirCache() {
@ -152,7 +154,8 @@ abstract class BaseDirCacheEditor {
} }
/** /**
* Finish this builder and update the destination {@link DirCache}. * Finish this builder and update the destination
* {@link org.eclipse.jgit.dircache.DirCache}.
* <p> * <p>
* When this method completes this builder instance is no longer usable by * When this method completes this builder instance is no longer usable by
* the calling application. A new builder must be created to make additional * the calling application. A new builder must be created to make additional
@ -263,9 +266,9 @@ abstract class BaseDirCacheEditor {
* @return true if the commit was successful and the file contains the new * @return true if the commit was successful and the file contains the new
* data; false if the commit failed and the file remains with the * data; false if the commit failed and the file remains with the
* old data. * old data.
* @throws IllegalStateException * @throws java.lang.IllegalStateException
* the lock is not held. * the lock is not held.
* @throws IOException * @throws java.io.IOException
* the output file could not be created. The caller no longer * the output file could not be created. The caller no longer
* holds the lock. * holds the lock.
*/ */

54
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java vendored

@ -158,7 +158,7 @@ public class DirCache {
* tree to read. Must identify a tree, not a tree-ish. * tree to read. Must identify a tree, not a tree-ish.
* @return a new cache which has no backing store file, but contains the * @return a new cache which has no backing store file, but contains the
* contents of {@code treeId}. * contents of {@code treeId}.
* @throws IOException * @throws java.io.IOException
* one or more trees not available from the ObjectReader. * one or more trees not available from the ObjectReader.
* @since 4.2 * @since 4.2
*/ */
@ -182,9 +182,9 @@ public class DirCache {
* repository containing the index to read * repository containing the index to read
* @return a cache representing the contents of the specified index file (if * @return a cache representing the contents of the specified index file (if
* it exists) or an empty cache if the file does not exist. * it exists) or an empty cache if the file does not exist.
* @throws IOException * @throws java.io.IOException
* the index file is present but could not be read. * the index file is present but could not be read.
* @throws CorruptObjectException * @throws org.eclipse.jgit.errors.CorruptObjectException
* the index file is using a format or extension that this * the index file is using a format or extension that this
* library does not support. * library does not support.
*/ */
@ -209,9 +209,9 @@ public class DirCache {
* certain file system operations. * certain file system operations.
* @return a cache representing the contents of the specified index file (if * @return a cache representing the contents of the specified index file (if
* it exists) or an empty cache if the file does not exist. * it exists) or an empty cache if the file does not exist.
* @throws IOException * @throws java.io.IOException
* the index file is present but could not be read. * the index file is present but could not be read.
* @throws CorruptObjectException * @throws org.eclipse.jgit.errors.CorruptObjectException
* the index file is using a format or extension that this * the index file is using a format or extension that this
* library does not support. * library does not support.
*/ */
@ -237,10 +237,10 @@ public class DirCache {
* certain file system operations. * certain file system operations.
* @return a cache representing the contents of the specified index file (if * @return a cache representing the contents of the specified index file (if
* it exists) or an empty cache if the file does not exist. * it exists) or an empty cache if the file does not exist.
* @throws IOException * @throws java.io.IOException
* the index file is present but could not be read, or the lock * the index file is present but could not be read, or the lock
* could not be obtained. * could not be obtained.
* @throws CorruptObjectException * @throws org.eclipse.jgit.errors.CorruptObjectException
* the index file is using a format or extension that this * the index file is using a format or extension that this
* library does not support. * library does not support.
*/ */
@ -280,10 +280,10 @@ public class DirCache {
* listener to be informed when DirCache is committed * listener to be informed when DirCache is committed
* @return a cache representing the contents of the specified index file (if * @return a cache representing the contents of the specified index file (if
* it exists) or an empty cache if the file does not exist. * it exists) or an empty cache if the file does not exist.
* @throws IOException * @throws java.io.IOException
* the index file is present but could not be read, or the lock * the index file is present but could not be read, or the lock
* could not be obtained. * could not be obtained.
* @throws CorruptObjectException * @throws org.eclipse.jgit.errors.CorruptObjectException
* the index file is using a format or extension that this * the index file is using a format or extension that this
* library does not support. * library does not support.
* @since 2.0 * @since 2.0
@ -314,10 +314,10 @@ public class DirCache {
* listener to be informed when DirCache is committed * listener to be informed when DirCache is committed
* @return a cache representing the contents of the specified index file (if * @return a cache representing the contents of the specified index file (if
* it exists) or an empty cache if the file does not exist. * it exists) or an empty cache if the file does not exist.
* @throws IOException * @throws java.io.IOException
* the index file is present but could not be read, or the lock * the index file is present but could not be read, or the lock
* could not be obtained. * could not be obtained.
* @throws CorruptObjectException * @throws org.eclipse.jgit.errors.CorruptObjectException
* the index file is using a format or extension that this * the index file is using a format or extension that this
* library does not support. * library does not support.
*/ */
@ -381,7 +381,8 @@ public class DirCache {
* Create a new builder to update this cache. * Create a new builder to update this cache.
* <p> * <p>
* Callers should add all entries to the builder, then use * Callers should add all entries to the builder, then use
* {@link DirCacheBuilder#finish()} to update this instance. * {@link org.eclipse.jgit.dircache.DirCacheBuilder#finish()} to update this
* instance.
* *
* @return a new builder instance for this cache. * @return a new builder instance for this cache.
*/ */
@ -393,7 +394,8 @@ public class DirCache {
* Create a new editor to recreate this cache. * Create a new editor to recreate this cache.
* <p> * <p>
* Callers should add commands to the editor, then use * Callers should add commands to the editor, then use
* {@link DirCacheEditor#finish()} to update this instance. * {@link org.eclipse.jgit.dircache.DirCacheEditor#finish()} to update this
* instance.
* *
* @return a new builder instance for this cache. * @return a new builder instance for this cache.
*/ */
@ -414,10 +416,10 @@ public class DirCache {
* the last time we consulted it. A missing index file will be treated as * the last time we consulted it. A missing index file will be treated as
* though it were present but had no file entries in it. * though it were present but had no file entries in it.
* *
* @throws IOException * @throws java.io.IOException
* the index file is present but could not be read. This * the index file is present but could not be read. This
* DirCache instance may not be populated correctly. * DirCache instance may not be populated correctly.
* @throws CorruptObjectException * @throws org.eclipse.jgit.errors.CorruptObjectException
* the index file is using a format or extension that this * the index file is using a format or extension that this
* library does not support. * library does not support.
*/ */
@ -456,8 +458,10 @@ public class DirCache {
} }
/** /**
* @return true if the memory state differs from the index file * Whether the memory state differs from the index file
* @throws IOException *
* @return {@code true} if the memory state differs from the index file
* @throws java.io.IOException
*/ */
public boolean isOutdated() throws IOException { public boolean isOutdated() throws IOException {
if (liveFile == null || !liveFile.exists()) if (liveFile == null || !liveFile.exists())
@ -465,7 +469,9 @@ public class DirCache {
return snapshot == null || snapshot.isModified(liveFile); return snapshot == null || snapshot.isModified(liveFile);
} }
/** Empty this index, removing all entries. */ /**
* Empty this index, removing all entries.
*/
public void clear() { public void clear() {
snapshot = null; snapshot = null;
sortedEntries = NO_ENTRIES; sortedEntries = NO_ENTRIES;
@ -601,7 +607,7 @@ public class DirCache {
* *
* @return true if the lock is now held by the caller; false if it is held * @return true if the lock is now held by the caller; false if it is held
* by someone else. * by someone else.
* @throws IOException * @throws java.io.IOException
* the output file could not be created. The caller does not * the output file could not be created. The caller does not
* hold the lock. * hold the lock.
*/ */
@ -628,7 +634,7 @@ public class DirCache {
* Once written the lock is closed and must be either committed with * Once written the lock is closed and must be either committed with
* {@link #commit()} or rolled back with {@link #unlock()}. * {@link #commit()} or rolled back with {@link #unlock()}.
* *
* @throws IOException * @throws java.io.IOException
* the output file could not be created. The caller no longer * the output file could not be created. The caller no longer
* holds the lock. * holds the lock.
*/ */
@ -730,7 +736,7 @@ public class DirCache {
* @return true if the commit was successful and the file contains the new * @return true if the commit was successful and the file contains the new
* data; false if the commit failed and the file remains with the * data; false if the commit failed and the file remains with the
* old data. * old data.
* @throws IllegalStateException * @throws java.lang.IllegalStateException
* the lock is not held. * the lock is not held.
*/ */
public boolean commit() { public boolean commit() {
@ -957,13 +963,13 @@ public class DirCache {
* responsible for flushing the inserter before trying to use the * responsible for flushing the inserter before trying to use the
* returned tree identity. * returned tree identity.
* @return identity for the root tree. * @return identity for the root tree.
* @throws UnmergedPathException * @throws org.eclipse.jgit.errors.UnmergedPathException
* one or more paths contain higher-order stages (stage &gt; 0), * one or more paths contain higher-order stages (stage &gt; 0),
* which cannot be stored in a tree object. * which cannot be stored in a tree object.
* @throws IllegalStateException * @throws java.lang.IllegalStateException
* one or more paths contain an invalid mode which should never * one or more paths contain an invalid mode which should never
* appear in a tree object. * appear in a tree object.
* @throws IOException * @throws java.io.IOException
* an unexpected error occurred writing to the object store. * an unexpected error occurred writing to the object store.
*/ */
public ObjectId writeTree(final ObjectInserter ow) public ObjectId writeTree(final ObjectInserter ow)

16
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuildIterator.java vendored

@ -54,12 +54,14 @@ import org.eclipse.jgit.lib.ObjectReader;
import org.eclipse.jgit.treewalk.AbstractTreeIterator; import org.eclipse.jgit.treewalk.AbstractTreeIterator;
/** /**
* Iterate and update a {@link DirCache} as part of a <code>TreeWalk</code>. * Iterate and update a {@link org.eclipse.jgit.dircache.DirCache} as part of a
* <code>TreeWalk</code>.
* <p> * <p>
* Like {@link DirCacheIterator} this iterator allows a DirCache to be used in * Like {@link org.eclipse.jgit.dircache.DirCacheIterator} this iterator allows
* parallel with other sorts of iterators in a TreeWalk. However any entry which * a DirCache to be used in parallel with other sorts of iterators in a
* appears in the source DirCache and which is skipped by the TreeFilter is * TreeWalk. However any entry which appears in the source DirCache and which is
* automatically copied into {@link DirCacheBuilder}, thus retaining it in the * skipped by the TreeFilter is automatically copied into
* {@link org.eclipse.jgit.dircache.DirCacheBuilder}, thus retaining it in the
* newly updated index. * newly updated index.
* <p> * <p>
* This iterator is suitable for update processes, or even a simple delete * This iterator is suitable for update processes, or even a simple delete
@ -105,6 +107,7 @@ public class DirCacheBuildIterator extends DirCacheIterator {
builder = p.builder; builder = p.builder;
} }
/** {@inheritDoc} */
@Override @Override
public AbstractTreeIterator createSubtreeIterator(final ObjectReader reader) public AbstractTreeIterator createSubtreeIterator(final ObjectReader reader)
throws IncorrectObjectTypeException, IOException { throws IncorrectObjectTypeException, IOException {
@ -114,6 +117,7 @@ public class DirCacheBuildIterator extends DirCacheIterator {
return new DirCacheBuildIterator(this, currentSubtree); return new DirCacheBuildIterator(this, currentSubtree);
} }
/** {@inheritDoc} */
@Override @Override
public void skip() throws CorruptObjectException { public void skip() throws CorruptObjectException {
if (currentSubtree != null) if (currentSubtree != null)
@ -123,6 +127,7 @@ public class DirCacheBuildIterator extends DirCacheIterator {
next(1); next(1);
} }
/** {@inheritDoc} */
@Override @Override
public void stopWalk() { public void stopWalk() {
final int cur = ptr; final int cur = ptr;
@ -131,6 +136,7 @@ public class DirCacheBuildIterator extends DirCacheIterator {
builder.keep(cur, cnt - cur); builder.keep(cur, cnt - cur);
} }
/** {@inheritDoc} */
@Override @Override
protected boolean needsStopWalk() { protected boolean needsStopWalk() {
return ptr < cache.getEntryCount(); return ptr < cache.getEntryCount();

8
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java vendored

@ -57,7 +57,8 @@ import org.eclipse.jgit.lib.ObjectReader;
import org.eclipse.jgit.treewalk.CanonicalTreeParser; import org.eclipse.jgit.treewalk.CanonicalTreeParser;
/** /**
* Updates a {@link DirCache} by adding individual {@link DirCacheEntry}s. * Updates a {@link org.eclipse.jgit.dircache.DirCache} by adding individual
* {@link org.eclipse.jgit.dircache.DirCacheEntry}s.
* <p> * <p>
* A builder always starts from a clean slate and appends in every single * A builder always starts from a clean slate and appends in every single
* <code>DirCacheEntry</code> which the final updated index must have to reflect * <code>DirCacheEntry</code> which the final updated index must have to reflect
@ -98,7 +99,7 @@ public class DirCacheBuilder extends BaseDirCacheEditor {
* *
* @param newEntry * @param newEntry
* the new entry to add. * the new entry to add.
* @throws IllegalArgumentException * @throws java.lang.IllegalArgumentException
* If the FileMode of the entry was not set by the caller. * If the FileMode of the entry was not set by the caller.
*/ */
public void add(final DirCacheEntry newEntry) { public void add(final DirCacheEntry newEntry) {
@ -161,7 +162,7 @@ public class DirCacheBuilder extends BaseDirCacheEditor {
* under <code>pathPrefix</code>. The ObjectId must be that of a * under <code>pathPrefix</code>. The ObjectId must be that of a
* tree; the caller is responsible for dereferencing a tag or * tree; the caller is responsible for dereferencing a tag or
* commit (if necessary). * commit (if necessary).
* @throws IOException * @throws java.io.IOException
* a tree cannot be read to iterate through its entries. * a tree cannot be read to iterate through its entries.
*/ */
public void addTree(byte[] pathPrefix, int stage, ObjectReader reader, public void addTree(byte[] pathPrefix, int stage, ObjectReader reader,
@ -218,6 +219,7 @@ public class DirCacheBuilder extends BaseDirCacheEditor {
return e; return e;
} }
/** {@inheritDoc} */
@Override @Override
public void finish() { public void finish() {
if (!sorted) if (!sorted)

55
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java vendored

@ -159,6 +159,8 @@ public class DirCacheCheckout {
private boolean performingCheckout; private boolean performingCheckout;
/** /**
* Get list of updated paths and smudgeFilterCommands
*
* @return a list of updated paths and smudgeFilterCommands * @return a list of updated paths and smudgeFilterCommands
*/ */
public Map<String, CheckoutMetadata> getUpdated() { public Map<String, CheckoutMetadata> getUpdated() {
@ -166,6 +168,8 @@ public class DirCacheCheckout {
} }
/** /**
* Get a list of conflicts created by this checkout
*
* @return a list of conflicts created by this checkout * @return a list of conflicts created by this checkout
*/ */
public List<String> getConflicts() { public List<String> getConflicts() {
@ -173,19 +177,24 @@ public class DirCacheCheckout {
} }
/** /**
* Get list of paths of files which couldn't be deleted during last call to
* {@link #checkout()}
*
* @return a list of paths (relative to the start of the working tree) of * @return a list of paths (relative to the start of the working tree) of
* files which couldn't be deleted during last call to * files which couldn't be deleted during last call to
* {@link #checkout()} . {@link #checkout()} detected that these * {@link #checkout()} . {@link #checkout()} detected that these
* files should be deleted but the deletion in the filesystem failed * files should be deleted but the deletion in the filesystem failed
* (e.g. because a file was locked). To have a consistent state of * (e.g. because a file was locked). To have a consistent state of
* the working tree these files have to be deleted by the callers of * the working tree these files have to be deleted by the callers of
* {@link DirCacheCheckout}. * {@link org.eclipse.jgit.dircache.DirCacheCheckout}.
*/ */
public List<String> getToBeDeleted() { public List<String> getToBeDeleted() {
return toBeDeleted; return toBeDeleted;
} }
/** /**
* Get list of all files removed by this checkout
*
* @return a list of all files removed by this checkout * @return a list of all files removed by this checkout
*/ */
public List<String> getRemoved() { public List<String> getRemoved() {
@ -206,7 +215,7 @@ public class DirCacheCheckout {
* the id of the tree we want to fast-forward to * the id of the tree we want to fast-forward to
* @param workingTree * @param workingTree
* an iterator over the repositories Working Tree * an iterator over the repositories Working Tree
* @throws IOException * @throws java.io.IOException
*/ */
public DirCacheCheckout(Repository repo, ObjectId headCommitTree, DirCache dc, public DirCacheCheckout(Repository repo, ObjectId headCommitTree, DirCache dc,
ObjectId mergeCommitTree, WorkingTreeIterator workingTree) ObjectId mergeCommitTree, WorkingTreeIterator workingTree)
@ -222,7 +231,8 @@ public class DirCacheCheckout {
/** /**
* Constructs a DirCacheCeckout for merging and checking out two trees (HEAD * Constructs a DirCacheCeckout for merging and checking out two trees (HEAD
* and mergeCommitTree) and the index. As iterator over the working tree * and mergeCommitTree) and the index. As iterator over the working tree
* this constructor creates a standard {@link FileTreeIterator} * this constructor creates a standard
* {@link org.eclipse.jgit.treewalk.FileTreeIterator}
* *
* @param repo * @param repo
* the repository in which we do the checkout * the repository in which we do the checkout
@ -232,7 +242,7 @@ public class DirCacheCheckout {
* the (already locked) Dircache for this repo * the (already locked) Dircache for this repo
* @param mergeCommitTree * @param mergeCommitTree
* the id of the tree we want to fast-forward to * the id of the tree we want to fast-forward to
* @throws IOException * @throws java.io.IOException
*/ */
public DirCacheCheckout(Repository repo, ObjectId headCommitTree, public DirCacheCheckout(Repository repo, ObjectId headCommitTree,
DirCache dc, ObjectId mergeCommitTree) throws IOException { DirCache dc, ObjectId mergeCommitTree) throws IOException {
@ -251,7 +261,7 @@ public class DirCacheCheckout {
* the id of the tree we want to fast-forward to * the id of the tree we want to fast-forward to
* @param workingTree * @param workingTree
* an iterator over the repositories Working Tree * an iterator over the repositories Working Tree
* @throws IOException * @throws java.io.IOException
*/ */
public DirCacheCheckout(Repository repo, DirCache dc, public DirCacheCheckout(Repository repo, DirCache dc,
ObjectId mergeCommitTree, WorkingTreeIterator workingTree) ObjectId mergeCommitTree, WorkingTreeIterator workingTree)
@ -262,7 +272,7 @@ public class DirCacheCheckout {
/** /**
* Constructs a DirCacheCeckout for checking out one tree, merging with the * Constructs a DirCacheCeckout for checking out one tree, merging with the
* index. As iterator over the working tree this constructor creates a * index. As iterator over the working tree this constructor creates a
* standard {@link FileTreeIterator} * standard {@link org.eclipse.jgit.treewalk.FileTreeIterator}
* *
* @param repo * @param repo
* the repository in which we do the checkout * the repository in which we do the checkout
@ -270,7 +280,7 @@ public class DirCacheCheckout {
* the (already locked) Dircache for this repo * the (already locked) Dircache for this repo
* @param mergeCommitTree * @param mergeCommitTree
* the id of the tree of the * the id of the tree of the
* @throws IOException * @throws java.io.IOException
*/ */
public DirCacheCheckout(Repository repo, DirCache dc, public DirCacheCheckout(Repository repo, DirCache dc,
ObjectId mergeCommitTree) throws IOException { ObjectId mergeCommitTree) throws IOException {
@ -281,8 +291,8 @@ public class DirCacheCheckout {
* Scan head, index and merge tree. Used during normal checkout or merge * Scan head, index and merge tree. Used during normal checkout or merge
* operations. * operations.
* *
* @throws CorruptObjectException * @throws org.eclipse.jgit.errors.CorruptObjectException
* @throws IOException * @throws java.io.IOException
*/ */
public void preScanTwoTrees() throws CorruptObjectException, IOException { public void preScanTwoTrees() throws CorruptObjectException, IOException {
removed.clear(); removed.clear();
@ -318,10 +328,10 @@ public class DirCacheCheckout {
* Scan index and merge tree (no HEAD). Used e.g. for initial checkout when * Scan index and merge tree (no HEAD). Used e.g. for initial checkout when
* there is no head yet. * there is no head yet.
* *
* @throws MissingObjectException * @throws org.eclipse.jgit.errors.MissingObjectException
* @throws IncorrectObjectTypeException * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException
* @throws CorruptObjectException * @throws org.eclipse.jgit.errors.CorruptObjectException
* @throws IOException * @throws java.io.IOException
*/ */
public void prescanOneTree() public void prescanOneTree()
throws MissingObjectException, IncorrectObjectTypeException, throws MissingObjectException, IncorrectObjectTypeException,
@ -439,7 +449,8 @@ public class DirCacheCheckout {
} }
/** /**
* Execute this checkout. A {@link WorkingTreeModifiedEvent} is fired if the * Execute this checkout. A
* {@link org.eclipse.jgit.events.WorkingTreeModifiedEvent} is fired if the
* working tree was modified; even if the checkout fails. * working tree was modified; even if the checkout fails.
* *
* @return <code>false</code> if this method could not delete all the files * @return <code>false</code> if this method could not delete all the files
@ -449,8 +460,7 @@ public class DirCacheCheckout {
* Although <code>false</code> is returned the checkout was * Although <code>false</code> is returned the checkout was
* successful and the working tree was updated for all other files. * successful and the working tree was updated for all other files.
* <code>true</code> is returned when no such problem occurred * <code>true</code> is returned when no such problem occurred
* * @throws java.io.IOException
* @throws IOException
*/ */
public boolean checkout() throws IOException { public boolean checkout() throws IOException {
try { try {
@ -1163,10 +1173,12 @@ public class DirCacheCheckout {
/** /**
* If <code>true</code>, will scan first to see if it's possible to check * If <code>true</code>, will scan first to see if it's possible to check
* out, otherwise throw {@link CheckoutConflictException}. If * out, otherwise throw
* {@link org.eclipse.jgit.errors.CheckoutConflictException}. If
* <code>false</code>, it will silently deal with the problem. * <code>false</code>, it will silently deal with the problem.
* *
* @param failOnConflict * @param failOnConflict
* a boolean.
*/ */
public void setFailOnConflict(boolean failOnConflict) { public void setFailOnConflict(boolean failOnConflict) {
this.failOnConflict = failOnConflict; this.failOnConflict = failOnConflict;
@ -1286,8 +1298,8 @@ public class DirCacheCheckout {
* <p> * <p>
* <b>Note:</b> if the entry path on local file system exists as a non-empty * <b>Note:</b> if the entry path on local file system exists as a non-empty
* directory, and the target entry type is a link or file, the checkout will * directory, and the target entry type is a link or file, the checkout will
* fail with {@link IOException} since existing non-empty directory cannot * fail with {@link java.io.IOException} since existing non-empty directory
* be renamed to file or link without deleting it recursively. * cannot be renamed to file or link without deleting it recursively.
* </p> * </p>
* *
* <p> * <p>
@ -1302,7 +1314,7 @@ public class DirCacheCheckout {
* the entry containing new mode and content * the entry containing new mode and content
* @param or * @param or
* object reader to use for checkout * object reader to use for checkout
* @throws IOException * @throws java.io.IOException
* @since 3.6 * @since 3.6
*/ */
public static void checkoutEntry(Repository repo, DirCacheEntry entry, public static void checkoutEntry(Repository repo, DirCacheEntry entry,
@ -1344,8 +1356,7 @@ public class DirCacheCheckout {
* checked out</li> * checked out</li>
* <li>eolStreamType used for stream conversion</li> * <li>eolStreamType used for stream conversion</li>
* </ul> * </ul>
* * @throws java.io.IOException
* @throws IOException
* @since 4.2 * @since 4.2
*/ */
public static void checkoutEntry(Repository repo, DirCacheEntry entry, public static void checkoutEntry(Repository repo, DirCacheEntry entry,

16
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java vendored

@ -60,14 +60,16 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.util.Paths; import org.eclipse.jgit.util.Paths;
/** /**
* Updates a {@link DirCache} by supplying discrete edit commands. * Updates a {@link org.eclipse.jgit.dircache.DirCache} by supplying discrete
* edit commands.
* <p> * <p>
* An editor updates a DirCache by taking a list of {@link PathEdit} commands * An editor updates a DirCache by taking a list of
* and executing them against the entries of the destination cache to produce a * {@link org.eclipse.jgit.dircache.DirCacheEditor.PathEdit} commands and
* new cache. This edit style allows applications to insert a few commands and * executing them against the entries of the destination cache to produce a new
* then have the editor compute the proper entry indexes necessary to perform an * cache. This edit style allows applications to insert a few commands and then
* have the editor compute the proper entry indexes necessary to perform an
* efficient in-order update of the index records. This can be easier to use * efficient in-order update of the index records. This can be easier to use
* than {@link DirCacheBuilder}. * than {@link org.eclipse.jgit.dircache.DirCacheBuilder}.
* <p> * <p>
* *
* @see DirCacheBuilder * @see DirCacheBuilder
@ -113,6 +115,7 @@ public class DirCacheEditor extends BaseDirCacheEditor {
edits.add(edit); edits.add(edit);
} }
/** {@inheritDoc} */
@Override @Override
public boolean commit() throws IOException { public boolean commit() throws IOException {
if (edits.isEmpty()) { if (edits.isEmpty()) {
@ -124,6 +127,7 @@ public class DirCacheEditor extends BaseDirCacheEditor {
return super.commit(); return super.commit();
} }
/** {@inheritDoc} */
@Override @Override
public void finish() { public void finish() {
if (!edits.isEmpty()) { if (!edits.isEmpty()) {

39
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java vendored

@ -68,7 +68,8 @@ import org.eclipse.jgit.util.NB;
import org.eclipse.jgit.util.SystemReader; import org.eclipse.jgit.util.SystemReader;
/** /**
* A single file (or stage of a file) in a {@link DirCache}. * A single file (or stage of a file) in a
* {@link org.eclipse.jgit.dircache.DirCache}.
* <p> * <p>
* An entry represents exactly one stage of a file. If a file path is unmerged * An entry represents exactly one stage of a file. If a file path is unmerged
* then multiple DirCacheEntry instances may appear for the same path name. * then multiple DirCacheEntry instances may appear for the same path name.
@ -221,7 +222,7 @@ public class DirCacheEntry {
* *
* @param newPath * @param newPath
* name of the cache entry. * name of the cache entry.
* @throws IllegalArgumentException * @throws java.lang.IllegalArgumentException
* If the path starts or ends with "/", or contains "//" either * If the path starts or ends with "/", or contains "//" either
* "\0". These sequences are not permitted in a git tree object * "\0". These sequences are not permitted in a git tree object
* or DirCache file. * or DirCache file.
@ -237,7 +238,7 @@ public class DirCacheEntry {
* name of the cache entry. * name of the cache entry.
* @param stage * @param stage
* the stage index of the new entry. * the stage index of the new entry.
* @throws IllegalArgumentException * @throws java.lang.IllegalArgumentException
* If the path starts or ends with "/", or contains "//" either * If the path starts or ends with "/", or contains "//" either
* "\0". These sequences are not permitted in a git tree object * "\0". These sequences are not permitted in a git tree object
* or DirCache file. Or if {@code stage} is outside of the * or DirCache file. Or if {@code stage} is outside of the
@ -252,7 +253,7 @@ public class DirCacheEntry {
* *
* @param newPath * @param newPath
* name of the cache entry, in the standard encoding. * name of the cache entry, in the standard encoding.
* @throws IllegalArgumentException * @throws java.lang.IllegalArgumentException
* If the path starts or ends with "/", or contains "//" either * If the path starts or ends with "/", or contains "//" either
* "\0". These sequences are not permitted in a git tree object * "\0". These sequences are not permitted in a git tree object
* or DirCache file. * or DirCache file.
@ -268,7 +269,7 @@ public class DirCacheEntry {
* name of the cache entry, in the standard encoding. * name of the cache entry, in the standard encoding.
* @param stage * @param stage
* the stage index of the new entry. * the stage index of the new entry.
* @throws IllegalArgumentException * @throws java.lang.IllegalArgumentException
* If the path starts or ends with "/", or contains "//" either * If the path starts or ends with "/", or contains "//" either
* "\0". These sequences are not permitted in a git tree object * "\0". These sequences are not permitted in a git tree object
* or DirCache file. Or if {@code stage} is outside of the * or DirCache file. Or if {@code stage} is outside of the
@ -378,8 +379,9 @@ public class DirCacheEntry {
/** /**
* Check whether this entry has been smudged or not * Check whether this entry has been smudged or not
* <p> * <p>
* If a blob has length 0 we know his id see {@link Constants#EMPTY_BLOB_ID}. If an entry * If a blob has length 0 we know its id, see
* has length 0 and an ID different from the one for empty blob we know this * {@link org.eclipse.jgit.lib.Constants#EMPTY_BLOB_ID}. If an entry has
* length 0 and an ID different from the one for empty blob we know this
* entry was smudged. * entry was smudged.
* *
* @return <code>true</code> if the entry is smudged, <code>false</code> * @return <code>true</code> if the entry is smudged, <code>false</code>
@ -426,7 +428,9 @@ public class DirCacheEntry {
} }
/** /**
* @return true if this entry should be checked for changes * Whether this entry should be checked for changes
*
* @return {@code true} if this entry should be checked for changes
*/ */
public boolean isUpdateNeeded() { public boolean isUpdateNeeded() {
return (inCoreFlags & UPDATE_NEEDED) != 0; return (inCoreFlags & UPDATE_NEEDED) != 0;
@ -436,6 +440,7 @@ public class DirCacheEntry {
* Set whether this entry must be checked for changes * Set whether this entry must be checked for changes
* *
* @param updateNeeded * @param updateNeeded
* whether this entry must be checked for changes
*/ */
public void setUpdateNeeded(boolean updateNeeded) { public void setUpdateNeeded(boolean updateNeeded) {
if (updateNeeded) if (updateNeeded)
@ -484,7 +489,7 @@ public class DirCacheEntry {
} }
/** /**
* Obtain the raw {@link FileMode} bits for this entry. * Obtain the raw {@link org.eclipse.jgit.lib.FileMode} bits for this entry.
* *
* @return mode bits for the entry. * @return mode bits for the entry.
* @see FileMode#fromBits(int) * @see FileMode#fromBits(int)
@ -494,7 +499,7 @@ public class DirCacheEntry {
} }
/** /**
* Obtain the {@link FileMode} for this entry. * Obtain the {@link org.eclipse.jgit.lib.FileMode} for this entry.
* *
* @return the file mode singleton for this entry. * @return the file mode singleton for this entry.
*/ */
@ -507,10 +512,11 @@ public class DirCacheEntry {
* *
* @param mode * @param mode
* the new mode constant. * the new mode constant.
* @throws IllegalArgumentException * @throws java.lang.IllegalArgumentException
* If {@code mode} is {@link FileMode#MISSING}, * If {@code mode} is
* {@link FileMode#TREE}, or any other type code not permitted * {@link org.eclipse.jgit.lib.FileMode#MISSING},
* in a tree object. * {@link org.eclipse.jgit.lib.FileMode#TREE}, or any other type
* code not permitted in a tree object.
*/ */
public void setFileMode(final FileMode mode) { public void setFileMode(final FileMode mode) {
switch (mode.getBits() & FileMode.TYPE_MASK) { switch (mode.getBits() & FileMode.TYPE_MASK) {
@ -629,7 +635,8 @@ public class DirCacheEntry {
* *
* @param id * @param id
* new object identifier for the entry. May be * new object identifier for the entry. May be
* {@link ObjectId#zeroId()} to remove the current identifier. * {@link org.eclipse.jgit.lib.ObjectId#zeroId()} to remove the
* current identifier.
*/ */
public void setObjectId(final AnyObjectId id) { public void setObjectId(final AnyObjectId id) {
id.copyRawTo(idBuffer(), idOffset()); id.copyRawTo(idBuffer(), idOffset());
@ -676,6 +683,8 @@ public class DirCacheEntry {
} }
/** /**
* {@inheritDoc}
* <p>
* Use for debugging only ! * Use for debugging only !
*/ */
@SuppressWarnings("nls") @SuppressWarnings("nls")

24
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheIterator.java vendored

@ -61,7 +61,8 @@ import org.eclipse.jgit.treewalk.EmptyTreeIterator;
import org.eclipse.jgit.util.RawParseUtils; import org.eclipse.jgit.util.RawParseUtils;
/** /**
* Iterate a {@link DirCache} as part of a <code>TreeWalk</code>. * Iterate a {@link org.eclipse.jgit.dircache.DirCache} as part of a
* <code>TreeWalk</code>.
* <p> * <p>
* This is an iterator to adapt a loaded <code>DirCache</code> instance (such as * This is an iterator to adapt a loaded <code>DirCache</code> instance (such as
* read from an existing <code>.git/index</code> file) to the tree structure * read from an existing <code>.git/index</code> file) to the tree structure
@ -134,6 +135,7 @@ public class DirCacheIterator extends AbstractTreeIterator {
parseEntry(); parseEntry();
} }
/** {@inheritDoc} */
@Override @Override
public AbstractTreeIterator createSubtreeIterator(final ObjectReader reader) public AbstractTreeIterator createSubtreeIterator(final ObjectReader reader)
throws IncorrectObjectTypeException, IOException { throws IncorrectObjectTypeException, IOException {
@ -143,6 +145,7 @@ public class DirCacheIterator extends AbstractTreeIterator {
return new DirCacheIterator(this, currentSubtree); return new DirCacheIterator(this, currentSubtree);
} }
/** {@inheritDoc} */
@Override @Override
public EmptyTreeIterator createEmptyTreeIterator() { public EmptyTreeIterator createEmptyTreeIterator() {
final byte[] n = new byte[Math.max(pathLen + 1, DEFAULT_PATH_SIZE)]; final byte[] n = new byte[Math.max(pathLen + 1, DEFAULT_PATH_SIZE)];
@ -151,6 +154,7 @@ public class DirCacheIterator extends AbstractTreeIterator {
return new EmptyTreeIterator(this, n, pathLen + 1); return new EmptyTreeIterator(this, n, pathLen + 1);
} }
/** {@inheritDoc} */
@Override @Override
public boolean hasId() { public boolean hasId() {
if (currentSubtree != null) if (currentSubtree != null)
@ -158,6 +162,7 @@ public class DirCacheIterator extends AbstractTreeIterator {
return currentEntry != null; return currentEntry != null;
} }
/** {@inheritDoc} */
@Override @Override
public byte[] idBuffer() { public byte[] idBuffer() {
if (currentSubtree != null) if (currentSubtree != null)
@ -167,6 +172,7 @@ public class DirCacheIterator extends AbstractTreeIterator {
return zeroid; return zeroid;
} }
/** {@inheritDoc} */
@Override @Override
public int idOffset() { public int idOffset() {
if (currentSubtree != null) if (currentSubtree != null)
@ -176,6 +182,7 @@ public class DirCacheIterator extends AbstractTreeIterator {
return 0; return 0;
} }
/** {@inheritDoc} */
@Override @Override
public void reset() { public void reset() {
if (!first()) { if (!first()) {
@ -188,16 +195,19 @@ public class DirCacheIterator extends AbstractTreeIterator {
} }
} }
/** {@inheritDoc} */
@Override @Override
public boolean first() { public boolean first() {
return ptr == treeStart; return ptr == treeStart;
} }
/** {@inheritDoc} */
@Override @Override
public boolean eof() { public boolean eof() {
return ptr == treeEnd; return ptr == treeEnd;
} }
/** {@inheritDoc} */
@Override @Override
public void next(int delta) { public void next(int delta) {
while (--delta >= 0) { while (--delta >= 0) {
@ -211,6 +221,7 @@ public class DirCacheIterator extends AbstractTreeIterator {
} }
} }
/** {@inheritDoc} */
@Override @Override
public void back(int delta) { public void back(int delta) {
while (--delta >= 0) { while (--delta >= 0) {
@ -282,12 +293,15 @@ public class DirCacheIterator extends AbstractTreeIterator {
} }
/** /**
* Retrieves the {@link AttributesNode} for the current entry. * Retrieves the {@link org.eclipse.jgit.attributes.AttributesNode} for the
* current entry.
* *
* @param reader * @param reader
* {@link ObjectReader} used to parse the .gitattributes entry. * {@link org.eclipse.jgit.lib.ObjectReader} used to parse the
* @return {@link AttributesNode} for the current entry. * .gitattributes entry.
* @throws IOException * @return {@link org.eclipse.jgit.attributes.AttributesNode} for the
* current entry.
* @throws java.io.IOException
* @since 3.7 * @since 3.7
*/ */
public AttributesNode getEntryAttributesNode(ObjectReader reader) public AttributesNode getEntryAttributesNode(ObjectReader reader)

21
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheTree.java vendored

@ -62,13 +62,14 @@ import org.eclipse.jgit.util.MutableInteger;
import org.eclipse.jgit.util.RawParseUtils; import org.eclipse.jgit.util.RawParseUtils;
/** /**
* Single tree record from the 'TREE' {@link DirCache} extension. * Single tree record from the 'TREE' {@link org.eclipse.jgit.dircache.DirCache}
* extension.
* <p> * <p>
* A valid cache tree record contains the object id of a tree object and the * A valid cache tree record contains the object id of a tree object and the
* total number of {@link DirCacheEntry} instances (counted recursively) from * total number of {@link org.eclipse.jgit.dircache.DirCacheEntry} instances
* the DirCache contained within the tree. This information facilitates faster * (counted recursively) from the DirCache contained within the tree. This
* traversal of the index and quicker generation of tree objects prior to * information facilitates faster traversal of the index and quicker generation
* creating a new commit. * of tree objects prior to creating a new commit.
* <p> * <p>
* An invalid cache tree record indicates a known subtree whose file entries * An invalid cache tree record indicates a known subtree whose file entries
* have changed in ways that cause the tree to no longer have a known object id. * have changed in ways that cause the tree to no longer have a known object id.
@ -205,10 +206,11 @@ public class DirCacheTree {
/** /**
* Determine if this cache is currently valid. * Determine if this cache is currently valid.
* <p> * <p>
* A valid cache tree knows how many {@link DirCacheEntry} instances from * A valid cache tree knows how many
* the parent {@link DirCache} reside within this tree (recursively * {@link org.eclipse.jgit.dircache.DirCacheEntry} instances from the parent
* enumerated). It also knows the object id of the tree, as the tree should * {@link org.eclipse.jgit.dircache.DirCache} reside within this tree
* be readily available from the repository's object database. * (recursively enumerated). It also knows the object id of the tree, as the
* tree should be readily available from the repository's object database.
* *
* @return true if this tree is knows key details about itself; false if the * @return true if this tree is knows key details about itself; false if the
* tree needs to be regenerated. * tree needs to be regenerated.
@ -563,6 +565,7 @@ public class DirCacheTree {
return -1; return -1;
} }
/** {@inheritDoc} */
@Override @Override
public String toString() { public String toString() {
return getNameString(); return getNameString();

3
org.eclipse.jgit/src/org/eclipse/jgit/dircache/InvalidPathException.java vendored

@ -57,7 +57,10 @@ public class InvalidPathException extends IllegalArgumentException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* Constructor for InvalidPathException
*
* @param path * @param path
* the invalid path
*/ */
public InvalidPathException(String path) { public InvalidPathException(String path) {
this(JGitText.get().invalidPath, path); this(JGitText.get().invalidPath, path);

Loading…
Cancel
Save