Package org.tmatesoft.hg.core

Examples of org.tmatesoft.hg.core.HgLogCommand


      }
    }

    BaseCancel insp = new ImplementsCancel(3);
    try {
      new HgLogCommand(repo).execute(insp);
      errorCollector.fail("CancelSupport as implemented iface");
    } catch (CancelledException ex) {
      errorCollector.assertEquals("CancelSupport as implemented iface", insp.stopValue, insp.lastSeen);
    }
    insp = new AdaptsToCancel(5);
    try {
      new HgLogCommand(repo).execute(insp);
      errorCollector.fail("Adaptable to CancelSupport");
    } catch (CancelledException ex) {
      errorCollector.assertEquals("Adaptable to CancelSupport", insp.stopValue, insp.lastSeen);
    }
    insp = new BaseCancel(9);
    try {
      new HgLogCommand(repo).set(insp.cancelImpl).execute(insp);
      errorCollector.fail("cmd#set(CancelSupport)");
    } catch (CancelledException e) {
      errorCollector.assertEquals("cmd#set(CancelSupport)", insp.stopValue, insp.lastSeen);
    }
  }
View Full Code Here


      changelogParser.reset();
      eh.run("hg", "log", "--debug");
    }
    final long start2 = System.currentTimeMillis();
    for (int i = 0; i < runs; i++) {
      new HgLogCommand(repo).execute();
    }
    final long end = System.currentTimeMillis();
    System.out.printf("'hg log --debug', %d runs: Native client total %d (%d per run), Java client %d (%d)\n", runs, start2-start1, (start2-start1)/runs, end-start2, (end-start2)/runs);
  }
View Full Code Here

  @Test
  public void testOriginalTestLogRepo() throws Exception {
    // tests fro mercurial distribution, test-log.t
    repo = Configuration.get().find("log-1");
    HgLogCommand cmd = new HgLogCommand(repo);
    // funny enough, but hg log -vf a -R c:\temp\hg\test-log\a doesn't work, while --cwd <same> works fine
    //
    changelogParser.reset();
    eh.run("hg", "log", "--debug", "a", "--cwd", repo.getLocation());
    report("log a", cmd.file("a", false).execute(), true);
    //
    changelogParser.reset();
    // fails with Mercurial 2.2.1, @see http://selenic.com/pipermail/mercurial-devel/2012-February/038249.html
    // and http://www.selenic.com/hg/rev/60101427d618?rev=
    // fix for the test (replacement) is available below 
//    eh.run("hg", "log", "--debug", "-f", "a", "--cwd", repo.getLocation());
//    List<HgChangeset> r = cmd.file("a", true).execute();
//    report("log -f a", r, true);

    //
    changelogParser.reset();
    eh.run("hg", "log", "--debug", "-f", "e", "--cwd", repo.getLocation());
    report("log -f e", cmd.file("e", true).execute(), true);
    //
    changelogParser.reset();
    eh.run("hg", "log", "--debug", "dir/b", "--cwd", repo.getLocation());
    report("log dir/b", cmd.file("dir/b", false).execute(), true);
    //
    changelogParser.reset();
//   
//    Commented out for the same reason as above hg log -f a - newly introduced error message in Mercurial 2.2
//    when files are not part of the parent revision
//    eh.run("hg", "log", "--debug", "-f", "dir/b", "--cwd", repo.getLocation());
//    report("log -f dir/b", cmd.file("dir/b", true).execute(), false /*#1, below*/);
    /*
     * #1: false works because presently commands dispatches history of the queried file, and then history
     * of it's origin. With history comprising of renames only, this effectively gives reversed (newest to oldest)
     * order of revisions.
     */

    // commented tests from above updated to work in 2.2 - update repo to revision where files are present
    eh.run("hg", "update", "-q", "-r", "2", "--cwd", repo.getLocation());
    changelogParser.reset();
    eh.run("hg", "log", "--debug", "-f", "a", "--cwd", repo.getLocation());
    List<HgChangeset> r = cmd.file("a", true).execute();
    report("log -f a", r, true);
    changelogParser.reset();
    eh.run("hg", "log", "--debug", "-f", "dir/b", "--cwd", repo.getLocation());
    report("log -f dir/b", cmd.file("dir/b", true).execute(), true);
    //
    // get repo back into clear state, up to the tip
    eh.run("hg", "update", "-q", "--cwd", repo.getLocation());
  }
View Full Code Here

    repo = Configuration.get().find("log-users");
    final String user1 = "User One <user1@example.org>";
    //
    changelogParser.reset();
    eh.run("hg", "log", "--debug", "-u", user1, "--cwd", repo.getLocation());
    report("log -u " + user1, new HgLogCommand(repo).user(user1).execute(), true);
    //
    changelogParser.reset();
    eh.run("hg", "log", "--debug", "-u", "user1", "-u", "user2", "--cwd", repo.getLocation());
    report("log -u user1 -u user2", new HgLogCommand(repo).user("user1").user("user2").execute(), true);
    //
    changelogParser.reset();
    eh.run("hg", "log", "--debug", "-u", "user3", "--cwd", repo.getLocation());
    report("log -u user3", new HgLogCommand(repo).user("user3").execute(), true);
  }
View Full Code Here

  @Test
  public void testBranches() throws Exception {
    repo = Configuration.get().find("log-branches");
    changelogParser.reset();
    eh.run("hg", "log", "--debug", "-b", "default", "--cwd", repo.getLocation());
    report("log -b default" , new HgLogCommand(repo).branch("default").execute(), true);
    //
    changelogParser.reset();
    eh.run("hg", "log", "--debug", "-b", "test", "--cwd", repo.getLocation());
    report("log -b test" , new HgLogCommand(repo).branch("test").execute(), true);
    //
    assertTrue("log -b dummy shall yeild empty result", new HgLogCommand(repo).branch("dummy").execute().isEmpty());
    //
    changelogParser.reset();
    eh.run("hg", "log", "--debug", "-b", "default", "-b", "test", "--cwd", repo.getLocation());
    report("log -b default -b test" , new HgLogCommand(repo).branch("default").branch("test").execute(), true);
  }
View Full Code Here

        changeSetRevisionToTags.put(changeSetRevision, revisionTags);
      }
      revisionTags.add(tagName);
    }

    final HgLogCommand logCommand = new HgLogCommand(repository);
    logCommand.file(targetPath, true);
    logCommand.execute(new HgChangesetHandler() {
      public void cset(HgChangeset changeset) {
        if (changeset.getAffectedFiles().contains(targetPath)) {
          System.out.println(changeset.getRevisionIndex() + " " + changeSetRevisionToTags.get(changeset.getNodeid()));
        }
      }
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.core.HgLogCommand

Copyright © 2018 www.massapicom. 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.