public void unlock(String token, boolean force) throws SVNException { Map pathsToTokens = new HashMap(); pathsToTokens.put(getResourceURI().getPath(), token); getRepository().unlock(pathsToTokens, force, null); }
pathsToTokens = fetchLockTokens(repository, pathsToTokens); repository.unlock(pathsToTokens, breakLock, new ISVNLockHandler() { public void handleLock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException {
pathsToTokens = fetchLockTokens(repository, pathsToTokens); repository.unlock(pathsToTokens, breakLock, new ISVNLockHandler() { public void handleLock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException {
pathsToTokens = fetchLockTokens(repository, pathsToTokens); repository.unlock(pathsToTokens, breakLock, new ISVNLockHandler() {
pathsToTokens = fetchLockTokens(repository, pathsToTokens); repository.unlock(pathsToTokens, breakLock, new ISVNLockHandler() { public void handleLock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException {
public void run() throws SVNException { List targets = getEnvironment().combineTargets(null, false); if (!targets.isEmpty()) { targets.remove(0); } String[] locks = (String[]) targets.toArray(new String[targets.size()]); SVNRepository repository = SVNRepositoryFactory.create(SVNURL.fromFile(getLocalRepository())); String userName = System.getProperty("user.name", "administrator"); repository.setAuthenticationManager(new BasicAuthenticationManager(userName, "")); repository.setCanceller(getEnvironment()); for (int i = 0; i < locks.length; i++) { String lockPath = locks[i]; try { SVNLock lock = repository.getLock(lockPath); if (lock == null) { getEnvironment().getOut().println("Path '" + lockPath + "' isn't locked."); continue; } Map pathToToken = new SVNHashMap(); pathToToken.put(lockPath, lock.getID()); repository.unlock(pathToToken, true, this); } catch (SVNException e) { getEnvironment().handleError(e.getErrorMessage()); } } }
public void run() throws SVNException { List targets = getEnvironment().combineTargets(null, false); if (!targets.isEmpty()) { targets.remove(0); } String[] locks = (String[]) targets.toArray(new String[targets.size()]); SVNRepository repository = SVNRepositoryFactory.create(SVNURL.fromFile(getLocalRepository())); String userName = System.getProperty("user.name", "administrator"); repository.setAuthenticationManager(new BasicAuthenticationManager(userName, "")); repository.setCanceller(getEnvironment()); for (int i = 0; i < locks.length; i++) { String lockPath = locks[i]; try { SVNLock lock = repository.getLock(lockPath); if (lock == null) { getEnvironment().getOut().println("Path '" + lockPath + "' isn't locked."); continue; } Map pathToToken = new SVNHashMap(); pathToToken.put(lockPath, lock.getID()); repository.unlock(pathToToken, true, this); } catch (SVNException e) { getEnvironment().handleError(e.getErrorMessage()); } } }
SVNRepository repository = createRepository(topURL, true); final SVNURL rootURL = repository.getRepositoryRoot(true); repository.unlock(pathsTokensMap, breakLock, new ISVNLockHandler() { public void handleLock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException {
@Override protected SVNLock run() throws SVNException { int i = 0; SVNURL[] urls = new SVNURL[getOperation().getTargets().size()]; for (SvnTarget target : getOperation().getTargets()) { urls[i++] = target.getURL(); } Collection<String> paths = new SVNHashSet(); SVNURL topURL = SVNURLUtil.condenceURLs(urls, paths, false); if (paths.isEmpty()) { paths.add(""); } Map<String, String> pathsToTokens = new SVNHashMap(); for (Iterator<String> p = paths.iterator(); p.hasNext();) { String path = (String) p.next(); path = SVNEncodingUtil.uriDecode(path); pathsToTokens.put(path, null); } checkCancelled(); SVNRepository repository = getRepositoryAccess().createRepository(topURL, null, true); if (!getOperation().isBreakLock()) { pathsToTokens = fetchLockTokens(repository, pathsToTokens); } repository.unlock(pathsToTokens, getOperation().isBreakLock(), this); return getOperation().first(); }
private void unlock(@NotNull SVNRepository repo, @NotNull SVNLock lock, boolean breakLock, @Nullable SVNErrorCode errorCode) { try { final Map<String, String> pathsToTokens = new HashMap<>(); final String root = repo.getLocation().getPath().substring(repo.getRepositoryRoot(true).getPath().length()); Assert.assertTrue(lock.getPath().startsWith(root)); pathsToTokens.put(StringHelper.normalize(lock.getPath().substring(root.length())), lock.getID()); repo.unlock(pathsToTokens, breakLock, new ISVNLockHandler() { @Override public void handleLock(@NotNull String path, @Nullable SVNLock lock, @Nullable SVNErrorMessage error) throws SVNException { Assert.fail(); } @Override public void handleUnlock(String path, SVNLock removedLock, SVNErrorMessage error) throws SVNException { if (error != null) { throw new SVNException(error); } Assert.assertNull(errorCode); Assert.assertNotNull(removedLock); compareLock(removedLock, lock); } }); Assert.assertNull(errorCode); } catch (SVNException e) { Assert.assertEquals(e.getErrorMessage().getErrorCode(), errorCode); } } }
SVNRepository repository = createRepository(topURL, paths[0], wcAccess, true); final SVNURL rootURL = repository.getRepositoryRoot(true); repository.unlock(pathsTokensMap, breakLock, new ISVNLockHandler() {
SVNRepository repository = createRepository(topURL, paths[0], wcAccess, true); final SVNURL rootURL = repository.getRepositoryRoot(true); repository.unlock(pathsTokensMap, breakLock, new ISVNLockHandler() { public void handleLock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException {
SVNRepository repository = createRepository(topURL, paths[0], wcAccess, true); final SVNURL rootURL = repository.getRepositoryRoot(true); repository.unlock(pathsTokensMap, breakLock, new ISVNLockHandler() { public void handleLock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException {
@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(); } }
SVNRepository repository = getRepositoryAccess().createRepository(topURL, null, true); final SVNURL rootURL = repository.getRepositoryRoot(true); repository.unlock(pathsRevisionsMap, getOperation().isBreakLock(), new ISVNLockHandler() {