/*
* 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
*/
/*
*/
/**
* Access to a Git repository.
*
*/
/** The property name used to obtain the client command for this repository. */
"org.opensolaris.opengrok.history.git";
/** The command to use to access the repository if none was given explicitly */
/** git blame command */
public GitRepository() {
type = "git";
datePattern = "EEE MMM dd hh:mm:ss yyyy ZZZZ";
}
/**
* Get path of the requested file given a commit hash.
* Useful for tracking the path when file has changed its location.
*
* @param fileName name of the file to retrieve the path
* @param revision commit hash to track the path of the file
* @return full path of the file on success; null string on failure
*/
if (status != 0) {
return path;
}
try {
break;
}
}
} finally {
}
return path;
}
/**
* Get an executor to be used for retrieving the history log for the
* named file.
*
* @param file The file to retrieve history for
* @return An Executor ready to be started
*/
throws IOException
{
}
if (sinceRevision != null) {
}
}
}
/**
* Create a {@code Reader} that reads an {@code InputStream} using the
* correct character encoding.
*
* @param input a stream with the output from a log or blame command
* @return a reader that reads the input
* @throws IOException if the reader cannot be created
*/
// Bug #17731: Git always encodes the log output using UTF-8 (unless
// overridden by i18n.logoutputencoding, but let's assume that hasn't
// been done for now). Create a reader that uses UTF-8 instead of the
// platform's default encoding.
}
{
byte[] buffer = new byte[8192];
try {
int len;
boolean error = true;
error = false;
if (len > 0) {
}
}
if (error) {
if (len > 0) {
}
}
}
} finally {
// Clean up zombie-processes...
try {
} catch (IllegalThreadStateException exp) {
// the process is still running??? just kill it..
}
}
}
return ret;
}
/**
*
* @param file file to annotate
* @param revision revision to annotate
* @return file annotation
*/
}
// File might have changed its location
if (status != 0) {
if (status != 0) {
}
try {
}
if (status != 0) {
}
break;
}
}
} finally {
}
}
if (status != 0) {
"Failed to get annotations for: \"{0}\" Exit code: {1}",
}
return parseAnnotation(
}
throws IOException
{
int lineno = 0;
++lineno;
} else {
"Error: did not find annotation in line {0}: [{1}] of {2}",
}
}
return ret;
}
return true;
}
}
}
}
}
// Todo: is there a cheap test for whether Git has history
// available for a file?
// Otherwise, this is harmless, since Git's commands will just
// print nothing if there is no history.
return true;
}
if (file.isDirectory()) {
return f.exists() && f.isDirectory();
}
return false;
}
public boolean isWorking() {
}
return working.booleanValue();
}
boolean hasHistoryForDirectories() {
return true;
}
}
throws HistoryException {
// Assign tags to changesets they represent
// We don't need to check if this repository supports tags, because we know it:-)
if (env.isTagsEnabled()) {
}
return result;
}
boolean hasFileBasedTags() {
return true;
}
+ "Date:%at");
}
}
}
}
}
try {
} catch (IllegalThreadStateException e) {
// the process is still running??? just kill it..
}
}
// Git can have tags not pointing to any commit, but tree instead
// Lets use Unix timestamp of 0 for such commits
}
return result;
}
try {
// First we have to obtain list of all tags, and put it asside
// Otherwise we can't use git to get date & hash for each tag
}
} catch (IOException e) {
}
// Make sure this git instance is not running any more
try {
} catch (IllegalThreadStateException e) {
// the process is still running??? just kill it..
}
}
try {
// Now get hash & date for each tag
// Reverse the order of the list
}
} catch (HistoryException e) {
} catch (IOException e) {
}
}
}