Package org.tmatesoft.hg.core

Examples of org.tmatesoft.hg.core.HgStatusCommand


   */
  @Test
  public void testRemovedIgnoredInWC() throws Exception {
    // check branch !known, ignored
    repo = Configuration.get().find("status-1");
    HgStatusCommand cmd = new HgStatusCommand(repo);
    StatusCollector sc = new StatusCollector();
    cmd.all().execute(sc);
    assertTrue(sc.getErrors().isEmpty());
    final Path file3 = Path.create("dir/file3");
    assertTrue(sc.get(file3).contains(Ignored));
    assertTrue(sc.get(file3).size() == 1);
    //
    cmd.base(3).execute(sc = new StatusCollector());
    assertTrue(sc.getErrors().isEmpty());
    assertTrue(sc.get(file3).contains(Ignored));
    assertTrue(sc.get(file3).contains(Removed));
    assertTrue(sc.get(file3).size() == 2);
    //
    cmd.base(5).execute(sc = new StatusCollector());
    assertTrue(sc.getErrors().isEmpty());
    assertTrue(sc.get(file3).contains(Ignored));
    assertTrue(sc.get(file3).size() == 1);
    //
    cmd.base(0).execute(sc = new StatusCollector());
    assertTrue(sc.getErrors().isEmpty());
    assertTrue(sc.get(file3).contains(Ignored));
    assertTrue(sc.get(file3).size() == 1);

  }
View Full Code Here


   */
  @Test
  public void testNewFileWithSameNameAsDeletedOld() throws Exception {
    // check branch !known, !ignored (=> unknown)
    repo = Configuration.get().find("status-1");
    HgStatusCommand cmd = new HgStatusCommand(repo);
    StatusCollector sc = new StatusCollector();
    cmd.base(1);
    cmd.all().execute(sc);
    assertTrue(sc.getErrors().isEmpty());
    final Path file1 = Path.create("file1");
    assertTrue(sc.get(file1).contains(Unknown));
    assertTrue(sc.get(file1).contains(Removed));
    assertTrue(sc.get(file1).size() == 2);
    //
    // no file1 in rev 2, shall be reported as unknown only
    cmd.base(2).execute(sc = new StatusCollector());
    assertTrue(sc.getErrors().isEmpty());
    assertTrue(sc.get(file1).contains(Unknown));
    assertTrue(sc.get(file1).size() == 1);
  }
View Full Code Here

  }

  @Test
  public void testSubTreeStatus() throws Exception {
    repo = Configuration.get().find("status-1");
    HgStatusCommand cmd = new HgStatusCommand(repo);
    StatusCollector sc = new StatusCollector();
    cmd.match(new PathGlobMatcher("*"));
    cmd.all().execute(sc);
    assertTrue(sc.getErrors().isEmpty());
    /*
     * C .hgignore
     * ? file1
     * M file2
     * C readme
     */
    final Path file1 = Path.create("file1");
    assertTrue(sc.get(file1).contains(Unknown));
    assertTrue(sc.get(file1).size() == 1);
    assertTrue(sc.get(Removed).isEmpty());
    assertTrue(sc.get(Clean).size() == 2);
    assertTrue(sc.get(Modified).size() == 1);
    //
    cmd.match(new PathGlobMatcher("dir/*")).execute(sc = new StatusCollector());
    assertTrue(sc.getErrors().isEmpty());
    /*
     * I dir/file3
     * R dir/file4
     * R dir/file5
View Full Code Here

  }

  @Test
  public void testScopeInHistoricalStatus() throws Exception {
    repo = Configuration.get().find("status-1");
    HgStatusCommand cmd = new HgStatusCommand(repo);
    cmd.base(3).revision(8).all();
    cmd.match(new PathGlobMatcher("dir/*"));
    StatusCollector sc = new StatusCollector();
    cmd.execute(sc);
    assertTrue(sc.getErrors().isEmpty());
    final Path file3 = Path.create("dir/file3");
    final Path file4 = Path.create("dir/file4");
    final Path file5 = Path.create("dir/file5");
    //
View Full Code Here

   * Issue 22
   */
  @Test
  public void testOnEmptyRepositoryWithAllFilesDeleted() throws Exception {
    repo = Configuration.get().find("status-2");
    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

   * </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

   * 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

    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

    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

    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

TOP

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

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.