Package org.tmatesoft.hg.repo

Examples of org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector


  private void testFileStatus() throws Exception {
//    final Path path = Path.create("src/org/tmatesoft/hg/util/");
//    final Path path = Path.create("src/org/tmatesoft/hg/internal/Experimental.java");
//    final Path path = Path.create("missing-dir/");
//    HgWorkingCopyStatusCollector wcsc = HgWorkingCopyStatusCollector.create(hgRepo, path);
    HgWorkingCopyStatusCollector wcsc = HgWorkingCopyStatusCollector.create(hgRepo, new PathGlobMatcher("mi**"));
    wcsc.walk(WORKING_COPY, new StatusDump());
  }
View Full Code Here


    }
  }
 
  private void dumpDirstate() throws Exception {
    new HgInternals(hgRepo).getDirstate().walk(new DirstateDump());
    HgWorkingCopyStatusCollector wcc = HgWorkingCopyStatusCollector.create(hgRepo, new Path.Matcher.Any());
    wcc.getDirstate().walk(new HgDirstate.Inspector() {
     
      public boolean next(EntryKind kind, Record entry) {
        System.out.printf("%s %s\n", kind, entry.name());
        return true;
      }
View Full Code Here

    sortAndPrint('R', r.getRemoved(), null);
    //
    System.out.println("\n\nTry hg status --change <rev>:");
    sc.change(0, dump);
    System.out.println("\nStatus against working dir:");
    HgWorkingCopyStatusCollector wcc = new HgWorkingCopyStatusCollector(hgRepo);
    wcc.walk(WORKING_COPY, dump);
    System.out.println();
    System.out.printf("Manifest of the revision %d:\n", r2);
    hgRepo.getManifest().walk(r2, r2, new ManifestDump());
    System.out.println();
    System.out.printf("\nStatus of working dir against %d:\n", r2);
    r = wcc.status(r2);
    sortAndPrint('M', r.getModified(), null);
    sortAndPrint('A', r.getAdded(), r.getCopied());
    sortAndPrint('R', r.getRemoved(), null);
    sortAndPrint('?', r.getUnknown(), null);
    sortAndPrint('I', r.getIgnored(), null);
View Full Code Here

  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

    final CompleteRepoLock repoLock = new CompleteRepoLock(repo);
    repoLock.acquire();
    try {
      int[] parentRevs = new int[2];
      detectParentFromDirstate(parentRevs);
      HgWorkingCopyStatusCollector sc = new HgWorkingCopyStatusCollector(repo);
      Record status = sc.status(HgRepository.WORKING_COPY);
      if (status.getModified().size() == 0 && status.getAdded().size() == 0 && status.getRemoved().size() == 0) {
        newRevision = Nodeid.NULL;
        return new Outcome(Kind.Failure, "nothing to add");
      }
      final Internals implRepo = Internals.getInstance(repo);
View Full Code Here

    try {
      // XXX if I need a rough estimation (for ProgressMonitor) of number of work units,
      // I may use number of files in either rev1 or rev2 manifest edition
      mediator.start(statusHandler, getCancelSupport(statusHandler, true), new ChangelogHelper(repo, startRevision));
      if (endRevision == WORKING_COPY) {
        HgWorkingCopyStatusCollector wcsc = scope != null ? HgWorkingCopyStatusCollector.create(repo, scope) : new HgWorkingCopyStatusCollector(repo);
        wcsc.setBaseRevisionCollector(sc);
        wcsc.walk(startRevision, mediator);
      } else {
        sc.setScope(scope); // explicitly set, even if null - would be handy once we reuse StatusCollector
        if (startRevision == TIP) {
          sc.change(endRevision, mediator);
        } else {
View Full Code Here

    sr = new StatusReporter(errorCollector, statusParser);
  }

  @Test
  public void testLowLevel() throws Exception {
    final HgWorkingCopyStatusCollector wcc = new HgWorkingCopyStatusCollector(repo);
    statusParser.reset();
    eh.run("hg", "status", "-A");
    HgStatusCollector.Record r = wcc.status(HgRepository.TIP);
    sr.report("hg status -A", r);
    //
    statusParser.reset();
    int revision = 3;
    eh.run("hg", "status", "-A", "--rev", String.valueOf(revision));
    r = wcc.status(revision);
    sr.report("status -A --rev " + revision, r);
    //
    statusParser.reset();
    eh.run("hg", "status", "-A", "--change", String.valueOf(revision));
    r = new HgStatusCollector.Record();
View Full Code Here

  }

  @Test
  @Ignore("needs configuration as it requires special repository")
  public void testDirstateParentOtherThanTipNoUpdate() throws Exception {
    final HgWorkingCopyStatusCollector wcc = new HgWorkingCopyStatusCollector(repo);
    statusParser.reset();
    //
    eh.run("hg", "status", "-A");
    HgStatusCollector.Record r = wcc.status(HgRepository.TIP);
    sr.report("hg status -A", r);
    //
    statusParser.reset();
    int revision = 3;
    eh.run("hg", "status", "-A", "--rev", String.valueOf(revision));
    r = wcc.status(revision);
    sr.report("status -A --rev " + revision, r);
  }
View Full Code Here

  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()) {
      assertEquals(Path.CompareResult.ImmediateChild, p.compareWith(dir));
    }
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector

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.