mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
Refactor the repository store implementation in order to store repositories in specific paths.
This commit is contained in:
@@ -6,15 +6,12 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
public class HgConfigDto extends HalRepresentation {
|
||||
|
||||
private boolean disabled;
|
||||
private File repositoryDirectory;
|
||||
|
||||
private String encoding;
|
||||
private String hgBinary;
|
||||
|
||||
@@ -52,32 +52,6 @@ import sonia.scm.net.ahc.AdvancedHttpClient;
|
||||
public abstract class AbstractHgInstaller implements HgInstaller
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String DIRECTORY_REPOSITORY = "repositories";
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param baseDirectory
|
||||
* @param config
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
public void install(File baseDirectory, HgConfig config) throws IOException
|
||||
{
|
||||
File repoDirectory = new File(
|
||||
baseDirectory,
|
||||
DIRECTORY_REPOSITORY.concat(File.separator).concat(
|
||||
HgRepositoryHandler.TYPE_NAME));
|
||||
|
||||
IOUtil.mkdirs(repoDirectory);
|
||||
config.setRepositoryDirectory(repoDirectory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
|
||||
@@ -74,8 +74,6 @@ public class UnixHgInstaller extends AbstractHgInstaller
|
||||
@Override
|
||||
public void install(File baseDirectory, HgConfig config) throws IOException
|
||||
{
|
||||
super.install(baseDirectory, config);
|
||||
|
||||
// search mercurial (hg)
|
||||
if (Util.isEmpty(config.getHgBinary()))
|
||||
{
|
||||
|
||||
@@ -116,8 +116,6 @@ public class WindowsHgInstaller extends AbstractHgInstaller
|
||||
@Override
|
||||
public void install(File baseDirectory, HgConfig config) throws IOException
|
||||
{
|
||||
super.install(baseDirectory, config);
|
||||
|
||||
if (Util.isEmpty(config.getPythonBinary()))
|
||||
{
|
||||
String pythonBinary = getPythonBinary();
|
||||
|
||||
@@ -111,16 +111,16 @@ public class HgRepositoryHandler
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param storeFactory
|
||||
* @param storeFactory
|
||||
* @param fileSystem
|
||||
* @param hgContextProvider
|
||||
* @param repositoryLocationResolver
|
||||
*/
|
||||
@Inject
|
||||
public HgRepositoryHandler(ConfigurationStoreFactory storeFactory, FileSystem fileSystem,
|
||||
Provider<HgContext> hgContextProvider)
|
||||
Provider<HgContext> hgContextProvider, RepositoryLocationResolver repositoryLocationResolver)
|
||||
{
|
||||
super(storeFactory, fileSystem);
|
||||
super(storeFactory, fileSystem, repositoryLocationResolver);
|
||||
this.hgContextProvider = hgContextProvider;
|
||||
|
||||
try
|
||||
@@ -566,8 +566,7 @@ public class HgRepositoryHandler
|
||||
|
||||
if (c != null)
|
||||
{
|
||||
File repositoryDirectroy = c.getRepositoryDirectory();
|
||||
|
||||
File repositoryDirectroy = getInitialBaseDirectory();
|
||||
if (repositoryDirectroy.exists())
|
||||
{
|
||||
File lockFile = new File(repositoryDirectroy, PATH_HOOK);
|
||||
|
||||
@@ -123,8 +123,9 @@ public class HgHookChangesetProvider implements HookChangesetProvider
|
||||
*/
|
||||
private Repository open()
|
||||
{
|
||||
File directory = handler.getConfig().getRepositoryDirectory();
|
||||
File repositoryDirectory = new File(directory, id);
|
||||
sonia.scm.repository.Repository repo = new sonia.scm.repository.Repository();
|
||||
repo.setId(id);
|
||||
File repositoryDirectory = handler.getDirectory(repo);
|
||||
|
||||
// use HG_PENDING only for pre receive hooks
|
||||
boolean pending = type == RepositoryHookType.PRE_RECEIVE;
|
||||
|
||||
Reference in New Issue
Block a user