Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to checkout only the directory structure in cvsclient in Java?

Tags:

java

cvs

I am using the org-netbeans-lib-cvsclient.jar to execute various cvs commands in a java class that communicates with CVS. I am able to do a cvs checkout command, add, commit, etc.

However, I need to find out which command is equivalent to the cvs ls -R command.

Here is the code I wrote that allows to do a cvs check out:

CheckoutCommand command = new CheckoutCommand();
command.setBuilder(null);
command.setRecursive(true); 
command.setModule(module);
if(revision!=null)
{
   command.setCheckoutByRevision(revision);
}
command.setPruneDirectories(true);
command.setUseHeadIfNotFound(true); 

executeCommand(command, AnonymizerConstants.DEFAULT_LOCAL_PATH);

I need to do something similar for CVS ls -R or CVS rls

like image 497
Wael Avatar asked Aug 12 '16 08:08

Wael


People also ask

How do I checkout a folder at CVS?

Use “cvs checkout” giving the name of the directory in the cvs repository you want to checkout, where the name you give is a directory under CVSROOT, presently $CD_SOFT/cvs (eg app/alh, script). The directory you give, and all subdirectories, will be placed in your working directory.

What is CVS folder?

The CVS repository stores a complete copy of all the files and directories which are under version control. Normally, you never access any of the files in the repository directly. Instead, you use CVS commands to get your own copy of the files into a working directory, and then work on that copy.


2 Answers

There's no such command in this lib, but the good news are that you can write this command. You would basically need something like org.netbeans.lib.cvsclient.command.log.LogCommand. The main method that you need is #execute. This can be starting point:

List<Request> requests = new LinkedList<Request>();
requests.add(1, new ArgumentRequest("-R")); 
requests.add(new CommandRequest("ls\n"));
client.processRequests(requests);
like image 172
hahn Avatar answered Sep 29 '22 01:09

hahn


I found a command which is the RLogCommand that allowed me to get a list of all files on server with their revisions and info about them.

like image 31
Wael Avatar answered Sep 29 '22 02:09

Wael