SubversionRepository.java revision eb1776903fd1f998009e97470a65fba8a499a0d9
/*
* 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 Subversion repository.
*
* <b>TODO</b> The current implementation does <b>not</b> support nested
* repositories as described in http://svnbook.red-bean.com/en/1.0/ch07s03.html
*
* @author Trond Norbye
*/
public class SubversionRepository extends Repository {
private static final long serialVersionUID = 1L;
/**
* The property name used to obtain the client command for this repository.
*/
public static final String CMD_PROPERTY_KEY
= "org.opensolaris.opengrok.history.Subversion";
/**
* The command to use to access the repository if none was given explicitly
*/
public SubversionRepository() {
type = "Subversion";
datePattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
}
return null;
}
while (n != null) {
}
n = n.getNextSibling();
}
}
super.setDirectoryName(directoryName);
if (isWorking()) {
// set to true if we manage to find the root directory
try {
"svn info did not contain an URL for [{0}]. Assuming remote repository.",
setRemote(true);
} else {
setRemote(true);
}
}
}
} catch (SAXException saxe) {
"Parser error parsing svn output", saxe);
} catch (ParserConfigurationException pce) {
"Parser configuration error parsing svn output", pce);
} catch (IOException ioe) {
"IOException reading from svn process", ioe);
}
} else {
"Failed to execute svn info for [{0}]. Repository disabled.",
}
}
}
/**
* Get an executor to be used for retrieving the history log for the named
* file.
*
* @param file The file to retrieve history for
* @param sinceRevision the revision number immediately preceding the first
* revision we want, or {@code null} to fetch the entire history
* @return An Executor ready to be started
*/
try {
} catch (IOException exp) {
return null;
}
}
if (sinceRevision != null) {
// We would like to use sinceRevision+1 here, but if no new
// revisions have been added after sinceRevision, it would fail
// because there is no such revision as sinceRevision+1. Instead,
// fetch the unneeded revision and remove it later.
}
}
}
try {
} catch (IOException exp) {
return null;
}
}
return ret;
}
boolean hasHistoryForDirectories() {
return true;
}
}
throws HistoryException {
}
return name;
}
return name + "@";
}
private static class AnnotateHandler extends DefaultHandler2 {
final Annotation annotation;
final StringBuilder sb;
sb = new StringBuilder();
}
Attributes attr) {
switch (qname) {
case "entry":
break;
case "commit":
break;
}
}
}
switch (qname) {
case "author":
break;
case "entry":
break;
}
}
}
}
}
try {
throw err;
}
}
try {
try (BufferedInputStream in
} catch (Exception e) {
"An error occurred while parsing the xml output", e);
}
} finally {
try {
} catch (IllegalThreadStateException e) {
// the process is still running??? just kill it..
}
}
}
return ret;
}
return true;
}
// @TODO: Research how to cheaply test if a file in a given
// SVN repo has history. If there is a cheap test, then this
// code can be refined, boosting performance.
return true;
}
public void update() throws IOException {
}
}
if (file.isDirectory()) {
return f.exists() && f.isDirectory();
}
return false;
}
public boolean isWorking() {
}
return working;
}
}
return result;
}
"Failed to get parent for {0}", directoryName);
}
break;
}
}
}
return parent;
}
return null;
}
}