• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to link CVS with Java

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
bacon. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic