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

The following examples show how to use org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getInfo() . 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: InfoTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void testInfoLocked(String filePath) throws Exception {
    if(!isCommandLine()) {
        return;
    }
    createAndCommitParentFolders(filePath);
    File file = createFile(filePath);
    add(file);
    commit(file);
    String msg =
        "Tamaryokucha and other types of sencha are made in essentially the same way.\n" +
        "Slight differences in processing, however, give tamaryokucha its characteristic\n" +
        "fresh taste and reduced astringency.";
    lock(file, msg, true);

    ISVNClientAdapter c = getNbClient();

    ISVNInfo info1 = c.getInfo(getFileUrl(file));
    ISVNInfo info2 = getInfo(getFileUrl(file));

    assertTrue(info1.getLockComment().startsWith("Tamaryokucha"));
    assertInfos(info1, info2);
}
 
Example 2
Source File: InfoTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void testInfoCopied(String srcFileName,
                            String targetFileName) throws Exception {
    File file = createFile(srcFileName);
    add(file);
    commit(file);
    
    File copy = new File(targetFileName);
    copy(getFileUrl(file), getFileUrl(copy));
    
    ISVNClientAdapter c = getNbClient();
   
    ISVNInfo info1 = c.getInfo(getFileUrl(copy));        
    ISVNInfo info2 = getInfo(getFileUrl(copy));
    
    assertInfos(info1, info2);
}
 
Example 3
Source File: SVNRepositoryLocation.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public ISVNRemoteFile getRemoteFile(SVNUrl url) throws SVNException{
	ISVNClientAdapter svnClient = getSVNClient();
	ISVNInfo info = null;
	try {
		if (this.getRepositoryRoot().equals(url))
		    return new RemoteFile(this, url, SVNRevision.HEAD);
		else
		    info = svnClient.getInfo(url, SVNRevision.HEAD, SVNRevision.HEAD);
	} catch (SVNClientException e) {
		throw new SVNException(
			"Can't get latest remote resource for "
				+ url);
	}

	if (info == null)
		return null; // no remote file
	else {
		return new RemoteFile(null, // we don't know its parent
		this,
			url,
			SVNRevision.HEAD,
			info.getLastChangedRevision(),
			info.getLastChangedDate(),
			info.getLastCommitAuthor());
	}		
}
 
Example 4
Source File: LogEntry.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @param resource
 * @return rootURL
 */
private SVNUrl updateRootUrl(ISVNResource resource) {
	ISVNClientAdapter client = null;
    try {
        client = SVNProviderPlugin.getPlugin().getSVNClient();
        SVNProviderPlugin.disableConsoleLogging(); 
        ISVNInfo info = client.getInfo(resource.getUrl());
        SVNProviderPlugin.enableConsoleLogging(); 
        if (info.getRepository() == null)
            return resource.getUrl();
        else {
            // update the saved root URL
            resource.getRepository().setRepositoryRoot(info.getRepository());
            return info.getRepository();
        }
    } catch (Exception e) {
        SVNProviderPlugin.enableConsoleLogging(); 
        return resource.getUrl();
    } finally {
     SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
    }
}
 
Example 5
Source File: InfoTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void testInfoFile(String filePath) throws Exception {
    createAndCommitParentFolders(filePath);
    File file = createFile(filePath);
    add(file);
    commit(file);

    ISVNClientAdapter c = getNbClient();

    ISVNInfo info1 = c.getInfo(getFileUrl(file));
    ISVNInfo info2 = getInfo(getFileUrl(file));

    assertInfos(info1, info2);
}
 
Example 6
Source File: InfoTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void testInfoDeleted(String fileName) throws Exception {
    File file = createFile(fileName);
    add(file);
    commit(file);
    remove(file);

    ISVNClientAdapter c = getNbClient();

    ISVNInfo info1 = c.getInfo(getFileUrl(file));
    ISVNInfo info2 = getInfo(getFileUrl(file));

    assertInfos(info1, info2);
}
 
Example 7
Source File: SvnWizardBranchTagPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void updateTagsProperty(SVNUrl toUrl) {
 	ISVNClientAdapter svnClient = null;
 	try {
ISVNProperty property = null;
property = svnResource.getSvnProperty("subclipse:tags"); //$NON-NLS-1$
if (property == null) return;
newAlias = new Alias();
newAlias.setBranch(toUrl.toString().toUpperCase().indexOf("TAGS") == -1); //$NON-NLS-1$
String relativePath = toUrl.toString().substring(svnResource.getRepository().getUrl().toString().length());
newAlias.setRelativePath(relativePath);
SVNRevision revision = null;
if (revisionButton.getSelection()) revision = SVNRevision.getRevision(revisionText.getText().trim());
else {
	svnClient = svnResource.getRepository().getSVNClient();
	ISVNInfo svnInfo = svnClient.getInfo(url);
	revision = SVNRevision.getRevision(svnInfo.getRevision().toString());
}
newAlias.setRevision(Integer.parseInt(revision.toString()));
newAlias.setName(toUrl.getLastPathSegment());
BranchTagPropertyUpdateDialog dialog = new BranchTagPropertyUpdateDialog(getShell(), resource, newAlias, "BranchTagPropertyUpdateDialog"); //$NON-NLS-1$
if (dialog.open() == BranchTagPropertyUpdateDialog.OK) 
	newAlias = dialog.getNewAlias();
else
	newAlias = null;
 	} catch (Exception e) {}
 	finally {
 		svnResource.getRepository().returnSVNClient(svnClient);
 	}
 }
 
