These can help identify the state of each object, especially the important UNINTERESTING flag being present (or not). Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx> --- .../org/spearce/jgit/revwalk/AbstractRevQueue.java | 5 ++++ .../src/org/spearce/jgit/revwalk/DateRevQueue.java | 10 ++------ .../src/org/spearce/jgit/revwalk/FIFORevQueue.java | 10 ++------ .../src/org/spearce/jgit/revwalk/LIFORevQueue.java | 10 ++------ .../src/org/spearce/jgit/revwalk/RevCommit.java | 12 ++++++++++ .../src/org/spearce/jgit/revwalk/RevObject.java | 23 ++++++++++++++++++++ 6 files changed, 49 insertions(+), 21 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractRevQueue.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractRevQueue.java index 4cf7dae..5bb969d 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractRevQueue.java +++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractRevQueue.java @@ -115,6 +115,11 @@ int outputType() { return outputType; } + protected static void describe(final StringBuilder s, final RevCommit c) { + s.append(c.toString()); + s.append('\n'); + } + private static class AlwaysEmptyQueue extends AbstractRevQueue { @Override public void add(RevCommit c) { diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/DateRevQueue.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/DateRevQueue.java index f797477..210f985 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/DateRevQueue.java +++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/DateRevQueue.java @@ -126,13 +126,9 @@ int outputType() { } public String toString() { - final StringBuffer s = new StringBuffer(); - for (Entry q = head; q != null; q = q.next) { - s.append(q.commit.name()); - s.append(' '); - s.append(q.commit.commitTime); - s.append('\n'); - } + final StringBuilder s = new StringBuilder(); + for (Entry q = head; q != null; q = q.next) + describe(s, q.commit); return s.toString(); } diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/FIFORevQueue.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/FIFORevQueue.java index 2c4c003..f086928 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/FIFORevQueue.java +++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/FIFORevQueue.java @@ -149,14 +149,10 @@ void removeFlag(final int f) { } public String toString() { - final StringBuffer s = new StringBuffer(); + final StringBuilder s = new StringBuilder(); for (Block q = head; q != null; q = q.next) { - for (int i = q.headIndex; i < q.tailIndex; i++) { - s.append(q.commits[i].name()); - s.append(' '); - s.append(q.commits[i].commitTime); - s.append('\n'); - } + for (int i = q.headIndex; i < q.tailIndex; i++) + describe(s, q.commits[i]); } return s.toString(); } diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/LIFORevQueue.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/LIFORevQueue.java index 5e885c0..045f7f1 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/LIFORevQueue.java +++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/LIFORevQueue.java @@ -104,14 +104,10 @@ boolean anybodyHasFlag(final int f) { } public String toString() { - final StringBuffer s = new StringBuffer(); + final StringBuilder s = new StringBuilder(); for (Block q = head; q != null; q = q.next) { - for (int i = q.headIndex; i < q.tailIndex; i++) { - s.append(q.commits[i].name()); - s.append(' '); - s.append(q.commits[i].commitTime); - s.append('\n'); - } + for (int i = q.headIndex; i < q.tailIndex; i++) + describe(s, q.commits[i]); } return s.toString(); } diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevCommit.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevCommit.java index de11c39..1b25fce 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevCommit.java +++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevCommit.java @@ -388,4 +388,16 @@ public void dispose() { flags &= ~PARSED; buffer = null; } + + @Override + public String toString() { + final StringBuilder s = new StringBuilder(); + s.append(Constants.typeString(getType())); + s.append(name()); + s.append(' '); + s.append(commitTime); + s.append(' '); + appendCoreFlags(s); + return s.toString(); + } } diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java index 451205c..7dadb7b 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java +++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java @@ -167,4 +167,27 @@ public void remove(final RevFlagSet set) { public void dispose() { // Nothing needs to be done for most objects. } + + @Override + public String toString() { + final StringBuilder s = new StringBuilder(); + s.append(Constants.typeString(getType())); + s.append(name()); + s.append(' '); + appendCoreFlags(s); + return s.toString(); + } + + /** + * @param s + * buffer to append a debug description of core RevFlags onto. + */ + protected void appendCoreFlags(final StringBuilder s) { + s.append((flags & RevWalk.TOPO_DELAY) != 0 ? 'o' : '-'); + s.append((flags & RevWalk.TEMP_MARK) != 0 ? 't' : '-'); + s.append((flags & RevWalk.REWRITE) != 0 ? 'r' : '-'); + s.append((flags & RevWalk.UNINTERESTING) != 0 ? 'u' : '-'); + s.append((flags & RevWalk.SEEN) != 0 ? 's' : '-'); + s.append((flags & RevWalk.PARSED) != 0 ? 'p' : '-'); + } } -- 1.6.2.288.gc3f22 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html