diff src/org/tmatesoft/hg/internal/ExceptionInfo.java @ 485:cdd53e5884ae

Do not add anything to exception message in case no details are known
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 09 Aug 2012 15:45:18 +0200
parents 2bf6f917a7e5
children
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/ExceptionInfo.java	Wed Aug 08 14:41:44 2012 +0200
+++ b/src/org/tmatesoft/hg/internal/ExceptionInfo.java	Thu Aug 09 15:45:18 2012 +0200
@@ -121,35 +121,35 @@
 			sb.append(';');
 			sb.append(' ');
 		}
-		sb.append("rev:");
-		boolean needNodeid = true;
-		if (isRevisionIndexSet()) {
-			if (rangeLeftBoundary != BAD_REVISION || rangeRightBoundary != BAD_REVISION) {
-				String sr;
-				switch (getRevisionIndex()) {
-				case BAD_REVISION:
-					sr = "UNKNOWN"; break;
-				case TIP:
-					sr = "TIP"; break;
-				case WORKING_COPY:
-					sr = "WORKING-COPY"; break;
-				case NO_REVISION:
-					sr = "NO REVISION"; break;
-				default:
-					sr = String.valueOf(getRevisionIndex());
-				}
-				sb.append(String.format("%s is not from [%d..%d]", sr, rangeLeftBoundary, rangeRightBoundary));
-			} else {
-				sb.append(getRevisionIndex());
-				if (isRevisionSet()) {
-					sb.append(':');
-					sb.append(getRevision().shortNotation());
-					needNodeid = false;
+		if (isRevisionIndexSet() || isRevisionSet()) {
+			if (isRevisionIndexSet()) {
+				if (rangeLeftBoundary != BAD_REVISION || rangeRightBoundary != BAD_REVISION) {
+					String sr;
+					switch (getRevisionIndex()) {
+					case BAD_REVISION:
+						sr = "UNKNOWN"; break;
+					case TIP:
+						sr = "TIP"; break;
+					case WORKING_COPY:
+						sr = "WORKING-COPY"; break;
+					case NO_REVISION:
+						sr = "NO REVISION"; break;
+					default:
+						sr = String.valueOf(getRevisionIndex());
+					}
+					sb.append(String.format("%s is not from [%d..%d]", sr, rangeLeftBoundary, rangeRightBoundary));
+				} else {
+					sb.append("rev:");
+					sb.append(getRevisionIndex());
+					if (isRevisionSet()) {
+						sb.append(':');
+						// fall-through to get revision appended
+					}
 				}
 			}
-		}
-		if (isRevisionSet() && needNodeid) {
-			sb.append(getRevision().shortNotation());
+			if (isRevisionSet()) {
+				sb.append(getRevision().shortNotation());
+			}
 		}
 		if (localFile != null) {
 			sb.append(';');