org.tigris.subversion.svnclientadapter.ISVNInfo Java Examples

The following examples show how to use org.tigris.subversion.svnclientadapter.ISVNInfo. 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: FileModificationManager.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private void autoShareProjectIfSVNWorkingCopy(IProject project) {
	ISVNClientAdapter client = null;
	try {
		client = SVNProviderPlugin.getPlugin().getSVNClient();
		SVNProviderPlugin.disableConsoleLogging();
		ISVNInfo info = client.getInfoFromWorkingCopy(project.getLocation().toFile());
		if (info != null) {
			SVNTeamProviderType.getAutoShareJob().share(project);
		}
	} catch (Exception e) {}
	finally {
	    SVNProviderPlugin.enableConsoleLogging();
	    if (client != null) {
	    	SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
	    }
	}
}
 
Example #2
Source File: CopyTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void testCopyURL2URL(String srcPath, String targetFileName) throws Exception {
    createAndCommitParentFolders(srcPath);
    File file = createFile(srcPath);
    add(file);
    commit(file);

    File filecopy = createFile(renameFile(srcPath, targetFileName));
    filecopy.delete();

    ISVNClientAdapter c = getNbClient();
    c.copy(getFileUrl(file), getFileUrl(filecopy), "copy", SVNRevision.HEAD);

    ISVNInfo info = getInfo(getFileUrl(filecopy));
    assertNotNull(info);
    assertEquals(getFileUrl(filecopy), TestUtilities.decode(info.getUrl()));

    assertNotifiedFiles(new File[] {});
}
 
Example #3
Source File: ResolveTreeConflictWizard.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public ISVNStatus getLocalCopiedTo(boolean getAll) throws SVNException, SVNClientException {
	String endsWithCheck = treeConflict.getConflictDescriptor().getSrcRightVersion().getPathInRepos();
	IProject project = svnResource.getResource().getProject();
	if (project != null) {
		int index = endsWithCheck.indexOf("/" + project.getName() + "/"); //$NON-NLS-1$ //$NON-NLS-2$
		if (index != -1) endsWithCheck = endsWithCheck.substring(index);
	}
	if (copiedTo == null && !copiedToRetrieved) {
		statuses = getStatuses(getAll);
		ISVNClientAdapter svnClient = svnResource.getRepository().getSVNClient();
		for (int i = 0; i < statuses.length; i++) {
			if (statuses[i].isCopied() && statuses[i].getTextStatus().equals(SVNStatusKind.ADDED)) {
				ISVNInfo info = svnClient.getInfoFromWorkingCopy(statuses[i].getFile());
				if (info.getCopyUrl() != null) {	
					if ((svnResource.getUrl() != null && info.getCopyUrl().toString().equals(svnResource.getUrl().toString())) || (info.getCopyUrl().toString().endsWith(endsWithCheck))) {
						copiedTo = statuses[i];
						break;
					}
				}
			}
		}
		svnResource.getRepository().returnSVNClient(svnClient);
	}
	copiedToRetrieved = true;
	return copiedTo;
}
 
Example #4
Source File: CopyTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void testCopyFile2URL(String srcPath, String targetFileName) throws Exception {
        createAndCommitParentFolders(srcPath);
        File file = createFile(srcPath);
        add(file);
        commit(file);

        // File filecopy = new File(createFolder(file.getParentFile(), targetFileName), file.getName());
        File filecopy = createFile(renameFile(srcPath, targetFileName));

        ISVNClientAdapter c = getNbClient();
//        c.copy(file, getFileUrl(filecopy), "copy"); XXX is failing with javahl and we don't use it anyway
        c.copy(new File[] {file}, getFileUrl(filecopy), "copy", false, true);

        ISVNInfo info = getInfo(getFileUrl(filecopy));
        assertNotNull(info);
        assertEquals(getFileUrl(filecopy), TestUtilities.decode(info.getUrl()));
        assertNotifiedFiles(new File[] {});
    }
 
Example #5
Source File: ImportStep.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Checks if the target folder already exists in the repository.
 * If it does exist, user will be asked to confirm the import into the existing folder.
 * @param client
 * @param repositoryFileUrl
 * @return true if the target does not exist or user wishes to import anyway.
 */
