From 85b189fdbea99e2a5ef8277d314d9962833e263a Mon Sep 17 00:00:00 2001 From: Robin Stocker Date: Mon, 24 Sep 2012 00:01:04 +0200 Subject: [PATCH] Add toString for TrackingRefUpdate Makes it much easier to debug the results of OperationResult#getTrackingRefUpdates (which otherwise requires digging into a TreeMap structure). Change-Id: I90da5385ee47c441404728f252eb3a100c48ee1c --- .../jgit/transport/TrackingRefUpdate.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java index 3344c3f6a..d6dcb3208 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java @@ -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(); + } }