Mercurial > jhg
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 175:7653bdf82cf0 | 176:a8df7162ec75 |
|---|---|
| 17 package org.tmatesoft.hg.console; | 17 package org.tmatesoft.hg.console; |
| 18 | 18 |
| 19 import static org.tmatesoft.hg.core.Nodeid.NULL; | 19 import static org.tmatesoft.hg.core.Nodeid.NULL; |
| 20 | 20 |
| 21 import java.io.File; | 21 import java.io.File; |
| 22 import java.net.MalformedURLException; | |
| 23 import java.net.URL; | 22 import java.net.URL; |
| 24 import java.util.Collection; | 23 import java.util.Collection; |
| 24 import java.util.Collections; | |
| 25 import java.util.LinkedList; | 25 import java.util.LinkedList; |
| 26 import java.util.List; | 26 import java.util.List; |
| 27 | 27 |
| 28 import org.tmatesoft.hg.core.HgException; | 28 import org.tmatesoft.hg.core.HgException; |
| 29 import org.tmatesoft.hg.core.Nodeid; | 29 import org.tmatesoft.hg.core.Nodeid; |
| 75 // find all local children of commonKnown | 75 // find all local children of commonKnown |
| 76 List<Nodeid> result = pw.childrenOf(commonKnown); | 76 List<Nodeid> result = pw.childrenOf(commonKnown); |
| 77 dump("Result", result); | 77 dump("Result", result); |
| 78 } | 78 } |
| 79 | 79 |
| 80 private static List<Nodeid> findCommonWithRemote(HgChangelog.ParentWalker pwLocal, HgRemoteRepository hgRemote) { | 80 private static List<Nodeid> findCommonWithRemote(HgChangelog.ParentWalker pwLocal, HgRemoteRepository hgRemote) throws HgException { |
| 81 List<Nodeid> remoteHeads = hgRemote.heads(); | 81 List<Nodeid> remoteHeads = hgRemote.heads(); |
| 82 LinkedList<Nodeid> common = new LinkedList<Nodeid>(); // these remotes are known in local | 82 LinkedList<Nodeid> common = new LinkedList<Nodeid>(); // these remotes are known in local |
| 83 LinkedList<Nodeid> toQuery = new LinkedList<Nodeid>(); // these need further queries to find common | 83 LinkedList<Nodeid> toQuery = new LinkedList<Nodeid>(); // these need further queries to find common |
| 84 for (Nodeid rh : remoteHeads) { | 84 for (Nodeid rh : remoteHeads) { |
| 85 if (pwLocal.knownNode(rh)) { | 85 if (pwLocal.knownNode(rh)) { |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 // can't check nodes between checkUp2Head element and local heads, remote might have distinct descendants sequence | 119 // can't check nodes between checkUp2Head element and local heads, remote might have distinct descendants sequence |
| 120 for (RemoteBranch rb : checkUp2Head) { | 120 for (RemoteBranch rb : checkUp2Head) { |
| 121 // rb.root is known locally | 121 // rb.root is known locally |
| 122 List<Nodeid> remoteRevisions = hgRemote.between(rb.root, rb.head); | 122 List<Nodeid> remoteRevisions = hgRemote.between(rb.head, rb.root); |
| 123 // between gives result from head to root, I'd like to go in reverse direction | |
| 124 Collections.reverse(remoteRevisions); | |
| 123 if (remoteRevisions.isEmpty()) { | 125 if (remoteRevisions.isEmpty()) { |
| 124 // head is immediate child | 126 // head is immediate child |
| 125 common.add(rb.root); | 127 common.add(rb.root); |
| 126 } else { | 128 } else { |
| 127 Nodeid root = rb.root; | 129 Nodeid root = rb.root; |
| 141 break; | 143 break; |
| 142 } | 144 } |
| 143 // might get handy for next between query, to narrow search down | 145 // might get handy for next between query, to narrow search down |
| 144 root = n; | 146 root = n; |
| 145 } else { | 147 } else { |
| 146 remoteRevisions = hgRemote.between(root, n); | 148 remoteRevisions = hgRemote.between(n, root); |
| 149 Collections.reverse(remoteRevisions); | |
| 147 if (remoteRevisions.isEmpty()) { | 150 if (remoteRevisions.isEmpty()) { |
| 148 common.add(root); | 151 common.add(root); |
| 149 } | 152 } |
| 150 } | 153 } |
| 151 } | 154 } |