private boolean importIntoExisting(SvnClient client, SVNUrl repositoryFileUrl) {
    try {
        ISVNInfo info = client.getInfo(repositoryFileUrl);
        if (info != null) {
            // target folder exists, ask user for confirmation
            final boolean flags[] = {true};
            NotifyDescriptor nd = new NotifyDescriptor(NbBundle.getMessage(ImportStep.class, "MSG_ImportIntoExisting", SvnUtils.decodeToString(repositoryFileUrl)), //NOI18N
                    NbBundle.getMessage(ImportStep.class, "CTL_TargetFolderExists"), NotifyDescriptor.YES_NO_CANCEL_OPTION, //NOI18N
                    NotifyDescriptor.QUESTION_MESSAGE, null, NotifyDescriptor.YES_OPTION);
            if (DialogDisplayer.getDefault().notify(nd) != NotifyDescriptor.YES_OPTION) {
                flags[0] = false;
            }
            return flags[0];
        }
    } catch (SVNClientException ex) {
        // ignore
    }
    return true;
}
 
Example #6
Source File: CreateCopyAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private String validateTargetPath(CreateCopy createCopy) {
    String errorText = null;
    try {
        RepositoryFile toRepositoryFile = createCopy.getToRepositoryFile();
        SvnClient client = Subversion.getInstance().getClient(toRepositoryFile.getRepositoryUrl());
        ISVNInfo info = null;
        try {
            info = client.getInfo(toRepositoryFile.getFileUrl());
        } catch (SVNClientException e) {
            if (!SvnClientExceptionHandler.isWrongUrl(e.getMessage())) {
                throw e;
            }
        }
        if (info != null) {
            errorText = NbBundle.getMessage(CreateCopyAction.class, "MSG_CreateCopy_Target_Exists");     // NOI18N
        }
    } catch (SVNClientException ex) {
        errorText = null;
    }
    return errorText;
}
 
Example #7
Source File: SwitchToAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private boolean validateInput(File root, RepositoryFile toRepositoryFile) {
    boolean ret = false;
    SvnClient client;
    try {                   
        client = Subversion.getInstance().getClient(toRepositoryFile.getRepositoryUrl());
        ISVNInfo info = client.getInfo(toRepositoryFile.getFileUrl());
        if(info.getNodeKind() == SVNNodeKind.DIR && root.isFile()) {
            SvnClientExceptionHandler.annotate(NbBundle.getMessage(SwitchToAction.class, "LBL_SwitchFileToFolderError"));
            ret = false;
        } else if(info.getNodeKind() == SVNNodeKind.FILE && root.isDirectory()) {
            SvnClientExceptionHandler.annotate(NbBundle.getMessage(SwitchToAction.class, "LBL_SwitchFolderToFileError"));
            ret = false;
        } else {
            ret = true;
        }
    } catch (SVNClientException ex) {
        SvnClientExceptionHandler.notifyException(ex, true, true);
        return ret;
    }                            
    return ret;
}
 
Example #8
Source File: RevisionSetupsSupport.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private ISVNInfo checkUrlExistance (SvnClient client, SVNUrl url, SVNRevision revision) throws SVNClientException {
    if (url == null) {
        // local file, not yet in the repository
        return null;
    }
    if (parentMissing(url, revision)) {
        return null;
    }
    try {
        return client.getInfo(url, revision, revision);
    } catch (SVNClientException ex) {
        if (SvnClientExceptionHandler.isWrongURLInRevision(ex.getMessage())){
            cacheParentMissing(url, revision);
            return null;
        } else {
            throw ex;
        }
    }
}
 
Example #9
Source File: CopyTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void testCopyFile2File(String srcPath, String target) throws Exception {
        createAndCommitParentFolders(srcPath);
        File file = createFile(srcPath);
        add(file);
        commit(file);

        // File filecopy = new File(createFolder(file.getParentFile(), targetFileName), file.getName());
        File filecopy = new File(file.getParentFile(), target);

        ISVNClientAdapter c = getNbClient();
//        c.copy(file, getFileUrl(filecopy), "copy"); XXX is failing with javahl and we don't use it anyway
        c.copy(file, filecopy);

        assertTrue(filecopy.exists());

        ISVNInfo info = getInfo(filecopy);
        assertNotNull(info);
        assertEquals(getFileUrl(filecopy), TestUtilities.decode(info.getUrl()));
        assertNotifiedFiles(new File[] {});
    }
 
