/** * Process a line while in "GET_FILE" state. * * @param line the line */ private void processFile(final String line) { if (line.startsWith("Working file:")) { m_file = line.substring(14, line.length()); File repo = new File(new File(owner.getDir(), m_file).getParentFile(), "CVS/Repository"); try { String module = FileUtils.readFileToString(repo, null);// not sure what encoding CVS uses. String simpleName = m_file.substring(m_file.lastIndexOf('/') + 1); m_fullName = '/' + module.trim() + '/' + simpleName; } catch (IOException e) { // failed to read LOGGER.log(Level.WARNING, "Failed to read CVS/Repository at " + repo, e); m_fullName = null; } m_status = GET_SYMBOLIC_NAMES; } }
/** * Validate the parameters specified for task. * * @throws BuildException if fails validation checks */ private void validate() throws BuildException { if (null == m_dir) { m_dir = getProject().getBaseDir(); } if (null == m_output) { final String message = "Destfile must be set."; throw new BuildException(message); } if (!m_dir.exists()) { final String message = "Cannot find base dir " + m_dir.getAbsolutePath(); throw new BuildException(message); } if (null != m_usersFile && !m_usersFile.exists()) { final String message = "Cannot find user lookup list " + m_usersFile.getAbsolutePath(); throw new BuildException(message); } }
validate(); final Properties userList = new Properties(); loadUserlist(userList); setCommand("log"); myCvsVersion.setProject(getProject()); myCvsVersion.setTaskName("cvsversion"); myCvsVersion.setCvsRoot(getCvsRoot()); myCvsVersion.setCvsRsh(getCvsRsh()); myCvsVersion.setPassfile(getPassFile()); myCvsVersion.setDest(m_dir); myCvsVersion.execute(); if (supportsCvsLogWithSOption(myCvsVersion.getClientVersion()) && supportsCvsLogWithSOption(myCvsVersion.getServerVersion())) { addCommandArgument("-S"); addCommandArgument("-d"); addCommandArgument(dateRange); addCommandArgument("--"); for (String file : m_filesets) { addCommandArgument(file); log("Running " + getCommand() + " at " + m_dir, Project.MSG_VERBOSE); setDest(m_dir); try {
task.setProject(new org.apache.tools.ant.Project()); task.setCvsExe(cvsExe); task.setDir(ws); if (cvspassFile.length() != 0) { task.setPassfile(new File(cvspassFile)); task.setCvsRoot(":fork:" + cvsroot); } else if (canUseUpdate && cvsroot.startsWith(":local:")) { task.setCvsRoot(":fork:" + cvsroot.substring(7)); } else { task.setCvsRoot(cvsroot); task.setCvsRsh(cvsRsh); task.setFailOnError(true); BufferedOutputStream bufferedOutput = new BufferedOutputStream(out); task.setDeststream(bufferedOutput); task.setBranch(branch); task.setTag(isTag() ? ":" + branch : branch); task.setStart(startTime); task.setEnd(endTime); if (changedFiles != null) { task.addFile(filePath); task.setPackage(getAllModulesNormalized()); task.execute();
validate(); final Properties userList = new Properties(); loadUserlist(userList); setCommand("log"); myCvsVersion.setProject(getProject()); myCvsVersion.setTaskName("cvsversion"); myCvsVersion.setCvsRoot(getCvsRoot()); myCvsVersion.setCvsRsh(getCvsRsh()); myCvsVersion.setPassfile(getPassFile()); myCvsVersion.setDest(m_dir); myCvsVersion.execute(); if (supportsCvsLogWithSOption(myCvsVersion.getClientVersion()) && supportsCvsLogWithSOption(myCvsVersion.getServerVersion())) { addCommandArgument("-S"); addCommandArgument("-d"); addCommandArgument(dateRange); addCommandArgument("--"); for (String file : m_filesets) { addCommandArgument(file); log("Running " + getCommand() + " at " + m_dir, Project.MSG_VERBOSE); setDest(m_dir); try {
task.setProject(new org.apache.tools.ant.Project()); task.setCvsExe(cvsExe); task.setDir(processingPath); if (cvspassFile.length() != 0) { task.setPassfile(new File(cvspassFile)); task.setCvsRoot(":fork:" + moduleLocation.getCvsroot()); } else if (canUseUpdate && moduleLocation.getCvsroot().startsWith(":local:")) { task.setCvsRoot(":fork:" + moduleLocation.getCvsroot().substring(7)); } else { task.setCvsRoot(moduleLocation.getCvsroot()); task.setCvsRsh(cvsRsh); task.setFailOnError(true); BufferedOutputStream bufferedOutput = new BufferedOutputStream(out); task.setDeststream(bufferedOutput); task.setBranch(moduleLocation.getBranch()); task.setTag(moduleLocation.getBranch()); task.setStart(startTime); task.setEnd(endTime); if (changedFiles != null) { task.addFile(filePath); task.setPackage(moduleLocation.getNormalizedModules()); task.execute();
/** * Validate the parameters specified for task. * * @throws BuildException if fails validation checks */ private void validate() throws BuildException { if (null == m_dir) { m_dir = getProject().getBaseDir(); } if (null == m_output) { final String message = "Destfile must be set."; throw new BuildException(message); } if (!m_dir.exists()) { final String message = "Cannot find base dir " + m_dir.getAbsolutePath(); throw new BuildException(message); } if (null != m_usersFile && !m_usersFile.exists()) { final String message = "Cannot find user lookup list " + m_usersFile.getAbsolutePath(); throw new BuildException(message); } }
/** * Process a line while in "GET_FILE" state. * * @param line the line */ private void processFile(final String line) { if (line.startsWith("Working file:")) { m_file = line.substring(14, line.length()); File repo = new File(new File(owner.getDir(), m_file).getParentFile(), "CVS/Repository"); try { String module = FileUtils.readFileToString(repo, null);// not sure what encoding CVS uses. String simpleName = m_file.substring(m_file.lastIndexOf('/') + 1); m_fullName = '/' + module.trim() + '/' + simpleName; } catch (IOException e) { // failed to read LOGGER.log(Level.WARNING, "Failed to read CVS/Repository at " + repo, e); m_fullName = null; } m_status = GET_SYMBOLIC_NAMES; } }
/** * Print changelog to file specified in task. * * @param entrySet the entry set to write. * @throws BuildException if there is an error writing changelog. */ private void writeChangeLog(final CVSEntry[] entrySet) throws BuildException { OutputStream output = null; try { output = m_output; final PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, "UTF-8")); final ChangeLogWriter serializer = new ChangeLogWriter(); serializer.printChangeLog(writer, entrySet); } catch (final UnsupportedEncodingException uee) { getProject().log(uee.toString(), Project.MSG_ERR); } catch (final IOException ioe) { throw new BuildException(ioe.toString(), ioe); } finally { IOUtils.closeQuietly(output); } } }
/** * Print changelog to file specified in task. * * @param entrySet the entry set to write. * @throws BuildException if there is an error writing changelog. */ private void writeChangeLog(final CVSEntry[] entrySet) throws BuildException { OutputStream output = null; try { output = m_output; final PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, "UTF-8")); final ChangeLogWriter serializer = new ChangeLogWriter(); serializer.printChangeLog(writer, entrySet); } catch (final UnsupportedEncodingException uee) { getProject().log(uee.toString(), Project.MSG_ERR); } catch (final IOException ioe) { throw new BuildException(ioe.toString(), ioe); } finally { IOUtils.closeQuietly(output); } } }