Package org.tmatesoft.hg.internal

Examples of org.tmatesoft.hg.internal.FileRenameHistory$BasicRevMap


      throw new HgInvalidFileException(msg, null).setFileName(fname).setRevisionIndex(originalChangesetIndex);
    }
    assert fnameRev != null;
    assert !Nodeid.NULL.equals(fnameRev);
    int fileRevIndex = fnameRev == null ? 0 : df.getRevisionIndex(fnameRev);
    FileRenameHistory frh = new FileRenameHistory(originalChangesetIndex, df.getChangesetRevisionIndex(fileRevIndex));
    if (frh.isOutOfRange(df, fileRevIndex)) {
      return null;
    }
    frh.build(df, fileRevIndex);
    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();
View Full Code Here


    Object[] historyA = new Object[] {"a", 2, 2, 5, 5, "c", 0, 1, 2, 4, "b", 0, 1, 0, 1};
    Object[] historyB = new Object[] {"b", 2, 3, 3, 4, "a", 0, 1, 0, 2 };
    Object[] historyC = new Object[] {"c", 0, 1, 2, 4, "b", 0, 1, 0, 1 };
    Object[] historyD = new Object[] {"d", 1, 1, 5, 5, "b", 2, 3, 3, 4, "a", 0, 1, 0, 2};
   
    FileRenameHistory frh = new FileRenameHistory(0, 5);
    for (Object[] history : new Object[][] {historyA, historyB, historyC, historyD}) {
      String fname = history[0].toString();
      HgDataFile df = repo.getFileNode(fname);
      Assert.assertFalse(frh.isOutOfRange(df, df.getLastRevision()));
      frh.build(df, df.getLastRevision());
      int recordIndex = 0;
      errorCollector.assertEquals(history.length / 5, frh.chunks());
      for (Chunk c : frh.iterate(HgIterateDirection.NewToOld)) {
        compareChunk(fname, c, history, recordIndex++);
      }
      errorCollector.assertEquals("Shall compare full history", history.length, recordIndex * 5);
    }
    //
    HgDataFile df = repo.getFileNode("d");
    Assert.assertFalse(frh.isOutOfRange(df, 0));
    frh.build(df, 0);
    errorCollector.assertEquals(1, frh.chunks());
    Chunk c = frh.iterate(NewToOld).iterator().next();
    compareChunk("abandoned d(0)", c, new Object[] { "d", 0, 0, 4, 4 }, 0);
    //
    df = repo.getFileNode("a");
    Assert.assertFalse(frh.isOutOfRange(df, 0));
    frh.build(df, 0);
    errorCollector.assertEquals(1, frh.chunks());
    c = frh.iterate(NewToOld).iterator().next();
    compareChunk("a(0) and boundary checks", c, new Object[] { "a", 0, 0, 0, 0 }, 0);
    //
    repo = Configuration.get().find("test-annotate"); // need a long file history
    df = repo.getFileNode("file1");
    Assert.assertTrue("[sanity]", repo.getChangelog().getLastRevision() >=9);
    Assert.assertTrue("[sanity]", df.exists() && df.getLastRevision() >= 9);
    frh = new FileRenameHistory(0, 9);
    frh.build(df, 9);
    errorCollector.assertEquals(1, frh.chunks());
    c = frh.iterate(NewToOld).iterator().next();
    compareChunk("regular file, no renames", c, new Object[] { "file1", 0, 9, 0, 9 }, 0);
    // restricted range
    frh = new FileRenameHistory(3, 6);
    Assert.assertFalse(frh.isOutOfRange(df, 9));
    frh.build(df, 9); // start from out of range revision
    errorCollector.assertEquals(1, frh.chunks());
    c = frh.iterate(OldToNew).iterator().next();
    compareChunk("regular file, no renames, in range 3..6", c, new Object[] { "file1", 3, 6, 3, 6 }, 0);
  }
View Full Code Here

      QueueElement p = new QueueElement(fileNode, startRev);
      if (!followRenames) {
        rv.add(p);
        return rv;
      }
      FileRenameHistory frh = new FileRenameHistory(csetStart, csetEnd);
      frh.build(fileNode, p.fileTo());
      for (Chunk c : frh.iterate(iterateDirection)) {
        rv.add(new QueueElement(c.file(), c.firstFileRev(), c.lastFileRev()));
      }
      return rv;
    }
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.internal.FileRenameHistory$BasicRevMap

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.