Example #10
Source File: RevertModificationsAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static RevertModifications.RevisionInterval recountStartRevision(SvnClient client, SVNUrl repository, RevertModifications.RevisionInterval ret) throws SVNClientException {
    SVNRevision currStartRevision = ret.startRevision;
    SVNRevision currEndRevision = ret.endRevision;

    if(currStartRevision.equals(SVNRevision.HEAD)) {
        ISVNInfo info = client.getInfo(repository);
        currStartRevision = info.getRevision();
    }

    long currStartRevNum = Long.parseLong(currStartRevision.toString());
    long newStartRevNum = (currStartRevNum > 0) ? currStartRevNum - 1
                                                : currStartRevNum;

    return new RevertModifications.RevisionInterval(
                                     new SVNRevision.Number(newStartRevNum),
                                     currEndRevision);
}
 
Example #11
Source File: PropertiesClient.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private File getPropertyFile(boolean base) throws SVNClientException {
    SvnClient client = Subversion.getInstance().getClient(false);
    ISVNInfo info = null;
    try {
        info = SvnUtils.getInfoFromWorkingCopy(client, file);
    } catch (SVNClientException ex) {
        throw ex;
    }
    if(info instanceof ParserSvnInfo) {
        if(base) {
            return ((ParserSvnInfo) info).getBasePropertyFile();
        } else {
            return ((ParserSvnInfo) info).getPropertyFile();
        }
    } else {
        return SvnWcUtils.getPropertiesFile(file, base);
    }
}
 
Example #12
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 #13
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 #14
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 #15
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 #16
Source File: AbstractJhlClientAdapter.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public ISVNInfo getInfoFromWorkingCopy(File path) throws SVNClientException {
	try {
		notificationHandler.setCommand(ISVNNotifyListener.Command.INFO);

		String target = fileToSVNPath(path, false);
		notificationHandler.logCommandLine("info " + target);
		notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
		JhlInfoCallback callback = new JhlInfoCallback();

		svnClient.info2(target, null, null, Depth.empty, null, callback);
		ISVNInfo[] items = callback.getInfo();
		if (items == null) {
			return new SVNInfoUnversioned(path);
		}
		return items[0];
	} catch (ClientException e) {
		// upgradeProject(path);
		if (e.getAprError() == ErrorCodes.wcNotDirectory
				|| e.getAprError() == ErrorCodes.wcPathNotFound) {
			return new SVNInfoUnversioned(path);
		} else {
			notificationHandler.logException(e);
			throw new SVNClientException(e);
		}
	}
}
 
Example #17
Source File: BlameTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void blameNullAuthor(Annotator annotator) throws Exception {                                
    
    File file = createFile("file");
    add(file);
    commit(file);
    
    // 1. line
    write(file, "a\n");
    anoncommit(file);
    ISVNInfo info = getInfo(file);
    Number rev1 = info.getRevision();

    ISVNAnnotations a1 = annotator.annotate(getNbClient(), file, null, null);
    
    // test 
    assertEquals(1, a1.numberOfLines());        
    assertEquals("a", a1.getLine(0));        
    assertNull(a1.getAuthor(0));
    // assertNull(a.getChanged(0)); is null only for svnClientAdapter
    assertEquals(rev1.getNumber(), a1.getRevision(0));
}
 
Example #18
Source File: ImportTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testImportFile(String fileToImport, String lastUrlPart) throws Exception {
    File file = createFile(fileToImport);
            
    assertTrue(file.exists());
    
    ISVNClientAdapter c = getNbClient();
    SVNUrl url = getRepoUrl().appendPath(getName()).appendPath(lastUrlPart);
    c.doImport(file, url, "imprd", false);

    assertTrue(file.exists());
    assertStatus(SVNStatusKind.UNVERSIONED, file);

    ISVNInfo info = getInfo(url);
    assertNotNull(info);        
    assertEquals(url.toString(), TestUtilities.decode(info.getUrl()).toString());
    assertNotifiedFiles(new File[] {file});    // XXX empty also in svnCA - why?! - no output from cli    
}
 
