Mercurial > hg4j
comparison test/org/tmatesoft/hg/test/TestHistory.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 | 645829962785 |
children | 4a948ec83980 |
comparison
equal
deleted
inserted
replaced
130:7567f4a42fe5 | 131:aa1629f36482 |
---|---|
27 | 27 |
28 import org.hamcrest.CoreMatchers; | 28 import org.hamcrest.CoreMatchers; |
29 import org.junit.Rule; | 29 import org.junit.Rule; |
30 import org.junit.Test; | 30 import org.junit.Test; |
31 import org.tmatesoft.hg.core.HgChangeset; | 31 import org.tmatesoft.hg.core.HgChangeset; |
32 import org.tmatesoft.hg.core.LogCommand; | 32 import org.tmatesoft.hg.core.HgLogCommand; |
33 import org.tmatesoft.hg.core.LogCommand.CollectHandler; | 33 import org.tmatesoft.hg.core.HgLogCommand.CollectHandler; |
34 import org.tmatesoft.hg.core.LogCommand.FileHistoryHandler; | 34 import org.tmatesoft.hg.core.HgLogCommand.FileHistoryHandler; |
35 import org.tmatesoft.hg.core.LogCommand.FileRevision; | 35 import org.tmatesoft.hg.core.HgLogCommand.FileRevision; |
36 import org.tmatesoft.hg.core.Path; | 36 import org.tmatesoft.hg.core.Path; |
37 import org.tmatesoft.hg.repo.HgLookup; | 37 import org.tmatesoft.hg.repo.HgLookup; |
38 import org.tmatesoft.hg.repo.HgRepository; | 38 import org.tmatesoft.hg.repo.HgRepository; |
39 import org.tmatesoft.hg.test.LogOutputParser.Record; | 39 import org.tmatesoft.hg.test.LogOutputParser.Record; |
40 | 40 |
72 | 72 |
73 @Test | 73 @Test |
74 public void testCompleteLog() throws Exception { | 74 public void testCompleteLog() throws Exception { |
75 changelogParser.reset(); | 75 changelogParser.reset(); |
76 eh.run("hg", "log", "--debug"); | 76 eh.run("hg", "log", "--debug"); |
77 List<HgChangeset> r = new LogCommand(repo).execute(); | 77 List<HgChangeset> r = new HgLogCommand(repo).execute(); |
78 report("hg log - COMPLETE REPO HISTORY", r, true); | 78 report("hg log - COMPLETE REPO HISTORY", r, true); |
79 } | 79 } |
80 | 80 |
81 @Test | 81 @Test |
82 public void testFollowHistory() throws Exception { | 82 public void testFollowHistory() throws Exception { |
93 copyReported = true; | 93 copyReported = true; |
94 fromMatched = "src/com/tmate/hgkit/console/Remote.java".equals(from.getPath().toString()); | 94 fromMatched = "src/com/tmate/hgkit/console/Remote.java".equals(from.getPath().toString()); |
95 } | 95 } |
96 }; | 96 }; |
97 H h = new H(); | 97 H h = new H(); |
98 new LogCommand(repo).file(f, true).execute(h); | 98 new HgLogCommand(repo).file(f, true).execute(h); |
99 String what = "hg log - FOLLOW FILE HISTORY"; | 99 String what = "hg log - FOLLOW FILE HISTORY"; |
100 errorCollector.checkThat(what + "#copyReported ", h.copyReported, is(true)); | 100 errorCollector.checkThat(what + "#copyReported ", h.copyReported, is(true)); |
101 errorCollector.checkThat(what + "#copyFromMatched", h.fromMatched, is(true)); | 101 errorCollector.checkThat(what + "#copyFromMatched", h.fromMatched, is(true)); |
102 // | 102 // |
103 // cmdline always gives in changesets in order from newest (bigger rev number) to oldest. | 103 // cmdline always gives in changesets in order from newest (bigger rev number) to oldest. |
142 changelogParser.reset(); | 142 changelogParser.reset(); |
143 eh.run("hg", "log", "--debug"); | 143 eh.run("hg", "log", "--debug"); |
144 } | 144 } |
145 final long start2 = System.currentTimeMillis(); | 145 final long start2 = System.currentTimeMillis(); |
146 for (int i = 0; i < runs; i++) { | 146 for (int i = 0; i < runs; i++) { |
147 new LogCommand(repo).execute(); | 147 new HgLogCommand(repo).execute(); |
148 } | 148 } |
149 final long end = System.currentTimeMillis(); | 149 final long end = System.currentTimeMillis(); |
150 System.out.printf("'hg log --debug', %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); | 150 System.out.printf("'hg log --debug', %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); |
151 } | 151 } |
152 } | 152 } |