Package org.eclipse.jgit.lib.RepositoryCache

Examples of org.eclipse.jgit.lib.RepositoryCache.FileKey


  @Override
  protected void run() throws Exception {
    final org.eclipse.jgit.transport.ReceivePack rp;

    try {
      FileKey key = FileKey.lenient(dstGitdir, FS.DETECTED);
      db = key.open(true /* must exist */);
    } catch (RepositoryNotFoundException notFound) {
      throw die(MessageFormat.format(CLIText.get().notAGitRepository,
          dstGitdir.getPath()));
    }

View Full Code Here


      File dir = FileKey.resolve(new File(base, name), FS.DETECTED);
      if (dir == null)
        continue;

      try {
        FileKey key = FileKey.exact(dir, FS.DETECTED);
        db = RepositoryCache.open(key, true);
      } catch (IOException e) {
        throw new RepositoryNotFoundException(name, e);
      }
View Full Code Here

  @Test
  public void testFileKeyOpenExisting() throws IOException {
    Repository r;

    r = new FileKey(db.getDirectory(), db.getFS()).open(true);
    assertNotNull(r);
    assertEqualsFile(db.getDirectory(), r.getDirectory());
    r.close();

    r = new FileKey(db.getDirectory(), db.getFS()).open(false);
    assertNotNull(r);
    assertEqualsFile(db.getDirectory(), r.getDirectory());
    r.close();
  }
View Full Code Here

    n.close();
    recursiveDelete(gitdir);
    assertFalse(gitdir.exists());

    try {
      new FileKey(gitdir, db.getFS()).open(true);
      fail("incorrectly opened a non existant repository");
    } catch (RepositoryNotFoundException e) {
      assertEquals("repository not found: " + gitdir.getCanonicalPath(),
          e.getMessage());
    }

    final Repository o = new FileKey(gitdir, db.getFS()).open(false);
    assertNotNull(o);
    assertEqualsFile(gitdir, o.getDirectory());
    assertFalse(gitdir.exists());
  }
View Full Code Here

    assertSame(db, RepositoryCache.open(FileKey.lenient(parent, db.getFS())));
  }

  @Test
  public void testCacheOpen() throws Exception {
    final FileKey loc = FileKey.exact(db.getDirectory(), db.getFS());
    final Repository d2 = RepositoryCache.open(loc);
    assertNotSame(db, d2);
    assertSame(d2, RepositoryCache.open(FileKey.exact(loc.getFile(), db.getFS())));
    d2.close();
    d2.close();
  }
View Full Code Here

  }

  private AlternateHandle openAlternate(File objdir) throws IOException {
    final File parent = objdir.getParentFile();
    if (FileKey.isGitRepository(parent, fs)) {
      FileKey key = FileKey.exact(parent, fs);
      FileRepository db = (FileRepository) RepositoryCache.open(key);
      return new AlternateRepository(db);
    }

    ObjectDirectory db = new ObjectDirectory(config, objdir, null, fs, null);
View Full Code Here

  @Override
  protected void run() throws Exception {
    final org.eclipse.jgit.transport.UploadPack up;

    try {
      FileKey key = FileKey.lenient(srcGitdir, FS.DETECTED);
      db = key.open(true /* must exist */);
    } catch (RepositoryNotFoundException notFound) {
      throw die(MessageFormat.format(CLIText.get().notAGitRepository,
          srcGitdir.getPath()));
    }

View Full Code Here

  @Override
  protected void run() throws Exception {
    final org.eclipse.jgit.transport.ReceivePack rp;

    try {
      FileKey key = FileKey.lenient(dstGitdir, FS.DETECTED);
      db = key.open(true /* must exist */);
    } catch (RepositoryNotFoundException notFound) {
      throw die(MessageFormat.format(CLIText.get().notAGitRepository,
          dstGitdir.getPath()));
    }

View Full Code Here

  }

  public void testFileKeyOpenExisting() throws IOException {
    Repository r;

    r = new FileKey(db.getDirectory(), db.getFS()).open(true);
    assertNotNull(r);
    assertEquals(db.getDirectory(), r.getDirectory());
    r.close();

    r = new FileKey(db.getDirectory(), db.getFS()).open(false);
    assertNotNull(r);
    assertEquals(db.getDirectory(), r.getDirectory());
    r.close();
  }
View Full Code Here

    n.close();
    recursiveDelete(gitdir);
    assertFalse(gitdir.exists());

    try {
      new FileKey(gitdir, db.getFS()).open(true);
      fail("incorrectly opened a non existant repository");
    } catch (RepositoryNotFoundException e) {
      assertEquals("repository not found: " + gitdir, e.getMessage());
    }

    final Repository o = new FileKey(gitdir, db.getFS()).open(false);
    assertNotNull(o);
    assertEquals(gitdir, o.getDirectory());
    assertFalse(gitdir.exists());
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.lib.RepositoryCache.FileKey

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.