Store repository id in git config for each repository

This is needed after migration from v1 to v2 and is done in
GitV1UpdateStep.java. Therefore we hat to make the 'forAllPaths' method
in PathBasedRepositoryLocationResolver available in the interface of
RepositoryLocationResolver.
This commit is contained in:
René Pfeuffer
2019-07-03 07:48:06 +02:00
parent 8f7ca34fa2
commit c35363b79f
14 changed files with 158 additions and 52 deletions

View File

@@ -1,5 +1,7 @@
package sonia.scm.repository;
import java.util.function.BiConsumer;
public abstract class RepositoryLocationResolver {
public abstract boolean supportsLocationType(Class<?> type);
@@ -35,5 +37,12 @@ public abstract class RepositoryLocationResolver {
* @throws IllegalStateException when there already is a location for the given repository registered.
*/
void setLocation(String repositoryId, T location);
/**
* Iterates all repository locations known to this resolver instance and calls the consumer giving the repository id
* and its location for each repository.
* @param consumer This callback will be called for each repository with the repository id and its location.
*/
void forAllLocations(BiConsumer<String, T> consumer);
}
}

View File

@@ -0,0 +1,11 @@
package sonia.scm.update;
import sonia.scm.repository.Repository;
/**
* Use this in {@link sonia.scm.migration.UpdateStep}s only to read repository objects directly from locations given by
* {@link sonia.scm.repository.RepositoryLocationResolver}.
*/
public interface UpdateStepRepositoryMetadataAccess<T> {
Repository read(T location);
}