Package org.tmatesoft.hg.util

Examples of org.tmatesoft.hg.util.Path


    HgChangesetFileSneaker fs1 = new HgChangesetFileSneaker(hgRepo);
    HgChangesetFileSneaker fs2 = new HgChangesetFileSneaker(hgRepo);
    fs1.followRenames(true);
    fs2.followRenames(true);
    Nodeid cset = hgRepo.getChangelog().getRevision(2);
    Path fname = Path.create("dir9/file9"); // close to the manifest end
    fs1.changeset(cset);
    fs2.changeset(cset);
//    hgRepo.getManifest().getFileRevision(TIP, fname);
    final long start1 = System.nanoTime();
    boolean e1 = fs1.checkExists(fname);
View Full Code Here


    System.out.printf("\n\tManifestRevision:%d ms, getFileRevision:%d ms\n", (_e1-_s1)/1000000, (_e2-_e1)/1000000);
  }
 
  //  -agentlib:hprof=cpu=times,heap=sites,depth=10
  private void checkFileSneakerPerformance2() throws Exception {
    Path fname = Path.create("dir9/file9"); // close to the manifest end
    hgRepo.getManifest().getFileRevision(0, fname);
//    ManifestRevision mr = new ManifestRevision(null, null);
//    hgRepo.getManifest().walk(2, 2, mr);
  }
View Full Code Here

  public void testAnnotateCmdFollowNoFollow() throws Exception {
    HgRepoFacade hgRepoFacade = new HgRepoFacade();
    HgRepository repo = Configuration.get().find("test-annotate2");
    hgRepoFacade.init(repo);
    HgAnnotateCommand cmd = hgRepoFacade.createAnnotateCommand();
    final Path fname = Path.create("file1b.txt");
    final int changeset = TIP;
    AnnotateInspector ai = new AnnotateInspector();

    cmd.changeset(changeset);
    // follow
View Full Code Here

    return mergeState;
  }
 
  public HgDataFile getFileNode(String path) {
    CharSequence nPath = normalizePath.rewrite(path);
    Path p = sessionContext.getPathFactory().path(nPath);
    return getFileNode(p);
  }
View Full Code Here

  }
 
  @Test
  public void testCatAtCsetRevision() throws Exception {
    HgCatCommand cmd = new HgCatCommand(repo);
    final Path file = Path.create("src/org/tmatesoft/hg/internal/RevlogStream.java");
    cmd.file(file);
    final Nodeid cset = Nodeid.fromAscii("08db726a0fb7914ac9d27ba26dc8bbf6385a0554");
    cmd.changeset(cset);
    final ByteArrayChannel sink = new ByteArrayChannel();
    cmd.execute(sink);
View Full Code Here

          iterateControl.stop();
          return;
        }
        if (!da.isEmpty()) {
          // although unlikely, manifest entry may be empty, when all files have been deleted from the repository
          Path fname = null;
          Flags flags = null;
          Nodeid nid = null;
          int i;
          byte[] data = da.byteArray();
          for (i = 0; i < actualLen; i++) {
View Full Code Here

    final HgDirstate ds = getDirstateImpl();
    TreeSet<Path> knownEntries = ds.all(); // here just to get dirstate initialized
    while (repoWalker.hasNext()) {
      cs.checkCancelled();
      repoWalker.next();
      final Path fname = getPathPool().mangle(repoWalker.name());
      FileInfo f = repoWalker.file();
      Path knownInDirstate;
      if (!f.exists()) {
        // file coming from iterator doesn't exist.
        if ((knownInDirstate = ds.known(fname)) != null) {
          // found in dirstate
          processed.add(knownInDirstate);
View Full Code Here

        try {
          // XXX perhaps, shall take second parent into account if not null, too?
          Nodeid nidFromDirstate = getDirstateParentManifest().nodeid(fname);
          if (nidFromDirstate != null) {
            // see if file revision known in this parent got copied from one of baseRevNames
            Path origin = HgStatusCollector.getOriginIfCopy(repo, fname, nidFromDirstate, collect.files(), baseRevision);
            if (origin != null) {
              inspector.copied(getPathPool().mangle(origin), fname);
              return;
            }
          }
View Full Code Here

    // With copy and original timestamps we pretend commit happens to an existing repository
    // in a regular manner (it's unlikely to have commits within the same second in a real life)
    // XXX Note, once we have more robust method to detect file changes (e.g. Java7), this
    // approach shall be abandoned.
    File repoLoc = RepoUtils.copyRepoToTempLocation("log-1", "test-commit-rollback");
    final Path newFilePath = Path.create("xx");
    final File newFile = new File(repoLoc, newFilePath.toString());
    RepoUtils.createFile(newFile, "xyz");
    HgRepository hgRepo = new HgLookup().detect(repoLoc);
    HgDataFile dfB = hgRepo.getFileNode("b");
    HgDataFile dfD = hgRepo.getFileNode("d");
    assertTrue("[sanity]", dfB.exists());
View Full Code Here

        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

TOP

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

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.