comparison src/org/tmatesoft/hg/core/HgLogCommand.java @ 432:1fc0da631200

Revlog.ParentWalker helper class got promoted as TLC, renamed to HgParentChildMap
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 30 Mar 2012 16:22:51 +0200
parents 12f668401613
children 909306e412e2
comparison
equal deleted inserted replaced
431:12f668401613 432:1fc0da631200
38 import org.tmatesoft.hg.repo.HgInvalidControlFileException; 38 import org.tmatesoft.hg.repo.HgInvalidControlFileException;
39 import org.tmatesoft.hg.repo.HgInvalidStateException; 39 import org.tmatesoft.hg.repo.HgInvalidStateException;
40 import org.tmatesoft.hg.repo.HgRepository; 40 import org.tmatesoft.hg.repo.HgRepository;
41 import org.tmatesoft.hg.repo.HgRuntimeException; 41 import org.tmatesoft.hg.repo.HgRuntimeException;
42 import org.tmatesoft.hg.repo.HgStatusCollector; 42 import org.tmatesoft.hg.repo.HgStatusCollector;
43 import org.tmatesoft.hg.repo.HgParentChildMap;
43 import org.tmatesoft.hg.util.CancelSupport; 44 import org.tmatesoft.hg.util.CancelSupport;
44 import org.tmatesoft.hg.util.CancelledException; 45 import org.tmatesoft.hg.util.CancelledException;
45 import org.tmatesoft.hg.util.Pair; 46 import org.tmatesoft.hg.util.Pair;
46 import org.tmatesoft.hg.util.Path; 47 import org.tmatesoft.hg.util.Path;
47 import org.tmatesoft.hg.util.ProgressSupport; 48 import org.tmatesoft.hg.util.ProgressSupport;
68 private int startRev = 0, endRev = TIP; 69 private int startRev = 0, endRev = TIP;
69 private Calendar date; 70 private Calendar date;
70 private Path file; 71 private Path file;
71 private boolean followHistory; // makes sense only when file != null 72 private boolean followHistory; // makes sense only when file != null
72 private ChangesetTransformer csetTransform; 73 private ChangesetTransformer csetTransform;
73 private HgChangelog.ParentWalker parentHelper; 74 private HgParentChildMap<HgChangelog> parentHelper;
74 75
75 public HgLogCommand(HgRepository hgRepo) { 76 public HgLogCommand(HgRepository hgRepo) {
76 repo = hgRepo; 77 repo = hgRepo;
77 } 78 }
78 79
232 throw new ConcurrentModificationException(); 233 throw new ConcurrentModificationException();
233 } 234 }
234 final ProgressSupport progressHelper = getProgressSupport(handler); 235 final ProgressSupport progressHelper = getProgressSupport(handler);
235 try { 236 try {
236 count = 0; 237 count = 0;
237 HgChangelog.ParentWalker pw = getParentHelper(file == null); // leave it uninitialized unless we iterate whole repo 238 HgParentChildMap<HgChangelog> pw = getParentHelper(file == null); // leave it uninitialized unless we iterate whole repo
238 // ChangesetTransfrom creates a blank PathPool, and #file(String, boolean) above 239 // ChangesetTransfrom creates a blank PathPool, and #file(String, boolean) above
239 // may utilize it as well. CommandContext? How about StatusCollector there as well? 240 // may utilize it as well. CommandContext? How about StatusCollector there as well?
240 csetTransform = new ChangesetTransformer(repo, handler, pw, progressHelper, getCancelSupport(handler, true)); 241 csetTransform = new ChangesetTransformer(repo, handler, pw, progressHelper, getCancelSupport(handler, true));
241 if (file == null) { 242 if (file == null) {
242 progressHelper.start(endRev - startRev + 1); 243 progressHelper.start(endRev - startRev + 1);
385 } 386 }
386 count++; 387 count++;
387 csetTransform.next(revisionNumber, nodeid, cset); 388 csetTransform.next(revisionNumber, nodeid, cset);
388 } 389 }
389 390
390 private HgChangelog.ParentWalker getParentHelper(boolean create) throws HgInvalidControlFileException { 391 private HgParentChildMap<HgChangelog> getParentHelper(boolean create) throws HgInvalidControlFileException {
391 if (parentHelper == null && create) { 392 if (parentHelper == null && create) {
392 parentHelper = repo.getChangelog().new ParentWalker(); 393 parentHelper = new HgParentChildMap<HgChangelog>(repo.getChangelog());
393 parentHelper.init(); 394 parentHelper.init();
394 } 395 }
395 return parentHelper; 396 return parentHelper;
396 } 397 }
397 398