diff cmdline/org/tmatesoft/hg/console/Outgoing.java @ 176:a8df7162ec75

Extracting complete branch using remote between call to detect incoming changes is done. Arguments reorderd in remote repo to better match Hg server ideology, not my mental convenience
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 02 Apr 2011 03:01:14 +0200
parents 87f40938c9b2
children 62665d8f0686
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Outgoing.java	Wed Mar 30 02:55:48 2011 +0200
+++ b/cmdline/org/tmatesoft/hg/console/Outgoing.java	Sat Apr 02 03:01:14 2011 +0200
@@ -19,9 +19,9 @@
 import static org.tmatesoft.hg.core.Nodeid.NULL;
 
 import java.io.File;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -77,7 +77,7 @@
 		dump("Result", result);
 	}
 	
-	private static List<Nodeid> findCommonWithRemote(HgChangelog.ParentWalker pwLocal, HgRemoteRepository hgRemote) {
+	private static List<Nodeid> findCommonWithRemote(HgChangelog.ParentWalker pwLocal, HgRemoteRepository hgRemote) throws HgException {
 		List<Nodeid> remoteHeads = hgRemote.heads();
 		LinkedList<Nodeid> common = new LinkedList<Nodeid>(); // these remotes are known in local
 		LinkedList<Nodeid> toQuery = new LinkedList<Nodeid>(); // these need further queries to find common
@@ -119,7 +119,9 @@
 		// can't check nodes between checkUp2Head element and local heads, remote might have distinct descendants sequence
 		for (RemoteBranch rb : checkUp2Head) {
 			// rb.root is known locally
-			List<Nodeid> remoteRevisions = hgRemote.between(rb.root, rb.head);
+			List<Nodeid> remoteRevisions = hgRemote.between(rb.head, rb.root);
+				// between gives result from head to root, I'd like to go in reverse direction
+			Collections.reverse(remoteRevisions);
 			if (remoteRevisions.isEmpty()) {
 				// head is immediate child
 				common.add(rb.root);
@@ -143,7 +145,8 @@
 						// might get handy for next between query, to narrow search down
 						root = n;
 					} else {
-						remoteRevisions = hgRemote.between(root, n);
+						remoteRevisions = hgRemote.between(n, root);
+						Collections.reverse(remoteRevisions);
 						if (remoteRevisions.isEmpty()) {
 							common.add(root);
 						}