Mercurial > hg4j
diff src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java @ 218:047b1dec7a04
Issue 7: Correctly handle manifest and changelog with different number of (or non-matching) revisions
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 17 May 2011 03:42:33 +0200 |
parents | c9b305df0b89 |
children | d63583b47bfa |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java Tue May 17 03:40:52 2011 +0200 +++ b/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java Tue May 17 03:42:33 2011 +0200 @@ -18,6 +18,7 @@ import static java.lang.Math.max; import static java.lang.Math.min; +import static org.tmatesoft.hg.repo.HgRepository.*; import static org.tmatesoft.hg.repo.HgRepository.BAD_REVISION; import static org.tmatesoft.hg.repo.HgRepository.TIP; @@ -61,8 +62,8 @@ } HgWorkingCopyStatusCollector(HgRepository hgRepo, FileIterator hgRepoWalker) { - this.repo = hgRepo; - this.repoWalker = hgRepoWalker; + repo = hgRepo; + repoWalker = hgRepoWalker; } /** @@ -98,14 +99,17 @@ // may be invoked few times public void walk(int baseRevision, HgStatusInspector inspector) { + if (HgInternals.wrongLocalRevision(baseRevision) || baseRevision == BAD_REVISION || baseRevision == WORKING_COPY) { + throw new IllegalArgumentException(String.valueOf(baseRevision)); + } final HgIgnore hgIgnore = repo.getIgnore(); TreeSet<String> knownEntries = getDirstate().all(); final boolean isTipBase; if (baseRevision == TIP) { - baseRevision = repo.getManifest().getRevisionCount() - 1; + baseRevision = repo.getChangelog().getLastRevision(); isTipBase = true; } else { - isTipBase = baseRevision == repo.getManifest().getRevisionCount() - 1; + isTipBase = baseRevision == repo.getChangelog().getLastRevision(); } HgStatusCollector.ManifestRevisionInspector collect = null; Set<String> baseRevFiles = Collections.emptySet();