Mercurial > hg4j
comparison cmdline/org/tmatesoft/hg/console/Main.java @ 450:03fd8d079e9c smartgit3
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 07 Jun 2012 17:06:23 +0200 |
parents | 5787e912f60e |
children | a0507a9f3da0 |
comparison
equal
deleted
inserted
replaced
449:5787e912f60e | 450:03fd8d079e9c |
---|---|
94 System.out.println("REPO:" + hgRepo.getLocation()); | 94 System.out.println("REPO:" + hgRepo.getLocation()); |
95 } | 95 } |
96 | 96 |
97 public static void main(String[] args) throws Exception { | 97 public static void main(String[] args) throws Exception { |
98 Main m = new Main(args); | 98 Main m = new Main(args); |
99 m.testRevisionDescendants(); | 99 // m.testRevisionDescendants(); |
100 for (int i : new int[] {1,2,3}) { | 100 for (int i : new int[] {1,2,3,4,5}) { |
101 m.dumpPhases(); | 101 // m.dumpPhases(); |
102 } | 102 m.buildFileLog(); |
103 // m.buildFileLog(); | 103 } |
104 // m.testConsoleLog(); | 104 // m.testConsoleLog(); |
105 // m.testTreeTraversal(); | 105 // m.testTreeTraversal(); |
106 // m.testRevisionMap(); | 106 // m.testRevisionMap(); |
107 // m.testSubrepos(); | 107 // m.testSubrepos(); |
108 // m.testReadWorkingCopy(); | 108 // m.testReadWorkingCopy(); |
171 System.out.printf("rev:%3d, phase:%s\n", i, phase[i]); | 171 System.out.printf("rev:%3d, phase:%s\n", i, phase[i]); |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 private void buildFileLog() throws Exception { | 175 private void buildFileLog() throws Exception { |
176 final long start = System.nanoTime(); | |
176 HgLogCommand cmd = new HgLogCommand(hgRepo); | 177 HgLogCommand cmd = new HgLogCommand(hgRepo); |
177 cmd.file("file1", false); | 178 cmd.file("file1", false); |
178 cmd.execute(new HgChangesetTreeHandler() { | 179 cmd.execute(new HgChangesetTreeHandler() { |
179 public void next(HgChangesetTreeHandler.TreeElement entry) { | 180 public void next(HgChangesetTreeHandler.TreeElement entry) { |
180 try { | 181 try { |
188 } | 189 } |
189 final Pair<Nodeid, Nodeid> parents = entry.parentRevisions(); | 190 final Pair<Nodeid, Nodeid> parents = entry.parentRevisions(); |
190 final boolean isJoin = !parents.first().isNull() && !parents.second().isNull(); | 191 final boolean isJoin = !parents.first().isNull() && !parents.second().isNull(); |
191 final boolean isFork = entry.children().size() > 1; | 192 final boolean isFork = entry.children().size() > 1; |
192 final HgChangeset cset = entry.changeset(); | 193 final HgChangeset cset = entry.changeset(); |
193 System.out.printf("%d:%s - %s\n", cset.getRevision(), cset.getNodeid().shortNotation(), cset.getComment()); | 194 System.out.printf("%d:%s - %s (%s)\n", cset.getRevision(), cset.getNodeid().shortNotation(), cset.getComment(), cset.getPhase()); |
194 if (!isJoin && !isFork && !entry.children().isEmpty()) { | 195 if (!isJoin && !isFork && !entry.children().isEmpty()) { |
195 System.out.printf("\t=> %s\n", sb); | 196 System.out.printf("\t=> %s\n", sb); |
196 } | 197 } |
197 if (isJoin) { | 198 if (isJoin) { |
198 HgChangeset p1 = entry.parents().first(); | 199 HgChangeset p1 = entry.parents().first(); |
214 } catch (HgException ex) { | 215 } catch (HgException ex) { |
215 ex.printStackTrace(); | 216 ex.printStackTrace(); |
216 } | 217 } |
217 } | 218 } |
218 }); | 219 }); |
220 final long end = System.nanoTime(); | |
221 System.out.printf("buildFileLog: %,d ms\n", (end-start)/1000); | |
219 } | 222 } |
220 | 223 |
221 private void buildFileLogOld() throws Exception { | 224 private void buildFileLogOld() throws Exception { |
222 final HgDataFile fn = hgRepo.getFileNode("file1"); | 225 final HgDataFile fn = hgRepo.getFileNode("file1"); |
223 final int[] fileChangesetRevisions = new int[fn.getRevisionCount()]; | 226 final int[] fileChangesetRevisions = new int[fn.getRevisionCount()]; |