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

The following examples show how to use org.tigris.subversion.svnclientadapter.ISVNClientAdapter#revert() . 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: RevertTestHidden.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void testRevertFile(String filePath) throws Exception {
    createAndCommitParentFolders(filePath);
    File file = createFile(filePath);
    write(file, 1);
    add(file);
    commit(file);
    assertStatus(SVNStatusKind.NORMAL, file);
    write(file, 2);
    assertStatus(SVNStatusKind.MODIFIED, file);
    
    ISVNClientAdapter c = getNbClient();        
    c.revert(file, false);

    assertStatus(SVNStatusKind.NORMAL, file);
    assertContents(file, 1);
    assertNotifiedFiles(new File[] {file});        
}
 
Example 2
Source File: RevertTestHidden.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testRevertFiles() throws Exception {                                                
    File file1 = createFile("file1");
    File file2 = createFile("file2");
    File file3 = createFile("file3");
    write(file1, 1);
    write(file2, 1);
    write(file3, 1);
    add(file1);
    add(file2);
    add(file3);
    commit(file1);
    commit(file2);
    commit(file3);
    
    assertStatus(SVNStatusKind.NORMAL, file1);
    assertStatus(SVNStatusKind.NORMAL, file2);
    assertStatus(SVNStatusKind.NORMAL, file3);
    
    write(file1, 2);
    write(file2, 2);
    write(file3, 2);
    
    assertStatus(SVNStatusKind.MODIFIED, file1);
    assertStatus(SVNStatusKind.MODIFIED, file2);
    assertStatus(SVNStatusKind.MODIFIED, file3);
    
    ISVNClientAdapter c = getNbClient();        
    for(File f : new File[] {file1, file2, file3}) {
        c.revert(f, false);
    }

    assertStatus(SVNStatusKind.NORMAL, file1);
    assertStatus(SVNStatusKind.NORMAL, file2);
    assertStatus(SVNStatusKind.NORMAL, file3);
    assertContents(file1, 1);
    assertContents(file2, 1);
    assertContents(file3, 1);
    assertNotifiedFiles(new File[] {file1, file2, file3});        
}
 
Example 3
Source File: RevertResourceManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Like revert on ISVNLocalFile but without updating the local history. Non
 * recursive revert for folders
 * 
 * @param resource
 * @throws SVNException
 */
private void revert(ISVNLocalResource resource) throws SVNException {
	ISVNClientAdapter svnClient = null;
    try {
        svnClient = resource.getRepository().getSVNClient();
        OperationManager.getInstance().beginOperation(svnClient);
        svnClient.revert(resource.getFile(), false);
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
    	resource.getRepository().returnSVNClient(svnClient);
        OperationManager.getInstance().endOperation();
    }
}
 
Example 4
Source File: RevertTestHidden.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void testRevertFolderRecursivelly(String folder1Name,
                                          String folder11Name) throws Exception {
    File folder1 = createFolder(folder1Name);
    File file11 = createFile(folder1, "file11");
    File folder11 = createFolder(folder1, folder11Name);
    File file111 = createFile(folder11, "file111");
    
    write(file11, 1);
    write(file111, 1);        
    add(folder1);
    add(file11);
    add(folder11);
    add(file111);
    commit(folder1);
    commit(file11);
    commit(folder11);
    commit(file111);
    
    assertStatus(SVNStatusKind.NORMAL, folder1);
    assertStatus(SVNStatusKind.NORMAL, file11);
    assertStatus(SVNStatusKind.NORMAL, folder11);
    assertStatus(SVNStatusKind.NORMAL, file111);
    
    write(file11, 2);
    write(file111, 2);
    
    assertStatus(SVNStatusKind.MODIFIED, file11);
    assertStatus(SVNStatusKind.MODIFIED, file111);        
    
    ISVNClientAdapter c = getNbClient();        
    for(File f : new File[] {folder1}) {
        c.revert(f, true);
    }

    assertStatus(SVNStatusKind.NORMAL, file11);
    assertStatus(SVNStatusKind.NORMAL, file111);
    assertStatus(SVNStatusKind.NORMAL, folder1);
    assertStatus(SVNStatusKind.NORMAL, folder11);
    assertContents(file11, 1);
    assertContents(file111, 1);        
    assertNotifiedFiles(new File[] {file11, file111});       // only files were reverted (modified) 
}
 
Example 5
Source File: RevertTestHidden.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void testRevertFolderNonRecursivelly(String folder1Name,
                                             String folder11Name) throws Exception {
    File folder1 = createFolder(folder1Name);
    File file11 = createFile(folder1, "file11");
    File folder11 = createFolder(folder1, folder11Name);
    File file111 = createFile(folder11, "file111");
    
    write(file11, 1);
    write(file111, 1);        
    add(folder1);
    add(file11);
    add(folder11);
    add(file111);
    commit(folder1);
    commit(file11);
    commit(folder11);
    commit(file111);
    
    assertStatus(SVNStatusKind.NORMAL, folder1);
    assertStatus(SVNStatusKind.NORMAL, file11);
    assertStatus(SVNStatusKind.NORMAL, folder11);
    assertStatus(SVNStatusKind.NORMAL, file111);
    
    write(file11, 2);
    write(file111, 2);
    
    assertStatus(SVNStatusKind.MODIFIED, file11);
    assertStatus(SVNStatusKind.MODIFIED, file111);        
    
    ISVNClientAdapter c = getNbClient();        
    for(File f : new File[] {folder1}) {
        c.revert(f, true);
    }

    assertStatus(SVNStatusKind.NORMAL, file11);
    assertStatus(SVNStatusKind.NORMAL, file111);
    assertStatus(SVNStatusKind.NORMAL, folder1);
    assertStatus(SVNStatusKind.NORMAL, folder11);
    assertContents(file11, 1);
    assertContents(file111, 1);        
    assertNotifiedFiles(new File[] {file11, file111}); // only files were reverted (modified)       
}
 
Example 6
Source File: RevertTestHidden.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void testRevertFolders() throws Exception {                                                
    File folder1 = createFolder("folder1");
    File file1 = createFile(folder1, "file11");
    
    File folder2 = createFolder("folder11");
    File file2 = createFile(folder2, "file111");
    
    write(file1, 1);
    write(file2, 1);        
    add(folder1);
    add(file1);
    add(folder2);
    add(file2);
    commit(folder1);
    commit(file1);
    commit(folder2);
    commit(file2);
    
    assertStatus(SVNStatusKind.NORMAL, folder1);
    assertStatus(SVNStatusKind.NORMAL, file1);
    assertStatus(SVNStatusKind.NORMAL, folder2);
    assertStatus(SVNStatusKind.NORMAL, file1);
    
    write(file1, 2);
    write(file2, 2);
    
    assertStatus(SVNStatusKind.MODIFIED, file1);
    assertStatus(SVNStatusKind.MODIFIED, file2);        
    
    ISVNClientAdapter c = getNbClient();        
    for(File f : new File[] {folder1, folder2}) {
        c.revert(f, true);
    }

    assertStatus(SVNStatusKind.NORMAL, file1);
    assertStatus(SVNStatusKind.NORMAL, file2);
    assertStatus(SVNStatusKind.NORMAL, folder1);
    assertStatus(SVNStatusKind.NORMAL, folder2);
    assertContents(file1, 1);
    assertContents(file2, 1);        
    assertNotifiedFiles(new File[] {file1, file2});  // only files were reverted (modified)      
}