Examples of HgStatusCommand


Examples of org.tmatesoft.hg.core.HgStatusCommand

        errorCollector.fail("There's no conflict in changesets 1 and 2 merge");
      }
    });
    RepoUtils.assertHgVerifyOk(errorCollector, repoLoc1);
    TestStatus.StatusCollector status = new TestStatus.StatusCollector();
    new HgStatusCommand(repo).all().execute(status);
    final List<Path> clean = status.get(Kind.Clean);
    final List<Path> modified = status.get(Kind.Modified);
    Collections.sort(clean);
    Collections.sort(modified);
    errorCollector.assertEquals(new Path[] {create("file1"), create("file3"), create("file4")}, clean.toArray());
    errorCollector.assertEquals(new Path[] {create("file2"), create("file5")}, modified.toArray());
    repo = new HgLookup().detect(repoLoc2);
    cmd = new HgMergeCommand(repo);
    cmd.changeset(3).execute(new HgMergeCommand.MediatorBase());
    RepoUtils.assertHgVerifyOk(errorCollector, repoLoc2);
    new HgStatusCommand(repo).all().execute(status = new TestStatus.StatusCollector());
    errorCollector.assertEquals(1, status.get(Kind.Modified).size());
    errorCollector.assertEquals(create("file1"), status.get(Kind.Modified).get(0));
    final HgMergeState ms = repo.getMergeState();
    ms.refresh();
    errorCollector.assertTrue(ms.isMerging());
View Full Code Here

Examples of org.tmatesoft.hg.core.HgStatusCommand

    sr.report("status -A --rev " + revision, r);
  }

  @Test
  public void testStatusCommand() throws Exception {
    final HgStatusCommand sc = new HgStatusCommand(repo).all();
    StatusCollector r;
    statusParser.reset();
    eh.run("hg", "status", "-A");
    sc.execute(r = new StatusCollector());
    sr.report("hg status -A", r);
    //
    statusParser.reset();
    int revision = 3;
    eh.run("hg", "status", "-A", "--rev", String.valueOf(revision));
    sc.base(revision).execute(r = new StatusCollector());
    sr.report("status -A --rev " + revision, r);
    //
    statusParser.reset();
    eh.run("hg", "status", "-A", "--change", String.valueOf(revision));
    sc.base(TIP).revision(revision).execute(r = new StatusCollector());
    sr.report("status -A --change " + revision, r);

    // TODO check not -A, but defaults()/custom set of modifications
  }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgStatusCommand

   */
  @Test
  public void testRemovedAgainstBaseWithoutIt() throws Exception {
    // check very end of WCStatusCollector, foreach left knownEntry, collect == null || baseRevFiles.contains()
    repo = Configuration.get().find("status-1");
    HgStatusCommand cmd = new HgStatusCommand(repo);
    StatusCollector sc = new StatusCollector();
    cmd.all().base(7).execute(sc);
    assertTrue(sc.getErrors().isEmpty());
    Path file5 = Path.create("dir/file5");
    // shall not be listed at all
    assertTrue(sc.get(file5).isEmpty());
  }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgStatusCommand

   * Shall be reported as modified.
   */
  @Test
  public void testTrackedModifiedIgnored() throws Exception {
    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 file2 = Path.create("file2");
    assertTrue(sc.get(file2).contains(Modified));
    assertTrue(sc.get(file2).size() == 1);
  }
View Full Code Here

Examples of org.tmatesoft.hg.core.HgStatusCommand

   * (despite both rev 3 and WC's parent has file4, there are different paths in the code for wc against parent and wc against rev)
   */
  @Test
  public void testMarkedRemovedButStillInWC() throws Exception {
    repo = Configuration.get().find("status-1");
    HgStatusCommand cmd = new HgStatusCommand(repo);
    StatusCollector sc = new StatusCollector();
    cmd.all().execute(sc);
    assertTrue(sc.getErrors().isEmpty());
    Path file4 = Path.create("dir/file4");
    assertTrue(sc.get(file4).contains(Removed));
    assertTrue(sc.get(file4).size() == 1);
    //
    // different code path (collect != null)
    cmd.base(3).execute(sc = new StatusCollector());
    assertTrue(sc.getErrors().isEmpty());
    assertTrue(sc.get(file4).contains(Removed));
    assertTrue(sc.get(file4).size() == 1);
    //
    // wasn't there in rev 2, shall not be reported at all
    cmd.base(2).execute(sc = new StatusCollector());
    assertTrue(sc.getErrors().isEmpty());
    assertTrue(sc.get(file4).isEmpty());
  }
View Full Code Here

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

Examples of org.tmatesoft.hg.core.HgStatusCommand

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

Examples of org.tmatesoft.hg.core.HgStatusCommand

  }

  @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

Examples of org.tmatesoft.hg.core.HgStatusCommand

  }

  @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

Examples of org.tmatesoft.hg.core.HgStatusCommand

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