comparison test/org/tmatesoft/hg/test/TestBlame.java @ 632:54e16ab771ec v1.1rc2

Progress/cancel for HgDiffCommand. Renamed execute method
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 30 May 2013 16:13:43 +0200
parents 72c979555cb8
children 3219cfadda49
comparison
equal deleted inserted replaced
631:8a5cdcb27b8f 632:54e16ab771ec
75 final int checkChangeset = repo.getChangelog().getRevisionIndex(Nodeid.fromAscii("946b131962521f9199e1fedbdc2487d3aaef5e46")); // 539 75 final int checkChangeset = repo.getChangelog().getRevisionIndex(Nodeid.fromAscii("946b131962521f9199e1fedbdc2487d3aaef5e46")); // 539
76 HgDataFile df = repo.getFileNode(fname); 76 HgDataFile df = repo.getFileNode(fname);
77 ByteArrayOutputStream bos = new ByteArrayOutputStream(); 77 ByteArrayOutputStream bos = new ByteArrayOutputStream();
78 HgDiffCommand diffCmd = new HgDiffCommand(repo); 78 HgDiffCommand diffCmd = new HgDiffCommand(repo);
79 diffCmd.file(df).changeset(checkChangeset); 79 diffCmd.file(df).changeset(checkChangeset);
80 diffCmd.executeAnnotateSingleRevision(new DiffOutInspector(new PrintStream(bos))); 80 diffCmd.executeParentsAnnotate(new DiffOutInspector(new PrintStream(bos)));
81 LineGrepOutputParser gp = new LineGrepOutputParser("^@@.+"); 81 LineGrepOutputParser gp = new LineGrepOutputParser("^@@.+");
82 ExecHelper eh = new ExecHelper(gp, null); 82 ExecHelper eh = new ExecHelper(gp, null);
83 eh.run("hg", "diff", "-c", String.valueOf(checkChangeset), "-U", "0", fname); 83 eh.run("hg", "diff", "-c", String.valueOf(checkChangeset), "-U", "0", fname);
84 // 84 //
85 String[] apiResult = splitLines(bos.toString()); 85 String[] apiResult = splitLines(bos.toString());
305 ExecHelper eh = new ExecHelper(gp, repo.getWorkingDir()); 305 ExecHelper eh = new ExecHelper(gp, repo.getWorkingDir());
306 eh.run("hg", "diff", "-c", "0", "-U", "0", df.getPath().toString()); 306 eh.run("hg", "diff", "-c", "0", "-U", "0", df.getPath().toString());
307 // 307 //
308 ByteArrayOutputStream bos = new ByteArrayOutputStream(); 308 ByteArrayOutputStream bos = new ByteArrayOutputStream();
309 HgDiffCommand diffCmd = new HgDiffCommand(repo).file(df); 309 HgDiffCommand diffCmd = new HgDiffCommand(repo).file(df);
310 diffCmd.changeset(0).executeAnnotateSingleRevision(new DiffOutInspector(new PrintStream(bos))); 310 diffCmd.changeset(0).executeParentsAnnotate(new DiffOutInspector(new PrintStream(bos)));
311 // 311 //
312 String[] apiResult = splitLines(bos.toString()); 312 String[] apiResult = splitLines(bos.toString());
313 String[] expected = splitLines(gp.result()); 313 String[] expected = splitLines(gp.result());
314 Assert.assertArrayEquals(expected, apiResult); 314 Assert.assertArrayEquals(expected, apiResult);
315 } 315 }