Package org.tmatesoft.hg.util

Examples of org.tmatesoft.hg.util.Path$Source


      reportNotEqual(what + "#UNKNOWN", r.getUnknown(), statusParser.getUnknown());
      List<Path> copiedKeyDiff = difference(r.getCopied().keySet(), statusParser.getCopied().keySet());
      HashMap<Path, String> copyDiff = new HashMap<Path, String>();
      if (copiedKeyDiff.isEmpty()) {
        for (Path jk : r.getCopied().keySet()) {
          Path jv = r.getCopied().get(jk);
          if (statusParser.getCopied().containsKey(jk)) {
            Path cmdv = statusParser.getCopied().get(jk);
            if (!jv.equals(cmdv)) {
              copyDiff.put(jk, jv + " instead of " + cmdv);
            }
          } else {
            copyDiff.put(jk, "ERRONEOUSLY REPORTED IN JAVA");
View Full Code Here


    DirstateReader dirstateReader = new DirstateReader(repo, pathPool);
    dirstateReader.readInto(new Inspector() {
     
      public boolean next(EntryKind kind, Record r) {
        if (canonicalPathRewrite != null) {
          Path canonicalPath = pathPool.path(canonicalPathRewrite.rewrite(r.name()));
          if (canonicalPath != r.name()) { // == as they come from the same pool
            assert !canonical2dirstateName.containsKey(canonicalPath); // otherwise there's already a file with same canonical name
            // which can't happen for case-insensitive file system (or there's erroneous PathRewrite, perhaps doing smth else)
            canonical2dirstateName.put(canonicalPath, r.name());
          }
View Full Code Here

  }

 
  // return non-null if fname is known, either as is, or its canonical form. in latter case, this canonical form is return value
  /*package-local*/ Path known(Path fname) {
    Path fnameCanonical = null;
    if (canonicalPathRewrite != null) {
      fnameCanonical = pathPool.path(canonicalPathRewrite.rewrite(fname).toString());
      if (fnameCanonical != fname && canonical2dirstateName.containsKey(fnameCanonical)) {
        // we know right away there's name in dirstate with alternative canonical form
        return canonical2dirstateName.get(fnameCanonical);
View Full Code Here

  private Record internalCheck(Map<Path, Record> map, Path fname) {
    Record rv = map.get(fname);
    if (rv != null || canonicalPathRewrite == null) {
      return rv;
    }
    Path fnameCanonical = pathPool.path(canonicalPathRewrite.rewrite(fname).toString());
    if (fnameCanonical != fname) {
      // case when fname = /a/B/c, and dirstate is /a/b/C
      if (canonical2dirstateName.containsKey(fnameCanonical)) {
        return map.get(canonical2dirstateName.get(fnameCanonical));
      }
View Full Code Here

  public void testCommand() throws Exception {
    // get a copy of a repository
    File testRepoLoc = RepoUtils.cloneRepoToTempLocation(Configuration.get().find("log-1"), "test-revert", false);
   
    repo = new HgLookup().detect(testRepoLoc);
    Path targetFile = Path.create("b");
    RepoUtils.modifyFileAppend(new File(testRepoLoc, targetFile.toString()), "XXX");
   
    StatusOutputParser statusParser = new StatusOutputParser();
    eh = new ExecHelper(statusParser, testRepoLoc);
    eh.run("hg", "status", "-A");
    assertEquals("[sanity]", 1, statusParser.getModified().size());
    assertEquals("[sanity]", 2, statusParser.getClean().size());
    assertEquals("[sanity]", targetFile, statusParser.getModified().get(0));
   
    HgRevertCommand cmd = new HgRevertCommand(repo);
    cmd.file(targetFile).execute();
    statusParser.reset();
    eh.run("hg", "status", "-A");

    errorCollector.assertEquals(3, statusParser.getClean().size());
    errorCollector.assertTrue(statusParser.getClean().contains(targetFile));
    errorCollector.assertEquals(1, statusParser.getUnknown().size());
    errorCollector.assertEquals(targetFile.toString() + ".orig", statusParser.getUnknown().get(0).toString());
  }
View Full Code Here

          inspector.modified(r2fname);
        }
        cs.checkCancelled();
      } else {
        try {
          Path copyTarget = r2fname;
          Path copyOrigin = detectCopies ? getOriginIfCopy(repo, copyTarget, r2.nodeid(copyTarget), allBaseFiles, rev1) : null;
          if (copyOrigin != null) {
            inspector.copied(getPathPool().mangle(copyOrigin) /*pipe through pool, just in case*/, copyTarget);
          } else {
            inspector.added(copyTarget);
          }
View Full Code Here

    Chunk c = frh.chunkAt(originalChangesetIndex);
    if (c == null) {
      // file rename history doesn't go deep up to changeset of interest
      return null;
    }
    Path nameAtOrigin = c.file().getPath();
    if (originals.contains(nameAtOrigin)) {
      return nameAtOrigin;
    }
    return null;
  }
View Full Code Here

    errorCollector.assertTrue(ps4.accept(Path.create("a/b/c/d")));
  }

  @Test
  public void testPathCompareWith() {
    Path p1 = Path.create("a/b/");
    Path p2 = Path.create("a/b/c");
    Path p3 = Path.create("a/b"); // file with the same name as dir
    Path p4 = Path.create("a/b/c/d/");
    Path p5 = Path.create("d/");
   
    errorCollector.assertEquals(Same, p1.compareWith(p1));
    errorCollector.assertEquals(Same, p1.compareWith(Path.create(p1.toString())));
    errorCollector.assertEquals(Unrelated, p1.compareWith(null));
    errorCollector.assertEquals(Unrelated, p1.compareWith(p5));
View Full Code Here

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

        }
        // TODO respect paths mappings in config file
        //
        // apparently, key value can't end with '/', `hg commit` fails if it does:
        // abort: path ends in directory separator: fourth/
        Path p = pathFactory.path(key.charAt(key.length()-1) == '/' ? key : key + '/');
        String revValue = substate.get(key);
        HgSubrepoLocation loc = hgRepoInternal.newSubrepo(p, value, kind, revValue == null ? null : Nodeid.fromAscii(revValue));
        res.add(loc);
      }
      return Arrays.asList(res.toArray(new HgSubrepoLocation[res.size()]));
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.util.Path$Source

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.