mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
bug fixes for issue "#1 HTTP ERROR 500 when using hgweb on Windows"
This commit is contained in:
@@ -79,6 +79,17 @@ public class HgConfig extends SimpleRepositoryConfig
|
||||
return pythonBinary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getPythonPath()
|
||||
{
|
||||
return pythonPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -116,6 +127,17 @@ public class HgConfig extends SimpleRepositoryConfig
|
||||
this.pythonBinary = pythonBinary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param pythonPath
|
||||
*/
|
||||
public void setPythonPath(String pythonPath)
|
||||
{
|
||||
this.pythonPath = pythonPath;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@@ -123,4 +145,7 @@ public class HgConfig extends SimpleRepositoryConfig
|
||||
|
||||
/** Field description */
|
||||
private String pythonBinary;
|
||||
|
||||
/** Field description */
|
||||
private String pythonPath = "";
|
||||
}
|
||||
|
||||
@@ -38,9 +38,11 @@ package sonia.scm.web;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import sonia.scm.repository.HgConfig;
|
||||
import sonia.scm.repository.HgRepositoryHandler;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RepositoryManager;
|
||||
import sonia.scm.util.AssertUtil;
|
||||
import sonia.scm.web.cgi.AbstractCGIServlet;
|
||||
import sonia.scm.web.cgi.EnvList;
|
||||
|
||||
@@ -63,6 +65,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||
public class HgCGIServlet extends AbstractCGIServlet
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String ENV_PYTHON_PATH = "SCM_PYTHON_PATH";
|
||||
|
||||
/** Field description */
|
||||
public static final String ENV_REPOSITORY_NAME = "REPO_NAME";
|
||||
|
||||
@@ -139,11 +144,42 @@ public class HgCGIServlet extends AbstractCGIServlet
|
||||
list.set(ENV_REPOSITORY_PATH, directory.getAbsolutePath());
|
||||
list.set(ENV_REPOSITORY_NAME, name);
|
||||
|
||||
String pythonPath = "";
|
||||
HgConfig config = handler.getConfig();
|
||||
|
||||
if (config != null)
|
||||
{
|
||||
pythonPath = config.getPythonPath();
|
||||
|
||||
if (pythonPath == null)
|
||||
{
|
||||
pythonPath = "";
|
||||
}
|
||||
}
|
||||
|
||||
list.set(ENV_PYTHON_PATH, pythonPath);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected String getCmdPrefix()
|
||||
{
|
||||
HgConfig config = handler.getConfig();
|
||||
|
||||
AssertUtil.assertIsNotNull(config);
|
||||
|
||||
return config.getPythonBinary();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user