本文整理汇总了Java中org.tmatesoft.svn.core.io.SVNRepository.getRepositoryRoot方法的典型用法代码示例。如果您正苦于以下问题:Java SVNRepository.getRepositoryRoot方法的具体用法?Java SVNRepository.getRepositoryRoot怎么用?Java SVNRepository.getRepositoryRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.tmatesoft.svn.core.io.SVNRepository
的用法示例。
在下文中一共展示了SVNRepository.getRepositoryRoot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRepositoryRoot
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
private SVNURL getRepositoryRoot(SVNURL svnurl, SVNRevision operationalFrom) throws SVNException {
final SVNRepository repository = myVcs.createRepository(svnurl);
final SVNURL root = repository.getRepositoryRoot(false);
if (root == null) {
return repository.getRepositoryRoot(true);
}
return root;
/*final SVNWCClient wcClient = myVcs.createWCClient();
try {
final SVNInfo info;
info = wcClient.doInfo(svnurl, myPeg, operationalFrom);
return info.getRepositoryRootURL();
}
catch (SVNException e) {
try {
final SVNInfo info;
info = wcClient.doInfo(svnurl, SVNRevision.UNDEFINED, SVNRevision.UNDEFINED);
return info.getRepositoryRootURL();
} catch (SVNException e1) {
final SVNInfo info;
info = wcClient.doInfo(svnurl, SVNRevision.UNDEFINED, SVNRevision.HEAD);
return info.getRepositoryRootURL();
}
}*/
}
示例2: close
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@Override
public void close() throws Exception {
final SVNRepository repo = openSvnRepository(url);
long revision = repo.getLatestRevision();
try {
final SVNLock[] locks = repo.getLocks(suffix);
if (locks.length > 0) {
final SVNURL root = repo.getRepositoryRoot(true);
final Map<String, String> locksMap = new HashMap<>();
for (SVNLock lock : locks) {
final String relativePath = SVNURLUtil.getRelativeURL(url, root.appendPath(lock.getPath(), false), false);
locksMap.put(relativePath, lock.getID());
}
repo.unlock(locksMap, true, null);
}
final ISVNEditor editor = repo.getCommitEditor("Remove subdir for test", null, false, null);
editor.openRoot(-1);
editor.deleteEntry(suffix, revision);
editor.closeEdit();
} finally {
repo.closeSession();
}
}
示例3: getLatestExistent
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public long getLatestExistent() {
if (! detectStartRevision()) return myStartNumber;
SVNRepository repository = null;
long latestOk = myStartNumber;
try {
repository = myVcs.createRepository(myUrl.toString());
final SVNURL repRoot = repository.getRepositoryRoot(true);
if (repRoot != null) {
if (myEndNumber == -1) {
myEndNumber = repository.getLatestRevision();
}
final String urlString = myUrl.toString().substring(repRoot.toString().length());
for (long i = myStartNumber + 1; i < myEndNumber; i++) {
final SVNNodeKind kind = repository.checkPath(urlString, i);
if (SVNNodeKind.DIR.equals(kind) || SVNNodeKind.FILE.equals(kind)) {
latestOk = i;
}
}
}
}
catch (SVNException e) {
//
} finally {
if (repository != null) {
repository.closeSession();
}
}
return latestOk;
}
示例4: getDeletionRevision
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public long getDeletionRevision() {
if (! detectStartRevision()) return -1;
final Ref<Long> latest = new Ref<Long>(myStartNumber);
SVNRepository repository = null;
try {
repository = myVcs.createRepository(myUrl.toString());
final SVNURL repRoot = repository.getRepositoryRoot(true);
if (repRoot != null) {
if (myEndNumber == -1) {
myEndNumber = repository.getLatestRevision();
}
final SVNURL existingParent = getExistingParent(myUrl, repository, repRoot.toString().length());
if (existingParent == null) {
return myStartNumber;
}
final String urlRelativeString = myUrl.toString().substring(repRoot.toString().length());
final SVNRevision startRevision = SVNRevision.create(myStartNumber);
myVcs.createLogClient().doLog(existingParent, new String[]{""}, startRevision, startRevision, SVNRevision.HEAD, false, true, 0,
new ISVNLogEntryHandler() {
public void handleLogEntry(final SVNLogEntry logEntry) throws SVNException {
final Map changedPaths = logEntry.getChangedPaths();
for (Object o : changedPaths.values()) {
final SVNLogEntryPath path = (SVNLogEntryPath) o;
if ((path.getType() == 'D') && (urlRelativeString.equals(path.getPath()))) {
latest.set(logEntry.getRevision());
throw new SVNException(SVNErrorMessage.UNKNOWN_ERROR_MESSAGE);
}
}
}
});
}
}
catch (SVNException e) {
//
} finally {
if (repository != null) {
repository.closeSession();
}
}
return latest.get().longValue();
}