本文整理汇总了Java中org.tmatesoft.svn.core.io.SVNRepository.closeSession方法的典型用法代码示例。如果您正苦于以下问题:Java SVNRepository.closeSession方法的具体用法?Java SVNRepository.closeSession怎么用?Java SVNRepository.closeSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.tmatesoft.svn.core.io.SVNRepository
的用法示例。
在下文中一共展示了SVNRepository.closeSession方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: supportsMergeTracking
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@Override
public boolean supportsMergeTracking(@NotNull SVNURL url) throws VcsException {
SVNRepository repository = null;
try {
repository = myVcs.getSvnKitManager().createRepository(url);
return repository.hasCapability(SVNCapability.MERGE_INFO);
}
catch (SVNException e) {
throw new SvnBindException(e);
}
finally {
if (repository != null) {
repository.closeSession();
}
}
}
示例2: remoteFolderIsEmpty
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public static boolean remoteFolderIsEmpty(final SvnVcs vcs, final String url) throws SVNException {
SVNRepository repository = null;
try {
repository = vcs.createRepository(url);
final Ref<Boolean> result = new Ref<Boolean>(true);
repository.getDir("", -1, null, new ISVNDirEntryHandler() {
public void handleDirEntry(final SVNDirEntry dirEntry) throws SVNException {
if (dirEntry != null) {
result.set(false);
}
}
});
return result.get();
} finally {
if (repository != null) {
repository.closeSession();
}
}
}
示例3: correctRevision
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
private SVNRevision correctRevision(final UpdateRootInfo value, final SVNURL url, final SVNRevision updateRevision) throws SVNException {
if (SVNRevision.HEAD.equals(value.getRevision())) {
// find acual revision to update to (a bug if just say head in switch)
SVNRepository repository = null;
try {
repository = myVcs.createRepository(url);
final long longRevision = repository.getLatestRevision();
final SVNRevision newRevision = SVNRevision.create(longRevision);
value.setRevision(newRevision);
return newRevision;
} finally {
if (repository != null) {
repository.closeSession();
}
}
}
return updateRevision;
}
示例4: run
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public void run() {
ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
if (progress != null) {
progress.setText(SvnBundle.message("progress.text.loading.contents", myPath));
progress.setText2(SvnBundle.message("progress.text2.revision.information", myRevision));
}
try {
SVNRepository repository = myVcs.createRepository(getFullPath());
try {
repository.getFile("", myRevision, null, myDst);
}
finally {
repository.closeSession();
}
}
catch (SVNException e) {
myException = e;
}
}
示例5: 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();
}
}
示例6: simpleShutdown
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
* Check simple shutdown:
* <p>
* * All old connection have a small time to finish work.
* * New connection is not accepted.
*
* @throws Exception
*/
@Test
public void simpleShutdown() throws Exception {
final Map<String, Thread> oldThreads = getAllThreads();
final SvnTestServer server = SvnTestServer.createEmpty();
final SVNRepository repo2 = server.openSvnRepository();
final SVNRepository repo1 = server.openSvnRepository();
repo1.getLatestRevision();
final ISVNEditor editor = repo1.getCommitEditor("Empty commit", null, false, null);
editor.openRoot(-1);
server.startShutdown();
try {
// Can't create new connection is shutdown mode.
repo2.getLatestRevision();
Assert.fail();
} catch (SVNException ignored) {
}
editor.closeDir();
editor.closeEdit();
repo1.closeSession();
repo2.closeSession();
server.shutdown(SHOWDOWN_TIME);
checkThreads(oldThreads);
}
示例7: timeoutShutdown
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
* Check simple shutdown:
* <p>
* * All old connection have a small time to finish work.
* * New connection is not accepted.
*
* @throws Exception
*/
@Test
public void timeoutShutdown() throws Exception {
final Map<String, Thread> oldThreads = getAllThreads();
final SvnTestServer server = SvnTestServer.createEmpty();
final SVNRepository repo = server.openSvnRepository();
repo.getLatestRevision();
final ISVNEditor editor = repo.getCommitEditor("Empty commit", null, false, null);
editor.openRoot(-1);
server.startShutdown();
server.shutdown(FORCE_TIME);
checkThreads(oldThreads);
try {
editor.closeDir();
editor.closeEdit();
repo.closeSession();
} catch (SVNException ignored) {
}
}
示例8: runUrlDiff
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
private Collection<Change> runUrlDiff() throws SVNException {
SVNRepository sourceRepository = myVcs.getSvnKitManager().createRepository(myTarget1.getURL());
sourceRepository.setCanceller(new SvnKitProgressCanceller());
SvnDiffEditor diffEditor;
final long rev;
SVNRepository targetRepository = null;
try {
rev = sourceRepository.getLatestRevision();
// generate Map of path->Change
targetRepository = myVcs.getSvnKitManager().createRepository(myTarget2.getURL());
diffEditor = new SvnDiffEditor(sourceRepository, targetRepository, -1, false);
final ISVNEditor cancellableEditor = SVNCancellableEditor.newInstance(diffEditor, new SvnKitProgressCanceller(), null);
sourceRepository.diff(myTarget2.getURL(), rev, rev, null, true, true, false, new ISVNReporterBaton() {
public void report(ISVNReporter reporter) throws SVNException {
reporter.setPath("", null, rev, false);
reporter.finishReport();
}
}, cancellableEditor);
return diffEditor.getChangesMap().values();
}
finally {
sourceRepository.closeSession();
if (targetRepository != null) {
targetRepository.closeSession();
}
}
}
示例9: returnRepo
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@Override
public void returnRepo(SVNRepository repo) {
myUsed.remove(repo);
if (myGuard.shouldKeepConnectionLocally() && myInactive.size() < myMaxCached) {
long time = System.currentTimeMillis();
if (myInactive.containsKey(time)) {
time = myInactive.lastKey() + 1;
}
myInactive.put(time, repo);
} else {
repo.closeSession();
myGuard.connectionDestroyed(1);
}
}
示例10: closeInactive
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public int closeInactive() {
int cnt = myInactive.size();
for (SVNRepository repository : myInactive.values()) {
repository.closeSession();
myGuard.connectionDestroyed(1);
}
myInactive.clear();
return cnt;
}
示例11: checkRepositoryVersion15
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public static boolean checkRepositoryVersion15(final SvnVcs vcs, final String url) {
SVNRepository repository = null;
try {
repository = vcs.createRepository(url);
return repository.hasCapability(SVNCapability.MERGE_INFO);
}
catch (SVNException e) {
return false;
}
finally {
if (repository != null) {
repository.closeSession();
}
}
}
示例12: doesRepositorySupportMergeInfo
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public static boolean doesRepositorySupportMergeInfo(final SvnVcs vcs, final SVNURL url) {
SVNRepository repository = null;
try {
repository = vcs.createRepository(url);
return repository.hasCapability(SVNCapability.MERGE_INFO);
}
catch (SVNException e) {
return false;
} finally {
if (repository != null) {
repository.closeSession();
}
}
}
示例13: getLastMergedRevision
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@Nullable
private String getLastMergedRevision(final SVNRevision rev2, final SVNURL svnURL2) {
if (!rev2.isValid() || rev2.isLocal()) {
return null;
}
else {
final long number = rev2.getNumber();
if (number > 0) {
return String.valueOf(number);
}
else {
SVNRepository repos = null;
try {
repos = myVcs.createRepository(svnURL2.toString());
final long latestRev = repos.getLatestRevision();
return String.valueOf(latestRev);
}
catch (SVNException e) {
return null;
} finally {
if (repos != null) {
repos.closeSession();
}
}
}
}
}
示例14: run
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public void run() {
final Collection<SVNDirEntry> entries = new TreeSet<SVNDirEntry>();
final RepositoryTreeNode node = myData.first;
final SvnVcs vcs = node.getVcs();
SVNRepository repository = null;
SvnAuthenticationProvider.forceInteractive();
try {
repository = vcs.createRepository(node.getURL().toString());
repository.getDir("", -1, null, new ISVNDirEntryHandler() {
public void handleDirEntry(final SVNDirEntry dirEntry) throws SVNException {
entries.add(dirEntry);
}
});
} catch (final SVNException e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
setError(myData, e.getErrorMessage());
startNext();
}
});
return;
} finally {
SvnAuthenticationProvider.clearInteractive();
if (repository != null) {
repository.closeSession();
}
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
setResults(myData, new ArrayList<SVNDirEntry>(entries));
startNext();
}
});
}
示例15: doGraphicalDiff
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
private void doGraphicalDiff(SVNURL sourceURL, SVNURL targetURL) throws SVNException {
SVNRepository sourceRepository = myVCS.createRepository(sourceURL.toString());
sourceRepository.setCanceller(new SvnProgressCanceller());
SvnDiffEditor diffEditor;
final long rev;
SVNRepository targetRepository = null;
try {
rev = sourceRepository.getLatestRevision();
// generate Map of path->Change
targetRepository = myVCS.createRepository(targetURL.toString());
diffEditor = new SvnDiffEditor(sourceRepository, targetRepository, -1, false);
final ISVNEditor cancellableEditor = SVNCancellableEditor.newInstance(diffEditor, new SvnProgressCanceller(), null);
sourceRepository.diff(targetURL, rev, rev, null, true, true, false, new ISVNReporterBaton() {
public void report(ISVNReporter reporter) throws SVNException {
reporter.setPath("", null, rev, false);
reporter.finishReport();
}
}, cancellableEditor);
}
finally {
sourceRepository.closeSession();
if (targetRepository != null) {
targetRepository.closeSession();
}
}
final String sourceTitle = SVNPathUtil.tail(sourceURL.toString());
final String targetTitle = SVNPathUtil.tail(targetURL.toString());
showDiffEditorResults(diffEditor.getChangesMap(), sourceTitle, targetTitle, sourceURL, targetURL, rev);
}