Mercurial > jhg
diff src/org/tmatesoft/hg/core/HgLogCommand.java @ 157:d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 09 Mar 2011 05:22:17 +0100 |
parents | ba2bf656f00f |
children | 37f3d4a596e4 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgLogCommand.java Wed Mar 02 01:06:09 2011 +0100 +++ b/src/org/tmatesoft/hg/core/HgLogCommand.java Wed Mar 09 05:22:17 2011 +0100 @@ -18,6 +18,7 @@ import static org.tmatesoft.hg.repo.HgRepository.TIP; +import java.io.IOException; import java.util.Calendar; import java.util.Collections; import java.util.ConcurrentModificationException; @@ -31,6 +32,8 @@ 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; @@ -164,7 +167,7 @@ /** * Similar to {@link #execute(org.tmatesoft.hg.repo.RawChangeset.Inspector)}, collects and return result as a list. */ - public List<HgChangeset> execute() { + public List<HgChangeset> execute() throws HgException { CollectHandler collector = new CollectHandler(); execute(collector); return collector.getChanges(); @@ -176,7 +179,7 @@ * @throws IllegalArgumentException when inspector argument is null * @throws ConcurrentModificationException if this log command instance is already running */ - public void execute(Handler handler) { + public void execute(Handler handler) throws HgException { if (handler == null) { throw new IllegalArgumentException(); } @@ -309,9 +312,10 @@ public Nodeid getRevision() { return revision; } - public byte[] getContent() { - // XXX Content wrapper, to allow formats other than byte[], e.g. Stream, DataAccess, etc? - return repo.getFileNode(path).content(revision); + public void putContentTo(ByteChannel sink) throws HgDataStreamException, IOException, CancelledException { + HgDataFile fn = repo.getFileNode(path); + int localRevision = fn.getLocalRevision(revision); + fn.contentWithFilters(localRevision, sink); } } }