Example 8
Source File: BranchTagWizard.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void updateTagsProperty(SVNUrl toUrl) {
 	ISVNClientAdapter svnClient = null;
 	try {
 		if (resources.length > 1) return;
ISVNProperty property = null;
property = repositoryPage.getSvnResource().getSvnProperty("subclipse:tags"); //$NON-NLS-1$
if (property == null) return;
newAlias = new Alias();
newAlias.setBranch(toUrl.toString().toUpperCase().indexOf("TAGS") == -1); //$NON-NLS-1$
String relativePath = toUrl.toString().substring(repositoryPage.getSvnResource().getRepository().getUrl().toString().length());
newAlias.setRelativePath(relativePath);
SVNRevision revision = null;
if (copyPage.revisionButton.getSelection()) revision = SVNRevision.getRevision(copyPage.getRevision());
else {
	svnClient = repositoryPage.getSvnResource().getRepository().getSVNClient();
	ISVNInfo svnInfo = svnClient.getInfo(repositoryPage.getUrl());
	revision = SVNRevision.getRevision(svnInfo.getRevision().toString());
}
newAlias.setRevision(Integer.parseInt(revision.toString()));
newAlias.setName(toUrl.getLastPathSegment());
BranchTagPropertyUpdateDialog dialog = new BranchTagPropertyUpdateDialog(getShell(), getResource(), newAlias, "BranchTagPropertyUpdateDialog"); //$NON-NLS-1$
if (dialog.open() == BranchTagPropertyUpdateDialog.OK) 
	newAlias = dialog.getNewAlias();
else
	newAlias = null;
 	} catch (Exception e) {}
 	finally {
 		if (svnClient != null) {
 			repositoryPage.getSvnResource().getRepository().returnSVNClient(svnClient);
 		}
 	}
 }
 
Example 9
Source File: SVNRepositoryLocation.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void validateConnection(IProgressMonitor monitor) throws SVNException {
	ISVNClientAdapter svnClient = getSVNClient();
	try {
		// we try to get the list of directories and files using the connection
		ISVNInfo info = svnClient.getInfo(getUrl());
	    repositoryRootUrl = info.getRepository();
	} catch (SVNClientException e) {
		// If the validation failed, dispose of any cached info
		dispose();
		throw SVNException.wrapException(e);
	}
}
 
Example 10
Source File: SVNBasedArtifactRepository.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
/**
 * Check whether the specified directory exists in the remote SVN repository. If the
 * directory does not exist, attempt to create it.
 *
 * @throws DeploymentSynchronizerException If an error occurs while creating the directory
 */
private void checkRemoteDirectory(int tenantId) throws DeploymentSynchronizerException {
    TenantSVNRepositoryContext repoContext= tenantSVNRepositories.get(tenantId);
    if (repoContext == null ) {
        log.warn("TenantSVNRepositoryContext not initialized for " + tenantId);
        return;
    }

    SVNUrl svnUrl = repoContext.getSvnUrl();
    ISVNClientAdapter svnClient = repoContext.getSvnClient();

    try {

        ISVNInfo info = svnClient.getInfo(svnUrl);
        if (info != null && log.isDebugEnabled()) {
            log.debug("Remote directory: " + svnUrl + " exists");
        }
    } catch (SVNClientException ex) {
        if (log.isDebugEnabled()) {
            log.debug("Error while retrieving information from the directory: " + svnUrl, ex);
            log.debug("Attempting to create the directory: " + svnUrl);
        }

        try {
            svnClient.mkdir(svnUrl, true, "Directory creation by deployment synchronizer");
        } catch (SVNClientException e) {
            handleException("Error while attempting to create the directory: " + svnUrl, e);
        }
    }
}
 
Example 11
Source File: GetRemoteResourceCommand.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void run(IProgressMonitor monitor) throws SVNException {
       monitor = Policy.monitorFor(monitor);
       monitor.beginTask(Policy.bind("GetRemoteResourceCommand.getLogEntries"), 100); //$NON-NLS-1$
       
       remoteResource = null;
       ISVNClientAdapter svnClient = repository.getSVNClient();
       ISVNInfo info;
       try {
           info = svnClient.getInfo(url, revision, revision);
       } catch (SVNClientException e) {
           throw new SVNException("Can't get remote resource "+url+" at revision "+revision,e);   
       }
       finally {
       	repository.returnSVNClient(svnClient);
       }
       
       if (info == null) {
           remoteResource = null; // no remote file
       }
       else
       {
           if (info.getNodeKind() == SVNNodeKind.FILE)
               remoteResource = new RemoteFile(
                   null,  // we don't know its parent
                   repository,
                   url,
                   revision,
                   info.getLastChangedRevision(),
                   info.getLastChangedDate(),
                   info.getLastCommitAuthor()
               );
            else
               remoteResource = new RemoteFolder(
                   null,  // we don't know its parent
                   repository,
                   url,
                   revision,
                   info.getLastChangedRevision(),
                   info.getLastChangedDate(),
                   info.getLastCommitAuthor()
               );                
       }
       monitor.done();
}
 
Example 12
Source File: InfoTestHidden.java    From netbeans with Apache License 2.0 3 votes vote down vote up
public void testInfoRepo() throws Exception {

        ISVNClientAdapter c = getNbClient();

        ISVNInfo info1 = c.getInfo(getRepoUrl());
        ISVNInfo info2 = getInfo(getRepoUrl());

        assertInfos(info1, info2);
    }