final File fileA = new File(repoLoc, fa.toString());
final File fileB = new File(repoLoc, fb.toString());
// rev0: +file1, +file2
RepoUtils.createFile(fileA, "first file");
RepoUtils.createFile(fileB, "second file");
new HgAddRemoveCommand(hgRepo).add(fa, fb).execute();
final HgCommitCommand commitCmd = new HgCommitCommand(hgRepo);
commitCmd.message("FIRST").execute();
// rev1: *file1, *file2
RepoUtils.modifyFileAppend(fileA, "A1");
RepoUtils.modifyFileAppend(fileB, "B1");
commitCmd.message("SECOND").execute();
// rev2: *file1, -file2
RepoUtils.modifyFileAppend(fileA, "A2");
fileB.delete();
new HgAddRemoveCommand(hgRepo).remove(fb).execute();
commitCmd.message("THIRD").execute();
// rev3: fork rev0, +file3, *file2
new HgCheckoutCommand(hgRepo).changeset(0).clean(true).execute();
final File fileC = new File(repoLoc, fc.toString());
RepoUtils.createFile(fileC, "third file");
RepoUtils.modifyFileAppend(fileB, "B2");
new HgAddRemoveCommand(hgRepo).add(fc).execute();
commitCmd.message("FOURTH").execute();
// rev4: *file3
RepoUtils.modifyFileAppend(fileC, "C1");
commitCmd.message("FIFTH").execute();
// rev5: merge rev2 with rev3