]> source.dussan.org Git - jgit.git/commitdiff
Add toString for TrackingRefUpdate 91/7891/1
authorRobin Stocker <robin@nibor.org>
Sun, 23 Sep 2012 22:01:04 +0000 (00:01 +0200)
committerRobin Stocker <robin@nibor.org>
Sun, 23 Sep 2012 22:01:04 +0000 (00:01 +0200)
Makes it much easier to debug the results of
OperationResult#getTrackingRefUpdates (which otherwise requires digging
into a TreeMap structure).

Change-Id: I90da5385ee47c441404728f252eb3a100c48ee1c

org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java

index 3344c3f6a5d570a64627929e3b733d67de588ae5..d6dcb3208f33d5fbdb95692134c1618d2ae385bd 100644 (file)
@@ -193,4 +193,21 @@ public class TrackingRefUpdate {
                        }
                }
        }
+
+       @Override
+       public String toString() {
+               StringBuilder sb = new StringBuilder();
+               sb.append("TrackingRefUpdate[");
+               sb.append(remoteName);
+               sb.append(" -> ");
+               sb.append(localName);
+               if (forceUpdate)
+                       sb.append(" (forced)");
+               sb.append(" ");
+               sb.append(oldObjectId == null ? "" : oldObjectId.abbreviate(7).name());
+               sb.append("..");
+               sb.append(newObjectId == null ? "" : newObjectId.abbreviate(7).name());
+               sb.append("]");
+               return sb.toString();
+       }
 }