How do I get a list of folders from a branch in perforce?

I am using perforce api to read a list of folders in a branch in java.

I've gotten to the point that tells me to get the Branch spec.

http://www.perforce.com/perforce/doc.current/manuals/p4java-javadoc/com/perforce/p4java/server/IServer.html#getBranchSpec(java.lang.String)


The following code is used to implement the method getDirectories()

.

String serverUri = "p4java://<server-address>:1666?userName=username&password=password";
IServer server = ServerFactory.getServer(serverUri, null);
server.connect();

List<IFileSpec> inputList = FileSpecBuilder.makeFileSpecList("//domain/code/branches/");
System.out.println("HelloPerforce.main() >> passed list >> " + inputList );

List<IFileSpec> outputList =  server.getDirectories(inputList , false, false, false);
System.out.println("HelloPerforce.main()  >> directory list >> " + outputList );

      

Conclusion: . OutputList is null.

Expected Result: List of folder names within the directory //domain/code/branches

.

Can someone please point me to what I am missing here?

+3


source to share


1 answer


What you want is getDirectories (). A branch specification is a mapping between two branches (which are usually, but not necessarily, the main depot paths). Usually, if you are talking about one "branch", what you say is the depot path, for example. "// depot / main", not a branch specification. To get a list of folders in the "main" section, you must request a list of directories that match "// depot / main / *".



+2


source







All Articles