comparison src/org/tmatesoft/hg/internal/RepositoryComparator.java @ 206:63c9fed4369e

Sample command line tools for incoming/outgoing to use commands
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 28 Apr 2011 02:47:44 +0200
parents 66fd2c73c56f
children 1bf0a5af2d5d
comparison
equal deleted inserted replaced
205:ffc5f6d59f7e 206:63c9fed4369e
45 * @author Artem Tikhomirov 45 * @author Artem Tikhomirov
46 * @author TMate Software Ltd. 46 * @author TMate Software Ltd.
47 */ 47 */
48 public class RepositoryComparator { 48 public class RepositoryComparator {
49 49
50 private final boolean debug = Boolean.parseBoolean(System.getProperty("hg4j.remote.debug"));
50 private final HgChangelog.ParentWalker localRepo; 51 private final HgChangelog.ParentWalker localRepo;
51 private final HgRemoteRepository remoteRepo; 52 private final HgRemoteRepository remoteRepo;
52 private List<Nodeid> common; 53 private List<Nodeid> common;
53 54
54 public RepositoryComparator(HgChangelog.ParentWalker pwLocal, HgRemoteRepository hgRemote) { 55 public RepositoryComparator(HgChangelog.ParentWalker pwLocal, HgRemoteRepository hgRemote) {
303 } while(--watchdog > 0); 304 } while(--watchdog > 0);
304 if (watchdog == 0) { 305 if (watchdog == 0) {
305 throw new HgBadStateException(String.format("Can't narrow down branch [%s, %s]", rb.head.shortNotation(), rb.root.shortNotation())); 306 throw new HgBadStateException(String.format("Can't narrow down branch [%s, %s]", rb.head.shortNotation(), rb.root.shortNotation()));
306 } 307 }
307 } 308 }
309 if (debug) {
310 for (BranchChain bc : branches2load) {
311 System.out.println("calculateMissingBranches:");
312 bc.dump();
313 }
314 }
308 return branches2load; 315 return branches2load;
309 } 316 }
310 317
311 // root and head (and all between) are unknown for each chain element but last (terminal), which has known root (revision 318 // root and head (and all between) are unknown for each chain element but last (terminal), which has known root (revision
312 // known to be locally and at remote server 319 // known to be locally and at remote server
341 @Override 348 @Override
342 public String toString() { 349 public String toString() {
343 return String.format("BranchChain [%s, %s]", branchRoot, branchHead); 350 return String.format("BranchChain [%s, %s]", branchRoot, branchHead);
344 } 351 }
345 352
346 public void dump() { 353 void dump() {
347 System.out.println(toString()); 354 System.out.println(toString());
348 internalDump(" "); 355 internalDump(" ");
349 } 356 }
350 357
351 private void internalDump(String prefix) { 358 private void internalDump(String prefix) {