mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-06 20:30:52 +01:00
support for mercurial 2.1
This commit is contained in:
@@ -184,6 +184,15 @@ public interface CGIExecutor
|
||||
*/
|
||||
public File getWorkDirectory();
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @since 1.12
|
||||
*/
|
||||
public boolean isContentLengthWorkaround();
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -210,6 +219,14 @@ public interface CGIExecutor
|
||||
*/
|
||||
public void setBufferSize(int bufferSize);
|
||||
|
||||
/**
|
||||
* Method description
|
||||
* @since 1.12
|
||||
*
|
||||
* @param contentLengthWorkaround
|
||||
*/
|
||||
public void setContentLengthWorkaround(boolean contentLengthWorkaround);
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
@@ -46,8 +46,8 @@ import sonia.scm.repository.HgConfig;
|
||||
import sonia.scm.repository.HgHookManager;
|
||||
import sonia.scm.repository.HgRepositoryHandler;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RepositoryRequestListenerUtil;
|
||||
import sonia.scm.repository.RepositoryProvider;
|
||||
import sonia.scm.repository.RepositoryRequestListenerUtil;
|
||||
import sonia.scm.util.AssertUtil;
|
||||
import sonia.scm.web.cgi.CGIExecutor;
|
||||
import sonia.scm.web.cgi.CGIExecutorFactory;
|
||||
@@ -228,6 +228,7 @@ public class HgCGIServlet extends HttpServlet
|
||||
CGIExecutor executor = cgiExecutorFactory.createExecutor(configuration,
|
||||
getServletContext(), request, response);
|
||||
|
||||
executor.setContentLengthWorkaround(true);
|
||||
executor.getEnvironment().set(ENV_REPOSITORY_NAME, name);
|
||||
executor.getEnvironment().set(ENV_REPOSITORY_PATH,
|
||||
directory.getAbsolutePath());
|
||||
|
||||
@@ -128,6 +128,12 @@ public class DefaultCGIExecutor extends AbstractCGIExecutor
|
||||
File command = new File(cmd);
|
||||
EnvList env = new EnvList(environment);
|
||||
|
||||
// workaround for mercurial 2.1
|
||||
if (isContentLengthWorkaround())
|
||||
{
|
||||
env.set(ENV_CONTENT_LENGTH, Integer.toString(request.getContentLength()));
|
||||
}
|
||||
|
||||
if (workDirectory == null)
|
||||
{
|
||||
workDirectory = command.getParentFile();
|
||||
@@ -161,7 +167,7 @@ public class DefaultCGIExecutor extends AbstractCGIExecutor
|
||||
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace(environment.toString());
|
||||
logger.trace(env.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,8 +175,7 @@ public class DefaultCGIExecutor extends AbstractCGIExecutor
|
||||
|
||||
try
|
||||
{
|
||||
p = Runtime.getRuntime().exec(execCmd, environment.getEnvArray(),
|
||||
workDirectory);
|
||||
p = Runtime.getRuntime().exec(execCmd, env.getEnvArray(), workDirectory);
|
||||
execute(p);
|
||||
}
|
||||
catch (Throwable ex)
|
||||
@@ -205,8 +210,33 @@ public class DefaultCGIExecutor extends AbstractCGIExecutor
|
||||
return exceptionHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isContentLengthWorkaround()
|
||||
{
|
||||
return contentLengthWorkaround;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param contentLengthWorkaround
|
||||
*/
|
||||
@Override
|
||||
public void setContentLengthWorkaround(boolean contentLengthWorkaround)
|
||||
{
|
||||
this.contentLengthWorkaround = contentLengthWorkaround;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -593,6 +623,9 @@ public class DefaultCGIExecutor extends AbstractCGIExecutor
|
||||
/** Field description */
|
||||
private ScmConfiguration configuration;
|
||||
|
||||
/** Field description */
|
||||
private boolean contentLengthWorkaround = false;
|
||||
|
||||
/** Field description */
|
||||
private ServletContext context;
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ public class ChangesetViewerITCase extends AbstractAdminITCaseBase
|
||||
{
|
||||
RepositoryClient rc = createRepositoryClient();
|
||||
|
||||
rc.checkout();
|
||||
rc.init();
|
||||
addTestFile(rc, "a", 1, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user