Examples of HgStatusCommand


Examples of org.tmatesoft.hg.core.HgStatusCommand

   * </pre>
   */
  @Test
  public void testOnEmptyRepositoryWithAllFilesDeletedInBranch() throws Exception {
    repo = Configuration.get().find("status-3");
    HgStatusCommand cmd = new HgStatusCommand(repo);
    cmd.all();
    StatusCollector sc = new StatusCollector();
    cmd.execute(sc);
    // shall pass without exception
    assertTrue(sc.getErrors().isEmpty());
    for (HgStatus.Kind k : HgStatus.Kind.values()) {
      assertTrue("Kind " + k.name() + " shall be empty", sc.get(k).isEmpty());
    }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgStatusCommand

   * Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest)
   */
  @Test
  public void testImportedRepoWithOddManifestRevisions() throws Exception {
    repo = Configuration.get().find("status-4");
    HgStatusCommand cmd = new HgStatusCommand(repo);
    cmd.all();
    StatusCollector sc = new StatusCollector();
    cmd.execute(sc);
    // shall pass without exception
    assertTrue(sc.getErrors().isEmpty());
  }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgStatusCommand

    File f1 = new File(repo.getWorkingDir(), "file1");
    f1.setLastModified(System.currentTimeMillis());
    File f3 = new File(repo.getWorkingDir(), "file3");
    f3.setLastModified(System.currentTimeMillis());
    //
    HgStatusCommand cmd = new HgStatusCommand(repo);
    cmd.all();
    StatusCollector sc = new StatusCollector();
    cmd.execute(sc);
    // shall pass without exception
    //
    for (Map.Entry<Path, Outcome> e : sc.getErrors().entrySet()) {
      System.out.printf("%s : (%s %s)\n", e.getKey(), e.getValue().getKind(), e.getValue().getMessage());
    }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgStatusCommand

    repo = Configuration.get().find("status-5");
    // touch the file to force content retrieval
    File f2 = new File(repo.getWorkingDir(), "file2");
    f2.setLastModified(System.currentTimeMillis());
    //
    HgStatusCommand cmd = new HgStatusCommand(repo);
    cmd.all();
    StatusCollector sc = new StatusCollector();
    cmd.execute(sc);
    // shall pass without exception
    //
    for (Map.Entry<Path, Outcome> e : sc.getErrors().entrySet()) {
      System.out.printf("%s : (%s %s)\n", e.getKey(), e.getValue().getKind(), e.getValue().getMessage());
    }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgStatusCommand

    File s1b = new File(repo.getWorkingDir(), "s1/b");
    assertTrue("[sanity]", s1.exists() && s1.isDirectory());
    assertTrue("[sanity]", s1b.exists() && s1b.isFile());
    assertTrue("[sanity]", s2.exists() && s2.isDirectory());
    StatusCollector sc = new StatusCollector();
    new HgStatusCommand(repo).all().execute(sc);
    List<Path> ignored = sc.get(Ignored);
    assertEquals(1, ignored.size());
    assertEquals(Path.create("skip/a"), ignored.get(0));
    assertTrue(sc.get(Path.create("s1/b")).isEmpty());
  }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgStatusCommand

 
  @Test
  public void testDetectRenamesInNonFirstRev() throws Exception {
    repo = Configuration.get().find("log-renames");
    eh.cwd(repo.getWorkingDir());
    final HgStatusCommand cmd = new HgStatusCommand(repo).defaults();
    StatusCollector sc;
    for (int r : new int[] {2,3,4}) {
      statusParser.reset();
      eh.run("hg", "status", "-C", "--change", String.valueOf(r));
      cmd.change(r).execute(sc = new StatusCollector());
      sr.report("hg status -C --change " + r, sc);
    }
    // a and d from r5 are missing in r3
    statusParser.reset();
    eh.run("hg", "status", "-C", "--rev", "3", "--rev", "5");
    cmd.base(3).revision(5).execute(sc = new StatusCollector());
    sr.report("hg status -C 3..5 ", sc);
    //
    // a is c which is initially b
    // d is b which is initially a
    Path fa = Path.create("a");
    Path fb = Path.create("b");
    Path fc = Path.create("c");
    Path fd = Path.create("d");
    // neither initial a nor b have isCopy(() == true
    assertFalse("[sanity]", repo.getFileNode(fa).isCopy());
    // check HgStatusCollector
    // originals (base revision) doesn't contain first copy origin (there's no b in r2)
    cmd.base(2).revision(5).execute(sc = new StatusCollector());
    errorCollector.assertEquals(fa, sc.new2oldName.get(fd));
    errorCollector.assertEquals(Collections.singletonList(Removed), sc.get(fc));
    // ensure same result with HgWorkingCopyStatusCollector
    cmd.base(2).revision(WORKING_COPY).execute(sc = new StatusCollector());
    errorCollector.assertEquals(fa, sc.new2oldName.get(fd));
    errorCollector.assertEquals(Collections.singletonList(Removed), sc.get(fc));
    // originals (base revision) does contain first copy origin (b is in r1)
    cmd.base(1).revision(5).execute(sc = new StatusCollector());
    errorCollector.assertEquals(fa, sc.new2oldName.get(fd));
    errorCollector.assertEquals(Collections.singletonList(Removed), sc.get(fb));
  }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgStatusCommand

      eh.run("hg", "status", "-A", "--rev", "3:80");
    }
    final long start2 = System.currentTimeMillis();
    for (int i = 0; i < runs; i++) {
      StatusCollector r = new StatusCollector();
      new HgStatusCommand(repo).all().base(3).revision(80).execute(r);
    }
    final long end = System.currentTimeMillis();
    System.out.printf("'hg status -A --rev 3:80', %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

Examples of org.tmatesoft.hg.core.HgStatusCommand

      wcLock.acquire();
      System.out.print(".");
      storeLock.acquire();
      System.out.print(".");
      try {
        new HgStatusCommand(hgRepo).execute(new TestStatus.StatusCollector());
        System.out.printf("%d ms)\n", (System.nanoTime() - start) / 1000000);
      } finally {
        storeLock.release();
        wcLock.release();
      }
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.