Example #19
Source File: AbstractJhlClientAdapter.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public ISVNInfo getInfo(SVNUrl url, SVNRevision revision, SVNRevision peg)
		throws SVNClientException {
	notificationHandler.setCommand(ISVNNotifyListener.Command.INFO);
	String target = url.toString();
	notificationHandler.logCommandLine("info " + target);
	// notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(url));
	JhlInfoCallback callback = new JhlInfoCallback();

	try {
		svnClient.info2(target, JhlConverter.convert(revision),
				JhlConverter.convert(peg), Depth.empty, null, callback);
	} catch (ClientException e) {
		// e.printStackTrace();
	}
	ISVNInfo[] items = callback.getInfo();
	if (items == null || items.length == 0) {
		return new SVNInfoUnversioned(null);
	} else {
		return items[0];
	}
}
 
Example #20
Source File: ImportTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testImportFolder() throws Exception {                                        
    File folder = createFolder("folder");
            
    assertTrue(folder.exists());
    
    ISVNClientAdapter c = getNbClient();
    SVNUrl url = getTestUrl().appendPath(getName()); 
    c.mkdir(url, "mrkvadir");        
    url = url.appendPath(folder.getName());
    c.mkdir(url, "mrkvadir");        
    c.doImport(folder, url, "imprd", false);

    assertTrue(folder.exists());
    assertStatus(SVNStatusKind.UNVERSIONED, folder);
    
    ISVNInfo info = getInfo(url);
    assertNotNull(info);        
    assertEquals(url.toString(), TestUtilities.decode(info.getUrl()).toString());
    assertNotifiedFiles(new File[] {});        // XXX empty also in svnCA - why?! - no output from cli
}
 
Example #21
Source File: AbstractJhlClientAdapter.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public ISVNInfo getInfo(File path) throws SVNClientException {
	try {
		notificationHandler.setCommand(ISVNNotifyListener.Command.INFO);

		String target = fileToSVNPath(path, false);
		notificationHandler.logCommandLine("info " + target);
		notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));

		JhlInfoCallback callback = new JhlInfoCallback();

		svnClient.info2(target, Revision.WORKING, Revision.BASE,
				Depth.infinity, null, callback);
		ISVNInfo[] items = callback.getInfo();
		if (items == null || items.length == 0) {
			return new SVNInfoUnversioned(path);
		} else {
			return items[0];
		}

	} catch (ClientException e) {
		if (e.getAprError() == ErrorCodes.wcNotDirectory
				|| e.getAprError() == ErrorCodes.wcPathNotFound) {
			return new SVNInfoUnversioned(path);
		} else {
			notificationHandler.logException(e);
			throw new SVNClientException(e);
		}
	}
}
 
Example #22
Source File: SVNLocalCompareInput.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @throws SVNException
 * creates a SVNLocalCompareInput, allows setting whether the current local resource is read only or not.
 */
public SVNLocalCompareInput(ISVNLocalResource resource, SVNRevision revision, boolean readOnly) throws SVNException, SVNClientException {
	super(new CompareConfiguration());
       this.remoteRevision = revision;
       this.readOnly = readOnly;
       this.resource = resource;
       
       LocalResourceStatus status = resource.getStatus();
       if (status != null && status.isCopied()) {
       	ISVNClientAdapter svnClient = null;
       	try {
        	svnClient = resource.getRepository().getSVNClient();
        	ISVNInfo info = svnClient.getInfoFromWorkingCopy(resource.getFile());
        	SVNUrl copiedFromUrl = info.getCopyUrl();
        	if (copiedFromUrl != null) {
        		GetRemoteResourceCommand getRemoteResourceCommand = new GetRemoteResourceCommand(resource.getRepository(), copiedFromUrl, SVNRevision.HEAD);
        		getRemoteResourceCommand.run(null);
        		this.remoteResource = getRemoteResourceCommand.getRemoteResource();
        	}
       	}
       	finally {
       		resource.getRepository().returnSVNClient(svnClient);
       	}
       }
       
	// SVNRevision can be any valid revision : BASE, HEAD, number ...
	if (this.remoteResource == null) this.remoteResource = resource.getRemoteResource(revision);

       // remoteResouce can be null if there is no corresponding remote resource
       // (for example no base because resource has just been added)
}
 
Example #23
Source File: StatusCacheManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * The cached statuses do not provide revision numbers anymore.
 * This method is the only place how to query for the revision of the resource explicitely.
 * @param resource
 * @return
 * @throws SVNException
 */
