Browse Source

Repository: Deprecate the #getAllRefs method

Callers should instead use getRefDatabase().getRefs(), which does not
swallow the IOException.

Replace @link with @code in the Javadoc of FileRepository, since linking
to the deprecated method causes an error:

  Javadoc: The method getAllRefs() from the type Repository is deprecated

Existing callers of the deprecated method are not adapted in this commit
because many of them require more refactoring. They will be done in
separate follow-up commits.

Bug: 534731
Change-Id: Id84e70e4cd7be3d1ca1795512950c6abe3d18ffd
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.1
David Pursehouse 7 years ago
parent
commit
4162ad0dd3
  1. 8
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

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

@ -477,7 +477,7 @@ public class FileRepository extends Repository {
/** /**
* {@inheritDoc} * {@inheritDoc}
* <p> * <p>
* Objects known to exist but not expressed by {@link #getAllRefs()}. * Objects known to exist but not expressed by {@code #getAllRefs()}.
* <p> * <p>
* When a repository borrows objects from another repository, it can * When a repository borrows objects from another repository, it can
* advertise that it safely has that other repository's references, without * advertise that it safely has that other repository's references, without
@ -490,12 +490,12 @@ public class FileRepository extends Repository {
} }
/** /**
* Objects known to exist but not expressed by {@link #getAllRefs()}. * Objects known to exist but not expressed by {@code #getAllRefs()}.
* <p> * <p>
* When a repository borrows objects from another repository, it can * When a repository borrows objects from another repository, it can
* advertise that it safely has that other repository's references, without * advertise that it safely has that other repository's references, without
* exposing any other details about the other repository. This may help * exposing any other details about the other repository. This may help a
* a client trying to push changes avoid pushing more than it needs to. * client trying to push changes avoid pushing more than it needs to.
* *
* @param skips * @param skips
* Set of AlternateHandle Ids already seen * Set of AlternateHandle Ids already seen

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

@ -1092,7 +1092,9 @@ public abstract class Repository implements AutoCloseable {
* not point to any object yet. * not point to any object yet.
* *
* @return mutable map of all known refs (heads, tags, remotes). * @return mutable map of all known refs (heads, tags, remotes).
* @deprecated use {@code getRefDatabase().getRefs()} instead.
*/ */
@Deprecated
@NonNull @NonNull
public Map<String, Ref> getAllRefs() { public Map<String, Ref> getAllRefs() {
try { try {

Loading…
Cancel
Save