Mercurial > hg4j
comparison cmdline/org/tmatesoft/hg/console/Main.java @ 425:48f993aa2f41
FIXMEs: exceptions, javadoc
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Wed, 28 Mar 2012 18:39:29 +0200 |
| parents | 6437d261048a |
| children | 063b0663495a |
comparison
equal
deleted
inserted
replaced
| 424:6437d261048a | 425:48f993aa2f41 |
|---|---|
| 36 import org.tmatesoft.hg.core.HgException; | 36 import org.tmatesoft.hg.core.HgException; |
| 37 import org.tmatesoft.hg.core.HgFileRevision; | 37 import org.tmatesoft.hg.core.HgFileRevision; |
| 38 import org.tmatesoft.hg.core.HgLogCommand; | 38 import org.tmatesoft.hg.core.HgLogCommand; |
| 39 import org.tmatesoft.hg.core.HgManifestCommand; | 39 import org.tmatesoft.hg.core.HgManifestCommand; |
| 40 import org.tmatesoft.hg.core.Nodeid; | 40 import org.tmatesoft.hg.core.Nodeid; |
| 41 import org.tmatesoft.hg.internal.BasicSessionContext; | |
| 41 import org.tmatesoft.hg.internal.ByteArrayChannel; | 42 import org.tmatesoft.hg.internal.ByteArrayChannel; |
| 42 import org.tmatesoft.hg.internal.DigestHelper; | 43 import org.tmatesoft.hg.internal.DigestHelper; |
| 43 import org.tmatesoft.hg.internal.PathGlobMatcher; | 44 import org.tmatesoft.hg.internal.PathGlobMatcher; |
| 44 import org.tmatesoft.hg.internal.RelativePathRewrite; | 45 import org.tmatesoft.hg.internal.RelativePathRewrite; |
| 45 import org.tmatesoft.hg.internal.StreamLogFacility; | 46 import org.tmatesoft.hg.internal.StreamLogFacility; |
| 65 import org.tmatesoft.hg.util.FileWalker; | 66 import org.tmatesoft.hg.util.FileWalker; |
| 66 import org.tmatesoft.hg.util.LogFacility; | 67 import org.tmatesoft.hg.util.LogFacility; |
| 67 import org.tmatesoft.hg.util.Pair; | 68 import org.tmatesoft.hg.util.Pair; |
| 68 import org.tmatesoft.hg.util.Path; | 69 import org.tmatesoft.hg.util.Path; |
| 69 import org.tmatesoft.hg.util.PathRewrite; | 70 import org.tmatesoft.hg.util.PathRewrite; |
| 71 import org.tmatesoft.hg.util.ProgressSupport; | |
| 70 | 72 |
| 71 /** | 73 /** |
| 72 * Various debug dumps. | 74 * Various debug dumps. |
| 73 * | 75 * |
| 74 * @author Artem Tikhomirov | 76 * @author Artem Tikhomirov |
| 90 System.out.println("REPO:" + hgRepo.getLocation()); | 92 System.out.println("REPO:" + hgRepo.getLocation()); |
| 91 } | 93 } |
| 92 | 94 |
| 93 public static void main(String[] args) throws Exception { | 95 public static void main(String[] args) throws Exception { |
| 94 Main m = new Main(args); | 96 Main m = new Main(args); |
| 95 m.checkFileFlags(); | 97 m.checkSubProgress(); |
| 98 // m.checkFileFlags(); | |
| 96 // m.buildFileLog(); | 99 // m.buildFileLog(); |
| 97 // m.testConsoleLog(); | 100 // m.testConsoleLog(); |
| 98 // m.testTreeTraversal(); | 101 // m.testTreeTraversal(); |
| 99 // m.testRevisionMap(); | 102 // m.testRevisionMap(); |
| 100 // m.testSubrepos(); | 103 // m.testSubrepos(); |
| 111 // m.testStatusInternals(); | 114 // m.testStatusInternals(); |
| 112 // m.catCompleteHistory(); | 115 // m.catCompleteHistory(); |
| 113 // m.dumpCompleteManifestLow(); | 116 // m.dumpCompleteManifestLow(); |
| 114 // m.dumpCompleteManifestHigh(); | 117 // m.dumpCompleteManifestHigh(); |
| 115 // m.bunchOfTests(); | 118 // m.bunchOfTests(); |
| 119 } | |
| 120 | |
| 121 // no repo | |
| 122 private void checkSubProgress() { | |
| 123 ProgressSupport ps = new ProgressSupport() { | |
| 124 private int units; | |
| 125 | |
| 126 public void start(int totalUnits) { | |
| 127 units = totalUnits; | |
| 128 System.out.printf("%d:", totalUnits); | |
| 129 | |
| 130 } | |
| 131 public void worked(int wu) { | |
| 132 for (int i = 0; i < wu; i++) { | |
| 133 System.out.print(units-- == 0 ? '!' : '.'); | |
| 134 } | |
| 135 } | |
| 136 public void done() { | |
| 137 System.out.println("DONE"); | |
| 138 } | |
| 139 }; | |
| 140 ps.start(10); | |
| 141 ProgressSupport.Sub s1 = new ProgressSupport.Sub(ps, 3); | |
| 142 ProgressSupport.Sub s2 = new ProgressSupport.Sub(ps, 7); | |
| 143 s1.start(10); | |
| 144 s1.worked(1); | |
| 145 s1.worked(2); | |
| 146 s1.worked(3); | |
| 147 s1.worked(4); | |
| 148 s1.done(); | |
| 149 // | |
| 150 s2.start(5); | |
| 151 s2.worked(3); | |
| 152 s2.worked(2); | |
| 153 s2.done(); | |
| 116 } | 154 } |
| 117 | 155 |
| 118 private void checkFileFlags() throws Exception { | 156 private void checkFileFlags() throws Exception { |
| 119 // ~/hg/test-flags repo | 157 // ~/hg/test-flags repo |
| 120 // TODO transform to a test once I keep test-flags in test-repos.jar | 158 // TODO transform to a test once I keep test-flags in test-repos.jar |
| 216 } | 254 } |
| 217 | 255 |
| 218 private void testTreeTraversal() throws Exception { | 256 private void testTreeTraversal() throws Exception { |
| 219 File repoRoot = hgRepo.getWorkingDir(); | 257 File repoRoot = hgRepo.getWorkingDir(); |
| 220 Path.Source pathSrc = new Path.SimpleSource(new PathRewrite.Composite(new RelativePathRewrite(repoRoot), hgRepo.getToRepoPathHelper())); | 258 Path.Source pathSrc = new Path.SimpleSource(new PathRewrite.Composite(new RelativePathRewrite(repoRoot), hgRepo.getToRepoPathHelper())); |
| 221 FileWalker w = new FileWalker(repoRoot, pathSrc); | 259 FileWalker w = new FileWalker(new BasicSessionContext(null, null), repoRoot, pathSrc); |
| 222 int count = 0; | 260 int count = 0; |
| 223 final long start = System.currentTimeMillis(); | 261 final long start = System.currentTimeMillis(); |
| 224 while (w.hasNext()) { | 262 while (w.hasNext()) { |
| 225 count++; | 263 count++; |
| 226 w.next(); | 264 w.next(); |
