Mercurial > jhg
diff src/org/tmatesoft/hg/core/HgLogCommand.java @ 193:37f3d4a596e4
Use common low to hi-level changeset api transformer
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 15 Apr 2011 03:28:12 +0200 |
parents | d5268ca7715b |
children | c9b305df0b89 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgLogCommand.java Fri Apr 15 03:17:03 2011 +0200 +++ b/src/org/tmatesoft/hg/core/HgLogCommand.java Fri Apr 15 03:28:12 2011 +0200 @@ -31,12 +31,9 @@ import org.tmatesoft.hg.repo.HgChangelog; import org.tmatesoft.hg.repo.HgDataFile; import org.tmatesoft.hg.repo.HgRepository; -import org.tmatesoft.hg.repo.HgStatusCollector; import org.tmatesoft.hg.util.ByteChannel; import org.tmatesoft.hg.util.CancelledException; import org.tmatesoft.hg.util.Path; -import org.tmatesoft.hg.util.PathPool; -import org.tmatesoft.hg.util.PathRewrite; /** @@ -58,11 +55,10 @@ private Set<String> branches; private int limit = 0, count = 0; private int startRev = 0, endRev = TIP; - private Handler delegate; private Calendar date; private Path file; private boolean followHistory; // makes sense only when file != null - private HgChangeset changeset; + private ChangesetTransformer csetTransform; public HgLogCommand(HgRepository hgRepo) { repo = hgRepo; @@ -183,18 +179,14 @@ if (handler == null) { throw new IllegalArgumentException(); } - if (delegate != null) { + if (csetTransform != null) { throw new ConcurrentModificationException(); } try { - delegate = handler; count = 0; - HgStatusCollector statusCollector = new HgStatusCollector(repo); - // files listed in a changeset don't need their names to be rewritten (they are normalized already) - PathPool pp = new PathPool(new PathRewrite.Empty()); - // #file(String, boolean) above may utilize PathPool as well. CommandContext? - statusCollector.setPathPool(pp); - changeset = new HgChangeset(statusCollector, pp); + // ChangesetTransfrom creates a blank PathPool, and #file(String, boolean) above + // may utilize it as well. CommandContext? How about StatusCollector there as well? + csetTransform = new ChangesetTransformer(repo, handler); if (file == null) { repo.getChangelog().range(startRev, endRev, this); } else { @@ -220,8 +212,7 @@ } } } finally { - delegate = null; - changeset = null; + csetTransform = null; } } @@ -251,8 +242,7 @@ // FIXME } count++; - changeset.init(revisionNumber, nodeid, cset); - delegate.next(changeset); + csetTransform.next(revisionNumber, nodeid, cset); } public interface Handler {