Mercurial > hg4j
diff src/org/tmatesoft/hg/core/HgAnnotateCommand.java @ 628:6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 22 May 2013 15:52:31 +0200 |
parents | 5afc7eedb3dd |
children | 5f52074707b2 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgAnnotateCommand.java Tue May 21 20:17:33 2013 +0200 +++ b/src/org/tmatesoft/hg/core/HgAnnotateCommand.java Wed May 22 15:52:31 2013 +0200 @@ -28,6 +28,7 @@ import org.tmatesoft.hg.repo.HgBlameInspector.BlockData; import org.tmatesoft.hg.repo.HgDataFile; import org.tmatesoft.hg.repo.HgRepository; +import org.tmatesoft.hg.repo.HgRuntimeException; import org.tmatesoft.hg.util.CancelSupport; import org.tmatesoft.hg.util.CancelledException; import org.tmatesoft.hg.util.Path; @@ -107,27 +108,31 @@ final CancelSupport cancellation = getCancelSupport(inspector, true); cancellation.checkCancelled(); progress.start(2); - HgDataFile df = repo.getFileNode(file); - if (!df.exists()) { - return; + try { + HgDataFile df = repo.getFileNode(file); + if (!df.exists()) { + return; + } + final int changesetStart = followRename ? 0 : df.getChangesetRevisionIndex(0); + Collector c = new Collector(cancellation); + FileAnnotation fa = new FileAnnotation(c); + df.annotate(changesetStart, annotateRevision.get(), fa, HgIterateDirection.NewToOld); + progress.worked(1); + c.throwIfCancelled(); + cancellation.checkCancelled(); + ProgressSupport.Sub subProgress = new ProgressSupport.Sub(progress, 1); + subProgress.start(c.lineRevisions.length); + LineImpl li = new LineImpl(); + for (int i = 0; i < c.lineRevisions.length; i++) { + li.init(i+1, c.lineRevisions[i], c.line(i)); + inspector.next(li); + subProgress.worked(1); + cancellation.checkCancelled(); + } + subProgress.done(); + } catch (HgRuntimeException ex) { + throw new HgLibraryFailureException(ex); } - final int changesetStart = followRename ? 0 : df.getChangesetRevisionIndex(0); - Collector c = new Collector(cancellation); - FileAnnotation fa = new FileAnnotation(c); - df.annotate(changesetStart, annotateRevision.get(), fa, HgIterateDirection.NewToOld); - progress.worked(1); - c.throwIfCancelled(); - cancellation.checkCancelled(); - ProgressSupport.Sub subProgress = new ProgressSupport.Sub(progress, 1); - subProgress.start(c.lineRevisions.length); - LineImpl li = new LineImpl(); - for (int i = 0; i < c.lineRevisions.length; i++) { - li.init(i+1, c.lineRevisions[i], c.line(i)); - inspector.next(li); - subProgress.worked(1); - cancellation.checkCancelled(); - } - subProgress.done(); progress.done(); }