mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
Harmonize repository resolution
This commit is contained in:
@@ -124,7 +124,7 @@ public class AbstractHgHandler
|
||||
protected AbstractHgHandler(HgRepositoryHandler handler, HgContext context,
|
||||
Repository repository)
|
||||
{
|
||||
this(handler, context, repository, handler.getDirectory(repository));
|
||||
this(handler, context, repository, handler.getDirectory(repository.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -114,7 +114,6 @@ public class HgRepositoryHandler
|
||||
RepositoryLocationResolver repositoryLocationResolver)
|
||||
{
|
||||
super(storeFactory, repositoryLocationResolver);
|
||||
this.repositoryLocationResolver = repositoryLocationResolver;
|
||||
this.hgContextProvider = hgContextProvider;
|
||||
|
||||
try
|
||||
@@ -428,10 +427,6 @@ public class HgRepositoryHandler
|
||||
}
|
||||
}
|
||||
|
||||
public File getDirectory(String repositoryId) {
|
||||
return repositoryLocationResolver.getRepositoryDirectory(repositoryId);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@@ -439,6 +434,4 @@ public class HgRepositoryHandler
|
||||
|
||||
/** Field description */
|
||||
private JAXBContext jaxbContext;
|
||||
|
||||
private final RepositoryLocationResolver repositoryLocationResolver;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class AbstractHgPushOrPullCommand extends AbstractCommand
|
||||
if (repo != null)
|
||||
{
|
||||
url =
|
||||
handler.getDirectory(request.getRemoteRepository()).getAbsolutePath();
|
||||
handler.getDirectory(request.getRemoteRepository().getId()).getAbsolutePath();
|
||||
}
|
||||
else if (request.getRemoteUrl() != null)
|
||||
{
|
||||
|
||||
@@ -81,7 +81,7 @@ public class HgIncomingCommand extends AbstractCommand
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public ChangesetPagingResult getIncomingChangesets(IncomingCommandRequest request) {
|
||||
File remoteRepository = handler.getDirectory(request.getRemoteRepository());
|
||||
File remoteRepository = handler.getDirectory(request.getRemoteRepository().getId());
|
||||
|
||||
com.aragost.javahg.Repository repository = open();
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public class HgOutgoingCommand extends AbstractCommand
|
||||
public ChangesetPagingResult getOutgoingChangesets(
|
||||
OutgoingCommandRequest request)
|
||||
{
|
||||
File remoteRepository = handler.getDirectory(request.getRemoteRepository());
|
||||
File remoteRepository = handler.getDirectory(request.getRemoteRepository().getId());
|
||||
|
||||
com.aragost.javahg.Repository repository = open();
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
|
||||
{
|
||||
this.repository = repository;
|
||||
this.handler = handler;
|
||||
this.repositoryDirectory = handler.getDirectory(repository);
|
||||
this.repositoryDirectory = handler.getDirectory(repository.getId());
|
||||
this.context = new HgCommandContext(hookManager, handler, repository,
|
||||
repositoryDirectory);
|
||||
}
|
||||
|
||||
@@ -253,8 +253,7 @@ public class HgCGIServlet extends HttpServlet implements ScmProviderHttpServlet
|
||||
HttpServletResponse response, Repository repository)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
String name = repository.getName();
|
||||
File directory = handler.getDirectory(repository);
|
||||
File directory = handler.getDirectory(repository.getId());
|
||||
CGIExecutor executor = cgiExecutorFactory.createExecutor(configuration,
|
||||
getServletContext(), request, response);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public class HgRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase {
|
||||
repositoryHandler.setConfig(hgConfig);
|
||||
|
||||
initRepository();
|
||||
File path = repositoryHandler.getDirectory(repository);
|
||||
File path = repositoryHandler.getDirectory(repository.getId());
|
||||
assertEquals(repoPath.toString() + File.separator + AbstractSimpleRepositoryHandler.REPOSITORIES_NATIVE_DIRECTORY, path.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,9 +94,9 @@ public abstract class IncomingOutgoingTestBase extends AbstractTestBase
|
||||
outgoing = Repository.create(createConfig(temp), outgoingDirectory);
|
||||
|
||||
handler = mock(HgRepositoryHandler.class);
|
||||
when(handler.getDirectory(incomingRepository)).thenReturn(
|
||||
when(handler.getDirectory(incomingRepository.getId())).thenReturn(
|
||||
incomingDirectory);
|
||||
when(handler.getDirectory(outgoingRepository)).thenReturn(
|
||||
when(handler.getDirectory(outgoingRepository.getId())).thenReturn(
|
||||
outgoingDirectory);
|
||||
when(handler.getConfig()).thenReturn(temp.getConfig());
|
||||
when(handler.getHgContext()).thenReturn(new HgContext());
|
||||
|
||||
Reference in New Issue
Block a user