Package org.tmatesoft.hg.util

Examples of org.tmatesoft.hg.util.Path$Matcher$Any


        String[] r = s.split("\\00");
        if (r.length < 7) {
          repo.getLog().dump(getClass(), Severity.Error, "Expect at least 7 zero-separated fields in the merge state file, not %d. Entry skipped", r.length);
          continue;
        }
        Path p1fname = pathPool.path(r[3]);
        Nodeid nidP1 = m1.nodeid(p1fname);
        Nodeid nidCA = nodeidPool.unify(Nodeid.fromAscii(r[5]));
        HgFileRevision p1 = new HgFileRevision(hgRepo, nidP1, m1.flags(p1fname), p1fname);
        HgFileRevision ca;
        if (nidCA == nidP1 && r[3].equals(r[4])) {
          ca = p1;
        } else {
          ca = new HgFileRevision(hgRepo, nidCA, null, pathPool.path(r[4]));
        }
        HgFileRevision p2;
        if (!wcp2.isNull() || !r[6].equals(r[4])) {
          final Path p2fname = pathPool.path(r[6]);
          Nodeid nidP2 = m2.nodeid(p2fname);
          if (nidP2 == null) {
            assert false : "There's not enough information (or I don't know where to look) in merge/state to find out what's the second parent";
            nidP2 = NULL;
          }
View Full Code Here


    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

    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

    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());
View Full Code Here

    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());
View Full Code Here

    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
View Full Code Here

     * 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);
View Full Code Here

  @Test
  public void testSpecificFileStatus() throws Exception {
    repo = Configuration.get().find("status-1");
    // files only
    final Path file2 = Path.create("file2");
    final Path file3 = Path.create("dir/file3");
    HgWorkingCopyStatusCollector sc = HgWorkingCopyStatusCollector.create(repo, file2, file3);
    HgStatusCollector.Record r = new HgStatusCollector.Record();
    sc.walk(WORKING_COPY, r);
    assertTrue(r.getAdded().isEmpty());
    assertTrue(r.getRemoved().isEmpty());
    assertTrue(r.getUnknown().isEmpty());
    assertTrue(r.getClean().isEmpty());
    assertTrue(r.getMissing().isEmpty());
    assertTrue(r.getCopied().isEmpty());
    assertTrue(r.getIgnored().contains(file3));
    assertTrue(r.getIgnored().size() == 1);
    assertTrue(r.getModified().contains(file2));
    assertTrue(r.getModified().size() == 1);
    // mix files and directories
    final Path readme = Path.create("readme");
    final Path dir = Path.create("dir/");
    sc = HgWorkingCopyStatusCollector.create(repo, readme, dir);
    sc.walk(WORKING_COPY, r = new HgStatusCollector.Record());
    assertTrue(r.getAdded().isEmpty());
    assertTrue(r.getRemoved().size() == 2);
    for (Path p : r.getRemoved()) {
View Full Code Here

  }

  @Test
  public void testSameResultDirectPathVsMatcher() throws Exception {
    repo = Configuration.get().find("status-1");
    final Path file3 = Path.create("dir/file3");
    final Path file5 = Path.create("dir/file5");

    HgWorkingCopyStatusCollector sc = HgWorkingCopyStatusCollector.create(repo, file3, file5);
    HgStatusCollector.Record r;
    sc.walk(WORKING_COPY, r = new HgStatusCollector.Record());
    assertTrue(r.getRemoved().contains(file5));
    assertTrue(r.getIgnored().contains(file3));
    //
    // query for the same file, but with
    sc = HgWorkingCopyStatusCollector.create(repo, new PathGlobMatcher(file3.toString(), file5.toString()));
    sc.walk(WORKING_COPY, r = new HgStatusCollector.Record());
    assertTrue(r.getRemoved().contains(file5));
    assertTrue(r.getIgnored().contains(file3));
  }
View Full Code Here

    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");
    //
    assertTrue(sc.get(file3).contains(Removed));
    assertTrue(sc.get(file3).size() == 1);
    assertTrue(sc.get(Removed).size() == 1);
    //
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.util.Path$Matcher$Any

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.