Mercurial > hg4j
comparison cmdline/org/tmatesoft/hg/console/Bundle.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 | 45dc79e545f5 |
children | dfb8405d996f |
comparison
equal
deleted
inserted
replaced
353:0f3687e79f5a | 354:5f9073eabf06 |
---|---|
17 package org.tmatesoft.hg.console; | 17 package org.tmatesoft.hg.console; |
18 | 18 |
19 import java.io.File; | 19 import java.io.File; |
20 import java.util.Collections; | 20 import java.util.Collections; |
21 | 21 |
22 import org.tmatesoft.hg.core.HgCallbackTargetException; | |
23 import org.tmatesoft.hg.core.HgException; | |
22 import org.tmatesoft.hg.core.Nodeid; | 24 import org.tmatesoft.hg.core.Nodeid; |
23 import org.tmatesoft.hg.repo.HgBundle; | 25 import org.tmatesoft.hg.repo.HgBundle; |
24 import org.tmatesoft.hg.repo.HgChangelog; | 26 import org.tmatesoft.hg.repo.HgChangelog; |
25 import org.tmatesoft.hg.repo.HgLookup; | 27 import org.tmatesoft.hg.repo.HgLookup; |
26 import org.tmatesoft.hg.repo.HgRepository; | 28 import org.tmatesoft.hg.repo.HgRepository; |
55 */ | 57 */ |
56 hgBundle.changes(hgRepo, new HgChangelog.Inspector() { | 58 hgBundle.changes(hgRepo, new HgChangelog.Inspector() { |
57 private final HgChangelog changelog = hgRepo.getChangelog(); | 59 private final HgChangelog changelog = hgRepo.getChangelog(); |
58 | 60 |
59 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) { | 61 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) { |
60 if (changelog.isKnown(nodeid)) { | 62 try { |
61 System.out.print("+"); | 63 if (changelog.isKnown(nodeid)) { |
62 } else { | 64 System.out.print("+"); |
63 System.out.print("-"); | 65 } else { |
66 System.out.print("-"); | |
67 } | |
68 System.out.printf("%d:%s\n%s\n", revisionNumber, nodeid.shortNotation(), cset.toString()); | |
69 } catch (HgException ex) { | |
70 throw new HgCallbackTargetException.Wrap(ex); | |
64 } | 71 } |
65 System.out.printf("%d:%s\n%s\n", revisionNumber, nodeid.shortNotation(), cset.toString()); | |
66 } | 72 } |
67 }); | 73 }); |
68 } | 74 } |
69 | 75 |
70 /* | 76 /* |