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

The following examples show how to use org.tigris.subversion.svnclientadapter.ISVNClientAdapter#addDirectory() . 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: AbstractSvnTestCase.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void importFile(File folder) throws SVNClientException {
    ISVNClientAdapter client = getFullWorkingClient();
    SVNUrl url = getTestUrl().appendPath(folder.getName());        
    client.mkdir(url, true, "msg");
    client.checkout(url, folder, SVNRevision.HEAD, true);        
    File[] files = folder.listFiles();
    if(files != null) {
        for (File file : files) {
            if(!isMetadata(file)) {
                if (file.isDirectory()) {
                    client.addDirectory(file, true);
                } else {
                    client.addFile(file);
                }
            }
        }
        client.commit(new File[] {folder}, "commit", true);                    
    }        
}
 
Example 2
Source File: AddTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testAddAddedFolder() throws Exception {
    File folder = createFolder("folder");

    assertStatus(SVNStatusKind.UNVERSIONED, folder);
    ISVNClientAdapter c = getNbClient();
    c.addDirectory(folder, false);
    assertStatus(SVNStatusKind.ADDED, folder);

    try {
        c.addDirectory(folder, false);
        fail("cmd client cannot throw the exception");
    } catch (SVNClientException ex) {
    }
    assertStatus(SVNStatusKind.ADDED, folder);

    assertNotifiedFiles(new File[] { folder });
}
 
Example 3
Source File: AddTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testAddNoDirectory() throws Exception {
    File file = new File(getWC(), "fail");

    assertStatus(SVNStatusKind.NONE, file);

    SVNClientException e = null;
    try {
        ISVNClientAdapter c = getNbClient();
        c.addDirectory(file, false);
    } catch (SVNClientException ex) {
        e = ex;
    }
    if (isJavahl()) {
        assertNotNull(e);
        assertTrue(e.getMessage().indexOf("is not a working copy") > -1 || e.getMessage().indexOf("not found") > -1);
    }

    assertNotifiedFiles(new File[] {});
}
 
Example 4
Source File: DifferentWorkingDirsTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testDifferentWorkingDirs1() throws Exception {
    File folder1 = createFolder("folder1");
    File folder11 = createFolder(folder1, "folder11");
    File folder12 = createFolder(folder1, "folder12");

    File folder2 = createFolder("folder2");
    File folder21 = createFolder(folder2,"folder2");
    File folder211 = createFolder(folder21,"folder2");
    File folder2111 = createFolder(folder211,"folder2");

    ISVNClientAdapter c = getNbClient();
    for(File f : new File[] {folder1, folder11, folder12, folder2, folder21, folder211, folder2111}) {
        c.addDirectory(f, false);
    }

    c.commit(new File[] {folder1, folder11, folder12, folder2, folder21, folder211, folder2111}, "msg", false);

    assertNotifiedFiles(new File[] {folder1, folder11, folder12, folder2, folder21, folder211, folder2111});
}
 
Example 5
Source File: AddTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testAddFileNonRecursivelly() throws Exception {
    File folder = createFolder("folder");
    File file = createFile(folder, "file");

    assertStatus(SVNStatusKind.UNVERSIONED, file);
    assertStatus(SVNStatusKind.UNVERSIONED, folder);

    ISVNClientAdapter c = getNbClient();
    c.addDirectory(folder, false);

    assertStatus(SVNStatusKind.ADDED, folder);
    assertStatus(SVNStatusKind.UNVERSIONED, file);

    assertNotifiedFiles(folder);
}
 
Example 6
Source File: AddTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testAddDirectory() throws Exception {
    File folder = createFolder("folder");

    assertStatus(SVNStatusKind.UNVERSIONED, folder);
    ISVNClientAdapter c = getNbClient();
    c.addDirectory(folder, false);
    assertStatus(SVNStatusKind.ADDED, folder);

    assertNotifiedFiles(folder);
}
 
Example 7
Source File: AddTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testAddFolderRecursivelly() throws Exception {
    File folder = createFolder("folder");
    File file = createFolder(folder, "folder");

    assertStatus(SVNStatusKind.UNVERSIONED, file);
    assertStatus(SVNStatusKind.UNVERSIONED, folder);

    ISVNClientAdapter c = getNbClient();
    c.addDirectory(folder, true);

    assertStatus(SVNStatusKind.ADDED, folder);
    assertStatus(SVNStatusKind.ADDED, file);

    assertNotifiedFiles(new File[] {folder, file});
}
 
Example 8
Source File: AddTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testAddFolderRecursivellyForced() throws Exception {
    File parentFolder = createFolder("folder");
    File folder = createFolder(parentFolder, "folder");

    assertStatus(SVNStatusKind.UNVERSIONED, parentFolder);
    assertStatus(SVNStatusKind.UNVERSIONED, folder);

    ISVNClientAdapter c = getNbClient();
    c.addDirectory(parentFolder, true, true);

    assertStatus(SVNStatusKind.ADDED, parentFolder);
    assertStatus(SVNStatusKind.ADDED, folder);

    assertNotifiedFiles(new File[] { parentFolder, folder });
}
 
Example 9
Source File: AddTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testAddFolderNonRecursivelly() throws Exception {
    File parentFolder = createFolder("folder");
    File folder = createFolder(parentFolder, "file");

    assertStatus(SVNStatusKind.UNVERSIONED, parentFolder);
    assertStatus(SVNStatusKind.UNVERSIONED, folder);

    ISVNClientAdapter c = getNbClient();
    c.addDirectory(parentFolder, false);

    assertStatus(SVNStatusKind.ADDED, parentFolder);
    assertStatus(SVNStatusKind.UNVERSIONED, folder);

    assertNotifiedFiles(parentFolder );
}
 
Example 10
Source File: SVNTeamProviderType.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask(null, IProgressMonitor.UNKNOWN);
SVNProviderPlugin plugin = SVNProviderPlugin.getPlugin();
SVNClientManager svnClientManager = plugin.getSVNClientManager();
ISVNClientAdapter client = null;
try{
	
	if (plugin == null || plugin.getSimpleDialogsHelper() == null){
		if (++reschedCount > MAX_RETRIES){
			String errorString = "Subclipse core and/or ui didn't come up in " + MAX_RETRIES + " retries, failing.";  //$NON-NLS-1$
			System.err.println(errorString); // Let it be visible to the user
			throw new SVNException(errorString);
		}
		schedule(1000);
		return Status.OK_STATUS;
	}
	
	if (!plugin.getSimpleDialogsHelper().promptYesNo(
			"Auto-add "+project.getName()+" to source control", //$NON-NLS-1$
			  "The new project \""+ project.getName() +"\" was created in a subversion " + //$NON-NLS-1$
			  "controlled directory.\n\n" + //$NON-NLS-1$
			  "Would you like to automatically add it to source control?", true)) { //$NON-NLS-1$

		return Status.OK_STATUS;
	}
			
	client = svnClientManager.getSVNClient();

	File file = project.getLocation().toFile();
	client.addDirectory(file, false);

	RepositoryProvider.map(project, SVNProviderPlugin.getTypeId());
	plugin.getStatusCacheManager().refreshStatus(project,
			true);
	
}catch(Exception e){
             SVNProviderPlugin.log(IStatus.ERROR, "Could not auto-add project " + project.getName(), e); //$NON-NLS-1$
	return Status.CANCEL_STATUS;
}finally{
	monitor.done();
	svnClientManager.returnSVNClient(client);
}
return Status.OK_STATUS;
     }