aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-07-09 08:53:06 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-07-09 19:09:19 -0700
commitb38426ae8c401bf482792da20b8a8169542900a0 (patch)
treeb01400c437cfc383ecfd9f93622f25e65ae6dafb
parent699e4aa7c5673b3c85f2be28652fbab6bd0dd968 (diff)
downloadjgit-b38426ae8c401bf482792da20b8a8169542900a0.tar.gz
jgit-b38426ae8c401bf482792da20b8a8169542900a0.zip
Add debugging toString() method to ObjectToPack
Its useful to know what the flags are or what the base that was selected is. Dump these out as part of the object's toString. Change-Id: I8810067fb8337b08b4fcafd5f9ea3e1e31ca6726 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java
index d3c409d9d3..471122a4f9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java
@@ -45,6 +45,7 @@
package org.eclipse.jgit.storage.pack;
import org.eclipse.jgit.lib.AnyObjectId;
+import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.revwalk.RevObject;
import org.eclipse.jgit.transport.PackedObjectInfo;
@@ -261,4 +262,31 @@ public class ObjectToPack extends PackedObjectInfo {
public void select(StoredObjectRepresentation ref) {
// Empty by default.
}
+
+ @Override
+ public String toString() {
+ StringBuilder buf = new StringBuilder();
+ buf.append("ObjectToPack[");
+ buf.append(Constants.typeString(getType()));
+ buf.append(" ");
+ buf.append(name());
+ if (wantWrite())
+ buf.append(" wantWrite");
+ if (isReuseAsIs())
+ buf.append(" reuseAsIs");
+ if (isDoNotDelta())
+ buf.append(" doNotDelta");
+ if (getDeltaDepth() > 0)
+ buf.append(" depth=" + getDeltaDepth());
+ if (isDeltaRepresentation()) {
+ if (getDeltaBase() != null)
+ buf.append(" base=inpack:" + getDeltaBase().name());
+ else
+ buf.append(" base=edge:" + getDeltaBaseId().name());
+ }
+ if (isWritten())
+ buf.append(" offset=" + getOffset());
+ buf.append("]");
+ return buf.toString();
+ }
}