ArrayList<Nodeid> parseResult = new ArrayList<Nodeid>(nodes.size() * 4);
while (st.nextToken() != StreamTokenizer.TT_EOF) {
parseResult.add(Nodeid.fromAscii(st.sval));
}
if (parseResult.size() != nodes.size() * 4) {
throw new HgRemoteConnectionException(String.format("Bad number of nodeids in result (shall be factor 4), expected %d, got %d", nodes.size()*4, parseResult.size()));
}
ArrayList<RemoteBranch> rv = new ArrayList<RemoteBranch>(nodes.size());
for (int i = 0; i < nodes.size(); i++) {
RemoteBranch rb = new RemoteBranch(parseResult.get(i*4), parseResult.get(i*4 + 1), parseResult.get(i*4 + 2), parseResult.get(i*4 + 3));
rv.add(rb);
}
return rv;
} catch (IOException ex) {
throw new HgRemoteConnectionException("Communication failure", ex).setRemoteCommand(CMD_BRANCHES).setServerInfo(getLocation());
} finally {
remote.sessionEnd();
}
}