import java.io.*;
import java.util.*;
import com.perforce.api.*;
public class Integrate {
public static void main(String[] argv) {
/* Please see the Common.java file to see how the environment is being
* set up. This is important, but it is common to all the examples.
*/
Env env = Common.setup();
Change cl;
StringBuffer sb;
String myString="NONE";
try {
cl = new Change(env);
cl.commit();
cl.setDescription("TEST");
sb = new StringBuffer();
if(Branch.canIntegrate(env, "//Alpha/main/...@1000,1000", "//Beta/main/...", sb)) {
cl=Branch.integrate(env, "//Alpha/main/...@1000,1000", "//Beta/main/...", sb, cl);
cl.resolve(true);
cl.submit();
} else {
System.out.println("Can't integrate from //Alpha/main to //Beta/main for CL: 1000");
}
} catch (Exception ex) {
myString=ex.getMessage();
System.out.println(myString);
if(myString.indexOf("no permission") != -1) {
System.out.println("Error: No permission for inegration from //Alpha/main to //Beta/main for CL: 1000");
}
if(myString.indexOf("can't branch") != -1) {
System.out.println("Error: Can't branch from //Alpha/main to //Beta/main for CL: 1000");
}
ex.printStackTrace();
}
Utils.cleanUp();
}
}