comparison src/org/tmatesoft/hg/repo/HgBundle.java @ 354:5f9073eabf06

Propagate errors with exceptions up to a end client
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 01 Dec 2011 05:21:40 +0100
parents 694ebabb5cb3
children dfb8405d996f
comparison
equal deleted inserted replaced
353:0f3687e79f5a 354:5f9073eabf06
19 import java.io.File; 19 import java.io.File;
20 import java.io.IOException; 20 import java.io.IOException;
21 import java.util.LinkedList; 21 import java.util.LinkedList;
22 22
23 import org.tmatesoft.hg.core.HgBadStateException; 23 import org.tmatesoft.hg.core.HgBadStateException;
24 import org.tmatesoft.hg.core.HgCallbackTargetException;
24 import org.tmatesoft.hg.core.HgException; 25 import org.tmatesoft.hg.core.HgException;
25 import org.tmatesoft.hg.core.HgInvalidFileException; 26 import org.tmatesoft.hg.core.HgInvalidFileException;
26 import org.tmatesoft.hg.core.Nodeid; 27 import org.tmatesoft.hg.core.Nodeid;
27 import org.tmatesoft.hg.internal.ByteArrayChannel; 28 import org.tmatesoft.hg.internal.ByteArrayChannel;
28 import org.tmatesoft.hg.internal.ByteArrayDataAccess; 29 import org.tmatesoft.hg.internal.ByteArrayDataAccess;
91 /** 92 /**
92 * Get changes recorded in the bundle that are missing from the supplied repository. 93 * Get changes recorded in the bundle that are missing from the supplied repository.
93 * @param hgRepo repository that shall possess base revision for this bundle 94 * @param hgRepo repository that shall possess base revision for this bundle
94 * @param inspector callback to get each changeset found 95 * @param inspector callback to get each changeset found
95 */ 96 */
96 public void changes(final HgRepository hgRepo, final HgChangelog.Inspector inspector) throws HgInvalidFileException { 97 public void changes(final HgRepository hgRepo, final HgChangelog.Inspector inspector) throws HgCallbackTargetException, HgInvalidFileException {
97 Inspector bundleInsp = new Inspector() { 98 Inspector bundleInsp = new Inspector() {
98 DigestHelper dh = new DigestHelper(); 99 DigestHelper dh = new DigestHelper();
99 boolean emptyChangelog = true; 100 boolean emptyChangelog = true;
100 private DataAccess prevRevContent; 101 private DataAccess prevRevContent;
101 private int revisionIndex; 102 private int revisionIndex;
175 public void manifestEnd() {} 176 public void manifestEnd() {}
176 public void fileStart(String name) {} 177 public void fileStart(String name) {}
177 public void fileEnd(String name) {} 178 public void fileEnd(String name) {}
178 179
179 }; 180 };
180 inspectChangelog(bundleInsp); 181 try {
182 inspectChangelog(bundleInsp);
183 } catch (RuntimeException ex) {
184 throw new HgCallbackTargetException(ex);
185 }
181 } 186 }
182 187
183 public void dump() throws HgException { 188 public void dump() throws HgException {
184 Dump dump = new Dump(); 189 Dump dump = new Dump();
185 inspectAll(dump); 190 inspectAll(dump);