Mercurial > jhg
comparison cmdline/org/tmatesoft/hg/console/Bundle.java @ 423:9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Fri, 23 Mar 2012 22:51:18 +0100 |
| parents | dfb8405d996f |
| children | 6526d8adbc0f |
comparison
equal
deleted
inserted
replaced
| 422:5d1cc7366d04 | 423:9c9c442b5f2e |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 TMate Software Ltd | 2 * Copyright (c) 2011-2012 TMate Software Ltd |
| 3 * | 3 * |
| 4 * This program is free software; you can redistribute it and/or modify | 4 * This program is free software; you can redistribute it and/or modify |
| 5 * it under the terms of the GNU General Public License as published by | 5 * it under the terms of the GNU General Public License as published by |
| 6 * the Free Software Foundation; version 2 of the License. | 6 * the Free Software Foundation; version 2 of the License. |
| 7 * | 7 * |
| 18 | 18 |
| 19 import java.io.File; | 19 import java.io.File; |
| 20 import java.util.Collections; | 20 import java.util.Collections; |
| 21 import java.util.LinkedList; | 21 import java.util.LinkedList; |
| 22 | 22 |
| 23 import org.tmatesoft.hg.core.HgCallbackTargetException; | |
| 24 import org.tmatesoft.hg.core.HgException; | 23 import org.tmatesoft.hg.core.HgException; |
| 25 import org.tmatesoft.hg.core.Nodeid; | 24 import org.tmatesoft.hg.core.Nodeid; |
| 26 import org.tmatesoft.hg.repo.HgBundle; | 25 import org.tmatesoft.hg.repo.HgBundle; |
| 27 import org.tmatesoft.hg.repo.HgChangelog; | 26 import org.tmatesoft.hg.repo.HgChangelog; |
| 28 import org.tmatesoft.hg.repo.HgLookup; | 27 import org.tmatesoft.hg.repo.HgLookup; |
| 60 */ | 59 */ |
| 61 hgBundle.changes(hgRepo, new HgChangelog.Inspector() { | 60 hgBundle.changes(hgRepo, new HgChangelog.Inspector() { |
| 62 private final HgChangelog changelog = hgRepo.getChangelog(); | 61 private final HgChangelog changelog = hgRepo.getChangelog(); |
| 63 | 62 |
| 64 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) { | 63 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) { |
| 65 try { | 64 if (changelog.isKnown(nodeid)) { |
| 66 if (changelog.isKnown(nodeid)) { | 65 System.out.print("+"); |
| 67 System.out.print("+"); | 66 } else { |
| 68 } else { | 67 System.out.print("-"); |
| 69 System.out.print("-"); | |
| 70 } | |
| 71 System.out.printf("%d:%s\n%s\n", revisionNumber, nodeid.shortNotation(), cset.toString()); | |
| 72 } catch (HgException ex) { | |
| 73 throw new HgCallbackTargetException.Wrap(ex); | |
| 74 } | 68 } |
| 69 System.out.printf("%d:%s\n%s\n", revisionNumber, nodeid.shortNotation(), cset.toString()); | |
| 75 } | 70 } |
| 76 }); | 71 }); |
| 77 } | 72 } |
| 78 | 73 |
| 79 /* | 74 /* |