public SVNRevision getResourceRevision(ISVNLocalResource resource) throws SVNException
{    
	if (resource == null) return null;
    GetInfoCommand command = new GetInfoCommand(resource);
    command.run(null);
    final ISVNInfo info = command.getInfo();

	return (info != null) ? info.getRevision() : null;
}
 
Example #24
Source File: CommitOperation.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private String getRootURL(ISVNLocalResource localResource) {
	if (!atomicCommit)
		return null;
	ISVNInfo info = getSVNInfo(localResource);
	if (info == null)
		return null;
	SVNUrl repos = info.getRepository();
	if (repos == null)
		return null;
   	return repos.toString();
}
 
Example #25
Source File: ApiTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testMkdir() throws SVNClientException, IOException {
    String url1 = TestUtilities.formatFileURL(repoDir) + "/foldertestMkdir";
    org.netbeans.modules.subversion.api.Subversion.mkdir(
            url1,
            "", "", "creating dir");
    ISVNInfo info = TestKit.getSVNInfo(url1);
    assertNotNull(info);

    String url2 = TestUtilities.formatFileURL(repoDir) + "/foldertestMkdir/foldertestMkdir2";
    org.netbeans.modules.subversion.api.Subversion.mkdir(
            url2,
            "", "", "creating dir");
    info = TestKit.getSVNInfo(url2);
    assertNotNull(info);
}
 
Example #26
Source File: AbstractCommandTestCase.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void assertInfos(ISVNInfo info, ISVNInfo refInfo) {
    assertNotNull(info);   
    assertNotNull(refInfo);   
    assertEquals(refInfo.getCopyRev(), info.getCopyRev());
    assertEquals(refInfo.getCopyUrl(), info.getCopyUrl());
    //assertEquals(refInfo.getFile(), info.getFile());
    assertEquals(DateFormat.getDateTimeInstance().format(refInfo.getLastChangedDate()), DateFormat.getDateTimeInstance().format(info.getLastChangedDate()));
    assertEquals(refInfo.getLastChangedRevision(), info.getLastChangedRevision());
    assertEquals(refInfo.getLastCommitAuthor(), info.getLastCommitAuthor());
    assertEquals(refInfo.getLastDatePropsUpdate(), info.getLastDatePropsUpdate());
    if (info.getLastDateTextUpdate() == null || refInfo.getLastDateTextUpdate() == null) {
        assertTrue("" + refInfo.getLastDateTextUpdate() + " --- " + info.getLastDateTextUpdate(), 
                (refInfo.getLastDateTextUpdate() == null || refInfo.getLastDateTextUpdate().getTime() == 0)
                && ((info.getLastDateTextUpdate() == null || info.getLastDateTextUpdate().getTime() == 0)));
    } else {
        assertEquals(refInfo.getLastDateTextUpdate(), info.getLastDateTextUpdate());
    }
    assertEquals(refInfo.getLockComment() != null ? refInfo.getLockComment().trim() : null, 
                 info.getLockComment() != null    ? info.getLockComment().trim()    : null);
    assertEquals(refInfo.getLockCreationDate(), info.getLockCreationDate());
    assertEquals(refInfo.getLockOwner(), info.getLockOwner());
    assertEquals(refInfo.getNodeKind(), info.getNodeKind());
    assertEquals(refInfo.getRepository(), info.getRepository());
    assertEquals(refInfo.getRevision(), info.getRevision());
    assertEquals(refInfo.getUrl(), info.getUrl());
    assertEquals(refInfo.getUrlString(), info.getUrlString());
    assertEquals(refInfo.getUuid(), info.getUuid());
}
 
Example #27
Source File: LogTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void assertLogMessage(ISVNInfo info, ISVNLogMessage logsNb, String msg, ISVNLogMessageChangePath[] changePaths) {
    assertEquals(info.getLastCommitAuthor(), logsNb.getAuthor());
    assertEquals(info.getLastChangedDate().toString(), logsNb.getDate().toString());
    assertEquals(msg, logsNb.getMessage());
    assertEquals(info.getRevision(), logsNb.getRevision());
    assertChangePaths(changePaths, logsNb.getChangedPaths());
}
 
