• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to link CVS with Java  RSS feed

 
pkinuk Buler
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all

I am requested to write a Java program to retrieve the log messages for every version for the file.

I've figured out how to attach it using CVS command line:

1. cvs -d /usr/local/cvsroot rdiff -s -r branch1 -r branch2 > diffs
Creates a summary of changes, nice and concise, just lists the changed files between tags. The result is saved in a file called diffs

2. cvs -d /usr/local/cvsroot rlog hippo.java
Assuming the hippo.java file has been updated and get the log message for each version

The question is how can I run above command line using Java and show the log messages in (say ) JTextArea?

I googled "CVS Java". There is not any useful information on line. Only the JCVS is useful for me, but no tutorial is found for the JCVS.

I hope someone can give a hint where I should start.

Thank you in advance.

 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use the Runtime.exec() method, or a ProcessBuilder. Both of which are designed to generate new processes to execute external commands from Java code. You can then read the results of the execution using the streams from the returned Process.

Just be sure to read this article from M.C. Daconta: When Runtime.exec() won't
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pkinuk Buler wrote:I googled "CVS Java". There is not any useful information on line. Only the JCVS is useful for me, but no tutorial is found for the JCVS.

Really? Using java cvs I found JavaCVS among others which as a full Javadoc API available. I also found jCVS and there are a few links in the Javadoc section.

Sure, neither has a full tutorial, but when I browse through the available classes I see a class named CVSClient in both. Starting from that class you should be able to at least do something - like process / perform CVSRequests to get CVSResponses (again classes available in both libraries).

I do think that JavaCVS seems to be easier. Unlike jCVS it has subclasses for different types of requests, like CheckoutRequest, SingleFileCVSRequest and MultiFileCVSRequest.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!