Mercurial > jhg
comparison cmdline/org/tmatesoft/hg/console/Main.java @ 236:883300108179
Speed up branches calculation when cached branch information is available
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 09 Jun 2011 06:13:43 +0200 |
parents | fd845a53f53d |
children | 6e1373b54e9b |
comparison
equal
deleted
inserted
replaced
235:fd845a53f53d | 236:883300108179 |
---|---|
43 import org.tmatesoft.hg.repo.HgStatusInspector; | 43 import org.tmatesoft.hg.repo.HgStatusInspector; |
44 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector; | 44 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector; |
45 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; | 45 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; |
46 import org.tmatesoft.hg.util.Pair; | 46 import org.tmatesoft.hg.util.Pair; |
47 import org.tmatesoft.hg.util.Path; | 47 import org.tmatesoft.hg.util.Path; |
48 import org.tmatesoft.hg.util.ProgressSupport; | |
48 | 49 |
49 /** | 50 /** |
50 * Various debug dumps. | 51 * Various debug dumps. |
51 * | 52 * |
52 * @author Artem Tikhomirov | 53 * @author Artem Tikhomirov |
67 System.out.println("REPO:" + hgRepo.getLocation()); | 68 System.out.println("REPO:" + hgRepo.getLocation()); |
68 } | 69 } |
69 | 70 |
70 public static void main(String[] args) throws Exception { | 71 public static void main(String[] args) throws Exception { |
71 Main m = new Main(args); | 72 Main m = new Main(args); |
72 m.testParents(); | 73 // m.testParents(); |
73 // m.testEffectiveFileLog(); | 74 // m.testEffectiveFileLog(); |
74 // m.testCatAtCsetRevision(); | 75 // m.testCatAtCsetRevision(); |
75 // m.testMergeState(); | 76 // m.testMergeState(); |
76 // m.testFileStatus(); | 77 // m.testFileStatus(); |
77 // m.dumpBranches(); | 78 m.dumpBranches(); |
78 // m.inflaterLengthException(); | 79 // m.inflaterLengthException(); |
79 // m.dumpIgnored(); | 80 // m.dumpIgnored(); |
80 // m.dumpDirstate(); | 81 // m.dumpDirstate(); |
81 // m.testStatusInternals(); | 82 // m.testStatusInternals(); |
82 // m.catCompleteHistory(); | 83 // m.catCompleteHistory(); |
151 // HgWorkingCopyStatusCollector wcsc = HgWorkingCopyStatusCollector.create(hgRepo, path); | 152 // HgWorkingCopyStatusCollector wcsc = HgWorkingCopyStatusCollector.create(hgRepo, path); |
152 HgWorkingCopyStatusCollector wcsc = HgWorkingCopyStatusCollector.create(hgRepo, new PathGlobMatcher("mi**")); | 153 HgWorkingCopyStatusCollector wcsc = HgWorkingCopyStatusCollector.create(hgRepo, new PathGlobMatcher("mi**")); |
153 wcsc.walk(TIP, new StatusDump()); | 154 wcsc.walk(TIP, new StatusDump()); |
154 } | 155 } |
155 | 156 |
157 /* | |
158 * Straightforward approach to collect branches, no use of branchheads.cache | |
159 * First, single run - 18 563 | |
160 * 10 runs (after 1 warm up) of HgBranches.collect took 167391 ms, ~17 seconds per run. | |
161 */ | |
156 private void dumpBranches() { | 162 private void dumpBranches() { |
163 final long start0 = System.currentTimeMillis(); | |
157 HgBranches b = hgRepo.getBranches(); | 164 HgBranches b = hgRepo.getBranches(); |
165 System.out.println("1:" + (System.currentTimeMillis() - start0)); | |
158 for (HgBranches.BranchInfo bi : b.getAllBranches()) { | 166 for (HgBranches.BranchInfo bi : b.getAllBranches()) { |
159 System.out.print(bi.getName()); | 167 System.out.print(bi.getName()); |
160 if (bi.isClosed()) { | 168 // if (bi.isClosed()) { |
161 System.out.print("!"); | 169 // System.out.print("!"); |
162 } | 170 // } |
163 System.out.print(" "); | 171 // System.out.print(" "); |
164 System.out.print(bi.getStart()); | 172 // System.out.print(bi.getStart()); |
165 System.out.print(" "); | 173 System.out.print(" "); |
166 System.out.println(bi.getHeads()); | 174 System.out.println(bi.getHeads()); |
167 } | 175 } |
176 // final long start = System.currentTimeMillis(); | |
177 // for (int i = 0; i < 10; i++) { | |
178 // b.collect(ProgressSupport.Factory.get(null)); | |
179 // } | |
180 // System.out.println("10:" + (System.currentTimeMillis() - start)); | |
168 } | 181 } |
169 | 182 |
170 private void inflaterLengthException() throws Exception { | 183 private void inflaterLengthException() throws Exception { |
171 HgDataFile f1 = hgRepo.getFileNode("src/com/tmate/hgkit/console/Bundle.java"); | 184 HgDataFile f1 = hgRepo.getFileNode("src/com/tmate/hgkit/console/Bundle.java"); |
172 HgDataFile f2 = hgRepo.getFileNode("test-repos.jar"); | 185 HgDataFile f2 = hgRepo.getFileNode("test-repos.jar"); |