Java Code Examples for org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getList()

The following examples show how to use org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getList() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InteceptorTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void cleanUpRepo() throws SVNClientException {
    ISVNClientAdapter client = getClient();
    ISVNDirEntry[] entries = client.getList(repoUrl, SVNRevision.HEAD, false);
    SVNUrl[] urls = new SVNUrl[entries.length];
    for (int i = 0; i < entries.length; i++) {
        urls[i] = repoUrl.appendPath(entries[i].getPath());            
    }        
    client.remove(urls, "cleanup");
}
 
Example 2
Source File: AbstractSvnTestCase.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void cleanUpRepo() throws SVNClientException, IOException, InterruptedException {
    ISVNClientAdapter client = getFullWorkingClient();
    ISVNDirEntry[] entries = client.getList(repoUrl, SVNRevision.HEAD, false);
    SVNUrl[] urls = new SVNUrl[entries.length];
    for (int i = 0; i < entries.length; i++) {
        urls[i] = repoUrl.appendPath(entries[i].getPath());            
    }        
    cliRemove(urls);
}
 
Example 3
Source File: SVNRepositoryLocation.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public boolean pathExists() throws SVNException{
	ISVNClientAdapter svnClient = getSVNClient();
	try{
		svnClient.getList(getUrl(), SVNRevision.HEAD, false);
	}catch(SVNClientException e){
		return false;
	}
	return true;
}
 
Example 4
Source File: ListTestHidden.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void testListNoFile() throws Exception {                                
    ISVNClientAdapter c = getNbClient();
    ISVNDirEntry[] entries1 = c.getList(getTestUrl().appendPath(getWC().getName()), SVNRevision.HEAD, false);
                    
    assertEquals(0, entries1.length);
}
 
Example 5
Source File: SVNBasedArtifactRepository.java    From carbon-commons with Apache License 2.0 4 votes vote down vote up
private void cleanupUnversionedFiles(int tenantId, SVNUrl svnURL,  File root) throws SVNClientException {
    TenantSVNRepositoryContext repoContext= tenantSVNRepositories.get(tenantId);
    if (repoContext == null ) {
        log.warn("TenantSVNRepositoryContext not initialized for " + tenantId);
        return;
    }

    ISVNClientAdapter svnClient = repoContext.getSvnClient();
    DeploymentSynchronizerConfiguration conf = repoContext.getConf();

    ISVNDirEntry[] entries = svnClient.getList(svnURL, SVNRevision.HEAD, false);
    for (ISVNDirEntry entry : entries) {
        String fileName = entry.getPath();
        SVNNodeKind nodeType = entry.getNodeKind();
        File localFile = new File(root, fileName);
        if (localFile.exists()) {
            ISVNStatus status = svnClient.getSingleStatus(localFile);
            if (status != null && status.getTextStatus().toInt() != UNVERSIONED) {
                if (localFile.isDirectory()) { // see whether there are unversioned files under this dir. Recursive
                    String appendPath = "/" + localFile.getName();
                    cleanupUnversionedFiles(tenantId, svnURL.appendPath(appendPath), localFile);
                    continue; // this is not an unversioned directory, continue
                } else if (localFile.isFile()) {
                    continue;
                }
            }

            if (localFile.isFile() && SVNNodeKind.FILE.equals(nodeType)) {
                log.info("Unversioned file: " + localFile.getPath() + " will be deleted");
                if (!localFile.delete()) {
                    log.error("Unable to delete the file: " + localFile.getPath());
                }
            } else if (localFile.isDirectory() && SVNNodeKind.DIR.equals(nodeType)) {
                log.info("Unversioned directory: " + localFile.getPath() + " will be deleted");
                try {
                    FileUtils.deleteDirectory(localFile);
                } catch (IOException e) {
                    log.error("Error while deleting the directory: " + localFile.getPath(), e);
                }
            }
        }
    }
}