comparison test/org/tmatesoft/hg/test/TestHistory.java @ 462:ad0322a4af20

Update tests not to fail with Mercurial 2.2 changes, run tests with gradle
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 20 Jun 2012 16:52:39 +0200
parents 31a89587eb04
children 3ca4ae7bdd38
comparison
equal deleted inserted replaced
461:613c883e360e 462:ad0322a4af20
29 29
30 import org.junit.Rule; 30 import org.junit.Rule;
31 import org.junit.Test; 31 import org.junit.Test;
32 import org.tmatesoft.hg.core.HgChangeset; 32 import org.tmatesoft.hg.core.HgChangeset;
33 import org.tmatesoft.hg.core.HgChangesetHandler; 33 import org.tmatesoft.hg.core.HgChangesetHandler;
34 import org.tmatesoft.hg.core.HgChangesetHandler.WithCopyHistory;
35 import org.tmatesoft.hg.core.HgFileRevision; 34 import org.tmatesoft.hg.core.HgFileRevision;
36 import org.tmatesoft.hg.core.HgLogCommand; 35 import org.tmatesoft.hg.core.HgLogCommand;
37 import org.tmatesoft.hg.core.HgLogCommand.CollectHandler; 36 import org.tmatesoft.hg.core.HgLogCommand.CollectHandler;
38 import org.tmatesoft.hg.repo.HgLookup; 37 import org.tmatesoft.hg.repo.HgLookup;
39 import org.tmatesoft.hg.repo.HgRepository; 38 import org.tmatesoft.hg.repo.HgRepository;
166 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); 165 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);
167 } 166 }
168 167
169 @Test 168 @Test
170 public void testOriginalTestLogRepo() throws Exception { 169 public void testOriginalTestLogRepo() throws Exception {
170 // tests fro mercurial distribution, test-log.t
171 repo = Configuration.get().find("log-1"); 171 repo = Configuration.get().find("log-1");
172 HgLogCommand cmd = new HgLogCommand(repo); 172 HgLogCommand cmd = new HgLogCommand(repo);
173 // funny enough, but hg log -vf a -R c:\temp\hg\test-log\a doesn't work, while --cwd <same> works fine 173 // funny enough, but hg log -vf a -R c:\temp\hg\test-log\a doesn't work, while --cwd <same> works fine
174 // 174 //
175 changelogParser.reset(); 175 changelogParser.reset();
176 eh.run("hg", "log", "--debug", "a", "--cwd", repo.getLocation()); 176 eh.run("hg", "log", "--debug", "a", "--cwd", repo.getLocation());
177 report("log a", cmd.file("a", false).execute(), true); 177 report("log a", cmd.file("a", false).execute(), true);
178 // 178 //
179 changelogParser.reset(); 179 changelogParser.reset();
180 // fails with Mercurial 2.2.1, @see http://selenic.com/pipermail/mercurial-devel/2012-February/038249.html
181 // and http://www.selenic.com/hg/rev/60101427d618?rev=
182 /* FIXME either fix test to update to revision 2, where a was still present, or change command to fail/report problem
180 eh.run("hg", "log", "--debug", "-f", "a", "--cwd", repo.getLocation()); 183 eh.run("hg", "log", "--debug", "-f", "a", "--cwd", repo.getLocation());
181 List<HgChangeset> r = cmd.file("a", true).execute(); 184 List<HgChangeset> r = cmd.file("a", true).execute();
182 report("log -f a", r, true); 185 report("log -f a", r, true);
186 */
183 // 187 //
184 changelogParser.reset(); 188 changelogParser.reset();
185 eh.run("hg", "log", "--debug", "-f", "e", "--cwd", repo.getLocation()); 189 eh.run("hg", "log", "--debug", "-f", "e", "--cwd", repo.getLocation());
186 report("log -f e", cmd.file("e", true).execute(), false /*#1, below*/); 190 report("log -f e", cmd.file("e", true).execute(), false /*#1, below*/);
187 // 191 //
188 changelogParser.reset(); 192 changelogParser.reset();
189 eh.run("hg", "log", "--debug", "dir/b", "--cwd", repo.getLocation()); 193 eh.run("hg", "log", "--debug", "dir/b", "--cwd", repo.getLocation());
190 report("log dir/b", cmd.file("dir/b", false).execute(), true); 194 report("log dir/b", cmd.file("dir/b", false).execute(), true);
191 // 195 //
192 changelogParser.reset(); 196 changelogParser.reset();
193 eh.run("hg", "log", "--debug", "-f", "dir/b", "--cwd", repo.getLocation()); 197 //
194 report("log -f dir/b", cmd.file("dir/b", true).execute(), false /*#1, below*/); 198 // Commented out for the same reason as above hg log -f a - newly introduced error message in Mercurial 2.2
199 // when files are not part of the parent revision
200 // eh.run("hg", "log", "--debug", "-f", "dir/b", "--cwd", repo.getLocation());
201 // report("log -f dir/b", cmd.file("dir/b", true).execute(), false /*#1, below*/);
195 /* 202 /*
196 * #1: false works because presently commands dispatches history of the queried file, and then history 203 * #1: false works because presently commands dispatches history of the queried file, and then history
197 * of it's origin. With history comprising of renames only, this effectively gives reversed (newest to oldest) 204 * of it's origin. With history comprising of renames only, this effectively gives reversed (newest to oldest)
198 * order of revisions. 205 * order of revisions.
199 */ 206 */
207
208 // commented tests from above updated to work in 2.2 - update repo to revision where files are present
209 eh.run("hg", "update", "-q", "-r", "2", "--cwd", repo.getLocation());
210 changelogParser.reset();
211 eh.run("hg", "log", "--debug", "-f", "a", "--cwd", repo.getLocation());
212 List<HgChangeset> r = cmd.file("a", true).execute();
213 report("log -f a", r, true);
214 changelogParser.reset();
215 eh.run("hg", "log", "--debug", "-f", "dir/b", "--cwd", repo.getLocation());
216 report("log -f dir/b", cmd.file("dir/b", true).execute(), false /*#1, below*/);
217 //
218 // get repo back into clear state, up to the tip
219 eh.run("hg", "update", "-q", "--cwd", repo.getLocation());
200 } 220 }
201 221
202 @Test 222 @Test
203 public void testUsernames() throws Exception { 223 public void testUsernames() throws Exception {
204 repo = Configuration.get().find("log-users"); 224 repo = Configuration.get().find("log-users");