diff src/org/tmatesoft/hg/internal/RepositoryComparator.java @ 203:66fd2c73c56f

Basic test for HgOutgoingCommand. Handle cases with no outgoing changes in RepositoryComparator
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 26 Apr 2011 15:52:33 +0200
parents 706bcc7cfee4
children 63c9fed4369e
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/RepositoryComparator.java	Tue Apr 26 02:50:06 2011 +0200
+++ b/src/org/tmatesoft/hg/internal/RepositoryComparator.java	Tue Apr 26 15:52:33 2011 +0200
@@ -112,6 +112,13 @@
 				earliestRevision = lr;
 			}
 		}
+		if (earliestRevision == Integer.MAX_VALUE) {
+			// either there are no common nodes (known locally and at remote)
+			// or no local children found (local is up to date). In former case, perhaps I shall bit return silently,
+			// but check for possible wrong repo comparison (hs says 'repository is unrelated' if I try to 
+			// check in/out for a repo that has no common nodes.
+			return;
+		}
 		if (earliestRevision < 0 || earliestRevision >= changelog.getLastRevision()) {
 			throw new HgBadStateException(String.format("Invalid index of common known revision: %d in total of %d", earliestRevision, 1+changelog.getLastRevision()));
 		}