final String fname = "src/org/tmatesoft/hg/internal/PatchGenerator.java";
final int checkChangeset = repo.getChangelog().getRevisionIndex(Nodeid.fromAscii("946b131962521f9199e1fedbdc2487d3aaef5e46")); // 539
HgDataFile df = repo.getFileNode(fname);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
HgDiffCommand diffCmd = new HgDiffCommand(repo);
diffCmd.file(df).changeset(checkChangeset);
diffCmd.executeParentsAnnotate(new DiffOutInspector(new PrintStream(bos)));
LineGrepOutputParser gp = new LineGrepOutputParser("^@@.+");
ExecHelper eh = new ExecHelper(gp, null);
eh.run("hg", "diff", "-c", String.valueOf(checkChangeset), "-U", "0", fname);
//