本文整理汇总了Java中org.tmatesoft.svn.core.SVNDepth类的典型用法代码示例。如果您正苦于以下问题:Java SVNDepth类的具体用法?Java SVNDepth怎么用?Java SVNDepth使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SVNDepth类属于org.tmatesoft.svn.core包,在下文中一共展示了SVNDepth类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addToSvnIfNotThere
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
public void addToSvnIfNotThere ( File applicationFolder, File newOrUpdatedItem, String targetUrlFolder, SVNCommitClient svnCommitClient,
String comment ) {
try {
logger.info( "Checking for new file: {}", newOrUpdatedItem.getAbsolutePath() );
// stripping off the parent path
String newPath = newOrUpdatedItem.toURI().getPath().substring( applicationFolder.toURI().getPath().length() );
SVNURL url = SVNURL.parseURIEncoded( targetUrlFolder + "/" + newPath );
logger.info( "url to check: {}", url );
svnCommitClient.doImport( newOrUpdatedItem, url, "Agent adding proprs file: " + comment, null, true, true, SVNDepth.INFINITY );
} catch (Exception e) {
logger.info( "File already present: {}, \n svn response: \n {}", newOrUpdatedItem.getAbsolutePath(), e.getMessage() );
}
}
示例2: diff
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
/********************************
* 작성일 : 2016. 5. 5. 작성자 : KYJ
*
*
* @param path1
* @param rivision1
* @param path2
* @param rivision2
* @return
* @throws SVNException
* @throws UnsupportedEncodingException
********************************/
public String diff(String path1, SVNRevision rivision1, String path2, SVNRevision rivision2) throws SVNException, Exception {
SVNDiffClient diffClient = getSvnManager().getDiffClient();
// StringOutputStream result = new StringOutputStream();
ByteArrayOutputStream out = new ByteArrayOutputStream();
// SVNURL svnURL = getSvnURL();
// String repositoryPath = getRepository().getRepositoryPath(path1);
SVNURL location = getRepository().getLocation();
String decodedString = location.toDecodedString();
String uriEncodedPath = location.getURIEncodedPath();
String rootUrl = decodedString.replaceAll(uriEncodedPath, "");
SVNURL svnUrl1 = SVNURL.parseURIEncoded(rootUrl + "/" + path1/*getRepository().getRepositoryPath(path1)*/);
SVNURL svnUrl2 = SVNURL.parseURIEncoded(rootUrl + "/" + path2/*getRepository().getRepositoryPath(path2)*/);
diffClient.doDiff(svnUrl1, rivision1, svnUrl2, rivision2, SVNDepth.UNKNOWN, true, out);
return out.toString("UTF-8");
}
示例3: checkout
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
/**
* @작성자 : KYJ
* @작성일 : 2017. 12. 20.
* @param absolutePath
* @param pegrevision
* @param revision
* @param depth
* @param outDir
* @param exceptionHandler
* @return
* @throws Exception
*/
public Long checkout(SVNURL absolutePath, SVNRevision pegrevision, SVNRevision revision, SVNDepth depth, File outDir,
ExceptionHandler exceptionHandler) throws Exception {
long checkoutResult = -1;
try {
if (outDir == null || !outDir.exists())
throw new FileNotFoundException("not support...");
LOGGER.debug(absolutePath.toString());
SVNClientManager svnManager = getSvnManager();
checkoutResult = svnManager.getUpdateClient().doCheckout(absolutePath, outDir, pegrevision, revision, depth, false);
} catch (Exception e) {
if (exceptionHandler != null)
exceptionHandler.handle(e);
else
throw e;
}
return checkoutResult;
}
示例4: commitClient
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
/**
*
* FileSystem Base Commit Operation.
*
* @작성자 : KYJ
* @작성일 : 2016. 7. 13.
* @param paths
* @param commitMessage
* @return
* @throws SVNException
*/
public SVNCommitInfo commitClient(File[] paths, String commitMessage) throws SVNException {
/*
* Parameters:
* paths :: paths to commit
* keepLocks :: whether to unlock or not files in the repository
* commitMessage :: commit log message
* revisionProperties :: custom revision properties
* changelists :: changelist names array
* keepChangelist :: whether to remove changelists or not
* force :: true to force a non-recursive commit; if depth is SVNDepth.INFINITY the force flag is ignored
* depth :: tree depth to processReturns: information about the new committed revision
*/
return getSvnManager().getCommitClient().doCommit(paths, false, commitMessage, null, null, false, true, SVNDepth.INFINITY);
}
示例5: performSVNupdate
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
/**
* @param svnPathString
* String which contains the local SVN folder path.
* @return Error code. If true --> SVN Operation failed.
*/
public final boolean performSVNupdate(final String svnPathString) {
SfdcCommander commander = SfdcCommander.getInstance();
boolean error = false;
File svnPath = new File(svnPathString);
// checkout
try {
ISVNAuthenticationManager authManager = getAuthManager(config);
SVNUpdateClient updateClient = new SVNUpdateClient(authManager,
SVNWCUtil.createDefaultOptions(true));
updateClient.doUpdate(svnPath, SVNRevision.HEAD, SVNDepth.INFINITY,
true, true);
commander.info("SVN Update successfully processed.");
} catch (SVNException e) {
commander.info(e.getMessage());
error = true;
}
return error;
}
示例6: performSVNcommit
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
/**
* @param svnPathString
* String which contains the local SVN folder path.
* @param aComment
* The SVN Comment which has been entered.
* @param aConfig
* CommanderConfig for SVN Connect.
* @return Error code. If true --> SVN Operation failed.
*/
public final boolean performSVNcommit(final String svnPathString,
final String aComment, final CommanderConfig aConfig) {
SfdcCommander commander = SfdcCommander.getInstance();
boolean error = false;
File[] paths = new File[1];
// paths[0] = projectFile;
// boolean svnNew = false;
// svn add
SVNProperties props = new SVNProperties();
try {
ISVNAuthenticationManager authManager = getAuthManager(config);
// if (svnNew) {
// SVNWCClient addClient = new SVNWCClient(authManager,
// SVNWCUtil.createDefaultOptions(true));
// addClient.doAdd(projectFile, true, false, true,
// SVNDepth.INFINITY, true, true);
// commander.notify("Projectfile successfully added.");
// }
// commit
SVNCommitClient commitClient = new SVNCommitClient(authManager,
SVNWCUtil.createDefaultOptions(true));
commitClient.doCommit(paths, false, aComment, props, null, false,
true, SVNDepth.INFINITY);
commander.info("Projectfile successfully commited.");
} catch (SVNException e) {
commander.info(e.getMessage());
error = true;
}
return error;
}
示例7: checkout
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
private File checkout(String scmUrl) throws Exception {
ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
ISVNAuthenticationManager isvnAuthenticationManager = SVNWCUtil.createDefaultAuthenticationManager(null, null, (char[]) null, false);
SVNClientManager svnClientManager = SVNClientManager.newInstance(options, isvnAuthenticationManager);
File out = temp.newFolder();
SVNUpdateClient updateClient = svnClientManager.getUpdateClient();
SvnCheckout co = updateClient.getOperationsFactory().createCheckout();
co.setUpdateLocksOnDemand(updateClient.isUpdateLocksOnDemand());
co.setSource(SvnTarget.fromURL(SVNURL.parseURIEncoded(scmUrl), SVNRevision.HEAD));
co.setSingleTarget(SvnTarget.fromFile(out));
co.setRevision(SVNRevision.HEAD);
co.setDepth(SVNDepth.INFINITY);
co.setAllowUnversionedObstructions(false);
co.setIgnoreExternals(updateClient.isIgnoreExternals());
co.setExternalsHandler(SvnCodec.externalsHandler(updateClient.getExternalsHandler()));
co.setTargetWorkingCopyFormat(wcVersion);
co.run();
return out;
}
示例8: getInfo
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
/**
* Returns an ArrayLIst with Info for all files found in file.
*
* @param file
* @return
*/
public java.util.List<SVNInfo> getInfo(final File file) {
final java.util.List<SVNInfo> ret = new ArrayList<SVNInfo>();
try {
getWCClient().doInfo(file, SVNRevision.UNDEFINED, SVNRevision.WORKING, SVNDepth.getInfinityOrEmptyDepth(true), null, new ISVNInfoHandler() {
@Override
public void handleInfo(final SVNInfo info) {
ret.add(info);
}
});
} catch (final SVNException e) {
e.printStackTrace();
}
return ret;
}
示例9: getRevision
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
public long getRevision(final File resource) throws SVNException {
final long[] ret = new long[] { -1 };
getWCClient().doInfo(resource, SVNRevision.UNDEFINED, SVNRevision.WORKING, SVNDepth.EMPTY, null, new ISVNInfoHandler() {
@Override
public void handleInfo(final SVNInfo info) {
final long rev = info.getCommittedRevision().getNumber();
if (rev > ret[0]) {
ret[0] = rev;
}
}
});
return ret[0];
}
示例10: report
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
public void report(ISVNReporter reporter) throws SVNException {
try {
/*
* Here empty working copy is reported.
*
* ISVNReporter includes methods that allows to report mixed-rev
* working copy and even let server know that some files or
* directories are locally missing or locked.
*/
reporter.setPath("", null, exportRevision, SVNDepth.INFINITY, true);
/*
* Don't forget to finish the report!
*/
reporter.finishReport();
} catch (SVNException svne) {
reporter.abortReport();
Log.L.fine("Report failed.");
}
}
示例11: handleAttributes
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
protected void handleAttributes(DAVElement parent, DAVElement element, Attributes attrs) throws SVNException {
if (element == ENTRY && parent == ServletDAVHandler.UPDATE_REPORT) {
setEntryLinkPath(attrs.getValue(LINKPATH_ATTR));
setEntryLockToken(attrs.getValue(LOCK_TOKEN_ATTR));
String revisionString = attrs.getValue(REVISION_ATTR);
if (revisionString == null) {
SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, "Missing XML attribute: rev"), SVNLogType.NETWORK);
}
try {
setEntryRevision(Long.parseLong(revisionString));
} catch (NumberFormatException nfe) {
SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, nfe), SVNLogType.NETWORK);
}
setDepth(SVNDepth.fromString(attrs.getValue(DEPTH_ATTR)));
if (attrs.getValue(START_EMPTY_ATTR) != null) {
setEntryStartEmpty(true);
}
} else if (element != MISSING || parent != ServletDAVHandler.UPDATE_REPORT) {
if (isInitialized()) {
SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, "Invalid XML elements order: entry elements should follow any other."), SVNLogType.NETWORK);
}
getDAVRequest().startElement(parent, element, attrs);
}
}
示例12: revertAdditional
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
private void revertAdditional() throws VcsException {
if (myRevertPath == null) return;
final File ioFile = myRevertPath.getIOFile();
SVNStatusClient statusClient = myVcs.createStatusClient();
SVNWCClient client = myVcs.createWCClient();
try {
final SVNStatus status = statusClient.doStatus(ioFile, false);
client.doRevert(new File[]{ioFile}, SVNDepth.INFINITY, null);
if (SVNStatusType.STATUS_ADDED.equals(status.getNodeStatus())) {
FileUtil.delete(ioFile);
}
}
catch (SVNException e) {
throw new VcsException(e);
}
pathDirty(myRevertPath);
}
示例13: changesMoved
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
public void changesMoved(final Collection<Change> changes, final ChangeList fromList, final ChangeList toList) {
if (fromList.getName().equals(toList.getName())) {
return;
}
if (SvnChangeProvider.ourDefaultListName.equals(toList.getName())) {
changeListRemoved(toList);
return;
}
final String[] fromLists = SvnChangeProvider.ourDefaultListName.equals(fromList.getName()) ? null : new String[] {fromList.getName()};
final List<String> paths = getPathsFromChanges(changes);
for (final String path : paths) {
try {
myVcs.createChangelistClient().doAddToChangelist(new File[]{new File(path)}, SVNDepth.EMPTY, toList.getName(), fromLists);
}
catch (SVNException e) {
LOG.info(e);
}
}
}
示例14: addRecursively
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
private static void addRecursively(final SvnVcs activeVcs, final VirtualFile file) throws SVNException {
final SVNWCClient wcClient = activeVcs.createWCClient();
final SvnExcludingIgnoredOperation operation = new SvnExcludingIgnoredOperation(activeVcs.getProject(), new SvnExcludingIgnoredOperation.Operation() {
public void doOperation(final VirtualFile virtualFile) throws SVNException {
final File ioFile = new File(virtualFile.getPath());
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null) {
indicator.checkCanceled();
indicator.setText(SvnBundle.message("share.or.import.add.progress.text", virtualFile.getPath()));
}
wcClient.doAdd(ioFile, true, false, false, SVNDepth.EMPTY, false, false);
}
}, SVNDepth.INFINITY);
operation.execute(file);
}
示例15: addToExternalProperty
import org.tmatesoft.svn.core.SVNDepth; //导入依赖的package包/类
public static boolean addToExternalProperty(SvnVcs vcs, File ioFile, String target, String url) throws SVNException {
final SVNWCClient wcClient = vcs.createWCClient();
final SVNPropertyData propertyData =
wcClient.doGetProperty(ioFile, SvnPropertyKeys.SVN_EXTERNALS, SVNRevision.UNDEFINED, SVNRevision.UNDEFINED);
String newValue;
if (propertyData != null && propertyData.getValue() != null && ! StringUtil.isEmptyOrSpaces(propertyData.getValue().getString())) {
final SVNExternal[] externals = SVNExternal.parseExternals("Create External", propertyData.getValue().getString());
for (SVNExternal external : externals) {
if (Comparing.equal(external.getPath(), target)) {
AbstractVcsHelper
.getInstance(vcs.getProject()).showError(new VcsException("Selected destination conflicts with existing: " + external.toString()), "Create External");
return true;
}
}
final String string = createExternalDefinitionString(url, target);
newValue = propertyData.getValue().getString() + "\n" + string;
} else {
newValue = createExternalDefinitionString(url, target);
}
wcClient.doSetProperty(ioFile, SvnPropertyKeys.SVN_EXTERNALS, SVNPropertyValue.create(newValue), false, SVNDepth.EMPTY, null, null);
return false;
}