/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/**
* Parse a stream of mercurial log comments.
*/
/** Prefix which identifies lines with the description of a commit. */
this.repository = repository;
}
/**
* Parse the history for the specified file or directory. If a changeset is
* specified, only return the history from the changeset right after the
* specified one.
*
* @param file the file or directory to get history for
* @param changeset the changeset right before the first one to fetch, or
* {@code null} if all changesets should be fetched
* @return history for the specified file or directory
* @throws HistoryException if an error happens when parsing the history
*/
try {
if (status != 0) {
throw new HistoryException("Failed to get history for '" +
}
} catch (IOException e) {
throw new HistoryException("Failed to get history for '" +
}
// If a changeset to start from is specified, remove that changeset
// from the list, since only the ones following it should be returned.
// Also check that the specified changeset was found, otherwise throw
// an exception.
}
}
/**
* Process the output from the hg log command and insert the HistoryEntries
* into the history field.
*
* @param input The output from the process
* @throws IOException If an error occurs while reading the stream
*/
@SuppressWarnings("null")
String s;
}
if (s.startsWith("changeset:")) {
entry = new HistoryEntry();
if (idx != -1) {
}
}
entry.setRevision(s);
// strip off hgsubversion UUID since
}
try {
} catch (ParseException pe) {
+ pe.getMessage());
}
// applies to directories only
if (s.isEmpty()) {
break;
}
try {
} catch (FileNotFoundException e) { // NOPMD
// If the file is not located under the source root,
// ignore it (bug #11664).
}
}
}
}
}
/**
* Decode a line with a description of a commit. The line is a sequence of
* XML character entities that need to be converted to single characters.
* This is to prevent problems if the log message contains one of the
* prefixes that {@link #processStream(InputStream)} is looking for (bug
* #405).
*
* This method is way too tolerant, and won't complain if the line has
* a different format than expected. It will return weird results, though.
*
* @param line the XML encoded line
* @return the decoded description
*/
int value = 0;
// fetch the char values from the &#ddd; sequences
} else if (ch == ';') {
value = 0;
}
}
}
}