comparison src/org/tmatesoft/hg/core/HgIncomingCommand.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 31a89587eb04
children 2f9ed6bcefa2
comparison
equal deleted inserted replaced
431:12f668401613 432:1fc0da631200
33 import org.tmatesoft.hg.repo.HgInvalidControlFileException; 33 import org.tmatesoft.hg.repo.HgInvalidControlFileException;
34 import org.tmatesoft.hg.repo.HgInvalidStateException; 34 import org.tmatesoft.hg.repo.HgInvalidStateException;
35 import org.tmatesoft.hg.repo.HgRemoteRepository; 35 import org.tmatesoft.hg.repo.HgRemoteRepository;
36 import org.tmatesoft.hg.repo.HgRepository; 36 import org.tmatesoft.hg.repo.HgRepository;
37 import org.tmatesoft.hg.repo.HgRuntimeException; 37 import org.tmatesoft.hg.repo.HgRuntimeException;
38 import org.tmatesoft.hg.repo.HgParentChildMap;
38 import org.tmatesoft.hg.util.CancelledException; 39 import org.tmatesoft.hg.util.CancelledException;
39 import org.tmatesoft.hg.util.ProgressSupport; 40 import org.tmatesoft.hg.util.ProgressSupport;
40 41
41 /** 42 /**
42 * Command to find out changes available in a remote repository, missing locally. 43 * Command to find out changes available in a remote repository, missing locally.
50 private HgRemoteRepository remoteRepo; 51 private HgRemoteRepository remoteRepo;
51 @SuppressWarnings("unused") 52 @SuppressWarnings("unused")
52 private boolean includeSubrepo; 53 private boolean includeSubrepo;
53 private RepositoryComparator comparator; 54 private RepositoryComparator comparator;
54 private List<BranchChain> missingBranches; 55 private List<BranchChain> missingBranches;
55 private HgChangelog.ParentWalker parentHelper; 56 private HgParentChildMap<HgChangelog> parentHelper;
56 private Set<String> branches; 57 private Set<String> branches;
57 58
58 public HgIncomingCommand(HgRepository hgRepo) { 59 public HgIncomingCommand(HgRepository hgRepo) {
59 localRepo = hgRepo; 60 localRepo = hgRepo;
60 } 61 }
142 try { 143 try {
143 final ChangesetTransformer transformer = new ChangesetTransformer(localRepo, handler, getParentHelper(), ps, getCancelSupport(handler, true)); 144 final ChangesetTransformer transformer = new ChangesetTransformer(localRepo, handler, getParentHelper(), ps, getCancelSupport(handler, true));
144 transformer.limitBranches(branches); 145 transformer.limitBranches(branches);
145 changegroup.changes(localRepo, new HgChangelog.Inspector() { 146 changegroup.changes(localRepo, new HgChangelog.Inspector() {
146 private int localIndex; 147 private int localIndex;
147 private final HgChangelog.ParentWalker parentHelper; 148 private final HgParentChildMap<HgChangelog> parentHelper;
148 149
149 { 150 {
150 parentHelper = getParentHelper(); 151 parentHelper = getParentHelper();
151 // new revisions, if any, would be added after all existing, and would get numbered started with last+1 152 // new revisions, if any, would be added after all existing, and would get numbered started with last+1
152 localIndex = localRepo.getChangelog().getRevisionCount(); 153 localIndex = localRepo.getChangelog().getRevisionCount();
179 // comparator.compare(context); // XXX meanwhile we use distinct path to calculate common 180 // comparator.compare(context); // XXX meanwhile we use distinct path to calculate common
180 } 181 }
181 return comparator; 182 return comparator;
182 } 183 }
183 184
184 private HgChangelog.ParentWalker getParentHelper() throws HgInvalidControlFileException { 185 private HgParentChildMap<HgChangelog> getParentHelper() throws HgInvalidControlFileException {
185 if (parentHelper == null) { 186 if (parentHelper == null) {
186 parentHelper = localRepo.getChangelog().new ParentWalker(); 187 parentHelper = new HgParentChildMap<HgChangelog>(localRepo.getChangelog());
187 parentHelper.init(); 188 parentHelper.init();
188 } 189 }
189 return parentHelper; 190 return parentHelper;
190 } 191 }
191 192