Package org.eclipse.jgit.internal.storage.file

Examples of org.eclipse.jgit.internal.storage.file.ObjectDirectory$AlternateRepository


   *
   * @throws Exception
   */
  public void packAndPrune() throws Exception {
    if (db.getObjectDatabase() instanceof ObjectDirectory) {
      ObjectDirectory odb = (ObjectDirectory) db.getObjectDatabase();
      NullProgressMonitor m = NullProgressMonitor.INSTANCE;

      final File pack, idx;
      PackWriter pw = new PackWriter(db);
      try {
        Set<ObjectId> all = new HashSet<ObjectId>();
        for (Ref r : db.getAllRefs().values())
          all.add(r.getObjectId());
        pw.preparePack(m, all, Collections.<ObjectId> emptySet());

        final ObjectId name = pw.computeName();
        OutputStream out;

        pack = nameFor(odb, name, ".pack");
        out = new SafeBufferedOutputStream(new FileOutputStream(pack));
        try {
          pw.writePack(m, m, out);
        } finally {
          out.close();
        }
        pack.setReadOnly();

        idx = nameFor(odb, name, ".idx");
        out = new SafeBufferedOutputStream(new FileOutputStream(idx));
        try {
          pw.writeIndex(out);
        } finally {
          out.close();
        }
        idx.setReadOnly();
      } finally {
        pw.release();
      }

      odb.openPack(pack);
      updateServerInfo();
      prunePacked(odb);
    }
  }
View Full Code Here


  @Test
  public void testConcurrentInsertionOfBlobsToTheSameNewFanOutDirectory()
      throws Exception {
    ExecutorService e = Executors.newCachedThreadPool();
    for (int i=0; i < 100; ++i) {
      ObjectDirectory db = createBareRepository().getObjectDatabase();
      for (Future f : e.invokeAll(blobInsertersForTheSameFanOutDir(db))) {
        f.get();
      }
    }
  }
View Full Code Here

    digest(pack);
    openPack(pack);

    // Verify the only storage of b is our packed delta above.
    //
    ObjectDirectory od = (ObjectDirectory) src.getObjectDatabase();
    assertTrue("has b", src.hasObject(b));
    assertFalse("b not loose", od.fileFor(b).exists());

    // Now use b but in a different commit than what is hidden.
    //
    TestRepository<Repository> s = new TestRepository<Repository>(src);
    RevCommit N = s.commit().parent(B).add("q", b).create();
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.internal.storage.file.ObjectDirectory$AlternateRepository

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.