Example #28
Source File: LogTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void logLimit(Log log) throws Exception {                                
    File file = createFile("file");
    add(file);
    write(file, "1");        
    commit(file, "msg1");
    ISVNInfo info1 = getInfo(file);        
    
    write(file, "2");
    commit(file, "msg2");
    ISVNInfo info2 = getInfo(file);
    
    write(file, "3");
    commit(file, "msg3");

    ISVNLogMessage[] logsNb = null;
    switch(log) {
        case file:
            logsNb = getNbClient().getLogMessages(file, new SVNRevision.Number(0), SVNRevision.HEAD, false, true, 2);
            break;
        case url:
            logsNb = getNbClient().getLogMessages(getFileUrl(file), null, new SVNRevision.Number(0), SVNRevision.HEAD, false, true, 2);
            break;
        default:
            fail("no idea!");
    }
    
    // test
    assertEquals(2, logsNb.length);         
    String testName = getName();        
    assertLogMessage(info1, logsNb[0], "msg1",  new ISVNLogMessageChangePath[] { new ChangePath('A', "/" + testName + "/" + testName + "_wc/file", null, null) });
    assertLogMessage(info2, logsNb[1], "msg2",  new ISVNLogMessageChangePath[] { new ChangePath('M', "/" + testName + "/" + testName + "_wc/file", null, null) });
}
 
Example #29
Source File: ImportTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testImportFolderRecursivelly() throws Exception {                                        
    File folder = createFolder("folder");
    File folder1 = createFolder(folder, "folder1");
    File file = createFile(folder1, "file");
            
    assertTrue(folder.exists());
    assertTrue(folder1.exists());
    assertTrue(file.exists());
    
    ISVNClientAdapter c = getNbClient();
    SVNUrl url = getTestUrl().appendPath(getName());
    c.mkdir(url, "mrkvadir");        
    url = url.appendPath(folder.getName());
    c.doImport(folder, url, "imprd", true);

    assertTrue(folder.exists());
    assertTrue(folder1.exists());
    assertTrue(file.exists());
    assertStatus(SVNStatusKind.UNVERSIONED, folder);
    assertStatus(SVNStatusKind.UNVERSIONED, folder1);
    assertStatus(SVNStatusKind.UNVERSIONED, file);
    
    ISVNInfo info = getInfo(url);
    assertNotNull(info);        
    assertEquals(url.toString(), TestUtilities.decode(info.getUrl()).toString());
    
    url = url.appendPath(folder1.getName());
    info = getInfo(url);
    assertNotNull(info);        
    assertEquals(url.toString(), TestUtilities.decode(info.getUrl()).toString());
    
    url = url.appendPath(file.getName());
    info = getInfo(url);        
    assertNotNull(info);        
    assertEquals(url.toString(), TestUtilities.decode(info.getUrl()).toString());
    assertNotifiedFiles(new File[] {folder1, file}); 
}
 
Example #30
Source File: ImportTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testImportFolderNonRecursivelly() throws Exception {                                        
    File folder = createFolder("folder");
    File folder1 = createFolder(folder, "folder1");
    File file = createFile(folder1, "file");
            
    assertTrue(folder.exists());
    assertTrue(folder1.exists());
    assertTrue(file.exists());
    
    ISVNClientAdapter c = getNbClient();
    SVNUrl url = getTestUrl().appendPath(getName());
    c.mkdir(url, "mrkvadir");        
    url = url.appendPath(folder.getName());
    c.mkdir(url, "mrkvadir");        
    c.doImport(folder, url, "imprd", false);

    assertTrue(folder.exists());
    assertTrue(folder1.exists());
    assertTrue(file.exists());
    assertStatus(SVNStatusKind.UNVERSIONED, folder);
    assertStatus(SVNStatusKind.UNVERSIONED, folder1);
    assertStatus(SVNStatusKind.UNVERSIONED, file);
    
    ISVNInfo info = getInfo(url);
    assertNotNull(info);        
    assertEquals(url.toString(), TestUtilities.decode(info.getUrl()).toString());
    
    SVNClientException ex = null;
    try {
        info = getInfo(url.appendPath(folder1.getName()));
    } catch (SVNClientException e) {
        ex = e;
    }
    assertNotNull(ex);
    assertNotifiedFiles(new File[] {});        // XXX empty also in svnCA - why?! - no output from cli
}