Package org.tmatesoft.hg.repo

Examples of org.tmatesoft.hg.repo.HgDirstate


    repo = Configuration.get().find("log-branches");
    final Pair<Nodeid, Nodeid> wcParents = repo.getWorkingCopyParents();
    assertEquals("5f24ef64e9dfb1540db524f88cb5c3d265e1a3b5", wcParents.first().toString());
    assertTrue(wcParents.second().isNull());
    //
    HgDirstate ds = new HgInternals(repo).getDirstate();
    final Pair<Nodeid, Nodeid> wcParents2 = ds.parents();
    assertEquals(wcParents.first(), wcParents2.first());
    assertEquals(wcParents.second(), wcParents2.second());
  }
View Full Code Here


    // 2. dirstate: /a/B/C, FileIterator: /a/b/c
    // 2. dirstate: /a/B/C, FileIterator: /A/b/C
    repo = Configuration.get().find("mixed-case");
    // Windows, case-insensitive file system
    final HgInternals testAccess = new HgInternals(repo);
    HgDirstate dirstate = testAccess.createDirstate(false);
    final TreeSet<Path> entries = new TreeSet<Path>();
    dirstate.walk(new HgDirstate.Inspector() {
     
      public boolean next(EntryKind kind, Record entry) {
        entries.add(entry.name());
        return true;
      }
    });
    Path[] expected = new Path[] {
      Path.create("a/low/low"),
      Path.create("a/low/UP"),
      Path.create("a/UP/low"),
      Path.create("a/UP/UP"),
    };
    Path[] allLower = new Path[expected.length];
    Path[] allUpper = new Path[expected.length];
    Path[] mixedNonMatching = new Path[expected.length];
    for (int i = 0; i < expected.length; i++) {
      assertTrue("prereq", entries.contains(expected[i]));
      final String s = expected[i].toString();
      allLower[i] = Path.create(s.toLowerCase());
      allUpper[i] = Path.create(s.toUpperCase());
      char[] ss = s.toCharArray();
      for (int j = 0; j < ss.length; j++) {
        if (isLetter(ss[j])) {
          ss[j] = isLowerCase(ss[j]) ? toUpperCase(ss[j]) : toLowerCase(ss[j]);
        }
      }
      Path mixed = Path.create(new String(ss));
      mixedNonMatching[i] = mixed;
    }
    // prereq
    checkKnownInDirstate(testAccess, dirstate, expected, expected);
    // all upper
    checkKnownInDirstate(testAccess, dirstate, allUpper, expected);
    // all lower
    checkKnownInDirstate(testAccess, dirstate, allLower, expected);
    // mixed
    checkKnownInDirstate(testAccess, dirstate, mixedNonMatching, expected);
    //
    // check that in case-sensitive file system mangled names do not match
    dirstate = testAccess.createDirstate(true);
    // ensure read
    dirstate.walk(new HgDirstate.Inspector() {
      public boolean next(EntryKind kind, Record entry) {
        return false;
      }
    });
    Path[] known = testAccess.checkKnown(dirstate, mixedNonMatching);
View Full Code Here

      Internals internalRepo = Internals.getInstance(repo);
      if (cleanCheckout) {
        // remove tracked files from wd (perhaps, just forget 'Added'?)
        // for now, just delete each and every tracked file
        // TODO WorkingCopy container with getFile(HgDataFile/Path) to access files in WD
        HgDirstate dirstate = new HgInternals(repo).getDirstate();
        dirstate.walk(new HgDirstate.Inspector() {
         
          public boolean next(EntryKind kind, Record entry) {
            File f = new File(repo.getWorkingDir(), entry.name().toString());
            if (f.exists()) {
              f.delete();
View Full Code Here

TOP

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

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.