Browse Source

Fix javadoc in org.eclipse.jgit storage/file package

Change-Id: Ieb2f66aef2cab7e2a6d8e35c5f5047da881994dd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.10
Matthias Sohn 7 years ago
parent
commit
5480da5999
  1. 1
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BasePackBitmapIndex.java
  2. 6
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java
  3. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteArrayWindow.java
  4. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteBufferWindow.java
  5. 21
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteWindow.java
  6. 3
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/CachedObjectDirectory.java
  7. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/CheckoutEntryImpl.java
  8. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileObjectDatabase.java
  9. 51
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
  10. 6
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java
  11. 37
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
  12. 11
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GlobalAttributesNode.java
  13. 11
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/InfoAttributesNode.java
  14. 5
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LargePackedWholeObject.java
  15. 5
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LazyObjectIdSetFile.java
  16. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalCachedPack.java
  17. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectRepresentation.java
  18. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectToPack.java
  19. 41
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java
  20. 46
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
  21. 6
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java
  22. 27
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java
  23. 16
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndex.java
  24. 54
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexBuilder.java
  25. 7
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java
  26. 7
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexV1.java
  27. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexWriterV1.java
  28. 22
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
  29. 29
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java
  30. 8
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java
  31. 9
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV2.java
  32. 35
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriter.java
  33. 1
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriterV1.java
  34. 1
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriterV2.java
  35. 3
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackInputStream.java
  36. 15
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackInserter.java
  37. 9
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java
  38. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndex.java
  39. 1
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java
  40. 19
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
  41. 1
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryRename.java
  42. 7
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java
  43. 6
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogEntryImpl.java
  44. 4
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogReaderImpl.java
  45. 22
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogWriter.java
  46. 22
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/SimpleDataInput.java
  47. 14
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/SimpleDataOutput.java
  48. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java
  49. 10
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java
  50. 20
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java

1
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BasePackBitmapIndex.java

