comparison cmdline/org/tmatesoft/hg/console/Main.java @ 242:ad6a046943be

Improved reading of sparse revisions from a revlog
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 23 Jun 2011 15:19:07 +0200
parents df9d2854d3d6
children 0e01f9182e16
comparison
equal deleted inserted replaced
241:d3ab16739736 242:ad6a046943be
70 System.out.println("REPO:" + hgRepo.getLocation()); 70 System.out.println("REPO:" + hgRepo.getLocation());
71 } 71 }
72 72
73 public static void main(String[] args) throws Exception { 73 public static void main(String[] args) throws Exception {
74 Main m = new Main(args); 74 Main m = new Main(args);
75 m.testSubrepos(); 75 // m.testSubrepos();
76 // m.testReadWorkingCopy(); 76 // m.testReadWorkingCopy();
77 // m.testParents(); 77 // m.testParents();
78 // m.testEffectiveFileLog(); 78 m.testEffectiveFileLog();
79 // m.testCatAtCsetRevision(); 79 // m.testCatAtCsetRevision();
80 // m.testMergeState(); 80 // m.testMergeState();
81 // m.testFileStatus(); 81 // m.testFileStatus();
82 // m.dumpBranches(); 82 // m.dumpBranches();
83 // m.inflaterLengthException(); 83 // m.inflaterLengthException();
130 int x = clog.getLocalRevision(wcParents.second()); 130 int x = clog.getLocalRevision(wcParents.second());
131 cmd.range(x, x).execute(dump); 131 cmd.range(x, x).execute(dump);
132 } 132 }
133 } 133 }
134 134
135 // -R \temp\hg\hg4j-50 src/org/tmatesoft/hg/internal/RevlogStream.java 135 /*
136 * -R \temp\hg\hg4j-50 src/org/tmatesoft/hg/internal/RevlogStream.java
137 *
138 * -R \temp\hg\cpython Lib/doctest.py, range 15907..68588, total 251 revision
139 * no improvement (collect linkRev, hgchangelog.range([])) 10890 ms
140 * improved history logic in HgDataFile (minimize reads of close revisions):
141 * with no sort (defect for tool-created repos) took 10500 ms
142 * with sort (to order revisions from linkRev before use) 610 ms
143 * HgChangelog.range() - 92 calls
144 * RevlogStream with separate iterate(int[] sortedRevisions,...)
145 * RevlogStream.ReaderN1.range(): 185 380 ms
146 */
136 private void testEffectiveFileLog() { 147 private void testEffectiveFileLog() {
137 for (String fname : cmdLineOpts.getList("")) { 148 for (String fname : cmdLineOpts.getList("")) {
138 System.out.println(fname); 149 System.out.println(fname);
150 final long start = System.currentTimeMillis();
139 HgDataFile fn = hgRepo.getFileNode(fname); 151 HgDataFile fn = hgRepo.getFileNode(fname);
140 if (fn.exists()) { 152 if (fn.exists()) {
141 fn.history(new HgChangelog.Inspector() { 153 fn.history(new HgChangelog.Inspector() {
142 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) { 154 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) {
143 System.out.printf("%d:%s\n", revisionNumber, nodeid); 155 System.out.printf("%d:%s\n", revisionNumber, nodeid);
144 } 156 }
145 }); 157 });
146 } 158 }
159 System.out.printf("Done: %d\n", System.currentTimeMillis() - start);
147 } 160 }
148 } 161 }
149 162
150 // TODO as test in TestCat 163 // TODO as test in TestCat
151 private void testCatAtCsetRevision() throws Exception { 164 private void testCatAtCsetRevision() throws Exception {