/** Utility method that saves the current entry. */ private void saveEntry() { final String entryKey = m_date + m_author + m_comment; CVSEntry entry; if (!m_entries.containsKey(entryKey)) { entry = new CVSEntry(parseDate(m_date), m_author, m_comment); m_entries.put(entryKey, entry); } else { entry = m_entries.get(entryKey); } String branch = findBranch(m_revision); owner.log( "Recorded a change: " + m_date + ',' + m_author + ',' + m_revision + "(branch=" + branch + ")," + m_comment, Project.MSG_VERBOSE); entry.addFile(m_file, m_fullName, m_revision, m_previousRevision, branch, m_dead); }
/** * Parse date out from expected format. * * @param date the string holding dat * @return the date object or null if unknown date format */ private Date parseDate(String date) { for (SimpleDateFormat df : c_inputDate) { try { return df.parse(date); } catch (ParseException e) { LOGGER.log(Level.FINER, "Couldn't convert " + date + " to format " + df); } } // nothing worked owner.log("Failed to parse " + date + "\n", Project.MSG_ERR); // final String message = REZ.getString( "changelog.bat-date.error", date ); // getContext().error( message ); return null; }
/** * 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; } }