Mercurial > hg4j
comparison cmdline/org/tmatesoft/hg/console/Main.java @ 478:e74580e24feb
Test for subprogress
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 12 Jul 2012 19:11:12 +0200 |
parents | 9c9d09111aee |
children | 59b7c817bc4d |
comparison
equal
deleted
inserted
replaced
477:9c9d09111aee | 478:e74580e24feb |
---|---|
104 } | 104 } |
105 | 105 |
106 public static void main(String[] args) throws Exception { | 106 public static void main(String[] args) throws Exception { |
107 Main m = new Main(args); | 107 Main m = new Main(args); |
108 // m.checkWalkFileRevisions(); | 108 // m.checkWalkFileRevisions(); |
109 // m.checkSubProgress(); | |
110 // m.buildFileLog(); | 109 // m.buildFileLog(); |
111 // m.testConsoleLog(); | 110 // m.testConsoleLog(); |
112 // m.testTreeTraversal(); | 111 // m.testTreeTraversal(); |
113 // m.testRevisionMap(); | 112 // m.testRevisionMap(); |
114 // m.testSubrepos(); | 113 // m.testSubrepos(); |
131 | 130 |
132 // hg4j repo | 131 // hg4j repo |
133 public void checkWalkFileRevisions() throws Exception { | 132 public void checkWalkFileRevisions() throws Exception { |
134 // hg --debug manifest --rev 150 | grep cmdline/org/tmatesoft/hg/console/Main.java | 133 // hg --debug manifest --rev 150 | grep cmdline/org/tmatesoft/hg/console/Main.java |
135 hgRepo.getManifest().walkFileRevisions(Path.create("cmdline/org/tmatesoft/hg/console/Main.java"), new ManifestDump(), 100, 150, 200, 210, 300); | 134 hgRepo.getManifest().walkFileRevisions(Path.create("cmdline/org/tmatesoft/hg/console/Main.java"), new ManifestDump(), 100, 150, 200, 210, 300); |
136 } | |
137 | |
138 // no repo | |
139 // FIXME as test, perhaps in TestAuxUtilities | |
140 private void checkSubProgress() { | |
141 ProgressSupport ps = new ProgressSupport() { | |
142 private int units; | |
143 | |
144 public void start(int totalUnits) { | |
145 units = totalUnits; | |
146 System.out.printf("%d:", totalUnits); | |
147 | |
148 } | |
149 public void worked(int wu) { | |
150 for (int i = 0; i < wu; i++) { | |
151 System.out.print(units-- == 0 ? '!' : '.'); | |
152 } | |
153 } | |
154 public void done() { | |
155 System.out.println("DONE"); | |
156 } | |
157 }; | |
158 ps.start(10); | |
159 ProgressSupport.Sub s1 = new ProgressSupport.Sub(ps, 3); | |
160 ProgressSupport.Sub s2 = new ProgressSupport.Sub(ps, 7); | |
161 s1.start(10); | |
162 s1.worked(1); | |
163 s1.worked(2); | |
164 s1.worked(3); | |
165 s1.worked(4); | |
166 s1.done(); | |
167 // | |
168 s2.start(5); | |
169 s2.worked(3); | |
170 s2.worked(2); | |
171 s2.done(); | |
172 } | 135 } |
173 | 136 |
174 private void buildFileLog() throws Exception { | 137 private void buildFileLog() throws Exception { |
175 final long start = System.nanoTime(); | 138 final long start = System.nanoTime(); |
176 HgLogCommand cmd = new HgLogCommand(hgRepo); | 139 HgLogCommand cmd = new HgLogCommand(hgRepo); |