final String fnameNoRename = "file2";
assertTrue("[sanity]", repo.getFileNode(fnameNoRename).exists());
// first, check that file without renames doesn't report any accidentally
CollectWithRenameHandler h1 = new CollectWithRenameHandler();
HgLogCommand cmd = new HgLogCommand(repo).file(fnameNoRename, false, false);
cmd.execute(h1);
errorCollector.assertEquals(0, h1.rh.renames.size());
TreeCollectHandler h2 = new TreeCollectHandler(false);
RenameCollector rh = new RenameCollector(h2);
cmd.execute(h2);
errorCollector.assertEquals(0, rh.renames.size());
// check default iterate direction
cmd = new HgLogCommand(repo).file(fname2, false, false);
cmd.execute(h1 = new CollectWithRenameHandler());
errorCollector.assertEquals(1, h1.rh.renames.size());
assertRename(fname1, fname2, h1.rh.renames.get(0));
h2 = new TreeCollectHandler(false);
rh = new RenameCollector(h2);
cmd.execute(h2);
errorCollector.assertEquals(1, rh.renames.size());
assertRename(fname1, fname2, rh.renames.get(0));
eh.run("hg", "log", "--debug", fname2, "--cwd", repo.getLocation());
report("HgChangesetHandler+RenameHandler with followRenames = false, default iteration order", h1.getChanges(), true);
report("HgChangesetTreeHandler+RenameHandler with followRenames = false, default iteration order", h2.getResult(), true);
//
// Now, check that iteration in opposite direction (new to old)
// still reports renames (and correct revisions, too)
cmd.order(HgIterateDirection.NewToOld);
cmd.execute(h1 = new CollectWithRenameHandler());
errorCollector.assertEquals(1, h1.rh.renames.size());
assertRename(fname1, fname2, h1.rh.renames.get(0));
h2 = new TreeCollectHandler(false);
rh = new RenameCollector(h2);
cmd.execute(h2);
errorCollector.assertEquals(1, rh.renames.size());
assertRename(fname1, fname2, rh.renames.get(0));
report("HgChangesetHandler+RenameHandler with followRenames = false, new2old iteration order", h1.getChanges(), false);
report("HgChangesetTreeHandler+RenameHandler with followRenames = false, new2old iteration order", h2.getResult(), false);
}