aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-04-27 10:42:53 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-04-27 11:16:10 +0900
commit4dcf2f93db3f31262220140484237cfbb4189f4d (patch)
tree4cf0ac9a340ad12eda0cfade11cd53802a22977c /org.eclipse.jgit.pgm
parent57f158632d2264d87cbd9e777014340eafa79fad (diff)
downloadjgit-4dcf2f93db3f31262220140484237cfbb4189f4d.tar.gz
jgit-4dcf2f93db3f31262220140484237cfbb4189f4d.zip
RefDatabase: Introduce getAllRefs method
Currently to get all refs, callers must use: getRefsByPrefix(ALL) Introduce getAllRefs, which does this, and migrate all existing callers of getRefsByPrefix(ALL). Change-Id: I7b1687c162c8ae836dc7db3ccc7ac847863f691d Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java4
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java4
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java4
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java7
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java2
5 files changed, 6 insertions, 15 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java
index 8ba533f130..a52954307e 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java
@@ -45,8 +45,6 @@
package org.eclipse.jgit.pgm;
-import static org.eclipse.jgit.lib.RefDatabase.ALL;
-
import java.util.ArrayList;
import java.util.List;
@@ -73,7 +71,7 @@ class RevParse extends TextBuiltin {
@Override
protected void run() throws Exception {
if (all) {
- List<Ref> allRefs = db.getRefDatabase().getRefsByPrefix(ALL);
+ List<Ref> allRefs = db.getRefDatabase().getAllRefs();
for (final Ref r : allRefs) {
ObjectId objectId = r.getObjectId();
// getRefs skips dangling symrefs, so objectId should never be
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java
index f3714d8d75..423887cc17 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java
@@ -53,7 +53,6 @@ import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
-import org.eclipse.jgit.lib.RefDatabase;
import org.eclipse.jgit.pgm.internal.CLIText;
import org.eclipse.jgit.pgm.opt.PathTreeFilterHandler;
import org.eclipse.jgit.revwalk.FollowFilter;
@@ -170,8 +169,7 @@ abstract class RevWalkTextBuiltin extends TextBuiltin {
walk.setRevFilter(AndRevFilter.create(revLimiter));
if (all) {
- List<Ref> refs =
- db.getRefDatabase().getRefsByPrefix(RefDatabase.ALL);
+ List<Ref> refs = db.getRefDatabase().getAllRefs();
for (Ref a : refs) {
ObjectId oid = a.getPeeledObjectId();
if (oid == null)
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java
index 2ed5de5c58..f6384a2cea 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java
@@ -45,8 +45,6 @@
package org.eclipse.jgit.pgm;
-import static org.eclipse.jgit.lib.RefDatabase.ALL;
-
import java.io.IOException;
import java.util.List;
@@ -67,7 +65,7 @@ class ShowRef extends TextBuiltin {
}
private Iterable<Ref> getSortedRefs() throws Exception {
- List<Ref> all = db.getRefDatabase().getRefsByPrefix(ALL);
+ List<Ref> all = db.getRefDatabase().getAllRefs();
// TODO(jrn) check if we can reintroduce fast-path by e.g. implementing
// SortedList
return RefComparator.sort(all);
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
index d7503ab297..666fc34e26 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
@@ -43,8 +43,6 @@
package org.eclipse.jgit.pgm.debug;
-import static org.eclipse.jgit.lib.RefDatabase.ALL;
-
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@@ -117,7 +115,7 @@ class RebuildCommitGraph extends TextBuiltin {
/** {@inheritDoc} */
@Override
protected void run() throws Exception {
- if (!really && !db.getRefDatabase().getRefsByPrefix(ALL).isEmpty()) {
+ if (!really && !db.getRefDatabase().getAllRefs().isEmpty()) {
File directory = db.getDirectory();
String absolutePath = directory == null ? "null" //$NON-NLS-1$
: directory.getAbsolutePath();
@@ -247,8 +245,7 @@ class RebuildCommitGraph extends TextBuiltin {
private void deleteAllRefs() throws Exception {
final RevWalk rw = new RevWalk(db);
- List<Ref> refs = db.getRefDatabase().getRefsByPrefix(ALL);
- for (final Ref r : refs) {
+ for (Ref r : db.getRefDatabase().getAllRefs()) {
if (Constants.HEAD.equals(r.getName()))
continue;
final RefUpdate u = db.updateRef(r.getName());
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java
index 45fbc2cb3c..6665ce7c1d 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java
@@ -154,7 +154,7 @@ class RebuildRefTree extends TextBuiltin {
head));
}
- for (Ref r : refdb.getRefsByPrefix(RefDatabase.ALL)) {
+ for (Ref r : refdb.getAllRefs()) {
if (r.getName().equals(txnCommitted) || r.getName().equals(HEAD)
|| r.getName().startsWith(txnNamespace)) {
continue;