Search in sources :

Example 1 with DelegateRepository

use of com.google.gerrit.server.git.DelegateRepository in project gerrit by GerritCodeReview.

the class ConvertRefStorage method run.

@Override
public void run() throws Exception {
    enableGracefulStop();
    Project.NameKey projectName = projectState.getNameKey();
    try (Repository repo = repoManager.openRepository(projectName)) {
        if (repo instanceof DelegateRepository) {
            ((DelegateRepository) repo).convertRefStorage(storageFormat.name(), writeLogs, backup);
        } else {
            checkState(repo instanceof FileRepository, "Repository is not an instance of FileRepository!");
            ((FileRepository) repo).convertRefStorage(storageFormat.name(), writeLogs, backup);
        }
    } catch (RepositoryNotFoundException e) {
        throw die("'" + projectName + "': not a git archive", e);
    } catch (IOException e) {
        throw die("Error converting: '" + projectName + "': " + e.getMessage(), e);
    }
}
Also used : Project(com.google.gerrit.entities.Project) FileRepository(org.eclipse.jgit.internal.storage.file.FileRepository) FileRepository(org.eclipse.jgit.internal.storage.file.FileRepository) DelegateRepository(com.google.gerrit.server.git.DelegateRepository) Repository(org.eclipse.jgit.lib.Repository) RepositoryNotFoundException(org.eclipse.jgit.errors.RepositoryNotFoundException) IOException(java.io.IOException) DelegateRepository(com.google.gerrit.server.git.DelegateRepository)

Aggregations

Project (com.google.gerrit.entities.Project)1 DelegateRepository (com.google.gerrit.server.git.DelegateRepository)1 IOException (java.io.IOException)1 RepositoryNotFoundException (org.eclipse.jgit.errors.RepositoryNotFoundException)1 FileRepository (org.eclipse.jgit.internal.storage.file.FileRepository)1 Repository (org.eclipse.jgit.lib.Repository)1