monotone

monotone Commit Details

Date:2005-05-21 16:59:16 (14 years 1 month ago)
Author:jcrisp@s-r-s.co.uk
Branch:net.venge.monotone.contrib.monotree
Commit:6b5a12624a5a82265a6d0f82c1e74f47c589ca66
Parents: 35cff8e8ba14155f5f7ddf7965073f514fd60f61
Message:Changed overload of exec() to be more linux friendly

Changes:
Mcontrib/monotree/Monotone.java (7 diffs)

File differences

contrib/monotree/Monotone.java
2727
2828
2929
30
3031
3132
3233
......
6061
6162
6263
63
64
64
65
6566
6667
6768
......
7071
7172
7273
73
74
7475
7576
7677
......
8182
8283
8384
84
85
8586
8687
8788
......
113114
114115
115116
117
118
119
120
121
122
123
124
125
126
127
128
129
116130
117131
118132
......
121135
122136
123137
124
138
125139
126140
127
141
128142
129
143
130144
131145
132146
......
171185
172186
173187
174
188
175189
176190
177191
178
192
179193
180194
181195
import javax.xml.transform.URIResolver;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import java.util.Arrays;
/**
* Interface class to control an inferior Monotone process and return information from it
*
* @return the base monotone command
*/
public String getBaseCommand() {
return "monotone \"--db="+database+"\" ";
public String[] getBaseCommand() {
return new String[] { "monotone","--db="+database };
}
/**
* @return a list of strings which enumerates the branches in the current monotone database
*/
public List<String> listBranches() throws IOException {
List<String> result=runMonotone("list branches");
List<String> result=runMonotone(new String[] { "list", "branches"});
return result;
}
* @return a list of strings which enumerates the heads of the specified branch in the current monotone database
*/
public List<String> listHeads(String branch) throws IOException {
List<String>result=runMonotone("heads --branch \""+branch+"\"");
List<String>result=runMonotone(new String[] { "heads", "--branch",branch});
return result;
}
BRANCHES
};
/**
* Return the full command by composing the base command and the sub-command
* @param subCommand an array of strings representing the sub-command
* @return an array of strings containing the full command
*/
private String[] getCommand(String[] subCommand) {
String[] base=getBaseCommand();
ArrayList<String> fullCommand=new ArrayList<String>();
fullCommand.addAll(Arrays.asList(base));
fullCommand.addAll(Arrays.asList(subCommand));
return fullCommand.toArray(new String[0]);
}
/**
* Run monotone and get an SVG stream from a log
*
* @return a stream from which an SVG format graph may be read
*/
public InputStream getSVGLog(final String id,final HighlightTypes highlight) throws IOException {
final String command="log --revision "+id;
final String[] command=new String[] { "log","--revision",id };
// Start the inferior processes
final Process monotone=Runtime.getRuntime().exec(getBaseCommand()+command);
final Process monotone=Runtime.getRuntime().exec(getCommand(command));
new ErrorReader("monotone",monotone.getErrorStream());
final Process dot2svg=Runtime.getRuntime().exec("dot -Tsvg");
final Process dot2svg=Runtime.getRuntime().exec(new String[] { "dot","-Tsvg" });
new ErrorReader("dot2svg",dot2svg.getErrorStream());
final PipedOutputStream gxl2dotSourceOutputStream=new PipedOutputStream();
* @param command the monotone sub-command to execute, e.g. "list branches"
* @return a string list containing the output lines from monotone's stdout
*/
public List<String> runMonotone(String command) throws IOException {
public List<String> runMonotone(String[] command) throws IOException {
List<String> results=new ArrayList<String>();
LineNumberReader source=null;
try {
Process monotone=Runtime.getRuntime().exec(getBaseCommand()+command);
Process monotone=Runtime.getRuntime().exec(getCommand(command));
new ErrorReader("monotone",monotone.getErrorStream());
source=new LineNumberReader(new InputStreamReader(monotone.getInputStream()));

Archive Download the corresponding diff file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status