repo = Configuration.get().find("log-renames");
HgCatCommand cmd1 = new HgCatCommand(repo);
HgCatCommand cmd2 = new HgCatCommand(repo);
cmd1.file(Path.create("a")); // a is initial b through temporary c
cmd2.file(Path.create("c"));
ByteArrayChannel sink1, sink2;
// a from wc/tip was c in rev 4
cmd1.changeset(4).execute(sink1 = new ByteArrayChannel());
cmd2.changeset(4).execute(sink2 = new ByteArrayChannel());
assertArrayEquals(sink2.toArray(), sink1.toArray());
//
// d from wc/tip was a in 0..2 and b in rev 3..4. Besides, there's another d in r4
cmd2.file(Path.create("d"));
cmd1.changeset(2).execute(sink1 = new ByteArrayChannel());
cmd2.changeset(2).execute(sink2 = new ByteArrayChannel());
assertArrayEquals(sink1.toArray(), sink2.toArray());
//
cmd1.file(Path.create("b"));
cmd1.changeset(3).execute(sink1 = new ByteArrayChannel());
cmd2.changeset(3).execute(sink2 = new ByteArrayChannel());
assertArrayEquals(sink1.toArray(), sink2.toArray());
//
cmd2.changeset(4).execute(sink2 = new ByteArrayChannel()); // ensure d in r4 is not from a or b
assertArrayEquals("d:4\n".getBytes(), sink2.toArray());
cmd2.changeset(5).execute(sink2 = new ByteArrayChannel()); // d in r5 is copy of b in r4
cmd1.changeset(4).execute(sink1 = new ByteArrayChannel());
assertArrayEquals(sink1.toArray(), sink2.toArray());
}