Mercurial > hg4j
comparison test/org/tmatesoft/hg/test/TestPhases.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 | fedc54356091 |
children | 690e71d29bf6 |
comparison
equal
deleted
inserted
replaced
627:5153eb73b18d | 628:6526d8adbc0f |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 TMate Software Ltd | 2 * Copyright (c) 2012-2013 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 * |
28 import org.tmatesoft.hg.repo.HgInternals; | 28 import org.tmatesoft.hg.repo.HgInternals; |
29 import org.tmatesoft.hg.repo.HgLookup; | 29 import org.tmatesoft.hg.repo.HgLookup; |
30 import org.tmatesoft.hg.repo.HgParentChildMap; | 30 import org.tmatesoft.hg.repo.HgParentChildMap; |
31 import org.tmatesoft.hg.repo.HgPhase; | 31 import org.tmatesoft.hg.repo.HgPhase; |
32 import org.tmatesoft.hg.repo.HgRepository; | 32 import org.tmatesoft.hg.repo.HgRepository; |
33 import org.tmatesoft.hg.repo.HgRuntimeException; | |
33 | 34 |
34 /** | 35 /** |
35 * {hg4j.tests.repos}/test-phases/ | 36 * {hg4j.tests.repos}/test-phases/ |
36 * @author Artem Tikhomirov | 37 * @author Artem Tikhomirov |
37 * @author TMate Software Ltd. | 38 * @author TMate Software Ltd. |
65 initAndCheck(ph, expected); | 66 initAndCheck(ph, expected); |
66 final long end = System.nanoTime(); | 67 final long end = System.nanoTime(); |
67 System.out.printf("With ParentWalker(simulates log command for whole repo): %,d μs (pw init: %,d ns)\n", (end - start1)/1000, start2 - start1); | 68 System.out.printf("With ParentWalker(simulates log command for whole repo): %,d μs (pw init: %,d ns)\n", (end - start1)/1000, start2 - start1); |
68 } | 69 } |
69 | 70 |
70 private HgPhase[] initAndCheck(PhasesHelper ph, HgPhase[] expected) { | 71 private HgPhase[] initAndCheck(PhasesHelper ph, HgPhase[] expected) throws HgRuntimeException { |
71 HgChangelog clog = ph.getRepo().getChangelog(); | 72 HgChangelog clog = ph.getRepo().getChangelog(); |
72 HgPhase[] result = new HgPhase[clog.getRevisionCount()]; | 73 HgPhase[] result = new HgPhase[clog.getRevisionCount()]; |
73 for (int i = 0, l = clog.getLastRevision(); i <= l; i++) { | 74 for (int i = 0, l = clog.getLastRevision(); i <= l; i++) { |
74 result[i] = ph.getPhase(i, null); | 75 result[i] = ph.getPhase(i, null); |
75 } | 76 } |