本文整理匯總了Java中org.tmatesoft.svn.core.SVNException類的典型用法代碼示例。如果您正苦於以下問題:Java SVNException類的具體用法?Java SVNException怎麽用?Java SVNException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SVNException類屬於org.tmatesoft.svn.core包,在下文中一共展示了SVNException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: copy
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
@Override
public void copy(@NotNull SvnTarget source,
@NotNull File destination,
@Nullable SVNRevision revision,
boolean makeParents,
@Nullable ProgressTracker handler) throws VcsException {
SVNCopyClient client = myVcs.getSvnKitManager().createCopyClient();
client.setEventHandler(toEventHandler(handler));
try {
client.doCopy(new SVNCopySource[]{createCopySource(source, revision)}, destination, false, makeParents, true);
}
catch (SVNException e) {
throw new SvnBindException(e);
}
}
示例2: doImport
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
@Override
public long doImport(@NotNull File path,
@NotNull SVNURL url,
@Nullable Depth depth,
@NotNull String message,
boolean noIgnore,
@Nullable CommitEventHandler handler,
@Nullable ISVNCommitHandler commitHandler) throws VcsException {
SVNCommitClient client = myVcs.getSvnKitManager().createCommitClient();
client.setEventHandler(toEventHandler(handler));
client.setCommitHandler(commitHandler);
try {
SVNCommitInfo info = client.doImport(path, url, message, null, !noIgnore, false, toDepth(depth));
return info.getNewRevision();
}
catch (SVNException e) {
throw new SvnBindException(e);
}
}
示例3: svnDelete
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
private void svnDelete ( BufferedWriter bw, File baseFolder, List<File> filesToDelete, String baseConfigUrl,
SVNCommitClient svnCommitClient, String comment )
throws SVNException {
List<SVNURL> urlsToDelete = new ArrayList<>();
filesToDelete.forEach( deleteFile -> {
try {
String deleteTarget = baseConfigUrl + "/" + deleteFile.getName();
if ( baseFolder != null ) {
String newPath = deleteFile.toURI().getPath().substring( baseFolder.toURI().getPath().length() );
deleteTarget = baseConfigUrl + "/" + newPath;
}
logger.info( "url to check: {}", deleteTarget );
SVNURL url = SVNURL.parseURIEncoded( deleteTarget );
urlsToDelete.add( url );
// deleting from fs now.
updateProgress( bw, "* Deleting from File system: " + deleteFile.getAbsolutePath() );
FileUtils.deleteQuietly( deleteFile );
} catch (SVNException ex) {
logger.error( "Failed to generated svn url for {}", deleteFile.getAbsolutePath(), ex );
}
} );
svnCommitClient.doDelete( urlsToDelete.toArray( new SVNURL[ 0 ] ), comment );
}
示例4: buildSvnEventHandler
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
private ISVNEventHandler buildSvnEventHandler ( String desc, BufferedWriter outputWriter ) {
lineCount = 0;
return new ISVNEventHandler() {
@Override
public void checkCancelled ()
throws SVNCancelException {
}
@Override
public void handleEvent ( SVNEvent event, double progress )
throws SVNException {
// logger.debug("progess: " + progress + " " + event);
if ( event.getURL() == null && event.getFile() != null ) {
updateProgress( outputWriter, desc + event.getFile().getName() );
} else if ( event.getURL() != null ) {
updateProgress( outputWriter, desc + event.getURL() );
} else {
updateProgress( outputWriter, desc + event );
}
}
};
}
示例5: handleLogEntry
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
@Override
public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
String filter = logFilterName.getText().toLowerCase();
String author = logEntry.getAuthor().toLowerCase();
String msg = logEntry.getMessage().toLowerCase();
if (filter != null && !filter.isEmpty() && !(author.contains(filter) || msg.contains(filter))) {
return;
}
detailData.put(logEntry.getRevision(), logEntry.getChangedPaths());
String str1 = projectName + "|" + logEntry.getRevision() + "|" + logEntry.getAuthor() + "|" + sdf.format(logEntry.getDate()) + "|" + logEntry.getMessage();
logs.add(str1);
((DefaultTableModel) logTable.getModel()).setRowCount(0);
((DefaultTableModel) detailTable.getModel()).setRowCount(0);
for (int i = logs.size() - 1; i >= 0; i--) {
String str = logs.get(i);
((DefaultTableModel) logTable.getModel()).addRow(str.split("\\|"));
}
for (Map.Entry<String, SVNLogEntryPath> entry : logEntry.getChangedPaths().entrySet()) {
SVNLogEntryPath path = entry.getValue();
((DefaultTableModel) detailTable.getModel()).addRow(new Object[]{path.getPath(), getType(path.getType()), path.getCopyPath(), getCopyRevision(path.getCopyRevision())});
}
}
示例6: retrieve
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
/**
* Retrieves this version of the metadata
*
* @return the metadata document as it was in this version
* @throws MCRUsageException
* if this is a deleted version, which can not be retrieved
*/
public MCRContent retrieve() throws IOException {
if (type == DELETED) {
String msg = "You can not retrieve a deleted version, retrieve a previous version instead";
throw new MCRUsageException(msg);
}
try {
SVNRepository repository = vm.getStore().getRepository();
MCRByteArrayOutputStream baos = new MCRByteArrayOutputStream();
repository.getFile(vm.getStore().getSlotPath(vm.getID()), revision, null, baos);
baos.close();
return new MCRByteContent(baos.getBuffer(), 0, baos.size(), getDate().getTime());
} catch (SVNException e) {
throw new IOException(e);
}
}
示例7: getLastRevision
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
private long getLastRevision(boolean deleted) throws SVNException {
SVNRepository repository = getStore().getRepository();
if (repository.getLatestRevision() == 0) {
//new repository cannot hold a revision yet (MCR-1196)
return -1;
}
final String path = getFilePath();
String dir = getDirectory();
LastRevisionLogHandler lastRevisionLogHandler = new LastRevisionLogHandler(path, deleted);
int limit = 0; //we stop through LastRevisionFoundException
try {
repository.log(new String[] { dir }, repository.getLatestRevision(), 0, true, true, limit, false, null,
lastRevisionLogHandler);
} catch (LastRevisionFoundException ignored) {
}
return lastRevisionLogHandler.getLastRevision();
}
示例8: checkout
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
@Override
public void checkout(@NotNull SvnTarget source,
@NotNull File destination,
@Nullable SVNRevision revision,
@Nullable Depth depth,
boolean ignoreExternals,
boolean force,
@NotNull WorkingCopyFormat format,
@Nullable ProgressTracker handler) throws VcsException {
assertUrl(source);
validateFormat(format, getSupportedFormats());
SVNUpdateClient client = myVcs.getSvnKitManager().createUpdateClient();
client.setIgnoreExternals(ignoreExternals);
client.setEventHandler(toEventHandler(handler));
try {
runCheckout(client, format, source, destination, revision, depth, force);
}
catch (SVNException e) {
throw new SvnBindException(e);
}
}
示例9: createUrl
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
@NotNull
public static SVNURL createUrl(@NotNull String url, boolean encoded) throws SvnBindException {
try {
SVNURL result = encoded ? SVNURL.parseURIEncoded(url) : SVNURL.parseURIDecoded(url);
// explicitly check if port corresponds to default port and recreate url specifying default port indicator
if (result.hasPort() && hasDefaultPort(result)) {
result = SVNURL
.create(result.getProtocol(), result.getUserInfo(), result.getHost(), DEFAULT_PORT_INDICATOR, result.getURIEncodedPath(), true);
}
return result;
}
catch (SVNException e) {
throw new SvnBindException(e);
}
}
示例10: export
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
@Override
public void export(@NotNull SvnTarget from,
@NotNull File to,
@Nullable SVNRevision revision,
@Nullable Depth depth,
@Nullable String nativeLineEnd,
boolean force,
boolean ignoreExternals,
@Nullable ProgressTracker handler) throws VcsException {
SVNUpdateClient client = myVcs.getSvnKitManager().createUpdateClient();
client.setEventHandler(toEventHandler(handler));
client.setIgnoreExternals(ignoreExternals);
try {
if (from.isFile()) {
client.doExport(from.getFile(), to, from.getPegRevision(), revision, nativeLineEnd, force, toDepth(depth));
}
else {
client.doExport(from.getURL(), to, from.getPegRevision(), revision, nativeLineEnd, force, toDepth(depth));
}
}
catch (SVNException e) {
throw new SvnBindException(e);
}
}
示例11: doLog
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
@Override
public void doLog(@NotNull SvnTarget target,
@NotNull SVNRevision startRevision,
@NotNull SVNRevision endRevision,
boolean stopOnCopy,
boolean discoverChangedPaths,
boolean includeMergedRevisions,
long limit,
@Nullable String[] revisionProperties,
@Nullable LogEntryConsumer handler) throws VcsException {
try {
SVNLogClient client = myVcs.getSvnKitManager().createLogClient();
if (target.isFile()) {
client.doLog(new File[]{target.getFile()}, startRevision, endRevision, target.getPegRevision(), stopOnCopy, discoverChangedPaths,
includeMergedRevisions, limit, revisionProperties, toHandler(handler));
}
else {
client.doLog(target.getURL(), ArrayUtil.EMPTY_STRING_ARRAY, target.getPegRevision(), startRevision, endRevision, stopOnCopy,
discoverChangedPaths, includeMergedRevisions, limit, revisionProperties, toHandler(handler));
}
}
catch (SVNException e) {
throw new SvnBindException(e);
}
}
示例12: addToExternalProperty
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
public static boolean addToExternalProperty(@NotNull SvnVcs vcs, @NotNull File ioFile, String target, String url)
throws SVNException, VcsException {
ClientFactory factory = vcs.getFactory(ioFile);
PropertyValue propertyValue = factory.createPropertyClient().getProperty(SvnTarget.fromFile(ioFile), SvnPropertyKeys.SVN_EXTERNALS,
false, SVNRevision.UNDEFINED);
String newValue;
if (propertyValue != null && !StringUtil.isEmptyOrSpaces(propertyValue.toString())) {
Map<String, String> externalsMap = ExternalsDefinitionParser.parseExternalsProperty(propertyValue.toString());
String externalsForTarget = externalsMap.get(target);
if (externalsForTarget != null) {
AbstractVcsHelper.getInstance(vcs.getProject()).showError(
new VcsException("Selected destination conflicts with existing: " + externalsForTarget), "Create External");
return true;
}
final String string = createExternalDefinitionString(url, target);
newValue = propertyValue.toString().trim() + "\n" + string;
} else {
newValue = createExternalDefinitionString(url, target);
}
factory.createPropertyClient().setProperty(ioFile, SvnPropertyKeys.SVN_EXTERNALS, PropertyValue.create(newValue), Depth.EMPTY, false);
return false;
}
示例13: getCopy
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
/**
* 참조할만한 사이트
* https://www.programcreek.com/java-api-examples/index.php?api=org.tmatesoft.svn.core.wc.SVNCopySource
*
* @작성자 : KYJ
* @작성일 : 2017. 12. 20.
* @param relativePath
* @param revision
* @param outputFile
* @param properties
* @return
* @throws SVNException
* @throws FileNotFoundException
* @throws IOException
*/
public File getCopy(String relativePath, long revision, SVNProperties properties, File outputFile)
throws SVNException, FileNotFoundException, IOException {
// URL 검증
if (relativePath.isEmpty() || relativePath.endsWith("/"))
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.BAD_URL, "Invalide relativePath : " + relativePath));
SVNRepository repository = getRepository();
LOGGER.debug("getCopy : {} ", relativePath);
SVNNodeKind checkPath = repository.checkPath(relativePath, revision);
if (checkPath == SVNNodeKind.FILE) {
try (FileOutputStream fos = new FileOutputStream(outputFile)) {
// return the revision the file has been taken at
long file = repository.getFile(relativePath, revision, properties, fos);
if (file == -1)
return null;
}
}
return outputFile;
}
示例14: getPropertyList
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
@NotNull
private static List<PropertyData> getPropertyList(@NotNull SvnVcs vcs,
@Nullable final ContentRevision contentRevision,
@Nullable final SVNRevision revision)
throws SVNException, VcsException {
if (contentRevision == null) {
return Collections.emptyList();
}
SvnTarget target;
if (contentRevision instanceof SvnRepositoryContentRevision) {
final SvnRepositoryContentRevision svnRevision = (SvnRepositoryContentRevision)contentRevision;
target = SvnTarget.fromURL(SVNURL.parseURIEncoded(svnRevision.getFullPath()), revision);
} else {
final File ioFile = contentRevision.getFile().getIOFile();
target = SvnTarget.fromFile(ioFile, revision);
}
return getPropertyList(vcs, target, revision);
}
示例15: checkForException
import org.tmatesoft.svn.core.SVNException; //導入依賴的package包/類
private void checkForException(final StringBuffer sbError) throws SVNException {
if (sbError.length() == 0) return;
final String message = sbError.toString();
final Matcher matcher = ourExceptionPattern.matcher(message);
if (matcher.matches()) {
final String group = matcher.group(1);
if (group != null) {
try {
final int code = Integer.parseInt(group);
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.getErrorCode(code), message));
} catch (NumberFormatException e) {
//
}
}
}
if (message.contains(ourAuthenticationRealm)) {
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.AUTHN_CREDS_UNAVAILABLE, message));
}
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.UNKNOWN, message));
}