@ -58,6 +58,7 @@ abstract class BasePackBitmapIndex extends PackBitmapIndex {
this.bitmaps = bitmaps;
}
/** {@inheritDoc} */
@Override
public EWAHCompressedBitmap getBitmap(AnyObjectId objectId) {
StoredBitmap sb = bitmaps.get(objectId);

6
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java

@ -59,7 +59,9 @@ import org.eclipse.jgit.util.BlockList;
import com.googlecode.javaewah.EWAHCompressedBitmap;
import com.googlecode.javaewah.IntIterator;
/** A compressed bitmap representation of the entire object graph. */
/**
* A compressed bitmap representation of the entire object graph.
*/
public class BitmapIndexImpl implements BitmapIndex {
private static final int EXTRA_BITS = 10 * 1024;
@ -85,6 +87,7 @@ public class BitmapIndexImpl implements BitmapIndex {
return packIndex;
}
/** {@inheritDoc} */
@Override
public CompressedBitmap getBitmap(AnyObjectId objectId) {
EWAHCompressedBitmap compressed = packIndex.getBitmap(objectId);
@ -93,6 +96,7 @@ public class BitmapIndexImpl implements BitmapIndex {
return new CompressedBitmap(compressed, this);
}
/** {@inheritDoc} */
@Override
public CompressedBitmapBuilder newBitmapBuilder() {
return new CompressedBitmapBuilder(this);

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteArrayWindow.java

@ -63,6 +63,7 @@ final class ByteArrayWindow extends ByteWindow {
array = b;
}
/** {@inheritDoc} */
@Override
protected int copy(final int p, final byte[] b, final int o, int n) {
n = Math.min(array.length - p, n);
@ -70,6 +71,7 @@ final class ByteArrayWindow extends ByteWindow {
return n;
}
/** {@inheritDoc} */
@Override
protected int setInput(final int pos, final Inflater inf)
throws DataFormatException {

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteBufferWindow.java

@ -65,6 +65,7 @@ final class ByteBufferWindow extends ByteWindow {
buffer = b;
}
/** {@inheritDoc} */
@Override
protected int copy(final int p, final byte[] b, final int o, int n) {
final ByteBuffer s = buffer.slice();
@ -89,6 +90,7 @@ final class ByteBufferWindow extends ByteWindow {
}
}
/** {@inheritDoc} */
@Override
protected int setInput(final int pos, final Inflater inf)
throws DataFormatException {

21
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteWindow.java

@ -66,6 +66,16 @@ abstract class ByteWindow {
protected final long end;
/**
* Constructor for ByteWindow.
*
* @param p
* a {@link org.eclipse.jgit.internal.storage.file.PackFile}.
* @param s
* where the byte window starts in the pack file
* @param n
* size of the byte window
*/
protected ByteWindow(final PackFile p, final long s, final int n) {
pack = p;
start = s;
@ -127,6 +137,17 @@ abstract class ByteWindow {
return setInput((int) (pos - start), inf);
}
/**
* Set the input
*
* @param pos
* position
* @param inf
* an {@link java.util.zip.Inflater} object.
* @return size of the byte window
* @throws java.util.zip.DataFormatException
* if any.
*/
protected abstract int setInput(int pos, Inflater inf)
throws DataFormatException;
}

3
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/CachedObjectDirectory.java

@ -117,11 +117,13 @@ class CachedObjectDirectory extends FileObjectDatabase {
return m;
}
/** {@inheritDoc} */
@Override
public void close() {
// Don't close anything.
}
/** {@inheritDoc} */
@Override
public ObjectDatabase newCachedDatabase() {
return this;
@ -177,6 +179,7 @@ class CachedObjectDirectory extends FileObjectDatabase {
wrapped.resolve(matches, id);
}
/** {@inheritDoc} */
@Override
public boolean has(final AnyObjectId objectId) throws IOException {
return has(objectId, null);

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/CheckoutEntryImpl.java

@ -65,11 +65,13 @@ public class CheckoutEntryImpl implements CheckoutEntry {
to = comment.substring(p2 + " to ".length(), p3); //$NON-NLS-1$
}
/** {@inheritDoc} */
@Override
public String getFromBranch() {
return from;
}
/** {@inheritDoc} */
@Override
public String getToBranch() {
return to;

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileObjectDatabase.java

@ -64,11 +64,13 @@ abstract class FileObjectDatabase extends ObjectDatabase {
INSERTED, EXISTS_PACKED, EXISTS_LOOSE, FAILURE;
}
/** {@inheritDoc} */
@Override
public ObjectReader newReader() {
return new WindowCursor(this);
}
/** {@inheritDoc} */
@Override
public ObjectDirectoryInserter newInserter() {
return new ObjectDirectoryInserter(this, getConfig());

51
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java

@ -116,7 +116,6 @@ import org.eclipse.jgit.util.SystemReader;
* This class is thread-safe.
* <p>
* This implementation only handles a subtly undocumented subset of git features.
*
*/
public class FileRepository extends Repository {
private static final String UNNAMED = "Unnamed repository; edit this file to name it for gitweb."; //$NON-NLS-1$
@ -133,8 +132,9 @@ public class FileRepository extends Repository {
* <p>
* The work tree, object directory, alternate object directories and index
* file locations are deduced from the given git directory and the default
* rules by running {@link FileRepositoryBuilder}. This constructor is the
* same as saying:
* rules by running
* {@link org.eclipse.jgit.storage.file.FileRepositoryBuilder}. This
* constructor is the same as saying:
*
* <pre>
* new FileRepositoryBuilder().setGitDir(gitDir).build()
@ -142,7 +142,7 @@ public class FileRepository extends Repository {
*
* @param gitDir
* GIT_DIR (the location of the repository metadata).
* @throws IOException
* @throws java.io.IOException
* the repository appears to already exist but cannot be
* accessed.
* @see FileRepositoryBuilder
@ -156,7 +156,7 @@ public class FileRepository extends Repository {
*
* @param gitDir
* GIT_DIR (the location of the repository metadata).
* @throws IOException
* @throws java.io.IOException
* the repository appears to already exist but cannot be
* accessed.
* @see FileRepositoryBuilder
@ -170,7 +170,7 @@ public class FileRepository extends Repository {
*
* @param options
* description of the repository's important paths.
* @throws IOException
* @throws java.io.IOException
* the user configuration file or repository configuration file
* cannot be accessed.
*/
@ -279,14 +279,10 @@ public class FileRepository extends Repository {
}
/**
* {@inheritDoc}
* <p>
* Create a new Git repository initializing the necessary files and
* directories.
*
* @param bare
* if true, a bare repository is created.
*
* @throws IOException
* in case of IO problem
*/
@Override
public void create(boolean bare) throws IOException {
@ -380,25 +376,27 @@ public class FileRepository extends Repository {
}
/**
* Get the directory containing the objects owned by this repository
*
* @return the directory containing the objects owned by this repository.
*/
public File getObjectsDirectory() {
return objectDatabase.getDirectory();
}
/** @return the object database storing this repository's data. */
/** {@inheritDoc} */
@Override
public ObjectDirectory getObjectDatabase() {
return objectDatabase;
}
/** @return the reference database which stores the reference namespace. */
/** {@inheritDoc} */
@Override
public RefDatabase getRefDatabase() {
return refs;
}
/** @return the configuration of this repository. */
/** {@inheritDoc} */
@Override
public FileBasedConfig getConfig() {
if (systemConfig.isOutdated()) {
@ -425,6 +423,7 @@ public class FileRepository extends Repository {
return repoConfig;
}
/** {@inheritDoc} */
@Override
@Nullable
public String getGitwebDescription() throws IOException {
@ -443,6 +442,7 @@ public class FileRepository extends Repository {
return d;
}
/** {@inheritDoc} */
@Override
public void setGitwebDescription(@Nullable String description)
throws IOException {
@ -479,14 +479,14 @@ public class FileRepository extends Repository {
}
/**
* {@inheritDoc}
* <p>
* Objects known to exist but not expressed by {@link #getAllRefs()}.
* <p>
* When a repository borrows objects from another repository, it can
* advertise that it safely has that other repository's references, without
* exposing any other details about the other repository. This may help
* a client trying to push changes avoid pushing more than it needs to.
*
* @return unmodifiable collection of other known objects.
* exposing any other details about the other repository. This may help a
* client trying to push changes avoid pushing more than it needs to.
*/
@Override
public Set<ObjectId> getAdditionalHaves() {
@ -531,7 +531,7 @@ public class FileRepository extends Repository {
*
* @param pack
* path of the pack file to open.
* @throws IOException
* @throws java.io.IOException
* index file could not be opened, read, or is not recognized as
* a Git pack file index.
*/
@ -539,6 +539,7 @@ public class FileRepository extends Repository {
objectDatabase.openPack(pack);
}
/** {@inheritDoc} */
@Override
public void scanForRepoChanges() throws IOException {
getRefDatabase().getRefs(ALL); // This will look for changes to refs
@ -557,18 +558,14 @@ public class FileRepository extends Repository {
notifyIndexChanged();
}
/** {@inheritDoc} */
@Override
public void notifyIndexChanged() {
snapshot = FileSnapshot.save(getIndexFile());
fireEvent(new IndexChangedEvent());
}
/**
* @param refName
* @return a {@link ReflogReader} for the supplied refname, or null if the
* named ref does not exist.
* @throws IOException the ref could not be accessed.
*/
/** {@inheritDoc} */
@Override
public ReflogReader getReflogReader(String refName) throws IOException {
Ref ref = findRef(refName);
@ -577,6 +574,7 @@ public class FileRepository extends Repository {
return null;
}
/** {@inheritDoc} */
@Override
public AttributesNodeProvider createAttributesNodeProvider() {
return new AttributesNodeProviderImpl(this);
@ -642,6 +640,7 @@ public class FileRepository extends Repository {
ConfigConstants.CONFIG_KEY_AUTODETACH, true);
}
/** {@inheritDoc} */
@Override
public void autoGC(ProgressMonitor monitor) {
GC gc = new GC(this);

6
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java

@ -121,7 +121,6 @@ public class FileSnapshot {
*
* @param modified
* the last modification time of the file
*
* @return the snapshot.
*/
public static FileSnapshot save(long modified) {
@ -145,6 +144,8 @@ public class FileSnapshot {
}
/**
* Get time of last snapshot update
*
* @return time of last snapshot update
*/
public long lastModified() {
@ -208,6 +209,7 @@ public class FileSnapshot {
return lastModified == other.lastModified;
}
/** {@inheritDoc} */
@Override
public boolean equals(Object other) {
if (other instanceof FileSnapshot)
@ -215,6 +217,7 @@ public class FileSnapshot {
return false;
}
/** {@inheritDoc} */
@Override
public int hashCode() {
// This is pretty pointless, but override hashCode to ensure that
@ -223,6 +226,7 @@ public class FileSnapshot {
return (int) lastModified;
}
/** {@inheritDoc} */
@Override
public String toString() {
if (this == DIRTY)

37
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java

@ -124,8 +124,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A garbage collector for git {@link FileRepository}. Instances of this class
* are not thread-safe. Don't use the same instance from multiple threads.
* A garbage collector for git
* {@link org.eclipse.jgit.internal.storage.file.FileRepository}. Instances of
* this class are not thread-safe. Don't use the same instance from multiple
* threads.
*
* This class started as a copy of DfsGarbageCollector from Shawn O. Pearce
* adapted to FileRepositories.
@ -218,7 +220,8 @@ public class GC {
}
/**
* Runs a garbage collector on a {@link FileRepository}. It will
* Runs a garbage collector on a
* {@link org.eclipse.jgit.internal.storage.file.FileRepository}. It will
* <ul>
* <li>pack loose references into packed-refs</li>
* <li>repack all reachable objects into new pack files and delete the old
@ -235,9 +238,11 @@ public class GC {
* return immediately. In this case, errors will not be reported except in
* gc.log.
*
* @return the collection of {@link PackFile}'s which are newly created
* @throws IOException
* @throws ParseException
* @return the collection of
* {@link org.eclipse.jgit.internal.storage.file.PackFile}'s which
* are newly created
* @throws java.io.IOException
* @throws java.text.ParseException
* If the configuration parameter "gc.pruneexpire" couldn't be
* parsed
*/
@ -475,7 +480,7 @@ public class GC {
* which can be found in packs. If certain objects can't be pruned (e.g.
* because the filesystem delete operation fails) this is silently ignored.
*
* @throws IOException
* @throws java.io.IOException
*/
public void prunePacked() throws IOException {
ObjectDirectory objdb = repo.getObjectDatabase();
@ -533,9 +538,8 @@ public class GC {
*
* @param objectsToKeep
* a set of objects which should explicitly not be pruned
*
* @throws IOException
* @throws ParseException
* @throws java.io.IOException
* @throws java.text.ParseException
* If the configuration parameter "gc.pruneexpire" couldn't be
* parsed
*/
@ -782,7 +786,7 @@ public class GC {
/**
* Packs all non-symbolic, loose refs into packed-refs.
*
* @throws IOException
* @throws java.io.IOException
*/
public void packRefs() throws IOException {
Collection<Ref> refs = repo.getRefDatabase().getRefs(Constants.R_REFS).values();
@ -810,10 +814,10 @@ public class GC {
* repacked. All old pack files which existed before are deleted.
*
* @return a collection of the newly created pack files
* @throws IOException
* @throws java.io.IOException
* when during reading of refs, index, packfiles, objects,
* reflog-entries or during writing to the packfiles
* {@link IOException} occurs
* {@link java.io.IOException} occurs
*/
public Collection<PackFile> repack() throws IOException {
Collection<PackFile> toBeDeleted = repo.getObjectDatabase().getPacks();
@ -1312,7 +1316,7 @@ public class GC {
* Returns information about objects and pack files for a FileRepository.
*
* @return information about objects and pack files for a FileRepository
* @throws IOException
* @throws java.io.IOException
*/
public RepoStatistics getStatistics() throws IOException {
RepoStatistics ret = new RepoStatistics();
@ -1357,7 +1361,7 @@ public class GC {
/**
* Set the progress monitor used for garbage collection methods.
*
* @param pm
* @param pm a {@link org.eclipse.jgit.lib.ProgressMonitor} object.
* @return this
*/
public GC setProgressMonitor(ProgressMonitor pm) {
@ -1399,7 +1403,8 @@ public class GC {
* "git gc --aggressive"
*
* @param pconfig
* the {@link PackConfig} used when writing packs
* the {@link org.eclipse.jgit.storage.pack.PackConfig} used when
* writing packs
*/
public void setPackConfig(PackConfig pconfig) {
this.pconfig = pconfig;

11
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GlobalAttributesNode.java

@ -51,20 +51,27 @@ import org.eclipse.jgit.lib.CoreConfig;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.util.FS;
/** Attribute node loaded from global system-wide file. */
/**
* Attribute node loaded from global system-wide file.
*/
public class GlobalAttributesNode extends AttributesNode {
final Repository repository;
/**
* Constructor for GlobalAttributesNode.
*
* @param repository
* the {@link org.eclipse.jgit.lib.Repository}.
*/
public GlobalAttributesNode(Repository repository) {
this.repository = repository;
}
/**
* Load the attributes node
*
* @return the attributes node
* @throws IOException
* @throws java.io.IOException
*/
public AttributesNode load() throws IOException {
AttributesNode r = new AttributesNode();

11
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/InfoAttributesNode.java

@ -51,20 +51,27 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.util.FS;
/** Attribute node loaded from the $GIT_DIR/info/attributes file. */
/**
* Attribute node loaded from the $GIT_DIR/info/attributes file.
*/
public class InfoAttributesNode extends AttributesNode {
final Repository repository;
/**
* Constructor for InfoAttributesNode.
*
* @param repository
* the {@link org.eclipse.jgit.lib.Repository}.
*/
public InfoAttributesNode(Repository repository) {
this.repository = repository;
}
/**
* Load the attributes node
*
* @return the attributes node
* @throws IOException
* @throws java.io.IOException
*/
public AttributesNode load() throws IOException {
AttributesNode r = new AttributesNode();

5
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LargePackedWholeObject.java

@ -77,21 +77,25 @@ class LargePackedWholeObject extends ObjectLoader {
this.db = db;
}
/** {@inheritDoc} */
@Override
public int getType() {
return type;
}
/** {@inheritDoc} */
@Override
public long getSize() {
return size;
}
/** {@inheritDoc} */
@Override
public boolean isLarge() {
return true;
}
/** {@inheritDoc} */
@Override
public byte[] getCachedBytes() throws LargeObjectException {
try {
@ -103,6 +107,7 @@ class LargePackedWholeObject extends ObjectLoader {
}
}
/** {@inheritDoc} */
@Override
public ObjectStream openStream() throws MissingObjectException, IOException {
WindowCursor wc = new WindowCursor(db);

5
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LazyObjectIdSetFile.java

@ -57,7 +57,9 @@ import org.eclipse.jgit.lib.MutableObjectId;
import org.eclipse.jgit.lib.ObjectIdOwnerMap;
import org.eclipse.jgit.lib.ObjectIdSet;
/** Lazily loads a set of ObjectIds, one per line. */
/**
* Lazily loads a set of ObjectIds, one per line.
*/
public class LazyObjectIdSetFile implements ObjectIdSet {
private final File src;
private ObjectIdOwnerMap<Entry> set;
@ -72,6 +74,7 @@ public class LazyObjectIdSetFile implements ObjectIdSet {
this.src = src;
}
/** {@inheritDoc} */
@Override
public boolean contains(AnyObjectId objectId) {
if (set == null) {

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalCachedPack.java

@ -71,6 +71,7 @@ class LocalCachedPack extends CachedPack {
this.packs = packs.toArray(new PackFile[packs.size()]);
}
/** {@inheritDoc} */
@Override
public long getObjectCount() throws IOException {
long cnt = 0;
@ -85,6 +86,7 @@ class LocalCachedPack extends CachedPack {
pack.copyPackAsIs(out, wc);
}
/** {@inheritDoc} */
@Override
public boolean hasObject(ObjectToPack obj, StoredObjectRepresentation rep) {
try {

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectRepresentation.java

@ -92,11 +92,13 @@ class LocalObjectRepresentation extends StoredObjectRepresentation {
private ObjectId baseId;
/** {@inheritDoc} */
@Override
public int getWeight() {
return (int) Math.min(length, Integer.MAX_VALUE);
}
/** {@inheritDoc} */
@Override
public ObjectId getDeltaBase() {
if (baseId == null && getFormat() == PACK_DELTA) {

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectToPack.java

@ -62,12 +62,14 @@ class LocalObjectToPack extends ObjectToPack {
super(src, type);
}
/** {@inheritDoc} */
@Override
protected void clearReuseAsIs() {
super.clearReuseAsIs();
pack = null;
}
/** {@inheritDoc} */
@Override
public void select(StoredObjectRepresentation ref) {
LocalObjectRepresentation ptr = (LocalObjectRepresentation) ref;

41
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java

@ -57,7 +57,6 @@ import java.nio.channels.FileChannel;
import java.nio.file.StandardCopyOption;
import java.text.MessageFormat;
import org.eclipse.jgit.errors.LockFailedException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
@ -81,10 +80,12 @@ public class LockFile {
* Unlock the given file.
* <p>
* This method can be used for recovering from a thrown
* {@link LockFailedException} . This method does not validate that the lock
* is or is not currently held before attempting to unlock it.
* {@link org.eclipse.jgit.errors.LockFailedException} . This method does
* not validate that the lock is or is not currently held before attempting
* to unlock it.
*
* @param file
* a {@link java.io.File} object.
* @return true if unlocked, false if unlocking failed
*/
public static boolean unlock(final File file) {
@ -138,7 +139,9 @@ public class LockFile {
* @param fs
* the file system abstraction which will be necessary to perform
* certain file system operations.
* @deprecated use {@link LockFile#LockFile(File)} instead
* @deprecated use
* {@link org.eclipse.jgit.internal.storage.file.LockFile#LockFile(File)}
* instead
*/
@Deprecated
public LockFile(final File f, final FS fs) {
@ -162,7 +165,7 @@ public class LockFile {
*
* @return true if the lock is now held by the caller; false if it is held
* by someone else.
* @throws IOException
* @throws java.io.IOException
* the temporary output file could not be created. The caller
* does not hold the lock.
*/
@ -185,7 +188,7 @@ public class LockFile {
*
* @return true if the lock is now held by the caller; false if it is held
* by someone else.
* @throws IOException
* @throws java.io.IOException
* the temporary output file could not be created. The caller
* does not hold the lock.
*/
@ -206,12 +209,12 @@ public class LockFile {
* This method does nothing if the current file does not exist, or exists
* but is empty.
*
* @throws IOException
* @throws java.io.IOException
* the temporary file could not be written, or a read error
* occurred while reading from the current file. The lock is
* released before throwing the underlying IO exception to the
* caller.
* @throws RuntimeException
* @throws java.lang.RuntimeException
* the temporary file could not be written. The lock is released
* before throwing the underlying exception to the caller.
*/
@ -264,10 +267,10 @@ public class LockFile {
* @param id
* the id to store in the file. The id will be written in hex,
* followed by a sole LF.
* @throws IOException
* @throws java.io.IOException
* the temporary file could not be written. The lock is released
* before throwing the underlying IO exception to the caller.
* @throws RuntimeException
* @throws java.lang.RuntimeException
* the temporary file could not be written. The lock is released
* before throwing the underlying exception to the caller.
*/
@ -285,10 +288,10 @@ public class LockFile {
* the bytes to store in the temporary file. No additional bytes
* are added, so if the file must end with an LF it must appear
* at the end of the byte array.
* @throws IOException
* @throws java.io.IOException
* the temporary file could not be written. The lock is released
* before throwing the underlying IO exception to the caller.
* @throws RuntimeException
* @throws java.lang.RuntimeException
* the temporary file could not be written. The lock is released
* before throwing the underlying exception to the caller.
*/
@ -394,7 +397,8 @@ public class LockFile {
}
/**
* Request that {@link #commit()} remember the {@link FileSnapshot}.
* Request that {@link #commit()} remember the
* {@link org.eclipse.jgit.internal.storage.file.FileSnapshot}.
*
* @param on
* true if the commit method must remember the FileSnapshot.
@ -420,7 +424,7 @@ public class LockFile {
* method sleeps until it can force the new lock file's modification date to
* be later than the target file.
*
* @throws InterruptedException
* @throws java.lang.InterruptedException
* the thread was interrupted before the last modified date of
* the lock file was different from the last modified date of
* the target file.
@ -443,7 +447,7 @@ public class LockFile {
* @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
* old data.
* @throws IllegalStateException
* @throws java.lang.IllegalStateException
* the lock is not held.
*/
public boolean commit() {
@ -477,7 +481,11 @@ public class LockFile {
return commitSnapshot.lastModified();
}
/** @return get the {@link FileSnapshot} just before commit. */
/**
* Get the {@link FileSnapshot} just before commit.
*
* @return get the {@link FileSnapshot} just before commit.
*/
public FileSnapshot getCommitSnapshot() {
return commitSnapshot;
}
@ -517,6 +525,7 @@ public class LockFile {
}
}
/** {@inheritDoc} */
@SuppressWarnings("nls")
@Override
public String toString() {

46
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java

@ -91,12 +91,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Traditional file system based {@link ObjectDatabase}.
* Traditional file system based {@link org.eclipse.jgit.lib.ObjectDatabase}.
* <p>
* This is the classical object database representation for a Git repository,
* where objects are stored loose by hashing them into directories by their
* {@link ObjectId}, or are stored in compressed containers known as
* {@link PackFile}s.
* {@link org.eclipse.jgit.lib.ObjectId}, or are stored in compressed containers
* known as {@link org.eclipse.jgit.internal.storage.file.PackFile}s.
* <p>
* Optionally an object database can reference one or more alternates; other
* ObjectDatabase instances that are searched in addition to the current
@ -161,7 +161,7 @@ public class ObjectDirectory extends FileObjectDatabase {
* @param shallowFile
* file which contains IDs of shallow commits, null if shallow
* commits handling should be turned off
* @throws IOException
* @throws java.io.IOException
* an alternate object cannot be opened.
*/
public ObjectDirectory(final Config cfg, final File dir,
@ -188,15 +188,15 @@ public class ObjectDirectory extends FileObjectDatabase {
}
}
/**
* @return the location of the <code>objects</code> directory.
*/
/** {@inheritDoc} */
@Override
public final File getDirectory() {
return objects;
}
/**
* <p>Getter for the field <code>packDirectory</code>.</p>
*
* @return the location of the <code>pack</code> directory.
* @since 4.10
*/
@ -205,17 +205,21 @@ public class ObjectDirectory extends FileObjectDatabase {
}
/**
* <p>Getter for the field <code>preservedDirectory</code>.</p>
*
* @return the location of the <code>preserved</code> directory.
*/
public final File getPreservedDirectory() {
return preservedDirectory;
}
/** {@inheritDoc} */
@Override
public boolean exists() {
return fs.exists(objects);
}
/** {@inheritDoc} */
@Override
public void create() throws IOException {
FileUtils.mkdirs(objects);
@ -223,6 +227,7 @@ public class ObjectDirectory extends FileObjectDatabase {
FileUtils.mkdir(packDirectory);
}
/** {@inheritDoc} */
@Override
public ObjectDirectoryInserter newInserter() {
return new ObjectDirectoryInserter(this, config);
@ -238,6 +243,7 @@ public class ObjectDirectory extends FileObjectDatabase {
return new PackInserter(this);
}
/** {@inheritDoc} */
@Override
public void close() {
unpackedObjectCache.clear();
@ -256,13 +262,7 @@ public class ObjectDirectory extends FileObjectDatabase {
}
}
/**
* @return unmodifiable collection of all known pack files local to this
* directory. Most recent packs are presented first. Packs most
* likely to contain more recent objects appear before packs
* containing objects referenced by commits further back in the
* history of the repository.
*/
/** {@inheritDoc} */
@Override
public Collection<PackFile> getPacks() {
PackList list = packList.get();
@ -273,14 +273,9 @@ public class ObjectDirectory extends FileObjectDatabase {
}
/**
* {@inheritDoc}
* <p>
* Add a single existing pack to the list of available pack files.
*
* @param pack
* path of the pack file to open.
* @return the pack that was opened and added to the database.
* @throws IOException
* index file could not be opened, read, or is not recognized as
* a Git pack file index.
*/
@Override
public PackFile openPack(final File pack)
@ -307,11 +302,13 @@ public class ObjectDirectory extends FileObjectDatabase {
return res;
}
/** {@inheritDoc} */
@Override
public String toString() {
return "ObjectDirectory[" + getDirectory() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
/** {@inheritDoc} */
@Override
public boolean has(AnyObjectId objectId) {
return unpackedObjectCache.isUnpacked(objectId)
@ -1066,11 +1063,9 @@ public class ObjectDirectory extends FileObjectDatabase {
}
/**
* {@inheritDoc}
* <p>
* Compute the location of a loose object file.
*
* @param objectId
* identity of the loose object to map to the directory.
* @return location of the object, if it were to exist as a loose object.
*/
@Override
public File fileFor(AnyObjectId objectId) {
@ -1155,6 +1150,7 @@ public class ObjectDirectory extends FileObjectDatabase {
}
}
/** {@inheritDoc} */
@Override
public ObjectDatabase newCachedDatabase() {
return newCachedFileObjectDatabase();

6
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java

@ -83,6 +83,7 @@ class ObjectDirectoryInserter extends ObjectInserter {
config = cfg.get(WriteConfig.KEY);
}
/** {@inheritDoc} */
@Override
public ObjectId insert(int type, byte[] data, int off, int len)
throws IOException {
@ -114,6 +115,7 @@ class ObjectDirectoryInserter extends ObjectInserter {
}
}
/** {@inheritDoc} */
@Override
public ObjectId insert(final int type, long len, final InputStream is)
throws IOException {
@ -166,21 +168,25 @@ class ObjectDirectoryInserter extends ObjectInserter {
.format(JGitText.get().unableToCreateNewObject, dst));
}
/** {@inheritDoc} */
@Override
public PackParser newPackParser(InputStream in) throws IOException {
return new ObjectDirectoryPackParser(db, in);
}
/** {@inheritDoc} */
@Override
public ObjectReader newReader() {
return new WindowCursor(db, this);
}
/** {@inheritDoc} */
@Override
public void flush() throws IOException {
// Do nothing. Loose objects are immediately visible.
}
/** {@inheritDoc} */
@Override
public void close() {
if (deflate != null) {

27
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java

@ -64,7 +64,6 @@ import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.CoreConfig;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.transport.PackParser;
import org.eclipse.jgit.transport.PackedObjectInfo;
@ -72,10 +71,11 @@ import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.NB;
/**
* Consumes a pack stream and stores as a pack file in {@link ObjectDirectory}.
* Consumes a pack stream and stores as a pack file in
* {@link org.eclipse.jgit.internal.storage.file.ObjectDirectory}.
* <p>
* To obtain an instance of a parser, applications should use
* {@link ObjectInserter#newPackParser(InputStream)}.
* {@link org.eclipse.jgit.lib.ObjectInserter#newPackParser(InputStream)}.
*/
public class ObjectDirectoryPackParser extends PackParser {
private final FileObjectDatabase db;
@ -158,7 +158,7 @@ public class ObjectDirectoryPackParser extends PackParser {
}
/**
* Get the imported {@link PackFile}.
* Get the imported {@link org.eclipse.jgit.internal.storage.file.PackFile}.
* <p>
* This method is supplied only to support testing; applications shouldn't
* be using it directly to access the imported data.
@ -169,6 +169,7 @@ public class ObjectDirectoryPackParser extends PackParser {
return newPack;
}
/** {@inheritDoc} */
@Override
public long getPackSize() {
if (newPack == null)
@ -184,6 +185,7 @@ public class ObjectDirectoryPackParser extends PackParser {
return size;
}
/** {@inheritDoc} */
@Override
public PackLock parse(ProgressMonitor receiving, ProgressMonitor resolving)
throws IOException {
@ -218,34 +220,40 @@ public class ObjectDirectoryPackParser extends PackParser {
}
}
/** {@inheritDoc} */
@Override
protected void onPackHeader(long objectCount) throws IOException {
// Ignored, the count is not required.
}
/** {@inheritDoc} */
@Override
protected void onBeginWholeObject(long streamPosition, int type,
long inflatedSize) throws IOException {
crc.reset();
}
/** {@inheritDoc} */
@Override
protected void onEndWholeObject(PackedObjectInfo info) throws IOException {
info.setCRC((int) crc.getValue());
}
/** {@inheritDoc} */
@Override
protected void onBeginOfsDelta(long streamPosition,
long baseStreamPosition, long inflatedSize) throws IOException {
crc.reset();
}
/** {@inheritDoc} */
@Override
protected void onBeginRefDelta(long streamPosition, AnyObjectId baseId,
long inflatedSize) throws IOException {
crc.reset();
}
/** {@inheritDoc} */
@Override
protected UnresolvedDelta onEndDelta() throws IOException {
UnresolvedDelta delta = new UnresolvedDelta();
@ -253,30 +261,35 @@ public class ObjectDirectoryPackParser extends PackParser {
return delta;
}
/** {@inheritDoc} */
@Override
protected void onInflatedObjectData(PackedObjectInfo obj, int typeCode,
byte[] data) throws IOException {
// ObjectDirectory ignores this event.
}
/** {@inheritDoc} */
@Override
protected void onObjectHeader(Source src, byte[] raw, int pos, int len)
throws IOException {
crc.update(raw, pos, len);
}
/** {@inheritDoc} */
@Override
protected void onObjectData(Source src, byte[] raw, int pos, int len)
throws IOException {
crc.update(raw, pos, len);
}
/** {@inheritDoc} */
@Override
protected void onStoreStream(byte[] raw, int pos, int len)
throws IOException {
out.write(raw, pos, len);
}
/** {@inheritDoc} */
@Override
protected void onPackFooter(byte[] hash) throws IOException {
packEnd = out.getFilePointer();
@ -285,6 +298,7 @@ public class ObjectDirectoryPackParser extends PackParser {
packHash = hash;
}
/** {@inheritDoc} */
@Override
protected ObjectTypeAndSize seekDatabase(UnresolvedDelta delta,
ObjectTypeAndSize info) throws IOException {
@ -293,6 +307,7 @@ public class ObjectDirectoryPackParser extends PackParser {
return readObjectHeader(info);
}
/** {@inheritDoc} */
@Override
protected ObjectTypeAndSize seekDatabase(PackedObjectInfo obj,
ObjectTypeAndSize info) throws IOException {
@ -301,11 +316,13 @@ public class ObjectDirectoryPackParser extends PackParser {
return readObjectHeader(info);
}
/** {@inheritDoc} */
@Override
protected int readDatabase(byte[] dst, int pos, int cnt) throws IOException {
return out.read(dst, pos, cnt);
}
/** {@inheritDoc} */
@Override
protected boolean checkCRC(int oldCRC) {
return oldCRC == (int) crc.getValue();
@ -323,6 +340,7 @@ public class ObjectDirectoryPackParser extends PackParser {
tmpPack.deleteOnExit();
}
/** {@inheritDoc} */
@Override
protected boolean onAppendBase(final int typeCode, final byte[] data,
final PackedObjectInfo info) throws IOException {
@ -365,6 +383,7 @@ public class ObjectDirectoryPackParser extends PackParser {
return true;
}
/** {@inheritDoc} */
@Override
protected void onEndThinPack() throws IOException {
final byte[] buf = buffer();

16
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndex.java

@ -58,11 +58,11 @@ import com.googlecode.javaewah.EWAHCompressedBitmap;
/**
* Logical representation of the bitmap data stored in the pack index.
* {@link ObjectId}s are encoded as a single integer in the range [0,
* {@link #getObjectCount()}). Compressed bitmaps are available at certain
* {@code ObjectId}s, which represent all of the objects reachable from that
* {@code ObjectId} (include the {@code ObjectId} itself). The meaning of the
* positions in the bitmaps can be decoded using {@link #getObject(int)} and
* {@link org.eclipse.jgit.lib.ObjectId}s are encoded as a single integer in the
* range [0, {@link #getObjectCount()}). Compressed bitmaps are available at
* certain {@code ObjectId}s, which represent all of the objects reachable from
* that {@code ObjectId} (include the {@code ObjectId} itself). The meaning of
* the positions in the bitmaps can be decoded using {@link #getObject(int)} and
* {@link #ofObjectType(EWAHCompressedBitmap, int)}. Furthermore,
* {@link #findPosition(AnyObjectId)} can be used to build other bitmaps that a
* compatible with the encoded bitmaps available from the index.
@ -85,7 +85,7 @@ public abstract class PackBitmapIndex {
* @param reverseIndex
* the pack reverse index for the corresponding pack file.
* @return a copy of the index in-memory.
* @throws IOException
* @throws java.io.IOException
* the stream cannot be read.
* @throws CorruptObjectException
* the stream does not contain a valid pack bitmap index.
@ -128,7 +128,7 @@ public abstract class PackBitmapIndex {
* @param reverseIndex
* the pack reverse index for the corresponding pack file.
* @return a copy of the index in-memory.
* @throws IOException
* @throws java.io.IOException
* the stream cannot be read.
* @throws CorruptObjectException
* the stream does not contain a valid pack bitmap index.
@ -157,7 +157,7 @@ public abstract class PackBitmapIndex {
* @param position
* the id for which the object will be found.
* @return the ObjectId.
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* when the item is not found.
*/
public abstract ObjectId getObject(int position) throws IllegalArgumentException;

54
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexBuilder.java

@ -64,7 +64,8 @@ import org.eclipse.jgit.util.BlockList;
import com.googlecode.javaewah.EWAHCompressedBitmap;
/**
* Helper for constructing {@link PackBitmapIndex}es.
* Helper for constructing
* {@link org.eclipse.jgit.internal.storage.file.PackBitmapIndex}es.
*/
public class PackBitmapIndexBuilder extends BasePackBitmapIndex {
private static final int MAX_XOR_OFFSET_SEARCH = 10;
@ -145,7 +146,11 @@ public class PackBitmapIndexBuilder extends BasePackBitmapIndex {
}
}
/** @return set of objects included in the pack. */
/**
* Get set of objects included in the pack.
*
* @return set of objects included in the pack.
*/
public ObjectIdOwnerMap<ObjectIdOwnerMap.Entry> getObjectSet() {
ObjectIdOwnerMap<ObjectIdOwnerMap.Entry> r = new ObjectIdOwnerMap<>();
for (PositionEntry e : byOffset) {
@ -197,6 +202,7 @@ public class PackBitmapIndexBuilder extends BasePackBitmapIndex {
byAddOrder.add(result);
}
/** {@inheritDoc} */
@Override
public EWAHCompressedBitmap ofObjectType(
EWAHCompressedBitmap bitmap, int type) {
@ -213,6 +219,7 @@ public class PackBitmapIndexBuilder extends BasePackBitmapIndex {
throw new IllegalArgumentException();
}
/** {@inheritDoc} */
@Override
public int findPosition(AnyObjectId objectId) {
PositionEntry entry = positionEntries.get(objectId);
@ -221,6 +228,7 @@ public class PackBitmapIndexBuilder extends BasePackBitmapIndex {
return entry.offsetPosition;
}
/** {@inheritDoc} */
@Override
public ObjectId getObject(int position) throws IllegalArgumentException {
ObjectId objectId = byOffset.get(position);
@ -229,48 +237,76 @@ public class PackBitmapIndexBuilder extends BasePackBitmapIndex {
return objectId;
}
/** @return the commit object bitmap. */
/**
* Get the commit object bitmap.
*
* @return the commit object bitmap.
*/
public EWAHCompressedBitmap getCommits() {
return commits;
}
/** @return the tree object bitmap. */
/**
* Get the tree object bitmap.
*
* @return the tree object bitmap.
*/
public EWAHCompressedBitmap getTrees() {
return trees;
}
/** @return the blob object bitmap. */
/**
* Get the blob object bitmap.
*
* @return the blob object bitmap.
*/
public EWAHCompressedBitmap getBlobs() {
return blobs;
}
/** @return the tag object bitmap. */
/**
* Get the tag object bitmap.
*
* @return the tag object bitmap.
*/
public EWAHCompressedBitmap getTags() {
return tags;
}
/** @return the index storage options. */
/**
* Get the index storage options.
*
* @return the index storage options.
*/
public int getOptions() {
return PackBitmapIndexV1.OPT_FULL;
}
/** {@inheritDoc} */
@Override
public int getBitmapCount() {
return getBitmaps().size();
}
/** Removes all the bitmaps entries added. */
/**
* Remove all the bitmaps entries added.
*/
public void clearBitmaps() {
byAddOrder.clear();
getBitmaps().clear();
}
/** {@inheritDoc} */
@Override
public int getObjectCount() {
return byOffset.size();
}
/** @return an iterator over the xor compressed entries. */
/**
* Get an iterator over the xor compressed entries.
*
* @return an iterator over the xor compressed entries.
*/
public Iterable<StoredEntry> getCompressedBitmaps() {
// Add order is from oldest to newest. The reverse add order is the
// output order.

7
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java

@ -116,27 +116,32 @@ public class PackBitmapIndexRemapper extends PackBitmapIndex
oldPackIndex.getObject(pos));
}
/** {@inheritDoc} */
@Override
public int findPosition(AnyObjectId objectId) {
return newPackIndex.findPosition(objectId);
}
/** {@inheritDoc} */
@Override
public ObjectId getObject(int position) throws IllegalArgumentException {
return newPackIndex.getObject(position);
}
/** {@inheritDoc} */
@Override
public int getObjectCount() {
return newPackIndex.getObjectCount();
}
/** {@inheritDoc} */
@Override
public EWAHCompressedBitmap ofObjectType(
EWAHCompressedBitmap bitmap, int type) {
return newPackIndex.ofObjectType(bitmap, type);
}
/** {@inheritDoc} */
@Override
public Iterator<Entry> iterator() {
if (oldPackIndex == null)
@ -173,6 +178,7 @@ public class PackBitmapIndexRemapper extends PackBitmapIndex
};
}
/** {@inheritDoc} */
@Override
public EWAHCompressedBitmap getBitmap(AnyObjectId objectId) {
EWAHCompressedBitmap bitmap = newPackIndex.getBitmap(objectId);
@ -214,6 +220,7 @@ public class PackBitmapIndexRemapper extends PackBitmapIndex
}
}
/** {@inheritDoc} */
@Override
public int getBitmapCount() {
// The count is only useful for the end index, not the remapper.

7
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexV1.java

@ -175,6 +175,7 @@ class PackBitmapIndexV1 extends BasePackBitmapIndex {
}
}
/** {@inheritDoc} */
@Override
public int findPosition(AnyObjectId objectId) {
long offset = packIndex.findOffset(objectId);
@ -183,6 +184,7 @@ class PackBitmapIndexV1 extends BasePackBitmapIndex {
return reverseIndex.findPostion(offset);
}
/** {@inheritDoc} */
@Override
public ObjectId getObject(int position) throws IllegalArgumentException {
ObjectId objectId = reverseIndex.findObjectByPosition(position);
@ -191,11 +193,13 @@ class PackBitmapIndexV1 extends BasePackBitmapIndex {
return objectId;
}
/** {@inheritDoc} */
@Override
public int getObjectCount() {
return (int) packIndex.getObjectCount();
}
/** {@inheritDoc} */
@Override
public EWAHCompressedBitmap ofObjectType(
EWAHCompressedBitmap bitmap, int type) {
@ -212,11 +216,13 @@ class PackBitmapIndexV1 extends BasePackBitmapIndex {
throw new IllegalArgumentException();
}
/** {@inheritDoc} */
@Override
public int getBitmapCount() {
return bitmaps.size();
}
/** {@inheritDoc} */
@Override
public boolean equals(Object o) {
// TODO(cranger): compare the pack checksum?
@ -225,6 +231,7 @@ class PackBitmapIndexV1 extends BasePackBitmapIndex {
return false;
}
/** {@inheritDoc} */
@Override
public int hashCode() {
return getPackIndex().hashCode();

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexWriterV1.java

@ -89,7 +89,7 @@ public class PackBitmapIndexWriterV1 {
* @param packDataChecksum
* checksum signature of the entire pack data content. This is
* traditionally the last 20 bytes of the pack file's own stream.
* @throws IOException
* @throws java.io.IOException
* an error occurred while writing to the output stream, or this
* index format cannot store the object data supplied.
*/

22
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java

@ -201,20 +201,30 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
return loadedIdx;
}
/** @return the File object which locates this pack on disk. */
/**
* Get the File object which locates this pack on disk.
*
* @return the File object which locates this pack on disk.
*/
public File getPackFile() {
return packFile;
}
/**
* Get the index for this pack file.
*
* @return the index for this pack file.
* @throws IOException
* @throws java.io.IOException
*/
public PackIndex getIndex() throws IOException {
return idx();
}
/** @return name extracted from {@code pack-*.pack} pattern. */
/**
* Get name extracted from {@code pack-*.pack} pattern.
*
* @return name extracted from {@code pack-*.pack} pattern.
*/
public String getPackName() {
String name = packName;
if (name == null) {
@ -238,7 +248,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
* @param id
* the object to look for. Must not be null.
* @return true if the object is in this pack; false otherwise.
* @throws IOException
* @throws java.io.IOException
* the index file cannot be loaded into memory.
*/
public boolean hasObject(final AnyObjectId id) throws IOException {
@ -292,6 +302,8 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
}
/**
* {@inheritDoc}
* <p>
* Provide iterator over entries in associated pack index, that should also
* exist in this pack file. Objects returned by such iterator are mutable
* during iteration.
@ -299,8 +311,6 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
* Iterator returns objects in SHA-1 lexicographical order.
* </p>
*
* @return iterator over entries of associated pack index
*
* @see PackIndex#iterator()
*/
@Override

29
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java

@ -66,7 +66,8 @@ import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.NB;
/**
* Access path to locate objects by {@link ObjectId} in a {@link PackFile}.
* Access path to locate objects by {@link org.eclipse.jgit.lib.ObjectId} in a
* {@link org.eclipse.jgit.internal.storage.file.PackFile}.
* <p>
* Indexes are strictly redundant information in that we can rebuild all of the
* data held in the index file from the on disk representation of the pack file
@ -89,7 +90,7 @@ public abstract class PackIndex
* @return access implementation for the requested file.
* @throws FileNotFoundException
* the file does not exist.
* @throws IOException
* @throws java.io.IOException
* the file exists but could not be read due to security errors,
* unrecognized data version, or unexpected data corruption.
*/
@ -124,9 +125,9 @@ public abstract class PackIndex
* buffered as some small IOs are performed against the stream.
* The caller is responsible for closing the stream.
* @return a copy of the index in-memory.
* @throws IOException
* @throws java.io.IOException
* the stream cannot be read.
* @throws CorruptObjectException
* @throws org.eclipse.jgit.errors.CorruptObjectException
* the stream does not contain a valid pack index.
*/
public static PackIndex read(InputStream fd) throws IOException,
@ -167,12 +168,15 @@ public abstract class PackIndex
return findOffset(id) != -1;
}
/** {@inheritDoc} */
@Override
public boolean contains(AnyObjectId id) {
return findOffset(id) != -1;
}
/**
* {@inheritDoc}
* <p>
* Provide iterator that gives access to index entries. Note, that iterator
* returns reference to mutable object, the same reference in each call -
* for performance reason. If client needs immutable objects, it must copy
@ -180,8 +184,6 @@ public abstract class PackIndex
* <p>
* Iterator returns objects in SHA-1 lexicographical order.
* </p>
*
* @return iterator over pack index entries
*/
@Override
public abstract Iterator<MutableEntry> iterator();
@ -218,7 +220,8 @@ public abstract class PackIndex
* @param nthPosition
* position within the traversal of {@link #iterator()} that the
* caller needs the object for. The first returned
* {@link MutableEntry} is 0, the second is 1, etc.
* {@link org.eclipse.jgit.internal.storage.file.PackIndex.MutableEntry}
* is 0, the second is 1, etc.
* @return the ObjectId for the corresponding entry.
*/
public abstract ObjectId getObjectId(long nthPosition);
@ -239,8 +242,10 @@ public abstract class PackIndex
* @param nthPosition
* unsigned 32 bit position within the traversal of
* {@link #iterator()} that the caller needs the object for. The
* first returned {@link MutableEntry} is 0, the second is 1,
* etc. Positions past 2**31-1 are negative, but still valid.
* first returned
* {@link org.eclipse.jgit.internal.storage.file.PackIndex.MutableEntry}
* is 0, the second is 1, etc. Positions past 2**31-1 are
* negative, but still valid.
* @return the ObjectId for the corresponding entry.
*/
public final ObjectId getObjectId(final int nthPosition) {
@ -282,9 +287,9 @@ public abstract class PackIndex
* @param objId
* id of object to look for
* @return CRC32 checksum of specified object (at 32 less significant bits)
* @throws MissingObjectException
* @throws org.eclipse.jgit.errors.MissingObjectException
* when requested ObjectId was not found in this index
* @throws UnsupportedOperationException
* @throws java.lang.UnsupportedOperationException
* when this index doesn't support CRC32 checksum
*/
public abstract long findCRC32(AnyObjectId objId)
@ -308,7 +313,7 @@ public abstract class PackIndex
* @param matchLimit
* maximum number of results to return. At most this many
* ObjectIds should be added to matches before returning.
* @throws IOException
* @throws java.io.IOException
* the index cannot be read.
*/
public abstract void resolve(Set<ObjectId> matches, AbbreviatedObjectId id,

8
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java

@ -103,11 +103,13 @@ class PackIndexV1 extends PackIndex {
IO.readFully(fd, packChecksum, 0, packChecksum.length);
}
/** {@inheritDoc} */
@Override
public long getObjectCount() {
return objectCnt;
}
/** {@inheritDoc} */
@Override
public long getOffset64Count() {
long n64 = 0;
@ -140,6 +142,7 @@ class PackIndexV1 extends PackIndex {
return (int) (nthPosition - base);
}
/** {@inheritDoc} */
@Override
public ObjectId getObjectId(final long nthPosition) {
final int levelOne = findLevelOne(nthPosition);
@ -156,6 +159,7 @@ class PackIndexV1 extends PackIndex {
return NB.decodeUInt32(idxdata[levelOne], p);
}
/** {@inheritDoc} */
@Override
public long findOffset(final AnyObjectId objId) {
final int levelOne = objId.getFirstByte();
@ -182,21 +186,25 @@ class PackIndexV1 extends PackIndex {
return -1;
}
/** {@inheritDoc} */
@Override
public long findCRC32(AnyObjectId objId) {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public boolean hasCRC32Support() {
return false;
}
/** {@inheritDoc} */
@Override
public Iterator<MutableEntry> iterator() {
return new IndexV1Iterator();
}
/** {@inheritDoc} */
@Override
public void resolve(Set<ObjectId> matches, AbbreviatedObjectId id,
int matchLimit) throws IOException {

9
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV2.java

@ -164,11 +164,13 @@ class PackIndexV2 extends PackIndex {
IO.readFully(fd, packChecksum, 0, packChecksum.length);
}
/** {@inheritDoc} */
@Override
public long getObjectCount() {
return objectCnt;
}
/** {@inheritDoc} */
@Override
public long getOffset64Count() {
return offset64.length / 8;
@ -196,6 +198,7 @@ class PackIndexV2 extends PackIndex {
return (int) (nthPosition - base);
}
/** {@inheritDoc} */
@Override
public ObjectId getObjectId(final long nthPosition) {
final int levelOne = findLevelOne(nthPosition);
@ -204,6 +207,7 @@ class PackIndexV2 extends PackIndex {
return ObjectId.fromRaw(names[levelOne], p4 + p); // p * 5
}
/** {@inheritDoc} */
@Override
public long getOffset(final long nthPosition) {
final int levelOne = findLevelOne(nthPosition);
@ -211,6 +215,7 @@ class PackIndexV2 extends PackIndex {
return getOffset(levelOne, levelTwo);
}
/** {@inheritDoc} */
@Override
public long findOffset(final AnyObjectId objId) {
final int levelOne = objId.getFirstByte();
@ -227,6 +232,7 @@ class PackIndexV2 extends PackIndex {
return p;
}
/** {@inheritDoc} */
@Override
public long findCRC32(AnyObjectId objId) throws MissingObjectException {
final int levelOne = objId.getFirstByte();
@ -236,16 +242,19 @@ class PackIndexV2 extends PackIndex {
return NB.decodeUInt32(crc32[levelOne], levelTwo << 2);
}
/** {@inheritDoc} */
@Override
public boolean hasCRC32Support() {
return true;
}
/** {@inheritDoc} */
@Override
public Iterator<MutableEntry> iterator() {
return new EntriesIteratorV2();
}
/** {@inheritDoc} */
@Override
public void resolve(Set<ObjectId> matches, AbbreviatedObjectId id,
int matchLimit) throws IOException {

35
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriter.java

@ -53,16 +53,16 @@ import java.util.List;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.transport.PackedObjectInfo;
import org.eclipse.jgit.util.NB;
/**
* Creates a table of contents to support random access by {@link PackFile}.
* Creates a table of contents to support random access by
* {@link org.eclipse.jgit.internal.storage.file.PackFile}.
* <p>
* Pack index files (the <code>.idx</code> suffix in a pack file pair)
* provides random access to any object in the pack by associating an ObjectId
* to the byte offset within the pack where the object's data can be read.
* Pack index files (the <code>.idx</code> suffix in a pack file pair) provides
* random access to any object in the pack by associating an ObjectId to the
* byte offset within the pack where the object's data can be read.
*/
public abstract class PackIndexWriter {
/** Magic constant indicating post-version 1 format. */
@ -90,7 +90,7 @@ public abstract class PackIndexWriter {
* will be examined until a format can be conclusively selected.
* @return a new writer to output an index file of the requested format to
* the supplied stream.
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* no recognized pack index version can support the supplied
* objects. This is likely a bug in the implementation.
* @see #oldestPossibleFormat(List)
@ -117,7 +117,7 @@ public abstract class PackIndexWriter {
* the objects the caller needs to store in the index. Entries
* will be examined until a format can be conclusively selected.
* @return the index format.
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* no recognized pack index version can support the supplied
* objects. This is likely a bug in the implementation.
*/
@ -143,7 +143,7 @@ public abstract class PackIndexWriter {
* this formatted version will be written.
* @return a new writer to output an index file of the requested format to
* the supplied stream.
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* the version requested is not supported by this
* implementation.
*/
@ -195,12 +195,13 @@ public abstract class PackIndexWriter {
*
* @param toStore
* sorted list of objects to store in the index. The caller must
* have previously sorted the list using {@link PackedObjectInfo}'s
* native {@link Comparable} implementation.
* have previously sorted the list using
* {@link org.eclipse.jgit.transport.PackedObjectInfo}'s native
* {@link java.lang.Comparable} implementation.
* @param packDataChecksum
* checksum signature of the entire pack data content. This is
* traditionally the last 20 bytes of the pack file's own stream.
* @throws IOException
* @throws java.io.IOException
* an error occurred while writing to the output stream, or this
* index format cannot store the object data supplied.
*/
@ -230,7 +231,7 @@ public abstract class PackIndexWriter {
* the {@link #entries} collection may be iterated over more than once if
* necessary. Implementors therefore have complete control over the data.
*
* @throws IOException
* @throws java.io.IOException
* an error occurred while writing to the output stream, or this
* index format cannot store the object data supplied.
*/
@ -246,7 +247,7 @@ public abstract class PackIndexWriter {
*
* @param version
* version number of this index format being written.
* @throws IOException
* @throws java.io.IOException
* an error occurred while writing to the output stream.
*/
protected void writeTOC(final int version) throws IOException {
@ -260,10 +261,10 @@ public abstract class PackIndexWriter {
* <p>
* The fan-out table is 4 KB in size, holding 256 32-bit unsigned integer
* counts. Each count represents the number of objects within this index
* whose {@link ObjectId#getFirstByte()} matches the count's position in the
* fan-out table.
* whose {@link org.eclipse.jgit.lib.ObjectId#getFirstByte()} matches the
* count's position in the fan-out table.
*
* @throws IOException
* @throws java.io.IOException
* an error occurred while writing to the output stream.
*/
protected void writeFanOutTable() throws IOException {
@ -288,7 +289,7 @@ public abstract class PackIndexWriter {
* the pack data checksum above.</li>
* </ol>
*
* @throws IOException
* @throws java.io.IOException
* an error occurred while writing to the output stream.
*/
protected void writeChecksumFooter() throws IOException {

1
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriterV1.java

@ -68,6 +68,7 @@ class PackIndexWriterV1 extends PackIndexWriter {
super(dst);
}
/** {@inheritDoc} */
@Override
protected void writeImpl() throws IOException {
writeFanOutTable();

1
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriterV2.java

@ -63,6 +63,7 @@ class PackIndexWriterV2 extends PackIndexWriter {
super(dst);
}
/** {@inheritDoc} */
@Override
protected void writeImpl() throws IOException {
writeTOC(2);

3
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackInputStream.java

@ -64,6 +64,7 @@ class PackInputStream extends InputStream {
wc.pin(pack, pos);
}
/** {@inheritDoc} */
@Override
public int read(byte[] b, int off, int len) throws IOException {
int n = wc.copy(pack, pos, b, off, len);
@ -71,6 +72,7 @@ class PackInputStream extends InputStream {
return n;
}
/** {@inheritDoc} */
@Override
public int read() throws IOException {
byte[] buf = new byte[1];
@ -78,6 +80,7 @@ class PackInputStream extends InputStream {
return n == 1 ? buf[0] & 0xff : -1;
}
/** {@inheritDoc} */
@Override
public void close() {
wc.close();

15
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackInserter.java

@ -119,15 +119,20 @@ class PackInserter extends ObjectInserter {
}
/**
* Whether to check if objects exist in the repo
*
* @param check
* if false, will write out possibly-duplicate objects without
* first checking whether they exist in the repo; default is true.
* if {@code false}, will write out possibly-duplicate objects
* without first checking whether they exist in the repo; default
* is true.
*/
public void checkExisting(boolean check) {
checkExisting = check;
}
/**
* Set compression level for zlib deflater.
*
* @param compression
* compression level for zlib deflater.
*/
@ -139,6 +144,7 @@ class PackInserter extends ObjectInserter {
return buffer().length;
}
/** {@inheritDoc} */
@Override
public ObjectId insert(int type, byte[] data, int off, int len)
throws IOException {
@ -157,6 +163,7 @@ class PackInserter extends ObjectInserter {
return endObject(id, offset);
}
/** {@inheritDoc} */
@Override
public ObjectId insert(int type, long len, InputStream in)
throws IOException {
@ -230,16 +237,19 @@ class PackInserter extends ObjectInserter {
return 12;
}
/** {@inheritDoc} */
@Override
public PackParser newPackParser(InputStream in) {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public ObjectReader newReader() {
return new Reader();
}
/** {@inheritDoc} */
@Override
public void flush() throws IOException {
if (tmpPack == null) {
@ -309,6 +319,7 @@ class PackInserter extends ObjectInserter {
return ObjectId.fromRaw(md.digest());
}
/** {@inheritDoc} */
@Override
public void close() {
try {

9
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java

@ -50,7 +50,10 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.FileUtils;
/** Keeps track of a {@link PackFile}'s associated <code>.keep</code> file. */
/**
* Keeps track of a {@link org.eclipse.jgit.internal.storage.file.PackFile}'s
* associated <code>.keep</code> file.
*/
public class PackLock {
private final File keepFile;
@ -74,7 +77,7 @@ public class PackLock {
* @param msg
* message to store in the file.
* @return true if the keep file was successfully written; false otherwise.
* @throws IOException
* @throws java.io.IOException
* the keep file could not be written.
*/
public boolean lock(String msg) throws IOException {
@ -92,7 +95,7 @@ public class PackLock {
/**
* Remove the <code>.keep</code> file that holds this pack in place.
*
* @throws IOException
* @throws java.io.IOException
* if deletion of .keep file failed
*/
public void unlock() throws IOException {

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndex.java

@ -174,7 +174,7 @@ public class PackReverseIndex {
* offset).
* @return offset of the next object in a pack or maxOffset if provided
* offset was the last one.
* @throws CorruptObjectException
* @throws org.eclipse.jgit.errors.CorruptObjectException
* when there is no object with the provided offset.
*/
public long findNextOffset(final long offset, final long maxOffset)

1
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java

@ -125,6 +125,7 @@ class PackedBatchRefUpdate extends BatchRefUpdate {
this.refdb = refdb;
}
/** {@inheritDoc} */
@Override
public void execute(RevWalk walk, ProgressMonitor monitor,
List<String> options) throws IOException {

19
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java

@ -111,14 +111,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Traditional file system based {@link RefDatabase}.
* Traditional file system based {@link org.eclipse.jgit.lib.RefDatabase}.
* <p>
* This is the classical reference database representation for a Git repository.
* References are stored in two formats: loose, and packed.
* <p>
* Loose references are stored as individual files within the {@code refs/}
* directory. The file name matches the reference name and the file contents is
* the current {@link ObjectId} in string form.
* the current {@link org.eclipse.jgit.lib.ObjectId} in string form.
* <p>
* Packed references are stored in a single text file named {@code packed-refs}.
* In the packed format, each reference is stored on its own line. This file
@ -243,6 +243,7 @@ public class RefDirectory extends RefDatabase {
return new File(logsDir, name);
}
/** {@inheritDoc} */
@Override
public void create() throws IOException {
FileUtils.mkdir(refsDir);
@ -251,6 +252,7 @@ public class RefDirectory extends RefDatabase {
newLogWriter(false).create();
}
/** {@inheritDoc} */
@Override
public void close() {
clearReferences();
@ -261,12 +263,14 @@ public class RefDirectory extends RefDatabase {
packedRefs.set(NO_PACKED_REFS);
}
/** {@inheritDoc} */
@Override
public void refresh() {
super.refresh();
clearReferences();
}
/** {@inheritDoc} */
@Override
public boolean isNameConflicting(String name) throws IOException {
RefList<Ref> packed = getPackedRefs();
@ -312,6 +316,7 @@ public class RefDirectory extends RefDatabase {
return loose;
}
/** {@inheritDoc} */
@Override
public Ref exactRef(String name) throws IOException {
RefList<Ref> packed = getPackedRefs();
@ -336,6 +341,7 @@ public class RefDirectory extends RefDatabase {
return ref;
}
/** {@inheritDoc} */
@Override
public Ref getRef(final String needle) throws IOException {
final RefList<Ref> packed = getPackedRefs();
@ -360,6 +366,7 @@ public class RefDirectory extends RefDatabase {
return ref;
}
/** {@inheritDoc} */
@Override
public Map<String, Ref> getRefs(String prefix) throws IOException {
final RefList<LooseRef> oldLoose = looseRefs.get();
@ -399,6 +406,7 @@ public class RefDirectory extends RefDatabase {
return new RefMap(prefix, packed, upcast(loose), symbolic.toRefList());
}
/** {@inheritDoc} */
@Override
public List<Ref> getAdditionalRefs() throws IOException {
List<Ref> ret = new LinkedList<>();
@ -533,6 +541,7 @@ public class RefDirectory extends RefDatabase {
}
}
/** {@inheritDoc} */
@Override
public Ref peel(final Ref ref) throws IOException {
final Ref leaf = ref.getLeaf();
@ -584,6 +593,7 @@ public class RefDirectory extends RefDatabase {
fireRefsChanged();
}
/** {@inheritDoc} */
@Override
public RefDirectoryUpdate newUpdate(String name, boolean detach)
throws IOException {
@ -603,6 +613,7 @@ public class RefDirectory extends RefDatabase {
return refDirUpdate;
}
/** {@inheritDoc} */
@Override
public RefDirectoryRename newRename(String fromName, String toName)
throws IOException {
@ -611,11 +622,13 @@ public class RefDirectory extends RefDatabase {
return new RefDirectoryRename(from, to);
}
/** {@inheritDoc} */
@Override
public PackedBatchRefUpdate newBatchUpdate() {
return new PackedBatchRefUpdate(this);
}
/** {@inheritDoc} */
@Override
public boolean performsAtomicTransactions() {
return true;
@ -695,7 +708,7 @@ public class RefDirectory extends RefDatabase {
*
* @param refs
* the refs to be added. Must be fully qualified.
* @throws IOException
* @throws java.io.IOException
*/
public void pack(List<String> refs) throws IOException {
pack(refs, Collections.emptyMap());

1
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryRename.java

@ -95,6 +95,7 @@ class RefDirectoryRename extends RefRename {
refdb = src.getRefDatabase();
}
/** {@inheritDoc} */
@Override
protected Result doRename() throws IOException {
if (source.getRef().isSymbolic())

7
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java

@ -65,16 +65,19 @@ class RefDirectoryUpdate extends RefUpdate {
database = r;
}
/** {@inheritDoc} */
@Override
protected RefDirectory getRefDatabase() {
return database;
}
/** {@inheritDoc} */
@Override
protected Repository getRepository() {
return database.getRepository();
}
/** {@inheritDoc} */
@Override
protected boolean tryLock(boolean deref) throws IOException {
shouldDeref = deref;
@ -92,6 +95,7 @@ class RefDirectoryUpdate extends RefUpdate {
}
}
/** {@inheritDoc} */
@Override
protected void unlock() {
if (lock != null) {
@ -100,6 +104,7 @@ class RefDirectoryUpdate extends RefUpdate {
}
}
/** {@inheritDoc} */
@Override
protected Result doUpdate(final Result status) throws IOException {
WriteConfig wc = database.getRepository().getConfig()
@ -141,6 +146,7 @@ class RefDirectoryUpdate extends RefUpdate {
}
}
/** {@inheritDoc} */
@Override
protected Result doDelete(final Result status) throws IOException {
if (getRef().getStorage() != Ref.Storage.NEW)
@ -148,6 +154,7 @@ class RefDirectoryUpdate extends RefUpdate {
return status;
}
/** {@inheritDoc} */
@Override
protected Result doLink(final String target) throws IOException {
WriteConfig wc = database.getRepository().getConfig()

6
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogEntryImpl.java

@ -93,6 +93,7 @@ public class ReflogEntryImpl implements Serializable, ReflogEntry {
/* (non-Javadoc)
* @see org.eclipse.jgit.internal.storage.file.ReflogEntry#getOldId()
*/
/** {@inheritDoc} */
@Override
public ObjectId getOldId() {
return oldId;
@ -101,6 +102,7 @@ public class ReflogEntryImpl implements Serializable, ReflogEntry {
/* (non-Javadoc)
* @see org.eclipse.jgit.internal.storage.file.ReflogEntry#getNewId()
*/
/** {@inheritDoc} */
@Override
public ObjectId getNewId() {
return newId;
@ -109,6 +111,7 @@ public class ReflogEntryImpl implements Serializable, ReflogEntry {
/* (non-Javadoc)
* @see org.eclipse.jgit.internal.storage.file.ReflogEntry#getWho()
*/
/** {@inheritDoc} */
@Override
public PersonIdent getWho() {
return who;
@ -117,11 +120,13 @@ public class ReflogEntryImpl implements Serializable, ReflogEntry {
/* (non-Javadoc)
* @see org.eclipse.jgit.internal.storage.file.ReflogEntry#getComment()
*/
/** {@inheritDoc} */
@Override
public String getComment() {
return comment;
}
/** {@inheritDoc} */
@SuppressWarnings("nls")
@Override
public String toString() {
@ -132,6 +137,7 @@ public class ReflogEntryImpl implements Serializable, ReflogEntry {
/* (non-Javadoc)
* @see org.eclipse.jgit.internal.storage.file.ReflogEntry#parseCheckout()
*/
/** {@inheritDoc} */
@Override
public CheckoutEntry parseCheckout() {
if (getComment().startsWith(CheckoutEntryImpl.CHECKOUT_MOVING_FROM))

4
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogReaderImpl.java

@ -74,6 +74,7 @@ class ReflogReaderImpl implements ReflogReader {
/* (non-Javadoc)
* @see org.eclipse.jgit.internal.storage.file.ReflogReaader#getLastEntry()
*/
/** {@inheritDoc} */
@Override
public ReflogEntry getLastEntry() throws IOException {
return getReverseEntry(0);
@ -82,6 +83,7 @@ class ReflogReaderImpl implements ReflogReader {
/* (non-Javadoc)
* @see org.eclipse.jgit.internal.storage.file.ReflogReaader#getReverseEntries()
*/
/** {@inheritDoc} */
@Override
public List<ReflogEntry> getReverseEntries() throws IOException {
return getReverseEntries(Integer.MAX_VALUE);
@ -90,6 +92,7 @@ class ReflogReaderImpl implements ReflogReader {
/* (non-Javadoc)
* @see org.eclipse.jgit.internal.storage.file.ReflogReaader#getReverseEntry(int)
*/
/** {@inheritDoc} */
@Override
public ReflogEntry getReverseEntry(int number) throws IOException {
if (number < 0)
@ -119,6 +122,7 @@ class ReflogReaderImpl implements ReflogReader {
/* (non-Javadoc)
* @see org.eclipse.jgit.internal.storage.file.ReflogReaader#getReverseEntries(int)
*/
/** {@inheritDoc} */
@Override
public List<ReflogEntry> getReverseEntries(int max) throws IOException {
final byte[] log;

22
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogWriter.java

@ -95,6 +95,8 @@ public class ReflogWriter {
* Create writer for ref directory.
*
* @param refdb
* a {@link org.eclipse.jgit.internal.storage.file.RefDirectory}
* object.
*/
public ReflogWriter(RefDirectory refdb) {
this(refdb, false);
@ -104,6 +106,8 @@ public class ReflogWriter {
* Create writer for ref directory.
*
* @param refdb
* a {@link org.eclipse.jgit.internal.storage.file.RefDirectory}
* object.
* @param forceWrite
* true to write to disk all entries logged, false to respect the
* repository's config and current log file status.
@ -116,7 +120,7 @@ public class ReflogWriter {
/**
* Create the log directories.
*
* @throws IOException
* @throws java.io.IOException
* @return this writer.
*/
public ReflogWriter create() throws IOException {
@ -131,9 +135,11 @@ public class ReflogWriter {
* Write the given entry to the ref's log.
*
* @param refName
* a {@link java.lang.String} object.
* @param entry
* a {@link org.eclipse.jgit.lib.ReflogEntry} object.
* @return this writer
* @throws IOException
* @throws java.io.IOException
*/
public ReflogWriter log(String refName, ReflogEntry entry)
throws IOException {
@ -145,12 +151,17 @@ public class ReflogWriter {
* Write the given entry information to the ref's log
*
* @param refName
* ref name
* @param oldId
* old object id
* @param newId
* new object id
* @param ident
* a {@link org.eclipse.jgit.lib.PersonIdent}
* @param message
* reflog message
* @return this writer
* @throws IOException
* @throws java.io.IOException
*/
public ReflogWriter log(String refName, ObjectId oldId,
ObjectId newId, PersonIdent ident, String message) throws IOException {
@ -162,10 +173,13 @@ public class ReflogWriter {
* Write the given ref update to the ref's log.
*
* @param update
* a {@link org.eclipse.jgit.lib.RefUpdate}
* @param msg
* reflog message
* @param deref
* whether to dereference symbolic refs
* @return this writer
* @throws IOException
* @throws java.io.IOException
*/
public ReflogWriter log(RefUpdate update, String msg,
boolean deref) throws IOException {

22
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/SimpleDataInput.java

@ -64,83 +64,105 @@ class SimpleDataInput implements DataInput {
this.fd = fd;
}
/** {@inheritDoc} */
@Override
public int readInt() throws IOException {
readFully(buf, 0, 4);
return NB.decodeInt32(buf, 0);
}
/** {@inheritDoc} */
@Override
public long readLong() throws IOException {
readFully(buf, 0, 8);
return NB.decodeInt64(buf, 0);
}
/**
* Read unsigned int
*
* @return a long.
* @throws java.io.IOException
* if any.
*/
public long readUnsignedInt() throws IOException {
readFully(buf, 0, 4);
return NB.decodeUInt32(buf, 0);
}
/** {@inheritDoc} */
@Override
public void readFully(byte[] b) throws IOException {
readFully(b, 0, b.length);
}
/** {@inheritDoc} */
@Override
public void readFully(byte[] b, int off, int len) throws IOException {
IO.readFully(fd, b, off, len);
}
/** {@inheritDoc} */
@Override
public int skipBytes(int n) throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public boolean readBoolean() throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public byte readByte() throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public int readUnsignedByte() throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public short readShort() throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public int readUnsignedShort() throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public char readChar() throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public float readFloat() throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public double readDouble() throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public String readLine() throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public String readUTF() throws IOException {
throw new UnsupportedOperationException();

14
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/SimpleDataOutput.java

@ -64,74 +64,88 @@ class SimpleDataOutput implements DataOutput {
this.fd = fd;
}
/** {@inheritDoc} */
@Override
public void writeShort(int v) throws IOException {
NB.encodeInt16(buf, 0, v);
fd.write(buf, 0, 2);
}
/** {@inheritDoc} */
@Override
public void writeInt(int v) throws IOException {
NB.encodeInt32(buf, 0, v);
fd.write(buf, 0, 4);
}
/** {@inheritDoc} */
@Override
public void writeLong(long v) throws IOException {
NB.encodeInt64(buf, 0, v);
fd.write(buf, 0, 8);
}
/** {@inheritDoc} */
@Override
public void write(int b) throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public void write(byte[] b) throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public void write(byte[] b, int off, int len) throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public void writeBoolean(boolean v) throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public void writeByte(int v) throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public void writeChar(int v) throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public void writeFloat(float v) throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public void writeDouble(double v) throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public void writeBytes(String s) throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public void writeChars(String s) throws IOException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public void writeUTF(String s) throws IOException {
throw new UnsupportedOperationException();

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java

@ -86,7 +86,7 @@ public class UnpackedObject {
* expected ObjectId of the object, used only for error reporting
* in exceptions.
* @return loader to read the inflated contents.
* @throws IOException
* @throws java.io.IOException
* the object cannot be parsed.
*/
public static ObjectLoader parse(byte[] raw, AnyObjectId id)

10
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java

@ -57,7 +57,8 @@ import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.storage.file.WindowCacheConfig;
/**
* Caches slices of a {@link PackFile} in memory for faster read access.
* Caches slices of a {@link org.eclipse.jgit.internal.storage.file.PackFile} in
* memory for faster read access.
* <p>
* The WindowCache serves as a Java based "buffer cache", loading segments of a
* PackFile into the JVM heap prior to use. As JGit often wants to do reads of
@ -111,8 +112,9 @@ import org.eclipse.jgit.storage.file.WindowCacheConfig;
* {@link #createRef(PackFile, long, ByteWindow)} methods, and matching
* decrements during {@link #clear(Ref)}. Implementors may need to override
* {@link #createRef(PackFile, long, ByteWindow)} in order to embed additional
* accounting information into an implementation specific {@link Ref} subclass,
* as the cached entity may have already been evicted by the JRE's garbage
* accounting information into an implementation specific
* {@link org.eclipse.jgit.internal.storage.file.WindowCache.Ref} subclass, as
* the cached entity may have already been evicted by the JRE's garbage
* collector.
* <p>
* To maintain higher concurrency workloads, during eviction only one thread
@ -150,7 +152,7 @@ public class WindowCache {
* @deprecated use {@code cfg.install()} to avoid internal reference.
* @param cfg
* the new window cache configuration.
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* the cache configuration contains one or more invalid
* settings, usually too low of a limit.
*/

20
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java

@ -110,11 +110,13 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs {
return baseCache;
}
/** {@inheritDoc} */
@Override
public ObjectReader newReader() {
return new WindowCursor(db);
}
/** {@inheritDoc} */
@Override
public BitmapIndex getBitmapIndex() throws IOException {
for (PackFile pack : db.getPacks()) {
@ -125,6 +127,7 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs {
return null;
}
/** {@inheritDoc} */
@Override
public Collection<CachedPack> getCachedPacksAndUpdate(
BitmapBuilder needBitmap) throws IOException {
@ -137,6 +140,7 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs {
return Collections.emptyList();
}
/** {@inheritDoc} */
@Override
public Collection<ObjectId> resolve(AbbreviatedObjectId id)
throws IOException {
@ -147,11 +151,13 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs {
return matches;
}
/** {@inheritDoc} */
@Override
public boolean has(AnyObjectId objectId) throws IOException {
return db.has(objectId);
}
/** {@inheritDoc} */
@Override
public ObjectLoader open(AnyObjectId objectId, int typeHint)
throws MissingObjectException, IncorrectObjectTypeException,
@ -168,11 +174,13 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs {
return ldr;
}
/** {@inheritDoc} */
@Override
public Set<ObjectId> getShallowCommits() throws IOException {
return db.getShallowCommits();
}
/** {@inheritDoc} */
@Override
public long getObjectSize(AnyObjectId objectId, int typeHint)
throws MissingObjectException, IncorrectObjectTypeException,
@ -187,11 +195,13 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs {
return sz;
}
/** {@inheritDoc} */
@Override
public LocalObjectToPack newObjectToPack(AnyObjectId objectId, int type) {
return new LocalObjectToPack(objectId, type);
}
/** {@inheritDoc} */
@Override
public void selectObjectRepresentation(PackWriter packer,
ProgressMonitor monitor, Iterable<ObjectToPack> objects)
@ -202,6 +212,7 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs {
}
}
/** {@inheritDoc} */
@Override
public void copyObjectAsIs(PackOutputStream out, ObjectToPack otp,
boolean validate) throws IOException,
@ -210,6 +221,7 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs {
src.pack.copyAsIs(out, src, validate, this);
}
/** {@inheritDoc} */
@Override
public void writeObjects(PackOutputStream out, List<ObjectToPack> list)
throws IOException {
@ -253,6 +265,7 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs {
return cnt - need;
}
/** {@inheritDoc} */
@Override
public void copyPackAsIs(PackOutputStream out, CachedPack pack)
throws IOException {
@ -348,13 +361,18 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs {
}
}
/** {@inheritDoc} */
@Override
@Nullable
public ObjectInserter getCreatedFromInserter() {
return createdFromInserter;
}
/** Release the current window cursor. */
/**
* {@inheritDoc}
* <p>
* Release the current window cursor.
*/
@Override
public void close() {
window = null;

Loading…
Cancel
Save