Mercurial > hg4j
comparison test/org/tmatesoft/hg/test/TestStatus.java @ 131:aa1629f36482
Renamed .core classes to start with Hg prefix
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 16 Feb 2011 20:47:56 +0100 |
parents | 2e395db595e2 |
children | 4a948ec83980 |
comparison
equal
deleted
inserted
replaced
130:7567f4a42fe5 | 131:aa1629f36482 |
---|---|
32 import org.junit.Assume; | 32 import org.junit.Assume; |
33 import org.junit.Rule; | 33 import org.junit.Rule; |
34 import org.junit.Test; | 34 import org.junit.Test; |
35 import org.tmatesoft.hg.core.HgStatus; | 35 import org.tmatesoft.hg.core.HgStatus; |
36 import org.tmatesoft.hg.core.Path; | 36 import org.tmatesoft.hg.core.Path; |
37 import org.tmatesoft.hg.core.StatusCommand; | 37 import org.tmatesoft.hg.core.HgStatusCommand; |
38 import org.tmatesoft.hg.repo.HgLookup; | 38 import org.tmatesoft.hg.repo.HgLookup; |
39 import org.tmatesoft.hg.repo.HgRepository; | 39 import org.tmatesoft.hg.repo.HgRepository; |
40 import org.tmatesoft.hg.repo.HgStatusCollector; | 40 import org.tmatesoft.hg.repo.HgStatusCollector; |
41 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector; | 41 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector; |
42 | 42 |
102 report("Status -A -rev " + range, r, statusParser); | 102 report("Status -A -rev " + range, r, statusParser); |
103 } | 103 } |
104 | 104 |
105 @Test | 105 @Test |
106 public void testStatusCommand() throws Exception { | 106 public void testStatusCommand() throws Exception { |
107 final StatusCommand sc = new StatusCommand(repo).all(); | 107 final HgStatusCommand sc = new HgStatusCommand(repo).all(); |
108 StatusCollector r; | 108 StatusCollector r; |
109 statusParser.reset(); | 109 statusParser.reset(); |
110 eh.run("hg", "status", "-A"); | 110 eh.run("hg", "status", "-A"); |
111 sc.execute(r = new StatusCollector()); | 111 sc.execute(r = new StatusCollector()); |
112 report("hg status -A", r); | 112 report("hg status -A", r); |
123 report("status -A --change " + revision, r); | 123 report("status -A --change " + revision, r); |
124 | 124 |
125 // TODO check not -A, but defaults()/custom set of modifications | 125 // TODO check not -A, but defaults()/custom set of modifications |
126 } | 126 } |
127 | 127 |
128 private static class StatusCollector implements StatusCommand.Handler { | 128 private static class StatusCollector implements HgStatusCommand.Handler { |
129 private final Map<HgStatus.Kind, List<Path>> map = new TreeMap<HgStatus.Kind, List<Path>>(); | 129 private final Map<HgStatus.Kind, List<Path>> map = new TreeMap<HgStatus.Kind, List<Path>>(); |
130 | 130 |
131 public void handleStatus(HgStatus s) { | 131 public void handleStatus(HgStatus s) { |
132 List<Path> l = map.get(s.getKind()); | 132 List<Path> l = map.get(s.getKind()); |
133 if (l == null) { | 133 if (l == null) { |
168 eh.run("hg", "status", "-A", "--rev", "3:80"); | 168 eh.run("hg", "status", "-A", "--rev", "3:80"); |
169 } | 169 } |
170 final long start2 = System.currentTimeMillis(); | 170 final long start2 = System.currentTimeMillis(); |
171 for (int i = 0; i < runs; i++) { | 171 for (int i = 0; i < runs; i++) { |
172 StatusCollector r = new StatusCollector(); | 172 StatusCollector r = new StatusCollector(); |
173 new StatusCommand(repo).all().base(3).revision(80).execute(r); | 173 new HgStatusCommand(repo).all().base(3).revision(80).execute(r); |
174 } | 174 } |
175 final long end = System.currentTimeMillis(); | 175 final long end = System.currentTimeMillis(); |
176 System.out.printf("'hg status -A --rev 3:80', %d runs: Native client total %d (%d per run), Java client %d (%d)\n", runs, start2-start1, (start2-start1)/runs, end-start2, (end-start2)/runs); | 176 System.out.printf("'hg status -A --rev 3:80', %d runs: Native client total %d (%d per run), Java client %d (%d)\n", runs, start2-start1, (start2-start1)/runs, end-start2, (end-start2)/runs); |
177 } | 177 } |
178 | 178 |