comparison src/org/tmatesoft/hg/repo/HgBranches.java @ 366:189dc6dc1c3e

Use exceptions to expose errors reading mercurial data
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 16 Dec 2011 04:43:18 +0100
parents 5f9073eabf06
children 2fadf8695f8a
comparison
equal deleted inserted replaced
365:3572fcb06473 366:189dc6dc1c3e
123 } 123 }
124 } 124 }
125 return -1; // deliberately not lastInCache, to avoid anything but -1 when 1st line was read and there's error is in lines 2..end 125 return -1; // deliberately not lastInCache, to avoid anything but -1 when 1st line was read and there's error is in lines 2..end
126 } 126 }
127 127
128 void collect(final ProgressSupport ps) { 128 void collect(final ProgressSupport ps) throws HgInvalidControlFileException {
129 branches.clear(); 129 branches.clear();
130 ps.start(1 + repo.getChangelog().getRevisionCount() * 2); 130 ps.start(1 + repo.getChangelog().getRevisionCount() * 2);
131 // 131 //
132 int lastCached = readCache(); 132 int lastCached = readCache();
133 isCacheActual = lastCached == repo.getChangelog().getLastRevision(); 133 isCacheActual = lastCached == repo.getChangelog().getLastRevision();
297 // proper BI in #collect() 297 // proper BI in #collect()
298 BranchInfo(String branchName, Nodeid[] branchHeads) { 298 BranchInfo(String branchName, Nodeid[] branchHeads) {
299 this(branchName, Nodeid.NULL, branchHeads); 299 this(branchName, Nodeid.NULL, branchHeads);
300 } 300 }
301 301
302 void validate(HgChangelog clog, HgChangelog.RevisionMap rmap) { 302 void validate(HgChangelog clog, HgChangelog.RevisionMap rmap) throws HgInvalidControlFileException {
303 int[] localCset = new int[heads.size()]; 303 int[] localCset = new int[heads.size()];
304 int i = 0; 304 int i = 0;
305 for (Nodeid h : heads) { 305 for (Nodeid h : heads) {
306 localCset[i++] = rmap.localRevision(h); 306 localCset[i++] = rmap.localRevision(h);
307 } 307 }