comparison cmdline/org/tmatesoft/hg/console/Log.java @ 215:41a778e3fd31

Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 17 May 2011 00:56:54 +0200
parents 63c9fed4369e
children 4c3b9f679412
comparison
equal deleted inserted replaced
214:4252faa556cd 215:41a778e3fd31
20 20
21 import org.tmatesoft.hg.core.HgLogCommand; 21 import org.tmatesoft.hg.core.HgLogCommand;
22 import org.tmatesoft.hg.core.HgLogCommand.FileRevision; 22 import org.tmatesoft.hg.core.HgLogCommand.FileRevision;
23 import org.tmatesoft.hg.repo.HgDataFile; 23 import org.tmatesoft.hg.repo.HgDataFile;
24 import org.tmatesoft.hg.repo.HgRepository; 24 import org.tmatesoft.hg.repo.HgRepository;
25 import org.tmatesoft.hg.util.CancelSupport;
26 import org.tmatesoft.hg.util.ProgressSupport;
25 27
26 28
27 /** 29 /**
28 * @author Artem Tikhomirov 30 * @author Artem Tikhomirov
29 * @author TMate Software Ltd. 31 * @author TMate Software Ltd.
37 HgRepository hgRepo = cmdLineOpts.findRepository(); 39 HgRepository hgRepo = cmdLineOpts.findRepository();
38 if (hgRepo.isInvalid()) { 40 if (hgRepo.isInvalid()) {
39 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); 41 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation());
40 return; 42 return;
41 } 43 }
44 //
45 // in fact, neither cancel nor progress of any use, need them just to check comamnd API
46 final CancelSupport noCancel = CancelSupport.Factory.get(null);
47 final ProgressSupport noProgress = ProgressSupport.Factory.get(null);
48 //
42 final Dump dump = new Dump(hgRepo); 49 final Dump dump = new Dump(hgRepo);
43 dump.complete(cmdLineOpts.getBoolean("--debug")); 50 dump.complete(cmdLineOpts.getBoolean("--debug"));
44 dump.verbose(cmdLineOpts.getBoolean("-v", "--verbose")); 51 dump.verbose(cmdLineOpts.getBoolean("-v", "--verbose"));
45 final boolean reverseOrder = true; 52 final boolean reverseOrder = true;
46 dump.reversed(reverseOrder); 53 dump.reversed(reverseOrder);
53 } 60 }
54 int limit = cmdLineOpts.getSingleInt(-1, "-l", "--limit"); 61 int limit = cmdLineOpts.getSingleInt(-1, "-l", "--limit");
55 if (limit != -1) { 62 if (limit != -1) {
56 cmd.limit(limit); 63 cmd.limit(limit);
57 } 64 }
65 cmd.set(noCancel).set(noProgress);
58 List<String> files = cmdLineOpts.getList(""); 66 List<String> files = cmdLineOpts.getList("");
59 final long start = System.currentTimeMillis(); 67 final long start = System.currentTimeMillis();
60 if (files.isEmpty()) { 68 if (files.isEmpty()) {
61 if (limit == -1) { 69 if (limit == -1) {
62 // no revisions and no limit 70 // no revisions and no limit