mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-04-01 18:00:12 +02:00
implement mercurial pre-receive hook
This commit is contained in:
@@ -47,6 +47,8 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -68,6 +70,20 @@ public class SimpleCommand implements Command
|
||||
*/
|
||||
public SimpleCommand(String... command)
|
||||
{
|
||||
this(null, command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param environment
|
||||
* @param command
|
||||
* @since 1.8
|
||||
*/
|
||||
public SimpleCommand(Map<String, String> environment, String... command)
|
||||
{
|
||||
this.environment = environment;
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
@@ -91,6 +107,18 @@ public class SimpleCommand implements Command
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param environment
|
||||
* @since 1.8
|
||||
*/
|
||||
public void setEnvironment(Map<String, String> environment)
|
||||
{
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -134,6 +162,11 @@ public class SimpleCommand implements Command
|
||||
processBuilder = processBuilder.directory(workDirectory);
|
||||
}
|
||||
|
||||
if (environment != null)
|
||||
{
|
||||
processBuilder.environment().putAll(environment);
|
||||
}
|
||||
|
||||
return processBuilder.redirectErrorStream(true).start();
|
||||
}
|
||||
|
||||
@@ -208,6 +241,9 @@ public class SimpleCommand implements Command
|
||||
/** Field description */
|
||||
private String[] command;
|
||||
|
||||
/** Field description */
|
||||
private Map<String, String> environment;
|
||||
|
||||
/** Field description */
|
||||
private File workDirectory;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user