Mercurial > hg4j
comparison cmdline/org/tmatesoft/hg/console/Log.java @ 197:3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 19 Apr 2011 03:49:29 +0200 |
parents | b9700740553a |
children | 33a7d76f067b |
comparison
equal
deleted
inserted
replaced
196:e2115da4cf6a | 197:3a7696fb457c |
---|---|
33 * @author Artem Tikhomirov | 33 * @author Artem Tikhomirov |
34 * @author TMate Software Ltd. | 34 * @author TMate Software Ltd. |
35 */ | 35 */ |
36 public class Log { | 36 public class Log { |
37 | 37 |
38 // -agentlib:hprof=heap=sites,depth=10,etc might be handy to debug speed/memory issues | |
39 | |
38 public static void main(String[] args) throws Exception { | 40 public static void main(String[] args) throws Exception { |
39 Options cmdLineOpts = Options.parse(args); | 41 Options cmdLineOpts = Options.parse(args); |
40 HgRepository hgRepo = cmdLineOpts.findRepository(); | 42 HgRepository hgRepo = cmdLineOpts.findRepository(); |
41 if (hgRepo.isInvalid()) { | 43 if (hgRepo.isInvalid()) { |
42 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); | 44 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); |
43 return; | 45 return; |
44 } | 46 } |
45 final Dump dump = new Dump(hgRepo); | 47 final Dump dump = new Dump(hgRepo); |
46 dump.complete = cmdLineOpts.getBoolean("--debug"); | 48 dump.complete = cmdLineOpts.getBoolean("--debug"); |
47 dump.verbose = cmdLineOpts.getBoolean("-v", "--verbose"); | 49 dump.verbose = cmdLineOpts.getBoolean("-v", "--verbose"); |
48 dump.reverseOrder = true; | 50 dump.reverseOrder = false; |
49 HgLogCommand cmd = new HgLogCommand(hgRepo); | 51 HgLogCommand cmd = new HgLogCommand(hgRepo); |
50 for (String u : cmdLineOpts.getList("-u", "--user")) { | 52 for (String u : cmdLineOpts.getList("-u", "--user")) { |
51 cmd.user(u); | 53 cmd.user(u); |
52 } | 54 } |
53 for (String b : cmdLineOpts.getList("-b", "--branches")) { | 55 for (String b : cmdLineOpts.getList("-b", "--branches")) { |
56 int limit = cmdLineOpts.getSingleInt(-1, "-l", "--limit"); | 58 int limit = cmdLineOpts.getSingleInt(-1, "-l", "--limit"); |
57 if (limit != -1) { | 59 if (limit != -1) { |
58 cmd.limit(limit); | 60 cmd.limit(limit); |
59 } | 61 } |
60 List<String> files = cmdLineOpts.getList(""); | 62 List<String> files = cmdLineOpts.getList(""); |
63 final long start = System.currentTimeMillis(); | |
61 if (files.isEmpty()) { | 64 if (files.isEmpty()) { |
62 if (limit == -1) { | 65 if (limit == -1) { |
63 // no revisions and no limit | 66 // no revisions and no limit |
64 cmd.execute(dump); | 67 cmd.execute(dump); |
65 } else { | 68 } else { |
88 cmd.range(r[0], r[1]).file(f1.getPath(), true).execute(dump); | 91 cmd.range(r[0], r[1]).file(f1.getPath(), true).execute(dump); |
89 } | 92 } |
90 dump.complete(); | 93 dump.complete(); |
91 } | 94 } |
92 } | 95 } |
93 // | 96 // cmd = null; |
94 // XXX new ChangelogWalker().setFile("hello.c").setRevisionRange(1, 4).accept(new Visitor); | 97 System.out.println("Total time:" + (System.currentTimeMillis() - start)); |
98 // Main.force_gc(); | |
95 } | 99 } |
96 | 100 |
97 private static int fixRange(int[] start_end, boolean reverse, int limit) { | 101 private static int fixRange(int[] start_end, boolean reverse, int limit) { |
98 assert start_end.length == 2; | 102 assert start_end.length == 2; |
99 if (limit < start_end[1]) { | 103 if (limit < start_end[1]) { |