Examples of HgDiffCommand


Examples of org.apache.maven.scm.provider.hg.command.diff.HgDiffCommand

    /** {@inheritDoc} */
    public DiffScmResult diff( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
        throws ScmException
    {
        HgDiffCommand command = new HgDiffCommand();

        command.setLogger( getLogger() );

        return (DiffScmResult) command.execute( repository, fileSet, parameters );
    }
View Full Code Here

Examples of org.apache.maven.scm.provider.hg.command.diff.HgDiffCommand

    /** {@inheritDoc} */
    public DiffScmResult diff( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
        throws ScmException
    {
        HgDiffCommand command = new HgDiffCommand();

        command.setLogger( getLogger() );

        return (DiffScmResult) command.execute( repository, fileSet, parameters );
    }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgDiffCommand

    HgRepository repo = new HgLookup().detectFromWorkingDir();
    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);
    //
    String[] apiResult = splitLines(bos.toString());
View Full Code Here

Examples of org.tmatesoft.hg.core.HgDiffCommand

    HgRepository repo = new HgLookup().detectFromWorkingDir();
    final String fname = "src/org/tmatesoft/hg/internal/PatchGenerator.java";
    HgDataFile df = repo.getFileNode(fname);
    AnnotateRunner ar = new AnnotateRunner(df.getPath(), null);

    final HgDiffCommand diffCmd = new HgDiffCommand(repo);
    diffCmd.file(df).order(NewToOld);
    final HgChangelog clog = repo.getChangelog();
    final int[] toTest = new int[] {
      clog.getRevisionIndex(Nodeid.fromAscii("946b131962521f9199e1fedbdc2487d3aaef5e46")), // 539
      clog.getRevisionIndex(Nodeid.fromAscii("1e95f48d9886abe79b9711ab371bc877ca5e773e")), // 541
      /*, TIP */};
    for (int cs : toTest) {
      ar.run(cs, false);
      diffCmd.range(0, cs);
      final ReverseAnnotateInspector insp = new ReverseAnnotateInspector();
      diffCmd.executeAnnotate(insp);
      AnnotateInspector fa = new AnnotateInspector().fill(cs, insp);
      doAnnotateLineCheck(cs, ar, fa);
    }
  }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgDiffCommand

  public void testFileLineAnnotate2() throws Exception {
    HgRepository repo = Configuration.get().find("test-annotate");
    HgDataFile df = repo.getFileNode("file1");
    AnnotateRunner ar = new AnnotateRunner(df.getPath(), repo.getWorkingDir());

    final HgDiffCommand diffCmd = new HgDiffCommand(repo).file(df).order(NewToOld);
    for (int cs : new int[] { 4, 6 /*, 8 see below*/, TIP}) {
      ar.run(cs, false);
      diffCmd.range(0, cs);
      final ReverseAnnotateInspector insp = new ReverseAnnotateInspector();
      diffCmd.executeAnnotate(insp);
      AnnotateInspector fa = new AnnotateInspector().fill(cs, insp);
      doAnnotateLineCheck(cs, ar, fa);
    }
    /*`hg annotate -r 8` and HgBlameFacility give different result
     * for "r0, line 5" line, which was deleted in rev2 and restored back in
View Full Code Here

Examples of org.tmatesoft.hg.core.HgDiffCommand

  public void testComplexHistoryAnnotate() throws Exception {
    HgRepository repo = Configuration.get().find("test-annotate");
    HgDataFile df = repo.getFileNode("file1");
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    DiffOutInspector dump = new DiffOutInspector(new PrintStream(bos));
    HgDiffCommand diffCmd = new HgDiffCommand(repo);
    diffCmd.file(df).range(0, TIP).order(OldToNew);
    diffCmd.executeAnnotate(dump);
    LinkedList<String> apiResult = new LinkedList<String>(Arrays.asList(splitLines(bos.toString())));
   
    /*
     * FIXME this is an ugly hack to deal with the way `hg diff -c <mergeRev>` describes the change
     * and our merge handling approach. For merged revision m, and lines changed both in p1 and p2
View Full Code Here

Examples of org.tmatesoft.hg.core.HgDiffCommand

    }));
    // rev6 changes rev4, rev4 changes rev3. Plus, anything changed
    // earlier than rev2 shall be reported as new from change3
    int[] change_2_8_new2old = new int[] {4, 6, 3, 4, -1, 3};
    int[] change_2_8_old2new = new int[] {-1, 3, 3, 4, 4, 6 };
    final HgDiffCommand cmd = new HgDiffCommand(repo);
    cmd.file(df);
    cmd.range(2, 8).order(NewToOld);
    cmd.executeAnnotate(insp);
    Assert.assertArrayEquals(change_2_8_new2old, insp.getReportedRevisionPairs());
    insp.reset();
    cmd.order(OldToNew).executeAnnotate(insp);
    Assert.assertArrayEquals(change_2_8_old2new, insp.getReportedRevisionPairs());
    // same as 2 to 8, with addition of rev9 changes rev7  (rev6 to rev7 didn't change content, only name)
    int[] change_3_9_new2old = new int[] {7, 9, 4, 6, 3, 4, -1, 3 };
    int[] change_3_9_old2new = new int[] {-1, 3, 3, 4, 4, 6, 7, 9 };
    insp.reset();
    cmd.range(3, 9).order(NewToOld).executeAnnotate(insp);
    Assert.assertArrayEquals(change_3_9_new2old, insp.getReportedRevisionPairs());
    insp.reset();
    cmd.order(OldToNew).executeAnnotate(insp);
    Assert.assertArrayEquals(change_3_9_old2new, insp.getReportedRevisionPairs());
  }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgDiffCommand

    HgRepository repo = Configuration.get().find("test-annotate");
    HgDataFile df = repo.getFileNode("file1");
    LineGrepOutputParser gp = new LineGrepOutputParser("^@@.+");
    ExecHelper eh = new ExecHelper(gp, repo.getWorkingDir());
    int[] toTest = { 3, 4, 5 }; // p1 ancestry line, p2 ancestry line, not in ancestry line
    final HgDiffCommand diffCmd = new HgDiffCommand(repo).file(df);
    for (int cs : toTest) {
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      diffCmd.range(cs, 8).executeDiff(new DiffOutInspector(new PrintStream(bos)));
      eh.run("hg", "diff", "-r", String.valueOf(cs), "-r", "8", "-U", "0", df.getPath().toString());
      //
      String[] apiResult = splitLines(bos.toString());
      String[] expected = splitLines(gp.result());
      Assert.assertArrayEquals("diff -r " + cs + "-r 8", expected, apiResult);
View Full Code Here

Examples of org.tmatesoft.hg.core.HgDiffCommand

    LineGrepOutputParser gp = new LineGrepOutputParser("^@@.+");
    ExecHelper eh = new ExecHelper(gp, repo.getWorkingDir());
    eh.run("hg", "diff", "-c", "0", "-U", "0", df.getPath().toString());
    //
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    HgDiffCommand diffCmd = new HgDiffCommand(repo).file(df);
    diffCmd.changeset(0).executeParentsAnnotate(new DiffOutInspector(new PrintStream(bos)));
    //
    String[] apiResult = splitLines(bos.toString());
    String[] expected = splitLines(gp.result());
    Assert.assertArrayEquals(expected, apiResult);
  }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgDiffCommand

  private void ddd() throws Throwable {
//    HgRepository repo = new HgLookup().detect("/home/artem/hg/blame-merge/");
    HgRepository repo = new HgLookup().detect("/home/artem/hg/junit-test-repos/test-annotate3/");
    final DiffOutInspector insp = new DiffOutInspector(System.out);
    insp.needRevisions(true);
    new HgDiffCommand(repo).file(Path.create("file1")).executeParentsAnnotate(insp);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.