1. Add libraries to the project 2. Write the following code to retrieve the info from CVS /** * Get the cvs log * * @param basePath * @param username * @param password * @return * @throws Exception */ public void getCVSLog(String basePath, String fileName) throws Exception { try { File cvsLocalRep = new File(basePath); CVSClient client = new CVSClient(); client.setHostName(getHostName()); client.setPort(getPort()); CVSProject project = new CVSProject(client); project.openProject(cvsLocalRep); project.setUserName(getUserName()); project.setPassword(CVSScramble.scramblePassword(getPassword(), 'A')); CVSRequest request = new CVSRequest(); request.setPServer(true); request.setUserInterface(new CVSBufferedUI()); if (!request.parseControlString(statusCommand)) { logger.info("Could not parse command specification: " + statusCommand); } CVSEntry entry = new CVSEntry(); entry.setLocalDirectory("./"); entry.setRepository(this.repository); entry.setName(fileName); CVSEntryVector entries = new CVSEntryVector(); entries.add(entry); request.setEntries(entries); CVSArgumentVector arguments = CVSArgumentVector.parseArgumentString("-NS"); request.setArguments(arguments); request.traceRequest = true; request.traceResponse = true; request.traceTCPData = true; request.traceProcessing = true; CVSResponse response = new CVSResponse(); boolean reqOk = project.performCVSRequest(request, response); if (reqOk) { project.processCVSResponse(request, response); parseResponse(response.getResultText()); logger.debug(response.getResultText()); } else { logger.error("FAILED to perform cvs request."); } } catch (IOException e) { logger.error("FAILED to perform cvs request. ERROR:" + e.getMessage()); } } /** * Parse the response * * @param response */ public void parseResponse(String response) { // Get head version Pattern p = Pattern.compile(ProcedureCheckerUtil.CVS_VERSION_INFO); Matcher m = p.matcher(response); if (m.find()) { String group = m.group(); String[] versionInfo = group.split("//n"); if (versionInfo.length == 2) { this.setLatestVersion(versionInfo[0].replaceAll("revision", "").trim()); String[] info = versionInfo[1].split(";"); for (int i = 0, len = info.length; i < len; i++) { if (info[i] != null) { if (info[i].trim().indexOf("date:") != -1) { this.setLastUpdateDateTime(info[i].replaceAll("date:", "").trim()); } else if (info[i].trim().indexOf("author:") != -1) { this.setLastUpdateAuthor(info[i].replaceAll("author:", "").trim()); } } } } } }